@gigadrive/network-config 4.0.0 → 4.2.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,8 @@ 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;
398
+ var STANDALONE_SERVER_MEMORY_MB = 1024;
397
399
  var resolveStandaloneServer = import_effect4.Effect.fn("nextjs.resolveStandaloneServer")(function* (projectFolder, distDir, repoRootToProject) {
398
400
  const fs = yield* import_platform4.FileSystem.FileSystem;
399
401
  const pathService = yield* import_platform4.Path.Path;
@@ -484,14 +486,9 @@ var createStandaloneConfig = import_effect4.Effect.fn("nextjs.createStandaloneCo
484
486
  };
485
487
  });
486
488
  var createStandaloneV2Config = import_effect4.Effect.fn("nextjs.createStandaloneV2Config")(function* (defaults, projectFolder, manifest) {
487
- const pathService = yield* import_platform4.Path.Path;
488
489
  const resolved = yield* resolveStandaloneServer(projectFolder, manifest.distDir, manifest.repoRootToProject);
489
490
  if (!resolved) return defaults;
490
491
  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
492
  const publicAssets = yield* buildStandalonePublicAssets(projectFolder, standaloneRoot, serverDirectory);
496
493
  const assetPaths = [...publicAssets.assetPaths];
497
494
  const assetOverrides = { ...publicAssets.assetOverrides };
@@ -502,24 +499,16 @@ var createStandaloneV2Config = import_effect4.Effect.fn("nextjs.createStandalone
502
499
  immutable: staticAsset.immutable,
503
500
  populateCache: true
504
501
  }));
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
- });
502
+ const entryPagePaths = [
503
+ ...new Set(
504
+ manifest.outputs.prerenders.filter((output) => !output.fallback?.postponedState).map((output) => output.pathname).filter((pathname) => pathname.startsWith("/") && !pathname.includes("["))
505
+ )
506
+ ].sort((left, right) => left.split("/").length - right.split("/").length || left.localeCompare(right)).slice(0, MAXIMUM_ENTRY_PAGE_PATHS);
518
507
  const singleEntrypoint = {
519
508
  displayName: "next-server",
520
509
  path: entrypoint,
521
510
  runtime: defaults.runtime,
522
- memory: defaults.memory,
511
+ memory: Math.max(defaults.memory, STANDALONE_SERVER_MEMORY_MB),
523
512
  maxDuration: manifest.server.maxDuration ?? defaults.maxDuration,
524
513
  streaming: true,
525
514
  environmentVariables: {
@@ -541,7 +530,11 @@ var createStandaloneV2Config = import_effect4.Effect.fn("nextjs.createStandalone
541
530
  server: manifest.server,
542
531
  config: manifest.config,
543
532
  routing: manifest.routing,
544
- outputs: { prerenders, staticAssets: manifest.outputs.staticAssets },
533
+ // The prerender table is deliberately not forwarded: the standalone server
534
+ // serves build-time prerenders from its own bundle, so the platform only
535
+ // needs the warming sample below.
536
+ outputs: { prerenders: [], staticAssets: manifest.outputs.staticAssets },
537
+ entryPagePaths,
545
538
  type: "nextjs",
546
539
  schemaVersion: 2
547
540
  };