@gigadrive/network-config 4.0.0 → 4.1.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.mjs CHANGED
@@ -327,6 +327,7 @@ var AVAILABLE_REGIONS = [...REGION_DEFINITIONS];
327
327
 
328
328
  // src/detection/frameworks/nextjs.ts
329
329
  var toPortablePath = (value) => value.replaceAll("\\", "/");
330
+ var MAXIMUM_ENTRY_PAGE_PATHS = 50;
330
331
  var resolveStandaloneServer = Effect4.fn("nextjs.resolveStandaloneServer")(function* (projectFolder, distDir, repoRootToProject) {
331
332
  const fs = yield* FileSystem4.FileSystem;
332
333
  const pathService = yield* Path3.Path;
@@ -417,14 +418,9 @@ var createStandaloneConfig = Effect4.fn("nextjs.createStandaloneConfig")(functio
417
418
  };
418
419
  });
419
420
  var createStandaloneV2Config = Effect4.fn("nextjs.createStandaloneV2Config")(function* (defaults, projectFolder, manifest) {
420
- const pathService = yield* Path3.Path;
421
421
  const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);
422
422
  if (!resolved) return defaults;
423
423
  const { standaloneRoot, serverDirectory, entrypoint } = resolved;
424
- let repoRoot = projectFolder;
425
- if (manifest.repoRootToProject !== ".") {
426
- repoRoot = manifest.repoRootToProject.split("/").reduce((root) => pathService.dirname(root), repoRoot);
427
- }
428
424
  const publicAssets = yield* buildStandalonePublicAssets(projectFolder, standaloneRoot, serverDirectory);
429
425
  const assetPaths = [...publicAssets.assetPaths];
430
426
  const assetOverrides = { ...publicAssets.assetOverrides };
@@ -435,19 +431,11 @@ var createStandaloneV2Config = Effect4.fn("nextjs.createStandaloneV2Config")(fun
435
431
  immutable: staticAsset.immutable,
436
432
  populateCache: true
437
433
  }));
438
- const prerenders = manifest.outputs.prerenders.map((output) => {
439
- if (!output.fallback?.filePath) return output;
440
- const absolutePath = pathService.join(repoRoot, output.fallback.filePath);
441
- const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));
442
- if (projectRelativePath.startsWith("../")) return output;
443
- const internalAssetPath = `_gigadrive/prerender/${encodeURIComponent(output.id)}.html`;
444
- assetPaths.push(projectRelativePath);
445
- assetOverrides[projectRelativePath] = { path: internalAssetPath };
446
- return {
447
- ...output,
448
- fallback: { ...output.fallback, filePath: `/${internalAssetPath}` }
449
- };
450
- });
434
+ const entryPagePaths = [
435
+ ...new Set(
436
+ manifest.outputs.prerenders.filter((output) => !output.fallback?.postponedState).map((output) => output.pathname).filter((pathname) => pathname.startsWith("/") && !pathname.includes("["))
437
+ )
438
+ ].sort((left, right) => left.split("/").length - right.split("/").length || left.localeCompare(right)).slice(0, MAXIMUM_ENTRY_PAGE_PATHS);
451
439
  const singleEntrypoint = {
452
440
  displayName: "next-server",
453
441
  path: entrypoint,
@@ -474,7 +462,11 @@ var createStandaloneV2Config = Effect4.fn("nextjs.createStandaloneV2Config")(fun
474
462
  server: manifest.server,
475
463
  config: manifest.config,
476
464
  routing: manifest.routing,
477
- outputs: { prerenders, staticAssets: manifest.outputs.staticAssets },
465
+ // The prerender table is deliberately not forwarded: the standalone server
466
+ // serves build-time prerenders from its own bundle, so the platform only
467
+ // needs the warming sample below.
468
+ outputs: { prerenders: [], staticAssets: manifest.outputs.staticAssets },
469
+ entryPagePaths,
478
470
  type: "nextjs",
479
471
  schemaVersion: 2
480
472
  };