From b596a9ddc68d51f9dde893ff67f47767105d3fdd Mon Sep 17 00:00:00 2001 From: abdelkader Date: Thu, 28 Jul 2022 13:53:24 +0200 Subject: [PATCH 1/5] [CHANGED] lib/addons changed to tsup --- code/lib/addons/package.json | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/code/lib/addons/package.json b/code/lib/addons/package.json index f77dd39d40a8..f089f0c60df8 100644 --- a/code/lib/addons/package.json +++ b/code/lib/addons/package.json @@ -20,9 +20,17 @@ }, "license": "MIT", "sideEffects": false, - "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" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", "files": [ "dist/**/*", "README.md", @@ -31,7 +39,17 @@ ], "scripts": { "check": "tsc --noEmit", - "prepare": "node ../../../scripts/prepare.js" + "prepare": "../../../scripts/prepare/bundle.ts" + }, + "bundler": { + "entries": [ + "./src/index.ts", + "./src/hooks.ts", + "./src/main.ts", + "./src/make-decorator.ts", + "./src/storybook-channel-mock.ts", + "./src/types.ts" + ] }, "dependencies": { "@storybook/api": "7.0.0-alpha.16", From 865bd81155b0e2ca4fa68fc714f0f5ba736c2ae0 Mon Sep 17 00:00:00 2001 From: abdelkader Date: Wed, 17 Aug 2022 09:36:05 +0200 Subject: [PATCH 2/5] [FIXED] Working on index.ts only --- code/lib/addons/package.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/code/lib/addons/package.json b/code/lib/addons/package.json index f089f0c60df8..92b6c89cad0c 100644 --- a/code/lib/addons/package.json +++ b/code/lib/addons/package.json @@ -43,12 +43,7 @@ }, "bundler": { "entries": [ - "./src/index.ts", - "./src/hooks.ts", - "./src/main.ts", - "./src/make-decorator.ts", - "./src/storybook-channel-mock.ts", - "./src/types.ts" + "./src/index.ts" ] }, "dependencies": { From 3ddf1fbc6dd762dbe775f9a3c48d55426f69fe5d Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Mon, 26 Sep 2022 21:28:23 -0400 Subject: [PATCH 3/5] Update script name # Conflicts: # code/lib/addons/package.json --- code/lib/addons/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/addons/package.json b/code/lib/addons/package.json index 9c378553a4b5..ac3929ad5510 100644 --- a/code/lib/addons/package.json +++ b/code/lib/addons/package.json @@ -39,7 +39,7 @@ ], "scripts": { "check": "../../../scripts/node_modules/.bin/tsc --noEmit", - "prepare": "../../../scripts/prepare/bundle.ts" + "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/api": "7.0.0-alpha.33", From 34b5cd57c441ddacd0719e8710cf5f18f50b1028 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Mon, 26 Sep 2022 21:29:45 -0400 Subject: [PATCH 4/5] Sort exports (automatic?) --- code/lib/ui/src/globals/exports.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/lib/ui/src/globals/exports.ts b/code/lib/ui/src/globals/exports.ts index d53ee16e4d63..441fb4b6d668 100644 --- a/code/lib/ui/src/globals/exports.ts +++ b/code/lib/ui/src/globals/exports.ts @@ -215,13 +215,13 @@ export default { '@storybook/addons': [ 'AddonStore', 'Channel', + 'HooksContext', 'addons', - 'makeDecorator', + 'applyHooks', 'isSupportedType', - 'types', + 'makeDecorator', 'mockChannel', - 'HooksContext', - 'applyHooks', + 'types', 'useArgs', 'useCallback', 'useChannel', From 6b8a0bba792f6f4ebb2294508c081ec2eeccfcb8 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Mon, 26 Sep 2022 21:45:36 -0400 Subject: [PATCH 5/5] Add reference to webpack types --- code/addons/a11y/src/index.ts | 2 ++ code/addons/actions/src/index.ts | 2 ++ code/addons/backgrounds/src/index.ts | 2 ++ code/addons/jest/src/index.ts | 2 ++ code/addons/links/src/index.ts | 2 ++ code/addons/measure/src/index.ts | 2 ++ code/addons/outline/src/index.ts | 2 ++ code/addons/storysource/src/index.ts | 2 ++ 8 files changed, 16 insertions(+) diff --git a/code/addons/a11y/src/index.ts b/code/addons/a11y/src/index.ts index 1563fe0c340a..6303d598f490 100644 --- a/code/addons/a11y/src/index.ts +++ b/code/addons/a11y/src/index.ts @@ -1,3 +1,5 @@ +/// + import type { AnyFramework, DecoratorFunction } from '@storybook/csf'; import deprecate from 'util-deprecate'; import { dedent } from 'ts-dedent'; diff --git a/code/addons/actions/src/index.ts b/code/addons/actions/src/index.ts index 8eeba5a84f10..221afdabf34f 100644 --- a/code/addons/actions/src/index.ts +++ b/code/addons/actions/src/index.ts @@ -1,3 +1,5 @@ +/// + export * from './constants'; export * from './models'; export * from './preview'; diff --git a/code/addons/backgrounds/src/index.ts b/code/addons/backgrounds/src/index.ts index 644402abb41c..d6968d6ab3e3 100644 --- a/code/addons/backgrounds/src/index.ts +++ b/code/addons/backgrounds/src/index.ts @@ -1,3 +1,5 @@ +/// + if (module && module.hot && module.hot.decline) { module.hot.decline(); } diff --git a/code/addons/jest/src/index.ts b/code/addons/jest/src/index.ts index 08398c74c7c2..2e8b0715121d 100644 --- a/code/addons/jest/src/index.ts +++ b/code/addons/jest/src/index.ts @@ -1,3 +1,5 @@ +/// + import { addons } from '@storybook/addons'; import { normalize, sep } from 'upath'; import { ADD_TESTS, defineJestParameter } from './shared'; diff --git a/code/addons/links/src/index.ts b/code/addons/links/src/index.ts index e9c50d0217c8..071b1de97b79 100644 --- a/code/addons/links/src/index.ts +++ b/code/addons/links/src/index.ts @@ -1,3 +1,5 @@ +/// + import { dedent } from 'ts-dedent'; let hasWarned = false; diff --git a/code/addons/measure/src/index.ts b/code/addons/measure/src/index.ts index 644402abb41c..d6968d6ab3e3 100644 --- a/code/addons/measure/src/index.ts +++ b/code/addons/measure/src/index.ts @@ -1,3 +1,5 @@ +/// + if (module && module.hot && module.hot.decline) { module.hot.decline(); } diff --git a/code/addons/outline/src/index.ts b/code/addons/outline/src/index.ts index 644402abb41c..d6968d6ab3e3 100644 --- a/code/addons/outline/src/index.ts +++ b/code/addons/outline/src/index.ts @@ -1,3 +1,5 @@ +/// + if (module && module.hot && module.hot.decline) { module.hot.decline(); } diff --git a/code/addons/storysource/src/index.ts b/code/addons/storysource/src/index.ts index a5cd9202f547..5edaf4114ea1 100644 --- a/code/addons/storysource/src/index.ts +++ b/code/addons/storysource/src/index.ts @@ -1,3 +1,5 @@ +/// + import { ADDON_ID, PANEL_ID } from './events'; export { ADDON_ID, PANEL_ID };