@cloudflare/vite-plugin 1.56.0 → 1.57.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/experimental-config.d.mts +280 -307
- package/dist/experimental-config.d.mts.map +1 -1
- package/dist/experimental-config.mjs +66 -39
- package/dist/experimental-config.mjs.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1141 -441
- package/dist/index.mjs.map +1 -1
- package/dist/{package-DPHOlgjb.mjs → package-CVgGbwca.mjs} +2 -2
- package/dist/{package-DPHOlgjb.mjs.map → package-CVgGbwca.mjs.map} +1 -1
- package/package.json +14 -14
package/dist/index.mjs
CHANGED
|
@@ -136,7 +136,7 @@ function createFatalError$1(message, isJson, options) {
|
|
|
136
136
|
__name$6(createFatalError$1, "createFatalError");
|
|
137
137
|
|
|
138
138
|
//#endregion
|
|
139
|
-
//#region ../workers-utils/dist/chunk-
|
|
139
|
+
//#region ../workers-utils/dist/chunk-JTB7VJSC.mjs
|
|
140
140
|
function hasKnownExportType(entry) {
|
|
141
141
|
const type = entry?.type;
|
|
142
142
|
return type === "durable-object" || type === "worker";
|
|
@@ -163,7 +163,6 @@ function hasDurableObjectExports(exports$1) {
|
|
|
163
163
|
return Object.keys(getDurableObjectExports(exports$1)).length > 0;
|
|
164
164
|
}
|
|
165
165
|
__name$6(hasDurableObjectExports, "hasDurableObjectExports");
|
|
166
|
-
var CONTAINER_IMAGES_BINDING = "EXPERIMENTAL_CLOUDFLARE_CONTAINER_IMAGES";
|
|
167
166
|
function isDurableObjectContainerApp(container) {
|
|
168
167
|
return container.scheduling_policy === "durable_object";
|
|
169
168
|
}
|
|
@@ -2614,8 +2613,8 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
|
|
|
2614
2613
|
__name$6(formatConfigSnippet, "formatConfigSnippet");
|
|
2615
2614
|
|
|
2616
2615
|
//#endregion
|
|
2617
|
-
//#region ../workers-utils/dist/chunk-
|
|
2618
|
-
var DEFAULT_COMPAT_DATE = "2026-09-
|
|
2616
|
+
//#region ../workers-utils/dist/chunk-4PNP2TCS.mjs
|
|
2617
|
+
var DEFAULT_COMPAT_DATE = "2026-09-21";
|
|
2619
2618
|
function assertNever(_value) {}
|
|
2620
2619
|
__name$6(assertNever, "assertNever");
|
|
2621
2620
|
function mapWorkerMetadataBindings(bindings) {
|
|
@@ -26328,11 +26327,11 @@ var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
|
|
|
26328
26327
|
var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1, module$1) {
|
|
26329
26328
|
var exec$3 = __require$1("child_process").exec;
|
|
26330
26329
|
var execSync$2 = __require$1("child_process").execSync;
|
|
26331
|
-
var
|
|
26332
|
-
var
|
|
26333
|
-
var access$1 =
|
|
26334
|
-
var accessSync2 =
|
|
26335
|
-
var constants2 =
|
|
26330
|
+
var fs4 = __require$1("fs");
|
|
26331
|
+
var path6 = __require$1("path");
|
|
26332
|
+
var access$1 = fs4.access;
|
|
26333
|
+
var accessSync2 = fs4.accessSync;
|
|
26334
|
+
var constants2 = fs4.constants || fs4;
|
|
26336
26335
|
var isUsingWindows$1 = process.platform == "win32";
|
|
26337
26336
|
var fileNotExists$1 = /* @__PURE__ */ __name$6(function(commandName, callback$1) {
|
|
26338
26337
|
access$1(commandName, constants2.F_OK, function(err) {
|
|
@@ -26406,8 +26405,8 @@ var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-
|
|
|
26406
26405
|
}, "cleanInput");
|
|
26407
26406
|
if (isUsingWindows$1) cleanInput$1 = /* @__PURE__ */ __name$6(function(s) {
|
|
26408
26407
|
if (/[\\]/.test(s)) {
|
|
26409
|
-
var dirname4 = "\"" +
|
|
26410
|
-
var basename2 = "\"" +
|
|
26408
|
+
var dirname4 = "\"" + path6.dirname(s) + "\"";
|
|
26409
|
+
var basename2 = "\"" + path6.basename(s) + "\"";
|
|
26411
26410
|
return dirname4 + ":" + basename2;
|
|
26412
26411
|
}
|
|
26413
26412
|
return "\"" + s + "\"";
|
|
@@ -26628,9 +26627,9 @@ var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip
|
|
|
26628
26627
|
};
|
|
26629
26628
|
} });
|
|
26630
26629
|
var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1) {
|
|
26631
|
-
var
|
|
26630
|
+
var fs4 = __require$1("fs");
|
|
26632
26631
|
var ini = require_ini();
|
|
26633
|
-
var
|
|
26632
|
+
var path6 = __require$1("path");
|
|
26634
26633
|
var stripJsonComments = require_strip_json_comments();
|
|
26635
26634
|
var parse3$1 = exports$1.parse = function(content) {
|
|
26636
26635
|
if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
|
|
@@ -26641,9 +26640,9 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
|
|
|
26641
26640
|
return arg != null;
|
|
26642
26641
|
});
|
|
26643
26642
|
for (var i$1 in args) if ("string" !== typeof args[i$1]) return;
|
|
26644
|
-
var file3 =
|
|
26643
|
+
var file3 = path6.join.apply(null, args);
|
|
26645
26644
|
try {
|
|
26646
|
-
return
|
|
26645
|
+
return fs4.readFileSync(file3, "utf-8");
|
|
26647
26646
|
} catch (err) {
|
|
26648
26647
|
return;
|
|
26649
26648
|
}
|
|
@@ -26671,14 +26670,14 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
|
|
|
26671
26670
|
return obj;
|
|
26672
26671
|
};
|
|
26673
26672
|
exports$1.find = function() {
|
|
26674
|
-
var rel =
|
|
26673
|
+
var rel = path6.join.apply(null, [].slice.call(arguments));
|
|
26675
26674
|
function find2(start, rel2) {
|
|
26676
|
-
var file3 =
|
|
26675
|
+
var file3 = path6.join(start, rel2);
|
|
26677
26676
|
try {
|
|
26678
|
-
|
|
26677
|
+
fs4.statSync(file3);
|
|
26679
26678
|
return file3;
|
|
26680
26679
|
} catch (err) {
|
|
26681
|
-
if (
|
|
26680
|
+
if (path6.dirname(start) !== start) return find2(path6.dirname(start), rel2);
|
|
26682
26681
|
}
|
|
26683
26682
|
}
|
|
26684
26683
|
__name$6(find2, "find");
|
|
@@ -27068,8 +27067,8 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
|
|
|
27068
27067
|
};
|
|
27069
27068
|
}
|
|
27070
27069
|
__name$6(getLegacyAuthInfo, "getLegacyAuthInfo");
|
|
27071
|
-
function normalizePath$3(
|
|
27072
|
-
return
|
|
27070
|
+
function normalizePath$3(path6) {
|
|
27071
|
+
return path6[path6.length - 1] === "/" ? path6 : path6 + "/";
|
|
27073
27072
|
}
|
|
27074
27073
|
__name$6(normalizePath$3, "normalizePath");
|
|
27075
27074
|
function getAuthInfoForUrl(regUrl, npmrc) {
|
|
@@ -27106,24 +27105,24 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
|
|
|
27106
27105
|
var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1, module$1) {
|
|
27107
27106
|
var { URL: URL2 } = __require$1("url");
|
|
27108
27107
|
var { join: join3 } = __require$1("path");
|
|
27109
|
-
var
|
|
27108
|
+
var fs4 = __require$1("fs");
|
|
27110
27109
|
var { promisify: promisify$3 } = __require$1("util");
|
|
27111
27110
|
var { tmpdir } = __require$1("os");
|
|
27112
27111
|
var registryUrl = require_registry_url();
|
|
27113
|
-
var writeFile$1 = promisify$3(
|
|
27114
|
-
var mkdir$1 = promisify$3(
|
|
27115
|
-
var readFile$1 = promisify$3(
|
|
27112
|
+
var writeFile$1 = promisify$3(fs4.writeFile);
|
|
27113
|
+
var mkdir$1 = promisify$3(fs4.mkdir);
|
|
27114
|
+
var readFile$1 = promisify$3(fs4.readFile);
|
|
27116
27115
|
var compareVersions = /* @__PURE__ */ __name$6((a, b) => a.localeCompare(b, "en-US", { numeric: true }), "compareVersions");
|
|
27117
27116
|
var encode3 = /* @__PURE__ */ __name$6((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
|
|
27118
27117
|
var getFile = /* @__PURE__ */ __name$6(async (details, distTag) => {
|
|
27119
27118
|
const subDir = join3(tmpdir(), "update-check");
|
|
27120
|
-
if (!
|
|
27119
|
+
if (!fs4.existsSync(subDir)) await mkdir$1(subDir);
|
|
27121
27120
|
let name = `${details.name}-${distTag}.json`;
|
|
27122
27121
|
if (details.scope) name = `${details.scope}-${name}`;
|
|
27123
27122
|
return join3(subDir, name);
|
|
27124
27123
|
}, "getFile");
|
|
27125
27124
|
var evaluateCache = /* @__PURE__ */ __name$6(async (file2, time3, interval) => {
|
|
27126
|
-
if (
|
|
27125
|
+
if (fs4.existsSync(file2)) {
|
|
27127
27126
|
const content = await readFile$1(file2, "utf8");
|
|
27128
27127
|
const { lastUpdate, latest } = JSON.parse(content);
|
|
27129
27128
|
if (lastUpdate + interval > time3) return {
|
|
@@ -27225,6 +27224,700 @@ var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check
|
|
|
27225
27224
|
return null;
|
|
27226
27225
|
};
|
|
27227
27226
|
} });
|
|
27227
|
+
var require_path = __commonJS$1({ "../../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/lib/path.js"(exports$1, module$1) {
|
|
27228
|
+
module$1.exports = typeof process === "object" && process && process.platform === "win32" ? { sep: "\\" } : { sep: "/" };
|
|
27229
|
+
} });
|
|
27230
|
+
var require_balanced_match = __commonJS$1({ "../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports$1, module$1) {
|
|
27231
|
+
module$1.exports = balanced;
|
|
27232
|
+
function balanced(a, b, str) {
|
|
27233
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
27234
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
27235
|
+
var r2 = range(a, b, str);
|
|
27236
|
+
return r2 && {
|
|
27237
|
+
start: r2[0],
|
|
27238
|
+
end: r2[1],
|
|
27239
|
+
pre: str.slice(0, r2[0]),
|
|
27240
|
+
body: str.slice(r2[0] + a.length, r2[1]),
|
|
27241
|
+
post: str.slice(r2[1] + b.length)
|
|
27242
|
+
};
|
|
27243
|
+
}
|
|
27244
|
+
__name$6(balanced, "balanced");
|
|
27245
|
+
function maybeMatch(reg, str) {
|
|
27246
|
+
var m = str.match(reg);
|
|
27247
|
+
return m ? m[0] : null;
|
|
27248
|
+
}
|
|
27249
|
+
__name$6(maybeMatch, "maybeMatch");
|
|
27250
|
+
balanced.range = range;
|
|
27251
|
+
function range(a, b, str) {
|
|
27252
|
+
var begs, beg, left, right, result;
|
|
27253
|
+
var ai = str.indexOf(a);
|
|
27254
|
+
var bi = str.indexOf(b, ai + 1);
|
|
27255
|
+
var i$1 = ai;
|
|
27256
|
+
if (ai >= 0 && bi > 0) {
|
|
27257
|
+
if (a === b) return [ai, bi];
|
|
27258
|
+
begs = [];
|
|
27259
|
+
left = str.length;
|
|
27260
|
+
while (i$1 >= 0 && !result) {
|
|
27261
|
+
if (i$1 == ai) {
|
|
27262
|
+
begs.push(i$1);
|
|
27263
|
+
ai = str.indexOf(a, i$1 + 1);
|
|
27264
|
+
} else if (begs.length == 1) result = [begs.pop(), bi];
|
|
27265
|
+
else {
|
|
27266
|
+
beg = begs.pop();
|
|
27267
|
+
if (beg < left) {
|
|
27268
|
+
left = beg;
|
|
27269
|
+
right = bi;
|
|
27270
|
+
}
|
|
27271
|
+
bi = str.indexOf(b, i$1 + 1);
|
|
27272
|
+
}
|
|
27273
|
+
i$1 = ai < bi && ai >= 0 ? ai : bi;
|
|
27274
|
+
}
|
|
27275
|
+
if (begs.length) result = [left, right];
|
|
27276
|
+
}
|
|
27277
|
+
return result;
|
|
27278
|
+
}
|
|
27279
|
+
__name$6(range, "range");
|
|
27280
|
+
} });
|
|
27281
|
+
var require_brace_expansion = __commonJS$1({ "../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js"(exports$1, module$1) {
|
|
27282
|
+
var balanced = require_balanced_match();
|
|
27283
|
+
module$1.exports = expandTop;
|
|
27284
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
27285
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
27286
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
27287
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
27288
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
27289
|
+
function numeric$1(str) {
|
|
27290
|
+
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
27291
|
+
}
|
|
27292
|
+
__name$6(numeric$1, "numeric");
|
|
27293
|
+
function escapeBraces(str) {
|
|
27294
|
+
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
27295
|
+
}
|
|
27296
|
+
__name$6(escapeBraces, "escapeBraces");
|
|
27297
|
+
function unescapeBraces(str) {
|
|
27298
|
+
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
27299
|
+
}
|
|
27300
|
+
__name$6(unescapeBraces, "unescapeBraces");
|
|
27301
|
+
function parseCommaParts(str) {
|
|
27302
|
+
if (!str) return [""];
|
|
27303
|
+
var parts = [];
|
|
27304
|
+
var m = balanced("{", "}", str);
|
|
27305
|
+
if (!m) return str.split(",");
|
|
27306
|
+
var pre = m.pre;
|
|
27307
|
+
var body = m.body;
|
|
27308
|
+
var post = m.post;
|
|
27309
|
+
var p$2 = pre.split(",");
|
|
27310
|
+
p$2[p$2.length - 1] += "{" + body + "}";
|
|
27311
|
+
var postParts = parseCommaParts(post);
|
|
27312
|
+
if (post.length) {
|
|
27313
|
+
p$2[p$2.length - 1] += postParts.shift();
|
|
27314
|
+
p$2.push.apply(p$2, postParts);
|
|
27315
|
+
}
|
|
27316
|
+
parts.push.apply(parts, p$2);
|
|
27317
|
+
return parts;
|
|
27318
|
+
}
|
|
27319
|
+
__name$6(parseCommaParts, "parseCommaParts");
|
|
27320
|
+
function expandTop(str) {
|
|
27321
|
+
if (!str) return [];
|
|
27322
|
+
if (str.substr(0, 2) === "{}") str = "\\{\\}" + str.substr(2);
|
|
27323
|
+
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
27324
|
+
}
|
|
27325
|
+
__name$6(expandTop, "expandTop");
|
|
27326
|
+
function embrace(str) {
|
|
27327
|
+
return "{" + str + "}";
|
|
27328
|
+
}
|
|
27329
|
+
__name$6(embrace, "embrace");
|
|
27330
|
+
function isPadded(el) {
|
|
27331
|
+
return /^-?0\d/.test(el);
|
|
27332
|
+
}
|
|
27333
|
+
__name$6(isPadded, "isPadded");
|
|
27334
|
+
function lte$4(i$1, y) {
|
|
27335
|
+
return i$1 <= y;
|
|
27336
|
+
}
|
|
27337
|
+
__name$6(lte$4, "lte");
|
|
27338
|
+
function gte$4(i$1, y) {
|
|
27339
|
+
return i$1 >= y;
|
|
27340
|
+
}
|
|
27341
|
+
__name$6(gte$4, "gte");
|
|
27342
|
+
function expand(str, isTop) {
|
|
27343
|
+
var expansions = [];
|
|
27344
|
+
var m = balanced("{", "}", str);
|
|
27345
|
+
if (!m) return [str];
|
|
27346
|
+
var pre = m.pre;
|
|
27347
|
+
var post = m.post.length ? expand(m.post, false) : [""];
|
|
27348
|
+
if (/\$$/.test(m.pre)) for (var k = 0; k < post.length; k++) {
|
|
27349
|
+
var expansion = pre + "{" + m.body + "}" + post[k];
|
|
27350
|
+
expansions.push(expansion);
|
|
27351
|
+
}
|
|
27352
|
+
else {
|
|
27353
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
27354
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
27355
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
27356
|
+
var isOptions = m.body.indexOf(",") >= 0;
|
|
27357
|
+
if (!isSequence && !isOptions) {
|
|
27358
|
+
if (m.post.match(/,.*\}/)) {
|
|
27359
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
27360
|
+
return expand(str);
|
|
27361
|
+
}
|
|
27362
|
+
return [str];
|
|
27363
|
+
}
|
|
27364
|
+
var n2;
|
|
27365
|
+
if (isSequence) n2 = m.body.split(/\.\./);
|
|
27366
|
+
else {
|
|
27367
|
+
n2 = parseCommaParts(m.body);
|
|
27368
|
+
if (n2.length === 1) {
|
|
27369
|
+
n2 = expand(n2[0], false).map(embrace);
|
|
27370
|
+
if (n2.length === 1) return post.map(function(p$2) {
|
|
27371
|
+
return m.pre + n2[0] + p$2;
|
|
27372
|
+
});
|
|
27373
|
+
}
|
|
27374
|
+
}
|
|
27375
|
+
var N;
|
|
27376
|
+
if (isSequence) {
|
|
27377
|
+
var x = numeric$1(n2[0]);
|
|
27378
|
+
var y = numeric$1(n2[1]);
|
|
27379
|
+
var width = Math.max(n2[0].length, n2[1].length);
|
|
27380
|
+
var incr = n2.length == 3 ? Math.abs(numeric$1(n2[2])) : 1;
|
|
27381
|
+
var test = lte$4;
|
|
27382
|
+
if (y < x) {
|
|
27383
|
+
incr *= -1;
|
|
27384
|
+
test = gte$4;
|
|
27385
|
+
}
|
|
27386
|
+
var pad = n2.some(isPadded);
|
|
27387
|
+
N = [];
|
|
27388
|
+
for (var i$1 = x; test(i$1, y); i$1 += incr) {
|
|
27389
|
+
var c$1;
|
|
27390
|
+
if (isAlphaSequence) {
|
|
27391
|
+
c$1 = String.fromCharCode(i$1);
|
|
27392
|
+
if (c$1 === "\\") c$1 = "";
|
|
27393
|
+
} else {
|
|
27394
|
+
c$1 = String(i$1);
|
|
27395
|
+
if (pad) {
|
|
27396
|
+
var need = width - c$1.length;
|
|
27397
|
+
if (need > 0) {
|
|
27398
|
+
var z2 = new Array(need + 1).join("0");
|
|
27399
|
+
if (i$1 < 0) c$1 = "-" + z2 + c$1.slice(1);
|
|
27400
|
+
else c$1 = z2 + c$1;
|
|
27401
|
+
}
|
|
27402
|
+
}
|
|
27403
|
+
}
|
|
27404
|
+
N.push(c$1);
|
|
27405
|
+
}
|
|
27406
|
+
} else {
|
|
27407
|
+
N = [];
|
|
27408
|
+
for (var j$1 = 0; j$1 < n2.length; j$1++) N.push.apply(N, expand(n2[j$1], false));
|
|
27409
|
+
}
|
|
27410
|
+
for (var j$1 = 0; j$1 < N.length; j$1++) for (var k = 0; k < post.length; k++) {
|
|
27411
|
+
var expansion = pre + N[j$1] + post[k];
|
|
27412
|
+
if (!isTop || isSequence || expansion) expansions.push(expansion);
|
|
27413
|
+
}
|
|
27414
|
+
}
|
|
27415
|
+
return expansions;
|
|
27416
|
+
}
|
|
27417
|
+
__name$6(expand, "expand");
|
|
27418
|
+
} });
|
|
27419
|
+
var require_minimatch = __commonJS$1({ "../../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/minimatch.js"(exports$1, module$1) {
|
|
27420
|
+
var minimatch = module$1.exports = (p$2, pattern, options = {}) => {
|
|
27421
|
+
assertValidPattern(pattern);
|
|
27422
|
+
if (!options.nocomment && pattern.charAt(0) === "#") return false;
|
|
27423
|
+
return new Minimatch2(pattern, options).match(p$2);
|
|
27424
|
+
};
|
|
27425
|
+
module$1.exports = minimatch;
|
|
27426
|
+
var path6 = require_path();
|
|
27427
|
+
minimatch.sep = path6.sep;
|
|
27428
|
+
var GLOBSTAR = Symbol("globstar **");
|
|
27429
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
27430
|
+
var expand = require_brace_expansion();
|
|
27431
|
+
var plTypes = {
|
|
27432
|
+
"!": {
|
|
27433
|
+
open: "(?:(?!(?:",
|
|
27434
|
+
close: "))[^/]*?)"
|
|
27435
|
+
},
|
|
27436
|
+
"?": {
|
|
27437
|
+
open: "(?:",
|
|
27438
|
+
close: ")?"
|
|
27439
|
+
},
|
|
27440
|
+
"+": {
|
|
27441
|
+
open: "(?:",
|
|
27442
|
+
close: ")+"
|
|
27443
|
+
},
|
|
27444
|
+
"*": {
|
|
27445
|
+
open: "(?:",
|
|
27446
|
+
close: ")*"
|
|
27447
|
+
},
|
|
27448
|
+
"@": {
|
|
27449
|
+
open: "(?:",
|
|
27450
|
+
close: ")"
|
|
27451
|
+
}
|
|
27452
|
+
};
|
|
27453
|
+
var qmark = "[^/]";
|
|
27454
|
+
var star = qmark + "*?";
|
|
27455
|
+
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
27456
|
+
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
27457
|
+
var charSet = /* @__PURE__ */ __name$6((s) => s.split("").reduce((set2, c$1) => {
|
|
27458
|
+
set2[c$1] = true;
|
|
27459
|
+
return set2;
|
|
27460
|
+
}, {}), "charSet");
|
|
27461
|
+
var reSpecials = charSet("().*{}+?[]^$\\!");
|
|
27462
|
+
var addPatternStartSet = charSet("[.(");
|
|
27463
|
+
var slashSplit = /\/+/;
|
|
27464
|
+
minimatch.filter = (pattern, options = {}) => (p$2, i$1, list$1) => minimatch(p$2, pattern, options);
|
|
27465
|
+
var ext = /* @__PURE__ */ __name$6((a, b = {}) => {
|
|
27466
|
+
const t2 = {};
|
|
27467
|
+
Object.keys(a).forEach((k) => t2[k] = a[k]);
|
|
27468
|
+
Object.keys(b).forEach((k) => t2[k] = b[k]);
|
|
27469
|
+
return t2;
|
|
27470
|
+
}, "ext");
|
|
27471
|
+
minimatch.defaults = (def) => {
|
|
27472
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) return minimatch;
|
|
27473
|
+
const orig = minimatch;
|
|
27474
|
+
const m = /* @__PURE__ */ __name$6((p$2, pattern, options) => orig(p$2, pattern, ext(def, options)), "m");
|
|
27475
|
+
m.Minimatch = class Minimatch extends orig.Minimatch {
|
|
27476
|
+
static {
|
|
27477
|
+
__name$6(this, "Minimatch");
|
|
27478
|
+
}
|
|
27479
|
+
constructor(pattern, options) {
|
|
27480
|
+
super(pattern, ext(def, options));
|
|
27481
|
+
}
|
|
27482
|
+
};
|
|
27483
|
+
m.Minimatch.defaults = (options) => orig.defaults(ext(def, options)).Minimatch;
|
|
27484
|
+
m.filter = (pattern, options) => orig.filter(pattern, ext(def, options));
|
|
27485
|
+
m.defaults = (options) => orig.defaults(ext(def, options));
|
|
27486
|
+
m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options));
|
|
27487
|
+
m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options));
|
|
27488
|
+
m.match = (list$1, pattern, options) => orig.match(list$1, pattern, ext(def, options));
|
|
27489
|
+
return m;
|
|
27490
|
+
};
|
|
27491
|
+
minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options);
|
|
27492
|
+
var braceExpand = /* @__PURE__ */ __name$6((pattern, options = {}) => {
|
|
27493
|
+
assertValidPattern(pattern);
|
|
27494
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [pattern];
|
|
27495
|
+
return expand(pattern);
|
|
27496
|
+
}, "braceExpand");
|
|
27497
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
27498
|
+
var assertValidPattern = /* @__PURE__ */ __name$6((pattern) => {
|
|
27499
|
+
if (typeof pattern !== "string") throw new TypeError("invalid pattern");
|
|
27500
|
+
if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
|
|
27501
|
+
}, "assertValidPattern");
|
|
27502
|
+
var SUBPARSE = Symbol("subparse");
|
|
27503
|
+
minimatch.makeRe = (pattern, options) => new Minimatch2(pattern, options || {}).makeRe();
|
|
27504
|
+
minimatch.match = (list$1, pattern, options = {}) => {
|
|
27505
|
+
const mm = new Minimatch2(pattern, options);
|
|
27506
|
+
list$1 = list$1.filter((f) => mm.match(f));
|
|
27507
|
+
if (mm.options.nonull && !list$1.length) list$1.push(pattern);
|
|
27508
|
+
return list$1;
|
|
27509
|
+
};
|
|
27510
|
+
var globUnescape = /* @__PURE__ */ __name$6((s) => s.replace(/\\(.)/g, "$1"), "globUnescape");
|
|
27511
|
+
var charUnescape = /* @__PURE__ */ __name$6((s) => s.replace(/\\([^-\]])/g, "$1"), "charUnescape");
|
|
27512
|
+
var regExpEscape = /* @__PURE__ */ __name$6((s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "regExpEscape");
|
|
27513
|
+
var braExpEscape = /* @__PURE__ */ __name$6((s) => s.replace(/[[\]\\]/g, "\\$&"), "braExpEscape");
|
|
27514
|
+
var Minimatch2 = class {
|
|
27515
|
+
static {
|
|
27516
|
+
__name$6(this, "Minimatch");
|
|
27517
|
+
}
|
|
27518
|
+
constructor(pattern, options) {
|
|
27519
|
+
assertValidPattern(pattern);
|
|
27520
|
+
if (!options) options = {};
|
|
27521
|
+
this.options = options;
|
|
27522
|
+
this.set = [];
|
|
27523
|
+
this.pattern = pattern;
|
|
27524
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
27525
|
+
if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
|
|
27526
|
+
this.regexp = null;
|
|
27527
|
+
this.negate = false;
|
|
27528
|
+
this.comment = false;
|
|
27529
|
+
this.empty = false;
|
|
27530
|
+
this.partial = !!options.partial;
|
|
27531
|
+
this.make();
|
|
27532
|
+
}
|
|
27533
|
+
debug() {}
|
|
27534
|
+
make() {
|
|
27535
|
+
const pattern = this.pattern;
|
|
27536
|
+
const options = this.options;
|
|
27537
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
27538
|
+
this.comment = true;
|
|
27539
|
+
return;
|
|
27540
|
+
}
|
|
27541
|
+
if (!pattern) {
|
|
27542
|
+
this.empty = true;
|
|
27543
|
+
return;
|
|
27544
|
+
}
|
|
27545
|
+
this.parseNegate();
|
|
27546
|
+
let set2 = this.globSet = this.braceExpand();
|
|
27547
|
+
if (options.debug) this.debug = (...args) => console.error(...args);
|
|
27548
|
+
this.debug(this.pattern, set2);
|
|
27549
|
+
set2 = this.globParts = set2.map((s) => s.split(slashSplit));
|
|
27550
|
+
this.debug(this.pattern, set2);
|
|
27551
|
+
set2 = set2.map((s, si, set3) => s.map(this.parse, this));
|
|
27552
|
+
this.debug(this.pattern, set2);
|
|
27553
|
+
set2 = set2.filter((s) => s.indexOf(false) === -1);
|
|
27554
|
+
this.debug(this.pattern, set2);
|
|
27555
|
+
this.set = set2;
|
|
27556
|
+
}
|
|
27557
|
+
parseNegate() {
|
|
27558
|
+
if (this.options.nonegate) return;
|
|
27559
|
+
const pattern = this.pattern;
|
|
27560
|
+
let negate = false;
|
|
27561
|
+
let negateOffset = 0;
|
|
27562
|
+
for (let i$1 = 0; i$1 < pattern.length && pattern.charAt(i$1) === "!"; i$1++) {
|
|
27563
|
+
negate = !negate;
|
|
27564
|
+
negateOffset++;
|
|
27565
|
+
}
|
|
27566
|
+
if (negateOffset) this.pattern = pattern.slice(negateOffset);
|
|
27567
|
+
this.negate = negate;
|
|
27568
|
+
}
|
|
27569
|
+
matchOne(file2, pattern, partial2) {
|
|
27570
|
+
var options = this.options;
|
|
27571
|
+
this.debug("matchOne", {
|
|
27572
|
+
"this": this,
|
|
27573
|
+
file: file2,
|
|
27574
|
+
pattern
|
|
27575
|
+
});
|
|
27576
|
+
this.debug("matchOne", file2.length, pattern.length);
|
|
27577
|
+
for (var fi = 0, pi = 0, fl = file2.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
27578
|
+
this.debug("matchOne loop");
|
|
27579
|
+
var p$2 = pattern[pi];
|
|
27580
|
+
var f = file2[fi];
|
|
27581
|
+
this.debug(pattern, p$2, f);
|
|
27582
|
+
if (p$2 === false) return false;
|
|
27583
|
+
if (p$2 === GLOBSTAR) {
|
|
27584
|
+
this.debug("GLOBSTAR", [
|
|
27585
|
+
pattern,
|
|
27586
|
+
p$2,
|
|
27587
|
+
f
|
|
27588
|
+
]);
|
|
27589
|
+
var fr = fi;
|
|
27590
|
+
var pr = pi + 1;
|
|
27591
|
+
if (pr === pl) {
|
|
27592
|
+
this.debug("** at the end");
|
|
27593
|
+
for (; fi < fl; fi++) if (file2[fi] === "." || file2[fi] === ".." || !options.dot && file2[fi].charAt(0) === ".") return false;
|
|
27594
|
+
return true;
|
|
27595
|
+
}
|
|
27596
|
+
while (fr < fl) {
|
|
27597
|
+
var swallowee = file2[fr];
|
|
27598
|
+
this.debug("\nglobstar while", file2, fr, pattern, pr, swallowee);
|
|
27599
|
+
if (this.matchOne(file2.slice(fr), pattern.slice(pr), partial2)) {
|
|
27600
|
+
this.debug("globstar found match!", fr, fl, swallowee);
|
|
27601
|
+
return true;
|
|
27602
|
+
} else {
|
|
27603
|
+
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
27604
|
+
this.debug("dot detected!", file2, fr, pattern, pr);
|
|
27605
|
+
break;
|
|
27606
|
+
}
|
|
27607
|
+
this.debug("globstar swallow a segment, and continue");
|
|
27608
|
+
fr++;
|
|
27609
|
+
}
|
|
27610
|
+
}
|
|
27611
|
+
if (partial2) {
|
|
27612
|
+
this.debug("\n>>> no match, partial?", file2, fr, pattern, pr);
|
|
27613
|
+
if (fr === fl) return true;
|
|
27614
|
+
}
|
|
27615
|
+
return false;
|
|
27616
|
+
}
|
|
27617
|
+
var hit;
|
|
27618
|
+
if (typeof p$2 === "string") {
|
|
27619
|
+
hit = f === p$2;
|
|
27620
|
+
this.debug("string match", p$2, f, hit);
|
|
27621
|
+
} else {
|
|
27622
|
+
hit = f.match(p$2);
|
|
27623
|
+
this.debug("pattern match", p$2, f, hit);
|
|
27624
|
+
}
|
|
27625
|
+
if (!hit) return false;
|
|
27626
|
+
}
|
|
27627
|
+
if (fi === fl && pi === pl) return true;
|
|
27628
|
+
else if (fi === fl) return partial2;
|
|
27629
|
+
else if (pi === pl) return fi === fl - 1 && file2[fi] === "";
|
|
27630
|
+
throw new Error("wtf?");
|
|
27631
|
+
}
|
|
27632
|
+
braceExpand() {
|
|
27633
|
+
return braceExpand(this.pattern, this.options);
|
|
27634
|
+
}
|
|
27635
|
+
parse(pattern, isSub) {
|
|
27636
|
+
assertValidPattern(pattern);
|
|
27637
|
+
const options = this.options;
|
|
27638
|
+
if (pattern === "**") if (!options.noglobstar) return GLOBSTAR;
|
|
27639
|
+
else pattern = "*";
|
|
27640
|
+
if (pattern === "") return "";
|
|
27641
|
+
let re$5 = "";
|
|
27642
|
+
let hasMagic = false;
|
|
27643
|
+
let escaping = false;
|
|
27644
|
+
const patternListStack = [];
|
|
27645
|
+
const negativeLists = [];
|
|
27646
|
+
let stateChar;
|
|
27647
|
+
let inClass = false;
|
|
27648
|
+
let reClassStart = -1;
|
|
27649
|
+
let classStart = -1;
|
|
27650
|
+
let cs;
|
|
27651
|
+
let pl;
|
|
27652
|
+
let sp;
|
|
27653
|
+
let dotTravAllowed = pattern.charAt(0) === ".";
|
|
27654
|
+
let dotFileAllowed = options.dot || dotTravAllowed;
|
|
27655
|
+
const patternStart = /* @__PURE__ */ __name$6(() => dotTravAllowed ? "" : dotFileAllowed ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)", "patternStart");
|
|
27656
|
+
const subPatternStart = /* @__PURE__ */ __name$6((p$2) => p$2.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)", "subPatternStart");
|
|
27657
|
+
const clearStateChar = /* @__PURE__ */ __name$6(() => {
|
|
27658
|
+
if (stateChar) {
|
|
27659
|
+
switch (stateChar) {
|
|
27660
|
+
case "*":
|
|
27661
|
+
re$5 += star;
|
|
27662
|
+
hasMagic = true;
|
|
27663
|
+
break;
|
|
27664
|
+
case "?":
|
|
27665
|
+
re$5 += qmark;
|
|
27666
|
+
hasMagic = true;
|
|
27667
|
+
break;
|
|
27668
|
+
default:
|
|
27669
|
+
re$5 += "\\" + stateChar;
|
|
27670
|
+
break;
|
|
27671
|
+
}
|
|
27672
|
+
this.debug("clearStateChar %j %j", stateChar, re$5);
|
|
27673
|
+
stateChar = false;
|
|
27674
|
+
}
|
|
27675
|
+
}, "clearStateChar");
|
|
27676
|
+
for (let i$1 = 0, c$1; i$1 < pattern.length && (c$1 = pattern.charAt(i$1)); i$1++) {
|
|
27677
|
+
this.debug("%s %s %s %j", pattern, i$1, re$5, c$1);
|
|
27678
|
+
if (escaping) {
|
|
27679
|
+
if (c$1 === "/") return false;
|
|
27680
|
+
if (reSpecials[c$1]) re$5 += "\\";
|
|
27681
|
+
re$5 += c$1;
|
|
27682
|
+
escaping = false;
|
|
27683
|
+
continue;
|
|
27684
|
+
}
|
|
27685
|
+
switch (c$1) {
|
|
27686
|
+
case "/": return false;
|
|
27687
|
+
case "\\":
|
|
27688
|
+
if (inClass && pattern.charAt(i$1 + 1) === "-") {
|
|
27689
|
+
re$5 += c$1;
|
|
27690
|
+
continue;
|
|
27691
|
+
}
|
|
27692
|
+
clearStateChar();
|
|
27693
|
+
escaping = true;
|
|
27694
|
+
continue;
|
|
27695
|
+
case "?":
|
|
27696
|
+
case "*":
|
|
27697
|
+
case "+":
|
|
27698
|
+
case "@":
|
|
27699
|
+
case "!":
|
|
27700
|
+
this.debug("%s %s %s %j <-- stateChar", pattern, i$1, re$5, c$1);
|
|
27701
|
+
if (inClass) {
|
|
27702
|
+
this.debug(" in class");
|
|
27703
|
+
if (c$1 === "!" && i$1 === classStart + 1) c$1 = "^";
|
|
27704
|
+
re$5 += c$1;
|
|
27705
|
+
continue;
|
|
27706
|
+
}
|
|
27707
|
+
this.debug("call clearStateChar %j", stateChar);
|
|
27708
|
+
clearStateChar();
|
|
27709
|
+
stateChar = c$1;
|
|
27710
|
+
if (options.noext) clearStateChar();
|
|
27711
|
+
continue;
|
|
27712
|
+
case "(": {
|
|
27713
|
+
if (inClass) {
|
|
27714
|
+
re$5 += "(";
|
|
27715
|
+
continue;
|
|
27716
|
+
}
|
|
27717
|
+
if (!stateChar) {
|
|
27718
|
+
re$5 += "\\(";
|
|
27719
|
+
continue;
|
|
27720
|
+
}
|
|
27721
|
+
const plEntry = {
|
|
27722
|
+
type: stateChar,
|
|
27723
|
+
start: i$1 - 1,
|
|
27724
|
+
reStart: re$5.length,
|
|
27725
|
+
open: plTypes[stateChar].open,
|
|
27726
|
+
close: plTypes[stateChar].close
|
|
27727
|
+
};
|
|
27728
|
+
this.debug(this.pattern, " ", plEntry);
|
|
27729
|
+
patternListStack.push(plEntry);
|
|
27730
|
+
re$5 += plEntry.open;
|
|
27731
|
+
if (plEntry.start === 0 && plEntry.type !== "!") {
|
|
27732
|
+
dotTravAllowed = true;
|
|
27733
|
+
re$5 += subPatternStart(pattern.slice(i$1 + 1));
|
|
27734
|
+
}
|
|
27735
|
+
this.debug("plType %j %j", stateChar, re$5);
|
|
27736
|
+
stateChar = false;
|
|
27737
|
+
continue;
|
|
27738
|
+
}
|
|
27739
|
+
case ")": {
|
|
27740
|
+
const plEntry = patternListStack[patternListStack.length - 1];
|
|
27741
|
+
if (inClass || !plEntry) {
|
|
27742
|
+
re$5 += "\\)";
|
|
27743
|
+
continue;
|
|
27744
|
+
}
|
|
27745
|
+
patternListStack.pop();
|
|
27746
|
+
clearStateChar();
|
|
27747
|
+
hasMagic = true;
|
|
27748
|
+
pl = plEntry;
|
|
27749
|
+
re$5 += pl.close;
|
|
27750
|
+
if (pl.type === "!") negativeLists.push(Object.assign(pl, { reEnd: re$5.length }));
|
|
27751
|
+
continue;
|
|
27752
|
+
}
|
|
27753
|
+
case "|": {
|
|
27754
|
+
const plEntry = patternListStack[patternListStack.length - 1];
|
|
27755
|
+
if (inClass || !plEntry) {
|
|
27756
|
+
re$5 += "\\|";
|
|
27757
|
+
continue;
|
|
27758
|
+
}
|
|
27759
|
+
clearStateChar();
|
|
27760
|
+
re$5 += "|";
|
|
27761
|
+
if (plEntry.start === 0 && plEntry.type !== "!") {
|
|
27762
|
+
dotTravAllowed = true;
|
|
27763
|
+
re$5 += subPatternStart(pattern.slice(i$1 + 1));
|
|
27764
|
+
}
|
|
27765
|
+
continue;
|
|
27766
|
+
}
|
|
27767
|
+
case "[":
|
|
27768
|
+
clearStateChar();
|
|
27769
|
+
if (inClass) {
|
|
27770
|
+
re$5 += "\\" + c$1;
|
|
27771
|
+
continue;
|
|
27772
|
+
}
|
|
27773
|
+
inClass = true;
|
|
27774
|
+
classStart = i$1;
|
|
27775
|
+
reClassStart = re$5.length;
|
|
27776
|
+
re$5 += c$1;
|
|
27777
|
+
continue;
|
|
27778
|
+
case "]":
|
|
27779
|
+
if (i$1 === classStart + 1 || !inClass) {
|
|
27780
|
+
re$5 += "\\" + c$1;
|
|
27781
|
+
continue;
|
|
27782
|
+
}
|
|
27783
|
+
cs = pattern.substring(classStart + 1, i$1);
|
|
27784
|
+
try {
|
|
27785
|
+
RegExp("[" + braExpEscape(charUnescape(cs)) + "]");
|
|
27786
|
+
re$5 += c$1;
|
|
27787
|
+
} catch (er) {
|
|
27788
|
+
re$5 = re$5.substring(0, reClassStart) + "(?:$.)";
|
|
27789
|
+
}
|
|
27790
|
+
hasMagic = true;
|
|
27791
|
+
inClass = false;
|
|
27792
|
+
continue;
|
|
27793
|
+
default:
|
|
27794
|
+
clearStateChar();
|
|
27795
|
+
if (reSpecials[c$1] && !(c$1 === "^" && inClass)) re$5 += "\\";
|
|
27796
|
+
re$5 += c$1;
|
|
27797
|
+
break;
|
|
27798
|
+
}
|
|
27799
|
+
}
|
|
27800
|
+
if (inClass) {
|
|
27801
|
+
cs = pattern.slice(classStart + 1);
|
|
27802
|
+
sp = this.parse(cs, SUBPARSE);
|
|
27803
|
+
re$5 = re$5.substring(0, reClassStart) + "\\[" + sp[0];
|
|
27804
|
+
hasMagic = hasMagic || sp[1];
|
|
27805
|
+
}
|
|
27806
|
+
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
27807
|
+
let tail$1;
|
|
27808
|
+
tail$1 = re$5.slice(pl.reStart + pl.open.length);
|
|
27809
|
+
this.debug("setting tail", re$5, pl);
|
|
27810
|
+
tail$1 = tail$1.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
|
|
27811
|
+
if (!$2) $2 = "\\";
|
|
27812
|
+
return $1 + $1 + $2 + "|";
|
|
27813
|
+
});
|
|
27814
|
+
this.debug("tail=%j\n %s", tail$1, tail$1, pl, re$5);
|
|
27815
|
+
const t2 = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
|
|
27816
|
+
hasMagic = true;
|
|
27817
|
+
re$5 = re$5.slice(0, pl.reStart) + t2 + "\\(" + tail$1;
|
|
27818
|
+
}
|
|
27819
|
+
clearStateChar();
|
|
27820
|
+
if (escaping) re$5 += "\\\\";
|
|
27821
|
+
const addPatternStart = addPatternStartSet[re$5.charAt(0)];
|
|
27822
|
+
for (let n2 = negativeLists.length - 1; n2 > -1; n2--) {
|
|
27823
|
+
const nl = negativeLists[n2];
|
|
27824
|
+
const nlBefore = re$5.slice(0, nl.reStart);
|
|
27825
|
+
const nlFirst = re$5.slice(nl.reStart, nl.reEnd - 8);
|
|
27826
|
+
let nlAfter = re$5.slice(nl.reEnd);
|
|
27827
|
+
const nlLast = re$5.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
|
|
27828
|
+
const closeParensBefore = nlBefore.split(")").length;
|
|
27829
|
+
const openParensBefore = nlBefore.split("(").length - closeParensBefore;
|
|
27830
|
+
let cleanAfter = nlAfter;
|
|
27831
|
+
for (let i$1 = 0; i$1 < openParensBefore; i$1++) cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
|
|
27832
|
+
nlAfter = cleanAfter;
|
|
27833
|
+
const dollar = nlAfter === "" && isSub !== SUBPARSE ? "(?:$|\\/)" : "";
|
|
27834
|
+
re$5 = nlBefore + nlFirst + nlAfter + dollar + nlLast;
|
|
27835
|
+
}
|
|
27836
|
+
if (re$5 !== "" && hasMagic) re$5 = "(?=.)" + re$5;
|
|
27837
|
+
if (addPatternStart) re$5 = patternStart() + re$5;
|
|
27838
|
+
if (isSub === SUBPARSE) return [re$5, hasMagic];
|
|
27839
|
+
if (options.nocase && !hasMagic) hasMagic = pattern.toUpperCase() !== pattern.toLowerCase();
|
|
27840
|
+
if (!hasMagic) return globUnescape(pattern);
|
|
27841
|
+
const flags = options.nocase ? "i" : "";
|
|
27842
|
+
try {
|
|
27843
|
+
return Object.assign(new RegExp("^" + re$5 + "$", flags), {
|
|
27844
|
+
_glob: pattern,
|
|
27845
|
+
_src: re$5
|
|
27846
|
+
});
|
|
27847
|
+
} catch (er) {
|
|
27848
|
+
return /* @__PURE__ */ new RegExp("$.");
|
|
27849
|
+
}
|
|
27850
|
+
}
|
|
27851
|
+
makeRe() {
|
|
27852
|
+
if (this.regexp || this.regexp === false) return this.regexp;
|
|
27853
|
+
const set2 = this.set;
|
|
27854
|
+
if (!set2.length) {
|
|
27855
|
+
this.regexp = false;
|
|
27856
|
+
return this.regexp;
|
|
27857
|
+
}
|
|
27858
|
+
const options = this.options;
|
|
27859
|
+
const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
|
|
27860
|
+
const flags = options.nocase ? "i" : "";
|
|
27861
|
+
let re$5 = set2.map((pattern) => {
|
|
27862
|
+
pattern = pattern.map((p$2) => typeof p$2 === "string" ? regExpEscape(p$2) : p$2 === GLOBSTAR ? GLOBSTAR : p$2._src).reduce((set3, p$2) => {
|
|
27863
|
+
if (!(set3[set3.length - 1] === GLOBSTAR && p$2 === GLOBSTAR)) set3.push(p$2);
|
|
27864
|
+
return set3;
|
|
27865
|
+
}, []);
|
|
27866
|
+
pattern.forEach((p$2, i$1) => {
|
|
27867
|
+
if (p$2 !== GLOBSTAR || pattern[i$1 - 1] === GLOBSTAR) return;
|
|
27868
|
+
if (i$1 === 0) if (pattern.length > 1) pattern[i$1 + 1] = "(?:\\/|" + twoStar + "\\/)?" + pattern[i$1 + 1];
|
|
27869
|
+
else pattern[i$1] = twoStar;
|
|
27870
|
+
else if (i$1 === pattern.length - 1) pattern[i$1 - 1] += "(?:\\/|" + twoStar + ")?";
|
|
27871
|
+
else {
|
|
27872
|
+
pattern[i$1 - 1] += "(?:\\/|\\/" + twoStar + "\\/)" + pattern[i$1 + 1];
|
|
27873
|
+
pattern[i$1 + 1] = GLOBSTAR;
|
|
27874
|
+
}
|
|
27875
|
+
});
|
|
27876
|
+
return pattern.filter((p$2) => p$2 !== GLOBSTAR).join("/");
|
|
27877
|
+
}).join("|");
|
|
27878
|
+
re$5 = "^(?:" + re$5 + ")$";
|
|
27879
|
+
if (this.negate) re$5 = "^(?!" + re$5 + ").*$";
|
|
27880
|
+
try {
|
|
27881
|
+
this.regexp = new RegExp(re$5, flags);
|
|
27882
|
+
} catch (ex) {
|
|
27883
|
+
this.regexp = false;
|
|
27884
|
+
}
|
|
27885
|
+
return this.regexp;
|
|
27886
|
+
}
|
|
27887
|
+
match(f, partial2 = this.partial) {
|
|
27888
|
+
this.debug("match", f, this.pattern);
|
|
27889
|
+
if (this.comment) return false;
|
|
27890
|
+
if (this.empty) return f === "";
|
|
27891
|
+
if (f === "/" && partial2) return true;
|
|
27892
|
+
const options = this.options;
|
|
27893
|
+
if (path6.sep !== "/") f = f.split(path6.sep).join("/");
|
|
27894
|
+
f = f.split(slashSplit);
|
|
27895
|
+
this.debug(this.pattern, "split", f);
|
|
27896
|
+
const set2 = this.set;
|
|
27897
|
+
this.debug(this.pattern, "set", set2);
|
|
27898
|
+
let filename;
|
|
27899
|
+
for (let i$1 = f.length - 1; i$1 >= 0; i$1--) {
|
|
27900
|
+
filename = f[i$1];
|
|
27901
|
+
if (filename) break;
|
|
27902
|
+
}
|
|
27903
|
+
for (let i$1 = 0; i$1 < set2.length; i$1++) {
|
|
27904
|
+
const pattern = set2[i$1];
|
|
27905
|
+
let file2 = f;
|
|
27906
|
+
if (options.matchBase && pattern.length === 1) file2 = [filename];
|
|
27907
|
+
if (this.matchOne(file2, pattern, partial2)) {
|
|
27908
|
+
if (options.flipNegate) return true;
|
|
27909
|
+
return !this.negate;
|
|
27910
|
+
}
|
|
27911
|
+
}
|
|
27912
|
+
if (options.flipNegate) return false;
|
|
27913
|
+
return this.negate;
|
|
27914
|
+
}
|
|
27915
|
+
static defaults(def) {
|
|
27916
|
+
return minimatch.defaults(def).Minimatch;
|
|
27917
|
+
}
|
|
27918
|
+
};
|
|
27919
|
+
minimatch.Minimatch = Minimatch2;
|
|
27920
|
+
} });
|
|
27228
27921
|
var ARTIFACTS_EVENT_TYPES = [
|
|
27229
27922
|
"cf.artifacts.repo.created",
|
|
27230
27923
|
"cf.artifacts.repo.deleted",
|
|
@@ -28113,9 +28806,9 @@ function cloneDef(schema) {
|
|
|
28113
28806
|
return mergeDefs$1(schema._zod.def);
|
|
28114
28807
|
}
|
|
28115
28808
|
__name$6(cloneDef, "cloneDef");
|
|
28116
|
-
function getElementAtPath(obj,
|
|
28117
|
-
if (!
|
|
28118
|
-
return
|
|
28809
|
+
function getElementAtPath(obj, path6) {
|
|
28810
|
+
if (!path6) return obj;
|
|
28811
|
+
return path6.reduce((acc, key) => acc?.[key], obj);
|
|
28119
28812
|
}
|
|
28120
28813
|
__name$6(getElementAtPath, "getElementAtPath");
|
|
28121
28814
|
function promiseAllObject(promisesObj) {
|
|
@@ -28445,11 +29138,11 @@ function explicitlyAborted$1(x, startIndex = 0) {
|
|
|
28445
29138
|
return false;
|
|
28446
29139
|
}
|
|
28447
29140
|
__name$6(explicitlyAborted$1, "explicitlyAborted");
|
|
28448
|
-
function prefixIssues$2(
|
|
29141
|
+
function prefixIssues$2(path6, issues) {
|
|
28449
29142
|
return issues.map((iss) => {
|
|
28450
29143
|
var _a3;
|
|
28451
29144
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
28452
|
-
iss.path.unshift(
|
|
29145
|
+
iss.path.unshift(path6);
|
|
28453
29146
|
return iss;
|
|
28454
29147
|
});
|
|
28455
29148
|
}
|
|
@@ -28584,12 +29277,12 @@ function flattenError$1(error51, mapper = (issue2) => issue2.message) {
|
|
|
28584
29277
|
__name$6(flattenError$1, "flattenError");
|
|
28585
29278
|
function formatError$2(error51, mapper = (issue2) => issue2.message) {
|
|
28586
29279
|
const fieldErrors = { _errors: [] };
|
|
28587
|
-
const processError = /* @__PURE__ */ __name$6((error52,
|
|
28588
|
-
for (const issue2 of error52.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...
|
|
28589
|
-
else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...
|
|
28590
|
-
else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...
|
|
29280
|
+
const processError = /* @__PURE__ */ __name$6((error52, path6 = []) => {
|
|
29281
|
+
for (const issue2 of error52.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
|
|
29282
|
+
else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
|
|
29283
|
+
else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
|
|
28591
29284
|
else {
|
|
28592
|
-
const fullpath = [...
|
|
29285
|
+
const fullpath = [...path6, ...issue2.path];
|
|
28593
29286
|
if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue2));
|
|
28594
29287
|
else {
|
|
28595
29288
|
let curr = fieldErrors;
|
|
@@ -28613,13 +29306,13 @@ function formatError$2(error51, mapper = (issue2) => issue2.message) {
|
|
|
28613
29306
|
__name$6(formatError$2, "formatError");
|
|
28614
29307
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
28615
29308
|
const result = { errors: [] };
|
|
28616
|
-
const processError = /* @__PURE__ */ __name$6((error52,
|
|
29309
|
+
const processError = /* @__PURE__ */ __name$6((error52, path6 = []) => {
|
|
28617
29310
|
var _a3, _b;
|
|
28618
|
-
for (const issue2 of error52.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...
|
|
28619
|
-
else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...
|
|
28620
|
-
else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...
|
|
29311
|
+
for (const issue2 of error52.issues) if (issue2.code === "invalid_union" && issue2.errors.length) issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
|
|
29312
|
+
else if (issue2.code === "invalid_key") processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
|
|
29313
|
+
else if (issue2.code === "invalid_element") processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
|
|
28621
29314
|
else {
|
|
28622
|
-
const fullpath = [...
|
|
29315
|
+
const fullpath = [...path6, ...issue2.path];
|
|
28623
29316
|
if (fullpath.length === 0) {
|
|
28624
29317
|
result.errors.push(mapper(issue2));
|
|
28625
29318
|
continue;
|
|
@@ -28649,8 +29342,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
28649
29342
|
__name$6(treeifyError, "treeifyError");
|
|
28650
29343
|
function toDotPath(_path) {
|
|
28651
29344
|
const segs = [];
|
|
28652
|
-
const
|
|
28653
|
-
for (const seg of
|
|
29345
|
+
const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
29346
|
+
for (const seg of path6) if (typeof seg === "number") segs.push(`[${seg}]`);
|
|
28654
29347
|
else if (typeof seg === "symbol") segs.push(`[${JSON.stringify(String(seg))}]`);
|
|
28655
29348
|
else if (/[^\w$]/.test(seg)) segs.push(`[${JSON.stringify(seg)}]`);
|
|
28656
29349
|
else {
|
|
@@ -40782,11 +41475,11 @@ function detectVersion(schema, defaultTarget) {
|
|
|
40782
41475
|
__name$6(detectVersion, "detectVersion");
|
|
40783
41476
|
function resolveRef(ref$1, ctx) {
|
|
40784
41477
|
if (!ref$1.startsWith("#")) throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
40785
|
-
const
|
|
40786
|
-
if (
|
|
41478
|
+
const path6 = ref$1.slice(1).split("/").filter(Boolean);
|
|
41479
|
+
if (path6.length === 0) return ctx.rootSchema;
|
|
40787
41480
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
40788
|
-
if (
|
|
40789
|
-
const key =
|
|
41481
|
+
if (path6[0] === defsKey) {
|
|
41482
|
+
const key = path6[1];
|
|
40790
41483
|
if (!key || !ctx.defs[key]) throw new Error(`Reference not found: ${ref$1}`);
|
|
40791
41484
|
return ctx.defs[key];
|
|
40792
41485
|
}
|
|
@@ -41175,9 +41868,9 @@ Please add "${field}" to "env.${envName}".`);
|
|
|
41175
41868
|
return rawEnv[field] ?? defaultValue;
|
|
41176
41869
|
}
|
|
41177
41870
|
__name$6(notInheritable, "notInheritable");
|
|
41178
|
-
function unwindPropertyPath(root,
|
|
41871
|
+
function unwindPropertyPath(root, path6) {
|
|
41179
41872
|
let container = root;
|
|
41180
|
-
const parts =
|
|
41873
|
+
const parts = path6.split(".");
|
|
41181
41874
|
for (let i$1 = 0; i$1 < parts.length - 1; i$1++) {
|
|
41182
41875
|
if (!hasProperty(container, parts[i$1])) return;
|
|
41183
41876
|
container = container[parts[i$1]];
|
|
@@ -41963,7 +42656,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
41963
42656
|
warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, environment.durable_objects, environment.migrations, environment.exports, configPath);
|
|
41964
42657
|
errorIfMigrationsAndExportsBothSet(diagnostics, environment.migrations, environment.exports);
|
|
41965
42658
|
const containersDeclaredElsewhere = rawConfig !== void 0 ? rawConfig.containers !== void 0 : Object.values("env" in rawEnv ? rawEnv.env ?? {} : {}).some((rawNamedEnv) => rawNamedEnv?.containers !== void 0);
|
|
41966
|
-
validateContainerExportLinks
|
|
42659
|
+
validateContainerExportLinks(diagnostics, environment.containers, environment.exports, containersDeclaredElsewhere);
|
|
41967
42660
|
if (envName !== "top level") validateAdditionalProperties(diagnostics, "env." + envName, Object.keys(rawEnv), Object.keys(environment));
|
|
41968
42661
|
return environment;
|
|
41969
42662
|
}
|
|
@@ -43255,7 +43948,6 @@ var validateBindingsHaveUniqueNames = /* @__PURE__ */ __name$6((diagnostics, con
|
|
|
43255
43948
|
const bindingNamesArray = Object.entries(friendlyBindingNames);
|
|
43256
43949
|
const bindingsGroupedByType = Object.fromEntries(bindingNamesArray.map(([bindingType, binding]) => [binding, getBindingNames(bindingType === "queues" ? config2[bindingType]?.producers : config2[bindingType])]));
|
|
43257
43950
|
bindingsGroupedByType["Secret"] = config2.secrets?.required ?? [];
|
|
43258
|
-
bindingsGroupedByType["Container images"] = [CONTAINER_IMAGES_BINDING];
|
|
43259
43951
|
const bindingsGroupedByName = {};
|
|
43260
43952
|
for (const bindingType in bindingsGroupedByType) {
|
|
43261
43953
|
const bindingNames = bindingsGroupedByType[bindingType];
|
|
@@ -44226,7 +44918,7 @@ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1)
|
|
|
44226
44918
|
if (migrations.length > 0 && exports$1 !== void 0 && Object.values(exports$1).some((entry) => entry.type === "durable-object")) diagnostics.errors.push(`\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`);
|
|
44227
44919
|
}
|
|
44228
44920
|
__name$6(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
|
|
44229
|
-
function validateContainerExportLinks
|
|
44921
|
+
function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
|
|
44230
44922
|
if (containers !== void 0 && !Array.isArray(containers)) return;
|
|
44231
44923
|
if (containers === void 0 && containersDeclaredElsewhere) return;
|
|
44232
44924
|
const containersByName = /* @__PURE__ */ new Map();
|
|
@@ -44286,7 +44978,7 @@ function validateContainerExportLinks$1(diagnostics, containers, exports$1, cont
|
|
|
44286
44978
|
if (referencedContainerName === void 0 && exportEntry !== void 0 && "storage" in exportEntry && exportEntry.storage === "legacy-kv") diagnostics.errors.push(`The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports.${container.class_name}.storage" is "legacy-kv". Containers are not supported on Durable Objects using the "legacy-kv" storage backend.`);
|
|
44287
44979
|
}
|
|
44288
44980
|
}
|
|
44289
|
-
__name$6(validateContainerExportLinks
|
|
44981
|
+
__name$6(validateContainerExportLinks, "validateContainerExportLinks");
|
|
44290
44982
|
var validatePythonModules = /* @__PURE__ */ __name$6((diagnostics, field, value, topLevelEnv) => {
|
|
44291
44983
|
if (value === void 0) return true;
|
|
44292
44984
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -46718,6 +47410,91 @@ function toUrlPath(filePath) {
|
|
|
46718
47410
|
return filePath.replace(/\\/g, "/");
|
|
46719
47411
|
}
|
|
46720
47412
|
__name$6(toUrlPath, "toUrlPath");
|
|
47413
|
+
var import_minimatch = __toESM(require_minimatch());
|
|
47414
|
+
var DEFAULT_MIGRATIONS_DIR = "./migrations";
|
|
47415
|
+
function getD1MigrationFiles(options) {
|
|
47416
|
+
const migrationsDir = normalizeRelativePath(options.migrationsDir ?? DEFAULT_MIGRATIONS_DIR);
|
|
47417
|
+
const dirRelativePattern = stripDirPrefix(normalizeRelativePath(options.migrationsPattern ?? `${migrationsDir}/*.sql`), migrationsDir);
|
|
47418
|
+
const walkRoot = path__default.resolve(options.projectPath, migrationsDir);
|
|
47419
|
+
return listFilesRelative(walkRoot, new import_minimatch.Minimatch(dirRelativePattern, { dot: false })).map((name) => ({
|
|
47420
|
+
name,
|
|
47421
|
+
filePath: path__default.join(walkRoot, ...name.split("/"))
|
|
47422
|
+
}));
|
|
47423
|
+
}
|
|
47424
|
+
__name$6(getD1MigrationFiles, "getD1MigrationFiles");
|
|
47425
|
+
function normalizeRelativePath(p$2) {
|
|
47426
|
+
const forwardSlashed = p$2.replace(/\\/g, "/");
|
|
47427
|
+
const normalized = path__default.posix.normalize(forwardSlashed);
|
|
47428
|
+
if (normalized.endsWith("/")) return normalized.slice(0, -1);
|
|
47429
|
+
return normalized;
|
|
47430
|
+
}
|
|
47431
|
+
__name$6(normalizeRelativePath, "normalizeRelativePath");
|
|
47432
|
+
function stripDirPrefix(pattern, dir2) {
|
|
47433
|
+
if (dir2 === ".") return pattern;
|
|
47434
|
+
const prefix = `${dir2}/`;
|
|
47435
|
+
if (!pattern.startsWith(prefix)) throw new Error(`Expected migrations pattern ${JSON.stringify(pattern)} to start with ${JSON.stringify(prefix)}`);
|
|
47436
|
+
return pattern.slice(prefix.length);
|
|
47437
|
+
}
|
|
47438
|
+
__name$6(stripDirPrefix, "stripDirPrefix");
|
|
47439
|
+
function listFilesRelative(dir2, matcher) {
|
|
47440
|
+
const out = [];
|
|
47441
|
+
const stack = [{
|
|
47442
|
+
abs: dir2,
|
|
47443
|
+
rel: ""
|
|
47444
|
+
}];
|
|
47445
|
+
while (stack.length > 0) {
|
|
47446
|
+
const { abs, rel } = stack.pop();
|
|
47447
|
+
let entries;
|
|
47448
|
+
try {
|
|
47449
|
+
entries = fs2.readdirSync(abs, { withFileTypes: true });
|
|
47450
|
+
} catch {
|
|
47451
|
+
continue;
|
|
47452
|
+
}
|
|
47453
|
+
for (const entry of entries) {
|
|
47454
|
+
const childRel = rel === "" ? entry.name : `${rel}/${entry.name}`;
|
|
47455
|
+
if (entry.isDirectory()) {
|
|
47456
|
+
if (matcher.match(childRel, true)) stack.push({
|
|
47457
|
+
abs: path__default.join(abs, entry.name),
|
|
47458
|
+
rel: childRel
|
|
47459
|
+
});
|
|
47460
|
+
} else if (entry.isFile() && matcher.match(childRel)) out.push(childRel);
|
|
47461
|
+
}
|
|
47462
|
+
}
|
|
47463
|
+
return out.sort(compareMigrationPaths);
|
|
47464
|
+
}
|
|
47465
|
+
__name$6(listFilesRelative, "listFilesRelative");
|
|
47466
|
+
function compareMigrationPaths(a, b) {
|
|
47467
|
+
const aSegments = a.split("/");
|
|
47468
|
+
const bSegments = b.split("/");
|
|
47469
|
+
const shared = Math.min(aSegments.length, bSegments.length);
|
|
47470
|
+
for (let i$1 = 0; i$1 < shared; i$1++) {
|
|
47471
|
+
const aSegment = aSegments[i$1];
|
|
47472
|
+
const bSegment = bSegments[i$1];
|
|
47473
|
+
if (aSegment === void 0 || bSegment === void 0) break;
|
|
47474
|
+
const cmp$3 = compareSegments(aSegment, bSegment);
|
|
47475
|
+
if (cmp$3 !== 0) return cmp$3;
|
|
47476
|
+
}
|
|
47477
|
+
return aSegments.length - bSegments.length;
|
|
47478
|
+
}
|
|
47479
|
+
__name$6(compareMigrationPaths, "compareMigrationPaths");
|
|
47480
|
+
function compareSegments(a, b) {
|
|
47481
|
+
const aNum = leadingMigrationNumber(a);
|
|
47482
|
+
const bNum = leadingMigrationNumber(b);
|
|
47483
|
+
if (aNum !== bNum) {
|
|
47484
|
+
if (Number.isFinite(aNum) && Number.isFinite(bNum)) return aNum - bNum;
|
|
47485
|
+
if (Number.isFinite(aNum)) return -1;
|
|
47486
|
+
if (Number.isFinite(bNum)) return 1;
|
|
47487
|
+
}
|
|
47488
|
+
if (a < b) return -1;
|
|
47489
|
+
if (a > b) return 1;
|
|
47490
|
+
return 0;
|
|
47491
|
+
}
|
|
47492
|
+
__name$6(compareSegments, "compareSegments");
|
|
47493
|
+
function leadingMigrationNumber(relativePath) {
|
|
47494
|
+
const firstSegment = relativePath.split("/")[0];
|
|
47495
|
+
return parseInt(firstSegment.split("_")[0], 10);
|
|
47496
|
+
}
|
|
47497
|
+
__name$6(leadingMigrationNumber, "leadingMigrationNumber");
|
|
46721
47498
|
|
|
46722
47499
|
//#endregion
|
|
46723
47500
|
//#region ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.js
|
|
@@ -55630,7 +56407,6 @@ const ContainerObservabilityBaseSchema = strictObject({
|
|
|
55630
56407
|
});
|
|
55631
56408
|
const StandardContainerObservabilitySchema = union([ContainerObservabilityBaseSchema.extend({ targetInstancePercentage: number().min(0).max(100).optional() }), ContainerObservabilityBaseSchema.extend({ targetInstanceCount: number().int().nonnegative().optional() })]);
|
|
55632
56409
|
const BaseContainerSchema = strictObject({
|
|
55633
|
-
type: literal$1("container"),
|
|
55634
56410
|
name: string().min(1),
|
|
55635
56411
|
unsafe: record(string(), unknown()).optional()
|
|
55636
56412
|
});
|
|
@@ -55687,14 +56463,13 @@ const DurableObjectContainerBaseSchema = BaseContainerSchema.extend({
|
|
|
55687
56463
|
observability: ContainerObservabilityBaseSchema.optional()
|
|
55688
56464
|
});
|
|
55689
56465
|
/**
|
|
55690
|
-
* Input Container schema —
|
|
55691
|
-
* Container
|
|
56466
|
+
* Input Container schema — parses user-authored `cloudflare.config.ts`
|
|
56467
|
+
* Container objects. Dockerfiles are built by the consuming build tool.
|
|
55692
56468
|
*/
|
|
55693
56469
|
const InputContainerSchema = union([StandardContainerBaseSchema.extend({ image: InputContainerImageSchema }).superRefine(validateContainerRelationships), DurableObjectContainerBaseSchema.extend({ images: record(string(), InputContainerImageSchema).optional() })]);
|
|
55694
56470
|
/**
|
|
55695
|
-
* Output Container schema —
|
|
55696
|
-
* Specification, after any Dockerfile has been built into a local
|
|
55697
|
-
* image reference.
|
|
56471
|
+
* Output Container schema — parses `container.config.json` files in the Build
|
|
56472
|
+
* Output Specification, after any Dockerfile has been built into a local image reference.
|
|
55698
56473
|
*/
|
|
55699
56474
|
const OutputContainerSchema = union([StandardContainerBaseSchema.extend({ image: OutputContainerImageSchema }).superRefine(validateContainerRelationships), DurableObjectContainerBaseSchema.extend({ images: record(string(), OutputContainerImageSchema).optional() })]);
|
|
55700
56475
|
const DurableObjectCreatedExportSchema = strictObject({
|
|
@@ -55836,7 +56611,6 @@ const UnsafeSchema = strictObject({
|
|
|
55836
56611
|
* (user-authored) and output (on-disk) Worker configs.
|
|
55837
56612
|
*/
|
|
55838
56613
|
const BaseWorkerSchema = strictObject({
|
|
55839
|
-
type: literal$1("worker"),
|
|
55840
56614
|
name: string(),
|
|
55841
56615
|
compatibilityDate: string(),
|
|
55842
56616
|
compatibilityFlags: array(string()).optional(),
|
|
@@ -55857,75 +56631,37 @@ const BaseWorkerSchema = strictObject({
|
|
|
55857
56631
|
exports: record(string(), ExportSchema).optional()
|
|
55858
56632
|
});
|
|
55859
56633
|
/**
|
|
55860
|
-
* Input Worker schema —
|
|
55861
|
-
* files
|
|
55862
|
-
*
|
|
56634
|
+
* Input Worker schema — parses Worker definitions from user-authored
|
|
56635
|
+
* `cloudflare.config.ts` files. Adds an optional `entrypoint` field to the base
|
|
56636
|
+
* schema.
|
|
55863
56637
|
*/
|
|
55864
56638
|
const InputWorkerSchema = BaseWorkerSchema.extend({ entrypoint: union([string(), strictObject({ default: string() })]).transform((value) => typeof value === "string" ? value : value.default).optional() });
|
|
55865
56639
|
/**
|
|
55866
|
-
* Input settings schema —
|
|
55867
|
-
* `cloudflare.config.ts`.
|
|
56640
|
+
* Input settings schema — parses the account settings at the top level of
|
|
56641
|
+
* `cloudflare.config.ts`.
|
|
55868
56642
|
*/
|
|
55869
|
-
const InputSettingsSchema =
|
|
55870
|
-
type: literal$1("settings"),
|
|
56643
|
+
const InputSettingsSchema = object({
|
|
55871
56644
|
accountId: string().optional(),
|
|
55872
56645
|
complianceRegion: _enum(["public", "fedramp-high"]).optional()
|
|
55873
56646
|
});
|
|
55874
|
-
/**
|
|
55875
|
-
|
|
55876
|
-
|
|
55877
|
-
|
|
55878
|
-
|
|
55879
|
-
|
|
56647
|
+
/** The resolved, user-authored project configuration. */
|
|
56648
|
+
const InputConfigSchema = strictObject({
|
|
56649
|
+
...InputSettingsSchema.shape,
|
|
56650
|
+
worker: InputWorkerSchema.optional(),
|
|
56651
|
+
containers: array(InputContainerSchema).default([])
|
|
56652
|
+
});
|
|
56653
|
+
const BuildContextSchema = strictObject({
|
|
56654
|
+
isPreview: boolean(),
|
|
55880
56655
|
mode: string().optional()
|
|
55881
56656
|
});
|
|
55882
|
-
|
|
55883
|
-
|
|
55884
|
-
|
|
55885
|
-
|
|
55886
|
-
|
|
55887
|
-
|
|
55888
|
-
|
|
55889
|
-
|
|
55890
|
-
return `The \`${exportName}\` export is not a supported export type. Move constants, helper functions, and other unsupported exports to a separate module.`;
|
|
55891
|
-
}
|
|
55892
|
-
const ConfigExportsTypeSchema = record(string(), unknown()).check((ctx) => {
|
|
55893
|
-
for (const [key, value] of Object.entries(ctx.value)) {
|
|
55894
|
-
const isObject$5 = typeof value === "object" && value !== null;
|
|
55895
|
-
const type = isObject$5 && "type" in value ? value.type : void 0;
|
|
55896
|
-
if (typeof type !== "string" || !SUPPORTED_EXPORT_TYPES.has(type)) {
|
|
55897
|
-
ctx.issues.push({
|
|
55898
|
-
code: "custom",
|
|
55899
|
-
input: value,
|
|
55900
|
-
path: isObject$5 ? [key, "type"] : [key],
|
|
55901
|
-
message: invalidConfigExportMessage(key)
|
|
55902
|
-
});
|
|
55903
|
-
continue;
|
|
55904
|
-
}
|
|
55905
|
-
if (key === DEFAULT_EXPORT_NAME && type !== "worker") {
|
|
55906
|
-
ctx.issues.push({
|
|
55907
|
-
code: "custom",
|
|
55908
|
-
input: value,
|
|
55909
|
-
path: [key],
|
|
55910
|
-
message: `The \`${DEFAULT_EXPORT_NAME}\` export is reserved for a \`worker\` config; found a \`${type}\` config.`
|
|
55911
|
-
});
|
|
55912
|
-
continue;
|
|
55913
|
-
}
|
|
55914
|
-
const isSettingsName = key === SETTINGS_EXPORT_NAME;
|
|
55915
|
-
const isSettingsType = type === "settings";
|
|
55916
|
-
if (isSettingsType && !isSettingsName) ctx.issues.push({
|
|
55917
|
-
code: "custom",
|
|
55918
|
-
input: value,
|
|
55919
|
-
path: [key],
|
|
55920
|
-
message: `A \`settings\` config is only allowed on the \`${SETTINGS_EXPORT_NAME}\` export; found one on the \`${key}\` export.`
|
|
55921
|
-
});
|
|
55922
|
-
else if (isSettingsName && !isSettingsType) ctx.issues.push({
|
|
55923
|
-
code: "custom",
|
|
55924
|
-
input: value,
|
|
55925
|
-
path: [key],
|
|
55926
|
-
message: `The \`${SETTINGS_EXPORT_NAME}\` export is reserved for a \`settings\` config; found a \`${type}\` config.`
|
|
55927
|
-
});
|
|
55928
|
-
}
|
|
56657
|
+
/**
|
|
56658
|
+
* The shape of the root `config.json` in the Build Output Specification.
|
|
56659
|
+
* Account settings remain at the top level while build context is grouped
|
|
56660
|
+
* under `buildContext`.
|
|
56661
|
+
*/
|
|
56662
|
+
const OutputRootConfigSchema = strictObject({
|
|
56663
|
+
...InputSettingsSchema.shape,
|
|
56664
|
+
buildContext: BuildContextSchema
|
|
55929
56665
|
});
|
|
55930
56666
|
const ModuleTypeSchema = _enum([
|
|
55931
56667
|
"esm",
|
|
@@ -55957,9 +56693,9 @@ const ManifestSchema = strictObject({
|
|
|
55957
56693
|
});
|
|
55958
56694
|
});
|
|
55959
56695
|
/**
|
|
55960
|
-
* Output Worker schema — the shape of the Worker's `config.json` in the
|
|
55961
|
-
* Build Output Specification. Adds an optional `manifest` field to the
|
|
55962
|
-
*
|
|
56696
|
+
* Output Worker schema — the shape of the Worker's `worker.config.json` in the
|
|
56697
|
+
* Build Output Specification. Adds an optional `manifest` field to the base
|
|
56698
|
+
* schema.
|
|
55963
56699
|
*/
|
|
55964
56700
|
const OutputWorkerSchema = BaseWorkerSchema.extend({ manifest: ManifestSchema.optional() });
|
|
55965
56701
|
var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js": ((exports$1) => {
|
|
@@ -56018,7 +56754,8 @@ function generateTypes({ configPath, packageName = "@cloudflare/config" }) {
|
|
|
56018
56754
|
return import_dist.dedent`
|
|
56019
56755
|
/* eslint-disable */
|
|
56020
56756
|
// Generated by @cloudflare/config
|
|
56021
|
-
type
|
|
56757
|
+
type __Config = import("${packageName}").UnwrapConfig<typeof import("${configPath.replace(/\.(ts|js|mts|mjs)$/, "")}").default>;
|
|
56758
|
+
type __WorkerConfig = import("${packageName}").UnwrapConfig<__Config["worker"]>;
|
|
56022
56759
|
type __Env = import("${packageName}").InferEnv<__WorkerConfig>;
|
|
56023
56760
|
|
|
56024
56761
|
declare namespace Cloudflare {
|
|
@@ -56100,27 +56837,25 @@ const ROLLOUT_KIND_MAP = {
|
|
|
56100
56837
|
/**
|
|
56101
56838
|
* Convert a parsed `@cloudflare/config` config into a Wrangler `RawConfig`.
|
|
56102
56839
|
*
|
|
56103
|
-
* The caller is responsible for
|
|
56104
|
-
*
|
|
56105
|
-
* passing them in.
|
|
56840
|
+
* The caller is responsible for resolving any function/promise wrappers and
|
|
56841
|
+
* parsing the configuration before passing it in.
|
|
56106
56842
|
*
|
|
56107
|
-
* @param
|
|
56108
|
-
* @param settingsConfig The optional parsed settings config, whose fields
|
|
56109
|
-
* are merged onto the result.
|
|
56110
|
-
* @param containerExports The parsed Container exports to include in the
|
|
56111
|
-
* result.
|
|
56843
|
+
* @param config The parsed configuration.
|
|
56112
56844
|
* @returns The corresponding Wrangler `RawConfig`.
|
|
56113
56845
|
*/
|
|
56114
|
-
function convertToWranglerConfig(
|
|
56846
|
+
function convertToWranglerConfig(config$2) {
|
|
56115
56847
|
const result = {};
|
|
56116
|
-
|
|
56117
|
-
|
|
56118
|
-
|
|
56119
|
-
|
|
56120
|
-
|
|
56121
|
-
|
|
56122
|
-
|
|
56123
|
-
|
|
56848
|
+
const { worker, containers } = config$2;
|
|
56849
|
+
if (worker !== void 0) {
|
|
56850
|
+
convertTopLevel(worker, result);
|
|
56851
|
+
convertBindingsAndAssets(worker, result);
|
|
56852
|
+
convertExports(worker, result);
|
|
56853
|
+
convertDomains(worker, result);
|
|
56854
|
+
convertTriggers(worker, result);
|
|
56855
|
+
convertTailConsumers(worker, result);
|
|
56856
|
+
}
|
|
56857
|
+
convertSettings(config$2, result);
|
|
56858
|
+
if (containers.length > 0) result.containers = containers.map((container) => convertContainer(container));
|
|
56124
56859
|
return result;
|
|
56125
56860
|
}
|
|
56126
56861
|
function convertContainer(container) {
|
|
@@ -56718,31 +57453,22 @@ const CF_NO_CACHE_QUERY_KEY = "cf-no-cache";
|
|
|
56718
57453
|
const RE_NODE_MODULES = /[/\\]node_modules[/\\]/;
|
|
56719
57454
|
const depsStore = new AsyncLocalStorage();
|
|
56720
57455
|
/**
|
|
56721
|
-
* Dynamically import a
|
|
57456
|
+
* Dynamically import a Cloudflare config file from disk.
|
|
56722
57457
|
*
|
|
56723
|
-
* Returns
|
|
56724
|
-
*
|
|
56725
|
-
* are responsible for unwrapping function/promise/definition wrappers around
|
|
56726
|
-
* each export and validating them.
|
|
57458
|
+
* Returns the module's default export plus the set of file paths imported
|
|
57459
|
+
* during resolution.
|
|
56727
57460
|
*
|
|
56728
57461
|
* @param configPath Filesystem path to the config file. Relative paths are
|
|
56729
57462
|
* resolved against `process.cwd()`.
|
|
56730
|
-
* @param options.include When provided, only exports whose names are listed
|
|
56731
|
-
* survive into the returned `exports` map. Filtering happens before any
|
|
56732
|
-
* resolution or validation.
|
|
56733
57463
|
*/
|
|
56734
|
-
async function loadConfig(configPath
|
|
57464
|
+
async function loadConfig(configPath) {
|
|
56735
57465
|
registerConfigHooks();
|
|
56736
57466
|
const url$2 = pathToFileURL(configPath).href;
|
|
56737
57467
|
const dependencies = /* @__PURE__ */ new Set();
|
|
56738
57468
|
const mod$1 = await depsStore.run(dependencies, () => import(url$2, { with: { [CF_ATTR]: CF_NO_CACHE_VALUE } }));
|
|
56739
|
-
|
|
56740
|
-
for (const [name, value] of Object.entries(mod$1)) {
|
|
56741
|
-
if (options?.include && !options.include.includes(name)) continue;
|
|
56742
|
-
exports$2[name] = value;
|
|
56743
|
-
}
|
|
57469
|
+
if (!("default" in mod$1)) throw new Error(`The config file "${configPath}" does not have a default export. Export your configuration with \`export default defineConfig({ ... })\`.`);
|
|
56744
57470
|
return {
|
|
56745
|
-
|
|
57471
|
+
config: mod$1.default,
|
|
56746
57472
|
dependencies
|
|
56747
57473
|
};
|
|
56748
57474
|
}
|
|
@@ -56831,23 +57557,11 @@ const CROSS_WORKER_BINDING_TYPES = new Set([
|
|
|
56831
57557
|
"worker",
|
|
56832
57558
|
"workflow"
|
|
56833
57559
|
]);
|
|
56834
|
-
/**
|
|
56835
|
-
* Selects the Container exports from a validated project configuration.
|
|
56836
|
-
*
|
|
56837
|
-
* @param config - Validated exports keyed by their JavaScript export names.
|
|
56838
|
-
* @returns Container configurations keyed by those same export names.
|
|
56839
|
-
*/
|
|
56840
|
-
function getContainerConfigExports(config$2) {
|
|
56841
|
-
return Object.fromEntries(Object.entries(config$2).filter((entry) => entry[1]?.type === "container"));
|
|
56842
|
-
}
|
|
56843
57560
|
function isRecord(value) {
|
|
56844
57561
|
return typeof value === "object" && value !== null;
|
|
56845
57562
|
}
|
|
56846
|
-
function
|
|
56847
|
-
return typeof
|
|
56848
|
-
}
|
|
56849
|
-
function normalizeConfigReference(reference, resolved, expectedType) {
|
|
56850
|
-
return isRecord(resolved) && resolved.type === expectedType && typeof resolved.name === "string" ? resolved.name : reference;
|
|
57563
|
+
function normalizeConfigReference(reference, resolved) {
|
|
57564
|
+
return isRecord(resolved) && typeof resolved.name === "string" ? resolved.name : reference;
|
|
56851
57565
|
}
|
|
56852
57566
|
function createDefinitionResolver(ctx) {
|
|
56853
57567
|
const resolvedDefinitions = /* @__PURE__ */ new Map();
|
|
@@ -56865,11 +57579,11 @@ async function normalizeWorkerReferences(resolved, resolveDefinition) {
|
|
|
56865
57579
|
if (!isRecord(resolved) || !isRecord(resolved.env)) return resolved;
|
|
56866
57580
|
const env$3 = { ...resolved.env };
|
|
56867
57581
|
for (const [bindingName, binding] of Object.entries(env$3)) {
|
|
56868
|
-
if (!isRecord(binding) || typeof binding.type !== "string" || !CROSS_WORKER_BINDING_TYPES.has(binding.type) ||
|
|
57582
|
+
if (!isRecord(binding) || typeof binding.type !== "string" || !CROSS_WORKER_BINDING_TYPES.has(binding.type) || typeof binding.worker === "string") continue;
|
|
56869
57583
|
const target$1 = await resolveDefinition(binding.worker);
|
|
56870
57584
|
env$3[bindingName] = {
|
|
56871
57585
|
...binding,
|
|
56872
|
-
worker: normalizeConfigReference(binding.worker, target$1
|
|
57586
|
+
worker: normalizeConfigReference(binding.worker, target$1)
|
|
56873
57587
|
};
|
|
56874
57588
|
}
|
|
56875
57589
|
return {
|
|
@@ -56877,7 +57591,7 @@ async function normalizeWorkerReferences(resolved, resolveDefinition) {
|
|
|
56877
57591
|
env: env$3
|
|
56878
57592
|
};
|
|
56879
57593
|
}
|
|
56880
|
-
async function normalizeContainerReferences(resolved, resolveDefinition,
|
|
57594
|
+
async function normalizeContainerReferences(resolved, resolveDefinition, containers) {
|
|
56881
57595
|
const issues = [];
|
|
56882
57596
|
if (!isRecord(resolved) || !isRecord(resolved.exports)) return {
|
|
56883
57597
|
value: resolved,
|
|
@@ -56896,7 +57610,7 @@ async function normalizeContainerReferences(resolved, resolveDefinition, resolve
|
|
|
56896
57610
|
exportName,
|
|
56897
57611
|
"container"
|
|
56898
57612
|
],
|
|
56899
|
-
message: "Container provided as a string. Reference
|
|
57613
|
+
message: "Container provided as a string. Reference a Container definition instead, for example `container: myContainer`."
|
|
56900
57614
|
});
|
|
56901
57615
|
workerExports[exportName] = {
|
|
56902
57616
|
...workerExport,
|
|
@@ -56905,7 +57619,7 @@ async function normalizeContainerReferences(resolved, resolveDefinition, resolve
|
|
|
56905
57619
|
continue;
|
|
56906
57620
|
}
|
|
56907
57621
|
const target$1 = await resolveDefinition(reference);
|
|
56908
|
-
if (isRecord(target$1) &&
|
|
57622
|
+
if (isRecord(target$1) && typeof target$1.name === "string" && !containers.includes(target$1)) {
|
|
56909
57623
|
issues.push({
|
|
56910
57624
|
code: "custom",
|
|
56911
57625
|
input: reference,
|
|
@@ -56914,7 +57628,7 @@ async function normalizeContainerReferences(resolved, resolveDefinition, resolve
|
|
|
56914
57628
|
exportName,
|
|
56915
57629
|
"container"
|
|
56916
57630
|
],
|
|
56917
|
-
message: `The referenced Container "${target$1.name}" is not
|
|
57631
|
+
message: `The referenced Container "${target$1.name}" is not included in the \`containers\` array.`
|
|
56918
57632
|
});
|
|
56919
57633
|
workerExports[exportName] = {
|
|
56920
57634
|
...workerExport,
|
|
@@ -56924,7 +57638,7 @@ async function normalizeContainerReferences(resolved, resolveDefinition, resolve
|
|
|
56924
57638
|
}
|
|
56925
57639
|
workerExports[exportName] = {
|
|
56926
57640
|
...workerExport,
|
|
56927
|
-
container: normalizeConfigReference(reference, target$1
|
|
57641
|
+
container: normalizeConfigReference(reference, target$1)
|
|
56928
57642
|
};
|
|
56929
57643
|
}
|
|
56930
57644
|
return {
|
|
@@ -56935,8 +57649,8 @@ async function normalizeContainerReferences(resolved, resolveDefinition, resolve
|
|
|
56935
57649
|
issues
|
|
56936
57650
|
};
|
|
56937
57651
|
}
|
|
56938
|
-
async function
|
|
56939
|
-
return normalizeContainerReferences(await normalizeWorkerReferences(resolved, resolveDefinition), resolveDefinition,
|
|
57652
|
+
async function normalizeWorkerConfig(resolved, resolveDefinition, containers) {
|
|
57653
|
+
return normalizeContainerReferences(await normalizeWorkerReferences(resolved, resolveDefinition), resolveDefinition, containers);
|
|
56940
57654
|
}
|
|
56941
57655
|
function prefixIssues(issues, prefix) {
|
|
56942
57656
|
return issues.map((issue$2) => ({
|
|
@@ -56944,126 +57658,83 @@ function prefixIssues(issues, prefix) {
|
|
|
56944
57658
|
path: [prefix, ...issue$2.path]
|
|
56945
57659
|
}));
|
|
56946
57660
|
}
|
|
56947
|
-
function
|
|
57661
|
+
function validateUniqueContainerNames(config$2) {
|
|
56948
57662
|
const issues = [];
|
|
56949
|
-
const
|
|
56950
|
-
|
|
56951
|
-
|
|
56952
|
-
|
|
56953
|
-
for (const [exportName, config$2] of Object.entries(configExports)) {
|
|
56954
|
-
if (config$2.type !== "container" && config$2.type !== "worker") continue;
|
|
56955
|
-
const resourceType = config$2.type === "container" ? "Container" : "Worker";
|
|
56956
|
-
const exportNames = exportNameByResourceName[config$2.type];
|
|
56957
|
-
const previousExportName = exportNames.get(config$2.name);
|
|
56958
|
-
if (previousExportName !== void 0) {
|
|
57663
|
+
const firstIndexByName = /* @__PURE__ */ new Map();
|
|
57664
|
+
for (const [index, container] of config$2.containers.entries()) {
|
|
57665
|
+
const firstIndex = firstIndexByName.get(container.name);
|
|
57666
|
+
if (firstIndex !== void 0) {
|
|
56959
57667
|
issues.push({
|
|
56960
57668
|
code: "custom",
|
|
56961
|
-
input:
|
|
56962
|
-
path: [
|
|
56963
|
-
|
|
57669
|
+
input: container.name,
|
|
57670
|
+
path: [
|
|
57671
|
+
"containers",
|
|
57672
|
+
index,
|
|
57673
|
+
"name"
|
|
57674
|
+
],
|
|
57675
|
+
message: `The Container name "${container.name}" is also used by \`containers[${firstIndex}]\`. Container names must be unique.`
|
|
56964
57676
|
});
|
|
56965
57677
|
continue;
|
|
56966
57678
|
}
|
|
56967
|
-
|
|
57679
|
+
firstIndexByName.set(container.name, index);
|
|
56968
57680
|
}
|
|
56969
57681
|
return issues;
|
|
56970
57682
|
}
|
|
56971
|
-
function
|
|
57683
|
+
function validateContainerLinks(config$2) {
|
|
56972
57684
|
const issues = [];
|
|
56973
|
-
const
|
|
56974
|
-
for (const
|
|
56975
|
-
|
|
56976
|
-
|
|
56977
|
-
|
|
56978
|
-
|
|
56979
|
-
|
|
56980
|
-
|
|
56981
|
-
|
|
56982
|
-
|
|
56983
|
-
|
|
56984
|
-
|
|
56985
|
-
|
|
56986
|
-
|
|
56987
|
-
|
|
56988
|
-
|
|
56989
|
-
code: "custom",
|
|
56990
|
-
input: containerName,
|
|
56991
|
-
path: path$2,
|
|
56992
|
-
message: `The Container "${containerName}" is not exported from this configuration.`
|
|
56993
|
-
});
|
|
56994
|
-
continue;
|
|
56995
|
-
}
|
|
56996
|
-
const firstReference = firstReferenceByContainerName.get(containerName);
|
|
56997
|
-
if (firstReference !== void 0) {
|
|
56998
|
-
issues.push({
|
|
56999
|
-
code: "custom",
|
|
57000
|
-
input: containerName,
|
|
57001
|
-
path: path$2,
|
|
57002
|
-
message: `The Container "${containerName}" is already referenced by "${firstReference.workerExportName}.exports.${firstReference.durableObjectExportName}". A Container can only be linked to one Durable Object.`
|
|
57003
|
-
});
|
|
57004
|
-
continue;
|
|
57005
|
-
}
|
|
57006
|
-
firstReferenceByContainerName.set(containerName, {
|
|
57007
|
-
workerExportName,
|
|
57008
|
-
durableObjectExportName
|
|
57685
|
+
const firstExportByContainerName = /* @__PURE__ */ new Map();
|
|
57686
|
+
for (const [exportName, workerExport] of Object.entries(config$2.worker?.exports ?? {})) {
|
|
57687
|
+
if (workerExport.type !== "durable-object" || !("container" in workerExport) || workerExport.container === void 0) continue;
|
|
57688
|
+
const containerName = workerExport.container;
|
|
57689
|
+
const firstExportName = firstExportByContainerName.get(containerName);
|
|
57690
|
+
if (firstExportName !== void 0) {
|
|
57691
|
+
issues.push({
|
|
57692
|
+
code: "custom",
|
|
57693
|
+
input: containerName,
|
|
57694
|
+
path: [
|
|
57695
|
+
"worker",
|
|
57696
|
+
"exports",
|
|
57697
|
+
exportName,
|
|
57698
|
+
"container"
|
|
57699
|
+
],
|
|
57700
|
+
message: `The Container "${containerName}" is already referenced by \`worker.exports.${firstExportName}\`. A Container can only be linked to one Durable Object.`
|
|
57009
57701
|
});
|
|
57702
|
+
continue;
|
|
57010
57703
|
}
|
|
57704
|
+
firstExportByContainerName.set(containerName, exportName);
|
|
57011
57705
|
}
|
|
57012
57706
|
return issues;
|
|
57013
57707
|
}
|
|
57014
|
-
/**
|
|
57015
|
-
|
|
57016
|
-
*
|
|
57017
|
-
* Config inputs are resolved once by identity. Top-level Worker and Container
|
|
57018
|
-
* exports are also parsed once by identity. References are resolved only far
|
|
57019
|
-
* enough to replace them with resource names, then Container links are
|
|
57020
|
-
* validated across the exported resources.
|
|
57021
|
-
*/
|
|
57022
|
-
async function resolveAndValidateConfigExports(exports$2, ctx) {
|
|
57708
|
+
/** Resolve and parse the default configuration export. */
|
|
57709
|
+
async function resolveAndParseConfig(input, ctx) {
|
|
57023
57710
|
const resolveDefinition = createDefinitionResolver(ctx);
|
|
57024
|
-
const
|
|
57025
|
-
|
|
57026
|
-
|
|
57027
|
-
const
|
|
57028
|
-
|
|
57029
|
-
|
|
57030
|
-
|
|
57031
|
-
|
|
57032
|
-
const
|
|
57033
|
-
|
|
57034
|
-
|
|
57035
|
-
|
|
57036
|
-
|
|
57037
|
-
|
|
57038
|
-
|
|
57039
|
-
|
|
57040
|
-
|
|
57041
|
-
if (resolved.type === "worker") {
|
|
57042
|
-
const normalized = await normalizeConfigReferences(resolved, resolveDefinition, resolvedExports);
|
|
57043
|
-
issues.push(...prefixIssues(normalized.issues, name));
|
|
57044
|
-
result = InputWorkerSchema.safeParse(normalized.value);
|
|
57045
|
-
} else result = InputContainerSchema.safeParse(resolved);
|
|
57046
|
-
parsedResources.set(input, result);
|
|
57047
|
-
if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
|
|
57048
|
-
}
|
|
57049
|
-
if (result.success) data$1[name] = result.data;
|
|
57050
|
-
}
|
|
57051
|
-
issues.push(...validateUniqueResourceNames(data$1), ...validateContainerExportLinks(data$1));
|
|
57711
|
+
const resolved = await resolveDefinition(input);
|
|
57712
|
+
if (!isRecord(resolved)) return InputConfigSchema.safeParse(resolved);
|
|
57713
|
+
const containerInputs = Array.isArray(resolved.containers) ? resolved.containers : [];
|
|
57714
|
+
const containers = await Promise.all(containerInputs.map((container) => resolveDefinition(container)));
|
|
57715
|
+
const normalizedWorker = resolved.worker === void 0 ? {
|
|
57716
|
+
value: void 0,
|
|
57717
|
+
issues: []
|
|
57718
|
+
} : await normalizeWorkerConfig(await resolveDefinition(resolved.worker), resolveDefinition, containers);
|
|
57719
|
+
const candidate = {
|
|
57720
|
+
...resolved,
|
|
57721
|
+
...resolved.worker === void 0 ? {} : { worker: normalizedWorker.value },
|
|
57722
|
+
...Array.isArray(resolved.containers) ? { containers } : {}
|
|
57723
|
+
};
|
|
57724
|
+
const result = InputConfigSchema.safeParse(candidate);
|
|
57725
|
+
const issues = [...prefixIssues(normalizedWorker.issues, "worker")];
|
|
57726
|
+
if (!result.success) issues.push(...result.error.issues);
|
|
57727
|
+
else issues.push(...validateUniqueContainerNames(result.data), ...validateContainerLinks(result.data));
|
|
57052
57728
|
return issues.length > 0 ? {
|
|
57053
57729
|
success: false,
|
|
57054
57730
|
error: new ZodError(issues)
|
|
57055
|
-
} :
|
|
57056
|
-
success: true,
|
|
57057
|
-
data: data$1
|
|
57058
|
-
};
|
|
57731
|
+
} : result;
|
|
57059
57732
|
}
|
|
57060
|
-
/**
|
|
57061
|
-
|
|
57062
|
-
|
|
57063
|
-
async function loadAndValidateConfig(configPath, ctx, options) {
|
|
57064
|
-
const { exports: exports$2, dependencies } = await loadConfig(configPath, options);
|
|
57733
|
+
/** Load and parse `cloudflare.config.ts`'s default export. */
|
|
57734
|
+
async function loadAndParseConfig(configPath, ctx) {
|
|
57735
|
+
const { config: config$2, dependencies } = await loadConfig(configPath);
|
|
57065
57736
|
return {
|
|
57066
|
-
result: await
|
|
57737
|
+
result: await resolveAndParseConfig(config$2, ctx),
|
|
57067
57738
|
dependencies
|
|
57068
57739
|
};
|
|
57069
57740
|
}
|
|
@@ -57336,35 +58007,31 @@ const defuArrayFn = createDefu((object$2, key, currentValue) => {
|
|
|
57336
58007
|
* Will move to `v1` when the spec stabilises.
|
|
57337
58008
|
*/
|
|
57338
58009
|
const BUILD_OUTPUT_VERSION = "v0";
|
|
57339
|
-
/**
|
|
57340
|
-
* Project-relative root.
|
|
57341
|
-
*/
|
|
58010
|
+
/** Build output directory relative to the project root. */
|
|
57342
58011
|
const BUILD_OUTPUT_ROOT = ".cloudflare/output";
|
|
57343
|
-
/**
|
|
57344
|
-
|
|
57345
|
-
|
|
57346
|
-
|
|
57347
|
-
*/
|
|
57348
|
-
const
|
|
57349
|
-
/**
|
|
57350
|
-
* Name of the sub-directory under `workers/` holding the default Worker.
|
|
57351
|
-
*/
|
|
58012
|
+
/** Filename of the root config in the Build Output Specification. */
|
|
58013
|
+
const ROOT_CONFIG_FILENAME = "config.json";
|
|
58014
|
+
/** Filename of each Worker config in the Build Output Specification. */
|
|
58015
|
+
const WORKER_CONFIG_FILENAME = "worker.config.json";
|
|
58016
|
+
/** Filename of each Container config in the Build Output Specification. */
|
|
58017
|
+
const CONTAINER_CONFIG_FILENAME = "container.config.json";
|
|
58018
|
+
/** Name of the directory containing the default Worker. */
|
|
57352
58019
|
const DEFAULT_WORKER_DIRECTORY_NAME = "default";
|
|
57353
|
-
|
|
57354
|
-
|
|
57355
|
-
|
|
58020
|
+
const INVALID_DIRECTORY_NAME_CHARACTERS = /[\s<>:"/\\|?*\u0000-\u001f]+|\.+$/g;
|
|
58021
|
+
const WINDOWS_RESERVED_NAME = /^(?:con|prn|aux|nul|conin\$|conout\$|com[1-9¹²³]|lpt[1-9¹²³])(?:\.|$)/;
|
|
58022
|
+
const MAX_DIRECTORY_NAME_BYTES = 254;
|
|
58023
|
+
/** Absolute path to the Build Output Specification directory. */
|
|
57356
58024
|
function getBuildOutputDir(root) {
|
|
57357
58025
|
return path.resolve(root, BUILD_OUTPUT_ROOT);
|
|
57358
58026
|
}
|
|
57359
58027
|
/**
|
|
57360
|
-
* Absolute path to the
|
|
58028
|
+
* Absolute path to the root `config.json`.
|
|
57361
58029
|
*
|
|
57362
|
-
* Holds the
|
|
57363
|
-
*
|
|
57364
|
-
* mode the build was produced in.
|
|
58030
|
+
* Holds the settings declared at the top level of `cloudflare.config.ts` and
|
|
58031
|
+
* build context.
|
|
57365
58032
|
*/
|
|
57366
|
-
function
|
|
57367
|
-
return path.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION,
|
|
58033
|
+
function getRootConfigPath(root) {
|
|
58034
|
+
return path.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, ROOT_CONFIG_FILENAME);
|
|
57368
58035
|
}
|
|
57369
58036
|
/**
|
|
57370
58037
|
* Absolute path to the Workers output directory.
|
|
@@ -57378,47 +58045,68 @@ function getWorkersDir(root) {
|
|
|
57378
58045
|
function getContainersDir(root) {
|
|
57379
58046
|
return path.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, "containers");
|
|
57380
58047
|
}
|
|
57381
|
-
|
|
57382
|
-
|
|
58048
|
+
/**
|
|
58049
|
+
* Convert a Cloudflare resource name into a portable, case-insensitive
|
|
58050
|
+
* directory name.
|
|
58051
|
+
*
|
|
58052
|
+
* The original resource name remains in its config file. Callers must reject
|
|
58053
|
+
* collisions when multiple resource names normalise to the same directory.
|
|
58054
|
+
*/
|
|
58055
|
+
function normalizeDirectoryName(name) {
|
|
58056
|
+
const directoryName = truncateUtf8(name.toLowerCase(), MAX_DIRECTORY_NAME_BYTES).replace(INVALID_DIRECTORY_NAME_CHARACTERS, "-");
|
|
58057
|
+
return WINDOWS_RESERVED_NAME.test(directoryName) ? `_${directoryName}` : directoryName;
|
|
58058
|
+
}
|
|
58059
|
+
function truncateUtf8(value, maxBytes) {
|
|
58060
|
+
let result = "";
|
|
58061
|
+
let byteLength = 0;
|
|
58062
|
+
for (const character of value) {
|
|
58063
|
+
const characterByteLength = Buffer.byteLength(character);
|
|
58064
|
+
if (byteLength + characterByteLength > maxBytes) break;
|
|
58065
|
+
result += character;
|
|
58066
|
+
byteLength += characterByteLength;
|
|
58067
|
+
}
|
|
58068
|
+
return result;
|
|
58069
|
+
}
|
|
58070
|
+
function validateDirectoryName(name, resourceType) {
|
|
58071
|
+
if (name.length === 0 || name === "." || name === ".." || name.includes("/") || name.includes("\\") || name.includes("\0")) throw new Error(`${resourceType} directory names must be non-empty, single path segments. Received ${JSON.stringify(name)}.`);
|
|
57383
58072
|
}
|
|
57384
58073
|
/**
|
|
57385
|
-
* Absolute path to a Worker's directory (`workers/<
|
|
58074
|
+
* Absolute path to a Worker's directory (`workers/<directory-name>`).
|
|
57386
58075
|
*/
|
|
57387
|
-
function getWorkerDir(root,
|
|
57388
|
-
validateDirectoryName(
|
|
57389
|
-
return path.join(getWorkersDir(root),
|
|
58076
|
+
function getWorkerDir(root, directoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
|
|
58077
|
+
validateDirectoryName(directoryName, "Worker");
|
|
58078
|
+
return path.join(getWorkersDir(root), directoryName);
|
|
57390
58079
|
}
|
|
57391
58080
|
/**
|
|
57392
|
-
* Absolute path to a Container's directory
|
|
57393
|
-
* (`containers/<container-directory-name>`).
|
|
58081
|
+
* Absolute path to a Container's directory (`containers/<directory-name>`).
|
|
57394
58082
|
*/
|
|
57395
|
-
function getContainerDir(root,
|
|
57396
|
-
validateDirectoryName(
|
|
57397
|
-
return path.join(getContainersDir(root),
|
|
58083
|
+
function getContainerDir(root, directoryName) {
|
|
58084
|
+
validateDirectoryName(directoryName, "Container");
|
|
58085
|
+
return path.join(getContainersDir(root), directoryName);
|
|
57398
58086
|
}
|
|
57399
58087
|
/**
|
|
57400
58088
|
* Absolute path to the Container's config file.
|
|
57401
58089
|
*/
|
|
57402
|
-
function getContainerConfigPath(root,
|
|
57403
|
-
return path.join(getContainerDir(root,
|
|
58090
|
+
function getContainerConfigPath(root, directoryName) {
|
|
58091
|
+
return path.join(getContainerDir(root, directoryName), CONTAINER_CONFIG_FILENAME);
|
|
57404
58092
|
}
|
|
57405
58093
|
/**
|
|
57406
58094
|
* Absolute path to the Worker's config file.
|
|
57407
58095
|
*/
|
|
57408
|
-
function getWorkerConfigPath(root,
|
|
57409
|
-
return path.join(getWorkerDir(root,
|
|
58096
|
+
function getWorkerConfigPath(root, directoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
|
|
58097
|
+
return path.join(getWorkerDir(root, directoryName), WORKER_CONFIG_FILENAME);
|
|
57410
58098
|
}
|
|
57411
58099
|
/**
|
|
57412
58100
|
* Absolute path to the Worker's bundle directory.
|
|
57413
58101
|
*/
|
|
57414
|
-
function getWorkerBundleDir(root,
|
|
57415
|
-
return path.join(getWorkerDir(root,
|
|
58102
|
+
function getWorkerBundleDir(root, directoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
|
|
58103
|
+
return path.join(getWorkerDir(root, directoryName), "bundle");
|
|
57416
58104
|
}
|
|
57417
58105
|
/**
|
|
57418
58106
|
* Absolute path to the Worker's assets directory.
|
|
57419
58107
|
*/
|
|
57420
|
-
function getWorkerAssetsDir(root,
|
|
57421
|
-
return path.join(getWorkerDir(root,
|
|
58108
|
+
function getWorkerAssetsDir(root, directoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
|
|
58109
|
+
return path.join(getWorkerDir(root, directoryName), "assets");
|
|
57422
58110
|
}
|
|
57423
58111
|
var __defProp$3 = Object.defineProperty;
|
|
57424
58112
|
var __name$3 = (target$1, value) => __defProp$3(target$1, "name", {
|
|
@@ -57456,7 +58144,8 @@ async function cleanBuildOutputDir(root) {
|
|
|
57456
58144
|
await removeDir(getBuildOutputDir(root));
|
|
57457
58145
|
}
|
|
57458
58146
|
/**
|
|
57459
|
-
* Write an output Worker `config.json` to the Build Output Specification
|
|
58147
|
+
* Write an output Worker `worker.config.json` to the Build Output Specification
|
|
58148
|
+
* tree.
|
|
57460
58149
|
*
|
|
57461
58150
|
* - Workers mode: `manifest` is provided (bundle/ present on disk).
|
|
57462
58151
|
* - Assets-only mode: `manifest` is omitted (no bundle/ directory).
|
|
@@ -57471,8 +58160,8 @@ async function writeWorkerConfig({ root, config: config$2, manifest, directoryNa
|
|
|
57471
58160
|
await fsp.writeFile(getWorkerConfigPath(root, directoryName), JSON.stringify(outputConfig));
|
|
57472
58161
|
}
|
|
57473
58162
|
/**
|
|
57474
|
-
* Write an output Container `config.json` to the Build Output
|
|
57475
|
-
* tree.
|
|
58163
|
+
* Write an output Container `container.config.json` to the Build Output
|
|
58164
|
+
* Specification tree.
|
|
57476
58165
|
*
|
|
57477
58166
|
* Local Dockerfiles must already have been built and represented by a
|
|
57478
58167
|
* `localReference` in the output config.
|
|
@@ -57482,30 +58171,24 @@ async function writeContainerConfig({ root, config: config$2, directoryName }) {
|
|
|
57482
58171
|
await fsp.writeFile(getContainerConfigPath(root, directoryName), JSON.stringify(config$2));
|
|
57483
58172
|
}
|
|
57484
58173
|
/**
|
|
57485
|
-
* Write the
|
|
57486
|
-
*
|
|
57487
|
-
* Holds the project settings shared by every Worker, plus the build mode and
|
|
57488
|
-
* whether the build is for a Preview. Always written, even without declared
|
|
57489
|
-
* settings or a mode.
|
|
58174
|
+
* Write the root `config.json` to the Build Output Specification tree.
|
|
57490
58175
|
*
|
|
57491
|
-
*
|
|
57492
|
-
*
|
|
58176
|
+
* Holds the settings declared at the top level of `cloudflare.config.ts` and
|
|
58177
|
+
* build context supplied at build time.
|
|
57493
58178
|
*/
|
|
57494
|
-
async function
|
|
58179
|
+
async function writeRootConfig(root, settings, buildContext) {
|
|
57495
58180
|
const outputConfig = {
|
|
57496
58181
|
...settings,
|
|
57497
|
-
|
|
57498
|
-
...isPreview ? { isPreview: true } : {},
|
|
57499
|
-
...mode !== void 0 ? { mode } : {}
|
|
58182
|
+
buildContext
|
|
57500
58183
|
};
|
|
57501
|
-
const configPath =
|
|
58184
|
+
const configPath = getRootConfigPath(root);
|
|
57502
58185
|
await fsp.mkdir(path.dirname(configPath), { recursive: true });
|
|
57503
58186
|
await fsp.writeFile(configPath, JSON.stringify(outputConfig));
|
|
57504
58187
|
}
|
|
57505
58188
|
const BUILD_OUTPUT_ERROR_PREFIX = "Build Output Specification: ";
|
|
57506
58189
|
/**
|
|
57507
58190
|
* Thrown when the Build Output Specification tree is missing, malformed, or
|
|
57508
|
-
*
|
|
58191
|
+
* internally inconsistent.
|
|
57509
58192
|
*/
|
|
57510
58193
|
var BuildOutputError = class extends Error {
|
|
57511
58194
|
constructor(message) {
|
|
@@ -57514,43 +58197,51 @@ var BuildOutputError = class extends Error {
|
|
|
57514
58197
|
}
|
|
57515
58198
|
};
|
|
57516
58199
|
/**
|
|
57517
|
-
* Read and
|
|
58200
|
+
* Read and parse the Build Output Specification tree at
|
|
57518
58201
|
* `<root>/.cloudflare/output/v0/`.
|
|
57519
58202
|
*
|
|
57520
|
-
* Reads the
|
|
57521
|
-
*
|
|
57522
|
-
*
|
|
57523
|
-
*
|
|
58203
|
+
* Reads the root `config.json`, then reads and parses each
|
|
58204
|
+
* `worker.config.json` and `container.config.json`, and resolves each Worker's
|
|
58205
|
+
* `bundle/` / `assets/` directories. Partial manifests are resolved into
|
|
58206
|
+
* complete manifests using the files in `bundle/`.
|
|
57524
58207
|
*
|
|
57525
|
-
* @throws {BuildOutputError} if the
|
|
57526
|
-
* a Worker or Container config is missing, is not valid JSON,
|
|
57527
|
-
*
|
|
58208
|
+
* @throws {BuildOutputError} if the root `config.json` is missing or
|
|
58209
|
+
* invalid, or if a Worker or Container config is missing, is not valid JSON,
|
|
58210
|
+
* or does not match its schema.
|
|
57528
58211
|
*/
|
|
57529
58212
|
async function readBuildOutput(root) {
|
|
57530
|
-
const
|
|
57531
|
-
const
|
|
57532
|
-
const
|
|
57533
|
-
const additionalWorkers = await Promise.all(additionalWorkerDirectoryNames.map(async (workerDirectoryName) => [workerDirectoryName, await readWorker(root, workerDirectoryName)]));
|
|
58213
|
+
const absoluteRoot = path.resolve(root);
|
|
58214
|
+
const rootConfig = await readRootConfig(absoluteRoot);
|
|
58215
|
+
const [workers, containers] = await Promise.all([readWorkers(absoluteRoot), readContainers(absoluteRoot)]);
|
|
57534
58216
|
return {
|
|
57535
|
-
root,
|
|
58217
|
+
root: absoluteRoot,
|
|
57536
58218
|
version: BUILD_OUTPUT_VERSION,
|
|
57537
|
-
|
|
57538
|
-
workers
|
|
57539
|
-
|
|
57540
|
-
...Object.fromEntries(additionalWorkers)
|
|
57541
|
-
},
|
|
57542
|
-
containers: await readContainers(root)
|
|
58219
|
+
rootConfig,
|
|
58220
|
+
workers,
|
|
58221
|
+
containers
|
|
57543
58222
|
};
|
|
57544
58223
|
}
|
|
57545
|
-
/** Read and
|
|
58224
|
+
/** Read and parse the default Worker and any additional Worker configs. */
|
|
58225
|
+
async function readWorkers(root) {
|
|
58226
|
+
const workersDir = getWorkersDir(root);
|
|
58227
|
+
const defaultWorker = await readWorker(root, DEFAULT_WORKER_DIRECTORY_NAME);
|
|
58228
|
+
const additionalWorkerDirectoryNames = (await fsp.readdir(workersDir, { withFileTypes: true })).filter((entry) => entry.isDirectory() && entry.name !== DEFAULT_WORKER_DIRECTORY_NAME).map((entry) => entry.name);
|
|
58229
|
+
const additionalWorkers = await Promise.all(additionalWorkerDirectoryNames.map(async (workerDirectoryName) => {
|
|
58230
|
+
return [workerDirectoryName, await readWorker(root, workerDirectoryName)];
|
|
58231
|
+
}));
|
|
58232
|
+
return {
|
|
58233
|
+
default: defaultWorker,
|
|
58234
|
+
...Object.fromEntries(additionalWorkers)
|
|
58235
|
+
};
|
|
58236
|
+
}
|
|
58237
|
+
/** Read and parse all Container configs, if any. */
|
|
57546
58238
|
async function readContainers(root) {
|
|
57547
58239
|
const containersDir = getContainersDir(root);
|
|
57548
|
-
if (!fs$1.existsSync(containersDir)) return
|
|
57549
|
-
const containerDirectoryNames = (await fsp.readdir(containersDir, { withFileTypes: true })).filter((entry) => entry.isDirectory()).map((entry) => entry.name)
|
|
57550
|
-
|
|
57551
|
-
return Object.fromEntries(containers);
|
|
58240
|
+
if (!fs$1.existsSync(containersDir)) return [];
|
|
58241
|
+
const containerDirectoryNames = (await fsp.readdir(containersDir, { withFileTypes: true })).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
58242
|
+
return Promise.all(containerDirectoryNames.map((containerDirectoryName) => readContainer(root, containerDirectoryName)));
|
|
57552
58243
|
}
|
|
57553
|
-
/** Read and
|
|
58244
|
+
/** Read and parse one Container config. */
|
|
57554
58245
|
async function readContainer(root, containerDirectoryName) {
|
|
57555
58246
|
const configPath = getContainerConfigPath(root, containerDirectoryName);
|
|
57556
58247
|
if (!fs$1.existsSync(configPath)) throw new BuildOutputError(`no Container config found at ${configPath}.`);
|
|
@@ -57563,12 +58254,12 @@ async function readContainer(root, containerDirectoryName) {
|
|
|
57563
58254
|
};
|
|
57564
58255
|
}
|
|
57565
58256
|
/**
|
|
57566
|
-
* Read and
|
|
58257
|
+
* Read and parse the Worker's `worker.config.json` and resolve its
|
|
57567
58258
|
* `bundle/` / `assets/` directories.
|
|
57568
58259
|
*
|
|
57569
58260
|
* @returns the Worker, with whichever of its directories exist resolved.
|
|
57570
58261
|
* @throws {BuildOutputError} if the config is missing, is not valid JSON, or
|
|
57571
|
-
*
|
|
58262
|
+
* does not match its schema.
|
|
57572
58263
|
*/
|
|
57573
58264
|
async function readWorker(root, workerDirectoryName) {
|
|
57574
58265
|
const configPath = getWorkerConfigPath(root, workerDirectoryName);
|
|
@@ -57649,23 +58340,18 @@ function inferModuleType(modulePath) {
|
|
|
57649
58340
|
}
|
|
57650
58341
|
}
|
|
57651
58342
|
/**
|
|
57652
|
-
* Read and
|
|
57653
|
-
* project-level settings shared by every Worker, including the mode the build
|
|
57654
|
-
* was produced in.
|
|
57655
|
-
*
|
|
57656
|
-
* Returned whole: consumers that need only the settings the user declared
|
|
57657
|
-
* narrow it themselves.
|
|
58343
|
+
* Read and parse the root `config.json`.
|
|
57658
58344
|
*
|
|
57659
|
-
* @returns the parsed
|
|
57660
|
-
* @throws {BuildOutputError} if the file is not valid JSON or
|
|
57661
|
-
*
|
|
58345
|
+
* @returns the parsed root config.
|
|
58346
|
+
* @throws {BuildOutputError} if the file is missing, is not valid JSON, or
|
|
58347
|
+
* does not match its schema.
|
|
57662
58348
|
*/
|
|
57663
|
-
async function
|
|
57664
|
-
const configPath =
|
|
57665
|
-
if (!fs$1.existsSync(configPath))
|
|
58349
|
+
async function readRootConfig(root) {
|
|
58350
|
+
const configPath = getRootConfigPath(root);
|
|
58351
|
+
if (!fs$1.existsSync(configPath)) throw new BuildOutputError(`no root config found at ${configPath}.`);
|
|
57666
58352
|
const contents = await fsp.readFile(configPath, "utf-8");
|
|
57667
|
-
const result =
|
|
57668
|
-
if (!result.success) throw new BuildOutputError(`invalid
|
|
58353
|
+
const result = OutputRootConfigSchema.safeParse(parseJson(contents, configPath));
|
|
58354
|
+
if (!result.success) throw new BuildOutputError(`invalid root config at ${configPath}.\n${result.error.message}`);
|
|
57669
58355
|
return result.data;
|
|
57670
58356
|
}
|
|
57671
58357
|
function parseJson(contents, configPath) {
|
|
@@ -57687,10 +58373,15 @@ function parseJson(contents, configPath) {
|
|
|
57687
58373
|
* single-element array.
|
|
57688
58374
|
*/
|
|
57689
58375
|
async function readBuildOutputWorkers(root) {
|
|
57690
|
-
const { workers,
|
|
58376
|
+
const { workers, rootConfig, containers } = await readBuildOutput(root);
|
|
57691
58377
|
const worker = workers[DEFAULT_WORKER_DIRECTORY_NAME];
|
|
57692
58378
|
const { manifest,...inputShape } = worker.config;
|
|
57693
|
-
const {
|
|
58379
|
+
const { buildContext: _buildContext,...settings } = rootConfig;
|
|
58380
|
+
const { config: config$2, diagnostics } = normalizeAndValidateConfig(convertToWranglerConfig({
|
|
58381
|
+
...settings,
|
|
58382
|
+
worker: inputShape,
|
|
58383
|
+
containers: containers.map(({ config: config$3 }) => convertOutputContainerToInput(config$3))
|
|
58384
|
+
}), void 0, void 0, { enableContainers: false }, true);
|
|
57694
58385
|
if (diagnostics.hasWarnings()) console.warn(diagnostics.renderWarnings());
|
|
57695
58386
|
if (diagnostics.hasErrors()) throw new Error(diagnostics.renderErrors());
|
|
57696
58387
|
if (worker.assetsDir) config$2.assets = {
|
|
@@ -64783,7 +65474,7 @@ async function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
|
|
|
64783
65474
|
if (Array.isArray(entryWorkerResolvedConfig.config.assets?.run_worker_first)) staticRouting = parseStaticRouting(entryWorkerResolvedConfig.config.assets.run_worker_first);
|
|
64784
65475
|
const entryWorkerEnvironmentName = pluginConfig.viteEnvironment?.name ?? workerNameToEnvironmentName(entryWorkerResolvedConfig.config.topLevelName);
|
|
64785
65476
|
validateAndAddEnvironmentName(entryWorkerEnvironmentName);
|
|
64786
|
-
const entryWorkerNewConfig = parsedNewConfig?.
|
|
65477
|
+
const entryWorkerNewConfig = parsedNewConfig?.worker;
|
|
64787
65478
|
environmentNameToWorkerMap.set(entryWorkerEnvironmentName, resolveWorker(entryWorkerResolvedConfig.config, pluginConfig.assetsOnly, entryWorkerNewConfig));
|
|
64788
65479
|
const entryWorkerChildEnvironments = pluginConfig.viteEnvironment?.childEnvironments;
|
|
64789
65480
|
if (entryWorkerChildEnvironments) {
|
|
@@ -64873,14 +65564,14 @@ const EXPERIMENTAL_CONFIG_PKG = "@cloudflare/vite-plugin/experimental-config";
|
|
|
64873
65564
|
async function loadNewConfig(options) {
|
|
64874
65565
|
const configPath = path.resolve(options.root, NEW_CONFIG_FILENAME);
|
|
64875
65566
|
if (!fs$1.existsSync(configPath)) throw new Error(`\`experimental.newConfig\` is enabled but no \`${NEW_CONFIG_FILENAME}\` was found at ${configPath}.`);
|
|
64876
|
-
const { result, dependencies } = await
|
|
65567
|
+
const { result, dependencies } = await loadAndParseConfig(configPath, {
|
|
64877
65568
|
isPreview: isPreviewBuild(),
|
|
64878
65569
|
mode: options.mode
|
|
64879
65570
|
});
|
|
64880
65571
|
if (!result.success) throw new Error(`Invalid \`${NEW_CONFIG_FILENAME}\`:\n${result.error.message}`);
|
|
64881
|
-
const worker = result.data.
|
|
64882
|
-
if (worker === void 0) throw new Error(`\`${NEW_CONFIG_FILENAME}\` must
|
|
64883
|
-
const rawConfig = convertToWranglerConfig(
|
|
65572
|
+
const worker = result.data.worker;
|
|
65573
|
+
if (worker === void 0) throw new Error(`\`${NEW_CONFIG_FILENAME}\` must define a Worker using the \`worker\` property.`);
|
|
65574
|
+
const rawConfig = convertToWranglerConfig(result.data);
|
|
64884
65575
|
if (options.command === "serve" && options.types.generate) await writeWorkerConfigurationDts({
|
|
64885
65576
|
root: options.root,
|
|
64886
65577
|
configPath,
|
|
@@ -66749,14 +67440,13 @@ const buildOutputPlugin = createPlugin("build-output", (ctx) => {
|
|
|
66749
67440
|
return { async writeBundle(_, bundle) {
|
|
66750
67441
|
if (ctx.isChildEnvironment(this.environment.name)) return;
|
|
66751
67442
|
if (ctx.resolvedPluginConfig.type === "assets-only" && this.environment.name === "client") {
|
|
66752
|
-
const
|
|
66753
|
-
|
|
66754
|
-
assert2(workerNewConfig$1, "Expected a default worker export on assets-only resolved config");
|
|
67443
|
+
const workerNewConfig$1 = ctx.resolvedPluginConfig.parsedNewConfig?.worker;
|
|
67444
|
+
assert2(workerNewConfig$1, "Expected a Worker on assets-only resolved config");
|
|
66755
67445
|
await writeWorkerConfig({
|
|
66756
67446
|
root: ctx.resolvedViteConfig.root,
|
|
66757
67447
|
config: workerNewConfig$1
|
|
66758
67448
|
});
|
|
66759
|
-
await
|
|
67449
|
+
await writeRoot();
|
|
66760
67450
|
return;
|
|
66761
67451
|
}
|
|
66762
67452
|
if (ctx.resolvedPluginConfig.type === "workers" && this.environment.name !== ctx.resolvedPluginConfig.entryWorkerEnvironmentName) return;
|
|
@@ -66781,20 +67471,26 @@ const buildOutputPlugin = createPlugin("build-output", (ctx) => {
|
|
|
66781
67471
|
modules
|
|
66782
67472
|
}
|
|
66783
67473
|
});
|
|
66784
|
-
await
|
|
67474
|
+
await writeRoot();
|
|
66785
67475
|
} };
|
|
66786
67476
|
/**
|
|
66787
|
-
* Write the
|
|
67477
|
+
* Write the root `config.json`, recording the settings shared by every
|
|
66788
67478
|
* Worker, including the Vite mode the build ran in.
|
|
66789
67479
|
*
|
|
66790
|
-
* Written even when there
|
|
66791
|
-
* captured.
|
|
67480
|
+
* Written even when there are no account settings, so the build context is
|
|
67481
|
+
* always captured.
|
|
66792
67482
|
*/
|
|
66793
|
-
async function
|
|
67483
|
+
async function writeRoot() {
|
|
66794
67484
|
if (ctx.resolvedPluginConfig.type === "preview") return;
|
|
66795
|
-
const
|
|
66796
|
-
const settings =
|
|
66797
|
-
|
|
67485
|
+
const config$2 = ctx.resolvedPluginConfig.parsedNewConfig;
|
|
67486
|
+
const settings = config$2 && {
|
|
67487
|
+
accountId: config$2.accountId,
|
|
67488
|
+
complianceRegion: config$2.complianceRegion
|
|
67489
|
+
};
|
|
67490
|
+
await writeRootConfig(ctx.resolvedViteConfig.root, settings, {
|
|
67491
|
+
isPreview: isPreviewBuild(),
|
|
67492
|
+
mode: ctx.resolvedViteConfig.mode
|
|
67493
|
+
});
|
|
66798
67494
|
}
|
|
66799
67495
|
});
|
|
66800
67496
|
/**
|
|
@@ -73498,31 +74194,6 @@ async function dockerLoginImageRegistry(pathToDocker, domain$1) {
|
|
|
73498
74194
|
});
|
|
73499
74195
|
}
|
|
73500
74196
|
__name$2(dockerLoginImageRegistry, "dockerLoginImageRegistry");
|
|
73501
|
-
async function dockerImageInspect(dockerPath, options) {
|
|
73502
|
-
return new Promise((resolve2, reject) => {
|
|
73503
|
-
const proc = spawn(dockerPath, [
|
|
73504
|
-
"image",
|
|
73505
|
-
"inspect",
|
|
73506
|
-
options.imageTag,
|
|
73507
|
-
"--format",
|
|
73508
|
-
options.formatString
|
|
73509
|
-
], { stdio: [
|
|
73510
|
-
"ignore",
|
|
73511
|
-
"pipe",
|
|
73512
|
-
"pipe"
|
|
73513
|
-
] });
|
|
73514
|
-
let stdout$2 = "";
|
|
73515
|
-
let stderr$1 = "";
|
|
73516
|
-
proc.stdout.on("data", (chunk) => stdout$2 += chunk);
|
|
73517
|
-
proc.stderr.on("data", (chunk) => stderr$1 += chunk);
|
|
73518
|
-
proc.on("close", (code) => {
|
|
73519
|
-
if (code !== 0) return reject(new UserError(`failed inspecting image locally: ${stderr$1.trim()}`, { telemetryMessage: false }));
|
|
73520
|
-
resolve2(stdout$2.trim());
|
|
73521
|
-
});
|
|
73522
|
-
proc.on("error", (err) => reject(err));
|
|
73523
|
-
});
|
|
73524
|
-
}
|
|
73525
|
-
__name$2(dockerImageInspect, "dockerImageInspect");
|
|
73526
74197
|
var runDockerCmd = /* @__PURE__ */ __name$2((dockerPath, args, stdio) => {
|
|
73527
74198
|
let aborted$2 = false;
|
|
73528
74199
|
let resolve2;
|
|
@@ -73680,15 +74351,6 @@ var getContainerIdsFromImage = /* @__PURE__ */ __name$2((dockerPath, ancestorIma
|
|
|
73680
74351
|
"{{.ID}}"
|
|
73681
74352
|
]).split("\n").filter((line) => line.trim());
|
|
73682
74353
|
}, "getContainerIdsFromImage");
|
|
73683
|
-
async function checkExposedPorts(dockerPath, options) {
|
|
73684
|
-
if (await dockerImageInspect(dockerPath, {
|
|
73685
|
-
imageTag: options.image_tag,
|
|
73686
|
-
formatString: "{{ len .Config.ExposedPorts }}"
|
|
73687
|
-
}) === "0") throw new UserError(`The container "${options.image_name === void 0 ? options.class_name : `${options.class_name}.${options.image_name}`}" does not expose any ports. In your Dockerfile, please expose any ports you intend to connect to.
|
|
73688
|
-
For additional information please see: https://developers.cloudflare.com/containers/local-dev/#exposing-ports.
|
|
73689
|
-
`, { telemetryMessage: false });
|
|
73690
|
-
}
|
|
73691
|
-
__name$2(checkExposedPorts, "checkExposedPorts");
|
|
73692
74354
|
function generateContainerBuildId() {
|
|
73693
74355
|
return randomUUID().slice(0, 8);
|
|
73694
74356
|
}
|
|
@@ -73808,7 +74470,6 @@ async function prepareContainerImagesForDev(args) {
|
|
|
73808
74470
|
onContainerImagePreparationEnd({ containerOptions: options });
|
|
73809
74471
|
}
|
|
73810
74472
|
if (aborted$2) break;
|
|
73811
|
-
await checkExposedPorts(dockerPath, options);
|
|
73812
74473
|
}
|
|
73813
74474
|
if (!aborted$2) await pullEgressInterceptorImage(dockerPath);
|
|
73814
74475
|
return { aborted: aborted$2 };
|
|
@@ -73895,6 +74556,31 @@ function validateAndEncodeGarKey(rawKey, expectedEmail) {
|
|
|
73895
74556
|
return base64Key;
|
|
73896
74557
|
}
|
|
73897
74558
|
__name$2(validateAndEncodeGarKey, "validateAndEncodeGarKey");
|
|
74559
|
+
async function dockerImageInspect(dockerPath, options) {
|
|
74560
|
+
return new Promise((resolve2, reject) => {
|
|
74561
|
+
const proc = spawn(dockerPath, [
|
|
74562
|
+
"image",
|
|
74563
|
+
"inspect",
|
|
74564
|
+
options.imageTag,
|
|
74565
|
+
"--format",
|
|
74566
|
+
options.formatString
|
|
74567
|
+
], { stdio: [
|
|
74568
|
+
"ignore",
|
|
74569
|
+
"pipe",
|
|
74570
|
+
"pipe"
|
|
74571
|
+
] });
|
|
74572
|
+
let stdout$2 = "";
|
|
74573
|
+
let stderr$1 = "";
|
|
74574
|
+
proc.stdout.on("data", (chunk) => stdout$2 += chunk);
|
|
74575
|
+
proc.stderr.on("data", (chunk) => stderr$1 += chunk);
|
|
74576
|
+
proc.on("close", (code) => {
|
|
74577
|
+
if (code !== 0) return reject(new UserError(`failed inspecting image locally: ${stderr$1.trim()}`, { telemetryMessage: false }));
|
|
74578
|
+
resolve2(stdout$2.trim());
|
|
74579
|
+
});
|
|
74580
|
+
proc.on("error", (err) => reject(err));
|
|
74581
|
+
});
|
|
74582
|
+
}
|
|
74583
|
+
__name$2(dockerImageInspect, "dockerImageInspect");
|
|
73898
74584
|
var MB = 1e3 * 1e3;
|
|
73899
74585
|
var MiB = 1024 * 1024;
|
|
73900
74586
|
var instanceTypes = {
|
|
@@ -74409,15 +75095,15 @@ __name$2(dockerBuild, "dockerBuild");
|
|
|
74409
75095
|
var BUILD_OUTPUT_IMAGE_NAMESPACE = "cloudflare-build";
|
|
74410
75096
|
var DOCKER_REPOSITORY_NAME_LENGTH = 255;
|
|
74411
75097
|
async function buildAndWriteContainerOutput(options) {
|
|
74412
|
-
const containers = Object.entries(options.containers);
|
|
74413
|
-
await cleanupPreviousBuildOutputImageTags({
|
|
74414
|
-
root: options.root,
|
|
74415
|
-
pathToDocker: options.pathToDocker
|
|
74416
|
-
});
|
|
74417
|
-
const buildId = createBuildId();
|
|
74418
75098
|
const localTags = /* @__PURE__ */ new Set();
|
|
74419
75099
|
try {
|
|
74420
|
-
const
|
|
75100
|
+
const containers = resolveContainerDirectories(options.containers);
|
|
75101
|
+
await cleanupPreviousBuildOutputImageTags({
|
|
75102
|
+
root: options.root,
|
|
75103
|
+
pathToDocker: options.pathToDocker
|
|
75104
|
+
});
|
|
75105
|
+
const buildId = createBuildId();
|
|
75106
|
+
const dockerfileCount = countDockerfiles(options.containers);
|
|
74421
75107
|
if (dockerfileCount > 0) await verifyDockerInstalled({
|
|
74422
75108
|
dockerPath: options.pathToDocker,
|
|
74423
75109
|
operation: "building the project",
|
|
@@ -74425,7 +75111,7 @@ async function buildAndWriteContainerOutput(options) {
|
|
|
74425
75111
|
});
|
|
74426
75112
|
const outputConfigs = [];
|
|
74427
75113
|
try {
|
|
74428
|
-
for (const
|
|
75114
|
+
for (const { config: config$2, directoryName } of containers) outputConfigs.push({
|
|
74429
75115
|
root: options.root,
|
|
74430
75116
|
directoryName,
|
|
74431
75117
|
config: await buildContainerOutputConfig({
|
|
@@ -74446,6 +75132,20 @@ async function buildAndWriteContainerOutput(options) {
|
|
|
74446
75132
|
}
|
|
74447
75133
|
}
|
|
74448
75134
|
__name$2(buildAndWriteContainerOutput, "buildAndWriteContainerOutput");
|
|
75135
|
+
function resolveContainerDirectories(containers) {
|
|
75136
|
+
const containerNameByDirectory = /* @__PURE__ */ new Map();
|
|
75137
|
+
return containers.map((config$2) => {
|
|
75138
|
+
const directoryName = normalizeDirectoryName(config$2.name);
|
|
75139
|
+
const conflictingName = containerNameByDirectory.get(directoryName);
|
|
75140
|
+
if (conflictingName !== void 0) throw new UserError(`Container names ${JSON.stringify(conflictingName)} and ${JSON.stringify(config$2.name)} resolve to the same Build Output directory ${JSON.stringify(directoryName)}. Rename one of the Containers.`, { telemetryMessage: "container build output directory name conflict" });
|
|
75141
|
+
containerNameByDirectory.set(directoryName, config$2.name);
|
|
75142
|
+
return {
|
|
75143
|
+
config: config$2,
|
|
75144
|
+
directoryName
|
|
75145
|
+
};
|
|
75146
|
+
});
|
|
75147
|
+
}
|
|
75148
|
+
__name$2(resolveContainerDirectories, "resolveContainerDirectories");
|
|
74449
75149
|
async function buildContainerOutputConfig(options) {
|
|
74450
75150
|
if (options.config.schedulingPolicy === "durable-object") {
|
|
74451
75151
|
if (options.config.images === void 0) return {
|
|
@@ -74543,7 +75243,7 @@ function createBuildId() {
|
|
|
74543
75243
|
__name$2(createBuildId, "createBuildId");
|
|
74544
75244
|
function countDockerfiles(containers) {
|
|
74545
75245
|
let count = 0;
|
|
74546
|
-
for (const
|
|
75246
|
+
for (const config$2 of containers) if (config$2.schedulingPolicy === "durable-object") count += Object.values(config$2.images ?? {}).filter((image) => "dockerfile" in image).length;
|
|
74547
75247
|
else if ("dockerfile" in config$2.image) count++;
|
|
74548
75248
|
return count;
|
|
74549
75249
|
}
|
|
@@ -75350,7 +76050,7 @@ async function buildOutputContainers(resolvedPluginConfig, root) {
|
|
|
75350
76050
|
const config$2 = resolvedPluginConfig.parsedNewConfig;
|
|
75351
76051
|
if (config$2 === void 0) return;
|
|
75352
76052
|
await buildAndWriteContainerOutput({
|
|
75353
|
-
containers:
|
|
76053
|
+
containers: config$2.containers,
|
|
75354
76054
|
root,
|
|
75355
76055
|
pathToDocker: getDockerPath$1()
|
|
75356
76056
|
});
|
|
@@ -81392,7 +82092,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
81392
82092
|
//#endregion
|
|
81393
82093
|
//#region ../remote-bindings/dist/index.mjs
|
|
81394
82094
|
var import_undici = require_undici();
|
|
81395
|
-
var version$2 = "0.0.
|
|
82095
|
+
var version$2 = "0.0.29";
|
|
81396
82096
|
var NoDefaultValueProvided = class extends UserError {
|
|
81397
82097
|
constructor() {
|
|
81398
82098
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|