@cloudflare/vite-plugin 1.35.0 → 1.36.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 +54 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{package-D0px1l44.mjs → package-CKyFi-5y.mjs} +2 -2
- package/dist/{package-D0px1l44.mjs.map → package-CKyFi-5y.mjs.map} +1 -1
- package/dist/workers/asset-worker/index.js +16 -5
- package/dist/workers/runner-worker/index.js +5 -4
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1503,7 +1503,7 @@ async function assertWranglerVersion() {
|
|
|
1503
1503
|
* The default compatibility date to use when the user omits one.
|
|
1504
1504
|
* This value is injected at build time and remains fixed for each release.
|
|
1505
1505
|
*/
|
|
1506
|
-
const DEFAULT_COMPAT_DATE = "2026-
|
|
1506
|
+
const DEFAULT_COMPAT_DATE = "2026-05-07";
|
|
1507
1507
|
|
|
1508
1508
|
//#endregion
|
|
1509
1509
|
//#region ../../node_modules/.pnpm/@remix-run+node-fetch-server@0.8.0/node_modules/@remix-run/node-fetch-server/dist/node-fetch-server.js
|
|
@@ -31264,7 +31264,6 @@ var validateStreamingTailConsumers = /* @__PURE__ */ __name((diagnostics, field,
|
|
|
31264
31264
|
function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDispatchNamespace, preserveOriginalMain, envName = "top level", topLevelEnv, useServiceEnvironments, rawConfig) {
|
|
31265
31265
|
deprecated(diagnostics, rawEnv, "node_compat", `The "node_compat" field is no longer supported as of Wrangler v4. Instead, use the \`nodejs_compat\` compatibility flag. This includes the functionality from legacy \`node_compat\` polyfills and natively implemented Node.js APIs. See https://developers.cloudflare.com/workers/runtime-apis/nodejs for more information.`, true, "Removed", "error");
|
|
31266
31266
|
experimental(diagnostics, rawEnv, "unsafe");
|
|
31267
|
-
experimental(diagnostics, rawEnv, "secrets");
|
|
31268
31267
|
const route = normalizeAndValidateRoute(diagnostics, topLevelEnv, rawEnv);
|
|
31269
31268
|
const account_id = inheritableInWranglerEnvironments(diagnostics, useServiceEnvironments, topLevelEnv, mutateEmptyStringAccountIDValue(diagnostics, rawEnv), "account_id", isString$2, void 0, void 0);
|
|
31270
31269
|
const routes = validateRoutes(diagnostics, topLevelEnv, rawEnv);
|
|
@@ -32764,13 +32763,15 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName) => (diagnostics, f
|
|
|
32764
32763
|
"secrets_store_secrets",
|
|
32765
32764
|
"artifacts",
|
|
32766
32765
|
"unsafe_hello_world",
|
|
32766
|
+
"flagship",
|
|
32767
32767
|
"worker_loaders",
|
|
32768
32768
|
"ratelimits",
|
|
32769
32769
|
"vpc_services",
|
|
32770
32770
|
"version_metadata",
|
|
32771
32771
|
"logpush",
|
|
32772
32772
|
"observability",
|
|
32773
|
-
"limits"
|
|
32773
|
+
"limits",
|
|
32774
|
+
"cache"
|
|
32774
32775
|
]) && isValid2;
|
|
32775
32776
|
isValid2 = validateVars(envName)(diagnostics, `${field}.vars`, previews.vars, void 0) && isValid2;
|
|
32776
32777
|
isValid2 = validateDefines(envName)(diagnostics, `${field}.define`, previews.define, void 0) && isValid2;
|
|
@@ -32799,6 +32800,7 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName) => (diagnostics, f
|
|
|
32799
32800
|
isValid2 = validateBindingArray(envName, validateSecretsStoreSecretBinding)(diagnostics, `${field}.secrets_store_secrets`, previews.secrets_store_secrets, void 0) && isValid2;
|
|
32800
32801
|
isValid2 = validateBindingArray(envName, validateArtifactsBinding)(diagnostics, `${field}.artifacts`, previews.artifacts, void 0) && isValid2;
|
|
32801
32802
|
isValid2 = validateBindingArray(envName, validateHelloWorldBinding)(diagnostics, `${field}.unsafe_hello_world`, previews.unsafe_hello_world, void 0) && isValid2;
|
|
32803
|
+
isValid2 = validateBindingArray(envName, validateFlagshipBinding)(diagnostics, `${field}.flagship`, previews.flagship, void 0) && isValid2;
|
|
32802
32804
|
isValid2 = validateBindingArray(envName, validateWorkerLoaderBinding)(diagnostics, `${field}.worker_loaders`, previews.worker_loaders, void 0) && isValid2;
|
|
32803
32805
|
isValid2 = validateBindingArray(envName, validateRateLimitBinding)(diagnostics, `${field}.ratelimits`, previews.ratelimits, void 0) && isValid2;
|
|
32804
32806
|
isValid2 = validateBindingArray(envName, validateVpcServiceBinding)(diagnostics, `${field}.vpc_services`, previews.vpc_services, void 0) && isValid2;
|
|
@@ -32809,6 +32811,7 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName) => (diagnostics, f
|
|
|
32809
32811
|
isValid2 = validateOptionalProperty(diagnostics, `${field}.limits`, "cpu_ms", previews.limits.cpu_ms, "number") && isValid2;
|
|
32810
32812
|
isValid2 = validateOptionalProperty(diagnostics, `${field}.limits`, "subrequests", previews.limits.subrequests, "number") && isValid2;
|
|
32811
32813
|
}
|
|
32814
|
+
isValid2 = validateCache(diagnostics, `${field}.cache`, previews.cache, void 0) && isValid2;
|
|
32812
32815
|
return isValid2;
|
|
32813
32816
|
}, "validatePreviewsConfig");
|
|
32814
32817
|
var validateMigrations = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
@@ -42598,6 +42601,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
42598
42601
|
const rules = [];
|
|
42599
42602
|
const invalid = [];
|
|
42600
42603
|
let rule = void 0;
|
|
42604
|
+
let skipUntilNextPath = false;
|
|
42601
42605
|
for (let i$1 = 0; i$1 < lines.length; i$1++) {
|
|
42602
42606
|
const line = (lines[i$1] || "").trim();
|
|
42603
42607
|
if (line.length === 0 || line.startsWith("#")) continue;
|
|
@@ -42606,6 +42610,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
42606
42610
|
continue;
|
|
42607
42611
|
}
|
|
42608
42612
|
if (LINE_IS_PROBABLY_A_PATH.test(line)) {
|
|
42613
|
+
skipUntilNextPath = false;
|
|
42609
42614
|
if (rules.length >= maxRules) {
|
|
42610
42615
|
invalid.push({ message: `Maximum number of rules supported is ${maxRules}. Skipping remaining ${lines.length - i$1} lines of file.` });
|
|
42611
42616
|
break;
|
|
@@ -42628,6 +42633,18 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
42628
42633
|
message: pathError
|
|
42629
42634
|
});
|
|
42630
42635
|
rule = void 0;
|
|
42636
|
+
skipUntilNextPath = true;
|
|
42637
|
+
continue;
|
|
42638
|
+
}
|
|
42639
|
+
const wildcardError = validateNoMultipleWildcards(path$2);
|
|
42640
|
+
if (wildcardError) {
|
|
42641
|
+
invalid.push({
|
|
42642
|
+
line,
|
|
42643
|
+
lineNumber: i$1 + 1,
|
|
42644
|
+
message: wildcardError
|
|
42645
|
+
});
|
|
42646
|
+
rule = void 0;
|
|
42647
|
+
skipUntilNextPath = true;
|
|
42631
42648
|
continue;
|
|
42632
42649
|
}
|
|
42633
42650
|
rule = {
|
|
@@ -42638,6 +42655,7 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
42638
42655
|
};
|
|
42639
42656
|
continue;
|
|
42640
42657
|
}
|
|
42658
|
+
if (skipUntilNextPath) continue;
|
|
42641
42659
|
if (!line.includes(HEADER_SEPARATOR)) {
|
|
42642
42660
|
if (!rule) invalid.push({
|
|
42643
42661
|
line,
|
|
@@ -42707,6 +42725,18 @@ function parseHeaders(input, { maxRules = MAX_HEADER_RULES, maxLineLength = MAX_
|
|
|
42707
42725
|
function isValidRule(rule) {
|
|
42708
42726
|
return Object.keys(rule.headers).length > 0 || rule.unsetHeaders.length > 0;
|
|
42709
42727
|
}
|
|
42728
|
+
/**
|
|
42729
|
+
* At runtime, `*` wildcards are converted to `:splat` placeholders. This means
|
|
42730
|
+
* a path with multiple wildcards, or a wildcard combined with an explicit
|
|
42731
|
+
* `:splat` placeholder, would result in duplicate `:splat` parameters which is
|
|
42732
|
+
* unsupported.
|
|
42733
|
+
*/
|
|
42734
|
+
function validateNoMultipleWildcards(path$2) {
|
|
42735
|
+
const wildcardCount = (path$2.match(SPLAT_REGEX) ?? []).length;
|
|
42736
|
+
const hasSplatPlaceholder = /:splat(?!\w)/.test(path$2);
|
|
42737
|
+
if (wildcardCount > 1) return `Only one wildcard is allowed per rule. Use a named placeholder (e.g. :project) instead. Skipping ${path$2}.`;
|
|
42738
|
+
if (wildcardCount > 0 && hasSplatPlaceholder) return `Cannot combine a wildcard * with a :splat placeholder because wildcards are converted to :splat at runtime. Skipping ${path$2}.`;
|
|
42739
|
+
}
|
|
42710
42740
|
|
|
42711
42741
|
//#endregion
|
|
42712
42742
|
//#region ../workers-shared/utils/configuration/parseRedirects.ts
|
|
@@ -48427,10 +48457,26 @@ function getLocalDevVarsForPreview(config, cloudflareEnv) {
|
|
|
48427
48457
|
const dotDevDotVars = wrangler.unstable_getVarsForDev(config.configPath, void 0, {}, cloudflareEnv, false, config.secrets);
|
|
48428
48458
|
const dotDevDotVarsEntries = Array.from(Object.entries(dotDevDotVars));
|
|
48429
48459
|
if (dotDevDotVarsEntries.length > 0) return dotDevDotVarsEntries.map(([key, { value }]) => {
|
|
48430
|
-
return `${key}
|
|
48460
|
+
return `${key}=${quoteForDotenv(value?.toString() ?? "")}\n`;
|
|
48431
48461
|
}).join("");
|
|
48432
48462
|
}
|
|
48433
48463
|
/**
|
|
48464
|
+
* Quote a value so that wrangler reads it back unchanged when it parses
|
|
48465
|
+
* `dist/<env>/.dev.vars` at preview time.
|
|
48466
|
+
*
|
|
48467
|
+
* Strategy: To quote the string pick the first quote character that does not
|
|
48468
|
+
* appear in the value (single → backtick → double). Throw if a value cannot
|
|
48469
|
+
* be losslessly serialized rather than silently corrupting it.
|
|
48470
|
+
*
|
|
48471
|
+
* @internal exported for tests
|
|
48472
|
+
*/
|
|
48473
|
+
function quoteForDotenv(value) {
|
|
48474
|
+
if (!value.includes("'")) return `'${value}'`;
|
|
48475
|
+
if (!value.includes("`")) return `\`${value}\``;
|
|
48476
|
+
if (!value.includes("\"") && !/[\\\n\r]/.test(value)) return `"${value}"`;
|
|
48477
|
+
throw new Error("Unable to serialize value to .dev.vars: contains every supported quote character or unsafe escape sequence.");
|
|
48478
|
+
}
|
|
48479
|
+
/**
|
|
48434
48480
|
* Returns `true` if the `changedFile` matches a `.dev.vars` or `.env` file.
|
|
48435
48481
|
*/
|
|
48436
48482
|
function hasLocalDevVarsFileChanged({ configPaths, cloudflareEnv }, changedFilePath) {
|
|
@@ -48489,7 +48535,10 @@ const configPlugin = createPlugin("config", (ctx) => {
|
|
|
48489
48535
|
fs: { deny: [...[
|
|
48490
48536
|
".env",
|
|
48491
48537
|
".env.*",
|
|
48492
|
-
"
|
|
48538
|
+
".npmrc",
|
|
48539
|
+
".yarnrc",
|
|
48540
|
+
".yarnrc.yml",
|
|
48541
|
+
"*.{crt,pem,key,pfx,p12,p8,jks}",
|
|
48493
48542
|
"**/.git/**",
|
|
48494
48543
|
".dev.vars",
|
|
48495
48544
|
".dev.vars.*",
|