@cloudflare/deploy-helpers 0.9.2 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { fetchResult, fetchPagedListResult, logger, confirm, fetchListResult, prompt, select } from './chunk-Z4LB73IF.mjs';
2
2
  export { initDeployHelpersContext } from './chunk-Z4LB73IF.mjs';
3
- import { extractBindingsOfType, isUnsafeBindingType, getBindings, createWorkerUploadForm, moduleTypeMimeType } from './chunk-ZV7SJ2MZ.mjs';
4
- export { convertConfigToBindings, createWorkerUploadForm, extractBindingsOfType, fromMimeType, getBindings, handleUnsafeCapnp, isUnsafeBindingType, moduleTypeMimeType } from './chunk-ZV7SJ2MZ.mjs';
3
+ import { createWorkerUploadForm, moduleTypeMimeType } from './chunk-PXVCTRCA.mjs';
4
+ export { createWorkerUploadForm, fromMimeType, handleUnsafeCapnp, moduleTypeMimeType } from './chunk-PXVCTRCA.mjs';
5
5
  import { __commonJS, __name, __require, __toESM, __export } from './chunk-Q72B4Q5Z.mjs';
6
6
  import assert4 from 'node:assert';
7
7
  import { readFileSync, mkdirSync, writeFileSync, createReadStream } from 'node:fs';
@@ -10,8 +10,10 @@ import path__default, { resolve, isAbsolute, sep, extname } from 'node:path';
10
10
  import url2, { URLSearchParams as URLSearchParams$1 } from 'node:url';
11
11
  import * as cli from '@cloudflare/cli-shared-helpers';
12
12
  import { cancel } from '@cloudflare/cli-shared-helpers';
13
- import { INHERIT_SYMBOL, APIError, UserError, getEnvironmentVariableFactory, isNonInteractiveOrCI, getHostFromRoute, retryOnAPIFailure, ParseError, getComplianceRegionSubdomain, configFileName, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getDurableObjectExports, partitionExports, getWranglerTmpDir, parsePackageJSON, getInstalledPackageVersion, FatalError, readFileSync as readFileSync$1, parseJSON, getBindingTypeFriendlyName, getBindingLocalSupport, assertNever, experimental_readRawConfig, experimental_patchConfig, PatchConfigError, COMPLIANCE_REGION_CONFIG_UNKNOWN, constructWranglerConfig, getCIMatchTag, formatConfigSnippet, DEFAULT_COMPAT_DATE, writeOutput, hasDurableObjectExports, getDockerPath, parseNonHyphenedUuid, getWorkersCIBranchName } from '@cloudflare/workers-utils';
13
+ import { UserError as UserError$1 } from '@cloudflare/workers-utils/errors';
14
14
  import { execSync, spawn } from 'node:child_process';
15
+ import '@cloudflare/workers-utils/compliance';
16
+ import { INHERIT_SYMBOL, APIError, UserError, getEnvironmentVariableFactory, isNonInteractiveOrCI, getHostFromRoute, retryOnAPIFailure, ParseError, getComplianceRegionSubdomain, configFileName, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getDurableObjectExports, partitionExports, getWranglerTmpDir, parsePackageJSON, getInstalledPackageVersion, FatalError, readFileSync as readFileSync$1, parseJSON, printBindings, experimental_readRawConfig, experimental_patchConfig, PatchConfigError, COMPLIANCE_REGION_CONFIG_UNKNOWN, constructWranglerConfig, getCIMatchTag, formatConfigSnippet, DEFAULT_COMPAT_DATE, writeOutput, getBindings, hasDurableObjectExports, getDockerPath, parseNonHyphenedUuid, getWorkersCIBranchName, getBindingTypeFriendlyName } from '@cloudflare/workers-utils';
15
17
  import { Response, FormData } from 'undici';
16
18
  import chalk6 from 'chalk';
17
19
  import PQueue from 'p-queue';
@@ -24,7 +26,6 @@ import { gzipSync } from 'node:zlib';
24
26
  import { brandColor, white, gray, bold, yellow, dim, red, blue } from '@cloudflare/cli-shared-helpers/colors';
25
27
  import readline from 'node:readline';
26
28
  import { parse as parse$1 } from 'dotenv';
27
- import { stripVTControlCharacters } from 'node:util';
28
29
  import { getFreshSourceMapSupport, getNodeCompat } from 'miniflare';
29
30
  import { createHash } from 'node:crypto';
30
31
 
@@ -2939,7 +2940,7 @@ var runDockerCmd = /* @__PURE__ */ __name((dockerPath, args, stdio) => {
2939
2940
  } else if (!errorHandled) {
2940
2941
  errorHandled = true;
2941
2942
  reject(
2942
- new UserError(`Docker command exited with code: ${code}`, {
2943
+ new UserError$1(`Docker command exited with code: ${code}`, {
2943
2944
  telemetryMessage: false
2944
2945
  })
2945
2946
  );
@@ -2949,7 +2950,7 @@ var runDockerCmd = /* @__PURE__ */ __name((dockerPath, args, stdio) => {
2949
2950
  if (!errorHandled) {
2950
2951
  errorHandled = true;
2951
2952
  reject(
2952
- new UserError(`Docker command failed: ${err.message}`, {
2953
+ new UserError$1(`Docker command failed: ${err.message}`, {
2953
2954
  telemetryMessage: false
2954
2955
  })
2955
2956
  );
@@ -2987,7 +2988,7 @@ var verifyDockerInstalled = /* @__PURE__ */ __name(async ({
2987
2988
  }) => {
2988
2989
  const dockerIsRunning = await isDockerRunning(dockerPath);
2989
2990
  if (!dockerIsRunning) {
2990
- throw new UserError(
2991
+ throw new UserError$1(
2991
2992
  getFailedToRunDockerErrorMessage({
2992
2993
  operation,
2993
2994
  imageNoun,
@@ -6546,8 +6547,7 @@ async function getSize(modules) {
6546
6547
  return { size: aggregateSize, gzipSize };
6547
6548
  }
6548
6549
  __name(getSize, "getSize");
6549
- async function printBundleSize(main, modules) {
6550
- const { size, gzipSize } = await getSize([...modules, main]);
6550
+ function printBundleSize({ size, gzipSize }) {
6551
6551
  const bundleReport = `${(size / ONE_KIB_BYTES).toFixed(2)} KiB / gzip: ${(gzipSize / ONE_KIB_BYTES).toFixed(2)} KiB`;
6552
6552
  const percentage = gzipSize / MAX_GZIP_SIZE_BYTES * 100;
6553
6553
  const colorizedReport = percentage > 90 ? chalk6.red(bundleReport) : percentage > 70 ? chalk6.yellow(bundleReport) : chalk6.green(bundleReport);
@@ -7281,839 +7281,6 @@ function parseConfigPlacement(config2) {
7281
7281
  }
7282
7282
  }
7283
7283
  __name(parseConfigPlacement, "parseConfigPlacement");
7284
- var isConnectedStatusExplained = false;
7285
- function printBindings(bindings, tailConsumers = [], streamingTailConsumers = [], containers = [], context = {}) {
7286
- let hasConnectionStatus = false;
7287
- const log2 = context.log ?? logger.log;
7288
- const isMultiWorker = context.isMultiWorker ?? false;
7289
- const getMode = createGetMode({
7290
- isProvisioning: context.provisioning,
7291
- isLocalDev: context.local
7292
- });
7293
- const truncate = /* @__PURE__ */ __name((item, maxLength = 40) => {
7294
- const s = typeof item === "string" ? item : JSON.stringify(item);
7295
- if (s.length < maxLength) {
7296
- return s;
7297
- }
7298
- return `${s.substring(0, maxLength - 3)}...`;
7299
- }, "truncate");
7300
- const output = [];
7301
- const data_blobs = extractBindingsOfType("data_blob", bindings);
7302
- const durable_objects = extractBindingsOfType(
7303
- "durable_object_namespace",
7304
- bindings
7305
- );
7306
- const workflows = extractBindingsOfType("workflow", bindings);
7307
- const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
7308
- const send_email = extractBindingsOfType("send_email", bindings);
7309
- const queues = extractBindingsOfType("queue", bindings);
7310
- const d1_databases = extractBindingsOfType("d1", bindings);
7311
- const vectorize = extractBindingsOfType("vectorize", bindings);
7312
- const ai_search_namespaces = extractBindingsOfType(
7313
- "ai_search_namespace",
7314
- bindings
7315
- );
7316
- const ai_search = extractBindingsOfType("ai_search", bindings);
7317
- const websearch = extractBindingsOfType("websearch", bindings);
7318
- const agent_memory = extractBindingsOfType("agent_memory", bindings);
7319
- const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
7320
- const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
7321
- const logfwdr = extractBindingsOfType("logfwdr", bindings);
7322
- const secrets_store_secrets = extractBindingsOfType(
7323
- "secrets_store_secret",
7324
- bindings
7325
- );
7326
- const artifacts = extractBindingsOfType("artifacts", bindings);
7327
- const services = extractBindingsOfType("service", bindings);
7328
- const vpc_services = extractBindingsOfType("vpc_service", bindings);
7329
- const vpc_networks = extractBindingsOfType("vpc_network", bindings);
7330
- const analytics_engine_datasets = extractBindingsOfType(
7331
- "analytics_engine",
7332
- bindings
7333
- );
7334
- const text_blobs = extractBindingsOfType("text_blob", bindings);
7335
- const browser = extractBindingsOfType("browser", bindings);
7336
- const images = extractBindingsOfType("images", bindings);
7337
- const stream = extractBindingsOfType("stream", bindings);
7338
- const ai = extractBindingsOfType("ai", bindings);
7339
- const version_metadata = extractBindingsOfType("version_metadata", bindings);
7340
- const vars = Object.entries(bindings ?? {}).filter(
7341
- ([_, binding]) => binding.type === "plain_text" || binding.type === "json" || binding.type === "secret_text"
7342
- ).map(([name, binding]) => ({
7343
- binding: name,
7344
- ...binding
7345
- }));
7346
- const wasm_modules = extractBindingsOfType("wasm_module", bindings);
7347
- const dispatch_namespaces = extractBindingsOfType(
7348
- "dispatch_namespace",
7349
- bindings
7350
- );
7351
- const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
7352
- const pipelines = extractBindingsOfType("pipeline", bindings);
7353
- const ratelimits = extractBindingsOfType("ratelimit", bindings);
7354
- const assets = extractBindingsOfType("assets", bindings);
7355
- const unsafe_hello_world = extractBindingsOfType(
7356
- "unsafe_hello_world",
7357
- bindings
7358
- );
7359
- const flagship = extractBindingsOfType("flagship", bindings);
7360
- const media = extractBindingsOfType("media", bindings);
7361
- const worker_loaders = extractBindingsOfType("worker_loader", bindings);
7362
- const unsafe_bindings = Object.entries(bindings ?? {}).filter(
7363
- ([_, binding]) => isUnsafeBindingType(binding.type) && binding.type !== "unsafe_hello_world"
7364
- ).map(([name, binding]) => ({ name, ...binding }));
7365
- if (data_blobs.length > 0) {
7366
- output.push(
7367
- ...data_blobs.map(({ binding, source }) => ({
7368
- name: binding,
7369
- type: getBindingTypeFriendlyName("data_blob"),
7370
- value: "contents" in source ? "<Buffer>" : truncate(source.path),
7371
- mode: getMode({ isSimulatedLocally: true })
7372
- }))
7373
- );
7374
- }
7375
- if (durable_objects.length > 0) {
7376
- output.push(
7377
- ...durable_objects.map(({ name, class_name, script_name }) => {
7378
- let value = class_name;
7379
- let mode = void 0;
7380
- if (script_name) {
7381
- if (context.local && context.registry !== null) {
7382
- const registryDefinition = context.registry?.[script_name];
7383
- hasConnectionStatus = true;
7384
- if (registryDefinition && registryDefinition.debugPortAddress) {
7385
- value += `, defined in ${script_name}`;
7386
- mode = getMode({ isSimulatedLocally: true, connected: true });
7387
- } else {
7388
- value += `, defined in ${script_name}`;
7389
- mode = getMode({ isSimulatedLocally: true, connected: false });
7390
- }
7391
- } else {
7392
- value += `, defined in ${script_name}`;
7393
- mode = getMode({ isSimulatedLocally: true });
7394
- }
7395
- } else {
7396
- mode = getMode({ isSimulatedLocally: true });
7397
- }
7398
- return {
7399
- name,
7400
- type: getBindingTypeFriendlyName("durable_object_namespace"),
7401
- value,
7402
- mode
7403
- };
7404
- })
7405
- );
7406
- }
7407
- if (workflows.length > 0) {
7408
- output.push(
7409
- ...workflows.map(({ class_name, script_name, binding }) => {
7410
- let value = class_name;
7411
- if (script_name) {
7412
- value += ` (defined in ${script_name})`;
7413
- }
7414
- return {
7415
- name: binding,
7416
- type: getBindingTypeFriendlyName("workflow"),
7417
- value,
7418
- mode: getMode({
7419
- isSimulatedLocally: true
7420
- })
7421
- };
7422
- })
7423
- );
7424
- }
7425
- if (kv_namespaces.length > 0) {
7426
- output.push(
7427
- ...kv_namespaces.map(({ binding, id, remote }) => {
7428
- return {
7429
- name: binding,
7430
- type: getBindingTypeFriendlyName("kv_namespace"),
7431
- value: id,
7432
- mode: getMode({
7433
- isSimulatedLocally: context.remoteBindingsDisabled || !remote
7434
- })
7435
- };
7436
- })
7437
- );
7438
- }
7439
- if (send_email.length > 0) {
7440
- output.push(
7441
- ...send_email.map((emailBinding) => {
7442
- const destination_address = "destination_address" in emailBinding ? emailBinding.destination_address : void 0;
7443
- const allowed_destination_addresses = "allowed_destination_addresses" in emailBinding ? emailBinding.allowed_destination_addresses : void 0;
7444
- const allowed_sender_addresses = "allowed_sender_addresses" in emailBinding ? emailBinding.allowed_sender_addresses : void 0;
7445
- let value = destination_address || allowed_destination_addresses?.join(", ") || "unrestricted";
7446
- if (allowed_sender_addresses) {
7447
- value += ` - senders: ${allowed_sender_addresses.join(", ")}`;
7448
- }
7449
- return {
7450
- name: emailBinding.name,
7451
- type: getBindingTypeFriendlyName("send_email"),
7452
- value,
7453
- mode: getMode({
7454
- isSimulatedLocally: context.remoteBindingsDisabled || !emailBinding.remote
7455
- })
7456
- };
7457
- })
7458
- );
7459
- }
7460
- if (queues.length > 0) {
7461
- output.push(
7462
- ...queues.map(({ binding, queue_name, remote }) => {
7463
- return {
7464
- name: binding,
7465
- type: getBindingTypeFriendlyName("queue"),
7466
- value: queue_name,
7467
- mode: getMode({
7468
- isSimulatedLocally: context.remoteBindingsDisabled || !remote
7469
- })
7470
- };
7471
- })
7472
- );
7473
- }
7474
- if (d1_databases.length > 0) {
7475
- output.push(
7476
- ...d1_databases.map(
7477
- ({
7478
- binding,
7479
- database_name,
7480
- database_id,
7481
- preview_database_id,
7482
- remote
7483
- }) => {
7484
- const value = typeof database_id == "symbol" ? database_id : preview_database_id ?? database_name ?? database_id;
7485
- return {
7486
- name: binding,
7487
- type: getBindingTypeFriendlyName("d1"),
7488
- mode: getMode({
7489
- isSimulatedLocally: context.remoteBindingsDisabled || !remote
7490
- }),
7491
- value
7492
- };
7493
- }
7494
- )
7495
- );
7496
- }
7497
- if (vectorize.length > 0) {
7498
- output.push(
7499
- ...vectorize.map(({ binding, index_name, remote }) => {
7500
- return {
7501
- name: binding,
7502
- type: getBindingTypeFriendlyName("vectorize"),
7503
- value: index_name,
7504
- mode: getMode({
7505
- isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
7506
- })
7507
- };
7508
- })
7509
- );
7510
- }
7511
- if (ai_search_namespaces.length > 0) {
7512
- output.push(
7513
- ...ai_search_namespaces.map(({ binding, namespace }) => ({
7514
- name: binding,
7515
- type: getBindingTypeFriendlyName("ai_search_namespace"),
7516
- // Preserve `namespace` as-is so `typeof === "symbol"` handling
7517
- // downstream can render INHERIT_SYMBOL as `"inherited"`. Using
7518
- // `String(namespace)` would stringify it to
7519
- // `"Symbol(inherit_binding)"` and defeat that check.
7520
- value: namespace ?? void 0,
7521
- mode: getMode({ isSimulatedLocally: false })
7522
- }))
7523
- );
7524
- }
7525
- if (ai_search.length > 0) {
7526
- output.push(
7527
- ...ai_search.map(({ binding, instance_name }) => ({
7528
- name: binding,
7529
- type: getBindingTypeFriendlyName("ai_search"),
7530
- value: instance_name ? String(instance_name) : void 0,
7531
- mode: getMode({ isSimulatedLocally: false })
7532
- }))
7533
- );
7534
- }
7535
- if (websearch.length > 0) {
7536
- output.push(
7537
- ...websearch.map(({ binding }) => ({
7538
- name: binding,
7539
- type: getBindingTypeFriendlyName("websearch"),
7540
- value: void 0,
7541
- mode: getMode({ isSimulatedLocally: false })
7542
- }))
7543
- );
7544
- }
7545
- if (agent_memory.length > 0) {
7546
- output.push(
7547
- ...agent_memory.map(({ binding, namespace }) => ({
7548
- name: binding,
7549
- type: getBindingTypeFriendlyName("agent_memory"),
7550
- value: namespace ?? void 0,
7551
- mode: getMode({ isSimulatedLocally: false })
7552
- }))
7553
- );
7554
- }
7555
- if (hyperdrive.length > 0) {
7556
- output.push(
7557
- ...hyperdrive.map(({ binding, id }) => {
7558
- return {
7559
- name: binding,
7560
- type: getBindingTypeFriendlyName("hyperdrive"),
7561
- value: id,
7562
- mode: getMode({ isSimulatedLocally: true })
7563
- };
7564
- })
7565
- );
7566
- }
7567
- if (vpc_services.length > 0) {
7568
- output.push(
7569
- ...vpc_services.map(({ binding, service_id, remote }) => {
7570
- return {
7571
- name: binding,
7572
- type: getBindingTypeFriendlyName("vpc_service"),
7573
- value: service_id,
7574
- mode: getMode({
7575
- isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
7576
- })
7577
- };
7578
- })
7579
- );
7580
- }
7581
- if (vpc_networks.length > 0) {
7582
- output.push(
7583
- ...vpc_networks.map(({ binding, tunnel_id, network_id, remote }) => {
7584
- return {
7585
- name: binding,
7586
- type: getBindingTypeFriendlyName("vpc_network"),
7587
- value: tunnel_id ?? network_id,
7588
- mode: getMode({
7589
- isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
7590
- })
7591
- };
7592
- })
7593
- );
7594
- }
7595
- if (r2_buckets.length > 0) {
7596
- output.push(
7597
- ...r2_buckets.map(({ binding, bucket_name, jurisdiction, remote }) => {
7598
- const value = typeof bucket_name === "symbol" ? bucket_name : bucket_name ? `${bucket_name}${jurisdiction ? ` (${jurisdiction})` : ""}` : void 0;
7599
- return {
7600
- name: binding,
7601
- type: getBindingTypeFriendlyName("r2_bucket"),
7602
- value,
7603
- mode: getMode({
7604
- isSimulatedLocally: context.remoteBindingsDisabled || !remote
7605
- })
7606
- };
7607
- })
7608
- );
7609
- }
7610
- if (logfwdr.length > 0) {
7611
- output.push(
7612
- ...logfwdr.map(({ name, destination }) => {
7613
- return {
7614
- name,
7615
- type: getBindingTypeFriendlyName("logfwdr"),
7616
- value: destination,
7617
- mode: getMode()
7618
- };
7619
- })
7620
- );
7621
- }
7622
- if (secrets_store_secrets.length > 0) {
7623
- output.push(
7624
- ...secrets_store_secrets.map(({ binding, store_id, secret_name }) => {
7625
- return {
7626
- name: binding,
7627
- type: getBindingTypeFriendlyName("secrets_store_secret"),
7628
- value: `${store_id}/${secret_name}`,
7629
- mode: getMode({ isSimulatedLocally: true })
7630
- };
7631
- })
7632
- );
7633
- }
7634
- if (artifacts.length > 0) {
7635
- output.push(
7636
- ...artifacts.map(({ binding, namespace }) => {
7637
- return {
7638
- name: binding,
7639
- type: getBindingTypeFriendlyName("artifacts"),
7640
- value: namespace,
7641
- mode: getMode({ isSimulatedLocally: false })
7642
- };
7643
- })
7644
- );
7645
- }
7646
- if (unsafe_hello_world.length > 0) {
7647
- output.push(
7648
- ...unsafe_hello_world.map(({ binding, enable_timer }) => {
7649
- return {
7650
- name: binding,
7651
- type: getBindingTypeFriendlyName("unsafe_hello_world"),
7652
- value: enable_timer ? `Timer enabled` : `Timer disabled`,
7653
- mode: getMode({ isSimulatedLocally: true })
7654
- };
7655
- })
7656
- );
7657
- }
7658
- if (flagship.length > 0) {
7659
- output.push(
7660
- ...flagship.map(({ binding, app_id }) => {
7661
- return {
7662
- name: binding,
7663
- type: getBindingTypeFriendlyName("flagship"),
7664
- value: app_id,
7665
- mode: getMode({
7666
- isSimulatedLocally: !context.remoteBindingsDisabled ? false : void 0
7667
- })
7668
- };
7669
- })
7670
- );
7671
- }
7672
- if (services.length > 0) {
7673
- output.push(
7674
- ...services.map(({ binding, service, entrypoint, remote, dev }) => {
7675
- let value = service;
7676
- let mode = void 0;
7677
- if (entrypoint) {
7678
- value += `#${entrypoint}`;
7679
- }
7680
- if (dev !== void 0 && context.local) {
7681
- mode = getMode({ isSimulatedLocally: true });
7682
- } else if (remote) {
7683
- mode = getMode({ isSimulatedLocally: false });
7684
- } else if (context.local && context.registry !== null) {
7685
- const isSelfBinding = service === context.name;
7686
- if (isSelfBinding) {
7687
- hasConnectionStatus = true;
7688
- mode = getMode({ isSimulatedLocally: true, connected: true });
7689
- } else {
7690
- const registryDefinition = context.registry?.[service];
7691
- hasConnectionStatus = true;
7692
- if (registryDefinition && registryDefinition.debugPortAddress) {
7693
- mode = getMode({ isSimulatedLocally: true, connected: true });
7694
- } else {
7695
- mode = getMode({ isSimulatedLocally: true, connected: false });
7696
- }
7697
- }
7698
- }
7699
- return {
7700
- name: binding,
7701
- type: getBindingTypeFriendlyName("service"),
7702
- value,
7703
- mode
7704
- };
7705
- })
7706
- );
7707
- }
7708
- if (analytics_engine_datasets.length > 0) {
7709
- output.push(
7710
- ...analytics_engine_datasets.map(({ binding, dataset }) => {
7711
- return {
7712
- name: binding,
7713
- type: getBindingTypeFriendlyName("analytics_engine"),
7714
- value: dataset ?? binding,
7715
- mode: getMode({ isSimulatedLocally: true })
7716
- };
7717
- })
7718
- );
7719
- }
7720
- if (text_blobs.length > 0) {
7721
- output.push(
7722
- ...text_blobs.map(({ binding, source }) => ({
7723
- name: binding,
7724
- type: getBindingTypeFriendlyName("text_blob"),
7725
- value: "contents" in source ? truncate(source.contents) : "path" in source ? truncate(source.path) : void 0,
7726
- mode: getMode({ isSimulatedLocally: true })
7727
- }))
7728
- );
7729
- }
7730
- if (browser.length > 0) {
7731
- output.push(
7732
- ...browser.map(({ binding, remote }) => ({
7733
- name: binding,
7734
- type: getBindingTypeFriendlyName("browser"),
7735
- value: void 0,
7736
- mode: getMode({
7737
- isSimulatedLocally: context.remoteBindingsDisabled || !remote
7738
- })
7739
- }))
7740
- );
7741
- }
7742
- if (images.length > 0) {
7743
- output.push(
7744
- ...images.map(({ binding, remote }) => ({
7745
- name: binding,
7746
- type: getBindingTypeFriendlyName("images"),
7747
- value: void 0,
7748
- mode: getMode({
7749
- isSimulatedLocally: context.remoteBindingsDisabled || !remote
7750
- })
7751
- }))
7752
- );
7753
- }
7754
- if (stream.length > 0) {
7755
- output.push(
7756
- ...stream.map(({ binding, remote }) => ({
7757
- name: binding,
7758
- type: getBindingTypeFriendlyName("stream"),
7759
- value: void 0,
7760
- mode: getMode({
7761
- isSimulatedLocally: (remote === true || remote === void 0) && !context.remoteBindingsDisabled ? false : void 0
7762
- })
7763
- }))
7764
- );
7765
- }
7766
- if (media.length > 0) {
7767
- output.push(
7768
- ...media.map(({ binding, remote }) => ({
7769
- name: binding,
7770
- type: getBindingTypeFriendlyName("media"),
7771
- value: void 0,
7772
- mode: getMode({
7773
- isSimulatedLocally: (remote === true || remote === void 0) && !context.remoteBindingsDisabled ? false : void 0
7774
- })
7775
- }))
7776
- );
7777
- }
7778
- if (ai.length > 0) {
7779
- output.push(
7780
- ...ai.map(({ binding, staging, remote }) => ({
7781
- name: binding,
7782
- type: getBindingTypeFriendlyName("ai"),
7783
- value: staging ? `staging` : void 0,
7784
- mode: getMode({
7785
- isSimulatedLocally: (remote === true || remote === void 0) && !context.remoteBindingsDisabled ? false : void 0
7786
- })
7787
- }))
7788
- );
7789
- }
7790
- if (pipelines.length > 0) {
7791
- output.push(
7792
- ...pipelines.map(
7793
- ({ binding, stream: pipelineStream, pipeline, remote }) => ({
7794
- name: binding,
7795
- type: getBindingTypeFriendlyName("pipeline"),
7796
- value: pipelineStream || pipeline,
7797
- mode: getMode({
7798
- isSimulatedLocally: context.remoteBindingsDisabled || !remote
7799
- })
7800
- })
7801
- )
7802
- );
7803
- }
7804
- if (ratelimits.length > 0) {
7805
- output.push(
7806
- ...ratelimits.map(({ name, simple }) => ({
7807
- name,
7808
- type: getBindingTypeFriendlyName("ratelimit"),
7809
- value: `${simple.limit} requests/${simple.period}s`,
7810
- mode: getMode({ isSimulatedLocally: true })
7811
- }))
7812
- );
7813
- }
7814
- if (assets.length > 0) {
7815
- output.push(
7816
- ...assets.map(({ binding }) => ({
7817
- name: binding,
7818
- type: getBindingTypeFriendlyName("assets"),
7819
- value: void 0,
7820
- mode: getMode({ isSimulatedLocally: true })
7821
- }))
7822
- );
7823
- }
7824
- if (version_metadata.length > 0) {
7825
- output.push(
7826
- ...version_metadata.map(({ binding }) => ({
7827
- name: binding,
7828
- type: getBindingTypeFriendlyName("version_metadata"),
7829
- value: void 0,
7830
- mode: getMode({ isSimulatedLocally: true })
7831
- }))
7832
- );
7833
- }
7834
- if (unsafe_bindings.length > 0) {
7835
- output.push(
7836
- ...unsafe_bindings.map((binding) => {
7837
- const dev = "dev" in binding ? binding.dev : void 0;
7838
- const originalType = binding.type.slice("unsafe_".length);
7839
- return {
7840
- name: binding.name,
7841
- type: dev ? dev.plugin.name : getBindingTypeFriendlyName(binding.type),
7842
- value: originalType,
7843
- mode: getMode({
7844
- isSimulatedLocally: !!dev
7845
- })
7846
- };
7847
- })
7848
- );
7849
- }
7850
- if (vars.length > 0) {
7851
- output.push(
7852
- ...vars.map((variable) => {
7853
- const { binding, type: varType, value: varValue } = variable;
7854
- let parsedValue;
7855
- if (varType === "plain_text" && variable.hidden !== true) {
7856
- parsedValue = `"${truncate(varValue)}"`;
7857
- } else if (varType === "json") {
7858
- parsedValue = truncate(JSON.stringify(varValue));
7859
- } else {
7860
- parsedValue = `"(hidden)"`;
7861
- }
7862
- return {
7863
- name: binding,
7864
- type: getBindingTypeFriendlyName(varType),
7865
- value: parsedValue,
7866
- mode: getMode({ isSimulatedLocally: true })
7867
- };
7868
- })
7869
- );
7870
- }
7871
- if (wasm_modules.length > 0) {
7872
- output.push(
7873
- ...wasm_modules.map(({ binding, source }) => ({
7874
- name: binding,
7875
- type: getBindingTypeFriendlyName("wasm_module"),
7876
- value: "contents" in source ? "<Wasm>" : truncate(source.path),
7877
- mode: getMode({ isSimulatedLocally: true })
7878
- }))
7879
- );
7880
- }
7881
- if (dispatch_namespaces.length > 0) {
7882
- output.push(
7883
- ...dispatch_namespaces.map(({ binding, namespace, outbound, remote }) => {
7884
- return {
7885
- name: binding,
7886
- type: getBindingTypeFriendlyName("dispatch_namespace"),
7887
- value: typeof namespace === "symbol" ? namespace : outbound ? `${namespace} (outbound -> ${outbound.service})` : namespace,
7888
- mode: getMode({
7889
- isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
7890
- })
7891
- };
7892
- })
7893
- );
7894
- }
7895
- if (mtls_certificates.length > 0) {
7896
- output.push(
7897
- ...mtls_certificates.map(({ binding, certificate_id, remote }) => {
7898
- return {
7899
- name: binding,
7900
- type: getBindingTypeFriendlyName("mtls_certificate"),
7901
- value: certificate_id,
7902
- mode: getMode({
7903
- isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
7904
- })
7905
- };
7906
- })
7907
- );
7908
- }
7909
- if (worker_loaders.length > 0) {
7910
- output.push(
7911
- ...worker_loaders.map(({ binding }) => ({
7912
- name: binding,
7913
- type: getBindingTypeFriendlyName("worker_loader"),
7914
- value: void 0,
7915
- mode: getMode({ isSimulatedLocally: true })
7916
- }))
7917
- );
7918
- }
7919
- if (output.length === 0) {
7920
- if (context.warnIfNoBindings) {
7921
- if (context.name && isMultiWorker) {
7922
- log2(`No bindings found for ${chalk6.blue(context.name)}`);
7923
- } else {
7924
- log2("No bindings found.");
7925
- }
7926
- }
7927
- } else {
7928
- let title2;
7929
- if (context.provisioning) {
7930
- title2 = "The following bindings need to be provisioned:";
7931
- } else if (context.name && isMultiWorker) {
7932
- title2 = `${chalk6.blue(context.name)} has access to the following bindings:`;
7933
- } else {
7934
- title2 = "Your Worker has access to the following bindings:";
7935
- }
7936
- const headings = {
7937
- binding: "Binding",
7938
- resource: "Resource",
7939
- mode: "Mode"
7940
- };
7941
- const maxValueLength = Math.max(
7942
- ...output.map(
7943
- (b) => typeof b.value === "symbol" ? "inherited".length : b.value?.length ?? 0
7944
- )
7945
- );
7946
- const maxNameLength = Math.max(...output.map((b) => b.name.length));
7947
- const maxTypeLength = Math.max(
7948
- ...output.map((b) => b.type.length),
7949
- headings.resource.length
7950
- );
7951
- const maxModeLength = Math.max(
7952
- ...output.map(
7953
- (b) => b.mode ? stripVTControlCharacters(b.mode).length : headings.mode.length
7954
- )
7955
- );
7956
- const hasMode = output.some((b) => b.mode);
7957
- const bindingPrefix = `env.`;
7958
- const bindingLength = bindingPrefix.length + maxNameLength + " (".length + maxValueLength + ")".length;
7959
- const columnGapSpaces = 6;
7960
- const columnGapSpacesWrapped = 4;
7961
- const shouldWrap = bindingLength + columnGapSpaces + maxTypeLength + columnGapSpaces + maxModeLength >= process.stdout.columns;
7962
- log2(title2);
7963
- const columnGap = shouldWrap ? " ".repeat(columnGapSpacesWrapped) : " ".repeat(columnGapSpaces);
7964
- log2(
7965
- `${padEndAnsi(dim(headings.binding), shouldWrap ? bindingPrefix.length + maxNameLength : bindingLength)}${columnGap}${padEndAnsi(dim(headings.resource), maxTypeLength)}${columnGap}${hasMode ? dim(headings.mode) : ""}`
7966
- );
7967
- for (const binding of output) {
7968
- const bindingValue = dim(
7969
- typeof binding.value === "symbol" ? chalk6.italic("inherited") : binding.value ?? ""
7970
- );
7971
- const bindingString = padEndAnsi(
7972
- `${white(`env.${binding.name}`)}${binding.value && !shouldWrap ? ` (${bindingValue})` : ""}`,
7973
- shouldWrap ? bindingPrefix.length + maxNameLength : bindingLength
7974
- );
7975
- const suffix = shouldWrap ? binding.value ? `
7976
- ${bindingValue}` : "" : "";
7977
- log2(
7978
- `${bindingString}${columnGap}${brandColor(binding.type.padEnd(maxTypeLength))}${columnGap}${hasMode ? binding.mode : ""}${suffix}`
7979
- );
7980
- }
7981
- log2("");
7982
- }
7983
- let title;
7984
- if (context.name && isMultiWorker) {
7985
- title = `${chalk6.blue(context.name)} is sending Tail events to the following Workers:`;
7986
- } else {
7987
- title = "Your Worker is sending Tail events to the following Workers:";
7988
- }
7989
- const allTailConsumers = [
7990
- ...(tailConsumers ?? []).map((c) => ({
7991
- service: c.service,
7992
- streaming: false
7993
- })),
7994
- ...(streamingTailConsumers ?? []).map((c) => ({
7995
- service: c.service,
7996
- streaming: true
7997
- }))
7998
- ];
7999
- if (allTailConsumers.length > 0) {
8000
- log2(
8001
- `${title}
8002
- ${allTailConsumers.map(({ service, streaming }) => {
8003
- const displayName = `${service}${streaming ? ` (streaming)` : ""}`;
8004
- if (context.local && context.registry !== null) {
8005
- const registryDefinition = context.registry?.[service];
8006
- hasConnectionStatus = true;
8007
- if (registryDefinition) {
8008
- return `- ${displayName} ${chalk6.green("[connected]")}`;
8009
- } else {
8010
- return `- ${displayName} ${chalk6.red("[not connected]")}`;
8011
- }
8012
- } else {
8013
- return `- ${displayName}`;
8014
- }
8015
- }).join("\n")}`
8016
- );
8017
- }
8018
- if (containers.length > 0 && !context.provisioning) {
8019
- let containersTitle = "The following containers are available:";
8020
- if (context.name && isMultiWorker) {
8021
- containersTitle = `The following containers are available from ${chalk6.blue(context.name)}:`;
8022
- }
8023
- log2(
8024
- `${containersTitle}
8025
- ${containers.map((c) => `- ${c.name} (${c.image})`).join("\n")}`
8026
- );
8027
- log2("");
8028
- }
8029
- if (context.unsafeMetadata) {
8030
- log2("The following unsafe metadata will be attached to your Worker:");
8031
- log2(JSON.stringify(context.unsafeMetadata, null, 2));
8032
- }
8033
- if (hasConnectionStatus && !isConnectedStatusExplained) {
8034
- log2(
8035
- dim(
8036
- `
8037
- Service bindings, Durable Object bindings, and Tail consumers connect to other Wrangler or Vite dev processes running locally, with their connection status indicated by ${chalk6.green("[connected]")} or ${chalk6.red("[not connected]")}. For more details, refer to https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#local-development
8038
- `
8039
- )
8040
- );
8041
- isConnectedStatusExplained = true;
8042
- }
8043
- }
8044
- __name(printBindings, "printBindings");
8045
- function padEndAnsi(str, length) {
8046
- return str + " ".repeat(Math.max(0, length - stripVTControlCharacters(str).length));
8047
- }
8048
- __name(padEndAnsi, "padEndAnsi");
8049
- function createGetMode({
8050
- isProvisioning = false,
8051
- isLocalDev = false
8052
- }) {
8053
- return /* @__PURE__ */ __name(function bindingMode({
8054
- isSimulatedLocally,
8055
- connected
8056
- } = {}) {
8057
- if (isProvisioning || !isLocalDev) {
8058
- return void 0;
8059
- }
8060
- if (isSimulatedLocally === void 0) {
8061
- return dim("not supported");
8062
- }
8063
- return `${isSimulatedLocally ? chalk6.blue("local") : chalk6.yellow("remote")}${connected === void 0 ? "" : connected ? chalk6.green(" [connected]") : chalk6.red(" [not connected]")}`;
8064
- }, "bindingMode");
8065
- }
8066
- __name(createGetMode, "createGetMode");
8067
- function warnOrError(type, remote) {
8068
- const support = getBindingLocalSupport(type);
8069
- switch (support) {
8070
- case "local-and-remote":
8071
- return;
8072
- case "local-only":
8073
- if (remote === true) {
8074
- throw new UserError(
8075
- `${getBindingTypeFriendlyName(type)} bindings do not support accessing remote resources.`,
8076
- {
8077
- telemetryMessage: "utils bindings unsupported remote resources"
8078
- }
8079
- );
8080
- }
8081
- return;
8082
- case "remote":
8083
- if (remote === false) {
8084
- throw new UserError(
8085
- `${getBindingTypeFriendlyName(type)} bindings do not support local development. You can set \`remote: true\` for the binding definition in your configuration file to access a remote version of the resource.`,
8086
- {
8087
- telemetryMessage: "utils bindings unsupported local development"
8088
- }
8089
- );
8090
- }
8091
- if (remote === void 0) {
8092
- logger.warn(
8093
- `${getBindingTypeFriendlyName(type)} bindings do not support local development, and so parts of your Worker may not work correctly. You can set \`remote: true\` for the binding definition in your configuration file to access a remote version of the resource.`
8094
- );
8095
- }
8096
- return;
8097
- case "DO-NOT-USE-this-resource-will-never-have-a-local-simulator":
8098
- if (remote === false) {
8099
- throw new UserError(
8100
- `${getBindingTypeFriendlyName(type)} bindings do not support local development. You can set \`remote: true\` for the binding definition in your configuration file to access a remote version of the resource.`,
8101
- {
8102
- telemetryMessage: "utils bindings unsupported local development always remote"
8103
- }
8104
- );
8105
- }
8106
- if (remote === void 0) {
8107
- logger.warn(
8108
- `${getBindingTypeFriendlyName(type)} bindings always access remote resources, and so may incur usage charges even in local dev. To suppress this warning, set \`remote: true\` for the binding definition in your configuration file.`
8109
- );
8110
- }
8111
- return;
8112
- default:
8113
- assertNever(support);
8114
- }
8115
- }
8116
- __name(warnOrError, "warnOrError");
8117
7284
  var ProvisionResourceHandler = class {
8118
7285
  constructor(type, bindingName, binding, idField, complianceConfig, accountId) {
8119
7286
  this.type = type;
@@ -8132,6 +7299,10 @@ var ProvisionResourceHandler = class {
8132
7299
  connect(id) {
8133
7300
  this.binding[this.idField] = id;
8134
7301
  }
7302
+ hasConfiguredResourceIdentifier() {
7303
+ const id = this.binding[this.idField];
7304
+ return typeof id === "string" && id.length > 0 || this.name !== void 0;
7305
+ }
8135
7306
  async provision(name) {
8136
7307
  const id = await this.create(name);
8137
7308
  this.connect(id);
@@ -8748,6 +7919,60 @@ function addBindingToPatch(patch, resourceType, binding) {
8748
7919
  );
8749
7920
  }
8750
7921
  __name(addBindingToPatch, "addBindingToPatch");
7922
+ function isPermissionDeniedAPIError(error51) {
7923
+ return error51 instanceof APIError && error51.status === 403;
7924
+ }
7925
+ __name(isPermissionDeniedAPIError, "isPermissionDeniedAPIError");
7926
+ function trackSkippedProvisioning(skippedProvisioning, resourceType, bindingName) {
7927
+ const skippedBindingNames = skippedProvisioning.get(resourceType) ?? /* @__PURE__ */ new Set();
7928
+ skippedBindingNames.add(bindingName);
7929
+ skippedProvisioning.set(resourceType, skippedBindingNames);
7930
+ }
7931
+ __name(trackSkippedProvisioning, "trackSkippedProvisioning");
7932
+ function warnSkippedProvisioning(skippedProvisioning) {
7933
+ if (skippedProvisioning.size === 0) {
7934
+ return;
7935
+ }
7936
+ const bindingsByResourceType = Array.from(
7937
+ skippedProvisioning,
7938
+ ([type, names]) => {
7939
+ return `${getSkippedProvisioningResourceName(type)} - ${Array.from(names).join(", ")}`;
7940
+ }
7941
+ ).join("\n");
7942
+ logger.warn(esm_default`
7943
+ Skipping automatic provisioning for the following bindings because Wrangler does not have permission to check whether the resource exists. The deploy will continue, but may fail later if the resource does not exist:
7944
+
7945
+ ${bindingsByResourceType}
7946
+ `);
7947
+ }
7948
+ __name(warnSkippedProvisioning, "warnSkippedProvisioning");
7949
+ function getSkippedProvisioningResourceName(resourceType) {
7950
+ switch (resourceType) {
7951
+ case "kv_namespace":
7952
+ return "KV";
7953
+ case "d1":
7954
+ return "D1";
7955
+ case "r2_bucket":
7956
+ return "R2";
7957
+ case "ai_search_namespace":
7958
+ return "AI Search";
7959
+ case "agent_memory":
7960
+ return "Agent Memory";
7961
+ case "queue":
7962
+ return "Queue";
7963
+ case "dispatch_namespace":
7964
+ return "Dispatch Namespace";
7965
+ case "flagship":
7966
+ return "Flagship";
7967
+ }
7968
+ }
7969
+ __name(getSkippedProvisioningResourceName, "getSkippedProvisioningResourceName");
7970
+ function inheritIfNoConfiguredResourceIdentifier(handler) {
7971
+ if (!handler.hasConfiguredResourceIdentifier()) {
7972
+ handler.inherit();
7973
+ }
7974
+ }
7975
+ __name(inheritIfNoConfiguredResourceIdentifier, "inheritIfNoConfiguredResourceIdentifier");
8751
7976
  function isProvisionableBinding(binding) {
8752
7977
  return binding.type in HANDLERS;
8753
7978
  }
@@ -8827,6 +8052,7 @@ async function collectPendingResources(complianceConfig, accountId, scriptName,
8827
8052
  logger.debug("No settings found");
8828
8053
  }
8829
8054
  const pendingResources = [];
8055
+ const skippedProvisioning = /* @__PURE__ */ new Map();
8830
8056
  for (const [bindingName, binding] of Object.entries(bindings ?? {})) {
8831
8057
  if (!isProvisionableBinding(binding)) {
8832
8058
  continue;
@@ -8837,7 +8063,18 @@ async function collectPendingResources(complianceConfig, accountId, scriptName,
8837
8063
  complianceConfig,
8838
8064
  accountId
8839
8065
  );
8840
- if (await handler.shouldProvision(settings)) {
8066
+ let shouldProvision;
8067
+ try {
8068
+ shouldProvision = await handler.shouldProvision(settings);
8069
+ } catch (error51) {
8070
+ if (!isPermissionDeniedAPIError(error51)) {
8071
+ throw error51;
8072
+ }
8073
+ inheritIfNoConfiguredResourceIdentifier(handler);
8074
+ trackSkippedProvisioning(skippedProvisioning, binding.type, bindingName);
8075
+ continue;
8076
+ }
8077
+ if (shouldProvision) {
8841
8078
  pendingResources.push({
8842
8079
  binding: bindingName,
8843
8080
  resourceType: binding.type,
@@ -8845,19 +8082,17 @@ async function collectPendingResources(complianceConfig, accountId, scriptName,
8845
8082
  });
8846
8083
  }
8847
8084
  }
8848
- return pendingResources.sort(
8849
- (a, b) => HANDLERS[a.resourceType].sort - HANDLERS[b.resourceType].sort
8850
- );
8085
+ return {
8086
+ pendingResources: pendingResources.sort(
8087
+ (a, b) => HANDLERS[a.resourceType].sort - HANDLERS[b.resourceType].sort
8088
+ ),
8089
+ skippedProvisioning
8090
+ };
8851
8091
  }
8852
8092
  __name(collectPendingResources, "collectPendingResources");
8853
8093
  async function provisionBindings(bindings, accountId, scriptName, autoCreate, config2, options) {
8854
8094
  const configPath = config2.userConfigPath ?? config2.configPath;
8855
- const pendingResources = await collectPendingResources(
8856
- config2,
8857
- accountId,
8858
- scriptName,
8859
- bindings
8860
- );
8095
+ const { pendingResources, skippedProvisioning } = await collectPendingResources(config2, accountId, scriptName, bindings);
8861
8096
  if (pendingResources.length > 0) {
8862
8097
  assert4(
8863
8098
  configPath,
@@ -8871,15 +8106,31 @@ async function provisionBindings(bindings, accountId, scriptName, autoCreate, co
8871
8106
  { type: resource.resourceType }
8872
8107
  ])
8873
8108
  ),
8874
- config2.tail_consumers,
8875
- config2.streaming_tail_consumers,
8876
- config2.containers,
8877
- { provisioning: true }
8109
+ {
8110
+ log: logger.log,
8111
+ tailConsumers: config2.tail_consumers,
8112
+ streamingTailConsumers: config2.streaming_tail_consumers,
8113
+ containers: config2.containers,
8114
+ provisioning: true
8115
+ }
8878
8116
  );
8879
8117
  logger.log();
8880
8118
  const existingResources = {};
8881
8119
  for (const resource of pendingResources) {
8882
- existingResources[resource.resourceType] ??= await HANDLERS[resource.resourceType].load(config2, accountId);
8120
+ try {
8121
+ existingResources[resource.resourceType] ??= await HANDLERS[resource.resourceType].load(config2, accountId);
8122
+ } catch (error51) {
8123
+ if (!isPermissionDeniedAPIError(error51)) {
8124
+ throw error51;
8125
+ }
8126
+ inheritIfNoConfiguredResourceIdentifier(resource.handler);
8127
+ trackSkippedProvisioning(
8128
+ skippedProvisioning,
8129
+ resource.resourceType,
8130
+ resource.binding
8131
+ );
8132
+ continue;
8133
+ }
8883
8134
  await runProvisioningFlow(
8884
8135
  resource,
8885
8136
  existingResources[resource.resourceType],
@@ -8945,9 +8196,12 @@ async function provisionBindings(bindings, accountId, scriptName, autoCreate, co
8945
8196
  }
8946
8197
  }
8947
8198
  }
8948
- logger.log(`\u{1F389} All resources provisioned, continuing with deployment...
8199
+ logger.log(`\u{1F389} Resources provisioned, continuing with deployment...
8949
8200
  `);
8950
8201
  }
8202
+ return {
8203
+ warnOnSkippedProvisioning: /* @__PURE__ */ __name(() => warnSkippedProvisioning(skippedProvisioning), "warnOnSkippedProvisioning")
8204
+ };
8951
8205
  }
8952
8206
  __name(provisionBindings, "provisionBindings");
8953
8207
  function getSettings(complianceConfig, accountId, scriptName) {
@@ -9940,7 +9194,7 @@ __export(util_exports, {
9940
9194
  assert: () => assert5,
9941
9195
  assertEqual: () => assertEqual,
9942
9196
  assertIs: () => assertIs,
9943
- assertNever: () => assertNever2,
9197
+ assertNever: () => assertNever,
9944
9198
  assertNotEqual: () => assertNotEqual,
9945
9199
  assignProp: () => assignProp,
9946
9200
  base64ToUint8Array: () => base64ToUint8Array,
@@ -10007,10 +9261,10 @@ __name(assertNotEqual, "assertNotEqual");
10007
9261
  function assertIs(_arg) {
10008
9262
  }
10009
9263
  __name(assertIs, "assertIs");
10010
- function assertNever2(_x) {
9264
+ function assertNever(_x) {
10011
9265
  throw new Error("Unexpected value in exhaustive check");
10012
9266
  }
10013
- __name(assertNever2, "assertNever");
9267
+ __name(assertNever, "assertNever");
10014
9268
  function assert5(_) {
10015
9269
  }
10016
9270
  __name(assert5, "assert");
@@ -24997,6 +24251,7 @@ function normalizeObservability(obs) {
24997
24251
  const fullObservabilityDefaults = {
24998
24252
  enabled,
24999
24253
  head_sampling_rate: 1,
24254
+ redact_query_string: false,
25000
24255
  logs: {
25001
24256
  enabled,
25002
24257
  head_sampling_rate: 1,
@@ -25698,7 +24953,11 @@ async function deploy(props, config2, buildResult, callbacks) {
25698
24953
  version_id: result.versionId,
25699
24954
  targets: result.targets,
25700
24955
  wrangler_environment: props.env,
25701
- worker_name_overridden: props.workerNameOverridden ?? false
24956
+ worker_name_overridden: props.workerNameOverridden ?? false,
24957
+ bundle_size: result.bundleSize ? {
24958
+ raw_bytes: result.bundleSize.size,
24959
+ gzip_bytes: result.bundleSize.gzipSize
24960
+ } : void 0
25702
24961
  });
25703
24962
  return result;
25704
24963
  }
@@ -25851,10 +25110,8 @@ async function deployWorker(props, config2, buildResult, callbacks) {
25851
25110
  (acc, m) => acc + m.content.length,
25852
25111
  0
25853
25112
  );
25854
- await printBundleSize(
25855
- { name: path__default.basename(resolvedEntryPointPath), content },
25856
- modules
25857
- );
25113
+ const bundleSize = await getSize([...modules, { content }]);
25114
+ printBundleSize(bundleSize);
25858
25115
  const canUseNewVersionsDeploymentsApi = workerExists && props.dispatchNamespace === void 0 && format === "modules" && migrations === void 0 && !hasDurableObjectExports(config2.exports) && !config2.first_party_worker && config2.containers === void 0;
25859
25116
  let workerBundle;
25860
25117
  const dockerPath = getDockerPath();
@@ -25898,19 +25155,21 @@ async function deployWorker(props, config2, buildResult, callbacks) {
25898
25155
  unsafe: config2.unsafe
25899
25156
  }
25900
25157
  );
25901
- printBindings(
25902
- bindings,
25903
- config2.tail_consumers,
25904
- config2.streaming_tail_consumers,
25905
- config2.containers,
25906
- { warnIfNoBindings: true, unsafeMetadata: config2.unsafe?.metadata }
25907
- );
25158
+ printBindings(bindings, {
25159
+ log: logger.log,
25160
+ tailConsumers: config2.tail_consumers,
25161
+ streamingTailConsumers: config2.streaming_tail_consumers,
25162
+ containers: config2.containers,
25163
+ warnIfNoBindings: true,
25164
+ unsafeMetadata: config2.unsafe?.metadata
25165
+ });
25908
25166
  } else {
25909
25167
  assert4(accountId, "Missing accountId");
25168
+ let provisionBindingsResult;
25910
25169
  if (assetsOptions?.routerConfig.has_user_worker === false) {
25911
25170
  logger.debug("skipping provisioning on assets-only project");
25912
25171
  } else if (props.resourcesProvision) {
25913
- await provisionBindings(
25172
+ provisionBindingsResult = await provisionBindings(
25914
25173
  bindings ?? {},
25915
25174
  accountId,
25916
25175
  scriptName,
@@ -26031,13 +25290,14 @@ async function deployWorker(props, config2, buildResult, callbacks) {
26031
25290
  logger.log("Worker Startup Time:", result.startup_time_ms, "ms");
26032
25291
  }
26033
25292
  bindingsPrinted = true;
26034
- printBindings(
26035
- bindings,
26036
- config2.tail_consumers,
26037
- config2.streaming_tail_consumers,
26038
- config2.containers,
26039
- { unsafeMetadata: config2.unsafe?.metadata }
26040
- );
25293
+ printBindings(bindings, {
25294
+ log: logger.log,
25295
+ tailConsumers: config2.tail_consumers,
25296
+ streamingTailConsumers: config2.streaming_tail_consumers,
25297
+ containers: config2.containers,
25298
+ unsafeMetadata: config2.unsafe?.metadata
25299
+ });
25300
+ provisionBindingsResult?.warnOnSkippedProvisioning();
26041
25301
  versionId = parseNonHyphenedUuid(result.deployment_id);
26042
25302
  if (config2.first_party_worker) {
26043
25303
  if (result.id) {
@@ -26058,13 +25318,13 @@ async function deployWorker(props, config2, buildResult, callbacks) {
26058
25318
  }
26059
25319
  } catch (err) {
26060
25320
  if (!bindingsPrinted) {
26061
- printBindings(
26062
- bindings,
26063
- config2.tail_consumers,
26064
- config2.streaming_tail_consumers,
26065
- config2.containers,
26066
- { unsafeMetadata: config2.unsafe?.metadata }
26067
- );
25321
+ printBindings(bindings, {
25322
+ log: logger.log,
25323
+ tailConsumers: config2.tail_consumers,
25324
+ streamingTailConsumers: config2.streaming_tail_consumers,
25325
+ containers: config2.containers,
25326
+ unsafeMetadata: config2.unsafe?.metadata
25327
+ });
26068
25328
  }
26069
25329
  if (err instanceof APIError && err.code === EXPORTS_RECONCILIATION_ERROR_CODE && isExportsReconciliationErrorDetails(err.meta?.details)) {
26070
25330
  err.preventReport();
@@ -26122,7 +25382,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
26122
25382
  }
26123
25383
  if (isDryRun) {
26124
25384
  logger.log(`--dry-run: exiting now.`);
26125
- return { versionId, workerTag };
25385
+ return { versionId, workerTag, bundleSize };
26126
25386
  }
26127
25387
  const uploadMs = Date.now() - start;
26128
25388
  logger.log("Uploaded", workerName, formatTime(uploadMs));
@@ -26136,7 +25396,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
26136
25396
  }
26137
25397
  if (props.dispatchNamespace !== void 0) {
26138
25398
  deployWfpUserWorker(props.dispatchNamespace, versionId);
26139
- return { versionId, workerTag, assetUploadStats };
25399
+ return { versionId, workerTag, assetUploadStats, bundleSize };
26140
25400
  }
26141
25401
  assert4(accountId);
26142
25402
  const targets = await triggersDeploy({
@@ -26156,7 +25416,8 @@ async function deployWorker(props, config2, buildResult, callbacks) {
26156
25416
  versionId,
26157
25417
  workerTag,
26158
25418
  assetUploadStats,
26159
- targets: targets ?? []
25419
+ targets: targets ?? [],
25420
+ bundleSize
26160
25421
  };
26161
25422
  }
26162
25423
  __name(deployWorker, "deployWorker");
@@ -26188,7 +25449,11 @@ async function versionsUpload(props, config2, buildResult, callbacks) {
26188
25449
  preview_url: result.versionPreviewUrl,
26189
25450
  preview_alias_url: result.versionPreviewAliasUrl,
26190
25451
  wrangler_environment: props.env,
26191
- worker_name_overridden: props.workerNameOverridden ?? false
25452
+ worker_name_overridden: props.workerNameOverridden ?? false,
25453
+ bundle_size: result.bundleSize ? {
25454
+ raw_bytes: result.bundleSize.size,
25455
+ gzip_bytes: result.bundleSize.gzipSize
25456
+ } : void 0
26192
25457
  });
26193
25458
  return result;
26194
25459
  }
@@ -26295,29 +25560,27 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
26295
25560
  config2.dependencies_instrumentation?.exclude_packages
26296
25561
  ) : void 0
26297
25562
  };
26298
- await printBundleSize(
26299
- { name: path__default.basename(resolvedEntryPointPath), content },
26300
- modules
26301
- );
25563
+ const bundleSize = await getSize([...modules, { content }]);
25564
+ printBundleSize(bundleSize);
26302
25565
  let workerBundle;
26303
25566
  if (props.dryRun) {
26304
25567
  workerBundle = createWorkerUploadForm(worker, bindings, {
26305
25568
  dryRun: true,
26306
25569
  unsafe: config2.unsafe
26307
25570
  });
26308
- printBindings(
26309
- bindings,
26310
- config2.tail_consumers,
26311
- config2.streaming_tail_consumers,
26312
- void 0,
26313
- { unsafeMetadata: config2.unsafe?.metadata }
26314
- );
25571
+ printBindings(bindings, {
25572
+ log: logger.log,
25573
+ tailConsumers: config2.tail_consumers,
25574
+ streamingTailConsumers: config2.streaming_tail_consumers,
25575
+ unsafeMetadata: config2.unsafe?.metadata
25576
+ });
26315
25577
  } else {
26316
25578
  assert4(accountId, "Missing accountId");
25579
+ let provisionBindingsResult;
26317
25580
  if (assetsOptions?.routerConfig.has_user_worker === false) {
26318
25581
  logger.debug("skipping provisioning on assets-only project");
26319
25582
  } else if (props.resourcesProvision) {
26320
- await provisionBindings(
25583
+ provisionBindingsResult = await provisionBindings(
26321
25584
  bindings,
26322
25585
  accountId,
26323
25586
  scriptName,
@@ -26348,24 +25611,23 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
26348
25611
  );
26349
25612
  logger.log("Worker Startup Time:", result.startup_time_ms, "ms");
26350
25613
  bindingsPrinted = true;
26351
- printBindings(
26352
- bindings,
26353
- config2.tail_consumers,
26354
- config2.streaming_tail_consumers,
26355
- void 0,
26356
- { unsafeMetadata: config2.unsafe?.metadata }
26357
- );
25614
+ printBindings(bindings, {
25615
+ log: logger.log,
25616
+ tailConsumers: config2.tail_consumers,
25617
+ streamingTailConsumers: config2.streaming_tail_consumers,
25618
+ unsafeMetadata: config2.unsafe?.metadata
25619
+ });
25620
+ provisionBindingsResult?.warnOnSkippedProvisioning();
26358
25621
  versionId = result.id;
26359
25622
  hasPreview = result.metadata.has_preview;
26360
25623
  } catch (err) {
26361
25624
  if (!bindingsPrinted) {
26362
- printBindings(
26363
- bindings,
26364
- config2.tail_consumers,
26365
- config2.streaming_tail_consumers,
26366
- void 0,
26367
- { unsafeMetadata: config2.unsafe?.metadata }
26368
- );
25625
+ printBindings(bindings, {
25626
+ log: logger.log,
25627
+ tailConsumers: config2.tail_consumers,
25628
+ streamingTailConsumers: config2.streaming_tail_consumers,
25629
+ unsafeMetadata: config2.unsafe?.metadata
25630
+ });
26369
25631
  }
26370
25632
  if (err instanceof APIError && err.code === ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE) {
26371
25633
  err.preventReport();
@@ -26425,7 +25687,7 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
26425
25687
  }
26426
25688
  if (props.dryRun) {
26427
25689
  logger.log(`--dry-run: exiting now.`);
26428
- return { versionId, workerTag };
25690
+ return { versionId, workerTag, bundleSize };
26429
25691
  }
26430
25692
  assert4(accountId);
26431
25693
  const uploadMs = Date.now() - start;
@@ -26464,7 +25726,8 @@ Changes to triggers (routes, custom domains, cron schedules, etc) must be applie
26464
25726
  workerTag,
26465
25727
  assetUploadStats: assetsUploadResult?.assetUploadStats,
26466
25728
  versionPreviewUrl,
26467
- versionPreviewAliasUrl
25729
+ versionPreviewAliasUrl,
25730
+ bundleSize
26468
25731
  };
26469
25732
  }
26470
25733
  __name(uploadWorkerVersion, "uploadWorkerVersion");
@@ -28057,4 +27320,4 @@ __name(previewSettingsUpdate, "previewSettingsUpdate");
28057
27320
  * THE SOFTWARE.
28058
27321
  */
28059
27322
 
28060
- export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, INVALID_INHERIT_BINDING_CODE, NO_ACTIVE_PREVIEW_URLS_MESSAGE, NoInputError, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE, WORKFLOW_NOT_FOUND_CODE, addRequiredSecretsInheritBindings, addWorkersSitesBindings, applyServiceAndEnvironmentTags, assemblePreviewDefaults, assemblePreviewScriptSettings, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, collectPackageDependencies, confirmLatestDeploymentOverwrite, createDeployment, createPreview, createPreviewDeployment, createPreviewDeploymentForm, createPreviewParentWorker, createTruncatedAlias, decodeJwtPayload, deletePreview, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, drawBox, drawConnectedChildBox, editPreview, editWorkerPreviewDefaults, ensureQueuesExistByConfig, extractConfigBindings, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, formatAlignedRows, formatBindings, formatPreviewsSettings, generatePreviewAlias, getBindingValue, getBranchName2 as getBranchName, getCommitSha, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getHeadCommitMessage, getHeadCommitRef, getMigrationsToUpload, getPreview, getPreviewBaseConfig, getPreviewDeployment, getPreviewOwnedContainerClassNames, getPullRequestMetadata, getQueue, getRemoteConfigDiff, getRepositoryUrl, getSettings, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkerPreviewDefaults, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, mergeDeep, padToVisibleWidth, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, patchPreviewBaseConfig, patchPreviewDeployment, postConsumer, preview, previewContainerAppName, previewDelete, previewSettingsGet, previewSettingsUpdate, printBindings, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, resolveWorkerName, sanitizeBranchName, shouldUseCIMetadataFallback, stripAnsi, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, validateEventTriggerTargets, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, visibleLength, warnOnErrorUpdatingServiceAndEnvironmentTags, warnOrError, workerNotFoundErrorMessage };
27323
+ export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, INVALID_INHERIT_BINDING_CODE, NO_ACTIVE_PREVIEW_URLS_MESSAGE, NoInputError, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE, WORKFLOW_NOT_FOUND_CODE, addRequiredSecretsInheritBindings, addWorkersSitesBindings, applyServiceAndEnvironmentTags, assemblePreviewDefaults, assemblePreviewScriptSettings, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, collectPackageDependencies, confirmLatestDeploymentOverwrite, createDeployment, createPreview, createPreviewDeployment, createPreviewDeploymentForm, createPreviewParentWorker, createTruncatedAlias, decodeJwtPayload, deletePreview, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, drawBox, drawConnectedChildBox, editPreview, editWorkerPreviewDefaults, ensureQueuesExistByConfig, extractConfigBindings, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, formatAlignedRows, formatBindings, formatPreviewsSettings, generatePreviewAlias, getBindingValue, getBranchName2 as getBranchName, getCommitSha, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getHeadCommitMessage, getHeadCommitRef, getMigrationsToUpload, getPreview, getPreviewBaseConfig, getPreviewDeployment, getPreviewOwnedContainerClassNames, getPullRequestMetadata, getQueue, getRemoteConfigDiff, getRepositoryUrl, getSettings, getSize, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkerPreviewDefaults, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, mergeDeep, padToVisibleWidth, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, patchPreviewBaseConfig, patchPreviewDeployment, postConsumer, preview, previewContainerAppName, previewDelete, previewSettingsGet, previewSettingsUpdate, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, resolveWorkerName, sanitizeBranchName, shouldUseCIMetadataFallback, stripAnsi, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, validateEventTriggerTargets, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, visibleLength, warnOnErrorUpdatingServiceAndEnvironmentTags, workerNotFoundErrorMessage };