From 4b0b818c0f207bf53878978f6c9caa08d522fce1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 10:21:09 +0200 Subject: [PATCH 01/12] tsup the first renderer --- renderers/preact/package.json | 30 ++++++++++++++++++++++++++---- renderers/preact/preview.js | 2 +- yarn.lock | 1 + 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/renderers/preact/package.json b/renderers/preact/package.json index 073f07e240ee..625b941f2610 100644 --- a/renderers/preact/package.json +++ b/renderers/preact/package.json @@ -19,9 +19,26 @@ "url": "https://opencollective.com/storybook" }, "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./preview": { + "require": "./dist/config.js", + "import": "./dist/config.mjs", + "types": "./dist/config.d.ts" + }, + "./package.json": { + "require": "./package.json", + "import": "./package.json", + "types": "./package.json" + } + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "files": [ "dist/**/*", "README.md", @@ -29,7 +46,7 @@ "*.d.ts" ], "scripts": { - "prepare": "node ../../scripts/prepare.js" + "prepare": "esrun ../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.5", @@ -43,6 +60,7 @@ "ts-dedent": "^2.0.0" }, "devDependencies": { + "@digitak/esrun": "^3.2.2", "preact": "^10.5.13" }, "peerDependencies": { @@ -54,5 +72,9 @@ "publishConfig": { "access": "public" }, + "bundlerEntrypoint": [ + "./src/index.ts", + "./src/config.ts" + ], "gitHead": "3dd46982823b34d9f37be917b6247631081feff7" } diff --git a/renderers/preact/preview.js b/renderers/preact/preview.js index 0d73a0b695f1..fe48d8883ba4 100644 --- a/renderers/preact/preview.js +++ b/renderers/preact/preview.js @@ -1 +1 @@ -export * from './dist/esm/config'; +export * from './dist/config'; diff --git a/yarn.lock b/yarn.lock index 3efac7454b2b..52575bdfbb59 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8669,6 +8669,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/preact@workspace:renderers/preact" dependencies: + "@digitak/esrun": ^3.2.2 "@storybook/addons": 7.0.0-alpha.5 "@storybook/core-client": 7.0.0-alpha.5 "@storybook/csf": 0.0.2--canary.4566f4d.1 From e643a99d28efee5ae95b8c718c4f3fc01381f2bd Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 10:29:49 +0200 Subject: [PATCH 02/12] another one --- renderers/html/package.json | 32 ++++++++++++++++++++++++++++---- renderers/html/preview.js | 2 +- yarn.lock | 1 + 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/renderers/html/package.json b/renderers/html/package.json index 82db85661e04..17b1fb801400 100644 --- a/renderers/html/package.json +++ b/renderers/html/package.json @@ -19,9 +19,26 @@ "url": "https://opencollective.com/storybook" }, "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./preview": { + "require": "./dist/config.js", + "import": "./dist/config.mjs", + "types": "./dist/config.d.ts" + }, + "./package.json": { + "require": "./package.json", + "import": "./package.json", + "types": "./package.json" + } + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "files": [ "dist/**/*", "README.md", @@ -29,7 +46,7 @@ "*.d.ts" ], "scripts": { - "prepare": "node ../../scripts/prepare.js" + "prepare": "esrun ../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.5", @@ -44,6 +61,9 @@ "react-dom": "16.14.0", "ts-dedent": "^2.0.0" }, + "devDependencies": { + "@digitak/esrun": "^3.2.2" + }, "peerDependencies": { "@babel/core": "*" }, @@ -53,5 +73,9 @@ "publishConfig": { "access": "public" }, + "bundlerEntrypoint": [ + "./src/index.ts", + "./src/config.ts" + ], "gitHead": "3dd46982823b34d9f37be917b6247631081feff7" } diff --git a/renderers/html/preview.js b/renderers/html/preview.js index 0d73a0b695f1..fe48d8883ba4 100644 --- a/renderers/html/preview.js +++ b/renderers/html/preview.js @@ -1 +1 @@ -export * from './dist/esm/config'; +export * from './dist/config'; diff --git a/yarn.lock b/yarn.lock index 52575bdfbb59..8f8766867e09 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8436,6 +8436,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/html@workspace:renderers/html" dependencies: + "@digitak/esrun": ^3.2.2 "@storybook/addons": 7.0.0-alpha.5 "@storybook/core-client": 7.0.0-alpha.5 "@storybook/csf": 0.0.2--canary.4566f4d.1 From 0bc43da55a04f0bcdeb731e09ec9e2fe1de96fd5 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 10:52:03 +0200 Subject: [PATCH 03/12] another one --- renderers/server/package.json | 32 ++++++++++++++++++++++++++++---- renderers/server/preview.js | 2 +- yarn.lock | 1 + 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/renderers/server/package.json b/renderers/server/package.json index 76363f0a3e91..0348b9b19076 100644 --- a/renderers/server/package.json +++ b/renderers/server/package.json @@ -19,9 +19,26 @@ "url": "https://opencollective.com/storybook" }, "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./preview": { + "require": "./dist/config.js", + "import": "./dist/config.mjs", + "types": "./dist/config.d.ts" + }, + "./package.json": { + "require": "./package.json", + "import": "./package.json", + "types": "./package.json" + } + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "files": [ "dist/**/*", "README.md", @@ -29,7 +46,7 @@ "*.d.ts" ], "scripts": { - "prepare": "node ../../scripts/prepare.js" + "prepare": "esrun ../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.5", @@ -43,11 +60,18 @@ "react-dom": "16.14.0", "ts-dedent": "^2.0.0" }, + "devDependencies": { + "@digitak/esrun": "^3.2.2" + }, "engines": { "node": ">=10.13.0" }, "publishConfig": { "access": "public" }, + "bundlerEntrypoint": [ + "./src/index.ts", + "./src/config.ts" + ], "gitHead": "3dd46982823b34d9f37be917b6247631081feff7" } diff --git a/renderers/server/preview.js b/renderers/server/preview.js index 0d73a0b695f1..fe48d8883ba4 100644 --- a/renderers/server/preview.js +++ b/renderers/server/preview.js @@ -1 +1 @@ -export * from './dist/esm/config'; +export * from './dist/config'; diff --git a/yarn.lock b/yarn.lock index 8f8766867e09..8468e90597fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9349,6 +9349,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/server@workspace:renderers/server" dependencies: + "@digitak/esrun": ^3.2.2 "@storybook/addons": 7.0.0-alpha.5 "@storybook/core-client": 7.0.0-alpha.5 "@storybook/csf": 0.0.2--canary.4566f4d.1 From 6ee74300675eb4dfae19df6fa4ed9a148f123d9c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 15:16:19 +0200 Subject: [PATCH 04/12] another one --- renderers/svelte/package.json | 30 ++++++++++++++++++++++++++---- renderers/svelte/preview.js | 2 +- scripts/prepare/bundle.ts | 5 +++++ yarn.lock | 1 + 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/renderers/svelte/package.json b/renderers/svelte/package.json index 1d93ec6ff77f..a16f969bbaaa 100644 --- a/renderers/svelte/package.json +++ b/renderers/svelte/package.json @@ -19,9 +19,26 @@ "url": "https://opencollective.com/storybook" }, "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./preview": { + "require": "./dist/config.js", + "import": "./dist/config.mjs", + "types": "./dist/config.d.ts" + }, + "./package.json": { + "require": "./package.json", + "import": "./package.json", + "types": "./package.json" + } + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "files": [ "dist/**/*", "templates/**/*", @@ -30,7 +47,7 @@ "*.d.ts" ], "scripts": { - "prepare": "node ../../scripts/prepare.js" + "prepare": "esrun ../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.5", @@ -46,6 +63,7 @@ "sveltedoc-parser": "4.1.0" }, "devDependencies": { + "@digitak/esrun": "^3.2.2", "svelte": "^3.31.2" }, "peerDependencies": { @@ -58,5 +76,9 @@ "publishConfig": { "access": "public" }, + "bundlerEntrypoint": [ + "./src/index.ts", + "./src/config.ts" + ], "gitHead": "3dd46982823b34d9f37be917b6247631081feff7" } diff --git a/renderers/svelte/preview.js b/renderers/svelte/preview.js index 0d73a0b695f1..fe48d8883ba4 100644 --- a/renderers/svelte/preview.js +++ b/renderers/svelte/preview.js @@ -1 +1 @@ -export * from './dist/esm/config'; +export * from './dist/config'; diff --git a/scripts/prepare/bundle.ts b/scripts/prepare/bundle.ts index 1be6e0ea6ee3..17c30c1cd538 100644 --- a/scripts/prepare/bundle.ts +++ b/scripts/prepare/bundle.ts @@ -28,6 +28,11 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => { target: 'node16', clean: true, shims: true, + external: [ + packageJson.name, + ...Object.keys(packageJson.dependencies || {}), + ...Object.keys(packageJson.peerDependencies || {}), + ], dts: optimized ? { diff --git a/yarn.lock b/yarn.lock index 8468e90597fa..6c83731282db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9429,6 +9429,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/svelte@workspace:renderers/svelte" dependencies: + "@digitak/esrun": ^3.2.2 "@storybook/addons": 7.0.0-alpha.5 "@storybook/client-logger": 7.0.0-alpha.5 "@storybook/core-client": 7.0.0-alpha.5 From 7a895a15f2e0ab38e563765f3db152e5dc751575 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 15:18:42 +0200 Subject: [PATCH 05/12] another one --- renderers/vue/package.json | 30 ++++++++++++++++++++++++++---- renderers/vue/preview.js | 2 +- yarn.lock | 1 + 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/renderers/vue/package.json b/renderers/vue/package.json index a27c903be188..1a665cdab7c0 100644 --- a/renderers/vue/package.json +++ b/renderers/vue/package.json @@ -19,9 +19,26 @@ "url": "https://opencollective.com/storybook" }, "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./preview": { + "require": "./dist/config.js", + "import": "./dist/config.mjs", + "types": "./dist/config.d.ts" + }, + "./package.json": { + "require": "./package.json", + "import": "./package.json", + "types": "./package.json" + } + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "files": [ "dist/**/*", "README.md", @@ -29,7 +46,7 @@ "*.d.ts" ], "scripts": { - "prepare": "node ../../scripts/prepare.js" + "prepare": "esrun ../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.5", @@ -45,6 +62,7 @@ "ts-dedent": "^2.0.0" }, "devDependencies": { + "@digitak/esrun": "^3.2.2", "vue": "^2.6.12" }, "peerDependencies": { @@ -59,5 +77,9 @@ "publishConfig": { "access": "public" }, + "bundlerEntrypoint": [ + "./src/index.ts", + "./src/config.ts" + ], "gitHead": "3dd46982823b34d9f37be917b6247631081feff7" } diff --git a/renderers/vue/preview.js b/renderers/vue/preview.js index 0d73a0b695f1..fe48d8883ba4 100644 --- a/renderers/vue/preview.js +++ b/renderers/vue/preview.js @@ -1 +1 @@ -export * from './dist/esm/config'; +export * from './dist/config'; diff --git a/yarn.lock b/yarn.lock index 6c83731282db..fd6778633242 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9678,6 +9678,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/vue@workspace:renderers/vue" dependencies: + "@digitak/esrun": ^3.2.2 "@storybook/addons": 7.0.0-alpha.5 "@storybook/client-logger": 7.0.0-alpha.5 "@storybook/core-client": 7.0.0-alpha.5 From a9aa28e413ab456f8de4c1cd925f9ecb72501069 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 15:20:32 +0200 Subject: [PATCH 06/12] another one --- renderers/vue3/package.json | 30 ++++++++++++++++++++++++++---- renderers/vue3/preview.js | 2 +- yarn.lock | 1 + 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/renderers/vue3/package.json b/renderers/vue3/package.json index 336612dbcf6f..f6be28f0bb0d 100644 --- a/renderers/vue3/package.json +++ b/renderers/vue3/package.json @@ -19,9 +19,26 @@ "url": "https://opencollective.com/storybook" }, "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./preview": { + "require": "./dist/config.js", + "import": "./dist/config.mjs", + "types": "./dist/config.d.ts" + }, + "./package.json": { + "require": "./package.json", + "import": "./package.json", + "types": "./package.json" + } + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "files": [ "bin/**/*", "dist/**/*", @@ -30,7 +47,7 @@ "*.d.ts" ], "scripts": { - "prepare": "node ../../scripts/prepare.js" + "prepare": "esrun ../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.5", @@ -45,6 +62,7 @@ "ts-dedent": "^2.0.0" }, "devDependencies": { + "@digitak/esrun": "^3.2.2", "vue": "3.0.0" }, "peerDependencies": { @@ -58,5 +76,9 @@ "publishConfig": { "access": "public" }, + "bundlerEntrypoint": [ + "./src/index.ts", + "./src/config.ts" + ], "gitHead": "3dd46982823b34d9f37be917b6247631081feff7" } diff --git a/renderers/vue3/preview.js b/renderers/vue3/preview.js index 0d73a0b695f1..fe48d8883ba4 100644 --- a/renderers/vue3/preview.js +++ b/renderers/vue3/preview.js @@ -1 +1 @@ -export * from './dist/esm/config'; +export * from './dist/config'; diff --git a/yarn.lock b/yarn.lock index fd6778633242..dca963bc3028 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9656,6 +9656,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/vue3@workspace:renderers/vue3" dependencies: + "@digitak/esrun": ^3.2.2 "@storybook/addons": 7.0.0-alpha.5 "@storybook/core-client": 7.0.0-alpha.5 "@storybook/csf": 0.0.2--canary.4566f4d.1 From f2a00858a386fe0ca87645215bdd5d7a322e67fb Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 15:33:33 +0200 Subject: [PATCH 07/12] final one! --- renderers/html/preview.js | 2 +- renderers/preact/preview.js | 2 +- renderers/react/package.json | 30 +++++++++++++++++++++++---- renderers/react/preview.js | 2 +- renderers/server/preview.js | 2 +- renderers/svelte/preview.js | 2 +- renderers/vue/preview.js | 2 +- renderers/vue3/preview.js | 2 +- renderers/web-components/package.json | 30 +++++++++++++++++++++++---- renderers/web-components/preview.js | 2 +- yarn.lock | 2 ++ 11 files changed, 62 insertions(+), 16 deletions(-) diff --git a/renderers/html/preview.js b/renderers/html/preview.js index fe48d8883ba4..f00f03b4e2e4 100644 --- a/renderers/html/preview.js +++ b/renderers/html/preview.js @@ -1 +1 @@ -export * from './dist/config'; +export * from './dist/config.mjs'; diff --git a/renderers/preact/preview.js b/renderers/preact/preview.js index fe48d8883ba4..f00f03b4e2e4 100644 --- a/renderers/preact/preview.js +++ b/renderers/preact/preview.js @@ -1 +1 @@ -export * from './dist/config'; +export * from './dist/config.mjs'; diff --git a/renderers/react/package.json b/renderers/react/package.json index 7d66a41eb574..f6b1876d2486 100644 --- a/renderers/react/package.json +++ b/renderers/react/package.json @@ -19,9 +19,26 @@ "url": "https://opencollective.com/storybook" }, "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./preview": { + "require": "./dist/config.js", + "import": "./dist/config.mjs", + "types": "./dist/config.d.ts" + }, + "./package.json": { + "require": "./package.json", + "import": "./package.json", + "types": "./package.json" + } + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "files": [ "dist/**/*", "types/**/*", @@ -30,7 +47,7 @@ "*.d.ts" ], "scripts": { - "prepare": "node ../../scripts/prepare.js" + "prepare": "esrun ../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.5", @@ -56,6 +73,7 @@ }, "devDependencies": { "@babel/core": "^7.11.5", + "@digitak/esrun": "^3.2.2", "@types/util-deprecate": "^1.0.0" }, "peerDependencies": { @@ -75,5 +93,9 @@ "publishConfig": { "access": "public" }, + "bundlerEntrypoint": [ + "./src/index.ts", + "./src/config.ts" + ], "gitHead": "3dd46982823b34d9f37be917b6247631081feff7" } diff --git a/renderers/react/preview.js b/renderers/react/preview.js index 0d73a0b695f1..f00f03b4e2e4 100644 --- a/renderers/react/preview.js +++ b/renderers/react/preview.js @@ -1 +1 @@ -export * from './dist/esm/config'; +export * from './dist/config.mjs'; diff --git a/renderers/server/preview.js b/renderers/server/preview.js index fe48d8883ba4..f00f03b4e2e4 100644 --- a/renderers/server/preview.js +++ b/renderers/server/preview.js @@ -1 +1 @@ -export * from './dist/config'; +export * from './dist/config.mjs'; diff --git a/renderers/svelte/preview.js b/renderers/svelte/preview.js index fe48d8883ba4..f00f03b4e2e4 100644 --- a/renderers/svelte/preview.js +++ b/renderers/svelte/preview.js @@ -1 +1 @@ -export * from './dist/config'; +export * from './dist/config.mjs'; diff --git a/renderers/vue/preview.js b/renderers/vue/preview.js index fe48d8883ba4..f00f03b4e2e4 100644 --- a/renderers/vue/preview.js +++ b/renderers/vue/preview.js @@ -1 +1 @@ -export * from './dist/config'; +export * from './dist/config.mjs'; diff --git a/renderers/vue3/preview.js b/renderers/vue3/preview.js index fe48d8883ba4..f00f03b4e2e4 100644 --- a/renderers/vue3/preview.js +++ b/renderers/vue3/preview.js @@ -1 +1 @@ -export * from './dist/config'; +export * from './dist/config.mjs'; diff --git a/renderers/web-components/package.json b/renderers/web-components/package.json index 69e6f36375aa..5ce5ad995cf0 100644 --- a/renderers/web-components/package.json +++ b/renderers/web-components/package.json @@ -21,9 +21,26 @@ "url": "https://opencollective.com/storybook" }, "license": "MIT", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./preview": { + "require": "./dist/config.js", + "import": "./dist/config.mjs", + "types": "./dist/config.d.ts" + }, + "./package.json": { + "require": "./package.json", + "import": "./package.json", + "types": "./package.json" + } + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "files": [ "dist/**/*", "README.md", @@ -31,7 +48,7 @@ "*.d.ts" ], "scripts": { - "prepare": "node ../../scripts/prepare.js" + "prepare": "esrun ../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "7.0.0-alpha.5", @@ -49,6 +66,7 @@ "ts-dedent": "^2.0.0" }, "devDependencies": { + "@digitak/esrun": "^3.2.2", "lit-html": "2.0.2" }, "peerDependencies": { @@ -60,5 +78,9 @@ "publishConfig": { "access": "public" }, + "bundlerEntrypoint": [ + "./src/index.ts", + "./src/config.ts" + ], "gitHead": "3dd46982823b34d9f37be917b6247631081feff7" } diff --git a/renderers/web-components/preview.js b/renderers/web-components/preview.js index 0d73a0b695f1..f00f03b4e2e4 100644 --- a/renderers/web-components/preview.js +++ b/renderers/web-components/preview.js @@ -1 +1 @@ -export * from './dist/esm/config'; +export * from './dist/config.mjs'; diff --git a/yarn.lock b/yarn.lock index dca963bc3028..c204dd088226 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8962,6 +8962,7 @@ __metadata: resolution: "@storybook/react@workspace:renderers/react" dependencies: "@babel/core": ^7.11.5 + "@digitak/esrun": ^3.2.2 "@storybook/addons": 7.0.0-alpha.5 "@storybook/client-logger": 7.0.0-alpha.5 "@storybook/core-client": 7.0.0-alpha.5 @@ -9723,6 +9724,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/web-components@workspace:renderers/web-components" dependencies: + "@digitak/esrun": ^3.2.2 "@storybook/addons": 7.0.0-alpha.5 "@storybook/api": 7.0.0-alpha.5 "@storybook/client-logger": 7.0.0-alpha.5 From b5ec7d05d29c9a2832d9adb09c0f87085219db02 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 16:08:21 +0200 Subject: [PATCH 08/12] fix --- renderers/html/preview.js | 2 +- renderers/preact/preview.js | 2 +- renderers/react/preview.js | 3 ++- renderers/server/preview.js | 2 +- renderers/svelte/preview.js | 2 +- renderers/vue/preview.js | 2 +- renderers/vue3/preview.js | 2 +- renderers/web-components/preview.js | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/renderers/html/preview.js b/renderers/html/preview.js index f00f03b4e2e4..fe48d8883ba4 100644 --- a/renderers/html/preview.js +++ b/renderers/html/preview.js @@ -1 +1 @@ -export * from './dist/config.mjs'; +export * from './dist/config'; diff --git a/renderers/preact/preview.js b/renderers/preact/preview.js index f00f03b4e2e4..fe48d8883ba4 100644 --- a/renderers/preact/preview.js +++ b/renderers/preact/preview.js @@ -1 +1 @@ -export * from './dist/config.mjs'; +export * from './dist/config'; diff --git a/renderers/react/preview.js b/renderers/react/preview.js index f00f03b4e2e4..508e4706a490 100644 --- a/renderers/react/preview.js +++ b/renderers/react/preview.js @@ -1 +1,2 @@ -export * from './dist/config.mjs'; +// eslint-disable-next-line import/export +export * from './dist/config'; diff --git a/renderers/server/preview.js b/renderers/server/preview.js index f00f03b4e2e4..fe48d8883ba4 100644 --- a/renderers/server/preview.js +++ b/renderers/server/preview.js @@ -1 +1 @@ -export * from './dist/config.mjs'; +export * from './dist/config'; diff --git a/renderers/svelte/preview.js b/renderers/svelte/preview.js index f00f03b4e2e4..fe48d8883ba4 100644 --- a/renderers/svelte/preview.js +++ b/renderers/svelte/preview.js @@ -1 +1 @@ -export * from './dist/config.mjs'; +export * from './dist/config'; diff --git a/renderers/vue/preview.js b/renderers/vue/preview.js index f00f03b4e2e4..fe48d8883ba4 100644 --- a/renderers/vue/preview.js +++ b/renderers/vue/preview.js @@ -1 +1 @@ -export * from './dist/config.mjs'; +export * from './dist/config'; diff --git a/renderers/vue3/preview.js b/renderers/vue3/preview.js index f00f03b4e2e4..fe48d8883ba4 100644 --- a/renderers/vue3/preview.js +++ b/renderers/vue3/preview.js @@ -1 +1 @@ -export * from './dist/config.mjs'; +export * from './dist/config'; diff --git a/renderers/web-components/preview.js b/renderers/web-components/preview.js index f00f03b4e2e4..fe48d8883ba4 100644 --- a/renderers/web-components/preview.js +++ b/renderers/web-components/preview.js @@ -1 +1 @@ -export * from './dist/config.mjs'; +export * from './dist/config'; From 232c36fa2d4cdca799ce35ef2972d621a5457fe9 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 17:01:28 +0200 Subject: [PATCH 09/12] fix issue where "failed to resolve only because it was resolved as fully specified" occured found fix here: https://stackoverflow.com/questions/69427025/programmatic-webpack-jest-esm-cant-resolve-module-without-js-file-exten --- .../src/preview/iframe-webpack.config.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/builder-webpack5/src/preview/iframe-webpack.config.ts b/lib/builder-webpack5/src/preview/iframe-webpack.config.ts index 118328be96e8..77ffe9fc827a 100644 --- a/lib/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/lib/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -240,6 +240,16 @@ export default async ( ].filter(Boolean), module: { rules: [ + { + test: /\.m?js$/, + type: 'javascript/auto', + }, + { + test: /\.m?js$/, + resolve: { + fullySpecified: false, + }, + }, createBabelLoader(babelOptions, typescriptOptions), { test: /\.md$/, From d547a12415709b51d293863c7d909e31c81683d6 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 23:15:43 +0200 Subject: [PATCH 10/12] fixes --- presets/react-webpack/src/framework-preset-cra.ts | 14 ++++++++++++++ renderers/svelte/package.json | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/presets/react-webpack/src/framework-preset-cra.ts b/presets/react-webpack/src/framework-preset-cra.ts index fe8dce90b4ab..82364ef0ab89 100644 --- a/presets/react-webpack/src/framework-preset-cra.ts +++ b/presets/react-webpack/src/framework-preset-cra.ts @@ -25,5 +25,19 @@ export const webpackFinal: StorybookConfig['webpack'] = (config, { presetsList } checkForNewPreset(presetsList); } } + config.module?.rules?.push( + ...[ + { + test: /\.m?js$/, + type: 'javascript/auto', + }, + { + test: /\.m?js$/, + resolve: { + fullySpecified: false, + }, + }, + ] + ); return config; }; diff --git a/renderers/svelte/package.json b/renderers/svelte/package.json index a16f969bbaaa..cb05a3aef583 100644 --- a/renderers/svelte/package.json +++ b/renderers/svelte/package.json @@ -34,7 +34,10 @@ "require": "./package.json", "import": "./package.json", "types": "./package.json" - } + }, + "./templates/HOC.svelte": "./templates/HOC.svelte", + "./templates/PreviewRender.svelte": "./templates/PreviewRender.svelte", + "./templates/SlotDecorator.svelte": "./templates/SlotDecorator.svelte" }, "main": "dist/index.js", "module": "dist/index.mjs", From 996a25ee1c84c4870cc6a38c47755d756fbcf03d Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 22 Jun 2022 23:28:45 +0200 Subject: [PATCH 11/12] fixes --- .../__snapshots__/cra-ts-essentials_preview-dev-posix | 10 ++++++++++ .../__snapshots__/cra-ts-essentials_preview-prod-posix | 10 ++++++++++ .../__snapshots__/html-kitchen-sink_preview-dev-posix | 10 ++++++++++ .../__snapshots__/html-kitchen-sink_preview-prod-posix | 10 ++++++++++ .../src/__snapshots__/vue-3-cli_preview-dev-posix | 10 ++++++++++ .../src/__snapshots__/vue-3-cli_preview-prod-posix | 10 ++++++++++ .../web-components-kitchen-sink_preview-dev-posix | 10 ++++++++++ .../web-components-kitchen-sink_preview-prod-posix | 10 ++++++++++ renderers/react/preview.js | 3 +-- 9 files changed, 81 insertions(+), 2 deletions(-) diff --git a/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-dev-posix b/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-dev-posix index adde75d05280..dfb6dc5bedce 100644 --- a/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-dev-posix +++ b/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-dev-posix @@ -478,6 +478,16 @@ Object { }, "test": "/\\\\.(stories|story)\\\\.[tj]sx?$/", }, + Object { + "test": "/\\\\.m?js$/", + "type": "javascript/auto", + }, + Object { + "resolve": Object { + "fullySpecified": false, + }, + "test": "/\\\\.m?js$/", + }, ], }, "plugins": Array [ diff --git a/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-prod-posix b/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-prod-posix index f259748d0458..7c663e245ebe 100644 --- a/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-prod-posix +++ b/lib/core-server/src/__snapshots__/cra-ts-essentials_preview-prod-posix @@ -495,6 +495,16 @@ Object { }, "test": "/\\\\.(stories|story)\\\\.[tj]sx?$/", }, + Object { + "test": "/\\\\.m?js$/", + "type": "javascript/auto", + }, + Object { + "resolve": Object { + "fullySpecified": false, + }, + "test": "/\\\\.m?js$/", + }, ], }, "plugins": Array [ diff --git a/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-dev-posix b/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-dev-posix index d0479f49dc32..f8012763c738 100644 --- a/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-dev-posix +++ b/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-dev-posix @@ -26,6 +26,16 @@ Object { ], "module": Object { "rules": Array [ + Object { + "test": "/\\\\.m?js$/", + "type": "javascript/auto", + }, + Object { + "resolve": Object { + "fullySpecified": false, + }, + "test": "/\\\\.m?js$/", + }, Object { "exclude": "NODE_MODULES/", "include": Array [ diff --git a/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-prod-posix b/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-prod-posix index ccd47de64db4..963e86506166 100644 --- a/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-prod-posix +++ b/lib/core-server/src/__snapshots__/html-kitchen-sink_preview-prod-posix @@ -25,6 +25,16 @@ Object { ], "module": Object { "rules": Array [ + Object { + "test": "/\\\\.m?js$/", + "type": "javascript/auto", + }, + Object { + "resolve": Object { + "fullySpecified": false, + }, + "test": "/\\\\.m?js$/", + }, Object { "exclude": "NODE_MODULES/", "include": Array [ diff --git a/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix b/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix index dce50647feca..8be7356c9f47 100644 --- a/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix +++ b/lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix @@ -26,6 +26,16 @@ Object { ], "module": Object { "rules": Array [ + Object { + "test": "/\\\\.m?js$/", + "type": "javascript/auto", + }, + Object { + "resolve": Object { + "fullySpecified": false, + }, + "test": "/\\\\.m?js$/", + }, Object { "exclude": "NODE_MODULES/", "include": Array [ diff --git a/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix b/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix index 53b02d697005..2cd4cf1c2b66 100644 --- a/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix +++ b/lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix @@ -25,6 +25,16 @@ Object { ], "module": Object { "rules": Array [ + Object { + "test": "/\\\\.m?js$/", + "type": "javascript/auto", + }, + Object { + "resolve": Object { + "fullySpecified": false, + }, + "test": "/\\\\.m?js$/", + }, Object { "exclude": "NODE_MODULES/", "include": Array [ diff --git a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-posix b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-posix index 41c4d9319af7..e7e98abcf951 100644 --- a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-posix +++ b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-posix @@ -26,6 +26,16 @@ Object { ], "module": Object { "rules": Array [ + Object { + "test": "/\\\\.m?js$/", + "type": "javascript/auto", + }, + Object { + "resolve": Object { + "fullySpecified": false, + }, + "test": "/\\\\.m?js$/", + }, Object { "exclude": "NODE_MODULES/", "include": Array [ diff --git a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-posix b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-posix index 150c6b7e3021..e5ea7dbf7ad0 100644 --- a/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-posix +++ b/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-posix @@ -25,6 +25,16 @@ Object { ], "module": Object { "rules": Array [ + Object { + "test": "/\\\\.m?js$/", + "type": "javascript/auto", + }, + Object { + "resolve": Object { + "fullySpecified": false, + }, + "test": "/\\\\.m?js$/", + }, Object { "exclude": "NODE_MODULES/", "include": Array [ diff --git a/renderers/react/preview.js b/renderers/react/preview.js index 508e4706a490..f00f03b4e2e4 100644 --- a/renderers/react/preview.js +++ b/renderers/react/preview.js @@ -1,2 +1 @@ -// eslint-disable-next-line import/export -export * from './dist/config'; +export * from './dist/config.mjs'; From a4a8c8adbf2130154ac48fa8bb2a09f75cd87067 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Wed, 29 Jun 2022 18:38:07 +0800 Subject: [PATCH 12/12] Upgrade sb bench --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c5ce96541f83..71913fcb4d72 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -269,7 +269,7 @@ jobs: name: Run @storybook/bench on repro command: | cd ../cra-bench - npx @storybook/bench@0.8.0--canary.11.edeef38.0 'echo noop' --label cra + npx @storybook/bench@1.0.0--canary.12.22336b6.0 'echo noop' --label cra e2e-tests-pnp: executor: class: medium