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

Commit dab26a9

Browse files
committed
feat: Improve ESM packaging
1 parent 187aa0a commit dab26a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1970
-15417
lines changed

package-lock.json

Lines changed: 1679 additions & 2045 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@iota/workspaces",
33
"description": "IOTA JavaScript Library",
4-
"version": "1.8.2",
4+
"version": "1.8.5",
55
"keywords": [
66
"iota"
77
],

packages/crypto/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v1.8.5
4+
5+
* New ESM Packaging
6+
37
## v1.8.2
48

59
* Add SHA1, HMACSHA1

packages/crypto/esm-modules.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ async function processDir(dir) {
2121
content = content.replace(/import(.*)\"\.(.*)\";/g, 'import$1".$2.mjs";');
2222
content = content.replace(/export(.*)\"\.(.*)\";/g, 'export$1".$2.mjs";');
2323

24+
content = content.replace(/require\("(.*)"\);/g, '(await import("$1")).default;');
25+
2426
const sourceMapUrlRegexp = new RegExp("//# sourceMappingURL=data:application/json;base64,(.*)");
2527
content = content.replace(sourceMapUrlRegexp, "");
2628
await fs.writeFile(fullEntry, content, "utf-8");

packages/crypto/package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@iota/crypto.js",
33
"description": "IOTA JavaScript Cryptography Library",
4-
"version": "1.8.2",
4+
"version": "1.8.5",
55
"keywords": [
66
"iota",
77
"client"
@@ -17,7 +17,7 @@
1717
"license": "Apache-2.0",
1818
"dependencies": {
1919
"big-integer": "^1.6.51",
20-
"@iota/util.js": "^1.8.2"
20+
"@iota/util.js": "^1.8.5"
2121
},
2222
"scripts": {
2323
"build-clean": "rimraf ./es/* ./typings/*",
@@ -47,28 +47,28 @@
4747
},
4848
"devDependencies": {
4949
"@rollup/plugin-commonjs": "^21.0.1",
50-
"@rollup/plugin-node-resolve": "^13.0.6",
51-
"@rollup/plugin-replace": "^3.0.0",
52-
"@types/jest": "^27.0.3",
53-
"@typescript-eslint/eslint-plugin": "5.5.0",
54-
"@typescript-eslint/parser": "^5.5.0",
50+
"@rollup/plugin-node-resolve": "^13.1.3",
51+
"@rollup/plugin-replace": "^3.0.1",
52+
"@types/jest": "^27.4.0",
53+
"@typescript-eslint/eslint-plugin": "5.9.0",
54+
"@typescript-eslint/parser": "^5.9.0",
5555
"copyfiles": "^2.4.1",
5656
"cross-env": "^7.0.3",
57-
"eslint": "^8.3.0",
57+
"eslint": "^8.6.0",
5858
"eslint-plugin-header": "^3.1.1",
59-
"eslint-plugin-import": "^2.25.3",
60-
"eslint-plugin-jsdoc": "^37.1.0",
61-
"eslint-plugin-unicorn": "^39.0.0",
62-
"jest": "^27.4.2",
59+
"eslint-plugin-import": "^2.25.4",
60+
"eslint-plugin-jsdoc": "^37.6.1",
61+
"eslint-plugin-unicorn": "^40.0.0",
62+
"jest": "^27.4.7",
6363
"npm-run-all": "^4.1.5",
6464
"rimraf": "^3.0.2",
65-
"rollup": "^2.60.2",
65+
"rollup": "^2.63.0",
6666
"rollup-plugin-terser": "^7.0.2",
67-
"ts-jest": "^27.0.7",
67+
"ts-jest": "^27.1.2",
6868
"ts-node": "^10.4.0",
6969
"typedoc": "^0.22.10",
70-
"typedoc-plugin-markdown": "^3.11.7",
71-
"typescript": "^4.5.2"
70+
"typedoc-plugin-markdown": "^3.11.11",
71+
"typescript": "^4.5.4"
7272
},
7373
"main": "dist/cjs/index-node.js",
7474
"browser": "dist/cjs/index-browser.js",

packages/crypto/rollup.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { terser } from "rollup-plugin-terser";
55

66
const plugins = [
77
replace({
8-
"PlatformHelper.isNodeJs": !process.env.BROWSER,
9-
"globalThis && globalThis.process && globalThis.process.version": !process.env.BROWSER,
108
preventAssignment: true
119
}),
1210
commonjs(),

packages/iota/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v1.8.5
4+
5+
* New ESM Packaging
6+
37
## v1.8.4
48

59
* Removed isFirst flag from address generators.

packages/iota/dist/esm/polyfill-node.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
// Fetch
55
if (globalThis && !globalThis.fetch) {
66
// eslint-disable-next-line @typescript-eslint/no-require-imports
7-
globalThis.fetch = require("node-fetch");
7+
globalThis.fetch = (await import("node-fetch")).default;
88
}

packages/iota/esm-modules.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ async function processDir(dir) {
2121
content = content.replace(/import(.*)\"\.(.*)\";/g, 'import$1".$2.mjs";');
2222
content = content.replace(/export(.*)\"\.(.*)\";/g, 'export$1".$2.mjs";');
2323

24+
content = content.replace(/require\("(.*)"\);/g, '(await import("$1")).default;');
25+
2426
const sourceMapUrlRegexp = new RegExp("//# sourceMappingURL=data:application/json;base64,(.*)");
2527
content = content.replace(sourceMapUrlRegexp, "");
2628
await fs.writeFile(fullEntry, content, "utf-8");

packages/iota/package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@iota/iota.js",
33
"description": "IOTA JavaScript Library",
4-
"version": "1.8.4",
4+
"version": "1.8.5",
55
"keywords": [
66
"iota",
77
"client"
@@ -18,8 +18,8 @@
1818
"dependencies": {
1919
"big-integer": "^1.6.51",
2020
"node-fetch": "2.6.6",
21-
"@iota/util.js": "^1.8.2",
22-
"@iota/crypto.js": "^1.8.2"
21+
"@iota/util.js": "^1.8.5",
22+
"@iota/crypto.js": "^1.8.5"
2323
},
2424
"scripts": {
2525
"build-clean": "rimraf ./es/* ./typings/*",
@@ -49,29 +49,29 @@
4949
},
5050
"devDependencies": {
5151
"@rollup/plugin-commonjs": "^21.0.1",
52-
"@rollup/plugin-node-resolve": "^13.0.6",
53-
"@rollup/plugin-replace": "^3.0.0",
54-
"@types/jest": "^27.0.3",
52+
"@rollup/plugin-node-resolve": "^13.1.3",
53+
"@rollup/plugin-replace": "^3.0.1",
54+
"@types/jest": "^27.4.0",
5555
"@types/node-fetch": "2.5.12",
56-
"@typescript-eslint/eslint-plugin": "5.5.0",
57-
"@typescript-eslint/parser": "^5.5.0",
56+
"@typescript-eslint/eslint-plugin": "5.9.0",
57+
"@typescript-eslint/parser": "^5.9.0",
5858
"copyfiles": "^2.4.1",
5959
"cross-env": "^7.0.3",
60-
"eslint": "^8.3.0",
60+
"eslint": "^8.6.0",
6161
"eslint-plugin-header": "^3.1.1",
62-
"eslint-plugin-import": "^2.25.3",
63-
"eslint-plugin-jsdoc": "^37.1.0",
64-
"eslint-plugin-unicorn": "^39.0.0",
65-
"jest": "^27.4.2",
62+
"eslint-plugin-import": "^2.25.4",
63+
"eslint-plugin-jsdoc": "^37.6.1",
64+
"eslint-plugin-unicorn": "^40.0.0",
65+
"jest": "^27.4.7",
6666
"npm-run-all": "^4.1.5",
6767
"rimraf": "^3.0.2",
68-
"rollup": "^2.60.2",
68+
"rollup": "^2.63.0",
6969
"rollup-plugin-terser": "^7.0.2",
70-
"ts-jest": "^27.0.7",
70+
"ts-jest": "^27.1.2",
7171
"ts-node": "^10.4.0",
7272
"typedoc": "^0.22.10",
73-
"typedoc-plugin-markdown": "^3.11.7",
74-
"typescript": "^4.5.2"
73+
"typedoc-plugin-markdown": "^3.11.11",
74+
"typescript": "^4.5.4"
7575
},
7676
"main": "dist/cjs/index-node.js",
7777
"browser": "dist/cjs/index-browser.js",

0 commit comments

Comments
 (0)