diff --git a/.circleci/config.yml b/.circleci/config.yml index 9b03dd3739bc..2273bcc5bdf3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -609,22 +609,22 @@ workflows: requires: - build - create-sandboxes: - parallelism: 34 + parallelism: 36 requires: - build # - smoke-test-sandboxes: # disabled for now # requires: # - create-sandboxes - build-sandboxes: - parallelism: 34 + parallelism: 36 requires: - create-sandboxes - chromatic-sandboxes: - parallelism: 31 + parallelism: 33 requires: - build-sandboxes - e2e-production: - parallelism: 31 + parallelism: 33 requires: - build-sandboxes - e2e-dev: @@ -632,7 +632,7 @@ workflows: requires: - create-sandboxes - test-runner-production: - parallelism: 31 + parallelism: 33 requires: - build-sandboxes # TODO: reenable once we find out the source of flakyness diff --git a/.github/workflows/generate-sandboxes-main.yml b/.github/workflows/generate-sandboxes-main.yml index 77d3f8c8646d..7d9328578493 100644 --- a/.github/workflows/generate-sandboxes-main.yml +++ b/.github/workflows/generate-sandboxes-main.yml @@ -43,7 +43,7 @@ jobs: run: yarn wait-on http://localhost:6001 working-directory: ./code - name: Generate - run: yarn generate-sandboxes --local-registry --exclude=angular-cli/prerelease + run: yarn generate-sandboxes --local-registry working-directory: ./code - name: Publish run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=main diff --git a/.github/workflows/generate-sandboxes-next.yml b/.github/workflows/generate-sandboxes-next.yml index 92e79bef6468..8a28c4cbb23a 100644 --- a/.github/workflows/generate-sandboxes-next.yml +++ b/.github/workflows/generate-sandboxes-next.yml @@ -43,7 +43,7 @@ jobs: run: yarn wait-on http://localhost:6001 working-directory: ./code - name: Generate - run: yarn generate-sandboxes --local-registry --exclude=angular-cli/prerelease --debug + run: yarn generate-sandboxes --local-registry --debug working-directory: ./code - name: Publish run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=next diff --git a/code/frameworks/nextjs/package.json b/code/frameworks/nextjs/package.json index 891ea29585ee..cbe8a52f0360 100644 --- a/code/frameworks/nextjs/package.json +++ b/code/frameworks/nextjs/package.json @@ -119,7 +119,7 @@ "@types/babel__core": "^7", "@types/babel__plugin-transform-runtime": "^7", "@types/babel__preset-env": "^7", - "next": "13.4.19", + "next": "13.5.4", "typescript": "^4.9.3", "webpack": "^5.65.0" }, diff --git a/code/frameworks/nextjs/src/config/webpack.ts b/code/frameworks/nextjs/src/config/webpack.ts index f5e72bc360d8..9d7c85d8c003 100644 --- a/code/frameworks/nextjs/src/config/webpack.ts +++ b/code/frameworks/nextjs/src/config/webpack.ts @@ -48,7 +48,7 @@ const setupRuntimeConfig = (baseConfig: WebpackConfig, nextConfig: NextConfig): }), }; - const newNextLinkBehavior = nextConfig.experimental?.newNextLinkBehavior; + const newNextLinkBehavior = (nextConfig.experimental as any)?.newNextLinkBehavior; /** * In Next 13.0.0 - 13.0.5, the `newNextLinkBehavior` option now defaults to truthy (still diff --git a/code/frameworks/nextjs/src/dependency-map.ts b/code/frameworks/nextjs/src/dependency-map.ts index 70ad2ece94e0..dd848087f3e3 100644 --- a/code/frameworks/nextjs/src/dependency-map.ts +++ b/code/frameworks/nextjs/src/dependency-map.ts @@ -6,17 +6,19 @@ const mapping: Record> = { '<11.1.0': { 'next/dist/next-server/lib/router-context': 'next/dist/next-server/lib/router-context', }, - '>=11.1.0': { + '>=11.1.0 <13.5.0': { 'next/dist/shared/lib/router-context': 'next/dist/shared/lib/router-context', }, - '>=13.5.0': { - 'next/dist/shared/lib/router-context': 'next/dist/shared/lib/router-context.shared-runtime', - 'next/dist/shared/lib/head-manager-context': - 'next/dist/shared/lib/head-manager-context.shared-runtime', - 'next/dist/shared/lib/app-router-context': - 'next/dist/shared/lib/app-router-context.shared-runtime', - 'next/dist/shared/lib/hooks-client-context': - 'next/dist/shared/lib/hooks-client-context.shared-runtime', + '>=13.0.2 <13.5.0': { + 'next/dist/shared/lib/hooks-client-context.shared-runtime': + 'next/dist/shared/lib/hooks-client-context', + }, + '<13.5.0': { + 'next/dist/shared/lib/router-context.shared-runtime': 'next/dist/shared/lib/router-context', + 'next/dist/shared/lib/head-manager-context.shared-runtime': + 'next/dist/shared/lib/head-manager-context', + 'next/dist/shared/lib/app-router-context.shared-runtime': + 'next/dist/shared/lib/app-router-context', }, }; diff --git a/code/frameworks/nextjs/src/head-manager/head-manager-provider.tsx b/code/frameworks/nextjs/src/head-manager/head-manager-provider.tsx index 6d8ab263f92c..45c3a4ab4c33 100644 --- a/code/frameworks/nextjs/src/head-manager/head-manager-provider.tsx +++ b/code/frameworks/nextjs/src/head-manager/head-manager-provider.tsx @@ -1,5 +1,5 @@ import React, { useMemo } from 'react'; -import { HeadManagerContext } from 'next/dist/shared/lib/head-manager-context'; +import { HeadManagerContext } from 'next/dist/shared/lib/head-manager-context.shared-runtime'; import initHeadManager from 'next/dist/client/head-manager'; type HeadManagerValue = { diff --git a/code/frameworks/nextjs/src/routing/app-router-provider.tsx b/code/frameworks/nextjs/src/routing/app-router-provider.tsx index e25c2f1488b4..a7f0bd326f9b 100644 --- a/code/frameworks/nextjs/src/routing/app-router-provider.tsx +++ b/code/frameworks/nextjs/src/routing/app-router-provider.tsx @@ -3,11 +3,11 @@ import type { LayoutRouterContext as TLayoutRouterContext, AppRouterContext as TAppRouterContext, GlobalLayoutRouterContext as TGlobalLayoutRouterContext, -} from 'next/dist/shared/lib/app-router-context'; +} from 'next/dist/shared/lib/app-router-context.shared-runtime'; import type { PathnameContext as TPathnameContext, SearchParamsContext as TSearchParamsContext, -} from 'next/dist/shared/lib/hooks-client-context'; +} from 'next/dist/shared/lib/hooks-client-context.shared-runtime'; import type { FlightRouterState } from 'next/dist/server/app-render/types'; import type { RouteParams } from './types'; @@ -25,12 +25,16 @@ let SearchParamsContext: typeof TSearchParamsContext; let GlobalLayoutRouterContext: typeof TGlobalLayoutRouterContext; try { - AppRouterContext = require('next/dist/shared/lib/app-router-context').AppRouterContext; - LayoutRouterContext = require('next/dist/shared/lib/app-router-context').LayoutRouterContext; - PathnameContext = require('next/dist/shared/lib/hooks-client-context').PathnameContext; - SearchParamsContext = require('next/dist/shared/lib/hooks-client-context').SearchParamsContext; + AppRouterContext = + require('next/dist/shared/lib/app-router-context.shared-runtime').AppRouterContext; + LayoutRouterContext = + require('next/dist/shared/lib/app-router-context.shared-runtime').LayoutRouterContext; + PathnameContext = + require('next/dist/shared/lib/hooks-client-context.shared-runtime').PathnameContext; + SearchParamsContext = + require('next/dist/shared/lib/hooks-client-context.shared-runtime').SearchParamsContext; GlobalLayoutRouterContext = - require('next/dist/shared/lib/app-router-context').GlobalLayoutRouterContext; + require('next/dist/shared/lib/app-router-context.shared-runtime').GlobalLayoutRouterContext; } catch { AppRouterContext = React.Fragment as any; LayoutRouterContext = React.Fragment as any; diff --git a/code/frameworks/nextjs/src/routing/page-router-provider.tsx b/code/frameworks/nextjs/src/routing/page-router-provider.tsx index c882e3bee5b3..e91819fde38e 100644 --- a/code/frameworks/nextjs/src/routing/page-router-provider.tsx +++ b/code/frameworks/nextjs/src/routing/page-router-provider.tsx @@ -1,5 +1,5 @@ import type { Globals } from '@storybook/csf'; -import { RouterContext } from 'next/dist/shared/lib/router-context'; +import { RouterContext } from 'next/dist/shared/lib/router-context.shared-runtime'; import React from 'react'; import type { RouteParams } from './types'; diff --git a/code/lib/cli/src/sandbox-templates.ts b/code/lib/cli/src/sandbox-templates.ts index 69e858f1d14f..3802d67b858c 100644 --- a/code/lib/cli/src/sandbox-templates.ts +++ b/code/lib/cli/src/sandbox-templates.ts @@ -137,6 +137,17 @@ const baseTemplates = { }, skipTasks: ['e2e-tests-dev', 'bench'], }, + 'nextjs/prerelease': { + name: 'Next.js Prerelease (Webpack | TypeScript)', + script: + 'npx create-next-app@canary {{beforeDir}} --typescript --eslint --tailwind --app --import-alias="@/*" --src-dir', + expected: { + framework: '@storybook/nextjs', + renderer: '@storybook/react', + builder: '@storybook/builder-webpack5', + }, + skipTasks: ['e2e-tests-dev', 'bench'], + }, 'react-vite/default-js': { name: 'React Latest (Vite | JavaScript)', script: 'npm create vite@latest --yes {{beforeDir}} -- --template react', @@ -296,8 +307,6 @@ const baseTemplates = { builder: '@storybook/builder-webpack5', }, skipTasks: ['e2e-tests-dev', 'bench'], - // TODO: Should be removed after we merge this PR: https://github.com/storybookjs/storybook/pull/24188 - inDevelopment: true, }, 'angular-cli/default-ts': { name: 'Angular CLI Latest (Webpack | TypeScript)', @@ -586,8 +595,7 @@ export const merged: TemplateKey[] = [ ]; export const daily: TemplateKey[] = [ ...merged, - // TODO: Should be re-added after we merge this PR: https://github.com/storybookjs/storybook/pull/24188 - // 'angular-cli/prerelease', + 'angular-cli/prerelease', 'cra/default-js', 'react-vite/default-js', 'vue3-vite/default-js', @@ -598,6 +606,7 @@ export const daily: TemplateKey[] = [ 'svelte-vite/default-js', 'nextjs/12-js', 'nextjs/default-js', + 'nextjs/prerelease', 'qwik-vite/default-ts', 'preact-webpack5/default-js', 'preact-vite/default-js', diff --git a/code/yarn.lock b/code/yarn.lock index 041e96115807..63b6817c354a 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -3973,72 +3973,72 @@ __metadata: languageName: node linkType: hard -"@next/env@npm:13.4.19": - version: 13.4.19 - resolution: "@next/env@npm:13.4.19" - checksum: 0d9cb76fedcde6f8116c5f029d999cccaf929c9eb8c55daf1d38ae223a80113abae28834e537b26b81731d84ed14fd5231301b2126cd7d9097a7e175dd79bf59 +"@next/env@npm:13.5.4": + version: 13.5.4 + resolution: "@next/env@npm:13.5.4" + checksum: 69c013047371bde6c4dc6d03ec77140059bd4e3db38c1991a8aa8a9c8ce4d1370b98a141145a6f60e23f32ce97a3040b448bfd0455b0d9e5ba6efda8df33c89f languageName: node linkType: hard -"@next/swc-darwin-arm64@npm:13.4.19": - version: 13.4.19 - resolution: "@next/swc-darwin-arm64@npm:13.4.19" +"@next/swc-darwin-arm64@npm:13.5.4": + version: 13.5.4 + resolution: "@next/swc-darwin-arm64@npm:13.5.4" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@next/swc-darwin-x64@npm:13.4.19": - version: 13.4.19 - resolution: "@next/swc-darwin-x64@npm:13.4.19" +"@next/swc-darwin-x64@npm:13.5.4": + version: 13.5.4 + resolution: "@next/swc-darwin-x64@npm:13.5.4" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@next/swc-linux-arm64-gnu@npm:13.4.19": - version: 13.4.19 - resolution: "@next/swc-linux-arm64-gnu@npm:13.4.19" +"@next/swc-linux-arm64-gnu@npm:13.5.4": + version: 13.5.4 + resolution: "@next/swc-linux-arm64-gnu@npm:13.5.4" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-arm64-musl@npm:13.4.19": - version: 13.4.19 - resolution: "@next/swc-linux-arm64-musl@npm:13.4.19" +"@next/swc-linux-arm64-musl@npm:13.5.4": + version: 13.5.4 + resolution: "@next/swc-linux-arm64-musl@npm:13.5.4" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@next/swc-linux-x64-gnu@npm:13.4.19": - version: 13.4.19 - resolution: "@next/swc-linux-x64-gnu@npm:13.4.19" +"@next/swc-linux-x64-gnu@npm:13.5.4": + version: 13.5.4 + resolution: "@next/swc-linux-x64-gnu@npm:13.5.4" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-x64-musl@npm:13.4.19": - version: 13.4.19 - resolution: "@next/swc-linux-x64-musl@npm:13.4.19" +"@next/swc-linux-x64-musl@npm:13.5.4": + version: 13.5.4 + resolution: "@next/swc-linux-x64-musl@npm:13.5.4" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@next/swc-win32-arm64-msvc@npm:13.4.19": - version: 13.4.19 - resolution: "@next/swc-win32-arm64-msvc@npm:13.4.19" +"@next/swc-win32-arm64-msvc@npm:13.5.4": + version: 13.5.4 + resolution: "@next/swc-win32-arm64-msvc@npm:13.5.4" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@next/swc-win32-ia32-msvc@npm:13.4.19": - version: 13.4.19 - resolution: "@next/swc-win32-ia32-msvc@npm:13.4.19" +"@next/swc-win32-ia32-msvc@npm:13.5.4": + version: 13.5.4 + resolution: "@next/swc-win32-ia32-msvc@npm:13.5.4" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@next/swc-win32-x64-msvc@npm:13.4.19": - version: 13.4.19 - resolution: "@next/swc-win32-x64-msvc@npm:13.4.19" +"@next/swc-win32-x64-msvc@npm:13.5.4": + version: 13.5.4 + resolution: "@next/swc-win32-x64-msvc@npm:13.5.4" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -7323,7 +7323,7 @@ __metadata: fs-extra: ^11.1.0 image-size: ^1.0.0 loader-utils: ^3.2.0 - next: 13.4.19 + next: 13.5.4 node-polyfill-webpack-plugin: ^2.0.1 pnp-webpack-plugin: ^1.7.0 postcss: ^8.4.21 @@ -8689,12 +8689,12 @@ __metadata: languageName: node linkType: hard -"@swc/helpers@npm:0.5.1": - version: 0.5.1 - resolution: "@swc/helpers@npm:0.5.1" +"@swc/helpers@npm:0.5.2": + version: 0.5.2 + resolution: "@swc/helpers@npm:0.5.2" dependencies: tslib: ^2.4.0 - checksum: 2e2272c8278351670e1daf27cc634ace793afb378dcc85be2800d30a7b4d3afad37707371ead2a6d96662fa30294da678d66cdc4dc7f3e698bd8e111235c60fc + checksum: b6fa49bcf6c00571d0eb7837b163f8609960d4d77538160585e27ed167361e9776bd6e5eb9646ffac2fb4d43c58df9ca50dab9d96ab097e6591bc82a75fd1164 languageName: node linkType: hard @@ -23841,7 +23841,7 @@ __metadata: languageName: node linkType: hard -"nanoid@npm:^3.3.4, nanoid@npm:^3.3.6": +"nanoid@npm:^3.3.6": version: 3.3.6 resolution: "nanoid@npm:3.3.6" bin: @@ -23936,27 +23936,26 @@ __metadata: languageName: node linkType: hard -"next@npm:13.4.19": - version: 13.4.19 - resolution: "next@npm:13.4.19" +"next@npm:13.5.4": + version: 13.5.4 + resolution: "next@npm:13.5.4" dependencies: - "@next/env": 13.4.19 - "@next/swc-darwin-arm64": 13.4.19 - "@next/swc-darwin-x64": 13.4.19 - "@next/swc-linux-arm64-gnu": 13.4.19 - "@next/swc-linux-arm64-musl": 13.4.19 - "@next/swc-linux-x64-gnu": 13.4.19 - "@next/swc-linux-x64-musl": 13.4.19 - "@next/swc-win32-arm64-msvc": 13.4.19 - "@next/swc-win32-ia32-msvc": 13.4.19 - "@next/swc-win32-x64-msvc": 13.4.19 - "@swc/helpers": 0.5.1 + "@next/env": 13.5.4 + "@next/swc-darwin-arm64": 13.5.4 + "@next/swc-darwin-x64": 13.5.4 + "@next/swc-linux-arm64-gnu": 13.5.4 + "@next/swc-linux-arm64-musl": 13.5.4 + "@next/swc-linux-x64-gnu": 13.5.4 + "@next/swc-linux-x64-musl": 13.5.4 + "@next/swc-win32-arm64-msvc": 13.5.4 + "@next/swc-win32-ia32-msvc": 13.5.4 + "@next/swc-win32-x64-msvc": 13.5.4 + "@swc/helpers": 0.5.2 busboy: 1.6.0 caniuse-lite: ^1.0.30001406 - postcss: 8.4.14 + postcss: 8.4.31 styled-jsx: 5.1.1 watchpack: 2.4.0 - zod: 3.21.4 peerDependencies: "@opentelemetry/api": ^1.1.0 react: ^18.2.0 @@ -23988,7 +23987,7 @@ __metadata: optional: true bin: next: dist/bin/next - checksum: 557fd15a52220f003ec88a79f51de41c5bb9cda5294944985f31ce45e75f98dd3caf902896d8419d96cc81596976671e953391b1eb3707757d261e362a242310 + checksum: 0b0bc7fa42844859a0444a79122a48b5e65116c30ce077a3edaaecd7cee1d7925214a659391ae6ecf8dc612869a7a646ab3a1a8aa12d074ff17e3f18c53a2621 languageName: node linkType: hard @@ -26096,25 +26095,25 @@ __metadata: languageName: node linkType: hard -"postcss@npm:8.4.14": - version: 8.4.14 - resolution: "postcss@npm:8.4.14" +"postcss@npm:8.4.27": + version: 8.4.27 + resolution: "postcss@npm:8.4.27" dependencies: - nanoid: ^3.3.4 + nanoid: ^3.3.6 picocolors: ^1.0.0 source-map-js: ^1.0.2 - checksum: 2a4cfa28e2f1bfd358313501f7771bd596e494487c7b735c492e2f8b1faf493d24fcb43e2e6ad825863fc65a77abb949ca8f228602ae46a022f02dc812c4ac8b + checksum: 41a0476e05cb97514ff8d75e4ff9fdcf778f22b2e0d25b7028f219cd408e01d3c4f50459d4a1cd9a430d8ef08202c881374a4fa4ea6009f4a135a07315d606e5 languageName: node linkType: hard -"postcss@npm:8.4.27": - version: 8.4.27 - resolution: "postcss@npm:8.4.27" +"postcss@npm:8.4.31, postcss@npm:^8.1.10, postcss@npm:^8.2.14, postcss@npm:^8.4.14, postcss@npm:^8.4.21, postcss@npm:^8.4.23, postcss@npm:^8.4.26, postcss@npm:^8.4.27": + version: 8.4.31 + resolution: "postcss@npm:8.4.31" dependencies: nanoid: ^3.3.6 picocolors: ^1.0.0 source-map-js: ^1.0.2 - checksum: 41a0476e05cb97514ff8d75e4ff9fdcf778f22b2e0d25b7028f219cd408e01d3c4f50459d4a1cd9a430d8ef08202c881374a4fa4ea6009f4a135a07315d606e5 + checksum: 748b82e6e5fc34034dcf2ae88ea3d11fd09f69b6c50ecdd3b4a875cfc7cdca435c958b211e2cb52355422ab6fccb7d8f2f2923161d7a1b281029e4a913d59acf languageName: node linkType: hard @@ -26128,17 +26127,6 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.1.10, postcss@npm:^8.2.14, postcss@npm:^8.4.14, postcss@npm:^8.4.21, postcss@npm:^8.4.23, postcss@npm:^8.4.26, postcss@npm:^8.4.27": - version: 8.4.31 - resolution: "postcss@npm:8.4.31" - dependencies: - nanoid: ^3.3.6 - picocolors: ^1.0.0 - source-map-js: ^1.0.2 - checksum: 748b82e6e5fc34034dcf2ae88ea3d11fd09f69b6c50ecdd3b4a875cfc7cdca435c958b211e2cb52355422ab6fccb7d8f2f2923161d7a1b281029e4a913d59acf - languageName: node - linkType: hard - "preact-render-to-string@npm:^5.1.19": version: 5.2.6 resolution: "preact-render-to-string@npm:5.2.6" @@ -33315,13 +33303,6 @@ __metadata: languageName: node linkType: hard -"zod@npm:3.21.4": - version: 3.21.4 - resolution: "zod@npm:3.21.4" - checksum: 161e8cf7aea38a99244d65da4a9477d9d966f6a533e503feaa20ff7968a9691065c38c6f1eab5cbbdc8374142fff4a05c9cacb8479803ab50ab6a6ca80e5d624 - languageName: node - linkType: hard - "zone.js@npm:^0.13.0": version: 0.13.3 resolution: "zone.js@npm:0.13.3"