@vercel/next 3.4.6 → 3.5.0
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 +51 -24
- package/dist/server-build.js +5 -1
- package/dist/utils.js +30 -17
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -40896,10 +40896,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
40896
40896
|
outputDirectory,
|
40897
40897
|
appPathRoutesManifest,
|
40898
40898
|
});
|
40899
|
-
const
|
40900
|
-
.replace(/\\/g, '/')
|
40901
|
-
.match(/(serverless|server)\/pages\/api(\/|\.js$)/);
|
40902
|
-
const canUsePreviewMode = Object.keys(pages).some(page => isApiPage(pages[page].fsPath));
|
40899
|
+
const canUsePreviewMode = Object.keys(pages).some(page => (0, utils_1.isApiPage)(pages[page].fsPath));
|
40903
40900
|
staticPages = await (0, utils_1.filterStaticPages)(await (0, build_utils_1.glob)('**/*.html', pagesDir), dynamicPages, entryDirectory, exports.htmlContentType, prerenderManifest, routesManifest);
|
40904
40901
|
hasStatic500 = !!staticPages[path_1.default.posix.join(entryDirectory, '500')];
|
40905
40902
|
// this can be either 404.html in latest versions
|
@@ -41109,7 +41106,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
41109
41106
|
const route = `/${page.replace(/\.js$/, '')}`;
|
41110
41107
|
if (route === '/_error' && static404Page)
|
41111
41108
|
continue;
|
41112
|
-
if (isApiPage(pagePath)) {
|
41109
|
+
if ((0, utils_1.isApiPage)(pagePath)) {
|
41113
41110
|
apiPages.push(page);
|
41114
41111
|
}
|
41115
41112
|
else if (!nonLambdaSsgPages.has(route)) {
|
@@ -41214,6 +41211,9 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
41214
41211
|
lambdaCompressedByteLimit,
|
41215
41212
|
internalPages: [],
|
41216
41213
|
});
|
41214
|
+
for (const group of initialApiLambdaGroups) {
|
41215
|
+
group.isApiLambda = true;
|
41216
|
+
}
|
41217
41217
|
(0, build_utils_1.debug)(JSON.stringify({
|
41218
41218
|
apiLambdaGroups: initialApiLambdaGroups.map(group => ({
|
41219
41219
|
pages: group.pages,
|
@@ -41250,7 +41250,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
41250
41250
|
const pageFileName = path_1.default.normalize(path_1.default.relative(workPath, pages[page].fsPath));
|
41251
41251
|
const pathname = page.replace(/\.js$/, '');
|
41252
41252
|
const routeIsDynamic = (0, utils_1.isDynamicRoute)(pathname);
|
41253
|
-
routeIsApi = isApiPage(pageFileName);
|
41253
|
+
routeIsApi = (0, utils_1.isApiPage)(pageFileName);
|
41254
41254
|
if (routeIsDynamic) {
|
41255
41255
|
dynamicPages.push((0, utils_1.normalizePage)(pathname));
|
41256
41256
|
}
|
@@ -41366,6 +41366,10 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
41366
41366
|
},
|
41367
41367
|
],
|
41368
41368
|
handler: path_1.default.join(path_1.default.relative(baseDir, entryPath), '___next_launcher.cjs'),
|
41369
|
+
operationType: (0, utils_1.getOperationType)({
|
41370
|
+
prerenderManifest,
|
41371
|
+
pageFileName,
|
41372
|
+
}),
|
41369
41373
|
runtime: nodeVersion.runtime,
|
41370
41374
|
nextVersion,
|
41371
41375
|
...lambdaOptions,
|
@@ -41383,6 +41387,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
41383
41387
|
},
|
41384
41388
|
],
|
41385
41389
|
handler: path_1.default.join(path_1.default.relative(baseDir, entryPath), '___next_launcher.cjs'),
|
41390
|
+
operationType: (0, utils_1.getOperationType)({ pageFileName }),
|
41386
41391
|
runtime: nodeVersion.runtime,
|
41387
41392
|
nextVersion,
|
41388
41393
|
...lambdaOptions,
|
@@ -41521,6 +41526,10 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
41521
41526
|
for (const page of groupPageKeys) {
|
41522
41527
|
pageLambdaMap[page] = group.lambdaIdentifier;
|
41523
41528
|
}
|
41529
|
+
const operationType = (0, utils_1.getOperationType)({
|
41530
|
+
group,
|
41531
|
+
prerenderManifest,
|
41532
|
+
});
|
41524
41533
|
lambdas[group.lambdaIdentifier] =
|
41525
41534
|
await (0, utils_1.createLambdaFromPseudoLayers)({
|
41526
41535
|
files: {
|
@@ -41529,6 +41538,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
41529
41538
|
},
|
41530
41539
|
layers: [group.pseudoLayer],
|
41531
41540
|
handler: path_1.default.join(path_1.default.relative(baseDir, entryPath), '___next_launcher.cjs'),
|
41541
|
+
operationType,
|
41532
41542
|
runtime: nodeVersion.runtime,
|
41533
41543
|
nextVersion,
|
41534
41544
|
});
|
@@ -42788,6 +42798,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42788
42798
|
lambdaCompressedByteLimit,
|
42789
42799
|
internalPages,
|
42790
42800
|
});
|
42801
|
+
for (const group of apiLambdaGroups) {
|
42802
|
+
group.isApiLambda = true;
|
42803
|
+
}
|
42791
42804
|
(0, build_utils_1.debug)(JSON.stringify({
|
42792
42805
|
apiLambdaGroups: apiLambdaGroups.map(group => ({
|
42793
42806
|
pages: group.pages,
|
@@ -42871,6 +42884,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42871
42884
|
});
|
42872
42885
|
}
|
42873
42886
|
}
|
42887
|
+
const operationType = (0, utils_1.getOperationType)({ group, prerenderManifest });
|
42874
42888
|
const lambda = await (0, utils_1.createLambdaFromPseudoLayers)({
|
42875
42889
|
files: {
|
42876
42890
|
...launcherFiles,
|
@@ -42878,11 +42892,11 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
42878
42892
|
},
|
42879
42893
|
layers: [group.pseudoLayer, groupPageFiles],
|
42880
42894
|
handler: path_1.default.join(path_1.default.relative(baseDir, requiredServerFilesManifest.appDir || entryPath), '___next_launcher.cjs'),
|
42895
|
+
operationType,
|
42881
42896
|
memory: group.memory,
|
42882
42897
|
runtime: nodeVersion.runtime,
|
42883
42898
|
maxDuration: group.maxDuration,
|
42884
42899
|
isStreaming: group.isStreaming,
|
42885
|
-
cron: group.cron,
|
42886
42900
|
nextVersion,
|
42887
42901
|
});
|
42888
42902
|
for (const page of group.pages) {
|
@@ -43636,7 +43650,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43636
43650
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
43637
43651
|
};
|
43638
43652
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
43639
|
-
exports.upgradeMiddlewareManifest = exports.getMiddlewareManifest = exports.getMiddlewareBundle = exports.getSourceFilePathFromPage = exports.isDynamicRoute = exports.normalizePage = exports.getImagesConfig = exports.getNextConfig = exports.normalizePackageJson = exports.validateEntrypoint = exports.excludeFiles = exports.getPrivateOutputs = exports.updateRouteSrc = exports.getNextServerPath = exports.normalizeIndexOutput = exports.getStaticFiles = exports.onPrerenderRoute = exports.onPrerenderRouteInitial = exports.detectLambdaLimitExceeding = exports.outputFunctionFileSizeInfo = exports.getPageLambdaGroups = exports.MAX_UNCOMPRESSED_LAMBDA_SIZE = exports.addLocaleOrDefault = exports.normalizeLocalePath = exports.getPrerenderManifest = exports.getRequiredServerFilesManifest = exports.getExportStatus = exports.getExportIntent = exports.createLambdaFromPseudoLayers = exports.createPseudoLayer = exports.ExperimentalTraceVersion = exports.collectTracedFiles = exports.getFilesMapFromReasons = exports.filterStaticPages = exports.getImagesManifest = exports.localizeDynamicRoutes = exports.getDynamicRoutes = exports.getRoutesManifest = exports.prettyBytes = exports.MIB = exports.KIB = void 0;
|
43653
|
+
exports.isApiPage = exports.getOperationType = exports.upgradeMiddlewareManifest = exports.getMiddlewareManifest = exports.getMiddlewareBundle = exports.getSourceFilePathFromPage = exports.isDynamicRoute = exports.normalizePage = exports.getImagesConfig = exports.getNextConfig = exports.normalizePackageJson = exports.validateEntrypoint = exports.excludeFiles = exports.getPrivateOutputs = exports.updateRouteSrc = exports.getNextServerPath = exports.normalizeIndexOutput = exports.getStaticFiles = exports.onPrerenderRoute = exports.onPrerenderRouteInitial = exports.detectLambdaLimitExceeding = exports.outputFunctionFileSizeInfo = exports.getPageLambdaGroups = exports.MAX_UNCOMPRESSED_LAMBDA_SIZE = exports.addLocaleOrDefault = exports.normalizeLocalePath = exports.getPrerenderManifest = exports.getRequiredServerFilesManifest = exports.getExportStatus = exports.getExportIntent = exports.createLambdaFromPseudoLayers = exports.createPseudoLayer = exports.ExperimentalTraceVersion = exports.collectTracedFiles = exports.getFilesMapFromReasons = exports.filterStaticPages = exports.getImagesManifest = exports.localizeDynamicRoutes = exports.getDynamicRoutes = exports.getRoutesManifest = exports.prettyBytes = exports.MIB = exports.KIB = void 0;
|
43640
43654
|
const build_utils_1 = __webpack_require__(3445);
|
43641
43655
|
const async_sema_1 = __webpack_require__(7905);
|
43642
43656
|
const buffer_crc32_1 = __importDefault(__webpack_require__(2227));
|
@@ -44442,8 +44456,7 @@ async function getPageLambdaGroups({ entryPath, config, pages, prerenderRoutes,
|
|
44442
44456
|
let matchingGroup = groups.find(group => {
|
44443
44457
|
const matches = group.maxDuration === opts.maxDuration &&
|
44444
44458
|
group.memory === opts.memory &&
|
44445
|
-
group.isPrerenders === isPrerenderRoute
|
44446
|
-
!opts.cron; // Functions with a cronjob must be on their own
|
44459
|
+
group.isPrerenders === isPrerenderRoute;
|
44447
44460
|
if (matches) {
|
44448
44461
|
let newTracedFilesSize = group.pseudoLayerBytes;
|
44449
44462
|
let newTracedFilesUncompressedSize = group.pseudoLayerUncompressedBytes;
|
@@ -44475,6 +44488,7 @@ async function getPageLambdaGroups({ entryPath, config, pages, prerenderRoutes,
|
|
44475
44488
|
pages: [page],
|
44476
44489
|
...opts,
|
44477
44490
|
isPrerenders: isPrerenderRoute,
|
44491
|
+
isApiLambda: !!isApiPage(page),
|
44478
44492
|
pseudoLayerBytes: initialPseudoLayer.pseudoLayerBytes,
|
44479
44493
|
pseudoLayerUncompressedBytes: initialPseudoLayerUncompressed,
|
44480
44494
|
pseudoLayer: Object.assign({}, initialPseudoLayer.pseudoLayer),
|
@@ -45051,7 +45065,7 @@ async function getPrivateOutputs(dir, entries) {
|
|
45051
45065
|
return { files, routes };
|
45052
45066
|
}
|
45053
45067
|
exports.getPrivateOutputs = getPrivateOutputs;
|
45054
|
-
async function getMiddlewareBundle({
|
45068
|
+
async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest, isCorrectMiddlewareOrder, prerenderBypassToken, nextVersion, }) {
|
45055
45069
|
const middlewareManifest = await getMiddlewareManifest(entryPath, outputDirectory);
|
45056
45070
|
const sortedFunctions = [
|
45057
45071
|
...(!middlewareManifest
|
@@ -45081,18 +45095,6 @@ async function getMiddlewareBundle({ config = {}, entryPath, outputDirectory, ro
|
|
45081
45095
|
i18n: routesManifest.i18n,
|
45082
45096
|
},
|
45083
45097
|
}, path_1.default.resolve(entryPath, outputDirectory), edgeFunction.wasm);
|
45084
|
-
const edgeFunctionOptions = {};
|
45085
|
-
if (config.functions) {
|
45086
|
-
const sourceFile = await getSourceFilePathFromPage({
|
45087
|
-
workPath: entryPath,
|
45088
|
-
page: `${edgeFunction.page}.js`,
|
45089
|
-
});
|
45090
|
-
const opts = await (0, build_utils_1.getLambdaOptionsFromFunction)({
|
45091
|
-
sourceFile,
|
45092
|
-
config,
|
45093
|
-
});
|
45094
|
-
edgeFunctionOptions.cron = opts.cron;
|
45095
|
-
}
|
45096
45098
|
return {
|
45097
45099
|
type,
|
45098
45100
|
page: edgeFunction.page,
|
@@ -45118,7 +45120,6 @@ async function getMiddlewareBundle({ config = {}, entryPath, outputDirectory, ro
|
|
45118
45120
|
return acc;
|
45119
45121
|
}, {});
|
45120
45122
|
return new build_utils_1.EdgeFunction({
|
45121
|
-
...edgeFunctionOptions,
|
45122
45123
|
deploymentTarget: 'v8-worker',
|
45123
45124
|
name: edgeFunction.name,
|
45124
45125
|
files: {
|
@@ -45329,6 +45330,32 @@ function transformSourceMap(sourcemap) {
|
|
45329
45330
|
});
|
45330
45331
|
return { ...sourcemap, sources };
|
45331
45332
|
}
|
45333
|
+
function getOperationType({ group, prerenderManifest, pageFileName, }) {
|
45334
|
+
if (group?.isApiLambda || isApiPage(pageFileName)) {
|
45335
|
+
return 'API';
|
45336
|
+
}
|
45337
|
+
if (group?.isPrerenders) {
|
45338
|
+
return 'ISR';
|
45339
|
+
}
|
45340
|
+
if (pageFileName && prerenderManifest) {
|
45341
|
+
const { blockingFallbackRoutes = {}, fallbackRoutes = {} } = prerenderManifest;
|
45342
|
+
if (pageFileName in blockingFallbackRoutes ||
|
45343
|
+
pageFileName in fallbackRoutes) {
|
45344
|
+
return 'ISR';
|
45345
|
+
}
|
45346
|
+
}
|
45347
|
+
return 'SSR';
|
45348
|
+
}
|
45349
|
+
exports.getOperationType = getOperationType;
|
45350
|
+
function isApiPage(page) {
|
45351
|
+
if (!page) {
|
45352
|
+
return false;
|
45353
|
+
}
|
45354
|
+
return page
|
45355
|
+
.replace(/\\/g, '/')
|
45356
|
+
.match(/(serverless|server)\/pages\/api(\/|\.js$)/);
|
45357
|
+
}
|
45358
|
+
exports.isApiPage = isApiPage;
|
45332
45359
|
|
45333
45360
|
|
45334
45361
|
/***/ }),
|
package/dist/server-build.js
CHANGED
@@ -412,6 +412,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
412
412
|
lambdaCompressedByteLimit,
|
413
413
|
internalPages,
|
414
414
|
});
|
415
|
+
for (const group of apiLambdaGroups) {
|
416
|
+
group.isApiLambda = true;
|
417
|
+
}
|
415
418
|
(0, build_utils_1.debug)(JSON.stringify({
|
416
419
|
apiLambdaGroups: apiLambdaGroups.map(group => ({
|
417
420
|
pages: group.pages,
|
@@ -495,6 +498,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
495
498
|
});
|
496
499
|
}
|
497
500
|
}
|
501
|
+
const operationType = (0, utils_1.getOperationType)({ group, prerenderManifest });
|
498
502
|
const lambda = await (0, utils_1.createLambdaFromPseudoLayers)({
|
499
503
|
files: {
|
500
504
|
...launcherFiles,
|
@@ -502,11 +506,11 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
502
506
|
},
|
503
507
|
layers: [group.pseudoLayer, groupPageFiles],
|
504
508
|
handler: path_1.default.join(path_1.default.relative(baseDir, requiredServerFilesManifest.appDir || entryPath), '___next_launcher.cjs'),
|
509
|
+
operationType,
|
505
510
|
memory: group.memory,
|
506
511
|
runtime: nodeVersion.runtime,
|
507
512
|
maxDuration: group.maxDuration,
|
508
513
|
isStreaming: group.isStreaming,
|
509
|
-
cron: group.cron,
|
510
514
|
nextVersion,
|
511
515
|
});
|
512
516
|
for (const page of group.pages) {
|
package/dist/utils.js
CHANGED
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
23
23
|
};
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
25
|
-
exports.upgradeMiddlewareManifest = exports.getMiddlewareManifest = exports.getMiddlewareBundle = exports.getSourceFilePathFromPage = exports.isDynamicRoute = exports.normalizePage = exports.getImagesConfig = exports.getNextConfig = exports.normalizePackageJson = exports.validateEntrypoint = exports.excludeFiles = exports.getPrivateOutputs = exports.updateRouteSrc = exports.getNextServerPath = exports.normalizeIndexOutput = exports.getStaticFiles = exports.onPrerenderRoute = exports.onPrerenderRouteInitial = exports.detectLambdaLimitExceeding = exports.outputFunctionFileSizeInfo = exports.getPageLambdaGroups = exports.MAX_UNCOMPRESSED_LAMBDA_SIZE = exports.addLocaleOrDefault = exports.normalizeLocalePath = exports.getPrerenderManifest = exports.getRequiredServerFilesManifest = exports.getExportStatus = exports.getExportIntent = exports.createLambdaFromPseudoLayers = exports.createPseudoLayer = exports.ExperimentalTraceVersion = exports.collectTracedFiles = exports.getFilesMapFromReasons = exports.filterStaticPages = exports.getImagesManifest = exports.localizeDynamicRoutes = exports.getDynamicRoutes = exports.getRoutesManifest = exports.prettyBytes = exports.MIB = exports.KIB = void 0;
|
25
|
+
exports.isApiPage = exports.getOperationType = exports.upgradeMiddlewareManifest = exports.getMiddlewareManifest = exports.getMiddlewareBundle = exports.getSourceFilePathFromPage = exports.isDynamicRoute = exports.normalizePage = exports.getImagesConfig = exports.getNextConfig = exports.normalizePackageJson = exports.validateEntrypoint = exports.excludeFiles = exports.getPrivateOutputs = exports.updateRouteSrc = exports.getNextServerPath = exports.normalizeIndexOutput = exports.getStaticFiles = exports.onPrerenderRoute = exports.onPrerenderRouteInitial = exports.detectLambdaLimitExceeding = exports.outputFunctionFileSizeInfo = exports.getPageLambdaGroups = exports.MAX_UNCOMPRESSED_LAMBDA_SIZE = exports.addLocaleOrDefault = exports.normalizeLocalePath = exports.getPrerenderManifest = exports.getRequiredServerFilesManifest = exports.getExportStatus = exports.getExportIntent = exports.createLambdaFromPseudoLayers = exports.createPseudoLayer = exports.ExperimentalTraceVersion = exports.collectTracedFiles = exports.getFilesMapFromReasons = exports.filterStaticPages = exports.getImagesManifest = exports.localizeDynamicRoutes = exports.getDynamicRoutes = exports.getRoutesManifest = exports.prettyBytes = exports.MIB = exports.KIB = void 0;
|
26
26
|
const build_utils_1 = require("@vercel/build-utils");
|
27
27
|
const async_sema_1 = require("async-sema");
|
28
28
|
const buffer_crc32_1 = __importDefault(require("buffer-crc32"));
|
@@ -828,8 +828,7 @@ async function getPageLambdaGroups({ entryPath, config, pages, prerenderRoutes,
|
|
828
828
|
let matchingGroup = groups.find(group => {
|
829
829
|
const matches = group.maxDuration === opts.maxDuration &&
|
830
830
|
group.memory === opts.memory &&
|
831
|
-
group.isPrerenders === isPrerenderRoute
|
832
|
-
!opts.cron; // Functions with a cronjob must be on their own
|
831
|
+
group.isPrerenders === isPrerenderRoute;
|
833
832
|
if (matches) {
|
834
833
|
let newTracedFilesSize = group.pseudoLayerBytes;
|
835
834
|
let newTracedFilesUncompressedSize = group.pseudoLayerUncompressedBytes;
|
@@ -861,6 +860,7 @@ async function getPageLambdaGroups({ entryPath, config, pages, prerenderRoutes,
|
|
861
860
|
pages: [page],
|
862
861
|
...opts,
|
863
862
|
isPrerenders: isPrerenderRoute,
|
863
|
+
isApiLambda: !!isApiPage(page),
|
864
864
|
pseudoLayerBytes: initialPseudoLayer.pseudoLayerBytes,
|
865
865
|
pseudoLayerUncompressedBytes: initialPseudoLayerUncompressed,
|
866
866
|
pseudoLayer: Object.assign({}, initialPseudoLayer.pseudoLayer),
|
@@ -1437,7 +1437,7 @@ async function getPrivateOutputs(dir, entries) {
|
|
1437
1437
|
return { files, routes };
|
1438
1438
|
}
|
1439
1439
|
exports.getPrivateOutputs = getPrivateOutputs;
|
1440
|
-
async function getMiddlewareBundle({
|
1440
|
+
async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest, isCorrectMiddlewareOrder, prerenderBypassToken, nextVersion, }) {
|
1441
1441
|
const middlewareManifest = await getMiddlewareManifest(entryPath, outputDirectory);
|
1442
1442
|
const sortedFunctions = [
|
1443
1443
|
...(!middlewareManifest
|
@@ -1467,18 +1467,6 @@ async function getMiddlewareBundle({ config = {}, entryPath, outputDirectory, ro
|
|
1467
1467
|
i18n: routesManifest.i18n,
|
1468
1468
|
},
|
1469
1469
|
}, path_1.default.resolve(entryPath, outputDirectory), edgeFunction.wasm);
|
1470
|
-
const edgeFunctionOptions = {};
|
1471
|
-
if (config.functions) {
|
1472
|
-
const sourceFile = await getSourceFilePathFromPage({
|
1473
|
-
workPath: entryPath,
|
1474
|
-
page: `${edgeFunction.page}.js`,
|
1475
|
-
});
|
1476
|
-
const opts = await (0, build_utils_1.getLambdaOptionsFromFunction)({
|
1477
|
-
sourceFile,
|
1478
|
-
config,
|
1479
|
-
});
|
1480
|
-
edgeFunctionOptions.cron = opts.cron;
|
1481
|
-
}
|
1482
1470
|
return {
|
1483
1471
|
type,
|
1484
1472
|
page: edgeFunction.page,
|
@@ -1504,7 +1492,6 @@ async function getMiddlewareBundle({ config = {}, entryPath, outputDirectory, ro
|
|
1504
1492
|
return acc;
|
1505
1493
|
}, {});
|
1506
1494
|
return new build_utils_1.EdgeFunction({
|
1507
|
-
...edgeFunctionOptions,
|
1508
1495
|
deploymentTarget: 'v8-worker',
|
1509
1496
|
name: edgeFunction.name,
|
1510
1497
|
files: {
|
@@ -1715,3 +1702,29 @@ function transformSourceMap(sourcemap) {
|
|
1715
1702
|
});
|
1716
1703
|
return { ...sourcemap, sources };
|
1717
1704
|
}
|
1705
|
+
function getOperationType({ group, prerenderManifest, pageFileName, }) {
|
1706
|
+
if (group?.isApiLambda || isApiPage(pageFileName)) {
|
1707
|
+
return 'API';
|
1708
|
+
}
|
1709
|
+
if (group?.isPrerenders) {
|
1710
|
+
return 'ISR';
|
1711
|
+
}
|
1712
|
+
if (pageFileName && prerenderManifest) {
|
1713
|
+
const { blockingFallbackRoutes = {}, fallbackRoutes = {} } = prerenderManifest;
|
1714
|
+
if (pageFileName in blockingFallbackRoutes ||
|
1715
|
+
pageFileName in fallbackRoutes) {
|
1716
|
+
return 'ISR';
|
1717
|
+
}
|
1718
|
+
}
|
1719
|
+
return 'SSR';
|
1720
|
+
}
|
1721
|
+
exports.getOperationType = getOperationType;
|
1722
|
+
function isApiPage(page) {
|
1723
|
+
if (!page) {
|
1724
|
+
return false;
|
1725
|
+
}
|
1726
|
+
return page
|
1727
|
+
.replace(/\\/g, '/')
|
1728
|
+
.match(/(serverless|server)\/pages\/api(\/|\.js$)/);
|
1729
|
+
}
|
1730
|
+
exports.isApiPage = isApiPage;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.5.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -45,7 +45,7 @@
|
|
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.
|
48
|
+
"@vercel/build-utils": "6.3.0",
|
49
49
|
"@vercel/nft": "0.22.5",
|
50
50
|
"@vercel/routing-utils": "2.1.9",
|
51
51
|
"async-sema": "3.0.1",
|
@@ -71,5 +71,5 @@
|
|
71
71
|
"typescript": "4.5.2",
|
72
72
|
"webpack-sources": "3.2.3"
|
73
73
|
},
|
74
|
-
"gitHead": "
|
74
|
+
"gitHead": "70a53515bd12202f895c369504e2d5be6c9469f4"
|
75
75
|
}
|