From e7e4395bc00c6ec69167396deb3376b621e53f74 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 21:54:35 +0100 Subject: [PATCH] wip --- code/lib/client-api/package.json | 35 ++----- code/lib/client-api/src/entry.ts | 1 + code/lib/core-client/package.json | 36 ++------ code/lib/core-client/src/entry.ts | 1 + code/lib/core-client/src/index.ts | 5 - code/lib/preview-api/package.json | 45 ++++++++- code/lib/preview-api/src/client-api.ts | 1 + code/lib/preview-api/src/core-client.ts | 1 + code/lib/preview-api/src/index.ts | 20 ++-- .../src/modules/client-api}/ClientApi.test.ts | 0 .../src/modules/client-api}/ClientApi.ts | 27 +++--- .../modules/client-api}/StoryStoreFacade.ts | 49 +++++----- .../src/modules/client-api}/index.ts | 0 .../src/modules/client-api}/queryparams.ts | 0 .../src/modules/client-api}/typings.d.ts | 0 .../core-client}/PreviewWeb.mockdata.ts | 0 .../modules/core-client}/executeLoadable.ts | 0 .../src/modules/core-client/index.ts | 5 + .../src/modules/core-client}/start.test.ts | 10 +- .../src/modules/core-client}/start.ts | 4 +- .../src/modules/core-client}/typings.d.ts | 0 .../src/modules/preview-web}/Preview.tsx | 2 +- .../PreviewWeb.integration.test.ts | 0 .../preview-web}/PreviewWeb.mockdata.ts | 0 .../modules/preview-web}/PreviewWeb.test.ts | 2 +- .../src/modules/preview-web}/PreviewWeb.tsx | 0 .../src/modules/preview-web}/UrlStore.test.ts | 0 .../src/modules/preview-web}/UrlStore.ts | 0 .../src/modules/preview-web}/WebView.ts | 0 .../preview-web}/docs-context/DocsContext.ts | 2 +- .../docs-context/DocsContextProps.ts | 0 .../docs-context/DocsRenderFunction.ts | 0 .../src/modules/preview-web}/index.ts | 2 +- .../preview-web}/parseArgsParam.test.ts | 0 .../modules/preview-web}/parseArgsParam.ts | 0 .../src/modules/preview-web}/render/Render.ts | 0 .../render/StandaloneDocsRender.test.ts | 2 +- .../render/StandaloneDocsRender.ts | 2 +- .../preview-web}/render/StoryRender.test.ts | 2 +- .../preview-web}/render/StoryRender.ts | 2 +- .../render/TemplateDocsRender.test.ts | 2 +- .../preview-web}/render/TemplateDocsRender.ts | 2 +- .../preview-web}/simulate-pageload.test.ts | 0 .../modules/preview-web}/simulate-pageload.ts | 0 .../src/modules/preview-web}/typings.d.ts | 0 .../src/modules/store}/ArgsStore.test.ts | 0 .../src/modules/store}/ArgsStore.ts | 0 .../src/modules/store}/GlobalsStore.test.ts | 0 .../src/modules/store}/GlobalsStore.ts | 0 .../modules/store}/StoryIndexStore.test.ts | 0 .../src/modules/store}/StoryIndexStore.ts | 0 .../src/modules/store}/StoryStore.test.ts | 0 .../src/modules/store}/StoryStore.ts | 0 .../src/modules/store}/args.test.ts | 0 .../src/modules/store}/args.ts | 0 .../src/modules/store}/autoTitle.test.ts | 0 .../src/modules/store}/autoTitle.ts | 0 .../modules/store}/csf/composeConfigs.test.ts | 0 .../src/modules/store}/csf/composeConfigs.ts | 0 .../store}/csf/getValuesFromArgTypes.ts | 0 .../src/modules/store}/csf/index.ts | 0 .../csf/normalizeComponentAnnotations.ts | 0 .../store}/csf/normalizeInputTypes.test.ts | 0 .../modules/store}/csf/normalizeInputTypes.ts | 0 .../store}/csf/normalizeProjectAnnotations.ts | 0 .../modules/store}/csf/normalizeStory.test.ts | 0 .../src/modules/store}/csf/normalizeStory.ts | 0 .../modules/store}/csf/prepareStory.test.ts | 0 .../src/modules/store}/csf/prepareStory.ts | 0 .../modules/store}/csf/processCSFFile.test.ts | 0 .../src/modules/store}/csf/processCSFFile.ts | 0 .../modules/store}/csf/stepRunners.test.ts | 0 .../src/modules/store}/csf/stepRunners.ts | 0 .../store}/csf/testing-utils/index.test.ts | 0 .../modules/store}/csf/testing-utils/index.ts | 0 .../src/modules/store}/decorators.test.ts | 0 .../src/modules/store}/decorators.ts | 0 .../src/modules/store}/filterArgTypes.ts | 0 .../src/modules/store}/hooks.test.ts | 0 .../src/modules/store}/hooks.ts | 0 .../src/modules/store}/index.ts | 0 .../src/modules/store}/inferArgTypes.test.ts | 0 .../src/modules/store}/inferArgTypes.ts | 0 .../src/modules/store}/inferControls.test.ts | 0 .../src/modules/store}/inferControls.ts | 0 .../src/modules/store}/parameters.test.ts | 0 .../src/modules/store}/parameters.ts | 0 .../src/modules/store}/sortStories.ts | 0 .../src/modules/store}/storySort.test.ts | 0 .../src/modules/store}/storySort.ts | 0 .../src/modules/store}/typings.d.ts | 0 code/lib/preview-api/src/preview-web.ts | 1 + code/lib/preview-api/src/store.ts | 1 + code/lib/preview-web/package.json | 37 ++------ code/lib/preview-web/src/entry.ts | 1 + code/lib/store/package.json | 35 ++----- code/lib/store/src/entry.ts | 1 + code/yarn.lock | 91 ++++--------------- 98 files changed, 170 insertions(+), 257 deletions(-) create mode 100644 code/lib/client-api/src/entry.ts create mode 100644 code/lib/core-client/src/entry.ts delete mode 100644 code/lib/core-client/src/index.ts create mode 100644 code/lib/preview-api/src/client-api.ts create mode 100644 code/lib/preview-api/src/core-client.ts rename code/lib/{client-api/src => preview-api/src/modules/client-api}/ClientApi.test.ts (100%) rename code/lib/{client-api/src => preview-api/src/modules/client-api}/ClientApi.ts (94%) rename code/lib/{client-api/src => preview-api/src/modules/client-api}/StoryStoreFacade.ts (87%) rename code/lib/{client-api/src => preview-api/src/modules/client-api}/index.ts (100%) rename code/lib/{client-api/src => preview-api/src/modules/client-api}/queryparams.ts (100%) rename code/lib/{client-api/src => preview-api/src/modules/client-api}/typings.d.ts (100%) rename code/lib/{core-client/src => preview-api/src/modules/core-client}/PreviewWeb.mockdata.ts (100%) rename code/lib/{core-client/src => preview-api/src/modules/core-client}/executeLoadable.ts (100%) create mode 100644 code/lib/preview-api/src/modules/core-client/index.ts rename code/lib/{core-client/src => preview-api/src/modules/core-client}/start.test.ts (99%) rename code/lib/{core-client/src => preview-api/src/modules/core-client}/start.ts (97%) rename code/lib/{core-client/src => preview-api/src/modules/core-client}/typings.d.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/Preview.tsx (99%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/PreviewWeb.integration.test.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/PreviewWeb.mockdata.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/PreviewWeb.test.ts (99%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/PreviewWeb.tsx (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/UrlStore.test.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/UrlStore.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/WebView.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/docs-context/DocsContext.ts (98%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/docs-context/DocsContextProps.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/docs-context/DocsRenderFunction.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/index.ts (91%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/parseArgsParam.test.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/parseArgsParam.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/Render.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/StandaloneDocsRender.test.ts (96%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/StandaloneDocsRender.ts (98%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/StoryRender.test.ts (96%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/StoryRender.ts (99%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/TemplateDocsRender.test.ts (96%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/TemplateDocsRender.ts (98%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/simulate-pageload.test.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/simulate-pageload.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/typings.d.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/ArgsStore.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/ArgsStore.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/GlobalsStore.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/GlobalsStore.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/StoryIndexStore.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/StoryIndexStore.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/StoryStore.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/StoryStore.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/args.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/args.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/autoTitle.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/autoTitle.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/composeConfigs.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/composeConfigs.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/getValuesFromArgTypes.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/index.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeComponentAnnotations.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeInputTypes.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeInputTypes.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeProjectAnnotations.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeStory.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeStory.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/prepareStory.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/prepareStory.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/processCSFFile.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/processCSFFile.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/stepRunners.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/stepRunners.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/testing-utils/index.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/testing-utils/index.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/decorators.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/decorators.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/filterArgTypes.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/hooks.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/hooks.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/index.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/inferArgTypes.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/inferArgTypes.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/inferControls.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/inferControls.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/parameters.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/parameters.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/sortStories.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/storySort.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/storySort.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/typings.d.ts (100%) create mode 100644 code/lib/preview-api/src/preview-web.ts create mode 100644 code/lib/preview-api/src/store.ts create mode 100644 code/lib/preview-web/src/entry.ts create mode 100644 code/lib/store/src/entry.ts diff --git a/code/lib/client-api/package.json b/code/lib/client-api/package.json index b0a7d82c24e..64dac4f9aac 100644 --- a/code/lib/client-api/package.json +++ b/code/lib/client-api/package.json @@ -22,15 +22,15 @@ "sideEffects": false, "exports": { ".": { - "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "require": "./dist/entry.js", + "import": "./dist/entry.mjs", + "types": "./dist/entry.d.ts" }, "./package.json": "./package.json" }, - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "main": "dist/entry.js", + "module": "dist/entry.mjs", + "types": "dist/entry.d.ts", "files": [ "dist/**/*", "README.md", @@ -42,33 +42,14 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/addons": "7.0.0-alpha.47", - "@storybook/client-logger": "7.0.0-alpha.47", - "@storybook/csf": "next", - "@storybook/store": "7.0.0-alpha.47", - "@storybook/types": "7.0.0-alpha.47", - "@types/qs": "^6.9.5", - "@types/webpack-env": "^1.16.4", - "global": "^4.4.0", - "qs": "^6.10.0", - "synchronous-promise": "^2.0.15", - "ts-dedent": "^2.0.0", - "util-deprecate": "^1.0.2" - }, - "devDependencies": { - "@storybook/core-common": "7.0.0-alpha.47", - "typescript": "~4.6.3" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + "@storybook/preview-api": "7.0.0-alpha.47" }, "publishConfig": { "access": "public" }, "bundler": { "entries": [ - "./src/index.ts" + "./src/entry.ts" ] }, "gitHead": "1c706a4a778831e012343c905f86225fa71491a7" diff --git a/code/lib/client-api/src/entry.ts b/code/lib/client-api/src/entry.ts new file mode 100644 index 00000000000..7d0286b54ea --- /dev/null +++ b/code/lib/client-api/src/entry.ts @@ -0,0 +1 @@ +export * from '@storybook/preview-api/dist/client-api'; diff --git a/code/lib/core-client/package.json b/code/lib/core-client/package.json index 838bd92a813..4f6845eaff7 100644 --- a/code/lib/core-client/package.json +++ b/code/lib/core-client/package.json @@ -21,48 +21,28 @@ "license": "MIT", "exports": { ".": { - "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "require": "./dist/entry.js", + "import": "./dist/entry.mjs", + "types": "./dist/entry.d.ts" }, "./package.json": "./package.json" }, - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "main": "dist/entry.js", + "module": "dist/entry.mjs", + "types": "dist/entry.d.ts", "scripts": { "check": "../../../scripts/node_modules/.bin/tsc --noEmit", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/addons": "7.0.0-alpha.47", - "@storybook/channel-postmessage": "7.0.0-alpha.47", - "@storybook/channel-websocket": "7.0.0-alpha.47", - "@storybook/channels": "7.0.0-alpha.47", - "@storybook/client-api": "7.0.0-alpha.47", - "@storybook/client-logger": "7.0.0-alpha.47", - "@storybook/core-events": "7.0.0-alpha.47", - "@storybook/csf": "next", - "@storybook/preview-web": "7.0.0-alpha.47", - "@storybook/store": "7.0.0-alpha.47", - "@storybook/types": "7.0.0-alpha.47", - "global": "^4.4.0", - "util-deprecate": "^1.0.2" - }, - "devDependencies": { - "typescript": "~4.6.3" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "@storybook/preview-api": "7.0.0-alpha.47" }, "publishConfig": { "access": "public" }, "bundler": { "entries": [ - "./src/index.ts" + "./src/entry.ts" ] }, "gitHead": "1c706a4a778831e012343c905f86225fa71491a7" diff --git a/code/lib/core-client/src/entry.ts b/code/lib/core-client/src/entry.ts new file mode 100644 index 00000000000..ba915a18f53 --- /dev/null +++ b/code/lib/core-client/src/entry.ts @@ -0,0 +1 @@ +export * from '@storybook/preview-api/dist/core-client'; diff --git a/code/lib/core-client/src/index.ts b/code/lib/core-client/src/index.ts deleted file mode 100644 index 23c8d04e27e..00000000000 --- a/code/lib/core-client/src/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ClientApi } from '@storybook/client-api'; -import { StoryStore } from '@storybook/store'; -import { start } from './start'; - -export { start, ClientApi, StoryStore }; diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 5e7698b1be7..d2b283db2d3 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -26,6 +26,26 @@ "require": "./dist/index.js", "types": "./dist/index.d.ts" }, + "./dist/store": { + "import": "./dist/store.mjs", + "require": "./dist/store.js", + "types": "./dist/store.d.ts" + }, + "./dist/client-api": { + "import": "./dist/client-api.mjs", + "require": "./dist/client-api.js", + "types": "./dist/client-api.d.ts" + }, + "./dist/core-client": { + "import": "./dist/core-client.mjs", + "require": "./dist/core-client.js", + "types": "./dist/core-client.d.ts" + }, + "./dist/preview-web": { + "import": "./dist/preview-web.mjs", + "require": "./dist/preview-web.js", + "types": "./dist/preview-web.d.ts" + }, "./package.json": "./package.json" }, "main": "dist/index.js", @@ -43,17 +63,32 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.47", - "@storybook/client-api": "7.0.0-alpha.47", - "@storybook/core-client": "7.0.0-alpha.47", - "@storybook/preview-web": "7.0.0-alpha.47", - "@storybook/store": "7.0.0-alpha.47" + "@storybook/client-logger": "7.0.0-alpha.47", + "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/csf": "next", + "@storybook/types": "7.0.0-alpha.47", + "@types/qs": "^6.9.5", + "@types/webpack-env": "^1.16.4", + "dequal": "^2.0.2", + "global": "^4.4.0", + "lodash": "^4.17.21", + "memoizerific": "^1.11.3", + "qs": "^6.10.0", + "slash": "^3.0.0", + "synchronous-promise": "^2.0.15", + "ts-dedent": "^2.0.0", + "util-deprecate": "^1.0.2" }, "publishConfig": { "access": "public" }, "bundler": { "entries": [ - "./src/index.ts" + "./src/index.ts", + "./src/store.ts", + "./src/client-api.ts", + "./src/core-client.ts", + "./src/preview-web.ts" ] }, "gitHead": "3ef14366115c56c1d45c0359ff681cc47ed50532" diff --git a/code/lib/preview-api/src/client-api.ts b/code/lib/preview-api/src/client-api.ts new file mode 100644 index 00000000000..0ba8fe19999 --- /dev/null +++ b/code/lib/preview-api/src/client-api.ts @@ -0,0 +1 @@ +export * from './modules/client-api'; diff --git a/code/lib/preview-api/src/core-client.ts b/code/lib/preview-api/src/core-client.ts new file mode 100644 index 00000000000..86513ed4b7f --- /dev/null +++ b/code/lib/preview-api/src/core-client.ts @@ -0,0 +1 @@ +export * from './modules/core-client'; diff --git a/code/lib/preview-api/src/index.ts b/code/lib/preview-api/src/index.ts index 099bd5cf6bc..7b16a286dd9 100644 --- a/code/lib/preview-api/src/index.ts +++ b/code/lib/preview-api/src/index.ts @@ -31,12 +31,12 @@ export { addons } from '@storybook/addons'; /** * DOCS API */ -export { DocsContext } from '@storybook/preview-web'; +export { DocsContext } from './preview-web'; /** * SIMULATION API */ -export { simulatePageLoad, simulateDOMContentLoaded } from '@storybook/preview-web'; +export { simulatePageLoad, simulateDOMContentLoaded } from './preview-web'; /** * STORIES API @@ -50,9 +50,9 @@ export { addLoader, addParameters, addStepRunner, -} from '@storybook/client-api'; -export { getQueryParam, getQueryParams } from '@storybook/client-api'; -export { setGlobalRender } from '@storybook/client-api'; +} from './client-api'; +export { getQueryParam, getQueryParams } from './client-api'; +export { setGlobalRender } from './client-api'; export { combineArgs, @@ -71,12 +71,12 @@ export { inferControls, userOrAutoTitleFromSpecifier, sortStoriesV7, -} from '@storybook/store'; +} from './store'; /** * STORIES API */ -export { ClientApi } from '@storybook/client-api'; -export { StoryStore } from '@storybook/store'; -export { Preview, PreviewWeb } from '@storybook/preview-web'; -export { start } from '@storybook/core-client'; +export { ClientApi } from './client-api'; +export { StoryStore } from './store'; +export { Preview, PreviewWeb } from './preview-web'; +export { start } from './core-client'; diff --git a/code/lib/client-api/src/ClientApi.test.ts b/code/lib/preview-api/src/modules/client-api/ClientApi.test.ts similarity index 100% rename from code/lib/client-api/src/ClientApi.test.ts rename to code/lib/preview-api/src/modules/client-api/ClientApi.test.ts diff --git a/code/lib/client-api/src/ClientApi.ts b/code/lib/preview-api/src/modules/client-api/ClientApi.ts similarity index 94% rename from code/lib/client-api/src/ClientApi.ts rename to code/lib/preview-api/src/modules/client-api/ClientApi.ts index 805b00fa24a..60d3025915d 100644 --- a/code/lib/client-api/src/ClientApi.ts +++ b/code/lib/preview-api/src/modules/client-api/ClientApi.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-this-alias */ /// import { dedent } from 'ts-dedent'; @@ -24,8 +25,8 @@ import type { Store_ModuleImportFn, Store_ModuleExports, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; -import { combineParameters, composeStepRunners, normalizeInputTypes } from '@storybook/store'; +import type { StoryStore } from '../../store'; +import { combineParameters, composeStepRunners, normalizeInputTypes } from '../../store'; import { StoryStoreFacade } from './StoryStoreFacade'; @@ -105,7 +106,9 @@ export const getGlobalRender = () => { return singleton.facade.projectAnnotations.render; }; -export const setGlobalRender = (render: StoryFn) => { +export const setGlobalRender = ( + render: typeof singleton['facade']['projectAnnotations']['render'] +) => { checkMethod('setGlobalRender'); singleton.facade.projectAnnotations.render = render; }; @@ -131,7 +134,7 @@ export class ClientApi { this.storyStore = storyStore; - // eslint-disable-next-line @typescript-eslint/no-this-alias + // @ts-expect-error (whatever) singleton = this; } @@ -147,7 +150,7 @@ export class ClientApi { } addDecorator = (decorator: DecoratorFunction) => { - this.facade.projectAnnotations.decorators.push(decorator); + this.facade.projectAnnotations.decorators?.push(decorator); }; addParameters = ({ @@ -175,12 +178,12 @@ export class ClientApi { addStepRunner = (stepRunner: StepRunner) => { this.facade.projectAnnotations.runStep = composeStepRunners( - [this.facade.projectAnnotations.runStep, stepRunner].filter(Boolean) + [this.facade.projectAnnotations.runStep, stepRunner].filter(Boolean) as StepRunner[] ); }; addLoader = (loader: LoaderFunction) => { - this.facade.projectAnnotations.loaders.push(loader); + this.facade.projectAnnotations.loaders?.push(loader); }; addArgs = (args: Args) => { @@ -198,11 +201,11 @@ export class ClientApi { }; addArgsEnhancer = (enhancer: ArgsEnhancer) => { - this.facade.projectAnnotations.argsEnhancers.push(enhancer); + this.facade.projectAnnotations.argsEnhancers?.push(enhancer); }; addArgTypesEnhancer = (enhancer: ArgTypesEnhancer) => { - this.facade.projectAnnotations.argTypesEnhancers.push(enhancer); + this.facade.projectAnnotations.argTypesEnhancers?.push(enhancer); }; // Because of the API of `storiesOf().add()` we don't have a good "end" call for a @@ -345,14 +348,14 @@ export class ClientApi { throw new Error(`You cannot add a decorator after the first story for a kind. Read more here: https://github.com/storybookjs/storybook/blob/master/MIGRATION.md#can-no-longer-add-decoratorsparameters-after-stories`); - meta.decorators.push(decorator); + meta.decorators?.push(decorator); return api; }; api.addLoader = (loader: LoaderFunction) => { if (hasAdded) throw new Error(`You cannot add a loader after the first story for a kind.`); - meta.loaders.push(loader); + meta.loaders?.push(loader); return api; }; @@ -374,7 +377,7 @@ Read more here: https://github.com/storybookjs/storybook/blob/master/MIGRATION.m // @deprecated raw = () => { - return this.storyStore.raw(); + return this.storyStore?.raw(); }; // @deprecated diff --git a/code/lib/client-api/src/StoryStoreFacade.ts b/code/lib/preview-api/src/modules/client-api/StoryStoreFacade.ts similarity index 87% rename from code/lib/client-api/src/StoryStoreFacade.ts rename to code/lib/preview-api/src/modules/client-api/StoryStoreFacade.ts index 3bbef76dc2e..f7b10b77d40 100644 --- a/code/lib/client-api/src/StoryStoreFacade.ts +++ b/code/lib/preview-api/src/modules/client-api/StoryStoreFacade.ts @@ -17,9 +17,9 @@ import type { Store_StoryIndex, StoryId, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; -import { userOrAutoTitle, sortStoriesV6 } from '@storybook/store'; import { logger } from '@storybook/client-logger'; +import type { StoryStore } from '../../store'; +import { userOrAutoTitle, sortStoriesV6 } from '../../store'; export class StoryStoreFacade { projectAnnotations: Store_NormalizedProjectAnnotations; @@ -60,36 +60,35 @@ export class StoryStoreFacade { const storyEntries = Object.entries(this.entries); // Add the kind parameters and global parameters to each entry - const sortableV6: [StoryId, Store_Story, Parameters, Parameters][] = - storyEntries.map(([storyId, { type, importPath, ...entry }]) => { - const exports = this.csfExports[importPath]; - const csfFile = store.processCSFFileWithCache( - exports, - importPath, - exports.default.title - ); + const sortableV6 = storyEntries.map(([storyId, { type, importPath, ...entry }]) => { + const exports = this.csfExports[importPath]; + const csfFile = store.processCSFFileWithCache( + exports, + importPath, + exports.default.title + ); - let storyLike: Store_Story; - if (type === 'story') { - storyLike = store.storyFromCSFFile({ storyId, csfFile }); - } else { - storyLike = { - ...entry, - story: entry.name, - kind: entry.title, - componentId: toId(entry.componentId || entry.title), - parameters: { fileName: importPath }, - } as any; - } - return [storyId, storyLike, csfFile.meta.parameters, this.projectAnnotations.parameters]; - }); + let storyLike: Store_Story; + if (type === 'story') { + storyLike = store.storyFromCSFFile({ storyId, csfFile }); + } else { + storyLike = { + ...entry, + story: entry.name, + kind: entry.title, + componentId: toId(entry.componentId || entry.title), + parameters: { fileName: importPath }, + } as any; + } + return [storyId, storyLike, csfFile.meta.parameters, this.projectAnnotations.parameters]; + }) as [StoryId, Store_Story, Parameters, Parameters][]; // NOTE: the sortStoriesV6 version returns the v7 data format. confusing but more convenient! let sortedV7: Addon_IndexEntry[]; try { sortedV7 = sortStoriesV6(sortableV6, storySortParameter, fileNameOrder); - } catch (err) { + } catch (err: any) { if (typeof storySortParameter === 'function') { throw new Error(dedent` Error sorting stories with sort parameter ${storySortParameter}: diff --git a/code/lib/client-api/src/index.ts b/code/lib/preview-api/src/modules/client-api/index.ts similarity index 100% rename from code/lib/client-api/src/index.ts rename to code/lib/preview-api/src/modules/client-api/index.ts diff --git a/code/lib/client-api/src/queryparams.ts b/code/lib/preview-api/src/modules/client-api/queryparams.ts similarity index 100% rename from code/lib/client-api/src/queryparams.ts rename to code/lib/preview-api/src/modules/client-api/queryparams.ts diff --git a/code/lib/client-api/src/typings.d.ts b/code/lib/preview-api/src/modules/client-api/typings.d.ts similarity index 100% rename from code/lib/client-api/src/typings.d.ts rename to code/lib/preview-api/src/modules/client-api/typings.d.ts diff --git a/code/lib/core-client/src/PreviewWeb.mockdata.ts b/code/lib/preview-api/src/modules/core-client/PreviewWeb.mockdata.ts similarity index 100% rename from code/lib/core-client/src/PreviewWeb.mockdata.ts rename to code/lib/preview-api/src/modules/core-client/PreviewWeb.mockdata.ts diff --git a/code/lib/core-client/src/executeLoadable.ts b/code/lib/preview-api/src/modules/core-client/executeLoadable.ts similarity index 100% rename from code/lib/core-client/src/executeLoadable.ts rename to code/lib/preview-api/src/modules/core-client/executeLoadable.ts diff --git a/code/lib/preview-api/src/modules/core-client/index.ts b/code/lib/preview-api/src/modules/core-client/index.ts new file mode 100644 index 00000000000..72d57e5f9d7 --- /dev/null +++ b/code/lib/preview-api/src/modules/core-client/index.ts @@ -0,0 +1,5 @@ +import { ClientApi } from '../../client-api'; +import { StoryStore } from '../../store'; +import { start } from './start'; + +export { start, ClientApi, StoryStore }; diff --git a/code/lib/core-client/src/start.test.ts b/code/lib/preview-api/src/modules/core-client/start.test.ts similarity index 99% rename from code/lib/core-client/src/start.test.ts rename to code/lib/preview-api/src/modules/core-client/start.test.ts index 8c3092d147e..bd4ff6e245f 100644 --- a/code/lib/core-client/src/start.test.ts +++ b/code/lib/preview-api/src/modules/core-client/start.test.ts @@ -2,8 +2,8 @@ import { STORY_RENDERED, STORY_UNCHANGED, SET_INDEX } from '@storybook/core-events'; import type { Store_ModuleExports, Path, Loadable } from '@storybook/types'; -import { setGlobalRender } from '@storybook/client-api'; import global from 'global'; +import { setGlobalRender } from '../../client-api'; import { waitForRender, waitForEvents, @@ -36,8 +36,8 @@ jest.mock('@storybook/channel-postmessage', () => ({ createChannel: () => mockCh jest.mock('react-dom'); // for the auto-title test -jest.mock('@storybook/store', () => { - const actualStore = jest.requireActual('@storybook/store'); +jest.mock('../../store', () => { + const actualStore = jest.requireActual('../../store'); return { ...actualStore, userOrAutoTitle: (importPath: Path, specifier: any, userTitle?: string) => @@ -45,8 +45,8 @@ jest.mock('@storybook/store', () => { }; }); -jest.mock('@storybook/preview-web', () => { - const actualPreviewWeb = jest.requireActual('@storybook/preview-web'); +jest.mock('../../preview-web', () => { + const actualPreviewWeb = jest.requireActual('../../preview-web'); class OverloadPreviewWeb extends actualPreviewWeb.PreviewWeb { constructor() { diff --git a/code/lib/core-client/src/start.ts b/code/lib/preview-api/src/modules/core-client/start.ts similarity index 97% rename from code/lib/core-client/src/start.ts rename to code/lib/preview-api/src/modules/core-client/start.ts index bb6748bb11f..25414650ca4 100644 --- a/code/lib/core-client/src/start.ts +++ b/code/lib/preview-api/src/modules/core-client/start.ts @@ -1,7 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ import global from 'global'; -import { ClientApi } from '@storybook/client-api'; -import { PreviewWeb } from '@storybook/preview-web'; import type { AnyFramework, ArgsStoryFn, @@ -12,6 +10,8 @@ import type { import { createChannel } from '@storybook/channel-postmessage'; import { addons } from '@storybook/addons'; import { FORCE_RE_RENDER } from '@storybook/core-events'; +import { PreviewWeb } from '../../preview-web'; +import { ClientApi } from '../../client-api'; import { executeLoadableForChanges } from './executeLoadable'; diff --git a/code/lib/core-client/src/typings.d.ts b/code/lib/preview-api/src/modules/core-client/typings.d.ts similarity index 100% rename from code/lib/core-client/src/typings.d.ts rename to code/lib/preview-api/src/modules/core-client/typings.d.ts diff --git a/code/lib/preview-web/src/Preview.tsx b/code/lib/preview-api/src/modules/preview-web/Preview.tsx similarity index 99% rename from code/lib/preview-web/src/Preview.tsx rename to code/lib/preview-api/src/modules/preview-web/Preview.tsx index fcf46c794a4..b9cec4dac04 100644 --- a/code/lib/preview-web/src/Preview.tsx +++ b/code/lib/preview-api/src/modules/preview-web/Preview.tsx @@ -29,7 +29,7 @@ import type { Store_WebProjectAnnotations, StoryId, } from '@storybook/types'; -import { StoryStore } from '@storybook/store'; +import { StoryStore } from '../../store'; import { StoryRender } from './render/StoryRender'; import type { TemplateDocsRender } from './render/TemplateDocsRender'; diff --git a/code/lib/preview-web/src/PreviewWeb.integration.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts similarity index 100% rename from code/lib/preview-web/src/PreviewWeb.integration.test.ts rename to code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts diff --git a/code/lib/preview-web/src/PreviewWeb.mockdata.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.mockdata.ts similarity index 100% rename from code/lib/preview-web/src/PreviewWeb.mockdata.ts rename to code/lib/preview-api/src/modules/preview-web/PreviewWeb.mockdata.ts diff --git a/code/lib/preview-web/src/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts similarity index 99% rename from code/lib/preview-web/src/PreviewWeb.test.ts rename to code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index 36cf0b17ce7..605b7df48e7 100644 --- a/code/lib/preview-web/src/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -30,8 +30,8 @@ import { import { logger } from '@storybook/client-logger'; import { addons, mockChannel as createMockChannel } from '@storybook/addons'; import type { AnyFramework } from '@storybook/types'; -import type { ModuleImportFn, WebProjectAnnotations } from '@storybook/store'; import { mocked } from 'ts-jest/utils'; +import type { ModuleImportFn, WebProjectAnnotations } from '../../store'; import { PreviewWeb } from './PreviewWeb'; import { diff --git a/code/lib/preview-web/src/PreviewWeb.tsx b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.tsx similarity index 100% rename from code/lib/preview-web/src/PreviewWeb.tsx rename to code/lib/preview-api/src/modules/preview-web/PreviewWeb.tsx diff --git a/code/lib/preview-web/src/UrlStore.test.ts b/code/lib/preview-api/src/modules/preview-web/UrlStore.test.ts similarity index 100% rename from code/lib/preview-web/src/UrlStore.test.ts rename to code/lib/preview-api/src/modules/preview-web/UrlStore.test.ts diff --git a/code/lib/preview-web/src/UrlStore.ts b/code/lib/preview-api/src/modules/preview-web/UrlStore.ts similarity index 100% rename from code/lib/preview-web/src/UrlStore.ts rename to code/lib/preview-api/src/modules/preview-web/UrlStore.ts diff --git a/code/lib/preview-web/src/WebView.ts b/code/lib/preview-api/src/modules/preview-web/WebView.ts similarity index 100% rename from code/lib/preview-web/src/WebView.ts rename to code/lib/preview-api/src/modules/preview-web/WebView.ts diff --git a/code/lib/preview-web/src/docs-context/DocsContext.ts b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContext.ts similarity index 98% rename from code/lib/preview-web/src/docs-context/DocsContext.ts rename to code/lib/preview-api/src/modules/preview-web/docs-context/DocsContext.ts index 50f46884899..cc0c66e7684 100644 --- a/code/lib/preview-web/src/docs-context/DocsContext.ts +++ b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContext.ts @@ -8,8 +8,8 @@ import type { StoryId, StoryName, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; import type { Channel } from '@storybook/channels'; +import type { StoryStore } from '../../store'; import type { DocsContextProps } from './DocsContextProps'; diff --git a/code/lib/preview-web/src/docs-context/DocsContextProps.ts b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContextProps.ts similarity index 100% rename from code/lib/preview-web/src/docs-context/DocsContextProps.ts rename to code/lib/preview-api/src/modules/preview-web/docs-context/DocsContextProps.ts diff --git a/code/lib/preview-web/src/docs-context/DocsRenderFunction.ts b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsRenderFunction.ts similarity index 100% rename from code/lib/preview-web/src/docs-context/DocsRenderFunction.ts rename to code/lib/preview-api/src/modules/preview-web/docs-context/DocsRenderFunction.ts diff --git a/code/lib/preview-web/src/index.ts b/code/lib/preview-api/src/modules/preview-web/index.ts similarity index 91% rename from code/lib/preview-web/src/index.ts rename to code/lib/preview-api/src/modules/preview-web/index.ts index dd3ff24cfec..f243aa5a98d 100644 --- a/code/lib/preview-web/src/index.ts +++ b/code/lib/preview-api/src/modules/preview-web/index.ts @@ -1,5 +1,5 @@ // FIXME: breaks builder-vite, remove this in 7.0 -export { composeConfigs } from '@storybook/store'; +export { composeConfigs } from '../../store'; export type { Store_WebProjectAnnotations as WebProjectAnnotations } from '@storybook/types'; export { Preview } from './Preview'; diff --git a/code/lib/preview-web/src/parseArgsParam.test.ts b/code/lib/preview-api/src/modules/preview-web/parseArgsParam.test.ts similarity index 100% rename from code/lib/preview-web/src/parseArgsParam.test.ts rename to code/lib/preview-api/src/modules/preview-web/parseArgsParam.test.ts diff --git a/code/lib/preview-web/src/parseArgsParam.ts b/code/lib/preview-api/src/modules/preview-web/parseArgsParam.ts similarity index 100% rename from code/lib/preview-web/src/parseArgsParam.ts rename to code/lib/preview-api/src/modules/preview-web/parseArgsParam.ts diff --git a/code/lib/preview-web/src/render/Render.ts b/code/lib/preview-api/src/modules/preview-web/render/Render.ts similarity index 100% rename from code/lib/preview-web/src/render/Render.ts rename to code/lib/preview-api/src/modules/preview-web/render/Render.ts diff --git a/code/lib/preview-web/src/render/StandaloneDocsRender.test.ts b/code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.test.ts similarity index 96% rename from code/lib/preview-web/src/render/StandaloneDocsRender.test.ts rename to code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.test.ts index 07e98e462ad..228286b3e8e 100644 --- a/code/lib/preview-web/src/render/StandaloneDocsRender.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.test.ts @@ -1,7 +1,7 @@ import { jest, describe, it, expect } from '@jest/globals'; import { Channel } from '@storybook/channels'; import type { AnyFramework, Addon_StandaloneDocsIndexEntry } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; +import type { StoryStore } from '../../store'; import { PREPARE_ABORTED } from './Render'; import { StandaloneDocsRender } from './StandaloneDocsRender'; diff --git a/code/lib/preview-web/src/render/StandaloneDocsRender.ts b/code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.ts similarity index 98% rename from code/lib/preview-web/src/render/StandaloneDocsRender.ts rename to code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.ts index 02137c7c892..8969018a630 100644 --- a/code/lib/preview-web/src/render/StandaloneDocsRender.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.ts @@ -5,9 +5,9 @@ import type { Store_ModuleExports, StoryId, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; import type { Channel } from '@storybook/channels'; import { DOCS_RENDERED } from '@storybook/core-events'; +import type { StoryStore } from '../../store'; import type { Render, RenderType } from './Render'; import { PREPARE_ABORTED } from './Render'; diff --git a/code/lib/preview-web/src/render/StoryRender.test.ts b/code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts similarity index 96% rename from code/lib/preview-web/src/render/StoryRender.test.ts rename to code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts index 4ca15195c07..b820552d441 100644 --- a/code/lib/preview-web/src/render/StoryRender.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts @@ -1,7 +1,7 @@ import { jest, describe, it, expect } from '@jest/globals'; import { Channel } from '@storybook/channels'; import type { AnyFramework, Addon_StoryIndexEntry } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; +import type { StoryStore } from '../../store'; import { PREPARE_ABORTED } from './Render'; import { StoryRender } from './StoryRender'; diff --git a/code/lib/preview-web/src/render/StoryRender.ts b/code/lib/preview-api/src/modules/preview-web/render/StoryRender.ts similarity index 99% rename from code/lib/preview-web/src/render/StoryRender.ts rename to code/lib/preview-api/src/modules/preview-web/render/StoryRender.ts index e2b3d056ae9..900b17a4051 100644 --- a/code/lib/preview-web/src/render/StoryRender.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/StoryRender.ts @@ -10,7 +10,6 @@ import type { StoryId, ViewMode, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; import type { Channel } from '@storybook/channels'; import { logger } from '@storybook/client-logger'; import { @@ -18,6 +17,7 @@ import { STORY_RENDERED, PLAY_FUNCTION_THREW_EXCEPTION, } from '@storybook/core-events'; +import type { StoryStore } from '../../store'; import type { Render, RenderType } from './Render'; import { PREPARE_ABORTED } from './Render'; diff --git a/code/lib/preview-web/src/render/TemplateDocsRender.test.ts b/code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.test.ts similarity index 96% rename from code/lib/preview-web/src/render/TemplateDocsRender.test.ts rename to code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.test.ts index e1b4bf1e474..164924d15ff 100644 --- a/code/lib/preview-web/src/render/TemplateDocsRender.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.test.ts @@ -1,7 +1,7 @@ import { jest, describe, it, expect } from '@jest/globals'; import { Channel } from '@storybook/channels'; import type { AnyFramework, Addon_TemplateDocsIndexEntry } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; +import type { StoryStore } from '../../store'; import { PREPARE_ABORTED } from './Render'; import { TemplateDocsRender } from './TemplateDocsRender'; diff --git a/code/lib/preview-web/src/render/TemplateDocsRender.ts b/code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.ts similarity index 98% rename from code/lib/preview-web/src/render/TemplateDocsRender.ts rename to code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.ts index dfe5a64577d..80e9a40602f 100644 --- a/code/lib/preview-web/src/render/TemplateDocsRender.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.ts @@ -5,9 +5,9 @@ import type { Store_Story, StoryId, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; import type { Channel } from '@storybook/channels'; import { DOCS_RENDERED } from '@storybook/core-events'; +import type { StoryStore } from '../../../store'; import type { Render, RenderType } from './Render'; import { PREPARE_ABORTED } from './Render'; diff --git a/code/lib/preview-web/src/simulate-pageload.test.ts b/code/lib/preview-api/src/modules/preview-web/simulate-pageload.test.ts similarity index 100% rename from code/lib/preview-web/src/simulate-pageload.test.ts rename to code/lib/preview-api/src/modules/preview-web/simulate-pageload.test.ts diff --git a/code/lib/preview-web/src/simulate-pageload.ts b/code/lib/preview-api/src/modules/preview-web/simulate-pageload.ts similarity index 100% rename from code/lib/preview-web/src/simulate-pageload.ts rename to code/lib/preview-api/src/modules/preview-web/simulate-pageload.ts diff --git a/code/lib/preview-web/src/typings.d.ts b/code/lib/preview-api/src/modules/preview-web/typings.d.ts similarity index 100% rename from code/lib/preview-web/src/typings.d.ts rename to code/lib/preview-api/src/modules/preview-web/typings.d.ts diff --git a/code/lib/store/src/ArgsStore.test.ts b/code/lib/preview-api/src/modules/store/ArgsStore.test.ts similarity index 100% rename from code/lib/store/src/ArgsStore.test.ts rename to code/lib/preview-api/src/modules/store/ArgsStore.test.ts diff --git a/code/lib/store/src/ArgsStore.ts b/code/lib/preview-api/src/modules/store/ArgsStore.ts similarity index 100% rename from code/lib/store/src/ArgsStore.ts rename to code/lib/preview-api/src/modules/store/ArgsStore.ts diff --git a/code/lib/store/src/GlobalsStore.test.ts b/code/lib/preview-api/src/modules/store/GlobalsStore.test.ts similarity index 100% rename from code/lib/store/src/GlobalsStore.test.ts rename to code/lib/preview-api/src/modules/store/GlobalsStore.test.ts diff --git a/code/lib/store/src/GlobalsStore.ts b/code/lib/preview-api/src/modules/store/GlobalsStore.ts similarity index 100% rename from code/lib/store/src/GlobalsStore.ts rename to code/lib/preview-api/src/modules/store/GlobalsStore.ts diff --git a/code/lib/store/src/StoryIndexStore.test.ts b/code/lib/preview-api/src/modules/store/StoryIndexStore.test.ts similarity index 100% rename from code/lib/store/src/StoryIndexStore.test.ts rename to code/lib/preview-api/src/modules/store/StoryIndexStore.test.ts diff --git a/code/lib/store/src/StoryIndexStore.ts b/code/lib/preview-api/src/modules/store/StoryIndexStore.ts similarity index 100% rename from code/lib/store/src/StoryIndexStore.ts rename to code/lib/preview-api/src/modules/store/StoryIndexStore.ts diff --git a/code/lib/store/src/StoryStore.test.ts b/code/lib/preview-api/src/modules/store/StoryStore.test.ts similarity index 100% rename from code/lib/store/src/StoryStore.test.ts rename to code/lib/preview-api/src/modules/store/StoryStore.test.ts diff --git a/code/lib/store/src/StoryStore.ts b/code/lib/preview-api/src/modules/store/StoryStore.ts similarity index 100% rename from code/lib/store/src/StoryStore.ts rename to code/lib/preview-api/src/modules/store/StoryStore.ts diff --git a/code/lib/store/src/args.test.ts b/code/lib/preview-api/src/modules/store/args.test.ts similarity index 100% rename from code/lib/store/src/args.test.ts rename to code/lib/preview-api/src/modules/store/args.test.ts diff --git a/code/lib/store/src/args.ts b/code/lib/preview-api/src/modules/store/args.ts similarity index 100% rename from code/lib/store/src/args.ts rename to code/lib/preview-api/src/modules/store/args.ts diff --git a/code/lib/store/src/autoTitle.test.ts b/code/lib/preview-api/src/modules/store/autoTitle.test.ts similarity index 100% rename from code/lib/store/src/autoTitle.test.ts rename to code/lib/preview-api/src/modules/store/autoTitle.test.ts diff --git a/code/lib/store/src/autoTitle.ts b/code/lib/preview-api/src/modules/store/autoTitle.ts similarity index 100% rename from code/lib/store/src/autoTitle.ts rename to code/lib/preview-api/src/modules/store/autoTitle.ts diff --git a/code/lib/store/src/csf/composeConfigs.test.ts b/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts similarity index 100% rename from code/lib/store/src/csf/composeConfigs.test.ts rename to code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts diff --git a/code/lib/store/src/csf/composeConfigs.ts b/code/lib/preview-api/src/modules/store/csf/composeConfigs.ts similarity index 100% rename from code/lib/store/src/csf/composeConfigs.ts rename to code/lib/preview-api/src/modules/store/csf/composeConfigs.ts diff --git a/code/lib/store/src/csf/getValuesFromArgTypes.ts b/code/lib/preview-api/src/modules/store/csf/getValuesFromArgTypes.ts similarity index 100% rename from code/lib/store/src/csf/getValuesFromArgTypes.ts rename to code/lib/preview-api/src/modules/store/csf/getValuesFromArgTypes.ts diff --git a/code/lib/store/src/csf/index.ts b/code/lib/preview-api/src/modules/store/csf/index.ts similarity index 100% rename from code/lib/store/src/csf/index.ts rename to code/lib/preview-api/src/modules/store/csf/index.ts diff --git a/code/lib/store/src/csf/normalizeComponentAnnotations.ts b/code/lib/preview-api/src/modules/store/csf/normalizeComponentAnnotations.ts similarity index 100% rename from code/lib/store/src/csf/normalizeComponentAnnotations.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeComponentAnnotations.ts diff --git a/code/lib/store/src/csf/normalizeInputTypes.test.ts b/code/lib/preview-api/src/modules/store/csf/normalizeInputTypes.test.ts similarity index 100% rename from code/lib/store/src/csf/normalizeInputTypes.test.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeInputTypes.test.ts diff --git a/code/lib/store/src/csf/normalizeInputTypes.ts b/code/lib/preview-api/src/modules/store/csf/normalizeInputTypes.ts similarity index 100% rename from code/lib/store/src/csf/normalizeInputTypes.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeInputTypes.ts diff --git a/code/lib/store/src/csf/normalizeProjectAnnotations.ts b/code/lib/preview-api/src/modules/store/csf/normalizeProjectAnnotations.ts similarity index 100% rename from code/lib/store/src/csf/normalizeProjectAnnotations.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeProjectAnnotations.ts diff --git a/code/lib/store/src/csf/normalizeStory.test.ts b/code/lib/preview-api/src/modules/store/csf/normalizeStory.test.ts similarity index 100% rename from code/lib/store/src/csf/normalizeStory.test.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeStory.test.ts diff --git a/code/lib/store/src/csf/normalizeStory.ts b/code/lib/preview-api/src/modules/store/csf/normalizeStory.ts similarity index 100% rename from code/lib/store/src/csf/normalizeStory.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeStory.ts diff --git a/code/lib/store/src/csf/prepareStory.test.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts similarity index 100% rename from code/lib/store/src/csf/prepareStory.test.ts rename to code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts diff --git a/code/lib/store/src/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts similarity index 100% rename from code/lib/store/src/csf/prepareStory.ts rename to code/lib/preview-api/src/modules/store/csf/prepareStory.ts diff --git a/code/lib/store/src/csf/processCSFFile.test.ts b/code/lib/preview-api/src/modules/store/csf/processCSFFile.test.ts similarity index 100% rename from code/lib/store/src/csf/processCSFFile.test.ts rename to code/lib/preview-api/src/modules/store/csf/processCSFFile.test.ts diff --git a/code/lib/store/src/csf/processCSFFile.ts b/code/lib/preview-api/src/modules/store/csf/processCSFFile.ts similarity index 100% rename from code/lib/store/src/csf/processCSFFile.ts rename to code/lib/preview-api/src/modules/store/csf/processCSFFile.ts diff --git a/code/lib/store/src/csf/stepRunners.test.ts b/code/lib/preview-api/src/modules/store/csf/stepRunners.test.ts similarity index 100% rename from code/lib/store/src/csf/stepRunners.test.ts rename to code/lib/preview-api/src/modules/store/csf/stepRunners.test.ts diff --git a/code/lib/store/src/csf/stepRunners.ts b/code/lib/preview-api/src/modules/store/csf/stepRunners.ts similarity index 100% rename from code/lib/store/src/csf/stepRunners.ts rename to code/lib/preview-api/src/modules/store/csf/stepRunners.ts diff --git a/code/lib/store/src/csf/testing-utils/index.test.ts b/code/lib/preview-api/src/modules/store/csf/testing-utils/index.test.ts similarity index 100% rename from code/lib/store/src/csf/testing-utils/index.test.ts rename to code/lib/preview-api/src/modules/store/csf/testing-utils/index.test.ts diff --git a/code/lib/store/src/csf/testing-utils/index.ts b/code/lib/preview-api/src/modules/store/csf/testing-utils/index.ts similarity index 100% rename from code/lib/store/src/csf/testing-utils/index.ts rename to code/lib/preview-api/src/modules/store/csf/testing-utils/index.ts diff --git a/code/lib/store/src/decorators.test.ts b/code/lib/preview-api/src/modules/store/decorators.test.ts similarity index 100% rename from code/lib/store/src/decorators.test.ts rename to code/lib/preview-api/src/modules/store/decorators.test.ts diff --git a/code/lib/store/src/decorators.ts b/code/lib/preview-api/src/modules/store/decorators.ts similarity index 100% rename from code/lib/store/src/decorators.ts rename to code/lib/preview-api/src/modules/store/decorators.ts diff --git a/code/lib/store/src/filterArgTypes.ts b/code/lib/preview-api/src/modules/store/filterArgTypes.ts similarity index 100% rename from code/lib/store/src/filterArgTypes.ts rename to code/lib/preview-api/src/modules/store/filterArgTypes.ts diff --git a/code/lib/store/src/hooks.test.ts b/code/lib/preview-api/src/modules/store/hooks.test.ts similarity index 100% rename from code/lib/store/src/hooks.test.ts rename to code/lib/preview-api/src/modules/store/hooks.test.ts diff --git a/code/lib/store/src/hooks.ts b/code/lib/preview-api/src/modules/store/hooks.ts similarity index 100% rename from code/lib/store/src/hooks.ts rename to code/lib/preview-api/src/modules/store/hooks.ts diff --git a/code/lib/store/src/index.ts b/code/lib/preview-api/src/modules/store/index.ts similarity index 100% rename from code/lib/store/src/index.ts rename to code/lib/preview-api/src/modules/store/index.ts diff --git a/code/lib/store/src/inferArgTypes.test.ts b/code/lib/preview-api/src/modules/store/inferArgTypes.test.ts similarity index 100% rename from code/lib/store/src/inferArgTypes.test.ts rename to code/lib/preview-api/src/modules/store/inferArgTypes.test.ts diff --git a/code/lib/store/src/inferArgTypes.ts b/code/lib/preview-api/src/modules/store/inferArgTypes.ts similarity index 100% rename from code/lib/store/src/inferArgTypes.ts rename to code/lib/preview-api/src/modules/store/inferArgTypes.ts diff --git a/code/lib/store/src/inferControls.test.ts b/code/lib/preview-api/src/modules/store/inferControls.test.ts similarity index 100% rename from code/lib/store/src/inferControls.test.ts rename to code/lib/preview-api/src/modules/store/inferControls.test.ts diff --git a/code/lib/store/src/inferControls.ts b/code/lib/preview-api/src/modules/store/inferControls.ts similarity index 100% rename from code/lib/store/src/inferControls.ts rename to code/lib/preview-api/src/modules/store/inferControls.ts diff --git a/code/lib/store/src/parameters.test.ts b/code/lib/preview-api/src/modules/store/parameters.test.ts similarity index 100% rename from code/lib/store/src/parameters.test.ts rename to code/lib/preview-api/src/modules/store/parameters.test.ts diff --git a/code/lib/store/src/parameters.ts b/code/lib/preview-api/src/modules/store/parameters.ts similarity index 100% rename from code/lib/store/src/parameters.ts rename to code/lib/preview-api/src/modules/store/parameters.ts diff --git a/code/lib/store/src/sortStories.ts b/code/lib/preview-api/src/modules/store/sortStories.ts similarity index 100% rename from code/lib/store/src/sortStories.ts rename to code/lib/preview-api/src/modules/store/sortStories.ts diff --git a/code/lib/store/src/storySort.test.ts b/code/lib/preview-api/src/modules/store/storySort.test.ts similarity index 100% rename from code/lib/store/src/storySort.test.ts rename to code/lib/preview-api/src/modules/store/storySort.test.ts diff --git a/code/lib/store/src/storySort.ts b/code/lib/preview-api/src/modules/store/storySort.ts similarity index 100% rename from code/lib/store/src/storySort.ts rename to code/lib/preview-api/src/modules/store/storySort.ts diff --git a/code/lib/store/src/typings.d.ts b/code/lib/preview-api/src/modules/store/typings.d.ts similarity index 100% rename from code/lib/store/src/typings.d.ts rename to code/lib/preview-api/src/modules/store/typings.d.ts diff --git a/code/lib/preview-api/src/preview-web.ts b/code/lib/preview-api/src/preview-web.ts new file mode 100644 index 00000000000..1f0814fb7af --- /dev/null +++ b/code/lib/preview-api/src/preview-web.ts @@ -0,0 +1 @@ +export * from './modules/preview-web'; diff --git a/code/lib/preview-api/src/store.ts b/code/lib/preview-api/src/store.ts new file mode 100644 index 00000000000..33f273a9603 --- /dev/null +++ b/code/lib/preview-api/src/store.ts @@ -0,0 +1 @@ +export * from './modules/store'; diff --git a/code/lib/preview-web/package.json b/code/lib/preview-web/package.json index d7b6a3ed83b..47839436b54 100644 --- a/code/lib/preview-web/package.json +++ b/code/lib/preview-web/package.json @@ -22,15 +22,15 @@ "sideEffects": false, "exports": { ".": { - "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "require": "./dist/entry.js", + "import": "./dist/entry.mjs", + "types": "./dist/entry.d.ts" }, "./package.json": "./package.json" }, - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "main": "dist/entry.js", + "module": "dist/entry.mjs", + "types": "dist/entry.d.ts", "files": [ "dist/**/*", "README.md", @@ -42,32 +42,11 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/addons": "7.0.0-alpha.47", - "@storybook/channels": "7.0.0-alpha.47", - "@storybook/client-logger": "7.0.0-alpha.47", - "@storybook/core-events": "7.0.0-alpha.47", - "@storybook/store": "7.0.0-alpha.47", - "@storybook/types": "7.0.0-alpha.47", - "ansi-to-html": "^0.6.11", - "global": "^4.4.0", - "lodash": "^4.17.21", - "qs": "^6.10.0", - "synchronous-promise": "^2.0.15", - "ts-dedent": "^2.0.0", - "util-deprecate": "^1.0.2" - }, - "devDependencies": { - "@storybook/channel-postmessage": "7.0.0-alpha.47", - "react": "16.14.0", - "ts-jest": "^28.0.8", - "typescript": "~4.6.3" - }, - "publishConfig": { - "access": "public" + "@storybook/preview-api": "7.0.0-alpha.47" }, "bundler": { "entries": [ - "./src/index.ts" + "./src/entry.ts" ] }, "gitHead": "1c706a4a778831e012343c905f86225fa71491a7" diff --git a/code/lib/preview-web/src/entry.ts b/code/lib/preview-web/src/entry.ts new file mode 100644 index 00000000000..bc3e97098ac --- /dev/null +++ b/code/lib/preview-web/src/entry.ts @@ -0,0 +1 @@ +export * from '@storybook/preview-api/dist/preview-web'; diff --git a/code/lib/store/package.json b/code/lib/store/package.json index 337fbbc3ea3..4a747deeb18 100644 --- a/code/lib/store/package.json +++ b/code/lib/store/package.json @@ -22,15 +22,15 @@ "sideEffects": false, "exports": { ".": { - "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "require": "./dist/entry.js", + "import": "./dist/entry.mjs", + "types": "./dist/entry.d.ts" }, "./package.json": "./package.json" }, - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "main": "dist/entry.js", + "module": "dist/entry.mjs", + "types": "dist/entry.d.ts", "files": [ "dist/**/*", "README.md", @@ -42,33 +42,14 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/addons": "7.0.0-alpha.47", - "@storybook/client-logger": "7.0.0-alpha.47", - "@storybook/core-events": "7.0.0-alpha.47", - "@storybook/csf": "next", - "@storybook/types": "7.0.0-alpha.47", - "dequal": "^2.0.2", - "global": "^4.4.0", - "lodash": "^4.17.21", - "memoizerific": "^1.11.3", - "slash": "^3.0.0", - "synchronous-promise": "^2.0.15", - "ts-dedent": "^2.0.0", - "util-deprecate": "^1.0.2" - }, - "devDependencies": { - "typescript": "~4.6.3" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + "@storybook/preview-api": "7.0.0-alpha.47" }, "publishConfig": { "access": "public" }, "bundler": { "entries": [ - "./src/index.ts" + "./src/entry.ts" ], "platform": "node" }, diff --git a/code/lib/store/src/entry.ts b/code/lib/store/src/entry.ts new file mode 100644 index 00000000000..5fb0b87c253 --- /dev/null +++ b/code/lib/store/src/entry.ts @@ -0,0 +1 @@ +export * from '@storybook/preview-api/dist/store'; diff --git a/code/yarn.lock b/code/yarn.lock index 7ba0a5291fa..90612493157 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6393,23 +6393,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/client-api@workspace:lib/client-api" dependencies: - "@storybook/addons": 7.0.0-alpha.47 - "@storybook/client-logger": 7.0.0-alpha.47 - "@storybook/core-common": 7.0.0-alpha.47 - "@storybook/csf": next - "@storybook/store": 7.0.0-alpha.47 - "@storybook/types": 7.0.0-alpha.47 - "@types/qs": ^6.9.5 - "@types/webpack-env": ^1.16.4 - global: ^4.4.0 - qs: ^6.10.0 - synchronous-promise: ^2.0.15 - ts-dedent: ^2.0.0 - typescript: ~4.6.3 - util-deprecate: ^1.0.2 - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 + "@storybook/preview-api": 7.0.0-alpha.47 languageName: unknown linkType: soft @@ -6488,23 +6472,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/core-client@workspace:lib/core-client" dependencies: - "@storybook/addons": 7.0.0-alpha.47 - "@storybook/channel-postmessage": 7.0.0-alpha.47 - "@storybook/channel-websocket": 7.0.0-alpha.47 - "@storybook/channels": 7.0.0-alpha.47 - "@storybook/client-api": 7.0.0-alpha.47 - "@storybook/client-logger": 7.0.0-alpha.47 - "@storybook/core-events": 7.0.0-alpha.47 - "@storybook/csf": next - "@storybook/preview-web": 7.0.0-alpha.47 - "@storybook/store": 7.0.0-alpha.47 - "@storybook/types": 7.0.0-alpha.47 - global: ^4.4.0 - typescript: ~4.6.3 - util-deprecate: ^1.0.2 - peerDependenciesMeta: - typescript: - optional: true + "@storybook/preview-api": 7.0.0-alpha.47 languageName: unknown linkType: soft @@ -7272,10 +7240,21 @@ __metadata: resolution: "@storybook/preview-api@workspace:lib/preview-api" dependencies: "@storybook/addons": 7.0.0-alpha.47 - "@storybook/client-api": 7.0.0-alpha.47 - "@storybook/core-client": 7.0.0-alpha.47 - "@storybook/preview-web": 7.0.0-alpha.47 - "@storybook/store": 7.0.0-alpha.47 + "@storybook/client-logger": 7.0.0-alpha.47 + "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/csf": next + "@storybook/types": 7.0.0-alpha.47 + "@types/qs": ^6.9.5 + "@types/webpack-env": ^1.16.4 + dequal: ^2.0.2 + global: ^4.4.0 + lodash: ^4.17.21 + memoizerific: ^1.11.3 + qs: ^6.10.0 + slash: ^3.0.0 + synchronous-promise: ^2.0.15 + ts-dedent: ^2.0.0 + util-deprecate: ^1.0.2 languageName: unknown linkType: soft @@ -7283,23 +7262,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/preview-web@workspace:lib/preview-web" dependencies: - "@storybook/addons": 7.0.0-alpha.47 - "@storybook/channel-postmessage": 7.0.0-alpha.47 - "@storybook/channels": 7.0.0-alpha.47 - "@storybook/client-logger": 7.0.0-alpha.47 - "@storybook/core-events": 7.0.0-alpha.47 - "@storybook/store": 7.0.0-alpha.47 - "@storybook/types": 7.0.0-alpha.47 - ansi-to-html: ^0.6.11 - global: ^4.4.0 - lodash: ^4.17.21 - qs: ^6.10.0 - react: 16.14.0 - synchronous-promise: ^2.0.15 - ts-dedent: ^2.0.0 - ts-jest: ^28.0.8 - typescript: ~4.6.3 - util-deprecate: ^1.0.2 + "@storybook/preview-api": 7.0.0-alpha.47 languageName: unknown linkType: soft @@ -7814,23 +7777,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/store@workspace:lib/store" dependencies: - "@storybook/addons": 7.0.0-alpha.47 - "@storybook/client-logger": 7.0.0-alpha.47 - "@storybook/core-events": 7.0.0-alpha.47 - "@storybook/csf": next - "@storybook/types": 7.0.0-alpha.47 - dequal: ^2.0.2 - global: ^4.4.0 - lodash: ^4.17.21 - memoizerific: ^1.11.3 - slash: ^3.0.0 - synchronous-promise: ^2.0.15 - ts-dedent: ^2.0.0 - typescript: ~4.6.3 - util-deprecate: ^1.0.2 - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 + "@storybook/preview-api": 7.0.0-alpha.47 languageName: unknown linkType: soft