@gigadrive/network-config 3.3.2 → 3.4.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 +187 -1
- package/dist/index.d.ts +187 -1
- package/dist/index.js +280 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +279 -18
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs-adapter.d.mts +7 -33
- package/dist/nextjs-adapter.d.ts +6 -34
- package/dist/nextjs-adapter.js +311 -21
- package/dist/nextjs-adapter.js.map +1 -1
- package/dist/nextjs-adapter.mjs +311 -22
- package/dist/nextjs-adapter.mjs.map +1 -1
- package/dist/nextjs-cache-components-handler.d.mts +20 -0
- package/dist/nextjs-cache-components-handler.d.ts +20 -0
- package/dist/nextjs-cache-components-handler.js +200 -0
- package/dist/nextjs-cache-components-handler.js.map +1 -0
- package/dist/nextjs-cache-components-handler.mjs +177 -0
- package/dist/nextjs-cache-components-handler.mjs.map +1 -0
- package/dist/nextjs-cache-handler.d.mts +12 -0
- package/dist/nextjs-cache-handler.d.ts +12 -0
- package/dist/nextjs-cache-handler.js +141 -0
- package/dist/nextjs-cache-handler.js.map +1 -0
- package/dist/nextjs-cache-handler.mjs +118 -0
- package/dist/nextjs-cache-handler.mjs.map +1 -0
- package/dist/nextjs-image-loader.d.mts +9 -0
- package/dist/nextjs-image-loader.d.ts +9 -0
- package/dist/nextjs-image-loader.js +36 -0
- package/dist/nextjs-image-loader.js.map +1 -0
- package/dist/nextjs-image-loader.mjs +15 -0
- package/dist/nextjs-image-loader.mjs.map +1 -0
- package/dist/v4/schema.json +85 -0
- package/package.json +19 -3
- package/src/v4/schema.json +85 -0
package/dist/index.mjs
CHANGED
|
@@ -254,28 +254,48 @@ var getDefaultPathMap = Effect3.fn("getDefaultPathMap")(function* (directory) {
|
|
|
254
254
|
return result;
|
|
255
255
|
});
|
|
256
256
|
|
|
257
|
-
// src/
|
|
257
|
+
// src/nextjs-manifest.ts
|
|
258
258
|
var isRecord2 = (value) => typeof value === "object" && value !== null;
|
|
259
|
-
var
|
|
259
|
+
var isPortableRelativePath = (value, allowCurrentDirectory = false) => {
|
|
260
|
+
if (typeof value !== "string") return false;
|
|
260
261
|
const normalized = value.replaceAll("\\", "/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
261
|
-
|
|
262
|
-
return void 0;
|
|
263
|
-
}
|
|
264
|
-
return normalized || ".";
|
|
262
|
+
return (allowCurrentDirectory || normalized !== "" && normalized !== ".") && !normalized.startsWith("/") && !/^[A-Za-z]:/.test(normalized) && !normalized.includes(":") && !normalized.split("/").some((segment) => segment === "..");
|
|
265
263
|
};
|
|
266
|
-
var
|
|
264
|
+
var isStringRecord = (value) => isRecord2(value) && Object.values(value).every((item) => typeof item === "string");
|
|
265
|
+
var isJsonValue = (value) => {
|
|
266
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
267
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
268
|
+
if (Array.isArray(value)) return value.every(isJsonValue);
|
|
269
|
+
return isRecord2(value) && Object.values(value).every(isJsonValue);
|
|
270
|
+
};
|
|
271
|
+
var isRouteOutput = (value) => isRecord2(value) && typeof value.id === "string" && ["PAGES", "PAGES_API", "APP_PAGE", "APP_ROUTE", "MIDDLEWARE"].includes(String(value.type)) && isPortableRelativePath(value.filePath) && typeof value.pathname === "string" && typeof value.sourcePage === "string" && (value.runtime === "nodejs" || value.runtime === "edge") && isStringRecord(value.assets) && isRecord2(value.config);
|
|
272
|
+
var isPrerenderOutput = (value) => isRecord2(value) && value.type === "PRERENDER" && typeof value.id === "string" && typeof value.pathname === "string" && typeof value.parentOutputId === "string" && typeof value.groupId === "number" && isRecord2(value.config) && (value.fallback === void 0 || isRecord2(value.fallback) && (value.fallback.filePath === void 0 || isPortableRelativePath(value.fallback.filePath)));
|
|
273
|
+
var isStaticOutput = (value) => isRecord2(value) && value.type === "STATIC_FILE" && typeof value.id === "string" && typeof value.pathname === "string" && isPortableRelativePath(value.filePath);
|
|
274
|
+
var isEntrypoint = (value) => isRecord2(value) && typeof value.id === "string" && (value.runtime === "nodejs" || value.runtime === "edge") && isPortableRelativePath(value.filePath) && Array.isArray(value.outputIds) && value.outputIds.every((item) => typeof item === "string") && isStringRecord(value.assets) && isRecord2(value.config);
|
|
275
|
+
var isImagePolicy = (value) => isRecord2(value) && Array.isArray(value.localPatterns) && Array.isArray(value.remotePatterns) && value.remotePatterns.every((pattern) => isRecord2(pattern) && typeof pattern.hostname === "string") && Array.isArray(value.widths) && value.widths.every((item) => typeof item === "number" && Number.isInteger(item) && item > 0) && Array.isArray(value.heights) && value.heights.every((item) => typeof item === "number" && Number.isInteger(item) && item > 0) && Array.isArray(value.qualities) && value.qualities.every((item) => typeof item === "number" && item >= 1 && item <= 100) && Array.isArray(value.formats) && value.formats.every((item) => ["image/avif", "image/webp", "image/jpeg", "image/png"].includes(String(item))) && typeof value.minimumCacheTTL === "number" && typeof value.dangerouslyAllowSVG === "boolean" && typeof value.contentSecurityPolicy === "string" && (value.contentDispositionType === "inline" || value.contentDispositionType === "attachment") && typeof value.maximumRedirects === "number" && typeof value.maximumResponseBody === "number" && isRecord2(value.variants);
|
|
276
|
+
var parseGigadriveNextBuildManifest = (content) => {
|
|
267
277
|
try {
|
|
268
278
|
const value = JSON.parse(content);
|
|
269
|
-
if (!isRecord2(value)
|
|
279
|
+
if (!isRecord2(value)) return void 0;
|
|
280
|
+
if (value.version === 1) {
|
|
281
|
+
if (value.output !== "standalone" && value.output !== "export" || !isPortableRelativePath(value.distDir) || !isPortableRelativePath(value.repoRootToProject, true) || typeof value.nextVersion !== "string" || typeof value.buildId !== "string") {
|
|
282
|
+
return void 0;
|
|
283
|
+
}
|
|
284
|
+
return value;
|
|
285
|
+
}
|
|
286
|
+
if (value.version !== 2 || value.mode !== "adapter-v2" && value.mode !== "export" || !isPortableRelativePath(value.distDir) || !isPortableRelativePath(value.repoRootToProject, true) || typeof value.nextVersion !== "string" || typeof value.buildId !== "string" || !isRecord2(value.config) || typeof value.config.basePath !== "string" || typeof value.config.trailingSlash !== "boolean" || typeof value.config.cacheComponents !== "boolean" || value.config.images !== void 0 && !isImagePolicy(value.config.images) || !isRecord2(value.routing) || !isJsonValue(value.routing) || !isRecord2(value.outputs) || !Array.isArray(value.outputs.pages) || !value.outputs.pages.every(isRouteOutput) || !Array.isArray(value.outputs.pagesApi) || !value.outputs.pagesApi.every(isRouteOutput) || !Array.isArray(value.outputs.appPages) || !value.outputs.appPages.every(isRouteOutput) || !Array.isArray(value.outputs.appRoutes) || !value.outputs.appRoutes.every(isRouteOutput) || !Array.isArray(value.outputs.prerenders) || !value.outputs.prerenders.every(isPrerenderOutput) || !Array.isArray(value.outputs.staticFiles) || !value.outputs.staticFiles.every(isStaticOutput) || value.outputs.middleware !== void 0 && !isRouteOutput(value.outputs.middleware) || !Array.isArray(value.entrypoints) || !value.entrypoints.every(isEntrypoint) || !isStringRecord(value.outputEntrypoints)) {
|
|
270
287
|
return void 0;
|
|
271
288
|
}
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
289
|
+
const entrypointIds = new Set(value.entrypoints.map((item) => item.id));
|
|
290
|
+
if (Object.values(value.outputEntrypoints).some((entrypointId) => !entrypointIds.has(entrypointId)))
|
|
291
|
+
return void 0;
|
|
292
|
+
return value;
|
|
275
293
|
} catch {
|
|
276
294
|
return void 0;
|
|
277
295
|
}
|
|
278
296
|
};
|
|
297
|
+
|
|
298
|
+
// src/detection/frameworks/nextjs.ts
|
|
279
299
|
var toPortablePath = (value) => value.replaceAll("\\", "/");
|
|
280
300
|
var createStaticExportConfig = Effect4.fn("nextjs.createStaticExportConfig")(function* (defaults, projectFolder) {
|
|
281
301
|
const pathService = yield* Path3.Path;
|
|
@@ -355,6 +375,116 @@ var createStandaloneConfig = Effect4.fn("nextjs.createStandaloneConfig")(functio
|
|
|
355
375
|
}
|
|
356
376
|
};
|
|
357
377
|
});
|
|
378
|
+
var createAdapterV2Config = Effect4.fn("nextjs.createAdapterV2Config")(function* (defaults, projectFolder, manifest) {
|
|
379
|
+
const pathService = yield* Path3.Path;
|
|
380
|
+
let repoRoot = projectFolder;
|
|
381
|
+
if (manifest.repoRootToProject !== ".") {
|
|
382
|
+
repoRoot = manifest.repoRootToProject.split("/").reduce((root) => pathService.dirname(root), repoRoot);
|
|
383
|
+
}
|
|
384
|
+
const artifactUseCount = /* @__PURE__ */ new Map();
|
|
385
|
+
for (const entrypoint of manifest.entrypoints) {
|
|
386
|
+
for (const [targetPath, sourcePath] of Object.entries(entrypoint.assets)) {
|
|
387
|
+
const identity = `${targetPath}\0${sourcePath}`;
|
|
388
|
+
artifactUseCount.set(identity, (artifactUseCount.get(identity) ?? 0) + 1);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
const sharedFilePathMap = {};
|
|
392
|
+
for (const [identity, useCount] of artifactUseCount) {
|
|
393
|
+
if (useCount < 2) continue;
|
|
394
|
+
const [targetPath, sourcePath] = identity.split("\0");
|
|
395
|
+
sharedFilePathMap[pathService.join(repoRoot, sourcePath)] = targetPath;
|
|
396
|
+
}
|
|
397
|
+
const sharedArtifacts = Object.keys(sharedFilePathMap).length > 0 ? [{ id: "next-shared", filePathMap: sharedFilePathMap }] : [];
|
|
398
|
+
const entrypoints = manifest.entrypoints.map((entrypoint) => {
|
|
399
|
+
const filePathMap = {};
|
|
400
|
+
for (const [targetPath, sourcePath] of Object.entries({
|
|
401
|
+
...entrypoint.assets,
|
|
402
|
+
...entrypoint.wasmAssets
|
|
403
|
+
})) {
|
|
404
|
+
const identity = `${targetPath}\0${sourcePath}`;
|
|
405
|
+
if ((artifactUseCount.get(identity) ?? 0) >= 2) continue;
|
|
406
|
+
filePathMap[pathService.join(repoRoot, sourcePath)] = targetPath;
|
|
407
|
+
}
|
|
408
|
+
filePathMap[pathService.join(repoRoot, entrypoint.filePath)] = entrypoint.filePath;
|
|
409
|
+
return {
|
|
410
|
+
displayName: entrypoint.id,
|
|
411
|
+
path: entrypoint.filePath,
|
|
412
|
+
runtime: "node-22",
|
|
413
|
+
memory: defaults.memory,
|
|
414
|
+
maxDuration: entrypoint.config.maxDuration ?? defaults.maxDuration,
|
|
415
|
+
streaming: true,
|
|
416
|
+
environmentVariables: {
|
|
417
|
+
GIGADRIVE_NEXT_ENTRYPOINT_ID: entrypoint.id,
|
|
418
|
+
GIGADRIVE_NEXT_RUNTIME: entrypoint.runtime,
|
|
419
|
+
NEXT_BUILD_ID: manifest.buildId,
|
|
420
|
+
...entrypoint.config.env
|
|
421
|
+
},
|
|
422
|
+
package: {
|
|
423
|
+
trace: false,
|
|
424
|
+
rootOverwrite: repoRoot,
|
|
425
|
+
filePathMap,
|
|
426
|
+
...sharedArtifacts.length > 0 ? { sharedArtifactIds: sharedArtifacts.map((artifact) => artifact.id) } : {}
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
});
|
|
430
|
+
const assetPaths = [];
|
|
431
|
+
const assetOverrides = {};
|
|
432
|
+
for (const output of manifest.outputs.staticFiles) {
|
|
433
|
+
const absolutePath = pathService.join(repoRoot, output.filePath);
|
|
434
|
+
const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));
|
|
435
|
+
if (projectRelativePath.startsWith("../")) continue;
|
|
436
|
+
assetPaths.push(projectRelativePath);
|
|
437
|
+
assetOverrides[projectRelativePath] = { path: output.pathname.replace(/^\//, "") };
|
|
438
|
+
}
|
|
439
|
+
const prerenders = manifest.outputs.prerenders.map((output) => {
|
|
440
|
+
if (!output.fallback?.filePath) return output;
|
|
441
|
+
const absolutePath = pathService.join(repoRoot, output.fallback.filePath);
|
|
442
|
+
const projectRelativePath = toPortablePath(pathService.relative(projectFolder, absolutePath));
|
|
443
|
+
if (projectRelativePath.startsWith("../")) return output;
|
|
444
|
+
const internalAssetPath = `_gigadrive/prerender/${encodeURIComponent(output.id)}.html`;
|
|
445
|
+
assetPaths.push(projectRelativePath);
|
|
446
|
+
assetOverrides[projectRelativePath] = { path: internalAssetPath };
|
|
447
|
+
return {
|
|
448
|
+
...output,
|
|
449
|
+
fallback: { ...output.fallback, filePath: `/${internalAssetPath}` }
|
|
450
|
+
};
|
|
451
|
+
});
|
|
452
|
+
const framework = {
|
|
453
|
+
mode: manifest.mode,
|
|
454
|
+
distDir: manifest.distDir,
|
|
455
|
+
repoRootToProject: manifest.repoRootToProject,
|
|
456
|
+
nextVersion: manifest.nextVersion,
|
|
457
|
+
buildId: manifest.buildId,
|
|
458
|
+
config: manifest.config,
|
|
459
|
+
routing: manifest.routing,
|
|
460
|
+
outputs: manifest.outputs,
|
|
461
|
+
entrypoints: manifest.entrypoints,
|
|
462
|
+
outputEntrypoints: manifest.outputEntrypoints
|
|
463
|
+
};
|
|
464
|
+
return {
|
|
465
|
+
...defaults,
|
|
466
|
+
entrypoint: void 0,
|
|
467
|
+
routes: [],
|
|
468
|
+
assetPaths,
|
|
469
|
+
assetOverrides,
|
|
470
|
+
assetsDir: manifest.distDir,
|
|
471
|
+
assetsPrefixToStrip: "",
|
|
472
|
+
package: void 0,
|
|
473
|
+
normalizedConfig: {
|
|
474
|
+
entrypoints,
|
|
475
|
+
routes: [],
|
|
476
|
+
framework: {
|
|
477
|
+
...framework,
|
|
478
|
+
outputs: { ...framework.outputs, prerenders },
|
|
479
|
+
type: "nextjs",
|
|
480
|
+
schemaVersion: 2
|
|
481
|
+
},
|
|
482
|
+
images: manifest.config.images,
|
|
483
|
+
sharedArtifacts,
|
|
484
|
+
userArchive: { rootOverwrite: repoRoot }
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
});
|
|
358
488
|
var nextjs = {
|
|
359
489
|
slug: "nextjs",
|
|
360
490
|
name: "Next.js",
|
|
@@ -376,8 +506,11 @@ var nextjs = {
|
|
|
376
506
|
refineDefaultConfig: (defaults, projectFolder) => Effect4.gen(function* () {
|
|
377
507
|
const fs = yield* FileSystem4.FileSystem;
|
|
378
508
|
const manifestContent = yield* fs.readFileString(`${projectFolder}/.gigadrive/nextjs.json`).pipe(Effect4.catchAll(() => Effect4.succeed(void 0)));
|
|
379
|
-
const manifest = manifestContent ?
|
|
509
|
+
const manifest = manifestContent ? parseGigadriveNextBuildManifest(manifestContent) : void 0;
|
|
380
510
|
if (!manifest) return defaults;
|
|
511
|
+
if (manifest.version === 2) {
|
|
512
|
+
return manifest.mode === "export" ? yield* createStaticExportConfig(defaults, projectFolder) : yield* createAdapterV2Config(defaults, projectFolder, manifest);
|
|
513
|
+
}
|
|
381
514
|
return manifest.output === "export" ? yield* createStaticExportConfig(defaults, projectFolder) : yield* createStandaloneConfig(defaults, projectFolder, manifest);
|
|
382
515
|
})
|
|
383
516
|
};
|
|
@@ -585,7 +718,7 @@ var generateConfig = Effect6.fn("generateConfig")(function* (framework, packageM
|
|
|
585
718
|
entrypoint: defaults.entrypoint,
|
|
586
719
|
commands
|
|
587
720
|
});
|
|
588
|
-
const entrypoints = defaults.entrypoint ? [
|
|
721
|
+
const entrypoints = defaults.normalizedConfig?.entrypoints ?? (defaults.entrypoint ? [
|
|
589
722
|
{
|
|
590
723
|
path: defaults.entrypoint,
|
|
591
724
|
runtime: defaults.runtime,
|
|
@@ -595,14 +728,14 @@ var generateConfig = Effect6.fn("generateConfig")(function* (framework, packageM
|
|
|
595
728
|
symlinks: defaults.symlinks,
|
|
596
729
|
package: defaults.package
|
|
597
730
|
}
|
|
598
|
-
] : [];
|
|
599
|
-
const routes = defaults.entrypoint ? defaults.routes.map((route) => ({
|
|
731
|
+
] : []);
|
|
732
|
+
const routes = defaults.normalizedConfig?.routes ?? (defaults.entrypoint ? defaults.routes.map((route) => ({
|
|
600
733
|
path: route.source,
|
|
601
734
|
destination: route.destination,
|
|
602
735
|
handler: defaults.streaming ? "SERVERLESS_FUNCTION_STREAMING" : "SERVERLESS_FUNCTION",
|
|
603
736
|
methods: ["ANY"],
|
|
604
737
|
headers: {}
|
|
605
|
-
})) : [];
|
|
738
|
+
})) : []);
|
|
606
739
|
const config = {
|
|
607
740
|
regions: [...AVAILABLE_REGIONS],
|
|
608
741
|
environmentVariables: { ...defaults.environmentVariables },
|
|
@@ -611,7 +744,8 @@ var generateConfig = Effect6.fn("generateConfig")(function* (framework, packageM
|
|
|
611
744
|
routes,
|
|
612
745
|
excludeFiles: defaults.excludeFiles && defaults.excludeFiles.length > 0 ? [...defaults.excludeFiles] : void 0,
|
|
613
746
|
warnings: [`Auto-detected framework: ${framework.name}. Create a gigadrive.yaml to customize.`],
|
|
614
|
-
errors: []
|
|
747
|
+
errors: [],
|
|
748
|
+
...defaults.normalizedConfig
|
|
615
749
|
};
|
|
616
750
|
if (defaults.assetsDir || defaults.assetPaths) {
|
|
617
751
|
config.assets = {
|
|
@@ -973,6 +1107,24 @@ var toArray = (value) => {
|
|
|
973
1107
|
return Array.isArray(value) ? value : [value];
|
|
974
1108
|
};
|
|
975
1109
|
var runtimeStreamsByDefault = (runtime) => runtime == null || runtime.startsWith("node-") || runtime.startsWith("bun-");
|
|
1110
|
+
var normalizeImagePolicy = (images) => {
|
|
1111
|
+
if (!images) return void 0;
|
|
1112
|
+
return {
|
|
1113
|
+
localPatterns: images.localPatterns ?? [{ pathname: "/**" }],
|
|
1114
|
+
remotePatterns: images.remotePatterns ?? [],
|
|
1115
|
+
widths: images.widths ?? [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
|
|
1116
|
+
heights: images.heights ?? [],
|
|
1117
|
+
qualities: images.qualities ?? [75],
|
|
1118
|
+
formats: images.formats ?? ["image/avif", "image/webp"],
|
|
1119
|
+
minimumCacheTTL: images.minimumCacheTTL ?? 14400,
|
|
1120
|
+
dangerouslyAllowSVG: images.dangerouslyAllowSVG ?? false,
|
|
1121
|
+
contentSecurityPolicy: images.contentSecurityPolicy ?? "default-src 'self'; script-src 'none'; sandbox;",
|
|
1122
|
+
contentDispositionType: images.contentDispositionType ?? "attachment",
|
|
1123
|
+
maximumRedirects: images.maximumRedirects ?? 3,
|
|
1124
|
+
maximumResponseBody: images.maximumResponseBody ?? 50 * 1024 * 1024,
|
|
1125
|
+
variants: images.variants ?? {}
|
|
1126
|
+
};
|
|
1127
|
+
};
|
|
976
1128
|
var normalizeRouteDestination = (destination) => {
|
|
977
1129
|
const [withoutHash] = destination.split("#", 1);
|
|
978
1130
|
const [withoutQuery] = withoutHash.split("?", 1);
|
|
@@ -1135,6 +1287,7 @@ var V4ConfigParser = class extends Effect13.Service()("V4ConfigParser", {
|
|
|
1135
1287
|
},
|
|
1136
1288
|
environmentVariables: config.env ?? {},
|
|
1137
1289
|
commands: config.build_commands ?? [],
|
|
1290
|
+
images: normalizeImagePolicy(config.images),
|
|
1138
1291
|
entrypoints,
|
|
1139
1292
|
errors: [],
|
|
1140
1293
|
warnings: [],
|
|
@@ -1256,7 +1409,8 @@ var VercelBuildOutputParser = class extends Effect14.Service()("VercelBuildOutpu
|
|
|
1256
1409
|
}
|
|
1257
1410
|
const functionData = yield* loadFunctions(config, parseResult, projectFolder);
|
|
1258
1411
|
const assetOverrides = loadAssetOverrides(config, parseResult);
|
|
1259
|
-
const
|
|
1412
|
+
const imagePolicy = loadImagePolicy(config);
|
|
1413
|
+
const merged = deepMerge(parseResult, functionData, assetOverrides, imagePolicy);
|
|
1260
1414
|
merged.regions = [...new Set(merged.regions)];
|
|
1261
1415
|
return merged;
|
|
1262
1416
|
});
|
|
@@ -1378,6 +1532,27 @@ var loadAssetOverrides = (config, parseResult) => {
|
|
|
1378
1532
|
}
|
|
1379
1533
|
};
|
|
1380
1534
|
};
|
|
1535
|
+
var loadImagePolicy = (config) => {
|
|
1536
|
+
if (!config.images) return {};
|
|
1537
|
+
const images = config.images;
|
|
1538
|
+
return {
|
|
1539
|
+
images: {
|
|
1540
|
+
localPatterns: images.localPatterns ?? [{ pathname: "/**" }],
|
|
1541
|
+
remotePatterns: [...images.remotePatterns ?? [], ...images.domains.map((hostname) => ({ hostname }))],
|
|
1542
|
+
widths: images.sizes,
|
|
1543
|
+
heights: [],
|
|
1544
|
+
qualities: images.qualities ?? [75],
|
|
1545
|
+
formats: images.formats ?? ["image/webp"],
|
|
1546
|
+
minimumCacheTTL: images.minimumCacheTTL ?? 60,
|
|
1547
|
+
dangerouslyAllowSVG: images.dangerouslyAllowSVG ?? false,
|
|
1548
|
+
contentSecurityPolicy: images.contentSecurityPolicy ?? "default-src 'self'; script-src 'none'; sandbox;",
|
|
1549
|
+
contentDispositionType: images.contentDispositionType === "inline" ? "inline" : "attachment",
|
|
1550
|
+
maximumRedirects: 3,
|
|
1551
|
+
maximumResponseBody: 50 * 1024 * 1024,
|
|
1552
|
+
variants: {}
|
|
1553
|
+
}
|
|
1554
|
+
};
|
|
1555
|
+
};
|
|
1381
1556
|
|
|
1382
1557
|
// src/v4/schema.json
|
|
1383
1558
|
var schema_default = {
|
|
@@ -1408,6 +1583,91 @@ var schema_default = {
|
|
|
1408
1583
|
type: ["boolean", "null"],
|
|
1409
1584
|
description: "If true, the assets will be cached at the edge during deployment. This may increase the deployment time, depending on the size of the assets. Defaults to false."
|
|
1410
1585
|
},
|
|
1586
|
+
images: {
|
|
1587
|
+
type: ["object", "null"],
|
|
1588
|
+
description: "Managed image optimization policy for this deployment.",
|
|
1589
|
+
additionalProperties: false,
|
|
1590
|
+
properties: {
|
|
1591
|
+
localPatterns: {
|
|
1592
|
+
type: "array",
|
|
1593
|
+
maxItems: 64,
|
|
1594
|
+
items: {
|
|
1595
|
+
type: "object",
|
|
1596
|
+
additionalProperties: false,
|
|
1597
|
+
properties: {
|
|
1598
|
+
pathname: { type: "string", minLength: 1, maxLength: 2048 },
|
|
1599
|
+
search: { type: "string", maxLength: 2048 }
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
},
|
|
1603
|
+
remotePatterns: {
|
|
1604
|
+
type: "array",
|
|
1605
|
+
maxItems: 64,
|
|
1606
|
+
items: {
|
|
1607
|
+
type: "object",
|
|
1608
|
+
required: ["hostname"],
|
|
1609
|
+
additionalProperties: false,
|
|
1610
|
+
properties: {
|
|
1611
|
+
protocol: { type: "string", enum: ["http", "https"] },
|
|
1612
|
+
hostname: { type: "string", minLength: 1, maxLength: 253 },
|
|
1613
|
+
port: { type: "string", pattern: "^[0-9]{0,5}$" },
|
|
1614
|
+
pathname: { type: "string", minLength: 1, maxLength: 2048 },
|
|
1615
|
+
search: { type: "string", maxLength: 2048 }
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
},
|
|
1619
|
+
widths: {
|
|
1620
|
+
type: "array",
|
|
1621
|
+
minItems: 1,
|
|
1622
|
+
maxItems: 64,
|
|
1623
|
+
uniqueItems: true,
|
|
1624
|
+
items: { type: "integer", minimum: 1, maximum: 8192 }
|
|
1625
|
+
},
|
|
1626
|
+
heights: {
|
|
1627
|
+
type: "array",
|
|
1628
|
+
maxItems: 64,
|
|
1629
|
+
uniqueItems: true,
|
|
1630
|
+
items: { type: "integer", minimum: 1, maximum: 8192 }
|
|
1631
|
+
},
|
|
1632
|
+
qualities: {
|
|
1633
|
+
type: "array",
|
|
1634
|
+
minItems: 1,
|
|
1635
|
+
maxItems: 100,
|
|
1636
|
+
uniqueItems: true,
|
|
1637
|
+
items: { type: "integer", minimum: 1, maximum: 100 }
|
|
1638
|
+
},
|
|
1639
|
+
formats: {
|
|
1640
|
+
type: "array",
|
|
1641
|
+
minItems: 1,
|
|
1642
|
+
maxItems: 4,
|
|
1643
|
+
uniqueItems: true,
|
|
1644
|
+
items: { type: "string", enum: ["image/avif", "image/webp", "image/jpeg", "image/png"] }
|
|
1645
|
+
},
|
|
1646
|
+
minimumCacheTTL: { type: "integer", minimum: 0, maximum: 31536e3 },
|
|
1647
|
+
dangerouslyAllowSVG: { type: "boolean" },
|
|
1648
|
+
contentSecurityPolicy: { type: "string", maxLength: 4096 },
|
|
1649
|
+
contentDispositionType: { type: "string", enum: ["inline", "attachment"] },
|
|
1650
|
+
maximumRedirects: { type: "integer", minimum: 0, maximum: 10 },
|
|
1651
|
+
maximumResponseBody: { type: "integer", minimum: 1024, maximum: 104857600 },
|
|
1652
|
+
variants: {
|
|
1653
|
+
type: "object",
|
|
1654
|
+
maxProperties: 100,
|
|
1655
|
+
propertyNames: { pattern: "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$" },
|
|
1656
|
+
additionalProperties: {
|
|
1657
|
+
type: "object",
|
|
1658
|
+
minProperties: 1,
|
|
1659
|
+
additionalProperties: false,
|
|
1660
|
+
properties: {
|
|
1661
|
+
width: { type: "integer", minimum: 1, maximum: 8192 },
|
|
1662
|
+
height: { type: "integer", minimum: 1, maximum: 8192 },
|
|
1663
|
+
quality: { type: "integer", minimum: 1, maximum: 100 },
|
|
1664
|
+
format: { type: "string", enum: ["image/avif", "image/webp", "image/jpeg", "image/png"] },
|
|
1665
|
+
fit: { type: "string", enum: ["contain", "cover", "fill", "inside", "outside"] }
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
},
|
|
1411
1671
|
regions: {
|
|
1412
1672
|
type: ["array", "null"],
|
|
1413
1673
|
description: 'The regions to which the project will be deployed. Use "global" to deploy to all regions. More regions will incur higher costs.',
|
|
@@ -1807,6 +2067,7 @@ export {
|
|
|
1807
2067
|
mergeWithFrameworkDefaults,
|
|
1808
2068
|
parseConfig,
|
|
1809
2069
|
parseConfigRaw,
|
|
2070
|
+
parseGigadriveNextBuildManifest,
|
|
1810
2071
|
postProcessConfig,
|
|
1811
2072
|
readDependencies
|
|
1812
2073
|
};
|