@vercel/next 3.0.4-canary.0 → 3.0.4-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,8 @@ async function getNextjsEdgeFunctionSource(filePaths, params, outputDir, wasm) {
|
|
39
39
|
* We validate at this point because we want to verify against user code.
|
40
40
|
* It should not count the Worker wrapper nor the Next.js wrapper.
|
41
41
|
*/
|
42
|
-
|
42
|
+
const wasmFiles = (wasm ?? []).map(({ filePath }) => (0, path_1.join)(outputDir, filePath));
|
43
|
+
await validateSize(text, wasmFiles);
|
43
44
|
// Wrap to fake module.exports
|
44
45
|
const getPageMatchCode = `(function () {
|
45
46
|
const module = { exports: {}, loaded: false };
|
@@ -64,9 +65,14 @@ function getWasmImportStatements(wasm = []) {
|
|
64
65
|
})
|
65
66
|
.join('\n');
|
66
67
|
}
|
67
|
-
async function
|
68
|
+
async function validateSize(script, wasmFiles) {
|
69
|
+
const buffers = [Buffer.from(script, 'utf8')];
|
70
|
+
for (const filePath of wasmFiles) {
|
71
|
+
buffers.push(await (0, fs_extra_1.readFile)(filePath));
|
72
|
+
}
|
73
|
+
const content = Buffer.concat(buffers);
|
68
74
|
const gzipped = await gzip(content);
|
69
75
|
if (gzipped.length > constants_1.EDGE_FUNCTION_SIZE_LIMIT) {
|
70
|
-
throw new Error(`Exceeds maximum edge function
|
76
|
+
throw new Error(`Exceeds maximum edge function size: ${(0, pretty_bytes_1.default)(gzipped.length)} / ${(0, pretty_bytes_1.default)(constants_1.EDGE_FUNCTION_SIZE_LIMIT)}`);
|
71
77
|
}
|
72
78
|
}
|
package/dist/index.js
CHANGED
@@ -44781,7 +44781,8 @@ async function getNextjsEdgeFunctionSource(filePaths, params, outputDir, wasm) {
|
|
44781
44781
|
* We validate at this point because we want to verify against user code.
|
44782
44782
|
* It should not count the Worker wrapper nor the Next.js wrapper.
|
44783
44783
|
*/
|
44784
|
-
|
44784
|
+
const wasmFiles = (wasm ?? []).map(({ filePath }) => (0, path_1.join)(outputDir, filePath));
|
44785
|
+
await validateSize(text, wasmFiles);
|
44785
44786
|
// Wrap to fake module.exports
|
44786
44787
|
const getPageMatchCode = `(function () {
|
44787
44788
|
const module = { exports: {}, loaded: false };
|
@@ -44806,10 +44807,15 @@ function getWasmImportStatements(wasm = []) {
|
|
44806
44807
|
})
|
44807
44808
|
.join('\n');
|
44808
44809
|
}
|
44809
|
-
async function
|
44810
|
+
async function validateSize(script, wasmFiles) {
|
44811
|
+
const buffers = [Buffer.from(script, 'utf8')];
|
44812
|
+
for (const filePath of wasmFiles) {
|
44813
|
+
buffers.push(await (0, fs_extra_1.readFile)(filePath));
|
44814
|
+
}
|
44815
|
+
const content = Buffer.concat(buffers);
|
44810
44816
|
const gzipped = await gzip(content);
|
44811
44817
|
if (gzipped.length > constants_1.EDGE_FUNCTION_SIZE_LIMIT) {
|
44812
|
-
throw new Error(`Exceeds maximum edge function
|
44818
|
+
throw new Error(`Exceeds maximum edge function size: ${(0, pretty_bytes_1.default)(gzipped.length)} / ${(0, pretty_bytes_1.default)(constants_1.EDGE_FUNCTION_SIZE_LIMIT)}`);
|
44813
44819
|
}
|
44814
44820
|
}
|
44815
44821
|
|
@@ -47497,6 +47503,20 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
47497
47503
|
},
|
47498
47504
|
],
|
47499
47505
|
},
|
47506
|
+
// normalize "/index" from "/_next/data/index.json" to -> just "/"
|
47507
|
+
// as matches a rewrite sources will expect just "/"
|
47508
|
+
{
|
47509
|
+
src: path_1.default.join('^/', entryDirectory, '/index'),
|
47510
|
+
has: [
|
47511
|
+
{
|
47512
|
+
type: 'header',
|
47513
|
+
key: 'x-nextjs-data',
|
47514
|
+
},
|
47515
|
+
],
|
47516
|
+
dest: path_1.default.join('/', entryDirectory),
|
47517
|
+
...(isOverride ? { override: true } : {}),
|
47518
|
+
continue: true,
|
47519
|
+
},
|
47500
47520
|
]
|
47501
47521
|
: [];
|
47502
47522
|
};
|
@@ -47504,7 +47524,19 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
47504
47524
|
return isNextDataServerResolving
|
47505
47525
|
? [
|
47506
47526
|
{
|
47507
|
-
src: '^/
|
47527
|
+
src: path_1.default.join('^/', entryDirectory, '$'),
|
47528
|
+
has: [
|
47529
|
+
{
|
47530
|
+
type: 'header',
|
47531
|
+
key: 'x-nextjs-data',
|
47532
|
+
},
|
47533
|
+
],
|
47534
|
+
dest: `${path_1.default.join('/', entryDirectory, '/_next/data/', buildId, '/index.json')}`,
|
47535
|
+
continue: true,
|
47536
|
+
...(isOverride ? { override: true } : {}),
|
47537
|
+
},
|
47538
|
+
{
|
47539
|
+
src: path_1.default.join('^/', entryDirectory, '((?!_next/).*)$'),
|
47508
47540
|
has: [
|
47509
47541
|
{
|
47510
47542
|
type: 'header',
|
package/dist/server-build.js
CHANGED
@@ -479,6 +479,20 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
479
479
|
},
|
480
480
|
],
|
481
481
|
},
|
482
|
+
// normalize "/index" from "/_next/data/index.json" to -> just "/"
|
483
|
+
// as matches a rewrite sources will expect just "/"
|
484
|
+
{
|
485
|
+
src: path_1.default.join('^/', entryDirectory, '/index'),
|
486
|
+
has: [
|
487
|
+
{
|
488
|
+
type: 'header',
|
489
|
+
key: 'x-nextjs-data',
|
490
|
+
},
|
491
|
+
],
|
492
|
+
dest: path_1.default.join('/', entryDirectory),
|
493
|
+
...(isOverride ? { override: true } : {}),
|
494
|
+
continue: true,
|
495
|
+
},
|
482
496
|
]
|
483
497
|
: [];
|
484
498
|
};
|
@@ -486,7 +500,19 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
486
500
|
return isNextDataServerResolving
|
487
501
|
? [
|
488
502
|
{
|
489
|
-
src: '^/
|
503
|
+
src: path_1.default.join('^/', entryDirectory, '$'),
|
504
|
+
has: [
|
505
|
+
{
|
506
|
+
type: 'header',
|
507
|
+
key: 'x-nextjs-data',
|
508
|
+
},
|
509
|
+
],
|
510
|
+
dest: `${path_1.default.join('/', entryDirectory, '/_next/data/', buildId, '/index.json')}`,
|
511
|
+
continue: true,
|
512
|
+
...(isOverride ? { override: true } : {}),
|
513
|
+
},
|
514
|
+
{
|
515
|
+
src: path_1.default.join('^/', entryDirectory, '((?!_next/).*)$'),
|
490
516
|
has: [
|
491
517
|
{
|
492
518
|
type: 'header',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.0.4-canary.
|
3
|
+
"version": "3.0.4-canary.3",
|
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": "998f6bf6e65301a19a400886bcc37b2dbbcdabe3"
|
74
74
|
}
|