next 15.2.0-canary.51 → 15.2.0-canary.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of next might be problematic. Click here for more details.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/load-jsconfig.d.ts +1 -0
- package/dist/build/load-jsconfig.js +2 -1
- package/dist/build/load-jsconfig.js.map +1 -1
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack-config.d.ts +3 -1
- package/dist/build/webpack-config.js +44 -23
- package/dist/build/webpack-config.js.map +1 -1
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/components/errors/attach-hydration-error-state.js +37 -24
- package/dist/client/components/errors/attach-hydration-error-state.js.map +1 -1
- package/dist/client/components/errors/hydration-error-info.js +86 -19
- package/dist/client/components/errors/hydration-error-info.js.map +1 -1
- package/dist/client/components/is-hydration-error.d.ts +1 -0
- package/dist/client/components/is-hydration-error.js +41 -3
- package/dist/client/components/is-hydration-error.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js +1 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.d.ts +1 -56
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js +4 -240
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.stories.js +0 -21
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.stories.js.map +1 -1
- package/dist/client/components/react-dev-overlay/hydration-diff/diff-view.d.ts +54 -0
- package/dist/client/components/react-dev-overlay/hydration-diff/diff-view.js +101 -0
- package/dist/client/components/react-dev-overlay/hydration-diff/diff-view.js.map +1 -0
- package/dist/client/components/react-dev-overlay/internal/container/Errors.js +1 -2
- package/dist/client/components/react-dev-overlay/internal/container/Errors.js.map +1 -1
- package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.d.ts +2 -56
- package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.js +28 -227
- package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.js.map +1 -1
- package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/index.js +1 -1
- package/dist/client/components/react-dev-overlay/internal/container/RuntimeError/index.js.map +1 -1
- package/dist/client/components/react-dev-overlay/internal/styles/ComponentStyles.js +3 -1
- package/dist/client/components/react-dev-overlay/internal/styles/ComponentStyles.js.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/app-page.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +6 -6
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/load-jsconfig.js +2 -1
- package/dist/esm/build/load-jsconfig.js.map +1 -1
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack-config.js +44 -23
- package/dist/esm/build/webpack-config.js.map +1 -1
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/components/errors/attach-hydration-error-state.js +38 -25
- package/dist/esm/client/components/errors/attach-hydration-error-state.js.map +1 -1
- package/dist/esm/client/components/errors/hydration-error-info.js +87 -20
- package/dist/esm/client/components/errors/hydration-error-info.js.map +1 -1
- package/dist/esm/client/components/is-hydration-error.js +36 -2
- package/dist/esm/client/components/is-hydration-error.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js +1 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js +3 -287
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.stories.js +0 -21
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/component-stack-pseudo-html.stories.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/hydration-diff/diff-view.js +132 -0
- package/dist/esm/client/components/react-dev-overlay/hydration-diff/diff-view.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/internal/container/Errors.js +1 -2
- package/dist/esm/client/components/react-dev-overlay/internal/container/Errors.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.js +12 -271
- package/dist/esm/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/internal/container/RuntimeError/index.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/internal/container/RuntimeError/index.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/internal/styles/ComponentStyles.js +3 -1
- package/dist/esm/client/components/react-dev-overlay/internal/styles/ComponentStyles.js.map +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/config.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/server/config.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
package/dist/esm/build/index.js
CHANGED
|
@@ -296,7 +296,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
|
296
296
|
const nextBuildSpan = trace('next-build', undefined, {
|
|
297
297
|
buildMode: experimentalBuildMode,
|
|
298
298
|
isTurboBuild: String(turboNextBuild),
|
|
299
|
-
version: "15.2.0-canary.
|
|
299
|
+
version: "15.2.0-canary.52"
|
|
300
300
|
});
|
|
301
301
|
NextBuildContext.nextBuildSpan = nextBuildSpan;
|
|
302
302
|
NextBuildContext.dir = dir;
|
|
@@ -661,7 +661,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
|
661
661
|
// Files outside of the distDir can be "type": "module"
|
|
662
662
|
await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
|
663
663
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
|
664
|
-
await recordFrameworkVersion("15.2.0-canary.
|
|
664
|
+
await recordFrameworkVersion("15.2.0-canary.52");
|
|
665
665
|
await updateBuildDiagnostics({
|
|
666
666
|
buildStage: 'start'
|
|
667
667
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/build/load-jsconfig.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport * as Log from './output/log'\nimport { getTypeScriptConfiguration } from '../lib/typescript/getTypeScriptConfiguration'\nimport { readFileSync } from 'fs'\nimport isError from '../lib/is-error'\nimport { hasNecessaryDependencies } from '../lib/has-necessary-dependencies'\n\nlet TSCONFIG_WARNED = false\n\nexport function parseJsonFile(filePath: string) {\n const JSON5 = require('next/dist/compiled/json5')\n const contents = readFileSync(filePath, 'utf8')\n\n // Special case an empty file\n if (contents.trim() === '') {\n return {}\n }\n\n try {\n return JSON5.parse(contents)\n } catch (err) {\n if (!isError(err)) throw err\n const { codeFrameColumns } = require('next/dist/compiled/babel/code-frame')\n const codeFrame = codeFrameColumns(\n String(contents),\n {\n start: {\n line: (err as Error & { lineNumber?: number }).lineNumber || 0,\n column: (err as Error & { columnNumber?: number }).columnNumber || 0,\n },\n },\n { message: err.message, highlightCode: true }\n )\n throw new Error(`Failed to parse \"${filePath}\":\\n${codeFrame}`)\n }\n}\n\nexport type ResolvedBaseUrl =\n | { baseUrl: string; isImplicit: boolean }\n | undefined\n\nexport type JsConfig = { compilerOptions: Record<string, any> } | undefined\n\nexport default async function loadJsConfig(\n dir: string,\n config: NextConfigComplete\n): Promise<{\n useTypeScript: boolean\n jsConfig: JsConfig\n resolvedBaseUrl: ResolvedBaseUrl\n}> {\n let typeScriptPath: string | undefined\n try {\n const deps = await hasNecessaryDependencies(dir, [\n {\n pkg: 'typescript',\n file: 'typescript/lib/typescript.js',\n exportsRestrict: true,\n },\n ])\n typeScriptPath = deps.resolved.get('typescript')\n } catch {}\n const tsConfigPath = path.join(dir, config.typescript.tsconfigPath)\n const useTypeScript = Boolean(typeScriptPath && fs.existsSync(tsConfigPath))\n\n let implicitBaseurl\n let jsConfig: { compilerOptions: Record<string, any> } | undefined\n // jsconfig is a subset of tsconfig\n if (useTypeScript) {\n if (\n config.typescript.tsconfigPath !== 'tsconfig.json' &&\n TSCONFIG_WARNED === false\n ) {\n TSCONFIG_WARNED = true\n Log.info(`Using tsconfig file: ${config.typescript.tsconfigPath}`)\n }\n\n const ts = (await Promise.resolve(\n require(typeScriptPath!)\n )) as typeof import('typescript')\n const tsConfig = await getTypeScriptConfiguration(ts, tsConfigPath, true)\n jsConfig = { compilerOptions: tsConfig.options }\n implicitBaseurl = path.dirname(tsConfigPath)\n }\n\n const jsConfigPath = path.join(dir, 'jsconfig.json')\n if (!useTypeScript && fs.existsSync(jsConfigPath)) {\n jsConfig = parseJsonFile(jsConfigPath)\n implicitBaseurl = path.dirname(jsConfigPath)\n }\n\n let resolvedBaseUrl: ResolvedBaseUrl\n if (jsConfig?.compilerOptions?.baseUrl) {\n resolvedBaseUrl = {\n baseUrl: path.resolve(dir, jsConfig.compilerOptions.baseUrl),\n isImplicit: false,\n }\n } else {\n if (implicitBaseurl) {\n resolvedBaseUrl = {\n baseUrl: implicitBaseurl,\n isImplicit: true,\n }\n }\n }\n\n return {\n useTypeScript,\n jsConfig,\n resolvedBaseUrl,\n }\n}\n"],"names":["path","fs","Log","getTypeScriptConfiguration","readFileSync","isError","hasNecessaryDependencies","TSCONFIG_WARNED","parseJsonFile","filePath","JSON5","require","contents","trim","parse","err","codeFrameColumns","codeFrame","String","start","line","lineNumber","column","columnNumber","message","highlightCode","Error","loadJsConfig","dir","config","jsConfig","typeScriptPath","deps","pkg","file","exportsRestrict","resolved","get","tsConfigPath","join","typescript","tsconfigPath","useTypeScript","Boolean","existsSync","implicitBaseurl","info","ts","Promise","resolve","tsConfig","compilerOptions","options","dirname","jsConfigPath","resolvedBaseUrl","baseUrl","isImplicit"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,OAAOC,QAAQ,KAAI;AAEnB,YAAYC,SAAS,eAAc;AACnC,SAASC,0BAA0B,QAAQ,+CAA8C;AACzF,SAASC,YAAY,QAAQ,KAAI;AACjC,OAAOC,aAAa,kBAAiB;AACrC,SAASC,wBAAwB,QAAQ,oCAAmC;AAE5E,IAAIC,kBAAkB;AAEtB,OAAO,SAASC,cAAcC,QAAgB;IAC5C,MAAMC,QAAQC,QAAQ;IACtB,MAAMC,WAAWR,aAAaK,UAAU;IAExC,6BAA6B;IAC7B,IAAIG,SAASC,IAAI,OAAO,IAAI;QAC1B,OAAO,CAAC;IACV;IAEA,IAAI;QACF,OAAOH,MAAMI,KAAK,CAACF;IACrB,EAAE,OAAOG,KAAK;QACZ,IAAI,CAACV,QAAQU,MAAM,MAAMA;QACzB,MAAM,EAAEC,gBAAgB,EAAE,GAAGL,QAAQ;QACrC,MAAMM,YAAYD,iBAChBE,OAAON,WACP;YACEO,OAAO;gBACLC,MAAM,AAACL,IAAwCM,UAAU,IAAI;gBAC7DC,QAAQ,AAACP,IAA0CQ,YAAY,IAAI;YACrE;QACF,GACA;YAAEC,SAAST,IAAIS,OAAO;YAAEC,eAAe;QAAK;QAE9C,MAAM,qBAAyD,CAAzD,IAAIC,MAAM,CAAC,iBAAiB,EAAEjB,SAAS,IAAI,EAAEQ,WAAW,GAAxD,qBAAA;mBAAA;wBAAA;QAAwD;IAChE;AACF;AAQA,eAAe,eAAeU,aAC5BC,GAAW,EACXC,MAA0B;
|
|
1
|
+
{"version":3,"sources":["../../src/build/load-jsconfig.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport * as Log from './output/log'\nimport { getTypeScriptConfiguration } from '../lib/typescript/getTypeScriptConfiguration'\nimport { readFileSync } from 'fs'\nimport isError from '../lib/is-error'\nimport { hasNecessaryDependencies } from '../lib/has-necessary-dependencies'\n\nlet TSCONFIG_WARNED = false\n\nexport function parseJsonFile(filePath: string) {\n const JSON5 = require('next/dist/compiled/json5')\n const contents = readFileSync(filePath, 'utf8')\n\n // Special case an empty file\n if (contents.trim() === '') {\n return {}\n }\n\n try {\n return JSON5.parse(contents)\n } catch (err) {\n if (!isError(err)) throw err\n const { codeFrameColumns } = require('next/dist/compiled/babel/code-frame')\n const codeFrame = codeFrameColumns(\n String(contents),\n {\n start: {\n line: (err as Error & { lineNumber?: number }).lineNumber || 0,\n column: (err as Error & { columnNumber?: number }).columnNumber || 0,\n },\n },\n { message: err.message, highlightCode: true }\n )\n throw new Error(`Failed to parse \"${filePath}\":\\n${codeFrame}`)\n }\n}\n\nexport type ResolvedBaseUrl =\n | { baseUrl: string; isImplicit: boolean }\n | undefined\n\nexport type JsConfig = { compilerOptions: Record<string, any> } | undefined\n\nexport default async function loadJsConfig(\n dir: string,\n config: NextConfigComplete\n): Promise<{\n useTypeScript: boolean\n jsConfig: JsConfig\n jsConfigPath?: string\n resolvedBaseUrl: ResolvedBaseUrl\n}> {\n let typeScriptPath: string | undefined\n try {\n const deps = await hasNecessaryDependencies(dir, [\n {\n pkg: 'typescript',\n file: 'typescript/lib/typescript.js',\n exportsRestrict: true,\n },\n ])\n typeScriptPath = deps.resolved.get('typescript')\n } catch {}\n const tsConfigPath = path.join(dir, config.typescript.tsconfigPath)\n const useTypeScript = Boolean(typeScriptPath && fs.existsSync(tsConfigPath))\n\n let implicitBaseurl\n let jsConfig: { compilerOptions: Record<string, any> } | undefined\n // jsconfig is a subset of tsconfig\n if (useTypeScript) {\n if (\n config.typescript.tsconfigPath !== 'tsconfig.json' &&\n TSCONFIG_WARNED === false\n ) {\n TSCONFIG_WARNED = true\n Log.info(`Using tsconfig file: ${config.typescript.tsconfigPath}`)\n }\n\n const ts = (await Promise.resolve(\n require(typeScriptPath!)\n )) as typeof import('typescript')\n const tsConfig = await getTypeScriptConfiguration(ts, tsConfigPath, true)\n jsConfig = { compilerOptions: tsConfig.options }\n implicitBaseurl = path.dirname(tsConfigPath)\n }\n\n const jsConfigPath = path.join(dir, 'jsconfig.json')\n if (!useTypeScript && fs.existsSync(jsConfigPath)) {\n jsConfig = parseJsonFile(jsConfigPath)\n implicitBaseurl = path.dirname(jsConfigPath)\n }\n\n let resolvedBaseUrl: ResolvedBaseUrl\n if (jsConfig?.compilerOptions?.baseUrl) {\n resolvedBaseUrl = {\n baseUrl: path.resolve(dir, jsConfig.compilerOptions.baseUrl),\n isImplicit: false,\n }\n } else {\n if (implicitBaseurl) {\n resolvedBaseUrl = {\n baseUrl: implicitBaseurl,\n isImplicit: true,\n }\n }\n }\n\n return {\n useTypeScript,\n jsConfig,\n resolvedBaseUrl,\n jsConfigPath: useTypeScript\n ? tsConfigPath\n : fs.existsSync(jsConfigPath)\n ? jsConfigPath\n : undefined,\n }\n}\n"],"names":["path","fs","Log","getTypeScriptConfiguration","readFileSync","isError","hasNecessaryDependencies","TSCONFIG_WARNED","parseJsonFile","filePath","JSON5","require","contents","trim","parse","err","codeFrameColumns","codeFrame","String","start","line","lineNumber","column","columnNumber","message","highlightCode","Error","loadJsConfig","dir","config","jsConfig","typeScriptPath","deps","pkg","file","exportsRestrict","resolved","get","tsConfigPath","join","typescript","tsconfigPath","useTypeScript","Boolean","existsSync","implicitBaseurl","info","ts","Promise","resolve","tsConfig","compilerOptions","options","dirname","jsConfigPath","resolvedBaseUrl","baseUrl","isImplicit","undefined"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,OAAOC,QAAQ,KAAI;AAEnB,YAAYC,SAAS,eAAc;AACnC,SAASC,0BAA0B,QAAQ,+CAA8C;AACzF,SAASC,YAAY,QAAQ,KAAI;AACjC,OAAOC,aAAa,kBAAiB;AACrC,SAASC,wBAAwB,QAAQ,oCAAmC;AAE5E,IAAIC,kBAAkB;AAEtB,OAAO,SAASC,cAAcC,QAAgB;IAC5C,MAAMC,QAAQC,QAAQ;IACtB,MAAMC,WAAWR,aAAaK,UAAU;IAExC,6BAA6B;IAC7B,IAAIG,SAASC,IAAI,OAAO,IAAI;QAC1B,OAAO,CAAC;IACV;IAEA,IAAI;QACF,OAAOH,MAAMI,KAAK,CAACF;IACrB,EAAE,OAAOG,KAAK;QACZ,IAAI,CAACV,QAAQU,MAAM,MAAMA;QACzB,MAAM,EAAEC,gBAAgB,EAAE,GAAGL,QAAQ;QACrC,MAAMM,YAAYD,iBAChBE,OAAON,WACP;YACEO,OAAO;gBACLC,MAAM,AAACL,IAAwCM,UAAU,IAAI;gBAC7DC,QAAQ,AAACP,IAA0CQ,YAAY,IAAI;YACrE;QACF,GACA;YAAEC,SAAST,IAAIS,OAAO;YAAEC,eAAe;QAAK;QAE9C,MAAM,qBAAyD,CAAzD,IAAIC,MAAM,CAAC,iBAAiB,EAAEjB,SAAS,IAAI,EAAEQ,WAAW,GAAxD,qBAAA;mBAAA;wBAAA;QAAwD;IAChE;AACF;AAQA,eAAe,eAAeU,aAC5BC,GAAW,EACXC,MAA0B;QAgDtBC;IAzCJ,IAAIC;IACJ,IAAI;QACF,MAAMC,OAAO,MAAM1B,yBAAyBsB,KAAK;YAC/C;gBACEK,KAAK;gBACLC,MAAM;gBACNC,iBAAiB;YACnB;SACD;QACDJ,iBAAiBC,KAAKI,QAAQ,CAACC,GAAG,CAAC;IACrC,EAAE,OAAM,CAAC;IACT,MAAMC,eAAetC,KAAKuC,IAAI,CAACX,KAAKC,OAAOW,UAAU,CAACC,YAAY;IAClE,MAAMC,gBAAgBC,QAAQZ,kBAAkB9B,GAAG2C,UAAU,CAACN;IAE9D,IAAIO;IACJ,IAAIf;IACJ,mCAAmC;IACnC,IAAIY,eAAe;QACjB,IACEb,OAAOW,UAAU,CAACC,YAAY,KAAK,mBACnClC,oBAAoB,OACpB;YACAA,kBAAkB;YAClBL,IAAI4C,IAAI,CAAC,CAAC,qBAAqB,EAAEjB,OAAOW,UAAU,CAACC,YAAY,EAAE;QACnE;QAEA,MAAMM,KAAM,MAAMC,QAAQC,OAAO,CAC/BtC,QAAQoB;QAEV,MAAMmB,WAAW,MAAM/C,2BAA2B4C,IAAIT,cAAc;QACpER,WAAW;YAAEqB,iBAAiBD,SAASE,OAAO;QAAC;QAC/CP,kBAAkB7C,KAAKqD,OAAO,CAACf;IACjC;IAEA,MAAMgB,eAAetD,KAAKuC,IAAI,CAACX,KAAK;IACpC,IAAI,CAACc,iBAAiBzC,GAAG2C,UAAU,CAACU,eAAe;QACjDxB,WAAWtB,cAAc8C;QACzBT,kBAAkB7C,KAAKqD,OAAO,CAACC;IACjC;IAEA,IAAIC;IACJ,IAAIzB,6BAAAA,4BAAAA,SAAUqB,eAAe,qBAAzBrB,0BAA2B0B,OAAO,EAAE;QACtCD,kBAAkB;YAChBC,SAASxD,KAAKiD,OAAO,CAACrB,KAAKE,SAASqB,eAAe,CAACK,OAAO;YAC3DC,YAAY;QACd;IACF,OAAO;QACL,IAAIZ,iBAAiB;YACnBU,kBAAkB;gBAChBC,SAASX;gBACTY,YAAY;YACd;QACF;IACF;IAEA,OAAO;QACLf;QACAZ;QACAyB;QACAD,cAAcZ,gBACVJ,eACArC,GAAG2C,UAAU,CAACU,gBACZA,eACAI;IACR;AACF"}
|
|
@@ -11,7 +11,7 @@ import { isDeepStrictEqual } from 'util';
|
|
|
11
11
|
import { getDefineEnv } from '../webpack/plugins/define-env-plugin';
|
|
12
12
|
import { getReactCompilerLoader } from '../get-babel-loader-config';
|
|
13
13
|
import { TurbopackInternalError } from '../../shared/lib/turbopack/utils';
|
|
14
|
-
const nextVersion = "15.2.0-canary.
|
|
14
|
+
const nextVersion = "15.2.0-canary.52";
|
|
15
15
|
const ArchName = arch();
|
|
16
16
|
const PlatformName = platform();
|
|
17
17
|
function infoLog(...args) {
|
|
@@ -170,10 +170,11 @@ export const NODE_BASE_ESM_RESOLVE_OPTIONS = {
|
|
|
170
170
|
};
|
|
171
171
|
export const nextImageLoaderRegex = /\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i;
|
|
172
172
|
export async function loadProjectInfo({ dir, config, dev }) {
|
|
173
|
-
const { jsConfig, resolvedBaseUrl } = await loadJsConfig(dir, config);
|
|
173
|
+
const { jsConfig, jsConfigPath, resolvedBaseUrl } = await loadJsConfig(dir, config);
|
|
174
174
|
const supportedBrowsers = await getSupportedBrowsers(dir, dev);
|
|
175
175
|
return {
|
|
176
176
|
jsConfig,
|
|
177
|
+
jsConfigPath,
|
|
177
178
|
resolvedBaseUrl,
|
|
178
179
|
supportedBrowsers
|
|
179
180
|
};
|
|
@@ -187,13 +188,14 @@ export function hasExternalOtelApiPackage() {
|
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
const UNSAFE_CACHE_REGEX = /[\\/]pages[\\/][^\\/]+(?:$|\?|#)/;
|
|
190
|
-
export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compilerType, dev = false, entrypoints, isDevFallback = false, pagesDir, reactProductionProfiling = false, rewrites, originalRewrites, originalRedirects, runWebpackSpan, appDir, middlewareMatchers, jsConfig, resolvedBaseUrl, supportedBrowsers, clientRouterFilters, fetchCacheKeyPrefix, edgePreviewProps }) {
|
|
191
|
+
export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compilerType, dev = false, entrypoints, isDevFallback = false, pagesDir, reactProductionProfiling = false, rewrites, originalRewrites, originalRedirects, runWebpackSpan, appDir, middlewareMatchers, jsConfig, jsConfigPath, resolvedBaseUrl, supportedBrowsers, clientRouterFilters, fetchCacheKeyPrefix, edgePreviewProps }) {
|
|
191
192
|
var _config_experimental, _config_experimental1, _config_watchOptions, _config_experimental_sri, _config_experimental_sri1, _config_compiler, _config_compiler1, _config_compiler2, _jsConfig_compilerOptions, _config_compiler3, _jsConfig_compilerOptions1, _config_compiler4, _jsConfig_compilerOptions2, // always add JsConfigPathsPlugin to allow hot-reloading
|
|
192
193
|
// if the config is added/removed
|
|
193
194
|
_webpackConfig_resolve_plugins, _webpackConfig_resolve, _config_experimental2, _config_compiler5, _config_compiler6, _config_compiler7, _config_compiler8, _config_compiler9, _webpack5Config_plugins, _webpackConfig_module, _webpackConfig_module1, _webpackConfig_module_rules, _webpackConfig_module2;
|
|
194
195
|
const isClient = compilerType === COMPILER_NAMES.client;
|
|
195
196
|
const isEdgeServer = compilerType === COMPILER_NAMES.edgeServer;
|
|
196
197
|
const isNodeServer = compilerType === COMPILER_NAMES.server;
|
|
198
|
+
const isRspack = Boolean(process.env.NEXT_RSPACK);
|
|
197
199
|
// If the current compilation is aimed at server-side code instead of client-side code.
|
|
198
200
|
const isNodeOrEdgeCompilation = isNodeServer || isEdgeServer;
|
|
199
201
|
const hasRewrites = rewrites.beforeFiles.length > 0 || rewrites.afterFiles.length > 0 || rewrites.fallback.length > 0;
|
|
@@ -449,7 +451,12 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
449
451
|
},
|
|
450
452
|
plugins: [
|
|
451
453
|
isNodeServer ? new OptionalPeerDependencyResolverPlugin() : undefined
|
|
452
|
-
].filter(Boolean)
|
|
454
|
+
].filter(Boolean),
|
|
455
|
+
...isRspack && jsConfigPath ? {
|
|
456
|
+
tsConfig: {
|
|
457
|
+
configFile: jsConfigPath
|
|
458
|
+
}
|
|
459
|
+
} : {}
|
|
453
460
|
};
|
|
454
461
|
// Packages which will be split into the 'framework' chunk.
|
|
455
462
|
// Only top-level packages are included, e.g. nested copies like
|
|
@@ -658,22 +665,26 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
658
665
|
const libCacheGroup = {
|
|
659
666
|
test (module) {
|
|
660
667
|
var _module_type;
|
|
661
|
-
return !((_module_type = module.type) == null ? void 0 : _module_type.startsWith('css')) &&
|
|
668
|
+
return !((_module_type = module.type) == null ? void 0 : _module_type.startsWith('css')) && // rspack doesn't support module.size
|
|
669
|
+
(isRspack || module.size() > 160000) && /node_modules[/\\]/.test(module.nameForCondition() || '');
|
|
662
670
|
},
|
|
663
671
|
name (module) {
|
|
664
672
|
const hash = crypto.createHash('sha1');
|
|
665
673
|
if (isModuleCSS(module)) {
|
|
666
674
|
module.updateHash(hash);
|
|
667
675
|
} else {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
676
|
+
// rspack doesn't support this
|
|
677
|
+
if (!isRspack) {
|
|
678
|
+
if (!module.libIdent) {
|
|
679
|
+
throw Object.defineProperty(new Error(`Encountered unknown module type: ${module.type}. Please open an issue.`), "__NEXT_ERROR_CODE", {
|
|
680
|
+
value: "E487",
|
|
681
|
+
enumerable: false
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
hash.update(module.libIdent({
|
|
685
|
+
context: dir
|
|
686
|
+
}));
|
|
673
687
|
}
|
|
674
|
-
hash.update(module.libIdent({
|
|
675
|
-
context: dir
|
|
676
|
-
}));
|
|
677
688
|
}
|
|
678
689
|
// Ensures the name of the chunk is not the same between two modules in different layers
|
|
679
690
|
// E.g. if you import 'button-library' in App Router and Pages Router we don't want these to be bundled in the same chunk
|
|
@@ -693,8 +704,10 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
693
704
|
// as we don't need a separate vendor chunk from that
|
|
694
705
|
// and all other chunk depend on them so there is no
|
|
695
706
|
// duplication that need to be pulled out.
|
|
696
|
-
chunks:
|
|
697
|
-
|
|
707
|
+
chunks: isRspack ? // in rspack
|
|
708
|
+
/(?!polyfills|main|pages\/_app)/ : (chunk)=>!/^(polyfills|main|pages\/_app)$/.test(chunk.name),
|
|
709
|
+
// TODO: investigate these cache groups with rspack
|
|
710
|
+
cacheGroups: isRspack ? {} : {
|
|
698
711
|
framework: frameworkCacheGroup,
|
|
699
712
|
lib: libCacheGroup
|
|
700
713
|
},
|
|
@@ -706,7 +719,14 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
706
719
|
name: CLIENT_STATIC_FILES_RUNTIME_WEBPACK
|
|
707
720
|
} : undefined,
|
|
708
721
|
minimize: !dev && (isClient || isEdgeServer || isNodeServer && config.experimental.serverMinification),
|
|
709
|
-
minimizer: [
|
|
722
|
+
minimizer: isRspack ? [
|
|
723
|
+
// @ts-expect-error
|
|
724
|
+
new webpack.SwcJsMinimizerRspackPlugin({
|
|
725
|
+
}),
|
|
726
|
+
// @ts-expect-error
|
|
727
|
+
new webpack.LightningCssMinimizerRspackPlugin({
|
|
728
|
+
})
|
|
729
|
+
] : [
|
|
710
730
|
// Minify JavaScript
|
|
711
731
|
(compiler)=>{
|
|
712
732
|
// @ts-ignore No typings yet
|
|
@@ -1305,7 +1325,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1305
1325
|
dev && new MemoryWithGcCachePlugin({
|
|
1306
1326
|
maxGenerations: 5
|
|
1307
1327
|
}),
|
|
1308
|
-
dev && isClient && new ReactRefreshWebpackPlugin(webpack),
|
|
1328
|
+
dev && isClient && (isRspack ? new (require('@rspack/plugin-react-refresh'))() : new ReactRefreshWebpackPlugin(webpack)),
|
|
1309
1329
|
// Makes sure `Buffer` and `process` are polyfilled in client and flight bundles (same behavior as webpack 4)
|
|
1310
1330
|
(isClient || isEdgeServer) && new webpack.ProvidePlugin({
|
|
1311
1331
|
// Buffer is used by getInlineScriptSource
|
|
@@ -1340,7 +1360,8 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1340
1360
|
runtimeAsset: `server/${MIDDLEWARE_REACT_LOADABLE_MANIFEST}.js`,
|
|
1341
1361
|
dev
|
|
1342
1362
|
}),
|
|
1343
|
-
|
|
1363
|
+
// rspack doesn't support the parser hooks used here
|
|
1364
|
+
!isRspack && (isClient || isEdgeServer) && new DropClientPage(),
|
|
1344
1365
|
isNodeServer && !dev && new (require('./webpack/plugins/next-trace-entrypoints-plugin')).TraceEntryPointsPlugin({
|
|
1345
1366
|
rootDir: dir,
|
|
1346
1367
|
appDir: appDir,
|
|
@@ -1403,7 +1424,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1403
1424
|
appDirEnabled: hasAppDir,
|
|
1404
1425
|
clientRouterFilters
|
|
1405
1426
|
}),
|
|
1406
|
-
new ProfilingPlugin({
|
|
1427
|
+
!isRspack && new ProfilingPlugin({
|
|
1407
1428
|
runWebpackSpan,
|
|
1408
1429
|
rootDir: dir
|
|
1409
1430
|
}),
|
|
@@ -1411,7 +1432,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1411
1432
|
isClient && new CopyFilePlugin({
|
|
1412
1433
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1413
1434
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1414
|
-
cacheKey: "15.2.0-canary.
|
|
1435
|
+
cacheKey: "15.2.0-canary.52",
|
|
1415
1436
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1416
1437
|
minimize: false,
|
|
1417
1438
|
info: {
|
|
@@ -1449,8 +1470,8 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1449
1470
|
isClient && new NextFontManifestPlugin({
|
|
1450
1471
|
appDir
|
|
1451
1472
|
}),
|
|
1452
|
-
!dev && isClient && config.experimental.cssChunking && new CssChunkingPlugin(config.experimental.cssChunking === 'strict'),
|
|
1453
|
-
!dev && isClient && new (require('./webpack/plugins/telemetry-plugin/telemetry-plugin')).TelemetryPlugin(new Map([
|
|
1473
|
+
!isRspack && !dev && isClient && config.experimental.cssChunking && new CssChunkingPlugin(config.experimental.cssChunking === 'strict'),
|
|
1474
|
+
!isRspack && !dev && isClient && new (require('./webpack/plugins/telemetry-plugin/telemetry-plugin')).TelemetryPlugin(new Map([
|
|
1454
1475
|
[
|
|
1455
1476
|
'swcLoader',
|
|
1456
1477
|
useSWCLoader
|
|
@@ -1506,7 +1527,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1506
1527
|
],
|
|
1507
1528
|
SWCBinaryTarget
|
|
1508
1529
|
].filter(Boolean))),
|
|
1509
|
-
!dev && isNodeServer && new (require('./webpack/plugins/telemetry-plugin/telemetry-plugin')).TelemetryPlugin(new Map()),
|
|
1530
|
+
!isRspack && !dev && isNodeServer && new (require('./webpack/plugins/telemetry-plugin/telemetry-plugin')).TelemetryPlugin(new Map()),
|
|
1510
1531
|
shouldEnableSlowModuleDetection && new (require('./webpack/plugins/slow-module-detection-plugin')).default({
|
|
1511
1532
|
compilerType,
|
|
1512
1533
|
...config.experimental.slowModuleDetection
|
|
@@ -1644,7 +1665,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1644
1665
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1645
1666
|
// - Next.js version
|
|
1646
1667
|
// - next.config.js keys that affect compilation
|
|
1647
|
-
version: `${__dirname}|${"15.2.0-canary.
|
|
1668
|
+
version: `${__dirname}|${"15.2.0-canary.52"}|${configVars}`,
|
|
1648
1669
|
cacheDirectory: path.join(distDir, 'cache', 'webpack'),
|
|
1649
1670
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1650
1671
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|