wrangler 4.17.0 → 4.18.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/bin/wrangler.js CHANGED
@@ -2,7 +2,7 @@
2
2
  const { spawn } = require("child_process");
3
3
  const path = require("path");
4
4
 
5
- const ERR_NODE_VERSION = "18.0.0";
5
+ const ERR_NODE_VERSION = "20.0.0";
6
6
  const MIN_NODE_VERSION = "20.0.0";
7
7
  let wranglerProcess;
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.17.0",
3
+ "version": "4.18.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -55,14 +55,14 @@
55
55
  "esbuild": "0.25.4",
56
56
  "path-to-regexp": "6.3.0",
57
57
  "unenv": "2.0.0-rc.17",
58
- "workerd": "1.20250523.0",
58
+ "workerd": "1.20250525.0",
59
59
  "@cloudflare/kv-asset-handler": "0.4.0",
60
- "miniflare": "4.20250523.0"
60
+ "miniflare": "4.20250525.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.20250523.0",
65
+ "@cloudflare/workers-types": "^4.20250525.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",
@@ -135,14 +135,14 @@
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",
138
139
  "@cloudflare/eslint-config-worker": "1.1.0",
139
- "@cloudflare/pages-shared": "^0.13.41",
140
+ "@cloudflare/pages-shared": "^0.13.42",
140
141
  "@cloudflare/workers-shared": "0.17.5",
141
- "@cloudflare/workers-tsconfig": "0.0.0",
142
- "@cloudflare/cli": "1.1.1"
142
+ "@cloudflare/workers-tsconfig": "0.0.0"
143
143
  },
144
144
  "peerDependencies": {
145
- "@cloudflare/workers-types": "^4.20250523.0"
145
+ "@cloudflare/workers-types": "^4.20250525.0"
146
146
  },
147
147
  "peerDependenciesMeta": {
148
148
  "@cloudflare/workers-types": {
@@ -329,8 +329,6 @@ declare type Binding = {
329
329
 
330
330
  declare type BindingOmit<T> = Omit<T, "binding">;
331
331
 
332
- declare type BindingsOpt = NonNullable<StartDevWorkerInput["bindings"]>;
333
-
334
332
  declare interface BlobPropertyBag {
335
333
  type?: string
336
334
  endings?: 'native' | 'transparent'
@@ -2641,19 +2639,28 @@ declare class ExecutionContext {
2641
2639
  props: any;
2642
2640
  }
2643
2641
 
2642
+ export declare type Experimental_ConfigBindingOptions = Pick<Unstable_Config, "ai" | "browser" | "d1_databases" | "dispatch_namespaces" | "durable_objects" | "queues" | "r2_buckets" | "services" | "kv_namespaces" | "mtls_certificates" | "vectorize" | "workflows">;
2643
+
2644
+ export declare type Experimental_MixedModeSession = Pick<Worker, "ready" | "dispose"> & {
2645
+ updateBindings: (bindings: StartDevWorkerInput["bindings"]) => Promise<void>;
2646
+ mixedModeConnectionString: MixedModeConnectionString;
2647
+ };
2648
+
2644
2649
  export declare const experimental_patchConfig: (configPath: string, patch: Unstable_RawConfig, isArrayInsertion?: boolean) => string;
2645
2650
 
2651
+ export declare function experimental_pickRemoteBindings(bindings: Record<string, Binding>): Record<string, Binding>;
2652
+
2646
2653
  export declare const experimental_readRawConfig: (args: ReadConfigCommandArgs, options?: ReadConfigOptions) => {
2647
2654
  rawConfig: Unstable_RawConfig;
2648
2655
  configPath: string | undefined;
2649
2656
  userConfigPath: string | undefined;
2650
2657
  };
2651
2658
 
2652
- export declare function experimental_startMixedModeSession(bindings: BindingsOpt, options?: {
2659
+ export declare function experimental_startMixedModeSession(bindings: StartDevWorkerInput["bindings"], options?: {
2653
2660
  auth?: NonNullable<StartDevWorkerInput["dev"]>["auth"];
2654
2661
  /** If running in a non-public compliance region, set this here. */
2655
2662
  complianceRegion?: Unstable_Config["compliance_region"];
2656
- }): Promise<MixedModeSession>;
2663
+ }): Promise<Experimental_MixedModeSession>;
2657
2664
 
2658
2665
  declare function fetch_2 (
2659
2666
  input: RequestInfo,
@@ -3028,11 +3035,6 @@ declare interface MIMEType {
3028
3035
 
3029
3036
  declare type MiniflareWorker = Awaited<ReturnType<Miniflare["getWorker"]>>;
3030
3037
 
3031
- declare type MixedModeSession = Pick<Worker, "ready" | "dispose"> & {
3032
- updateBindings: (bindings: BindingsOpt) => Promise<void>;
3033
- mixedModeConnectionString: MixedModeConnectionString;
3034
- };
3035
-
3036
3038
  /** A mocked Agent class that implements the Agent API. It allows one to intercept HTTP requests made through undici and return mocked responses instead. */
3037
3039
  declare class MockAgent<TMockAgentOptions extends MockAgent.Options = MockAgent.Options> extends Dispatcher {
3038
3040
  constructor(options?: MockAgent.Options)
@@ -26586,6 +26588,8 @@ export declare interface Unstable_ASSETSBindingsOptions {
26586
26588
  */
26587
26589
  export declare type Unstable_Config = ComputedFields & ConfigFields<DevConfig> & PagesConfigFields & Environment;
26588
26590
 
26591
+ export declare function unstable_convertConfigBindingsToStartWorkerBindings(configBindings: Experimental_ConfigBindingOptions): StartDevWorkerOptions["bindings"];
26592
+
26589
26593
  /**
26590
26594
  * unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
26591
26595
  */
@@ -26696,6 +26700,7 @@ export declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindi
26696
26700
 
26697
26701
  export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string, options?: {
26698
26702
  imagesLocalMode?: boolean;
26703
+ mixedModeConnectionString?: MixedModeConnectionString;
26699
26704
  overrides?: {
26700
26705
  assets?: Partial<AssetsOptions>;
26701
26706
  };
@@ -26703,6 +26708,7 @@ export declare function unstable_getMiniflareWorkerOptions(configPath: string, e
26703
26708
 
26704
26709
  export declare function unstable_getMiniflareWorkerOptions(config: Unstable_Config, env?: string, options?: {
26705
26710
  imagesLocalMode?: boolean;
26711
+ mixedModeConnectionString?: MixedModeConnectionString;
26706
26712
  overrides?: {
26707
26713
  assets?: Partial<AssetsOptions>;
26708
26714
  };
@@ -27279,6 +27279,37 @@ function parseNonHyphenedUuid(uuid) {
27279
27279
  uuid_parts.forEach((part) => hyphenated += part + "-");
27280
27280
  return hyphenated.slice(0, 36);
27281
27281
  }
27282
+ function parseByteSize(s5, base = void 0) {
27283
+ const match2 = s5.match(
27284
+ /^(\d*\.*\d*)\s*([kKmMgGtTpP]{0,1})([i]{0,1}[bB]{0,1})$/
27285
+ );
27286
+ if (!match2) {
27287
+ return NaN;
27288
+ }
27289
+ const size = match2[1];
27290
+ if (size.length === 0 || isNaN(Number(size))) {
27291
+ return NaN;
27292
+ }
27293
+ const unit = match2[2].toLowerCase();
27294
+ const sizeUnits = {
27295
+ k: 1,
27296
+ m: 2,
27297
+ g: 3,
27298
+ t: 4,
27299
+ p: 5
27300
+ };
27301
+ if (unit.length !== 0 && !(unit in sizeUnits)) {
27302
+ return NaN;
27303
+ }
27304
+ const binary = match2[3].toLowerCase() == "ib";
27305
+ if (binary && unit.length === 0) {
27306
+ return NaN;
27307
+ }
27308
+ const pow = sizeUnits[unit] || 0;
27309
+ return Math.floor(
27310
+ Number(size) * Math.pow(base ?? (binary ? 1024 : 1e3), pow)
27311
+ );
27312
+ }
27282
27313
  var fs2, import_node_path5, import_toml, import_esbuild2, ParseError, APIError, TOML_ERROR_NAME, TOML_ERROR_SUFFIX, units;
27283
27314
  var init_parse = __esm({
27284
27315
  "src/parse.ts"() {
@@ -27389,6 +27420,7 @@ var init_parse = __esm({
27389
27420
  };
27390
27421
  __name(parseHumanDuration, "parseHumanDuration");
27391
27422
  __name(parseNonHyphenedUuid, "parseNonHyphenedUuid");
27423
+ __name(parseByteSize, "parseByteSize");
27392
27424
  }
27393
27425
  });
27394
27426
 
@@ -27421,7 +27453,7 @@ var name, version;
27421
27453
  var init_package = __esm({
27422
27454
  "package.json"() {
27423
27455
  name = "wrangler";
27424
- version = "4.17.0";
27456
+ version = "4.18.0";
27425
27457
  }
27426
27458
  });
27427
27459
 
@@ -29535,9 +29567,8 @@ function printBindings(bindings, tailConsumers = [], context2 = {}) {
29535
29567
  isProvisioning: context2.provisioning,
29536
29568
  isLocalDev: context2.local
29537
29569
  });
29538
- const truncate4 = /* @__PURE__ */ __name((item) => {
29570
+ const truncate4 = /* @__PURE__ */ __name((item, maxLength = 40) => {
29539
29571
  const s5 = typeof item === "string" ? item : JSON.stringify(item);
29540
- const maxLength = 40;
29541
29572
  if (s5.length < maxLength) {
29542
29573
  return s5;
29543
29574
  }
@@ -29704,7 +29735,12 @@ function printBindings(bindings, tailConsumers = [], context2 = {}) {
29704
29735
  name: binding,
29705
29736
  type: friendlyBindingNames.vectorize,
29706
29737
  value: index_name,
29707
- mode: getMode()
29738
+ mode: getMode({
29739
+ isSimulatedLocally: context2.vectorizeBindToProd ? false : (
29740
+ /* Vectorize doesn't support local mode */
29741
+ void 0
29742
+ )
29743
+ })
29708
29744
  };
29709
29745
  })
29710
29746
  );
@@ -29958,20 +29994,32 @@ function printBindings(bindings, tailConsumers = [], context2 = {}) {
29958
29994
  );
29959
29995
  const maxNameLength = Math.max(...output.map((b6) => b6.name.length));
29960
29996
  const maxTypeLength = Math.max(...output.map((b6) => b6.type.length));
29997
+ const maxModeLength = Math.max(
29998
+ ...output.map((b6) => b6.mode ? stripAnsi2(b6.mode).length : "Mode".length)
29999
+ );
29961
30000
  const hasMode = output.some((b6) => b6.mode);
29962
30001
  const bindingPrefix = `env.`;
29963
30002
  const bindingLength = bindingPrefix.length + maxNameLength + " (".length + maxValueLength + ")".length;
30003
+ const columnGapSpaces = 6;
30004
+ const columnGapSpacesWrapped = 4;
30005
+ const shouldWrap = bindingLength + columnGapSpaces + maxTypeLength + columnGapSpaces + maxModeLength >= process.stdout.columns;
29964
30006
  logger.log(title2);
30007
+ const columnGap = shouldWrap ? " ".repeat(columnGapSpacesWrapped) : " ".repeat(columnGapSpaces);
29965
30008
  logger.log(
29966
- `${padEndAnsi(dim("Binding"), bindingLength)} ${padEndAnsi(dim("Resource"), maxTypeLength)} ${hasMode ? dim("Mode") : ""}`
30009
+ `${padEndAnsi(dim("Binding"), shouldWrap ? bindingPrefix.length + maxNameLength : bindingLength)}${columnGap}${padEndAnsi(dim("Resource"), maxTypeLength)}${columnGap}${hasMode ? dim("Mode") : ""}`
29967
30010
  );
29968
30011
  for (const binding of output) {
30012
+ const bindingValue = dim(
30013
+ typeof binding.value === "symbol" ? source_default.italic("inherited") : binding.value ?? ""
30014
+ );
29969
30015
  const bindingString = padEndAnsi(
29970
- `${white(`env.${binding.name}`)}${binding.value ? ` (${dim(typeof binding.value === "symbol" ? source_default.italic("inherited") : binding.value ?? "")})` : ""}`,
29971
- bindingLength
30016
+ `${white(`env.${binding.name}`)}${binding.value && !shouldWrap ? ` (${bindingValue})` : ""}`,
30017
+ shouldWrap ? bindingPrefix.length + maxNameLength : bindingLength
29972
30018
  );
30019
+ const suffix = shouldWrap ? binding.value ? `
30020
+ ${bindingValue}` : "" : "";
29973
30021
  logger.log(
29974
- `${bindingString} ${brandColor(binding.type.padEnd(maxTypeLength))} ${hasMode ? binding.mode : ""}`
30022
+ `${bindingString}${columnGap}${brandColor(binding.type.padEnd(maxTypeLength))}${columnGap}${hasMode ? binding.mode : ""}${suffix}`
29975
30023
  );
29976
30024
  }
29977
30025
  logger.log();
@@ -46929,21 +46977,21 @@ function getRemoteId(id) {
46929
46977
  }
46930
46978
  function kvNamespaceEntry({ binding, id: originalId, remote }, mixedModeConnectionString) {
46931
46979
  const id = getRemoteId(originalId) ?? binding;
46932
- if (!getFlag("MIXED_MODE") || !remote) {
46980
+ if (!mixedModeConnectionString || !remote) {
46933
46981
  return [binding, { id }];
46934
46982
  }
46935
46983
  return [binding, { id, mixedModeConnectionString }];
46936
46984
  }
46937
46985
  function r2BucketEntry({ binding, bucket_name, remote }, mixedModeConnectionString) {
46938
46986
  const id = getRemoteId(bucket_name) ?? binding;
46939
- if (!getFlag("MIXED_MODE") || !remote) {
46987
+ if (!mixedModeConnectionString || !remote) {
46940
46988
  return [binding, { id }];
46941
46989
  }
46942
46990
  return [binding, { id, mixedModeConnectionString }];
46943
46991
  }
46944
46992
  function d1DatabaseEntry({ binding, database_id, preview_database_id, remote }, mixedModeConnectionString) {
46945
46993
  const id = getRemoteId(preview_database_id ?? database_id) ?? binding;
46946
- if (!getFlag("MIXED_MODE") || !remote) {
46994
+ if (!mixedModeConnectionString || !remote) {
46947
46995
  return [binding, { id }];
46948
46996
  }
46949
46997
  return [binding, { id, mixedModeConnectionString }];
@@ -46954,7 +47002,7 @@ function queueProducerEntry({
46954
47002
  delivery_delay: deliveryDelay,
46955
47003
  remote
46956
47004
  }, mixedModeConnectionString) {
46957
- if (!getFlag("MIXED_MODE") || !remote) {
47005
+ if (!mixedModeConnectionString || !remote) {
46958
47006
  return [binding, { queueName, deliveryDelay }];
46959
47007
  }
46960
47008
  return [binding, { queueName, deliveryDelay, mixedModeConnectionString }];
@@ -46972,7 +47020,7 @@ function workflowEntry({
46972
47020
  script_name: scriptName,
46973
47021
  remote
46974
47022
  }, mixedModeConnectionString) {
46975
- if (!getFlag("MIXED_MODE") || !remote) {
47023
+ if (!mixedModeConnectionString || !remote) {
46976
47024
  return [
46977
47025
  binding,
46978
47026
  {
@@ -47028,7 +47076,7 @@ function buildMiniflareBindingOptions(config, mixedModeConnectionString) {
47028
47076
  };
47029
47077
  const notFoundServices = /* @__PURE__ */ new Set();
47030
47078
  for (const service of config.services ?? []) {
47031
- if (getFlag("MIXED_MODE") && service.remote) {
47079
+ if (mixedModeConnectionString && service.remote) {
47032
47080
  serviceBindings[service.binding] = {
47033
47081
  name: service.service,
47034
47082
  props: service.props,
@@ -47184,7 +47232,7 @@ function buildMiniflareBindingOptions(config, mixedModeConnectionString) {
47184
47232
  }
47185
47233
  const wrappedBindings = {};
47186
47234
  if (bindings.ai?.binding) {
47187
- if (!getFlag("MIXED_MODE")) {
47235
+ if (!mixedModeConnectionString) {
47188
47236
  externalWorkers.push({
47189
47237
  name: `${EXTERNAL_AI_WORKER_NAME}:${config.name}`,
47190
47238
  modules: [
@@ -47264,7 +47312,7 @@ function buildMiniflareBindingOptions(config, mixedModeConnectionString) {
47264
47312
  textBlobBindings,
47265
47313
  dataBlobBindings,
47266
47314
  wasmBindings,
47267
- ai: bindings.ai && getFlag("MIXED_MODE") && mixedModeConnectionString ? {
47315
+ ai: bindings.ai && mixedModeConnectionString ? {
47268
47316
  binding: bindings.ai.binding,
47269
47317
  mixedModeConnectionString
47270
47318
  } : void 0,
@@ -47802,6 +47850,13 @@ async function getBinaryFileContents(file) {
47802
47850
  }
47803
47851
  return (0, import_promises5.readFile)(file.path);
47804
47852
  }
47853
+ function convertConfigBindingsToStartWorkerBindings(configBindings) {
47854
+ const { queues, ...bindings } = configBindings;
47855
+ return convertCfWorkerInitBindingsToBindings({
47856
+ ...bindings,
47857
+ queues: queues.producers?.map((q6) => ({ ...q6, queue_name: q6.queue }))
47858
+ });
47859
+ }
47805
47860
  function convertCfWorkerInitBindingsToBindings(inputBindings) {
47806
47861
  const output = {};
47807
47862
  const bindingsIterable = Object.entries(inputBindings);
@@ -48127,6 +48182,7 @@ var init_utils = __esm({
48127
48182
  __name(assertNever, "assertNever");
48128
48183
  __name(unwrapHook, "unwrapHook");
48129
48184
  __name(getBinaryFileContents, "getBinaryFileContents");
48185
+ __name(convertConfigBindingsToStartWorkerBindings, "convertConfigBindingsToStartWorkerBindings");
48130
48186
  __name(convertCfWorkerInitBindingsToBindings, "convertCfWorkerInitBindingsToBindings");
48131
48187
  __name(convertBindingsToCfWorkerInitBindings, "convertBindingsToCfWorkerInitBindings");
48132
48188
  __name(isUnsafeBindingType, "isUnsafeBindingType");
@@ -58544,7 +58600,7 @@ function renderDeploymentConfiguration(action, {
58544
58600
  image,
58545
58601
  location,
58546
58602
  vcpu,
58547
- memory,
58603
+ memoryMib,
58548
58604
  environmentVariables,
58549
58605
  labels,
58550
58606
  env: env6,
@@ -58567,7 +58623,7 @@ No environment variables added! You can set some under [${env6 ? "env." + env6 +
58567
58623
  ["image", image],
58568
58624
  ["location", idToLocationName(location)],
58569
58625
  ["vCPU", `${vcpu}`],
58570
- ["memory", memory],
58626
+ ["memory", `${memoryMib} MiB`],
58571
58627
  ["environment variables", environmentVariablesText],
58572
58628
  ["labels", labelsText],
58573
58629
  ...network === void 0 ? [] : [["IPv4", network.assign_ipv4 === "predefined" ? "yes" : "no"]]
@@ -58593,10 +58649,12 @@ function renderDeploymentMutationError(account, err) {
58593
58649
  }
58594
58650
  const details = err.body.details ?? {};
58595
58651
  function renderAccountLimits() {
58596
- return `${space(2)}${brandColor("Maximum VCPU per deployment")} ${account.limits.vcpu_per_deployment}
58597
- ${space(2)}${brandColor("Maximum total VCPU in your account")} ${account.limits.total_vcpu}
58598
- ${space(2)}${brandColor("Maximum memory per deployment")} ${account.limits.memory_per_deployment}
58599
- ${space(2)}${brandColor("Maximum total memory in your account")} ${account.limits.total_memory}`;
58652
+ return [
58653
+ `${space(2)}${brandColor("Maximum VCPU per deployment")} ${account.limits.vcpu_per_deployment}`,
58654
+ `${space(2)}${brandColor("Maximum total VCPU in your account")} ${account.limits.total_vcpu}`,
58655
+ `${space(2)}${brandColor("Maximum memory per deployment")} ${account.limits.memory_mib_per_deployment} MiB`,
58656
+ `${space(2)}${brandColor("Maximum total memory in your account")} ${account.limits.total_memory_mib} MiB`
58657
+ ].join("\n");
58600
58658
  }
58601
58659
  __name(renderAccountLimits, "renderAccountLimits");
58602
58660
  function renderInvalidInputDetails(inputDetails) {
@@ -58771,6 +58829,14 @@ async function promptForLabels(labels, initiallySelected, allowSkipping) {
58771
58829
  }
58772
58830
  return [];
58773
58831
  }
58832
+ function resolveMemory(args, config) {
58833
+ const MiB = 1024 * 1024;
58834
+ const memory = args.memory ?? config.memory;
58835
+ if (memory !== void 0) {
58836
+ return Math.round(parseByteSize(memory, 1024) / MiB);
58837
+ }
58838
+ return void 0;
58839
+ }
58774
58840
  var import_promises12, imageRe;
58775
58841
  var init_common = __esm({
58776
58842
  "src/cloudchamber/common.ts"() {
@@ -58787,6 +58853,7 @@ var init_common = __esm({
58787
58853
  init_is_interactive();
58788
58854
  init_logger();
58789
58855
  init_user2();
58856
+ init_parse();
58790
58857
  init_client2();
58791
58858
  init_wrap();
58792
58859
  init_locations();
@@ -58817,6 +58884,7 @@ var init_common = __esm({
58817
58884
  __name(sortLabels, "sortLabels");
58818
58885
  __name(collectLabels, "collectLabels");
58819
58886
  __name(promptForLabels, "promptForLabels");
58887
+ __name(resolveMemory, "resolveMemory");
58820
58888
  }
58821
58889
  });
58822
58890
 
@@ -64848,8 +64916,7 @@ function createWorkerUploadForm(worker) {
64848
64916
  config: assetConfig
64849
64917
  }
64850
64918
  },
64851
- ...observability && { observability },
64852
- minimal_mode: worker.minimal_mode
64919
+ ...observability && { observability }
64853
64920
  };
64854
64921
  if (bindings.unsafe?.metadata !== void 0) {
64855
64922
  for (const key of Object.keys(bindings.unsafe.metadata)) {
@@ -74605,7 +74672,7 @@ function createCommandOptionalYargs(yargs) {
74605
74672
  requiresArg: true,
74606
74673
  type: "string",
74607
74674
  demandOption: false,
74608
- describe: "Amount of memory (GB, MB...) to allocate to this deployment. Ex: 4GB."
74675
+ describe: "Amount of memory (GiB, MiB...) to allocate to this deployment. Ex: 4GiB."
74609
74676
  }).option("ipv4", {
74610
74677
  requiresArg: false,
74611
74678
  type: "boolean",
@@ -74636,6 +74703,7 @@ async function createCommand2(args, config) {
74636
74703
  const keysToAdd = args.allSshKeys ? (await pollSSHKeysUntilCondition(() => true)).map((key) => key.id) : [];
74637
74704
  const useIpv4 = args.ipv4 ?? config.cloudchamber.ipv4;
74638
74705
  const network = useIpv4 === true ? { assign_ipv4: "predefined" /* PREDEFINED */ } : { assign_ipv6: "predefined" /* PREDEFINED */ };
74706
+ const memoryMib = resolveMemory(args, config.cloudchamber);
74639
74707
  const deployment = await DeploymentsService.createDeploymentV2({
74640
74708
  image: body.image,
74641
74709
  location: body.location,
@@ -74643,8 +74711,8 @@ async function createCommand2(args, config) {
74643
74711
  environment_variables: environmentVariables,
74644
74712
  labels,
74645
74713
  vcpu: args.vcpu ?? config.cloudchamber.vcpu,
74646
- memory: args.memory ?? config.cloudchamber.memory,
74647
- network
74714
+ network,
74715
+ memory_mib: memoryMib
74648
74716
  });
74649
74717
  console.log(JSON.stringify(deployment, null, 4));
74650
74718
  return;
@@ -74751,12 +74819,13 @@ async function handleCreateCommand(args, config, environmentVariables, labels) {
74751
74819
  );
74752
74820
  const selectedLabels = await promptForLabels(labels, [], false);
74753
74821
  const account = await loadAccount();
74822
+ const memoryMib = resolveMemory(args, config.cloudchamber) ?? account.defaults.memory_mib ?? Math.round(parseByteSize(account.defaults.memory, 1024) / (1024 * 1024));
74754
74823
  renderDeploymentConfiguration("create", {
74755
74824
  image,
74756
74825
  location,
74757
74826
  network,
74758
74827
  vcpu: args.vcpu ?? config.cloudchamber.vcpu ?? account.defaults.vcpus,
74759
- memory: args.memory ?? config.cloudchamber.memory ?? account.defaults.memory,
74828
+ memoryMib,
74760
74829
  environmentVariables: selectedEnvironmentVariables,
74761
74830
  labels: selectedLabels,
74762
74831
  env: args.env
@@ -74771,7 +74840,7 @@ async function handleCreateCommand(args, config, environmentVariables, labels) {
74771
74840
  return;
74772
74841
  }
74773
74842
  const { start, stop } = spinner();
74774
- start("Creating your container", "shortly your container will be created");
74843
+ start("Creating your container", "your container will be created shortly");
74775
74844
  const [deployment, err] = await wrap2(
74776
74845
  DeploymentsService.createDeploymentV2({
74777
74846
  image,
@@ -74780,7 +74849,7 @@ async function handleCreateCommand(args, config, environmentVariables, labels) {
74780
74849
  environment_variables: environmentVariables,
74781
74850
  labels,
74782
74851
  vcpu: args.vcpu ?? config.cloudchamber.vcpu,
74783
- memory: args.memory ?? config.cloudchamber.memory,
74852
+ memory_mib: memoryMib,
74784
74853
  network
74785
74854
  })
74786
74855
  );
@@ -74805,6 +74874,7 @@ var init_create2 = __esm({
74805
74874
  init_args();
74806
74875
  init_colors();
74807
74876
  init_interactive();
74877
+ init_parse();
74808
74878
  init_cli2();
74809
74879
  init_locations2();
74810
74880
  init_client2();
@@ -75836,6 +75906,7 @@ async function modifyCommand(modifyArgs, config) {
75836
75906
  modifyArgs.var
75837
75907
  );
75838
75908
  const labels = collectLabels(modifyArgs.label);
75909
+ const memoryMib = resolveMemory(modifyArgs, config.cloudchamber);
75839
75910
  const deployment = await DeploymentsService.modifyDeploymentV2(
75840
75911
  modifyArgs.deploymentId,
75841
75912
  {
@@ -75845,7 +75916,7 @@ async function modifyCommand(modifyArgs, config) {
75845
75916
  labels,
75846
75917
  ssh_public_key_ids: modifyArgs.sshPublicKeyId,
75847
75918
  vcpu: modifyArgs.vcpu ?? config.cloudchamber.vcpu,
75848
- memory: modifyArgs.memory ?? config.cloudchamber.memory
75919
+ memory_mib: memoryMib
75849
75920
  }
75850
75921
  );
75851
75922
  console.log(JSON.stringify(deployment, null, 4));
@@ -75933,11 +76004,12 @@ async function handleModifyCommand(args, config) {
75933
76004
  (deployment.labels ?? []).map((v7) => v7.name),
75934
76005
  true
75935
76006
  );
76007
+ const memoryMib = resolveMemory(args, config.cloudchamber);
75936
76008
  renderDeploymentConfiguration("modify", {
75937
76009
  image,
75938
76010
  location: location ?? deployment.location.name,
75939
76011
  vcpu: args.vcpu ?? config.cloudchamber.vcpu ?? deployment.vcpu,
75940
- memory: args.memory ?? config.cloudchamber.memory ?? deployment.memory,
76012
+ memoryMib: memoryMib ?? deployment.memory_mib,
75941
76013
  env: args.env,
75942
76014
  environmentVariables: selectedEnvironmentVariables !== void 0 ? selectedEnvironmentVariables : deployment.environment_variables,
75943
76015
  // show the existing environment variables if any
@@ -75966,7 +76038,7 @@ async function handleModifyCommand(args, config) {
75966
76038
  environment_variables: selectedEnvironmentVariables,
75967
76039
  labels: selectedLabels,
75968
76040
  vcpu: args.vcpu ?? config.cloudchamber.vcpu,
75969
- memory: args.memory ?? config.cloudchamber.memory
76041
+ memory_mib: memoryMib
75970
76042
  })
75971
76043
  );
75972
76044
  stop();
@@ -151873,7 +151945,8 @@ async function resolveBindings(config, input) {
151873
151945
  registry: input.dev?.registry,
151874
151946
  local: !input.dev?.remote,
151875
151947
  imagesLocalMode: input.dev?.imagesLocalMode,
151876
- name: config.name
151948
+ name: config.name,
151949
+ vectorizeBindToProd: input.dev?.bindVectorizeToProd
151877
151950
  }
151878
151951
  );
151879
151952
  return {
@@ -171318,7 +171391,7 @@ async function createPreviewSession(complianceConfig, account, ctx, abortSignal)
171318
171391
  }
171319
171392
  }
171320
171393
  }
171321
- async function createPreviewToken(complianceConfig, account, worker, ctx, session, abortSignal) {
171394
+ async function createPreviewToken(complianceConfig, account, worker, ctx, session, abortSignal, minimal_mode) {
171322
171395
  const { value, host, inspectorUrl, prewarmUrl } = session;
171323
171396
  const { accountId } = account;
171324
171397
  const url4 = ctx.env && !ctx.legacyEnv ? `/accounts/${accountId}/workers/services/${worker.name}/environments/${ctx.env}/edge-preview` : `/accounts/${accountId}/workers/scripts/${worker.name}/edge-preview`;
@@ -171337,8 +171410,9 @@ async function createPreviewToken(complianceConfig, account, worker, ctx, sessio
171337
171410
  ) : (
171338
171411
  // if there aren't any patterns, then just match on all routes
171339
171412
  ["*/*"]
171340
- )
171341
- } : { workers_dev: true };
171413
+ ),
171414
+ minimal_mode
171415
+ } : { workers_dev: true, minimal_mode };
171342
171416
  const formData = createWorkerUploadForm(worker);
171343
171417
  formData.set("wrangler-session-config", JSON.stringify(mode));
171344
171418
  const { preview_token } = await fetchResult(
@@ -171361,14 +171435,15 @@ async function createPreviewToken(complianceConfig, account, worker, ctx, sessio
171361
171435
  prewarmUrl
171362
171436
  };
171363
171437
  }
171364
- async function createWorkerPreview(complianceConfig, init3, account, ctx, session, abortSignal) {
171438
+ async function createWorkerPreview(complianceConfig, init3, account, ctx, session, abortSignal, minimal_mode) {
171365
171439
  const token = await createPreviewToken(
171366
171440
  complianceConfig,
171367
171441
  account,
171368
171442
  init3,
171369
171443
  ctx,
171370
171444
  session,
171371
- abortSignal
171445
+ abortSignal,
171446
+ minimal_mode
171372
171447
  );
171373
171448
  const accessToken = await getAccessToken(token.prewarmUrl.hostname);
171374
171449
  const headers = { "cf-workers-preview-token": token.value };
@@ -171529,9 +171604,8 @@ async function createRemoteWorkerInit(props) {
171529
171604
  // no tail consumers in dev - TODO revisit?
171530
171605
  limits: void 0,
171531
171606
  // no limits in preview - not supported yet but can be added
171532
- observability: void 0,
171607
+ observability: void 0
171533
171608
  // no observability in dev,
171534
- minimal_mode: props.minimal_mode
171535
171609
  };
171536
171610
  return init3;
171537
171611
  }
@@ -171718,8 +171792,7 @@ var init_RemoteRuntimeController = __esm({
171718
171792
  format: props.format,
171719
171793
  bindings: props.bindings,
171720
171794
  compatibilityDate: props.compatibilityDate,
171721
- compatibilityFlags: props.compatibilityFlags,
171722
- minimal_mode: props.minimal_mode
171795
+ compatibilityFlags: props.compatibilityFlags
171723
171796
  });
171724
171797
  if (props.bundleId !== this.#currentBundleId) {
171725
171798
  return;
@@ -171730,7 +171803,8 @@ var init_RemoteRuntimeController = __esm({
171730
171803
  workerAccount,
171731
171804
  workerContext,
171732
171805
  this.#session,
171733
- this.#abortController.signal
171806
+ this.#abortController.signal,
171807
+ props.minimal_mode
171734
171808
  );
171735
171809
  return workerPreviewToken;
171736
171810
  } catch (err) {
@@ -172090,6 +172164,7 @@ var init_startDevWorker = __esm({
172090
172164
  "src/api/startDevWorker/index.ts"() {
172091
172165
  init_import_meta_url();
172092
172166
  init_DevEnv();
172167
+ init_utils();
172093
172168
  init_types12();
172094
172169
  init_events();
172095
172170
  __name(startWorker, "startWorker");
@@ -172099,6 +172174,7 @@ var init_startDevWorker = __esm({
172099
172174
  // src/api/mixedMode/index.ts
172100
172175
  var mixedMode_exports = {};
172101
172176
  __export(mixedMode_exports, {
172177
+ pickRemoteBindings: () => pickRemoteBindings,
172102
172178
  startMixedModeSession: () => startMixedModeSession
172103
172179
  });
172104
172180
  async function startMixedModeSession(bindings, options) {
@@ -172107,7 +172183,7 @@ async function startMixedModeSession(bindings, options) {
172107
172183
  "templates/mixedMode/proxyServerWorker/wrangler.jsonc"
172108
172184
  );
172109
172185
  const rawBindings = Object.fromEntries(
172110
- Object.entries(bindings).map(([key, binding]) => [
172186
+ Object.entries(bindings ?? {}).map(([key, binding]) => [
172111
172187
  key,
172112
172188
  { ...binding, raw: true }
172113
172189
  ])
@@ -172133,7 +172209,7 @@ async function startMixedModeSession(bindings, options) {
172133
172209
  const mixedModeConnectionString = await worker.url;
172134
172210
  const updateBindings = /* @__PURE__ */ __name(async (newBindings) => {
172135
172211
  const rawNewBindings = Object.fromEntries(
172136
- Object.entries(newBindings).map(([key, binding]) => [
172212
+ Object.entries(newBindings ?? {}).map(([key, binding]) => [
172137
172213
  key,
172138
172214
  { ...binding, raw: true }
172139
172215
  ])
@@ -172147,6 +172223,16 @@ async function startMixedModeSession(bindings, options) {
172147
172223
  dispose: worker.dispose
172148
172224
  };
172149
172225
  }
172226
+ function pickRemoteBindings(bindings) {
172227
+ return Object.fromEntries(
172228
+ Object.entries(bindings ?? {}).filter(([, binding]) => {
172229
+ if (binding.type === "ai") {
172230
+ return true;
172231
+ }
172232
+ return "remote" in binding && binding["remote"];
172233
+ })
172234
+ );
172235
+ }
172150
172236
  var import_node_path63;
172151
172237
  var init_mixedMode = __esm({
172152
172238
  "src/api/mixedMode/index.ts"() {
@@ -172156,6 +172242,7 @@ var init_mixedMode = __esm({
172156
172242
  init_paths();
172157
172243
  init_startDevWorker();
172158
172244
  __name(startMixedModeSession, "startMixedModeSession");
172245
+ __name(pickRemoteBindings, "pickRemoteBindings");
172159
172246
  }
172160
172247
  });
172161
172248
 
@@ -172259,30 +172346,20 @@ async function convertToConfigBundle(event) {
172259
172346
  };
172260
172347
  }
172261
172348
  async function maybeStartOrUpdateMixedModeSession(configBundle, mixedModeSession) {
172262
- const remoteBindings = convertCfWorkerInitBindingsToBindings(
172349
+ const { startMixedModeSession: startMixedModeSession2, pickRemoteBindings: pickRemoteBindings2 } = await Promise.resolve().then(() => (init_mixedMode(), mixedMode_exports));
172350
+ const convertedBindings = convertCfWorkerInitBindingsToBindings(
172263
172351
  configBundle.bindings
172264
172352
  );
172265
- const convertedRemoteBindings = Object.fromEntries(
172266
- Object.entries(remoteBindings ?? []).filter(([, binding]) => {
172267
- if (binding.type === "ai") {
172268
- return true;
172269
- }
172270
- return "remote" in binding && binding["remote"];
172271
- })
172272
- );
172353
+ const remoteBindings = pickRemoteBindings2(convertedBindings ?? {});
172273
172354
  if (mixedModeSession === void 0) {
172274
- const numOfRemoteBindings = Object.keys(
172275
- convertedRemoteBindings ?? {}
172276
- ).length;
172355
+ const numOfRemoteBindings = Object.keys(remoteBindings ?? {}).length;
172277
172356
  if (numOfRemoteBindings > 0) {
172278
- const mixedModeModule = await Promise.resolve().then(() => (init_mixedMode(), mixedMode_exports));
172279
- mixedModeSession = await mixedModeModule.startMixedModeSession(
172280
- convertedRemoteBindings,
172281
- { complianceRegion: configBundle.complianceRegion }
172282
- );
172357
+ mixedModeSession = await startMixedModeSession2(remoteBindings, {
172358
+ complianceRegion: configBundle.complianceRegion
172359
+ });
172283
172360
  }
172284
172361
  } else {
172285
- await mixedModeSession.updateBindings(convertedRemoteBindings);
172362
+ await mixedModeSession.updateBindings(remoteBindings);
172286
172363
  }
172287
172364
  await mixedModeSession?.ready;
172288
172365
  return mixedModeSession;
@@ -176238,7 +176315,7 @@ function getResolvedSiteAssetPaths(args, configParam) {
176238
176315
  args.siteExclude
176239
176316
  );
176240
176317
  }
176241
- function getBindings2(configParam, env6, local, args) {
176318
+ function getBindings2(configParam, env6, local, args, mixedModeEnabled = getFlag("MIXED_MODE")) {
176242
176319
  const kvConfig = (configParam.kv_namespaces || []).map(
176243
176320
  ({ binding, preview_id, id, remote }) => {
176244
176321
  if (!preview_id && !local) {
@@ -176249,7 +176326,7 @@ function getBindings2(configParam, env6, local, args) {
176249
176326
  return {
176250
176327
  binding,
176251
176328
  id: preview_id ?? id,
176252
- remote: getFlag("MIXED_MODE") && remote
176329
+ remote: mixedModeEnabled && remote
176253
176330
  };
176254
176331
  }
176255
176332
  );
@@ -176263,7 +176340,7 @@ function getBindings2(configParam, env6, local, args) {
176263
176340
  if (local) {
176264
176341
  return {
176265
176342
  ...d1Db,
176266
- remote: getFlag("MIXED_MODE") && d1Db.remote,
176343
+ remote: mixedModeEnabled && d1Db.remote,
176267
176344
  database_id
176268
176345
  };
176269
176346
  }
@@ -176291,7 +176368,7 @@ function getBindings2(configParam, env6, local, args) {
176291
176368
  binding,
176292
176369
  bucket_name: preview_bucket_name ?? bucket_name,
176293
176370
  jurisdiction,
176294
- remote: getFlag("MIXED_MODE") && remote
176371
+ remote: mixedModeEnabled && remote
176295
176372
  };
176296
176373
  }
176297
176374
  ) || [];
@@ -176305,7 +176382,7 @@ function getBindings2(configParam, env6, local, args) {
176305
176382
  "binding"
176306
176383
  ).map((service) => ({
176307
176384
  ...service,
176308
- remote: getFlag("MIXED_MODE") && "remote" in service && !!service.remote
176385
+ remote: mixedModeEnabled && "remote" in service && !!service.remote
176309
176386
  }));
176310
176387
  const hyperdriveBindings = configParam.hyperdrive.map((hyperdrive) => {
176311
176388
  const connectionStringFromEnv = process.env[`WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_${hyperdrive.binding}`];
@@ -176328,13 +176405,13 @@ function getBindings2(configParam, env6, local, args) {
176328
176405
  binding: queue.binding,
176329
176406
  queue_name: queue.queue,
176330
176407
  delivery_delay: queue.delivery_delay,
176331
- remote: getFlag("MIXED_MODE") && queue.remote
176408
+ remote: mixedModeEnabled && queue.remote
176332
176409
  };
176333
176410
  })
176334
176411
  ];
176335
176412
  const workflowsConfig = configParam.workflows.map((workflowConfig) => ({
176336
176413
  ...workflowConfig,
176337
- remote: getFlag("MIXED_MODE") && workflowConfig.remote
176414
+ remote: mixedModeEnabled && workflowConfig.remote
176338
176415
  }));
176339
176416
  const bindings = {
176340
176417
  // top-level fields
@@ -177143,23 +177220,36 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
177143
177220
  include: rule.globs,
177144
177221
  fallthrough: rule.fallthrough
177145
177222
  }));
177146
- const bindings = getBindings2(config, env6, true, {});
177147
- const { bindingOptions, externalWorkers } = buildMiniflareBindingOptions({
177148
- name: config.name,
177149
- complianceRegion: config.compliance_region,
177150
- bindings,
177151
- workerDefinitions: null,
177152
- queueConsumers: config.queues.consumers,
177153
- services: [],
177154
- serviceBindings: {},
177155
- migrations: config.migrations,
177156
- imagesLocalMode: !!options?.imagesLocalMode,
177157
- tails: config.tail_consumers
177158
- });
177223
+ const bindings = getBindings2(config, env6, true, {}, true);
177224
+ const { bindingOptions, externalWorkers } = buildMiniflareBindingOptions(
177225
+ {
177226
+ name: config.name,
177227
+ complianceRegion: config.compliance_region,
177228
+ bindings,
177229
+ workerDefinitions: null,
177230
+ queueConsumers: config.queues.consumers,
177231
+ services: [],
177232
+ serviceBindings: {},
177233
+ migrations: config.migrations,
177234
+ imagesLocalMode: !!options?.imagesLocalMode,
177235
+ tails: config.tail_consumers
177236
+ },
177237
+ options?.mixedModeConnectionString
177238
+ );
177159
177239
  if (bindings.services !== void 0) {
177160
177240
  bindingOptions.serviceBindings = Object.fromEntries(
177161
177241
  bindings.services.map((binding) => {
177162
177242
  const name2 = binding.service === config.name ? import_miniflare29.kCurrentWorker : binding.service;
177243
+ if (options?.mixedModeConnectionString && binding.remote) {
177244
+ return [
177245
+ binding.binding,
177246
+ {
177247
+ name: name2,
177248
+ entrypoint: binding.entrypoint,
177249
+ mixedModeConnectionString: options.mixedModeConnectionString
177250
+ }
177251
+ ];
177252
+ }
177163
177253
  return [binding.binding, { name: name2, entrypoint: binding.entrypoint }];
177164
177254
  })
177165
177255
  );
@@ -177256,10 +177346,12 @@ var init_api3 = __esm({
177256
177346
  var cli_exports2 = {};
177257
177347
  __export(cli_exports2, {
177258
177348
  experimental_patchConfig: () => experimental_patchConfig,
177349
+ experimental_pickRemoteBindings: () => pickRemoteBindings,
177259
177350
  experimental_readRawConfig: () => experimental_readRawConfig,
177260
177351
  experimental_startMixedModeSession: () => startMixedModeSession,
177261
177352
  getPlatformProxy: () => getPlatformProxy,
177262
177353
  unstable_DevEnv: () => DevEnv,
177354
+ unstable_convertConfigBindingsToStartWorkerBindings: () => convertConfigBindingsToStartWorkerBindings,
177263
177355
  unstable_dev: () => unstable_dev,
177264
177356
  unstable_generateASSETSBinding: () => generateASSETSBinding2,
177265
177357
  unstable_getMiniflareWorkerOptions: () => unstable_getMiniflareWorkerOptions,
@@ -177362,10 +177454,12 @@ var generateASSETSBinding2 = (
177362
177454
  // Annotate the CommonJS export names for ESM import in node:
177363
177455
  0 && (module.exports = {
177364
177456
  experimental_patchConfig,
177457
+ experimental_pickRemoteBindings,
177365
177458
  experimental_readRawConfig,
177366
177459
  experimental_startMixedModeSession,
177367
177460
  getPlatformProxy,
177368
177461
  unstable_DevEnv,
177462
+ unstable_convertConfigBindingsToStartWorkerBindings,
177369
177463
  unstable_dev,
177370
177464
  unstable_generateASSETSBinding,
177371
177465
  unstable_getMiniflareWorkerOptions,