wrangler 4.21.2 → 4.22.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.21.2",
3
+ "version": "4.22.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -136,8 +136,8 @@
136
136
  "xxhash-wasm": "^1.0.1",
137
137
  "yargs": "^17.7.2",
138
138
  "@cloudflare/cli": "1.1.1",
139
- "@cloudflare/containers-shared": "0.2.2",
140
139
  "@cloudflare/eslint-config-worker": "1.1.0",
140
+ "@cloudflare/containers-shared": "0.2.2",
141
141
  "@cloudflare/pages-shared": "^0.13.51",
142
142
  "@cloudflare/workers-shared": "0.18.0",
143
143
  "@cloudflare/workers-tsconfig": "0.0.0"
@@ -29486,7 +29486,7 @@ var name, version;
29486
29486
  var init_package = __esm({
29487
29487
  "package.json"() {
29488
29488
  name = "wrangler";
29489
- version = "4.21.2";
29489
+ version = "4.22.0";
29490
29490
  }
29491
29491
  });
29492
29492
 
@@ -62914,7 +62914,7 @@ async function handleDeleteImageCommand(args, _config) {
62914
62914
  `Failed to delete image ${args.image}: ${gcResponse.status} ${gcResponse.statusText}`
62915
62915
  );
62916
62916
  }
62917
- await logger.log(`Deleted tag: ${args.image}`);
62917
+ logger.log(`Deleted tag: ${args.image}`);
62918
62918
  }),
62919
62919
  { message: "Deleting", json: args.json }
62920
62920
  );
@@ -62922,21 +62922,24 @@ async function handleDeleteImageCommand(args, _config) {
62922
62922
  logger.log(`Error when removing image: ${error2}`);
62923
62923
  }
62924
62924
  }
62925
- async function handleListImagesCommand(args, _config) {
62925
+ async function handleListImagesCommand(args, config) {
62926
62926
  try {
62927
62927
  return await promiseSpinner(
62928
62928
  getCreds().then(async (creds) => {
62929
62929
  const repos = await listRepos(creds);
62930
- const tags = [];
62930
+ const responses = [];
62931
+ const accountId = config.account_id || await getAccountId(config);
62932
+ const accountIdPrefix = new RegExp(`^${accountId}/`);
62933
+ const filter = new RegExp(args.filter ?? "");
62931
62934
  for (const repo of repos) {
62932
62935
  const stripped = repo.replace(/^\/+/, "");
62933
- const regex2 = new RegExp(args.filter ?? "");
62934
- if (regex2.test(stripped)) {
62935
- const repoTags = await listTags(stripped, creds);
62936
- tags.push({ name: stripped, tags: repoTags });
62936
+ if (filter.test(stripped)) {
62937
+ const tags = await listTags(stripped, creds);
62938
+ const name2 = stripped.replace(accountIdPrefix, "");
62939
+ responses.push({ name: name2, tags });
62937
62940
  }
62938
62941
  }
62939
- await ListTags(tags, false, args.json);
62942
+ await ListTags(responses, false, args.json);
62940
62943
  }),
62941
62944
  { message: "Listing", json: args.json }
62942
62945
  );
@@ -62959,13 +62962,16 @@ async function ListTags(responses, digests = false, json = false) {
62959
62962
  if (json) {
62960
62963
  logger.log(JSON.stringify(responses, null, 2));
62961
62964
  } else {
62962
- const rows = responses.map((resp) => {
62963
- return {
62964
- REPOSITORY: resp.name,
62965
- TAG: resp.tags.join(" ")
62966
- };
62967
- }).flat();
62968
- logger.table(rows);
62965
+ const rows = responses.flatMap((r7) => r7.tags.map((t7) => [r7.name, t7]));
62966
+ const headers = ["REPOSITORY", "TAG"];
62967
+ const widths = new Array(headers.length).fill(0);
62968
+ for (let i5 = 0; i5 < widths.length - 1; i5++) {
62969
+ widths[i5] = rows.map((r7) => r7[i5].length).reduce((a5, b6) => Math.max(a5, b6), headers[i5].length);
62970
+ }
62971
+ logger.log(headers.map((h6, i5) => h6.padEnd(widths[i5], " ")).join(" "));
62972
+ for (const row of rows) {
62973
+ logger.log(row.map((v7, i5) => v7.padEnd(widths[i5], " ")).join(" "));
62974
+ }
62969
62975
  }
62970
62976
  }
62971
62977
  async function listTags(repo, creds) {
@@ -63049,6 +63055,7 @@ var init_list = __esm({
63049
63055
  init_import_meta_url();
63050
63056
  init_containers_shared();
63051
63057
  init_logger();
63058
+ init_user2();
63052
63059
  init_common();
63053
63060
  imagesCommand = /* @__PURE__ */ __name((yargs, scope) => {
63054
63061
  return yargs.command(
@@ -63802,18 +63809,26 @@ function observabilityToConfiguration(observability, existingObservabilityConfig
63802
63809
  }
63803
63810
  }
63804
63811
  }
63812
+ function containerAppToInstanceType(containerApp) {
63813
+ if (containerApp.instance_type !== void 0) {
63814
+ return containerApp.instance_type;
63815
+ }
63816
+ const configuration = containerApp.configuration;
63817
+ if (configuration.disk === void 0 && configuration.vcpu === void 0 && configuration.memory === void 0 && configuration.memory_mib === void 0) {
63818
+ return "dev" /* DEV */;
63819
+ }
63820
+ }
63805
63821
  function containerAppToCreateApplication(containerApp, observability, existingApp, skipDefaults = false) {
63806
63822
  const observabilityConfiguration = observabilityToConfiguration(
63807
63823
  observability,
63808
63824
  existingApp?.configuration.observability
63809
63825
  );
63826
+ const instanceType = containerAppToInstanceType(containerApp);
63810
63827
  const configuration = {
63811
63828
  ...containerApp.configuration,
63812
- observability: observabilityConfiguration
63829
+ observability: observabilityConfiguration,
63830
+ instance_type: instanceType
63813
63831
  };
63814
- if (containerApp.instance_type !== void 0) {
63815
- configuration.instance_type = containerApp.instance_type;
63816
- }
63817
63832
  if (containerApp.name === void 0) {
63818
63833
  throw new FatalError("Container application name failed to be set", 1, {
63819
63834
  telemetryMessage: true
@@ -64327,6 +64342,7 @@ var init_apply = __esm({
64327
64342
  __name(applicationToCreateApplication, "applicationToCreateApplication");
64328
64343
  __name(cleanupObservability, "cleanupObservability");
64329
64344
  __name(observabilityToConfiguration, "observabilityToConfiguration");
64345
+ __name(containerAppToInstanceType, "containerAppToInstanceType");
64330
64346
  __name(containerAppToCreateApplication, "containerAppToCreateApplication");
64331
64347
  __name(isNumber, "isNumber");
64332
64348
  __name(createLine, "createLine");
@@ -89666,7 +89682,7 @@ var init_deployment_tails = __esm({
89666
89682
  new URLSearchParams({ env: environment })
89667
89683
  );
89668
89684
  const envDeployments = deployments.filter(
89669
- (d6) => d6.environment === environment
89685
+ (d6) => d6.environment === environment && d6.latest_stage.name === "deploy" && d6.latest_stage.status === "success"
89670
89686
  );
89671
89687
  if (isUrl(deployment)) {
89672
89688
  const { hostname: deploymentHostname } = new URL(deployment);
@@ -153271,7 +153287,7 @@ function getAssetsOptions(args, config, overrides) {
153271
153287
  const directory = path59.resolve(assetsBasePath, assets.directory);
153272
153288
  if (!(0, import_node_fs32.existsSync)(directory)) {
153273
153289
  const sourceOfTruthMessage = args.assets ? '"--assets" command line argument' : '"assets.directory" field in your configuration file';
153274
- throw new UserError(
153290
+ throw new NonExistentAssetsDirError(
153275
153291
  `The directory specified by the ${sourceOfTruthMessage} does not exist:
153276
153292
  ${directory}`,
153277
153293
  {
@@ -153357,7 +153373,7 @@ function errorOnLegacyPagesWorkerJSAsset(file, hasAssetsIgnoreFile) {
153357
153373
  }
153358
153374
  }
153359
153375
  }
153360
- var import_node_assert22, import_node_fs32, import_promises35, path59, import_undici22, BULK_UPLOAD_CONCURRENCY2, MAX_UPLOAD_ATTEMPTS2, MAX_UPLOAD_GATEWAY_ERRORS2, MAX_DIFF_LINES2, syncAssets, buildAssetManifest, WORKER_JS_FILENAME;
153376
+ var import_node_assert22, import_node_fs32, import_promises35, path59, import_undici22, BULK_UPLOAD_CONCURRENCY2, MAX_UPLOAD_ATTEMPTS2, MAX_UPLOAD_GATEWAY_ERRORS2, MAX_DIFF_LINES2, syncAssets, buildAssetManifest, NonExistentAssetsDirError, WORKER_JS_FILENAME;
153361
153377
  var init_assets = __esm({
153362
153378
  "src/assets.ts"() {
153363
153379
  init_import_meta_url();
@@ -153610,6 +153626,11 @@ Ensure all assets in your assets directory "${dir}" conform with the Workers max
153610
153626
  __name(logAssetsUploadStatus, "logAssetsUploadStatus");
153611
153627
  __name(logReadFilesFromDirectory, "logReadFilesFromDirectory");
153612
153628
  __name(getAssetsBasePath, "getAssetsBasePath");
153629
+ NonExistentAssetsDirError = class extends UserError {
153630
+ static {
153631
+ __name(this, "NonExistentAssetsDirError");
153632
+ }
153633
+ };
153613
153634
  __name(getAssetsOptions, "getAssetsOptions");
153614
153635
  __name(validateAssetsArgsAndConfig, "validateAssetsArgsAndConfig");
153615
153636
  WORKER_JS_FILENAME = "_worker.js";
@@ -178750,6 +178771,16 @@ async function getMiniflareOptionsFromConfig(args) {
178750
178771
  remoteProxyConnectionString,
178751
178772
  remoteBindingsEnabled
178752
178773
  );
178774
+ let processedAssetOptions;
178775
+ try {
178776
+ processedAssetOptions = getAssetsOptions({ assets: void 0 }, config);
178777
+ } catch (e7) {
178778
+ const isNonExistentError = e7 instanceof NonExistentAssetsDirError;
178779
+ if (!isNonExistentError) {
178780
+ throw e7;
178781
+ }
178782
+ }
178783
+ const assetOptions = processedAssetOptions ? buildAssetOptions({ assets: processedAssetOptions }) : {};
178753
178784
  const defaultPersistRoot = getMiniflarePersistRoot(options.persist);
178754
178785
  const serviceBindings = await getServiceBindings(bindings.services);
178755
178786
  const miniflareOptions = {
@@ -178762,7 +178793,8 @@ async function getMiniflareOptionsFromConfig(args) {
178762
178793
  serviceBindings: {
178763
178794
  ...serviceBindings,
178764
178795
  ...bindingOptions.serviceBindings
178765
- }
178796
+ },
178797
+ ...assetOptions
178766
178798
  },
178767
178799
  ...externalWorkers
178768
178800
  ],