diff --git a/.changeset/drop-nextjs-below-16.md b/.changeset/drop-nextjs-below-16.md new file mode 100644 index 000000000..9206659b3 --- /dev/null +++ b/.changeset/drop-nextjs-below-16.md @@ -0,0 +1,10 @@ +--- +'@vanilla-extract/next-plugin': major +'@vanilla-extract/turbopack-plugin': major +--- + +Drop support for Next.js versions below 16 + +**BREAKING CHANGE**: The minimum supported version of `next` is now `^16.0.0`. The `semver` dependency has been removed, and `unstable_turbopack.mode` `'auto'` now always enables Turbopack config since Next.js version detection is no longer required. Please note that turbopack support is still experimental. + +**MIGRATION GUIDE**: Upgrade to Next.js 16 or later. diff --git a/examples/next/package.json b/examples/next/package.json index b92e7635f..77a7fef1c 100644 --- a/examples/next/package.json +++ b/examples/next/package.json @@ -9,7 +9,7 @@ "start": "next start" }, "dependencies": { - "next": "12.3.4", + "next": "^16.0.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/fixtures/next-12-pages-router/CHANGELOG.md b/fixtures/next-12-pages-router/CHANGELOG.md deleted file mode 100644 index 51ab0dea3..000000000 --- a/fixtures/next-12-pages-router/CHANGELOG.md +++ /dev/null @@ -1,77 +0,0 @@ -# @fixtures/next-pages-router - -## 0.0.7 - -### Patch Changes - -- Updated dependencies [[`6432199fa0717f424fb3f45fbe36410b03b01c1c`](https://github.com/vanilla-extract-css/vanilla-extract/commit/6432199fa0717f424fb3f45fbe36410b03b01c1c)]: - - @vanilla-extract/css@1.15.5 - - @fixtures/features@0.0.31 - - @fixtures/recipes@0.0.36 - - @fixtures/sprinkles@0.0.36 - - @vanilla-extract/recipes@0.5.5 - - @vanilla-extract/sprinkles@1.6.3 - -## 0.0.6 - -### Patch Changes - -- Updated dependencies [[`61878f5fb21a33190ef242551c639e216ba4748a`](https://github.com/vanilla-extract-css/vanilla-extract/commit/61878f5fb21a33190ef242551c639e216ba4748a)]: - - @vanilla-extract/css@1.15.4 - - @vanilla-extract/recipes@0.5.5 - - @vanilla-extract/sprinkles@1.6.3 - - @fixtures/features@0.0.30 - - @fixtures/recipes@0.0.35 - - @fixtures/sprinkles@0.0.35 - -## 0.0.5 - -### Patch Changes - -- Updated dependencies [[`2a7acc989fba707220186f2d0b824bc4cc37ad66`](https://github.com/vanilla-extract-css/vanilla-extract/commit/2a7acc989fba707220186f2d0b824bc4cc37ad66)]: - - @vanilla-extract/recipes@0.5.4 - - @fixtures/recipes@0.0.34 - -## 0.0.4 - -### Patch Changes - -- Updated dependencies [[`b86f3f59c86420e12593996a14f8cdb5db2f7c25`](https://github.com/vanilla-extract-css/vanilla-extract/commit/b86f3f59c86420e12593996a14f8cdb5db2f7c25), [`99e974b2ae56e1e851b376988216b7bd30813813`](https://github.com/vanilla-extract-css/vanilla-extract/commit/99e974b2ae56e1e851b376988216b7bd30813813)]: - - @vanilla-extract/css@1.15.3 - - @fixtures/features@0.0.29 - - @fixtures/recipes@0.0.33 - - @fixtures/sprinkles@0.0.34 - - @vanilla-extract/recipes@0.5.3 - - @vanilla-extract/sprinkles@1.6.2 - -## 0.0.3 - -### Patch Changes - -- Updated dependencies [[`b8a99e4980710a34692034d5da43e584edbc3d17`](https://github.com/vanilla-extract-css/vanilla-extract/commit/b8a99e4980710a34692034d5da43e584edbc3d17)]: - - @vanilla-extract/sprinkles@1.6.2 - - @vanilla-extract/recipes@0.5.3 - - @vanilla-extract/css@1.15.2 - - @fixtures/sprinkles@0.0.33 - - @fixtures/features@0.0.28 - - @fixtures/recipes@0.0.32 - -## 0.0.2 - -### Patch Changes - -- Updated dependencies [[`e58cf9013c6f6cdfacb2a7936b3354e71138e9fb`](https://github.com/vanilla-extract-css/vanilla-extract/commit/e58cf9013c6f6cdfacb2a7936b3354e71138e9fb), [`3df9b4ebc5ad7e03e5c908c10216447b7089132a`](https://github.com/vanilla-extract-css/vanilla-extract/commit/3df9b4ebc5ad7e03e5c908c10216447b7089132a)]: - - @vanilla-extract/css@1.15.1 - - @fixtures/features@0.0.27 - - @fixtures/recipes@0.0.31 - - @fixtures/sprinkles@0.0.32 - -## 0.0.1 - -### Patch Changes - -- Updated dependencies [[`df9fe3ee3fc0057bc14a2333a405f8229f80c214`](https://github.com/vanilla-extract-css/vanilla-extract/commit/df9fe3ee3fc0057bc14a2333a405f8229f80c214)]: - - @vanilla-extract/css@1.15.0 - - @fixtures/features@0.0.26 - - @fixtures/recipes@0.0.30 - - @fixtures/sprinkles@0.0.31 diff --git a/fixtures/next-12-pages-router/next.config.js b/fixtures/next-12-pages-router/next.config.js deleted file mode 100644 index ccf7e23ca..000000000 --- a/fixtures/next-12-pages-router/next.config.js +++ /dev/null @@ -1,21 +0,0 @@ -const { - createVanillaExtractPlugin, -} = require('./next-plugin/dist/vanilla-extract-next-plugin.cjs.js'); - -const withVanillaExtract = createVanillaExtractPlugin(); - -/** @type {import('next').NextConfig} */ -const config = withVanillaExtract({ - // we need to differentiate build and dev folders - // so they don't overwrite eachother when running tests - distDir: process.env.NODE_ENV === 'production' ? 'dist' : '.next', - experimental: { - externalDir: true, - }, - onDemandEntries: { - // Make sure entries are not getting disposed. - maxInactiveAge: 1000 * 60 * 60, - }, -}); - -module.exports = config; diff --git a/fixtures/next-12-pages-router/package.json b/fixtures/next-12-pages-router/package.json deleted file mode 100644 index fd1eb3af8..000000000 --- a/fixtures/next-12-pages-router/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "@fixtures/next-12-pages-router", - "description": "Next pages router fixtures", - "version": "0.0.7", - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "clean:dev": "rm -rf .next", - "clean:prod": "rm -rf dist" - }, - "dependencies": { - "@fixtures/features": "workspace:*", - "@fixtures/recipes": "workspace:*", - "@fixtures/sprinkles": "workspace:*", - "@vanilla-extract/css": "workspace:*", - "@vanilla-extract/recipes": "workspace:*", - "@vanilla-extract/sprinkles": "workspace:*", - "next": "12.3.4", - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "devDependencies": { - "@types/react": "^18.2.55", - "@vanilla-extract/next-plugin": "workspace:*", - "@vanilla-extract/webpack-plugin": "workspace:*" - }, - "browserslist": [ - ">0.3%", - "ie 11", - "safari 4", - "not op_mini all" - ] -} diff --git a/fixtures/next-12-pages-router/src/pages/features/index.tsx b/fixtures/next-12-pages-router/src/pages/features/index.tsx deleted file mode 100644 index ffffe61a8..000000000 --- a/fixtures/next-12-pages-router/src/pages/features/index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import html from '@fixtures/features/src/html'; - -export default function Features() { - return ( - <> - -
- - ); -} diff --git a/fixtures/next-12-pages-router/src/pages/index.tsx b/fixtures/next-12-pages-router/src/pages/index.tsx deleted file mode 100644 index 171850fc9..000000000 --- a/fixtures/next-12-pages-router/src/pages/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import Link from 'next/link'; - -export default function Home() { - return ( - <> - sprinkles -
- recipes -
- features - - ); -} diff --git a/fixtures/next-12-pages-router/src/pages/recipes/index.tsx b/fixtures/next-12-pages-router/src/pages/recipes/index.tsx deleted file mode 100644 index fcde26b0d..000000000 --- a/fixtures/next-12-pages-router/src/pages/recipes/index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import html from '@fixtures/recipes/src/html'; - -export default function Recipes() { - return ( - <> - -
- - ); -} diff --git a/fixtures/next-12-pages-router/src/pages/sprinkles/index.tsx b/fixtures/next-12-pages-router/src/pages/sprinkles/index.tsx deleted file mode 100644 index f70bcf5d4..000000000 --- a/fixtures/next-12-pages-router/src/pages/sprinkles/index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import html from '@fixtures/sprinkles/src/html'; - -export default function Sprinkles() { - return ( - <> - -
- - ); -} diff --git a/fixtures/next-12-pages-router/tsconfig.json b/fixtures/next-12-pages-router/tsconfig.json deleted file mode 100644 index c363dcf1f..000000000 --- a/fixtures/next-12-pages-router/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "forceConsistentCasingInFileNames": true, - "jsx": "preserve", - "strictNullChecks": true, - "module": "esnext", - "moduleResolution": "node" - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] -} diff --git a/fixtures/next-13-app-router/CHANGELOG.md b/fixtures/next-13-app-router/CHANGELOG.md deleted file mode 100644 index d6fd071f8..000000000 --- a/fixtures/next-13-app-router/CHANGELOG.md +++ /dev/null @@ -1,77 +0,0 @@ -# @fixtures/next-app-router - -## 0.0.7 - -### Patch Changes - -- Updated dependencies [[`6432199fa0717f424fb3f45fbe36410b03b01c1c`](https://github.com/vanilla-extract-css/vanilla-extract/commit/6432199fa0717f424fb3f45fbe36410b03b01c1c)]: - - @vanilla-extract/css@1.15.5 - - @fixtures/features@0.0.31 - - @fixtures/recipes@0.0.36 - - @fixtures/sprinkles@0.0.36 - - @vanilla-extract/recipes@0.5.5 - - @vanilla-extract/sprinkles@1.6.3 - -## 0.0.6 - -### Patch Changes - -- Updated dependencies [[`61878f5fb21a33190ef242551c639e216ba4748a`](https://github.com/vanilla-extract-css/vanilla-extract/commit/61878f5fb21a33190ef242551c639e216ba4748a)]: - - @vanilla-extract/css@1.15.4 - - @vanilla-extract/recipes@0.5.5 - - @vanilla-extract/sprinkles@1.6.3 - - @fixtures/features@0.0.30 - - @fixtures/recipes@0.0.35 - - @fixtures/sprinkles@0.0.35 - -## 0.0.5 - -### Patch Changes - -- Updated dependencies [[`2a7acc989fba707220186f2d0b824bc4cc37ad66`](https://github.com/vanilla-extract-css/vanilla-extract/commit/2a7acc989fba707220186f2d0b824bc4cc37ad66)]: - - @vanilla-extract/recipes@0.5.4 - - @fixtures/recipes@0.0.34 - -## 0.0.4 - -### Patch Changes - -- Updated dependencies [[`b86f3f59c86420e12593996a14f8cdb5db2f7c25`](https://github.com/vanilla-extract-css/vanilla-extract/commit/b86f3f59c86420e12593996a14f8cdb5db2f7c25), [`99e974b2ae56e1e851b376988216b7bd30813813`](https://github.com/vanilla-extract-css/vanilla-extract/commit/99e974b2ae56e1e851b376988216b7bd30813813)]: - - @vanilla-extract/css@1.15.3 - - @fixtures/features@0.0.29 - - @fixtures/recipes@0.0.33 - - @fixtures/sprinkles@0.0.34 - - @vanilla-extract/recipes@0.5.3 - - @vanilla-extract/sprinkles@1.6.2 - -## 0.0.3 - -### Patch Changes - -- Updated dependencies [[`b8a99e4980710a34692034d5da43e584edbc3d17`](https://github.com/vanilla-extract-css/vanilla-extract/commit/b8a99e4980710a34692034d5da43e584edbc3d17)]: - - @vanilla-extract/sprinkles@1.6.2 - - @vanilla-extract/recipes@0.5.3 - - @vanilla-extract/css@1.15.2 - - @fixtures/sprinkles@0.0.33 - - @fixtures/features@0.0.28 - - @fixtures/recipes@0.0.32 - -## 0.0.2 - -### Patch Changes - -- Updated dependencies [[`e58cf9013c6f6cdfacb2a7936b3354e71138e9fb`](https://github.com/vanilla-extract-css/vanilla-extract/commit/e58cf9013c6f6cdfacb2a7936b3354e71138e9fb), [`3df9b4ebc5ad7e03e5c908c10216447b7089132a`](https://github.com/vanilla-extract-css/vanilla-extract/commit/3df9b4ebc5ad7e03e5c908c10216447b7089132a)]: - - @vanilla-extract/css@1.15.1 - - @fixtures/features@0.0.27 - - @fixtures/recipes@0.0.31 - - @fixtures/sprinkles@0.0.32 - -## 0.0.1 - -### Patch Changes - -- Updated dependencies [[`df9fe3ee3fc0057bc14a2333a405f8229f80c214`](https://github.com/vanilla-extract-css/vanilla-extract/commit/df9fe3ee3fc0057bc14a2333a405f8229f80c214)]: - - @vanilla-extract/css@1.15.0 - - @fixtures/features@0.0.26 - - @fixtures/recipes@0.0.30 - - @fixtures/sprinkles@0.0.31 diff --git a/fixtures/next-13-app-router/next.config.js b/fixtures/next-13-app-router/next.config.js deleted file mode 100644 index ccf7e23ca..000000000 --- a/fixtures/next-13-app-router/next.config.js +++ /dev/null @@ -1,21 +0,0 @@ -const { - createVanillaExtractPlugin, -} = require('./next-plugin/dist/vanilla-extract-next-plugin.cjs.js'); - -const withVanillaExtract = createVanillaExtractPlugin(); - -/** @type {import('next').NextConfig} */ -const config = withVanillaExtract({ - // we need to differentiate build and dev folders - // so they don't overwrite eachother when running tests - distDir: process.env.NODE_ENV === 'production' ? 'dist' : '.next', - experimental: { - externalDir: true, - }, - onDemandEntries: { - // Make sure entries are not getting disposed. - maxInactiveAge: 1000 * 60 * 60, - }, -}); - -module.exports = config; diff --git a/fixtures/next-13-app-router/package.json b/fixtures/next-13-app-router/package.json deleted file mode 100644 index cb504aece..000000000 --- a/fixtures/next-13-app-router/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "@fixtures/next-13-app-router", - "description": "Next app router fixtures", - "version": "0.0.7", - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "clean:dev": "rm -rf .next", - "clean:prod": "rm -rf dist" - }, - "dependencies": { - "@fixtures/features": "workspace:*", - "@fixtures/recipes": "workspace:*", - "@fixtures/sprinkles": "workspace:*", - "@vanilla-extract/css": "workspace:*", - "@vanilla-extract/recipes": "workspace:*", - "@vanilla-extract/sprinkles": "workspace:*", - "next": "npm:next@13.5.11", - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "devDependencies": { - "@types/react": "^18.2.55", - "@vanilla-extract/next-plugin": "workspace:*", - "@vanilla-extract/webpack-plugin": "workspace:*" - }, - "browserslist": [ - ">0.3%", - "ie 11", - "safari 4", - "not op_mini all" - ] -} diff --git a/fixtures/next-13-app-router/src/app/features/page.tsx b/fixtures/next-13-app-router/src/app/features/page.tsx deleted file mode 100644 index ffffe61a8..000000000 --- a/fixtures/next-13-app-router/src/app/features/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import html from '@fixtures/features/src/html'; - -export default function Features() { - return ( - <> - -
- - ); -} diff --git a/fixtures/next-13-app-router/src/app/layout.tsx b/fixtures/next-13-app-router/src/app/layout.tsx deleted file mode 100644 index 225b6038d..000000000 --- a/fixtures/next-13-app-router/src/app/layout.tsx +++ /dev/null @@ -1,11 +0,0 @@ -export default function RootLayout({ - children, -}: { - children: React.ReactNode; -}) { - return ( - - {children} - - ); -} diff --git a/fixtures/next-13-app-router/src/app/page.tsx b/fixtures/next-13-app-router/src/app/page.tsx deleted file mode 100644 index 171850fc9..000000000 --- a/fixtures/next-13-app-router/src/app/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import Link from 'next/link'; - -export default function Home() { - return ( - <> - sprinkles -
- recipes -
- features - - ); -} diff --git a/fixtures/next-13-app-router/src/app/recipes/page.tsx b/fixtures/next-13-app-router/src/app/recipes/page.tsx deleted file mode 100644 index fcde26b0d..000000000 --- a/fixtures/next-13-app-router/src/app/recipes/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import html from '@fixtures/recipes/src/html'; - -export default function Recipes() { - return ( - <> - -
- - ); -} diff --git a/fixtures/next-13-app-router/src/app/sprinkles/page.tsx b/fixtures/next-13-app-router/src/app/sprinkles/page.tsx deleted file mode 100644 index f70bcf5d4..000000000 --- a/fixtures/next-13-app-router/src/app/sprinkles/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import html from '@fixtures/sprinkles/src/html'; - -export default function Sprinkles() { - return ( - <> - -
- - ); -} diff --git a/fixtures/next-13-app-router/tsconfig.json b/fixtures/next-13-app-router/tsconfig.json deleted file mode 100644 index 8c8ab9649..000000000 --- a/fixtures/next-13-app-router/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "forceConsistentCasingInFileNames": true, - "jsx": "preserve", - "plugins": [ - { - "name": "next" - } - ], - "strictNullChecks": true, - "module": "esnext" - }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts", - "dist/types/**/*.ts" - ], - "exclude": ["node_modules"] -} diff --git a/packages/next-plugin/package.json b/packages/next-plugin/package.json index 5d8c74edc..cb71892d1 100644 --- a/packages/next-plugin/package.json +++ b/packages/next-plugin/package.json @@ -22,15 +22,13 @@ "license": "MIT", "dependencies": { "@vanilla-extract/turbopack-plugin": "workspace:^", - "@vanilla-extract/webpack-plugin": "workspace:^", - "semver": "^7.6.3" + "@vanilla-extract/webpack-plugin": "workspace:^" }, "peerDependencies": { - "next": ">=12.1.7" + "next": "^16.0.0" }, "devDependencies": { - "@types/semver": "^7.7.1", - "next": "12.3.4", + "next": "^16.0.0", "webpack": "^5.90.0" } } diff --git a/packages/next-plugin/src/index.ts b/packages/next-plugin/src/index.ts index 97bed3686..900c5a0fd 100644 --- a/packages/next-plugin/src/index.ts +++ b/packages/next-plugin/src/index.ts @@ -12,9 +12,7 @@ import type { WebpackConfigContext, } from 'next/dist/server/config-shared'; import { createRequire } from 'node:module'; -import * as path from 'node:path'; import type { TurboLoaderOptions } from '@vanilla-extract/turbopack-plugin'; -import semver from 'semver'; const require = createRequire(import.meta.url); @@ -23,8 +21,8 @@ type PluginOptions = ConstructorParameters[0] & { glob?: string[]; /** * controls whether we attempt to configure turbopack - * auto: enable only when Next >= 16.0.0 - * on: force enable regardless of detected Next version + * auto: enable turbopack config (equivalent to `on` as of v3) + * on: enable turbopack config * off: never configure turbopack, webpack only */ mode?: 'auto' | 'on' | 'off'; @@ -111,6 +109,7 @@ const getVanillaExtractCssLoaders = ( options.dir, getSupportedBrowsers(options.dir, options.dev), undefined, + undefined, ); // https://github.com/vercel/next.js/blob/6e5b935fd7a61497f6854a81aec7df3a5dbf61ac/packages/next/src/build/webpack/config/blocks/css/loaders/global.ts#L28 @@ -164,36 +163,16 @@ export const createVanillaExtractPlugin = ( mode: turbopackMode = 'off', glob: turbopackGlob = ['**/*.css.{js,cjs,mjs,jsx,ts,tsx}'], } = turbopackOptions; - // detect Next version and decide whether to configure turbopack - const nextVersion = (() => { - try { - // resolve from the consumer app's cwd, not this package - const requireFromCwd = createRequire( - path.join(process.cwd(), 'package.json'), - ); - const pkg = requireFromCwd('next/package.json') as { version?: string }; - return pkg?.version ?? null; - } catch { - return null; - } - })(); - const coerced = nextVersion ? semver.coerce(nextVersion) : null; - const supportsTurbopackRules = !!coerced && semver.gte(coerced, '16.0.0'); - const enableTurbopack = - turbopackMode === 'on' || - (turbopackMode === 'auto' && supportsTurbopackRules); - - if (turbopackMode === 'on' && !supportsTurbopackRules) { - console.warn( - `[@vanilla-extract/next-plugin] Turbopack is configured but does not seem supported. Expected Next.js >= 16.0.0, got ${nextVersion}`, - ); - } + // In v3 these were made equivalent as the only supported next version (v16) means + // turbopack support is guaranteed. + const enableTurbopack = turbopackMode === 'on' || turbopackMode === 'auto'; - let turbopack: typeof nextConfig.turbopack; + let turbopack: NonNullable | undefined; if (enableTurbopack) { - turbopack = { ...nextConfig.turbopack }; + const turbopackConfig = { ...nextConfig.turbopack }; + turbopack = turbopackConfig; - if (turbopackGlob.some((glob) => turbopack.rules?.[glob])) { + if (turbopackGlob.some((glob) => turbopackConfig.rules?.[glob])) { throw new Error( 'Vanilla extract could not be applied automatically due to conflicting turbopack rules', ); @@ -211,15 +190,15 @@ export const createVanillaExtractPlugin = ( } satisfies TurboLoaderOptions, }, ], - } as const; + }; const vanillaExtractCssRule = { as: '*.css', loaders: [require.resolve('@vanilla-extract/turbopack-plugin')], - } as const; + }; - turbopack.rules = { - ...turbopack.rules, + turbopackConfig.rules = { + ...turbopackConfig.rules, ...Object.fromEntries( turbopackGlob.map((glob) => [glob, vanillaExtractRule]), ), @@ -232,16 +211,8 @@ export const createVanillaExtractPlugin = ( webpack(config: any, options: WebpackConfigContext) { const { dir, dev, config: resolvedNextConfig } = options; - // https://github.com/vercel/next.js/blob/1fb4cad2a8329811b5ccde47217b4a6ae739124e/packages/next/build/index.ts#L336 - // https://github.com/vercel/next.js/blob/1fb4cad2a8329811b5ccde47217b4a6ae739124e/packages/next/build/webpack-config.ts#L626 - // https://github.com/vercel/next.js/pull/43916 - // on Next.js 12, findPagesDirResult is a string. on Next.js 13, findPagesDirResult is an object - const findPagesDirResult = findPagesDir( - dir, - resolvedNextConfig.experimental?.appDir ?? false, - ); - // Skip nextConfig check since appDir is stable feature after Next.js 13.4 - const hasAppDir = !!(findPagesDirResult && findPagesDirResult.appDir); + const findPagesDirResult = findPagesDir(dir); + const hasAppDir = Boolean(findPagesDirResult.appDir); const outputCss = true; diff --git a/packages/turbopack-plugin/package.json b/packages/turbopack-plugin/package.json index 85f55aff3..f3ea8b2dc 100644 --- a/packages/turbopack-plugin/package.json +++ b/packages/turbopack-plugin/package.json @@ -26,10 +26,10 @@ "@vanilla-extract/integration": "workspace:^" }, "devDependencies": { - "next": "12.3.4", + "next": "^16.0.0", "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependencies": { - "next": ">=12.1.7" + "next": "^16.0.0" } } diff --git a/packages/turbopack-plugin/src/index.ts b/packages/turbopack-plugin/src/index.ts index ed92ed832..ad5b1c374 100644 --- a/packages/turbopack-plugin/src/index.ts +++ b/packages/turbopack-plugin/src/index.ts @@ -136,7 +136,6 @@ const getOrMakeCompiler = async ({ const { getImageSize } = await import('next/dist/server/image-optimizer.js'); const imageSize: { width?: number; height?: number } = - // @ts-expect-error - next.js version mismatch loads next 12 types but uses next 16 code await getImageSize(await imageAsBuffer).catch((error) => { const message = `Process image "${sourceImage}" failed: ${error}`; throw new Error(message); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 001e35982..19acb483b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -64,8 +64,8 @@ importers: examples/next: dependencies: next: - specifier: 12.3.4 - version: 12.3.4(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + specifier: ^16.0.0 + version: 16.1.1(@babel/core@7.23.9)(@playwright/test@1.61.0)(react-dom@18.2.0)(react@18.2.0) react: specifier: ^18.2.0 version: 18.2.0 @@ -165,86 +165,6 @@ importers: specifier: workspace:^ version: link:../../packages/css - fixtures/next-12-pages-router: - dependencies: - '@fixtures/features': - specifier: workspace:* - version: link:../features - '@fixtures/recipes': - specifier: workspace:* - version: link:../recipes - '@fixtures/sprinkles': - specifier: workspace:* - version: link:../sprinkles - '@vanilla-extract/css': - specifier: workspace:* - version: link:../../packages/css - '@vanilla-extract/recipes': - specifier: workspace:* - version: link:../../packages/recipes - '@vanilla-extract/sprinkles': - specifier: workspace:* - version: link:../../packages/sprinkles - next: - specifier: 12.3.4 - version: 12.3.4(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) - react: - specifier: ^18.2.0 - version: 18.2.0 - react-dom: - specifier: ^18.2.0 - version: 18.2.0(react@18.2.0) - devDependencies: - '@types/react': - specifier: ^18.2.55 - version: 18.2.55 - '@vanilla-extract/next-plugin': - specifier: workspace:* - version: link:../../packages/next-plugin - '@vanilla-extract/webpack-plugin': - specifier: workspace:* - version: link:../../packages/webpack-plugin - - fixtures/next-13-app-router: - dependencies: - '@fixtures/features': - specifier: workspace:* - version: link:../features - '@fixtures/recipes': - specifier: workspace:* - version: link:../recipes - '@fixtures/sprinkles': - specifier: workspace:* - version: link:../sprinkles - '@vanilla-extract/css': - specifier: workspace:* - version: link:../../packages/css - '@vanilla-extract/recipes': - specifier: workspace:* - version: link:../../packages/recipes - '@vanilla-extract/sprinkles': - specifier: workspace:* - version: link:../../packages/sprinkles - next: - specifier: npm:next@13.5.11 - version: 13.5.11(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) - react: - specifier: ^18.2.0 - version: 18.2.0 - react-dom: - specifier: ^18.2.0 - version: 18.2.0(react@18.2.0) - devDependencies: - '@types/react': - specifier: ^18.2.55 - version: 18.2.55 - '@vanilla-extract/next-plugin': - specifier: workspace:* - version: link:../../packages/next-plugin - '@vanilla-extract/webpack-plugin': - specifier: workspace:* - version: link:../../packages/webpack-plugin - fixtures/next-16-app-pages-router: dependencies: '@fixtures/features': @@ -525,16 +445,10 @@ importers: '@vanilla-extract/webpack-plugin': specifier: workspace:^ version: link:../webpack-plugin - semver: - specifier: ^7.6.3 - version: 7.7.3 devDependencies: - '@types/semver': - specifier: ^7.7.1 - version: 7.7.1 next: - specifier: 12.3.4 - version: 12.3.4(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + specifier: ^16.0.0 + version: 16.1.1(@babel/core@7.23.9)(@playwright/test@1.61.0)(react-dom@19.2.3)(react@19.2.3) webpack: specifier: ^5.90.0 version: 5.104.0(@swc/core@1.15.8)(esbuild@0.28.0)(webpack-cli@6.0.1) @@ -609,8 +523,8 @@ importers: version: link:../integration devDependencies: next: - specifier: 12.3.4 - version: 12.3.4(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + specifier: ^16.0.0 + version: 16.1.1(@babel/core@7.23.9)(@playwright/test@1.61.0)(react-dom@19.2.3)(react@19.2.3) vite: specifier: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 version: 8.3.5(@types/node@22.15.3)(esbuild@0.28.0)(jiti@1.21.7)(terser@5.44.1)(tsx@4.21.0)(yaml@2.9.1) @@ -784,12 +698,6 @@ importers: '@fixtures/low-level': specifier: workspace:* version: link:../fixtures/low-level - '@fixtures/next-12-pages-router': - specifier: workspace:* - version: link:../fixtures/next-12-pages-router - '@fixtures/next-13-app-router': - specifier: workspace:* - version: link:../fixtures/next-13-app-router '@fixtures/next-16-app-pages-router': specifier: workspace:* version: link:../fixtures/next-16-app-pages-router @@ -3175,89 +3083,21 @@ packages: engines: {node: ^12.20.0 || ^14.14.0 || >=16.0.0} hasBin: true - '@next/env@12.3.4': - resolution: {integrity: sha512-H/69Lc5Q02dq3o+dxxy5O/oNxFsZpdL6WREtOOtOM1B/weonIwDXkekr1KV5DPVPr12IHFPrMrcJQ6bgPMfn7A==} - - '@next/env@13.5.11': - resolution: {integrity: sha512-fbb2C7HChgM7CemdCY+y3N1n8pcTKdqtQLbC7/EQtPdLvlMUT9JX/dBYl8MMZAtYG4uVMyPFHXckb68q/NRwqg==} - '@next/env@16.1.1': resolution: {integrity: sha512-3oxyM97Sr2PqiVyMyrZUtrtM3jqqFxOQJVuKclDsgj/L728iZt/GyslkN4NwarledZATCenbk4Offjk1hQmaAA==} - '@next/swc-android-arm-eabi@12.3.4': - resolution: {integrity: sha512-cM42Cw6V4Bz/2+j/xIzO8nK/Q3Ly+VSlZJTa1vHzsocJRYz8KT6MrreXaci2++SIZCF1rVRCDgAg5PpqRibdIA==} - engines: {node: '>= 10'} - cpu: [arm] - os: [android] - - '@next/swc-android-arm64@12.3.4': - resolution: {integrity: sha512-5jf0dTBjL+rabWjGj3eghpLUxCukRhBcEJgwLedewEA/LJk2HyqCvGIwj5rH+iwmq1llCWbOky2dO3pVljrapg==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [android] - - '@next/swc-darwin-arm64@12.3.4': - resolution: {integrity: sha512-DqsSTd3FRjQUR6ao0E1e2OlOcrF5br+uegcEGPVonKYJpcr0MJrtYmPxd4v5T6UCJZ+XzydF7eQo5wdGvSZAyA==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [darwin] - - '@next/swc-darwin-arm64@13.5.9': - resolution: {integrity: sha512-pVyd8/1y1l5atQRvOaLOvfbmRwefxLhqQOzYo/M7FQ5eaRwA1+wuCn7t39VwEgDd7Aw1+AIWwd+MURXUeXhwDw==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [darwin] - '@next/swc-darwin-arm64@16.1.1': resolution: {integrity: sha512-JS3m42ifsVSJjSTzh27nW+Igfha3NdBOFScr9C80hHGrWx55pTrVL23RJbqir7k7/15SKlrLHhh/MQzqBBYrQA==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@12.3.4': - resolution: {integrity: sha512-PPF7tbWD4k0dJ2EcUSnOsaOJ5rhT3rlEt/3LhZUGiYNL8KvoqczFrETlUx0cUYaXe11dRA3F80Hpt727QIwByQ==} - engines: {node: '>= 10'} - cpu: [x64] - os: [darwin] - - '@next/swc-darwin-x64@13.5.9': - resolution: {integrity: sha512-DwdeJqP7v8wmoyTWPbPVodTwCybBZa02xjSJ6YQFIFZFZ7dFgrieKW4Eo0GoIcOJq5+JxkQyejmI+8zwDp3pwA==} - engines: {node: '>= 10'} - cpu: [x64] - os: [darwin] - '@next/swc-darwin-x64@16.1.1': resolution: {integrity: sha512-hbyKtrDGUkgkyQi1m1IyD3q4I/3m9ngr+V93z4oKHrPcmxwNL5iMWORvLSGAf2YujL+6HxgVvZuCYZfLfb4bGw==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-freebsd-x64@12.3.4': - resolution: {integrity: sha512-KM9JXRXi/U2PUM928z7l4tnfQ9u8bTco/jb939pdFUHqc28V43Ohd31MmZD1QzEK4aFlMRaIBQOWQZh4D/E5lQ==} - engines: {node: '>= 10'} - cpu: [x64] - os: [freebsd] - - '@next/swc-linux-arm-gnueabihf@12.3.4': - resolution: {integrity: sha512-3zqD3pO+z5CZyxtKDTnOJ2XgFFRUBciOox6EWkoZvJfc9zcidNAQxuwonUeNts6Xbm8Wtm5YGIRC0x+12YH7kw==} - engines: {node: '>= 10'} - cpu: [arm] - os: [linux] - - '@next/swc-linux-arm64-gnu@12.3.4': - resolution: {integrity: sha512-kiX0vgJGMZVv+oo1QuObaYulXNvdH/IINmvdZnVzMO/jic/B8EEIGlZ8Bgvw8LCjH3zNVPO3mGrdMvnEEPEhKA==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [linux] - libc: [glibc] - - '@next/swc-linux-arm64-gnu@13.5.9': - resolution: {integrity: sha512-wdQsKsIsGSNdFojvjW3Ozrh8Q00+GqL3wTaMjDkQxVtRbAqfFBtrLPO0IuWChVUP2UeuQcHpVeUvu0YgOP00+g==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [linux] - libc: [glibc] - '@next/swc-linux-arm64-gnu@16.1.1': resolution: {integrity: sha512-/fvHet+EYckFvRLQ0jPHJCUI5/B56+2DpI1xDSvi80r/3Ez+Eaa2Yq4tJcRTaB1kqj/HrYKn8Yplm9bNoMJpwQ==} engines: {node: '>= 10'} @@ -3265,20 +3105,6 @@ packages: os: [linux] libc: [glibc] - '@next/swc-linux-arm64-musl@12.3.4': - resolution: {integrity: sha512-EETZPa1juczrKLWk5okoW2hv7D7WvonU+Cf2CgsSoxgsYbUCZ1voOpL4JZTOb6IbKMDo6ja+SbY0vzXZBUMvkQ==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [linux] - libc: [musl] - - '@next/swc-linux-arm64-musl@13.5.9': - resolution: {integrity: sha512-6VpS+bodQqzOeCwGxoimlRoosiWlSc0C224I7SQWJZoyJuT1ChNCo+45QQH+/GtbR/s7nhaUqmiHdzZC9TXnXA==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [linux] - libc: [musl] - '@next/swc-linux-arm64-musl@16.1.1': resolution: {integrity: sha512-MFHrgL4TXNQbBPzkKKur4Fb5ICEJa87HM7fczFs2+HWblM7mMLdco3dvyTI+QmLBU9xgns/EeeINSZD6Ar+oLg==} engines: {node: '>= 10'} @@ -3286,20 +3112,6 @@ packages: os: [linux] libc: [musl] - '@next/swc-linux-x64-gnu@12.3.4': - resolution: {integrity: sha512-4csPbRbfZbuWOk3ATyWcvVFdD9/Rsdq5YHKvRuEni68OCLkfy4f+4I9OBpyK1SKJ00Cih16NJbHE+k+ljPPpag==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - libc: [glibc] - - '@next/swc-linux-x64-gnu@13.5.9': - resolution: {integrity: sha512-XxG3yj61WDd28NA8gFASIR+2viQaYZEFQagEodhI/R49gXWnYhiflTeeEmCn7Vgnxa/OfK81h1gvhUZ66lozpw==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - libc: [glibc] - '@next/swc-linux-x64-gnu@16.1.1': resolution: {integrity: sha512-20bYDfgOQAPUkkKBnyP9PTuHiJGM7HzNBbuqmD0jiFVZ0aOldz+VnJhbxzjcSabYsnNjMPsE0cyzEudpYxsrUQ==} engines: {node: '>= 10'} @@ -3307,20 +3119,6 @@ packages: os: [linux] libc: [glibc] - '@next/swc-linux-x64-musl@12.3.4': - resolution: {integrity: sha512-YeBmI+63Ro75SUiL/QXEVXQ19T++58aI/IINOyhpsRL1LKdyfK/35iilraZEFz9bLQrwy1LYAR5lK200A9Gjbg==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - libc: [musl] - - '@next/swc-linux-x64-musl@13.5.9': - resolution: {integrity: sha512-/dnscWqfO3+U8asd+Fc6dwL2l9AZDl7eKtPNKW8mKLh4Y4wOpjJiamhe8Dx+D+Oq0GYVjuW0WwjIxYWVozt2bA==} - engines: {node: '>= 10'} - cpu: [x64] - os: [linux] - libc: [musl] - '@next/swc-linux-x64-musl@16.1.1': resolution: {integrity: sha512-9pRbK3M4asAHQRkwaXwu601oPZHghuSC8IXNENgbBSyImHv/zY4K5udBusgdHkvJ/Tcr96jJwQYOll0qU8+fPA==} engines: {node: '>= 10'} @@ -3328,48 +3126,12 @@ packages: os: [linux] libc: [musl] - '@next/swc-win32-arm64-msvc@12.3.4': - resolution: {integrity: sha512-Sd0qFUJv8Tj0PukAYbCCDbmXcMkbIuhnTeHm9m4ZGjCf6kt7E/RMs55Pd3R5ePjOkN7dJEuxYBehawTR/aPDSQ==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [win32] - - '@next/swc-win32-arm64-msvc@13.5.9': - resolution: {integrity: sha512-T/iPnyurOK5a4HRUcxAlss8uzoEf5h9tkd+W2dSWAfzxv8WLKlUgbfk+DH43JY3Gc2xK5URLuXrxDZ2mGfk/jw==} - engines: {node: '>= 10'} - cpu: [arm64] - os: [win32] - '@next/swc-win32-arm64-msvc@16.1.1': resolution: {integrity: sha512-bdfQkggaLgnmYrFkSQfsHfOhk/mCYmjnrbRCGgkMcoOBZ4n+TRRSLmT/CU5SATzlBJ9TpioUyBW/vWFXTqQRiA==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-ia32-msvc@12.3.4': - resolution: {integrity: sha512-rt/vv/vg/ZGGkrkKcuJ0LyliRdbskQU+91bje+PgoYmxTZf/tYs6IfbmgudBJk6gH3QnjHWbkphDdRQrseRefQ==} - engines: {node: '>= 10'} - cpu: [ia32] - os: [win32] - - '@next/swc-win32-ia32-msvc@13.5.9': - resolution: {integrity: sha512-BLiPKJomaPrTAb7ykjA0LPcuuNMLDVK177Z1xe0nAem33+9FIayU4k/OWrtSn9SAJW/U60+1hoey5z+KCHdRLQ==} - engines: {node: '>= 10'} - cpu: [ia32] - os: [win32] - - '@next/swc-win32-x64-msvc@12.3.4': - resolution: {integrity: sha512-DQ20JEfTBZAgF8QCjYfJhv2/279M6onxFjdG/+5B0Cyj00/EdBxiWb2eGGFgQhrBbNv/lsvzFbbi0Ptf8Vw/bg==} - engines: {node: '>= 10'} - cpu: [x64] - os: [win32] - - '@next/swc-win32-x64-msvc@13.5.9': - resolution: {integrity: sha512-/72/dZfjXXNY/u+n8gqZDjI6rxKMpYsgBBYNZKWOQw0BpBF7WCnPflRy3ZtvQ2+IYI3ZH2bPyj7K+6a6wNk90Q==} - engines: {node: '>= 10'} - cpu: [x64] - os: [win32] - '@next/swc-win32-x64-msvc@16.1.1': resolution: {integrity: sha512-Ncwbw2WJ57Al5OX0k4chM68DKhEPlrXBaSXDCi2kPi5f4d8b3ejr3RRJGfKBLrn2YJL5ezNS7w2TZLHSti8CMw==} engines: {node: '>= 10'} @@ -4404,15 +4166,9 @@ packages: '@swc/counter@0.1.3': resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} - '@swc/helpers@0.4.11': - resolution: {integrity: sha512-rEUrBSGIoSFuYxwBYtlUFMlE2CwGhmW+w9355/5oduSw8e5h2+Tj4UrAGNNgP9915++wj5vkQo0UuOBqOAq4nw==} - '@swc/helpers@0.5.15': resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==} - '@swc/helpers@0.5.2': - resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==} - '@swc/types@0.1.25': resolution: {integrity: sha512-iAoY/qRhNH8a/hBvm3zKj9qQ4oc2+3w1unPJa2XvTK3XjeLXtzcCingVPw/9e5mn1+0yPqxcBGp9Jf0pkfMb1g==} @@ -5351,10 +5107,6 @@ packages: resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==} engines: {node: '>=18'} - busboy@1.6.0: - resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} - engines: {node: '>=10.16.0'} - byline@5.0.0: resolution: {integrity: sha512-s6webAy+R4SR8XVuJWt2V2rGvhnrhxN+9S15GNuTK3wKPOXFF6RNc+8ug2XhH+2s4f+uudG4kUVYmYOQWL2g0Q==} engines: {node: '>=0.10.0'} @@ -8326,39 +8078,6 @@ packages: resolution: {integrity: sha512-nv16ofE2zHBbB8jQia8+opfdLmVYGrOaorhpInVz5Mkx3kVgJd7Q9c3+dVmSl4VA/4MHX6e4N7X4cH+9sj8Zhw==} engines: {node: ^12.20.0 || ^14.14.0 || >=16.0.0} - next@12.3.4: - resolution: {integrity: sha512-VcyMJUtLZBGzLKo3oMxrEF0stxh8HwuW976pAzlHhI3t8qJ4SROjCrSh1T24bhrbjw55wfZXAbXPGwPt5FLRfQ==} - engines: {node: '>=12.22.0'} - hasBin: true - peerDependencies: - fibers: '>= 3.1.0' - node-sass: ^6.0.0 || ^7.0.0 - react: ^17.0.2 || ^18.0.0-0 - react-dom: ^17.0.2 || ^18.0.0-0 - sass: ^1.3.0 - peerDependenciesMeta: - fibers: - optional: true - node-sass: - optional: true - sass: - optional: true - - next@13.5.11: - resolution: {integrity: sha512-WUPJ6WbAX9tdC86kGTu92qkrRdgRqVrY++nwM+shmWQwmyxt4zhZfR59moXSI4N8GDYCBY3lIAqhzjDd4rTC8Q==} - engines: {node: '>=16.14.0'} - hasBin: true - peerDependencies: - '@opentelemetry/api': ^1.1.0 - react: ^18.2.0 - react-dom: ^18.2.0 - sass: ^1.3.0 - peerDependenciesMeta: - '@opentelemetry/api': - optional: true - sass: - optional: true - next@16.1.1: resolution: {integrity: sha512-QI+T7xrxt1pF6SQ/JYFz95ro/mg/1Znk5vBebsWwbpejj1T0A23hO7GYEaVac9QUOT2BIMiuzm0L99ooq7k0/w==} engines: {node: '>=20.9.0'} @@ -9181,10 +8900,6 @@ packages: peerDependencies: postcss: ^8.2.9 - postcss@8.4.14: - resolution: {integrity: sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==} - engines: {node: ^10 || ^12 || >=14} - postcss@8.4.31: resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} engines: {node: ^10 || ^12 || >=14} @@ -9964,10 +9679,6 @@ packages: std-env@4.3.0: resolution: {integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==} - streamsearch@1.1.0: - resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} - engines: {node: '>=10.0.0'} - strict-uri-encode@1.1.0: resolution: {integrity: sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==} engines: {node: '>=0.10.0'} @@ -10070,32 +9781,6 @@ packages: peerDependencies: webpack: ^4.0.0 || ^5.0.0 - styled-jsx@5.0.7: - resolution: {integrity: sha512-b3sUzamS086YLRuvnaDigdAewz1/EFYlHpYBP5mZovKEdQQOIIYq8lApylub3HHZ6xFjV051kkGU7cudJmrXEA==} - engines: {node: '>= 12.0.0'} - peerDependencies: - '@babel/core': '*' - babel-plugin-macros: '*' - react: '>= 16.8.0 || 17.x.x || ^18.0.0-0' - peerDependenciesMeta: - '@babel/core': - optional: true - babel-plugin-macros: - optional: true - - styled-jsx@5.1.1: - resolution: {integrity: sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==} - engines: {node: '>= 12.0.0'} - peerDependencies: - '@babel/core': '*' - babel-plugin-macros: '*' - react: '>= 16.8.0 || 17.x.x || ^18.0.0-0' - peerDependenciesMeta: - '@babel/core': - optional: true - babel-plugin-macros: - optional: true - styled-jsx@5.1.6: resolution: {integrity: sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==} engines: {node: '>= 12.0.0'} @@ -10681,11 +10366,6 @@ packages: resolution: {integrity: sha512-0kQLIzG4fdk/G5NONku64rSH/x32NOA39LVQqlK8Le6lvTF6GGRJpqaQFGgU+CLwySIqBSMdwYM0sYcW9f6P4A==} engines: {node: '>= 4'} - use-sync-external-store@1.2.0: - resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - use@3.1.1: resolution: {integrity: sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==} engines: {node: '>=0.10.0'} @@ -10990,10 +10670,6 @@ packages: walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} - watchpack@2.4.0: - resolution: {integrity: sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==} - engines: {node: '>=10.13.0'} - watchpack@2.4.4: resolution: {integrity: sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==} engines: {node: '>=10.13.0'} @@ -13596,99 +13272,29 @@ snapshots: - encoding - supports-color - '@next/env@12.3.4': {} - - '@next/env@13.5.11': {} - '@next/env@16.1.1': {} - '@next/swc-android-arm-eabi@12.3.4': - optional: true - - '@next/swc-android-arm64@12.3.4': - optional: true - - '@next/swc-darwin-arm64@12.3.4': - optional: true - - '@next/swc-darwin-arm64@13.5.9': - optional: true - '@next/swc-darwin-arm64@16.1.1': optional: true - '@next/swc-darwin-x64@12.3.4': - optional: true - - '@next/swc-darwin-x64@13.5.9': - optional: true - '@next/swc-darwin-x64@16.1.1': optional: true - '@next/swc-freebsd-x64@12.3.4': - optional: true - - '@next/swc-linux-arm-gnueabihf@12.3.4': - optional: true - - '@next/swc-linux-arm64-gnu@12.3.4': - optional: true - - '@next/swc-linux-arm64-gnu@13.5.9': - optional: true - '@next/swc-linux-arm64-gnu@16.1.1': optional: true - '@next/swc-linux-arm64-musl@12.3.4': - optional: true - - '@next/swc-linux-arm64-musl@13.5.9': - optional: true - '@next/swc-linux-arm64-musl@16.1.1': optional: true - '@next/swc-linux-x64-gnu@12.3.4': - optional: true - - '@next/swc-linux-x64-gnu@13.5.9': - optional: true - '@next/swc-linux-x64-gnu@16.1.1': optional: true - '@next/swc-linux-x64-musl@12.3.4': - optional: true - - '@next/swc-linux-x64-musl@13.5.9': - optional: true - '@next/swc-linux-x64-musl@16.1.1': optional: true - '@next/swc-win32-arm64-msvc@12.3.4': - optional: true - - '@next/swc-win32-arm64-msvc@13.5.9': - optional: true - '@next/swc-win32-arm64-msvc@16.1.1': optional: true - '@next/swc-win32-ia32-msvc@12.3.4': - optional: true - - '@next/swc-win32-ia32-msvc@13.5.9': - optional: true - - '@next/swc-win32-x64-msvc@12.3.4': - optional: true - - '@next/swc-win32-x64-msvc@13.5.9': - optional: true - '@next/swc-win32-x64-msvc@16.1.1': optional: true @@ -14843,18 +14449,10 @@ snapshots: '@swc/counter@0.1.3': {} - '@swc/helpers@0.4.11': - dependencies: - tslib: 2.8.1 - '@swc/helpers@0.5.15': dependencies: tslib: 2.8.1 - '@swc/helpers@0.5.2': - dependencies: - tslib: 2.8.1 - '@swc/types@0.1.25': dependencies: '@swc/counter': 0.1.3 @@ -16004,10 +15602,6 @@ snapshots: dependencies: run-applescript: 7.0.0 - busboy@1.6.0: - dependencies: - streamsearch: 1.1.0 - byline@5.0.0: {} bytes@3.0.0: {} @@ -19297,55 +18891,27 @@ snapshots: p-wait-for: 4.1.0 qs: 6.14.0 - next@12.3.4(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): + next@16.1.1(@babel/core@7.23.9)(@playwright/test@1.61.0)(react-dom@18.2.0)(react@18.2.0): dependencies: - '@next/env': 12.3.4 - '@swc/helpers': 0.4.11 - caniuse-lite: 1.0.30001760 - postcss: 8.4.14 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - styled-jsx: 5.0.7(@babel/core@7.23.9)(react@18.2.0) - use-sync-external-store: 1.2.0(react@18.2.0) - optionalDependencies: - '@next/swc-android-arm-eabi': 12.3.4 - '@next/swc-android-arm64': 12.3.4 - '@next/swc-darwin-arm64': 12.3.4 - '@next/swc-darwin-x64': 12.3.4 - '@next/swc-freebsd-x64': 12.3.4 - '@next/swc-linux-arm-gnueabihf': 12.3.4 - '@next/swc-linux-arm64-gnu': 12.3.4 - '@next/swc-linux-arm64-musl': 12.3.4 - '@next/swc-linux-x64-gnu': 12.3.4 - '@next/swc-linux-x64-musl': 12.3.4 - '@next/swc-win32-arm64-msvc': 12.3.4 - '@next/swc-win32-ia32-msvc': 12.3.4 - '@next/swc-win32-x64-msvc': 12.3.4 - transitivePeerDependencies: - - '@babel/core' - - babel-plugin-macros - - next@13.5.11(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): - dependencies: - '@next/env': 13.5.11 - '@swc/helpers': 0.5.2 - busboy: 1.6.0 + '@next/env': 16.1.1 + '@swc/helpers': 0.5.15 + baseline-browser-mapping: 2.9.8 caniuse-lite: 1.0.30001760 postcss: 8.4.31 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - styled-jsx: 5.1.1(@babel/core@7.23.9)(react@18.2.0) - watchpack: 2.4.0 + styled-jsx: 5.1.6(@babel/core@7.23.9)(react@18.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 13.5.9 - '@next/swc-darwin-x64': 13.5.9 - '@next/swc-linux-arm64-gnu': 13.5.9 - '@next/swc-linux-arm64-musl': 13.5.9 - '@next/swc-linux-x64-gnu': 13.5.9 - '@next/swc-linux-x64-musl': 13.5.9 - '@next/swc-win32-arm64-msvc': 13.5.9 - '@next/swc-win32-ia32-msvc': 13.5.9 - '@next/swc-win32-x64-msvc': 13.5.9 + '@next/swc-darwin-arm64': 16.1.1 + '@next/swc-darwin-x64': 16.1.1 + '@next/swc-linux-arm64-gnu': 16.1.1 + '@next/swc-linux-arm64-musl': 16.1.1 + '@next/swc-linux-x64-gnu': 16.1.1 + '@next/swc-linux-x64-musl': 16.1.1 + '@next/swc-win32-arm64-msvc': 16.1.1 + '@next/swc-win32-x64-msvc': 16.1.1 + '@playwright/test': 1.61.0 + sharp: 0.34.5 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros @@ -20130,12 +19696,6 @@ snapshots: postcss: 8.5.8 quote-unquote: 1.0.0 - postcss@8.4.14: - dependencies: - nanoid: 3.3.11 - picocolors: 1.1.1 - source-map-js: 1.2.1 - postcss@8.4.31: dependencies: nanoid: 3.3.11 @@ -21101,8 +20661,6 @@ snapshots: std-env@4.3.0: {} - streamsearch@1.1.0: {} - strict-uri-encode@1.1.0: {} string-similarity@4.0.4: {} @@ -21208,13 +20766,7 @@ snapshots: schema-utils: 3.3.0 webpack: 5.104.0(@swc/core@1.15.8)(esbuild@0.28.0)(webpack-cli@6.0.1) - styled-jsx@5.0.7(@babel/core@7.23.9)(react@18.2.0): - dependencies: - react: 18.2.0 - optionalDependencies: - '@babel/core': 7.23.9(supports-color@9.2.3) - - styled-jsx@5.1.1(@babel/core@7.23.9)(react@18.2.0): + styled-jsx@5.1.6(@babel/core@7.23.9)(react@18.2.0): dependencies: client-only: 0.0.1 react: 18.2.0 @@ -21732,10 +21284,6 @@ snapshots: url-to-options@1.0.1: {} - use-sync-external-store@1.2.0(react@18.2.0): - dependencies: - react: 18.2.0 - use@3.1.1: {} util-deprecate@1.0.2: {} @@ -22019,11 +21567,6 @@ snapshots: dependencies: makeerror: 1.0.12 - watchpack@2.4.0: - dependencies: - glob-to-regexp: 0.4.1 - graceful-fs: 4.2.11 - watchpack@2.4.4: dependencies: glob-to-regexp: 0.4.1 diff --git a/site/docs/integrations/next.mdx b/site/docs/integrations/next.mdx index 07a3774b5..fa850eec1 100644 --- a/site/docs/integrations/next.mdx +++ b/site/docs/integrations/next.mdx @@ -50,8 +50,9 @@ export default withVanillaExtract(withMDX(nextConfig)); ## Version Support -- **Next.js >= 16.x**: Both Turbopack and Webpack are supported -- **Next.js <= 15.x**: Only Webpack is supported +**Only Next.js >= 16 is currently supported**. +Both Webpack and Turbopack are supported, but Turbopack support is currently experimental. +See [the Turbopack section](#unstable_turbopack) for more details. ## Configuration @@ -78,12 +79,10 @@ Each integration will set a default value based on the configuration options pas ### externals -Effectively [`ExternalItem[]`] from webpack. +Effectively [`ExternalItem[]`](https://github.com/webpack/webpack/blob/9211be0f7a04feb45e1074e6cf848a657dd82ebc/declarations/WebpackOptions.d.ts#L207-L211) from webpack. Currently typed as `any` as this type was previously not exposed. The `any` type will be fixed in the next major version. -[`ExternalItem[]`]: https://github.com/webpack/webpack/blob/9211be0f7a04feb45e1074e6cf848a657dd82ebc/declarations/WebpackOptions.d.ts#L207-L211 - ### unstable_turbopack > ⚠️  Turbopack support is experimental. Its API is unstable and may undergo breaking changes in non-major versions. Additionally, it may not handle all features supported by Next.js. @@ -91,7 +90,7 @@ The `any` type will be fixed in the next major version. You can control Turbopack autoconfiguration using `unstable_turbopack.mode`: - `off`: (default) never configure Turbopack (i.e. use Webpack) -- `auto`: enable Turbopack config only when Next >= 16.0.0 +- `auto`: enable Turbopack config (equivalent to `on` in v3) - `on`: force-enable Turbopack config For example: diff --git a/site/docs/integrations/webpack.mdx b/site/docs/integrations/webpack.mdx index 50b1be11a..1facfda83 100644 --- a/site/docs/integrations/webpack.mdx +++ b/site/docs/integrations/webpack.mdx @@ -105,8 +105,6 @@ Each integration will set a default value based on the configuration options pas ### externals -Effectively [`ExternalItem[]`] from webpack. +Effectively [`ExternalItem[]`](https://github.com/webpack/webpack/blob/9211be0f7a04feb45e1074e6cf848a657dd82ebc/declarations/WebpackOptions.d.ts#L207-L211) from webpack. Currently typed as `any` as this type was previously not exposed. The `any` type will be fixed in the next major version. - -[`ExternalItem[]`]: https://github.com/webpack/webpack/blob/9211be0f7a04feb45e1074e6cf848a657dd82ebc/declarations/WebpackOptions.d.ts#L207-L211 diff --git a/test-helpers/package.json b/test-helpers/package.json index ba673f15d..03b33068d 100644 --- a/test-helpers/package.json +++ b/test-helpers/package.json @@ -10,8 +10,6 @@ "@fixtures/features": "workspace:*", "@fixtures/layers": "workspace:*", "@fixtures/low-level": "workspace:*", - "@fixtures/next-12-pages-router": "workspace:*", - "@fixtures/next-13-app-router": "workspace:*", "@fixtures/next-16-app-pages-router": "workspace:*", "@fixtures/recipes": "workspace:*", "@fixtures/sprinkles": "workspace:*", diff --git a/test-helpers/src/startFixture/index.ts b/test-helpers/src/startFixture/index.ts index a352b03f2..3b69b3b8b 100644 --- a/test-helpers/src/startFixture/index.ts +++ b/test-helpers/src/startFixture/index.ts @@ -69,11 +69,7 @@ export async function startFixture( }); } - if ( - type === 'next-12-pages-router' || - type === 'next-13-app-router' || - type === 'next-16-app-pages-router' - ) { + if (type === 'next-16-app-pages-router') { return startNextFixture({ type, port, diff --git a/test-helpers/src/startFixture/next.ts b/test-helpers/src/startFixture/next.ts index 3735e2f43..e4c600b25 100644 --- a/test-helpers/src/startFixture/next.ts +++ b/test-helpers/src/startFixture/next.ts @@ -1,13 +1,12 @@ import type { NextServer, NextServerOptions, -} from '@fixtures/next-12-pages-router/node_modules/next/dist/server/next'; +} from '@fixtures/next-16-app-pages-router/node_modules/next/dist/server/next'; import { existsSync } from 'fs'; import { Server as _Server, createServer } from 'http'; import path from 'path'; import type { TestServer } from './types'; -import { serveAssets } from './vite'; type Server = _Server & { __app?: NextServer; @@ -20,10 +19,7 @@ const DIST_DIR = 'dist'; export const nextFixtures = ['sprinkles', 'recipes', 'features'] as const; export interface NextFixtureOptions { - type: - | 'next-13-app-router' - | 'next-12-pages-router' - | 'next-16-app-pages-router'; + type: 'next-16-app-pages-router'; mode?: 'development' | 'production'; port: number; } @@ -96,22 +92,6 @@ export const startNextFixture = async ({ const nextDir = getNextDir(type); - // using export mode for production build in next 13 - // due to issues with the distDir config not being set - // properly. - if (!dev && type === 'next-13-app-router') { - // Use vite to server the static build. - const closeServer = await serveAssets({ - port, - dir: path.join(nextDir, DIST_DIR), - }); - return { - type, - url, - close: closeServer, - }; - } - process.env.NODE_ENV = mode; const nextConfig = await import(path.join(nextDir, 'next.config.js')); diff --git a/tests/servers.ts b/tests/servers.ts index 8c56d01be..2e411424b 100644 --- a/tests/servers.ts +++ b/tests/servers.ts @@ -7,34 +7,6 @@ interface ServerDefinition { } export const NEXT_SERVERS: ServerDefinition[] = [ - { - name: 'Next 12 Dev Server', - isProduction: false, - script: 'pnpm --filter=next-12-pages-router dev', - port: 3001, - suite: 'limited', - }, - { - name: 'Next 12 Build', - isProduction: true, - script: 'pnpm --filter=next-12-pages-router start', - port: 3002, - suite: 'limited', - }, - { - name: 'Next 13 Dev Server', - isProduction: false, - script: 'pnpm --filter=next-13-app-router dev', - port: 3003, - suite: 'limited', - }, - { - name: 'Next 13 Build', - isProduction: true, - script: 'pnpm --filter=next-13-app-router start', - port: 3004, - suite: 'limited', - }, { name: 'Next 16 Dev Server (Webpack)', isProduction: false,