diff --git a/.circleci/config.yml b/.circleci/config.yml index 634d2d695dfa..81b226ffeb21 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,16 +4,16 @@ parameters: workflow: description: Which workflow to run type: enum - enum: ['normal', 'merged', 'daily', 'skipped', 'docs'] - default: 'skipped' + enum: ["normal", "merged", "daily", "skipped", "docs"] + default: "skipped" ghPrNumber: description: The PR number type: string - default: '' + default: "" ghBaseBranch: description: The name of the base branch (the target of the PR) type: string - default: 'next' + default: "next" executors: sb_node_22_classic: @@ -21,8 +21,8 @@ executors: class: description: The Resource class type: enum - enum: ['small', 'medium', 'medium+', 'large', 'xlarge'] - default: 'small' + enum: ["small", "medium", "medium+", "large", "xlarge"] + default: "small" working_directory: /tmp/storybook docker: - image: cimg/node:22.15.0 @@ -34,8 +34,8 @@ executors: class: description: The Resource class type: enum - enum: ['small', 'medium', 'medium+', 'large', 'xlarge'] - default: 'small' + enum: ["small", "medium", "medium+", "large", "xlarge"] + default: "small" working_directory: /tmp/storybook docker: - image: cimg/node:18.20.3-browsers @@ -47,11 +47,11 @@ executors: class: description: The Resource class type: enum - enum: ['small', 'medium', 'medium+', 'large', 'xlarge'] - default: 'small' + enum: ["small", "medium", "medium+", "large", "xlarge"] + default: "small" working_directory: /tmp/storybook docker: - - image: cimg/node:22.15.0-browsers + - image: cimg/node:22.16.0-browsers environment: NODE_OPTIONS: --max_old_space_size=6144 resource_class: <> @@ -60,8 +60,8 @@ executors: class: description: The Resource class type: enum - enum: ['small', 'medium', 'medium+', 'large', 'xlarge'] - default: 'small' + enum: ["small", "medium", "medium+", "large", "xlarge"] + default: "small" working_directory: /tmp/storybook docker: - image: mcr.microsoft.com/playwright:v1.52.0-noble @@ -74,12 +74,12 @@ orbs: browser-tools: circleci/browser-tools@1.4.1 discord: antonioned/discord@0.1.0 codecov: codecov/codecov@3.2.4 - node: circleci/node@5.2.0 + node: circleci/node@7.1.0 nx: nrwl/nx@1.6.2 commands: cancel-workflow-on-failure: - description: 'Cancels the entire workflow in case the previous step has failed' + description: "Cancels the entire workflow in case the previous step has failed" steps: - run: name: Cancel current workflow @@ -89,13 +89,13 @@ commands: echo "To execute all checks locally, please run yarn ci-tests" curl -X POST --header "Content-Type: application/json" "https://circleci.com/api/v2/workflow/${CIRCLE_WORKFLOW_ID}/cancel?circle-token=${WORKFLOW_CANCELER}" report-workflow-on-failure: - description: 'Reports failures to discord' + description: "Reports failures to discord" parameters: template: description: | Which template to report in discord. Applicable for parallel sandbox jobs type: string - default: 'none' + default: "none" steps: - run: when: on_fail @@ -105,7 +105,7 @@ commands: fail_only: true failure_message: $(yarn get-report-message << pipeline.parameters.workflow >> << parameters.template >>) start-event-collector: - description: 'Starts the event collector' + description: "Starts the event collector" steps: - run: name: Start Event Collector @@ -119,7 +119,7 @@ jobs: name: sb_node_22_classic steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - restore_cache: name: Restore Yarn cache keys: @@ -145,7 +145,7 @@ jobs: name: sb_node_22_classic steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - restore_cache: name: Restore Yarn cache keys: @@ -190,7 +190,7 @@ jobs: name: sb_node_22_classic steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -206,7 +206,7 @@ jobs: name: sb_node_22_classic steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -222,7 +222,7 @@ jobs: name: sb_node_22_classic steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . # if there is a base branch AND a PR number in parameters, benchmark packages against those @@ -271,9 +271,9 @@ jobs: name: sb_node_22_classic steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - nx/set-shas: - main-branch-name: 'next' + main-branch-name: "next" workflow-name: << pipeline.parameters.workflow >> - restore_cache: name: Restore Yarn cache @@ -297,7 +297,7 @@ jobs: executor: sb_node_22_browsers steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -326,7 +326,7 @@ jobs: parallelism: 2 steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -354,7 +354,7 @@ jobs: name: sb_node_22_browsers steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -368,7 +368,7 @@ jobs: name: sb_node_22_browsers steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - codecov/upload @@ -402,7 +402,7 @@ jobs: parallelism: << parameters.parallelism >> steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -426,7 +426,7 @@ jobs: cd sandbox/$(yarn get-sandbox-dir --template $TEMPLATE) && rm -rf node_modules environment: STORYBOOK_TELEMETRY_DEBUG: 1 - STORYBOOK_TELEMETRY_URL: 'http://localhost:6007/event-log' + STORYBOOK_TELEMETRY_URL: "http://localhost:6007/event-log" - report-workflow-on-failure: template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task sandbox) - persist_to_workspace: @@ -445,7 +445,7 @@ jobs: parallelism: << parameters.parallelism >> steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -465,7 +465,7 @@ jobs: parallelism: << parameters.parallelism >> steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -479,9 +479,9 @@ jobs: command: yarn task --task test-runner --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner) --no-link --start-from=never --junit environment: STORYBOOK_TELEMETRY_DEBUG: 1 - STORYBOOK_TELEMETRY_URL: 'http://localhost:6007/event-log' + STORYBOOK_TELEMETRY_URL: "http://localhost:6007/event-log" - run: - name: 'Check Telemetry' + name: "Check Telemetry" command: yarn --cwd scripts jiti ./event-log-checker.ts test-run $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner) - report-workflow-on-failure: template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner) @@ -497,7 +497,7 @@ jobs: parallelism: << parameters.parallelism >> steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -511,9 +511,9 @@ jobs: command: yarn task --task vitest-integration --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task vitest-integration) --no-link --start-from=never --junit environment: STORYBOOK_TELEMETRY_DEBUG: 1 - STORYBOOK_TELEMETRY_URL: 'http://localhost:6007/event-log' + STORYBOOK_TELEMETRY_URL: "http://localhost:6007/event-log" - run: - name: 'Check Telemetry' + name: "Check Telemetry" command: yarn --cwd scripts jiti ./event-log-checker.ts test-run $(yarn get-template --cadence << pipeline.parameters.workflow >> --task vitest-integration) - report-workflow-on-failure: template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task vitest-integration) @@ -529,14 +529,9 @@ jobs: parallelism: << parameters.parallelism >> steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - - run: - name: Running Test Runner in Dev mode - command: yarn task --task test-runner-dev --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner-dev) --no-link --start-from=never --junit - - report-workflow-on-failure: - template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner-dev) - store_test_results: path: test-results chromatic-sandboxes: @@ -573,7 +568,7 @@ jobs: parallelism: << parameters.parallelism >> steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -601,7 +596,7 @@ jobs: parallelism: << parameters.parallelism >> steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -629,7 +624,7 @@ jobs: parallelism: << parameters.parallelism >> steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -651,25 +646,53 @@ jobs: name: sb_node_22_browsers steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: - name: Storybook init for features + name: Verdaccio + background: true + command: | + cd code + yarn local-registry --open + - run: + name: Wait on verdaccio command: | cd code - yarn local-registry --open & yarn wait-on tcp:127.0.0.1:6001 - cd ../../ + yarn wait-on tcp:127.0.0.1:6002 + - run: + name: Storybook init for features + command: | + cd ../ mkdir features-1 - cd features-1 - npm set registry http://localhost:6001 + cd ./features-1 npx create-storybook --yes --package-manager npm --features dev docs test + environment: + IN_STORYBOOK_SANDBOX: true + STORYBOOK_INIT_EMPTY_TYPE: react-vite-ts + STORYBOOK_DISABLE_TELEMETRY: true + npm_config_registry: http://localhost:6001 + - run: + name: Vitest + command: | + cd ../features-1 npx vitest environment: IN_STORYBOOK_SANDBOX: true STORYBOOK_INIT_EMPTY_TYPE: react-vite-ts STORYBOOK_DISABLE_TELEMETRY: true + npm_config_registry: http://localhost:6001 + - run: + name: Create tar archive + command: | + cd ../ + tar -czf compressed.tar.gz features-1 + when: always + - store_artifacts: + path: ../compressed.tar.gz + destination: sandbox + when: always test-init-empty: executor: @@ -682,12 +705,12 @@ jobs: type: string steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - when: condition: - equal: ['npm', << parameters.packageManager >>] + equal: ["npm", << parameters.packageManager >>] steps: - run: name: Storybook init from empty directory (NPM) @@ -706,7 +729,7 @@ jobs: STORYBOOK_DISABLE_TELEMETRY: true - when: condition: - equal: ['yarn1', << parameters.packageManager >>] + equal: ["yarn1", << parameters.packageManager >>] steps: - run: name: Storybook init from empty directory (Yarn 1) @@ -724,7 +747,7 @@ jobs: STORYBOOK_DISABLE_TELEMETRY: true - when: condition: - equal: ['yarn2', << parameters.packageManager >>] + equal: ["yarn2", << parameters.packageManager >>] steps: - run: name: Storybook init from empty directory (Yarn 2) @@ -744,7 +767,7 @@ jobs: STORYBOOK_DISABLE_TELEMETRY: true - when: condition: - equal: ['pnpm', << parameters.packageManager >>] + equal: ["pnpm", << parameters.packageManager >>] steps: - run: name: Storybook init from empty directory (PNPM) @@ -764,7 +787,7 @@ jobs: STORYBOOK_DISABLE_TELEMETRY: true - when: condition: - equal: ['react-vite-ts', << parameters.template >>] + equal: ["react-vite-ts", << parameters.template >>] steps: - run: name: Storybook init from empty directory (--skip-install) @@ -788,7 +811,7 @@ jobs: class: medium steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -816,7 +839,7 @@ jobs: class: medium steps: - git-shallow-clone/checkout_advanced: - clone_options: '--depth 1 --verbose' + clone_options: "--depth 1 --verbose" - attach_workspace: at: . - run: @@ -825,6 +848,7 @@ jobs: working_directory: test-storybooks/portable-stories-kitchen-sink/<< parameters.directory >> environment: YARN_ENABLE_IMMUTABLE_INSTALLS: false + # Disabled due to Jest not working in the ESM-only paradigm. Will require some recipe to make it work - run: name: Run Jest tests command: yarn jest @@ -841,6 +865,32 @@ jobs: name: Run Cypress CT tests command: yarn cypress working_directory: test-storybooks/portable-stories-kitchen-sink/<< parameters.directory >> + test-yarn-pnp: + executor: + name: sb_playwright + class: medium + steps: + - git-shallow-clone/checkout_advanced: + clone_options: "--depth 1 --verbose" + - attach_workspace: + at: . + - node/install: + node-version: "22.17.0" + - run: + name: Install dependencies + command: yarn install --no-immutable + working_directory: test-storybooks/yarn-pnp + environment: + YARN_ENABLE_IMMUTABLE_INSTALLS: false + # Disabled due to Jest not working in the ESM-only paradigm. Will require some recipe to make it work + - run: + name: Build Storybook + command: yarn build-storybook + working_directory: test-storybooks/yarn-pnp + - run: + name: Run Vitest tests + command: yarn vitest run + working_directory: test-storybooks/yarn-pnp - report-workflow-on-failure workflows: docs: @@ -919,7 +969,10 @@ workflows: - build matrix: parameters: - directory: ['react', 'vue3', 'nextjs', 'svelte'] + directory: ["react", "vue3", "nextjs", "svelte"] + - test-yarn-pnp: + requires: + - build # TODO: reenable once we find out the source of flakyness # - test-runner-dev: # requires: @@ -984,13 +1037,16 @@ workflows: - build matrix: parameters: - directory: ['react', 'vue3', 'nextjs', 'svelte'] + directory: ["react", "vue3", "nextjs", "svelte"] - e2e-ui: requires: - build - test-init-features: requires: - build + - test-yarn-pnp: + requires: + - build # TODO: don't forget to reenable this # - bench-sandboxes: # parallelism: 5 @@ -1061,7 +1117,7 @@ workflows: - build matrix: parameters: - directory: ['react', 'vue3', 'nextjs', 'svelte'] + directory: ["react", "vue3", "nextjs", "svelte"] - e2e-ui: requires: - build @@ -1074,18 +1130,21 @@ workflows: matrix: parameters: packageManager: - - 'npm' + - "npm" # TODO: reenable once we find out the source of failure # - "yarn1" # - "yarn2" # - "pnpm" template: - - 'react-vite-ts' - - 'nextjs-ts' - - 'vue-vite-ts' + - "react-vite-ts" + - "nextjs-ts" + - "vue-vite-ts" # --smoke-test is not supported for the angular builder right now # - "angular-cli" - - 'lit-vite-ts' + - "lit-vite-ts" + - test-yarn-pnp: + requires: + - build # TODO: don't forget to reenable this # - bench-sandboxes: # parallelism: 5 diff --git a/.github/workflows/canary-release-pr.yml b/.github/workflows/canary-release-pr.yml index dde7b4eb3606..fff7da57c614 100644 --- a/.github/workflows/canary-release-pr.yml +++ b/.github/workflows/canary-release-pr.yml @@ -1,5 +1,5 @@ name: Publish canary release of PR -run-name: "Canary release: PR #${{ inputs.pr }}, triggered by ${{ github.triggering_actor }}" +run-name: "Canary release: PR #${{ github.event_name == 'workflow_dispatch' && inputs.pr || github.event.pull_request.number }}, triggered by ${{ github.triggering_actor }}" on: workflow_dispatch: @@ -8,13 +8,15 @@ on: description: "Pull request number to create a canary release for" required: true type: number + pull_request: + types: [opened, synchronize, reopened] env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1 concurrency: - group: ${{ github.workflow }}-${{ github.event.inputs.pr }} + group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && inputs.pr || github.event.pull_request.number }} cancel-in-progress: true permissions: @@ -25,6 +27,7 @@ jobs: name: Release canary version runs-on: ubuntu-latest environment: release + if: github.event_name == 'workflow_dispatch' || github.head_ref == 'sb10/esm-only' steps: - name: Fail if triggering actor is not administrator uses: prince-chrismc/check-actor-permissions-action@v2.0.4 @@ -36,7 +39,8 @@ jobs: env: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - PR_INFO=$(gh pr view ${{ inputs.pr }} --repo ${{ github.repository }} --json isCrossRepository,headRefOid,headRefName,headRepository,headRepositoryOwner --jq '{isFork: .isCrossRepository, owner: .headRepositoryOwner.login, repoName: .headRepository.name, branch: .headRefName, sha: .headRefOid}') + PR_NUMBER=${{ github.event_name == 'workflow_dispatch' && inputs.pr || github.event.pull_request.number }} + PR_INFO=$(gh pr view $PR_NUMBER --repo ${{ github.repository }} --json isCrossRepository,headRefOid,headRefName,headRepository,headRepositoryOwner --jq '{isFork: .isCrossRepository, owner: .headRepositoryOwner.login, repoName: .headRepository.name, branch: .headRefName, sha: .headRefOid}') echo $PR_INFO # Loop through each key-value pair in PR_INFO and set as step output for key in $(echo "$PR_INFO" | jq -r 'keys[]'); do @@ -78,7 +82,8 @@ jobs: id: version working-directory: scripts run: | - yarn release:version --exact 0.0.0-pr-${{ inputs.pr }}-sha-${{ steps.info.outputs.shortSha }} --verbose + PR_NUMBER=${{ github.event_name == 'workflow_dispatch' && inputs.pr || github.event.pull_request.number }} + yarn release:version --exact 0.0.0-pr-$PR_NUMBER-sha-${{ steps.info.outputs.shortSha }} --verbose - name: Publish v${{ steps.version.outputs.next-version }} env: @@ -91,7 +96,7 @@ jobs: uses: mcky/find-and-replace-pull-request-body@v1.1.6-mcky with: githubToken: ${{ secrets.GH_TOKEN }} - prNumber: ${{ inputs.pr }} + prNumber: ${{ github.event_name == 'workflow_dispatch' && inputs.pr || '' }} find: "CANARY_RELEASE_SECTION" isHtmlCommentTag: true replace: | @@ -111,7 +116,7 @@ jobs: To request a new release of this pull request, mention the `@storybookjs/core` team. - _core team members can create a new canary release [here](https://github.com/storybookjs/storybook/actions/workflows/canary-release-pr.yml) or locally with `gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=${{ inputs.pr }}`_ + _core team members can create a new canary release [here](https://github.com/storybookjs/storybook/actions/workflows/canary-release-pr.yml) or locally with `gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=${{ github.event_name == 'workflow_dispatch' && inputs.pr || github.event.pull_request.number }}`_ - name: Create failing comment on PR @@ -119,6 +124,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - gh pr comment ${{ inputs.pr }}\ + PR_NUMBER=${{ github.event_name == 'workflow_dispatch' && inputs.pr || github.event.pull_request.number }} + gh pr comment $PR_NUMBER\ --repo "${{github.repository }}"\ --body "Failed to publish canary version of this pull request, triggered by @${{ github.triggering_actor }}. See the failed workflow run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" diff --git a/.github/workflows/tests-unit.yml b/.github/workflows/tests-unit.yml index a1bdcd6d0d9f..0c6a9f61b333 100644 --- a/.github/workflows/tests-unit.yml +++ b/.github/workflows/tests-unit.yml @@ -13,8 +13,6 @@ env: jobs: build: name: Core Unit Tests, windows-latest - strategy: - fail-fast: false runs-on: windows-11-arm steps: - uses: actions/checkout@v4 @@ -24,6 +22,10 @@ jobs: uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" + cache: 'yarn' + cache-dependency-path: | + code/yarn.lock + scripts/yarn.lock - name: install scripts run: | diff --git a/.nvmrc b/.nvmrc index d7bc8d4dbf5f..9995f913b45c 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1,2 +1,2 @@ -22.13.1 +22.16.0 diff --git a/MIGRATION.md b/MIGRATION.md index f6120ef2dff7..decbf7708c95 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,5 +1,9 @@

Migration

+- [From version 9.x to 10.0.0](#from-version-9x-to-1000) + - [Core Changes](#core-changes) + - [Node.js 20.19+ or 22.12+ required](#nodejs-2019-or-2212-required) + - [Require `tsconfig.json` `moduleResolution` set to value that supports `types` condition](#require-tsconfigjson-moduleresolution-set-to-value-that-supports-types-condition) - [From version 8.x to 9.0.0](#from-version-8x-to-900) - [Core Changes and Removals](#core-changes-and-removals) - [Dropped support for legacy packages](#dropped-support-for-legacy-packages) @@ -97,7 +101,7 @@ - [MDX is upgraded to v3](#mdx-is-upgraded-to-v3) - [Dropping support for \*.stories.mdx (CSF in MDX) format and MDX1 support](#dropping-support-for-storiesmdx-csf-in-mdx-format-and-mdx1-support) - [Dropping support for id, name and story in Story block](#dropping-support-for-id-name-and-story-in-story-block) - - [Core changes](#core-changes) + - [Core changes](#core-changes-1) - [`framework.options.builder.useSWC` for Webpack5-based projects removed](#frameworkoptionsbuilderuseswc-for-webpack5-based-projects-removed) - [Removed `@babel/core` and `babel-loader` from `@storybook/builder-webpack5`](#removed-babelcore-and-babel-loader-from-storybookbuilder-webpack5) - [`framework.options.fastRefresh` for Webpack5-based projects removed](#frameworkoptionsfastrefresh-for-webpack5-based-projects-removed) @@ -477,6 +481,37 @@ - [Packages renaming](#packages-renaming) - [Deprecated embedded addons](#deprecated-embedded-addons) +## From version 9.x to 10.0.0 + +### Core Changes + +#### Node.js 20.19+ or 22.12+ required + +Storybook 10 now requires Node.js version 20.19+ or 22.12+. We require these new ranges so Node.js supports `require(esm)` without a flag. + +#### Require `tsconfig.json` `moduleResolution` set to value that supports `types` condition + +Storybook 10 has removed all `typesVersions` fields from `package.json` files. This field was previously needed for older TypeScript module resolution strategies that didn't support the `types` condition in package.json exports. + +**Required action:** Update your `tsconfig.json` to use a `moduleResolution` that supports the `types` condition: + +```json +{ + "compilerOptions": { + "moduleResolution": "bundler" // or "node16"/"nodenext" + } +} +``` + +**Supported values:** + +- `"bundler"` (recommended for modern bundler-based projects) +- `"node16"` or `"nodenext"` (Node.js 16+ module resolution) + +**Note:** If you're currently using `moduleResolution: "node"` (the old Node.js 10-style resolution), you'll need to upgrade to one of the supported values above. + +This change simplifies our package structure and aligns with modern TypeScript standards. Only TypeScript projects are affected - JavaScript projects require no changes. + ## From version 8.x to 9.0.0 ### Core Changes and Removals diff --git a/code/.storybook/bench.stories.tsx b/code/.storybook/bench.stories.tsx index 09bb95c7f225..d62ebba5ab35 100644 --- a/code/.storybook/bench.stories.tsx +++ b/code/.storybook/bench.stories.tsx @@ -35,10 +35,14 @@ export default { labels: Object.fromEntries( Object.keys(allMetafiles).map((path) => { const [, dirName, subEntry] = /esbuild-metafiles\/(.+)\/(.+).json/.exec(path)!; - const pkgName = PACKAGES_WITHOUT_ORG.includes(dirName) + let pkgName = PACKAGES_WITHOUT_ORG.includes(dirName) ? dirName : `@storybook/${dirName}`; + if (pkgName === '@storybook/core') { + pkgName = 'storybook'; + } + return [ safeMetafileArg(path), subEntry !== 'metafile' ? `${pkgName} - ${subEntry}` : pkgName, @@ -66,6 +70,31 @@ export default { render: (args, { loaded }) => { const { encodedMetafile = '' } = loaded ?? {}; + if (encodedMetafile.length > 2020836) { + return ( +
+

Metafile is too large

+

+ The metafile {args.metafile} is too large to be displayed + in the iframe. This is because we base64-encode the contents of the metafile into the + URL of the {'