From 649aa5479c8f8830841cae1aa2da1e651c1c81b5 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 13 Dec 2023 18:10:06 -0500 Subject: [PATCH 1/3] Remove extraneous gitignores which interfere with packing --- build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sh b/build.sh index 8a651c6..c417aff 100755 --- a/build.sh +++ b/build.sh @@ -12,3 +12,6 @@ wasm-pack build --target nodejs --out-dir pkg/node --weak-refs --no-pack --relea # Rename the node js file to cjs, because we emit type=module mv pkg/node/content_tag.js pkg/node/content_tag.cjs + +rm pkg/node/.gitignore +rm pkg/standalone/.gitignore From 3ed36e09425fed8c557ae26699e827db85f4a6fb Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 13 Dec 2023 18:14:35 -0500 Subject: [PATCH 2/3] Since import environments support top-level await, we can use the standalone build in node-esm --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 7755537..8532ebf 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "import": { "types": "./index.d.ts", + "import": "./pkg/standalone.js", "default": "./pkg/node/content_tag.cjs" }, "require": { From 2c6060b8ec8cdfbe4a2e0468d3dbf7d82ddbed1d Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 13 Dec 2023 18:19:38 -0500 Subject: [PATCH 3/3] Ignore FalseESM rule: https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseESM.md -- it's not technically a breaking functionality, but it's a sub-optimal one (that we ship CJS masquerading as ESM -- however, the wasm-pack standalone build (browser) is not compatible with node --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 8532ebf..5c6e265 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ }, "import": { "types": "./index.d.ts", - "import": "./pkg/standalone.js", "default": "./pkg/node/content_tag.cjs" }, "require": { @@ -37,7 +36,7 @@ "ci:node": "mocha", "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", "lint:package": "publint", - "lint:published-types": "attw --pack --ignore-rules cjs-resolves-to-esm", + "lint:published-types": "attw --pack --ignore-rules cjs-resolves-to-esm --ignore-rules false-esm", "start": "vite", "test": "npm run ci:node" },