wrangler 4.21.1 → 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.1",
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"
@@ -22287,14 +22287,13 @@ var init_utils = __esm({
22287
22287
  });
22288
22288
  });
22289
22289
  }, "runDockerCmdWithOutput");
22290
- verifyDockerInstalled = /* @__PURE__ */ __name(async (dockerPath) => {
22290
+ verifyDockerInstalled = /* @__PURE__ */ __name(async (dockerPath, isDev = true) => {
22291
22291
  try {
22292
22292
  await runDockerCmd(dockerPath, ["info"], ["inherit", "pipe", "pipe"]);
22293
22293
  } catch {
22294
22294
  throw new Error(
22295
- `The Docker CLI could not be launched. Please ensure that Docker is installed and running. You can specify an executable with the environment variable WRANGLER_DOCKER_BIN.
22296
- Other container tooling that is compatible with the Docker CLI may work, but is not yet guaranteed to do so.
22297
- To suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your Wrangler config or passing in --enable-containers=false.`
22295
+ `The Docker CLI could not be launched. Please ensure that the Docker CLI is installed and the daemon is running.
22296
+ Other container tooling that is compatible with the Docker CLI and engine may work, but is not yet guaranteed to do so. You can specify an executable with the environment variable WRANGLER_DOCKER_BIN and a socket with WRANGLER_DOCKER_HOST.${isDev ? "\nTo suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your Wrangler config or passing in --enable-containers=false." : ""}`
22298
22297
  );
22299
22298
  }
22300
22299
  }, "verifyDockerInstalled");
@@ -22375,24 +22374,6 @@ var init_types = __esm({
22375
22374
  });
22376
22375
 
22377
22376
  // ../containers-shared/src/images.ts
22378
- async function getDockerImageDigest(dockerPath, imageTag) {
22379
- return new Promise((resolve24, reject) => {
22380
- (0, import_child_process4.execFile)(
22381
- dockerPath,
22382
- ["images", "--digests", "--format", "{{.Digest}}", imageTag],
22383
- (error2, stdout2, stderr2) => {
22384
- if (error2) {
22385
- return reject(
22386
- new Error(
22387
- `Failed getting docker image digest for image: ${imageTag} with error: ${error2}.`
22388
- )
22389
- );
22390
- }
22391
- return resolve24(stdout2.trim());
22392
- }
22393
- );
22394
- });
22395
- }
22396
22377
  async function pullImage(dockerPath, options) {
22397
22378
  await dockerLoginManagedRegistry(dockerPath);
22398
22379
  await runDockerCmd(dockerPath, [
@@ -22426,16 +22407,13 @@ To use an existing image from another repository, see https://developers.cloudfl
22426
22407
  await checkExposedPorts(dockerPath, options);
22427
22408
  }
22428
22409
  }
22429
- var import_child_process4;
22430
22410
  var init_images = __esm({
22431
22411
  "../containers-shared/src/images.ts"() {
22432
22412
  init_import_meta_url();
22433
- import_child_process4 = require("child_process");
22434
22413
  init_build();
22435
22414
  init_knobs();
22436
22415
  init_login();
22437
22416
  init_utils();
22438
- __name(getDockerImageDigest, "getDockerImageDigest");
22439
22417
  __name(pullImage, "pullImage");
22440
22418
  __name(prepareContainerImagesForDev, "prepareContainerImagesForDev");
22441
22419
  }
@@ -29508,7 +29486,7 @@ var name, version;
29508
29486
  var init_package = __esm({
29509
29487
  "package.json"() {
29510
29488
  name = "wrangler";
29511
- version = "4.21.1";
29489
+ version = "4.22.0";
29512
29490
  }
29513
29491
  });
29514
29492
 
@@ -38667,9 +38645,8 @@ function validateContainerApp(envName, topLevelName) {
38667
38645
  );
38668
38646
  return false;
38669
38647
  }
38670
- containerAppOptional.configuration ??= {
38671
- image: containerAppOptional.image
38672
- };
38648
+ containerAppOptional.configuration ??= {};
38649
+ containerAppOptional.configuration.image = containerAppOptional.image;
38673
38650
  delete containerAppOptional["image"];
38674
38651
  }
38675
38652
  if (!isOptionalProperty(
@@ -49164,7 +49141,7 @@ async function getAccessToken(domain2) {
49164
49141
  if (cache[domain2]) {
49165
49142
  return cache[domain2];
49166
49143
  }
49167
- const output = (0, import_child_process5.spawnSync)("cloudflared", ["access", "login", domain2]);
49144
+ const output = (0, import_child_process4.spawnSync)("cloudflared", ["access", "login", domain2]);
49168
49145
  if (output.error) {
49169
49146
  throw new UserError(
49170
49147
  "To use Wrangler with Cloudflare Access, please install `cloudflared` from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation"
@@ -49178,11 +49155,11 @@ async function getAccessToken(domain2) {
49178
49155
  }
49179
49156
  throw new Error("Failed to authenticate with Cloudflare Access");
49180
49157
  }
49181
- var import_child_process5, import_undici2, cache, usesAccessCache;
49158
+ var import_child_process4, import_undici2, cache, usesAccessCache;
49182
49159
  var init_access = __esm({
49183
49160
  "src/user/access.ts"() {
49184
49161
  init_import_meta_url();
49185
- import_child_process5 = require("child_process");
49162
+ import_child_process4 = require("child_process");
49186
49163
  import_undici2 = __toESM(require_undici());
49187
49164
  init_errors();
49188
49165
  init_logger();
@@ -49799,11 +49776,7 @@ async function logout() {
49799
49776
  }
49800
49777
  function listScopes(message = "\u{1F481} Available scopes:") {
49801
49778
  logger.log(message);
49802
- const data = DefaultScopeKeys.map((scope) => ({
49803
- Scope: scope,
49804
- Description: DefaultScopes[scope]
49805
- }));
49806
- logger.table(data);
49779
+ printScopes(DefaultScopeKeys);
49807
49780
  }
49808
49781
  async function getAccountId(complianceConfig) {
49809
49782
  const cachedAccount2 = getAccountFromCache();
@@ -49877,6 +49850,13 @@ function getAccountFromCache() {
49877
49850
  function getScopes() {
49878
49851
  return LocalState.scopes;
49879
49852
  }
49853
+ function printScopes(scopes) {
49854
+ const data = scopes.map((scope) => ({
49855
+ Scope: scope,
49856
+ Description: DefaultScopes[scope]
49857
+ }));
49858
+ logger.table(data);
49859
+ }
49880
49860
  async function fetchAuthToken(body) {
49881
49861
  const headers = {
49882
49862
  "Content-Type": "application/x-www-form-urlencoded"
@@ -50155,6 +50135,7 @@ var init_user = __esm({
50155
50135
  __name(saveAccountToCache, "saveAccountToCache");
50156
50136
  __name(getAccountFromCache, "getAccountFromCache");
50157
50137
  __name(getScopes, "getScopes");
50138
+ __name(printScopes, "printScopes");
50158
50139
  __name(fetchAuthToken, "fetchAuthToken");
50159
50140
  __name(getJSONFromResponse, "getJSONFromResponse");
50160
50141
  }
@@ -62273,6 +62254,14 @@ async function fillOpenAPIConfiguration(config, _json2, scope) {
62273
62254
  const headers = OpenAPI.HEADERS !== void 0 ? { ...OpenAPI.HEADERS } : {};
62274
62255
  const accountId = await requireAuth(config);
62275
62256
  const auth = requireApiToken();
62257
+ const scopes = getScopes();
62258
+ if (scopes !== void 0 && !scopes.includes(scope)) {
62259
+ logger.error(`You don't have '${scope}' in your list of scopes`);
62260
+ printScopes(scopes ?? []);
62261
+ throw new UserError(
62262
+ `You need '${scope}', try logging in again or creating an appropiate API token`
62263
+ );
62264
+ }
62276
62265
  addAuthorizationHeaderIfUnspecified(headers, auth);
62277
62266
  addUserAgent(headers);
62278
62267
  OpenAPI.CREDENTIALS = "omit";
@@ -62743,9 +62732,9 @@ async function buildAndMaybePush(args, pathToDocker, push, containerConfig) {
62743
62732
  });
62744
62733
  const inspectOutput = await dockerImageInspect(pathToDocker, {
62745
62734
  imageTag,
62746
- formatString: "{{ .Size }} {{ len .RootFS.Layers }}"
62735
+ formatString: "{{ .Size }} {{ len .RootFS.Layers }} {{json .RepoDigests}}"
62747
62736
  });
62748
- const [sizeStr, layerStr] = inspectOutput.split(" ");
62737
+ const [sizeStr, layerStr, repoDigests] = inspectOutput.split(" ");
62749
62738
  const size = parseInt(sizeStr, 10);
62750
62739
  const layers = parseInt(layerStr, 10);
62751
62740
  const MiB = 1024 * 1024;
@@ -62755,15 +62744,28 @@ async function buildAndMaybePush(args, pathToDocker, push, containerConfig) {
62755
62744
  account,
62756
62745
  containerApp: containerConfig
62757
62746
  });
62747
+ let pushed = false;
62758
62748
  if (push) {
62759
62749
  await dockerLoginManagedRegistry(pathToDocker);
62760
62750
  try {
62751
+ const parsedDigests = JSON.parse(repoDigests);
62752
+ if (!Array.isArray(parsedDigests)) {
62753
+ throw new Error(
62754
+ `Expected RepoDigests from docker inspect to be an array but got ${JSON.stringify(parsedDigests)}`
62755
+ );
62756
+ }
62761
62757
  const repositoryOnly = imageTag.split(":")[0];
62762
- const localDigest = await getDockerImageDigest(pathToDocker, imageTag);
62763
- const digest = repositoryOnly + "@" + localDigest;
62758
+ const digests = parsedDigests.filter(
62759
+ (d6) => typeof d6 === "string" && d6.split("@")[0] === repositoryOnly
62760
+ );
62761
+ if (digests.length !== 1) {
62762
+ throw new Error(
62763
+ `Expected there to only be 1 valid digests for this repository: ${repositoryOnly} but there were ${digests.length}`
62764
+ );
62765
+ }
62764
62766
  await runDockerCmd(
62765
62767
  pathToDocker,
62766
- ["manifest", "inspect", digest],
62768
+ ["manifest", "inspect", digests[0]],
62767
62769
  "ignore"
62768
62770
  );
62769
62771
  logger.log("Image already exists remotely, skipping push");
@@ -62771,13 +62773,19 @@ async function buildAndMaybePush(args, pathToDocker, push, containerConfig) {
62771
62773
  `Untagging built image: ${imageTag} since there was no change.`
62772
62774
  );
62773
62775
  await runDockerCmd(pathToDocker, ["image", "rm", imageTag]);
62774
- return "";
62776
+ return { image: digests[0], pushed: false };
62775
62777
  } catch (error2) {
62776
62778
  logger.log(`Image does not exist remotely, pushing: ${imageTag}`);
62779
+ if (error2 instanceof Error) {
62780
+ logger.debug(
62781
+ `Checking for local image ${imageTag} failed with error: ${error2.message}`
62782
+ );
62783
+ }
62777
62784
  await runDockerCmd(pathToDocker, ["push", imageTag]);
62785
+ pushed = true;
62778
62786
  }
62779
62787
  }
62780
- return imageTag;
62788
+ return { image: imageTag, pushed };
62781
62789
  } catch (error2) {
62782
62790
  if (error2 instanceof Error) {
62783
62791
  throw new UserError(error2.message);
@@ -62906,7 +62914,7 @@ async function handleDeleteImageCommand(args, _config) {
62906
62914
  `Failed to delete image ${args.image}: ${gcResponse.status} ${gcResponse.statusText}`
62907
62915
  );
62908
62916
  }
62909
- await logger.log(`Deleted tag: ${args.image}`);
62917
+ logger.log(`Deleted tag: ${args.image}`);
62910
62918
  }),
62911
62919
  { message: "Deleting", json: args.json }
62912
62920
  );
@@ -62914,21 +62922,24 @@ async function handleDeleteImageCommand(args, _config) {
62914
62922
  logger.log(`Error when removing image: ${error2}`);
62915
62923
  }
62916
62924
  }
62917
- async function handleListImagesCommand(args, _config) {
62925
+ async function handleListImagesCommand(args, config) {
62918
62926
  try {
62919
62927
  return await promiseSpinner(
62920
62928
  getCreds().then(async (creds) => {
62921
62929
  const repos = await listRepos(creds);
62922
- 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 ?? "");
62923
62934
  for (const repo of repos) {
62924
62935
  const stripped = repo.replace(/^\/+/, "");
62925
- const regex2 = new RegExp(args.filter ?? "");
62926
- if (regex2.test(stripped)) {
62927
- const repoTags = await listTags(stripped, creds);
62928
- 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 });
62929
62940
  }
62930
62941
  }
62931
- await ListTags(tags, false, args.json);
62942
+ await ListTags(responses, false, args.json);
62932
62943
  }),
62933
62944
  { message: "Listing", json: args.json }
62934
62945
  );
@@ -62951,13 +62962,16 @@ async function ListTags(responses, digests = false, json = false) {
62951
62962
  if (json) {
62952
62963
  logger.log(JSON.stringify(responses, null, 2));
62953
62964
  } else {
62954
- const rows = responses.map((resp) => {
62955
- return {
62956
- REPOSITORY: resp.name,
62957
- TAG: resp.tags.join(" ")
62958
- };
62959
- }).flat();
62960
- 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
+ }
62961
62975
  }
62962
62976
  }
62963
62977
  async function listTags(repo, creds) {
@@ -63041,6 +63055,7 @@ var init_list = __esm({
63041
63055
  init_import_meta_url();
63042
63056
  init_containers_shared();
63043
63057
  init_logger();
63058
+ init_user2();
63044
63059
  init_common();
63045
63060
  imagesCommand = /* @__PURE__ */ __name((yargs, scope) => {
63046
63061
  return yargs.command(
@@ -63794,18 +63809,26 @@ function observabilityToConfiguration(observability, existingObservabilityConfig
63794
63809
  }
63795
63810
  }
63796
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
+ }
63797
63821
  function containerAppToCreateApplication(containerApp, observability, existingApp, skipDefaults = false) {
63798
63822
  const observabilityConfiguration = observabilityToConfiguration(
63799
63823
  observability,
63800
63824
  existingApp?.configuration.observability
63801
63825
  );
63826
+ const instanceType = containerAppToInstanceType(containerApp);
63802
63827
  const configuration = {
63803
63828
  ...containerApp.configuration,
63804
- observability: observabilityConfiguration
63829
+ observability: observabilityConfiguration,
63830
+ instance_type: instanceType
63805
63831
  };
63806
- if (containerApp.instance_type !== void 0) {
63807
- configuration.instance_type = containerApp.instance_type;
63808
- }
63809
63832
  if (containerApp.name === void 0) {
63810
63833
  throw new FatalError("Container application name failed to be set", 1, {
63811
63834
  telemetryMessage: true
@@ -64004,6 +64027,9 @@ async function apply(args, config) {
64004
64027
  `${config.name}-${appConfigNoDefaults.class_name}`];
64005
64028
  if (!appConfigNoDefaults.configuration?.image && application) {
64006
64029
  appConfigNoDefaults.configuration ??= {};
64030
+ }
64031
+ if (!args.imageUpdateRequired && application) {
64032
+ appConfigNoDefaults.configuration ??= {};
64007
64033
  appConfigNoDefaults.configuration.image = application.configuration.image;
64008
64034
  }
64009
64035
  const appConfig = containerAppToCreateApplication(
@@ -64287,7 +64313,14 @@ ${err.message}`
64287
64313
  }
64288
64314
  async function applyCommand(args, config) {
64289
64315
  return apply(
64290
- { skipDefaults: args.skipDefaults, env: args.env, json: args.json },
64316
+ {
64317
+ skipDefaults: args.skipDefaults,
64318
+ env: args.env,
64319
+ json: args.json,
64320
+ // For the apply command we want this to default to true
64321
+ // so that the image can be updated if the user modified it.
64322
+ imageUpdateRequired: true
64323
+ },
64291
64324
  config
64292
64325
  );
64293
64326
  }
@@ -64309,6 +64342,7 @@ var init_apply = __esm({
64309
64342
  __name(applicationToCreateApplication, "applicationToCreateApplication");
64310
64343
  __name(cleanupObservability, "cleanupObservability");
64311
64344
  __name(observabilityToConfiguration, "observabilityToConfiguration");
64345
+ __name(containerAppToInstanceType, "containerAppToInstanceType");
64312
64346
  __name(containerAppToCreateApplication, "containerAppToCreateApplication");
64313
64347
  __name(isNumber, "isNumber");
64314
64348
  __name(createLine, "createLine");
@@ -64327,7 +64361,10 @@ async function maybeBuildContainer(containerConfig, imageTag, dryRun, pathToDock
64327
64361
  if (!isDockerfile(
64328
64362
  containerConfig.image ?? containerConfig.configuration?.image
64329
64363
  )) {
64330
- return containerConfig.image ?? containerConfig.configuration?.image;
64364
+ return {
64365
+ image: containerConfig.image ?? containerConfig.configuration?.image,
64366
+ pushed: false
64367
+ };
64331
64368
  }
64332
64369
  } catch (err) {
64333
64370
  if (err instanceof Error) {
@@ -64337,13 +64374,13 @@ async function maybeBuildContainer(containerConfig, imageTag, dryRun, pathToDock
64337
64374
  }
64338
64375
  const options = getBuildArguments(containerConfig, imageTag);
64339
64376
  logger.log("Building image", options.tag);
64340
- const tag = await buildAndMaybePush(
64377
+ const buildResult = await buildAndMaybePush(
64341
64378
  options,
64342
64379
  pathToDocker,
64343
64380
  !dryRun,
64344
64381
  containerConfig
64345
64382
  );
64346
- return tag;
64383
+ return buildResult;
64347
64384
  }
64348
64385
  async function deployContainers(config, { versionId, accountId, scriptName, dryRun, env: env6 }) {
64349
64386
  if (config.containers === void 0) {
@@ -64386,16 +64423,24 @@ async function deployContainers(config, { versionId, accountId, scriptName, dryR
64386
64423
  }
64387
64424
  ]
64388
64425
  };
64389
- const image = await maybeBuildContainer(
64426
+ const buildResult = await maybeBuildContainer(
64390
64427
  container,
64391
64428
  versionId,
64392
64429
  dryRun,
64393
64430
  pathToDocker
64394
64431
  );
64395
64432
  container.configuration ??= {};
64396
- container.configuration.image = image;
64397
- container.image = image;
64398
- await apply({ skipDefaults: false, json: true, env: env6 }, configuration);
64433
+ container.configuration.image = buildResult.image;
64434
+ container.image = buildResult.image;
64435
+ await apply(
64436
+ {
64437
+ skipDefaults: false,
64438
+ json: true,
64439
+ env: env6,
64440
+ imageUpdateRequired: buildResult.pushed
64441
+ },
64442
+ configuration
64443
+ );
64399
64444
  }
64400
64445
  }
64401
64446
  function getBuildArguments(container, idForImageTag) {
@@ -89637,7 +89682,7 @@ var init_deployment_tails = __esm({
89637
89682
  new URLSearchParams({ env: environment })
89638
89683
  );
89639
89684
  const envDeployments = deployments.filter(
89640
- (d6) => d6.environment === environment
89685
+ (d6) => d6.environment === environment && d6.latest_stage.name === "deploy" && d6.latest_stage.status === "success"
89641
89686
  );
89642
89687
  if (isUrl(deployment)) {
89643
89688
  const { hostname: deploymentHostname } = new URL(deployment);
@@ -119664,12 +119709,12 @@ var init_getValidatedProcessCredentials = __esm({
119664
119709
  });
119665
119710
 
119666
119711
  // ../../node_modules/.pnpm/@aws-sdk+credential-provider-process@3.716.0/node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
119667
- var import_child_process6, import_util14, resolveProcessCredentials;
119712
+ var import_child_process5, import_util14, resolveProcessCredentials;
119668
119713
  var init_resolveProcessCredentials = __esm({
119669
119714
  "../../node_modules/.pnpm/@aws-sdk+credential-provider-process@3.716.0/node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js"() {
119670
119715
  init_import_meta_url();
119671
119716
  init_dist_es17();
119672
- import_child_process6 = require("child_process");
119717
+ import_child_process5 = require("child_process");
119673
119718
  import_util14 = require("util");
119674
119719
  init_getValidatedProcessCredentials();
119675
119720
  resolveProcessCredentials = /* @__PURE__ */ __name(async (profileName, profiles, logger4) => {
@@ -119677,7 +119722,7 @@ var init_resolveProcessCredentials = __esm({
119677
119722
  if (profiles[profileName]) {
119678
119723
  const credentialProcess = profile["credential_process"];
119679
119724
  if (credentialProcess !== void 0) {
119680
- const execPromise = (0, import_util14.promisify)(import_child_process6.exec);
119725
+ const execPromise = (0, import_util14.promisify)(import_child_process5.exec);
119681
119726
  try {
119682
119727
  const { stdout: stdout2 } = await execPromise(credentialProcess);
119683
119728
  let data;
@@ -140306,7 +140351,7 @@ async function getDarwinInfo() {
140306
140351
  };
140307
140352
  try {
140308
140353
  const output = await new Promise((resolve24, reject) => {
140309
- (0, import_child_process7.execFile)("/usr/bin/sw_vers", (error2, stdout2) => {
140354
+ (0, import_child_process6.execFile)("/usr/bin/sw_vers", (error2, stdout2) => {
140310
140355
  if (error2) {
140311
140356
  reject(error2);
140312
140357
  return;
@@ -140400,12 +140445,12 @@ function getCloudResourceContext() {
140400
140445
  return void 0;
140401
140446
  }
140402
140447
  }
140403
- var import_child_process7, import_fs24, os8, import_path24, import_util16, readFileAsync, readDirAsync, Context, PLATFORM_NAMES, LINUX_DISTROS, LINUX_VERSIONS;
140448
+ var import_child_process6, import_fs24, os8, import_path24, import_util16, readFileAsync, readDirAsync, Context, PLATFORM_NAMES, LINUX_DISTROS, LINUX_VERSIONS;
140404
140449
  var init_context = __esm({
140405
140450
  "../../node_modules/.pnpm/@sentry+node@7.87.0_supports-color@9.2.2/node_modules/@sentry/node/esm/integrations/context.js"() {
140406
140451
  init_import_meta_url();
140407
140452
  init_esm6();
140408
- import_child_process7 = require("child_process");
140453
+ import_child_process6 = require("child_process");
140409
140454
  import_fs24 = require("fs");
140410
140455
  os8 = __toESM(require("os"));
140411
140456
  import_path24 = require("path");
@@ -152638,8 +152683,16 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
152638
152683
  }
152639
152684
  const canUseNewVersionsDeploymentsApi = workerExists && props.dispatchNamespace === void 0 && prod && format9 === "modules" && migrations === void 0 && !config.first_party_worker && config.containers === void 0;
152640
152685
  let workerBundle;
152686
+ const dockerPath = getDockerPath();
152687
+ if (config.containers) {
152688
+ const hasDockerfiles = config.containers?.some(
152689
+ (container) => isDockerfile(container.image ?? container.configuration?.image)
152690
+ );
152691
+ if (hasDockerfiles) {
152692
+ await verifyDockerInstalled(dockerPath, false);
152693
+ }
152694
+ }
152641
152695
  if (props.dryRun) {
152642
- const dockerPath = getDockerPath();
152643
152696
  if (config.containers) {
152644
152697
  for (const container of config.containers) {
152645
152698
  await maybeBuildContainer(
@@ -153081,6 +153134,7 @@ var init_deploy7 = __esm({
153081
153134
  import_node_path56 = __toESM(require("path"));
153082
153135
  import_node_url9 = require("url");
153083
153136
  init_cli();
153137
+ init_containers_shared();
153084
153138
  init_dist2();
153085
153139
  import_undici21 = __toESM(require_undici());
153086
153140
  init_assets();
@@ -153233,7 +153287,7 @@ function getAssetsOptions(args, config, overrides) {
153233
153287
  const directory = path59.resolve(assetsBasePath, assets.directory);
153234
153288
  if (!(0, import_node_fs32.existsSync)(directory)) {
153235
153289
  const sourceOfTruthMessage = args.assets ? '"--assets" command line argument' : '"assets.directory" field in your configuration file';
153236
- throw new UserError(
153290
+ throw new NonExistentAssetsDirError(
153237
153291
  `The directory specified by the ${sourceOfTruthMessage} does not exist:
153238
153292
  ${directory}`,
153239
153293
  {
@@ -153319,7 +153373,7 @@ function errorOnLegacyPagesWorkerJSAsset(file, hasAssetsIgnoreFile) {
153319
153373
  }
153320
153374
  }
153321
153375
  }
153322
- 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;
153323
153377
  var init_assets = __esm({
153324
153378
  "src/assets.ts"() {
153325
153379
  init_import_meta_url();
@@ -153572,6 +153626,11 @@ Ensure all assets in your assets directory "${dir}" conform with the Workers max
153572
153626
  __name(logAssetsUploadStatus, "logAssetsUploadStatus");
153573
153627
  __name(logReadFilesFromDirectory, "logReadFilesFromDirectory");
153574
153628
  __name(getAssetsBasePath, "getAssetsBasePath");
153629
+ NonExistentAssetsDirError = class extends UserError {
153630
+ static {
153631
+ __name(this, "NonExistentAssetsDirError");
153632
+ }
153633
+ };
153575
153634
  __name(getAssetsOptions, "getAssetsOptions");
153576
153635
  __name(validateAssetsArgsAndConfig, "validateAssetsArgsAndConfig");
153577
153636
  WORKER_JS_FILENAME = "_worker.js";
@@ -178712,6 +178771,16 @@ async function getMiniflareOptionsFromConfig(args) {
178712
178771
  remoteProxyConnectionString,
178713
178772
  remoteBindingsEnabled
178714
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 }) : {};
178715
178784
  const defaultPersistRoot = getMiniflarePersistRoot(options.persist);
178716
178785
  const serviceBindings = await getServiceBindings(bindings.services);
178717
178786
  const miniflareOptions = {
@@ -178724,7 +178793,8 @@ async function getMiniflareOptionsFromConfig(args) {
178724
178793
  serviceBindings: {
178725
178794
  ...serviceBindings,
178726
178795
  ...bindingOptions.serviceBindings
178727
- }
178796
+ },
178797
+ ...assetOptions
178728
178798
  },
178729
178799
  ...externalWorkers
178730
178800
  ],