next 15.6.0-canary.33 → 15.6.0-canary.34
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/index.js +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.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.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/esm/build/index.js +3 -3
- package/dist/esm/build/swc/index.js +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/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/esm/shared/lib/turbopack/manifest-loader.js +131 -46
- package/dist/esm/shared/lib/turbopack/manifest-loader.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/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/canary-only.js +1 -1
- package/dist/shared/lib/turbopack/manifest-loader.d.ts +4 -3
- package/dist/shared/lib/turbopack/manifest-loader.js +131 -46
- package/dist/shared/lib/turbopack/manifest-loader.js.map +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
package/dist/esm/build/index.js
CHANGED
@@ -303,7 +303,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
303
303
|
try {
|
304
304
|
const nextBuildSpan = trace('next-build', undefined, {
|
305
305
|
buildMode: experimentalBuildMode,
|
306
|
-
version: "15.6.0-canary.
|
306
|
+
version: "15.6.0-canary.34"
|
307
307
|
});
|
308
308
|
NextBuildContext.nextBuildSpan = nextBuildSpan;
|
309
309
|
NextBuildContext.dir = dir;
|
@@ -785,7 +785,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
785
785
|
// Files outside of the distDir can be "type": "module"
|
786
786
|
await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
787
787
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
788
|
-
await recordFrameworkVersion("15.6.0-canary.
|
788
|
+
await recordFrameworkVersion("15.6.0-canary.34");
|
789
789
|
await updateBuildDiagnostics({
|
790
790
|
buildStage: 'start'
|
791
791
|
});
|
@@ -2451,7 +2451,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
2451
2451
|
distDir,
|
2452
2452
|
config,
|
2453
2453
|
staticPages,
|
2454
|
-
nextVersion: "15.6.0-canary.
|
2454
|
+
nextVersion: "15.6.0-canary.34",
|
2455
2455
|
tracingRoot: outputFileTracingRoot,
|
2456
2456
|
hasNodeMiddleware,
|
2457
2457
|
hasInstrumentationHook,
|
@@ -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.34";
|
14
14
|
const ArchName = arch();
|
15
15
|
const PlatformName = platform();
|
16
16
|
function infoLog(...args) {
|
@@ -1603,7 +1603,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
1603
1603
|
isClient && new CopyFilePlugin({
|
1604
1604
|
// file path to build output of `@next/polyfill-nomodule`
|
1605
1605
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
1606
|
-
cacheKey: "15.6.0-canary.
|
1606
|
+
cacheKey: "15.6.0-canary.34",
|
1607
1607
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
1608
1608
|
minimize: false,
|
1609
1609
|
info: {
|
@@ -1786,7 +1786,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
1786
1786
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
1787
1787
|
// - Next.js version
|
1788
1788
|
// - next.config.js keys that affect compilation
|
1789
|
-
version: `${__dirname}|${"15.6.0-canary.
|
1789
|
+
version: `${__dirname}|${"15.6.0-canary.34"}|${configVars}`,
|
1790
1790
|
cacheDirectory: path.join(distDir, 'cache', 'webpack'),
|
1791
1791
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
1792
1792
|
// 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.34";
|
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.34";
|
30
30
|
export let router;
|
31
31
|
export const emitter = mitt();
|
32
32
|
const looseToArray = (input)=>[].slice.call(input);
|
@@ -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.34"
|
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.
|
@@ -161,7 +161,7 @@ export default class HotReloaderWebpack {
|
|
161
161
|
this.previewProps = previewProps;
|
162
162
|
this.rewrites = rewrites;
|
163
163
|
this.hotReloaderSpan = trace('hot-reloader', undefined, {
|
164
|
-
version: "15.6.0-canary.
|
164
|
+
version: "15.6.0-canary.34"
|
165
165
|
});
|
166
166
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
167
167
|
// of the current `next dev` invocation.
|
@@ -14,7 +14,7 @@ export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures
|
|
14
14
|
bundlerSuffix = ' (webpack)';
|
15
15
|
}
|
16
16
|
}
|
17
|
-
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.6.0-canary.
|
17
|
+
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.6.0-canary.34"}`))}${bundlerSuffix}`);
|
18
18
|
if (appUrl) {
|
19
19
|
Log.bootstrap(`- Local: ${appUrl}`);
|
20
20
|
}
|
@@ -111,7 +111,7 @@ export async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup,
|
|
111
111
|
export async function startServer(serverOptions) {
|
112
112
|
const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
|
113
113
|
let { port } = serverOptions;
|
114
|
-
process.title = `next-server (v${"15.6.0-canary.
|
114
|
+
process.title = `next-server (v${"15.6.0-canary.34"})`;
|
115
115
|
let handlersReady = ()=>{};
|
116
116
|
let handlersError = ()=>{};
|
117
117
|
let handlersPromise = new Promise((resolve, reject)=>{
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export function isStableBuild() {
|
2
2
|
var _process_env___NEXT_VERSION;
|
3
|
-
return !((_process_env___NEXT_VERSION = "15.6.0-canary.
|
3
|
+
return !((_process_env___NEXT_VERSION = "15.6.0-canary.34") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
|
4
4
|
}
|
5
5
|
export class CanaryOnlyError extends Error {
|
6
6
|
constructor(arg){
|
@@ -29,11 +29,53 @@ const getManifestPath = (page, distDir, name, type, firstCall)=>{
|
|
29
29
|
}
|
30
30
|
return manifestPath;
|
31
31
|
};
|
32
|
-
function
|
32
|
+
function readPartialManifestContent(distDir, name, pageName, type) {
|
33
33
|
if (type === void 0) type = 'pages';
|
34
34
|
const page = pageName;
|
35
35
|
const manifestPath = getManifestPath(page, distDir, name, type, true);
|
36
|
-
return
|
36
|
+
return readFileSync(posix.join(manifestPath), 'utf-8');
|
37
|
+
}
|
38
|
+
/// Helper class that stores a map of manifests and tracks if they have changed
|
39
|
+
/// since the last time they were written to disk. This is used to avoid
|
40
|
+
/// unnecessary writes to disk.
|
41
|
+
class ManifestsMap {
|
42
|
+
set(key, value) {
|
43
|
+
if (this.rawMap.get(key) === value) return;
|
44
|
+
this.changed = true;
|
45
|
+
this.rawMap.set(key, value);
|
46
|
+
this.map.set(key, JSON.parse(value));
|
47
|
+
}
|
48
|
+
delete(key) {
|
49
|
+
if (this.map.has(key)) {
|
50
|
+
this.changed = true;
|
51
|
+
this.rawMap.delete(key);
|
52
|
+
this.map.delete(key);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
get(key) {
|
56
|
+
return this.map.get(key);
|
57
|
+
}
|
58
|
+
takeChanged(extraInvalidationKey) {
|
59
|
+
let changed = this.changed;
|
60
|
+
if (extraInvalidationKey !== undefined) {
|
61
|
+
const stringified = JSON.stringify(extraInvalidationKey);
|
62
|
+
if (this.extraInvalidationKey !== stringified) {
|
63
|
+
this.extraInvalidationKey = stringified;
|
64
|
+
changed = true;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
this.changed = false;
|
68
|
+
return changed;
|
69
|
+
}
|
70
|
+
values() {
|
71
|
+
return this.map.values();
|
72
|
+
}
|
73
|
+
constructor(){
|
74
|
+
this.rawMap = new Map();
|
75
|
+
this.map = new Map();
|
76
|
+
this.extraInvalidationKey = undefined;
|
77
|
+
this.changed = true;
|
78
|
+
}
|
37
79
|
}
|
38
80
|
export class TurbopackManifestLoader {
|
39
81
|
delete(key) {
|
@@ -47,7 +89,7 @@ export class TurbopackManifestLoader {
|
|
47
89
|
this.webpackStats.delete(key);
|
48
90
|
}
|
49
91
|
loadActionManifest(pageName) {
|
50
|
-
this.actionManifests.set(getEntryKey('app', 'server', pageName),
|
92
|
+
this.actionManifests.set(getEntryKey('app', 'server', pageName), readPartialManifestContent(this.distDir, "" + SERVER_REFERENCE_MANIFEST + ".json", pageName, 'app'));
|
51
93
|
}
|
52
94
|
mergeActionManifests(manifests) {
|
53
95
|
const manifest = {
|
@@ -86,6 +128,9 @@ export class TurbopackManifestLoader {
|
|
86
128
|
return manifest;
|
87
129
|
}
|
88
130
|
writeActionManifest() {
|
131
|
+
if (!this.actionManifests.takeChanged()) {
|
132
|
+
return;
|
133
|
+
}
|
89
134
|
const actionManifest = this.mergeActionManifests(this.actionManifests.values());
|
90
135
|
const actionManifestJsonPath = join(this.distDir, 'server', "" + SERVER_REFERENCE_MANIFEST + ".json");
|
91
136
|
const actionManifestJsPath = join(this.distDir, 'server', "" + SERVER_REFERENCE_MANIFEST + ".js");
|
@@ -96,15 +141,21 @@ export class TurbopackManifestLoader {
|
|
96
141
|
writeFileAtomic(actionManifestJsPath, "self.__RSC_SERVER_MANIFEST=" + JSON.stringify(json));
|
97
142
|
}
|
98
143
|
loadAppPathsManifest(pageName) {
|
99
|
-
this.appPathsManifests.set(getEntryKey('app', 'server', pageName),
|
144
|
+
this.appPathsManifests.set(getEntryKey('app', 'server', pageName), readPartialManifestContent(this.distDir, APP_PATHS_MANIFEST, pageName, 'app'));
|
100
145
|
}
|
101
146
|
writeAppPathsManifest() {
|
147
|
+
if (!this.appPathsManifests.takeChanged()) {
|
148
|
+
return;
|
149
|
+
}
|
102
150
|
const appPathsManifest = this.mergePagesManifests(this.appPathsManifests.values());
|
103
151
|
const appPathsManifestPath = join(this.distDir, 'server', APP_PATHS_MANIFEST);
|
104
152
|
deleteCache(appPathsManifestPath);
|
105
153
|
writeFileAtomic(appPathsManifestPath, JSON.stringify(appPathsManifest, null, 2));
|
106
154
|
}
|
107
155
|
writeWebpackStats() {
|
156
|
+
if (!this.webpackStats.takeChanged()) {
|
157
|
+
return;
|
158
|
+
}
|
108
159
|
const webpackStats = this.mergeWebpackStats(this.webpackStats.values());
|
109
160
|
const path = join(this.distDir, 'server', WEBPACK_STATS);
|
110
161
|
deleteCache(path);
|
@@ -112,15 +163,15 @@ export class TurbopackManifestLoader {
|
|
112
163
|
}
|
113
164
|
loadBuildManifest(pageName, type) {
|
114
165
|
if (type === void 0) type = 'pages';
|
115
|
-
this.buildManifests.set(getEntryKey(type, 'server', pageName),
|
166
|
+
this.buildManifests.set(getEntryKey(type, 'server', pageName), readPartialManifestContent(this.distDir, BUILD_MANIFEST, pageName, type));
|
116
167
|
}
|
117
168
|
loadClientBuildManifest(pageName, type) {
|
118
169
|
if (type === void 0) type = 'pages';
|
119
|
-
this.clientBuildManifests.set(getEntryKey(type, 'server', pageName),
|
170
|
+
this.clientBuildManifests.set(getEntryKey(type, 'server', pageName), readPartialManifestContent(this.distDir, TURBOPACK_CLIENT_BUILD_MANIFEST, pageName, type));
|
120
171
|
}
|
121
172
|
loadWebpackStats(pageName, type) {
|
122
173
|
if (type === void 0) type = 'pages';
|
123
|
-
this.webpackStats.set(getEntryKey(type, 'client', pageName),
|
174
|
+
this.webpackStats.set(getEntryKey(type, 'client', pageName), readPartialManifestContent(this.distDir, WEBPACK_STATS, pageName, type));
|
124
175
|
}
|
125
176
|
mergeWebpackStats(statsFiles) {
|
126
177
|
const entrypoints = {};
|
@@ -207,9 +258,9 @@ export class TurbopackManifestLoader {
|
|
207
258
|
manifest.pages = sortObjectByKey(manifest.pages);
|
208
259
|
return manifest;
|
209
260
|
}
|
210
|
-
mergeClientBuildManifests(
|
261
|
+
mergeClientBuildManifests(manifests, rewrites, sortedPageKeys) {
|
211
262
|
const manifest = {
|
212
|
-
__rewrites:
|
263
|
+
__rewrites: rewrites,
|
213
264
|
sortedPages: sortedPageKeys
|
214
265
|
};
|
215
266
|
for (const m of manifests){
|
@@ -217,7 +268,7 @@ export class TurbopackManifestLoader {
|
|
217
268
|
}
|
218
269
|
return sortObjectByKey(manifest);
|
219
270
|
}
|
220
|
-
|
271
|
+
writeInterceptionRouteRewriteManifest(devRewrites, productionRewrites) {
|
221
272
|
var _devRewrites_beforeFiles, _devRewrites_afterFiles, _devRewrites_fallback;
|
222
273
|
const rewrites = productionRewrites != null ? productionRewrites : {
|
223
274
|
...devRewrites,
|
@@ -225,19 +276,45 @@ export class TurbopackManifestLoader {
|
|
225
276
|
afterFiles: ((_devRewrites_afterFiles = devRewrites == null ? void 0 : devRewrites.afterFiles) != null ? _devRewrites_afterFiles : []).map(processRoute),
|
226
277
|
fallback: ((_devRewrites_fallback = devRewrites == null ? void 0 : devRewrites.fallback) != null ? _devRewrites_fallback : []).map(processRoute)
|
227
278
|
};
|
279
|
+
const interceptionRewrites = JSON.stringify(rewrites.beforeFiles.filter(isInterceptionRouteRewrite));
|
280
|
+
if (this.cachedInterceptionRewrites === interceptionRewrites) {
|
281
|
+
return;
|
282
|
+
}
|
283
|
+
this.cachedInterceptionRewrites = interceptionRewrites;
|
284
|
+
const interceptionRewriteManifestPath = join(this.distDir, 'server', "" + INTERCEPTION_ROUTE_REWRITE_MANIFEST + ".js");
|
285
|
+
deleteCache(interceptionRewriteManifestPath);
|
286
|
+
writeFileAtomic(interceptionRewriteManifestPath, "self.__INTERCEPTION_ROUTE_REWRITE_MANIFEST=" + JSON.stringify(interceptionRewrites) + ";");
|
287
|
+
}
|
288
|
+
writeBuildManifest() {
|
289
|
+
if (!this.buildManifests.takeChanged()) {
|
290
|
+
return;
|
291
|
+
}
|
228
292
|
const buildManifest = this.mergeBuildManifests(this.buildManifests.values());
|
229
293
|
const buildManifestPath = join(this.distDir, BUILD_MANIFEST);
|
230
294
|
const middlewareBuildManifestPath = join(this.distDir, 'server', "" + MIDDLEWARE_BUILD_MANIFEST + ".js");
|
231
|
-
const interceptionRewriteManifestPath = join(this.distDir, 'server', "" + INTERCEPTION_ROUTE_REWRITE_MANIFEST + ".js");
|
232
295
|
deleteCache(buildManifestPath);
|
233
296
|
deleteCache(middlewareBuildManifestPath);
|
234
|
-
deleteCache(interceptionRewriteManifestPath);
|
235
297
|
writeFileAtomic(buildManifestPath, JSON.stringify(buildManifest, null, 2));
|
236
298
|
writeFileAtomic(middlewareBuildManifestPath, // we use globalThis here because middleware can be node
|
237
299
|
// which doesn't have "self"
|
238
300
|
createEdgeRuntimeManifest(buildManifest));
|
239
|
-
|
240
|
-
|
301
|
+
// Write fallback build manifest
|
302
|
+
const fallbackBuildManifest = this.mergeBuildManifests([
|
303
|
+
this.buildManifests.get(getEntryKey('pages', 'server', '_app')),
|
304
|
+
this.buildManifests.get(getEntryKey('pages', 'server', '_error'))
|
305
|
+
].filter(Boolean));
|
306
|
+
const fallbackBuildManifestPath = join(this.distDir, "fallback-" + BUILD_MANIFEST);
|
307
|
+
deleteCache(fallbackBuildManifestPath);
|
308
|
+
writeFileAtomic(fallbackBuildManifestPath, JSON.stringify(fallbackBuildManifest, null, 2));
|
309
|
+
}
|
310
|
+
writeClientBuildManifest(entrypoints, devRewrites, productionRewrites) {
|
311
|
+
var _devRewrites_beforeFiles, _devRewrites_afterFiles, _devRewrites_fallback;
|
312
|
+
const rewrites = normalizeRewritesForBuildManifest(productionRewrites != null ? productionRewrites : {
|
313
|
+
...devRewrites,
|
314
|
+
beforeFiles: ((_devRewrites_beforeFiles = devRewrites == null ? void 0 : devRewrites.beforeFiles) != null ? _devRewrites_beforeFiles : []).map(processRoute),
|
315
|
+
afterFiles: ((_devRewrites_afterFiles = devRewrites == null ? void 0 : devRewrites.afterFiles) != null ? _devRewrites_afterFiles : []).map(processRoute),
|
316
|
+
fallback: ((_devRewrites_fallback = devRewrites == null ? void 0 : devRewrites.fallback) != null ? _devRewrites_fallback : []).map(processRoute)
|
317
|
+
});
|
241
318
|
const pagesKeys = [
|
242
319
|
...entrypoints.page.keys()
|
243
320
|
];
|
@@ -248,31 +325,20 @@ export class TurbopackManifestLoader {
|
|
248
325
|
pagesKeys.push('/_error');
|
249
326
|
}
|
250
327
|
const sortedPageKeys = getSortedRoutes(pagesKeys);
|
251
|
-
|
328
|
+
if (!this.clientBuildManifests.takeChanged({
|
329
|
+
rewrites,
|
330
|
+
sortedPageKeys
|
331
|
+
})) {
|
332
|
+
return;
|
333
|
+
}
|
334
|
+
const clientBuildManifest = this.mergeClientBuildManifests(this.clientBuildManifests.values(), rewrites, sortedPageKeys);
|
252
335
|
const clientBuildManifestJs = "self.__BUILD_MANIFEST = " + JSON.stringify(clientBuildManifest, null, 2) + ";self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()";
|
253
336
|
writeFileAtomic(join(this.distDir, 'static', this.buildId, '_buildManifest.js'), clientBuildManifestJs);
|
254
337
|
writeFileAtomic(join(this.distDir, 'static', this.buildId, '_ssgManifest.js'), srcEmptySsgManifest);
|
255
338
|
}
|
256
|
-
writeClientMiddlewareManifest() {
|
257
|
-
var _middlewareManifest_middleware_;
|
258
|
-
const middlewareManifest = this.mergeMiddlewareManifests(this.middlewareManifests.values());
|
259
|
-
const matchers = (middlewareManifest == null ? void 0 : (_middlewareManifest_middleware_ = middlewareManifest.middleware['/']) == null ? void 0 : _middlewareManifest_middleware_.matchers) || [];
|
260
|
-
const clientMiddlewareManifestPath = join(this.distDir, 'static', this.buildId, "" + TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST);
|
261
|
-
deleteCache(clientMiddlewareManifestPath);
|
262
|
-
writeFileAtomic(clientMiddlewareManifestPath, JSON.stringify(matchers, null, 2));
|
263
|
-
}
|
264
|
-
async writeFallbackBuildManifest() {
|
265
|
-
const fallbackBuildManifest = this.mergeBuildManifests([
|
266
|
-
this.buildManifests.get(getEntryKey('pages', 'server', '_app')),
|
267
|
-
this.buildManifests.get(getEntryKey('pages', 'server', '_error'))
|
268
|
-
].filter(Boolean));
|
269
|
-
const fallbackBuildManifestPath = join(this.distDir, "fallback-" + BUILD_MANIFEST);
|
270
|
-
deleteCache(fallbackBuildManifestPath);
|
271
|
-
writeFileAtomic(fallbackBuildManifestPath, JSON.stringify(fallbackBuildManifest, null, 2));
|
272
|
-
}
|
273
339
|
loadFontManifest(pageName, type) {
|
274
340
|
if (type === void 0) type = 'pages';
|
275
|
-
this.fontManifests.set(getEntryKey(type, 'server', pageName),
|
341
|
+
this.fontManifests.set(getEntryKey(type, 'server', pageName), readPartialManifestContent(this.distDir, "" + NEXT_FONT_MANIFEST + ".json", pageName, type));
|
276
342
|
}
|
277
343
|
mergeFontManifests(manifests) {
|
278
344
|
const manifest = {
|
@@ -292,6 +358,9 @@ export class TurbopackManifestLoader {
|
|
292
358
|
return manifest;
|
293
359
|
}
|
294
360
|
async writeNextFontManifest() {
|
361
|
+
if (!this.fontManifests.takeChanged()) {
|
362
|
+
return;
|
363
|
+
}
|
295
364
|
const fontManifest = this.mergeFontManifests(this.fontManifests.values());
|
296
365
|
const json = JSON.stringify(fontManifest, null, 2);
|
297
366
|
const fontManifestJsonPath = join(this.distDir, 'server', "" + NEXT_FONT_MANIFEST + ".json");
|
@@ -309,7 +378,7 @@ export class TurbopackManifestLoader {
|
|
309
378
|
if (!existsSync(middlewareManifestPath)) {
|
310
379
|
return false;
|
311
380
|
}
|
312
|
-
this.middlewareManifests.set(getEntryKey(type === 'middleware' || type === 'instrumentation' ? 'root' : type, 'server', pageName),
|
381
|
+
this.middlewareManifests.set(getEntryKey(type === 'middleware' || type === 'instrumentation' ? 'root' : type, 'server', pageName), readPartialManifestContent(this.distDir, MIDDLEWARE_MANIFEST, pageName, type));
|
313
382
|
return true;
|
314
383
|
}
|
315
384
|
getMiddlewareManifest(key) {
|
@@ -368,7 +437,12 @@ export class TurbopackManifestLoader {
|
|
368
437
|
return manifest;
|
369
438
|
}
|
370
439
|
writeMiddlewareManifest() {
|
440
|
+
var _middlewareManifest_middleware_;
|
441
|
+
if (!this.middlewareManifests.takeChanged()) {
|
442
|
+
return;
|
443
|
+
}
|
371
444
|
const middlewareManifest = this.mergeMiddlewareManifests(this.middlewareManifests.values());
|
445
|
+
// Server middleware manifest
|
372
446
|
// Normalize regexes as it uses path-to-regexp
|
373
447
|
for(const key in middlewareManifest.middleware){
|
374
448
|
middlewareManifest.middleware[key].matchers.forEach((matcher)=>{
|
@@ -388,9 +462,14 @@ export class TurbopackManifestLoader {
|
|
388
462
|
const middlewareManifestPath = join(this.distDir, 'server', MIDDLEWARE_MANIFEST);
|
389
463
|
deleteCache(middlewareManifestPath);
|
390
464
|
writeFileAtomic(middlewareManifestPath, JSON.stringify(middlewareManifest, null, 2));
|
465
|
+
// Client middleware manifest
|
466
|
+
const matchers = (middlewareManifest == null ? void 0 : (_middlewareManifest_middleware_ = middlewareManifest.middleware['/']) == null ? void 0 : _middlewareManifest_middleware_.matchers) || [];
|
467
|
+
const clientMiddlewareManifestPath = join(this.distDir, 'static', this.buildId, "" + TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST);
|
468
|
+
deleteCache(clientMiddlewareManifestPath);
|
469
|
+
writeFileAtomic(clientMiddlewareManifestPath, JSON.stringify(matchers, null, 2));
|
391
470
|
}
|
392
471
|
loadPagesManifest(pageName) {
|
393
|
-
this.pagesManifests.set(getEntryKey('pages', 'server', pageName),
|
472
|
+
this.pagesManifests.set(getEntryKey('pages', 'server', pageName), readPartialManifestContent(this.distDir, PAGES_MANIFEST, pageName));
|
394
473
|
}
|
395
474
|
mergePagesManifests(manifests) {
|
396
475
|
const manifest = {};
|
@@ -400,6 +479,9 @@ export class TurbopackManifestLoader {
|
|
400
479
|
return sortObjectByKey(manifest);
|
401
480
|
}
|
402
481
|
writePagesManifest() {
|
482
|
+
if (!this.pagesManifests.takeChanged()) {
|
483
|
+
return;
|
484
|
+
}
|
403
485
|
const pagesManifest = this.mergePagesManifests(this.pagesManifests.values());
|
404
486
|
const pagesManifestPath = join(this.distDir, 'server', PAGES_MANIFEST);
|
405
487
|
deleteCache(pagesManifestPath);
|
@@ -409,10 +491,10 @@ export class TurbopackManifestLoader {
|
|
409
491
|
let { devRewrites, productionRewrites, entrypoints } = param;
|
410
492
|
this.writeActionManifest();
|
411
493
|
this.writeAppPathsManifest();
|
412
|
-
this.writeBuildManifest(
|
413
|
-
this.
|
494
|
+
this.writeBuildManifest();
|
495
|
+
this.writeInterceptionRouteRewriteManifest(devRewrites, productionRewrites);
|
496
|
+
this.writeClientBuildManifest(entrypoints, devRewrites, productionRewrites);
|
414
497
|
this.writeMiddlewareManifest();
|
415
|
-
this.writeClientMiddlewareManifest();
|
416
498
|
this.writeNextFontManifest();
|
417
499
|
this.writePagesManifest();
|
418
500
|
if (process.env.TURBOPACK_STATS != null) {
|
@@ -420,14 +502,17 @@ export class TurbopackManifestLoader {
|
|
420
502
|
}
|
421
503
|
}
|
422
504
|
constructor({ distDir, buildId, encryptionKey }){
|
423
|
-
this.actionManifests = new
|
424
|
-
this.appPathsManifests = new
|
425
|
-
this.buildManifests = new
|
426
|
-
this.clientBuildManifests = new
|
427
|
-
this.fontManifests = new
|
428
|
-
this.middlewareManifests = new
|
429
|
-
this.pagesManifests = new
|
430
|
-
this.webpackStats = new
|
505
|
+
this.actionManifests = new ManifestsMap();
|
506
|
+
this.appPathsManifests = new ManifestsMap();
|
507
|
+
this.buildManifests = new ManifestsMap();
|
508
|
+
this.clientBuildManifests = new ManifestsMap();
|
509
|
+
this.fontManifests = new ManifestsMap();
|
510
|
+
this.middlewareManifests = new ManifestsMap();
|
511
|
+
this.pagesManifests = new ManifestsMap();
|
512
|
+
this.webpackStats = new ManifestsMap();
|
513
|
+
/// interceptionRewrites that have been written to disk
|
514
|
+
/// This is used to avoid unnecessary writes if the rewrites haven't changed
|
515
|
+
this.cachedInterceptionRewrites = undefined;
|
431
516
|
this.distDir = distDir;
|
432
517
|
this.buildId = buildId;
|
433
518
|
this.encryptionKey = encryptionKey;
|