wrangler 4.4.1 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1900,8 +1900,7 @@
1900
1900
  "Text",
1901
1901
  "Data",
1902
1902
  "PythonModule",
1903
- "PythonRequirement",
1904
- "NodeJsCompatModule"
1903
+ "PythonRequirement"
1905
1904
  ],
1906
1905
  "description": "The possible types for a `Rule`."
1907
1906
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.4.1",
3
+ "version": "4.5.1",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -50,14 +50,14 @@
50
50
  "config-schema.json"
51
51
  ],
52
52
  "dependencies": {
53
- "@cloudflare/unenv-preset": "2.3.0",
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
58
  "workerd": "1.20250321.0",
59
59
  "@cloudflare/kv-asset-handler": "0.4.0",
60
- "miniflare": "4.20250321.0"
60
+ "miniflare": "4.20250321.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@aws-sdk/client-s3": "^3.721.0",
@@ -135,9 +135,9 @@
135
135
  "xdg-app-paths": "^8.3.0",
136
136
  "xxhash-wasm": "^1.0.1",
137
137
  "yargs": "^17.7.2",
138
- "@cloudflare/cli": "1.1.1",
139
138
  "@cloudflare/eslint-config-worker": "1.1.0",
140
- "@cloudflare/pages-shared": "^0.13.19",
139
+ "@cloudflare/cli": "1.1.1",
140
+ "@cloudflare/pages-shared": "^0.13.20",
141
141
  "@cloudflare/workers-shared": "0.17.1",
142
142
  "@cloudflare/workers-tsconfig": "0.0.0"
143
143
  },
@@ -668,7 +668,7 @@ declare interface CfModule {
668
668
  /**
669
669
  * A module type.
670
670
  */
671
- declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement" | "nodejs-compat-module";
671
+ declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
672
672
 
673
673
  declare interface CfMTlsCertificate {
674
674
  binding: string;
@@ -1019,7 +1019,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
1019
1019
  /**
1020
1020
  * The possible types for a `Rule`.
1021
1021
  */
1022
- declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement" | "NodeJsCompatModule";
1022
+ declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
1023
1023
 
1024
1024
  declare type ConfigUpdateEvent = {
1025
1025
  type: "configUpdate";
@@ -81185,7 +81185,7 @@ var import_undici3 = __toESM(require_undici());
81185
81185
 
81186
81186
  // package.json
81187
81187
  var name = "wrangler";
81188
- var version = "4.4.1";
81188
+ var version = "4.5.1";
81189
81189
 
81190
81190
  // src/environment-variables/misc-variables.ts
81191
81191
  init_import_meta_url();
@@ -83884,7 +83884,8 @@ function printBindings(bindings, context2 = {}) {
83884
83884
  wasm_modules,
83885
83885
  dispatch_namespaces,
83886
83886
  mtls_certificates,
83887
- pipelines: pipelines2
83887
+ pipelines: pipelines2,
83888
+ assets
83888
83889
  } = bindings;
83889
83890
  if (data_blobs !== void 0 && Object.keys(data_blobs).length > 0) {
83890
83891
  output.push({
@@ -84141,6 +84142,12 @@ function printBindings(bindings, context2 = {}) {
84141
84142
  }))
84142
84143
  });
84143
84144
  }
84145
+ if (assets !== void 0) {
84146
+ output.push({
84147
+ name: friendlyBindingNames.assets,
84148
+ entries: [{ key: "Binding", value: assets.binding }]
84149
+ });
84150
+ }
84144
84151
  if (version_metadata !== void 0) {
84145
84152
  output.push({
84146
84153
  name: friendlyBindingNames.version_metadata,
@@ -91532,8 +91539,7 @@ var RuleTypeToModuleType = {
91532
91539
  Data: "buffer",
91533
91540
  Text: "text",
91534
91541
  PythonModule: "python",
91535
- PythonRequirement: "python-requirement",
91536
- NodeJsCompatModule: "nodejs-compat-module"
91542
+ PythonRequirement: "python-requirement"
91537
91543
  };
91538
91544
  var ModuleTypeToRuleType = flipObject(RuleTypeToModuleType);
91539
91545
  var modulesWatchRegexp = /^wrangler:modules-watch$/;
@@ -99624,6 +99630,19 @@ function logBulkProgress(operation, index, total) {
99624
99630
  );
99625
99631
  }
99626
99632
  __name(logBulkProgress, "logBulkProgress");
99633
+ async function getKVBulkKeyValue(accountId, namespaceId, keys) {
99634
+ const requestPayload = { keys };
99635
+ const result = await fetchResult(
99636
+ `/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/bulk/get`,
99637
+ {
99638
+ method: "POST",
99639
+ body: JSON.stringify(requestPayload),
99640
+ headers: { "Content-Type": "application/json" }
99641
+ }
99642
+ );
99643
+ return result.values;
99644
+ }
99645
+ __name(getKVBulkKeyValue, "getKVBulkKeyValue");
99627
99646
  async function putKVBulkKeyValue(accountId, namespaceId, keyValues, quiet = false, abortSignal) {
99628
99647
  for (let index = 0; index < keyValues.length; index += BATCH_KEY_MAX) {
99629
99648
  if (!quiet && keyValues.length > BATCH_KEY_MAX) {
@@ -103694,8 +103713,7 @@ var moduleTypeMimeType = {
103694
103713
  buffer: "application/octet-stream",
103695
103714
  text: "text/plain",
103696
103715
  python: "text/x-python",
103697
- "python-requirement": "text/x-python-requirement",
103698
- "nodejs-compat-module": void 0
103716
+ "python-requirement": "text/x-python-requirement"
103699
103717
  };
103700
103718
  function toMimeType(type) {
103701
103719
  const mimeType = moduleTypeMimeType[type];
@@ -118478,7 +118496,7 @@ var kvNamespaceDeleteCommand = createCommand({
118478
118496
  binding: {
118479
118497
  type: "string",
118480
118498
  requiresArg: true,
118481
- describe: "The name of the namespace to delete"
118499
+ describe: "The binding name to the namespace to delete from"
118482
118500
  },
118483
118501
  "namespace-id": {
118484
118502
  type: "string",
@@ -118532,7 +118550,7 @@ var kvKeyPutCommand = createCommand({
118532
118550
  binding: {
118533
118551
  type: "string",
118534
118552
  requiresArg: true,
118535
- describe: "The binding of the namespace to write to"
118553
+ describe: "The binding name to the namespace to write to"
118536
118554
  },
118537
118555
  "namespace-id": {
118538
118556
  type: "string",
@@ -118641,7 +118659,7 @@ var kvKeyListCommand = createCommand({
118641
118659
  binding: {
118642
118660
  type: "string",
118643
118661
  requiresArg: true,
118644
- describe: "The name of the namespace to list"
118662
+ describe: "The binding name to the namespace to list"
118645
118663
  },
118646
118664
  "namespace-id": {
118647
118665
  type: "string",
@@ -118719,7 +118737,7 @@ var kvKeyGetCommand = createCommand({
118719
118737
  binding: {
118720
118738
  type: "string",
118721
118739
  requiresArg: true,
118722
- describe: "The name of the namespace to get from"
118740
+ describe: "The binding name to the namespace to get from"
118723
118741
  },
118724
118742
  "namespace-id": {
118725
118743
  type: "string",
@@ -118811,7 +118829,7 @@ var kvKeyDeleteCommand = createCommand({
118811
118829
  binding: {
118812
118830
  type: "string",
118813
118831
  requiresArg: true,
118814
- describe: "The name of the namespace to delete from"
118832
+ describe: "The binding name to the namespace to delete from"
118815
118833
  },
118816
118834
  "namespace-id": {
118817
118835
  type: "string",
@@ -118860,6 +118878,110 @@ var kvKeyDeleteCommand = createCommand({
118860
118878
  });
118861
118879
  }
118862
118880
  });
118881
+ var kvBulkGetCommand = createCommand({
118882
+ metadata: {
118883
+ description: "Gets multiple key-value pairs from a namespace",
118884
+ status: "open-beta",
118885
+ owner: "Product: KV"
118886
+ },
118887
+ positionalArgs: ["filename"],
118888
+ args: {
118889
+ filename: {
118890
+ describe: "The file containing the keys to get",
118891
+ type: "string",
118892
+ demandOption: true
118893
+ },
118894
+ binding: {
118895
+ type: "string",
118896
+ requiresArg: true,
118897
+ describe: "The binding name to the namespace to get from"
118898
+ },
118899
+ "namespace-id": {
118900
+ type: "string",
118901
+ requiresArg: true,
118902
+ describe: "The id of the namespace to get from"
118903
+ },
118904
+ preview: {
118905
+ type: "boolean",
118906
+ describe: "Interact with a preview namespace"
118907
+ },
118908
+ local: {
118909
+ type: "boolean",
118910
+ describe: "Interact with local storage"
118911
+ },
118912
+ remote: {
118913
+ type: "boolean",
118914
+ describe: "Interact with remote storage",
118915
+ conflicts: "local"
118916
+ },
118917
+ "persist-to": {
118918
+ type: "string",
118919
+ describe: "Directory for local persistence"
118920
+ }
118921
+ },
118922
+ async handler({ filename, ...args }) {
118923
+ const localMode = isLocal(args);
118924
+ const config = readConfig(args);
118925
+ const namespaceId = getKVNamespaceId(args, config);
118926
+ const content = parseJSON(readFileSync6(filename), filename);
118927
+ if (!Array.isArray(content)) {
118928
+ throw new UserError(
118929
+ `Unexpected JSON input from "${filename}".
118930
+ Expected an array of strings but got:
118931
+ ${content}`
118932
+ );
118933
+ }
118934
+ const errors = [];
118935
+ const keysToGet = [];
118936
+ for (const [index, item] of content.entries()) {
118937
+ const key = typeof item !== "string" ? item?.name : item;
118938
+ if (typeof key !== "string") {
118939
+ errors.push(
118940
+ `The item at index ${index} is type: "${typeof item}" - ${JSON.stringify(
118941
+ item
118942
+ )}`
118943
+ );
118944
+ continue;
118945
+ }
118946
+ keysToGet.push(key);
118947
+ }
118948
+ if (errors.length > 0) {
118949
+ throw new UserError(
118950
+ `Unexpected JSON input from "${filename}".
118951
+ Expected an array of strings or objects with a "name" key.
118952
+ ` + errors.join("\n")
118953
+ );
118954
+ }
118955
+ if (localMode) {
118956
+ const result = await usingLocalNamespace(
118957
+ args.persistTo,
118958
+ config,
118959
+ namespaceId,
118960
+ async (namespace) => {
118961
+ const out = {};
118962
+ for (const key of keysToGet) {
118963
+ const value = await namespace.get(key, "text");
118964
+ out[key] = {
118965
+ value
118966
+ };
118967
+ }
118968
+ return out;
118969
+ }
118970
+ );
118971
+ logger.log(JSON.stringify(result, null, 2));
118972
+ } else {
118973
+ const accountId = await requireAuth(config);
118974
+ logger.log(
118975
+ JSON.stringify(
118976
+ await getKVBulkKeyValue(accountId, namespaceId, keysToGet),
118977
+ null,
118978
+ 2
118979
+ )
118980
+ );
118981
+ }
118982
+ logger.log("\nSuccess!");
118983
+ }
118984
+ });
118863
118985
  var kvBulkPutCommand = createCommand({
118864
118986
  metadata: {
118865
118987
  description: "Upload multiple key-value pairs to a namespace",
@@ -118876,7 +118998,7 @@ var kvBulkPutCommand = createCommand({
118876
118998
  binding: {
118877
118999
  type: "string",
118878
119000
  requiresArg: true,
118879
- describe: "The name of the namespace to write to"
119001
+ describe: "The binding name to the namespace to write to"
118880
119002
  },
118881
119003
  "namespace-id": {
118882
119004
  type: "string",
@@ -119018,7 +119140,7 @@ var kvBulkDeleteCommand = createCommand({
119018
119140
  binding: {
119019
119141
  type: "string",
119020
119142
  requiresArg: true,
119021
- describe: "The name of the namespace to delete from"
119143
+ describe: "The binding name to the namespace to delete from"
119022
119144
  },
119023
119145
  "namespace-id": {
119024
119146
  type: "string",
@@ -149297,6 +149419,7 @@ function createCLIParser(argv) {
149297
149419
  { command: "wrangler kv key list", definition: kvKeyListCommand },
149298
149420
  { command: "wrangler kv key get", definition: kvKeyGetCommand },
149299
149421
  { command: "wrangler kv key delete", definition: kvKeyDeleteCommand },
149422
+ { command: "wrangler kv bulk get", definition: kvBulkGetCommand },
149300
149423
  { command: "wrangler kv bulk put", definition: kvBulkPutCommand },
149301
149424
  { command: "wrangler kv bulk delete", definition: kvBulkDeleteCommand }
149302
149425
  ]);
@@ -154886,4 +155009,3 @@ yargs-parser/build/lib/index.js:
154886
155009
  * SPDX-License-Identifier: ISC
154887
155010
  *)
154888
155011
  */
154889
- //# sourceMappingURL=cli.js.map