@netlify/plugin-nextjs 5.12.0 → 5.13.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.
@@ -7,7 +7,7 @@
7
7
  import {
8
8
  trace,
9
9
  wrapTracer
10
- } from "../../esm-chunks/chunk-FKDTZJRV.js";
10
+ } from "../../esm-chunks/chunk-5V5HA6YA.js";
11
11
  import {
12
12
  require_out
13
13
  } from "../../esm-chunks/chunk-YUXQHOYO.js";
@@ -190,23 +190,39 @@ var buildPagesCacheValue = async (path, initialRevalidateSeconds, shouldUseEnumK
190
190
  status: void 0,
191
191
  revalidate: initialRevalidateSeconds
192
192
  });
193
+ var RSC_SEGMENTS_DIR_SUFFIX = ".segments";
194
+ var RSC_SEGMENT_SUFFIX = ".segment.rsc";
193
195
  var buildAppCacheValue = async (path, shouldUseAppPageKind) => {
194
196
  const meta = JSON.parse(await readFile(`${path}.meta`, "utf-8"));
195
197
  const html = await readFile(`${path}.html`, "utf-8");
196
198
  if (shouldUseAppPageKind) {
199
+ let segmentData;
200
+ if (meta.segmentPaths) {
201
+ const segmentsDir = path + RSC_SEGMENTS_DIR_SUFFIX;
202
+ segmentData = Object.fromEntries(
203
+ await Promise.all(
204
+ meta.segmentPaths.map(async (segmentPath) => {
205
+ const segmentDataFilePath = segmentsDir + segmentPath + RSC_SEGMENT_SUFFIX;
206
+ const segmentContent = await readFile(segmentDataFilePath, "base64");
207
+ return [segmentPath, segmentContent];
208
+ })
209
+ )
210
+ );
211
+ }
197
212
  return {
198
213
  kind: "APP_PAGE",
199
214
  html,
200
215
  rscData: await readFile(`${path}.rsc`, "base64").catch(
201
216
  () => readFile(`${path}.prefetch.rsc`, "base64")
202
217
  ),
218
+ segmentData,
203
219
  ...meta
204
220
  };
205
221
  }
206
222
  const rsc = await readFile(`${path}.rsc`, "utf-8").catch(
207
223
  () => readFile(`${path}.prefetch.rsc`, "utf-8")
208
224
  );
209
- if (!meta.status && rsc.includes("NEXT_NOT_FOUND") && !meta.headers["x-next-cache-tags"].includes("/@")) {
225
+ if (!meta.status && rsc.includes("NEXT_NOT_FOUND") && !(typeof meta.headers?.["x-next-cache-tags"] === "string" && meta.headers?.["x-next-cache-tags"].includes("/@"))) {
210
226
  meta.status = 404;
211
227
  }
212
228
  return {
@@ -280,17 +296,29 @@ var copyPrerenderedContent = async (ctx) => {
280
296
  await writeCacheEntry(key, value, lastModified, ctx);
281
297
  })
282
298
  ),
283
- ...ctx.getFallbacks(manifest).map(async (route) => {
284
- const key = routeToFilePath(route);
285
- const value = await buildPagesCacheValue(
286
- join(ctx.publishDir, "server/pages", key),
287
- void 0,
288
- shouldUseEnumKind,
289
- true
290
- // there is no corresponding json file for fallback, so we are skipping it for this entry
291
- );
292
- await writeCacheEntry(key, value, Date.now(), ctx);
293
- })
299
+ ...ctx.getFallbacks(manifest).map(
300
+ (route) => limitConcurrentPrerenderContentHandling(async () => {
301
+ const key = routeToFilePath(route);
302
+ const value = await buildPagesCacheValue(
303
+ join(ctx.publishDir, "server/pages", key),
304
+ void 0,
305
+ shouldUseEnumKind,
306
+ true
307
+ // there is no corresponding json file for fallback, so we are skipping it for this entry
308
+ );
309
+ await writeCacheEntry(key, value, Date.now(), ctx);
310
+ })
311
+ ),
312
+ ...ctx.getShells(manifest).map(
313
+ (route) => limitConcurrentPrerenderContentHandling(async () => {
314
+ const key = routeToFilePath(route);
315
+ const value = await buildAppCacheValue(
316
+ join(ctx.publishDir, "server/app", key),
317
+ shouldUseAppPageKind
318
+ );
319
+ await writeCacheEntry(key, value, Date.now(), ctx);
320
+ })
321
+ )
294
322
  ]);
295
323
  if (existsSync(join(ctx.publishDir, `server/app/_not-found.html`))) {
296
324
  const lastModified = Date.now();
@@ -7,7 +7,7 @@
7
7
  import {
8
8
  trace,
9
9
  wrapTracer
10
- } from "../../esm-chunks/chunk-FKDTZJRV.js";
10
+ } from "../../esm-chunks/chunk-5V5HA6YA.js";
11
11
  import {
12
12
  require_out
13
13
  } from "../../esm-chunks/chunk-YUXQHOYO.js";
@@ -109,6 +109,14 @@ var copyNextServerCode = async (ctx) => {
109
109
  }
110
110
  return;
111
111
  }
112
+ if (path === "server/functions-config-manifest.json") {
113
+ try {
114
+ await replaceFunctionsConfigManifest(srcPath, destPath);
115
+ } catch (error) {
116
+ throw new Error("Could not patch functions config manifest file", { cause: error });
117
+ }
118
+ return;
119
+ }
112
120
  await cp(srcPath, destPath, { recursive: true, force: true });
113
121
  })
114
122
  );
@@ -246,6 +254,35 @@ var replaceMiddlewareManifest = async (sourcePath, destPath) => {
246
254
  const newData = JSON.stringify(newManifest);
247
255
  await writeFile(destPath, newData);
248
256
  };
257
+ var replaceFunctionsConfigManifest = async (sourcePath, destPath) => {
258
+ const data = await readFile(sourcePath, "utf8");
259
+ const manifest = JSON.parse(data);
260
+ if (manifest?.functions?.["/_middleware"]?.matchers) {
261
+ const newManifest = {
262
+ ...manifest,
263
+ functions: {
264
+ ...manifest.functions,
265
+ "/_middleware": {
266
+ ...manifest.functions["/_middleware"],
267
+ matchers: manifest.functions["/_middleware"].matchers.map((matcher) => {
268
+ return {
269
+ ...matcher,
270
+ // matcher that won't match on anything
271
+ // this is meant to disable actually running middleware in the server handler,
272
+ // while still allowing next server to enable some middleware specific handling
273
+ // such as _next/data normalization ( https://github.com/vercel/next.js/blob/7bb72e508572237fe0d4aac5418546d4b4b3a363/packages/next/src/server/lib/router-utils/resolve-routes.ts#L395 )
274
+ regexp: "(?!.*)"
275
+ };
276
+ })
277
+ }
278
+ }
279
+ };
280
+ const newData = JSON.stringify(newManifest);
281
+ await writeFile(destPath, newData);
282
+ } else {
283
+ await cp(sourcePath, destPath, { recursive: true, force: true });
284
+ }
285
+ };
249
286
  var verifyHandlerDirStructure = async (ctx) => {
250
287
  const { nextConfig } = JSON.parse(
251
288
  await readFile(join(ctx.serverHandlerDir, RUN_CONFIG_FILE), "utf-8")
@@ -7,7 +7,7 @@
7
7
  import {
8
8
  trace,
9
9
  wrapTracer
10
- } from "../../esm-chunks/chunk-FKDTZJRV.js";
10
+ } from "../../esm-chunks/chunk-5V5HA6YA.js";
11
11
  import {
12
12
  require_out
13
13
  } from "../../esm-chunks/chunk-YUXQHOYO.js";
@@ -406,8 +406,11 @@ var require_dist = __commonJS({
406
406
  var import_fast_glob = __toESM(require_out(), 1);
407
407
  var import_path_to_regexp = __toESM(require_dist(), 1);
408
408
  import { cp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
409
- import { dirname, join } from "node:path";
409
+ import { dirname, join, relative } from "node:path/posix";
410
410
  import { EDGE_HANDLER_NAME } from "../plugin-context.js";
411
+ function nodeMiddlewareDefinitionHasMatcher(definition) {
412
+ return Array.isArray(definition.matchers);
413
+ }
411
414
  var writeEdgeManifest = async (ctx, manifest) => {
412
415
  await mkdir(ctx.edgeFunctionsDir, { recursive: true });
413
416
  await writeFile(join(ctx.edgeFunctionsDir, "manifest.json"), JSON.stringify(manifest, null, 2));
@@ -487,11 +490,11 @@ var writeHandlerFile = async (ctx, { matchers, name }) => {
487
490
  `
488
491
  );
489
492
  };
490
- var copyHandlerDependencies = async (ctx, { name, env, files, wasm }) => {
493
+ var copyHandlerDependenciesForEdgeMiddleware = async (ctx, { name, env, files, wasm }) => {
491
494
  const srcDir = join(ctx.standaloneDir, ctx.nextDistDir);
492
495
  const destDir = join(ctx.edgeFunctionsDir, getHandlerName({ name }));
493
496
  const edgeRuntimeDir = join(ctx.pluginDir, "edge-runtime");
494
- const shimPath = join(edgeRuntimeDir, "shim/index.js");
497
+ const shimPath = join(edgeRuntimeDir, "shim/edge.js");
495
498
  const shim = await readFile(shimPath, "utf8");
496
499
  const parts = [shim];
497
500
  const outputFile = join(destDir, `server/${name}.js`);
@@ -520,17 +523,87 @@ var copyHandlerDependencies = async (ctx, { name, env, files, wasm }) => {
520
523
  await mkdir(dirname(outputFile), { recursive: true });
521
524
  await writeFile(outputFile, parts.join("\n"));
522
525
  };
526
+ var NODE_MIDDLEWARE_NAME = "node-middleware";
527
+ var copyHandlerDependenciesForNodeMiddleware = async (ctx) => {
528
+ const name = NODE_MIDDLEWARE_NAME;
529
+ const srcDir = join(ctx.standaloneDir, ctx.nextDistDir);
530
+ const destDir = join(ctx.edgeFunctionsDir, getHandlerName({ name }));
531
+ const edgeRuntimeDir = join(ctx.pluginDir, "edge-runtime");
532
+ const shimPath = join(edgeRuntimeDir, "shim/node.js");
533
+ const shim = await readFile(shimPath, "utf8");
534
+ const parts = [shim];
535
+ const entry = "server/middleware.js";
536
+ const nft = `${entry}.nft.json`;
537
+ const nftFilesPath = join(process.cwd(), ctx.nextDistDir, nft);
538
+ const nftManifest = JSON.parse(await readFile(nftFilesPath, "utf8"));
539
+ const files = nftManifest.files.map((file) => join("server", file));
540
+ files.push(entry);
541
+ const { maxParentDirectoriesPath, unsupportedDotNodeModules } = files.reduce(
542
+ (acc, file) => {
543
+ let dirsUp = 0;
544
+ let parentDirectoriesPath = "";
545
+ for (const part of file.split("/")) {
546
+ if (part === "..") {
547
+ dirsUp += 1;
548
+ parentDirectoriesPath += "../";
549
+ } else {
550
+ break;
551
+ }
552
+ }
553
+ if (file.endsWith(".node")) {
554
+ acc.unsupportedDotNodeModules.push(join(srcDir, file));
555
+ }
556
+ if (dirsUp > acc.maxDirsUp) {
557
+ return {
558
+ ...acc,
559
+ maxDirsUp: dirsUp,
560
+ maxParentDirectoriesPath: parentDirectoriesPath
561
+ };
562
+ }
563
+ return acc;
564
+ },
565
+ { maxDirsUp: 0, maxParentDirectoriesPath: "", unsupportedDotNodeModules: [] }
566
+ );
567
+ if (unsupportedDotNodeModules.length !== 0) {
568
+ throw new Error(
569
+ `Usage of unsupported C++ Addon(s) found in Node.js Middleware:
570
+ ${unsupportedDotNodeModules.map((file) => `- ${file}`).join("\n")}
571
+
572
+ Check https://docs.netlify.com/build/frameworks/framework-setup-guides/nextjs/overview/#limitations for more information.`
573
+ );
574
+ }
575
+ const commonPrefix = relative(join(srcDir, maxParentDirectoriesPath), srcDir);
576
+ parts.push(`const virtualModules = new Map();`);
577
+ for (const file of files) {
578
+ const srcPath = join(srcDir, file);
579
+ const content = await readFile(srcPath, "utf8");
580
+ parts.push(
581
+ `virtualModules.set(${JSON.stringify(join(commonPrefix, file))}, ${JSON.stringify(content)});`
582
+ );
583
+ }
584
+ parts.push(`registerCJSModules(import.meta.url, virtualModules);
585
+
586
+ const require = createRequire(import.meta.url);
587
+ const handlerMod = require("./${join(commonPrefix, entry)}");
588
+ const handler = handlerMod.default || handlerMod;
589
+
590
+ export default handler
591
+ `);
592
+ const outputFile = join(destDir, `server/${name}.js`);
593
+ await mkdir(dirname(outputFile), { recursive: true });
594
+ await writeFile(outputFile, parts.join("\n"));
595
+ };
523
596
  var createEdgeHandler = async (ctx, definition) => {
524
- await copyHandlerDependencies(ctx, definition);
597
+ await (definition.runtime === "edge" ? copyHandlerDependenciesForEdgeMiddleware(ctx, definition.functionDefinition) : copyHandlerDependenciesForNodeMiddleware(ctx));
525
598
  await writeHandlerFile(ctx, definition);
526
599
  };
527
600
  var getHandlerName = ({ name }) => `${EDGE_HANDLER_NAME}-${name.replace(/\W/g, "-")}`;
528
- var buildHandlerDefinition = (ctx, { name, matchers, page }) => {
529
- const functionHandlerName = getHandlerName({ name });
530
- const functionName = name.endsWith("middleware") ? "Next.js Middleware Handler" : `Next.js Edge Handler: ${page}`;
531
- const cache = name.endsWith("middleware") ? void 0 : "manual";
601
+ var buildHandlerDefinition = (ctx, def) => {
602
+ const functionHandlerName = getHandlerName({ name: def.name });
603
+ const functionName = "Next.js Middleware Handler";
604
+ const cache = def.name.endsWith("middleware") ? void 0 : "manual";
532
605
  const generator = `${ctx.pluginName}@${ctx.pluginVersion}`;
533
- return augmentMatchers(matchers, ctx).map((matcher) => ({
606
+ return augmentMatchers(def.matchers, ctx).map((matcher) => ({
534
607
  function: functionHandlerName,
535
608
  name: functionName,
536
609
  pattern: matcher.regexp,
@@ -543,9 +616,29 @@ var clearStaleEdgeHandlers = async (ctx) => {
543
616
  };
544
617
  var createEdgeHandlers = async (ctx) => {
545
618
  const nextManifest = await ctx.getMiddlewareManifest();
546
- const nextDefinitions = [...Object.values(nextManifest.middleware)];
547
- await Promise.all(nextDefinitions.map((def) => createEdgeHandler(ctx, def)));
548
- const netlifyDefinitions = nextDefinitions.flatMap((def) => buildHandlerDefinition(ctx, def));
619
+ const middlewareDefinitions = [
620
+ ...Object.values(nextManifest.middleware)
621
+ ].map((edgeDefinition) => {
622
+ return {
623
+ runtime: "edge",
624
+ functionDefinition: edgeDefinition,
625
+ name: edgeDefinition.name,
626
+ matchers: edgeDefinition.matchers
627
+ };
628
+ });
629
+ const functionsConfigManifest = await ctx.getFunctionsConfigManifest();
630
+ if (functionsConfigManifest?.functions?.["/_middleware"] && nodeMiddlewareDefinitionHasMatcher(functionsConfigManifest?.functions?.["/_middleware"])) {
631
+ middlewareDefinitions.push({
632
+ runtime: "nodejs",
633
+ functionDefinition: functionsConfigManifest?.functions?.["/_middleware"],
634
+ name: NODE_MIDDLEWARE_NAME,
635
+ matchers: functionsConfigManifest?.functions?.["/_middleware"]?.matchers
636
+ });
637
+ }
638
+ await Promise.all(middlewareDefinitions.map((def) => createEdgeHandler(ctx, def)));
639
+ const netlifyDefinitions = middlewareDefinitions.flatMap(
640
+ (def) => buildHandlerDefinition(ctx, def)
641
+ );
549
642
  const netlifyManifest = {
550
643
  version: 1,
551
644
  functions: netlifyDefinitions
@@ -7,7 +7,7 @@
7
7
  import {
8
8
  trace,
9
9
  wrapTracer
10
- } from "../../esm-chunks/chunk-FKDTZJRV.js";
10
+ } from "../../esm-chunks/chunk-5V5HA6YA.js";
11
11
  import {
12
12
  require_out
13
13
  } from "../../esm-chunks/chunk-YUXQHOYO.js";
@@ -92,6 +92,7 @@ var require_constants = __commonJS({
92
92
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
93
93
  // Replace globs with equivalent patterns to reduce parsing time.
94
94
  REPLACEMENTS: {
95
+ __proto__: null,
95
96
  "***": "*",
96
97
  "**/**": "**",
97
98
  "**/**/**": "**"
@@ -200,6 +200,19 @@ var PluginContext = class {
200
200
  await readFile(join(this.publishDir, "server/middleware-manifest.json"), "utf-8")
201
201
  );
202
202
  }
203
+ /**
204
+ * Get Next.js Functions Config Manifest config if it exists from the build output
205
+ */
206
+ async getFunctionsConfigManifest() {
207
+ const functionsConfigManifestPath = join(
208
+ this.publishDir,
209
+ "server/functions-config-manifest.json"
210
+ );
211
+ if (existsSync(functionsConfigManifestPath)) {
212
+ return JSON.parse(await readFile(functionsConfigManifestPath, "utf-8"));
213
+ }
214
+ return null;
215
+ }
203
216
  // don't make private as it is handy inside testing to override the config
204
217
  _requiredServerFiles = null;
205
218
  /** Get RequiredServerFiles manifest from build output **/
@@ -268,7 +281,7 @@ var PluginContext = class {
268
281
  }
269
282
  #fallbacks = null;
270
283
  /**
271
- * Get an array of localized fallback routes
284
+ * Get an array of localized fallback routes for Pages Router
272
285
  *
273
286
  * Example return value for non-i18n site: `['blog/[slug]']`
274
287
  *
@@ -279,7 +292,7 @@ var PluginContext = class {
279
292
  const locales = this.buildConfig.i18n?.locales ?? [""];
280
293
  this.#fallbacks = Object.entries(prerenderManifest.dynamicRoutes).reduce(
281
294
  (fallbacks, [route, meta]) => {
282
- if (typeof meta.fallback === "string") {
295
+ if (typeof meta.fallback === "string" && meta.renderingMode !== "PARTIALLY_STATIC") {
283
296
  for (const locale of locales) {
284
297
  const localizedRoute = posixJoin(locale, route.replace(/^\/+/g, ""));
285
298
  fallbacks.push(localizedRoute);
@@ -315,6 +328,24 @@ var PluginContext = class {
315
328
  }
316
329
  return this.#fullyStaticHtmlPages;
317
330
  }
331
+ #shells = null;
332
+ /**
333
+ * Get an array of static shells for App Router's PPR dynamic routes
334
+ */
335
+ getShells(prerenderManifest) {
336
+ if (!this.#shells) {
337
+ this.#shells = Object.entries(prerenderManifest.dynamicRoutes).reduce(
338
+ (shells, [route, meta]) => {
339
+ if (typeof meta.fallback === "string" && meta.renderingMode === "PARTIALLY_STATIC") {
340
+ shells.push(route);
341
+ }
342
+ return shells;
343
+ },
344
+ []
345
+ );
346
+ }
347
+ return this.#shells;
348
+ }
318
349
  /** Fails a build with a message and an optional error */
319
350
  failBuild(message, error) {
320
351
  return this.utils.build.failBuild(message, error instanceof Error ? { error } : void 0);
@@ -126,7 +126,7 @@ function createContextKey(description) {
126
126
  }
127
127
  var BaseContext = (
128
128
  /** @class */
129
- /* @__PURE__ */ function() {
129
+ /* @__PURE__ */ (function() {
130
130
  function BaseContext2(parentContext) {
131
131
  var self = this;
132
132
  self._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
@@ -145,7 +145,7 @@ var BaseContext = (
145
145
  };
146
146
  }
147
147
  return BaseContext2;
148
- }()
148
+ })()
149
149
  );
150
150
  var ROOT_CONTEXT = new BaseContext();
151
151
 
@@ -178,7 +178,7 @@ var __spreadArray = function(to, from, pack) {
178
178
  };
179
179
  var NoopContextManager = (
180
180
  /** @class */
181
- function() {
181
+ (function() {
182
182
  function NoopContextManager2() {
183
183
  }
184
184
  NoopContextManager2.prototype.active = function() {
@@ -201,7 +201,7 @@ var NoopContextManager = (
201
201
  return this;
202
202
  };
203
203
  return NoopContextManager2;
204
- }()
204
+ })()
205
205
  );
206
206
 
207
207
  // node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
@@ -233,7 +233,7 @@ var __spreadArray2 = function(to, from, pack) {
233
233
  };
234
234
  var DiagComponentLogger = (
235
235
  /** @class */
236
- function() {
236
+ (function() {
237
237
  function DiagComponentLogger2(props) {
238
238
  this._namespace = props.namespace || "DiagComponentLogger";
239
239
  }
@@ -273,7 +273,7 @@ var DiagComponentLogger = (
273
273
  return logProxy("verbose", this._namespace, args);
274
274
  };
275
275
  return DiagComponentLogger2;
276
- }()
276
+ })()
277
277
  );
278
278
  function logProxy(funcName, namespace, args) {
279
279
  var logger = getGlobal("diag");
@@ -351,7 +351,7 @@ var __spreadArray3 = function(to, from, pack) {
351
351
  var API_NAME = "diag";
352
352
  var DiagAPI = (
353
353
  /** @class */
354
- function() {
354
+ (function() {
355
355
  function DiagAPI2() {
356
356
  function _logProxy(funcName) {
357
357
  return function() {
@@ -410,7 +410,7 @@ var DiagAPI = (
410
410
  return this._instance;
411
411
  };
412
412
  return DiagAPI2;
413
- }()
413
+ })()
414
414
  );
415
415
 
416
416
  // node_modules/@opentelemetry/api/build/esm/api/context.js
@@ -444,7 +444,7 @@ var API_NAME2 = "context";
444
444
  var NOOP_CONTEXT_MANAGER = new NoopContextManager();
445
445
  var ContextAPI = (
446
446
  /** @class */
447
- function() {
447
+ (function() {
448
448
  function ContextAPI2() {
449
449
  }
450
450
  ContextAPI2.getInstance = function() {
@@ -478,7 +478,7 @@ var ContextAPI = (
478
478
  unregisterGlobal(API_NAME2, DiagAPI.instance());
479
479
  };
480
480
  return ContextAPI2;
481
- }()
481
+ })()
482
482
  );
483
483
 
484
484
  // node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
@@ -500,7 +500,7 @@ var INVALID_SPAN_CONTEXT = {
500
500
  // node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
501
501
  var NonRecordingSpan = (
502
502
  /** @class */
503
- function() {
503
+ (function() {
504
504
  function NonRecordingSpan2(_spanContext) {
505
505
  if (_spanContext === void 0) {
506
506
  _spanContext = INVALID_SPAN_CONTEXT;
@@ -533,7 +533,7 @@ var NonRecordingSpan = (
533
533
  NonRecordingSpan2.prototype.recordException = function(_exception, _time) {
534
534
  };
535
535
  return NonRecordingSpan2;
536
- }()
536
+ })()
537
537
  );
538
538
 
539
539
  // node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
@@ -578,7 +578,7 @@ function wrapSpanContext(spanContext) {
578
578
  var contextApi = ContextAPI.getInstance();
579
579
  var NoopTracer = (
580
580
  /** @class */
581
- function() {
581
+ (function() {
582
582
  function NoopTracer2() {
583
583
  }
584
584
  NoopTracer2.prototype.startSpan = function(name, options, context2) {
@@ -618,7 +618,7 @@ var NoopTracer = (
618
618
  return contextApi.with(contextWithSpanSet, fn, void 0, span);
619
619
  };
620
620
  return NoopTracer2;
621
- }()
621
+ })()
622
622
  );
623
623
  function isSpanContext(spanContext) {
624
624
  return typeof spanContext === "object" && typeof spanContext["spanId"] === "string" && typeof spanContext["traceId"] === "string" && typeof spanContext["traceFlags"] === "number";
@@ -628,7 +628,7 @@ function isSpanContext(spanContext) {
628
628
  var NOOP_TRACER = new NoopTracer();
629
629
  var ProxyTracer = (
630
630
  /** @class */
631
- function() {
631
+ (function() {
632
632
  function ProxyTracer2(_provider, name, version, options) {
633
633
  this._provider = _provider;
634
634
  this.name = name;
@@ -654,27 +654,27 @@ var ProxyTracer = (
654
654
  return this._delegate;
655
655
  };
656
656
  return ProxyTracer2;
657
- }()
657
+ })()
658
658
  );
659
659
 
660
660
  // node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js
661
661
  var NoopTracerProvider = (
662
662
  /** @class */
663
- function() {
663
+ (function() {
664
664
  function NoopTracerProvider2() {
665
665
  }
666
666
  NoopTracerProvider2.prototype.getTracer = function(_name, _version, _options) {
667
667
  return new NoopTracer();
668
668
  };
669
669
  return NoopTracerProvider2;
670
- }()
670
+ })()
671
671
  );
672
672
 
673
673
  // node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
674
674
  var NOOP_TRACER_PROVIDER = new NoopTracerProvider();
675
675
  var ProxyTracerProvider = (
676
676
  /** @class */
677
- function() {
677
+ (function() {
678
678
  function ProxyTracerProvider2() {
679
679
  }
680
680
  ProxyTracerProvider2.prototype.getTracer = function(name, version, options) {
@@ -693,14 +693,14 @@ var ProxyTracerProvider = (
693
693
  return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);
694
694
  };
695
695
  return ProxyTracerProvider2;
696
- }()
696
+ })()
697
697
  );
698
698
 
699
699
  // node_modules/@opentelemetry/api/build/esm/api/trace.js
700
700
  var API_NAME3 = "trace";
701
701
  var TraceAPI = (
702
702
  /** @class */
703
- function() {
703
+ (function() {
704
704
  function TraceAPI2() {
705
705
  this._proxyTracerProvider = new ProxyTracerProvider();
706
706
  this.wrapSpanContext = wrapSpanContext;
@@ -736,7 +736,7 @@ var TraceAPI = (
736
736
  this._proxyTracerProvider = new ProxyTracerProvider();
737
737
  };
738
738
  return TraceAPI2;
739
- }()
739
+ })()
740
740
  );
741
741
 
742
742
  // node_modules/@opentelemetry/api/build/esm/trace-api.js
@@ -765,7 +765,7 @@ function wrapTracer(tracer) {
765
765
  }
766
766
  var SugaredTracer = (
767
767
  /** @class */
768
- function() {
768
+ (function() {
769
769
  function SugaredTracer2(tracer) {
770
770
  this._tracer = tracer;
771
771
  this.startSpan = tracer.startSpan.bind(this._tracer);
@@ -783,7 +783,7 @@ var SugaredTracer = (
783
783
  return handleFn(span, opts, fn);
784
784
  };
785
785
  return SugaredTracer2;
786
- }()
786
+ })()
787
787
  );
788
788
  function massageParams(arg, arg2, arg3) {
789
789
  var opts;
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
  import {
8
8
  trace,
9
9
  wrapTracer
10
- } from "./esm-chunks/chunk-FKDTZJRV.js";
10
+ } from "./esm-chunks/chunk-5V5HA6YA.js";
11
11
  import "./esm-chunks/chunk-6BT4RYQJ.js";
12
12
 
13
13
  // src/index.ts
@@ -30,6 +30,7 @@ var setRunConfig = (config) => {
30
30
  config.cacheMaxMemorySize ?? config.experimental?.isrMemoryCacheSize
31
31
  );
32
32
  process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(config);
33
+ return config;
33
34
  };
34
35
  export {
35
36
  getRunConfig,
@@ -265,14 +265,20 @@ var NetlifyCacheHandler = class {
265
265
  if (requestContext && blob.value?.kind === "APP_PAGE") {
266
266
  requestContext.isCacheableAppPage = true;
267
267
  }
268
- const { revalidate, rscData, ...restOfPageValue } = blob.value;
268
+ const { revalidate, rscData, segmentData, ...restOfPageValue } = blob.value;
269
269
  span.addEvent(blob.value?.kind, { lastModified: blob.lastModified, revalidate, ttl });
270
270
  await this.injectEntryToPrerenderManifest(key, blob.value);
271
271
  return {
272
272
  lastModified: blob.lastModified,
273
273
  value: {
274
274
  ...restOfPageValue,
275
- rscData: rscData ? import_node_buffer.Buffer.from(rscData, "base64") : void 0
275
+ rscData: rscData ? import_node_buffer.Buffer.from(rscData, "base64") : void 0,
276
+ segmentData: segmentData ? new Map(
277
+ Object.entries(segmentData).map(([segmentPath, base64EncodedSegment]) => [
278
+ segmentPath,
279
+ import_node_buffer.Buffer.from(base64EncodedSegment, "base64")
280
+ ])
281
+ ) : void 0
276
282
  }
277
283
  };
278
284
  }
@@ -306,7 +312,13 @@ var NetlifyCacheHandler = class {
306
312
  ...data,
307
313
  revalidate: context.revalidate ?? context.cacheControl?.revalidate,
308
314
  cacheControl: context.cacheControl,
309
- rscData: data.rscData?.toString("base64")
315
+ rscData: data.rscData?.toString("base64"),
316
+ segmentData: data.segmentData ? Object.fromEntries(
317
+ [...data.segmentData.entries()].map(([segmentPath, base64EncodedSegment]) => [
318
+ segmentPath,
319
+ base64EncodedSegment.toString("base64")
320
+ ])
321
+ ) : void 0
310
322
  };
311
323
  }
312
324
  return data;