next 16.0.0-canary.0 → 16.0.0-canary.1
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/index.js +3 -3
- package/dist/build/swc/generated-native.d.ts +1 -0
- package/dist/build/swc/index.js +2 -3
- package/dist/build/swc/index.js.map +1 -1
- package/dist/build/swc/types.d.ts +1 -0
- 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.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.dev.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.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.prod.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.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/next-server/server.runtime.prod.js +8 -8
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +3 -3
- package/dist/esm/build/swc/generated-native.d.ts +1 -0
- package/dist/esm/build/swc/index.js +2 -3
- package/dist/esm/build/swc/index.js.map +1 -1
- package/dist/esm/build/swc/types.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/export/worker.js +2 -0
- package/dist/esm/export/worker.js.map +1 -1
- package/dist/esm/server/config-schema.js +2 -1
- package/dist/esm/server/config-schema.js.map +1 -1
- package/dist/esm/server/config-shared.js +2 -1
- package/dist/esm/server/config-shared.js.map +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/dev/on-demand-entry-handler.js +2 -1
- package/dist/esm/server/dev/on-demand-entry-handler.js.map +1 -1
- package/dist/esm/server/dev/turbopack-utils.js +4 -2
- package/dist/esm/server/dev/turbopack-utils.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/next-server.js +2 -0
- package/dist/esm/server/next-server.js.map +1 -1
- package/dist/esm/server/node-environment-extensions/console-dim.external.js +61 -47
- package/dist/esm/server/node-environment-extensions/console-dim.external.js.map +1 -1
- package/dist/esm/server/node-environment-extensions/global-behaviors.js +23 -0
- package/dist/esm/server/node-environment-extensions/global-behaviors.js.map +1 -0
- package/dist/esm/shared/lib/errors/canary-only-config-error.js +1 -1
- package/dist/export/worker.js +2 -0
- package/dist/export/worker.js.map +1 -1
- package/dist/server/config-schema.d.ts +1 -0
- package/dist/server/config-schema.js +2 -1
- package/dist/server/config-schema.js.map +1 -1
- package/dist/server/config-shared.d.ts +8 -0
- package/dist/server/config-shared.js +2 -1
- package/dist/server/config-shared.js.map +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/dev/on-demand-entry-handler.js +2 -1
- package/dist/server/dev/on-demand-entry-handler.js.map +1 -1
- package/dist/server/dev/turbopack-utils.js +4 -2
- package/dist/server/dev/turbopack-utils.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/next-server.js +2 -0
- package/dist/server/next-server.js.map +1 -1
- package/dist/server/node-environment-extensions/console-dim.external.d.ts +4 -0
- package/dist/server/node-environment-extensions/console-dim.external.js +76 -50
- package/dist/server/node-environment-extensions/console-dim.external.js.map +1 -1
- package/dist/server/node-environment-extensions/global-behaviors.d.ts +7 -0
- package/dist/server/node-environment-extensions/global-behaviors.js +33 -0
- package/dist/server/node-environment-extensions/global-behaviors.js.map +1 -0
- package/dist/shared/lib/errors/canary-only-config-error.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
|
@@ -5,6 +5,13 @@ const cacheSignals = [];
|
|
|
5
5
|
export function registerGetCacheSignal(getSignal) {
|
|
6
6
|
cacheSignals.push(getSignal);
|
|
7
7
|
}
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- we may use later and want parity with the HIDDEN_STYLE value
|
|
9
|
+
const DIMMED_STYLE = 'dimmed';
|
|
10
|
+
const HIDDEN_STYLE = 'hidden';
|
|
11
|
+
let currentAbortedLogsStyle = 'dimmed';
|
|
12
|
+
export function setAbortedLogsStyle(style) {
|
|
13
|
+
currentAbortedLogsStyle = style;
|
|
14
|
+
}
|
|
8
15
|
const isColorSupported = dim('test') !== 'test';
|
|
9
16
|
// 50% opacity for dimmed text
|
|
10
17
|
const dimStyle = 'color: color(from currentColor xyz x y z / 0.5);';
|
|
@@ -138,58 +145,65 @@ function patchConsoleMethod(methodName) {
|
|
|
138
145
|
const originalName = Object.getOwnPropertyDescriptor(originalMethod, 'name');
|
|
139
146
|
const wrapperMethod = function(...args) {
|
|
140
147
|
const consoleStore = consoleAsyncStorage.getStore();
|
|
141
|
-
if
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (signal) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (signal.aborted) {
|
|
156
|
-
return applyWithDimming.call(this, consoleStore, originalMethod, methodName, args);
|
|
157
|
-
} else {
|
|
158
|
-
return originalMethod.apply(this, args);
|
|
148
|
+
// First we see if there is a cache signal for our current scope. If we're in a client render it'll
|
|
149
|
+
// come from the client React cacheSignal implementation. If we are in a server render it'll come from
|
|
150
|
+
// the server React cacheSignal implementation. Any particular console call will be in one, the other, or neither
|
|
151
|
+
// scope and these signals return null if you are out of scope so this can be called from a single global patch
|
|
152
|
+
// and still work properly.
|
|
153
|
+
for(let i = 0; i < cacheSignals.length; i++){
|
|
154
|
+
const signal = cacheSignals[i]() // try to get a signal from registered functions
|
|
155
|
+
;
|
|
156
|
+
if (signal) {
|
|
157
|
+
// We are in a React Server render and can consult the React cache signal to determine if logs
|
|
158
|
+
// are now dimmable.
|
|
159
|
+
if (signal.aborted) {
|
|
160
|
+
if (currentAbortedLogsStyle === HIDDEN_STYLE) {
|
|
161
|
+
return;
|
|
159
162
|
}
|
|
163
|
+
return applyWithDimming.call(this, consoleStore, originalMethod, methodName, args);
|
|
164
|
+
} else if ((consoleStore == null ? void 0 : consoleStore.dim) === true) {
|
|
165
|
+
return applyWithDimming.call(this, consoleStore, originalMethod, methodName, args);
|
|
166
|
+
} else {
|
|
167
|
+
return originalMethod.apply(this, args);
|
|
160
168
|
}
|
|
161
169
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return
|
|
170
|
+
}
|
|
171
|
+
// We need to fall back to checking the work unit store for two reasons.
|
|
172
|
+
// 1. Client React does not yet implement cacheSignal (it always returns null)
|
|
173
|
+
// 2. route.ts files aren't rendered with React but do have prerender semantics
|
|
174
|
+
// TODO in the future we should be able to remove this once there is a runnable cache
|
|
175
|
+
// scope independent of actual React rendering.
|
|
176
|
+
const workUnitStore = workUnitAsyncStorage.getStore();
|
|
177
|
+
switch(workUnitStore == null ? void 0 : workUnitStore.type){
|
|
178
|
+
case 'prerender':
|
|
179
|
+
case 'prerender-runtime':
|
|
180
|
+
// These can be hit in a route handler. In the future we can use potential React.createCache API
|
|
181
|
+
// to create a cache scope for arbitrary computation and can move over to cacheSignal exclusively.
|
|
182
|
+
// fallthrough
|
|
183
|
+
case 'prerender-client':
|
|
184
|
+
// This is a react-dom/server render and won't have a cacheSignal until React adds this for the client world.
|
|
185
|
+
const renderSignal = workUnitStore.renderSignal;
|
|
186
|
+
if (renderSignal.aborted) {
|
|
187
|
+
if (currentAbortedLogsStyle === HIDDEN_STYLE) {
|
|
188
|
+
return;
|
|
181
189
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
190
|
+
return applyWithDimming.call(this, consoleStore, originalMethod, methodName, args);
|
|
191
|
+
}
|
|
192
|
+
// intentional fallthrough
|
|
193
|
+
case 'prerender-legacy':
|
|
194
|
+
case 'prerender-ppr':
|
|
195
|
+
case 'cache':
|
|
196
|
+
case 'unstable-cache':
|
|
197
|
+
case 'private-cache':
|
|
198
|
+
case 'request':
|
|
199
|
+
case undefined:
|
|
200
|
+
if ((consoleStore == null ? void 0 : consoleStore.dim) === true) {
|
|
201
|
+
return applyWithDimming.call(this, consoleStore, originalMethod, methodName, args);
|
|
202
|
+
} else {
|
|
189
203
|
return originalMethod.apply(this, args);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
204
|
+
}
|
|
205
|
+
default:
|
|
206
|
+
workUnitStore;
|
|
193
207
|
}
|
|
194
208
|
};
|
|
195
209
|
if (originalName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/node-environment-extensions/console-dim.external.tsx"],"sourcesContent":["import { dim } from '../../lib/picocolors'\nimport {\n consoleAsyncStorage,\n type ConsoleStore,\n} from '../app-render/console-async-storage.external'\nimport { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\n\ntype GetCacheSignal = () => AbortSignal | null\nconst cacheSignals: Array<GetCacheSignal> = []\nexport function registerGetCacheSignal(getSignal: GetCacheSignal): void {\n cacheSignals.push(getSignal)\n}\n\ntype InterceptableConsoleMethod =\n | 'error'\n | 'assert'\n | 'debug'\n | 'dir'\n | 'dirxml'\n | 'group'\n | 'groupCollapsed'\n | 'groupEnd'\n | 'info'\n | 'log'\n | 'table'\n | 'trace'\n | 'warn'\n\nconst isColorSupported = dim('test') !== 'test'\n\n// 50% opacity for dimmed text\nconst dimStyle = 'color: color(from currentColor xyz x y z / 0.5);'\nconst reactBadgeFormat = '\\x1b[0m\\x1b[7m%c%s\\x1b[0m%c '\n\nfunction dimmedConsoleArgs(...inputArgs: any[]): any[] {\n if (!isColorSupported) {\n return inputArgs\n }\n\n const newArgs = inputArgs.slice(0)\n let template = ''\n let argumentsPointer = 0\n if (typeof inputArgs[0] === 'string') {\n const originalTemplateString = inputArgs[0]\n // Remove the original template string from the args.\n newArgs.splice(argumentsPointer, 1)\n argumentsPointer += 1\n\n let i = 0\n if (originalTemplateString.startsWith(reactBadgeFormat)) {\n i = reactBadgeFormat.length\n // for `format` we already moved the pointer earlier\n // style, badge, reset style\n argumentsPointer += 3\n template += reactBadgeFormat\n // React's badge reset styles, reapply dimming\n template += '\\x1b[2m%c'\n // argumentsPointer includes template\n newArgs.splice(argumentsPointer - 1, 0, dimStyle)\n // dim the badge\n newArgs[0] += `;${dimStyle}`\n }\n\n for (i; i < originalTemplateString.length; i++) {\n const currentChar = originalTemplateString[i]\n if (currentChar !== '%') {\n template += currentChar\n continue\n }\n\n const nextChar = originalTemplateString[i + 1]\n ++i\n\n switch (nextChar) {\n case 'f':\n case 'O':\n case 'o':\n case 'd':\n case 's':\n case 'i':\n case 'c':\n ++argumentsPointer\n template += `%${nextChar}`\n break\n default:\n template += `%${nextChar}`\n }\n }\n }\n\n for (\n argumentsPointer;\n argumentsPointer < inputArgs.length;\n ++argumentsPointer\n ) {\n const arg = inputArgs[argumentsPointer]\n const argType = typeof arg\n if (argumentsPointer > 0) {\n template += ' '\n }\n switch (argType) {\n case 'boolean':\n case 'string':\n template += '%s'\n break\n case 'bigint':\n template += '%s'\n break\n case 'number':\n if (arg % 0) {\n template += '%f'\n } else {\n template += '%d'\n }\n break\n case 'object':\n template += '%O'\n break\n case 'symbol':\n case 'undefined':\n case 'function':\n template += '%s'\n break\n default:\n // deopt to string for new, unknown types\n template += '%s'\n }\n }\n\n template += '\\x1b[22m'\n\n return [dim(`%c${template}`), dimStyle, ...newArgs]\n}\n\nfunction convertToDimmedArgs(\n methodName: InterceptableConsoleMethod,\n args: any[]\n): any[] {\n switch (methodName) {\n case 'dir':\n case 'dirxml':\n case 'group':\n case 'groupCollapsed':\n case 'groupEnd':\n case 'table': {\n // These methods cannot be colorized because they don't take a formatting string.\n return args\n }\n case 'assert': {\n // assert takes formatting options as the second argument.\n return [args[0]].concat(...dimmedConsoleArgs(args[1], ...args.slice(2)))\n }\n case 'error':\n case 'debug':\n case 'info':\n case 'log':\n case 'trace':\n case 'warn':\n return dimmedConsoleArgs(args[0], ...args.slice(1))\n default:\n return methodName satisfies never\n }\n}\n\n// Based on https://github.com/facebook/react/blob/28dc0776be2e1370fe217549d32aee2519f0cf05/packages/react-server/src/ReactFlightServer.js#L248\nfunction patchConsoleMethod(methodName: InterceptableConsoleMethod): void {\n const descriptor = Object.getOwnPropertyDescriptor(console, methodName)\n if (\n descriptor &&\n (descriptor.configurable || descriptor.writable) &&\n typeof descriptor.value === 'function'\n ) {\n const originalMethod = descriptor.value\n const originalName = Object.getOwnPropertyDescriptor(originalMethod, 'name')\n const wrapperMethod = function (this: typeof console, ...args: any[]) {\n const consoleStore = consoleAsyncStorage.getStore()\n\n if (consoleStore?.dim === true) {\n return applyWithDimming.call(\n this,\n consoleStore,\n originalMethod,\n methodName,\n args\n )\n } else {\n // First we see if there is a cache signal for our current scope. If we're in a client render it'll\n // come from the client React cacheSignal implementation. If we are in a server render it'll come from\n // the server React cacheSignal implementation. Any particular console call will be in one, the other, or neither\n // scope and these signals return null if you are out of scope so this can be called from a single global patch\n // and still work properly.\n for (let i = 0; i < cacheSignals.length; i++) {\n const signal = cacheSignals[i]() // try to get a signal from registered functions\n if (signal) {\n // We are in a React Server render and can consult the React cache signal to determine if logs\n // are now dimmable.\n if (signal.aborted) {\n return applyWithDimming.call(\n this,\n consoleStore,\n originalMethod,\n methodName,\n args\n )\n } else {\n return originalMethod.apply(this, args)\n }\n }\n }\n // We need to fall back to checking the work unit store for two reasons.\n // 1. Client React does not yet implement cacheSignal (it always returns null)\n // 2. route.ts files aren't rendered with React but do have prerender semantics\n // TODO in the future we should be able to remove this once there is a runnable cache\n // scope independent of actual React rendering.\n const workUnitStore = workUnitAsyncStorage.getStore()\n switch (workUnitStore?.type) {\n case 'prerender':\n case 'prerender-runtime':\n // These can be hit in a route handler. In the future we can use potential React.createCache API\n // to create a cache scope for arbitrary computation and can move over to cacheSignal exclusively.\n // fallthrough\n case 'prerender-client':\n // This is a react-dom/server render and won't have a cacheSignal until React adds this for the client world.\n const renderSignal = workUnitStore.renderSignal\n if (renderSignal.aborted) {\n return applyWithDimming.call(\n this,\n consoleStore,\n originalMethod,\n methodName,\n args\n )\n } else {\n return originalMethod.apply(this, args)\n }\n case 'prerender-legacy':\n case 'prerender-ppr':\n case 'cache':\n case 'unstable-cache':\n case 'private-cache':\n case 'request':\n case undefined:\n return originalMethod.apply(this, args)\n default:\n workUnitStore satisfies never\n }\n }\n }\n if (originalName) {\n Object.defineProperty(wrapperMethod, 'name', originalName)\n }\n Object.defineProperty(console, methodName, {\n value: wrapperMethod,\n })\n }\n}\n\nfunction applyWithDimming<F extends (this: Console, ...args: any[]) => any>(\n this: Console,\n consoleStore: undefined | ConsoleStore,\n method: F,\n methodName: InterceptableConsoleMethod,\n args: Parameters<F>\n): ReturnType<F> {\n if (consoleStore?.dim === true) {\n return method.apply(this, convertToDimmedArgs(methodName, args))\n } else {\n return consoleAsyncStorage.run(\n DIMMED_STORE,\n method.bind(this, ...convertToDimmedArgs(methodName, args))\n )\n }\n}\n\nconst DIMMED_STORE = { dim: true }\n\npatchConsoleMethod('error')\npatchConsoleMethod('assert')\npatchConsoleMethod('debug')\npatchConsoleMethod('dir')\npatchConsoleMethod('dirxml')\npatchConsoleMethod('group')\npatchConsoleMethod('groupCollapsed')\npatchConsoleMethod('groupEnd')\npatchConsoleMethod('info')\npatchConsoleMethod('log')\npatchConsoleMethod('table')\npatchConsoleMethod('trace')\npatchConsoleMethod('warn')\n"],"names":["dim","consoleAsyncStorage","workUnitAsyncStorage","cacheSignals","registerGetCacheSignal","getSignal","push","isColorSupported","dimStyle","reactBadgeFormat","dimmedConsoleArgs","inputArgs","newArgs","slice","template","argumentsPointer","originalTemplateString","splice","i","startsWith","length","currentChar","nextChar","arg","argType","convertToDimmedArgs","methodName","args","concat","patchConsoleMethod","descriptor","Object","getOwnPropertyDescriptor","console","configurable","writable","value","originalMethod","originalName","wrapperMethod","consoleStore","getStore","applyWithDimming","call","signal","aborted","apply","workUnitStore","type","renderSignal","undefined","defineProperty","method","run","DIMMED_STORE","bind"],"mappings":"AAAA,SAASA,GAAG,QAAQ,uBAAsB;AAC1C,SACEC,mBAAmB,QAEd,+CAA8C;AACrD,SAASC,oBAAoB,QAAQ,iDAAgD;AAGrF,MAAMC,eAAsC,EAAE;AAC9C,OAAO,SAASC,uBAAuBC,SAAyB;IAC9DF,aAAaG,IAAI,CAACD;AACpB;AAiBA,MAAME,mBAAmBP,IAAI,YAAY;AAEzC,8BAA8B;AAC9B,MAAMQ,WAAW;AACjB,MAAMC,mBAAmB;AAEzB,SAASC,kBAAkB,GAAGC,SAAgB;IAC5C,IAAI,CAACJ,kBAAkB;QACrB,OAAOI;IACT;IAEA,MAAMC,UAAUD,UAAUE,KAAK,CAAC;IAChC,IAAIC,WAAW;IACf,IAAIC,mBAAmB;IACvB,IAAI,OAAOJ,SAAS,CAAC,E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B,UAAsC,EACtCC,IAAmB;IAEnB,IAAIa,CAAAA,gCAAAA,aAAcxC,GAAG,MAAK,MAAM;QAC9B,OAAOoD,OAAON,KAAK,CAAC,IAAI,EAAErB,oBAAoBC,YAAYC;IAC5D,OAAO;QACL,OAAO1B,oBAAoBoD,GAAG,CAC5BC,cACAF,OAAOG,IAAI,CAAC,IAAI,KAAK9B,oBAAoBC,YAAYC;IAEzD;AACF;AAEA,MAAM2B,eAAe;IAAEtD,KAAK;AAAK;AAEjC6B,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../../src/server/node-environment-extensions/console-dim.external.tsx"],"sourcesContent":["import { dim } from '../../lib/picocolors'\nimport {\n consoleAsyncStorage,\n type ConsoleStore,\n} from '../app-render/console-async-storage.external'\nimport { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external'\n\ntype GetCacheSignal = () => AbortSignal | null\nconst cacheSignals: Array<GetCacheSignal> = []\nexport function registerGetCacheSignal(getSignal: GetCacheSignal): void {\n cacheSignals.push(getSignal)\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- we may use later and want parity with the HIDDEN_STYLE value\nconst DIMMED_STYLE = 'dimmed'\nconst HIDDEN_STYLE = 'hidden'\n\ntype LogStyle = typeof DIMMED_STYLE | typeof HIDDEN_STYLE\n\nlet currentAbortedLogsStyle: LogStyle = 'dimmed'\nexport function setAbortedLogsStyle(style: LogStyle) {\n currentAbortedLogsStyle = style\n}\n\ntype InterceptableConsoleMethod =\n | 'error'\n | 'assert'\n | 'debug'\n | 'dir'\n | 'dirxml'\n | 'group'\n | 'groupCollapsed'\n | 'groupEnd'\n | 'info'\n | 'log'\n | 'table'\n | 'trace'\n | 'warn'\n\nconst isColorSupported = dim('test') !== 'test'\n\n// 50% opacity for dimmed text\nconst dimStyle = 'color: color(from currentColor xyz x y z / 0.5);'\nconst reactBadgeFormat = '\\x1b[0m\\x1b[7m%c%s\\x1b[0m%c '\n\nfunction dimmedConsoleArgs(...inputArgs: any[]): any[] {\n if (!isColorSupported) {\n return inputArgs\n }\n\n const newArgs = inputArgs.slice(0)\n let template = ''\n let argumentsPointer = 0\n if (typeof inputArgs[0] === 'string') {\n const originalTemplateString = inputArgs[0]\n // Remove the original template string from the args.\n newArgs.splice(argumentsPointer, 1)\n argumentsPointer += 1\n\n let i = 0\n if (originalTemplateString.startsWith(reactBadgeFormat)) {\n i = reactBadgeFormat.length\n // for `format` we already moved the pointer earlier\n // style, badge, reset style\n argumentsPointer += 3\n template += reactBadgeFormat\n // React's badge reset styles, reapply dimming\n template += '\\x1b[2m%c'\n // argumentsPointer includes template\n newArgs.splice(argumentsPointer - 1, 0, dimStyle)\n // dim the badge\n newArgs[0] += `;${dimStyle}`\n }\n\n for (i; i < originalTemplateString.length; i++) {\n const currentChar = originalTemplateString[i]\n if (currentChar !== '%') {\n template += currentChar\n continue\n }\n\n const nextChar = originalTemplateString[i + 1]\n ++i\n\n switch (nextChar) {\n case 'f':\n case 'O':\n case 'o':\n case 'd':\n case 's':\n case 'i':\n case 'c':\n ++argumentsPointer\n template += `%${nextChar}`\n break\n default:\n template += `%${nextChar}`\n }\n }\n }\n\n for (\n argumentsPointer;\n argumentsPointer < inputArgs.length;\n ++argumentsPointer\n ) {\n const arg = inputArgs[argumentsPointer]\n const argType = typeof arg\n if (argumentsPointer > 0) {\n template += ' '\n }\n switch (argType) {\n case 'boolean':\n case 'string':\n template += '%s'\n break\n case 'bigint':\n template += '%s'\n break\n case 'number':\n if (arg % 0) {\n template += '%f'\n } else {\n template += '%d'\n }\n break\n case 'object':\n template += '%O'\n break\n case 'symbol':\n case 'undefined':\n case 'function':\n template += '%s'\n break\n default:\n // deopt to string for new, unknown types\n template += '%s'\n }\n }\n\n template += '\\x1b[22m'\n\n return [dim(`%c${template}`), dimStyle, ...newArgs]\n}\n\nfunction convertToDimmedArgs(\n methodName: InterceptableConsoleMethod,\n args: any[]\n): any[] {\n switch (methodName) {\n case 'dir':\n case 'dirxml':\n case 'group':\n case 'groupCollapsed':\n case 'groupEnd':\n case 'table': {\n // These methods cannot be colorized because they don't take a formatting string.\n return args\n }\n case 'assert': {\n // assert takes formatting options as the second argument.\n return [args[0]].concat(...dimmedConsoleArgs(args[1], ...args.slice(2)))\n }\n case 'error':\n case 'debug':\n case 'info':\n case 'log':\n case 'trace':\n case 'warn':\n return dimmedConsoleArgs(args[0], ...args.slice(1))\n default:\n return methodName satisfies never\n }\n}\n\n// Based on https://github.com/facebook/react/blob/28dc0776be2e1370fe217549d32aee2519f0cf05/packages/react-server/src/ReactFlightServer.js#L248\nfunction patchConsoleMethod(methodName: InterceptableConsoleMethod): void {\n const descriptor = Object.getOwnPropertyDescriptor(console, methodName)\n if (\n descriptor &&\n (descriptor.configurable || descriptor.writable) &&\n typeof descriptor.value === 'function'\n ) {\n const originalMethod = descriptor.value\n const originalName = Object.getOwnPropertyDescriptor(originalMethod, 'name')\n const wrapperMethod = function (this: typeof console, ...args: any[]) {\n const consoleStore = consoleAsyncStorage.getStore()\n\n // First we see if there is a cache signal for our current scope. If we're in a client render it'll\n // come from the client React cacheSignal implementation. If we are in a server render it'll come from\n // the server React cacheSignal implementation. Any particular console call will be in one, the other, or neither\n // scope and these signals return null if you are out of scope so this can be called from a single global patch\n // and still work properly.\n for (let i = 0; i < cacheSignals.length; i++) {\n const signal = cacheSignals[i]() // try to get a signal from registered functions\n if (signal) {\n // We are in a React Server render and can consult the React cache signal to determine if logs\n // are now dimmable.\n if (signal.aborted) {\n if (currentAbortedLogsStyle === HIDDEN_STYLE) {\n return\n }\n return applyWithDimming.call(\n this,\n consoleStore,\n originalMethod,\n methodName,\n args\n )\n } else if (consoleStore?.dim === true) {\n return applyWithDimming.call(\n this,\n consoleStore,\n originalMethod,\n methodName,\n args\n )\n } else {\n return originalMethod.apply(this, args)\n }\n }\n }\n\n // We need to fall back to checking the work unit store for two reasons.\n // 1. Client React does not yet implement cacheSignal (it always returns null)\n // 2. route.ts files aren't rendered with React but do have prerender semantics\n // TODO in the future we should be able to remove this once there is a runnable cache\n // scope independent of actual React rendering.\n const workUnitStore = workUnitAsyncStorage.getStore()\n switch (workUnitStore?.type) {\n case 'prerender':\n case 'prerender-runtime':\n // These can be hit in a route handler. In the future we can use potential React.createCache API\n // to create a cache scope for arbitrary computation and can move over to cacheSignal exclusively.\n // fallthrough\n case 'prerender-client':\n // This is a react-dom/server render and won't have a cacheSignal until React adds this for the client world.\n const renderSignal = workUnitStore.renderSignal\n if (renderSignal.aborted) {\n if (currentAbortedLogsStyle === HIDDEN_STYLE) {\n return\n }\n return applyWithDimming.call(\n this,\n consoleStore,\n originalMethod,\n methodName,\n args\n )\n }\n // intentional fallthrough\n case 'prerender-legacy':\n case 'prerender-ppr':\n case 'cache':\n case 'unstable-cache':\n case 'private-cache':\n case 'request':\n case undefined:\n if (consoleStore?.dim === true) {\n return applyWithDimming.call(\n this,\n consoleStore,\n originalMethod,\n methodName,\n args\n )\n } else {\n return originalMethod.apply(this, args)\n }\n default:\n workUnitStore satisfies never\n }\n }\n if (originalName) {\n Object.defineProperty(wrapperMethod, 'name', originalName)\n }\n Object.defineProperty(console, methodName, {\n value: wrapperMethod,\n })\n }\n}\n\nfunction applyWithDimming<F extends (this: Console, ...args: any[]) => any>(\n this: Console,\n consoleStore: undefined | ConsoleStore,\n method: F,\n methodName: InterceptableConsoleMethod,\n args: Parameters<F>\n): ReturnType<F> {\n if (consoleStore?.dim === true) {\n return method.apply(this, convertToDimmedArgs(methodName, args))\n } else {\n return consoleAsyncStorage.run(\n DIMMED_STORE,\n method.bind(this, ...convertToDimmedArgs(methodName, args))\n )\n }\n}\n\nconst DIMMED_STORE = { dim: true }\n\npatchConsoleMethod('error')\npatchConsoleMethod('assert')\npatchConsoleMethod('debug')\npatchConsoleMethod('dir')\npatchConsoleMethod('dirxml')\npatchConsoleMethod('group')\npatchConsoleMethod('groupCollapsed')\npatchConsoleMethod('groupEnd')\npatchConsoleMethod('info')\npatchConsoleMethod('log')\npatchConsoleMethod('table')\npatchConsoleMethod('trace')\npatchConsoleMethod('warn')\n"],"names":["dim","consoleAsyncStorage","workUnitAsyncStorage","cacheSignals","registerGetCacheSignal","getSignal","push","DIMMED_STYLE","HIDDEN_STYLE","currentAbortedLogsStyle","setAbortedLogsStyle","style","isColorSupported","dimStyle","reactBadgeFormat","dimmedConsoleArgs","inputArgs","newArgs","slice","template","argumentsPointer","originalTemplateString","splice","i","startsWith","length","currentChar","nextChar","arg","argType","convertToDimmedArgs","methodName","args","concat","patchConsoleMethod","descriptor","Object","getOwnPropertyDescriptor","console","configurable","writable","value","originalMethod","originalName","wrapperMethod","consoleStore","getStore","signal","aborted","applyWithDimming","call","apply","workUnitStore","type","renderSignal","undefined","defineProperty","method","run","DIMMED_STORE","bind"],"mappings":"AAAA,SAASA,GAAG,QAAQ,uBAAsB;AAC1C,SACEC,mBAAmB,QAEd,+CAA8C;AACrD,SAASC,oBAAoB,QAAQ,iDAAgD;AAGrF,MAAMC,eAAsC,EAAE;AAC9C,OAAO,SAASC,uBAAuBC,SAAyB;IAC9DF,aAAaG,IAAI,CAACD;AACpB;AAEA,6HAA6H;AAC7H,MAAME,eAAe;AACrB,MAAMC,eAAe;AAIrB,IAAIC,0BAAoC;AACxC,OAAO,SAASC,oBAAoBC,KAAe;IACjDF,0BAA0BE;AAC5B;AAiBA,MAAMC,mBAAmBZ,IAAI,YAAY;AAEzC,8BAA8B;AAC9B,MAAMa,WAAW;AACjB,MAAMC,mBAAmB;AAEzB,SAASC,kBAAkB,GAAGC,SAAgB;IAC5C,IAAI,CAACJ,kBAAkB;QACrB,OAAOI;IACT;IAEA,MAAMC,UAAUD,UAAUE,KAAK,CAAC;IAChC,IAAIC,WAAW;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,IAAI,EAAEnB;oBACpC;gBACF;oBACEoB;YACJ;QACF;QACA,IAAIT,cAAc;YAChBP,OAAOoB,cAAc,CAACZ,eAAe,QAAQD;QAC/C;QACAP,OAAOoB,cAAc,CAAClB,SAASP,YAAY;YACzCU,OAAOG;QACT;IACF;AACF;AAEA,SAASK,iBAEPJ,YAAsC,EACtCY,MAAS,EACT1B,UAAsC,EACtCC,IAAmB;IAEnB,IAAIa,CAAAA,gCAAAA,aAAc7C,GAAG,MAAK,MAAM;QAC9B,OAAOyD,OAAON,KAAK,CAAC,IAAI,EAAErB,oBAAoBC,YAAYC;IAC5D,OAAO;QACL,OAAO/B,oBAAoByD,GAAG,CAC5BC,cACAF,OAAOG,IAAI,CAAC,IAAI,KAAK9B,oBAAoBC,YAAYC;IAEzD;AACF;AAEA,MAAM2B,eAAe;IAAE3D,KAAK;AAAK;AAEjCkC,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB;AACnBA,mBAAmB","ignoreList":[0]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unlike most files in the node-environment-extensions folder this one is not
|
|
3
|
+
* an extension itself but it exposes a function to install config based global
|
|
4
|
+
* behaviors that should be loaded whenever a Node Server or Node Worker are created.
|
|
5
|
+
*/ import { InvariantError } from '../../shared/lib/invariant-error';
|
|
6
|
+
import { setAbortedLogsStyle } from './console-dim.external';
|
|
7
|
+
export function installGlobalBehaviors(config) {
|
|
8
|
+
var _config_experimental;
|
|
9
|
+
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
10
|
+
throw Object.defineProperty(new InvariantError('Expected not to install Node.js global behaviors in the edge runtime.'), "__NEXT_ERROR_CODE", {
|
|
11
|
+
value: "E874",
|
|
12
|
+
enumerable: false,
|
|
13
|
+
configurable: true
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (((_config_experimental = config.experimental) == null ? void 0 : _config_experimental.hideLogsAfterAbort) === true) {
|
|
17
|
+
setAbortedLogsStyle('hidden');
|
|
18
|
+
} else {
|
|
19
|
+
setAbortedLogsStyle('dimmed');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=global-behaviors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/server/node-environment-extensions/global-behaviors.tsx"],"sourcesContent":["/**\n * Unlike most files in the node-environment-extensions folder this one is not\n * an extension itself but it exposes a function to install config based global\n * behaviors that should be loaded whenever a Node Server or Node Worker are created.\n */\nimport type { NextConfigComplete } from '../config-shared'\nimport { InvariantError } from '../../shared/lib/invariant-error'\n\nimport { setAbortedLogsStyle } from './console-dim.external'\n\nexport function installGlobalBehaviors(config: NextConfigComplete) {\n if (process.env.NEXT_RUNTIME === 'edge') {\n throw new InvariantError(\n 'Expected not to install Node.js global behaviors in the edge runtime.'\n )\n }\n\n if (config.experimental?.hideLogsAfterAbort === true) {\n setAbortedLogsStyle('hidden')\n } else {\n setAbortedLogsStyle('dimmed')\n }\n}\n"],"names":["InvariantError","setAbortedLogsStyle","installGlobalBehaviors","config","process","env","NEXT_RUNTIME","experimental","hideLogsAfterAbort"],"mappings":"AAAA;;;;CAIC,GAED,SAASA,cAAc,QAAQ,mCAAkC;AAEjE,SAASC,mBAAmB,QAAQ,yBAAwB;AAE5D,OAAO,SAASC,uBAAuBC,MAA0B;QAO3DA;IANJ,IAAIC,QAAQC,GAAG,CAACC,YAAY,KAAK,QAAQ;QACvC,MAAM,qBAEL,CAFK,IAAIN,eACR,0EADI,qBAAA;mBAAA;wBAAA;0BAAA;QAEN;IACF;IAEA,IAAIG,EAAAA,uBAAAA,OAAOI,YAAY,qBAAnBJ,qBAAqBK,kBAAkB,MAAK,MAAM;QACpDP,oBAAoB;IACtB,OAAO;QACLA,oBAAoB;IACtB;AACF","ignoreList":[0]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function isStableBuild() {
|
|
2
|
-
return !"16.0.0-canary.
|
|
2
|
+
return !"16.0.0-canary.1"?.includes('canary') && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
|
|
3
3
|
}
|
|
4
4
|
export class CanaryOnlyConfigError extends Error {
|
|
5
5
|
constructor(arg){
|
package/dist/export/worker.js
CHANGED
|
@@ -36,6 +36,7 @@ const _needsexperimentalreact = require("../lib/needs-experimental-react");
|
|
|
36
36
|
const _staticgenerationbailout = require("../client/components/static-generation-bailout");
|
|
37
37
|
const _multifilewriter = require("../lib/multi-file-writer");
|
|
38
38
|
const _resumedatacache = require("../server/resume-data-cache/resume-data-cache");
|
|
39
|
+
const _globalbehaviors = require("../server/node-environment-extensions/global-behaviors");
|
|
39
40
|
function _interop_require_default(obj) {
|
|
40
41
|
return obj && obj.__esModule ? obj : {
|
|
41
42
|
default: obj
|
|
@@ -203,6 +204,7 @@ async function exportPageImpl(input, fileWriter) {
|
|
|
203
204
|
}
|
|
204
205
|
async function exportPages(input) {
|
|
205
206
|
const { exportPaths, dir, distDir, outDir, cacheHandler, cacheMaxMemorySize, fetchCacheKeyPrefix, pagesDataDir, renderOpts, nextConfig, options, renderResumeDataCachesByPage = {} } = input;
|
|
207
|
+
(0, _globalbehaviors.installGlobalBehaviors)(nextConfig);
|
|
206
208
|
if (nextConfig.experimental.enablePrerenderSourceMaps) {
|
|
207
209
|
try {
|
|
208
210
|
// Same as `next dev`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/export/worker.ts"],"sourcesContent":["import type {\n ExportPagesInput,\n ExportPageInput,\n ExportPageResult,\n ExportRouteResult,\n WorkerRenderOpts,\n ExportPagesResult,\n ExportPathEntry,\n} from './types'\n\nimport '../server/node-environment'\n\nprocess.env.NEXT_IS_EXPORT_WORKER = 'true'\n\nimport { extname, join, dirname, sep } from 'path'\nimport fs from 'fs/promises'\nimport { loadComponents } from '../server/load-components'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport { trace } from '../trace'\nimport { setHttpClientAndAgentOptions } from '../server/setup-http-agent-env'\nimport { addRequestMeta } from '../server/request-meta'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\n\nimport { createRequestResponseMocks } from '../server/lib/mock-request'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { hasNextSupport } from '../server/ci-info'\nimport { exportAppRoute } from './routes/app-route'\nimport { exportAppPage } from './routes/app-page'\nimport { exportPagesPage } from './routes/pages'\nimport { getParams } from './helpers/get-params'\nimport { createIncrementalCache } from './helpers/create-incremental-cache'\nimport { isPostpone } from '../server/lib/router-utils/is-postpone'\nimport { isDynamicUsageError } from './helpers/is-dynamic-usage-error'\nimport { isBailoutToCSRError } from '../shared/lib/lazy-dynamic/bailout-to-csr'\nimport {\n turborepoTraceAccess,\n TurborepoAccessTraceResult,\n} from '../build/turborepo-access-trace'\nimport type { Params } from '../server/request/params'\nimport {\n createOpaqueFallbackRouteParams,\n type OpaqueFallbackRouteParams,\n} from '../server/request/fallback-params'\nimport { needsExperimentalReact } from '../lib/needs-experimental-react'\nimport type { AppRouteRouteModule } from '../server/route-modules/app-route/module.compiled'\nimport { isStaticGenBailoutError } from '../client/components/static-generation-bailout'\nimport type { PagesRenderContext, PagesSharedContext } from '../server/render'\nimport type { AppSharedContext } from '../server/app-render/app-render'\nimport { MultiFileWriter } from '../lib/multi-file-writer'\nimport { createRenderResumeDataCache } from '../server/resume-data-cache/resume-data-cache'\n;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n}\n\nclass TimeoutError extends Error {\n code = 'NEXT_EXPORT_TIMEOUT_ERROR'\n}\n\nclass ExportPageError extends Error {\n code = 'NEXT_EXPORT_PAGE_ERROR'\n}\n\nasync function exportPageImpl(\n input: ExportPageInput,\n fileWriter: MultiFileWriter\n): Promise<ExportRouteResult | undefined> {\n const {\n exportPath,\n distDir,\n pagesDataDir,\n buildExport = false,\n subFolders = false,\n optimizeCss,\n disableOptimizedLoading,\n debugOutput = false,\n enableExperimentalReact,\n trailingSlash,\n sriEnabled,\n renderOpts: commonRenderOpts,\n outDir: commonOutDir,\n buildId,\n renderResumeDataCache,\n } = input\n\n if (enableExperimentalReact) {\n process.env.__NEXT_EXPERIMENTAL_REACT = 'true'\n }\n\n const {\n path,\n page,\n\n // The parameters that are currently unknown.\n _fallbackRouteParams = [],\n\n // Check if this is an `app/` page.\n _isAppDir: isAppDir = false,\n\n // Check if this should error when dynamic usage is detected.\n _isDynamicError: isDynamicError = false,\n\n // If this page supports partial prerendering, then we need to pass that to\n // the renderOpts.\n _isRoutePPREnabled: isRoutePPREnabled,\n\n // Configure the rendering of the page to allow that an empty static shell\n // is generated while rendering using PPR and Cache Components.\n _allowEmptyStaticShell: allowEmptyStaticShell = false,\n\n // Pull the original query out.\n query: originalQuery = {},\n } = exportPath\n\n const fallbackRouteParams: OpaqueFallbackRouteParams | null =\n createOpaqueFallbackRouteParams(_fallbackRouteParams)\n\n let query = { ...originalQuery }\n const pathname = normalizeAppPath(page)\n const isDynamic = isDynamicRoute(page)\n const outDir = isAppDir ? join(distDir, 'server/app') : commonOutDir\n\n const filePath = normalizePagePath(path)\n\n let updatedPath = exportPath._ssgPath || path\n let locale = exportPath._locale || commonRenderOpts.locale\n\n if (commonRenderOpts.locale) {\n const localePathResult = normalizeLocalePath(path, commonRenderOpts.locales)\n\n if (localePathResult.detectedLocale) {\n updatedPath = localePathResult.pathname\n locale = localePathResult.detectedLocale\n }\n }\n\n // We need to show a warning if they try to provide query values\n // for an auto-exported page since they won't be available\n const hasOrigQueryValues = Object.keys(originalQuery).length > 0\n\n // Check if the page is a specified dynamic route\n const { pathname: nonLocalizedPath } = normalizeLocalePath(\n path,\n commonRenderOpts.locales\n )\n\n let params: Params | undefined\n\n if (isDynamic && page !== nonLocalizedPath) {\n const normalizedPage = isAppDir ? normalizeAppPath(page) : page\n\n params = getParams(normalizedPage, updatedPath)\n }\n\n const { req, res } = createRequestResponseMocks({ url: updatedPath })\n\n // If this is a status code page, then set the response code.\n for (const statusCode of [404, 500]) {\n if (\n [\n `/${statusCode}`,\n `/${statusCode}.html`,\n `/${statusCode}/index.html`,\n ].some((p) => p === updatedPath || `/${locale}${p}` === updatedPath)\n ) {\n res.statusCode = statusCode\n }\n }\n\n // Ensure that the URL has a trailing slash if it's configured.\n if (trailingSlash && !req.url?.endsWith('/')) {\n req.url += '/'\n }\n\n if (\n locale &&\n buildExport &&\n commonRenderOpts.domainLocales &&\n commonRenderOpts.domainLocales.some(\n (dl) => dl.defaultLocale === locale || dl.locales?.includes(locale || '')\n )\n ) {\n addRequestMeta(req, 'isLocaleDomain', true)\n }\n\n const getHtmlFilename = (p: string) =>\n subFolders ? `${p}${sep}index.html` : `${p}.html`\n\n let htmlFilename = getHtmlFilename(filePath)\n\n // dynamic routes can provide invalid extensions e.g. /blog/[...slug] returns an\n // extension of `.slug]`\n const pageExt = isDynamic || isAppDir ? '' : extname(page)\n const pathExt = isDynamic || isAppDir ? '' : extname(path)\n\n // force output 404.html for backwards compat\n if (path === '/404.html') {\n htmlFilename = path\n }\n // Make sure page isn't a folder with a dot in the name e.g. `v1.2`\n else if (pageExt !== pathExt && pathExt !== '') {\n const isBuiltinPaths = ['/500', '/404'].some(\n (p) => p === path || p === path + '.html'\n )\n // If the ssg path has .html extension, and it's not builtin paths, use it directly\n // Otherwise, use that as the filename instead\n const isHtmlExtPath = !isBuiltinPaths && path.endsWith('.html')\n htmlFilename = isHtmlExtPath ? getHtmlFilename(path) : path\n } else if (path === '/') {\n // If the path is the root, just use index.html\n htmlFilename = 'index.html'\n }\n\n const baseDir = join(outDir, dirname(htmlFilename))\n let htmlFilepath = join(outDir, htmlFilename)\n\n await fs.mkdir(baseDir, { recursive: true })\n\n const components = await loadComponents({\n distDir,\n page,\n isAppPath: isAppDir,\n isDev: false,\n sriEnabled,\n needsManifestsForLegacyReasons: true,\n })\n\n // Handle App Routes.\n if (isAppDir && isAppRouteRoute(page)) {\n return exportAppRoute(\n req,\n res,\n params,\n page,\n components.routeModule as AppRouteRouteModule,\n commonRenderOpts.incrementalCache,\n commonRenderOpts.cacheLifeProfiles,\n htmlFilepath,\n fileWriter,\n commonRenderOpts.experimental,\n buildId\n )\n }\n\n const renderOpts: WorkerRenderOpts = {\n ...components,\n ...commonRenderOpts,\n params,\n optimizeCss,\n disableOptimizedLoading,\n locale,\n supportsDynamicResponse: false,\n // During the export phase in next build, we always enable the streaming metadata since if there's\n // any dynamic access in metadata we can determine it in the build phase.\n // If it's static, then it won't affect anything.\n // If it's dynamic, then it can be handled when request hits the route.\n serveStreamingMetadata: true,\n allowEmptyStaticShell,\n experimental: {\n ...commonRenderOpts.experimental,\n isRoutePPREnabled,\n },\n renderResumeDataCache,\n }\n\n // Handle App Pages\n if (isAppDir) {\n const sharedContext: AppSharedContext = { buildId }\n\n return exportAppPage(\n req,\n res,\n page,\n path,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts,\n htmlFilepath,\n debugOutput,\n isDynamicError,\n fileWriter,\n sharedContext\n )\n }\n\n const sharedContext: PagesSharedContext = {\n buildId,\n deploymentId: commonRenderOpts.deploymentId,\n customServer: undefined,\n }\n\n const renderContext: PagesRenderContext = {\n isFallback: exportPath._pagesFallback ?? false,\n isDraftMode: false,\n developmentNotFoundSourcePage: undefined,\n }\n\n return exportPagesPage(\n req,\n res,\n path,\n page,\n query,\n params,\n htmlFilepath,\n htmlFilename,\n pagesDataDir,\n buildExport,\n isDynamic,\n sharedContext,\n renderContext,\n hasOrigQueryValues,\n renderOpts,\n components,\n fileWriter\n )\n}\n\nexport async function exportPages(\n input: ExportPagesInput\n): Promise<ExportPagesResult> {\n const {\n exportPaths,\n dir,\n distDir,\n outDir,\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n pagesDataDir,\n renderOpts,\n nextConfig,\n options,\n renderResumeDataCachesByPage = {},\n } = input\n\n if (nextConfig.experimental.enablePrerenderSourceMaps) {\n try {\n // Same as `next dev`\n // Limiting the stack trace to a useful amount of frames is handled by ignore-listing.\n // TODO: How high can we go without severely impacting CPU/memory?\n Error.stackTraceLimit = 50\n } catch {}\n }\n\n // If the fetch cache was enabled, we need to create an incremental\n // cache instance for this page.\n const incrementalCache = await createIncrementalCache({\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n distDir,\n dir,\n // skip writing to disk in minimal mode for now, pending some\n // changes to better support it\n flushToDisk: !hasNextSupport,\n cacheHandlers: nextConfig.experimental.cacheHandlers,\n })\n\n renderOpts.incrementalCache = incrementalCache\n\n const maxConcurrency =\n nextConfig.experimental.staticGenerationMaxConcurrency ?? 8\n const results: ExportPagesResult = []\n\n const exportPageWithRetry = async (\n exportPath: ExportPathEntry,\n maxAttempts: number\n ) => {\n const { page, path } = exportPath\n const pageKey = page !== path ? `${page}: ${path}` : path\n let attempt = 0\n let result\n\n const hasDebuggerAttached =\n // Also tests for `inspect-brk`\n process.env.NODE_OPTIONS?.includes('--inspect')\n\n const renderResumeDataCache = renderResumeDataCachesByPage[page]\n ? createRenderResumeDataCache(renderResumeDataCachesByPage[page])\n : undefined\n\n while (attempt < maxAttempts) {\n try {\n result = await Promise.race<ExportPageResult | undefined>([\n exportPage({\n exportPath,\n distDir,\n outDir,\n pagesDataDir,\n renderOpts,\n trailingSlash: nextConfig.trailingSlash,\n subFolders: nextConfig.trailingSlash && !options.buildExport,\n buildExport: options.buildExport,\n optimizeCss: nextConfig.experimental.optimizeCss,\n disableOptimizedLoading:\n nextConfig.experimental.disableOptimizedLoading,\n parentSpanId: input.parentSpanId,\n httpAgentOptions: nextConfig.httpAgentOptions,\n debugOutput: options.debugOutput,\n enableExperimentalReact: needsExperimentalReact(nextConfig),\n sriEnabled: Boolean(nextConfig.experimental.sri?.algorithm),\n buildId: input.buildId,\n renderResumeDataCache,\n }),\n hasDebuggerAttached\n ? // With a debugger attached, exporting can take infinitely if we paused script execution.\n new Promise(() => {})\n : // If exporting the page takes longer than the timeout, reject the promise.\n new Promise((_, reject) => {\n setTimeout(() => {\n reject(new TimeoutError())\n }, nextConfig.staticPageGenerationTimeout * 1000)\n }),\n ])\n\n // If there was an error in the export, throw it immediately. In the catch block, we might retry the export,\n // or immediately fail the build, depending on user configuration. We might also continue on and attempt other pages.\n if (result && 'error' in result) {\n throw new ExportPageError()\n }\n\n // If the export succeeds, break out of the retry loop\n break\n } catch (err) {\n // The only error that should be caught here is an ExportError, as `exportPage` doesn't throw and instead returns an object with an `error` property.\n // This is an overly cautious check to ensure that we don't accidentally catch an unexpected error.\n if (!(err instanceof ExportPageError || err instanceof TimeoutError)) {\n throw err\n }\n\n if (err instanceof TimeoutError) {\n // If the export times out, we will restart the worker up to 3 times.\n maxAttempts = 3\n }\n\n // We've reached the maximum number of attempts\n if (attempt >= maxAttempts - 1) {\n // Log a message if we've reached the maximum number of attempts.\n // We only care to do this if maxAttempts was configured.\n if (maxAttempts > 1) {\n console.info(\n `Failed to build ${pageKey} after ${maxAttempts} attempts.`\n )\n }\n // If prerenderEarlyExit is enabled, we'll exit the build immediately.\n if (nextConfig.experimental.prerenderEarlyExit) {\n console.error(\n `Export encountered an error on ${pageKey}, exiting the build.`\n )\n process.exit(1)\n } else {\n // Otherwise, this is a no-op. The build will continue, and a summary of failed pages will be displayed at the end.\n }\n } else {\n // Otherwise, we have more attempts to make. Wait before retrying\n if (err instanceof TimeoutError) {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}) because it took more than ${nextConfig.staticPageGenerationTimeout} seconds. Retrying again shortly.`\n )\n } else {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}). Retrying again shortly.`\n )\n }\n\n // Exponential backoff with random jitter to avoid thundering herd on retries\n const baseDelay = 500 // 500ms\n const maxDelay = 2000 // 2 seconds\n const delay = Math.min(baseDelay * Math.pow(2, attempt), maxDelay)\n const jitter = Math.random() * 0.3 * delay // Add up to 30% random jitter\n await new Promise((r) => setTimeout(r, delay + jitter))\n }\n }\n\n attempt++\n }\n\n return { result, path, page, pageKey }\n }\n\n for (let i = 0; i < exportPaths.length; i += maxConcurrency) {\n const subset = exportPaths.slice(i, i + maxConcurrency)\n\n const subsetResults = await Promise.all(\n subset.map((exportPath) =>\n exportPageWithRetry(\n exportPath,\n nextConfig.experimental.staticGenerationRetryCount ?? 1\n )\n )\n )\n\n results.push(...subsetResults)\n }\n\n return results\n}\n\nasync function exportPage(\n input: ExportPageInput\n): Promise<ExportPageResult | undefined> {\n trace('export-page', input.parentSpanId).setAttribute(\n 'path',\n input.exportPath.path\n )\n\n // Configure the http agent.\n setHttpClientAndAgentOptions({\n httpAgentOptions: input.httpAgentOptions,\n })\n\n const fileWriter = new MultiFileWriter({\n writeFile: (filePath, data) => fs.writeFile(filePath, data),\n mkdir: (dir) => fs.mkdir(dir, { recursive: true }),\n })\n\n const exportPageSpan = trace('export-page-worker', input.parentSpanId)\n\n const start = Date.now()\n\n const turborepoAccessTraceResult = new TurborepoAccessTraceResult()\n\n // Export the page.\n let result: ExportRouteResult | undefined\n try {\n result = await exportPageSpan.traceAsyncFn(() =>\n turborepoTraceAccess(\n () => exportPageImpl(input, fileWriter),\n turborepoAccessTraceResult\n )\n )\n\n // Wait for all the files to flush to disk.\n await fileWriter.wait()\n\n // If there was no result, then we can exit early.\n if (!result) return\n\n // If there was an error, then we can exit early.\n if ('error' in result) {\n return { error: result.error, duration: Date.now() - start }\n }\n } catch (err) {\n console.error(\n `Error occurred prerendering page \"${input.exportPath.path}\". Read more: https://nextjs.org/docs/messages/prerender-error`\n )\n\n // bailoutToCSRError errors should not leak to the user as they are not actionable; they're\n // a framework signal\n if (!isBailoutToCSRError(err)) {\n // A static generation bailout error is a framework signal to fail static generation but\n // and will encode a reason in the error message. If there is a message, we'll print it.\n // Otherwise there's nothing to show as we don't want to leak an error internal error stack to the user.\n // TODO: Always log the full error. ignore-listing will take care of hiding internal stacks.\n if (isStaticGenBailoutError(err)) {\n if (err.message) {\n console.error(`Error: ${err.message}`)\n }\n } else {\n console.error(err)\n }\n }\n\n return { error: true, duration: Date.now() - start }\n }\n\n // Notify the parent process that we processed a page (used by the progress activity indicator)\n process.send?.([3, { type: 'activity' }])\n\n // Otherwise we can return the result.\n return {\n ...result,\n duration: Date.now() - start,\n turborepoAccessTraceResult: turborepoAccessTraceResult.serialize(),\n }\n}\n\nprocess.on('unhandledRejection', (err: unknown) => {\n // if it's a postpone error, it'll be handled later\n // when the postponed promise is actually awaited.\n if (isPostpone(err)) {\n return\n }\n\n // we don't want to log these errors\n if (isDynamicUsageError(err)) {\n return\n }\n\n console.error(err)\n})\n\nprocess.on('rejectionHandled', () => {\n // It is ok to await a Promise late in Next.js as it allows for better\n // prefetching patterns to avoid waterfalls. We ignore logging these.\n // We should've already errored in anyway unhandledRejection.\n})\n\nconst FATAL_UNHANDLED_NEXT_API_EXIT_CODE = 78\n\nprocess.on('uncaughtException', (err) => {\n if (isDynamicUsageError(err)) {\n console.error(\n 'A Next.js API that uses exceptions to signal framework behavior was uncaught. This suggests improper usage of a Next.js API. The original error is printed below and the build will now exit.'\n )\n console.error(err)\n process.exit(FATAL_UNHANDLED_NEXT_API_EXIT_CODE)\n } else {\n console.error(err)\n }\n})\n"],"names":["exportPages","process","env","NEXT_IS_EXPORT_WORKER","globalThis","__NEXT_DATA__","nextExport","TimeoutError","Error","code","ExportPageError","exportPageImpl","input","fileWriter","req","exportPath","distDir","pagesDataDir","buildExport","subFolders","optimizeCss","disableOptimizedLoading","debugOutput","enableExperimentalReact","trailingSlash","sriEnabled","renderOpts","commonRenderOpts","outDir","commonOutDir","buildId","renderResumeDataCache","__NEXT_EXPERIMENTAL_REACT","path","page","_fallbackRouteParams","_isAppDir","isAppDir","_isDynamicError","isDynamicError","_isRoutePPREnabled","isRoutePPREnabled","_allowEmptyStaticShell","allowEmptyStaticShell","query","originalQuery","fallbackRouteParams","createOpaqueFallbackRouteParams","pathname","normalizeAppPath","isDynamic","isDynamicRoute","join","filePath","normalizePagePath","updatedPath","_ssgPath","locale","_locale","localePathResult","normalizeLocalePath","locales","detectedLocale","hasOrigQueryValues","Object","keys","length","nonLocalizedPath","params","normalizedPage","getParams","res","createRequestResponseMocks","url","statusCode","some","p","endsWith","domainLocales","dl","defaultLocale","includes","addRequestMeta","getHtmlFilename","sep","htmlFilename","pageExt","extname","pathExt","isBuiltinPaths","isHtmlExtPath","baseDir","dirname","htmlFilepath","fs","mkdir","recursive","components","loadComponents","isAppPath","isDev","needsManifestsForLegacyReasons","isAppRouteRoute","exportAppRoute","routeModule","incrementalCache","cacheLifeProfiles","experimental","supportsDynamicResponse","serveStreamingMetadata","sharedContext","exportAppPage","deploymentId","customServer","undefined","renderContext","isFallback","_pagesFallback","isDraftMode","developmentNotFoundSourcePage","exportPagesPage","exportPaths","dir","cacheHandler","cacheMaxMemorySize","fetchCacheKeyPrefix","nextConfig","options","renderResumeDataCachesByPage","enablePrerenderSourceMaps","stackTraceLimit","createIncrementalCache","flushToDisk","hasNextSupport","cacheHandlers","maxConcurrency","staticGenerationMaxConcurrency","results","exportPageWithRetry","maxAttempts","pageKey","attempt","result","hasDebuggerAttached","NODE_OPTIONS","createRenderResumeDataCache","Promise","race","exportPage","parentSpanId","httpAgentOptions","needsExperimentalReact","Boolean","sri","algorithm","_","reject","setTimeout","staticPageGenerationTimeout","err","console","info","prerenderEarlyExit","error","exit","baseDelay","maxDelay","delay","Math","min","pow","jitter","random","r","i","subset","slice","subsetResults","all","map","staticGenerationRetryCount","push","trace","setAttribute","setHttpClientAndAgentOptions","MultiFileWriter","writeFile","data","exportPageSpan","start","Date","now","turborepoAccessTraceResult","TurborepoAccessTraceResult","traceAsyncFn","turborepoTraceAccess","wait","duration","isBailoutToCSRError","isStaticGenBailoutError","message","send","type","serialize","on","isPostpone","isDynamicUsageError","FATAL_UNHANDLED_NEXT_API_EXIT_CODE"],"mappings":";;;;+BAgUsBA;;;eAAAA;;;QAtTf;sBAIqC;iEAC7B;gCACgB;2BACA;mCACG;qCACE;uBACd;mCACuB;6BACd;0BACE;6BAEU;iCACX;wBACD;0BACA;yBACD;uBACE;2BACN;wCACa;4BACZ;qCACS;8BACA;sCAI7B;gCAKA;wCACgC;yCAEC;iCAGR;iCACY;;;;;;AAvC5CC,QAAQC,GAAG,CAACC,qBAAqB,GAAG;AAwClCC,WAAmBC,aAAa,GAAG;IACnCC,YAAY;AACd;AAEA,MAAMC,qBAAqBC;;QAA3B,qBACEC,OAAO;;AACT;AAEA,MAAMC,wBAAwBF;;QAA9B,qBACEC,OAAO;;AACT;AAEA,eAAeE,eACbC,KAAsB,EACtBC,UAA2B;QAyGLC;IAvGtB,MAAM,EACJC,UAAU,EACVC,OAAO,EACPC,YAAY,EACZC,cAAc,KAAK,EACnBC,aAAa,KAAK,EAClBC,WAAW,EACXC,uBAAuB,EACvBC,cAAc,KAAK,EACnBC,uBAAuB,EACvBC,aAAa,EACbC,UAAU,EACVC,YAAYC,gBAAgB,EAC5BC,QAAQC,YAAY,EACpBC,OAAO,EACPC,qBAAqB,EACtB,GAAGnB;IAEJ,IAAIW,yBAAyB;QAC3BtB,QAAQC,GAAG,CAAC8B,yBAAyB,GAAG;IAC1C;IAEA,MAAM,EACJC,IAAI,EACJC,IAAI,EAEJ,6CAA6C;IAC7CC,uBAAuB,EAAE,EAEzB,mCAAmC;IACnCC,WAAWC,WAAW,KAAK,EAE3B,6DAA6D;IAC7DC,iBAAiBC,iBAAiB,KAAK,EAEvC,2EAA2E;IAC3E,kBAAkB;IAClBC,oBAAoBC,iBAAiB,EAErC,0EAA0E;IAC1E,+DAA+D;IAC/DC,wBAAwBC,wBAAwB,KAAK,EAErD,+BAA+B;IAC/BC,OAAOC,gBAAgB,CAAC,CAAC,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QG,KAAK,CAACJ;QACd9J,QAAQmK,IAAI,CAAC2C;IACf,OAAO;QACL/C,QAAQG,KAAK,CAACJ;IAChB;AACF","ignoreList":[0]}
|
|
1
|
+
{"version":3,"sources":["../../src/export/worker.ts"],"sourcesContent":["import type {\n ExportPagesInput,\n ExportPageInput,\n ExportPageResult,\n ExportRouteResult,\n WorkerRenderOpts,\n ExportPagesResult,\n ExportPathEntry,\n} from './types'\n\nimport '../server/node-environment'\n\nprocess.env.NEXT_IS_EXPORT_WORKER = 'true'\n\nimport { extname, join, dirname, sep } from 'path'\nimport fs from 'fs/promises'\nimport { loadComponents } from '../server/load-components'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport { trace } from '../trace'\nimport { setHttpClientAndAgentOptions } from '../server/setup-http-agent-env'\nimport { addRequestMeta } from '../server/request-meta'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\n\nimport { createRequestResponseMocks } from '../server/lib/mock-request'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { hasNextSupport } from '../server/ci-info'\nimport { exportAppRoute } from './routes/app-route'\nimport { exportAppPage } from './routes/app-page'\nimport { exportPagesPage } from './routes/pages'\nimport { getParams } from './helpers/get-params'\nimport { createIncrementalCache } from './helpers/create-incremental-cache'\nimport { isPostpone } from '../server/lib/router-utils/is-postpone'\nimport { isDynamicUsageError } from './helpers/is-dynamic-usage-error'\nimport { isBailoutToCSRError } from '../shared/lib/lazy-dynamic/bailout-to-csr'\nimport {\n turborepoTraceAccess,\n TurborepoAccessTraceResult,\n} from '../build/turborepo-access-trace'\nimport type { Params } from '../server/request/params'\nimport {\n createOpaqueFallbackRouteParams,\n type OpaqueFallbackRouteParams,\n} from '../server/request/fallback-params'\nimport { needsExperimentalReact } from '../lib/needs-experimental-react'\nimport type { AppRouteRouteModule } from '../server/route-modules/app-route/module.compiled'\nimport { isStaticGenBailoutError } from '../client/components/static-generation-bailout'\nimport type { PagesRenderContext, PagesSharedContext } from '../server/render'\nimport type { AppSharedContext } from '../server/app-render/app-render'\nimport { MultiFileWriter } from '../lib/multi-file-writer'\nimport { createRenderResumeDataCache } from '../server/resume-data-cache/resume-data-cache'\nimport { installGlobalBehaviors } from '../server/node-environment-extensions/global-behaviors'\n;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n}\n\nclass TimeoutError extends Error {\n code = 'NEXT_EXPORT_TIMEOUT_ERROR'\n}\n\nclass ExportPageError extends Error {\n code = 'NEXT_EXPORT_PAGE_ERROR'\n}\n\nasync function exportPageImpl(\n input: ExportPageInput,\n fileWriter: MultiFileWriter\n): Promise<ExportRouteResult | undefined> {\n const {\n exportPath,\n distDir,\n pagesDataDir,\n buildExport = false,\n subFolders = false,\n optimizeCss,\n disableOptimizedLoading,\n debugOutput = false,\n enableExperimentalReact,\n trailingSlash,\n sriEnabled,\n renderOpts: commonRenderOpts,\n outDir: commonOutDir,\n buildId,\n renderResumeDataCache,\n } = input\n\n if (enableExperimentalReact) {\n process.env.__NEXT_EXPERIMENTAL_REACT = 'true'\n }\n\n const {\n path,\n page,\n\n // The parameters that are currently unknown.\n _fallbackRouteParams = [],\n\n // Check if this is an `app/` page.\n _isAppDir: isAppDir = false,\n\n // Check if this should error when dynamic usage is detected.\n _isDynamicError: isDynamicError = false,\n\n // If this page supports partial prerendering, then we need to pass that to\n // the renderOpts.\n _isRoutePPREnabled: isRoutePPREnabled,\n\n // Configure the rendering of the page to allow that an empty static shell\n // is generated while rendering using PPR and Cache Components.\n _allowEmptyStaticShell: allowEmptyStaticShell = false,\n\n // Pull the original query out.\n query: originalQuery = {},\n } = exportPath\n\n const fallbackRouteParams: OpaqueFallbackRouteParams | null =\n createOpaqueFallbackRouteParams(_fallbackRouteParams)\n\n let query = { ...originalQuery }\n const pathname = normalizeAppPath(page)\n const isDynamic = isDynamicRoute(page)\n const outDir = isAppDir ? join(distDir, 'server/app') : commonOutDir\n\n const filePath = normalizePagePath(path)\n\n let updatedPath = exportPath._ssgPath || path\n let locale = exportPath._locale || commonRenderOpts.locale\n\n if (commonRenderOpts.locale) {\n const localePathResult = normalizeLocalePath(path, commonRenderOpts.locales)\n\n if (localePathResult.detectedLocale) {\n updatedPath = localePathResult.pathname\n locale = localePathResult.detectedLocale\n }\n }\n\n // We need to show a warning if they try to provide query values\n // for an auto-exported page since they won't be available\n const hasOrigQueryValues = Object.keys(originalQuery).length > 0\n\n // Check if the page is a specified dynamic route\n const { pathname: nonLocalizedPath } = normalizeLocalePath(\n path,\n commonRenderOpts.locales\n )\n\n let params: Params | undefined\n\n if (isDynamic && page !== nonLocalizedPath) {\n const normalizedPage = isAppDir ? normalizeAppPath(page) : page\n\n params = getParams(normalizedPage, updatedPath)\n }\n\n const { req, res } = createRequestResponseMocks({ url: updatedPath })\n\n // If this is a status code page, then set the response code.\n for (const statusCode of [404, 500]) {\n if (\n [\n `/${statusCode}`,\n `/${statusCode}.html`,\n `/${statusCode}/index.html`,\n ].some((p) => p === updatedPath || `/${locale}${p}` === updatedPath)\n ) {\n res.statusCode = statusCode\n }\n }\n\n // Ensure that the URL has a trailing slash if it's configured.\n if (trailingSlash && !req.url?.endsWith('/')) {\n req.url += '/'\n }\n\n if (\n locale &&\n buildExport &&\n commonRenderOpts.domainLocales &&\n commonRenderOpts.domainLocales.some(\n (dl) => dl.defaultLocale === locale || dl.locales?.includes(locale || '')\n )\n ) {\n addRequestMeta(req, 'isLocaleDomain', true)\n }\n\n const getHtmlFilename = (p: string) =>\n subFolders ? `${p}${sep}index.html` : `${p}.html`\n\n let htmlFilename = getHtmlFilename(filePath)\n\n // dynamic routes can provide invalid extensions e.g. /blog/[...slug] returns an\n // extension of `.slug]`\n const pageExt = isDynamic || isAppDir ? '' : extname(page)\n const pathExt = isDynamic || isAppDir ? '' : extname(path)\n\n // force output 404.html for backwards compat\n if (path === '/404.html') {\n htmlFilename = path\n }\n // Make sure page isn't a folder with a dot in the name e.g. `v1.2`\n else if (pageExt !== pathExt && pathExt !== '') {\n const isBuiltinPaths = ['/500', '/404'].some(\n (p) => p === path || p === path + '.html'\n )\n // If the ssg path has .html extension, and it's not builtin paths, use it directly\n // Otherwise, use that as the filename instead\n const isHtmlExtPath = !isBuiltinPaths && path.endsWith('.html')\n htmlFilename = isHtmlExtPath ? getHtmlFilename(path) : path\n } else if (path === '/') {\n // If the path is the root, just use index.html\n htmlFilename = 'index.html'\n }\n\n const baseDir = join(outDir, dirname(htmlFilename))\n let htmlFilepath = join(outDir, htmlFilename)\n\n await fs.mkdir(baseDir, { recursive: true })\n\n const components = await loadComponents({\n distDir,\n page,\n isAppPath: isAppDir,\n isDev: false,\n sriEnabled,\n needsManifestsForLegacyReasons: true,\n })\n\n // Handle App Routes.\n if (isAppDir && isAppRouteRoute(page)) {\n return exportAppRoute(\n req,\n res,\n params,\n page,\n components.routeModule as AppRouteRouteModule,\n commonRenderOpts.incrementalCache,\n commonRenderOpts.cacheLifeProfiles,\n htmlFilepath,\n fileWriter,\n commonRenderOpts.experimental,\n buildId\n )\n }\n\n const renderOpts: WorkerRenderOpts = {\n ...components,\n ...commonRenderOpts,\n params,\n optimizeCss,\n disableOptimizedLoading,\n locale,\n supportsDynamicResponse: false,\n // During the export phase in next build, we always enable the streaming metadata since if there's\n // any dynamic access in metadata we can determine it in the build phase.\n // If it's static, then it won't affect anything.\n // If it's dynamic, then it can be handled when request hits the route.\n serveStreamingMetadata: true,\n allowEmptyStaticShell,\n experimental: {\n ...commonRenderOpts.experimental,\n isRoutePPREnabled,\n },\n renderResumeDataCache,\n }\n\n // Handle App Pages\n if (isAppDir) {\n const sharedContext: AppSharedContext = { buildId }\n\n return exportAppPage(\n req,\n res,\n page,\n path,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts,\n htmlFilepath,\n debugOutput,\n isDynamicError,\n fileWriter,\n sharedContext\n )\n }\n\n const sharedContext: PagesSharedContext = {\n buildId,\n deploymentId: commonRenderOpts.deploymentId,\n customServer: undefined,\n }\n\n const renderContext: PagesRenderContext = {\n isFallback: exportPath._pagesFallback ?? false,\n isDraftMode: false,\n developmentNotFoundSourcePage: undefined,\n }\n\n return exportPagesPage(\n req,\n res,\n path,\n page,\n query,\n params,\n htmlFilepath,\n htmlFilename,\n pagesDataDir,\n buildExport,\n isDynamic,\n sharedContext,\n renderContext,\n hasOrigQueryValues,\n renderOpts,\n components,\n fileWriter\n )\n}\n\nexport async function exportPages(\n input: ExportPagesInput\n): Promise<ExportPagesResult> {\n const {\n exportPaths,\n dir,\n distDir,\n outDir,\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n pagesDataDir,\n renderOpts,\n nextConfig,\n options,\n renderResumeDataCachesByPage = {},\n } = input\n\n installGlobalBehaviors(nextConfig)\n\n if (nextConfig.experimental.enablePrerenderSourceMaps) {\n try {\n // Same as `next dev`\n // Limiting the stack trace to a useful amount of frames is handled by ignore-listing.\n // TODO: How high can we go without severely impacting CPU/memory?\n Error.stackTraceLimit = 50\n } catch {}\n }\n\n // If the fetch cache was enabled, we need to create an incremental\n // cache instance for this page.\n const incrementalCache = await createIncrementalCache({\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n distDir,\n dir,\n // skip writing to disk in minimal mode for now, pending some\n // changes to better support it\n flushToDisk: !hasNextSupport,\n cacheHandlers: nextConfig.experimental.cacheHandlers,\n })\n\n renderOpts.incrementalCache = incrementalCache\n\n const maxConcurrency =\n nextConfig.experimental.staticGenerationMaxConcurrency ?? 8\n const results: ExportPagesResult = []\n\n const exportPageWithRetry = async (\n exportPath: ExportPathEntry,\n maxAttempts: number\n ) => {\n const { page, path } = exportPath\n const pageKey = page !== path ? `${page}: ${path}` : path\n let attempt = 0\n let result\n\n const hasDebuggerAttached =\n // Also tests for `inspect-brk`\n process.env.NODE_OPTIONS?.includes('--inspect')\n\n const renderResumeDataCache = renderResumeDataCachesByPage[page]\n ? createRenderResumeDataCache(renderResumeDataCachesByPage[page])\n : undefined\n\n while (attempt < maxAttempts) {\n try {\n result = await Promise.race<ExportPageResult | undefined>([\n exportPage({\n exportPath,\n distDir,\n outDir,\n pagesDataDir,\n renderOpts,\n trailingSlash: nextConfig.trailingSlash,\n subFolders: nextConfig.trailingSlash && !options.buildExport,\n buildExport: options.buildExport,\n optimizeCss: nextConfig.experimental.optimizeCss,\n disableOptimizedLoading:\n nextConfig.experimental.disableOptimizedLoading,\n parentSpanId: input.parentSpanId,\n httpAgentOptions: nextConfig.httpAgentOptions,\n debugOutput: options.debugOutput,\n enableExperimentalReact: needsExperimentalReact(nextConfig),\n sriEnabled: Boolean(nextConfig.experimental.sri?.algorithm),\n buildId: input.buildId,\n renderResumeDataCache,\n }),\n hasDebuggerAttached\n ? // With a debugger attached, exporting can take infinitely if we paused script execution.\n new Promise(() => {})\n : // If exporting the page takes longer than the timeout, reject the promise.\n new Promise((_, reject) => {\n setTimeout(() => {\n reject(new TimeoutError())\n }, nextConfig.staticPageGenerationTimeout * 1000)\n }),\n ])\n\n // If there was an error in the export, throw it immediately. In the catch block, we might retry the export,\n // or immediately fail the build, depending on user configuration. We might also continue on and attempt other pages.\n if (result && 'error' in result) {\n throw new ExportPageError()\n }\n\n // If the export succeeds, break out of the retry loop\n break\n } catch (err) {\n // The only error that should be caught here is an ExportError, as `exportPage` doesn't throw and instead returns an object with an `error` property.\n // This is an overly cautious check to ensure that we don't accidentally catch an unexpected error.\n if (!(err instanceof ExportPageError || err instanceof TimeoutError)) {\n throw err\n }\n\n if (err instanceof TimeoutError) {\n // If the export times out, we will restart the worker up to 3 times.\n maxAttempts = 3\n }\n\n // We've reached the maximum number of attempts\n if (attempt >= maxAttempts - 1) {\n // Log a message if we've reached the maximum number of attempts.\n // We only care to do this if maxAttempts was configured.\n if (maxAttempts > 1) {\n console.info(\n `Failed to build ${pageKey} after ${maxAttempts} attempts.`\n )\n }\n // If prerenderEarlyExit is enabled, we'll exit the build immediately.\n if (nextConfig.experimental.prerenderEarlyExit) {\n console.error(\n `Export encountered an error on ${pageKey}, exiting the build.`\n )\n process.exit(1)\n } else {\n // Otherwise, this is a no-op. The build will continue, and a summary of failed pages will be displayed at the end.\n }\n } else {\n // Otherwise, we have more attempts to make. Wait before retrying\n if (err instanceof TimeoutError) {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}) because it took more than ${nextConfig.staticPageGenerationTimeout} seconds. Retrying again shortly.`\n )\n } else {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}). Retrying again shortly.`\n )\n }\n\n // Exponential backoff with random jitter to avoid thundering herd on retries\n const baseDelay = 500 // 500ms\n const maxDelay = 2000 // 2 seconds\n const delay = Math.min(baseDelay * Math.pow(2, attempt), maxDelay)\n const jitter = Math.random() * 0.3 * delay // Add up to 30% random jitter\n await new Promise((r) => setTimeout(r, delay + jitter))\n }\n }\n\n attempt++\n }\n\n return { result, path, page, pageKey }\n }\n\n for (let i = 0; i < exportPaths.length; i += maxConcurrency) {\n const subset = exportPaths.slice(i, i + maxConcurrency)\n\n const subsetResults = await Promise.all(\n subset.map((exportPath) =>\n exportPageWithRetry(\n exportPath,\n nextConfig.experimental.staticGenerationRetryCount ?? 1\n )\n )\n )\n\n results.push(...subsetResults)\n }\n\n return results\n}\n\nasync function exportPage(\n input: ExportPageInput\n): Promise<ExportPageResult | undefined> {\n trace('export-page', input.parentSpanId).setAttribute(\n 'path',\n input.exportPath.path\n )\n\n // Configure the http agent.\n setHttpClientAndAgentOptions({\n httpAgentOptions: input.httpAgentOptions,\n })\n\n const fileWriter = new MultiFileWriter({\n writeFile: (filePath, data) => fs.writeFile(filePath, data),\n mkdir: (dir) => fs.mkdir(dir, { recursive: true }),\n })\n\n const exportPageSpan = trace('export-page-worker', input.parentSpanId)\n\n const start = Date.now()\n\n const turborepoAccessTraceResult = new TurborepoAccessTraceResult()\n\n // Export the page.\n let result: ExportRouteResult | undefined\n try {\n result = await exportPageSpan.traceAsyncFn(() =>\n turborepoTraceAccess(\n () => exportPageImpl(input, fileWriter),\n turborepoAccessTraceResult\n )\n )\n\n // Wait for all the files to flush to disk.\n await fileWriter.wait()\n\n // If there was no result, then we can exit early.\n if (!result) return\n\n // If there was an error, then we can exit early.\n if ('error' in result) {\n return { error: result.error, duration: Date.now() - start }\n }\n } catch (err) {\n console.error(\n `Error occurred prerendering page \"${input.exportPath.path}\". Read more: https://nextjs.org/docs/messages/prerender-error`\n )\n\n // bailoutToCSRError errors should not leak to the user as they are not actionable; they're\n // a framework signal\n if (!isBailoutToCSRError(err)) {\n // A static generation bailout error is a framework signal to fail static generation but\n // and will encode a reason in the error message. If there is a message, we'll print it.\n // Otherwise there's nothing to show as we don't want to leak an error internal error stack to the user.\n // TODO: Always log the full error. ignore-listing will take care of hiding internal stacks.\n if (isStaticGenBailoutError(err)) {\n if (err.message) {\n console.error(`Error: ${err.message}`)\n }\n } else {\n console.error(err)\n }\n }\n\n return { error: true, duration: Date.now() - start }\n }\n\n // Notify the parent process that we processed a page (used by the progress activity indicator)\n process.send?.([3, { type: 'activity' }])\n\n // Otherwise we can return the result.\n return {\n ...result,\n duration: Date.now() - start,\n turborepoAccessTraceResult: turborepoAccessTraceResult.serialize(),\n }\n}\n\nprocess.on('unhandledRejection', (err: unknown) => {\n // if it's a postpone error, it'll be handled later\n // when the postponed promise is actually awaited.\n if (isPostpone(err)) {\n return\n }\n\n // we don't want to log these errors\n if (isDynamicUsageError(err)) {\n return\n }\n\n console.error(err)\n})\n\nprocess.on('rejectionHandled', () => {\n // It is ok to await a Promise late in Next.js as it allows for better\n // prefetching patterns to avoid waterfalls. We ignore logging these.\n // We should've already errored in anyway unhandledRejection.\n})\n\nconst FATAL_UNHANDLED_NEXT_API_EXIT_CODE = 78\n\nprocess.on('uncaughtException', (err) => {\n if (isDynamicUsageError(err)) {\n console.error(\n 'A Next.js API that uses exceptions to signal framework behavior was uncaught. This suggests improper usage of a Next.js API. The original error is printed below and the build will now exit.'\n )\n console.error(err)\n process.exit(FATAL_UNHANDLED_NEXT_API_EXIT_CODE)\n } else {\n console.error(err)\n }\n})\n"],"names":["exportPages","process","env","NEXT_IS_EXPORT_WORKER","globalThis","__NEXT_DATA__","nextExport","TimeoutError","Error","code","ExportPageError","exportPageImpl","input","fileWriter","req","exportPath","distDir","pagesDataDir","buildExport","subFolders","optimizeCss","disableOptimizedLoading","debugOutput","enableExperimentalReact","trailingSlash","sriEnabled","renderOpts","commonRenderOpts","outDir","commonOutDir","buildId","renderResumeDataCache","__NEXT_EXPERIMENTAL_REACT","path","page","_fallbackRouteParams","_isAppDir","isAppDir","_isDynamicError","isDynamicError","_isRoutePPREnabled","isRoutePPREnabled","_allowEmptyStaticShell","allowEmptyStaticShell","query","originalQuery","fallbackRouteParams","createOpaqueFallbackRouteParams","pathname","normalizeAppPath","isDynamic","isDynamicRoute","join","filePath","normalizePagePath","updatedPath","_ssgPath","locale","_locale","localePathResult","normalizeLocalePath","locales","detectedLocale","hasOrigQueryValues","Object","keys","length","nonLocalizedPath","params","normalizedPage","getParams","res","createRequestResponseMocks","url","statusCode","some","p","endsWith","domainLocales","dl","defaultLocale","includes","addRequestMeta","getHtmlFilename","sep","htmlFilename","pageExt","extname","pathExt","isBuiltinPaths","isHtmlExtPath","baseDir","dirname","htmlFilepath","fs","mkdir","recursive","components","loadComponents","isAppPath","isDev","needsManifestsForLegacyReasons","isAppRouteRoute","exportAppRoute","routeModule","incrementalCache","cacheLifeProfiles","experimental","supportsDynamicResponse","serveStreamingMetadata","sharedContext","exportAppPage","deploymentId","customServer","undefined","renderContext","isFallback","_pagesFallback","isDraftMode","developmentNotFoundSourcePage","exportPagesPage","exportPaths","dir","cacheHandler","cacheMaxMemorySize","fetchCacheKeyPrefix","nextConfig","options","renderResumeDataCachesByPage","installGlobalBehaviors","enablePrerenderSourceMaps","stackTraceLimit","createIncrementalCache","flushToDisk","hasNextSupport","cacheHandlers","maxConcurrency","staticGenerationMaxConcurrency","results","exportPageWithRetry","maxAttempts","pageKey","attempt","result","hasDebuggerAttached","NODE_OPTIONS","createRenderResumeDataCache","Promise","race","exportPage","parentSpanId","httpAgentOptions","needsExperimentalReact","Boolean","sri","algorithm","_","reject","setTimeout","staticPageGenerationTimeout","err","console","info","prerenderEarlyExit","error","exit","baseDelay","maxDelay","delay","Math","min","pow","jitter","random","r","i","subset","slice","subsetResults","all","map","staticGenerationRetryCount","push","trace","setAttribute","setHttpClientAndAgentOptions","MultiFileWriter","writeFile","data","exportPageSpan","start","Date","now","turborepoAccessTraceResult","TurborepoAccessTraceResult","traceAsyncFn","turborepoTraceAccess","wait","duration","isBailoutToCSRError","isStaticGenBailoutError","message","send","type","serialize","on","isPostpone","isDynamicUsageError","FATAL_UNHANDLED_NEXT_API_EXIT_CODE"],"mappings":";;;;+BAiUsBA;;;eAAAA;;;QAvTf;sBAIqC;iEAC7B;gCACgB;2BACA;mCACG;qCACE;uBACd;mCACuB;6BACd;0BACE;6BAEU;iCACX;wBACD;0BACA;yBACD;uBACE;2BACN;wCACa;4BACZ;qCACS;8BACA;sCAI7B;gCAKA;wCACgC;yCAEC;iCAGR;iCACY;iCACL;;;;;;AAxCvCC,QAAQC,GAAG,CAACC,qBAAqB,GAAG;AAyClCC,WAAmBC,aAAa,GAAG;IACnCC,YAAY;AACd;AAEA,MAAMC,qBAAqBC;;QAA3B,qBACEC,OAAO;;AACT;AAEA,MAAMC,wBAAwBF;;QAA9B,qBACEC,OAAO;;AACT;AAEA,eAAeE,eACbC,KAAsB,EACtBC,UAA2B;QAyGLC;IAvGtB,MAAM,EACJC,UAAU,EACVC,OAAO,EACPC,YAAY,EACZC,cAAc,KAAK,EACnBC,aAAa,KAAK,EAClBC,WAAW,EACXC,uBAAuB,EACvBC,cAAc,KAAK,EACnBC,uBAAuB,EACvBC,aAAa,EACbC,UAAU,EACVC,YAAYC,gBAAgB,EAC5BC,QAAQC,YAAY,EACpBC,OAAO,EACPC,qBAAqB,EACtB,GAAGnB;IAE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7C;IAChC,mDAAmD;IACnD,kDAAkD;IAClD,IAAI8C,IAAAA,sBAAU,EAAC9C,MAAM;QACnB;IACF;IAEA,oCAAoC;IACpC,IAAI+C,IAAAA,wCAAmB,EAAC/C,MAAM;QAC5B;IACF;IAEAC,QAAQG,KAAK,CAACJ;AAChB;AAEA/J,QAAQ4M,EAAE,CAAC,oBAAoB;AAC7B,sEAAsE;AACtE,qEAAqE;AACrE,6DAA6D;AAC/D;AAEA,MAAMG,qCAAqC;AAE3C/M,QAAQ4M,EAAE,CAAC,qBAAqB,CAAC7C;IAC/B,IAAI+C,IAAAA,wCAAmB,EAAC/C,MAAM;QAC5BC,QAAQG,KAAK,CACX;QAEFH,QAAQG,KAAK,CAACJ;QACd/J,QAAQoK,IAAI,CAAC2C;IACf,OAAO;QACL/C,QAAQG,KAAK,CAACJ;IAChB;AACF","ignoreList":[0]}
|
|
@@ -187,5 +187,6 @@ export declare const experimentalSchema: {
|
|
|
187
187
|
showSourceLocation?: boolean | undefined;
|
|
188
188
|
}>]>>;
|
|
189
189
|
lockDistDir: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
+
hideLogsAfterAbort: z.ZodOptional<z.ZodBoolean>;
|
|
190
191
|
};
|
|
191
192
|
export declare const configSchema: zod.ZodType<NextConfig>;
|
|
@@ -342,7 +342,8 @@ const experimentalSchema = {
|
|
|
342
342
|
showSourceLocation: _zod.z.boolean().optional()
|
|
343
343
|
})
|
|
344
344
|
]).optional(),
|
|
345
|
-
lockDistDir: _zod.z.boolean().optional()
|
|
345
|
+
lockDistDir: _zod.z.boolean().optional(),
|
|
346
|
+
hideLogsAfterAbort: _zod.z.boolean().optional()
|
|
346
347
|
};
|
|
347
348
|
const configSchema = _zod.z.lazy(()=>_zod.z.strictObject({
|
|
348
349
|
allowedDevOrigins: _zod.z.array(_zod.z.string()).optional(),
|