next 15.6.0-canary.50 → 15.6.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.
- package/dist/bin/next +1 -1
- package/dist/build/adapter/build-complete.d.ts +12 -1
- package/dist/build/adapter/build-complete.js +80 -21
- package/dist/build/adapter/build-complete.js.map +1 -1
- package/dist/build/index.js +31 -27
- package/dist/build/index.js.map +1 -1
- package/dist/build/swc/index.js +1 -1
- package/dist/build/type-check.js +15 -8
- package/dist/build/type-check.js.map +1 -1
- package/dist/build/webpack/config/blocks/css/index.js +1 -15
- package/dist/build/webpack/config/blocks/css/index.js.map +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages-api.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages.runtime.prod.js.map +1 -1
- package/dist/compiled/sass-loader/cjs.js +1 -1
- package/dist/esm/build/adapter/build-complete.js +80 -21
- package/dist/esm/build/adapter/build-complete.js.map +1 -1
- package/dist/esm/build/index.js +31 -27
- package/dist/esm/build/index.js.map +1 -1
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/type-check.js +15 -8
- package/dist/esm/build/type-check.js.map +1 -1
- package/dist/esm/build/webpack/config/blocks/css/index.js +1 -15
- package/dist/esm/build/webpack/config/blocks/css/index.js.map +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/lib/recursive-delete.js +1 -1
- package/dist/esm/lib/recursive-delete.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +8 -2
- package/dist/esm/server/dev/hot-reloader-turbopack.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +10 -4
- package/dist/esm/server/dev/hot-reloader-webpack.js.map +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/esm/server/mcp/get-mcp-middleware.js +2 -2
- package/dist/esm/server/mcp/get-mcp-middleware.js.map +1 -1
- package/dist/esm/server/mcp/get-or-create-mcp-server.js +7 -7
- package/dist/esm/server/mcp/get-or-create-mcp-server.js.map +1 -1
- package/dist/esm/server/mcp/tools/{get-project-path.js → get-project-metadata.js} +9 -5
- package/dist/esm/server/mcp/tools/get-project-metadata.js.map +1 -0
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/lib/recursive-delete.d.ts +1 -1
- package/dist/lib/recursive-delete.js +1 -1
- package/dist/lib/recursive-delete.js.map +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +8 -2
- package/dist/server/dev/hot-reloader-turbopack.js.map +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +10 -4
- package/dist/server/dev/hot-reloader-webpack.js.map +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/server/mcp/get-mcp-middleware.d.ts +2 -2
- package/dist/server/mcp/get-mcp-middleware.js +2 -2
- package/dist/server/mcp/get-mcp-middleware.js.map +1 -1
- package/dist/server/mcp/get-or-create-mcp-server.d.ts +8 -1
- package/dist/server/mcp/get-or-create-mcp-server.js +7 -7
- package/dist/server/mcp/get-or-create-mcp-server.js.map +1 -1
- package/dist/server/mcp/tools/get-project-metadata.d.ts +2 -0
- package/dist/server/mcp/tools/{get-project-path.js → get-project-metadata.js} +11 -7
- package/dist/server/mcp/tools/get-project-metadata.js.map +1 -0
- package/dist/shared/lib/canary-only.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 +16 -16
- package/dist/esm/server/mcp/tools/get-project-path.js.map +0 -1
- package/dist/server/mcp/tools/get-project-path.d.ts +0 -2
- package/dist/server/mcp/tools/get-project-path.js.map +0 -1
|
@@ -10,7 +10,7 @@ import { downloadNativeNextSwc, downloadWasmSwc } from '../../lib/download-swc';
|
|
|
10
10
|
import { isDeepStrictEqual } from 'util';
|
|
11
11
|
import { getDefineEnv } from '../define-env';
|
|
12
12
|
import { throwTurbopackInternalError } from '../../shared/lib/turbopack/internal-error';
|
|
13
|
-
const nextVersion = "15.6.0-canary.
|
|
13
|
+
const nextVersion = "15.6.0-canary.52";
|
|
14
14
|
const ArchName = arch();
|
|
15
15
|
const PlatformName = platform();
|
|
16
16
|
function infoLog(...args) {
|
|
@@ -56,25 +56,25 @@ export async function startTypeChecking({ cacheDir, config, dir, ignoreESLint, n
|
|
|
56
56
|
let typeCheckingAndLintingSpinnerPrefixText;
|
|
57
57
|
let typeCheckingAndLintingSpinner;
|
|
58
58
|
if (!ignoreTypeScriptErrors && shouldLint) {
|
|
59
|
-
typeCheckingAndLintingSpinnerPrefixText = '
|
|
59
|
+
typeCheckingAndLintingSpinnerPrefixText = 'Running ESLint and TypeScript concurrently';
|
|
60
60
|
} else if (!ignoreTypeScriptErrors) {
|
|
61
|
-
typeCheckingAndLintingSpinnerPrefixText = '
|
|
61
|
+
typeCheckingAndLintingSpinnerPrefixText = 'Running TypeScript';
|
|
62
62
|
} else if (shouldLint) {
|
|
63
|
-
typeCheckingAndLintingSpinnerPrefixText = '
|
|
63
|
+
typeCheckingAndLintingSpinnerPrefixText = 'Running ESLint';
|
|
64
64
|
}
|
|
65
65
|
// we will not create a spinner if both ignoreTypeScriptErrors and ignoreESLint are
|
|
66
66
|
// enabled, but we will still verifying project's tsconfig and dependencies.
|
|
67
67
|
if (typeCheckingAndLintingSpinnerPrefixText) {
|
|
68
68
|
typeCheckingAndLintingSpinner = createSpinner(typeCheckingAndLintingSpinnerPrefixText);
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const typeCheckAndLintStart = process.hrtime();
|
|
71
71
|
try {
|
|
72
|
-
const [[verifyResult, typeCheckEnd]] = await Promise.all([
|
|
72
|
+
const [[verifyResult, typeCheckEnd], lintCheckEnd] = await Promise.all([
|
|
73
73
|
nextBuildSpan.traceChild('run-typescript').traceAsyncFn(()=>verifyTypeScriptSetup(dir, config.distDir, [
|
|
74
74
|
pagesDir,
|
|
75
75
|
appDir
|
|
76
76
|
].filter(Boolean), !ignoreTypeScriptErrors, config.typescript.tsconfigPath, config.images.disableStaticImages, cacheDir, config.experimental.workerThreads, !!appDir, !!pagesDir).then((resolved)=>{
|
|
77
|
-
const checkEnd = process.hrtime(
|
|
77
|
+
const checkEnd = process.hrtime(typeCheckAndLintStart);
|
|
78
78
|
return [
|
|
79
79
|
resolved,
|
|
80
80
|
checkEnd
|
|
@@ -83,11 +83,18 @@ export async function startTypeChecking({ cacheDir, config, dir, ignoreESLint, n
|
|
|
83
83
|
shouldLint && nextBuildSpan.traceChild('run-eslint').traceAsyncFn(async ()=>{
|
|
84
84
|
var _config_eslint;
|
|
85
85
|
await verifyAndLint(dir, eslintCacheDir, (_config_eslint = config.eslint) == null ? void 0 : _config_eslint.dirs, config.experimental.workerThreads, telemetry);
|
|
86
|
+
const checkEnd = process.hrtime(typeCheckAndLintStart);
|
|
87
|
+
return checkEnd;
|
|
86
88
|
})
|
|
87
89
|
]);
|
|
88
90
|
if (typeCheckingAndLintingSpinner) {
|
|
89
|
-
|
|
90
|
-
typeCheckingAndLintingSpinner.
|
|
91
|
+
var _createSpinner;
|
|
92
|
+
typeCheckingAndLintingSpinner.stop();
|
|
93
|
+
(_createSpinner = createSpinner(`Finished TypeScript${ignoreTypeScriptErrors ? ' config validation' : ''} in ${hrtimeDurationToString(typeCheckEnd)}`)) == null ? void 0 : _createSpinner.stopAndPersist();
|
|
94
|
+
if (lintCheckEnd) {
|
|
95
|
+
var _createSpinner1;
|
|
96
|
+
(_createSpinner1 = createSpinner(`Finished ESLint in ${hrtimeDurationToString(lintCheckEnd)}`)) == null ? void 0 : _createSpinner1.stopAndPersist();
|
|
97
|
+
}
|
|
91
98
|
}
|
|
92
99
|
if (!ignoreTypeScriptErrors && verifyResult) {
|
|
93
100
|
var _verifyResult_result, _verifyResult_result1, _verifyResult_result2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/build/type-check.ts"],"sourcesContent":["import type { NextConfigComplete } from '../server/config-shared'\nimport type { Telemetry } from '../telemetry/storage'\nimport type { Span } from '../trace'\n\nimport path from 'path'\nimport * as Log from './output/log'\nimport { Worker } from '../lib/worker'\nimport { verifyAndLint } from '../lib/verifyAndLint'\nimport createSpinner from './spinner'\nimport { eventTypeCheckCompleted } from '../telemetry/events'\nimport isError from '../lib/is-error'\nimport { hrtimeDurationToString } from './duration-to-string'\n\n/**\n * typescript will be loaded in \"next/lib/verify-typescript-setup\" and\n * then passed to \"next/lib/typescript/runTypeCheck\" as a parameter.\n *\n * Since it is impossible to pass a function from main thread to a worker,\n * instead of running \"next/lib/typescript/runTypeCheck\" in a worker,\n * we will run entire \"next/lib/verify-typescript-setup\" in a worker instead.\n */\nfunction verifyTypeScriptSetup(\n dir: string,\n distDir: string,\n intentDirs: string[],\n typeCheckPreflight: boolean,\n tsconfigPath: string | undefined,\n disableStaticImages: boolean,\n cacheDir: string | undefined,\n enableWorkerThreads: boolean | undefined,\n hasAppDir: boolean,\n hasPagesDir: boolean\n) {\n const typeCheckWorker = new Worker(\n require.resolve('../lib/verify-typescript-setup'),\n {\n exposedMethods: ['verifyTypeScriptSetup'],\n debuggerPortOffset: -1,\n isolatedMemory: false,\n numWorkers: 1,\n enableWorkerThreads,\n maxRetries: 0,\n }\n ) as Worker & {\n verifyTypeScriptSetup: typeof import('../lib/verify-typescript-setup').verifyTypeScriptSetup\n }\n\n return typeCheckWorker\n .verifyTypeScriptSetup({\n dir,\n distDir,\n intentDirs,\n typeCheckPreflight,\n tsconfigPath,\n disableStaticImages,\n cacheDir,\n hasAppDir,\n hasPagesDir,\n })\n .then((result) => {\n typeCheckWorker.end()\n return result\n })\n .catch(() => {\n // The error is already logged in the worker, we simply exit the main thread to prevent the\n // `Jest worker encountered 1 child process exceptions, exceeding retry limit` from showing up\n process.exit(1)\n })\n}\n\nexport async function startTypeChecking({\n cacheDir,\n config,\n dir,\n ignoreESLint,\n nextBuildSpan,\n pagesDir,\n runLint,\n shouldLint,\n telemetry,\n appDir,\n}: {\n cacheDir: string\n config: NextConfigComplete\n dir: string\n ignoreESLint: boolean\n nextBuildSpan: Span\n pagesDir?: string\n runLint: boolean\n shouldLint: boolean\n telemetry: Telemetry\n appDir?: string\n}) {\n const ignoreTypeScriptErrors = Boolean(config.typescript.ignoreBuildErrors)\n\n const eslintCacheDir = path.join(cacheDir, 'eslint/')\n\n if (ignoreTypeScriptErrors) {\n Log.info('Skipping validation of types')\n }\n if (runLint && ignoreESLint) {\n // only print log when build require lint while ignoreESLint is enabled\n Log.info('Skipping linting')\n }\n\n let typeCheckingAndLintingSpinnerPrefixText: string | undefined\n let typeCheckingAndLintingSpinner:\n | ReturnType<typeof createSpinner>\n | undefined\n\n if (!ignoreTypeScriptErrors && shouldLint) {\n typeCheckingAndLintingSpinnerPrefixText =\n 'Linting and checking validity of types'\n } else if (!ignoreTypeScriptErrors) {\n typeCheckingAndLintingSpinnerPrefixText = 'Checking validity of types'\n } else if (shouldLint) {\n typeCheckingAndLintingSpinnerPrefixText = 'Linting'\n }\n\n // we will not create a spinner if both ignoreTypeScriptErrors and ignoreESLint are\n // enabled, but we will still verifying project's tsconfig and dependencies.\n if (typeCheckingAndLintingSpinnerPrefixText) {\n typeCheckingAndLintingSpinner = createSpinner(\n typeCheckingAndLintingSpinnerPrefixText\n )\n }\n\n const typeCheckStart = process.hrtime()\n\n try {\n const [[verifyResult, typeCheckEnd]] = await Promise.all([\n nextBuildSpan.traceChild('run-typescript').traceAsyncFn(() =>\n verifyTypeScriptSetup(\n dir,\n config.distDir,\n [pagesDir, appDir].filter(Boolean) as string[],\n !ignoreTypeScriptErrors,\n config.typescript.tsconfigPath,\n config.images.disableStaticImages,\n cacheDir,\n config.experimental.workerThreads,\n !!appDir,\n !!pagesDir\n ).then((resolved) => {\n const checkEnd = process.hrtime(typeCheckStart)\n return [resolved, checkEnd] as const\n })\n ),\n shouldLint &&\n nextBuildSpan.traceChild('run-eslint').traceAsyncFn(async () => {\n await verifyAndLint(\n dir,\n eslintCacheDir,\n config.eslint?.dirs,\n config.experimental.workerThreads,\n telemetry\n )\n }),\n ])\n\n if (typeCheckingAndLintingSpinner) {\n typeCheckingAndLintingSpinner.setText(\n `${typeCheckingAndLintingSpinnerPrefixText} in ${hrtimeDurationToString(typeCheckEnd)}`\n )\n typeCheckingAndLintingSpinner.stopAndPersist()\n }\n\n if (!ignoreTypeScriptErrors && verifyResult) {\n telemetry.record(\n eventTypeCheckCompleted({\n durationInSeconds: typeCheckEnd[0],\n typescriptVersion: verifyResult.version,\n inputFilesCount: verifyResult.result?.inputFilesCount,\n totalFilesCount: verifyResult.result?.totalFilesCount,\n incremental: verifyResult.result?.incremental,\n })\n )\n }\n } catch (err) {\n // prevent showing jest-worker internal error as it\n // isn't helpful for users and clutters output\n if (isError(err) && err.message === 'Call retries were exceeded') {\n await telemetry.flush()\n process.exit(1)\n }\n throw err\n }\n}\n"],"names":["path","Log","Worker","verifyAndLint","createSpinner","eventTypeCheckCompleted","isError","hrtimeDurationToString","verifyTypeScriptSetup","dir","distDir","intentDirs","typeCheckPreflight","tsconfigPath","disableStaticImages","cacheDir","enableWorkerThreads","hasAppDir","hasPagesDir","typeCheckWorker","require","resolve","exposedMethods","debuggerPortOffset","isolatedMemory","numWorkers","maxRetries","then","result","end","catch","process","exit","startTypeChecking","config","ignoreESLint","nextBuildSpan","pagesDir","runLint","shouldLint","telemetry","appDir","ignoreTypeScriptErrors","Boolean","typescript","ignoreBuildErrors","eslintCacheDir","join","info","typeCheckingAndLintingSpinnerPrefixText","typeCheckingAndLintingSpinner","typeCheckStart","hrtime","verifyResult","typeCheckEnd","Promise","all","traceChild","traceAsyncFn","filter","images","experimental","workerThreads","resolved","checkEnd","eslint","dirs","setText","stopAndPersist","record","durationInSeconds","typescriptVersion","version","inputFilesCount","totalFilesCount","incremental","err","message","flush"],"mappings":"AAIA,OAAOA,UAAU,OAAM;AACvB,YAAYC,SAAS,eAAc;AACnC,SAASC,MAAM,QAAQ,gBAAe;AACtC,SAASC,aAAa,QAAQ,uBAAsB;AACpD,OAAOC,mBAAmB,YAAW;AACrC,SAASC,uBAAuB,QAAQ,sBAAqB;AAC7D,OAAOC,aAAa,kBAAiB;AACrC,SAASC,sBAAsB,QAAQ,uBAAsB;AAE7D;;;;;;;CAOC,GACD,SAASC,sBACPC,GAAW,EACXC,OAAe,EACfC,UAAoB,EACpBC,kBAA2B,EAC3BC,YAAgC,EAChCC,mBAA4B,EAC5BC,QAA4B,EAC5BC,mBAAwC,EACxCC,SAAkB,EAClBC,WAAoB;IAEpB,MAAMC,kBAAkB,IAAIjB,OAC1BkB,QAAQC,OAAO,CAAC,mCAChB;QACEC,gBAAgB;YAAC;SAAwB;QACzCC,oBAAoB,CAAC;QACrBC,gBAAgB;QAChBC,YAAY;QACZT;QACAU,YAAY;IACd;IAKF,OAAOP,gBACJX,qBAAqB,CAAC;QACrBC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAE;QACAC;IACF,GACCS,IAAI,CAAC,CAACC;QACLT,gBAAgBU,GAAG;QACnB,OAAOD;IACT,GACCE,KAA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ACD;oBAChC,OAAO;wBAACY;wBAAUC;qBAAS;gBAC7B;YAEFzB,cACEH,cAAcqB,UAAU,CAAC,cAAcC,YAAY,CAAC;oBAIhDxB;gBAHF,MAAM/B,cACJM,KACAqC,iBACAZ,iBAAAA,OAAO+B,MAAM,qBAAb/B,eAAegC,IAAI,EACnBhC,OAAO2B,YAAY,CAACC,aAAa,EACjCtB;YAEJ;SACH;QAED,IAAIU,+BAA+B;YACjCA,8BAA8BiB,OAAO,CACnC,GAAGlB,wCAAwC,IAAI,EAAE1C,uBAAuB+C,eAAe;YAEzFJ,8BAA8BkB,cAAc;QAC9C;QAEA,IAAI,CAAC1B,0BAA0BW,cAAc;gBAKtBA,sBACAA,uBACJA;YANjBb,UAAU6B,MAAM,CACdhE,wBAAwB;gBACtBiE,mBAAmBhB,YAAY,CAAC,EAAE;gBAClCiB,mBAAmBlB,aAAamB,OAAO;gBACvCC,eAAe,GAAEpB,uBAAAA,aAAazB,MAAM,qBAAnByB,qBAAqBoB,eAAe;gBACrDC,eAAe,GAAErB,wBAAAA,aAAazB,MAAM,qBAAnByB,sBAAqBqB,eAAe;gBACrDC,WAAW,GAAEtB,wBAAAA,aAAazB,MAAM,qBAAnByB,sBAAqBsB,WAAW;YAC/C;QAEJ;IACF,EAAE,OAAOC,KAAK;QACZ,mDAAmD;QACnD,8CAA8C;QAC9C,IAAItE,QAAQsE,QAAQA,IAAIC,OAAO,KAAK,8BAA8B;YAChE,MAAMrC,UAAUsC,KAAK;YACrB/C,QAAQC,IAAI,CAAC;QACf;QACA,MAAM4C;IACR;AACF","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../src/build/type-check.ts"],"sourcesContent":["import type { NextConfigComplete } from '../server/config-shared'\nimport type { Telemetry } from '../telemetry/storage'\nimport type { Span } from '../trace'\n\nimport path from 'path'\nimport * as Log from './output/log'\nimport { Worker } from '../lib/worker'\nimport { verifyAndLint } from '../lib/verifyAndLint'\nimport createSpinner from './spinner'\nimport { eventTypeCheckCompleted } from '../telemetry/events'\nimport isError from '../lib/is-error'\nimport { hrtimeDurationToString } from './duration-to-string'\n\n/**\n * typescript will be loaded in \"next/lib/verify-typescript-setup\" and\n * then passed to \"next/lib/typescript/runTypeCheck\" as a parameter.\n *\n * Since it is impossible to pass a function from main thread to a worker,\n * instead of running \"next/lib/typescript/runTypeCheck\" in a worker,\n * we will run entire \"next/lib/verify-typescript-setup\" in a worker instead.\n */\nfunction verifyTypeScriptSetup(\n dir: string,\n distDir: string,\n intentDirs: string[],\n typeCheckPreflight: boolean,\n tsconfigPath: string | undefined,\n disableStaticImages: boolean,\n cacheDir: string | undefined,\n enableWorkerThreads: boolean | undefined,\n hasAppDir: boolean,\n hasPagesDir: boolean\n) {\n const typeCheckWorker = new Worker(\n require.resolve('../lib/verify-typescript-setup'),\n {\n exposedMethods: ['verifyTypeScriptSetup'],\n debuggerPortOffset: -1,\n isolatedMemory: false,\n numWorkers: 1,\n enableWorkerThreads,\n maxRetries: 0,\n }\n ) as Worker & {\n verifyTypeScriptSetup: typeof import('../lib/verify-typescript-setup').verifyTypeScriptSetup\n }\n\n return typeCheckWorker\n .verifyTypeScriptSetup({\n dir,\n distDir,\n intentDirs,\n typeCheckPreflight,\n tsconfigPath,\n disableStaticImages,\n cacheDir,\n hasAppDir,\n hasPagesDir,\n })\n .then((result) => {\n typeCheckWorker.end()\n return result\n })\n .catch(() => {\n // The error is already logged in the worker, we simply exit the main thread to prevent the\n // `Jest worker encountered 1 child process exceptions, exceeding retry limit` from showing up\n process.exit(1)\n })\n}\n\nexport async function startTypeChecking({\n cacheDir,\n config,\n dir,\n ignoreESLint,\n nextBuildSpan,\n pagesDir,\n runLint,\n shouldLint,\n telemetry,\n appDir,\n}: {\n cacheDir: string\n config: NextConfigComplete\n dir: string\n ignoreESLint: boolean\n nextBuildSpan: Span\n pagesDir?: string\n runLint: boolean\n shouldLint: boolean\n telemetry: Telemetry\n appDir?: string\n}) {\n const ignoreTypeScriptErrors = Boolean(config.typescript.ignoreBuildErrors)\n\n const eslintCacheDir = path.join(cacheDir, 'eslint/')\n\n if (ignoreTypeScriptErrors) {\n Log.info('Skipping validation of types')\n }\n if (runLint && ignoreESLint) {\n // only print log when build require lint while ignoreESLint is enabled\n Log.info('Skipping linting')\n }\n\n let typeCheckingAndLintingSpinnerPrefixText: string | undefined\n let typeCheckingAndLintingSpinner:\n | ReturnType<typeof createSpinner>\n | undefined\n\n if (!ignoreTypeScriptErrors && shouldLint) {\n typeCheckingAndLintingSpinnerPrefixText =\n 'Running ESLint and TypeScript concurrently'\n } else if (!ignoreTypeScriptErrors) {\n typeCheckingAndLintingSpinnerPrefixText = 'Running TypeScript'\n } else if (shouldLint) {\n typeCheckingAndLintingSpinnerPrefixText = 'Running ESLint'\n }\n\n // we will not create a spinner if both ignoreTypeScriptErrors and ignoreESLint are\n // enabled, but we will still verifying project's tsconfig and dependencies.\n if (typeCheckingAndLintingSpinnerPrefixText) {\n typeCheckingAndLintingSpinner = createSpinner(\n typeCheckingAndLintingSpinnerPrefixText\n )\n }\n\n const typeCheckAndLintStart = process.hrtime()\n\n try {\n const [[verifyResult, typeCheckEnd], lintCheckEnd] = await Promise.all([\n nextBuildSpan.traceChild('run-typescript').traceAsyncFn(() =>\n verifyTypeScriptSetup(\n dir,\n config.distDir,\n [pagesDir, appDir].filter(Boolean) as string[],\n !ignoreTypeScriptErrors,\n config.typescript.tsconfigPath,\n config.images.disableStaticImages,\n cacheDir,\n config.experimental.workerThreads,\n !!appDir,\n !!pagesDir\n ).then((resolved) => {\n const checkEnd = process.hrtime(typeCheckAndLintStart)\n return [resolved, checkEnd] as const\n })\n ),\n shouldLint &&\n nextBuildSpan.traceChild('run-eslint').traceAsyncFn(async () => {\n await verifyAndLint(\n dir,\n eslintCacheDir,\n config.eslint?.dirs,\n config.experimental.workerThreads,\n telemetry\n )\n const checkEnd = process.hrtime(typeCheckAndLintStart)\n return checkEnd\n }),\n ])\n\n if (typeCheckingAndLintingSpinner) {\n typeCheckingAndLintingSpinner.stop()\n\n createSpinner(\n `Finished TypeScript${ignoreTypeScriptErrors ? ' config validation' : ''} in ${hrtimeDurationToString(typeCheckEnd)}`\n )?.stopAndPersist()\n if (lintCheckEnd) {\n createSpinner(\n `Finished ESLint in ${hrtimeDurationToString(lintCheckEnd)}`\n )?.stopAndPersist()\n }\n }\n\n if (!ignoreTypeScriptErrors && verifyResult) {\n telemetry.record(\n eventTypeCheckCompleted({\n durationInSeconds: typeCheckEnd[0],\n typescriptVersion: verifyResult.version,\n inputFilesCount: verifyResult.result?.inputFilesCount,\n totalFilesCount: verifyResult.result?.totalFilesCount,\n incremental: verifyResult.result?.incremental,\n })\n )\n }\n } catch (err) {\n // prevent showing jest-worker internal error as it\n // isn't helpful for users and clutters output\n if (isError(err) && err.message === 'Call retries were exceeded') {\n await telemetry.flush()\n process.exit(1)\n }\n throw err\n }\n}\n"],"names":["path","Log","Worker","verifyAndLint","createSpinner","eventTypeCheckCompleted","isError","hrtimeDurationToString","verifyTypeScriptSetup","dir","distDir","intentDirs","typeCheckPreflight","tsconfigPath","disableStaticImages","cacheDir","enableWorkerThreads","hasAppDir","hasPagesDir","typeCheckWorker","require","resolve","exposedMethods","debuggerPortOffset","isolatedMemory","numWorkers","maxRetries","then","result","end","catch","process","exit","startTypeChecking","config","ignoreESLint","nextBuildSpan","pagesDir","runLint","shouldLint","telemetry","appDir","ignoreTypeScriptErrors","Boolean","typescript","ignoreBuildErrors","eslintCacheDir","join","info","typeCheckingAndLintingSpinnerPrefixText","typeCheckingAndLintingSpinner","typeCheckAndLintStart","hrtime","verifyResult","typeCheckEnd","lintCheckEnd","Promise","all","traceChild","traceAsyncFn","filter","images","experimental","workerThreads","resolved","checkEnd","eslint","dirs","stop","stopAndPersist","record","durationInSeconds","typescriptVersion","version","inputFilesCount","totalFilesCount","incremental","err","message","flush"],"mappings":"AAIA,OAAOA,UAAU,OAAM;AACvB,YAAYC,SAAS,eAAc;AACnC,SAASC,MAAM,QAAQ,gBAAe;AACtC,S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EG,uBAAuBgD,eAAe,sBAD9DnD,gBAEGiE,cAAc;YACnB;QACF;QAEA,IAAI,CAAC3B,0BAA0BW,cAAc;gBAKtBA,sBACAA,uBACJA;YANjBb,UAAU8B,MAAM,CACdjE,wBAAwB;gBACtBkE,mBAAmBjB,YAAY,CAAC,EAAE;gBAClCkB,mBAAmBnB,aAAaoB,OAAO;gBACvCC,eAAe,GAAErB,uBAAAA,aAAazB,MAAM,qBAAnByB,qBAAqBqB,eAAe;gBACrDC,eAAe,GAAEtB,wBAAAA,aAAazB,MAAM,qBAAnByB,sBAAqBsB,eAAe;gBACrDC,WAAW,GAAEvB,wBAAAA,aAAazB,MAAM,qBAAnByB,sBAAqBuB,WAAW;YAC/C;QAEJ;IACF,EAAE,OAAOC,KAAK;QACZ,mDAAmD;QACnD,8CAA8C;QAC9C,IAAIvE,QAAQuE,QAAQA,IAAIC,OAAO,KAAK,8BAA8B;YAChE,MAAMtC,UAAUuC,KAAK;YACrBhD,QAAQC,IAAI,CAAC;QACf;QACA,MAAM6C;IACR;AACF","ignoreList":[0]}
|
|
@@ -115,21 +115,7 @@ export const css = curry(async function css(ctx, config) {
|
|
|
115
115
|
// Source maps are required so that `resolve-url-loader` can locate
|
|
116
116
|
// files original to their source directory.
|
|
117
117
|
sourceMap: true,
|
|
118
|
-
sassOptions
|
|
119
|
-
// The "fibers" option is not needed for Node.js 16+, but it's causing
|
|
120
|
-
// problems for Node.js <= 14 users as you'll have to manually install
|
|
121
|
-
// the `fibers` package:
|
|
122
|
-
// https://github.com/webpack-contrib/sass-loader#:~:text=We%20automatically%20inject%20the%20fibers%20package
|
|
123
|
-
// https://github.com/vercel/next.js/issues/45052
|
|
124
|
-
// Since it's optional and not required, we'll disable it by default
|
|
125
|
-
// to avoid the confusion.
|
|
126
|
-
fibers: false,
|
|
127
|
-
// TODO: Remove this once we upgrade to sass-loader 16
|
|
128
|
-
silenceDeprecations: [
|
|
129
|
-
'legacy-js-api'
|
|
130
|
-
],
|
|
131
|
-
...sassOptions
|
|
132
|
-
},
|
|
118
|
+
sassOptions,
|
|
133
119
|
additionalData: sassPrependData || sassAdditionalData
|
|
134
120
|
}
|
|
135
121
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/build/webpack/config/blocks/css/index.ts"],"sourcesContent":["import curry from 'next/dist/compiled/lodash.curry'\nimport type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { loader, plugin } from '../../helpers'\nimport { pipe } from '../../utils'\nimport type { ConfigurationContext, ConfigurationFn } from '../../utils'\nimport { getCssModuleLoader, getGlobalCssLoader } from './loaders'\nimport { getNextFontLoader } from './loaders/next-font'\nimport {\n getCustomDocumentError,\n getGlobalImportError,\n getGlobalModuleImportError,\n getLocalModuleImportError,\n} from './messages'\nimport { getPostCssPlugins } from './plugins'\nimport { nonNullable } from '../../../../../lib/non-nullable'\nimport { WEBPACK_LAYERS } from '../../../../../lib/constants'\nimport { getRspackCore } from '../../../../../shared/lib/get-rspack'\n\n// RegExps for all Style Sheet variants\nexport const regexLikeCss = /\\.(css|scss|sass)$/\n\n// RegExps for Style Sheets\nconst regexCssGlobal = /(?<!\\.module)\\.css$/\nconst regexCssModules = /\\.module\\.css$/\n\n// RegExps for Syntactically Awesome Style Sheets\nconst regexSassGlobal = /(?<!\\.module)\\.(scss|sass)$/\nconst regexSassModules = /\\.module\\.(scss|sass)$/\n\nconst APP_LAYER_RULE = {\n or: [\n WEBPACK_LAYERS.reactServerComponents,\n WEBPACK_LAYERS.serverSideRendering,\n WEBPACK_LAYERS.appPagesBrowser,\n ],\n}\n\nconst PAGES_LAYER_RULE = {\n not: [\n WEBPACK_LAYERS.reactServerComponents,\n WEBPACK_LAYERS.serverSideRendering,\n WEBPACK_LAYERS.appPagesBrowser,\n ],\n}\n\n/**\n * Mark a rule as removable if built-in CSS support is disabled\n */\nfunction markRemovable(r: webpack.RuleSetRule): webpack.RuleSetRule {\n Object.defineProperty(r, Symbol.for('__next_css_remove'), {\n enumerable: false,\n value: true,\n })\n return r\n}\n\nlet postcssInstancePromise: Promise<any>\nexport async function lazyPostCSS(\n rootDirectory: string,\n supportedBrowsers: string[] | undefined,\n disablePostcssPresetEnv: boolean | undefined,\n useLightningcss: boolean | undefined\n) {\n if (!postcssInstancePromise) {\n postcssInstancePromise = (async () => {\n const postcss = require('postcss') as typeof import('postcss')\n // @ts-ignore backwards compat\n postcss.plugin = function postcssPlugin(name, initializer) {\n function creator(...args: any) {\n let transformer = initializer(...args)\n transformer.postcssPlugin = name\n // transformer.postcssVersion = new Processor().version\n return transformer\n }\n\n let cache: any\n Object.defineProperty(creator, 'postcss', {\n get() {\n if (!cache) cache = creator()\n return cache\n },\n })\n\n creator.process = function (\n css: any,\n processOpts: any,\n pluginOpts: any\n ) {\n return postcss([creator(pluginOpts)]).process(css, processOpts)\n }\n\n return creator\n }\n\n // @ts-ignore backwards compat\n postcss.vendor = {\n /**\n * Returns the vendor prefix extracted from an input string.\n *\n * @example\n * postcss.vendor.prefix('-moz-tab-size') //=> '-moz-'\n * postcss.vendor.prefix('tab-size') //=> ''\n */\n prefix: function prefix(prop: string): string {\n const match = prop.match(/^(-\\w+-)/)\n\n if (match) {\n return match[0]\n }\n\n return ''\n },\n\n /**\n * Returns the input string stripped of its vendor prefix.\n *\n * @example\n * postcss.vendor.unprefixed('-moz-tab-size') //=> 'tab-size'\n */\n unprefixed: function unprefixed(\n /**\n * String with or without vendor prefix.\n */\n prop: string\n ): string {\n return prop.replace(/^-\\w+-/, '')\n },\n }\n\n const postCssPlugins = await getPostCssPlugins(\n rootDirectory,\n supportedBrowsers,\n disablePostcssPresetEnv,\n useLightningcss\n )\n\n return {\n postcss,\n postcssWithPlugins: postcss(postCssPlugins),\n }\n })()\n }\n\n return postcssInstancePromise\n}\n\nexport const css = curry(async function css(\n ctx: ConfigurationContext,\n config: webpack.Configuration\n) {\n const isRspack = Boolean(process.env.NEXT_RSPACK)\n const {\n prependData: sassPrependData,\n additionalData: sassAdditionalData,\n implementation: sassImplementation,\n ...sassOptions\n } = ctx.sassOptions\n\n const lazyPostCSSInitializer = () =>\n lazyPostCSS(\n ctx.rootDirectory,\n ctx.supportedBrowsers,\n ctx.experimental.disablePostcssPresetEnv,\n ctx.experimental.useLightningcss\n )\n\n const sassPreprocessors: webpack.RuleSetUseItem[] = [\n // First, process files with `sass-loader`: this inlines content, and\n // compiles away the proprietary syntax.\n {\n loader: require.resolve('next/dist/compiled/sass-loader'),\n options: {\n implementation: sassImplementation,\n // Source maps are required so that `resolve-url-loader` can locate\n // files original to their source directory.\n sourceMap: true,\n sassOptions: {\n // The \"fibers\" option is not needed for Node.js 16+, but it's causing\n // problems for Node.js <= 14 users as you'll have to manually install\n // the `fibers` package:\n // https://github.com/webpack-contrib/sass-loader#:~:text=We%20automatically%20inject%20the%20fibers%20package\n // https://github.com/vercel/next.js/issues/45052\n // Since it's optional and not required, we'll disable it by default\n // to avoid the confusion.\n fibers: false,\n // TODO: Remove this once we upgrade to sass-loader 16\n silenceDeprecations: ['legacy-js-api'],\n ...sassOptions,\n },\n additionalData: sassPrependData || sassAdditionalData,\n },\n },\n // Then, `sass-loader` will have passed-through CSS imports as-is instead\n // of inlining them. Because they were inlined, the paths are no longer\n // correct.\n // To fix this, we use `resolve-url-loader` to rewrite the CSS\n // imports to real file paths.\n {\n loader: require.resolve('../../../loaders/resolve-url-loader/index'),\n options: {\n postcss: lazyPostCSSInitializer,\n // Source maps are not required here, but we may as well emit\n // them.\n sourceMap: true,\n },\n },\n ]\n\n const fns: ConfigurationFn[] = []\n\n const googleLoader = require.resolve(\n 'next/dist/compiled/@next/font/google/loader'\n )\n const localLoader = require.resolve(\n 'next/dist/compiled/@next/font/local/loader'\n )\n const nextFontLoaders: Array<[string | RegExp, string, any?]> = [\n [require.resolve('next/font/google/target.css'), googleLoader],\n [require.resolve('next/font/local/target.css'), localLoader],\n ]\n\n nextFontLoaders.forEach(([fontLoaderTarget, fontLoaderPath]) => {\n // Matches the resolved font loaders noop files to run next-font-loader\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n sideEffects: false,\n test: fontLoaderTarget,\n use: getNextFontLoader(ctx, lazyPostCSSInitializer, fontLoaderPath),\n }),\n ],\n })\n )\n })\n\n // CSS cannot be imported in _document. This comes before everything because\n // global CSS nor CSS modules work in said file.\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: regexLikeCss,\n // Use a loose regex so we don't have to crawl the file system to\n // find the real file name (if present).\n issuer: /pages[\\\\/]_document\\./,\n use: {\n loader: 'error-loader',\n options: {\n reason: getCustomDocumentError(),\n },\n },\n }),\n ],\n })\n )\n\n const shouldIncludeExternalCSSImports =\n !!ctx.experimental.craCompat || !!ctx.transpilePackages\n\n // CSS modules & SASS modules support. They are allowed to be imported in anywhere.\n fns.push(\n // CSS Modules should never have side effects. This setting will\n // allow unused CSS to be removed from the production build.\n // We ensure this by disallowing `:global()` CSS at the top-level\n // via the `pure` mode in `css-loader`.\n loader({\n oneOf: [\n // For app dir, we need to match the specific app layer.\n ctx.hasAppDir\n ? markRemovable({\n sideEffects: true,\n test: regexCssModules,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: true,\n },\n },\n ...getCssModuleLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer\n ),\n ],\n })\n : null,\n markRemovable({\n sideEffects: true,\n test: regexCssModules,\n issuerLayer: PAGES_LAYER_RULE,\n use: getCssModuleLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n ].filter(nonNullable),\n }),\n // Opt-in support for Sass (using .scss or .sass extensions).\n // Sass Modules should never have side effects. This setting will\n // allow unused Sass to be removed from the production build.\n // We ensure this by disallowing `:global()` Sass at the top-level\n // via the `pure` mode in `css-loader`.\n loader({\n oneOf: [\n // For app dir, we need to match the specific app layer.\n ctx.hasAppDir\n ? markRemovable({\n sideEffects: true,\n test: regexSassModules,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: true,\n },\n },\n ...getCssModuleLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n ],\n })\n : null,\n markRemovable({\n sideEffects: true,\n test: regexSassModules,\n issuerLayer: PAGES_LAYER_RULE,\n use: getCssModuleLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ].filter(nonNullable),\n }),\n // Throw an error for CSS Modules used outside their supported scope\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssModules, regexSassModules],\n use: {\n loader: 'error-loader',\n options: {\n reason: getLocalModuleImportError(),\n },\n },\n }),\n ],\n })\n )\n\n // Global CSS and SASS support.\n if (ctx.isServer) {\n fns.push(\n loader({\n oneOf: [\n ctx.hasAppDir && !ctx.isProduction\n ? markRemovable({\n sideEffects: true,\n test: [regexCssGlobal, regexSassGlobal],\n issuerLayer: APP_LAYER_RULE,\n use: {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n })\n : null,\n markRemovable({\n // CSS imports have side effects, even on the server side.\n sideEffects: true,\n test: [regexCssGlobal, regexSassGlobal],\n use: require.resolve('next/dist/compiled/ignore-loader'),\n }),\n ].filter(nonNullable),\n })\n )\n } else {\n // External CSS files are allowed to be loaded when any of the following is true:\n // - hasAppDir: all CSS files are allowed\n // - If the CSS file is located in `node_modules`\n // - If the CSS file is located in another package in a monorepo (outside of the current rootDir)\n // - If the issuer is pages/_app (matched later)\n const allowedPagesGlobalCSSPath = ctx.hasAppDir\n ? undefined\n : {\n and: [\n {\n or: [\n /node_modules/,\n {\n not: [ctx.rootDirectory],\n },\n ],\n },\n ],\n }\n const allowedPagesGlobalCSSIssuer = ctx.hasAppDir\n ? undefined\n : shouldIncludeExternalCSSImports\n ? undefined\n : {\n and: [ctx.rootDirectory],\n not: [/node_modules/],\n }\n\n fns.push(\n loader({\n oneOf: [\n ...(ctx.hasAppDir\n ? [\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n ...getGlobalCssLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer\n ),\n ],\n }),\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n ...getGlobalCssLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n ],\n }),\n ]\n : []),\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n include: allowedPagesGlobalCSSPath,\n issuer: allowedPagesGlobalCSSIssuer,\n issuerLayer: PAGES_LAYER_RULE,\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n include: allowedPagesGlobalCSSPath,\n issuer: allowedPagesGlobalCSSIssuer,\n issuerLayer: PAGES_LAYER_RULE,\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ].filter(nonNullable),\n })\n )\n\n if (ctx.customAppFile) {\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n issuer: { and: [ctx.customAppFile] },\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n ],\n }),\n loader({\n oneOf: [\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n issuer: { and: [ctx.customAppFile] },\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ],\n })\n )\n }\n }\n\n // Throw an error for Global CSS used inside of `node_modules`\n if (!shouldIncludeExternalCSSImports) {\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssGlobal, regexSassGlobal],\n issuer: { and: [/node_modules/] },\n use: {\n loader: 'error-loader',\n options: {\n reason: getGlobalModuleImportError(),\n },\n },\n }),\n ],\n })\n )\n }\n\n // Throw an error for Global CSS used outside of our custom <App> file\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssGlobal, regexSassGlobal],\n issuer: ctx.hasAppDir\n ? {\n // If it's inside the app dir, but not importing from a layout file,\n // throw an error.\n and: [ctx.rootDirectory],\n not: [/layout\\.(js|mjs|jsx|ts|tsx)$/],\n }\n : undefined,\n use: {\n loader: 'error-loader',\n options: {\n reason: getGlobalImportError(),\n },\n },\n }),\n ],\n })\n )\n\n if (ctx.isClient) {\n // Automatically transform references to files (i.e. url()) into URLs\n // e.g. url(./logo.svg)\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n // This should only be applied to CSS files\n issuer: regexLikeCss,\n // Exclude extensions that webpack handles by default\n exclude: [\n /\\.(js|mjs|jsx|ts|tsx)$/,\n /\\.html$/,\n /\\.json$/,\n /\\.webpack\\[[^\\]]+\\]$/,\n ],\n // `asset/resource` always emits a URL reference, where `asset`\n // might inline the asset as a data URI\n type: 'asset/resource',\n }),\n ],\n })\n )\n }\n\n // Enable full mini-css-extract-plugin hmr for prod mode pages or app dir\n if (ctx.isClient && (ctx.isProduction || ctx.hasAppDir)) {\n // Extract CSS as CSS file(s) in the client-side production bundle.\n const MiniCssExtractPlugin = isRspack\n ? getRspackCore().CssExtractRspackPlugin\n : (\n require('../../../plugins/mini-css-extract-plugin') as typeof import('../../../plugins/mini-css-extract-plugin')\n ).default\n\n fns.push(\n plugin(\n // @ts-ignore webpack 5 compat\n new MiniCssExtractPlugin({\n filename: ctx.isProduction\n ? 'static/css/[contenthash].css'\n : 'static/css/[name].css',\n chunkFilename: ctx.isProduction\n ? 'static/css/[contenthash].css'\n : 'static/css/[name].css',\n // Next.js guarantees that CSS order \"doesn't matter\", due to imposed\n // restrictions:\n // 1. Global CSS can only be defined in a single entrypoint (_app)\n // 2. CSS Modules generate scoped class names by default and cannot\n // include Global CSS (:global() selector).\n //\n // While not a perfect guarantee (e.g. liberal use of `:global()`\n // selector), this assumption is required to code-split CSS.\n //\n // If this warning were to trigger, it'd be unactionable by the user,\n // but likely not valid -- so we disable it.\n ignoreOrder: true,\n insert: function (linkTag: HTMLLinkElement) {\n if (typeof _N_E_STYLE_LOAD === 'function') {\n const { href, onload, onerror } = linkTag\n _N_E_STYLE_LOAD(\n href.indexOf(window.location.origin) === 0\n ? new URL(href).pathname\n : href\n ).then(\n () => onload?.call(linkTag, { type: 'load' } as Event),\n () => onerror?.call(linkTag, {} as Event)\n )\n } else {\n document.head.appendChild(linkTag)\n }\n },\n })\n )\n )\n }\n\n const fn = pipe(...fns)\n return fn(config)\n})\n"],"names":["curry","loader","plugin","pipe","getCssModuleLoader","getGlobalCssLoader","getNextFontLoader","getCustomDocumentError","getGlobalImportError","getGlobalModuleImportError","getLocalModuleImportError","getPostCssPlugins","nonNullable","WEBPACK_LAYERS","getRspackCore","regexLikeCss","regexCssGlobal","regexCssModules","regexSassGlobal","regexSassModules","APP_LAYER_RULE","or","reactServerComponents","serverSideRendering","appPagesBrowser","PAGES_LAYER_RULE","not","markRemovable","r","Object","defineProperty","Symbol","for","enumerable","value","postcssInstancePromise","lazyPostCSS","rootDirectory","supportedBrowsers","disablePostcssPresetEnv","useLightningcss","postcss","require","postcssPlugin","name","initializer","creator","args","transformer","cache","get","process","css","processOpts","pluginOpts","vendor","prefix","prop","match","unprefixed","replace","postCssPlugins","postcssWithPlugins","ctx","config","isRspack","Boolean","env","NEXT_RSPACK","prependData","sassPrependData","additionalData","sassAdditionalData","implementation","sassImplementation","sassOptions","lazyPostCSSInitializer","experimental","sassPreprocessors","resolve","options","sourceMap","fibers","silenceDeprecations","fns","googleLoader","localLoader","nextFontLoaders","forEach","fontLoaderTarget","fontLoaderPath","push","oneOf","sideEffects","test","use","issuer","reason","shouldIncludeExternalCSSImports","craCompat","transpilePackages","hasAppDir","issuerLayer","cssModules","isAppDir","filter","isServer","isProduction","allowedPagesGlobalCSSPath","undefined","and","allowedPagesGlobalCSSIssuer","include","customAppFile","isClient","exclude","type","MiniCssExtractPlugin","CssExtractRspackPlugin","default","filename","chunkFilename","ignoreOrder","insert","linkTag","_N_E_STYLE_LOAD","href","onload","onerror","indexOf","window","location","origin","URL","pathname","then","call","document","head","appendChild","fn"],"mappings":"AAAA,OAAOA,WAAW,kCAAiC;AAEnD,SAASC,MAAM,EAAEC,MAAM,QAAQ,gBAAe;AAC9C,SAASC,IAAI,QAAQ,cAAa;AAElC,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,YAAW;AAClE,SAASC,iBAAiB,QAAQ,sBAAqB;AACvD,SACEC,sBAAsB,EACtBC,oBAAoB,EACpBC,0BAA0B,EAC1BC,yBAAyB,QACpB,aAAY;AACnB,SAASC,iBAAiB,QAAQ,YAAW;AAC7C,SAASC,WAAW,QAAQ,kCAAiC;AAC7D,SAASC,cAAc,QAAQ,+BAA8B;AAC7D,SAASC,aAAa,QAAQ,uCAAsC;AAEpE,uCAAuC;AACvC,OAAO,MAAMC,eAAe,qBAAoB;AAEhD,2BAA2B;AAC3B,MAAMC,iBAAiB;AACvB,MAAMC,kBAAkB;AAExB,iDAAiD;AACjD,MAAMC,kBAAkB;AACxB,MAAMC,mBAAmB;AAEzB,MAAMC,iBAAiB;IACrBC,IAAI;QACFR,eAAeS,qBAAqB;QACpCT,eAAeU,mBAAmB;QAClCV,eAAeW,eAAe;KAC/B;AACH;AAEA,MAAMC,mBAAmB;IACvBC,KAAK;QACHb,eAAeS,qBAAqB;QACpCT,eAAeU,mBAAmB;QAClCV,eAAeW,eAAe;KAC/B;AACH;AAEA;;CAEC,GACD,SAASG,cAAcC,CAAsB;IAC3CC,OAA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,MAAM;wBAAO,IAC3C,IAAMY,2BAAAA,QAASQ,IAAI,CAACZ,SAAS,CAAC;gBAElC,OAAO;oBACLa,SAASC,IAAI,CAACC,WAAW,CAACf;gBAC5B;YACF;QACF;IAGN;IAEA,MAAMgB,KAAKzI,QAAQiF;IACnB,OAAOwD,GAAG5E;AACZ,GAAE","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/build/webpack/config/blocks/css/index.ts"],"sourcesContent":["import curry from 'next/dist/compiled/lodash.curry'\nimport type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { loader, plugin } from '../../helpers'\nimport { pipe } from '../../utils'\nimport type { ConfigurationContext, ConfigurationFn } from '../../utils'\nimport { getCssModuleLoader, getGlobalCssLoader } from './loaders'\nimport { getNextFontLoader } from './loaders/next-font'\nimport {\n getCustomDocumentError,\n getGlobalImportError,\n getGlobalModuleImportError,\n getLocalModuleImportError,\n} from './messages'\nimport { getPostCssPlugins } from './plugins'\nimport { nonNullable } from '../../../../../lib/non-nullable'\nimport { WEBPACK_LAYERS } from '../../../../../lib/constants'\nimport { getRspackCore } from '../../../../../shared/lib/get-rspack'\n\n// RegExps for all Style Sheet variants\nexport const regexLikeCss = /\\.(css|scss|sass)$/\n\n// RegExps for Style Sheets\nconst regexCssGlobal = /(?<!\\.module)\\.css$/\nconst regexCssModules = /\\.module\\.css$/\n\n// RegExps for Syntactically Awesome Style Sheets\nconst regexSassGlobal = /(?<!\\.module)\\.(scss|sass)$/\nconst regexSassModules = /\\.module\\.(scss|sass)$/\n\nconst APP_LAYER_RULE = {\n or: [\n WEBPACK_LAYERS.reactServerComponents,\n WEBPACK_LAYERS.serverSideRendering,\n WEBPACK_LAYERS.appPagesBrowser,\n ],\n}\n\nconst PAGES_LAYER_RULE = {\n not: [\n WEBPACK_LAYERS.reactServerComponents,\n WEBPACK_LAYERS.serverSideRendering,\n WEBPACK_LAYERS.appPagesBrowser,\n ],\n}\n\n/**\n * Mark a rule as removable if built-in CSS support is disabled\n */\nfunction markRemovable(r: webpack.RuleSetRule): webpack.RuleSetRule {\n Object.defineProperty(r, Symbol.for('__next_css_remove'), {\n enumerable: false,\n value: true,\n })\n return r\n}\n\nlet postcssInstancePromise: Promise<any>\nexport async function lazyPostCSS(\n rootDirectory: string,\n supportedBrowsers: string[] | undefined,\n disablePostcssPresetEnv: boolean | undefined,\n useLightningcss: boolean | undefined\n) {\n if (!postcssInstancePromise) {\n postcssInstancePromise = (async () => {\n const postcss = require('postcss') as typeof import('postcss')\n // @ts-ignore backwards compat\n postcss.plugin = function postcssPlugin(name, initializer) {\n function creator(...args: any) {\n let transformer = initializer(...args)\n transformer.postcssPlugin = name\n // transformer.postcssVersion = new Processor().version\n return transformer\n }\n\n let cache: any\n Object.defineProperty(creator, 'postcss', {\n get() {\n if (!cache) cache = creator()\n return cache\n },\n })\n\n creator.process = function (\n css: any,\n processOpts: any,\n pluginOpts: any\n ) {\n return postcss([creator(pluginOpts)]).process(css, processOpts)\n }\n\n return creator\n }\n\n // @ts-ignore backwards compat\n postcss.vendor = {\n /**\n * Returns the vendor prefix extracted from an input string.\n *\n * @example\n * postcss.vendor.prefix('-moz-tab-size') //=> '-moz-'\n * postcss.vendor.prefix('tab-size') //=> ''\n */\n prefix: function prefix(prop: string): string {\n const match = prop.match(/^(-\\w+-)/)\n\n if (match) {\n return match[0]\n }\n\n return ''\n },\n\n /**\n * Returns the input string stripped of its vendor prefix.\n *\n * @example\n * postcss.vendor.unprefixed('-moz-tab-size') //=> 'tab-size'\n */\n unprefixed: function unprefixed(\n /**\n * String with or without vendor prefix.\n */\n prop: string\n ): string {\n return prop.replace(/^-\\w+-/, '')\n },\n }\n\n const postCssPlugins = await getPostCssPlugins(\n rootDirectory,\n supportedBrowsers,\n disablePostcssPresetEnv,\n useLightningcss\n )\n\n return {\n postcss,\n postcssWithPlugins: postcss(postCssPlugins),\n }\n })()\n }\n\n return postcssInstancePromise\n}\n\nexport const css = curry(async function css(\n ctx: ConfigurationContext,\n config: webpack.Configuration\n) {\n const isRspack = Boolean(process.env.NEXT_RSPACK)\n const {\n prependData: sassPrependData,\n additionalData: sassAdditionalData,\n implementation: sassImplementation,\n ...sassOptions\n } = ctx.sassOptions\n\n const lazyPostCSSInitializer = () =>\n lazyPostCSS(\n ctx.rootDirectory,\n ctx.supportedBrowsers,\n ctx.experimental.disablePostcssPresetEnv,\n ctx.experimental.useLightningcss\n )\n\n const sassPreprocessors: webpack.RuleSetUseItem[] = [\n // First, process files with `sass-loader`: this inlines content, and\n // compiles away the proprietary syntax.\n {\n loader: require.resolve('next/dist/compiled/sass-loader'),\n options: {\n implementation: sassImplementation,\n // Source maps are required so that `resolve-url-loader` can locate\n // files original to their source directory.\n sourceMap: true,\n sassOptions,\n additionalData: sassPrependData || sassAdditionalData,\n },\n },\n // Then, `sass-loader` will have passed-through CSS imports as-is instead\n // of inlining them. Because they were inlined, the paths are no longer\n // correct.\n // To fix this, we use `resolve-url-loader` to rewrite the CSS\n // imports to real file paths.\n {\n loader: require.resolve('../../../loaders/resolve-url-loader/index'),\n options: {\n postcss: lazyPostCSSInitializer,\n // Source maps are not required here, but we may as well emit\n // them.\n sourceMap: true,\n },\n },\n ]\n\n const fns: ConfigurationFn[] = []\n\n const googleLoader = require.resolve(\n 'next/dist/compiled/@next/font/google/loader'\n )\n const localLoader = require.resolve(\n 'next/dist/compiled/@next/font/local/loader'\n )\n const nextFontLoaders: Array<[string | RegExp, string, any?]> = [\n [require.resolve('next/font/google/target.css'), googleLoader],\n [require.resolve('next/font/local/target.css'), localLoader],\n ]\n\n nextFontLoaders.forEach(([fontLoaderTarget, fontLoaderPath]) => {\n // Matches the resolved font loaders noop files to run next-font-loader\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n sideEffects: false,\n test: fontLoaderTarget,\n use: getNextFontLoader(ctx, lazyPostCSSInitializer, fontLoaderPath),\n }),\n ],\n })\n )\n })\n\n // CSS cannot be imported in _document. This comes before everything because\n // global CSS nor CSS modules work in said file.\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: regexLikeCss,\n // Use a loose regex so we don't have to crawl the file system to\n // find the real file name (if present).\n issuer: /pages[\\\\/]_document\\./,\n use: {\n loader: 'error-loader',\n options: {\n reason: getCustomDocumentError(),\n },\n },\n }),\n ],\n })\n )\n\n const shouldIncludeExternalCSSImports =\n !!ctx.experimental.craCompat || !!ctx.transpilePackages\n\n // CSS modules & SASS modules support. They are allowed to be imported in anywhere.\n fns.push(\n // CSS Modules should never have side effects. This setting will\n // allow unused CSS to be removed from the production build.\n // We ensure this by disallowing `:global()` CSS at the top-level\n // via the `pure` mode in `css-loader`.\n loader({\n oneOf: [\n // For app dir, we need to match the specific app layer.\n ctx.hasAppDir\n ? markRemovable({\n sideEffects: true,\n test: regexCssModules,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: true,\n },\n },\n ...getCssModuleLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer\n ),\n ],\n })\n : null,\n markRemovable({\n sideEffects: true,\n test: regexCssModules,\n issuerLayer: PAGES_LAYER_RULE,\n use: getCssModuleLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n ].filter(nonNullable),\n }),\n // Opt-in support for Sass (using .scss or .sass extensions).\n // Sass Modules should never have side effects. This setting will\n // allow unused Sass to be removed from the production build.\n // We ensure this by disallowing `:global()` Sass at the top-level\n // via the `pure` mode in `css-loader`.\n loader({\n oneOf: [\n // For app dir, we need to match the specific app layer.\n ctx.hasAppDir\n ? markRemovable({\n sideEffects: true,\n test: regexSassModules,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: true,\n },\n },\n ...getCssModuleLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n ],\n })\n : null,\n markRemovable({\n sideEffects: true,\n test: regexSassModules,\n issuerLayer: PAGES_LAYER_RULE,\n use: getCssModuleLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ].filter(nonNullable),\n }),\n // Throw an error for CSS Modules used outside their supported scope\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssModules, regexSassModules],\n use: {\n loader: 'error-loader',\n options: {\n reason: getLocalModuleImportError(),\n },\n },\n }),\n ],\n })\n )\n\n // Global CSS and SASS support.\n if (ctx.isServer) {\n fns.push(\n loader({\n oneOf: [\n ctx.hasAppDir && !ctx.isProduction\n ? markRemovable({\n sideEffects: true,\n test: [regexCssGlobal, regexSassGlobal],\n issuerLayer: APP_LAYER_RULE,\n use: {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n })\n : null,\n markRemovable({\n // CSS imports have side effects, even on the server side.\n sideEffects: true,\n test: [regexCssGlobal, regexSassGlobal],\n use: require.resolve('next/dist/compiled/ignore-loader'),\n }),\n ].filter(nonNullable),\n })\n )\n } else {\n // External CSS files are allowed to be loaded when any of the following is true:\n // - hasAppDir: all CSS files are allowed\n // - If the CSS file is located in `node_modules`\n // - If the CSS file is located in another package in a monorepo (outside of the current rootDir)\n // - If the issuer is pages/_app (matched later)\n const allowedPagesGlobalCSSPath = ctx.hasAppDir\n ? undefined\n : {\n and: [\n {\n or: [\n /node_modules/,\n {\n not: [ctx.rootDirectory],\n },\n ],\n },\n ],\n }\n const allowedPagesGlobalCSSIssuer = ctx.hasAppDir\n ? undefined\n : shouldIncludeExternalCSSImports\n ? undefined\n : {\n and: [ctx.rootDirectory],\n not: [/node_modules/],\n }\n\n fns.push(\n loader({\n oneOf: [\n ...(ctx.hasAppDir\n ? [\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n ...getGlobalCssLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer\n ),\n ],\n }),\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n issuerLayer: APP_LAYER_RULE,\n use: [\n {\n loader: require.resolve(\n '../../../loaders/next-flight-css-loader'\n ),\n options: {\n cssModules: false,\n },\n },\n ...getGlobalCssLoader(\n { ...ctx, isAppDir: true },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n ],\n }),\n ]\n : []),\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n include: allowedPagesGlobalCSSPath,\n issuer: allowedPagesGlobalCSSIssuer,\n issuerLayer: PAGES_LAYER_RULE,\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n include: allowedPagesGlobalCSSPath,\n issuer: allowedPagesGlobalCSSIssuer,\n issuerLayer: PAGES_LAYER_RULE,\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ].filter(nonNullable),\n })\n )\n\n if (ctx.customAppFile) {\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n sideEffects: true,\n test: regexCssGlobal,\n issuer: { and: [ctx.customAppFile] },\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer\n ),\n }),\n ],\n }),\n loader({\n oneOf: [\n markRemovable({\n sideEffects: true,\n test: regexSassGlobal,\n issuer: { and: [ctx.customAppFile] },\n use: getGlobalCssLoader(\n { ...ctx, isAppDir: false },\n lazyPostCSSInitializer,\n sassPreprocessors\n ),\n }),\n ],\n })\n )\n }\n }\n\n // Throw an error for Global CSS used inside of `node_modules`\n if (!shouldIncludeExternalCSSImports) {\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssGlobal, regexSassGlobal],\n issuer: { and: [/node_modules/] },\n use: {\n loader: 'error-loader',\n options: {\n reason: getGlobalModuleImportError(),\n },\n },\n }),\n ],\n })\n )\n }\n\n // Throw an error for Global CSS used outside of our custom <App> file\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n test: [regexCssGlobal, regexSassGlobal],\n issuer: ctx.hasAppDir\n ? {\n // If it's inside the app dir, but not importing from a layout file,\n // throw an error.\n and: [ctx.rootDirectory],\n not: [/layout\\.(js|mjs|jsx|ts|tsx)$/],\n }\n : undefined,\n use: {\n loader: 'error-loader',\n options: {\n reason: getGlobalImportError(),\n },\n },\n }),\n ],\n })\n )\n\n if (ctx.isClient) {\n // Automatically transform references to files (i.e. url()) into URLs\n // e.g. url(./logo.svg)\n fns.push(\n loader({\n oneOf: [\n markRemovable({\n // This should only be applied to CSS files\n issuer: regexLikeCss,\n // Exclude extensions that webpack handles by default\n exclude: [\n /\\.(js|mjs|jsx|ts|tsx)$/,\n /\\.html$/,\n /\\.json$/,\n /\\.webpack\\[[^\\]]+\\]$/,\n ],\n // `asset/resource` always emits a URL reference, where `asset`\n // might inline the asset as a data URI\n type: 'asset/resource',\n }),\n ],\n })\n )\n }\n\n // Enable full mini-css-extract-plugin hmr for prod mode pages or app dir\n if (ctx.isClient && (ctx.isProduction || ctx.hasAppDir)) {\n // Extract CSS as CSS file(s) in the client-side production bundle.\n const MiniCssExtractPlugin = isRspack\n ? getRspackCore().CssExtractRspackPlugin\n : (\n require('../../../plugins/mini-css-extract-plugin') as typeof import('../../../plugins/mini-css-extract-plugin')\n ).default\n\n fns.push(\n plugin(\n // @ts-ignore webpack 5 compat\n new MiniCssExtractPlugin({\n filename: ctx.isProduction\n ? 'static/css/[contenthash].css'\n : 'static/css/[name].css',\n chunkFilename: ctx.isProduction\n ? 'static/css/[contenthash].css'\n : 'static/css/[name].css',\n // Next.js guarantees that CSS order \"doesn't matter\", due to imposed\n // restrictions:\n // 1. Global CSS can only be defined in a single entrypoint (_app)\n // 2. CSS Modules generate scoped class names by default and cannot\n // include Global CSS (:global() selector).\n //\n // While not a perfect guarantee (e.g. liberal use of `:global()`\n // selector), this assumption is required to code-split CSS.\n //\n // If this warning were to trigger, it'd be unactionable by the user,\n // but likely not valid -- so we disable it.\n ignoreOrder: true,\n insert: function (linkTag: HTMLLinkElement) {\n if (typeof _N_E_STYLE_LOAD === 'function') {\n const { href, onload, onerror } = linkTag\n _N_E_STYLE_LOAD(\n href.indexOf(window.location.origin) === 0\n ? new URL(href).pathname\n : href\n ).then(\n () => onload?.call(linkTag, { type: 'load' } as Event),\n () => onerror?.call(linkTag, {} as Event)\n )\n } else {\n document.head.appendChild(linkTag)\n }\n },\n })\n )\n )\n }\n\n const fn = pipe(...fns)\n return fn(config)\n})\n"],"names":["curry","loader","plugin","pipe","getCssModuleLoader","getGlobalCssLoader","getNextFontLoader","getCustomDocumentError","getGlobalImportError","getGlobalModuleImportError","getLocalModuleImportError","getPostCssPlugins","nonNullable","WEBPACK_LAYERS","getRspackCore","regexLikeCss","regexCssGlobal","regexCssModules","regexSassGlobal","regexSassModules","APP_LAYER_RULE","or","reactServerComponents","serverSideRendering","appPagesBrowser","PAGES_LAYER_RULE","not","markRemovable","r","Object","defineProperty","Symbol","for","enumerable","value","postcssInstancePromise","lazyPostCSS","rootDirectory","supportedBrowsers","disablePostcssPresetEnv","useLightningcss","postcss","require","postcssPlugin","name","initializer","creator","args","transformer","cache","get","process","css","processOpts","pluginOpts","vendor","prefix","prop","match","unprefixed","replace","postCssPlugins","postcssWithPlugins","ctx","config","isRspack","Boolean","env","NEXT_RSPACK","prependData","sassPrependData","additionalData","sassAdditionalData","implementation","sassImplementation","sassOptions","lazyPostCSSInitializer","experimental","sassPreprocessors","resolve","options","sourceMap","fns","googleLoader","localLoader","nextFontLoaders","forEach","fontLoaderTarget","fontLoaderPath","push","oneOf","sideEffects","test","use","issuer","reason","shouldIncludeExternalCSSImports","craCompat","transpilePackages","hasAppDir","issuerLayer","cssModules","isAppDir","filter","isServer","isProduction","allowedPagesGlobalCSSPath","undefined","and","allowedPagesGlobalCSSIssuer","include","customAppFile","isClient","exclude","type","MiniCssExtractPlugin","CssExtractRspackPlugin","default","filename","chunkFilename","ignoreOrder","insert","linkTag","_N_E_STYLE_LOAD","href","onload","onerror","indexOf","window","location","origin","URL","pathname","then","call","document","head","appendChild","fn"],"mappings":"AAAA,OAAOA,WAAW,kCAAiC;AAEnD,SAASC,MAAM,EAAEC,MAAM,QAAQ,gBAAe;AAC9C,SAASC,IAAI,QAAQ,cAAa;AAElC,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,YAAW;AAClE,SAASC,iBAAiB,QAAQ,sBAAqB;AACvD,SACEC,sBAAsB,EACtBC,oBAAoB,EACpBC,0BAA0B,EAC1BC,yBAAyB,QACpB,aAAY;AACnB,SAASC,iBAAiB,QAAQ,YAAW;AAC7C,SAASC,WAAW,QAAQ,kCAAiC;AAC7D,SAASC,cAAc,QAAQ,+BAA8B;AAC7D,SAASC,aAAa,QAAQ,uCAAsC;AAEpE,uCAAuC;AACvC,OAAO,MAAMC,eAAe,qBAAoB;AAEhD,2BAA2B;AAC3B,MAAMC,iBAAiB;AACvB,MAAMC,kBAAkB;AAExB,iDAAiD;AACjD,MAAMC,kBAAkB;AACxB,MAAMC,mBAAmB;AAEzB,MAAMC,iBAAiB;IACrBC,IAAI;QACFR,eAAeS,qBAAqB;QACpCT,eAAeU,mBAAmB;QAClCV,eAAeW,eAAe;KAC/B;AACH;AAEA,MAAMC,mBAAmB;IACvBC,KAAK;QACHb,eAAeS,qBAAqB;QACpCT,eAAeU,mBAAmB;QAClCV,eAAeW,eAAe;KAC/B;AACH;AAEA;;CAEC,GACD,SAASG,cAAcC,CAAsB;IAC3CC,OAAOC,cAAc,CAACF,GAAGG,OAAOC,GAAG,CAAC,sBAAsB;QACxDC,YAAY;QACZC,OAAO;IACT;IACA,OAAON;AACT;AAEA,IAAIO;AACJ,OAAO,eAAeC,YACpBC,aAAqB,EACrBC,iBAAuC,EACvCC,uBAA4C,EAC5CC,eAAoC;IAEpC,IAAI,CAACL,wBA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,IAAKjD,CAAAA,IAAI0C,YAAY,IAAI1C,IAAIoC,SAAS,AAAD,GAAI;QACvD,mEAAmE;QACnE,MAAMgB,uBAAuBlD,WACzBnD,gBAAgBsG,sBAAsB,GACtC,AACE1E,QAAQ,4CACR2E,OAAO;QAEbnC,IAAIO,IAAI,CACNvF,OACE,8BAA8B;QAC9B,IAAIiH,qBAAqB;YACvBG,UAAUvD,IAAI0C,YAAY,GACtB,iCACA;YACJc,eAAexD,IAAI0C,YAAY,GAC3B,iCACA;YACJ,qEAAqE;YACrE,gBAAgB;YAChB,kEAAkE;YAClE,mEAAmE;YACnE,8CAA8C;YAC9C,EAAE;YACF,iEAAiE;YACjE,4DAA4D;YAC5D,EAAE;YACF,qEAAqE;YACrE,4CAA4C;YAC5Ce,aAAa;YACbC,QAAQ,SAAUC,OAAwB;gBACxC,IAAI,OAAOC,oBAAoB,YAAY;oBACzC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGJ;oBAClCC,gBACEC,KAAKG,OAAO,CAACC,OAAOC,QAAQ,CAACC,MAAM,MAAM,IACrC,IAAIC,IAAIP,MAAMQ,QAAQ,GACtBR,MACJS,IAAI,CACJ,IAAMR,0BAAAA,OAAQS,IAAI,CAACZ,SAAS;4BAAER,MAAM;wBAAO,IAC3C,IAAMY,2BAAAA,QAASQ,IAAI,CAACZ,SAAS,CAAC;gBAElC,OAAO;oBACLa,SAASC,IAAI,CAACC,WAAW,CAACf;gBAC5B;YACF;QACF;IAGN;IAEA,MAAMgB,KAAKvI,QAAQ+E;IACnB,OAAOwD,GAAG1E;AACZ,GAAE","ignoreList":[0]}
|
|
@@ -1599,7 +1599,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1599
1599
|
isClient && new CopyFilePlugin({
|
|
1600
1600
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1601
1601
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1602
|
-
cacheKey: "15.6.0-canary.
|
|
1602
|
+
cacheKey: "15.6.0-canary.52",
|
|
1603
1603
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1604
1604
|
minimize: false,
|
|
1605
1605
|
info: {
|
|
@@ -1782,7 +1782,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1782
1782
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1783
1783
|
// - Next.js version
|
|
1784
1784
|
// - next.config.js keys that affect compilation
|
|
1785
|
-
version: `${__dirname}|${"15.6.0-canary.
|
|
1785
|
+
version: `${__dirname}|${"15.6.0-canary.52"}|${configVars}`,
|
|
1786
1786
|
cacheDirectory: path.join(distDir, 'cache', 'webpack'),
|
|
1787
1787
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1788
1788
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* - next/script with `beforeInteractive` strategy
|
|
6
6
|
*/ import { getAssetPrefix } from './asset-prefix';
|
|
7
7
|
import { setAttributesFromProps } from './set-attributes-from-props';
|
|
8
|
-
const version = "15.6.0-canary.
|
|
8
|
+
const version = "15.6.0-canary.52";
|
|
9
9
|
window.next = {
|
|
10
10
|
version,
|
|
11
11
|
appDir: true
|
package/dist/esm/client/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
|
|
|
26
26
|
import { onRecoverableError } from './react-client-callbacks/on-recoverable-error';
|
|
27
27
|
import tracer from './tracing/tracer';
|
|
28
28
|
import { isNextRouterError } from './components/is-next-router-error';
|
|
29
|
-
export const version = "15.6.0-canary.
|
|
29
|
+
export const version = "15.6.0-canary.52";
|
|
30
30
|
export let router;
|
|
31
31
|
export const emitter = mitt();
|
|
32
32
|
const looseToArray = (input)=>[].slice.call(input);
|
|
@@ -50,7 +50,7 @@ function unlinkPath(p, isDir = false, attempt = 0) {
|
|
|
50
50
|
*
|
|
51
51
|
* Despite using sync IO, the function signature is still `async` because we
|
|
52
52
|
* asynchronously perform retries.
|
|
53
|
-
*/ export async function recursiveDeleteSyncWithAsyncRetries(/** Directory to delete the contents of */ dir, /** Exclude based on relative file path */ exclude, /**
|
|
53
|
+
*/ export async function recursiveDeleteSyncWithAsyncRetries(/** Directory to delete the contents of */ dir, /** Exclude based on relative file path */ exclude, /** Relative path to the directory being deleted, used for exclude */ previousPath = '') {
|
|
54
54
|
let result;
|
|
55
55
|
try {
|
|
56
56
|
result = fs.readdirSync(dir, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/recursive-delete.ts"],"sourcesContent":["import type { Dirent } from 'node:fs'\nimport * as fs from 'node:fs'\nimport { join, isAbsolute, dirname } from 'node:path'\nimport isError from './is-error'\nimport { wait } from './wait'\n\n// We use an exponential backoff. See the unit test for example values.\n//\n// - Node's `fs` module uses a linear backoff, starting with 100ms.\n// - Rust tries 64 times with only a `thread::yield_now` in between.\n//\n// We want something more aggressive, as `recursiveDelete` is in the critical\n// path of `next dev` and `next build` startup.\nconst INITIAL_RETRY_MS = 8\nconst MAX_RETRY_MS = 64\nconst MAX_RETRIES = 6\n\n/**\n * Used in unit test.\n * @ignore\n */\nexport function calcBackoffMs(attempt: number): number {\n return Math.min(INITIAL_RETRY_MS * Math.pow(2, attempt), MAX_RETRY_MS)\n}\n\nfunction unlinkPath(\n p: string,\n isDir = false,\n attempt = 0\n): Promise<void> | void {\n try {\n if (isDir) {\n fs.rmdirSync(p)\n } else {\n fs.unlinkSync(p)\n }\n } catch (e) {\n const code = isError(e) && e.code\n if (\n (code === 'EBUSY' ||\n code === 'ENOTEMPTY' ||\n code === 'EPERM' ||\n code === 'EMFILE') &&\n attempt < MAX_RETRIES\n ) {\n // retrying is unlikely to succeed on POSIX platforms, but Windows can\n // fail due to temporarily-open files\n return (async () => {\n await wait(calcBackoffMs(attempt))\n return unlinkPath(p, isDir, attempt + 1)\n })()\n }\n\n if (code === 'ENOENT') {\n return\n }\n\n throw e\n }\n}\n\n/**\n * Recursively delete directory contents.\n *\n * This is used when cleaning the `distDir`, and is part of the critical path\n * for starting the server, so we use synchronous file IO, as we're always\n * blocked on it anyways.\n *\n * Despite using sync IO, the function signature is still `async` because we\n * asynchronously perform retries.\n */\nexport async function recursiveDeleteSyncWithAsyncRetries(\n /** Directory to delete the contents of */\n dir: string,\n /** Exclude based on relative file path */\n exclude?: RegExp,\n /**
|
|
1
|
+
{"version":3,"sources":["../../src/lib/recursive-delete.ts"],"sourcesContent":["import type { Dirent } from 'node:fs'\nimport * as fs from 'node:fs'\nimport { join, isAbsolute, dirname } from 'node:path'\nimport isError from './is-error'\nimport { wait } from './wait'\n\n// We use an exponential backoff. See the unit test for example values.\n//\n// - Node's `fs` module uses a linear backoff, starting with 100ms.\n// - Rust tries 64 times with only a `thread::yield_now` in between.\n//\n// We want something more aggressive, as `recursiveDelete` is in the critical\n// path of `next dev` and `next build` startup.\nconst INITIAL_RETRY_MS = 8\nconst MAX_RETRY_MS = 64\nconst MAX_RETRIES = 6\n\n/**\n * Used in unit test.\n * @ignore\n */\nexport function calcBackoffMs(attempt: number): number {\n return Math.min(INITIAL_RETRY_MS * Math.pow(2, attempt), MAX_RETRY_MS)\n}\n\nfunction unlinkPath(\n p: string,\n isDir = false,\n attempt = 0\n): Promise<void> | void {\n try {\n if (isDir) {\n fs.rmdirSync(p)\n } else {\n fs.unlinkSync(p)\n }\n } catch (e) {\n const code = isError(e) && e.code\n if (\n (code === 'EBUSY' ||\n code === 'ENOTEMPTY' ||\n code === 'EPERM' ||\n code === 'EMFILE') &&\n attempt < MAX_RETRIES\n ) {\n // retrying is unlikely to succeed on POSIX platforms, but Windows can\n // fail due to temporarily-open files\n return (async () => {\n await wait(calcBackoffMs(attempt))\n return unlinkPath(p, isDir, attempt + 1)\n })()\n }\n\n if (code === 'ENOENT') {\n return\n }\n\n throw e\n }\n}\n\n/**\n * Recursively delete directory contents.\n *\n * This is used when cleaning the `distDir`, and is part of the critical path\n * for starting the server, so we use synchronous file IO, as we're always\n * blocked on it anyways.\n *\n * Despite using sync IO, the function signature is still `async` because we\n * asynchronously perform retries.\n */\nexport async function recursiveDeleteSyncWithAsyncRetries(\n /** Directory to delete the contents of */\n dir: string,\n /** Exclude based on relative file path */\n exclude?: RegExp,\n /** Relative path to the directory being deleted, used for exclude */\n previousPath: string = ''\n): Promise<void> {\n let result\n try {\n result = fs.readdirSync(dir, { withFileTypes: true })\n } catch (e) {\n if (isError(e) && e.code === 'ENOENT') {\n return\n }\n throw e\n }\n\n await Promise.all(\n result.map(async (part: Dirent) => {\n const absolutePath = join(dir, part.name)\n\n // readdir does not follow symbolic links\n // if part is a symbolic link, follow it using stat\n let isDirectory = part.isDirectory()\n const isSymlink = part.isSymbolicLink()\n\n if (isSymlink) {\n const linkPath = fs.readlinkSync(absolutePath)\n\n try {\n const stats = fs.statSync(\n isAbsolute(linkPath)\n ? linkPath\n : join(dirname(absolutePath), linkPath)\n )\n isDirectory = stats.isDirectory()\n } catch {}\n }\n\n const pp = join(previousPath, part.name)\n const isNotExcluded = !exclude || !exclude.test(pp)\n\n if (isNotExcluded) {\n if (!isSymlink && isDirectory) {\n await recursiveDeleteSyncWithAsyncRetries(absolutePath, exclude, pp)\n }\n return unlinkPath(absolutePath, !isSymlink && isDirectory)\n }\n })\n )\n}\n"],"names":["fs","join","isAbsolute","dirname","isError","wait","INITIAL_RETRY_MS","MAX_RETRY_MS","MAX_RETRIES","calcBackoffMs","attempt","Math","min","pow","unlinkPath","p","isDir","rmdirSync","unlinkSync","e","code","recursiveDeleteSyncWithAsyncRetries","dir","exclude","previousPath","result","readdirSync","withFileTypes","Promise","all","map","part","absolutePath","name","isDirectory","isSymlink","isSymbolicLink","linkPath","readlinkSync","stats","statSync","pp","isNotExcluded","test"],"mappings":"AACA,YAAYA,QAAQ,UAAS;AAC7B,SAASC,IAAI,EAAEC,UAAU,EAAEC,OAA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fJ,OAAOK,GAAG,CAAC,OAAOC;QAChB,MAAMC,eAAe/B,KAAKqB,KAAKS,KAAKE,IAAI;QAExC,yCAAyC;QACzC,mDAAmD;QACnD,IAAIC,cAAcH,KAAKG,WAAW;QAClC,MAAMC,YAAYJ,KAAKK,cAAc;QAErC,IAAID,WAAW;YACb,MAAME,WAAWrC,GAAGsC,YAAY,CAACN;YAEjC,IAAI;gBACF,MAAMO,QAAQvC,GAAGwC,QAAQ,CACvBtC,WAAWmC,YACPA,WACApC,KAAKE,QAAQ6B,eAAeK;gBAElCH,cAAcK,MAAML,WAAW;YACjC,EAAE,OAAM,CAAC;QACX;QAEA,MAAMO,KAAKxC,KAAKuB,cAAcO,KAAKE,IAAI;QACvC,MAAMS,gBAAgB,CAACnB,WAAW,CAACA,QAAQoB,IAAI,CAACF;QAEhD,IAAIC,eAAe;YACjB,IAAI,CAACP,aAAaD,aAAa;gBAC7B,MAAMb,oCAAoCW,cAAcT,SAASkB;YACnE;YACA,OAAO3B,WAAWkB,cAAc,CAACG,aAAaD;QAChD;IACF;AAEJ","ignoreList":[0]}
|
|
@@ -95,7 +95,7 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
|
|
|
95
95
|
}
|
|
96
96
|
const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
|
|
97
97
|
const hotReloaderSpan = trace('hot-reloader', undefined, {
|
|
98
|
-
version: "15.6.0-canary.
|
|
98
|
+
version: "15.6.0-canary.52"
|
|
99
99
|
});
|
|
100
100
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
101
101
|
// of the current `next dev` invocation.
|
|
@@ -534,7 +534,13 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
|
|
|
534
534
|
}
|
|
535
535
|
}),
|
|
536
536
|
...nextConfig.experimental.mcpServer ? [
|
|
537
|
-
getMcpMiddleware(
|
|
537
|
+
getMcpMiddleware({
|
|
538
|
+
projectPath,
|
|
539
|
+
distDir,
|
|
540
|
+
sendHmrMessage: (message)=>hotReloader.send(message),
|
|
541
|
+
getActiveConnectionCount: ()=>clients.size,
|
|
542
|
+
getDevServerUrl: ()=>process.env.__NEXT_PRIVATE_ORIGIN
|
|
543
|
+
})
|
|
538
544
|
] : []
|
|
539
545
|
];
|
|
540
546
|
setStackFrameResolver(async (request)=>{
|