@vercel/next 3.6.1 → 3.6.3
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/index.js +28 -11
- package/dist/server-build.js +27 -11
- package/dist/utils.js +1 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -42417,6 +42417,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42417
42417
|
const internalPages = ['_app.js', '_error.js', '_document.js'];
|
42418
42418
|
const pageBuildTraces = await (0, build_utils_1.glob)('**/*.js.nft.json', pagesDir);
|
42419
42419
|
const isEmptyAllowQueryForPrendered = semver_1.default.gte(nextVersion, EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION);
|
42420
|
+
const projectDir = requiredServerFilesManifest.relativeAppDir
|
42421
|
+
? path_1.default.join(baseDir, requiredServerFilesManifest.relativeAppDir)
|
42422
|
+
: requiredServerFilesManifest.appDir || entryPath;
|
42420
42423
|
let appBuildTraces = {};
|
42421
42424
|
let appDir = null;
|
42422
42425
|
if (appPathRoutesManifest) {
|
@@ -42488,7 +42491,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42488
42491
|
let initialFileList;
|
42489
42492
|
let initialFileReasons;
|
42490
42493
|
let nextServerBuildTrace;
|
42491
|
-
|
42494
|
+
let instrumentationHookBuildTrace;
|
42495
|
+
const nextServerFile = (0, resolve_from_1.default)(projectDir, `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
|
42492
42496
|
try {
|
42493
42497
|
// leverage next-server trace from build if available
|
42494
42498
|
nextServerBuildTrace = JSON.parse(await fs_extra_1.default.readFile(path_1.default.join(entryPath, outputDirectory, 'next-server.js.nft.json'), 'utf8'));
|
@@ -42496,6 +42500,12 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42496
42500
|
catch (_) {
|
42497
42501
|
// if the trace is unavailable we trace inside the runtime
|
42498
42502
|
}
|
42503
|
+
try {
|
42504
|
+
instrumentationHookBuildTrace = JSON.parse(await fs_extra_1.default.readFile(path_1.default.join(entryPath, outputDirectory, 'server', 'instrumentation.js.nft.json'), 'utf8'));
|
42505
|
+
}
|
42506
|
+
catch (_) {
|
42507
|
+
// if the trace is unavailable it means `instrumentation.js` wasn't used
|
42508
|
+
}
|
42499
42509
|
if (nextServerBuildTrace) {
|
42500
42510
|
initialFileList = nextServerBuildTrace.files.map((file) => {
|
42501
42511
|
return path_1.default.relative(baseDir, path_1.default.join(entryPath, outputDirectory, file));
|
@@ -42523,6 +42533,12 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42523
42533
|
initialFileList = Array.from(result.fileList);
|
42524
42534
|
initialFileReasons = result.reasons;
|
42525
42535
|
}
|
42536
|
+
if (instrumentationHookBuildTrace) {
|
42537
|
+
initialFileList = initialFileList.concat(instrumentationHookBuildTrace.files.map((file) => {
|
42538
|
+
return path_1.default.relative(baseDir, path_1.default.join(entryPath, outputDirectory, 'server', file));
|
42539
|
+
}));
|
42540
|
+
(0, build_utils_1.debug)('Using instrumentation.js.nft.json trace from build');
|
42541
|
+
}
|
42526
42542
|
(0, build_utils_1.debug)('collecting initial Next.js server files');
|
42527
42543
|
await Promise.all(initialFileList.map((0, utils_1.collectTracedFiles)(baseDir, lstatResults, lstatSema, initialFileReasons, initialTracedFiles)));
|
42528
42544
|
(0, build_utils_1.debug)('creating initial pseudo layer');
|
@@ -42606,8 +42622,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42606
42622
|
// remove last part of outputDirectory `.next` since this is already
|
42607
42623
|
// included in the file path
|
42608
42624
|
path_1.default.join(outputDirectory, '..'), file);
|
42609
|
-
if (
|
42610
|
-
fsPath = path_1.default.join(
|
42625
|
+
if (projectDir) {
|
42626
|
+
fsPath = path_1.default.join(projectDir, file);
|
42611
42627
|
}
|
42612
42628
|
const relativePath = path_1.default.relative(baseDir, fsPath);
|
42613
42629
|
const { mode } = await fs_extra_1.default.lstat(fsPath);
|
@@ -42644,7 +42660,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42644
42660
|
let launcher = launcherData
|
42645
42661
|
.replace('conf: __NEXT_CONFIG__', `conf: ${JSON.stringify({
|
42646
42662
|
...requiredServerFilesManifest.config,
|
42647
|
-
distDir: path_1.default.relative(
|
42663
|
+
distDir: path_1.default.relative(projectDir, path_1.default.join(entryPath, outputDirectory)),
|
42648
42664
|
compress: false,
|
42649
42665
|
})}`)
|
42650
42666
|
.replace('__NEXT_SERVER_PATH__', `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
|
@@ -42658,7 +42674,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42658
42674
|
.replace(/\//g, '\\/')}/, '')`);
|
42659
42675
|
}
|
42660
42676
|
const launcherFiles = {
|
42661
|
-
[path_1.default.join(path_1.default.relative(baseDir,
|
42677
|
+
[path_1.default.join(path_1.default.relative(baseDir, projectDir), '___next_launcher.cjs')]: new build_utils_1.FileBlob({ data: launcher }),
|
42662
42678
|
};
|
42663
42679
|
const pageTraces = {};
|
42664
42680
|
const compressedPages = {};
|
@@ -42694,7 +42710,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42694
42710
|
traceResult = await (0, nft_1.nodeFileTrace)(pathsToTrace, {
|
42695
42711
|
base: baseDir,
|
42696
42712
|
cache: traceCache,
|
42697
|
-
processCwd:
|
42713
|
+
processCwd: projectDir,
|
42698
42714
|
});
|
42699
42715
|
traceResult.esmFileList.forEach(file => traceResult?.fileList.add(file));
|
42700
42716
|
parentFilesMap = (0, utils_1.getFilesMapFromReasons)(traceResult.fileList, traceResult.reasons);
|
@@ -42756,7 +42772,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42756
42772
|
}, {}));
|
42757
42773
|
const pageExtensions = requiredServerFilesManifest.config?.pageExtensions;
|
42758
42774
|
const pageLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
|
42759
|
-
entryPath:
|
42775
|
+
entryPath: projectDir,
|
42760
42776
|
config,
|
42761
42777
|
pages: nonApiPages,
|
42762
42778
|
prerenderRoutes,
|
@@ -42770,7 +42786,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42770
42786
|
pageExtensions,
|
42771
42787
|
});
|
42772
42788
|
const streamingPageLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
|
42773
|
-
entryPath:
|
42789
|
+
entryPath: projectDir,
|
42774
42790
|
config,
|
42775
42791
|
pages: streamingPages,
|
42776
42792
|
prerenderRoutes,
|
@@ -42789,7 +42805,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42789
42805
|
}
|
42790
42806
|
}
|
42791
42807
|
const apiLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
|
42792
|
-
entryPath:
|
42808
|
+
entryPath: projectDir,
|
42793
42809
|
config,
|
42794
42810
|
pages: apiPages,
|
42795
42811
|
prerenderRoutes,
|
@@ -42894,7 +42910,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42894
42910
|
...updatedManifestFiles,
|
42895
42911
|
},
|
42896
42912
|
layers: [group.pseudoLayer, groupPageFiles],
|
42897
|
-
handler: path_1.default.join(path_1.default.relative(baseDir,
|
42913
|
+
handler: path_1.default.join(path_1.default.relative(baseDir, projectDir), '___next_launcher.cjs'),
|
42898
42914
|
operationType,
|
42899
42915
|
memory: group.memory,
|
42900
42916
|
runtime: nodeVersion.runtime,
|
@@ -43354,7 +43370,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43354
43370
|
{
|
43355
43371
|
src: `^${path_1.default.posix.join('/', entryDirectory)}/?(?:${i18n.locales
|
43356
43372
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
43357
|
-
.join('|')})
|
43373
|
+
.join('|')})/?(.*)`,
|
43358
43374
|
dest: `${path_1.default.posix.join('/', entryDirectory, '/')}$1`,
|
43359
43375
|
check: true,
|
43360
43376
|
},
|
@@ -44227,6 +44243,7 @@ async function getRequiredServerFilesManifest(entryPath, outputDirectory) {
|
|
44227
44243
|
ignore: [],
|
44228
44244
|
config: {},
|
44229
44245
|
appDir: manifestData.appDir,
|
44246
|
+
relativeAppDir: manifestData.relativeAppDir,
|
44230
44247
|
};
|
44231
44248
|
switch (manifestData.version) {
|
44232
44249
|
case 1: {
|
package/dist/server-build.js
CHANGED
@@ -29,6 +29,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
29
29
|
const internalPages = ['_app.js', '_error.js', '_document.js'];
|
30
30
|
const pageBuildTraces = await (0, build_utils_1.glob)('**/*.js.nft.json', pagesDir);
|
31
31
|
const isEmptyAllowQueryForPrendered = semver_1.default.gte(nextVersion, EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION);
|
32
|
+
const projectDir = requiredServerFilesManifest.relativeAppDir
|
33
|
+
? path_1.default.join(baseDir, requiredServerFilesManifest.relativeAppDir)
|
34
|
+
: requiredServerFilesManifest.appDir || entryPath;
|
32
35
|
let appBuildTraces = {};
|
33
36
|
let appDir = null;
|
34
37
|
if (appPathRoutesManifest) {
|
@@ -100,7 +103,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
100
103
|
let initialFileList;
|
101
104
|
let initialFileReasons;
|
102
105
|
let nextServerBuildTrace;
|
103
|
-
|
106
|
+
let instrumentationHookBuildTrace;
|
107
|
+
const nextServerFile = (0, resolve_from_1.default)(projectDir, `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
|
104
108
|
try {
|
105
109
|
// leverage next-server trace from build if available
|
106
110
|
nextServerBuildTrace = JSON.parse(await fs_extra_1.default.readFile(path_1.default.join(entryPath, outputDirectory, 'next-server.js.nft.json'), 'utf8'));
|
@@ -108,6 +112,12 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
108
112
|
catch (_) {
|
109
113
|
// if the trace is unavailable we trace inside the runtime
|
110
114
|
}
|
115
|
+
try {
|
116
|
+
instrumentationHookBuildTrace = JSON.parse(await fs_extra_1.default.readFile(path_1.default.join(entryPath, outputDirectory, 'server', 'instrumentation.js.nft.json'), 'utf8'));
|
117
|
+
}
|
118
|
+
catch (_) {
|
119
|
+
// if the trace is unavailable it means `instrumentation.js` wasn't used
|
120
|
+
}
|
111
121
|
if (nextServerBuildTrace) {
|
112
122
|
initialFileList = nextServerBuildTrace.files.map((file) => {
|
113
123
|
return path_1.default.relative(baseDir, path_1.default.join(entryPath, outputDirectory, file));
|
@@ -135,6 +145,12 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
135
145
|
initialFileList = Array.from(result.fileList);
|
136
146
|
initialFileReasons = result.reasons;
|
137
147
|
}
|
148
|
+
if (instrumentationHookBuildTrace) {
|
149
|
+
initialFileList = initialFileList.concat(instrumentationHookBuildTrace.files.map((file) => {
|
150
|
+
return path_1.default.relative(baseDir, path_1.default.join(entryPath, outputDirectory, 'server', file));
|
151
|
+
}));
|
152
|
+
(0, build_utils_1.debug)('Using instrumentation.js.nft.json trace from build');
|
153
|
+
}
|
138
154
|
(0, build_utils_1.debug)('collecting initial Next.js server files');
|
139
155
|
await Promise.all(initialFileList.map((0, utils_1.collectTracedFiles)(baseDir, lstatResults, lstatSema, initialFileReasons, initialTracedFiles)));
|
140
156
|
(0, build_utils_1.debug)('creating initial pseudo layer');
|
@@ -218,8 +234,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
218
234
|
// remove last part of outputDirectory `.next` since this is already
|
219
235
|
// included in the file path
|
220
236
|
path_1.default.join(outputDirectory, '..'), file);
|
221
|
-
if (
|
222
|
-
fsPath = path_1.default.join(
|
237
|
+
if (projectDir) {
|
238
|
+
fsPath = path_1.default.join(projectDir, file);
|
223
239
|
}
|
224
240
|
const relativePath = path_1.default.relative(baseDir, fsPath);
|
225
241
|
const { mode } = await fs_extra_1.default.lstat(fsPath);
|
@@ -256,7 +272,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
256
272
|
let launcher = launcherData
|
257
273
|
.replace('conf: __NEXT_CONFIG__', `conf: ${JSON.stringify({
|
258
274
|
...requiredServerFilesManifest.config,
|
259
|
-
distDir: path_1.default.relative(
|
275
|
+
distDir: path_1.default.relative(projectDir, path_1.default.join(entryPath, outputDirectory)),
|
260
276
|
compress: false,
|
261
277
|
})}`)
|
262
278
|
.replace('__NEXT_SERVER_PATH__', `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
|
@@ -270,7 +286,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
270
286
|
.replace(/\//g, '\\/')}/, '')`);
|
271
287
|
}
|
272
288
|
const launcherFiles = {
|
273
|
-
[path_1.default.join(path_1.default.relative(baseDir,
|
289
|
+
[path_1.default.join(path_1.default.relative(baseDir, projectDir), '___next_launcher.cjs')]: new build_utils_1.FileBlob({ data: launcher }),
|
274
290
|
};
|
275
291
|
const pageTraces = {};
|
276
292
|
const compressedPages = {};
|
@@ -306,7 +322,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
306
322
|
traceResult = await (0, nft_1.nodeFileTrace)(pathsToTrace, {
|
307
323
|
base: baseDir,
|
308
324
|
cache: traceCache,
|
309
|
-
processCwd:
|
325
|
+
processCwd: projectDir,
|
310
326
|
});
|
311
327
|
traceResult.esmFileList.forEach(file => traceResult?.fileList.add(file));
|
312
328
|
parentFilesMap = (0, utils_1.getFilesMapFromReasons)(traceResult.fileList, traceResult.reasons);
|
@@ -368,7 +384,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
368
384
|
}, {}));
|
369
385
|
const pageExtensions = requiredServerFilesManifest.config?.pageExtensions;
|
370
386
|
const pageLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
|
371
|
-
entryPath:
|
387
|
+
entryPath: projectDir,
|
372
388
|
config,
|
373
389
|
pages: nonApiPages,
|
374
390
|
prerenderRoutes,
|
@@ -382,7 +398,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
382
398
|
pageExtensions,
|
383
399
|
});
|
384
400
|
const streamingPageLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
|
385
|
-
entryPath:
|
401
|
+
entryPath: projectDir,
|
386
402
|
config,
|
387
403
|
pages: streamingPages,
|
388
404
|
prerenderRoutes,
|
@@ -401,7 +417,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
401
417
|
}
|
402
418
|
}
|
403
419
|
const apiLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
|
404
|
-
entryPath:
|
420
|
+
entryPath: projectDir,
|
405
421
|
config,
|
406
422
|
pages: apiPages,
|
407
423
|
prerenderRoutes,
|
@@ -506,7 +522,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
506
522
|
...updatedManifestFiles,
|
507
523
|
},
|
508
524
|
layers: [group.pseudoLayer, groupPageFiles],
|
509
|
-
handler: path_1.default.join(path_1.default.relative(baseDir,
|
525
|
+
handler: path_1.default.join(path_1.default.relative(baseDir, projectDir), '___next_launcher.cjs'),
|
510
526
|
operationType,
|
511
527
|
memory: group.memory,
|
512
528
|
runtime: nodeVersion.runtime,
|
@@ -966,7 +982,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
966
982
|
{
|
967
983
|
src: `^${path_1.default.posix.join('/', entryDirectory)}/?(?:${i18n.locales
|
968
984
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
969
|
-
.join('|')})
|
985
|
+
.join('|')})/?(.*)`,
|
970
986
|
dest: `${path_1.default.posix.join('/', entryDirectory, '/')}$1`,
|
971
987
|
check: true,
|
972
988
|
},
|
package/dist/utils.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.6.
|
3
|
+
"version": "3.6.3",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -45,9 +45,9 @@
|
|
45
45
|
"@types/semver": "6.0.0",
|
46
46
|
"@types/text-table": "0.2.1",
|
47
47
|
"@types/webpack-sources": "3.2.0",
|
48
|
-
"@vercel/build-utils": "6.3.
|
48
|
+
"@vercel/build-utils": "6.3.2",
|
49
49
|
"@vercel/nft": "0.22.5",
|
50
|
-
"@vercel/routing-utils": "2.1.
|
50
|
+
"@vercel/routing-utils": "2.1.10",
|
51
51
|
"async-sema": "3.0.1",
|
52
52
|
"buffer-crc32": "0.2.13",
|
53
53
|
"bytes": "3.1.2",
|
@@ -71,5 +71,5 @@
|
|
71
71
|
"typescript": "4.5.2",
|
72
72
|
"webpack-sources": "3.2.3"
|
73
73
|
},
|
74
|
-
"gitHead": "
|
74
|
+
"gitHead": "cfc1c9e818ebb55d440479cf0edf18536b772b28"
|
75
75
|
}
|