From 85ce232fdc18119ba9339e237fd1e934b8fa6318 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Fri, 26 Jan 2024 16:32:43 -0500 Subject: [PATCH] Fix usage in Jest, drop *.module.js for just .mjs (files were nearly identical), don't include `"browser"` export map key, do include `"module"` export map key (to avoid dual package hazard). --- package.json | 2 +- packages/core/package.json | 4 ++-- packages/preact/package.json | 4 ++-- packages/react-transform/package.json | 3 ++- packages/react/auto/package.json | 4 ++-- packages/react/package.json | 6 +++--- packages/react/runtime/package.json | 4 ++-- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 1ea8b17d0..71fc75744 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "scripts": { "prebuild": "rimraf packages/core/dist/ packages/preact/dist", "build": "pnpm build:core && pnpm build:preact && pnpm build:react-runtime && pnpm build:react-auto && pnpm build:react && pnpm build:react-transform", - "_build": "microbundle --raw --globals @preact/signals-core=preactSignalsCore,preact/hooks=preactHooks,@preact/signals-react/runtime=reactSignalsRuntime", + "_build": "microbundle --format esm,cjs --raw --globals @preact/signals-core=preactSignalsCore,preact/hooks=preactHooks,@preact/signals-react/runtime=reactSignalsRuntime", "build:core": "pnpm _build --cwd packages/core && pnpm postbuild:core", "build:preact": "pnpm _build --cwd packages/preact && pnpm postbuild:preact", "build:react": "pnpm _build --cwd packages/react --external \"react,@preact/signals-react/runtime,@preact/signals-core\" && pnpm postbuild:react", diff --git a/packages/core/package.json b/packages/core/package.json index 462975df5..f3774c005 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -19,7 +19,7 @@ }, "amdName": "preactSignalsCore", "main": "dist/signals-core.js", - "module": "dist/signals-core.module.js", + "module": "dist/signals-core.mjs", "unpkg": "dist/signals-core.min.js", "types": "dist/signals-core.d.ts", "source": "src/index.ts", @@ -27,7 +27,7 @@ "exports": { ".": { "types": "./dist/signals-core.d.ts", - "browser": "./dist/signals-core.module.js", + "module": "./dist/signals-core.mjs", "import": "./dist/signals-core.mjs", "require": "./dist/signals-core.js" } diff --git a/packages/preact/package.json b/packages/preact/package.json index 2c32a9be5..8adccd547 100644 --- a/packages/preact/package.json +++ b/packages/preact/package.json @@ -20,14 +20,14 @@ }, "amdName": "preactSignals", "main": "dist/signals.js", - "module": "dist/signals.module.js", + "module": "dist/signals.mjs", "unpkg": "dist/signals.min.js", "types": "dist/signals.d.ts", "source": "src/index.ts", "exports": { ".": { "types": "./dist/signals.d.ts", - "browser": "./dist/signals.module.js", + "module": "./dist/signals.mjs", "import": "./dist/signals.mjs", "require": "./dist/signals.js" } diff --git a/packages/react-transform/package.json b/packages/react-transform/package.json index fad59937b..a905b186e 100644 --- a/packages/react-transform/package.json +++ b/packages/react-transform/package.json @@ -23,12 +23,13 @@ "url": "https://opencollective.com/preact" }, "main": "dist/signals-transform.js", - "module": "dist/signals-transform.module.js", + "module": "dist/signals-transform.mjs", "types": "dist/signals-transform.d.ts", "source": "src/index.ts", "exports": { ".": { "types": "./dist/signals-transform.d.ts", + "module": "./dist/signals-transform.mjs", "import": "./dist/signals-transform.mjs", "require": "./dist/signals-transform.js" } diff --git a/packages/react/auto/package.json b/packages/react/auto/package.json index fa473061a..57ea773e9 100644 --- a/packages/react/auto/package.json +++ b/packages/react/auto/package.json @@ -4,14 +4,14 @@ "private": true, "amdName": "reactSignalsAuto", "main": "dist/auto.js", - "module": "dist/auto.module.js", + "module": "dist/auto.mjs", "unpkg": "dist/auto.min.js", "types": "dist/index.d.ts", "mangle": "../../../mangle.json", "exports": { ".": { "types": "./dist/index.d.ts", - "browser": "./dist/auto.module.js", + "module": "./dist/auto.mjs", "import": "./dist/auto.mjs", "require": "./dist/auto.js" } diff --git a/packages/react/package.json b/packages/react/package.json index 65e29f2ea..24a0aef46 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -27,20 +27,20 @@ "exports": { ".": { "types": "./dist/signals.d.ts", - "browser": "./dist/signals.module.js", + "module": "./dist/signals.mjs", "import": "./dist/signals.mjs", "require": "./dist/signals.js" }, "./runtime": { "types": "./runtime/dist/index.d.ts", - "browser": "./runtime/dist/runtime.module.js", + "module": "./runtime/dist/runtime.mjs", "import": "./runtime/dist/runtime.mjs", "require": "./runtime/dist/runtime.js" }, "./runtime/package.json": "./runtime/package.json", "./auto": { "types": "./auto/dist/index.d.ts", - "browser": "./auto/dist/auto.module.js", + "module": "./auto/dist/auto.mjs", "import": "./auto/dist/auto.mjs", "require": "./auto/dist/auto.js" }, diff --git a/packages/react/runtime/package.json b/packages/react/runtime/package.json index de98164a0..504d3be94 100644 --- a/packages/react/runtime/package.json +++ b/packages/react/runtime/package.json @@ -4,7 +4,7 @@ "private": true, "amdName": "reactSignalsRuntime", "main": "dist/runtime.js", - "module": "dist/runtime.module.js", + "module": "dist/runtime.mjs", "unpkg": "dist/runtime.min.js", "types": "dist/index.d.ts", "source": "src/index.ts", @@ -12,7 +12,7 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "browser": "./dist/runtime.module.js", + "module": "./dist/runtime.mjs", "import": "./dist/runtime.mjs", "require": "./dist/runtime.js" }