@cloudflare/vite-plugin 1.30.0 → 1.30.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 +77 -14
- package/dist/index.mjs.map +1 -1
- package/dist/{package--uDsBjBd.mjs → package-BOguDXuZ.mjs} +5 -5
- package/dist/{package--uDsBjBd.mjs.map → package-BOguDXuZ.mjs.map} +1 -1
- package/dist/workers/runner-worker/module-runner-legacy.js +1 -1
- package/dist/workers/runner-worker/module-runner.js +2 -2
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1893,7 +1893,14 @@ const formatInvalidRoutes = (invalidRules) => {
|
|
|
1893
1893
|
};
|
|
1894
1894
|
|
|
1895
1895
|
//#endregion
|
|
1896
|
-
//#region ../workers-utils/dist/chunk-
|
|
1896
|
+
//#region ../workers-utils/dist/chunk-OZQVB3L3.mjs
|
|
1897
|
+
var INHERIT_SYMBOL = Symbol.for("inherit_binding");
|
|
1898
|
+
var SERVICE_TAG_PREFIX = "cf:service=";
|
|
1899
|
+
var ENVIRONMENT_TAG_PREFIX = "cf:environment=";
|
|
1900
|
+
var PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
|
|
1901
|
+
|
|
1902
|
+
//#endregion
|
|
1903
|
+
//#region ../workers-utils/dist/chunk-DCOBXSFB.mjs
|
|
1897
1904
|
var __create = Object.create;
|
|
1898
1905
|
var __defProp = Object.defineProperty;
|
|
1899
1906
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1931,13 +1938,9 @@ var __toESM = (mod, isNodeMode, target$1) => (target$1 = mod != null ? __create(
|
|
|
1931
1938
|
value: mod,
|
|
1932
1939
|
enumerable: true
|
|
1933
1940
|
}) : target$1, mod));
|
|
1934
|
-
var INHERIT_SYMBOL = Symbol.for("inherit_binding");
|
|
1935
|
-
var SERVICE_TAG_PREFIX = "cf:service=";
|
|
1936
|
-
var ENVIRONMENT_TAG_PREFIX = "cf:environment=";
|
|
1937
|
-
var PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
|
|
1938
1941
|
|
|
1939
1942
|
//#endregion
|
|
1940
|
-
//#region ../workers-utils/dist/chunk-
|
|
1943
|
+
//#region ../workers-utils/dist/chunk-DMN4LFFR.mjs
|
|
1941
1944
|
function getLocalWorkerdCompatibilityDate({ projectPath = process.cwd() } = {}) {
|
|
1942
1945
|
try {
|
|
1943
1946
|
const miniflareEntry = module$1.createRequire(path3.join(projectPath, "package.json")).resolve("miniflare");
|
|
@@ -2237,7 +2240,57 @@ function constructWranglerConfig(workerOrWorkers) {
|
|
|
2237
2240
|
__name(constructWranglerConfig, "constructWranglerConfig");
|
|
2238
2241
|
|
|
2239
2242
|
//#endregion
|
|
2240
|
-
//#region ../workers-utils/dist/chunk-
|
|
2243
|
+
//#region ../workers-utils/dist/chunk-O4YGOZSW.mjs
|
|
2244
|
+
var MetricsRegistry = class {
|
|
2245
|
+
static {
|
|
2246
|
+
__name(this, "MetricsRegistry");
|
|
2247
|
+
}
|
|
2248
|
+
counters = [];
|
|
2249
|
+
/**
|
|
2250
|
+
* Create and register a new counter metric.
|
|
2251
|
+
*
|
|
2252
|
+
* @param name - The metric name (e.g. "service_request_total")
|
|
2253
|
+
* @param help - A human-readable description of the metric
|
|
2254
|
+
* @returns A Counter that can be incremented
|
|
2255
|
+
*/
|
|
2256
|
+
createCounter(name, help) {
|
|
2257
|
+
const entry = {
|
|
2258
|
+
name,
|
|
2259
|
+
help,
|
|
2260
|
+
value: 0
|
|
2261
|
+
};
|
|
2262
|
+
this.counters.push(entry);
|
|
2263
|
+
return {
|
|
2264
|
+
inc: /* @__PURE__ */ __name(() => {
|
|
2265
|
+
entry.value++;
|
|
2266
|
+
}, "inc"),
|
|
2267
|
+
add: /* @__PURE__ */ __name((amount) => {
|
|
2268
|
+
if (amount < 0) throw new Error("Counter value cannot decrease");
|
|
2269
|
+
entry.value += amount;
|
|
2270
|
+
}, "add")
|
|
2271
|
+
};
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* Serialize all registered metrics in Prometheus text exposition format.
|
|
2275
|
+
*
|
|
2276
|
+
* @see https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format
|
|
2277
|
+
*/
|
|
2278
|
+
metrics() {
|
|
2279
|
+
return this.counters.map((c) => {
|
|
2280
|
+
let result = "";
|
|
2281
|
+
if (c.help.length > 0) result += `# HELP ${c.name} ${c.help}
|
|
2282
|
+
`;
|
|
2283
|
+
result += `# TYPE ${c.name} counter
|
|
2284
|
+
`;
|
|
2285
|
+
result += `${c.name} ${c.value}
|
|
2286
|
+
`;
|
|
2287
|
+
return result;
|
|
2288
|
+
}).join("");
|
|
2289
|
+
}
|
|
2290
|
+
};
|
|
2291
|
+
|
|
2292
|
+
//#endregion
|
|
2293
|
+
//#region ../workers-utils/dist/chunk-R5I2EYQO.mjs
|
|
2241
2294
|
var UserError = class extends Error {
|
|
2242
2295
|
static {
|
|
2243
2296
|
__name(this, "UserError");
|
|
@@ -9002,6 +9055,8 @@ var Diagnostics = class {
|
|
|
9002
9055
|
errors = [];
|
|
9003
9056
|
warnings = [];
|
|
9004
9057
|
children = [];
|
|
9058
|
+
/** Set to true when an unexpected/unknown field is encountered during validation. */
|
|
9059
|
+
hasUnexpectedFields = false;
|
|
9005
9060
|
/**
|
|
9006
9061
|
* Merge the given `diagnostics` into this as a child.
|
|
9007
9062
|
*/
|
|
@@ -9013,6 +9068,11 @@ var Diagnostics = class {
|
|
|
9013
9068
|
if (this.errors.length > 0) return true;
|
|
9014
9069
|
else return this.children.some((child) => child.hasErrors());
|
|
9015
9070
|
}
|
|
9071
|
+
/** Does this or any of its children have unexpected fields. */
|
|
9072
|
+
hasUnexpectedFieldsInTree() {
|
|
9073
|
+
if (this.hasUnexpectedFields) return true;
|
|
9074
|
+
else return this.children.some((child) => child.hasUnexpectedFieldsInTree());
|
|
9075
|
+
}
|
|
9016
9076
|
/** Render the errors of this and all its children. */
|
|
9017
9077
|
renderErrors() {
|
|
9018
9078
|
return this.render("errors");
|
|
@@ -9205,6 +9265,7 @@ var validateAdditionalProperties = /* @__PURE__ */ __name((diagnostics, fieldPat
|
|
|
9205
9265
|
if (restPropSet.size > 0) {
|
|
9206
9266
|
const fields = Array.from(restPropSet.keys()).map((field) => `"${field}"`);
|
|
9207
9267
|
diagnostics.warnings.push(`Unexpected fields found in ${fieldPath} field: ${fields}`);
|
|
9268
|
+
diagnostics.hasUnexpectedFields = true;
|
|
9208
9269
|
return false;
|
|
9209
9270
|
}
|
|
9210
9271
|
return true;
|
|
@@ -19266,14 +19327,15 @@ const additionalModulesPlugin = createPlugin("additional-modules", (ctx) => {
|
|
|
19266
19327
|
resolveId: {
|
|
19267
19328
|
filter: { id: moduleRuleFilters },
|
|
19268
19329
|
async handler(source, importer, options) {
|
|
19269
|
-
const
|
|
19270
|
-
if (!
|
|
19271
|
-
const
|
|
19272
|
-
if (!
|
|
19273
|
-
|
|
19330
|
+
const resolved = await this.resolve(source, importer, options);
|
|
19331
|
+
if (!resolved) return;
|
|
19332
|
+
const additionalModuleType = matchAdditionalModule(resolved.id);
|
|
19333
|
+
if (!additionalModuleType) return resolved;
|
|
19334
|
+
const filePath = cleanUrl(resolved.id);
|
|
19335
|
+
additionalModulePaths.add(filePath);
|
|
19274
19336
|
return {
|
|
19275
19337
|
external: true,
|
|
19276
|
-
id: createModuleReference(additionalModuleType,
|
|
19338
|
+
id: createModuleReference(additionalModuleType, filePath)
|
|
19277
19339
|
};
|
|
19278
19340
|
}
|
|
19279
19341
|
},
|
|
@@ -19338,7 +19400,8 @@ const moduleRules = [
|
|
|
19338
19400
|
pattern: /\.(txt|html|sql)$/
|
|
19339
19401
|
}
|
|
19340
19402
|
];
|
|
19341
|
-
const
|
|
19403
|
+
const subpathImportRE = /^#/;
|
|
19404
|
+
const moduleRuleFilters = [...moduleRules.map((rule) => rule.pattern), subpathImportRE];
|
|
19342
19405
|
function matchAdditionalModule(source) {
|
|
19343
19406
|
for (const rule of moduleRules) if (rule.pattern.test(source)) return rule.type;
|
|
19344
19407
|
return null;
|