@vercel/next 3.1.24 → 3.1.26
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 +114 -97
- package/dist/server-build.js +64 -62
- package/dist/utils.js +27 -12
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -43054,7 +43054,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43054
43054
|
}
|
43055
43055
|
}
|
43056
43056
|
}
|
43057
|
-
let dynamicPrefix = path_1.default.join('/', entryDirectory);
|
43057
|
+
let dynamicPrefix = path_1.default.posix.join('/', entryDirectory);
|
43058
43058
|
dynamicPrefix = dynamicPrefix === '/' ? '' : dynamicPrefix;
|
43059
43059
|
if (imagesManifest) {
|
43060
43060
|
switch (imagesManifest.version) {
|
@@ -43171,7 +43171,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43171
43171
|
...beforeFilesRewrites,
|
43172
43172
|
// Make sure to 404 for the /404 path itself
|
43173
43173
|
{
|
43174
|
-
src: path_1.default.join('/', entryDirectory, '404/?'),
|
43174
|
+
src: path_1.default.posix.join('/', entryDirectory, '404/?'),
|
43175
43175
|
status: 404,
|
43176
43176
|
continue: true,
|
43177
43177
|
},
|
@@ -43183,7 +43183,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43183
43183
|
...(routesManifest?.basePath
|
43184
43184
|
? [
|
43185
43185
|
{
|
43186
|
-
src: path_1.default.join('/', entryDirectory, '_next/image/?'),
|
43186
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/image/?'),
|
43187
43187
|
dest: '/_next/image',
|
43188
43188
|
check: true,
|
43189
43189
|
},
|
@@ -43192,12 +43192,12 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43192
43192
|
// No-op _next/data rewrite to trigger handle: 'rewrites' and then 404
|
43193
43193
|
// if no match to prevent rewriting _next/data unexpectedly
|
43194
43194
|
{
|
43195
|
-
src: path_1.default.join('/', entryDirectory, '_next/data/(.*)'),
|
43196
|
-
dest: path_1.default.join('/', entryDirectory, '_next/data/$1'),
|
43195
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/data/(.*)'),
|
43196
|
+
dest: path_1.default.posix.join('/', entryDirectory, '_next/data/$1'),
|
43197
43197
|
check: true,
|
43198
43198
|
},
|
43199
43199
|
{
|
43200
|
-
src: path_1.default.join('/', entryDirectory, '_next/data/(.*)'),
|
43200
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/data/(.*)'),
|
43201
43201
|
status: 404,
|
43202
43202
|
},
|
43203
43203
|
// These need to come before handle: miss or else they are grouped
|
@@ -43207,13 +43207,13 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43207
43207
|
// an index page
|
43208
43208
|
{ handle: 'resource' },
|
43209
43209
|
...fallbackRewrites,
|
43210
|
-
{ src: path_1.default.join('/', entryDirectory, '.*'), status: 404 },
|
43210
|
+
{ src: path_1.default.posix.join('/', entryDirectory, '.*'), status: 404 },
|
43211
43211
|
// We need to make sure to 404 for /_next after handle: miss since
|
43212
43212
|
// handle: miss is called before rewrites and to prevent rewriting
|
43213
43213
|
// /_next
|
43214
43214
|
{ handle: 'miss' },
|
43215
43215
|
{
|
43216
|
-
src: path_1.default.join('/', entryDirectory, '_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media)/.+'),
|
43216
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media)/.+'),
|
43217
43217
|
status: 404,
|
43218
43218
|
check: true,
|
43219
43219
|
dest: '$0',
|
@@ -43227,7 +43227,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43227
43227
|
{
|
43228
43228
|
// This ensures we only match known emitted-by-Next.js files and not
|
43229
43229
|
// user-emitted files which may be missing a hash in their filename.
|
43230
|
-
src: path_1.default.join('/', entryDirectory, `_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media|${escapedBuildId})/.+`),
|
43230
|
+
src: path_1.default.posix.join('/', entryDirectory, `_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media|${escapedBuildId})/.+`),
|
43231
43231
|
// Next.js assets contain a hash or entropy in their filenames, so they
|
43232
43232
|
// are guaranteed to be unique and cacheable indefinitely.
|
43233
43233
|
headers: {
|
@@ -43237,14 +43237,14 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43237
43237
|
important: true,
|
43238
43238
|
},
|
43239
43239
|
// error handling
|
43240
|
-
...(output[path_1.default.join('./', entryDirectory, '404')] ||
|
43241
|
-
output[path_1.default.join('./', entryDirectory, '404/index')]
|
43240
|
+
...(output[path_1.default.posix.join('./', entryDirectory, '404')] ||
|
43241
|
+
output[path_1.default.posix.join('./', entryDirectory, '404/index')]
|
43242
43242
|
? [
|
43243
43243
|
{ handle: 'error' },
|
43244
43244
|
{
|
43245
43245
|
status: 404,
|
43246
|
-
src: path_1.default.join(entryDirectory, '.*'),
|
43247
|
-
dest: path_1.default.join('/', entryDirectory, '404'),
|
43246
|
+
src: path_1.default.posix.join(entryDirectory, '.*'),
|
43247
|
+
dest: path_1.default.posix.join('/', entryDirectory, '404'),
|
43248
43248
|
},
|
43249
43249
|
]
|
43250
43250
|
: []),
|
@@ -43337,7 +43337,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43337
43337
|
});
|
43338
43338
|
}
|
43339
43339
|
(0, build_utils_1.debug)(`Creating serverless function for page: "${page}"...`);
|
43340
|
-
lambdas[path_1.default.join(entryDirectory, pathname)] = new build_utils_1.NodejsLambda({
|
43340
|
+
lambdas[path_1.default.posix.join(entryDirectory, pathname)] = new build_utils_1.NodejsLambda({
|
43341
43341
|
files: {
|
43342
43342
|
...nextFiles,
|
43343
43343
|
...pageFiles,
|
@@ -43368,24 +43368,24 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43368
43368
|
.match(/(serverless|server)\/pages\/api(\/|\.js$)/);
|
43369
43369
|
const canUsePreviewMode = Object.keys(pages).some(page => isApiPage(pages[page].fsPath));
|
43370
43370
|
staticPages = await (0, utils_1.filterStaticPages)(await (0, build_utils_1.glob)('**/*.html', pagesDir), dynamicPages, entryDirectory, exports.htmlContentType, prerenderManifest, routesManifest);
|
43371
|
-
hasStatic500 = !!staticPages[path_1.default.join(entryDirectory, '500')];
|
43371
|
+
hasStatic500 = !!staticPages[path_1.default.posix.join(entryDirectory, '500')];
|
43372
43372
|
// this can be either 404.html in latest versions
|
43373
43373
|
// or _errors/404.html versions while this was experimental
|
43374
43374
|
static404Page =
|
43375
|
-
staticPages[path_1.default.join(entryDirectory, '404')] && hasPages404
|
43376
|
-
? path_1.default.join(entryDirectory, '404')
|
43377
|
-
: staticPages[path_1.default.join(entryDirectory, '_errors/404')]
|
43378
|
-
? path_1.default.join(entryDirectory, '_errors/404')
|
43375
|
+
staticPages[path_1.default.posix.join(entryDirectory, '404')] && hasPages404
|
43376
|
+
? path_1.default.posix.join(entryDirectory, '404')
|
43377
|
+
: staticPages[path_1.default.posix.join(entryDirectory, '_errors/404')]
|
43378
|
+
? path_1.default.posix.join(entryDirectory, '_errors/404')
|
43379
43379
|
: undefined;
|
43380
43380
|
const { i18n } = routesManifest || {};
|
43381
43381
|
if (!static404Page && i18n) {
|
43382
|
-
static404Page = staticPages[path_1.default.join(entryDirectory, i18n.defaultLocale, '404')]
|
43383
|
-
? path_1.default.join(entryDirectory, i18n.defaultLocale, '404')
|
43382
|
+
static404Page = staticPages[path_1.default.posix.join(entryDirectory, i18n.defaultLocale, '404')]
|
43383
|
+
? path_1.default.posix.join(entryDirectory, i18n.defaultLocale, '404')
|
43384
43384
|
: undefined;
|
43385
43385
|
}
|
43386
43386
|
if (!hasStatic500 && i18n) {
|
43387
43387
|
hasStatic500 =
|
43388
|
-
!!staticPages[path_1.default.join(entryDirectory, i18n.defaultLocale, '500')];
|
43388
|
+
!!staticPages[path_1.default.posix.join(entryDirectory, i18n.defaultLocale, '500')];
|
43389
43389
|
}
|
43390
43390
|
if (routesManifest) {
|
43391
43391
|
switch (routesManifest.version) {
|
@@ -43409,7 +43409,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43409
43409
|
}
|
43410
43410
|
const route = {
|
43411
43411
|
src: (dataRoute.namedDataRouteRegex || dataRoute.dataRouteRegex).replace(/^\^/, `^${appMountPrefixNoTrailingSlash}`),
|
43412
|
-
dest: path_1.default.join('/', entryDirectory,
|
43412
|
+
dest: path_1.default.posix.join('/', entryDirectory,
|
43413
43413
|
// make sure to route SSG data route to the data prerender
|
43414
43414
|
// output, we don't do this for SSP routes since they don't
|
43415
43415
|
// have a separate data output
|
@@ -44881,7 +44881,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
44881
44881
|
const isCorrectNotFoundRoutes = semver_1.default.gte(nextVersion, CORRECT_NOT_FOUND_ROUTES_VERSION);
|
44882
44882
|
const isCorrectMiddlewareOrder = semver_1.default.gte(nextVersion, CORRECT_MIDDLEWARE_ORDER_VERSION);
|
44883
44883
|
const isCorrectManifests = semver_1.default.gte(nextVersion, CORRECTED_MANIFESTS_VERSION);
|
44884
|
-
let hasStatic500 = !!staticPages[path_1.default.join(entryDirectory, '500')];
|
44884
|
+
let hasStatic500 = !!staticPages[path_1.default.posix.join(entryDirectory, '500')];
|
44885
44885
|
if (lambdaPageKeys.length === 0) {
|
44886
44886
|
throw new build_utils_1.NowBuildError({
|
44887
44887
|
code: 'NEXT_NO_SERVER_PAGES',
|
@@ -44894,19 +44894,19 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
44894
44894
|
};
|
44895
44895
|
const { i18n } = routesManifest;
|
44896
44896
|
const hasPages404 = routesManifest.pages404;
|
44897
|
-
let static404Page = staticPages[path_1.default.join(entryDirectory, '404')] && hasPages404
|
44898
|
-
? path_1.default.join(entryDirectory, '404')
|
44899
|
-
: staticPages[path_1.default.join(entryDirectory, '_errors/404')]
|
44900
|
-
? path_1.default.join(entryDirectory, '_errors/404')
|
44897
|
+
let static404Page = staticPages[path_1.default.posix.join(entryDirectory, '404')] && hasPages404
|
44898
|
+
? path_1.default.posix.join(entryDirectory, '404')
|
44899
|
+
: staticPages[path_1.default.posix.join(entryDirectory, '_errors/404')]
|
44900
|
+
? path_1.default.posix.join(entryDirectory, '_errors/404')
|
44901
44901
|
: undefined;
|
44902
44902
|
if (!static404Page && i18n) {
|
44903
|
-
static404Page = staticPages[path_1.default.join(entryDirectory, i18n.defaultLocale, '404')]
|
44904
|
-
? path_1.default.join(entryDirectory, i18n.defaultLocale, '404')
|
44903
|
+
static404Page = staticPages[path_1.default.posix.join(entryDirectory, i18n.defaultLocale, '404')]
|
44904
|
+
? path_1.default.posix.join(entryDirectory, i18n.defaultLocale, '404')
|
44905
44905
|
: undefined;
|
44906
44906
|
}
|
44907
44907
|
if (!hasStatic500 && i18n) {
|
44908
44908
|
hasStatic500 =
|
44909
|
-
!!staticPages[path_1.default.join(entryDirectory, i18n.defaultLocale, '500')];
|
44909
|
+
!!staticPages[path_1.default.posix.join(entryDirectory, i18n.defaultLocale, '500')];
|
44910
44910
|
}
|
44911
44911
|
const lstatSema = new async_sema_1.Sema(25);
|
44912
44912
|
const lstatResults = {};
|
@@ -45016,7 +45016,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45016
45016
|
// for notFound GS(S)P support
|
45017
45017
|
if (i18n) {
|
45018
45018
|
for (const locale of i18n.locales) {
|
45019
|
-
const static404File = staticPages[path_1.default.join(entryDirectory, locale, '/404')] ||
|
45019
|
+
const static404File = staticPages[path_1.default.posix.join(entryDirectory, locale, '/404')] ||
|
45020
45020
|
new build_utils_1.FileFsRef({
|
45021
45021
|
fsPath: path_1.default.join(pagesDir, locale, '/404.html'),
|
45022
45022
|
});
|
@@ -45099,11 +45099,11 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45099
45099
|
})}`)
|
45100
45100
|
.replace('__NEXT_SERVER_PATH__', `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
|
45101
45101
|
if (entryDirectory !== '.' &&
|
45102
|
-
path_1.default.join('/', entryDirectory) !== routesManifest.basePath) {
|
45102
|
+
path_1.default.posix.join('/', entryDirectory) !== routesManifest.basePath) {
|
45103
45103
|
// we normalize the entryDirectory in the request URL since
|
45104
45104
|
// Next.js isn't aware of it and it isn't included in the
|
45105
45105
|
// x-matched-path header
|
45106
|
-
launcher = launcher.replace('// entryDirectory handler', `req.url = req.url.replace(/^${path_1.default
|
45106
|
+
launcher = launcher.replace('// entryDirectory handler', `req.url = req.url.replace(/^${path_1.default.posix
|
45107
45107
|
.join('/', entryDirectory)
|
45108
45108
|
.replace(/\//g, '\\/')}/, '')`);
|
45109
45109
|
}
|
@@ -45319,7 +45319,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45319
45319
|
return prerenderRoutes.has(path_1.default.join('/', locale, pageNoExt === 'index' ? '' : pageNoExt));
|
45320
45320
|
});
|
45321
45321
|
}
|
45322
|
-
const outputName = (0, utils_1.normalizeIndexOutput)(path_1.default.join(entryDirectory, pageNoExt), true);
|
45322
|
+
const outputName = (0, utils_1.normalizeIndexOutput)(path_1.default.posix.join(entryDirectory, pageNoExt), true);
|
45323
45323
|
// we add locale prefixed outputs for SSR pages,
|
45324
45324
|
// this is handled in onPrerenderRoute for SSG pages
|
45325
45325
|
if (i18n &&
|
@@ -45327,7 +45327,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45327
45327
|
(!isCorrectLocaleAPIRoutes ||
|
45328
45328
|
!(pageNoExt === 'api' || pageNoExt.startsWith('api/')))) {
|
45329
45329
|
for (const locale of i18n.locales) {
|
45330
|
-
lambdas[(0, utils_1.normalizeIndexOutput)(path_1.default.join(entryDirectory, locale, pageNoExt === 'index' ? '' : pageNoExt), true)] = lambda;
|
45330
|
+
lambdas[(0, utils_1.normalizeIndexOutput)(path_1.default.posix.join(entryDirectory, locale, pageNoExt === 'index' ? '' : pageNoExt), true)] = lambda;
|
45331
45331
|
}
|
45332
45332
|
}
|
45333
45333
|
else {
|
@@ -45365,7 +45365,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45365
45365
|
if (routesManifest?.i18n) {
|
45366
45366
|
route = (0, utils_1.normalizeLocalePath)(route, routesManifest.i18n.locales).pathname;
|
45367
45367
|
}
|
45368
|
-
delete lambdas[path_1.default.join('.', entryDirectory, route === '/' ? 'index' : route)];
|
45368
|
+
delete lambdas[path_1.default.posix.join('.', entryDirectory, route === '/' ? 'index' : route)];
|
45369
45369
|
});
|
45370
45370
|
const middleware = await (0, utils_1.getMiddlewareBundle)({
|
45371
45371
|
entryPath,
|
@@ -45383,7 +45383,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45383
45383
|
// we combine routes into one src here to reduce the number of needed
|
45384
45384
|
// routes since only the status is being modified and we don't want
|
45385
45385
|
// to exceed the routes limit
|
45386
|
-
const starterRouteSrc = `^${entryDirectory !== '.' ? path_1.default.join('/', entryDirectory, '()') : '()'}`;
|
45386
|
+
const starterRouteSrc = `^${entryDirectory !== '.' ? path_1.default.posix.join('/', entryDirectory, '()') : '()'}`;
|
45387
45387
|
let currentRouteSrc = starterRouteSrc;
|
45388
45388
|
const pushRoute = (src) => {
|
45389
45389
|
notFoundPreviewRoutes.push({
|
@@ -45423,8 +45423,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45423
45423
|
? [
|
45424
45424
|
// strip _next/data prefix for resolving
|
45425
45425
|
{
|
45426
|
-
src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
45427
|
-
dest: `${path_1.default.join('/', entryDirectory, '/$1', trailingSlash ? '/' : '')}`,
|
45426
|
+
src: `^${path_1.default.posix.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
45427
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, '/$1', trailingSlash ? '/' : '')}`,
|
45428
45428
|
...(isOverride ? { override: true } : {}),
|
45429
45429
|
continue: true,
|
45430
45430
|
has: [
|
@@ -45437,14 +45437,14 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45437
45437
|
// normalize "/index" from "/_next/data/index.json" to -> just "/"
|
45438
45438
|
// as matches a rewrite sources will expect just "/"
|
45439
45439
|
{
|
45440
|
-
src: path_1.default.join('^/', entryDirectory, '/index(?:/)?'),
|
45440
|
+
src: path_1.default.posix.join('^/', entryDirectory, '/index(?:/)?'),
|
45441
45441
|
has: [
|
45442
45442
|
{
|
45443
45443
|
type: 'header',
|
45444
45444
|
key: 'x-nextjs-data',
|
45445
45445
|
},
|
45446
45446
|
],
|
45447
|
-
dest: path_1.default.join('/', entryDirectory, trailingSlash ? '/' : ''),
|
45447
|
+
dest: path_1.default.posix.join('/', entryDirectory, trailingSlash ? '/' : ''),
|
45448
45448
|
...(isOverride ? { override: true } : {}),
|
45449
45449
|
continue: true,
|
45450
45450
|
},
|
@@ -45455,26 +45455,26 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45455
45455
|
return isNextDataServerResolving
|
45456
45456
|
? [
|
45457
45457
|
{
|
45458
|
-
src: path_1.default.join('^/', entryDirectory, trailingSlash ? '/' : '', '$'),
|
45458
|
+
src: path_1.default.posix.join('^/', entryDirectory, trailingSlash ? '/' : '', '$'),
|
45459
45459
|
has: [
|
45460
45460
|
{
|
45461
45461
|
type: 'header',
|
45462
45462
|
key: 'x-nextjs-data',
|
45463
45463
|
},
|
45464
45464
|
],
|
45465
|
-
dest: `${path_1.default.join('/', entryDirectory, '/_next/data/', buildId, '/index.json')}`,
|
45465
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, '/_next/data/', buildId, '/index.json')}`,
|
45466
45466
|
continue: true,
|
45467
45467
|
...(isOverride ? { override: true } : {}),
|
45468
45468
|
},
|
45469
45469
|
{
|
45470
|
-
src: path_1.default.join('^/', entryDirectory, '((?!_next/)(?:.*[^/]|.*))/?$'),
|
45470
|
+
src: path_1.default.posix.join('^/', entryDirectory, '((?!_next/)(?:.*[^/]|.*))/?$'),
|
45471
45471
|
has: [
|
45472
45472
|
{
|
45473
45473
|
type: 'header',
|
45474
45474
|
key: 'x-nextjs-data',
|
45475
45475
|
},
|
45476
45476
|
],
|
45477
|
-
dest: `${path_1.default.join('/', entryDirectory, '/_next/data/', buildId, '/$1.json')}`,
|
45477
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, '/_next/data/', buildId, '/$1.json')}`,
|
45478
45478
|
continue: true,
|
45479
45479
|
...(isOverride ? { override: true } : {}),
|
45480
45480
|
},
|
@@ -45542,12 +45542,14 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45542
45542
|
// Handle auto-adding current default locale to path based on
|
45543
45543
|
// $wildcard
|
45544
45544
|
{
|
45545
|
-
src: `^${path_1.default.join('/', entryDirectory, '/')}(?!(?:_next/.*|${i18n.locales
|
45545
|
+
src: `^${path_1.default.posix.join('/', entryDirectory, '/')}(?!(?:_next/.*|${i18n.locales
|
45546
45546
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
45547
45547
|
.join('|')})(?:/.*|$))(.*)$`,
|
45548
45548
|
// we aren't able to ensure trailing slash mode here
|
45549
45549
|
// so ensure this comes after the trailing slash redirect
|
45550
|
-
dest: `${entryDirectory !== '.'
|
45550
|
+
dest: `${entryDirectory !== '.'
|
45551
|
+
? path_1.default.posix.join('/', entryDirectory)
|
45552
|
+
: ''}$wildcard/$1`,
|
45551
45553
|
continue: true,
|
45552
45554
|
},
|
45553
45555
|
// Handle redirecting to locale specific domains
|
@@ -45556,7 +45558,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45556
45558
|
i18n.localeDetection !== false
|
45557
45559
|
? [
|
45558
45560
|
{
|
45559
|
-
src: `^${path_1.default.join('/', entryDirectory)}/?(?:${i18n.locales
|
45561
|
+
src: `^${path_1.default.posix.join('/', entryDirectory)}/?(?:${i18n.locales
|
45560
45562
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
45561
45563
|
.join('|')})?/?$`,
|
45562
45564
|
locale: {
|
@@ -45597,8 +45599,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45597
45599
|
]
|
45598
45600
|
: []),
|
45599
45601
|
{
|
45600
|
-
src: `^${path_1.default.join('/', entryDirectory)}$`,
|
45601
|
-
dest: `${path_1.default.join('/', entryDirectory, i18n.defaultLocale)}`,
|
45602
|
+
src: `^${path_1.default.posix.join('/', entryDirectory)}$`,
|
45603
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, i18n.defaultLocale)}`,
|
45602
45604
|
continue: true,
|
45603
45605
|
},
|
45604
45606
|
// Auto-prefix non-locale path with default locale
|
@@ -45607,10 +45609,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45607
45609
|
// e.g. for /de/posts/[slug] x-now-route-matches would have
|
45608
45610
|
// 1=posts%2Fpost-1
|
45609
45611
|
{
|
45610
|
-
src: `^${path_1.default.join('/', entryDirectory, '/')}(?!(?:_next/.*|${i18n.locales
|
45612
|
+
src: `^${path_1.default.posix.join('/', entryDirectory, '/')}(?!(?:_next/.*|${i18n.locales
|
45611
45613
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
45612
45614
|
.join('|')})(?:/.*|$))(.*)$`,
|
45613
|
-
dest: `${path_1.default.join('/', entryDirectory, i18n.defaultLocale)}/$1`,
|
45615
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, i18n.defaultLocale)}/$1`,
|
45614
45616
|
continue: true,
|
45615
45617
|
},
|
45616
45618
|
]
|
@@ -45628,7 +45630,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45628
45630
|
...(i18n
|
45629
45631
|
? [
|
45630
45632
|
{
|
45631
|
-
src: `${path_1.default.join('/', entryDirectory, '/')}(?:${i18n.locales
|
45633
|
+
src: `${path_1.default.posix.join('/', entryDirectory, '/')}(?:${i18n.locales
|
45632
45634
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
45633
45635
|
.join('|')})?[/]?404/?`,
|
45634
45636
|
status: 404,
|
@@ -45637,7 +45639,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45637
45639
|
]
|
45638
45640
|
: [
|
45639
45641
|
{
|
45640
|
-
src: path_1.default.join('/', entryDirectory, '404/?'),
|
45642
|
+
src: path_1.default.posix.join('/', entryDirectory, '404/?'),
|
45641
45643
|
status: 404,
|
45642
45644
|
continue: true,
|
45643
45645
|
},
|
@@ -45648,7 +45650,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45648
45650
|
: i18n
|
45649
45651
|
? [
|
45650
45652
|
{
|
45651
|
-
src: `${path_1.default.join('/', entryDirectory, '/')}(?:${i18n.locales
|
45653
|
+
src: `${path_1.default.posix.join('/', entryDirectory, '/')}(?:${i18n.locales
|
45652
45654
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
45653
45655
|
.join('|')})?[/]?500`,
|
45654
45656
|
status: 500,
|
@@ -45657,7 +45659,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45657
45659
|
]
|
45658
45660
|
: [
|
45659
45661
|
{
|
45660
|
-
src: path_1.default.join('/', entryDirectory, '500'),
|
45662
|
+
src: path_1.default.posix.join('/', entryDirectory, '500'),
|
45661
45663
|
status: 500,
|
45662
45664
|
continue: true,
|
45663
45665
|
},
|
@@ -45676,7 +45678,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45676
45678
|
...(routesManifest?.basePath
|
45677
45679
|
? [
|
45678
45680
|
{
|
45679
|
-
src: path_1.default.join('/', entryDirectory, '_next/image/?'),
|
45681
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/image/?'),
|
45680
45682
|
dest: '/_next/image',
|
45681
45683
|
check: true,
|
45682
45684
|
},
|
@@ -45689,8 +45691,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45689
45691
|
// No-op _next/data rewrite to trigger handle: 'rewrites' and then 404
|
45690
45692
|
// if no match to prevent rewriting _next/data unexpectedly
|
45691
45693
|
{
|
45692
|
-
src: path_1.default.join('/', entryDirectory, '_next/data/(.*)'),
|
45693
|
-
dest: path_1.default.join('/', entryDirectory, '_next/data/$1'),
|
45694
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/data/(.*)'),
|
45695
|
+
dest: path_1.default.posix.join('/', entryDirectory, '_next/data/$1'),
|
45694
45696
|
check: true,
|
45695
45697
|
},
|
45696
45698
|
]
|
@@ -45702,12 +45704,12 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45702
45704
|
// an index page
|
45703
45705
|
{ handle: 'resource' },
|
45704
45706
|
...fallbackRewrites,
|
45705
|
-
{ src: path_1.default.join('/', entryDirectory, '.*'), status: 404 },
|
45707
|
+
{ src: path_1.default.posix.join('/', entryDirectory, '.*'), status: 404 },
|
45706
45708
|
// We need to make sure to 404 for /_next after handle: miss since
|
45707
45709
|
// handle: miss is called before rewrites and to prevent rewriting /_next
|
45708
45710
|
{ handle: 'miss' },
|
45709
45711
|
{
|
45710
|
-
src: path_1.default.join('/', entryDirectory, '_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media)/.+'),
|
45712
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media)/.+'),
|
45711
45713
|
status: 404,
|
45712
45714
|
check: true,
|
45713
45715
|
dest: '$0',
|
@@ -45717,10 +45719,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45717
45719
|
...(i18n
|
45718
45720
|
? [
|
45719
45721
|
{
|
45720
|
-
src: `^${path_1.default.join('/', entryDirectory)}/?(?:${i18n.locales
|
45722
|
+
src: `^${path_1.default.posix.join('/', entryDirectory)}/?(?:${i18n.locales
|
45721
45723
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
45722
45724
|
.join('|')})/(.*)`,
|
45723
|
-
dest: `${path_1.default.join('/', entryDirectory, '/')}$1`,
|
45725
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, '/')}$1`,
|
45724
45726
|
check: true,
|
45725
45727
|
},
|
45726
45728
|
]
|
@@ -45770,8 +45772,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45770
45772
|
// ensure we 404 for non-existent _next/data routes before
|
45771
45773
|
// trying page dynamic routes
|
45772
45774
|
{
|
45773
|
-
src: path_1.default.join('/', entryDirectory, '_next/data/(.*)'),
|
45774
|
-
dest: path_1.default.join('/', entryDirectory, '404'),
|
45775
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/data/(.*)'),
|
45776
|
+
dest: path_1.default.posix.join('/', entryDirectory, '404'),
|
45775
45777
|
status: 404,
|
45776
45778
|
},
|
45777
45779
|
]
|
@@ -45782,7 +45784,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45782
45784
|
...(isNextDataServerResolving
|
45783
45785
|
? [
|
45784
45786
|
{
|
45785
|
-
src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
45787
|
+
src: `^${path_1.default.posix.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
45786
45788
|
headers: {
|
45787
45789
|
'x-nextjs-matched-path': '/$1',
|
45788
45790
|
},
|
@@ -45792,7 +45794,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45792
45794
|
// add a catch-all data route so we don't 404 when getting
|
45793
45795
|
// middleware effects
|
45794
45796
|
{
|
45795
|
-
src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
45797
|
+
src: `^${path_1.default.posix.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
45796
45798
|
dest: '__next_data_catchall',
|
45797
45799
|
},
|
45798
45800
|
]
|
@@ -45803,7 +45805,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45803
45805
|
{
|
45804
45806
|
// This ensures we only match known emitted-by-Next.js files and not
|
45805
45807
|
// user-emitted files which may be missing a hash in their filename.
|
45806
|
-
src: path_1.default.join('/', entryDirectory, `_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media|${escapedBuildId})/.+`),
|
45808
|
+
src: path_1.default.posix.join('/', entryDirectory, `_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media|${escapedBuildId})/.+`),
|
45807
45809
|
// Next.js assets contain a hash or entropy in their filenames, so they
|
45808
45810
|
// are guaranteed to be unique and cacheable indefinitely.
|
45809
45811
|
headers: {
|
@@ -45815,7 +45817,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45815
45817
|
// TODO: remove below workaround when `/` is allowed to be output
|
45816
45818
|
// different than `/index`
|
45817
45819
|
{
|
45818
|
-
src: path_1.default.join('/', entryDirectory, '/index'),
|
45820
|
+
src: path_1.default.posix.join('/', entryDirectory, '/index'),
|
45819
45821
|
headers: {
|
45820
45822
|
'x-matched-path': '/',
|
45821
45823
|
},
|
@@ -45823,7 +45825,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45823
45825
|
important: true,
|
45824
45826
|
},
|
45825
45827
|
{
|
45826
|
-
src: path_1.default.join('/', entryDirectory, `/((?!index$).*)`),
|
45828
|
+
src: path_1.default.posix.join('/', entryDirectory, `/((?!index$).*)`),
|
45827
45829
|
headers: {
|
45828
45830
|
'x-matched-path': '/$1',
|
45829
45831
|
},
|
@@ -45836,25 +45838,25 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45836
45838
|
...(i18n && (static404Page || hasIsr404Page || lambdaPages['404.js'])
|
45837
45839
|
? [
|
45838
45840
|
{
|
45839
|
-
src: `${path_1.default.join('/', entryDirectory, '/')}(?<nextLocale>${i18n.locales
|
45841
|
+
src: `${path_1.default.posix.join('/', entryDirectory, '/')}(?<nextLocale>${i18n.locales
|
45840
45842
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
45841
45843
|
.join('|')})(/.*|$)`,
|
45842
|
-
dest: path_1.default.join('/', entryDirectory, '/$nextLocale/404'),
|
45844
|
+
dest: path_1.default.posix.join('/', entryDirectory, '/$nextLocale/404'),
|
45843
45845
|
status: 404,
|
45844
45846
|
caseSensitive: true,
|
45845
45847
|
},
|
45846
45848
|
{
|
45847
|
-
src: path_1.default.join('/', entryDirectory, '.*'),
|
45848
|
-
dest: path_1.default.join('/', entryDirectory, `/${i18n.defaultLocale}/404`),
|
45849
|
+
src: path_1.default.posix.join('/', entryDirectory, '.*'),
|
45850
|
+
dest: path_1.default.posix.join('/', entryDirectory, `/${i18n.defaultLocale}/404`),
|
45849
45851
|
status: 404,
|
45850
45852
|
},
|
45851
45853
|
]
|
45852
45854
|
: [
|
45853
45855
|
{
|
45854
|
-
src: path_1.default.join('/', entryDirectory, '.*'),
|
45855
|
-
dest: path_1.default.join('/', entryDirectory, static404Page ||
|
45856
|
+
src: path_1.default.posix.join('/', entryDirectory, '.*'),
|
45857
|
+
dest: path_1.default.posix.join('/', entryDirectory, static404Page ||
|
45856
45858
|
hasIsr404Page ||
|
45857
|
-
lambdas[path_1.default.join(entryDirectory, '404')]
|
45859
|
+
lambdas[path_1.default.posix.join(entryDirectory, '404')]
|
45858
45860
|
? '/404'
|
45859
45861
|
: '/_error'),
|
45860
45862
|
status: 404,
|
@@ -45864,25 +45866,25 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45864
45866
|
...(i18n && (hasStatic500 || hasIsr500Page || lambdaPages['500.js'])
|
45865
45867
|
? [
|
45866
45868
|
{
|
45867
|
-
src: `${path_1.default.join('/', entryDirectory, '/')}(?<nextLocale>${i18n.locales
|
45869
|
+
src: `${path_1.default.posix.join('/', entryDirectory, '/')}(?<nextLocale>${i18n.locales
|
45868
45870
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
45869
45871
|
.join('|')})(/.*|$)`,
|
45870
|
-
dest: path_1.default.join('/', entryDirectory, '/$nextLocale/500'),
|
45872
|
+
dest: path_1.default.posix.join('/', entryDirectory, '/$nextLocale/500'),
|
45871
45873
|
status: 500,
|
45872
45874
|
caseSensitive: true,
|
45873
45875
|
},
|
45874
45876
|
{
|
45875
|
-
src: path_1.default.join('/', entryDirectory, '.*'),
|
45876
|
-
dest: path_1.default.join('/', entryDirectory, `/${i18n.defaultLocale}/500`),
|
45877
|
+
src: path_1.default.posix.join('/', entryDirectory, '.*'),
|
45878
|
+
dest: path_1.default.posix.join('/', entryDirectory, `/${i18n.defaultLocale}/500`),
|
45877
45879
|
status: 500,
|
45878
45880
|
},
|
45879
45881
|
]
|
45880
45882
|
: [
|
45881
45883
|
{
|
45882
|
-
src: path_1.default.join('/', entryDirectory, '.*'),
|
45883
|
-
dest: path_1.default.join('/', entryDirectory, hasStatic500 ||
|
45884
|
+
src: path_1.default.posix.join('/', entryDirectory, '.*'),
|
45885
|
+
dest: path_1.default.posix.join('/', entryDirectory, hasStatic500 ||
|
45884
45886
|
hasIsr500Page ||
|
45885
|
-
lambdas[path_1.default.join(entryDirectory, '500')]
|
45887
|
+
lambdas[path_1.default.posix.join(entryDirectory, '500')]
|
45886
45888
|
? '/500'
|
45887
45889
|
: '/_error'),
|
45888
45890
|
status: 500,
|
@@ -46183,7 +46185,7 @@ async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev,
|
|
46183
46185
|
.map(({ page, regex }) => {
|
46184
46186
|
return {
|
46185
46187
|
src: regex,
|
46186
|
-
dest: !isDev ? path_1.default.join('/', entryDirectory, page) : page,
|
46188
|
+
dest: !isDev ? path_1.default.posix.join('/', entryDirectory, page) : page,
|
46187
46189
|
check: true,
|
46188
46190
|
status: canUsePreviewMode && omittedRoutes?.has(page) ? 404 : undefined,
|
46189
46191
|
};
|
@@ -46204,7 +46206,7 @@ async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev,
|
|
46204
46206
|
const { page, namedRegex, regex, routeKeys } = params;
|
46205
46207
|
const route = {
|
46206
46208
|
src: namedRegex || regex,
|
46207
|
-
dest: `${!isDev ? path_1.default.join('/', entryDirectory, page) : page}${routeKeys
|
46209
|
+
dest: `${!isDev ? path_1.default.posix.join('/', entryDirectory, page) : page}${routeKeys
|
46208
46210
|
? `?${Object.keys(routeKeys)
|
46209
46211
|
.map(key => `${routeKeys[key]}=$${key}`)
|
46210
46212
|
.join('&')}`
|
@@ -46281,7 +46283,7 @@ async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev,
|
|
46281
46283
|
pageMatchers.forEach(pageMatcher => {
|
46282
46284
|
// in `vercel dev` we don't need to prefix the destination
|
46283
46285
|
const dest = !isDev
|
46284
|
-
? path_1.default.join('/', entryDirectory, pageMatcher.pageName)
|
46286
|
+
? path_1.default.posix.join('/', entryDirectory, pageMatcher.pageName)
|
46285
46287
|
: pageMatcher.pageName;
|
46286
46288
|
if (pageMatcher && pageMatcher.matcher) {
|
46287
46289
|
routes.push({
|
@@ -46312,7 +46314,7 @@ function localizeDynamicRoutes(dynamicRoutes, dynamicPrefix, entryDirectory, sta
|
|
46312
46314
|
if (isLocalePrefixed && !(isCorrectLocaleAPIRoutes && isApiRoute)) {
|
46313
46315
|
// ensure destination has locale prefix to match prerender output
|
46314
46316
|
// path so that the prerender object is used
|
46315
|
-
route.dest = route.dest.replace(`${path_1.default.join('/', entryDirectory, '/')}`, `${path_1.default.join('/', entryDirectory, '$nextLocale', '/')}`);
|
46317
|
+
route.dest = route.dest.replace(`${path_1.default.posix.join('/', entryDirectory, '/')}`, `${path_1.default.posix.join('/', entryDirectory, '$nextLocale', '/')}`);
|
46316
46318
|
}
|
46317
46319
|
}
|
46318
46320
|
else {
|
@@ -46349,7 +46351,7 @@ function filterStaticPages(staticPageFiles, dynamicPages, entryDirectory, htmlCo
|
|
46349
46351
|
prerenderManifest.fallbackRoutes[normalizePage(pathname)]) {
|
46350
46352
|
return;
|
46351
46353
|
}
|
46352
|
-
const staticRoute = path_1.default.join(entryDirectory, pathname);
|
46354
|
+
const staticRoute = path_1.default.posix.join(entryDirectory, pathname);
|
46353
46355
|
staticPages[staticRoute] = staticPageFiles[page];
|
46354
46356
|
staticPages[staticRoute].contentType = htmlContentType;
|
46355
46357
|
if (isDynamicRoute(pathname)) {
|
@@ -46994,10 +46996,10 @@ const onPrerenderRouteInitial = (prerenderManifest, canUsePreviewMode, entryDire
|
|
46994
46996
|
// if the 404 page used getStaticProps we need to update static404Page
|
46995
46997
|
// since it wasn't populated from the staticPages group
|
46996
46998
|
if (routeNoLocale === '/404') {
|
46997
|
-
static404Page = path_1.default.join(entryDirectory, routeKey);
|
46999
|
+
static404Page = path_1.default.posix.join(entryDirectory, routeKey);
|
46998
47000
|
}
|
46999
47001
|
if (routeNoLocale === '/500') {
|
47000
|
-
static500Page = path_1.default.join(entryDirectory, routeKey);
|
47002
|
+
static500Page = path_1.default.posix.join(entryDirectory, routeKey);
|
47001
47003
|
}
|
47002
47004
|
if (initialRevalidate === false &&
|
47003
47005
|
(!canUsePreviewMode || (hasPages404 && routeNoLocale === '/404')) &&
|
@@ -47126,7 +47128,7 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
|
|
47126
47128
|
if (isSharedLambdas) {
|
47127
47129
|
const outputSrcPathPage = normalizeIndexOutput(path_1.default.join('/', srcRoute == null
|
47128
47130
|
? outputPathPageOrig
|
47129
|
-
: path_1.default.join(entryDirectory, srcRoute === '/' ? '/index' : srcRoute)), isServerMode);
|
47131
|
+
: path_1.default.posix.join(entryDirectory, srcRoute === '/' ? '/index' : srcRoute)), isServerMode);
|
47130
47132
|
const lambdaId = pageLambdaMap[outputSrcPathPage];
|
47131
47133
|
lambda = lambdas[lambdaId];
|
47132
47134
|
}
|
@@ -47286,15 +47288,15 @@ async function getStaticFiles(entryPath, entryDirectory, outputDirectory) {
|
|
47286
47288
|
const staticDirectoryFiles = {};
|
47287
47289
|
const publicDirectoryFiles = {};
|
47288
47290
|
for (const file of Object.keys(nextStaticFiles)) {
|
47289
|
-
staticFiles[path_1.default.join(entryDirectory, `_next/static/${file}`)] =
|
47291
|
+
staticFiles[path_1.default.posix.join(entryDirectory, `_next/static/${file}`)] =
|
47290
47292
|
nextStaticFiles[file];
|
47291
47293
|
}
|
47292
47294
|
for (const file of Object.keys(staticFolderFiles)) {
|
47293
|
-
staticDirectoryFiles[path_1.default.join(entryDirectory, 'static', file)] =
|
47295
|
+
staticDirectoryFiles[path_1.default.posix.join(entryDirectory, 'static', file)] =
|
47294
47296
|
staticFolderFiles[file];
|
47295
47297
|
}
|
47296
47298
|
for (const file of Object.keys(publicFolderFiles)) {
|
47297
|
-
publicDirectoryFiles[path_1.default.join(entryDirectory, file)] =
|
47299
|
+
publicDirectoryFiles[path_1.default.posix.join(entryDirectory, file)] =
|
47298
47300
|
publicFolderFiles[file];
|
47299
47301
|
}
|
47300
47302
|
console.timeEnd(collectLabel);
|
@@ -47453,7 +47455,22 @@ async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest,
|
|
47453
47455
|
};
|
47454
47456
|
for (const worker of workerConfigs.values()) {
|
47455
47457
|
const edgeFile = worker.edgeFunction.name;
|
47456
|
-
|
47458
|
+
let shortPath = edgeFile;
|
47459
|
+
// Replacing the folder prefix for the page
|
47460
|
+
//
|
47461
|
+
// For `pages/`, use file base name directly:
|
47462
|
+
// pages/index -> index
|
47463
|
+
// For `app/`, use folder name, handle the root page as index:
|
47464
|
+
// app/route/page -> route
|
47465
|
+
// app/page -> index
|
47466
|
+
// app/index/page -> index/index
|
47467
|
+
if (shortPath.startsWith('pages/')) {
|
47468
|
+
shortPath = shortPath.replace(/^pages\//, '');
|
47469
|
+
}
|
47470
|
+
else if (shortPath.startsWith('app/') && shortPath.endsWith('/page')) {
|
47471
|
+
shortPath =
|
47472
|
+
shortPath.replace(/^app\//, '').replace(/(^|\/)page$/, '') || 'index';
|
47473
|
+
}
|
47457
47474
|
worker.edgeFunction.name = shortPath;
|
47458
47475
|
source.edgeFunctions[shortPath] = worker.edgeFunction;
|
47459
47476
|
// we don't add the route for edge functions as these
|
package/dist/server-build.js
CHANGED
@@ -38,7 +38,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
38
38
|
const isCorrectNotFoundRoutes = semver_1.default.gte(nextVersion, CORRECT_NOT_FOUND_ROUTES_VERSION);
|
39
39
|
const isCorrectMiddlewareOrder = semver_1.default.gte(nextVersion, CORRECT_MIDDLEWARE_ORDER_VERSION);
|
40
40
|
const isCorrectManifests = semver_1.default.gte(nextVersion, CORRECTED_MANIFESTS_VERSION);
|
41
|
-
let hasStatic500 = !!staticPages[path_1.default.join(entryDirectory, '500')];
|
41
|
+
let hasStatic500 = !!staticPages[path_1.default.posix.join(entryDirectory, '500')];
|
42
42
|
if (lambdaPageKeys.length === 0) {
|
43
43
|
throw new build_utils_1.NowBuildError({
|
44
44
|
code: 'NEXT_NO_SERVER_PAGES',
|
@@ -51,19 +51,19 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
51
51
|
};
|
52
52
|
const { i18n } = routesManifest;
|
53
53
|
const hasPages404 = routesManifest.pages404;
|
54
|
-
let static404Page = staticPages[path_1.default.join(entryDirectory, '404')] && hasPages404
|
55
|
-
? path_1.default.join(entryDirectory, '404')
|
56
|
-
: staticPages[path_1.default.join(entryDirectory, '_errors/404')]
|
57
|
-
? path_1.default.join(entryDirectory, '_errors/404')
|
54
|
+
let static404Page = staticPages[path_1.default.posix.join(entryDirectory, '404')] && hasPages404
|
55
|
+
? path_1.default.posix.join(entryDirectory, '404')
|
56
|
+
: staticPages[path_1.default.posix.join(entryDirectory, '_errors/404')]
|
57
|
+
? path_1.default.posix.join(entryDirectory, '_errors/404')
|
58
58
|
: undefined;
|
59
59
|
if (!static404Page && i18n) {
|
60
|
-
static404Page = staticPages[path_1.default.join(entryDirectory, i18n.defaultLocale, '404')]
|
61
|
-
? path_1.default.join(entryDirectory, i18n.defaultLocale, '404')
|
60
|
+
static404Page = staticPages[path_1.default.posix.join(entryDirectory, i18n.defaultLocale, '404')]
|
61
|
+
? path_1.default.posix.join(entryDirectory, i18n.defaultLocale, '404')
|
62
62
|
: undefined;
|
63
63
|
}
|
64
64
|
if (!hasStatic500 && i18n) {
|
65
65
|
hasStatic500 =
|
66
|
-
!!staticPages[path_1.default.join(entryDirectory, i18n.defaultLocale, '500')];
|
66
|
+
!!staticPages[path_1.default.posix.join(entryDirectory, i18n.defaultLocale, '500')];
|
67
67
|
}
|
68
68
|
const lstatSema = new async_sema_1.Sema(25);
|
69
69
|
const lstatResults = {};
|
@@ -173,7 +173,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
173
173
|
// for notFound GS(S)P support
|
174
174
|
if (i18n) {
|
175
175
|
for (const locale of i18n.locales) {
|
176
|
-
const static404File = staticPages[path_1.default.join(entryDirectory, locale, '/404')] ||
|
176
|
+
const static404File = staticPages[path_1.default.posix.join(entryDirectory, locale, '/404')] ||
|
177
177
|
new build_utils_1.FileFsRef({
|
178
178
|
fsPath: path_1.default.join(pagesDir, locale, '/404.html'),
|
179
179
|
});
|
@@ -256,11 +256,11 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
256
256
|
})}`)
|
257
257
|
.replace('__NEXT_SERVER_PATH__', `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
|
258
258
|
if (entryDirectory !== '.' &&
|
259
|
-
path_1.default.join('/', entryDirectory) !== routesManifest.basePath) {
|
259
|
+
path_1.default.posix.join('/', entryDirectory) !== routesManifest.basePath) {
|
260
260
|
// we normalize the entryDirectory in the request URL since
|
261
261
|
// Next.js isn't aware of it and it isn't included in the
|
262
262
|
// x-matched-path header
|
263
|
-
launcher = launcher.replace('// entryDirectory handler', `req.url = req.url.replace(/^${path_1.default
|
263
|
+
launcher = launcher.replace('// entryDirectory handler', `req.url = req.url.replace(/^${path_1.default.posix
|
264
264
|
.join('/', entryDirectory)
|
265
265
|
.replace(/\//g, '\\/')}/, '')`);
|
266
266
|
}
|
@@ -476,7 +476,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
476
476
|
return prerenderRoutes.has(path_1.default.join('/', locale, pageNoExt === 'index' ? '' : pageNoExt));
|
477
477
|
});
|
478
478
|
}
|
479
|
-
const outputName = (0, utils_1.normalizeIndexOutput)(path_1.default.join(entryDirectory, pageNoExt), true);
|
479
|
+
const outputName = (0, utils_1.normalizeIndexOutput)(path_1.default.posix.join(entryDirectory, pageNoExt), true);
|
480
480
|
// we add locale prefixed outputs for SSR pages,
|
481
481
|
// this is handled in onPrerenderRoute for SSG pages
|
482
482
|
if (i18n &&
|
@@ -484,7 +484,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
484
484
|
(!isCorrectLocaleAPIRoutes ||
|
485
485
|
!(pageNoExt === 'api' || pageNoExt.startsWith('api/')))) {
|
486
486
|
for (const locale of i18n.locales) {
|
487
|
-
lambdas[(0, utils_1.normalizeIndexOutput)(path_1.default.join(entryDirectory, locale, pageNoExt === 'index' ? '' : pageNoExt), true)] = lambda;
|
487
|
+
lambdas[(0, utils_1.normalizeIndexOutput)(path_1.default.posix.join(entryDirectory, locale, pageNoExt === 'index' ? '' : pageNoExt), true)] = lambda;
|
488
488
|
}
|
489
489
|
}
|
490
490
|
else {
|
@@ -522,7 +522,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
522
522
|
if (routesManifest?.i18n) {
|
523
523
|
route = (0, utils_1.normalizeLocalePath)(route, routesManifest.i18n.locales).pathname;
|
524
524
|
}
|
525
|
-
delete lambdas[path_1.default.join('.', entryDirectory, route === '/' ? 'index' : route)];
|
525
|
+
delete lambdas[path_1.default.posix.join('.', entryDirectory, route === '/' ? 'index' : route)];
|
526
526
|
});
|
527
527
|
const middleware = await (0, utils_1.getMiddlewareBundle)({
|
528
528
|
entryPath,
|
@@ -540,7 +540,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
540
540
|
// we combine routes into one src here to reduce the number of needed
|
541
541
|
// routes since only the status is being modified and we don't want
|
542
542
|
// to exceed the routes limit
|
543
|
-
const starterRouteSrc = `^${entryDirectory !== '.' ? path_1.default.join('/', entryDirectory, '()') : '()'}`;
|
543
|
+
const starterRouteSrc = `^${entryDirectory !== '.' ? path_1.default.posix.join('/', entryDirectory, '()') : '()'}`;
|
544
544
|
let currentRouteSrc = starterRouteSrc;
|
545
545
|
const pushRoute = (src) => {
|
546
546
|
notFoundPreviewRoutes.push({
|
@@ -580,8 +580,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
580
580
|
? [
|
581
581
|
// strip _next/data prefix for resolving
|
582
582
|
{
|
583
|
-
src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
584
|
-
dest: `${path_1.default.join('/', entryDirectory, '/$1', trailingSlash ? '/' : '')}`,
|
583
|
+
src: `^${path_1.default.posix.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
584
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, '/$1', trailingSlash ? '/' : '')}`,
|
585
585
|
...(isOverride ? { override: true } : {}),
|
586
586
|
continue: true,
|
587
587
|
has: [
|
@@ -594,14 +594,14 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
594
594
|
// normalize "/index" from "/_next/data/index.json" to -> just "/"
|
595
595
|
// as matches a rewrite sources will expect just "/"
|
596
596
|
{
|
597
|
-
src: path_1.default.join('^/', entryDirectory, '/index(?:/)?'),
|
597
|
+
src: path_1.default.posix.join('^/', entryDirectory, '/index(?:/)?'),
|
598
598
|
has: [
|
599
599
|
{
|
600
600
|
type: 'header',
|
601
601
|
key: 'x-nextjs-data',
|
602
602
|
},
|
603
603
|
],
|
604
|
-
dest: path_1.default.join('/', entryDirectory, trailingSlash ? '/' : ''),
|
604
|
+
dest: path_1.default.posix.join('/', entryDirectory, trailingSlash ? '/' : ''),
|
605
605
|
...(isOverride ? { override: true } : {}),
|
606
606
|
continue: true,
|
607
607
|
},
|
@@ -612,26 +612,26 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
612
612
|
return isNextDataServerResolving
|
613
613
|
? [
|
614
614
|
{
|
615
|
-
src: path_1.default.join('^/', entryDirectory, trailingSlash ? '/' : '', '$'),
|
615
|
+
src: path_1.default.posix.join('^/', entryDirectory, trailingSlash ? '/' : '', '$'),
|
616
616
|
has: [
|
617
617
|
{
|
618
618
|
type: 'header',
|
619
619
|
key: 'x-nextjs-data',
|
620
620
|
},
|
621
621
|
],
|
622
|
-
dest: `${path_1.default.join('/', entryDirectory, '/_next/data/', buildId, '/index.json')}`,
|
622
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, '/_next/data/', buildId, '/index.json')}`,
|
623
623
|
continue: true,
|
624
624
|
...(isOverride ? { override: true } : {}),
|
625
625
|
},
|
626
626
|
{
|
627
|
-
src: path_1.default.join('^/', entryDirectory, '((?!_next/)(?:.*[^/]|.*))/?$'),
|
627
|
+
src: path_1.default.posix.join('^/', entryDirectory, '((?!_next/)(?:.*[^/]|.*))/?$'),
|
628
628
|
has: [
|
629
629
|
{
|
630
630
|
type: 'header',
|
631
631
|
key: 'x-nextjs-data',
|
632
632
|
},
|
633
633
|
],
|
634
|
-
dest: `${path_1.default.join('/', entryDirectory, '/_next/data/', buildId, '/$1.json')}`,
|
634
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, '/_next/data/', buildId, '/$1.json')}`,
|
635
635
|
continue: true,
|
636
636
|
...(isOverride ? { override: true } : {}),
|
637
637
|
},
|
@@ -699,12 +699,14 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
699
699
|
// Handle auto-adding current default locale to path based on
|
700
700
|
// $wildcard
|
701
701
|
{
|
702
|
-
src: `^${path_1.default.join('/', entryDirectory, '/')}(?!(?:_next/.*|${i18n.locales
|
702
|
+
src: `^${path_1.default.posix.join('/', entryDirectory, '/')}(?!(?:_next/.*|${i18n.locales
|
703
703
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
704
704
|
.join('|')})(?:/.*|$))(.*)$`,
|
705
705
|
// we aren't able to ensure trailing slash mode here
|
706
706
|
// so ensure this comes after the trailing slash redirect
|
707
|
-
dest: `${entryDirectory !== '.'
|
707
|
+
dest: `${entryDirectory !== '.'
|
708
|
+
? path_1.default.posix.join('/', entryDirectory)
|
709
|
+
: ''}$wildcard/$1`,
|
708
710
|
continue: true,
|
709
711
|
},
|
710
712
|
// Handle redirecting to locale specific domains
|
@@ -713,7 +715,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
713
715
|
i18n.localeDetection !== false
|
714
716
|
? [
|
715
717
|
{
|
716
|
-
src: `^${path_1.default.join('/', entryDirectory)}/?(?:${i18n.locales
|
718
|
+
src: `^${path_1.default.posix.join('/', entryDirectory)}/?(?:${i18n.locales
|
717
719
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
718
720
|
.join('|')})?/?$`,
|
719
721
|
locale: {
|
@@ -754,8 +756,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
754
756
|
]
|
755
757
|
: []),
|
756
758
|
{
|
757
|
-
src: `^${path_1.default.join('/', entryDirectory)}$`,
|
758
|
-
dest: `${path_1.default.join('/', entryDirectory, i18n.defaultLocale)}`,
|
759
|
+
src: `^${path_1.default.posix.join('/', entryDirectory)}$`,
|
760
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, i18n.defaultLocale)}`,
|
759
761
|
continue: true,
|
760
762
|
},
|
761
763
|
// Auto-prefix non-locale path with default locale
|
@@ -764,10 +766,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
764
766
|
// e.g. for /de/posts/[slug] x-now-route-matches would have
|
765
767
|
// 1=posts%2Fpost-1
|
766
768
|
{
|
767
|
-
src: `^${path_1.default.join('/', entryDirectory, '/')}(?!(?:_next/.*|${i18n.locales
|
769
|
+
src: `^${path_1.default.posix.join('/', entryDirectory, '/')}(?!(?:_next/.*|${i18n.locales
|
768
770
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
769
771
|
.join('|')})(?:/.*|$))(.*)$`,
|
770
|
-
dest: `${path_1.default.join('/', entryDirectory, i18n.defaultLocale)}/$1`,
|
772
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, i18n.defaultLocale)}/$1`,
|
771
773
|
continue: true,
|
772
774
|
},
|
773
775
|
]
|
@@ -785,7 +787,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
785
787
|
...(i18n
|
786
788
|
? [
|
787
789
|
{
|
788
|
-
src: `${path_1.default.join('/', entryDirectory, '/')}(?:${i18n.locales
|
790
|
+
src: `${path_1.default.posix.join('/', entryDirectory, '/')}(?:${i18n.locales
|
789
791
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
790
792
|
.join('|')})?[/]?404/?`,
|
791
793
|
status: 404,
|
@@ -794,7 +796,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
794
796
|
]
|
795
797
|
: [
|
796
798
|
{
|
797
|
-
src: path_1.default.join('/', entryDirectory, '404/?'),
|
799
|
+
src: path_1.default.posix.join('/', entryDirectory, '404/?'),
|
798
800
|
status: 404,
|
799
801
|
continue: true,
|
800
802
|
},
|
@@ -805,7 +807,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
805
807
|
: i18n
|
806
808
|
? [
|
807
809
|
{
|
808
|
-
src: `${path_1.default.join('/', entryDirectory, '/')}(?:${i18n.locales
|
810
|
+
src: `${path_1.default.posix.join('/', entryDirectory, '/')}(?:${i18n.locales
|
809
811
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
810
812
|
.join('|')})?[/]?500`,
|
811
813
|
status: 500,
|
@@ -814,7 +816,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
814
816
|
]
|
815
817
|
: [
|
816
818
|
{
|
817
|
-
src: path_1.default.join('/', entryDirectory, '500'),
|
819
|
+
src: path_1.default.posix.join('/', entryDirectory, '500'),
|
818
820
|
status: 500,
|
819
821
|
continue: true,
|
820
822
|
},
|
@@ -833,7 +835,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
833
835
|
...(routesManifest?.basePath
|
834
836
|
? [
|
835
837
|
{
|
836
|
-
src: path_1.default.join('/', entryDirectory, '_next/image/?'),
|
838
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/image/?'),
|
837
839
|
dest: '/_next/image',
|
838
840
|
check: true,
|
839
841
|
},
|
@@ -846,8 +848,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
846
848
|
// No-op _next/data rewrite to trigger handle: 'rewrites' and then 404
|
847
849
|
// if no match to prevent rewriting _next/data unexpectedly
|
848
850
|
{
|
849
|
-
src: path_1.default.join('/', entryDirectory, '_next/data/(.*)'),
|
850
|
-
dest: path_1.default.join('/', entryDirectory, '_next/data/$1'),
|
851
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/data/(.*)'),
|
852
|
+
dest: path_1.default.posix.join('/', entryDirectory, '_next/data/$1'),
|
851
853
|
check: true,
|
852
854
|
},
|
853
855
|
]
|
@@ -859,12 +861,12 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
859
861
|
// an index page
|
860
862
|
{ handle: 'resource' },
|
861
863
|
...fallbackRewrites,
|
862
|
-
{ src: path_1.default.join('/', entryDirectory, '.*'), status: 404 },
|
864
|
+
{ src: path_1.default.posix.join('/', entryDirectory, '.*'), status: 404 },
|
863
865
|
// We need to make sure to 404 for /_next after handle: miss since
|
864
866
|
// handle: miss is called before rewrites and to prevent rewriting /_next
|
865
867
|
{ handle: 'miss' },
|
866
868
|
{
|
867
|
-
src: path_1.default.join('/', entryDirectory, '_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media)/.+'),
|
869
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media)/.+'),
|
868
870
|
status: 404,
|
869
871
|
check: true,
|
870
872
|
dest: '$0',
|
@@ -874,10 +876,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
874
876
|
...(i18n
|
875
877
|
? [
|
876
878
|
{
|
877
|
-
src: `^${path_1.default.join('/', entryDirectory)}/?(?:${i18n.locales
|
879
|
+
src: `^${path_1.default.posix.join('/', entryDirectory)}/?(?:${i18n.locales
|
878
880
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
879
881
|
.join('|')})/(.*)`,
|
880
|
-
dest: `${path_1.default.join('/', entryDirectory, '/')}$1`,
|
882
|
+
dest: `${path_1.default.posix.join('/', entryDirectory, '/')}$1`,
|
881
883
|
check: true,
|
882
884
|
},
|
883
885
|
]
|
@@ -927,8 +929,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
927
929
|
// ensure we 404 for non-existent _next/data routes before
|
928
930
|
// trying page dynamic routes
|
929
931
|
{
|
930
|
-
src: path_1.default.join('/', entryDirectory, '_next/data/(.*)'),
|
931
|
-
dest: path_1.default.join('/', entryDirectory, '404'),
|
932
|
+
src: path_1.default.posix.join('/', entryDirectory, '_next/data/(.*)'),
|
933
|
+
dest: path_1.default.posix.join('/', entryDirectory, '404'),
|
932
934
|
status: 404,
|
933
935
|
},
|
934
936
|
]
|
@@ -939,7 +941,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
939
941
|
...(isNextDataServerResolving
|
940
942
|
? [
|
941
943
|
{
|
942
|
-
src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
944
|
+
src: `^${path_1.default.posix.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
943
945
|
headers: {
|
944
946
|
'x-nextjs-matched-path': '/$1',
|
945
947
|
},
|
@@ -949,7 +951,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
949
951
|
// add a catch-all data route so we don't 404 when getting
|
950
952
|
// middleware effects
|
951
953
|
{
|
952
|
-
src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
954
|
+
src: `^${path_1.default.posix.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
953
955
|
dest: '__next_data_catchall',
|
954
956
|
},
|
955
957
|
]
|
@@ -960,7 +962,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
960
962
|
{
|
961
963
|
// This ensures we only match known emitted-by-Next.js files and not
|
962
964
|
// user-emitted files which may be missing a hash in their filename.
|
963
|
-
src: path_1.default.join('/', entryDirectory, `_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media|${escapedBuildId})/.+`),
|
965
|
+
src: path_1.default.posix.join('/', entryDirectory, `_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media|${escapedBuildId})/.+`),
|
964
966
|
// Next.js assets contain a hash or entropy in their filenames, so they
|
965
967
|
// are guaranteed to be unique and cacheable indefinitely.
|
966
968
|
headers: {
|
@@ -972,7 +974,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
972
974
|
// TODO: remove below workaround when `/` is allowed to be output
|
973
975
|
// different than `/index`
|
974
976
|
{
|
975
|
-
src: path_1.default.join('/', entryDirectory, '/index'),
|
977
|
+
src: path_1.default.posix.join('/', entryDirectory, '/index'),
|
976
978
|
headers: {
|
977
979
|
'x-matched-path': '/',
|
978
980
|
},
|
@@ -980,7 +982,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
980
982
|
important: true,
|
981
983
|
},
|
982
984
|
{
|
983
|
-
src: path_1.default.join('/', entryDirectory, `/((?!index$).*)`),
|
985
|
+
src: path_1.default.posix.join('/', entryDirectory, `/((?!index$).*)`),
|
984
986
|
headers: {
|
985
987
|
'x-matched-path': '/$1',
|
986
988
|
},
|
@@ -993,25 +995,25 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
993
995
|
...(i18n && (static404Page || hasIsr404Page || lambdaPages['404.js'])
|
994
996
|
? [
|
995
997
|
{
|
996
|
-
src: `${path_1.default.join('/', entryDirectory, '/')}(?<nextLocale>${i18n.locales
|
998
|
+
src: `${path_1.default.posix.join('/', entryDirectory, '/')}(?<nextLocale>${i18n.locales
|
997
999
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
998
1000
|
.join('|')})(/.*|$)`,
|
999
|
-
dest: path_1.default.join('/', entryDirectory, '/$nextLocale/404'),
|
1001
|
+
dest: path_1.default.posix.join('/', entryDirectory, '/$nextLocale/404'),
|
1000
1002
|
status: 404,
|
1001
1003
|
caseSensitive: true,
|
1002
1004
|
},
|
1003
1005
|
{
|
1004
|
-
src: path_1.default.join('/', entryDirectory, '.*'),
|
1005
|
-
dest: path_1.default.join('/', entryDirectory, `/${i18n.defaultLocale}/404`),
|
1006
|
+
src: path_1.default.posix.join('/', entryDirectory, '.*'),
|
1007
|
+
dest: path_1.default.posix.join('/', entryDirectory, `/${i18n.defaultLocale}/404`),
|
1006
1008
|
status: 404,
|
1007
1009
|
},
|
1008
1010
|
]
|
1009
1011
|
: [
|
1010
1012
|
{
|
1011
|
-
src: path_1.default.join('/', entryDirectory, '.*'),
|
1012
|
-
dest: path_1.default.join('/', entryDirectory, static404Page ||
|
1013
|
+
src: path_1.default.posix.join('/', entryDirectory, '.*'),
|
1014
|
+
dest: path_1.default.posix.join('/', entryDirectory, static404Page ||
|
1013
1015
|
hasIsr404Page ||
|
1014
|
-
lambdas[path_1.default.join(entryDirectory, '404')]
|
1016
|
+
lambdas[path_1.default.posix.join(entryDirectory, '404')]
|
1015
1017
|
? '/404'
|
1016
1018
|
: '/_error'),
|
1017
1019
|
status: 404,
|
@@ -1021,25 +1023,25 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
1021
1023
|
...(i18n && (hasStatic500 || hasIsr500Page || lambdaPages['500.js'])
|
1022
1024
|
? [
|
1023
1025
|
{
|
1024
|
-
src: `${path_1.default.join('/', entryDirectory, '/')}(?<nextLocale>${i18n.locales
|
1026
|
+
src: `${path_1.default.posix.join('/', entryDirectory, '/')}(?<nextLocale>${i18n.locales
|
1025
1027
|
.map(locale => (0, escape_string_regexp_1.default)(locale))
|
1026
1028
|
.join('|')})(/.*|$)`,
|
1027
|
-
dest: path_1.default.join('/', entryDirectory, '/$nextLocale/500'),
|
1029
|
+
dest: path_1.default.posix.join('/', entryDirectory, '/$nextLocale/500'),
|
1028
1030
|
status: 500,
|
1029
1031
|
caseSensitive: true,
|
1030
1032
|
},
|
1031
1033
|
{
|
1032
|
-
src: path_1.default.join('/', entryDirectory, '.*'),
|
1033
|
-
dest: path_1.default.join('/', entryDirectory, `/${i18n.defaultLocale}/500`),
|
1034
|
+
src: path_1.default.posix.join('/', entryDirectory, '.*'),
|
1035
|
+
dest: path_1.default.posix.join('/', entryDirectory, `/${i18n.defaultLocale}/500`),
|
1034
1036
|
status: 500,
|
1035
1037
|
},
|
1036
1038
|
]
|
1037
1039
|
: [
|
1038
1040
|
{
|
1039
|
-
src: path_1.default.join('/', entryDirectory, '.*'),
|
1040
|
-
dest: path_1.default.join('/', entryDirectory, hasStatic500 ||
|
1041
|
+
src: path_1.default.posix.join('/', entryDirectory, '.*'),
|
1042
|
+
dest: path_1.default.posix.join('/', entryDirectory, hasStatic500 ||
|
1041
1043
|
hasIsr500Page ||
|
1042
|
-
lambdas[path_1.default.join(entryDirectory, '500')]
|
1044
|
+
lambdas[path_1.default.posix.join(entryDirectory, '500')]
|
1043
1045
|
? '/500'
|
1044
1046
|
: '/_error'),
|
1045
1047
|
status: 500,
|
package/dist/utils.js
CHANGED
@@ -184,7 +184,7 @@ async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev,
|
|
184
184
|
.map(({ page, regex }) => {
|
185
185
|
return {
|
186
186
|
src: regex,
|
187
|
-
dest: !isDev ? path_1.default.join('/', entryDirectory, page) : page,
|
187
|
+
dest: !isDev ? path_1.default.posix.join('/', entryDirectory, page) : page,
|
188
188
|
check: true,
|
189
189
|
status: canUsePreviewMode && omittedRoutes?.has(page) ? 404 : undefined,
|
190
190
|
};
|
@@ -205,7 +205,7 @@ async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev,
|
|
205
205
|
const { page, namedRegex, regex, routeKeys } = params;
|
206
206
|
const route = {
|
207
207
|
src: namedRegex || regex,
|
208
|
-
dest: `${!isDev ? path_1.default.join('/', entryDirectory, page) : page}${routeKeys
|
208
|
+
dest: `${!isDev ? path_1.default.posix.join('/', entryDirectory, page) : page}${routeKeys
|
209
209
|
? `?${Object.keys(routeKeys)
|
210
210
|
.map(key => `${routeKeys[key]}=$${key}`)
|
211
211
|
.join('&')}`
|
@@ -282,7 +282,7 @@ async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev,
|
|
282
282
|
pageMatchers.forEach(pageMatcher => {
|
283
283
|
// in `vercel dev` we don't need to prefix the destination
|
284
284
|
const dest = !isDev
|
285
|
-
? path_1.default.join('/', entryDirectory, pageMatcher.pageName)
|
285
|
+
? path_1.default.posix.join('/', entryDirectory, pageMatcher.pageName)
|
286
286
|
: pageMatcher.pageName;
|
287
287
|
if (pageMatcher && pageMatcher.matcher) {
|
288
288
|
routes.push({
|
@@ -313,7 +313,7 @@ function localizeDynamicRoutes(dynamicRoutes, dynamicPrefix, entryDirectory, sta
|
|
313
313
|
if (isLocalePrefixed && !(isCorrectLocaleAPIRoutes && isApiRoute)) {
|
314
314
|
// ensure destination has locale prefix to match prerender output
|
315
315
|
// path so that the prerender object is used
|
316
|
-
route.dest = route.dest.replace(`${path_1.default.join('/', entryDirectory, '/')}`, `${path_1.default.join('/', entryDirectory, '$nextLocale', '/')}`);
|
316
|
+
route.dest = route.dest.replace(`${path_1.default.posix.join('/', entryDirectory, '/')}`, `${path_1.default.posix.join('/', entryDirectory, '$nextLocale', '/')}`);
|
317
317
|
}
|
318
318
|
}
|
319
319
|
else {
|
@@ -350,7 +350,7 @@ function filterStaticPages(staticPageFiles, dynamicPages, entryDirectory, htmlCo
|
|
350
350
|
prerenderManifest.fallbackRoutes[normalizePage(pathname)]) {
|
351
351
|
return;
|
352
352
|
}
|
353
|
-
const staticRoute = path_1.default.join(entryDirectory, pathname);
|
353
|
+
const staticRoute = path_1.default.posix.join(entryDirectory, pathname);
|
354
354
|
staticPages[staticRoute] = staticPageFiles[page];
|
355
355
|
staticPages[staticRoute].contentType = htmlContentType;
|
356
356
|
if (isDynamicRoute(pathname)) {
|
@@ -995,10 +995,10 @@ const onPrerenderRouteInitial = (prerenderManifest, canUsePreviewMode, entryDire
|
|
995
995
|
// if the 404 page used getStaticProps we need to update static404Page
|
996
996
|
// since it wasn't populated from the staticPages group
|
997
997
|
if (routeNoLocale === '/404') {
|
998
|
-
static404Page = path_1.default.join(entryDirectory, routeKey);
|
998
|
+
static404Page = path_1.default.posix.join(entryDirectory, routeKey);
|
999
999
|
}
|
1000
1000
|
if (routeNoLocale === '/500') {
|
1001
|
-
static500Page = path_1.default.join(entryDirectory, routeKey);
|
1001
|
+
static500Page = path_1.default.posix.join(entryDirectory, routeKey);
|
1002
1002
|
}
|
1003
1003
|
if (initialRevalidate === false &&
|
1004
1004
|
(!canUsePreviewMode || (hasPages404 && routeNoLocale === '/404')) &&
|
@@ -1127,7 +1127,7 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
|
|
1127
1127
|
if (isSharedLambdas) {
|
1128
1128
|
const outputSrcPathPage = normalizeIndexOutput(path_1.default.join('/', srcRoute == null
|
1129
1129
|
? outputPathPageOrig
|
1130
|
-
: path_1.default.join(entryDirectory, srcRoute === '/' ? '/index' : srcRoute)), isServerMode);
|
1130
|
+
: path_1.default.posix.join(entryDirectory, srcRoute === '/' ? '/index' : srcRoute)), isServerMode);
|
1131
1131
|
const lambdaId = pageLambdaMap[outputSrcPathPage];
|
1132
1132
|
lambda = lambdas[lambdaId];
|
1133
1133
|
}
|
@@ -1287,15 +1287,15 @@ async function getStaticFiles(entryPath, entryDirectory, outputDirectory) {
|
|
1287
1287
|
const staticDirectoryFiles = {};
|
1288
1288
|
const publicDirectoryFiles = {};
|
1289
1289
|
for (const file of Object.keys(nextStaticFiles)) {
|
1290
|
-
staticFiles[path_1.default.join(entryDirectory, `_next/static/${file}`)] =
|
1290
|
+
staticFiles[path_1.default.posix.join(entryDirectory, `_next/static/${file}`)] =
|
1291
1291
|
nextStaticFiles[file];
|
1292
1292
|
}
|
1293
1293
|
for (const file of Object.keys(staticFolderFiles)) {
|
1294
|
-
staticDirectoryFiles[path_1.default.join(entryDirectory, 'static', file)] =
|
1294
|
+
staticDirectoryFiles[path_1.default.posix.join(entryDirectory, 'static', file)] =
|
1295
1295
|
staticFolderFiles[file];
|
1296
1296
|
}
|
1297
1297
|
for (const file of Object.keys(publicFolderFiles)) {
|
1298
|
-
publicDirectoryFiles[path_1.default.join(entryDirectory, file)] =
|
1298
|
+
publicDirectoryFiles[path_1.default.posix.join(entryDirectory, file)] =
|
1299
1299
|
publicFolderFiles[file];
|
1300
1300
|
}
|
1301
1301
|
console.timeEnd(collectLabel);
|
@@ -1454,7 +1454,22 @@ async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest,
|
|
1454
1454
|
};
|
1455
1455
|
for (const worker of workerConfigs.values()) {
|
1456
1456
|
const edgeFile = worker.edgeFunction.name;
|
1457
|
-
|
1457
|
+
let shortPath = edgeFile;
|
1458
|
+
// Replacing the folder prefix for the page
|
1459
|
+
//
|
1460
|
+
// For `pages/`, use file base name directly:
|
1461
|
+
// pages/index -> index
|
1462
|
+
// For `app/`, use folder name, handle the root page as index:
|
1463
|
+
// app/route/page -> route
|
1464
|
+
// app/page -> index
|
1465
|
+
// app/index/page -> index/index
|
1466
|
+
if (shortPath.startsWith('pages/')) {
|
1467
|
+
shortPath = shortPath.replace(/^pages\//, '');
|
1468
|
+
}
|
1469
|
+
else if (shortPath.startsWith('app/') && shortPath.endsWith('/page')) {
|
1470
|
+
shortPath =
|
1471
|
+
shortPath.replace(/^app\//, '').replace(/(^|\/)page$/, '') || 'index';
|
1472
|
+
}
|
1458
1473
|
worker.edgeFunction.name = shortPath;
|
1459
1474
|
source.edgeFunctions[shortPath] = worker.edgeFunction;
|
1460
1475
|
// we don't add the route for edge functions as these
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.26",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -8,7 +8,7 @@
|
|
8
8
|
"build": "node build.js",
|
9
9
|
"build-dev": "node build.js --dev",
|
10
10
|
"test": "jest --env node --verbose --bail --runInBand",
|
11
|
-
"test-unit": "yarn test test/
|
11
|
+
"test-unit": "yarn test test/unit/",
|
12
12
|
"test-next-local": "jest --env node --verbose --bail --forceExit --testTimeout=360000 test/integration/*.test.js test/integration/*.test.ts",
|
13
13
|
"test-next-local:middleware": "jest --env node --verbose --bail --useStderr --testTimeout=360000 test/integration/middleware.test.ts",
|
14
14
|
"test-integration-once": "rm test/builder-info.json; jest --env node --verbose --runInBand --bail test/fixtures/**/*.test.js"
|
@@ -44,7 +44,7 @@
|
|
44
44
|
"@types/semver": "6.0.0",
|
45
45
|
"@types/text-table": "0.2.1",
|
46
46
|
"@types/webpack-sources": "3.2.0",
|
47
|
-
"@vercel/build-utils": "5.4.
|
47
|
+
"@vercel/build-utils": "5.4.3",
|
48
48
|
"@vercel/nft": "0.22.1",
|
49
49
|
"@vercel/routing-utils": "2.0.2",
|
50
50
|
"async-sema": "3.0.1",
|
@@ -69,5 +69,5 @@
|
|
69
69
|
"typescript": "4.5.2",
|
70
70
|
"webpack-sources": "3.2.3"
|
71
71
|
},
|
72
|
-
"gitHead": "
|
72
|
+
"gitHead": "619ca9342156758efdb0db8adaf20e0d4a1493e4"
|
73
73
|
}
|