@cloudflare/vite-plugin 1.25.6 → 1.26.1
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
|
@@ -6500,12 +6500,26 @@ var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value)
|
|
|
6500
6500
|
diagnostics.errors.push(`"${field}" bindings should, optionally, have a boolean "remote" field but got ${JSON.stringify(value)}.`);
|
|
6501
6501
|
isValid$1 = false;
|
|
6502
6502
|
}
|
|
6503
|
+
if (hasProperty(value, "limits") && value.limits !== void 0) if (typeof value.limits !== "object" || value.limits === null || Array.isArray(value.limits)) {
|
|
6504
|
+
diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "limits" field but got ${JSON.stringify(value)}.`);
|
|
6505
|
+
isValid$1 = false;
|
|
6506
|
+
} else {
|
|
6507
|
+
const limits = value.limits;
|
|
6508
|
+
if (limits.steps !== void 0) {
|
|
6509
|
+
if (typeof limits.steps !== "number" || !Number.isInteger(limits.steps) || limits.steps < 1) {
|
|
6510
|
+
diagnostics.errors.push(`"${field}" bindings "limits.steps" field must be a positive integer but got ${JSON.stringify(limits.steps)}.`);
|
|
6511
|
+
isValid$1 = false;
|
|
6512
|
+
} else if (limits.steps > 25e3) diagnostics.warnings.push(`"${field}" has a step limit of ${limits.steps}, which exceeds the production maximum of 25,000. This configuration may not work when deployed.`);
|
|
6513
|
+
}
|
|
6514
|
+
validateAdditionalProperties(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
|
|
6515
|
+
}
|
|
6503
6516
|
validateAdditionalProperties(diagnostics, field, Object.keys(value), [
|
|
6504
6517
|
"binding",
|
|
6505
6518
|
"name",
|
|
6506
6519
|
"class_name",
|
|
6507
6520
|
"script_name",
|
|
6508
|
-
"remote"
|
|
6521
|
+
"remote",
|
|
6522
|
+
"limits"
|
|
6509
6523
|
]);
|
|
6510
6524
|
return isValid$1;
|
|
6511
6525
|
}, "validateWorkflowBinding");
|
|
@@ -21768,10 +21782,11 @@ function initRunners(resolvedPluginConfig, viteDevServer, miniflare) {
|
|
|
21768
21782
|
/**
|
|
21769
21783
|
* Gets any variables with which to augment the Worker config in preview mode.
|
|
21770
21784
|
*
|
|
21771
|
-
* Calls `unstable_getVarsForDev` with the current Cloudflare environment to get local dev variables from the
|
|
21785
|
+
* Calls `unstable_getVarsForDev` with the current Cloudflare environment to get local dev variables from the .dev.vars/.env/process.env.
|
|
21786
|
+
* When `secrets` is defined in the Worker config, only declared secrets are loaded.
|
|
21772
21787
|
*/
|
|
21773
|
-
function getLocalDevVarsForPreview(
|
|
21774
|
-
const dotDevDotVars = wrangler.unstable_getVarsForDev(configPath, void 0, {}, cloudflareEnv);
|
|
21788
|
+
function getLocalDevVarsForPreview(config, cloudflareEnv) {
|
|
21789
|
+
const dotDevDotVars = wrangler.unstable_getVarsForDev(config.configPath, void 0, {}, cloudflareEnv, false, config.secrets);
|
|
21775
21790
|
const dotDevDotVarsEntries = Array.from(Object.entries(dotDevDotVars));
|
|
21776
21791
|
if (dotDevDotVarsEntries.length > 0) return dotDevDotVarsEntries.map(([key, { value }]) => {
|
|
21777
21792
|
return `${key} = "${value?.toString().replaceAll(`"`, `\\"`)}"\n`;
|
|
@@ -22307,6 +22322,18 @@ let DeploymentNotFoundError;
|
|
|
22307
22322
|
}({});
|
|
22308
22323
|
})(DeploymentNotFoundError || (DeploymentNotFoundError = {}));
|
|
22309
22324
|
|
|
22325
|
+
//#endregion
|
|
22326
|
+
//#region ../containers-shared/src/client/models/ExternalRegistryKind.ts
|
|
22327
|
+
/* istanbul ignore file */
|
|
22328
|
+
/**
|
|
22329
|
+
* The type of external registry that is being configured.
|
|
22330
|
+
*/
|
|
22331
|
+
let ExternalRegistryKind = /* @__PURE__ */ function(ExternalRegistryKind$1) {
|
|
22332
|
+
ExternalRegistryKind$1["ECR"] = "ECR";
|
|
22333
|
+
ExternalRegistryKind$1["DOCKER_HUB"] = "DockerHub";
|
|
22334
|
+
return ExternalRegistryKind$1;
|
|
22335
|
+
}({});
|
|
22336
|
+
|
|
22310
22337
|
//#endregion
|
|
22311
22338
|
//#region ../containers-shared/src/client/models/ImageRegistryAlreadyExistsError.ts
|
|
22312
22339
|
let ImageRegistryAlreadyExistsError;
|
|
@@ -23143,19 +23170,20 @@ async function cleanupDuplicateImageTags(dockerPath, imageTag) {
|
|
|
23143
23170
|
} catch {}
|
|
23144
23171
|
}
|
|
23145
23172
|
|
|
23146
|
-
//#endregion
|
|
23147
|
-
//#region ../containers-shared/src/client/models/ExternalRegistryKind.ts
|
|
23148
|
-
/* istanbul ignore file */
|
|
23149
|
-
/**
|
|
23150
|
-
* The type of external registry that is being configured.
|
|
23151
|
-
*/
|
|
23152
|
-
let ExternalRegistryKind = /* @__PURE__ */ function(ExternalRegistryKind$1) {
|
|
23153
|
-
ExternalRegistryKind$1["ECR"] = "ECR";
|
|
23154
|
-
return ExternalRegistryKind$1;
|
|
23155
|
-
}({});
|
|
23156
|
-
|
|
23157
23173
|
//#endregion
|
|
23158
23174
|
//#region ../containers-shared/src/images.ts
|
|
23175
|
+
const DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE = "cloudflare/proxy-everything:4dc6c7f@sha256:9621ef445ef120409e5d95bbd845ab2fa0f613636b59a01d998f5704f4096ae2";
|
|
23176
|
+
function getEgressInterceptorImage() {
|
|
23177
|
+
return process.env.MINIFLARE_CONTAINER_EGRESS_IMAGE ?? DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE;
|
|
23178
|
+
}
|
|
23179
|
+
async function pullEgressInterceptorImage(dockerPath) {
|
|
23180
|
+
await runDockerCmd(dockerPath, [
|
|
23181
|
+
"pull",
|
|
23182
|
+
getEgressInterceptorImage(),
|
|
23183
|
+
"--platform",
|
|
23184
|
+
"linux/amd64"
|
|
23185
|
+
]);
|
|
23186
|
+
}
|
|
23159
23187
|
async function pullImage(dockerPath, options, logger, isVite) {
|
|
23160
23188
|
const domain = new URL(`http://${options.image_uri}`).hostname;
|
|
23161
23189
|
const isExternalRegistry = domain !== getCloudflareContainerRegistry();
|
|
@@ -23233,6 +23261,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
23233
23261
|
await checkExposedPorts(dockerPath, options);
|
|
23234
23262
|
}
|
|
23235
23263
|
}
|
|
23264
|
+
if (!aborted && args.compatibilityFlags?.includes("experimental")) await pullEgressInterceptorImage(dockerPath);
|
|
23236
23265
|
}
|
|
23237
23266
|
|
|
23238
23267
|
//#endregion
|
|
@@ -26334,7 +26363,8 @@ const devPlugin = createPlugin("dev", (ctx) => {
|
|
|
26334
26363
|
onContainerImagePreparationStart: () => {},
|
|
26335
26364
|
onContainerImagePreparationEnd: () => {},
|
|
26336
26365
|
logger: viteDevServer.config.logger,
|
|
26337
|
-
isVite: true
|
|
26366
|
+
isVite: true,
|
|
26367
|
+
compatibilityFlags: ctx.allWorkerConfigs.flatMap((c) => c.compatibility_flags)
|
|
26338
26368
|
});
|
|
26339
26369
|
containerImageTags = new Set(containerTagToOptionsMap.keys());
|
|
26340
26370
|
viteDevServer.config.logger.info(import_picocolors$2.default.dim(import_picocolors$2.default.yellow("\n⚡️ Containers successfully built. To rebuild your containers during development, restart the Vite dev server (r + enter).")));
|
|
@@ -26505,7 +26535,7 @@ const outputConfigPlugin = createPlugin("output-config", (ctx) => {
|
|
|
26505
26535
|
};
|
|
26506
26536
|
if (inputWorkerConfig.upload_source_maps === void 0 && this.environment.config.build.sourcemap) outputConfig.upload_source_maps = true;
|
|
26507
26537
|
if (inputWorkerConfig.configPath) {
|
|
26508
|
-
const localDevVars = getLocalDevVarsForPreview(inputWorkerConfig
|
|
26538
|
+
const localDevVars = getLocalDevVarsForPreview(inputWorkerConfig, ctx.resolvedPluginConfig.cloudflareEnv);
|
|
26509
26539
|
if (localDevVars) this.emitFile({
|
|
26510
26540
|
type: "asset",
|
|
26511
26541
|
fileName: ".dev.vars",
|
|
@@ -26584,7 +26614,8 @@ const previewPlugin = createPlugin("preview", (ctx) => {
|
|
|
26584
26614
|
onContainerImagePreparationStart: () => {},
|
|
26585
26615
|
onContainerImagePreparationEnd: () => {},
|
|
26586
26616
|
logger: vitePreviewServer.config.logger,
|
|
26587
|
-
isVite: true
|
|
26617
|
+
isVite: true,
|
|
26618
|
+
compatibilityFlags: ctx.allWorkerConfigs.flatMap((c) => c.compatibility_flags)
|
|
26588
26619
|
});
|
|
26589
26620
|
const containerImageTags = new Set(containerTagToOptionsMap.keys());
|
|
26590
26621
|
vitePreviewServer.config.logger.info(import_picocolors$1.default.dim(import_picocolors$1.default.yellow("\n⚡️ Containers successfully built.\n")));
|