diff --git a/.circleci/config.yml b/.circleci/config.yml index 6db12bf41959..e3f8ef172a8d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -504,19 +504,19 @@ workflows: requires: - unit-tests - create-sandboxes: - parallelism: 14 + parallelism: 13 requires: - build - build-sandboxes: - parallelism: 14 + parallelism: 13 requires: - create-sandboxes - chromatic-sandboxes: - parallelism: 11 + parallelism: 10 requires: - build-sandboxes - e2e-production: - parallelism: 9 + parallelism: 8 requires: - build-sandboxes - e2e-dev: @@ -524,7 +524,7 @@ workflows: requires: - create-sandboxes - test-runner-production: - parallelism: 9 + parallelism: 8 requires: - build-sandboxes - bench: @@ -560,19 +560,19 @@ workflows: requires: - unit-tests - create-sandboxes: - parallelism: 21 + parallelism: 20 requires: - build - build-sandboxes: - parallelism: 21 + parallelism: 20 requires: - create-sandboxes - chromatic-sandboxes: - parallelism: 18 + parallelism: 17 requires: - build-sandboxes - e2e-production: - parallelism: 16 + parallelism: 15 requires: - build-sandboxes - e2e-dev: @@ -580,7 +580,7 @@ workflows: requires: - create-sandboxes - test-runner-production: - parallelism: 16 + parallelism: 15 requires: - build-sandboxes - bench: @@ -614,22 +614,22 @@ workflows: requires: - build - create-sandboxes: - parallelism: 36 + parallelism: 34 requires: - build # - smoke-test-sandboxes: # disabled for now # requires: # - create-sandboxes - build-sandboxes: - parallelism: 36 + parallelism: 34 requires: - create-sandboxes - chromatic-sandboxes: - parallelism: 33 + parallelism: 31 requires: - build-sandboxes - e2e-production: - parallelism: 31 + parallelism: 29 requires: - build-sandboxes - e2e-dev: @@ -637,7 +637,7 @@ workflows: requires: - create-sandboxes - test-runner-production: - parallelism: 31 + parallelism: 29 requires: - build-sandboxes # TODO: reenable once we find out the source of flakyness diff --git a/CHANGELOG.md b/CHANGELOG.md index ca7fcf921544..5ba60ca1636f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 7.6.4 + +- Angular: Fix CSF Plugin - [#25098](https://github.com/storybookjs/storybook/pull/25098), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)! +- Viewport: Fix viewport dts files - [#25107](https://github.com/storybookjs/storybook/pull/25107), thanks [@kasperpeulen](https://github.com/kasperpeulen)! + ## 7.6.3 - Next.js: Fix next/font/local usage in babel mode - [#25045](https://github.com/storybookjs/storybook/pull/25045), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)! diff --git a/code/addons/storysource/package.json b/code/addons/storysource/package.json index cd767bfa3ead..2b3ffaed914e 100644 --- a/code/addons/storysource/package.json +++ b/code/addons/storysource/package.json @@ -47,6 +47,7 @@ "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts" }, "dependencies": { + "@storybook/source-loader": "workspace:*", "estraverse": "^5.2.0", "tiny-invariant": "^1.3.1" }, @@ -56,7 +57,6 @@ "@storybook/manager-api": "workspace:*", "@storybook/preview-api": "workspace:*", "@storybook/router": "workspace:*", - "@storybook/source-loader": "workspace:*", "@storybook/theming": "workspace:*", "@types/react": "^16.14.34", "@types/react-syntax-highlighter": "11.0.5", diff --git a/code/addons/viewport/package.json b/code/addons/viewport/package.json index f17c27d249bd..1d2b96571769 100644 --- a/code/addons/viewport/package.json +++ b/code/addons/viewport/package.json @@ -30,8 +30,6 @@ "import": "./dist/index.mjs" }, "./manager": "./dist/manager.js", - "./preview": "./dist/preview.ts", - "./register": "./dist/manager.js", "./package.json": "./package.json" }, "main": "dist/index.js", @@ -73,9 +71,6 @@ ], "managerEntries": [ "./src/manager.tsx" - ], - "previewEntries": [ - "./src/preview.ts" ] }, "gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17", diff --git a/code/addons/viewport/src/index.ts b/code/addons/viewport/src/index.ts index 341f696ad7b5..79e0216d7923 100644 --- a/code/addons/viewport/src/index.ts +++ b/code/addons/viewport/src/index.ts @@ -1,3 +1,2 @@ -export * from './constants'; export * from './defaults'; -export * from './shortcuts'; +export type * from './models'; diff --git a/code/addons/viewport/src/models/index.ts b/code/addons/viewport/src/models/index.ts index 0cc15c61f914..7eb7ed1a6942 100644 --- a/code/addons/viewport/src/models/index.ts +++ b/code/addons/viewport/src/models/index.ts @@ -1,2 +1,2 @@ -export * from './Viewport'; -export * from './ViewportAddonParameter'; +export type * from './Viewport'; +export type * from './ViewportAddonParameter'; diff --git a/code/addons/viewport/src/preview.ts b/code/addons/viewport/src/preview.ts deleted file mode 100644 index 05f32144967d..000000000000 --- a/code/addons/viewport/src/preview.ts +++ /dev/null @@ -1 +0,0 @@ -export { INITIAL_VIEWPORTS, DEFAULT_VIEWPORT, MINIMAL_VIEWPORTS } from './defaults'; diff --git a/code/lib/cli/src/sandbox-templates.ts b/code/lib/cli/src/sandbox-templates.ts index b40bdb4f22f8..6a6aaa78b1d6 100644 --- a/code/lib/cli/src/sandbox-templates.ts +++ b/code/lib/cli/src/sandbox-templates.ts @@ -107,17 +107,6 @@ const baseTemplates = { builder: '@storybook/builder-webpack5', }, }, - 'nextjs/12-js': { - name: 'Next.js v12 (Webpack | JavaScript)', - script: - 'yarn create next-app {{beforeDir}} -e https://github.com/vercel/next.js/tree/next-12-3-2/examples/hello-world && cd {{beforeDir}} && npm pkg set "dependencies.next"="^12.2.0" && yarn && git add . && git commit --amend --no-edit && cd ..', - expected: { - framework: '@storybook/nextjs', - renderer: '@storybook/react', - builder: '@storybook/builder-webpack5', - }, - skipTasks: ['e2e-tests-dev', 'bench'], - }, 'nextjs/default-js': { name: 'Next.js Latest (Webpack | JavaScript)', script: @@ -391,18 +380,6 @@ const baseTemplates = { // Remove smoke-test from the list once https://github.com/storybookjs/storybook/issues/19351 is fixed. skipTasks: ['smoke-test', 'e2e-tests-dev', 'bench'], }, - 'vue-cli/vue2-default-js': { - name: 'Vue CLI v2 (Webpack | JavaScript)', - script: - 'npx -p @vue/cli vue create {{beforeDir}} --default --packageManager=yarn --force --merge --preset="Default (Vue 2)" && cd {{beforeDir}} && echo "module.exports = {}" > webpack.config.js', - expected: { - framework: '@storybook/vue-webpack5', - renderer: '@storybook/vue', - builder: '@storybook/builder-webpack5', - }, - // Remove smoke-test from the list once https://github.com/storybookjs/storybook/issues/19351 is fixed. - skipTasks: ['smoke-test', 'e2e-tests-dev', 'bench'], - }, 'preact-webpack5/default-js': { name: 'Preact CLI Latest (Webpack | JavaScript)', script: @@ -567,7 +544,6 @@ export const normal: TemplateKey[] = [ 'react-vite/default-ts', 'angular-cli/default-ts', 'vue3-vite/default-ts', - 'vue-cli/vue2-default-js', 'lit-vite/default-ts', 'svelte-vite/default-ts', 'svelte-kit/skeleton-ts', @@ -599,7 +575,6 @@ export const daily: TemplateKey[] = [ 'lit-vite/default-js', 'svelte-kit/skeleton-js', 'svelte-vite/default-js', - 'nextjs/12-js', 'nextjs/default-js', 'nextjs/prerelease', 'qwik-vite/default-ts', diff --git a/code/lib/csf-plugin/src/index.ts b/code/lib/csf-plugin/src/index.ts index aed7a531ee32..ec0aaa1d52a9 100644 --- a/code/lib/csf-plugin/src/index.ts +++ b/code/lib/csf-plugin/src/index.ts @@ -12,15 +12,18 @@ const logger = console; export const unplugin = createUnplugin((options) => { return { name: 'unplugin-csf', - enforce: 'pre', - loadInclude(id) { + transformInclude(id) { return STORIES_REGEX.test(id); }, - async load(fname) { - const code = await fs.readFile(fname, 'utf-8'); + async transform(code, id) { + const sourceCode = await fs.readFile(id, 'utf-8'); try { - const csf = loadCsf(code, { makeTitle: (userTitle) => userTitle || 'default' }).parse(); - enrichCsf(csf, options); + const makeTitle = (userTitle: string) => userTitle || 'default'; + const csf = loadCsf(code, { makeTitle }).parse(); + const csfSource = loadCsf(sourceCode, { + makeTitle, + }).parse(); + enrichCsf(csf, csfSource, options); return formatCsf(csf, { sourceMaps: true }); } catch (err: any) { // This can be called on legacy storiesOf files, so just ignore diff --git a/code/lib/csf-tools/src/enrichCsf.test.ts b/code/lib/csf-tools/src/enrichCsf.test.ts index a8f5f3aaa09c..d793f730cecc 100644 --- a/code/lib/csf-tools/src/enrichCsf.test.ts +++ b/code/lib/csf-tools/src/enrichCsf.test.ts @@ -11,11 +11,16 @@ expect.addSnapshotSerializer({ test: (val) => true, }); -const enrich = (code: string, options?: EnrichCsfOptions) => { +const enrich = (code: string, originalCode: string, options?: EnrichCsfOptions) => { // we don't actually care about the title - const csf = loadCsf(code, { makeTitle: (userTitle) => userTitle || 'default' }).parse(); - enrichCsf(csf, options); + const csf = loadCsf(code, { + makeTitle: (userTitle) => userTitle || 'default', + }).parse(); + const csfSource = loadCsf(originalCode, { + makeTitle: (userTitle) => userTitle || 'default', + }).parse(); + enrichCsf(csf, csfSource, options); return formatCsf(csf); }; @@ -23,17 +28,28 @@ describe('enrichCsf', () => { describe('source', () => { it('csf1', () => { expect( - enrich(dedent` + enrich( + dedent` + // compiled code export default { title: 'Button', } - export const Basic = () =>