Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
feat: Improve ESM packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
obany committed Jan 10, 2022
1 parent 187aa0a commit dab26a9
Show file tree
Hide file tree
Showing 59 changed files with 1,970 additions and 15,417 deletions.
3,724 changes: 1,679 additions & 2,045 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/workspaces",
"description": "IOTA JavaScript Library",
"version": "1.8.2",
"version": "1.8.5",
"keywords": [
"iota"
],
Expand Down
4 changes: 4 additions & 0 deletions packages/crypto/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.5

* New ESM Packaging

## v1.8.2

* Add SHA1, HMACSHA1
Expand Down
2 changes: 2 additions & 0 deletions packages/crypto/esm-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ async function processDir(dir) {
content = content.replace(/import(.*)\"\.(.*)\";/g, 'import$1".$2.mjs";');
content = content.replace(/export(.*)\"\.(.*)\";/g, 'export$1".$2.mjs";');

content = content.replace(/require\("(.*)"\);/g, '(await import("$1")).default;');

const sourceMapUrlRegexp = new RegExp("//# sourceMappingURL=data:application/json;base64,(.*)");
content = content.replace(sourceMapUrlRegexp, "");
await fs.writeFile(fullEntry, content, "utf-8");
Expand Down
32 changes: 16 additions & 16 deletions packages/crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/crypto.js",
"description": "IOTA JavaScript Cryptography Library",
"version": "1.8.2",
"version": "1.8.5",
"keywords": [
"iota",
"client"
Expand All @@ -17,7 +17,7 @@
"license": "Apache-2.0",
"dependencies": {
"big-integer": "^1.6.51",
"@iota/util.js": "^1.8.2"
"@iota/util.js": "^1.8.5"
},
"scripts": {
"build-clean": "rimraf ./es/* ./typings/*",
Expand Down Expand Up @@ -47,28 +47,28 @@
},
"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@rollup/plugin-replace": "^3.0.0",
"@types/jest": "^27.0.3",
"@typescript-eslint/eslint-plugin": "5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^3.0.1",
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"eslint": "^8.3.0",
"eslint": "^8.6.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^37.1.0",
"eslint-plugin-unicorn": "^39.0.0",
"jest": "^27.4.2",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsdoc": "^37.6.1",
"eslint-plugin-unicorn": "^40.0.0",
"jest": "^27.4.7",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"rollup": "^2.60.2",
"rollup": "^2.63.0",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^27.0.7",
"ts-jest": "^27.1.2",
"ts-node": "^10.4.0",
"typedoc": "^0.22.10",
"typedoc-plugin-markdown": "^3.11.7",
"typescript": "^4.5.2"
"typedoc-plugin-markdown": "^3.11.11",
"typescript": "^4.5.4"
},
"main": "dist/cjs/index-node.js",
"browser": "dist/cjs/index-browser.js",
Expand Down
2 changes: 0 additions & 2 deletions packages/crypto/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { terser } from "rollup-plugin-terser";

const plugins = [
replace({
"PlatformHelper.isNodeJs": !process.env.BROWSER,
"globalThis && globalThis.process && globalThis.process.version": !process.env.BROWSER,
preventAssignment: true
}),
commonjs(),
Expand Down
4 changes: 4 additions & 0 deletions packages/iota/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.5

* New ESM Packaging

## v1.8.4

* Removed isFirst flag from address generators.
Expand Down
2 changes: 1 addition & 1 deletion packages/iota/dist/esm/polyfill-node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
// Fetch
if (globalThis && !globalThis.fetch) {
// eslint-disable-next-line @typescript-eslint/no-require-imports
globalThis.fetch = require("node-fetch");
globalThis.fetch = (await import("node-fetch")).default;
}
2 changes: 2 additions & 0 deletions packages/iota/esm-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ async function processDir(dir) {
content = content.replace(/import(.*)\"\.(.*)\";/g, 'import$1".$2.mjs";');
content = content.replace(/export(.*)\"\.(.*)\";/g, 'export$1".$2.mjs";');

content = content.replace(/require\("(.*)"\);/g, '(await import("$1")).default;');

const sourceMapUrlRegexp = new RegExp("//# sourceMappingURL=data:application/json;base64,(.*)");
content = content.replace(sourceMapUrlRegexp, "");
await fs.writeFile(fullEntry, content, "utf-8");
Expand Down
34 changes: 17 additions & 17 deletions packages/iota/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/iota.js",
"description": "IOTA JavaScript Library",
"version": "1.8.4",
"version": "1.8.5",
"keywords": [
"iota",
"client"
Expand All @@ -18,8 +18,8 @@
"dependencies": {
"big-integer": "^1.6.51",
"node-fetch": "2.6.6",
"@iota/util.js": "^1.8.2",
"@iota/crypto.js": "^1.8.2"
"@iota/util.js": "^1.8.5",
"@iota/crypto.js": "^1.8.5"
},
"scripts": {
"build-clean": "rimraf ./es/* ./typings/*",
Expand Down Expand Up @@ -49,29 +49,29 @@
},
"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@rollup/plugin-replace": "^3.0.0",
"@types/jest": "^27.0.3",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^3.0.1",
"@types/jest": "^27.4.0",
"@types/node-fetch": "2.5.12",
"@typescript-eslint/eslint-plugin": "5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@typescript-eslint/eslint-plugin": "5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"eslint": "^8.3.0",
"eslint": "^8.6.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^37.1.0",
"eslint-plugin-unicorn": "^39.0.0",
"jest": "^27.4.2",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsdoc": "^37.6.1",
"eslint-plugin-unicorn": "^40.0.0",
"jest": "^27.4.7",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"rollup": "^2.60.2",
"rollup": "^2.63.0",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^27.0.7",
"ts-jest": "^27.1.2",
"ts-node": "^10.4.0",
"typedoc": "^0.22.10",
"typedoc-plugin-markdown": "^3.11.7",
"typescript": "^4.5.2"
"typedoc-plugin-markdown": "^3.11.11",
"typescript": "^4.5.4"
},
"main": "dist/cjs/index-node.js",
"browser": "dist/cjs/index-browser.js",
Expand Down
2 changes: 0 additions & 2 deletions packages/iota/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { terser } from "rollup-plugin-terser";

const plugins = [
replace({
"PlatformHelper.isNodeJs": !process.env.BROWSER,
"globalThis && globalThis.process && globalThis.process.version": !process.env.BROWSER,
preventAssignment: true
}),
commonjs(),
Expand Down
4 changes: 4 additions & 0 deletions packages/mqtt/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.5

* New ESM Packaging

## v1.8.2

* Fix es module files in dist
Expand Down
2 changes: 2 additions & 0 deletions packages/mqtt/esm-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ async function processDir(dir) {
content = content.replace(/import(.*)\"\.(.*)\";/g, 'import$1".$2.mjs";');
content = content.replace(/export(.*)\"\.(.*)\";/g, 'export$1".$2.mjs";');

content = content.replace(/require\("(.*)"\);/g, '(await import("$1")).default;');

const sourceMapUrlRegexp = new RegExp("//# sourceMappingURL=data:application/json;base64,(.*)");
content = content.replace(sourceMapUrlRegexp, "");
await fs.writeFile(fullEntry, content, "utf-8");
Expand Down
36 changes: 18 additions & 18 deletions packages/mqtt/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/mqtt.js",
"description": "IOTA JavaScript Library for Adding MQTT support",
"version": "1.8.2",
"version": "1.8.5",
"keywords": [
"iota",
"mqtt"
Expand Down Expand Up @@ -40,26 +40,26 @@
},
"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@rollup/plugin-replace": "^3.0.0",
"@types/jest": "^27.0.3",
"@types/ws": "^8.2.1",
"@typescript-eslint/eslint-plugin": "5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^3.0.1",
"@types/jest": "^27.4.0",
"@types/ws": "^8.2.2",
"@typescript-eslint/eslint-plugin": "5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"cross-env": "^7.0.3",
"eslint": "^8.3.0",
"eslint": "^8.6.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^37.1.0",
"eslint-plugin-unicorn": "^39.0.0",
"jest": "^27.4.2",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsdoc": "^37.6.1",
"eslint-plugin-unicorn": "^40.0.0",
"jest": "^27.4.7",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"rollup": "^2.60.2",
"rollup": "^2.63.0",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^27.0.7",
"ts-jest": "^27.1.2",
"ts-node": "^10.4.0",
"typescript": "^4.5.2"
"typescript": "^4.5.4"
},
"main": "dist/cjs/index-node.js",
"browser": "dist/cjs/index-browser.js",
Expand All @@ -84,8 +84,8 @@
"typings"
],
"dependencies": {
"@iota/util.js": "^1.8.2",
"@iota/iota.js": "^1.8.4",
"mqtt": "^4.2.8"
"@iota/util.js": "^1.8.5",
"@iota/iota.js": "^1.8.5",
"mqtt": "^4.3.4"
}
}
4 changes: 4 additions & 0 deletions packages/pow-neon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.5

* New ESM Packaging

## v1.8.2

* Dependency Update
Expand Down
30 changes: 15 additions & 15 deletions packages/pow-neon/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/pow-neon.js",
"description": "IOTA JavaScript Library for Performing Multi-Threaded PoW on NodeJS",
"version": "1.8.2",
"version": "1.8.5",
"keywords": [
"iota",
"pow"
Expand Down Expand Up @@ -39,27 +39,27 @@
},
"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@rollup/plugin-replace": "^3.0.0",
"@types/jest": "^27.0.3",
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^3.0.1",
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"eslint": "^8.3.0",
"eslint": "^8.6.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^37.1.0",
"eslint-plugin-unicorn": "^39.0.0",
"jest": "^27.4.2",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsdoc": "^37.6.1",
"eslint-plugin-unicorn": "^40.0.0",
"jest": "^27.4.7",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"rollup": "^2.60.2",
"rollup": "^2.63.0",
"rollup-plugin-natives": "^0.7.5",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^27.0.7",
"ts-jest": "^27.1.2",
"ts-node": "^10.4.0",
"typescript": "^4.5.2"
"typescript": "^4.5.4"
},
"main": "dist/pow-neon.js",
"module": "es/pow-neon.js",
Expand All @@ -79,7 +79,7 @@
"copy-dist.js"
],
"dependencies": {
"@iota/iota.js": "^1.8.4",
"@iota/iota.js": "^1.8.5",
"neon-cli": "^0.9.1"
}
}
4 changes: 4 additions & 0 deletions packages/pow-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.5

* New ESM Packaging

## v1.8.2

* Dependency Update
Expand Down
Loading

0 comments on commit dab26a9

Please sign in to comment.