wrangler 4.33.2 → 4.35.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/config-schema.json +49 -2
- package/package.json +12 -12
- package/templates/startDevWorker/InspectorProxyWorker.ts +1 -1
- package/wrangler-dist/InspectorProxyWorker.js +6 -2
- package/wrangler-dist/cli.d.ts +40 -1
- package/wrangler-dist/cli.js +1160 -1019
- package/wrangler-dist/metafile-cjs.json +1 -1
package/wrangler-dist/cli.js
CHANGED
@@ -33841,7 +33841,7 @@ var name, version;
|
|
33841
33841
|
var init_package = __esm({
|
33842
33842
|
"package.json"() {
|
33843
33843
|
name = "wrangler";
|
33844
|
-
version = "4.
|
33844
|
+
version = "4.35.0";
|
33845
33845
|
}
|
33846
33846
|
});
|
33847
33847
|
|
@@ -40833,12 +40833,15 @@ var init_interactive = __esm({
|
|
40833
40833
|
const helpText = config.helpText ?? "";
|
40834
40834
|
const format9 = config.format ?? ((val2) => String(val2));
|
40835
40835
|
const defaultValue = config.defaultValue?.toString() ?? "";
|
40836
|
-
const activeRenderer = /* @__PURE__ */ __name((
|
40837
|
-
|
40838
|
-
|
40839
|
-
|
40840
|
-
|
40841
|
-
|
40836
|
+
const activeRenderer = /* @__PURE__ */ __name((props) => {
|
40837
|
+
const { valueWithCursor } = props;
|
40838
|
+
return [
|
40839
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
40840
|
+
`${space(2)}${format9(valueWithCursor || dim(defaultValue))}`,
|
40841
|
+
``
|
40842
|
+
// extra line for readability
|
40843
|
+
];
|
40844
|
+
}, "activeRenderer");
|
40842
40845
|
return {
|
40843
40846
|
initial: /* @__PURE__ */ __name(() => [
|
40844
40847
|
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
@@ -45300,7 +45303,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
45300
45303
|
rawEnv,
|
45301
45304
|
"preview_urls",
|
45302
45305
|
isBoolean,
|
45303
|
-
|
45306
|
+
void 0
|
45304
45307
|
);
|
45305
45308
|
const build5 = normalizeAndValidateBuild(
|
45306
45309
|
diagnostics,
|
@@ -45992,6 +45995,7 @@ function validateContainerApp(envName, topLevelName, configPath) {
|
|
45992
45995
|
"instance_type",
|
45993
45996
|
"configuration",
|
45994
45997
|
"constraints",
|
45998
|
+
"affinities",
|
45995
45999
|
"rollout_step_percentage",
|
45996
46000
|
"rollout_kind",
|
45997
46001
|
"durable_objects",
|
@@ -47817,6 +47821,11 @@ ${resolution}`);
|
|
47817
47821
|
key: "logs.enabled",
|
47818
47822
|
value: val2.logs?.enabled,
|
47819
47823
|
type: "boolean"
|
47824
|
+
},
|
47825
|
+
{
|
47826
|
+
key: "traces.enabled",
|
47827
|
+
value: val2.traces?.enabled,
|
47828
|
+
type: "boolean"
|
47820
47829
|
}
|
47821
47830
|
]) && isValid2;
|
47822
47831
|
isValid2 = validateOptionalProperty(
|
@@ -47827,10 +47836,18 @@ ${resolution}`);
|
|
47827
47836
|
"number"
|
47828
47837
|
) && isValid2;
|
47829
47838
|
isValid2 = validateOptionalProperty(diagnostics, field, "logs", val2.logs, "object") && isValid2;
|
47839
|
+
isValid2 = validateOptionalProperty(
|
47840
|
+
diagnostics,
|
47841
|
+
field,
|
47842
|
+
"traces",
|
47843
|
+
val2.traces,
|
47844
|
+
"object"
|
47845
|
+
) && isValid2;
|
47830
47846
|
isValid2 = validateAdditionalProperties(diagnostics, field, Object.keys(val2), [
|
47831
47847
|
"enabled",
|
47832
47848
|
"head_sampling_rate",
|
47833
|
-
"logs"
|
47849
|
+
"logs",
|
47850
|
+
"traces"
|
47834
47851
|
]) && isValid2;
|
47835
47852
|
if (typeof val2.logs === "object") {
|
47836
47853
|
isValid2 = validateOptionalProperty(
|
@@ -47854,12 +47871,47 @@ ${resolution}`);
|
|
47854
47871
|
val2.logs.invocation_logs,
|
47855
47872
|
"boolean"
|
47856
47873
|
) && isValid2;
|
47874
|
+
isValid2 = validateOptionalTypedArray(
|
47875
|
+
diagnostics,
|
47876
|
+
"logs.destinations",
|
47877
|
+
val2.logs?.destinations,
|
47878
|
+
"string"
|
47879
|
+
) && isValid2;
|
47857
47880
|
isValid2 = validateAdditionalProperties(diagnostics, field, Object.keys(val2.logs), [
|
47858
47881
|
"enabled",
|
47859
47882
|
"head_sampling_rate",
|
47860
|
-
"invocation_logs"
|
47883
|
+
"invocation_logs",
|
47884
|
+
"destinations"
|
47861
47885
|
]) && isValid2;
|
47862
47886
|
}
|
47887
|
+
if (typeof val2.traces === "object") {
|
47888
|
+
isValid2 = validateOptionalProperty(
|
47889
|
+
diagnostics,
|
47890
|
+
field,
|
47891
|
+
"traces.enabled",
|
47892
|
+
val2.traces.enabled,
|
47893
|
+
"boolean"
|
47894
|
+
) && isValid2;
|
47895
|
+
isValid2 = validateOptionalProperty(
|
47896
|
+
diagnostics,
|
47897
|
+
field,
|
47898
|
+
"traces.head_sampling_rate",
|
47899
|
+
val2.traces.head_sampling_rate,
|
47900
|
+
"number"
|
47901
|
+
) && isValid2;
|
47902
|
+
isValid2 = validateOptionalTypedArray(
|
47903
|
+
diagnostics,
|
47904
|
+
"traces.destinations",
|
47905
|
+
val2.traces?.destinations,
|
47906
|
+
"string"
|
47907
|
+
) && isValid2;
|
47908
|
+
isValid2 = validateAdditionalProperties(
|
47909
|
+
diagnostics,
|
47910
|
+
field,
|
47911
|
+
Object.keys(val2.traces),
|
47912
|
+
["enabled", "head_sampling_rate", "destinations"]
|
47913
|
+
) && isValid2;
|
47914
|
+
}
|
47863
47915
|
const samplingRate = val2?.head_sampling_rate;
|
47864
47916
|
if (samplingRate && (samplingRate < 0 || samplingRate > 1)) {
|
47865
47917
|
diagnostics.errors.push(
|
@@ -47947,7 +47999,7 @@ var init_config = __esm({
|
|
47947
47999
|
preserve_file_names: void 0,
|
47948
48000
|
base_dir: void 0,
|
47949
48001
|
workers_dev: void 0,
|
47950
|
-
preview_urls:
|
48002
|
+
preview_urls: void 0,
|
47951
48003
|
route: void 0,
|
47952
48004
|
routes: void 0,
|
47953
48005
|
tsconfig: void 0,
|
@@ -53488,7 +53540,7 @@ var init_class_names_sqlite = __esm({
|
|
53488
53540
|
});
|
53489
53541
|
|
53490
53542
|
// ../workers-shared/utils/constants.ts
|
53491
|
-
var PATH_HASH_SIZE, CONTENT_HASH_SIZE, TAIL_SIZE, ENTRY_SIZE,
|
53543
|
+
var PATH_HASH_SIZE, CONTENT_HASH_SIZE, TAIL_SIZE, ENTRY_SIZE, MAX_ASSET_SIZE2, CF_ASSETS_IGNORE_FILENAME, REDIRECTS_FILENAME, HEADERS_FILENAME;
|
53492
53544
|
var init_constants2 = __esm({
|
53493
53545
|
"../workers-shared/utils/constants.ts"() {
|
53494
53546
|
init_import_meta_url();
|
@@ -53496,7 +53548,6 @@ var init_constants2 = __esm({
|
|
53496
53548
|
CONTENT_HASH_SIZE = 16;
|
53497
53549
|
TAIL_SIZE = 8;
|
53498
53550
|
ENTRY_SIZE = PATH_HASH_SIZE + CONTENT_HASH_SIZE + TAIL_SIZE;
|
53499
|
-
MAX_ASSET_COUNT2 = 2e4;
|
53500
53551
|
MAX_ASSET_SIZE2 = 25 * 1024 * 1024;
|
53501
53552
|
CF_ASSETS_IGNORE_FILENAME = ".assetsignore";
|
53502
53553
|
REDIRECTS_FILENAME = "_redirects";
|
@@ -60548,6 +60599,16 @@ var init_BaseController = __esm({
|
|
60548
60599
|
}
|
60549
60600
|
});
|
60550
60601
|
|
60602
|
+
// src/utils/assert-never.ts
|
60603
|
+
function assertNever(_value) {
|
60604
|
+
}
|
60605
|
+
var init_assert_never = __esm({
|
60606
|
+
"src/utils/assert-never.ts"() {
|
60607
|
+
init_import_meta_url();
|
60608
|
+
__name(assertNever, "assertNever");
|
60609
|
+
}
|
60610
|
+
});
|
60611
|
+
|
60551
60612
|
// src/api/startDevWorker/utils.ts
|
60552
60613
|
function createDeferred(previousDeferred) {
|
60553
60614
|
let resolve25, reject;
|
@@ -60564,8 +60625,6 @@ function createDeferred(previousDeferred) {
|
|
60564
60625
|
reject
|
60565
60626
|
};
|
60566
60627
|
}
|
60567
|
-
function assertNever(_value) {
|
60568
|
-
}
|
60569
60628
|
function unwrapHook(hook, ...args) {
|
60570
60629
|
return typeof hook === "function" ? hook(...args) : hook;
|
60571
60630
|
}
|
@@ -60582,6 +60641,18 @@ function convertConfigBindingsToStartWorkerBindings(configBindings) {
|
|
60582
60641
|
const { queues, ...bindings } = configBindings;
|
60583
60642
|
return convertCfWorkerInitBindingsToBindings({
|
60584
60643
|
...bindings,
|
60644
|
+
kv_namespaces: bindings.kv_namespaces.map((kv) => ({
|
60645
|
+
...kv,
|
60646
|
+
id: kv.preview_id ?? kv.id
|
60647
|
+
})),
|
60648
|
+
d1_databases: bindings.d1_databases.map((d1) => ({
|
60649
|
+
...d1,
|
60650
|
+
database_id: d1.preview_database_id ?? d1.database_id
|
60651
|
+
})),
|
60652
|
+
r2_buckets: bindings.r2_buckets.map((r22) => ({
|
60653
|
+
...r22,
|
60654
|
+
bucket_name: r22.preview_bucket_name ?? r22.bucket_name
|
60655
|
+
})),
|
60585
60656
|
queues: queues.producers?.map((q6) => ({ ...q6, queue_name: q6.queue }))
|
60586
60657
|
});
|
60587
60658
|
}
|
@@ -60916,8 +60987,8 @@ var init_utils2 = __esm({
|
|
60916
60987
|
init_import_meta_url();
|
60917
60988
|
import_node_assert6 = __toESM(require("assert"));
|
60918
60989
|
import_promises5 = require("fs/promises");
|
60990
|
+
init_assert_never();
|
60919
60991
|
__name(createDeferred, "createDeferred");
|
60920
|
-
__name(assertNever, "assertNever");
|
60921
60992
|
__name(unwrapHook, "unwrapHook");
|
60922
60993
|
__name(getBinaryFileContents, "getBinaryFileContents");
|
60923
60994
|
__name(convertConfigBindingsToStartWorkerBindings, "convertConfigBindingsToStartWorkerBindings");
|
@@ -68974,7 +69045,7 @@ var init_containers2 = __esm({
|
|
68974
69045
|
}
|
68975
69046
|
});
|
68976
69047
|
|
68977
|
-
// src/
|
69048
|
+
// src/utils/diff.ts
|
68978
69049
|
function tokenize(value) {
|
68979
69050
|
const retLines = [];
|
68980
69051
|
const linesAndNewlines = value.split(/(\n|\r\n)/);
|
@@ -68989,7 +69060,7 @@ function tokenize(value) {
|
|
68989
69060
|
}
|
68990
69061
|
var Diff;
|
68991
69062
|
var init_diff = __esm({
|
68992
|
-
"src/
|
69063
|
+
"src/utils/diff.ts"() {
|
68993
69064
|
init_import_meta_url();
|
68994
69065
|
init_cli();
|
68995
69066
|
init_colors();
|
@@ -69414,6 +69485,7 @@ function containerConfigToCreateRequest(accountId, containerApp, imageRef, durab
|
|
69414
69485
|
instances: 0,
|
69415
69486
|
max_instances: containerApp.max_instances,
|
69416
69487
|
constraints: containerApp.constraints,
|
69488
|
+
affinities: containerApp.affinities,
|
69417
69489
|
durable_objects: {
|
69418
69490
|
namespace_id: durableObjectNamespaceId
|
69419
69491
|
},
|
@@ -69573,11 +69645,11 @@ var init_deploy = __esm({
|
|
69573
69645
|
init_colors();
|
69574
69646
|
init_containers_shared();
|
69575
69647
|
init_common();
|
69576
|
-
init_diff();
|
69577
69648
|
init_instance_type();
|
69578
69649
|
init_config2();
|
69579
69650
|
init_errors();
|
69580
69651
|
init_user2();
|
69652
|
+
init_diff();
|
69581
69653
|
init_sortObjectRecursive();
|
69582
69654
|
__name(mergeDeep2, "mergeDeep");
|
69583
69655
|
__name(isObject, "isObject");
|
@@ -69896,6 +69968,16 @@ var init_deploy2 = __esm({
|
|
69896
69968
|
});
|
69897
69969
|
|
69898
69970
|
// src/containers/config.ts
|
69971
|
+
function convertContainerAffinitiesForApi(container) {
|
69972
|
+
if (container.affinities === void 0) {
|
69973
|
+
return void 0;
|
69974
|
+
}
|
69975
|
+
const affinities = {
|
69976
|
+
colocation: container.affinities?.colocation,
|
69977
|
+
hardware_generation: container.affinities?.hardware_generation
|
69978
|
+
};
|
69979
|
+
return affinities;
|
69980
|
+
}
|
69899
69981
|
var import_node_assert12, import_node_path23, getNormalizedContainerOptions;
|
69900
69982
|
var init_config3 = __esm({
|
69901
69983
|
"src/containers/config.ts"() {
|
@@ -69905,6 +69987,7 @@ var init_config3 = __esm({
|
|
69905
69987
|
init_containers_shared();
|
69906
69988
|
init_errors();
|
69907
69989
|
init_user2();
|
69990
|
+
__name(convertContainerAffinitiesForApi, "convertContainerAffinitiesForApi");
|
69908
69991
|
getNormalizedContainerOptions = /* @__PURE__ */ __name(async (config, args) => {
|
69909
69992
|
if (!config.containers || config.containers.length === 0) {
|
69910
69993
|
return [];
|
@@ -69933,7 +70016,7 @@ var init_config3 = __esm({
|
|
69933
70016
|
const shared = {
|
69934
70017
|
name: container.name,
|
69935
70018
|
class_name: container.class_name,
|
69936
|
-
max_instances: container.max_instances ??
|
70019
|
+
max_instances: container.max_instances ?? 1,
|
69937
70020
|
scheduling_policy: container.scheduling_policy ?? "default" /* DEFAULT */,
|
69938
70021
|
constraints: {
|
69939
70022
|
// if the tier is -1, then we allow all tiers
|
@@ -69947,6 +70030,7 @@ var init_config3 = __esm({
|
|
69947
70030
|
(city) => city.toLowerCase()
|
69948
70031
|
)
|
69949
70032
|
},
|
70033
|
+
affinities: convertContainerAffinitiesForApi(container),
|
69950
70034
|
rollout_step_percentage: args?.containersRollout === "immediate" ? 100 : container.rollout_step_percentage ?? rolloutStepPercentageFallback,
|
69951
70035
|
rollout_kind: container.rollout_kind ?? "full_auto",
|
69952
70036
|
rollout_active_grace_period: container.rollout_active_grace_period ?? 0,
|
@@ -72449,863 +72533,6 @@ var init_durable = __esm({
|
|
72449
72533
|
}
|
72450
72534
|
});
|
72451
72535
|
|
72452
|
-
// src/utils/compatibility-date.ts
|
72453
|
-
function getDevCompatibilityDate(config, compatibilityDate = config.compatibility_date) {
|
72454
|
-
const miniflareEntry = require.resolve("miniflare");
|
72455
|
-
const miniflareRequire = import_node_module3.default.createRequire(miniflareEntry);
|
72456
|
-
const miniflareWorkerd = miniflareRequire("workerd");
|
72457
|
-
const workerdDate = miniflareWorkerd.compatibilityDate;
|
72458
|
-
if (config.configPath !== void 0 && compatibilityDate === void 0) {
|
72459
|
-
logger.warn(
|
72460
|
-
`No compatibility_date was specified. Using the installed Workers runtime's latest supported date: ${workerdDate}.
|
72461
|
-
\u276F\u276F Add one to your ${configFileName(config.configPath)} file: compatibility_date = "${workerdDate}", or
|
72462
|
-
\u276F\u276F Pass it in your terminal: wrangler dev [<SCRIPT>] --compatibility-date=${workerdDate}
|
72463
|
-
|
72464
|
-
See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for more information.`
|
72465
|
-
);
|
72466
|
-
}
|
72467
|
-
return compatibilityDate ?? workerdDate;
|
72468
|
-
}
|
72469
|
-
function formatCompatibilityDate(date) {
|
72470
|
-
return date.toISOString().slice(0, 10);
|
72471
|
-
}
|
72472
|
-
var import_node_module3;
|
72473
|
-
var init_compatibility_date = __esm({
|
72474
|
-
"src/utils/compatibility-date.ts"() {
|
72475
|
-
init_import_meta_url();
|
72476
|
-
import_node_module3 = __toESM(require("module"));
|
72477
|
-
init_config2();
|
72478
|
-
init_logger();
|
72479
|
-
__name(getDevCompatibilityDate, "getDevCompatibilityDate");
|
72480
|
-
__name(formatCompatibilityDate, "formatCompatibilityDate");
|
72481
|
-
}
|
72482
|
-
});
|
72483
|
-
|
72484
|
-
// src/utils/create-batches.ts
|
72485
|
-
function* createBatches(array, size) {
|
72486
|
-
for (let i5 = 0; i5 < array.length; i5 += size) {
|
72487
|
-
yield array.slice(i5, i5 + size);
|
72488
|
-
}
|
72489
|
-
}
|
72490
|
-
var init_create_batches = __esm({
|
72491
|
-
"src/utils/create-batches.ts"() {
|
72492
|
-
init_import_meta_url();
|
72493
|
-
__name(createBatches, "createBatches");
|
72494
|
-
}
|
72495
|
-
});
|
72496
|
-
|
72497
|
-
// ../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/quote.js
|
72498
|
-
var require_quote = __commonJS({
|
72499
|
-
"../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/quote.js"(exports2, module3) {
|
72500
|
-
"use strict";
|
72501
|
-
init_import_meta_url();
|
72502
|
-
module3.exports = /* @__PURE__ */ __name(function quote2(xs) {
|
72503
|
-
return xs.map(function(s5) {
|
72504
|
-
if (s5 && typeof s5 === "object") {
|
72505
|
-
return s5.op.replace(/(.)/g, "\\$1");
|
72506
|
-
}
|
72507
|
-
if (/["\s]/.test(s5) && !/'/.test(s5)) {
|
72508
|
-
return "'" + s5.replace(/(['\\])/g, "\\$1") + "'";
|
72509
|
-
}
|
72510
|
-
if (/["'\s]/.test(s5)) {
|
72511
|
-
return '"' + s5.replace(/(["\\$`!])/g, "\\$1") + '"';
|
72512
|
-
}
|
72513
|
-
return String(s5).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, "$1\\$2");
|
72514
|
-
}).join(" ");
|
72515
|
-
}, "quote");
|
72516
|
-
}
|
72517
|
-
});
|
72518
|
-
|
72519
|
-
// ../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/parse.js
|
72520
|
-
var require_parse4 = __commonJS({
|
72521
|
-
"../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/parse.js"(exports2, module3) {
|
72522
|
-
"use strict";
|
72523
|
-
init_import_meta_url();
|
72524
|
-
var CONTROL = "(?:" + [
|
72525
|
-
"\\|\\|",
|
72526
|
-
"\\&\\&",
|
72527
|
-
";;",
|
72528
|
-
"\\|\\&",
|
72529
|
-
"\\<\\(",
|
72530
|
-
"\\<\\<\\<",
|
72531
|
-
">>",
|
72532
|
-
">\\&",
|
72533
|
-
"<\\&",
|
72534
|
-
"[&;()|<>]"
|
72535
|
-
].join("|") + ")";
|
72536
|
-
var controlRE = new RegExp("^" + CONTROL + "$");
|
72537
|
-
var META = "|&;()<> \\t";
|
72538
|
-
var SINGLE_QUOTE = '"((\\\\"|[^"])*?)"';
|
72539
|
-
var DOUBLE_QUOTE = "'((\\\\'|[^'])*?)'";
|
72540
|
-
var hash = /^#$/;
|
72541
|
-
var SQ = "'";
|
72542
|
-
var DQ = '"';
|
72543
|
-
var DS = "$";
|
72544
|
-
var TOKEN = "";
|
72545
|
-
var mult = 4294967296;
|
72546
|
-
for (i5 = 0; i5 < 4; i5++) {
|
72547
|
-
TOKEN += (mult * Math.random()).toString(16);
|
72548
|
-
}
|
72549
|
-
var i5;
|
72550
|
-
var startsWithToken = new RegExp("^" + TOKEN);
|
72551
|
-
function matchAll(s5, r7) {
|
72552
|
-
var origIndex = r7.lastIndex;
|
72553
|
-
var matches = [];
|
72554
|
-
var matchObj;
|
72555
|
-
while (matchObj = r7.exec(s5)) {
|
72556
|
-
matches.push(matchObj);
|
72557
|
-
if (r7.lastIndex === matchObj.index) {
|
72558
|
-
r7.lastIndex += 1;
|
72559
|
-
}
|
72560
|
-
}
|
72561
|
-
r7.lastIndex = origIndex;
|
72562
|
-
return matches;
|
72563
|
-
}
|
72564
|
-
__name(matchAll, "matchAll");
|
72565
|
-
function getVar(env6, pre, key) {
|
72566
|
-
var r7 = typeof env6 === "function" ? env6(key) : env6[key];
|
72567
|
-
if (typeof r7 === "undefined" && key != "") {
|
72568
|
-
r7 = "";
|
72569
|
-
} else if (typeof r7 === "undefined") {
|
72570
|
-
r7 = "$";
|
72571
|
-
}
|
72572
|
-
if (typeof r7 === "object") {
|
72573
|
-
return pre + TOKEN + JSON.stringify(r7) + TOKEN;
|
72574
|
-
}
|
72575
|
-
return pre + r7;
|
72576
|
-
}
|
72577
|
-
__name(getVar, "getVar");
|
72578
|
-
function parseInternal(string, env6, opts) {
|
72579
|
-
if (!opts) {
|
72580
|
-
opts = {};
|
72581
|
-
}
|
72582
|
-
var BS = opts.escape || "\\";
|
72583
|
-
var BAREWORD = "(\\" + BS + `['"` + META + `]|[^\\s'"` + META + "])+";
|
72584
|
-
var chunker = new RegExp([
|
72585
|
-
"(" + CONTROL + ")",
|
72586
|
-
// control chars
|
72587
|
-
"(" + BAREWORD + "|" + SINGLE_QUOTE + "|" + DOUBLE_QUOTE + ")+"
|
72588
|
-
].join("|"), "g");
|
72589
|
-
var matches = matchAll(string, chunker);
|
72590
|
-
if (matches.length === 0) {
|
72591
|
-
return [];
|
72592
|
-
}
|
72593
|
-
if (!env6) {
|
72594
|
-
env6 = {};
|
72595
|
-
}
|
72596
|
-
var commented = false;
|
72597
|
-
return matches.map(function(match2) {
|
72598
|
-
var s5 = match2[0];
|
72599
|
-
if (!s5 || commented) {
|
72600
|
-
return void 0;
|
72601
|
-
}
|
72602
|
-
if (controlRE.test(s5)) {
|
72603
|
-
return { op: s5 };
|
72604
|
-
}
|
72605
|
-
var quote2 = false;
|
72606
|
-
var esc = false;
|
72607
|
-
var out = "";
|
72608
|
-
var isGlob = false;
|
72609
|
-
var i6;
|
72610
|
-
function parseEnvVar() {
|
72611
|
-
i6 += 1;
|
72612
|
-
var varend;
|
72613
|
-
var varname;
|
72614
|
-
var char = s5.charAt(i6);
|
72615
|
-
if (char === "{") {
|
72616
|
-
i6 += 1;
|
72617
|
-
if (s5.charAt(i6) === "}") {
|
72618
|
-
throw new Error("Bad substitution: " + s5.slice(i6 - 2, i6 + 1));
|
72619
|
-
}
|
72620
|
-
varend = s5.indexOf("}", i6);
|
72621
|
-
if (varend < 0) {
|
72622
|
-
throw new Error("Bad substitution: " + s5.slice(i6));
|
72623
|
-
}
|
72624
|
-
varname = s5.slice(i6, varend);
|
72625
|
-
i6 = varend;
|
72626
|
-
} else if (/[*@#?$!_-]/.test(char)) {
|
72627
|
-
varname = char;
|
72628
|
-
i6 += 1;
|
72629
|
-
} else {
|
72630
|
-
var slicedFromI = s5.slice(i6);
|
72631
|
-
varend = slicedFromI.match(/[^\w\d_]/);
|
72632
|
-
if (!varend) {
|
72633
|
-
varname = slicedFromI;
|
72634
|
-
i6 = s5.length;
|
72635
|
-
} else {
|
72636
|
-
varname = slicedFromI.slice(0, varend.index);
|
72637
|
-
i6 += varend.index - 1;
|
72638
|
-
}
|
72639
|
-
}
|
72640
|
-
return getVar(env6, "", varname);
|
72641
|
-
}
|
72642
|
-
__name(parseEnvVar, "parseEnvVar");
|
72643
|
-
for (i6 = 0; i6 < s5.length; i6++) {
|
72644
|
-
var c6 = s5.charAt(i6);
|
72645
|
-
isGlob = isGlob || !quote2 && (c6 === "*" || c6 === "?");
|
72646
|
-
if (esc) {
|
72647
|
-
out += c6;
|
72648
|
-
esc = false;
|
72649
|
-
} else if (quote2) {
|
72650
|
-
if (c6 === quote2) {
|
72651
|
-
quote2 = false;
|
72652
|
-
} else if (quote2 == SQ) {
|
72653
|
-
out += c6;
|
72654
|
-
} else {
|
72655
|
-
if (c6 === BS) {
|
72656
|
-
i6 += 1;
|
72657
|
-
c6 = s5.charAt(i6);
|
72658
|
-
if (c6 === DQ || c6 === BS || c6 === DS) {
|
72659
|
-
out += c6;
|
72660
|
-
} else {
|
72661
|
-
out += BS + c6;
|
72662
|
-
}
|
72663
|
-
} else if (c6 === DS) {
|
72664
|
-
out += parseEnvVar();
|
72665
|
-
} else {
|
72666
|
-
out += c6;
|
72667
|
-
}
|
72668
|
-
}
|
72669
|
-
} else if (c6 === DQ || c6 === SQ) {
|
72670
|
-
quote2 = c6;
|
72671
|
-
} else if (controlRE.test(c6)) {
|
72672
|
-
return { op: s5 };
|
72673
|
-
} else if (hash.test(c6)) {
|
72674
|
-
commented = true;
|
72675
|
-
var commentObj = { comment: string.slice(match2.index + i6 + 1) };
|
72676
|
-
if (out.length) {
|
72677
|
-
return [out, commentObj];
|
72678
|
-
}
|
72679
|
-
return [commentObj];
|
72680
|
-
} else if (c6 === BS) {
|
72681
|
-
esc = true;
|
72682
|
-
} else if (c6 === DS) {
|
72683
|
-
out += parseEnvVar();
|
72684
|
-
} else {
|
72685
|
-
out += c6;
|
72686
|
-
}
|
72687
|
-
}
|
72688
|
-
if (isGlob) {
|
72689
|
-
return { op: "glob", pattern: out };
|
72690
|
-
}
|
72691
|
-
return out;
|
72692
|
-
}).reduce(function(prev, arg) {
|
72693
|
-
return typeof arg === "undefined" ? prev : prev.concat(arg);
|
72694
|
-
}, []);
|
72695
|
-
}
|
72696
|
-
__name(parseInternal, "parseInternal");
|
72697
|
-
module3.exports = /* @__PURE__ */ __name(function parse7(s5, env6, opts) {
|
72698
|
-
var mapped = parseInternal(s5, env6, opts);
|
72699
|
-
if (typeof env6 !== "function") {
|
72700
|
-
return mapped;
|
72701
|
-
}
|
72702
|
-
return mapped.reduce(function(acc, s6) {
|
72703
|
-
if (typeof s6 === "object") {
|
72704
|
-
return acc.concat(s6);
|
72705
|
-
}
|
72706
|
-
var xs = s6.split(RegExp("(" + TOKEN + ".*?" + TOKEN + ")", "g"));
|
72707
|
-
if (xs.length === 1) {
|
72708
|
-
return acc.concat(xs[0]);
|
72709
|
-
}
|
72710
|
-
return acc.concat(xs.filter(Boolean).map(function(x6) {
|
72711
|
-
if (startsWithToken.test(x6)) {
|
72712
|
-
return JSON.parse(x6.split(TOKEN)[1]);
|
72713
|
-
}
|
72714
|
-
return x6;
|
72715
|
-
}));
|
72716
|
-
}, []);
|
72717
|
-
}, "parse");
|
72718
|
-
}
|
72719
|
-
});
|
72720
|
-
|
72721
|
-
// ../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/index.js
|
72722
|
-
var require_shell_quote = __commonJS({
|
72723
|
-
"../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/index.js"(exports2) {
|
72724
|
-
"use strict";
|
72725
|
-
init_import_meta_url();
|
72726
|
-
exports2.quote = require_quote();
|
72727
|
-
exports2.parse = require_parse4();
|
72728
|
-
}
|
72729
|
-
});
|
72730
|
-
|
72731
|
-
// src/utils/shell-quote.ts
|
72732
|
-
function parse4(cmd, env6) {
|
72733
|
-
if (process.platform === "win32") {
|
72734
|
-
cmd = cmd.replaceAll("\\", "\\\\");
|
72735
|
-
}
|
72736
|
-
const entries = import_shell_quote.default.parse(cmd, env6);
|
72737
|
-
const argv = [];
|
72738
|
-
for (const entry of entries) {
|
72739
|
-
if (typeof entry === "string") {
|
72740
|
-
argv.push(entry);
|
72741
|
-
continue;
|
72742
|
-
}
|
72743
|
-
if ("comment" in entry) {
|
72744
|
-
continue;
|
72745
|
-
}
|
72746
|
-
if (entry.op === "glob") {
|
72747
|
-
argv.push(entry.pattern);
|
72748
|
-
continue;
|
72749
|
-
}
|
72750
|
-
throw new Error(
|
72751
|
-
`Only simple commands are supported, please don't use the "${entry.op}" operator in "${cmd}".`
|
72752
|
-
);
|
72753
|
-
}
|
72754
|
-
return argv;
|
72755
|
-
}
|
72756
|
-
var import_shell_quote, quote;
|
72757
|
-
var init_shell_quote = __esm({
|
72758
|
-
"src/utils/shell-quote.ts"() {
|
72759
|
-
init_import_meta_url();
|
72760
|
-
import_shell_quote = __toESM(require_shell_quote());
|
72761
|
-
quote = /* @__PURE__ */ __name(function(args) {
|
72762
|
-
const stringArgs = args.map((arg) => String(arg));
|
72763
|
-
return import_shell_quote.default.quote(stringArgs);
|
72764
|
-
}, "quote");
|
72765
|
-
__name(parse4, "parse");
|
72766
|
-
}
|
72767
|
-
});
|
72768
|
-
|
72769
|
-
// src/init.ts
|
72770
|
-
function isNpm(packageManager) {
|
72771
|
-
return packageManager.type === "npm";
|
72772
|
-
}
|
72773
|
-
async function downloadWorkerConfig(accountId, workerName, entrypoint, serviceEnvironment) {
|
72774
|
-
const [
|
72775
|
-
bindings,
|
72776
|
-
routes,
|
72777
|
-
customDomains,
|
72778
|
-
workersDev,
|
72779
|
-
serviceEnvMetadata,
|
72780
|
-
cronTriggers
|
72781
|
-
] = await Promise.all([
|
72782
|
-
fetchResult(
|
72783
|
-
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
72784
|
-
`/accounts/${accountId}/workers/services/${workerName}/environments/${serviceEnvironment}/bindings`
|
72785
|
-
),
|
72786
|
-
fetchResult(
|
72787
|
-
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
72788
|
-
`/accounts/${accountId}/workers/services/${workerName}/environments/${serviceEnvironment}/routes?show_zonename=true`
|
72789
|
-
),
|
72790
|
-
fetchResult(
|
72791
|
-
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
72792
|
-
`/accounts/${accountId}/workers/domains/records?page=0&per_page=5&service=${workerName}&environment=${serviceEnvironment}`
|
72793
|
-
),
|
72794
|
-
fetchResult(
|
72795
|
-
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
72796
|
-
`/accounts/${accountId}/workers/services/${workerName}/environments/${serviceEnvironment}/subdomain`
|
72797
|
-
),
|
72798
|
-
fetchResult(
|
72799
|
-
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
72800
|
-
`/accounts/${accountId}/workers/services/${workerName}/environments/${serviceEnvironment}`
|
72801
|
-
),
|
72802
|
-
fetchResult(
|
72803
|
-
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
72804
|
-
`/accounts/${accountId}/workers/scripts/${workerName}/schedules`
|
72805
|
-
)
|
72806
|
-
]).catch((e7) => {
|
72807
|
-
throw new Error(
|
72808
|
-
`Error Occurred ${e7}: Unable to fetch bindings, routes, or services metadata from the dashboard. Please try again later.`
|
72809
|
-
);
|
72810
|
-
});
|
72811
|
-
const mappedBindings = await mapBindings(
|
72812
|
-
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
72813
|
-
accountId,
|
72814
|
-
bindings
|
72815
|
-
);
|
72816
|
-
const durableObjectClassNames = bindings.filter((binding) => binding.type === "durable_object_namespace").map(
|
72817
|
-
(durableObject) => durableObject.class_name
|
72818
|
-
);
|
72819
|
-
const allRoutes = [
|
72820
|
-
...routes.map(
|
72821
|
-
(r7) => ({ pattern: r7.pattern, zone_name: r7.zone_name })
|
72822
|
-
),
|
72823
|
-
...customDomains.map(
|
72824
|
-
(c6) => ({
|
72825
|
-
pattern: c6.hostname,
|
72826
|
-
zone_name: c6.zone_name,
|
72827
|
-
custom_domain: true
|
72828
|
-
})
|
72829
|
-
)
|
72830
|
-
];
|
72831
|
-
return {
|
72832
|
-
name: workerName,
|
72833
|
-
main: entrypoint,
|
72834
|
-
workers_dev: workersDev.enabled,
|
72835
|
-
compatibility_date: serviceEnvMetadata.script.compatibility_date ?? formatCompatibilityDate(/* @__PURE__ */ new Date()),
|
72836
|
-
compatibility_flags: serviceEnvMetadata.script.compatibility_flags,
|
72837
|
-
...allRoutes.length ? { routes: allRoutes } : {},
|
72838
|
-
placement: serviceEnvMetadata.script.placement_mode === "smart" ? { mode: "smart" } : void 0,
|
72839
|
-
limits: serviceEnvMetadata.script.limits,
|
72840
|
-
...durableObjectClassNames.length ? {
|
72841
|
-
migrations: [
|
72842
|
-
{
|
72843
|
-
tag: serviceEnvMetadata.script.migration_tag,
|
72844
|
-
new_classes: durableObjectClassNames
|
72845
|
-
}
|
72846
|
-
]
|
72847
|
-
} : {},
|
72848
|
-
...cronTriggers.schedules.length ? {
|
72849
|
-
triggers: {
|
72850
|
-
crons: cronTriggers.schedules.map((scheduled) => scheduled.cron)
|
72851
|
-
}
|
72852
|
-
} : {},
|
72853
|
-
tail_consumers: serviceEnvMetadata.script.tail_consumers ?? void 0,
|
72854
|
-
observability: serviceEnvMetadata.script.observability,
|
72855
|
-
...mappedBindings
|
72856
|
-
};
|
72857
|
-
}
|
72858
|
-
async function mapBindings(complianceConfig, accountId, bindings) {
|
72859
|
-
const d1BindingsWithInfo = {};
|
72860
|
-
await Promise.all(
|
72861
|
-
bindings.filter((binding) => binding.type === "d1").map(async (binding) => {
|
72862
|
-
const dbInfo = await getDatabaseInfoFromIdOrName(
|
72863
|
-
complianceConfig,
|
72864
|
-
accountId,
|
72865
|
-
binding.id
|
72866
|
-
);
|
72867
|
-
d1BindingsWithInfo[binding.id] = dbInfo;
|
72868
|
-
})
|
72869
|
-
);
|
72870
|
-
return bindings.filter((binding) => binding.type !== "secret_text").reduce((configObj, binding) => {
|
72871
|
-
switch (binding.type) {
|
72872
|
-
case "plain_text":
|
72873
|
-
{
|
72874
|
-
configObj.vars = {
|
72875
|
-
...configObj.vars ?? {},
|
72876
|
-
[binding.name]: binding.text
|
72877
|
-
};
|
72878
|
-
}
|
72879
|
-
break;
|
72880
|
-
case "json":
|
72881
|
-
{
|
72882
|
-
configObj.vars = {
|
72883
|
-
...configObj.vars ?? {},
|
72884
|
-
name: binding.name,
|
72885
|
-
json: binding.json
|
72886
|
-
};
|
72887
|
-
}
|
72888
|
-
break;
|
72889
|
-
case "kv_namespace":
|
72890
|
-
{
|
72891
|
-
configObj.kv_namespaces = [
|
72892
|
-
...configObj.kv_namespaces ?? [],
|
72893
|
-
{ id: binding.namespace_id, binding: binding.name }
|
72894
|
-
];
|
72895
|
-
}
|
72896
|
-
break;
|
72897
|
-
case "durable_object_namespace":
|
72898
|
-
{
|
72899
|
-
configObj.durable_objects = {
|
72900
|
-
bindings: [
|
72901
|
-
...configObj.durable_objects?.bindings ?? [],
|
72902
|
-
{
|
72903
|
-
name: binding.name,
|
72904
|
-
class_name: binding.class_name,
|
72905
|
-
script_name: binding.script_name,
|
72906
|
-
environment: binding.environment
|
72907
|
-
}
|
72908
|
-
]
|
72909
|
-
};
|
72910
|
-
}
|
72911
|
-
break;
|
72912
|
-
case "d1":
|
72913
|
-
{
|
72914
|
-
configObj.d1_databases = [
|
72915
|
-
...configObj.d1_databases ?? [],
|
72916
|
-
{
|
72917
|
-
binding: binding.name,
|
72918
|
-
database_id: binding.id,
|
72919
|
-
database_name: d1BindingsWithInfo[binding.id].name
|
72920
|
-
}
|
72921
|
-
];
|
72922
|
-
}
|
72923
|
-
break;
|
72924
|
-
case "browser":
|
72925
|
-
{
|
72926
|
-
configObj.browser = {
|
72927
|
-
binding: binding.name
|
72928
|
-
};
|
72929
|
-
}
|
72930
|
-
break;
|
72931
|
-
case "ai":
|
72932
|
-
{
|
72933
|
-
configObj.ai = {
|
72934
|
-
binding: binding.name
|
72935
|
-
};
|
72936
|
-
}
|
72937
|
-
break;
|
72938
|
-
case "images":
|
72939
|
-
{
|
72940
|
-
configObj.images = {
|
72941
|
-
binding: binding.name
|
72942
|
-
};
|
72943
|
-
}
|
72944
|
-
break;
|
72945
|
-
case "r2_bucket":
|
72946
|
-
{
|
72947
|
-
configObj.r2_buckets = [
|
72948
|
-
...configObj.r2_buckets ?? [],
|
72949
|
-
{
|
72950
|
-
binding: binding.name,
|
72951
|
-
bucket_name: binding.bucket_name,
|
72952
|
-
jurisdiction: binding.jurisdiction
|
72953
|
-
}
|
72954
|
-
];
|
72955
|
-
}
|
72956
|
-
break;
|
72957
|
-
case "secrets_store_secret":
|
72958
|
-
{
|
72959
|
-
configObj.secrets_store_secrets = [
|
72960
|
-
...configObj.secrets_store_secrets ?? [],
|
72961
|
-
{
|
72962
|
-
binding: binding.name,
|
72963
|
-
store_id: binding.store_id,
|
72964
|
-
secret_name: binding.secret_name
|
72965
|
-
}
|
72966
|
-
];
|
72967
|
-
}
|
72968
|
-
break;
|
72969
|
-
case "unsafe_hello_world": {
|
72970
|
-
configObj.unsafe_hello_world = [
|
72971
|
-
...configObj.unsafe_hello_world ?? [],
|
72972
|
-
{
|
72973
|
-
binding: binding.name,
|
72974
|
-
enable_timer: binding.enable_timer
|
72975
|
-
}
|
72976
|
-
];
|
72977
|
-
break;
|
72978
|
-
}
|
72979
|
-
case "service":
|
72980
|
-
{
|
72981
|
-
configObj.services = [
|
72982
|
-
...configObj.services ?? [],
|
72983
|
-
{
|
72984
|
-
binding: binding.name,
|
72985
|
-
service: binding.service,
|
72986
|
-
environment: binding.environment,
|
72987
|
-
entrypoint: binding.entrypoint
|
72988
|
-
}
|
72989
|
-
];
|
72990
|
-
}
|
72991
|
-
break;
|
72992
|
-
case "analytics_engine":
|
72993
|
-
{
|
72994
|
-
configObj.analytics_engine_datasets = [
|
72995
|
-
...configObj.analytics_engine_datasets ?? [],
|
72996
|
-
{ binding: binding.name, dataset: binding.dataset }
|
72997
|
-
];
|
72998
|
-
}
|
72999
|
-
break;
|
73000
|
-
case "dispatch_namespace":
|
73001
|
-
{
|
73002
|
-
configObj.dispatch_namespaces = [
|
73003
|
-
...configObj.dispatch_namespaces ?? [],
|
73004
|
-
{
|
73005
|
-
binding: binding.name,
|
73006
|
-
namespace: binding.namespace,
|
73007
|
-
...binding.outbound && {
|
73008
|
-
outbound: {
|
73009
|
-
service: binding.outbound.worker.service,
|
73010
|
-
environment: binding.outbound.worker.environment,
|
73011
|
-
parameters: binding.outbound.params?.map((p6) => p6.name) ?? []
|
73012
|
-
}
|
73013
|
-
}
|
73014
|
-
}
|
73015
|
-
];
|
73016
|
-
}
|
73017
|
-
break;
|
73018
|
-
case "logfwdr":
|
73019
|
-
{
|
73020
|
-
configObj.logfwdr = {
|
73021
|
-
bindings: [
|
73022
|
-
...configObj.logfwdr?.bindings ?? [],
|
73023
|
-
{ name: binding.name, destination: binding.destination }
|
73024
|
-
]
|
73025
|
-
};
|
73026
|
-
}
|
73027
|
-
break;
|
73028
|
-
case "wasm_module":
|
73029
|
-
{
|
73030
|
-
configObj.wasm_modules = {
|
73031
|
-
...configObj.wasm_modules ?? {},
|
73032
|
-
[binding.name]: binding.part
|
73033
|
-
};
|
73034
|
-
}
|
73035
|
-
break;
|
73036
|
-
case "text_blob":
|
73037
|
-
{
|
73038
|
-
configObj.text_blobs = {
|
73039
|
-
...configObj.text_blobs ?? {},
|
73040
|
-
[binding.name]: binding.part
|
73041
|
-
};
|
73042
|
-
}
|
73043
|
-
break;
|
73044
|
-
case "data_blob":
|
73045
|
-
{
|
73046
|
-
configObj.data_blobs = {
|
73047
|
-
...configObj.data_blobs ?? {},
|
73048
|
-
[binding.name]: binding.part
|
73049
|
-
};
|
73050
|
-
}
|
73051
|
-
break;
|
73052
|
-
case "secret_text":
|
73053
|
-
break;
|
73054
|
-
case "version_metadata": {
|
73055
|
-
{
|
73056
|
-
configObj.version_metadata = {
|
73057
|
-
binding: binding.name
|
73058
|
-
};
|
73059
|
-
}
|
73060
|
-
break;
|
73061
|
-
}
|
73062
|
-
case "send_email": {
|
73063
|
-
configObj.send_email = [
|
73064
|
-
...configObj.send_email ?? [],
|
73065
|
-
{
|
73066
|
-
name: binding.name,
|
73067
|
-
destination_address: binding.destination_address,
|
73068
|
-
allowed_destination_addresses: binding.allowed_destination_addresses
|
73069
|
-
}
|
73070
|
-
];
|
73071
|
-
break;
|
73072
|
-
}
|
73073
|
-
case "queue":
|
73074
|
-
configObj.queues ??= { producers: [] };
|
73075
|
-
configObj.queues.producers = [
|
73076
|
-
...configObj.queues.producers ?? [],
|
73077
|
-
{
|
73078
|
-
binding: binding.name,
|
73079
|
-
queue: binding.queue_name,
|
73080
|
-
delivery_delay: binding.delivery_delay
|
73081
|
-
}
|
73082
|
-
];
|
73083
|
-
break;
|
73084
|
-
case "vectorize":
|
73085
|
-
configObj.vectorize = [
|
73086
|
-
...configObj.vectorize ?? [],
|
73087
|
-
{
|
73088
|
-
binding: binding.name,
|
73089
|
-
index_name: binding.index_name
|
73090
|
-
}
|
73091
|
-
];
|
73092
|
-
break;
|
73093
|
-
case "hyperdrive":
|
73094
|
-
configObj.hyperdrive = [
|
73095
|
-
...configObj.hyperdrive ?? [],
|
73096
|
-
{
|
73097
|
-
binding: binding.name,
|
73098
|
-
id: binding.id
|
73099
|
-
}
|
73100
|
-
];
|
73101
|
-
break;
|
73102
|
-
case "mtls_certificate":
|
73103
|
-
configObj.mtls_certificates = [
|
73104
|
-
...configObj.mtls_certificates ?? [],
|
73105
|
-
{
|
73106
|
-
binding: binding.name,
|
73107
|
-
certificate_id: binding.certificate_id
|
73108
|
-
}
|
73109
|
-
];
|
73110
|
-
break;
|
73111
|
-
case "pipelines":
|
73112
|
-
configObj.pipelines = [
|
73113
|
-
...configObj.pipelines ?? [],
|
73114
|
-
{
|
73115
|
-
binding: binding.name,
|
73116
|
-
pipeline: binding.pipeline
|
73117
|
-
}
|
73118
|
-
];
|
73119
|
-
break;
|
73120
|
-
case "assets":
|
73121
|
-
throw new FatalError(
|
73122
|
-
"`wrangler init --from-dash` is not yet supported for Workers with Assets"
|
73123
|
-
);
|
73124
|
-
case "inherit":
|
73125
|
-
configObj.unsafe = {
|
73126
|
-
bindings: [...configObj.unsafe?.bindings ?? [], binding],
|
73127
|
-
metadata: configObj.unsafe?.metadata ?? void 0
|
73128
|
-
};
|
73129
|
-
break;
|
73130
|
-
case "workflow":
|
73131
|
-
{
|
73132
|
-
configObj.workflows = [
|
73133
|
-
...configObj.workflows ?? [],
|
73134
|
-
{
|
73135
|
-
binding: binding.name,
|
73136
|
-
name: binding.workflow_name,
|
73137
|
-
class_name: binding.class_name,
|
73138
|
-
script_name: binding.script_name
|
73139
|
-
}
|
73140
|
-
];
|
73141
|
-
}
|
73142
|
-
break;
|
73143
|
-
default: {
|
73144
|
-
configObj.unsafe = {
|
73145
|
-
bindings: [...configObj.unsafe?.bindings ?? [], binding],
|
73146
|
-
metadata: configObj.unsafe?.metadata ?? void 0
|
73147
|
-
};
|
73148
|
-
assertNever(binding);
|
73149
|
-
}
|
73150
|
-
}
|
73151
|
-
return configObj;
|
73152
|
-
}, {});
|
73153
|
-
}
|
73154
|
-
async function downloadWorker(accountId, workerName) {
|
73155
|
-
const serviceMetadata = await fetchResult(
|
73156
|
-
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
73157
|
-
`/accounts/${accountId}/workers/services/${workerName}`
|
73158
|
-
);
|
73159
|
-
const defaultEnvironment = serviceMetadata.default_environment.environment;
|
73160
|
-
const { entrypoint, modules } = await fetchWorkerDefinitionFromDash(
|
73161
|
-
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
73162
|
-
`/accounts/${accountId}/workers/services/${workerName}/environments/${defaultEnvironment}/content/v2`
|
73163
|
-
);
|
73164
|
-
const config = await downloadWorkerConfig(
|
73165
|
-
accountId,
|
73166
|
-
workerName,
|
73167
|
-
entrypoint,
|
73168
|
-
defaultEnvironment
|
73169
|
-
);
|
73170
|
-
return {
|
73171
|
-
modules,
|
73172
|
-
config
|
73173
|
-
};
|
73174
|
-
}
|
73175
|
-
var import_promises9, import_node_path27, import_toml5, init;
|
73176
|
-
var init_init = __esm({
|
73177
|
-
"src/init.ts"() {
|
73178
|
-
init_import_meta_url();
|
73179
|
-
import_promises9 = require("fs/promises");
|
73180
|
-
import_node_path27 = __toESM(require("path"));
|
73181
|
-
import_toml5 = __toESM(require_toml());
|
73182
|
-
init_execa();
|
73183
|
-
init_utils2();
|
73184
|
-
init_cfetch();
|
73185
|
-
init_internal();
|
73186
|
-
init_create_command();
|
73187
|
-
init_utils3();
|
73188
|
-
init_misc_variables();
|
73189
|
-
init_errors();
|
73190
|
-
init_logger();
|
73191
|
-
init_metrics_config();
|
73192
|
-
init_package_manager();
|
73193
|
-
init_user2();
|
73194
|
-
init_compatibility_date();
|
73195
|
-
init_create_batches();
|
73196
|
-
init_shell_quote();
|
73197
|
-
init = createCommand({
|
73198
|
-
metadata: {
|
73199
|
-
description: "\u{1F4E5} Initialize a basic Worker",
|
73200
|
-
owner: "Workers: Authoring and Testing",
|
73201
|
-
status: "stable"
|
73202
|
-
},
|
73203
|
-
args: {
|
73204
|
-
name: {
|
73205
|
-
describe: "The name of your worker",
|
73206
|
-
type: "string"
|
73207
|
-
},
|
73208
|
-
yes: {
|
73209
|
-
describe: 'Answer "yes" to any prompts for new projects',
|
73210
|
-
type: "boolean",
|
73211
|
-
alias: "y"
|
73212
|
-
},
|
73213
|
-
"from-dash": {
|
73214
|
-
describe: "The name of the Worker you wish to download from the Cloudflare dashboard for local development.",
|
73215
|
-
type: "string",
|
73216
|
-
requiresArg: true
|
73217
|
-
},
|
73218
|
-
"delegate-c3": {
|
73219
|
-
describe: "Delegate to Create Cloudflare CLI (C3)",
|
73220
|
-
type: "boolean",
|
73221
|
-
hidden: true,
|
73222
|
-
default: true,
|
73223
|
-
alias: "c3"
|
73224
|
-
}
|
73225
|
-
},
|
73226
|
-
behaviour: {
|
73227
|
-
provideConfig: false
|
73228
|
-
},
|
73229
|
-
positionalArgs: ["name"],
|
73230
|
-
async handler(args) {
|
73231
|
-
const yesFlag = args.yes ?? false;
|
73232
|
-
const packageManager = await getPackageManager();
|
73233
|
-
const name2 = args.fromDash ?? args.name;
|
73234
|
-
const c3Arguments = [
|
73235
|
-
...parse4(getC3CommandFromEnv()),
|
73236
|
-
...name2 ? [name2] : [],
|
73237
|
-
...yesFlag && isNpm(packageManager) ? ["-y"] : [],
|
73238
|
-
// --yes arg for npx
|
73239
|
-
...isNpm(packageManager) ? ["--"] : [],
|
73240
|
-
...args.fromDash ? ["--existing-script", args.fromDash] : [],
|
73241
|
-
...yesFlag ? ["--wrangler-defaults"] : []
|
73242
|
-
];
|
73243
|
-
const replacementC3Command = `\`${packageManager.type} ${c3Arguments.join(
|
73244
|
-
" "
|
73245
|
-
)}\``;
|
73246
|
-
if (args.fromDash && !args.delegateC3) {
|
73247
|
-
const accountId = await requireAuth({});
|
73248
|
-
try {
|
73249
|
-
await fetchResult(
|
73250
|
-
// `wrangler init` is not run from within a Workers project, so there will be no config file to define the compliance region.
|
73251
|
-
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
73252
|
-
`/accounts/${accountId}/workers/services/${args.fromDash}`
|
73253
|
-
);
|
73254
|
-
} catch (err) {
|
73255
|
-
if (err.code === 10090) {
|
73256
|
-
throw new UserError(
|
73257
|
-
"wrangler couldn't find a Worker with that name in your account.\nRun `wrangler whoami` to confirm you're logged into the correct account.",
|
73258
|
-
{
|
73259
|
-
telemetryMessage: true
|
73260
|
-
}
|
73261
|
-
);
|
73262
|
-
}
|
73263
|
-
throw err;
|
73264
|
-
}
|
73265
|
-
const creationDir = import_node_path27.default.join(process.cwd(), args.fromDash);
|
73266
|
-
await (0, import_promises9.mkdir)(creationDir, { recursive: true });
|
73267
|
-
const { modules, config } = await downloadWorker(
|
73268
|
-
accountId,
|
73269
|
-
args.fromDash
|
73270
|
-
);
|
73271
|
-
await (0, import_promises9.mkdir)(import_node_path27.default.join(creationDir, "./src"), {
|
73272
|
-
recursive: true
|
73273
|
-
});
|
73274
|
-
config.main = `src/${config.main}`;
|
73275
|
-
config.name = args.fromDash;
|
73276
|
-
for (const files of createBatches(modules, 10)) {
|
73277
|
-
await Promise.all(
|
73278
|
-
files.map(async (file) => {
|
73279
|
-
const filepath = import_node_path27.default.join(creationDir, `./src/${file.name}`);
|
73280
|
-
const directory = (0, import_node_path27.dirname)(filepath);
|
73281
|
-
await (0, import_promises9.mkdir)(directory, { recursive: true });
|
73282
|
-
await (0, import_promises9.writeFile)(filepath, file.stream());
|
73283
|
-
})
|
73284
|
-
);
|
73285
|
-
}
|
73286
|
-
await (0, import_promises9.writeFile)(
|
73287
|
-
import_node_path27.default.join(creationDir, "wrangler.toml"),
|
73288
|
-
import_toml5.default.stringify(config)
|
73289
|
-
);
|
73290
|
-
} else {
|
73291
|
-
logger.log(`\u{1F300} Running ${replacementC3Command}...`);
|
73292
|
-
const metricsConfig = readMetricsConfig();
|
73293
|
-
await execa(packageManager.type, c3Arguments, {
|
73294
|
-
stdio: "inherit",
|
73295
|
-
...metricsConfig.permission?.enabled === false && {
|
73296
|
-
env: { CREATE_CLOUDFLARE_TELEMETRY_DISABLED: "1" }
|
73297
|
-
}
|
73298
|
-
});
|
73299
|
-
}
|
73300
|
-
}
|
73301
|
-
});
|
73302
|
-
__name(isNpm, "isNpm");
|
73303
|
-
__name(downloadWorkerConfig, "downloadWorkerConfig");
|
73304
|
-
__name(mapBindings, "mapBindings");
|
73305
|
-
__name(downloadWorker, "downloadWorker");
|
73306
|
-
}
|
73307
|
-
});
|
73308
|
-
|
73309
72536
|
// ../../node_modules/.pnpm/xxhash-wasm@1.0.1/node_modules/xxhash-wasm/esm/xxhash-wasm.js
|
73310
72537
|
async function e() {
|
73311
72538
|
const { instance: { exports: { mem: e7, xxh32: n6, xxh64: r7, init32: i5, update32: o5, digest32: h6, init64: s5, update64: u5, digest64: g6 } } } = await WebAssembly.instantiate(t);
|
@@ -73373,7 +72600,7 @@ var init_xxhash_wasm = __esm({
|
|
73373
72600
|
|
73374
72601
|
// src/sites.ts
|
73375
72602
|
async function* getFilesInFolder(dirPath) {
|
73376
|
-
const files = await (0,
|
72603
|
+
const files = await (0, import_promises9.readdir)(dirPath, { withFileTypes: true });
|
73377
72604
|
for (const file of files) {
|
73378
72605
|
if (ALWAYS_IGNORE.has(file.name)) {
|
73379
72606
|
continue;
|
@@ -73382,9 +72609,9 @@ async function* getFilesInFolder(dirPath) {
|
|
73382
72609
|
continue;
|
73383
72610
|
}
|
73384
72611
|
if (file.isDirectory()) {
|
73385
|
-
yield* await getFilesInFolder(
|
72612
|
+
yield* await getFilesInFolder(path29.join(dirPath, file.name));
|
73386
72613
|
} else {
|
73387
|
-
yield
|
72614
|
+
yield path29.join(dirPath, file.name);
|
73388
72615
|
}
|
73389
72616
|
}
|
73390
72617
|
}
|
@@ -73392,11 +72619,11 @@ function hashFileContent(hasher, content) {
|
|
73392
72619
|
return hasher.h64ToString(content).substring(0, 10);
|
73393
72620
|
}
|
73394
72621
|
function hashAsset(hasher, filePath, content) {
|
73395
|
-
const extName =
|
73396
|
-
const baseName =
|
73397
|
-
const directory =
|
72622
|
+
const extName = path29.extname(filePath) || "";
|
72623
|
+
const baseName = path29.basename(filePath, extName);
|
72624
|
+
const directory = path29.dirname(filePath);
|
73398
72625
|
const hash = hashFileContent(hasher, content);
|
73399
|
-
return urlSafe(
|
72626
|
+
return urlSafe(path29.join(directory, `${baseName}.${hash}${extName}`));
|
73400
72627
|
}
|
73401
72628
|
async function createKVNamespaceIfNotAlreadyExisting(complianceConfig, title, accountId) {
|
73402
72629
|
const namespaces = await listKVNamespaces(complianceConfig, accountId);
|
@@ -73437,7 +72664,7 @@ async function syncWorkersSite(complianceConfig, accountId, scriptName, siteAsse
|
|
73437
72664
|
);
|
73438
72665
|
const namespaceKeyInfoMap = new Map(namespaceKeysResponse.map((x6) => [x6.name, x6]));
|
73439
72666
|
const namespaceKeys = new Set(namespaceKeysResponse.map((x6) => x6.name));
|
73440
|
-
const assetDirectory =
|
72667
|
+
const assetDirectory = path29.join(
|
73441
72668
|
siteAssets.baseDirectory,
|
73442
72669
|
siteAssets.assetDirectory
|
73443
72670
|
);
|
@@ -73466,11 +72693,11 @@ async function syncWorkersSite(complianceConfig, accountId, scriptName, siteAsse
|
|
73466
72693
|
__name(logDiff, "logDiff");
|
73467
72694
|
logger.info("Building list of assets to upload...");
|
73468
72695
|
for await (const absAssetFile of getFilesInFolder(assetDirectory)) {
|
73469
|
-
const assetFile =
|
72696
|
+
const assetFile = path29.relative(assetDirectory, absAssetFile);
|
73470
72697
|
if (!include(assetFile) || exclude2(assetFile)) {
|
73471
72698
|
continue;
|
73472
72699
|
}
|
73473
|
-
const content = await (0,
|
72700
|
+
const content = await (0, import_promises9.readFile)(absAssetFile, "base64");
|
73474
72701
|
const assetSize = Buffer.byteLength(content);
|
73475
72702
|
await validateAssetSize(absAssetFile, assetFile);
|
73476
72703
|
const assetKey = hashAsset(hasher, assetFile, content);
|
@@ -73492,7 +72719,7 @@ async function syncWorkersSite(complianceConfig, accountId, scriptName, siteAsse
|
|
73492
72719
|
skipCount++;
|
73493
72720
|
}
|
73494
72721
|
namespaceKeys.delete(assetKey);
|
73495
|
-
const manifestKey = urlSafe(
|
72722
|
+
const manifestKey = urlSafe(path29.relative(assetDirectory, absAssetFile));
|
73496
72723
|
manifest[manifestKey] = assetKey;
|
73497
72724
|
}
|
73498
72725
|
if (uploadBucket.length > 0) {
|
@@ -73525,7 +72752,7 @@ async function syncWorkersSite(complianceConfig, accountId, scriptName, siteAsse
|
|
73525
72752
|
for (const [absAssetFile, assetKey] of nextBucket) {
|
73526
72753
|
bucket.push({
|
73527
72754
|
key: assetKey,
|
73528
|
-
value: await (0,
|
72755
|
+
value: await (0, import_promises9.readFile)(absAssetFile, "base64"),
|
73529
72756
|
base64: true
|
73530
72757
|
});
|
73531
72758
|
if (controller.signal.aborted) {
|
@@ -73609,7 +72836,7 @@ async function syncWorkersSite(complianceConfig, accountId, scriptName, siteAsse
|
|
73609
72836
|
return { manifest, namespace };
|
73610
72837
|
}
|
73611
72838
|
async function validateAssetSize(absFilePath, relativeFilePath) {
|
73612
|
-
const { size } = await (0,
|
72839
|
+
const { size } = await (0, import_promises9.stat)(absFilePath);
|
73613
72840
|
if (size > 25 * 1024 * 1024) {
|
73614
72841
|
throw new UserError(
|
73615
72842
|
`File ${relativeFilePath} is too big, it should be under 25 MiB. See https://developers.cloudflare.com/workers/platform/limits#kv-limits`
|
@@ -73627,7 +72854,7 @@ function urlSafe(filePath) {
|
|
73627
72854
|
return filePath.replace(/\\/g, "/");
|
73628
72855
|
}
|
73629
72856
|
function getSiteAssetPaths(config, assetDirectory, includePatterns = config.site?.include ?? [], excludePatterns = config.site?.exclude ?? []) {
|
73630
|
-
const baseDirectory = assetDirectory ? process.cwd() :
|
72857
|
+
const baseDirectory = assetDirectory ? process.cwd() : path29.resolve(path29.dirname(config.configPath ?? "wrangler.toml"));
|
73631
72858
|
assetDirectory ??= config.site?.bucket;
|
73632
72859
|
if (assetDirectory) {
|
73633
72860
|
return {
|
@@ -73640,13 +72867,13 @@ function getSiteAssetPaths(config, assetDirectory, includePatterns = config.site
|
|
73640
72867
|
return void 0;
|
73641
72868
|
}
|
73642
72869
|
}
|
73643
|
-
var import_node_assert16,
|
72870
|
+
var import_node_assert16, import_promises9, path29, ALWAYS_IGNORE, HIDDEN_FILES_TO_INCLUDE, MAX_DIFF_LINES, MAX_BUCKET_SIZE2, MAX_BUCKET_KEYS, MAX_BATCH_OPERATIONS;
|
73644
72871
|
var init_sites = __esm({
|
73645
72872
|
"src/sites.ts"() {
|
73646
72873
|
init_import_meta_url();
|
73647
72874
|
import_node_assert16 = __toESM(require("assert"));
|
73648
|
-
|
73649
|
-
|
72875
|
+
import_promises9 = require("fs/promises");
|
72876
|
+
path29 = __toESM(require("path"));
|
73650
72877
|
init_workers_shared();
|
73651
72878
|
init_source();
|
73652
72879
|
init_xxhash_wasm();
|
@@ -73818,7 +73045,7 @@ async function retryOnAPIFailure(action, backoff = 0, attempts = MAX_ATTEMPTS) {
|
|
73818
73045
|
if (attempts <= 1) {
|
73819
73046
|
throw err;
|
73820
73047
|
}
|
73821
|
-
await (0,
|
73048
|
+
await (0, import_promises10.setTimeout)(backoff);
|
73822
73049
|
return retryOnAPIFailure(
|
73823
73050
|
action,
|
73824
73051
|
backoff + (MAX_ATTEMPTS - attempts) * 1e3,
|
@@ -73826,11 +73053,11 @@ async function retryOnAPIFailure(action, backoff = 0, attempts = MAX_ATTEMPTS) {
|
|
73826
73053
|
);
|
73827
73054
|
}
|
73828
73055
|
}
|
73829
|
-
var
|
73056
|
+
var import_promises10, MAX_ATTEMPTS;
|
73830
73057
|
var init_retry = __esm({
|
73831
73058
|
"src/utils/retry.ts"() {
|
73832
73059
|
init_import_meta_url();
|
73833
|
-
|
73060
|
+
import_promises10 = require("timers/promises");
|
73834
73061
|
init_source();
|
73835
73062
|
init_logger();
|
73836
73063
|
init_parse();
|
@@ -74030,10 +73257,6 @@ var init_zones = __esm({
|
|
74030
73257
|
});
|
74031
73258
|
|
74032
73259
|
// src/triggers/deploy.ts
|
74033
|
-
function getResolvedWorkersDev(configWorkersDev, routes) {
|
74034
|
-
const resolvedWorkersDev = configWorkersDev ?? routes.length === 0;
|
74035
|
-
return resolvedWorkersDev;
|
74036
|
-
}
|
74037
73260
|
async function triggersDeploy(props) {
|
74038
73261
|
const { config, accountId, name: scriptName } = props;
|
74039
73262
|
const schedules = props.triggers || config.triggers?.crons;
|
@@ -74048,7 +73271,6 @@ async function triggersDeploy(props) {
|
|
74048
73271
|
routesOnly.push(route);
|
74049
73272
|
}
|
74050
73273
|
}
|
74051
|
-
const deployToWorkersDev = getResolvedWorkersDev(config.workers_dev, routes);
|
74052
73274
|
if (!scriptName) {
|
74053
73275
|
throw new UserError(
|
74054
73276
|
'You need to provide a name when uploading a Worker Version. Either pass it as a cli arg with `--name <name>` or in your config file as `name = "<name>"`',
|
@@ -74060,10 +73282,6 @@ async function triggersDeploy(props) {
|
|
74060
73282
|
const notProd = Boolean(!props.legacyEnv && props.env);
|
74061
73283
|
const workerName = notProd ? `${scriptName} (${envName})` : scriptName;
|
74062
73284
|
const workerUrl = notProd ? `/accounts/${accountId}/workers/services/${scriptName}/environments/${envName}` : `/accounts/${accountId}/workers/scripts/${scriptName}`;
|
74063
|
-
const {
|
74064
|
-
enabled: available_on_subdomain,
|
74065
|
-
previews_enabled: previews_available_on_subdomain
|
74066
|
-
} = await fetchResult(config, `${workerUrl}/subdomain`);
|
74067
73285
|
if (!props.dryRun) {
|
74068
73286
|
await ensureQueuesExistByConfig(config);
|
74069
73287
|
}
|
@@ -74076,45 +73294,16 @@ async function triggersDeploy(props) {
|
|
74076
73294
|
}
|
74077
73295
|
const uploadMs = Date.now() - start;
|
74078
73296
|
const deployments = [];
|
74079
|
-
const
|
74080
|
-
|
74081
|
-
|
74082
|
-
|
74083
|
-
|
74084
|
-
|
74085
|
-
|
74086
|
-
|
74087
|
-
|
74088
|
-
|
74089
|
-
deployments.push(Promise.resolve([deploymentURL]));
|
74090
|
-
} else {
|
74091
|
-
deployments.push(
|
74092
|
-
fetchResult(config, `${workerUrl}/subdomain`, {
|
74093
|
-
method: "POST",
|
74094
|
-
body: JSON.stringify({
|
74095
|
-
enabled: true,
|
74096
|
-
previews_enabled: config.preview_urls
|
74097
|
-
}),
|
74098
|
-
headers: {
|
74099
|
-
"Content-Type": "application/json"
|
74100
|
-
}
|
74101
|
-
}).then(() => [deploymentURL])
|
74102
|
-
);
|
74103
|
-
}
|
74104
|
-
}
|
74105
|
-
if (!deployToWorkersDev && (!deploymentInSync || !previewsInSync)) {
|
74106
|
-
await fetchResult(config, `${workerUrl}/subdomain`, {
|
74107
|
-
method: "POST",
|
74108
|
-
body: JSON.stringify({
|
74109
|
-
enabled: false,
|
74110
|
-
previews_enabled: config.preview_urls
|
74111
|
-
}),
|
74112
|
-
headers: {
|
74113
|
-
"Content-Type": "application/json"
|
74114
|
-
}
|
74115
|
-
});
|
74116
|
-
}
|
74117
|
-
if (!deployToWorkersDev && deploymentInSync && routes.length !== 0) {
|
73297
|
+
const { wantWorkersDev, workersDevInSync } = await subdomainDeploy(
|
73298
|
+
props,
|
73299
|
+
accountId,
|
73300
|
+
scriptName,
|
73301
|
+
envName,
|
73302
|
+
workerUrl,
|
73303
|
+
routes,
|
73304
|
+
deployments
|
73305
|
+
);
|
73306
|
+
if (!wantWorkersDev && workersDevInSync && routes.length !== 0) {
|
74118
73307
|
const routesWithOtherBindings = {};
|
74119
73308
|
const queue = new PQueue({ concurrency: 10 });
|
74120
73309
|
const queuePromises = [];
|
@@ -74253,6 +73442,71 @@ ${dashLink}`);
|
|
74253
73442
|
logger.log("No deploy targets for", workerName, formatTime(deployMs));
|
74254
73443
|
}
|
74255
73444
|
}
|
73445
|
+
function getSubdomainValues(config_workers_dev, config_preview_urls, routes) {
|
73446
|
+
const defaultWorkersDev = routes.length === 0;
|
73447
|
+
const defaultPreviewUrls = false;
|
73448
|
+
return {
|
73449
|
+
workers_dev: config_workers_dev ?? defaultWorkersDev,
|
73450
|
+
preview_urls: config_preview_urls ?? defaultPreviewUrls
|
73451
|
+
};
|
73452
|
+
}
|
73453
|
+
async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl, routes, deployments) {
|
73454
|
+
const { config } = props;
|
73455
|
+
const { workers_dev: wantWorkersDev, preview_urls: wantPreviews } = getSubdomainValues(config.workers_dev, config.preview_urls, routes);
|
73456
|
+
const { enabled: currWorkersDev, previews_enabled: currPreviews } = await fetchResult(config, `${workerUrl}/subdomain`);
|
73457
|
+
const workersDevInSync = wantWorkersDev === currWorkersDev;
|
73458
|
+
const previewsInSync = wantPreviews === currPreviews;
|
73459
|
+
const allInSync = [workersDevInSync, previewsInSync].every((v7) => v7);
|
73460
|
+
if (config.workers_dev == void 0 && !workersDevInSync) {
|
73461
|
+
const currWorkersDevStatus = currWorkersDev ? "enabled" : "disabled";
|
73462
|
+
logger.warn(
|
73463
|
+
[
|
73464
|
+
`Worker has workers.dev ${currWorkersDevStatus}, but 'workers_dev' is not in the config.`,
|
73465
|
+
`Using fallback value 'workers_dev = ${wantWorkersDev}'.`
|
73466
|
+
].join("\n")
|
73467
|
+
);
|
73468
|
+
}
|
73469
|
+
if (config.preview_urls == void 0 && !previewsInSync) {
|
73470
|
+
const currPreviewsStatus = currPreviews ? "enabled" : "disabled";
|
73471
|
+
logger.warn(
|
73472
|
+
[
|
73473
|
+
`Worker has preview URLs ${currPreviewsStatus}, but 'preview_urls' is not in the config.`,
|
73474
|
+
`Using fallback value 'preview_urls = ${wantPreviews}'.`
|
73475
|
+
].join("\n")
|
73476
|
+
);
|
73477
|
+
}
|
73478
|
+
let workersDevURL;
|
73479
|
+
if (wantWorkersDev) {
|
73480
|
+
const userSubdomain = await getWorkersDevSubdomain(
|
73481
|
+
config,
|
73482
|
+
accountId,
|
73483
|
+
config.configPath
|
73484
|
+
);
|
73485
|
+
workersDevURL = props.legacyEnv || !props.env ? `${scriptName}.${userSubdomain}` : `${envName}.${scriptName}.${userSubdomain}`;
|
73486
|
+
}
|
73487
|
+
if (!allInSync) {
|
73488
|
+
await fetchResult(config, `${workerUrl}/subdomain`, {
|
73489
|
+
method: "POST",
|
73490
|
+
body: JSON.stringify({
|
73491
|
+
enabled: wantWorkersDev,
|
73492
|
+
previews_enabled: wantPreviews
|
73493
|
+
}),
|
73494
|
+
headers: {
|
73495
|
+
"Content-Type": "application/json",
|
73496
|
+
"Cloudflare-Workers-Script-Api-Date": "2025-08-01"
|
73497
|
+
}
|
73498
|
+
});
|
73499
|
+
}
|
73500
|
+
if (workersDevURL) {
|
73501
|
+
deployments.push(Promise.resolve([workersDevURL]));
|
73502
|
+
}
|
73503
|
+
return {
|
73504
|
+
wantWorkersDev,
|
73505
|
+
wantPreviews,
|
73506
|
+
workersDevInSync,
|
73507
|
+
previewsInSync
|
73508
|
+
};
|
73509
|
+
}
|
74256
73510
|
var init_deploy3 = __esm({
|
74257
73511
|
"src/triggers/deploy.ts"() {
|
74258
73512
|
init_import_meta_url();
|
@@ -74266,8 +73520,446 @@ var init_deploy3 = __esm({
|
|
74266
73520
|
init_routes();
|
74267
73521
|
init_retry();
|
74268
73522
|
init_zones();
|
74269
|
-
__name(getResolvedWorkersDev, "getResolvedWorkersDev");
|
74270
73523
|
__name(triggersDeploy, "triggersDeploy");
|
73524
|
+
__name(getSubdomainValues, "getSubdomainValues");
|
73525
|
+
__name(subdomainDeploy, "subdomainDeploy");
|
73526
|
+
}
|
73527
|
+
});
|
73528
|
+
|
73529
|
+
// src/utils/compatibility-date.ts
|
73530
|
+
function getDevCompatibilityDate(config, compatibilityDate = config.compatibility_date) {
|
73531
|
+
const miniflareEntry = require.resolve("miniflare");
|
73532
|
+
const miniflareRequire = import_node_module3.default.createRequire(miniflareEntry);
|
73533
|
+
const miniflareWorkerd = miniflareRequire("workerd");
|
73534
|
+
const workerdDate = miniflareWorkerd.compatibilityDate;
|
73535
|
+
if (config.configPath !== void 0 && compatibilityDate === void 0) {
|
73536
|
+
logger.warn(
|
73537
|
+
`No compatibility_date was specified. Using the installed Workers runtime's latest supported date: ${workerdDate}.
|
73538
|
+
\u276F\u276F Add one to your ${configFileName(config.configPath)} file: compatibility_date = "${workerdDate}", or
|
73539
|
+
\u276F\u276F Pass it in your terminal: wrangler dev [<SCRIPT>] --compatibility-date=${workerdDate}
|
73540
|
+
|
73541
|
+
See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for more information.`
|
73542
|
+
);
|
73543
|
+
}
|
73544
|
+
return compatibilityDate ?? workerdDate;
|
73545
|
+
}
|
73546
|
+
function formatCompatibilityDate(date) {
|
73547
|
+
return date.toISOString().slice(0, 10);
|
73548
|
+
}
|
73549
|
+
var import_node_module3;
|
73550
|
+
var init_compatibility_date = __esm({
|
73551
|
+
"src/utils/compatibility-date.ts"() {
|
73552
|
+
init_import_meta_url();
|
73553
|
+
import_node_module3 = __toESM(require("module"));
|
73554
|
+
init_config2();
|
73555
|
+
init_logger();
|
73556
|
+
__name(getDevCompatibilityDate, "getDevCompatibilityDate");
|
73557
|
+
__name(formatCompatibilityDate, "formatCompatibilityDate");
|
73558
|
+
}
|
73559
|
+
});
|
73560
|
+
|
73561
|
+
// src/utils/map-worker-metadata-bindings.ts
|
73562
|
+
async function mapWorkerMetadataBindings(bindings, accountId, complianceConfig) {
|
73563
|
+
const d1BindingsWithInfo = {};
|
73564
|
+
await Promise.all(
|
73565
|
+
bindings.filter((binding) => binding.type === "d1").map(async (binding) => {
|
73566
|
+
const dbInfo = await getDatabaseInfoFromIdOrName(
|
73567
|
+
complianceConfig,
|
73568
|
+
accountId,
|
73569
|
+
binding.id
|
73570
|
+
);
|
73571
|
+
d1BindingsWithInfo[binding.id] = dbInfo;
|
73572
|
+
})
|
73573
|
+
);
|
73574
|
+
return bindings.filter((binding) => binding.type !== "secret_text").reduce((configObj, binding) => {
|
73575
|
+
switch (binding.type) {
|
73576
|
+
case "plain_text":
|
73577
|
+
{
|
73578
|
+
configObj.vars = {
|
73579
|
+
...configObj.vars ?? {},
|
73580
|
+
[binding.name]: binding.text
|
73581
|
+
};
|
73582
|
+
}
|
73583
|
+
break;
|
73584
|
+
case "json":
|
73585
|
+
{
|
73586
|
+
configObj.vars = {
|
73587
|
+
...configObj.vars ?? {},
|
73588
|
+
name: binding.name,
|
73589
|
+
json: binding.json
|
73590
|
+
};
|
73591
|
+
}
|
73592
|
+
break;
|
73593
|
+
case "kv_namespace":
|
73594
|
+
{
|
73595
|
+
configObj.kv_namespaces = [
|
73596
|
+
...configObj.kv_namespaces ?? [],
|
73597
|
+
{ id: binding.namespace_id, binding: binding.name }
|
73598
|
+
];
|
73599
|
+
}
|
73600
|
+
break;
|
73601
|
+
case "durable_object_namespace":
|
73602
|
+
{
|
73603
|
+
configObj.durable_objects = {
|
73604
|
+
bindings: [
|
73605
|
+
...configObj.durable_objects?.bindings ?? [],
|
73606
|
+
{
|
73607
|
+
name: binding.name,
|
73608
|
+
class_name: binding.class_name,
|
73609
|
+
script_name: binding.script_name,
|
73610
|
+
environment: binding.environment
|
73611
|
+
}
|
73612
|
+
]
|
73613
|
+
};
|
73614
|
+
}
|
73615
|
+
break;
|
73616
|
+
case "d1":
|
73617
|
+
{
|
73618
|
+
configObj.d1_databases = [
|
73619
|
+
...configObj.d1_databases ?? [],
|
73620
|
+
{
|
73621
|
+
binding: binding.name,
|
73622
|
+
database_id: binding.id,
|
73623
|
+
database_name: d1BindingsWithInfo[binding.id].name
|
73624
|
+
}
|
73625
|
+
];
|
73626
|
+
}
|
73627
|
+
break;
|
73628
|
+
case "browser":
|
73629
|
+
{
|
73630
|
+
configObj.browser = {
|
73631
|
+
binding: binding.name
|
73632
|
+
};
|
73633
|
+
}
|
73634
|
+
break;
|
73635
|
+
case "ai":
|
73636
|
+
{
|
73637
|
+
configObj.ai = {
|
73638
|
+
binding: binding.name
|
73639
|
+
};
|
73640
|
+
}
|
73641
|
+
break;
|
73642
|
+
case "images":
|
73643
|
+
{
|
73644
|
+
configObj.images = {
|
73645
|
+
binding: binding.name
|
73646
|
+
};
|
73647
|
+
}
|
73648
|
+
break;
|
73649
|
+
case "r2_bucket":
|
73650
|
+
{
|
73651
|
+
configObj.r2_buckets = [
|
73652
|
+
...configObj.r2_buckets ?? [],
|
73653
|
+
{
|
73654
|
+
binding: binding.name,
|
73655
|
+
bucket_name: binding.bucket_name,
|
73656
|
+
jurisdiction: binding.jurisdiction
|
73657
|
+
}
|
73658
|
+
];
|
73659
|
+
}
|
73660
|
+
break;
|
73661
|
+
case "secrets_store_secret":
|
73662
|
+
{
|
73663
|
+
configObj.secrets_store_secrets = [
|
73664
|
+
...configObj.secrets_store_secrets ?? [],
|
73665
|
+
{
|
73666
|
+
binding: binding.name,
|
73667
|
+
store_id: binding.store_id,
|
73668
|
+
secret_name: binding.secret_name
|
73669
|
+
}
|
73670
|
+
];
|
73671
|
+
}
|
73672
|
+
break;
|
73673
|
+
case "unsafe_hello_world": {
|
73674
|
+
configObj.unsafe_hello_world = [
|
73675
|
+
...configObj.unsafe_hello_world ?? [],
|
73676
|
+
{
|
73677
|
+
binding: binding.name,
|
73678
|
+
enable_timer: binding.enable_timer
|
73679
|
+
}
|
73680
|
+
];
|
73681
|
+
break;
|
73682
|
+
}
|
73683
|
+
case "service":
|
73684
|
+
{
|
73685
|
+
configObj.services = [
|
73686
|
+
...configObj.services ?? [],
|
73687
|
+
{
|
73688
|
+
binding: binding.name,
|
73689
|
+
service: binding.service,
|
73690
|
+
environment: binding.environment,
|
73691
|
+
entrypoint: binding.entrypoint
|
73692
|
+
}
|
73693
|
+
];
|
73694
|
+
}
|
73695
|
+
break;
|
73696
|
+
case "analytics_engine":
|
73697
|
+
{
|
73698
|
+
configObj.analytics_engine_datasets = [
|
73699
|
+
...configObj.analytics_engine_datasets ?? [],
|
73700
|
+
{ binding: binding.name, dataset: binding.dataset }
|
73701
|
+
];
|
73702
|
+
}
|
73703
|
+
break;
|
73704
|
+
case "dispatch_namespace":
|
73705
|
+
{
|
73706
|
+
configObj.dispatch_namespaces = [
|
73707
|
+
...configObj.dispatch_namespaces ?? [],
|
73708
|
+
{
|
73709
|
+
binding: binding.name,
|
73710
|
+
namespace: binding.namespace,
|
73711
|
+
...binding.outbound && {
|
73712
|
+
outbound: {
|
73713
|
+
service: binding.outbound.worker.service,
|
73714
|
+
environment: binding.outbound.worker.environment,
|
73715
|
+
parameters: binding.outbound.params?.map((p6) => p6.name) ?? []
|
73716
|
+
}
|
73717
|
+
}
|
73718
|
+
}
|
73719
|
+
];
|
73720
|
+
}
|
73721
|
+
break;
|
73722
|
+
case "logfwdr":
|
73723
|
+
{
|
73724
|
+
configObj.logfwdr = {
|
73725
|
+
bindings: [
|
73726
|
+
...configObj.logfwdr?.bindings ?? [],
|
73727
|
+
{ name: binding.name, destination: binding.destination }
|
73728
|
+
]
|
73729
|
+
};
|
73730
|
+
}
|
73731
|
+
break;
|
73732
|
+
case "wasm_module":
|
73733
|
+
{
|
73734
|
+
configObj.wasm_modules = {
|
73735
|
+
...configObj.wasm_modules ?? {},
|
73736
|
+
[binding.name]: binding.part
|
73737
|
+
};
|
73738
|
+
}
|
73739
|
+
break;
|
73740
|
+
case "text_blob":
|
73741
|
+
{
|
73742
|
+
configObj.text_blobs = {
|
73743
|
+
...configObj.text_blobs ?? {},
|
73744
|
+
[binding.name]: binding.part
|
73745
|
+
};
|
73746
|
+
}
|
73747
|
+
break;
|
73748
|
+
case "data_blob":
|
73749
|
+
{
|
73750
|
+
configObj.data_blobs = {
|
73751
|
+
...configObj.data_blobs ?? {},
|
73752
|
+
[binding.name]: binding.part
|
73753
|
+
};
|
73754
|
+
}
|
73755
|
+
break;
|
73756
|
+
case "secret_text":
|
73757
|
+
break;
|
73758
|
+
case "version_metadata": {
|
73759
|
+
{
|
73760
|
+
configObj.version_metadata = {
|
73761
|
+
binding: binding.name
|
73762
|
+
};
|
73763
|
+
}
|
73764
|
+
break;
|
73765
|
+
}
|
73766
|
+
case "send_email": {
|
73767
|
+
configObj.send_email = [
|
73768
|
+
...configObj.send_email ?? [],
|
73769
|
+
{
|
73770
|
+
name: binding.name,
|
73771
|
+
destination_address: binding.destination_address,
|
73772
|
+
allowed_destination_addresses: binding.allowed_destination_addresses
|
73773
|
+
}
|
73774
|
+
];
|
73775
|
+
break;
|
73776
|
+
}
|
73777
|
+
case "queue":
|
73778
|
+
configObj.queues ??= { producers: [] };
|
73779
|
+
configObj.queues.producers = [
|
73780
|
+
...configObj.queues.producers ?? [],
|
73781
|
+
{
|
73782
|
+
binding: binding.name,
|
73783
|
+
queue: binding.queue_name,
|
73784
|
+
delivery_delay: binding.delivery_delay
|
73785
|
+
}
|
73786
|
+
];
|
73787
|
+
break;
|
73788
|
+
case "vectorize":
|
73789
|
+
configObj.vectorize = [
|
73790
|
+
...configObj.vectorize ?? [],
|
73791
|
+
{
|
73792
|
+
binding: binding.name,
|
73793
|
+
index_name: binding.index_name
|
73794
|
+
}
|
73795
|
+
];
|
73796
|
+
break;
|
73797
|
+
case "hyperdrive":
|
73798
|
+
configObj.hyperdrive = [
|
73799
|
+
...configObj.hyperdrive ?? [],
|
73800
|
+
{
|
73801
|
+
binding: binding.name,
|
73802
|
+
id: binding.id
|
73803
|
+
}
|
73804
|
+
];
|
73805
|
+
break;
|
73806
|
+
case "mtls_certificate":
|
73807
|
+
configObj.mtls_certificates = [
|
73808
|
+
...configObj.mtls_certificates ?? [],
|
73809
|
+
{
|
73810
|
+
binding: binding.name,
|
73811
|
+
certificate_id: binding.certificate_id
|
73812
|
+
}
|
73813
|
+
];
|
73814
|
+
break;
|
73815
|
+
case "pipelines":
|
73816
|
+
configObj.pipelines = [
|
73817
|
+
...configObj.pipelines ?? [],
|
73818
|
+
{
|
73819
|
+
binding: binding.name,
|
73820
|
+
pipeline: binding.pipeline
|
73821
|
+
}
|
73822
|
+
];
|
73823
|
+
break;
|
73824
|
+
case "assets":
|
73825
|
+
throw new FatalError(
|
73826
|
+
"`wrangler init --from-dash` is not yet supported for Workers with Assets"
|
73827
|
+
);
|
73828
|
+
case "inherit":
|
73829
|
+
configObj.unsafe = {
|
73830
|
+
bindings: [...configObj.unsafe?.bindings ?? [], binding],
|
73831
|
+
metadata: configObj.unsafe?.metadata ?? void 0
|
73832
|
+
};
|
73833
|
+
break;
|
73834
|
+
case "workflow":
|
73835
|
+
{
|
73836
|
+
configObj.workflows = [
|
73837
|
+
...configObj.workflows ?? [],
|
73838
|
+
{
|
73839
|
+
binding: binding.name,
|
73840
|
+
name: binding.workflow_name,
|
73841
|
+
class_name: binding.class_name,
|
73842
|
+
script_name: binding.script_name
|
73843
|
+
}
|
73844
|
+
];
|
73845
|
+
}
|
73846
|
+
break;
|
73847
|
+
default: {
|
73848
|
+
configObj.unsafe = {
|
73849
|
+
bindings: [...configObj.unsafe?.bindings ?? [], binding],
|
73850
|
+
metadata: configObj.unsafe?.metadata ?? void 0
|
73851
|
+
};
|
73852
|
+
assertNever(binding);
|
73853
|
+
}
|
73854
|
+
}
|
73855
|
+
return configObj;
|
73856
|
+
}, {});
|
73857
|
+
}
|
73858
|
+
var init_map_worker_metadata_bindings = __esm({
|
73859
|
+
"src/utils/map-worker-metadata-bindings.ts"() {
|
73860
|
+
init_import_meta_url();
|
73861
|
+
init_utils3();
|
73862
|
+
init_errors();
|
73863
|
+
init_assert_never();
|
73864
|
+
__name(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
|
73865
|
+
}
|
73866
|
+
});
|
73867
|
+
|
73868
|
+
// src/utils/download-worker-config.ts
|
73869
|
+
async function downloadWorkerConfig(workerName, environment, entrypoint, accountId) {
|
73870
|
+
const [
|
73871
|
+
bindings,
|
73872
|
+
routes,
|
73873
|
+
customDomains,
|
73874
|
+
subdomainStatus,
|
73875
|
+
serviceEnvMetadata,
|
73876
|
+
cronTriggers
|
73877
|
+
] = await Promise.all([
|
73878
|
+
fetchResult(
|
73879
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
73880
|
+
`/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/bindings`
|
73881
|
+
),
|
73882
|
+
fetchResult(
|
73883
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
73884
|
+
`/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/routes?show_zonename=true`
|
73885
|
+
),
|
73886
|
+
fetchResult(
|
73887
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
73888
|
+
`/accounts/${accountId}/workers/domains/records?page=0&per_page=5&service=${workerName}&environment=${environment}`
|
73889
|
+
),
|
73890
|
+
fetchResult(
|
73891
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
73892
|
+
`/accounts/${accountId}/workers/services/${workerName}/environments/${environment}/subdomain`
|
73893
|
+
),
|
73894
|
+
fetchResult(
|
73895
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
73896
|
+
`/accounts/${accountId}/workers/services/${workerName}/environments/${environment}`
|
73897
|
+
),
|
73898
|
+
fetchResult(
|
73899
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
73900
|
+
`/accounts/${accountId}/workers/scripts/${workerName}/schedules`
|
73901
|
+
)
|
73902
|
+
]).catch((e7) => {
|
73903
|
+
throw new Error(
|
73904
|
+
`Error Occurred: Unable to fetch bindings, routes, or services metadata from the dashboard. Please try again later.`,
|
73905
|
+
{ cause: e7 }
|
73906
|
+
);
|
73907
|
+
});
|
73908
|
+
const mappedBindings = await mapWorkerMetadataBindings(
|
73909
|
+
bindings,
|
73910
|
+
accountId,
|
73911
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN
|
73912
|
+
);
|
73913
|
+
const durableObjectClassNames = bindings.filter((binding) => binding.type === "durable_object_namespace").map(
|
73914
|
+
(durableObject) => durableObject.class_name
|
73915
|
+
);
|
73916
|
+
const allRoutes = [
|
73917
|
+
...routes.map((r7) => ({
|
73918
|
+
pattern: r7.pattern,
|
73919
|
+
zone_name: r7.zone_name
|
73920
|
+
})),
|
73921
|
+
...customDomains.map((c6) => ({
|
73922
|
+
pattern: c6.hostname,
|
73923
|
+
zone_name: c6.zone_name,
|
73924
|
+
custom_domain: true
|
73925
|
+
}))
|
73926
|
+
];
|
73927
|
+
return {
|
73928
|
+
name: workerName,
|
73929
|
+
main: entrypoint,
|
73930
|
+
workers_dev: subdomainStatus.enabled,
|
73931
|
+
preview_urls: subdomainStatus.previews_enabled,
|
73932
|
+
compatibility_date: serviceEnvMetadata.script.compatibility_date ?? formatCompatibilityDate(/* @__PURE__ */ new Date()),
|
73933
|
+
compatibility_flags: serviceEnvMetadata.script.compatibility_flags,
|
73934
|
+
...allRoutes.length ? { routes: allRoutes } : {},
|
73935
|
+
placement: serviceEnvMetadata.script.placement_mode === "smart" ? { mode: "smart" } : void 0,
|
73936
|
+
limits: serviceEnvMetadata.script.limits,
|
73937
|
+
...durableObjectClassNames.length ? {
|
73938
|
+
migrations: [
|
73939
|
+
{
|
73940
|
+
tag: serviceEnvMetadata.script.migration_tag,
|
73941
|
+
new_classes: durableObjectClassNames
|
73942
|
+
}
|
73943
|
+
]
|
73944
|
+
} : {},
|
73945
|
+
...cronTriggers.schedules.length ? {
|
73946
|
+
triggers: {
|
73947
|
+
crons: cronTriggers.schedules.map((scheduled) => scheduled.cron)
|
73948
|
+
}
|
73949
|
+
} : {},
|
73950
|
+
tail_consumers: serviceEnvMetadata.script.tail_consumers ?? void 0,
|
73951
|
+
observability: serviceEnvMetadata.script.observability,
|
73952
|
+
...mappedBindings
|
73953
|
+
};
|
73954
|
+
}
|
73955
|
+
var init_download_worker_config = __esm({
|
73956
|
+
"src/utils/download-worker-config.ts"() {
|
73957
|
+
init_import_meta_url();
|
73958
|
+
init_cfetch();
|
73959
|
+
init_misc_variables();
|
73960
|
+
init_compatibility_date();
|
73961
|
+
init_map_worker_metadata_bindings();
|
73962
|
+
__name(downloadWorkerConfig, "downloadWorkerConfig");
|
74271
73963
|
}
|
74272
73964
|
});
|
74273
73965
|
|
@@ -82082,6 +81774,16 @@ function containerAppToInstanceType(containerApp) {
|
|
82082
81774
|
}
|
82083
81775
|
return configuration;
|
82084
81776
|
}
|
81777
|
+
function convertContainerAffinitiesForApi2(container) {
|
81778
|
+
if (container.affinities === void 0) {
|
81779
|
+
return void 0;
|
81780
|
+
}
|
81781
|
+
const affinities = {
|
81782
|
+
colocation: container.affinities?.colocation,
|
81783
|
+
hardware_generation: container.affinities?.hardware_generation
|
81784
|
+
};
|
81785
|
+
return affinities;
|
81786
|
+
}
|
82085
81787
|
function containerAppToCreateApplication(accountId, containerApp, observability, existingApp, skipDefaults = false) {
|
82086
81788
|
const observabilityConfiguration = observabilityToConfiguration2(
|
82087
81789
|
observability,
|
@@ -82116,7 +81818,8 @@ function containerAppToCreateApplication(accountId, containerApp, observability,
|
|
82116
81818
|
regions: containerApp.constraints?.regions?.map(
|
82117
81819
|
(region) => region.toUpperCase()
|
82118
81820
|
)
|
82119
|
-
}
|
81821
|
+
},
|
81822
|
+
affinities: convertContainerAffinitiesForApi2(containerApp)
|
82120
81823
|
};
|
82121
81824
|
delete app["class_name"];
|
82122
81825
|
delete app["image"];
|
@@ -82401,9 +82104,9 @@ var init_apply = __esm({
|
|
82401
82104
|
init_deploy();
|
82402
82105
|
init_errors();
|
82403
82106
|
init_user2();
|
82107
|
+
init_diff();
|
82404
82108
|
init_sortObjectRecursive();
|
82405
82109
|
init_common();
|
82406
|
-
init_diff();
|
82407
82110
|
init_instance_type();
|
82408
82111
|
__name(mergeDeep3, "mergeDeep");
|
82409
82112
|
__name(isObject2, "isObject");
|
@@ -82413,6 +82116,7 @@ var init_apply = __esm({
|
|
82413
82116
|
__name(cleanupObservability2, "cleanupObservability");
|
82414
82117
|
__name(observabilityToConfiguration2, "observabilityToConfiguration");
|
82415
82118
|
__name(containerAppToInstanceType, "containerAppToInstanceType");
|
82119
|
+
__name(convertContainerAffinitiesForApi2, "convertContainerAffinitiesForApi");
|
82416
82120
|
__name(containerAppToCreateApplication, "containerAppToCreateApplication");
|
82417
82121
|
__name(apply2, "apply");
|
82418
82122
|
__name(applyCommand, "applyCommand");
|
@@ -82949,7 +82653,7 @@ function createSSHPublicKeyOptionalYargs(yargs) {
|
|
82949
82653
|
}
|
82950
82654
|
async function retrieveSSHKey(sshKeyPath, { json } = { json: false }) {
|
82951
82655
|
try {
|
82952
|
-
const file = (await (0,
|
82656
|
+
const file = (await (0, import_promises11.readFile)(sshKeyPath)).toString();
|
82953
82657
|
validatePublicSSHKeyCLI(file, { json });
|
82954
82658
|
return file;
|
82955
82659
|
} catch {
|
@@ -82990,10 +82694,10 @@ async function tryToRetrieveAllDefaultSSHKeyPaths() {
|
|
82990
82694
|
const path72 = `${HOME}/.ssh`;
|
82991
82695
|
const paths = [];
|
82992
82696
|
try {
|
82993
|
-
const dirList = await (0,
|
82697
|
+
const dirList = await (0, import_promises11.readdir)(path72);
|
82994
82698
|
for (const file of dirList) {
|
82995
82699
|
if (file.endsWith(".pub")) {
|
82996
|
-
const s5 = await (0,
|
82700
|
+
const s5 = await (0, import_promises11.stat)(`${path72}/${file}`);
|
82997
82701
|
if (s5.isFile()) {
|
82998
82702
|
paths.push(`${path72}/${file}`);
|
82999
82703
|
}
|
@@ -83032,7 +82736,7 @@ async function shouldPromptForNewSSHKeyAppear(keys = void 0) {
|
|
83032
82736
|
}
|
83033
82737
|
let foundValidSSHKeyThatDontExist = false;
|
83034
82738
|
for (const defaultSSHKeyPath of defaultSSHKeyPaths) {
|
83035
|
-
const file = (await (0,
|
82739
|
+
const file = (await (0, import_promises11.readFile)(defaultSSHKeyPath)).toString().trim();
|
83036
82740
|
try {
|
83037
82741
|
validateSSHKey(file);
|
83038
82742
|
} catch {
|
@@ -83145,11 +82849,11 @@ async function promptForSSHKey(args) {
|
|
83145
82849
|
}
|
83146
82850
|
return res;
|
83147
82851
|
}
|
83148
|
-
var
|
82852
|
+
var import_promises11, import_os4, sshCommand;
|
83149
82853
|
var init_ssh = __esm({
|
83150
82854
|
"src/cloudchamber/ssh/ssh.ts"() {
|
83151
82855
|
init_import_meta_url();
|
83152
|
-
|
82856
|
+
import_promises11 = require("fs/promises");
|
83153
82857
|
import_os4 = require("os");
|
83154
82858
|
init_cli();
|
83155
82859
|
init_colors();
|
@@ -85576,7 +85280,7 @@ async function executeLocally({
|
|
85576
85280
|
}
|
85577
85281
|
const id = localDB.previewDatabaseUuid ?? localDB.uuid;
|
85578
85282
|
const persistencePath = getLocalPersistencePath(persistTo, config);
|
85579
|
-
const d1Persist =
|
85283
|
+
const d1Persist = import_node_path27.default.join(persistencePath, "v3", "d1");
|
85580
85284
|
logger.log(
|
85581
85285
|
`\u{1F300} Executing on local database ${name2} (${id}) from ${readableRelative(
|
85582
85286
|
d1Persist
|
@@ -85857,13 +85561,13 @@ async function checkForSQLiteBinary(filename) {
|
|
85857
85561
|
);
|
85858
85562
|
}
|
85859
85563
|
}
|
85860
|
-
var import_fs16, import_node_assert17,
|
85564
|
+
var import_fs16, import_node_assert17, import_node_path27, import_md5_file, import_miniflare12, import_undici8, d1ExecuteCommand;
|
85861
85565
|
var init_execute = __esm({
|
85862
85566
|
"src/d1/execute.ts"() {
|
85863
85567
|
init_import_meta_url();
|
85864
85568
|
import_fs16 = require("fs");
|
85865
85569
|
import_node_assert17 = __toESM(require("assert"));
|
85866
|
-
|
85570
|
+
import_node_path27 = __toESM(require("path"));
|
85867
85571
|
init_interactive();
|
85868
85572
|
init_source();
|
85869
85573
|
import_md5_file = __toESM(require_md5_file());
|
@@ -86033,7 +85737,7 @@ async function exportLocal(config, name2, output, tables, noSchema, noData) {
|
|
86033
85737
|
}
|
86034
85738
|
const id = localDB.previewDatabaseUuid ?? localDB.uuid;
|
86035
85739
|
const persistencePath = getLocalPersistencePath(void 0, config);
|
86036
|
-
const d1Persist =
|
85740
|
+
const d1Persist = import_node_path28.default.join(persistencePath, "v3", "d1");
|
86037
85741
|
logger.log(
|
86038
85742
|
`\u{1F300} Exporting local database ${name2} (${id}) from ${readableRelative(
|
86039
85743
|
d1Persist
|
@@ -86052,7 +85756,7 @@ async function exportLocal(config, name2, output, tables, noSchema, noData) {
|
|
86052
85756
|
logger.log(`\u{1F300} Exporting SQL to ${output}...`);
|
86053
85757
|
try {
|
86054
85758
|
const dump = await db.prepare(`PRAGMA miniflare_d1_export(?,?,?);`).bind(noSchema, noData, ...tables).raw();
|
86055
|
-
await
|
85759
|
+
await import_promises12.default.writeFile(output, dump[0].join("\n"));
|
86056
85760
|
} catch (e7) {
|
86057
85761
|
throw new UserError(e7.message);
|
86058
85762
|
} finally {
|
@@ -86096,7 +85800,7 @@ async function exportRemotely(config, name2, output, tables, noSchema, noData) {
|
|
86096
85800
|
`There was an error while downloading from the presigned URL with status code: ${contents.status}`
|
86097
85801
|
);
|
86098
85802
|
}
|
86099
|
-
await
|
85803
|
+
await import_promises12.default.writeFile(output, contents.body || "");
|
86100
85804
|
}
|
86101
85805
|
});
|
86102
85806
|
logger.log(`\u{1F300} Downloaded to ${output} successfully!`);
|
@@ -86147,12 +85851,12 @@ async function pollExport(s5, complianceConfig, accountId, db, dumpOptions, curr
|
|
86147
85851
|
);
|
86148
85852
|
}
|
86149
85853
|
}
|
86150
|
-
var
|
85854
|
+
var import_promises12, import_node_path28, import_miniflare13, import_undici9, d1ExportCommand;
|
86151
85855
|
var init_export = __esm({
|
86152
85856
|
"src/d1/export.ts"() {
|
86153
85857
|
init_import_meta_url();
|
86154
|
-
|
86155
|
-
|
85858
|
+
import_promises12 = __toESM(require("fs/promises"));
|
85859
|
+
import_node_path28 = __toESM(require("path"));
|
86156
85860
|
init_interactive();
|
86157
85861
|
init_source();
|
86158
85862
|
import_miniflare13 = require("miniflare");
|
@@ -87603,10 +87307,10 @@ var init_delete3 = __esm({
|
|
87603
87307
|
|
87604
87308
|
// src/deployment-bundle/guess-worker-format.ts
|
87605
87309
|
async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
|
87606
|
-
const parsedEntryPath =
|
87310
|
+
const parsedEntryPath = import_node_path29.default.parse(entryFile);
|
87607
87311
|
if (parsedEntryPath.ext == ".py") {
|
87608
87312
|
logger.warn(
|
87609
|
-
`The entrypoint ${
|
87313
|
+
`The entrypoint ${import_node_path29.default.relative(
|
87610
87314
|
process.cwd(),
|
87611
87315
|
entryFile
|
87612
87316
|
)} defines a Python worker, support for Python workers is currently experimental.`
|
@@ -87631,7 +87335,7 @@ async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
|
|
87631
87335
|
guessedWorkerFormat = "modules";
|
87632
87336
|
} else {
|
87633
87337
|
logger.warn(
|
87634
|
-
`The entrypoint ${
|
87338
|
+
`The entrypoint ${import_node_path29.default.relative(
|
87635
87339
|
process.cwd(),
|
87636
87340
|
entryFile
|
87637
87341
|
)} has exports like an ES Module, but hasn't defined a default export like a module worker normally would. Building the worker using "service-worker" format...`
|
@@ -87643,11 +87347,11 @@ async function guessWorkerFormat(entryFile, entryWorkingDirectory, tsconfig) {
|
|
87643
87347
|
}
|
87644
87348
|
return { format: guessedWorkerFormat, exports: exports2 };
|
87645
87349
|
}
|
87646
|
-
var
|
87350
|
+
var import_node_path29, esbuild2;
|
87647
87351
|
var init_guess_worker_format = __esm({
|
87648
87352
|
"src/deployment-bundle/guess-worker-format.ts"() {
|
87649
87353
|
init_import_meta_url();
|
87650
|
-
|
87354
|
+
import_node_path29 = __toESM(require("path"));
|
87651
87355
|
esbuild2 = __toESM(require("esbuild"));
|
87652
87356
|
init_logger();
|
87653
87357
|
init_bundle();
|
@@ -87777,7 +87481,7 @@ ${migrateUrl}`,
|
|
87777
87481
|
projectRoot,
|
87778
87482
|
configPath: config.configPath,
|
87779
87483
|
format: format9,
|
87780
|
-
moduleRoot: args.moduleRoot ?? config.base_dir ??
|
87484
|
+
moduleRoot: args.moduleRoot ?? config.base_dir ?? import_node_path30.default.dirname(paths.absolutePath),
|
87781
87485
|
name: config.name ?? "worker",
|
87782
87486
|
exports: exports2
|
87783
87487
|
};
|
@@ -87817,11 +87521,11 @@ function getNpxEquivalent() {
|
|
87817
87521
|
return "npx";
|
87818
87522
|
}
|
87819
87523
|
}
|
87820
|
-
var
|
87524
|
+
var import_node_path30;
|
87821
87525
|
var init_entry = __esm({
|
87822
87526
|
"src/deployment-bundle/entry.ts"() {
|
87823
87527
|
init_import_meta_url();
|
87824
|
-
|
87528
|
+
import_node_path30 = __toESM(require("path"));
|
87825
87529
|
init_esm2();
|
87826
87530
|
init_config2();
|
87827
87531
|
init_errors();
|
@@ -87924,20 +87628,20 @@ function getOutputFilePath() {
|
|
87924
87628
|
const outputFileDirectoryFromEnv = getOutputFileDirectoryFromEnv();
|
87925
87629
|
if (outputFileDirectoryFromEnv) {
|
87926
87630
|
const date = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-").replace(".", "_").replace("T", "_").replace("Z", "");
|
87927
|
-
return (0,
|
87631
|
+
return (0, import_node_path31.resolve)(
|
87928
87632
|
outputFileDirectoryFromEnv,
|
87929
87633
|
`wrangler-output-${date}-${(0, import_node_crypto6.randomBytes)(3).toString("hex")}.json`
|
87930
87634
|
);
|
87931
87635
|
}
|
87932
87636
|
return null;
|
87933
87637
|
}
|
87934
|
-
var import_node_crypto6, import_node_fs19,
|
87638
|
+
var import_node_crypto6, import_node_fs19, import_node_path31, outputFilePath;
|
87935
87639
|
var init_output = __esm({
|
87936
87640
|
"src/output.ts"() {
|
87937
87641
|
init_import_meta_url();
|
87938
87642
|
import_node_crypto6 = require("crypto");
|
87939
87643
|
import_node_fs19 = require("fs");
|
87940
|
-
|
87644
|
+
import_node_path31 = require("path");
|
87941
87645
|
init_misc_variables();
|
87942
87646
|
init_filesystem();
|
87943
87647
|
__name(writeOutput, "writeOutput");
|
@@ -88003,7 +87707,7 @@ async function handleMaybeAssetsDeployment(assetDirectory, args) {
|
|
88003
87707
|
}
|
88004
87708
|
}
|
88005
87709
|
if (!args.name) {
|
88006
|
-
const defaultName = process.cwd().split(
|
87710
|
+
const defaultName = process.cwd().split(import_node_path32.default.sep).pop()?.replace("_", "-");
|
88007
87711
|
const isValidName2 = defaultName && /^[a-zA-Z0-9-]+$/.test(defaultName);
|
88008
87712
|
const projectName = await prompt("What do you want to name your project?", {
|
88009
87713
|
defaultValue: isValidName2 ? defaultName : "my-project"
|
@@ -88025,7 +87729,7 @@ async function handleMaybeAssetsDeployment(assetDirectory, args) {
|
|
88025
87729
|
${source_default.dim("This will allow you to simply run `wrangler deploy` on future deployments.")}`
|
88026
87730
|
);
|
88027
87731
|
if (writeConfig) {
|
88028
|
-
const configPath =
|
87732
|
+
const configPath = import_node_path32.default.join(process.cwd(), "wrangler.jsonc");
|
88029
87733
|
const jsonString = JSON.stringify(
|
88030
87734
|
{
|
88031
87735
|
name: args.name,
|
@@ -88052,13 +87756,13 @@ ${jsonString}
|
|
88052
87756
|
logger.log("\nProceeding with deployment...\n");
|
88053
87757
|
return args;
|
88054
87758
|
}
|
88055
|
-
var import_node_assert18, import_node_fs20,
|
87759
|
+
var import_node_assert18, import_node_fs20, import_node_path32, deployCommand;
|
88056
87760
|
var init_deploy4 = __esm({
|
88057
87761
|
"src/deploy/index.ts"() {
|
88058
87762
|
init_import_meta_url();
|
88059
87763
|
import_node_assert18 = __toESM(require("assert"));
|
88060
87764
|
import_node_fs20 = require("fs");
|
88061
|
-
|
87765
|
+
import_node_path32 = __toESM(require("path"));
|
88062
87766
|
init_source();
|
88063
87767
|
init_assets();
|
88064
87768
|
init_config2();
|
@@ -88309,7 +88013,7 @@ var init_deploy4 = __esm({
|
|
88309
88013
|
{ telemetryMessage: true }
|
88310
88014
|
);
|
88311
88015
|
}
|
88312
|
-
const projectRoot = config.userConfigPath &&
|
88016
|
+
const projectRoot = config.userConfigPath && import_node_path32.default.dirname(config.userConfigPath);
|
88313
88017
|
if (!config.configPath) {
|
88314
88018
|
if (args.script) {
|
88315
88019
|
try {
|
@@ -89433,6 +89137,446 @@ var init_update = __esm({
|
|
89433
89137
|
}
|
89434
89138
|
});
|
89435
89139
|
|
89140
|
+
// src/utils/create-batches.ts
|
89141
|
+
function* createBatches(array, size) {
|
89142
|
+
for (let i5 = 0; i5 < array.length; i5 += size) {
|
89143
|
+
yield array.slice(i5, i5 + size);
|
89144
|
+
}
|
89145
|
+
}
|
89146
|
+
var init_create_batches = __esm({
|
89147
|
+
"src/utils/create-batches.ts"() {
|
89148
|
+
init_import_meta_url();
|
89149
|
+
__name(createBatches, "createBatches");
|
89150
|
+
}
|
89151
|
+
});
|
89152
|
+
|
89153
|
+
// ../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/quote.js
|
89154
|
+
var require_quote = __commonJS({
|
89155
|
+
"../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/quote.js"(exports2, module3) {
|
89156
|
+
"use strict";
|
89157
|
+
init_import_meta_url();
|
89158
|
+
module3.exports = /* @__PURE__ */ __name(function quote2(xs) {
|
89159
|
+
return xs.map(function(s5) {
|
89160
|
+
if (s5 && typeof s5 === "object") {
|
89161
|
+
return s5.op.replace(/(.)/g, "\\$1");
|
89162
|
+
}
|
89163
|
+
if (/["\s]/.test(s5) && !/'/.test(s5)) {
|
89164
|
+
return "'" + s5.replace(/(['\\])/g, "\\$1") + "'";
|
89165
|
+
}
|
89166
|
+
if (/["'\s]/.test(s5)) {
|
89167
|
+
return '"' + s5.replace(/(["\\$`!])/g, "\\$1") + '"';
|
89168
|
+
}
|
89169
|
+
return String(s5).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, "$1\\$2");
|
89170
|
+
}).join(" ");
|
89171
|
+
}, "quote");
|
89172
|
+
}
|
89173
|
+
});
|
89174
|
+
|
89175
|
+
// ../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/parse.js
|
89176
|
+
var require_parse4 = __commonJS({
|
89177
|
+
"../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/parse.js"(exports2, module3) {
|
89178
|
+
"use strict";
|
89179
|
+
init_import_meta_url();
|
89180
|
+
var CONTROL = "(?:" + [
|
89181
|
+
"\\|\\|",
|
89182
|
+
"\\&\\&",
|
89183
|
+
";;",
|
89184
|
+
"\\|\\&",
|
89185
|
+
"\\<\\(",
|
89186
|
+
"\\<\\<\\<",
|
89187
|
+
">>",
|
89188
|
+
">\\&",
|
89189
|
+
"<\\&",
|
89190
|
+
"[&;()|<>]"
|
89191
|
+
].join("|") + ")";
|
89192
|
+
var controlRE = new RegExp("^" + CONTROL + "$");
|
89193
|
+
var META = "|&;()<> \\t";
|
89194
|
+
var SINGLE_QUOTE = '"((\\\\"|[^"])*?)"';
|
89195
|
+
var DOUBLE_QUOTE = "'((\\\\'|[^'])*?)'";
|
89196
|
+
var hash = /^#$/;
|
89197
|
+
var SQ = "'";
|
89198
|
+
var DQ = '"';
|
89199
|
+
var DS = "$";
|
89200
|
+
var TOKEN = "";
|
89201
|
+
var mult = 4294967296;
|
89202
|
+
for (i5 = 0; i5 < 4; i5++) {
|
89203
|
+
TOKEN += (mult * Math.random()).toString(16);
|
89204
|
+
}
|
89205
|
+
var i5;
|
89206
|
+
var startsWithToken = new RegExp("^" + TOKEN);
|
89207
|
+
function matchAll(s5, r7) {
|
89208
|
+
var origIndex = r7.lastIndex;
|
89209
|
+
var matches = [];
|
89210
|
+
var matchObj;
|
89211
|
+
while (matchObj = r7.exec(s5)) {
|
89212
|
+
matches.push(matchObj);
|
89213
|
+
if (r7.lastIndex === matchObj.index) {
|
89214
|
+
r7.lastIndex += 1;
|
89215
|
+
}
|
89216
|
+
}
|
89217
|
+
r7.lastIndex = origIndex;
|
89218
|
+
return matches;
|
89219
|
+
}
|
89220
|
+
__name(matchAll, "matchAll");
|
89221
|
+
function getVar(env6, pre, key) {
|
89222
|
+
var r7 = typeof env6 === "function" ? env6(key) : env6[key];
|
89223
|
+
if (typeof r7 === "undefined" && key != "") {
|
89224
|
+
r7 = "";
|
89225
|
+
} else if (typeof r7 === "undefined") {
|
89226
|
+
r7 = "$";
|
89227
|
+
}
|
89228
|
+
if (typeof r7 === "object") {
|
89229
|
+
return pre + TOKEN + JSON.stringify(r7) + TOKEN;
|
89230
|
+
}
|
89231
|
+
return pre + r7;
|
89232
|
+
}
|
89233
|
+
__name(getVar, "getVar");
|
89234
|
+
function parseInternal(string, env6, opts) {
|
89235
|
+
if (!opts) {
|
89236
|
+
opts = {};
|
89237
|
+
}
|
89238
|
+
var BS = opts.escape || "\\";
|
89239
|
+
var BAREWORD = "(\\" + BS + `['"` + META + `]|[^\\s'"` + META + "])+";
|
89240
|
+
var chunker = new RegExp([
|
89241
|
+
"(" + CONTROL + ")",
|
89242
|
+
// control chars
|
89243
|
+
"(" + BAREWORD + "|" + SINGLE_QUOTE + "|" + DOUBLE_QUOTE + ")+"
|
89244
|
+
].join("|"), "g");
|
89245
|
+
var matches = matchAll(string, chunker);
|
89246
|
+
if (matches.length === 0) {
|
89247
|
+
return [];
|
89248
|
+
}
|
89249
|
+
if (!env6) {
|
89250
|
+
env6 = {};
|
89251
|
+
}
|
89252
|
+
var commented = false;
|
89253
|
+
return matches.map(function(match2) {
|
89254
|
+
var s5 = match2[0];
|
89255
|
+
if (!s5 || commented) {
|
89256
|
+
return void 0;
|
89257
|
+
}
|
89258
|
+
if (controlRE.test(s5)) {
|
89259
|
+
return { op: s5 };
|
89260
|
+
}
|
89261
|
+
var quote2 = false;
|
89262
|
+
var esc = false;
|
89263
|
+
var out = "";
|
89264
|
+
var isGlob = false;
|
89265
|
+
var i6;
|
89266
|
+
function parseEnvVar() {
|
89267
|
+
i6 += 1;
|
89268
|
+
var varend;
|
89269
|
+
var varname;
|
89270
|
+
var char = s5.charAt(i6);
|
89271
|
+
if (char === "{") {
|
89272
|
+
i6 += 1;
|
89273
|
+
if (s5.charAt(i6) === "}") {
|
89274
|
+
throw new Error("Bad substitution: " + s5.slice(i6 - 2, i6 + 1));
|
89275
|
+
}
|
89276
|
+
varend = s5.indexOf("}", i6);
|
89277
|
+
if (varend < 0) {
|
89278
|
+
throw new Error("Bad substitution: " + s5.slice(i6));
|
89279
|
+
}
|
89280
|
+
varname = s5.slice(i6, varend);
|
89281
|
+
i6 = varend;
|
89282
|
+
} else if (/[*@#?$!_-]/.test(char)) {
|
89283
|
+
varname = char;
|
89284
|
+
i6 += 1;
|
89285
|
+
} else {
|
89286
|
+
var slicedFromI = s5.slice(i6);
|
89287
|
+
varend = slicedFromI.match(/[^\w\d_]/);
|
89288
|
+
if (!varend) {
|
89289
|
+
varname = slicedFromI;
|
89290
|
+
i6 = s5.length;
|
89291
|
+
} else {
|
89292
|
+
varname = slicedFromI.slice(0, varend.index);
|
89293
|
+
i6 += varend.index - 1;
|
89294
|
+
}
|
89295
|
+
}
|
89296
|
+
return getVar(env6, "", varname);
|
89297
|
+
}
|
89298
|
+
__name(parseEnvVar, "parseEnvVar");
|
89299
|
+
for (i6 = 0; i6 < s5.length; i6++) {
|
89300
|
+
var c6 = s5.charAt(i6);
|
89301
|
+
isGlob = isGlob || !quote2 && (c6 === "*" || c6 === "?");
|
89302
|
+
if (esc) {
|
89303
|
+
out += c6;
|
89304
|
+
esc = false;
|
89305
|
+
} else if (quote2) {
|
89306
|
+
if (c6 === quote2) {
|
89307
|
+
quote2 = false;
|
89308
|
+
} else if (quote2 == SQ) {
|
89309
|
+
out += c6;
|
89310
|
+
} else {
|
89311
|
+
if (c6 === BS) {
|
89312
|
+
i6 += 1;
|
89313
|
+
c6 = s5.charAt(i6);
|
89314
|
+
if (c6 === DQ || c6 === BS || c6 === DS) {
|
89315
|
+
out += c6;
|
89316
|
+
} else {
|
89317
|
+
out += BS + c6;
|
89318
|
+
}
|
89319
|
+
} else if (c6 === DS) {
|
89320
|
+
out += parseEnvVar();
|
89321
|
+
} else {
|
89322
|
+
out += c6;
|
89323
|
+
}
|
89324
|
+
}
|
89325
|
+
} else if (c6 === DQ || c6 === SQ) {
|
89326
|
+
quote2 = c6;
|
89327
|
+
} else if (controlRE.test(c6)) {
|
89328
|
+
return { op: s5 };
|
89329
|
+
} else if (hash.test(c6)) {
|
89330
|
+
commented = true;
|
89331
|
+
var commentObj = { comment: string.slice(match2.index + i6 + 1) };
|
89332
|
+
if (out.length) {
|
89333
|
+
return [out, commentObj];
|
89334
|
+
}
|
89335
|
+
return [commentObj];
|
89336
|
+
} else if (c6 === BS) {
|
89337
|
+
esc = true;
|
89338
|
+
} else if (c6 === DS) {
|
89339
|
+
out += parseEnvVar();
|
89340
|
+
} else {
|
89341
|
+
out += c6;
|
89342
|
+
}
|
89343
|
+
}
|
89344
|
+
if (isGlob) {
|
89345
|
+
return { op: "glob", pattern: out };
|
89346
|
+
}
|
89347
|
+
return out;
|
89348
|
+
}).reduce(function(prev, arg) {
|
89349
|
+
return typeof arg === "undefined" ? prev : prev.concat(arg);
|
89350
|
+
}, []);
|
89351
|
+
}
|
89352
|
+
__name(parseInternal, "parseInternal");
|
89353
|
+
module3.exports = /* @__PURE__ */ __name(function parse7(s5, env6, opts) {
|
89354
|
+
var mapped = parseInternal(s5, env6, opts);
|
89355
|
+
if (typeof env6 !== "function") {
|
89356
|
+
return mapped;
|
89357
|
+
}
|
89358
|
+
return mapped.reduce(function(acc, s6) {
|
89359
|
+
if (typeof s6 === "object") {
|
89360
|
+
return acc.concat(s6);
|
89361
|
+
}
|
89362
|
+
var xs = s6.split(RegExp("(" + TOKEN + ".*?" + TOKEN + ")", "g"));
|
89363
|
+
if (xs.length === 1) {
|
89364
|
+
return acc.concat(xs[0]);
|
89365
|
+
}
|
89366
|
+
return acc.concat(xs.filter(Boolean).map(function(x6) {
|
89367
|
+
if (startsWithToken.test(x6)) {
|
89368
|
+
return JSON.parse(x6.split(TOKEN)[1]);
|
89369
|
+
}
|
89370
|
+
return x6;
|
89371
|
+
}));
|
89372
|
+
}, []);
|
89373
|
+
}, "parse");
|
89374
|
+
}
|
89375
|
+
});
|
89376
|
+
|
89377
|
+
// ../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/index.js
|
89378
|
+
var require_shell_quote = __commonJS({
|
89379
|
+
"../../node_modules/.pnpm/shell-quote@1.8.1/node_modules/shell-quote/index.js"(exports2) {
|
89380
|
+
"use strict";
|
89381
|
+
init_import_meta_url();
|
89382
|
+
exports2.quote = require_quote();
|
89383
|
+
exports2.parse = require_parse4();
|
89384
|
+
}
|
89385
|
+
});
|
89386
|
+
|
89387
|
+
// src/utils/shell-quote.ts
|
89388
|
+
function parse4(cmd, env6) {
|
89389
|
+
if (process.platform === "win32") {
|
89390
|
+
cmd = cmd.replaceAll("\\", "\\\\");
|
89391
|
+
}
|
89392
|
+
const entries = import_shell_quote.default.parse(cmd, env6);
|
89393
|
+
const argv = [];
|
89394
|
+
for (const entry of entries) {
|
89395
|
+
if (typeof entry === "string") {
|
89396
|
+
argv.push(entry);
|
89397
|
+
continue;
|
89398
|
+
}
|
89399
|
+
if ("comment" in entry) {
|
89400
|
+
continue;
|
89401
|
+
}
|
89402
|
+
if (entry.op === "glob") {
|
89403
|
+
argv.push(entry.pattern);
|
89404
|
+
continue;
|
89405
|
+
}
|
89406
|
+
throw new Error(
|
89407
|
+
`Only simple commands are supported, please don't use the "${entry.op}" operator in "${cmd}".`
|
89408
|
+
);
|
89409
|
+
}
|
89410
|
+
return argv;
|
89411
|
+
}
|
89412
|
+
var import_shell_quote, quote;
|
89413
|
+
var init_shell_quote = __esm({
|
89414
|
+
"src/utils/shell-quote.ts"() {
|
89415
|
+
init_import_meta_url();
|
89416
|
+
import_shell_quote = __toESM(require_shell_quote());
|
89417
|
+
quote = /* @__PURE__ */ __name(function(args) {
|
89418
|
+
const stringArgs = args.map((arg) => String(arg));
|
89419
|
+
return import_shell_quote.default.quote(stringArgs);
|
89420
|
+
}, "quote");
|
89421
|
+
__name(parse4, "parse");
|
89422
|
+
}
|
89423
|
+
});
|
89424
|
+
|
89425
|
+
// src/init.ts
|
89426
|
+
function isNpm(packageManager) {
|
89427
|
+
return packageManager.type === "npm";
|
89428
|
+
}
|
89429
|
+
async function downloadWorker(accountId, workerName) {
|
89430
|
+
const serviceMetadata = await fetchResult(
|
89431
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
89432
|
+
`/accounts/${accountId}/workers/services/${workerName}`
|
89433
|
+
);
|
89434
|
+
const defaultEnvironment = serviceMetadata.default_environment.environment;
|
89435
|
+
const { entrypoint, modules } = await fetchWorkerDefinitionFromDash(
|
89436
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
89437
|
+
`/accounts/${accountId}/workers/services/${workerName}/environments/${defaultEnvironment}/content/v2`
|
89438
|
+
);
|
89439
|
+
const config = await downloadWorkerConfig(
|
89440
|
+
workerName,
|
89441
|
+
defaultEnvironment,
|
89442
|
+
entrypoint,
|
89443
|
+
accountId
|
89444
|
+
);
|
89445
|
+
return {
|
89446
|
+
modules,
|
89447
|
+
config
|
89448
|
+
};
|
89449
|
+
}
|
89450
|
+
var import_promises13, import_node_path33, import_toml5, init;
|
89451
|
+
var init_init = __esm({
|
89452
|
+
"src/init.ts"() {
|
89453
|
+
init_import_meta_url();
|
89454
|
+
import_promises13 = require("fs/promises");
|
89455
|
+
import_node_path33 = __toESM(require("path"));
|
89456
|
+
import_toml5 = __toESM(require_toml());
|
89457
|
+
init_execa();
|
89458
|
+
init_cfetch();
|
89459
|
+
init_internal();
|
89460
|
+
init_create_command();
|
89461
|
+
init_misc_variables();
|
89462
|
+
init_errors();
|
89463
|
+
init_logger();
|
89464
|
+
init_metrics_config();
|
89465
|
+
init_package_manager();
|
89466
|
+
init_user2();
|
89467
|
+
init_create_batches();
|
89468
|
+
init_download_worker_config();
|
89469
|
+
init_shell_quote();
|
89470
|
+
init = createCommand({
|
89471
|
+
metadata: {
|
89472
|
+
description: "\u{1F4E5} Initialize a basic Worker",
|
89473
|
+
owner: "Workers: Authoring and Testing",
|
89474
|
+
status: "stable"
|
89475
|
+
},
|
89476
|
+
args: {
|
89477
|
+
name: {
|
89478
|
+
describe: "The name of your worker",
|
89479
|
+
type: "string"
|
89480
|
+
},
|
89481
|
+
yes: {
|
89482
|
+
describe: 'Answer "yes" to any prompts for new projects',
|
89483
|
+
type: "boolean",
|
89484
|
+
alias: "y"
|
89485
|
+
},
|
89486
|
+
"from-dash": {
|
89487
|
+
describe: "The name of the Worker you wish to download from the Cloudflare dashboard for local development.",
|
89488
|
+
type: "string",
|
89489
|
+
requiresArg: true
|
89490
|
+
},
|
89491
|
+
"delegate-c3": {
|
89492
|
+
describe: "Delegate to Create Cloudflare CLI (C3)",
|
89493
|
+
type: "boolean",
|
89494
|
+
hidden: true,
|
89495
|
+
default: true,
|
89496
|
+
alias: "c3"
|
89497
|
+
}
|
89498
|
+
},
|
89499
|
+
behaviour: {
|
89500
|
+
provideConfig: false
|
89501
|
+
},
|
89502
|
+
positionalArgs: ["name"],
|
89503
|
+
async handler(args) {
|
89504
|
+
const yesFlag = args.yes ?? false;
|
89505
|
+
const packageManager = await getPackageManager();
|
89506
|
+
const name2 = args.fromDash ?? args.name;
|
89507
|
+
const c3Arguments = [
|
89508
|
+
...parse4(getC3CommandFromEnv()),
|
89509
|
+
...name2 ? [name2] : [],
|
89510
|
+
...yesFlag && isNpm(packageManager) ? ["-y"] : [],
|
89511
|
+
// --yes arg for npx
|
89512
|
+
...isNpm(packageManager) ? ["--"] : [],
|
89513
|
+
...args.fromDash ? ["--existing-script", args.fromDash] : [],
|
89514
|
+
...yesFlag ? ["--wrangler-defaults"] : []
|
89515
|
+
];
|
89516
|
+
const replacementC3Command = `\`${packageManager.type} ${c3Arguments.join(
|
89517
|
+
" "
|
89518
|
+
)}\``;
|
89519
|
+
if (args.fromDash && !args.delegateC3) {
|
89520
|
+
const accountId = await requireAuth({});
|
89521
|
+
try {
|
89522
|
+
await fetchResult(
|
89523
|
+
// `wrangler init` is not run from within a Workers project, so there will be no config file to define the compliance region.
|
89524
|
+
COMPLIANCE_REGION_CONFIG_UNKNOWN,
|
89525
|
+
`/accounts/${accountId}/workers/services/${args.fromDash}`
|
89526
|
+
);
|
89527
|
+
} catch (err) {
|
89528
|
+
if (err.code === 10090) {
|
89529
|
+
throw new UserError(
|
89530
|
+
"wrangler couldn't find a Worker with that name in your account.\nRun `wrangler whoami` to confirm you're logged into the correct account.",
|
89531
|
+
{
|
89532
|
+
telemetryMessage: true
|
89533
|
+
}
|
89534
|
+
);
|
89535
|
+
}
|
89536
|
+
throw err;
|
89537
|
+
}
|
89538
|
+
const creationDir = import_node_path33.default.join(process.cwd(), args.fromDash);
|
89539
|
+
await (0, import_promises13.mkdir)(creationDir, { recursive: true });
|
89540
|
+
const { modules, config } = await downloadWorker(
|
89541
|
+
accountId,
|
89542
|
+
args.fromDash
|
89543
|
+
);
|
89544
|
+
await (0, import_promises13.mkdir)(import_node_path33.default.join(creationDir, "./src"), {
|
89545
|
+
recursive: true
|
89546
|
+
});
|
89547
|
+
config.main = `src/${config.main}`;
|
89548
|
+
config.name = args.fromDash;
|
89549
|
+
for (const files of createBatches(modules, 10)) {
|
89550
|
+
await Promise.all(
|
89551
|
+
files.map(async (file) => {
|
89552
|
+
const filepath = import_node_path33.default.join(creationDir, `./src/${file.name}`);
|
89553
|
+
const directory = (0, import_node_path33.dirname)(filepath);
|
89554
|
+
await (0, import_promises13.mkdir)(directory, { recursive: true });
|
89555
|
+
await (0, import_promises13.writeFile)(filepath, file.stream());
|
89556
|
+
})
|
89557
|
+
);
|
89558
|
+
}
|
89559
|
+
await (0, import_promises13.writeFile)(
|
89560
|
+
import_node_path33.default.join(creationDir, "wrangler.toml"),
|
89561
|
+
import_toml5.default.stringify(config)
|
89562
|
+
);
|
89563
|
+
} else {
|
89564
|
+
logger.log(`\u{1F300} Running ${replacementC3Command}...`);
|
89565
|
+
const metricsConfig = readMetricsConfig();
|
89566
|
+
await execa(packageManager.type, c3Arguments, {
|
89567
|
+
stdio: "inherit",
|
89568
|
+
...metricsConfig.permission?.enabled === false && {
|
89569
|
+
env: { CREATE_CLOUDFLARE_TELEMETRY_DISABLED: "1" }
|
89570
|
+
}
|
89571
|
+
});
|
89572
|
+
}
|
89573
|
+
}
|
89574
|
+
});
|
89575
|
+
__name(isNpm, "isNpm");
|
89576
|
+
__name(downloadWorker, "downloadWorker");
|
89577
|
+
}
|
89578
|
+
});
|
89579
|
+
|
89436
89580
|
// src/kv/index.ts
|
89437
89581
|
var import_node_assert20, import_node_buffer4, import_consumers, import_node_string_decoder, kvNamespace, kvNamespaceNamespace, kvKeyNamespace, kvBulkNamespace, kvNamespaceCreateCommand, kvNamespaceListCommand, kvNamespaceDeleteCommand, kvNamespaceRenameCommand, kvKeyPutCommand, kvKeyListCommand, kvKeyGetCommand, kvKeyDeleteCommand, kvBulkGetCommand, kvBulkPutCommand, kvBulkDeleteCommand;
|
89438
89582
|
var init_kv = __esm({
|
@@ -151005,7 +151149,9 @@ var init_listVectors = __esm({
|
|
151005
151149
|
},
|
151006
151150
|
positionalArgs: ["name"],
|
151007
151151
|
async handler(args, { config }) {
|
151008
|
-
|
151152
|
+
if (!args.json) {
|
151153
|
+
logger.log(`\u{1F4CB} Listing vectors in index '${args.name}'...`);
|
151154
|
+
}
|
151009
151155
|
const options = {};
|
151010
151156
|
if (args.count !== void 0) {
|
151011
151157
|
options.count = args.count;
|
@@ -153533,6 +153679,7 @@ var init_upload2 = __esm({
|
|
153533
153679
|
owner: "Workers: Authoring and Testing",
|
153534
153680
|
status: "stable"
|
153535
153681
|
},
|
153682
|
+
positionalArgs: ["script"],
|
153536
153683
|
args: {
|
153537
153684
|
script: {
|
153538
153685
|
describe: "The path to an entry point for your Worker",
|
@@ -153540,17 +153687,32 @@ var init_upload2 = __esm({
|
|
153540
153687
|
requiresArg: true
|
153541
153688
|
},
|
153542
153689
|
name: {
|
153543
|
-
describe: "Name of the
|
153690
|
+
describe: "Name of the Worker",
|
153691
|
+
type: "string",
|
153692
|
+
requiresArg: true
|
153693
|
+
},
|
153694
|
+
tag: {
|
153695
|
+
describe: "A tag for this Worker Gradual Rollouts Version",
|
153696
|
+
type: "string",
|
153697
|
+
requiresArg: true
|
153698
|
+
},
|
153699
|
+
message: {
|
153700
|
+
describe: "A descriptive message for this Worker Gradual Rollouts Version",
|
153701
|
+
type: "string",
|
153702
|
+
requiresArg: true
|
153703
|
+
},
|
153704
|
+
"preview-alias": {
|
153705
|
+
describe: "Name of an alias for this Worker version",
|
153544
153706
|
type: "string",
|
153545
153707
|
requiresArg: true
|
153546
153708
|
},
|
153547
153709
|
bundle: {
|
153548
|
-
describe: "Run
|
153710
|
+
describe: "Run Wrangler's compilation step before publishing",
|
153549
153711
|
type: "boolean",
|
153550
153712
|
hidden: true
|
153551
153713
|
},
|
153552
153714
|
"no-bundle": {
|
153553
|
-
describe: "Skip internal build steps and directly
|
153715
|
+
describe: "Skip internal build steps and directly upload Worker",
|
153554
153716
|
type: "boolean",
|
153555
153717
|
default: false
|
153556
153718
|
},
|
@@ -153657,24 +153819,9 @@ var init_upload2 = __esm({
|
|
153657
153819
|
deprecated: true
|
153658
153820
|
},
|
153659
153821
|
"dry-run": {
|
153660
|
-
describe: "
|
153822
|
+
describe: "Compile a project without actually uploading the version.",
|
153661
153823
|
type: "boolean"
|
153662
153824
|
},
|
153663
|
-
tag: {
|
153664
|
-
describe: "A tag for this Worker Gradual Rollouts Version",
|
153665
|
-
type: "string",
|
153666
|
-
requiresArg: true
|
153667
|
-
},
|
153668
|
-
message: {
|
153669
|
-
describe: "A descriptive message for this Worker Gradual Rollouts Version",
|
153670
|
-
type: "string",
|
153671
|
-
requiresArg: true
|
153672
|
-
},
|
153673
|
-
"preview-alias": {
|
153674
|
-
describe: "Name of an alias for this Worker version",
|
153675
|
-
type: "string",
|
153676
|
-
requiresArg: true
|
153677
|
-
},
|
153678
153825
|
"experimental-auto-create": {
|
153679
153826
|
describe: "Automatically provision draft bindings with new resources",
|
153680
153827
|
type: "boolean",
|
@@ -159421,13 +159568,16 @@ function configDiffOnlyHasAdditionsIfAny(diff) {
|
|
159421
159568
|
});
|
159422
159569
|
}
|
159423
159570
|
function normalizeLocalResolvedConfigAsRemote(localResolvedConfig) {
|
159571
|
+
const subdomainValues = getSubdomainValues(
|
159572
|
+
localResolvedConfig.workers_dev,
|
159573
|
+
localResolvedConfig.preview_urls,
|
159574
|
+
localResolvedConfig.routes ?? []
|
159575
|
+
);
|
159424
159576
|
const normalizedConfig = {
|
159425
159577
|
...localResolvedConfig,
|
159426
|
-
|
159427
|
-
|
159428
|
-
|
159429
|
-
localResolvedConfig.routes ?? []
|
159430
|
-
)
|
159578
|
+
workers_dev: subdomainValues.workers_dev,
|
159579
|
+
preview_urls: subdomainValues.preview_urls,
|
159580
|
+
observability: normalizeObservability(localResolvedConfig.observability)
|
159431
159581
|
};
|
159432
159582
|
return normalizedConfig;
|
159433
159583
|
}
|
@@ -159527,8 +159677,8 @@ var init_config_diffs = __esm({
|
|
159527
159677
|
"src/deploy/config-diffs.ts"() {
|
159528
159678
|
init_import_meta_url();
|
159529
159679
|
init_colors();
|
159530
|
-
init_diff();
|
159531
159680
|
init_deploy3();
|
159681
|
+
init_diff();
|
159532
159682
|
__name(getRemoteConfigDiff, "getRemoteConfigDiff");
|
159533
159683
|
__name(configDiffOnlyHasAdditionsIfAny, "configDiffOnlyHasAdditionsIfAny");
|
159534
159684
|
__name(normalizeLocalResolvedConfigAsRemote, "normalizeLocalResolvedConfigAsRemote");
|
@@ -159660,10 +159810,10 @@ async function deploy(props) {
|
|
159660
159810
|
let configDiff;
|
159661
159811
|
if (getFlag("DEPLOY_REMOTE_DIFF_CHECK")) {
|
159662
159812
|
const remoteWorkerConfig = await downloadWorkerConfig(
|
159663
|
-
accountId,
|
159664
159813
|
name2,
|
159814
|
+
serviceMetaData.default_environment.environment,
|
159665
159815
|
entry.file,
|
159666
|
-
|
159816
|
+
accountId
|
159667
159817
|
);
|
159668
159818
|
configDiff = getRemoteConfigDiff(remoteWorkerConfig, {
|
159669
159819
|
...config,
|
@@ -160450,7 +160600,6 @@ var init_deploy8 = __esm({
|
|
160450
160600
|
init_misc_variables();
|
160451
160601
|
init_errors();
|
160452
160602
|
init_experimental_flags();
|
160453
|
-
init_init();
|
160454
160603
|
init_logger();
|
160455
160604
|
init_metrics();
|
160456
160605
|
init_navigator_user_agent();
|
@@ -160461,6 +160610,7 @@ var init_deploy8 = __esm({
|
|
160461
160610
|
init_sourcemap();
|
160462
160611
|
init_deploy3();
|
160463
160612
|
init_compatibility_date();
|
160613
|
+
init_download_worker_config();
|
160464
160614
|
init_friendly_validator_errors();
|
160465
160615
|
init_print_bindings();
|
160466
160616
|
init_retry();
|
@@ -160543,7 +160693,7 @@ function logAssetUpload(line, diffCount) {
|
|
160543
160693
|
const msg = " (truncating changed assets log, set `WRANGLER_LOG=debug` environment variable to see full diff)";
|
160544
160694
|
logger.info(source_default.dim(msg));
|
160545
160695
|
}
|
160546
|
-
return diffCount
|
160696
|
+
return ++diffCount;
|
160547
160697
|
}
|
160548
160698
|
function logAssetsUploadStatus(numberFilesToUpload, uploadedAssetsCount, uploadedAssetFiles) {
|
160549
160699
|
logger.info(
|
@@ -160868,7 +161018,6 @@ Assets already uploaded have been saved, so the next attempt will automatically
|
|
160868
161018
|
const files = await (0, import_promises35.readdir)(dir, { recursive: true });
|
160869
161019
|
logReadFilesFromDirectory(dir, files);
|
160870
161020
|
const manifest = {};
|
160871
|
-
let counter = 0;
|
160872
161021
|
const { assetsIgnoreFunction, assetsIgnoreFilePresent } = await createAssetsIgnoreFunction(dir);
|
160873
161022
|
await Promise.all(
|
160874
161023
|
files.map(async (relativeFilepath) => {
|
@@ -160885,14 +161034,6 @@ Assets already uploaded have been saved, so the next attempt will automatically
|
|
160885
161034
|
relativeFilepath,
|
160886
161035
|
assetsIgnoreFilePresent
|
160887
161036
|
);
|
160888
|
-
if (counter >= MAX_ASSET_COUNT2) {
|
160889
|
-
throw new UserError(
|
160890
|
-
`Maximum number of assets exceeded.
|
160891
|
-
Cloudflare Workers supports up to ${MAX_ASSET_COUNT2.toLocaleString()} assets in a version. We found ${counter.toLocaleString()} files in the specified assets directory "${dir}".
|
160892
|
-
Ensure your assets directory contains a maximum of ${MAX_ASSET_COUNT2.toLocaleString()} files, and that you have specified your assets directory correctly.`,
|
160893
|
-
{ telemetryMessage: "Maximum number of assets exceeded" }
|
160894
|
-
);
|
160895
|
-
}
|
160896
161037
|
if (filestat.size > MAX_ASSET_SIZE2) {
|
160897
161038
|
throw new UserError(
|
160898
161039
|
`Asset too large.
|
@@ -160915,7 +161056,6 @@ Ensure all assets in your assets directory "${dir}" conform with the Workers max
|
|
160915
161056
|
hash: hashFile(filepath),
|
160916
161057
|
size: filestat.size
|
160917
161058
|
};
|
160918
|
-
counter++;
|
160919
161059
|
}
|
160920
161060
|
})
|
160921
161061
|
);
|
@@ -180126,6 +180266,7 @@ var init_ProxyController = __esm({
|
|
180126
180266
|
init_https_options();
|
180127
180267
|
init_logger();
|
180128
180268
|
init_sourcemap();
|
180269
|
+
init_assert_never();
|
180129
180270
|
init_BaseController();
|
180130
180271
|
init_events();
|
180131
180272
|
init_utils2();
|