wrangler 4.4.0 → 4.5.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/package.json +8 -8
- package/wrangler-dist/cli.js +168 -32
- package/wrangler-dist/cli.js.map +0 -7
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "wrangler",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.5.0",
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
5
5
|
"keywords": [
|
6
6
|
"wrangler",
|
@@ -50,19 +50,19 @@
|
|
50
50
|
"config-schema.json"
|
51
51
|
],
|
52
52
|
"dependencies": {
|
53
|
-
"@cloudflare/unenv-preset": "2.3.
|
53
|
+
"@cloudflare/unenv-preset": "2.3.1",
|
54
54
|
"blake3-wasm": "2.1.5",
|
55
55
|
"esbuild": "0.24.2",
|
56
56
|
"path-to-regexp": "6.3.0",
|
57
57
|
"unenv": "2.0.0-rc.15",
|
58
|
-
"workerd": "1.
|
58
|
+
"workerd": "1.20250321.0",
|
59
59
|
"@cloudflare/kv-asset-handler": "0.4.0",
|
60
|
-
"miniflare": "4.
|
60
|
+
"miniflare": "4.20250321.0"
|
61
61
|
},
|
62
62
|
"devDependencies": {
|
63
63
|
"@aws-sdk/client-s3": "^3.721.0",
|
64
64
|
"@cloudflare/types": "6.18.4",
|
65
|
-
"@cloudflare/workers-types": "^4.
|
65
|
+
"@cloudflare/workers-types": "^4.20250321.0",
|
66
66
|
"@cspotcode/source-map-support": "0.8.1",
|
67
67
|
"@iarna/toml": "^3.0.0",
|
68
68
|
"@microsoft/api-extractor": "^7.47.0",
|
@@ -136,13 +136,13 @@
|
|
136
136
|
"xxhash-wasm": "^1.0.1",
|
137
137
|
"yargs": "^17.7.2",
|
138
138
|
"@cloudflare/cli": "1.1.1",
|
139
|
-
"@cloudflare/pages-shared": "^0.13.18",
|
140
139
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
141
|
-
"@cloudflare/
|
140
|
+
"@cloudflare/pages-shared": "^0.13.19",
|
141
|
+
"@cloudflare/workers-shared": "0.17.1",
|
142
142
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
143
143
|
},
|
144
144
|
"peerDependencies": {
|
145
|
-
"@cloudflare/workers-types": "^4.
|
145
|
+
"@cloudflare/workers-types": "^4.20250321.0"
|
146
146
|
},
|
147
147
|
"peerDependenciesMeta": {
|
148
148
|
"@cloudflare/workers-types": {
|
package/wrangler-dist/cli.js
CHANGED
@@ -76441,13 +76441,14 @@ ${invalidHeaderRulesList}`
|
|
76441
76441
|
}
|
76442
76442
|
const rules = {};
|
76443
76443
|
for (const rule of headers.rules) {
|
76444
|
-
|
76444
|
+
const configuredRule = {};
|
76445
76445
|
if (Object.keys(rule.headers).length) {
|
76446
|
-
|
76446
|
+
configuredRule.set = rule.headers;
|
76447
76447
|
}
|
76448
76448
|
if (rule.unsetHeaders.length) {
|
76449
|
-
|
76449
|
+
configuredRule.unset = rule.unsetHeaders;
|
76450
76450
|
}
|
76451
|
+
rules[rule.path] = configuredRule;
|
76451
76452
|
}
|
76452
76453
|
return {
|
76453
76454
|
headers: {
|
@@ -76598,26 +76599,29 @@ var init_validateURL = __esm({
|
|
76598
76599
|
});
|
76599
76600
|
|
76600
76601
|
// ../workers-shared/utils/configuration/parseHeaders.ts
|
76601
|
-
function parseHeaders(input
|
76602
|
+
function parseHeaders(input, {
|
76603
|
+
maxRules = MAX_HEADER_RULES,
|
76604
|
+
maxLineLength = MAX_LINE_LENGTH
|
76605
|
+
} = {}) {
|
76602
76606
|
const lines = input.split("\n");
|
76603
76607
|
const rules = [];
|
76604
76608
|
const invalid = [];
|
76605
76609
|
let rule = void 0;
|
76606
76610
|
for (let i5 = 0; i5 < lines.length; i5++) {
|
76607
|
-
const line = lines[i5].trim();
|
76611
|
+
const line = (lines[i5] || "").trim();
|
76608
76612
|
if (line.length === 0 || line.startsWith("#")) {
|
76609
76613
|
continue;
|
76610
76614
|
}
|
76611
|
-
if (line.length >
|
76615
|
+
if (line.length > maxLineLength) {
|
76612
76616
|
invalid.push({
|
76613
|
-
message: `Ignoring line ${i5 + 1} as it exceeds the maximum allowed length of ${
|
76617
|
+
message: `Ignoring line ${i5 + 1} as it exceeds the maximum allowed length of ${maxLineLength}.`
|
76614
76618
|
});
|
76615
76619
|
continue;
|
76616
76620
|
}
|
76617
76621
|
if (LINE_IS_PROBABLY_A_PATH.test(line)) {
|
76618
|
-
if (rules.length >=
|
76622
|
+
if (rules.length >= maxRules) {
|
76619
76623
|
invalid.push({
|
76620
|
-
message: `Maximum number of rules supported is ${
|
76624
|
+
message: `Maximum number of rules supported is ${maxRules}. Skipping remaining ${lines.length - i5} lines of file.`
|
76621
76625
|
});
|
76622
76626
|
break;
|
76623
76627
|
}
|
@@ -76675,7 +76679,7 @@ function parseHeaders(input) {
|
|
76675
76679
|
continue;
|
76676
76680
|
}
|
76677
76681
|
const [rawName, ...rawValue] = line.split(HEADER_SEPARATOR);
|
76678
|
-
const name2 = rawName.trim().toLowerCase();
|
76682
|
+
const name2 = (rawName || "").trim().toLowerCase();
|
76679
76683
|
if (name2.includes(" ")) {
|
76680
76684
|
invalid.push({
|
76681
76685
|
line,
|
@@ -76745,7 +76749,11 @@ var init_parseHeaders = __esm({
|
|
76745
76749
|
});
|
76746
76750
|
|
76747
76751
|
// ../workers-shared/utils/configuration/parseRedirects.ts
|
76748
|
-
function parseRedirects(input
|
76752
|
+
function parseRedirects(input, {
|
76753
|
+
maxStaticRules = MAX_STATIC_REDIRECT_RULES,
|
76754
|
+
maxDynamicRules = MAX_DYNAMIC_REDIRECT_RULES,
|
76755
|
+
maxLineLength = MAX_LINE_LENGTH
|
76756
|
+
} = {}) {
|
76749
76757
|
const lines = input.split("\n");
|
76750
76758
|
const rules = [];
|
76751
76759
|
const seen_paths = /* @__PURE__ */ new Set();
|
@@ -76754,13 +76762,13 @@ function parseRedirects(input) {
|
|
76754
76762
|
let dynamicRules = 0;
|
76755
76763
|
let canCreateStaticRule = true;
|
76756
76764
|
for (let i5 = 0; i5 < lines.length; i5++) {
|
76757
|
-
const line = lines[i5].trim();
|
76765
|
+
const line = (lines[i5] || "").trim();
|
76758
76766
|
if (line.length === 0 || line.startsWith("#")) {
|
76759
76767
|
continue;
|
76760
76768
|
}
|
76761
|
-
if (line.length >
|
76769
|
+
if (line.length > maxLineLength) {
|
76762
76770
|
invalid.push({
|
76763
|
-
message: `Ignoring line ${i5 + 1} as it exceeds the maximum allowed length of ${
|
76771
|
+
message: `Ignoring line ${i5 + 1} as it exceeds the maximum allowed length of ${maxLineLength}.`
|
76764
76772
|
});
|
76765
76773
|
continue;
|
76766
76774
|
}
|
@@ -76786,18 +76794,18 @@ function parseRedirects(input) {
|
|
76786
76794
|
const from = fromResult[0];
|
76787
76795
|
if (canCreateStaticRule && !from.match(SPLAT_REGEX) && !from.match(PLACEHOLDER_REGEX)) {
|
76788
76796
|
staticRules += 1;
|
76789
|
-
if (staticRules >
|
76797
|
+
if (staticRules > maxStaticRules) {
|
76790
76798
|
invalid.push({
|
76791
|
-
message: `Maximum number of static rules supported is ${
|
76799
|
+
message: `Maximum number of static rules supported is ${maxStaticRules}. Skipping line.`
|
76792
76800
|
});
|
76793
76801
|
continue;
|
76794
76802
|
}
|
76795
76803
|
} else {
|
76796
76804
|
dynamicRules += 1;
|
76797
76805
|
canCreateStaticRule = false;
|
76798
|
-
if (dynamicRules >
|
76806
|
+
if (dynamicRules > maxDynamicRules) {
|
76799
76807
|
invalid.push({
|
76800
|
-
message: `Maximum number of dynamic rules supported is ${
|
76808
|
+
message: `Maximum number of dynamic rules supported is ${maxDynamicRules}. Skipping remaining ${lines.length - i5} lines of file.`
|
76801
76809
|
});
|
76802
76810
|
break;
|
76803
76811
|
}
|
@@ -81177,7 +81185,7 @@ var import_undici3 = __toESM(require_undici());
|
|
81177
81185
|
|
81178
81186
|
// package.json
|
81179
81187
|
var name = "wrangler";
|
81180
|
-
var version = "4.
|
81188
|
+
var version = "4.5.0";
|
81181
81189
|
|
81182
81190
|
// src/environment-variables/misc-variables.ts
|
81183
81191
|
init_import_meta_url();
|
@@ -83876,7 +83884,8 @@ function printBindings(bindings, context2 = {}) {
|
|
83876
83884
|
wasm_modules,
|
83877
83885
|
dispatch_namespaces,
|
83878
83886
|
mtls_certificates,
|
83879
|
-
pipelines: pipelines2
|
83887
|
+
pipelines: pipelines2,
|
83888
|
+
assets
|
83880
83889
|
} = bindings;
|
83881
83890
|
if (data_blobs !== void 0 && Object.keys(data_blobs).length > 0) {
|
83882
83891
|
output.push({
|
@@ -84133,6 +84142,12 @@ function printBindings(bindings, context2 = {}) {
|
|
84133
84142
|
}))
|
84134
84143
|
});
|
84135
84144
|
}
|
84145
|
+
if (assets !== void 0) {
|
84146
|
+
output.push({
|
84147
|
+
name: friendlyBindingNames.assets,
|
84148
|
+
entries: [{ key: "Binding", value: assets.binding }]
|
84149
|
+
});
|
84150
|
+
}
|
84136
84151
|
if (version_metadata !== void 0) {
|
84137
84152
|
output.push({
|
84138
84153
|
name: friendlyBindingNames.version_metadata,
|
@@ -99616,6 +99631,19 @@ function logBulkProgress(operation, index, total) {
|
|
99616
99631
|
);
|
99617
99632
|
}
|
99618
99633
|
__name(logBulkProgress, "logBulkProgress");
|
99634
|
+
async function getKVBulkKeyValue(accountId, namespaceId, keys) {
|
99635
|
+
const requestPayload = { keys };
|
99636
|
+
const result = await fetchResult(
|
99637
|
+
`/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/bulk/get`,
|
99638
|
+
{
|
99639
|
+
method: "POST",
|
99640
|
+
body: JSON.stringify(requestPayload),
|
99641
|
+
headers: { "Content-Type": "application/json" }
|
99642
|
+
}
|
99643
|
+
);
|
99644
|
+
return result.values;
|
99645
|
+
}
|
99646
|
+
__name(getKVBulkKeyValue, "getKVBulkKeyValue");
|
99619
99647
|
async function putKVBulkKeyValue(accountId, namespaceId, keyValues, quiet = false, abortSignal) {
|
99620
99648
|
for (let index = 0; index < keyValues.length; index += BATCH_KEY_MAX) {
|
99621
99649
|
if (!quiet && keyValues.length > BATCH_KEY_MAX) {
|
@@ -112096,7 +112124,7 @@ async function getNetworkInput(args) {
|
|
112096
112124
|
label: "Include IPv4",
|
112097
112125
|
type: "confirm"
|
112098
112126
|
});
|
112099
|
-
return ipv4 === true ? { assign_ipv4: "predefined" /* PREDEFINED */ } :
|
112127
|
+
return ipv4 === true ? { assign_ipv4: "predefined" /* PREDEFINED */ } : { assign_ipv6: "predefined" /* PREDEFINED */ };
|
112100
112128
|
}
|
112101
112129
|
__name(getNetworkInput, "getNetworkInput");
|
112102
112130
|
|
@@ -112488,7 +112516,7 @@ async function createCommand2(args, config) {
|
|
112488
112516
|
}
|
112489
112517
|
const keysToAdd = args.allSshKeys ? (await pollSSHKeysUntilCondition(() => true)).map((key) => key.id) : [];
|
112490
112518
|
const useIpv4 = args.ipv4 ?? config.cloudchamber.ipv4;
|
112491
|
-
const network = useIpv4 === true ? { assign_ipv4: "predefined" /* PREDEFINED */ } :
|
112519
|
+
const network = useIpv4 === true ? { assign_ipv4: "predefined" /* PREDEFINED */ } : { assign_ipv6: "predefined" /* PREDEFINED */ };
|
112492
112520
|
const deployment = await DeploymentsService.createDeploymentV2({
|
112493
112521
|
image: body.image,
|
112494
112522
|
location: body.location,
|
@@ -116713,9 +116741,13 @@ async function verifyWorkerMatchesCITag(accountId, workerName, configPath) {
|
|
116713
116741
|
throw new FatalError(
|
116714
116742
|
`The name in your ${configFileName(configPath)} file (${workerName}) must match the name of your Worker. Please update the name field in your ${configFileName(configPath)} file.`
|
116715
116743
|
);
|
116744
|
+
} else if (e7 instanceof APIError) {
|
116745
|
+
throw new FatalError(
|
116746
|
+
"An error occurred while trying to validate that the Worker name matches what is expected by the build system.\n" + e7.message + "\n" + e7.notes.map((note) => note.text).join("\n")
|
116747
|
+
);
|
116716
116748
|
} else {
|
116717
116749
|
throw new FatalError(
|
116718
|
-
"Wrangler cannot validate that your Worker name matches what is expected by the build system. Please retry the build."
|
116750
|
+
"Wrangler cannot validate that your Worker name matches what is expected by the build system. Please retry the build. If the problem persists, please contact support."
|
116719
116751
|
);
|
116720
116752
|
}
|
116721
116753
|
}
|
@@ -118466,7 +118498,7 @@ var kvNamespaceDeleteCommand = createCommand({
|
|
118466
118498
|
binding: {
|
118467
118499
|
type: "string",
|
118468
118500
|
requiresArg: true,
|
118469
|
-
describe: "The name
|
118501
|
+
describe: "The binding name to the namespace to delete from"
|
118470
118502
|
},
|
118471
118503
|
"namespace-id": {
|
118472
118504
|
type: "string",
|
@@ -118520,7 +118552,7 @@ var kvKeyPutCommand = createCommand({
|
|
118520
118552
|
binding: {
|
118521
118553
|
type: "string",
|
118522
118554
|
requiresArg: true,
|
118523
|
-
describe: "The binding
|
118555
|
+
describe: "The binding name to the namespace to write to"
|
118524
118556
|
},
|
118525
118557
|
"namespace-id": {
|
118526
118558
|
type: "string",
|
@@ -118629,7 +118661,7 @@ var kvKeyListCommand = createCommand({
|
|
118629
118661
|
binding: {
|
118630
118662
|
type: "string",
|
118631
118663
|
requiresArg: true,
|
118632
|
-
describe: "The name
|
118664
|
+
describe: "The binding name to the namespace to list"
|
118633
118665
|
},
|
118634
118666
|
"namespace-id": {
|
118635
118667
|
type: "string",
|
@@ -118707,7 +118739,7 @@ var kvKeyGetCommand = createCommand({
|
|
118707
118739
|
binding: {
|
118708
118740
|
type: "string",
|
118709
118741
|
requiresArg: true,
|
118710
|
-
describe: "The name
|
118742
|
+
describe: "The binding name to the namespace to get from"
|
118711
118743
|
},
|
118712
118744
|
"namespace-id": {
|
118713
118745
|
type: "string",
|
@@ -118799,7 +118831,7 @@ var kvKeyDeleteCommand = createCommand({
|
|
118799
118831
|
binding: {
|
118800
118832
|
type: "string",
|
118801
118833
|
requiresArg: true,
|
118802
|
-
describe: "The name
|
118834
|
+
describe: "The binding name to the namespace to delete from"
|
118803
118835
|
},
|
118804
118836
|
"namespace-id": {
|
118805
118837
|
type: "string",
|
@@ -118848,6 +118880,110 @@ var kvKeyDeleteCommand = createCommand({
|
|
118848
118880
|
});
|
118849
118881
|
}
|
118850
118882
|
});
|
118883
|
+
var kvBulkGetCommand = createCommand({
|
118884
|
+
metadata: {
|
118885
|
+
description: "Gets multiple key-value pairs from a namespace",
|
118886
|
+
status: "open-beta",
|
118887
|
+
owner: "Product: KV"
|
118888
|
+
},
|
118889
|
+
positionalArgs: ["filename"],
|
118890
|
+
args: {
|
118891
|
+
filename: {
|
118892
|
+
describe: "The file containing the keys to get",
|
118893
|
+
type: "string",
|
118894
|
+
demandOption: true
|
118895
|
+
},
|
118896
|
+
binding: {
|
118897
|
+
type: "string",
|
118898
|
+
requiresArg: true,
|
118899
|
+
describe: "The binding name to the namespace to get from"
|
118900
|
+
},
|
118901
|
+
"namespace-id": {
|
118902
|
+
type: "string",
|
118903
|
+
requiresArg: true,
|
118904
|
+
describe: "The id of the namespace to get from"
|
118905
|
+
},
|
118906
|
+
preview: {
|
118907
|
+
type: "boolean",
|
118908
|
+
describe: "Interact with a preview namespace"
|
118909
|
+
},
|
118910
|
+
local: {
|
118911
|
+
type: "boolean",
|
118912
|
+
describe: "Interact with local storage"
|
118913
|
+
},
|
118914
|
+
remote: {
|
118915
|
+
type: "boolean",
|
118916
|
+
describe: "Interact with remote storage",
|
118917
|
+
conflicts: "local"
|
118918
|
+
},
|
118919
|
+
"persist-to": {
|
118920
|
+
type: "string",
|
118921
|
+
describe: "Directory for local persistence"
|
118922
|
+
}
|
118923
|
+
},
|
118924
|
+
async handler({ filename, ...args }) {
|
118925
|
+
const localMode = isLocal(args);
|
118926
|
+
const config = readConfig(args);
|
118927
|
+
const namespaceId = getKVNamespaceId(args, config);
|
118928
|
+
const content = parseJSON(readFileSync6(filename), filename);
|
118929
|
+
if (!Array.isArray(content)) {
|
118930
|
+
throw new UserError(
|
118931
|
+
`Unexpected JSON input from "${filename}".
|
118932
|
+
Expected an array of strings but got:
|
118933
|
+
${content}`
|
118934
|
+
);
|
118935
|
+
}
|
118936
|
+
const errors = [];
|
118937
|
+
const keysToGet = [];
|
118938
|
+
for (const [index, item] of content.entries()) {
|
118939
|
+
const key = typeof item !== "string" ? item?.name : item;
|
118940
|
+
if (typeof key !== "string") {
|
118941
|
+
errors.push(
|
118942
|
+
`The item at index ${index} is type: "${typeof item}" - ${JSON.stringify(
|
118943
|
+
item
|
118944
|
+
)}`
|
118945
|
+
);
|
118946
|
+
continue;
|
118947
|
+
}
|
118948
|
+
keysToGet.push(key);
|
118949
|
+
}
|
118950
|
+
if (errors.length > 0) {
|
118951
|
+
throw new UserError(
|
118952
|
+
`Unexpected JSON input from "${filename}".
|
118953
|
+
Expected an array of strings or objects with a "name" key.
|
118954
|
+
` + errors.join("\n")
|
118955
|
+
);
|
118956
|
+
}
|
118957
|
+
if (localMode) {
|
118958
|
+
const result = await usingLocalNamespace(
|
118959
|
+
args.persistTo,
|
118960
|
+
config,
|
118961
|
+
namespaceId,
|
118962
|
+
async (namespace) => {
|
118963
|
+
const out = {};
|
118964
|
+
for (const key of keysToGet) {
|
118965
|
+
const value = await namespace.get(key, "text");
|
118966
|
+
out[key] = {
|
118967
|
+
value
|
118968
|
+
};
|
118969
|
+
}
|
118970
|
+
return out;
|
118971
|
+
}
|
118972
|
+
);
|
118973
|
+
logger.log(JSON.stringify(result, null, 2));
|
118974
|
+
} else {
|
118975
|
+
const accountId = await requireAuth(config);
|
118976
|
+
logger.log(
|
118977
|
+
JSON.stringify(
|
118978
|
+
await getKVBulkKeyValue(accountId, namespaceId, keysToGet),
|
118979
|
+
null,
|
118980
|
+
2
|
118981
|
+
)
|
118982
|
+
);
|
118983
|
+
}
|
118984
|
+
logger.log("\nSuccess!");
|
118985
|
+
}
|
118986
|
+
});
|
118851
118987
|
var kvBulkPutCommand = createCommand({
|
118852
118988
|
metadata: {
|
118853
118989
|
description: "Upload multiple key-value pairs to a namespace",
|
@@ -118864,7 +119000,7 @@ var kvBulkPutCommand = createCommand({
|
|
118864
119000
|
binding: {
|
118865
119001
|
type: "string",
|
118866
119002
|
requiresArg: true,
|
118867
|
-
describe: "The name
|
119003
|
+
describe: "The binding name to the namespace to write to"
|
118868
119004
|
},
|
118869
119005
|
"namespace-id": {
|
118870
119006
|
type: "string",
|
@@ -119006,7 +119142,7 @@ var kvBulkDeleteCommand = createCommand({
|
|
119006
119142
|
binding: {
|
119007
119143
|
type: "string",
|
119008
119144
|
requiresArg: true,
|
119009
|
-
describe: "The name
|
119145
|
+
describe: "The binding name to the namespace to delete from"
|
119010
119146
|
},
|
119011
119147
|
"namespace-id": {
|
119012
119148
|
type: "string",
|
@@ -123009,7 +123145,7 @@ var Handler14 = /* @__PURE__ */ __name(async (args) => {
|
|
123009
123145
|
}
|
123010
123146
|
if (args.env) {
|
123011
123147
|
throw new FatalError(
|
123012
|
-
"Pages does not support targeting an environment with the --env flag
|
123148
|
+
"Pages does not support targeting an environment with the --env flag during local development.",
|
123013
123149
|
1
|
123014
123150
|
);
|
123015
123151
|
}
|
@@ -149285,6 +149421,7 @@ function createCLIParser(argv) {
|
|
149285
149421
|
{ command: "wrangler kv key list", definition: kvKeyListCommand },
|
149286
149422
|
{ command: "wrangler kv key get", definition: kvKeyGetCommand },
|
149287
149423
|
{ command: "wrangler kv key delete", definition: kvKeyDeleteCommand },
|
149424
|
+
{ command: "wrangler kv bulk get", definition: kvBulkGetCommand },
|
149288
149425
|
{ command: "wrangler kv bulk put", definition: kvBulkPutCommand },
|
149289
149426
|
{ command: "wrangler kv bulk delete", definition: kvBulkDeleteCommand }
|
149290
149427
|
]);
|
@@ -154874,4 +155011,3 @@ yargs-parser/build/lib/index.js:
|
|
154874
155011
|
* SPDX-License-Identifier: ISC
|
154875
155012
|
*)
|
154876
155013
|
*/
|
154877
|
-
//# sourceMappingURL=cli.js.map
|