@netlify/plugin-nextjs 5.0.0-beta.6 → 5.0.0-beta.8
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/build/cache.js +1 -1
- package/dist/build/content/prerendered.js +3 -3
- package/dist/build/content/server.js +3 -3
- package/dist/build/content/static.js +3 -3
- package/dist/build/functions/edge.js +3 -3
- package/dist/build/functions/server.js +4 -4
- package/dist/build/image-cdn.js +1 -1
- package/dist/build/plugin-context.js +1 -1
- package/dist/build/templates/handler-monorepo.tmpl.js +46 -0
- package/dist/build/templates/handler.tmpl.js +37 -0
- package/dist/esm-chunks/{chunk-WELZ7LFO.js → chunk-5JVNISGM.js} +12 -1
- package/dist/esm-chunks/{chunk-PCJY2SS7.js → chunk-ETPYUOBQ.js} +4 -4
- package/dist/esm-chunks/{chunk-X7XIMV6B.js → chunk-HYBEXB2Z.js} +1 -1
- package/dist/esm-chunks/{chunk-W5TLWQMF.js → chunk-N23TUUXK.js} +69 -17
- package/dist/esm-chunks/chunk-VDDK7MXY.js +1661 -0
- package/dist/esm-chunks/{chunk-MFN4GH7U.js → chunk-VZNKO4OO.js} +1 -1
- package/dist/esm-chunks/{chunk-KDRFBPAR.js → chunk-WSPFUAK4.js} +17 -29
- package/dist/esm-chunks/{chunk-NE4HYI2D.js → chunk-WT2HN3M6.js} +1 -1
- package/dist/esm-chunks/{chunk-UDWVXRI2.js → chunk-XFDUV7DP.js} +3 -3
- package/dist/esm-chunks/{chunk-COJ526HO.js → chunk-YMFYCTRI.js} +4 -4
- package/dist/esm-chunks/{chunk-AMJYZZKR.js → chunk-ZWFKLYLH.js} +6 -3
- package/dist/esm-chunks/package-2CI3IXK3.js +131 -0
- package/dist/index.js +12 -12
- package/dist/run/config.js +1 -1
- package/dist/run/constants.js +1 -1
- package/dist/run/handlers/cache.cjs +1765 -79
- package/dist/run/handlers/server.js +60 -38
- package/dist/run/handlers/tracing.js +52883 -0
- package/dist/run/headers.js +2 -2
- package/dist/run/next.cjs +1722 -34
- package/dist/run/revalidate.js +2 -2
- package/dist/run/systemlog.js +2 -2
- package/dist/shared/blobkey.js +1 -1
- package/edge-runtime/lib/headers.ts +18 -4
- package/edge-runtime/lib/next-request.ts +6 -1
- package/edge-runtime/lib/response.ts +56 -13
- package/edge-runtime/lib/util.ts +13 -3
- package/edge-runtime/middleware.ts +1 -0
- package/edge-runtime/shim/index.js +27 -0
- package/package.json +1 -1
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "../../esm-chunks/chunk-
|
|
8
|
+
require_src
|
|
9
|
+
} from "../../esm-chunks/chunk-VDDK7MXY.js";
|
|
10
10
|
import {
|
|
11
11
|
getTagsManifest
|
|
12
12
|
} from "../../esm-chunks/chunk-XIP2W57K.js";
|
|
@@ -17,15 +17,18 @@ import {
|
|
|
17
17
|
setCacheControlHeaders,
|
|
18
18
|
setCacheTagsHeaders,
|
|
19
19
|
setVaryHeaders
|
|
20
|
-
} from "../../esm-chunks/chunk-
|
|
20
|
+
} from "../../esm-chunks/chunk-N23TUUXK.js";
|
|
21
21
|
import "../../esm-chunks/chunk-TYCYFZ22.js";
|
|
22
22
|
import {
|
|
23
23
|
nextResponseProxy
|
|
24
|
-
} from "../../esm-chunks/chunk-
|
|
24
|
+
} from "../../esm-chunks/chunk-WT2HN3M6.js";
|
|
25
|
+
import {
|
|
26
|
+
import_internal
|
|
27
|
+
} from "../../esm-chunks/chunk-HYBEXB2Z.js";
|
|
25
28
|
import {
|
|
26
29
|
__commonJS,
|
|
27
30
|
__toESM
|
|
28
|
-
} from "../../esm-chunks/chunk-
|
|
31
|
+
} from "../../esm-chunks/chunk-5JVNISGM.js";
|
|
29
32
|
|
|
30
33
|
// node_modules/node-inspect-extracted/dist/inspect.js
|
|
31
34
|
var require_inspect = __commonJS({
|
|
@@ -3257,46 +3260,65 @@ function toComputeResponse(res) {
|
|
|
3257
3260
|
}
|
|
3258
3261
|
|
|
3259
3262
|
// src/run/handlers/server.ts
|
|
3263
|
+
var import_api = __toESM(require_src(), 1);
|
|
3260
3264
|
var nextHandler;
|
|
3261
3265
|
var nextConfig;
|
|
3262
3266
|
var tagsManifest;
|
|
3263
3267
|
var server_default = async (request) => {
|
|
3268
|
+
const tracer = import_api.trace.getTracer("Next.js Runtime");
|
|
3264
3269
|
if (!nextHandler) {
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3270
|
+
await tracer.startActiveSpan("initialize next server", async (span) => {
|
|
3271
|
+
const { getRunConfig, setRunConfig } = await import("../config.js");
|
|
3272
|
+
nextConfig = await getRunConfig();
|
|
3273
|
+
setRunConfig(nextConfig);
|
|
3274
|
+
tagsManifest = await getTagsManifest();
|
|
3275
|
+
span.setAttributes(
|
|
3276
|
+
Object.entries(tagsManifest).reduce(
|
|
3277
|
+
(acc, [key, value]) => ({ ...acc, [`tagsManifest.${key}`]: value }),
|
|
3278
|
+
{}
|
|
3279
|
+
)
|
|
3280
|
+
);
|
|
3281
|
+
const { getMockedRequestHandlers } = await import("../next.cjs");
|
|
3282
|
+
const url = new URL(request.url);
|
|
3283
|
+
[nextHandler] = await getMockedRequestHandlers({
|
|
3284
|
+
port: Number(url.port) || 443,
|
|
3285
|
+
hostname: url.hostname,
|
|
3286
|
+
dir: process.cwd(),
|
|
3287
|
+
isDev: false
|
|
3288
|
+
});
|
|
3289
|
+
span.end();
|
|
3276
3290
|
});
|
|
3277
3291
|
}
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3292
|
+
return await tracer.startActiveSpan("generate response", async (span) => {
|
|
3293
|
+
const { req, res } = toReqRes(request);
|
|
3294
|
+
const resProxy = nextResponseProxy(res);
|
|
3295
|
+
delete req.headers["accept-encoding"];
|
|
3296
|
+
const nextHandlerPromise = nextHandler(req, resProxy).catch((error) => {
|
|
3297
|
+
import_internal.systemLogger.withError(error).error("next handler error");
|
|
3298
|
+
console.error(error);
|
|
3299
|
+
resProxy.statusCode = 500;
|
|
3300
|
+
resProxy.end("Internal Server Error");
|
|
3301
|
+
});
|
|
3302
|
+
const response = await toComputeResponse(resProxy);
|
|
3303
|
+
await adjustDateHeader(response.headers, request, span, tracer);
|
|
3304
|
+
setCacheControlHeaders(response.headers, request);
|
|
3305
|
+
setCacheTagsHeaders(response.headers, request, tagsManifest);
|
|
3306
|
+
setVaryHeaders(response.headers, request, nextConfig);
|
|
3307
|
+
handleNextCacheHeader(response.headers);
|
|
3308
|
+
if (response.status > 300 && response.status < 400 || response.status >= 500) {
|
|
3309
|
+
const body = await response.text();
|
|
3310
|
+
span.end();
|
|
3311
|
+
return new Response(body || null, response);
|
|
3312
|
+
}
|
|
3313
|
+
const keepOpenUntilNextFullyRendered = new TransformStream({
|
|
3314
|
+
flush() {
|
|
3315
|
+
return nextHandlerPromise.then(() => {
|
|
3316
|
+
span.end();
|
|
3317
|
+
});
|
|
3318
|
+
}
|
|
3319
|
+
});
|
|
3320
|
+
return new Response(response.body?.pipeThrough(keepOpenUntilNextFullyRendered), response);
|
|
3321
|
+
});
|
|
3300
3322
|
};
|
|
3301
3323
|
export {
|
|
3302
3324
|
server_default as default
|