@vercel/next 3.0.2-canary.1 → 3.0.3-canary.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 +58 -42
- package/dist/server-build.js +58 -42
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -47468,39 +47468,52 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
47468
47468
|
}
|
47469
47469
|
}
|
47470
47470
|
}
|
47471
|
-
const normalizeNextDataRoute =
|
47472
|
-
|
47473
|
-
|
47474
|
-
|
47475
|
-
|
47476
|
-
|
47477
|
-
|
47478
|
-
|
47479
|
-
|
47480
|
-
|
47481
|
-
|
47482
|
-
|
47483
|
-
|
47484
|
-
|
47485
|
-
|
47486
|
-
|
47487
|
-
|
47488
|
-
|
47489
|
-
|
47490
|
-
|
47491
|
-
|
47492
|
-
|
47493
|
-
|
47494
|
-
|
47495
|
-
|
47496
|
-
|
47497
|
-
|
47498
|
-
|
47499
|
-
|
47500
|
-
|
47501
|
-
|
47502
|
-
|
47503
|
-
|
47471
|
+
const normalizeNextDataRoute = (isOverride = false) => {
|
47472
|
+
return isNextDataServerResolving
|
47473
|
+
? [
|
47474
|
+
// strip _next/data prefix for resolving
|
47475
|
+
{
|
47476
|
+
src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
47477
|
+
dest: `${path_1.default.join('/', entryDirectory, '/$1')}`,
|
47478
|
+
...(isOverride ? { override: true } : {}),
|
47479
|
+
continue: true,
|
47480
|
+
has: [
|
47481
|
+
{
|
47482
|
+
type: 'header',
|
47483
|
+
key: 'x-nextjs-data',
|
47484
|
+
},
|
47485
|
+
],
|
47486
|
+
},
|
47487
|
+
]
|
47488
|
+
: [];
|
47489
|
+
};
|
47490
|
+
const denormalizeNextDataRoute = (isOverride = false) => {
|
47491
|
+
return isNextDataServerResolving
|
47492
|
+
? [
|
47493
|
+
{
|
47494
|
+
src: '/(.*)',
|
47495
|
+
has: [
|
47496
|
+
{
|
47497
|
+
type: 'header',
|
47498
|
+
key: 'x-nextjs-data',
|
47499
|
+
},
|
47500
|
+
],
|
47501
|
+
dest: `${path_1.default.join('/', entryDirectory, '/_next/data/', buildId, '/$1.json')}`,
|
47502
|
+
continue: true,
|
47503
|
+
...(isOverride ? { override: true } : {}),
|
47504
|
+
},
|
47505
|
+
]
|
47506
|
+
: [];
|
47507
|
+
};
|
47508
|
+
let nextDataCatchallOutput = undefined;
|
47509
|
+
if (isNextDataServerResolving) {
|
47510
|
+
const catchallFsPath = path_1.default.join(entryPath, outputDirectory, '__next_data_catchall.json');
|
47511
|
+
await fs_extra_1.default.writeFile(catchallFsPath, '{}');
|
47512
|
+
nextDataCatchallOutput = new build_utils_1.FileFsRef({
|
47513
|
+
contentType: 'application/json',
|
47514
|
+
fsPath: catchallFsPath,
|
47515
|
+
});
|
47516
|
+
}
|
47504
47517
|
return {
|
47505
47518
|
wildcard: wildcardConfig,
|
47506
47519
|
images: imagesManifest?.images?.loader === 'default'
|
@@ -47526,11 +47539,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
47526
47539
|
...middleware.edgeFunctions,
|
47527
47540
|
...(isNextDataServerResolving
|
47528
47541
|
? {
|
47529
|
-
__next_data_catchall:
|
47530
|
-
contentType: 'application/json',
|
47531
|
-
mode: 0o644,
|
47532
|
-
data: '{}',
|
47533
|
-
}),
|
47542
|
+
__next_data_catchall: nextDataCatchallOutput,
|
47534
47543
|
}
|
47535
47544
|
: {}),
|
47536
47545
|
},
|
@@ -47551,7 +47560,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
47551
47560
|
...trailingSlashRedirects,
|
47552
47561
|
...privateOutputs.routes,
|
47553
47562
|
// normalize _next/data URL before processing redirects
|
47554
|
-
...normalizeNextDataRoute,
|
47563
|
+
...normalizeNextDataRoute(true),
|
47555
47564
|
...(i18n
|
47556
47565
|
? [
|
47557
47566
|
// Handle auto-adding current default locale to path based on
|
@@ -47678,7 +47687,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
47678
47687
|
},
|
47679
47688
|
]),
|
47680
47689
|
// we need to undo _next/data normalize before checking filesystem
|
47681
|
-
...denormalizeNextDataRoute,
|
47690
|
+
...denormalizeNextDataRoute(true),
|
47682
47691
|
// while middleware was in beta the order came right before
|
47683
47692
|
// handle: 'filesystem' we maintain this for older versions
|
47684
47693
|
// to prevent a local/deploy mismatch
|
@@ -47698,7 +47707,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
47698
47707
|
]
|
47699
47708
|
: []),
|
47700
47709
|
// normalize _next/data URL before processing rewrites
|
47701
|
-
...normalizeNextDataRoute,
|
47710
|
+
...normalizeNextDataRoute(),
|
47702
47711
|
...(!isNextDataServerResolving
|
47703
47712
|
? [
|
47704
47713
|
// No-op _next/data rewrite to trigger handle: 'rewrites' and then 404
|
@@ -47756,7 +47765,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
47756
47765
|
// if there no rewrites
|
47757
47766
|
{ handle: 'rewrite' },
|
47758
47767
|
// re-build /_next/data URL after resolving
|
47759
|
-
...denormalizeNextDataRoute,
|
47768
|
+
...denormalizeNextDataRoute(),
|
47760
47769
|
// /_next/data routes for getServerProps/getStaticProps pages
|
47761
47770
|
...dataRoutes,
|
47762
47771
|
...(!isNextDataServerResolving
|
@@ -47775,6 +47784,13 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
47775
47784
|
...dynamicRoutes,
|
47776
47785
|
...(isNextDataServerResolving
|
47777
47786
|
? [
|
47787
|
+
{
|
47788
|
+
src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
47789
|
+
headers: {
|
47790
|
+
'x-nextjs-matched-path': '/$1',
|
47791
|
+
},
|
47792
|
+
continue: true,
|
47793
|
+
},
|
47778
47794
|
// add a catch-all data route so we don't 404 when getting
|
47779
47795
|
// middleware effects
|
47780
47796
|
{
|
package/dist/server-build.js
CHANGED
@@ -462,39 +462,52 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
462
462
|
}
|
463
463
|
}
|
464
464
|
}
|
465
|
-
const normalizeNextDataRoute =
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
465
|
+
const normalizeNextDataRoute = (isOverride = false) => {
|
466
|
+
return isNextDataServerResolving
|
467
|
+
? [
|
468
|
+
// strip _next/data prefix for resolving
|
469
|
+
{
|
470
|
+
src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
471
|
+
dest: `${path_1.default.join('/', entryDirectory, '/$1')}`,
|
472
|
+
...(isOverride ? { override: true } : {}),
|
473
|
+
continue: true,
|
474
|
+
has: [
|
475
|
+
{
|
476
|
+
type: 'header',
|
477
|
+
key: 'x-nextjs-data',
|
478
|
+
},
|
479
|
+
],
|
480
|
+
},
|
481
|
+
]
|
482
|
+
: [];
|
483
|
+
};
|
484
|
+
const denormalizeNextDataRoute = (isOverride = false) => {
|
485
|
+
return isNextDataServerResolving
|
486
|
+
? [
|
487
|
+
{
|
488
|
+
src: '/(.*)',
|
489
|
+
has: [
|
490
|
+
{
|
491
|
+
type: 'header',
|
492
|
+
key: 'x-nextjs-data',
|
493
|
+
},
|
494
|
+
],
|
495
|
+
dest: `${path_1.default.join('/', entryDirectory, '/_next/data/', buildId, '/$1.json')}`,
|
496
|
+
continue: true,
|
497
|
+
...(isOverride ? { override: true } : {}),
|
498
|
+
},
|
499
|
+
]
|
500
|
+
: [];
|
501
|
+
};
|
502
|
+
let nextDataCatchallOutput = undefined;
|
503
|
+
if (isNextDataServerResolving) {
|
504
|
+
const catchallFsPath = path_1.default.join(entryPath, outputDirectory, '__next_data_catchall.json');
|
505
|
+
await fs_extra_1.default.writeFile(catchallFsPath, '{}');
|
506
|
+
nextDataCatchallOutput = new build_utils_1.FileFsRef({
|
507
|
+
contentType: 'application/json',
|
508
|
+
fsPath: catchallFsPath,
|
509
|
+
});
|
510
|
+
}
|
498
511
|
return {
|
499
512
|
wildcard: wildcardConfig,
|
500
513
|
images: imagesManifest?.images?.loader === 'default'
|
@@ -520,11 +533,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
520
533
|
...middleware.edgeFunctions,
|
521
534
|
...(isNextDataServerResolving
|
522
535
|
? {
|
523
|
-
__next_data_catchall:
|
524
|
-
contentType: 'application/json',
|
525
|
-
mode: 0o644,
|
526
|
-
data: '{}',
|
527
|
-
}),
|
536
|
+
__next_data_catchall: nextDataCatchallOutput,
|
528
537
|
}
|
529
538
|
: {}),
|
530
539
|
},
|
@@ -545,7 +554,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
545
554
|
...trailingSlashRedirects,
|
546
555
|
...privateOutputs.routes,
|
547
556
|
// normalize _next/data URL before processing redirects
|
548
|
-
...normalizeNextDataRoute,
|
557
|
+
...normalizeNextDataRoute(true),
|
549
558
|
...(i18n
|
550
559
|
? [
|
551
560
|
// Handle auto-adding current default locale to path based on
|
@@ -672,7 +681,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
672
681
|
},
|
673
682
|
]),
|
674
683
|
// we need to undo _next/data normalize before checking filesystem
|
675
|
-
...denormalizeNextDataRoute,
|
684
|
+
...denormalizeNextDataRoute(true),
|
676
685
|
// while middleware was in beta the order came right before
|
677
686
|
// handle: 'filesystem' we maintain this for older versions
|
678
687
|
// to prevent a local/deploy mismatch
|
@@ -692,7 +701,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
692
701
|
]
|
693
702
|
: []),
|
694
703
|
// normalize _next/data URL before processing rewrites
|
695
|
-
...normalizeNextDataRoute,
|
704
|
+
...normalizeNextDataRoute(),
|
696
705
|
...(!isNextDataServerResolving
|
697
706
|
? [
|
698
707
|
// No-op _next/data rewrite to trigger handle: 'rewrites' and then 404
|
@@ -750,7 +759,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
750
759
|
// if there no rewrites
|
751
760
|
{ handle: 'rewrite' },
|
752
761
|
// re-build /_next/data URL after resolving
|
753
|
-
...denormalizeNextDataRoute,
|
762
|
+
...denormalizeNextDataRoute(),
|
754
763
|
// /_next/data routes for getServerProps/getStaticProps pages
|
755
764
|
...dataRoutes,
|
756
765
|
...(!isNextDataServerResolving
|
@@ -769,6 +778,13 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
769
778
|
...dynamicRoutes,
|
770
779
|
...(isNextDataServerResolving
|
771
780
|
? [
|
781
|
+
{
|
782
|
+
src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
|
783
|
+
headers: {
|
784
|
+
'x-nextjs-matched-path': '/$1',
|
785
|
+
},
|
786
|
+
continue: true,
|
787
|
+
},
|
772
788
|
// add a catch-all data route so we don't 404 when getting
|
773
789
|
// middleware effects
|
774
790
|
{
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.3-canary.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -70,5 +70,5 @@
|
|
70
70
|
"typescript": "4.5.2",
|
71
71
|
"webpack-sources": "3.2.3"
|
72
72
|
},
|
73
|
-
"gitHead": "
|
73
|
+
"gitHead": "b7b7923f92b370c5ef44bde3ced2dbc550f547e4"
|
74
74
|
}
|