@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.d.mts CHANGED
@@ -324,6 +324,12 @@ type NormalizedFramework = NormalizedNextjsFramework;
324
324
  type NormalizedNextjsFramework = Omit<GigadriveNextBuildManifestV2Standalone, 'version'> & {
325
325
  type: 'nextjs';
326
326
  schemaVersion: 2;
327
+ /**
328
+ * Bounded sample of prerendered page paths, used to warm the CDN. Replaces
329
+ * carrying the deployment's full prerender table, which grew to tens of
330
+ * thousands of entries on large content sites.
331
+ */
332
+ entryPagePaths?: string[];
327
333
  };
328
334
  interface NormalizedSharedArtifact {
329
335
  id: string;
package/dist/index.d.ts CHANGED
@@ -324,6 +324,12 @@ type NormalizedFramework = NormalizedNextjsFramework;
324
324
  type NormalizedNextjsFramework = Omit<GigadriveNextBuildManifestV2Standalone, 'version'> & {
325
325
  type: 'nextjs';
326
326
  schemaVersion: 2;
327
+ /**
328
+ * Bounded sample of prerendered page paths, used to warm the CDN. Replaces
329
+ * carrying the deployment's full prerender table, which grew to tens of
330
+ * thousands of entries on large content sites.
331
+ */
332
+ entryPagePaths?: string[];
327
333
  };
328
334
  interface NormalizedSharedArtifact {
329
335
  id: string;
package/dist/index.js CHANGED
@@ -394,6 +394,7 @@ var AVAILABLE_REGIONS = [...REGION_DEFINITIONS];
394
394
 
395
395
  // src/detection/frameworks/nextjs.ts
396
396
  var toPortablePath = (value) => value.replaceAll("\\", "/");
397
+ var MAXIMUM_ENTRY_PAGE_PATHS = 50;
397
398
  var resolveStandaloneServer = import_effect4.Effect.fn("nextjs.resolveStandaloneServer")(function* (projectFolder, distDir, repoRootToProject) {
398
399
  const fs = yield* import_platform4.FileSystem.FileSystem;
399
400
  const pathService = yield* import_platform4.Path.Path;
@@ -484,14 +485,9 @@ var createStandaloneConfig = import_effect4.Effect.fn("nextjs.createStandaloneCo
484
485
  };
485
486
  });
486
487
  var createStandaloneV2Config = import_effect4.Effect.fn("nextjs.createStandaloneV2Config")(function* (defaults, projectFolder, manifest) {
487
- const pathService = yield* import_platform4.Path.Path;
488
488
  const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);
489
489
  if (!resolved) return defaults;
490
490
  const { standaloneRoot, serverDirectory, entrypoint } = resolved;
491
- let repoRoot = projectFolder;
492
- if (manifest.repoRootToProject !== ".") {
493
- repoRoot = manifest.repoRootToProject.split("/").reduce((root) => pathService.dirname(root), repoRoot);
494
- }
495
491
  const publicAssets = yield* buildStandalonePublicAssets(projectFolder, standaloneRoot, serverDirectory);
496
492
  const assetPaths = [...publicAssets.assetPaths];
497
493
  const assetOverrides = { ...publicAssets.assetOverrides };
@@ -502,19 +498,11 @@ var createStandaloneV2Config = import_effect4.Effect.fn("nextjs.createStandalone
502
498
  immutable: staticAsset.immutable,
503
499
  populateCache: true
504
500
  }));
505
- const prerenders = manifest.outputs.prerenders.map((output) => {
506
- if (!output.fallback?.filePath) return output;
507
- const absolutePath = pathService.join(repoRoot, output.fallback.filePath);
508
- const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));
509
- if (projectRelativePath.startsWith("../")) return output;
510
- const internalAssetPath = `_gigadrive/prerender/${encodeURIComponent(output.id)}.html`;
511
- assetPaths.push(projectRelativePath);
512
- assetOverrides[projectRelativePath] = { path: internalAssetPath };
513
- return {
514
- ...output,
515
- fallback: { ...output.fallback, filePath: `/${internalAssetPath}` }
516
- };
517
- });
501
+ const entryPagePaths = [
502
+ ...new Set(
503
+ manifest.outputs.prerenders.filter((output) => !output.fallback?.postponedState).map((output) => output.pathname).filter((pathname) => pathname.startsWith("/") && !pathname.includes("["))
504
+ )
505
+ ].sort((left, right) => left.split("/").length - right.split("/").length || left.localeCompare(right)).slice(0, MAXIMUM_ENTRY_PAGE_PATHS);
518
506
  const singleEntrypoint = {
519
507
  displayName: "next-server",
520
508
  path: entrypoint,
@@ -541,7 +529,11 @@ var createStandaloneV2Config = import_effect4.Effect.fn("nextjs.createStandalone
541
529
  server: manifest.server,
542
530
  config: manifest.config,
543
531
  routing: manifest.routing,
544
- outputs: { prerenders, staticAssets: manifest.outputs.staticAssets },
532
+ // The prerender table is deliberately not forwarded: the standalone server
533
+ // serves build-time prerenders from its own bundle, so the platform only
534
+ // needs the warming sample below.
535
+ outputs: { prerenders: [], staticAssets: manifest.outputs.staticAssets },
536
+ entryPagePaths,
545
537
  type: "nextjs",
546
538
  schemaVersion: 2
547
539
  };