wrangler 3.114.2 → 3.114.4

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.
@@ -74,8 +74,7 @@
74
74
  "Text",
75
75
  "Data",
76
76
  "PythonModule",
77
- "PythonRequirement",
78
- "NodeJsCompatModule"
77
+ "PythonRequirement"
79
78
  ],
80
79
  "type": "string"
81
80
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "3.114.2",
3
+ "version": "3.114.4",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -59,7 +59,7 @@
59
59
  "unenv": "2.0.0-rc.14",
60
60
  "workerd": "1.20250310.0",
61
61
  "@cloudflare/kv-asset-handler": "0.3.4",
62
- "miniflare": "3.20250310.1"
62
+ "miniflare": "3.20250310.2"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@aws-sdk/client-s3": "^3.721.0",
@@ -139,7 +139,7 @@
139
139
  "yargs": "^17.7.2",
140
140
  "@cloudflare/cli": "1.1.1",
141
141
  "@cloudflare/eslint-config-worker": "1.1.0",
142
- "@cloudflare/pages-shared": "^0.13.14",
142
+ "@cloudflare/pages-shared": "0.13.15",
143
143
  "@cloudflare/workers-shared": "0.15.0",
144
144
  "@cloudflare/workers-tsconfig": "0.0.0"
145
145
  },
@@ -680,7 +680,7 @@ declare interface CfModule {
680
680
  /**
681
681
  * A module type.
682
682
  */
683
- declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement" | "nodejs-compat-module";
683
+ declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
684
684
 
685
685
  declare interface CfMTlsCertificate {
686
686
  binding: string;
@@ -1045,7 +1045,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
1045
1045
  /**
1046
1046
  * The possible types for a `Rule`.
1047
1047
  */
1048
- declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement" | "NodeJsCompatModule";
1048
+ declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
1049
1049
 
1050
1050
  declare type ConfigUpdateEvent = {
1051
1051
  type: "configUpdate";
@@ -81450,7 +81450,7 @@ var import_undici3 = __toESM(require_undici());
81450
81450
 
81451
81451
  // package.json
81452
81452
  var name = "wrangler";
81453
- var version = "3.114.2";
81453
+ var version = "3.114.4";
81454
81454
 
81455
81455
  // src/environment-variables/misc-variables.ts
81456
81456
  init_import_meta_url();
@@ -90767,11 +90767,14 @@ function hasCursor(result_info) {
90767
90767
  }
90768
90768
  __name(hasCursor, "hasCursor");
90769
90769
  function renderError(err, level = 0) {
90770
+ const indent = " ".repeat(level);
90770
90771
  const chainedMessages = err.error_chain?.map(
90771
90772
  (chainedError) => `
90772
- ${" ".repeat(level)}- ${renderError(chainedError, level + 1)}`
90773
+
90774
+ ${indent}- ${renderError(chainedError, level + 1)}`
90773
90775
  ).join("\n") ?? "";
90774
- return (err.code ? `${err.message} [code: ${err.code}]` : err.message) + chainedMessages;
90776
+ return (err.code ? `${err.message} [code: ${err.code}]` : err.message) + (err.documentation_url ? `
90777
+ ${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
90775
90778
  }
90776
90779
  __name(renderError, "renderError");
90777
90780
 
@@ -92183,8 +92186,7 @@ var RuleTypeToModuleType = {
92183
92186
  Data: "buffer",
92184
92187
  Text: "text",
92185
92188
  PythonModule: "python",
92186
- PythonRequirement: "python-requirement",
92187
- NodeJsCompatModule: "nodejs-compat-module"
92189
+ PythonRequirement: "python-requirement"
92188
92190
  };
92189
92191
  var ModuleTypeToRuleType = flipObject(RuleTypeToModuleType);
92190
92192
  var modulesWatchRegexp = /^wrangler:modules-watch$/;
@@ -104382,8 +104384,7 @@ var moduleTypeMimeType = {
104382
104384
  buffer: "application/octet-stream",
104383
104385
  text: "text/plain",
104384
104386
  python: "text/x-python",
104385
- "python-requirement": "text/x-python-requirement",
104386
- "nodejs-compat-module": void 0
104387
+ "python-requirement": "text/x-python-requirement"
104387
104388
  };
104388
104389
  function toMimeType(type) {
104389
104390
  const mimeType = moduleTypeMimeType[type];
@@ -120035,8 +120036,39 @@ async function getEntry(args, config, command2) {
120035
120036
  "It looks like you've run a Workers-specific command in a Pages project.\nFor Pages, please run `wrangler pages dev` instead."
120036
120037
  );
120037
120038
  }
120039
+ const compatibilityDateStr = [
120040
+ (/* @__PURE__ */ new Date()).getFullYear(),
120041
+ ((/* @__PURE__ */ new Date()).getMonth() + 1 + "").padStart(2, "0"),
120042
+ ((/* @__PURE__ */ new Date()).getDate() + "").padStart(2, "0")
120043
+ ].join("-");
120044
+ const updateConfigMessage = /* @__PURE__ */ __name((snippet) => esm_default2`
120045
+ ${config.configPath ? `add the following to your "${configFileName(config.configPath)}" file:` : `create a "wrangler.jsonc" file containing:`}
120046
+
120047
+ \`\`\`
120048
+ ${formatConfigSnippet(
120049
+ {
120050
+ ...config.name ? {} : { name: "worker-name" },
120051
+ ...config.compatibility_date ? {} : { compatibility_date: compatibilityDateStr },
120052
+ ...snippet
120053
+ },
120054
+ config.configPath
120055
+ )}
120056
+ \`\`\`
120057
+
120058
+ `, "updateConfigMessage");
120059
+ const fullCommand = `${getNpxEquivalent()} wrangler ${command2}`;
120038
120060
  throw new UserError(
120039
- `Missing entry-point: The entry-point should be specified via the command line (e.g. \`wrangler ${command2} path/to/script\`) or the \`main\` config field.`
120061
+ esm_default2`
120062
+ Missing entry-point to Worker script or to assets directory
120063
+
120064
+ If there is code to deploy, you can either:
120065
+ - Specify an entry-point to your Worker script via the command line (ex: \`${fullCommand} src/index.ts\`)
120066
+ - Or ${updateConfigMessage({ main: "src/index.ts" })}
120067
+
120068
+ If are uploading a directory of assets, you can either:
120069
+ - Specify the path to the directory of assets via the command line: (ex: \`${fullCommand} --assets=./dist\`)
120070
+ - Or ${updateConfigMessage({ assets: { directory: "./dist" } })}`,
120071
+ { telemetryMessage: "missing worker entrypoint or assets directory" }
120040
120072
  );
120041
120073
  }
120042
120074
  await runCustomBuild(
@@ -120052,12 +120084,7 @@ async function getEntry(args, config, command2) {
120052
120084
  args.format ?? config.build?.upload?.format,
120053
120085
  config.tsconfig
120054
120086
  );
120055
- const { localBindings, remoteBindings } = partitionDurableObjectBindings(config);
120056
- if (command2 === "dev" && remoteBindings.length > 0) {
120057
- logger.warn(
120058
- "WARNING: You have Durable Object bindings that are not defined locally in the worker being developed.\nBe aware that changes to the data stored in these Durable Objects will be permanent and affect the live instances.\nRemote Durable Objects that are affected:\n" + remoteBindings.map((b6) => `- ${JSON.stringify(b6)}`).join("\n")
120059
- );
120060
- }
120087
+ const { localBindings } = partitionDurableObjectBindings(config);
120061
120088
  if (format11 === "service-worker" && localBindings.length > 0) {
120062
120089
  const errorMessage = "You seem to be trying to use Durable Objects in a Worker written as a service-worker.";
120063
120090
  const addScriptName = `You can use Durable Objects defined in other Workers by specifying a \`script_name\` in your ${configFileName(config.configPath)} file, where \`script_name\` is the name of the Worker that implements that Durable Object. For example:`;
@@ -120086,7 +120113,7 @@ function partitionDurableObjectBindings(config) {
120086
120113
  const localBindings = [];
120087
120114
  const remoteBindings = [];
120088
120115
  for (const binding of config.durable_objects.bindings) {
120089
- if (binding.script_name === void 0) {
120116
+ if (binding.script_name === void 0 || binding.script_name === config.name) {
120090
120117
  localBindings.push(binding);
120091
120118
  } else {
120092
120119
  remoteBindings.push(binding);
@@ -120108,6 +120135,18 @@ function generateAddScriptNameExamples(localBindings) {
120108
120135
  }).join("\n");
120109
120136
  }
120110
120137
  __name(generateAddScriptNameExamples, "generateAddScriptNameExamples");
120138
+ function getNpxEquivalent() {
120139
+ switch (sniffUserAgent()) {
120140
+ case "pnpm":
120141
+ return "pnpm";
120142
+ case "yarn":
120143
+ return "yarn";
120144
+ case "npm":
120145
+ default:
120146
+ return "npx";
120147
+ }
120148
+ }
120149
+ __name(getNpxEquivalent, "getNpxEquivalent");
120111
120150
 
120112
120151
  // src/match-tag.ts
120113
120152
  init_import_meta_url();
@@ -122413,6 +122452,31 @@ __name(handler6, "handler");
122413
122452
 
122414
122453
  // src/hyperdrive/list.ts
122415
122454
  init_import_meta_url();
122455
+
122456
+ // src/hyperdrive/shared.ts
122457
+ init_import_meta_url();
122458
+ function formatCachingOptions(cachingOptions) {
122459
+ switch (cachingOptions?.disabled) {
122460
+ case false: {
122461
+ if (cachingOptions.stale_while_revalidate === 0) {
122462
+ return `max_age: ${cachingOptions.max_age}, stale_while_revalidate: disabled`;
122463
+ } else {
122464
+ return `max_age: ${cachingOptions.max_age}, stale_while_revalidate: ${cachingOptions.stale_while_revalidate}`;
122465
+ }
122466
+ }
122467
+ case void 0: {
122468
+ return "enabled";
122469
+ }
122470
+ case true: {
122471
+ return "disabled";
122472
+ }
122473
+ default:
122474
+ return JSON.stringify(cachingOptions);
122475
+ }
122476
+ }
122477
+ __name(formatCachingOptions, "formatCachingOptions");
122478
+
122479
+ // src/hyperdrive/list.ts
122416
122480
  function options7(yargs) {
122417
122481
  return yargs;
122418
122482
  }
@@ -122429,7 +122493,7 @@ async function handler7(args) {
122429
122493
  host: database.origin.host ?? "",
122430
122494
  port: database.origin.port?.toString() ?? "",
122431
122495
  database: database.origin.database ?? "",
122432
- caching: JSON.stringify(database.caching)
122496
+ caching: formatCachingOptions(database.caching)
122433
122497
  }))
122434
122498
  );
122435
122499
  }
@@ -127366,7 +127430,7 @@ var Handler14 = /* @__PURE__ */ __name(async (args) => {
127366
127430
  }
127367
127431
  if (args.env) {
127368
127432
  throw new FatalError(
127369
- "Pages does not support targeting an environment with the --env flag. Use the --branch flag to target your production or preview branch",
127433
+ "Pages does not support targeting an environment with the --env flag during local development.",
127370
127434
  1
127371
127435
  );
127372
127436
  }
@@ -128779,9 +128843,8 @@ var secretBulkCommand = createCommand({
128779
128843
  logger.log(`\u2728 ${upsertBindings.length} secrets successfully uploaded`);
128780
128844
  } catch (err) {
128781
128845
  logger.log("");
128782
- logger.log("Finished processing secrets JSON file:");
128783
- logger.log(`\u2728 0 secrets successfully uploaded`);
128784
- throw new Error(`\u{1F6A8} ${upsertBindings.length} secrets failed to upload`);
128846
+ logger.log(`\u{1F6A8} Secrets failed to upload`);
128847
+ throw err;
128785
128848
  }
128786
128849
  }
128787
128850
  });
@@ -129014,11 +129077,8 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
129014
129077
  `\u2728 ${Object.keys(upsertBindings).length} secrets successfully uploaded`
129015
129078
  );
129016
129079
  } catch (err) {
129017
- logger.log("Finished processing secrets file:");
129018
- logger.log(`\u2728 0 secrets successfully uploaded`);
129019
- throw new FatalError(
129020
- `\u{1F6A8} ${Object.keys(upsertBindings).length} secrets failed to upload`
129021
- );
129080
+ logger.log(`\u{1F6A8} Secrets failed to upload`);
129081
+ throw err;
129022
129082
  }
129023
129083
  }
129024
129084
  ).command(
@@ -158028,13 +158088,26 @@ async function getPlatformProxy(options32 = {}) {
158028
158088
  __name(getPlatformProxy, "getPlatformProxy");
158029
158089
  async function getMiniflareOptionsFromConfig(rawConfig, env6, options32) {
158030
158090
  const bindings = getBindings2(rawConfig, env6, true, {});
158091
+ if (rawConfig["durable_objects"]) {
158092
+ const { localBindings } = partitionDurableObjectBindings(rawConfig);
158093
+ if (localBindings.length > 0) {
158094
+ logger.warn(dedent2`
158095
+ You have defined bindings to the following internal Durable Objects:
158096
+ ${localBindings.map((b6) => `- ${JSON.stringify(b6)}`).join("\n")}
158097
+ These will not work in local development, but they should work in production.
158098
+
158099
+ If you want to develop these locally, you can define your DO in a separate Worker, with a separate configuration file.
158100
+ For detailed instructions, refer to the Durable Objects section here: https://developers.cloudflare.com/workers/wrangler/api#supported-bindings
158101
+ `);
158102
+ }
158103
+ }
158031
158104
  const workerDefinitions = await getBoundRegisteredWorkers({
158032
158105
  name: rawConfig.name,
158033
158106
  services: bindings.services,
158034
158107
  durableObjects: rawConfig["durable_objects"]
158035
158108
  });
158036
158109
  const { bindingOptions, externalWorkers } = buildMiniflareBindingOptions({
158037
- name: void 0,
158110
+ name: rawConfig.name,
158038
158111
  bindings,
158039
158112
  workerDefinitions,
158040
158113
  queueConsumers: void 0,
@@ -158050,6 +158123,7 @@ async function getMiniflareOptionsFromConfig(rawConfig, env6, options32) {
158050
158123
  {
158051
158124
  script: "",
158052
158125
  modules: true,
158126
+ name: rawConfig.name,
158053
158127
  ...bindingOptions,
158054
158128
  serviceBindings: {
158055
158129
  ...serviceBindings,