@vercel/next 4.15.17 → 4.15.18
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/adapter/index.js +3 -25
- package/package.json +2 -2
package/dist/adapter/index.js
CHANGED
|
@@ -9516,11 +9516,10 @@ var import_node_path = __toESM(require("node:path"));
|
|
|
9516
9516
|
var import_build_utils = require("@vercel/build-utils");
|
|
9517
9517
|
var import_async_sema = __toESM(require_lib());
|
|
9518
9518
|
var import_fs_extra3 = __toESM(require_lib2());
|
|
9519
|
-
var
|
|
9519
|
+
var import_constants = __toESM(require_constants());
|
|
9520
9520
|
|
|
9521
9521
|
// src/pretty-bytes.ts
|
|
9522
9522
|
var import_bytes = __toESM(require_bytes());
|
|
9523
|
-
var prettyBytes = (n) => (0, import_bytes.default)(n, { unitSeparator: " " });
|
|
9524
9523
|
|
|
9525
9524
|
// src/constants.ts
|
|
9526
9525
|
var EDGE_FUNCTION_SIZE_LIMIT = 1024 * 1024;
|
|
@@ -9529,9 +9528,7 @@ var INTERNAL_PAGES = ["_app", "_error", "_document"];
|
|
|
9529
9528
|
// src/get-edge-function-source.ts
|
|
9530
9529
|
var import_fs_extra2 = __toESM(require_lib2());
|
|
9531
9530
|
var import_path = require("path");
|
|
9532
|
-
var import_util = require("util");
|
|
9533
9531
|
var import_webpack_sources2 = __toESM(require_lib3());
|
|
9534
|
-
var import_zlib = __toESM(require("zlib"));
|
|
9535
9532
|
|
|
9536
9533
|
// src/edge-function-template.ts
|
|
9537
9534
|
var template = `var b=Object.create;var p=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var h=e=>p(e,"__esModule",{value:!0});var _=(e,n)=>{h(e);for(var t in n)p(e,t,{get:n[t],enumerable:!0})},U=(e,n,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of T(n))!L.call(e,i)&&i!=="default"&&p(e,i,{get:()=>n[i],enumerable:!(t=w(n,i))||t.enumerable});return e},A=e=>U(h(p(e!=null?b(P(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);_(exports,{default:()=>N});var R=A(require("async_hooks")),S="@next/request-context",f=Symbol.for(S),C=Symbol.for("internal.storage");function O(){let e=globalThis;if(!e[f]){let n=new R.AsyncLocalStorage,t={get:()=>n.getStore(),[C]:n};e[f]=t}return e[f]}var q=O();function m(e,n){return q[C].run(e,n)}function y(e){let n={};return e&&e.forEach((t,i)=>{n[i]=t,i.toLowerCase()==="set-cookie"&&(n[i]=M(t))}),n}function M(e){let n=[],t=0,i,a,g,o,r;function x(){for(;t<e.length&&/\\s/.test(e.charAt(t));)t+=1;return t<e.length}function s(){return a=e.charAt(t),a!=="="&&a!==";"&&a!==","}for(;t<e.length;){for(i=t,r=!1;x();)if(a=e.charAt(t),a===","){for(g=t,t+=1,x(),o=t;t<e.length&&s();)t+=1;t<e.length&&e.charAt(t)==="="?(r=!0,t=o,n.push(e.substring(i,g)),i=t):t=g+1}else t+=1;(!r||t>=e.length)&&n.push(e.substring(i,e.length))}return n}function N(e){let n=e.staticRoutes.map(i=>({regexp:new RegExp(i.namedRegex),page:i.page})),t=e.dynamicRoutes?.map(i=>({regexp:new RegExp(i.namedRegex),page:i.page}))||[];return async function(a,g){let o=new URL(a.url).pathname,r={};if(e.nextConfig?.basePath&&o.startsWith(e.nextConfig.basePath)&&(o=o.replace(e.nextConfig.basePath,"")||"/"),e.nextConfig?.i18n)for(let s of e.nextConfig.i18n.locales){let u=new RegExp(\`^/\${s}($|/)\`,"i");if(o.match(u)){o=o.replace(u,"/")||"/";break}}for(let s of n)if(s.regexp.exec(o)){r.name=s.page;break}if(!r.name){let s=E(o);for(let u of t||[]){if(s&&!E(u.page))continue;let d=u.regexp.exec(o);if(d){r={name:u.page,params:d.groups};break}}}let x=await m({waitUntil:g.waitUntil},()=>_ENTRIES[\`middleware_\${e.name}\`].default.call({},{request:{url:a.url,method:a.method,headers:y(a.headers),ip:c(a.headers,l.Ip),geo:{city:c(a.headers,l.City,!0),country:c(a.headers,l.Country,!0),latitude:c(a.headers,l.Latitude),longitude:c(a.headers,l.Longitude),region:c(a.headers,l.Region,!0)},nextConfig:e.nextConfig,page:r,body:a.body}}));return x.waitUntil&&g.waitUntil(x.waitUntil),x.response}}function c(e,n,t=!1){let i=e.get(n)||void 0;return t&&i?decodeURIComponent(i):i}function E(e){return e==="/api"||e.startsWith("/api/")}var l;(function(o){o.City="x-vercel-ip-city",o.Country="x-vercel-ip-country",o.Ip="x-real-ip",o.Latitude="x-vercel-ip-latitude",o.Longitude="x-vercel-ip-longitude",o.Region="x-vercel-ip-country-region"})(l||(l={}));`;
|
|
@@ -9598,7 +9595,6 @@ function removeInlinedSourceMap(source) {
|
|
|
9598
9595
|
}
|
|
9599
9596
|
|
|
9600
9597
|
// src/get-edge-function-source.ts
|
|
9601
|
-
var gzip = (0, import_util.promisify)(import_zlib.default.gzip);
|
|
9602
9598
|
async function getNextjsEdgeFunctionSource(filePaths, params, outputDir, wasm) {
|
|
9603
9599
|
const chunks = new import_webpack_sources2.ConcatSource(raw(`globalThis._ENTRIES = {};`));
|
|
9604
9600
|
for (const filePath of filePaths) {
|
|
@@ -9608,9 +9604,6 @@ async function getNextjsEdgeFunctionSource(filePaths, params, outputDir, wasm) {
|
|
|
9608
9604
|
/**/;`));
|
|
9609
9605
|
chunks.add(await fileToSource(content, filePath, fullFilePath));
|
|
9610
9606
|
}
|
|
9611
|
-
const text = chunks.source();
|
|
9612
|
-
const wasmFiles = Object.values(wasm || {});
|
|
9613
|
-
await validateSize(text, wasmFiles);
|
|
9614
9607
|
const getPageMatchCode = `(function () {
|
|
9615
9608
|
const module = { exports: {}, loaded: false };
|
|
9616
9609
|
const fn = (function(module,exports) {${template}
|
|
@@ -9631,21 +9624,6 @@ function getWasmImportStatements(wasm) {
|
|
|
9631
9624
|
return `const ${name} = require(${JSON.stringify(pathname)});`;
|
|
9632
9625
|
}).join("\n");
|
|
9633
9626
|
}
|
|
9634
|
-
async function validateSize(script, wasmFiles) {
|
|
9635
|
-
const buffers = [Buffer.from(script, "utf8")];
|
|
9636
|
-
for (const filePath of wasmFiles) {
|
|
9637
|
-
buffers.push(await (0, import_fs_extra2.readFile)(filePath));
|
|
9638
|
-
}
|
|
9639
|
-
const content = Buffer.concat(buffers);
|
|
9640
|
-
const gzipped = await gzip(content);
|
|
9641
|
-
if (gzipped.length > EDGE_FUNCTION_SIZE_LIMIT) {
|
|
9642
|
-
throw new Error(
|
|
9643
|
-
`Exceeds maximum edge function size: ${prettyBytes(
|
|
9644
|
-
gzipped.length
|
|
9645
|
-
)} / ${prettyBytes(EDGE_FUNCTION_SIZE_LIMIT)}`
|
|
9646
|
-
);
|
|
9647
|
-
}
|
|
9648
|
-
}
|
|
9649
9627
|
|
|
9650
9628
|
// src/outputs.ts
|
|
9651
9629
|
var import_node_handler = require("./node-handler");
|
|
@@ -9773,7 +9751,7 @@ async function handleNodeOutputs(nodeOutputs, {
|
|
|
9773
9751
|
files[relPath] = import_node_path.default.posix.relative(repoRoot, fsPath);
|
|
9774
9752
|
}
|
|
9775
9753
|
files[import_node_path.default.posix.relative(repoRoot, output.filePath)] = import_node_path.default.posix.relative(repoRoot, output.filePath);
|
|
9776
|
-
if (output.type ===
|
|
9754
|
+
if (output.type === import_constants.AdapterOutputType.PAGES) {
|
|
9777
9755
|
const notFoundOutput = pages404Output || pagesErrorOutput;
|
|
9778
9756
|
if (notFoundOutput) {
|
|
9779
9757
|
for (const [relPath, fsPath] of Object.entries(
|
|
@@ -9799,7 +9777,7 @@ async function handleNodeOutputs(nodeOutputs, {
|
|
|
9799
9777
|
nextConfig: config
|
|
9800
9778
|
})
|
|
9801
9779
|
);
|
|
9802
|
-
const operationType = output.type ===
|
|
9780
|
+
const operationType = output.type === import_constants.AdapterOutputType.APP_PAGE || import_constants.AdapterOutputType.PAGES ? "PAGE" : "API";
|
|
9803
9781
|
const sourceFile = await getSourceFilePathFromPage({
|
|
9804
9782
|
workPath: projectDir,
|
|
9805
9783
|
page: output.sourcePage,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.18",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@vercel/nft": "1.1.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@next-community/adapter-vercel": "0.0.1-beta.
|
|
19
|
+
"@next-community/adapter-vercel": "0.0.1-beta.2",
|
|
20
20
|
"@types/aws-lambda": "8.10.19",
|
|
21
21
|
"@types/buffer-crc32": "0.2.0",
|
|
22
22
|
"@types/bytes": "3.1.1",
|