wrangler 4.125.0 → 4.127.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.
@@ -229,7 +229,7 @@ var init_chunk_Q72B4Q5Z = __esm({
229
229
  }
230
230
  });
231
231
 
232
- // ../workers-utils/dist/chunk-QKX75RGI.mjs
232
+ // ../workers-utils/dist/chunk-RB2KBB2C.mjs
233
233
  function assertNever(_value) {
234
234
  }
235
235
  function mapWorkerMetadataBindings(bindings2) {
@@ -691,11 +691,11 @@ function constructWranglerConfig(config6) {
691
691
  };
692
692
  }
693
693
  var DEFAULT_COMPAT_DATE;
694
- var init_chunk_QKX75RGI = __esm({
695
- "../workers-utils/dist/chunk-QKX75RGI.mjs"() {
694
+ var init_chunk_RB2KBB2C = __esm({
695
+ "../workers-utils/dist/chunk-RB2KBB2C.mjs"() {
696
696
  init_import_meta_url();
697
697
  init_chunk_Q72B4Q5Z();
698
- DEFAULT_COMPAT_DATE = "2026-08-20";
698
+ DEFAULT_COMPAT_DATE = "2026-08-26";
699
699
  __name(assertNever, "assertNever");
700
700
  __name2(assertNever, "assertNever");
701
701
  __name(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
@@ -36433,6 +36433,19 @@ function validateAndNormalizeTsconfig(diagnostics, topLevelEnv, rawEnv, configPa
36433
36433
  path31__namespace.default.join(path31__namespace.default.dirname(configPath), tsconfig)
36434
36434
  ) : tsconfig;
36435
36435
  }
36436
+ function validateWorkflowRetentionValue(diagnostics, field, key, value) {
36437
+ const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
36438
+ const isValidString = typeof value === "string" && value.length > 0;
36439
+ if (isValidNumber || isValidString) {
36440
+ return true;
36441
+ }
36442
+ diagnostics.errors.push(
36443
+ `"${field}" bindings "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(
36444
+ value
36445
+ )}.`
36446
+ );
36447
+ return false;
36448
+ }
36436
36449
  function validateSshPublicKeys(diagnostics, field, value, nameRequired) {
36437
36450
  if (!Array.isArray(value)) {
36438
36451
  diagnostics.errors.push(`${field} must be an array`);
@@ -39367,7 +39380,7 @@ var import_undici, require_vendors, require_ci_info, require_command_exists, req
39367
39380
  var init_dist = __esm({
39368
39381
  "../workers-utils/dist/index.mjs"() {
39369
39382
  init_import_meta_url();
39370
- init_chunk_QKX75RGI();
39383
+ init_chunk_RB2KBB2C();
39371
39384
  init_chunk_34VZWBGB();
39372
39385
  init_chunk_34VZWBGB();
39373
39386
  init_chunk_QFKPUV4H();
@@ -53784,6 +53797,8 @@ Please add a binding for each to "${fieldPath}.bindings":
53784
53797
  return isValid;
53785
53798
  }, "validateDurableObjectBinding");
53786
53799
  workflowNameFormatMessage = `Workflow names must be 1-64 characters long, start with a letter, number, or underscore, and may only contain letters, numbers, underscores, or hyphens.`;
53800
+ __name(validateWorkflowRetentionValue, "validateWorkflowRetentionValue");
53801
+ __name2(validateWorkflowRetentionValue, "validateWorkflowRetentionValue");
53787
53802
  validateWorkflowBinding = /* @__PURE__ */ __name2((diagnostics, field, value) => {
53788
53803
  if (typeof value !== "object" || value === null) {
53789
53804
  diagnostics.errors.push(
@@ -53897,13 +53912,69 @@ Please add a binding for each to "${fieldPath}.bindings":
53897
53912
  );
53898
53913
  }
53899
53914
  }
53915
+ if (hasProperty(value, "default_retention") && value.default_retention !== void 0) {
53916
+ if (typeof value.default_retention !== "object" || value.default_retention === null || Array.isArray(value.default_retention)) {
53917
+ diagnostics.errors.push(
53918
+ `"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(
53919
+ value
53920
+ )}.`
53921
+ );
53922
+ isValid = false;
53923
+ } else {
53924
+ const defaultRetention = value.default_retention;
53925
+ for (const key of ["success_retention", "error_retention"]) {
53926
+ if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue(
53927
+ diagnostics,
53928
+ field,
53929
+ key,
53930
+ defaultRetention[key]
53931
+ )) {
53932
+ isValid = false;
53933
+ }
53934
+ }
53935
+ validateAdditionalProperties(
53936
+ diagnostics,
53937
+ `${field}.default_retention`,
53938
+ Object.keys(defaultRetention),
53939
+ ["success_retention", "error_retention"]
53940
+ );
53941
+ }
53942
+ }
53943
+ if (hasProperty(value, "concurrency") && value.concurrency !== void 0) {
53944
+ if (typeof value.concurrency !== "object" || value.concurrency === null || Array.isArray(value.concurrency)) {
53945
+ diagnostics.errors.push(
53946
+ `"${field}" bindings should, optionally, have an object "concurrency" field but got ${JSON.stringify(
53947
+ value
53948
+ )}.`
53949
+ );
53950
+ isValid = false;
53951
+ } else {
53952
+ const concurrency = value.concurrency;
53953
+ if (concurrency.limit !== void 0 && (typeof concurrency.limit !== "number" || !Number.isInteger(concurrency.limit) || concurrency.limit < 1)) {
53954
+ diagnostics.errors.push(
53955
+ `"${field}" bindings "concurrency.limit" field must be a positive integer but got ${JSON.stringify(
53956
+ concurrency.limit
53957
+ )}.`
53958
+ );
53959
+ isValid = false;
53960
+ }
53961
+ validateAdditionalProperties(
53962
+ diagnostics,
53963
+ `${field}.concurrency`,
53964
+ Object.keys(concurrency),
53965
+ ["limit"]
53966
+ );
53967
+ }
53968
+ }
53900
53969
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
53901
53970
  "binding",
53902
53971
  "name",
53903
53972
  "class_name",
53904
53973
  "script_name",
53905
53974
  "limits",
53906
- "schedules"
53975
+ "concurrency",
53976
+ "schedules",
53977
+ "default_retention"
53907
53978
  ]);
53908
53979
  return isValid;
53909
53980
  }, "validateWorkflowBinding");
@@ -58676,7 +58747,7 @@ var name, version2;
58676
58747
  var init_package = __esm({
58677
58748
  "package.json"() {
58678
58749
  name = "wrangler";
58679
- version2 = "4.125.0";
58750
+ version2 = "4.127.0";
58680
58751
  }
58681
58752
  });
58682
58753
 
@@ -123997,7 +124068,7 @@ function probeSecretTool() {
123997
124068
  let result;
123998
124069
  try {
123999
124070
  const r8 = runner(["--version"]);
124000
- result = r8.status === 0;
124071
+ result = r8.error === void 0;
124001
124072
  } catch {
124002
124073
  result = false;
124003
124074
  }
@@ -124267,8 +124338,8 @@ function scrubEncryptedCredentials(options) {
124267
124338
  return { backendAvailable: false, encryptedFileExisted };
124268
124339
  }
124269
124340
  var import_undici2, hasWarnedAboutDeprecatedV1ApiToken, getCloudflareAPITokenFromEnv, getCloudflareGlobalAuthKeyFromEnv, getCloudflareGlobalAuthEmailFromEnv, ACCOUNT_ID_PATTERN, getAuthDomainFromEnv, getAuthUrlFromEnv, getTokenUrlFromEnv, getRevokeUrlFromEnv, readCloudflareAccountIdFromEnv, DEVICE_AUTH_PATH, getAccessClientIdFromEnv, getAccessClientSecretFromEnv, getCfAuthorizationTokenFromEnv, getCloudflareAuthUseKeyringFromEnv, headersCache, usesAccessCache, RECOMMENDED_CODE_VERIFIER_LENGTH, RECOMMENDED_STATE_LENGTH, PKCE_CHARSET, generateVerificationUrl, generateAuthUrl, POW_MAX_ITERATIONS, TEMPORARY_TERMS_URLS, TEMPORARY_TERMS_PROMPT, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_ERROR, esm_default3, ErrorOAuth2, ErrorUnknown, ErrorNoAuthCode, ErrorInvalidReturnedStateParam, ErrorInvalidJson, ErrorInvalidScope, ErrorInvalidRequest, ErrorInvalidToken, ErrorAuthenticationGrant, ErrorUnauthorizedClient, ErrorAccessDenied, ErrorUnsupportedResponseType, ErrorServerError, ErrorTemporarilyUnavailable, ErrorAccessTokenResponse, ErrorInvalidClient, ErrorInvalidGrant, ErrorUnsupportedGrantType, DEVICE_FLOW_MAX_DURATION_SECONDS, DEVICE_FLOW_MIN_POLL_INTERVAL_SECONDS, RESERVED_PROFILE_NAMES, TomlError2, DATE_TIME_RE2, TomlDate2, INT_REGEX2, FLOAT_REGEX2, LEADING_ZERO2, ESCAPE_REGEX2, ESC_MAP2, KEY_PART_RE2, BARE_KEY2, dist_default2, FILE_FORMATS, USER_AUTH_CONFIG_PATH, FileCredentialStore, KEY_LENGTH_BYTES, IV_LENGTH_BYTES, TAG_LENGTH_BYTES, ALGORITHM_LABEL, CIPHER_NAME, EncryptedFileCredentialStore, PINNED_KEYRING_VERSION, npmRunner, cachedBindingPathByDir, entryFactoryOverride, runner, cachedProbeResult, LinuxSecretToolKeyProvider, SECURITY_EXIT_ITEM_NOT_FOUND, runner2, MacSecurityKeyProvider, NapiKeyringKeyProvider, testProviderFactory, sessionFlags;
124270
- var init_chunk_EGLFJKUK = __esm({
124271
- "../workers-auth/dist/chunk-EGLFJKUK.mjs"() {
124341
+ var init_chunk_LQW53VED = __esm({
124342
+ "../workers-auth/dist/chunk-LQW53VED.mjs"() {
124272
124343
  init_import_meta_url();
124273
124344
  init_chunk_O6YSETKJ();
124274
124345
  init_dist();
@@ -125353,7 +125424,7 @@ ${codeblock}`, options);
125353
125424
  var init_dist2 = __esm({
125354
125425
  "../workers-auth/dist/index.mjs"() {
125355
125426
  init_import_meta_url();
125356
- init_chunk_EGLFJKUK();
125427
+ init_chunk_LQW53VED();
125357
125428
  }
125358
125429
  });
125359
125430
  function createPreferences(getConfigPath2) {
@@ -126260,10 +126331,10 @@ function createAuthConfigFileHelpers(deps) {
126260
126331
  };
126261
126332
  }
126262
126333
  var millisecondsInMinute, minutesInYear, minutesInMonth, minutesInDay, constructFromSymbol, defaultOptions2, formatDistanceLocale, formatDistance, dateFormats, timeFormats, dateTimeFormats, formatLong, formatRelativeLocale, formatRelative, eraValues, quarterValues, monthValues, dayValues, dayPeriodValues, formattingDayPeriodValues, ordinalNumber, localize, matchOrdinalNumberPattern, parseOrdinalNumberPattern, matchEraPatterns, parseEraPatterns, matchQuarterPatterns, parseQuarterPatterns, matchMonthPatterns, parseMonthPatterns, matchDayPatterns, parseDayPatterns, matchDayPeriodPatterns, parseDayPeriodPatterns, match, enUS, MEMBERSHIPS_INACCESSIBLE_CODES, DIRECTORY_BINDINGS_FILE, ENCRYPTED_PROFILE_CONFIG_EXTENSION;
126263
- var init_chunk_X7ZLU22G = __esm({
126264
- "../workers-auth/dist/chunk-X7ZLU22G.mjs"() {
126334
+ var init_chunk_YCVYA5LL = __esm({
126335
+ "../workers-auth/dist/chunk-YCVYA5LL.mjs"() {
126265
126336
  init_import_meta_url();
126266
- init_chunk_EGLFJKUK();
126337
+ init_chunk_LQW53VED();
126267
126338
  init_chunk_O6YSETKJ();
126268
126339
  init_dist();
126269
126340
  __name(createPreferences, "createPreferences");
@@ -126777,7 +126848,7 @@ var DefaultScopes, DefaultScopeKeys, WRANGLER_KEYRING_SERVICE_NAME, WRANGLER_CLI
126777
126848
  var init_wrangler = __esm({
126778
126849
  "../workers-auth/dist/wrangler/index.mjs"() {
126779
126850
  init_import_meta_url();
126780
- init_chunk_X7ZLU22G();
126851
+ init_chunk_YCVYA5LL();
126781
126852
  init_chunk_O6YSETKJ();
126782
126853
  init_dist();
126783
126854
  DefaultScopes = {
@@ -135933,8 +136004,25 @@ function convertConfigToBindings(config6, options) {
135933
136004
  if (pages) {
135934
136005
  break;
135935
136006
  }
135936
- for (const { name: name2, ...x6 } of info3) {
135937
- output[name2] = { type: "send_email", ...x6 };
136007
+ for (const {
136008
+ name: name2,
136009
+ destination_address,
136010
+ allowed_destination_addresses,
136011
+ allowed_sender_addresses,
136012
+ remote
136013
+ } of info3) {
136014
+ const shared = {
136015
+ type: "send_email",
136016
+ allowed_sender_addresses,
136017
+ remote
136018
+ };
136019
+ if (destination_address !== void 0) {
136020
+ output[name2] = { ...shared, destination_address };
136021
+ } else if (allowed_destination_addresses !== void 0) {
136022
+ output[name2] = { ...shared, allowed_destination_addresses };
136023
+ } else {
136024
+ output[name2] = shared;
136025
+ }
135938
136026
  }
135939
136027
  break;
135940
136028
  }
@@ -136417,16 +136505,24 @@ function createWorkerUploadForm(worker, bindings2, options) {
136417
136505
  }
136418
136506
  });
136419
136507
  send_email.forEach((emailBinding) => {
136420
- const destination_address = "destination_address" in emailBinding ? emailBinding.destination_address : void 0;
136421
- const allowed_destination_addresses = "allowed_destination_addresses" in emailBinding ? emailBinding.allowed_destination_addresses : void 0;
136422
- const allowed_sender_addresses = "allowed_sender_addresses" in emailBinding ? emailBinding.allowed_sender_addresses : void 0;
136423
- metadataBindings.push({
136508
+ const shared = {
136424
136509
  name: emailBinding.name,
136425
136510
  type: "send_email",
136426
- destination_address,
136427
- allowed_destination_addresses,
136428
- allowed_sender_addresses
136429
- });
136511
+ allowed_sender_addresses: emailBinding.allowed_sender_addresses
136512
+ };
136513
+ if (emailBinding.destination_address !== void 0) {
136514
+ metadataBindings.push({
136515
+ ...shared,
136516
+ destination_address: emailBinding.destination_address
136517
+ });
136518
+ } else if (emailBinding.allowed_destination_addresses !== void 0) {
136519
+ metadataBindings.push({
136520
+ ...shared,
136521
+ allowed_destination_addresses: emailBinding.allowed_destination_addresses
136522
+ });
136523
+ } else {
136524
+ metadataBindings.push(shared);
136525
+ }
136430
136526
  });
136431
136527
  durable_objects.forEach(({ name: name2, class_name, script_name, environment }) => {
136432
136528
  metadataBindings.push({
@@ -137009,8 +137105,8 @@ function createWorkerUploadForm(worker, bindings2, options) {
137009
137105
  return formData;
137010
137106
  }
137011
137107
  var import_undici4, import_command_exists2, nameBindings, moduleTypeMimeType;
137012
- var init_chunk_LRKPOFWK = __esm({
137013
- "../deploy-helpers/dist/chunk-LRKPOFWK.mjs"() {
137108
+ var init_chunk_ZV7SJ2MZ = __esm({
137109
+ "../deploy-helpers/dist/chunk-ZV7SJ2MZ.mjs"() {
137014
137110
  init_import_meta_url();
137015
137111
  init_chunk_Q72B4Q5Z2();
137016
137112
  init_dist();
@@ -142729,6 +142825,14 @@ ${dashLink}`, {
142729
142825
  }
142730
142826
  );
142731
142827
  }
142828
+ if (workflow.concurrency) {
142829
+ throw new UserError(
142830
+ `Workflow "${workflow.name}" has "concurrency" configured but references external script "${workflow.script_name}". Configure concurrency on the worker that defines the workflow.`,
142831
+ {
142832
+ telemetryMessage: "triggers deploy workflow concurrency external script"
142833
+ }
142834
+ );
142835
+ }
142732
142836
  if (workflow.schedules) {
142733
142837
  throw new UserError(
142734
142838
  `Workflow "${workflow.name}" has "schedules" configured but references external script "${workflow.script_name}". Configure schedules on the worker that defines the workflow.`,
@@ -142737,6 +142841,14 @@ ${dashLink}`, {
142737
142841
  }
142738
142842
  );
142739
142843
  }
142844
+ if (workflow.default_retention) {
142845
+ throw new UserError(
142846
+ `Workflow "${workflow.name}" has "default_retention" configured but references external script "${workflow.script_name}". Configure default_retention on the worker that defines the workflow.`,
142847
+ {
142848
+ telemetryMessage: "triggers deploy workflow default_retention external script"
142849
+ }
142850
+ );
142851
+ }
142740
142852
  continue;
142741
142853
  }
142742
142854
  workflowDeployments.push({
@@ -142750,8 +142862,14 @@ ${dashLink}`, {
142750
142862
  script_name: scriptName,
142751
142863
  class_name: workflow.class_name,
142752
142864
  ...workflow.limits && { limits: workflow.limits },
142865
+ ...workflow.concurrency && {
142866
+ concurrency: workflow.concurrency
142867
+ },
142753
142868
  ...workflow.schedules && {
142754
142869
  schedules: (Array.isArray(workflow.schedules) ? workflow.schedules : [workflow.schedules]).map((cron) => ({ cron }))
142870
+ },
142871
+ ...workflow.default_retention && {
142872
+ default_retention: workflow.default_retention
142755
142873
  }
142756
142874
  }),
142757
142875
  headers: {
@@ -151238,6 +151356,18 @@ async function getPreviewDeployment(config22, accountId, workerName, previewIden
151238
151356
  )}/deployments/${encodeURIComponent(deploymentIdentifier)}`
151239
151357
  );
151240
151358
  }
151359
+ function createPreviewDeploymentForm(request22) {
151360
+ const { modules, ...metadata2 } = request22;
151361
+ const formData = new import_undici5.FormData();
151362
+ formData.set("metadata", JSON.stringify(metadata2));
151363
+ for (const module2 of modules ?? []) {
151364
+ formData.append(
151365
+ "files",
151366
+ new File([module2.content], module2.name, { type: module2.content_type })
151367
+ );
151368
+ }
151369
+ return formData;
151370
+ }
151241
151371
  async function createPreviewDeployment(config22, accountId, workerName, previewIdentifier, request22) {
151242
151372
  return fetchResult(
151243
151373
  config22,
@@ -151246,8 +151376,8 @@ async function createPreviewDeployment(config22, accountId, workerName, previewI
151246
151376
  )}/deployments`,
151247
151377
  {
151248
151378
  method: "POST",
151249
- headers: { "Content-Type": "application/json" },
151250
- body: JSON.stringify(request22)
151379
+ // Let undici set Content-Type with the generated multipart boundary.
151380
+ body: createPreviewDeploymentForm(request22)
151251
151381
  }
151252
151382
  );
151253
151383
  }
@@ -151341,6 +151471,132 @@ function getHeadCommitMessage() {
151341
151471
  return void 0;
151342
151472
  }
151343
151473
  }
151474
+ function getCommitSha() {
151475
+ return process.env.GITHUB_SHA || process.env.CI_COMMIT_SHA || process.env.CIRCLE_SHA1 || process.env.COMMIT_SHA || void 0;
151476
+ }
151477
+ function normalizeRepositoryUrl(repositoryUrl) {
151478
+ const trimmed = repositoryUrl.trim();
151479
+ if (!trimmed) {
151480
+ return void 0;
151481
+ }
151482
+ const scpLikeSshMatch = trimmed.match(/^git@([^:]+):(.+)$/);
151483
+ if (scpLikeSshMatch) {
151484
+ const [, host, pathname] = scpLikeSshMatch;
151485
+ return `https://${host}/${pathname.replace(/\.git$/, "")}`;
151486
+ }
151487
+ try {
151488
+ const url32 = new URL(trimmed);
151489
+ if (url32.protocol === "ssh:" && url32.username === "git") {
151490
+ return `https://${url32.host}${url32.pathname.replace(/\.git$/, "")}`;
151491
+ }
151492
+ if (url32.protocol !== "https:" && url32.protocol !== "http:") {
151493
+ return void 0;
151494
+ }
151495
+ url32.username = "";
151496
+ url32.password = "";
151497
+ url32.search = "";
151498
+ url32.hash = "";
151499
+ url32.pathname = url32.pathname.replace(/\.git$/, "");
151500
+ return url32.toString().replace(/\/$/, "");
151501
+ } catch {
151502
+ return void 0;
151503
+ }
151504
+ }
151505
+ function getRepositoryUrl() {
151506
+ const repositoryUrl = process.env.CI_PROJECT_URL || process.env.CI_REPOSITORY_URL || process.env.CIRCLE_REPOSITORY_URL || process.env.BUILDKITE_REPO || process.env.BITBUCKET_GIT_HTTP_ORIGIN || process.env.BITBUCKET_GIT_SSH_ORIGIN || process.env.REPOSITORY_URL;
151507
+ if (repositoryUrl) {
151508
+ return normalizeRepositoryUrl(repositoryUrl);
151509
+ }
151510
+ if (process.env.GITHUB_REPOSITORY) {
151511
+ const githubServerUrl = process.env.GITHUB_SERVER_URL || "https://github.com";
151512
+ return normalizeRepositoryUrl(
151513
+ `${githubServerUrl.replace(/\/$/, "")}/${process.env.GITHUB_REPOSITORY}`
151514
+ );
151515
+ }
151516
+ if (!shouldUseCIMetadataFallback()) {
151517
+ return void 0;
151518
+ }
151519
+ try {
151520
+ childProcess.execSync(`git rev-parse --is-inside-work-tree`, { stdio: "ignore" });
151521
+ return normalizeRepositoryUrl(
151522
+ childProcess.execSync(`git config --get remote.origin.url`).toString()
151523
+ );
151524
+ } catch {
151525
+ return void 0;
151526
+ }
151527
+ }
151528
+ function normalizePullRequestNumber(number42) {
151529
+ if (number42 === void 0) {
151530
+ return void 0;
151531
+ }
151532
+ const normalizedNumber = String(number42).trim();
151533
+ return normalizedNumber ? normalizedNumber : void 0;
151534
+ }
151535
+ function normalizePullRequestTitle(title) {
151536
+ if (title === void 0) {
151537
+ return void 0;
151538
+ }
151539
+ const trimmedTitle = title.trim();
151540
+ return trimmedTitle || void 0;
151541
+ }
151542
+ function getGitHubPullRequestMetadata() {
151543
+ if (process.env.GITHUB_EVENT_PATH) {
151544
+ try {
151545
+ const event = JSON.parse(
151546
+ fs6.readFileSync(process.env.GITHUB_EVENT_PATH, "utf8")
151547
+ );
151548
+ const number52 = normalizePullRequestNumber(event.pull_request?.number);
151549
+ const url32 = event.pull_request?.html_url ? normalizeRepositoryUrl(event.pull_request.html_url) : void 0;
151550
+ const title = normalizePullRequestTitle(event.pull_request?.title);
151551
+ if (number52 || url32 || title) {
151552
+ return { number: number52, url: url32, title };
151553
+ }
151554
+ } catch {
151555
+ }
151556
+ }
151557
+ const refPullRequestNumber = process.env.GITHUB_REF?.match(/^refs\/pull\/(\d+)\//)?.[1];
151558
+ const number42 = normalizePullRequestNumber(refPullRequestNumber);
151559
+ if (!number42 || !process.env.GITHUB_REPOSITORY) {
151560
+ return void 0;
151561
+ }
151562
+ const githubServerUrl = process.env.GITHUB_SERVER_URL || "https://github.com";
151563
+ return {
151564
+ number: number42,
151565
+ url: normalizeRepositoryUrl(
151566
+ `${githubServerUrl.replace(/\/$/, "")}/${process.env.GITHUB_REPOSITORY}/pull/${number42}`
151567
+ )
151568
+ };
151569
+ }
151570
+ function getGitLabPullRequestMetadata() {
151571
+ const number42 = normalizePullRequestNumber(process.env.CI_MERGE_REQUEST_IID);
151572
+ const projectUrl = process.env.CI_MERGE_REQUEST_PROJECT_URL || process.env.CI_PROJECT_URL;
151573
+ if (!number42 || !projectUrl) {
151574
+ return void 0;
151575
+ }
151576
+ const normalizedProjectUrl = projectUrl.replace(/\.git$/, "").replace(/\/$/, "");
151577
+ return {
151578
+ number: number42,
151579
+ url: normalizeRepositoryUrl(
151580
+ `${normalizedProjectUrl}/-/merge_requests/${number42}`
151581
+ ),
151582
+ title: normalizePullRequestTitle(process.env.CI_MERGE_REQUEST_TITLE)
151583
+ };
151584
+ }
151585
+ function getDirectPullRequestMetadata() {
151586
+ const directUrl = process.env.PULL_REQUEST_URL || process.env.PR_URL || process.env.CHANGE_URL || process.env.CIRCLE_PULL_REQUEST;
151587
+ const number42 = normalizePullRequestNumber(
151588
+ process.env.PULL_REQUEST_NUMBER || process.env.PR_NUMBER || process.env.CHANGE_ID
151589
+ );
151590
+ const url32 = directUrl ? normalizeRepositoryUrl(directUrl) : void 0;
151591
+ const title = normalizePullRequestTitle(process.env.PULL_REQUEST_TITLE);
151592
+ if (number42 || url32 || title) {
151593
+ return { number: number42, url: url32, title };
151594
+ }
151595
+ return void 0;
151596
+ }
151597
+ function getPullRequestMetadata() {
151598
+ return getDirectPullRequestMetadata() ?? getGitHubPullRequestMetadata() ?? getGitLabPullRequestMetadata();
151599
+ }
151344
151600
  function resolveWorkerName(args, config22) {
151345
151601
  const workerName = args.workerName ?? args["worker-name"] ?? config22.name;
151346
151602
  if (!workerName) {
@@ -151734,9 +151990,6 @@ async function prepareContainersForPreview(config22, workerName, previewSlug, ca
151734
151990
  }
151735
151991
  return { scopedContainerConfig, normalisedContainerConfig };
151736
151992
  }
151737
- function toBase64(content) {
151738
- return Buffer.from(content).toString("base64");
151739
- }
151740
151993
  function getPreviewMigrationsToUpload(workerName, config22, currentMigrationTag) {
151741
151994
  if (config22.migrations.length === 0) {
151742
151995
  return void 0;
@@ -151778,14 +152031,14 @@ function buildResultToDeploymentModules(buildResult, assetFiles) {
151778
152031
  {
151779
152032
  name: mainModuleName,
151780
152033
  content_type: mainContentType,
151781
- content_base64: toBase64(buildResult.content)
152034
+ content: buildResult.content
151782
152035
  },
151783
152036
  ...buildResult.modules.map((mod2) => {
151784
152037
  const contentType = moduleTypeMimeType[mod2.type ?? "text"] ?? "application/octet-stream";
151785
152038
  return {
151786
152039
  name: mod2.name,
151787
152040
  content_type: contentType,
151788
- content_base64: toBase64(mod2.content)
152041
+ content: mod2.content
151789
152042
  };
151790
152043
  })
151791
152044
  ];
@@ -151794,7 +152047,7 @@ function buildResultToDeploymentModules(buildResult, assetFiles) {
151794
152047
  ...buildResult.sourceMaps.map((sourceMap) => ({
151795
152048
  name: sourceMap.name,
151796
152049
  content_type: "application/source-map",
151797
- content_base64: toBase64(sourceMap.content)
152050
+ content: sourceMap.content
151798
152051
  }))
151799
152052
  );
151800
152053
  }
@@ -151802,14 +152055,14 @@ function buildResultToDeploymentModules(buildResult, assetFiles) {
151802
152055
  deploymentModules.push({
151803
152056
  name: "_headers",
151804
152057
  content_type: "text/plain",
151805
- content_base64: toBase64(assetFiles._headers)
152058
+ content: assetFiles._headers
151806
152059
  });
151807
152060
  }
151808
152061
  if (assetFiles?._redirects !== void 0) {
151809
152062
  deploymentModules.push({
151810
152063
  name: "_redirects",
151811
152064
  content_type: "text/plain",
151812
- content_base64: toBase64(assetFiles._redirects)
152065
+ content: assetFiles._redirects
151813
152066
  });
151814
152067
  }
151815
152068
  return { main_module: mainModuleName, modules: deploymentModules };
@@ -151845,9 +152098,21 @@ async function assemblePreviewDeploymentSettings(config22, buildResult, accountI
151845
152098
  if (config22.compatibility_flags && config22.compatibility_flags.length > 0) {
151846
152099
  request22.compatibility_flags = config22.compatibility_flags;
151847
152100
  }
151848
- if (options.message || options.tag) {
152101
+ const repositoryUrl = options.repositoryUrl;
152102
+ const pullRequest = options.pullRequest;
152103
+ const commitSha = options.commitSha;
152104
+ if (options.message || options.tag || repositoryUrl || pullRequest || commitSha) {
151849
152105
  request22.annotations = {
152106
+ ...commitSha && { "workers/commit_sha": commitSha },
151850
152107
  ...options.message && { "workers/message": options.message },
152108
+ ...pullRequest?.number && {
152109
+ "workers/pull_request_number": pullRequest.number
152110
+ },
152111
+ ...pullRequest?.title && {
152112
+ "workers/pull_request_title": pullRequest.title
152113
+ },
152114
+ ...pullRequest?.url && { "workers/pull_request_url": pullRequest.url },
152115
+ ...repositoryUrl && { "workers/repository_url": repositoryUrl },
151851
152116
  ...options.tag && { "workers/tag": options.tag }
151852
152117
  };
151853
152118
  }
@@ -151918,14 +152183,21 @@ function formatUrlLines(label, urls) {
151918
152183
  ...urls.map((url32) => ` ${source_default.underline(url32)}`)
151919
152184
  ];
151920
152185
  }
151921
- function formatPreviewDeploymentSummary(previewResource, deployment, isNew) {
152186
+ function formatPreviewDeploymentSummary(previewResource, deployment, isNew, pullRequest) {
151922
152187
  const statusLabel = isNew ? source_default.green("(new)") : source_default.dim("(updated)");
152188
+ const pullRequestUrl = deployment.annotations?.["workers/pull_request_url"] ?? pullRequest?.url;
152189
+ const pullRequestNumber = deployment.annotations?.["workers/pull_request_number"] ?? pullRequest?.number;
152190
+ const hasActiveUrls = (previewResource.urls?.length ?? 0) > 0 || (deployment.urls?.length ?? 0) > 0;
151923
152191
  return [
151924
152192
  `${source_default.bold("Preview:")} ${previewResource.name} ${statusLabel}`,
151925
152193
  ...formatUrlLines("Preview", previewResource.urls),
151926
152194
  "",
151927
152195
  `${source_default.bold("Deployment ID:")} ${deployment.id}`,
151928
- ...formatUrlLines("Deployment", deployment.urls)
152196
+ ...formatUrlLines("Deployment", deployment.urls),
152197
+ ...pullRequestUrl || pullRequestNumber ? [
152198
+ `${source_default.bold("Pull Request:")} ${pullRequestUrl ?? `#${pullRequestNumber}`}`
152199
+ ] : [],
152200
+ ...hasActiveUrls ? [] : [NO_ACTIVE_PREVIEW_URLS_MESSAGE]
151929
152201
  ].join("\n");
151930
152202
  }
151931
152203
  function logMissingPreviewsBindingsWarning(topLevelBindings, remotePreviewDefaultBindings, localPreviewBindings) {
@@ -151995,6 +152267,9 @@ async function preview(accountId, args, config22, buildResult, assetsOptions, ca
151995
152267
  const ignoreBaseConfig = args.ignoreBaseConfig;
151996
152268
  const fallbackTag = !args.tag && shouldUseCIMetadataFallback() ? getHeadCommitRef() : void 0;
151997
152269
  const fallbackMessage = !args.message && shouldUseCIMetadataFallback() ? getHeadCommitMessage() : void 0;
152270
+ const repositoryUrl = getRepositoryUrl();
152271
+ const pullRequest = getPullRequestMetadata();
152272
+ const commitSha = getCommitSha();
151998
152273
  let existingPreview = null;
151999
152274
  try {
152000
152275
  existingPreview = await getPreview(
@@ -152054,6 +152329,9 @@ async function preview(accountId, args, config22, buildResult, assetsOptions, ca
152054
152329
  {
152055
152330
  message: args.message ?? fallbackMessage,
152056
152331
  tag: args.tag ?? fallbackTag,
152332
+ repositoryUrl,
152333
+ pullRequest,
152334
+ commitSha,
152057
152335
  assetsOptions
152058
152336
  }
152059
152337
  );
@@ -152086,7 +152364,12 @@ async function preview(accountId, args, config22, buildResult, assetsOptions, ca
152086
152364
  );
152087
152365
  } else {
152088
152366
  logger.log(
152089
- formatPreviewDeploymentSummary(previewResource, deployment, isNewPreview)
152367
+ formatPreviewDeploymentSummary(
152368
+ previewResource,
152369
+ deployment,
152370
+ isNewPreview,
152371
+ pullRequest
152372
+ )
152090
152373
  );
152091
152374
  const topLevelBindings = getBindings(config22);
152092
152375
  if (Object.keys(topLevelBindings).length > 0) {
@@ -152383,14 +152666,14 @@ async function previewSettingsUpdate(accountId, args, config22) {
152383
152666
  );
152384
152667
  logger.log(formatPreviewsSettings(workerName, updatedPreviewDefaults));
152385
152668
  }
152386
- var import_undici5, import_dotenv, require_ignore, require_heap, require_heap2, require_difflib, require_difflib2, require_util9, require_styles2, require_has_flag2, require_supports_colors2, require_trap2, require_zalgo2, require_america2, require_zebra2, require_rainbow2, require_random2, require_colors2, require_safe2, require_colorize, require_lib4, ApplicationRollout2, BadRequestWithCodeError2, CreateApplicationRolloutRequest2, DeploymentNotFoundError2, ImageRegistryAlreadyExistsError2, ImageRegistryIsPublic2, ImageRegistryNotAllowedError2, ImageRegistryNotFoundError2, ImageRegistryProtocolAlreadyExists2, ImageRegistryProtocolIsReferencedError2, ImageRegistryProtocolNotFound2, ProvisionerConfiguration2, RolloutStep2, SecretNameAlreadyExists2, SecretNotFound2, SSHPublicKeyNotFoundError2, UpdateApplicationRolloutRequest2, runDockerCmd2, isDockerRunning2, verifyDockerInstalled2, INVALID_INHERIT_BINDING_CODE, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, CHANGE_MARKERS, PLAN_RETRY_WORKER_NOT_FOUND_CODE, PLAN_RETRY_TIMEOUT_MS, PLAN_RETRY_DELAY_MS, NON_INTERACTIVE_PROGRESS_INTERVAL, APPLY_ZONE_CONCURRENCY, RESET_CATCH_ALL_BODY, queuesUrl, MAX_ROUTES_RULES, MAX_ROUTES_RULE_LENGTH, formatInvalidRoutes, MAX_ASSET_SIZE, CF_ASSETS_IGNORE_FILENAME, REDIRECTS_FILENAME, HEADERS_FILENAME, import_ignore, types, other_default, types2, standard_default, __classPrivateFieldGet7, _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions, Mime, Mime_default, src_default, normalizeFilePath, getContentType, hashFile, decodeJwtPayload, isJwtExpired, BULK_UPLOAD_CONCURRENCY, EDGE_KV_UPLOAD_CONCURRENCY, MAX_UPLOAD_ATTEMPTS, MAX_UPLOAD_GATEWAY_ERRORS, MAX_DIFF_LINES, syncAssets, buildAssetManifest, WORKER_JS_FILENAME, ONE_KIB_BYTES, MAX_GZIP_SIZE_BYTES, BLANK_INPUT, suppressNotFoundError, esm_default5, MAX_PACKAGE_DEPENDENCIES, isConnectedStatusExplained, ProvisionResourceHandler, R2Handler, AISearchNamespaceHandler, AgentMemoryNamespaceHandler, QueueHandler, DispatchNamespaceHandler, FlagshipHandler, KVHandler, D1Handler, HANDLERS, external_exports2, core_exports22, _a5, NEVER2, $brand2, $ZodAsyncError2, $ZodEncodeError2, globalConfig2, util_exports2, EVALUATING2, captureStackTrace2, allowsEval2, getParsedType2, propertyKeyTypes2, primitiveTypes2, NUMBER_FORMAT_RANGES2, BIGINT_FORMAT_RANGES2, Class3, initializer3, $ZodError2, $ZodRealError2, _parse2, parse6, _parseAsync2, parseAsync3, _safeParse2, safeParse3, _safeParseAsync2, safeParseAsync3, _encode2, encode4, _decode2, decode3, _encodeAsync2, encodeAsync3, _decodeAsync2, decodeAsync3, _safeEncode2, safeEncode3, _safeDecode2, safeDecode3, _safeEncodeAsync2, safeEncodeAsync3, _safeDecodeAsync2, safeDecodeAsync3, regexes_exports2, cuid4, cuid23, ulid3, xid3, ksuid3, nanoid3, duration3, extendedDuration2, guid3, uuid3, uuid43, uuid62, uuid72, email3, html5Email2, rfc5322Email2, unicodeEmail2, idnEmail2, browserEmail2, _emoji3, ipv43, ipv63, mac3, cidrv43, cidrv63, base644, base64url3, hostname3, domain2, httpProtocol2, e1643, dateSource2, date5, string4, bigint4, integer2, number4, boolean4, _null4, _undefined4, lowercase2, uppercase2, hex3, md5_hex2, md5_base642, md5_base64url2, sha1_hex2, sha1_base642, sha1_base64url2, sha256_hex2, sha256_base642, sha256_base64url2, sha384_hex2, sha384_base642, sha384_base64url2, sha512_hex2, sha512_base642, sha512_base64url2, $ZodCheck2, numericOriginMap2, $ZodCheckLessThan2, $ZodCheckGreaterThan2, $ZodCheckMultipleOf2, $ZodCheckNumberFormat2, $ZodCheckBigIntFormat2, $ZodCheckMaxSize2, $ZodCheckMinSize2, $ZodCheckSizeEquals2, $ZodCheckMaxLength2, $ZodCheckMinLength2, $ZodCheckLengthEquals2, $ZodCheckStringFormat2, $ZodCheckRegex2, $ZodCheckLowerCase2, $ZodCheckUpperCase2, $ZodCheckIncludes2, $ZodCheckStartsWith2, $ZodCheckEndsWith2, $ZodCheckProperty2, $ZodCheckMimeType2, $ZodCheckOverwrite2, Doc2, version3, $ZodType2, $ZodString2, $ZodStringFormat2, $ZodGUID2, $ZodUUID2, $ZodEmail2, $ZodURL2, $ZodEmoji2, $ZodNanoID2, $ZodCUID3, $ZodCUID22, $ZodULID2, $ZodXID2, $ZodKSUID2, $ZodISODateTime2, $ZodISODate2, $ZodISOTime2, $ZodISODuration2, $ZodIPv42, $ZodIPv62, $ZodMAC2, $ZodCIDRv42, $ZodCIDRv62, $ZodBase642, $ZodBase64URL2, $ZodE1642, $ZodJWT2, $ZodCustomStringFormat2, $ZodNumber2, $ZodNumberFormat2, $ZodBoolean2, $ZodBigInt2, $ZodBigIntFormat2, $ZodSymbol2, $ZodUndefined2, $ZodNull2, $ZodAny2, $ZodUnknown2, $ZodNever2, $ZodVoid2, $ZodDate2, $ZodArray2, $ZodObject2, $ZodObjectJIT2, $ZodUnion2, $ZodXor2, $ZodDiscriminatedUnion2, $ZodIntersection2, $ZodTuple2, $ZodRecord2, $ZodMap2, $ZodSet2, $ZodEnum2, $ZodLiteral2, $ZodFile2, $ZodTransform2, $ZodOptional2, $ZodExactOptional2, $ZodNullable2, $ZodDefault2, $ZodPrefault2, $ZodNonOptional2, $ZodSuccess2, $ZodCatch2, $ZodNaN2, $ZodPipe2, $ZodCodec2, $ZodPreprocess2, $ZodReadonly2, $ZodTemplateLiteral2, $ZodFunction2, $ZodPromise2, $ZodLazy2, $ZodCustom2, locales_exports2, error52, error210, error310, error410, error53, error62, error72, error82, error92, error102, error112, error122, error132, error142, error152, error162, error172, error182, error192, error202, error212, error222, error232, error242, error252, error262, error272, capitalizeFirstCharacter2, error282, error292, error302, error312, error322, error332, error342, error352, error362, error372, error382, error392, error402, error412, error422, error432, error442, error452, error462, error472, error482, error492, error502, _a22, $output2, $input2, $ZodRegistry2, globalRegistry2, TimePrecision2, createToJSONSchemaMethod2, createStandardJSONSchemaMethod2, formatMap2, stringProcessor2, numberProcessor2, booleanProcessor2, bigintProcessor2, symbolProcessor2, nullProcessor2, undefinedProcessor2, voidProcessor2, neverProcessor2, anyProcessor2, unknownProcessor2, dateProcessor2, enumProcessor2, literalProcessor2, nanProcessor2, templateLiteralProcessor2, fileProcessor2, successProcessor2, customProcessor2, functionProcessor2, transformProcessor2, mapProcessor2, setProcessor2, arrayProcessor2, objectProcessor2, unionProcessor2, intersectionProcessor2, tupleProcessor2, recordProcessor2, nullableProcessor2, nonoptionalProcessor2, defaultProcessor2, prefaultProcessor2, catchProcessor2, pipeProcessor2, readonlyProcessor2, promiseProcessor2, optionalProcessor2, lazyProcessor2, allProcessors2, JSONSchemaGenerator2, json_schema_exports2, schemas_exports22, checks_exports22, iso_exports2, ZodISODateTime2, ZodISODate2, ZodISOTime2, ZodISODuration2, initializer22, ZodError2, ZodRealError2, parse23, parseAsync22, safeParse22, safeParseAsync22, encode22, decode22, encodeAsync22, decodeAsync22, safeEncode22, safeDecode22, safeEncodeAsync22, safeDecodeAsync22, _installedGroups2, ZodType2, _ZodString2, ZodString2, ZodStringFormat2, ZodEmail2, ZodGUID2, ZodUUID2, ZodURL2, ZodEmoji2, ZodNanoID2, ZodCUID3, ZodCUID22, ZodULID2, ZodXID2, ZodKSUID2, ZodIPv42, ZodMAC2, ZodIPv62, ZodCIDRv42, ZodCIDRv62, ZodBase642, ZodBase64URL2, ZodE1642, ZodJWT2, ZodCustomStringFormat2, ZodNumber2, ZodNumberFormat2, ZodBoolean2, ZodBigInt2, ZodBigIntFormat2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodDate2, ZodArray2, ZodObject2, ZodUnion2, ZodXor2, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodEnum2, ZodLiteral2, ZodFile2, ZodTransform2, ZodOptional2, ZodExactOptional2, ZodNullable2, ZodDefault2, ZodPrefault2, ZodNonOptional2, ZodSuccess2, ZodCatch2, ZodNaN2, ZodPipe2, ZodCodec2, ZodPreprocess2, ZodReadonly2, ZodTemplateLiteral2, ZodLazy2, ZodPromise2, ZodFunction2, ZodCustom2, describe22, meta22, stringbool2, ZodIssueCode2, ZodFirstPartyTypeKind2, z3, RECOGNIZED_KEYS2, coerce_exports2, InternalConfigSchema, StaticRoutingSchema, MetadataStaticRedirectEntry, MetadataRedirectEntry, MetadataStaticRedirects, MetadataRedirects, MetadataHeaderEntry, MetadataHeaders, RedirectsSchema, HeadersSchema, sourceMappingPrepareStackTrace, retrieveSourceMapOverride, placeholderError, CALL_SITE_REGEXP, CallSite, WORKFLOW_NOT_FOUND_CODE, import_json_diff, reorderableBindings, getCloudflareAccountIdFromEnv2, validateRoutes2, SHORT_HASH_LENGTH, MAX_DNS_LABEL_LENGTH, HASH_LENGTH, ALIAS_VALIDATION_REGEX, MAX_CONTAINER_APP_NAME_LENGTH, BOX, CONFIG_MARKER;
152669
+ var import_undici5, import_dotenv, require_ignore, require_heap, require_heap2, require_difflib, require_difflib2, require_util9, require_styles2, require_has_flag2, require_supports_colors2, require_trap2, require_zalgo2, require_america2, require_zebra2, require_rainbow2, require_random2, require_colors2, require_safe2, require_colorize, require_lib4, ApplicationRollout2, BadRequestWithCodeError2, CreateApplicationRolloutRequest2, DeploymentNotFoundError2, ImageRegistryAlreadyExistsError2, ImageRegistryIsPublic2, ImageRegistryNotAllowedError2, ImageRegistryNotFoundError2, ImageRegistryProtocolAlreadyExists2, ImageRegistryProtocolIsReferencedError2, ImageRegistryProtocolNotFound2, ProvisionerConfiguration2, RolloutStep2, SecretNameAlreadyExists2, SecretNotFound2, SSHPublicKeyNotFoundError2, UpdateApplicationRolloutRequest2, runDockerCmd2, isDockerRunning2, verifyDockerInstalled2, INVALID_INHERIT_BINDING_CODE, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, CHANGE_MARKERS, PLAN_RETRY_WORKER_NOT_FOUND_CODE, PLAN_RETRY_TIMEOUT_MS, PLAN_RETRY_DELAY_MS, NON_INTERACTIVE_PROGRESS_INTERVAL, APPLY_ZONE_CONCURRENCY, RESET_CATCH_ALL_BODY, queuesUrl, MAX_ROUTES_RULES, MAX_ROUTES_RULE_LENGTH, formatInvalidRoutes, MAX_ASSET_SIZE, CF_ASSETS_IGNORE_FILENAME, REDIRECTS_FILENAME, HEADERS_FILENAME, import_ignore, types, other_default, types2, standard_default, __classPrivateFieldGet7, _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions, Mime, Mime_default, src_default, normalizeFilePath, getContentType, hashFile, decodeJwtPayload, isJwtExpired, BULK_UPLOAD_CONCURRENCY, EDGE_KV_UPLOAD_CONCURRENCY, MAX_UPLOAD_ATTEMPTS, MAX_UPLOAD_GATEWAY_ERRORS, MAX_DIFF_LINES, syncAssets, buildAssetManifest, WORKER_JS_FILENAME, ONE_KIB_BYTES, MAX_GZIP_SIZE_BYTES, BLANK_INPUT, suppressNotFoundError, esm_default5, MAX_PACKAGE_DEPENDENCIES, isConnectedStatusExplained, ProvisionResourceHandler, R2Handler, AISearchNamespaceHandler, AgentMemoryNamespaceHandler, QueueHandler, DispatchNamespaceHandler, FlagshipHandler, KVHandler, D1Handler, HANDLERS, external_exports2, core_exports22, _a5, NEVER2, $brand2, $ZodAsyncError2, $ZodEncodeError2, globalConfig2, util_exports2, EVALUATING2, captureStackTrace2, allowsEval2, getParsedType2, propertyKeyTypes2, primitiveTypes2, NUMBER_FORMAT_RANGES2, BIGINT_FORMAT_RANGES2, Class3, initializer3, $ZodError2, $ZodRealError2, _parse2, parse6, _parseAsync2, parseAsync3, _safeParse2, safeParse3, _safeParseAsync2, safeParseAsync3, _encode2, encode4, _decode2, decode3, _encodeAsync2, encodeAsync3, _decodeAsync2, decodeAsync3, _safeEncode2, safeEncode3, _safeDecode2, safeDecode3, _safeEncodeAsync2, safeEncodeAsync3, _safeDecodeAsync2, safeDecodeAsync3, regexes_exports2, cuid4, cuid23, ulid3, xid3, ksuid3, nanoid3, duration3, extendedDuration2, guid3, uuid3, uuid43, uuid62, uuid72, email3, html5Email2, rfc5322Email2, unicodeEmail2, idnEmail2, browserEmail2, _emoji3, ipv43, ipv63, mac3, cidrv43, cidrv63, base644, base64url3, hostname3, domain2, httpProtocol2, e1643, dateSource2, date5, string4, bigint4, integer2, number4, boolean4, _null4, _undefined4, lowercase2, uppercase2, hex3, md5_hex2, md5_base642, md5_base64url2, sha1_hex2, sha1_base642, sha1_base64url2, sha256_hex2, sha256_base642, sha256_base64url2, sha384_hex2, sha384_base642, sha384_base64url2, sha512_hex2, sha512_base642, sha512_base64url2, $ZodCheck2, numericOriginMap2, $ZodCheckLessThan2, $ZodCheckGreaterThan2, $ZodCheckMultipleOf2, $ZodCheckNumberFormat2, $ZodCheckBigIntFormat2, $ZodCheckMaxSize2, $ZodCheckMinSize2, $ZodCheckSizeEquals2, $ZodCheckMaxLength2, $ZodCheckMinLength2, $ZodCheckLengthEquals2, $ZodCheckStringFormat2, $ZodCheckRegex2, $ZodCheckLowerCase2, $ZodCheckUpperCase2, $ZodCheckIncludes2, $ZodCheckStartsWith2, $ZodCheckEndsWith2, $ZodCheckProperty2, $ZodCheckMimeType2, $ZodCheckOverwrite2, Doc2, version3, $ZodType2, $ZodString2, $ZodStringFormat2, $ZodGUID2, $ZodUUID2, $ZodEmail2, $ZodURL2, $ZodEmoji2, $ZodNanoID2, $ZodCUID3, $ZodCUID22, $ZodULID2, $ZodXID2, $ZodKSUID2, $ZodISODateTime2, $ZodISODate2, $ZodISOTime2, $ZodISODuration2, $ZodIPv42, $ZodIPv62, $ZodMAC2, $ZodCIDRv42, $ZodCIDRv62, $ZodBase642, $ZodBase64URL2, $ZodE1642, $ZodJWT2, $ZodCustomStringFormat2, $ZodNumber2, $ZodNumberFormat2, $ZodBoolean2, $ZodBigInt2, $ZodBigIntFormat2, $ZodSymbol2, $ZodUndefined2, $ZodNull2, $ZodAny2, $ZodUnknown2, $ZodNever2, $ZodVoid2, $ZodDate2, $ZodArray2, $ZodObject2, $ZodObjectJIT2, $ZodUnion2, $ZodXor2, $ZodDiscriminatedUnion2, $ZodIntersection2, $ZodTuple2, $ZodRecord2, $ZodMap2, $ZodSet2, $ZodEnum2, $ZodLiteral2, $ZodFile2, $ZodTransform2, $ZodOptional2, $ZodExactOptional2, $ZodNullable2, $ZodDefault2, $ZodPrefault2, $ZodNonOptional2, $ZodSuccess2, $ZodCatch2, $ZodNaN2, $ZodPipe2, $ZodCodec2, $ZodPreprocess2, $ZodReadonly2, $ZodTemplateLiteral2, $ZodFunction2, $ZodPromise2, $ZodLazy2, $ZodCustom2, locales_exports2, error52, error210, error310, error410, error53, error62, error72, error82, error92, error102, error112, error122, error132, error142, error152, error162, error172, error182, error192, error202, error212, error222, error232, error242, error252, error262, error272, capitalizeFirstCharacter2, error282, error292, error302, error312, error322, error332, error342, error352, error362, error372, error382, error392, error402, error412, error422, error432, error442, error452, error462, error472, error482, error492, error502, _a22, $output2, $input2, $ZodRegistry2, globalRegistry2, TimePrecision2, createToJSONSchemaMethod2, createStandardJSONSchemaMethod2, formatMap2, stringProcessor2, numberProcessor2, booleanProcessor2, bigintProcessor2, symbolProcessor2, nullProcessor2, undefinedProcessor2, voidProcessor2, neverProcessor2, anyProcessor2, unknownProcessor2, dateProcessor2, enumProcessor2, literalProcessor2, nanProcessor2, templateLiteralProcessor2, fileProcessor2, successProcessor2, customProcessor2, functionProcessor2, transformProcessor2, mapProcessor2, setProcessor2, arrayProcessor2, objectProcessor2, unionProcessor2, intersectionProcessor2, tupleProcessor2, recordProcessor2, nullableProcessor2, nonoptionalProcessor2, defaultProcessor2, prefaultProcessor2, catchProcessor2, pipeProcessor2, readonlyProcessor2, promiseProcessor2, optionalProcessor2, lazyProcessor2, allProcessors2, JSONSchemaGenerator2, json_schema_exports2, schemas_exports22, checks_exports22, iso_exports2, ZodISODateTime2, ZodISODate2, ZodISOTime2, ZodISODuration2, initializer22, ZodError2, ZodRealError2, parse23, parseAsync22, safeParse22, safeParseAsync22, encode22, decode22, encodeAsync22, decodeAsync22, safeEncode22, safeDecode22, safeEncodeAsync22, safeDecodeAsync22, _installedGroups2, ZodType2, _ZodString2, ZodString2, ZodStringFormat2, ZodEmail2, ZodGUID2, ZodUUID2, ZodURL2, ZodEmoji2, ZodNanoID2, ZodCUID3, ZodCUID22, ZodULID2, ZodXID2, ZodKSUID2, ZodIPv42, ZodMAC2, ZodIPv62, ZodCIDRv42, ZodCIDRv62, ZodBase642, ZodBase64URL2, ZodE1642, ZodJWT2, ZodCustomStringFormat2, ZodNumber2, ZodNumberFormat2, ZodBoolean2, ZodBigInt2, ZodBigIntFormat2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodDate2, ZodArray2, ZodObject2, ZodUnion2, ZodXor2, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodEnum2, ZodLiteral2, ZodFile2, ZodTransform2, ZodOptional2, ZodExactOptional2, ZodNullable2, ZodDefault2, ZodPrefault2, ZodNonOptional2, ZodSuccess2, ZodCatch2, ZodNaN2, ZodPipe2, ZodCodec2, ZodPreprocess2, ZodReadonly2, ZodTemplateLiteral2, ZodLazy2, ZodPromise2, ZodFunction2, ZodCustom2, describe22, meta22, stringbool2, ZodIssueCode2, ZodFirstPartyTypeKind2, z3, RECOGNIZED_KEYS2, coerce_exports2, InternalConfigSchema, StaticRoutingSchema, MetadataStaticRedirectEntry, MetadataRedirectEntry, MetadataStaticRedirects, MetadataRedirects, MetadataHeaderEntry, MetadataHeaders, RedirectsSchema, HeadersSchema, sourceMappingPrepareStackTrace, retrieveSourceMapOverride, placeholderError, CALL_SITE_REGEXP, CallSite, WORKFLOW_NOT_FOUND_CODE, import_json_diff, reorderableBindings, getCloudflareAccountIdFromEnv2, validateRoutes2, SHORT_HASH_LENGTH, MAX_DNS_LABEL_LENGTH, HASH_LENGTH, ALIAS_VALIDATION_REGEX, MAX_CONTAINER_APP_NAME_LENGTH, NO_ACTIVE_PREVIEW_URLS_MESSAGE, BOX, CONFIG_MARKER;
152387
152670
  var init_dist8 = __esm({
152388
152671
  "../deploy-helpers/dist/index.mjs"() {
152389
152672
  init_import_meta_url();
152390
152673
  init_chunk_Z4LB73IF();
152391
152674
  init_chunk_Z4LB73IF();
152392
- init_chunk_LRKPOFWK();
152393
- init_chunk_LRKPOFWK();
152675
+ init_chunk_ZV7SJ2MZ();
152676
+ init_chunk_ZV7SJ2MZ();
152394
152677
  init_chunk_Q72B4Q5Z2();
152395
152678
  init_dist3();
152396
152679
  init_dist3();
@@ -169559,6 +169842,8 @@ ${mountedAssetRoutes.map((route) => {
169559
169842
  __name3(deletePreview, "deletePreview");
169560
169843
  __name(getPreviewDeployment, "getPreviewDeployment");
169561
169844
  __name3(getPreviewDeployment, "getPreviewDeployment");
169845
+ __name(createPreviewDeploymentForm, "createPreviewDeploymentForm");
169846
+ __name3(createPreviewDeploymentForm, "createPreviewDeploymentForm");
169562
169847
  __name(createPreviewDeployment, "createPreviewDeployment");
169563
169848
  __name3(createPreviewDeployment, "createPreviewDeployment");
169564
169849
  __name(patchPreviewDeployment, "patchPreviewDeployment");
@@ -169580,6 +169865,24 @@ ${mountedAssetRoutes.map((route) => {
169580
169865
  __name3(getHeadCommitRef, "getHeadCommitRef");
169581
169866
  __name(getHeadCommitMessage, "getHeadCommitMessage");
169582
169867
  __name3(getHeadCommitMessage, "getHeadCommitMessage");
169868
+ __name(getCommitSha, "getCommitSha");
169869
+ __name3(getCommitSha, "getCommitSha");
169870
+ __name(normalizeRepositoryUrl, "normalizeRepositoryUrl");
169871
+ __name3(normalizeRepositoryUrl, "normalizeRepositoryUrl");
169872
+ __name(getRepositoryUrl, "getRepositoryUrl");
169873
+ __name3(getRepositoryUrl, "getRepositoryUrl");
169874
+ __name(normalizePullRequestNumber, "normalizePullRequestNumber");
169875
+ __name3(normalizePullRequestNumber, "normalizePullRequestNumber");
169876
+ __name(normalizePullRequestTitle, "normalizePullRequestTitle");
169877
+ __name3(normalizePullRequestTitle, "normalizePullRequestTitle");
169878
+ __name(getGitHubPullRequestMetadata, "getGitHubPullRequestMetadata");
169879
+ __name3(getGitHubPullRequestMetadata, "getGitHubPullRequestMetadata");
169880
+ __name(getGitLabPullRequestMetadata, "getGitLabPullRequestMetadata");
169881
+ __name3(getGitLabPullRequestMetadata, "getGitLabPullRequestMetadata");
169882
+ __name(getDirectPullRequestMetadata, "getDirectPullRequestMetadata");
169883
+ __name3(getDirectPullRequestMetadata, "getDirectPullRequestMetadata");
169884
+ __name(getPullRequestMetadata, "getPullRequestMetadata");
169885
+ __name3(getPullRequestMetadata, "getPullRequestMetadata");
169583
169886
  __name(resolveWorkerName, "resolveWorkerName");
169584
169887
  __name3(resolveWorkerName, "resolveWorkerName");
169585
169888
  __name(getBindingValue, "getBindingValue");
@@ -169600,8 +169903,7 @@ ${mountedAssetRoutes.map((route) => {
169600
169903
  __name3(buildPreviewContainerConfig, "buildPreviewContainerConfig");
169601
169904
  __name(prepareContainersForPreview, "prepareContainersForPreview");
169602
169905
  __name3(prepareContainersForPreview, "prepareContainersForPreview");
169603
- __name(toBase64, "toBase64");
169604
- __name3(toBase64, "toBase64");
169906
+ NO_ACTIVE_PREVIEW_URLS_MESSAGE = "Note: This Preview deployment has no active URLs. To get one, enable Preview Deployments on workers.dev or a custom domain. See https://developers.cloudflare.com/workers/previews/custom-domains/ for more information";
169605
169907
  __name(getPreviewMigrationsToUpload, "getPreviewMigrationsToUpload");
169606
169908
  __name3(getPreviewMigrationsToUpload, "getPreviewMigrationsToUpload");
169607
169909
  __name(buildResultToDeploymentModules, "buildResultToDeploymentModules");
@@ -179926,6 +180228,12 @@ function buildMiniflareBindingOptions(config6, remoteProxyConnectionString) {
179926
180228
  { telemetryMessage: "workflow limits on external script" }
179927
180229
  );
179928
180230
  }
180231
+ if (workflow.concurrency) {
180232
+ throw new UserError(
180233
+ `Workflow "${workflow.name}" has "concurrency" configured but references external script "${workflow.script_name}". Configure concurrency on the worker that defines the workflow.`,
180234
+ { telemetryMessage: "workflow concurrency on external script" }
180235
+ );
180236
+ }
179929
180237
  if (workflow.schedules) {
179930
180238
  throw new UserError(
179931
180239
  `Workflow "${workflow.name}" has "schedules" configured but references external script "${workflow.script_name}". Configure schedules on the worker that defines the workflow.`,
@@ -180633,7 +180941,7 @@ var CF_KEYRING_SERVICE_NAME, CF_CLI_NAME, CF_DISPLAY_NAME, CF_OAUTH_CALLBACK_URL
180633
180941
  var init_cf = __esm({
180634
180942
  "../workers-auth/dist/cf/index.mjs"() {
180635
180943
  init_import_meta_url();
180636
- init_chunk_X7ZLU22G();
180944
+ init_chunk_YCVYA5LL();
180637
180945
  init_chunk_O6YSETKJ();
180638
180946
  init_dist();
180639
180947
  CF_KEYRING_SERVICE_NAME = "cloudflare";
@@ -184589,7 +184897,7 @@ var init_wrapper = __esm({
184589
184897
  var init_create_worker_upload_form = __esm({
184590
184898
  "../deploy-helpers/dist/create-worker-upload-form.mjs"() {
184591
184899
  init_import_meta_url();
184592
- init_chunk_LRKPOFWK();
184900
+ init_chunk_ZV7SJ2MZ();
184593
184901
  }
184594
184902
  });
184595
184903
  function createRemoteBindingsAuth(logger$1) {
@@ -185016,7 +185324,7 @@ var init_dist12 = __esm({
185016
185324
  init_wrapper();
185017
185325
  init_create_worker_upload_form();
185018
185326
  import_undici8 = __toESM(require_undici(), 1);
185019
- version4 = "0.0.14";
185327
+ version4 = "0.0.16";
185020
185328
  NoDefaultValueProvided2 = class extends UserError {
185021
185329
  static {
185022
185330
  __name(this, "NoDefaultValueProvided");
@@ -201157,6 +201465,9 @@ function validateSingletonBindings(env7, ctx) {
201157
201465
  message: `${listFormatter.format([...duplicates].sort())} bindings can only be defined once`
201158
201466
  });
201159
201467
  }
201468
+ function invalidConfigExportMessage(exportName) {
201469
+ return `The \`${exportName}\` export is not a supported export type. Move constants, helper functions, and other unsupported exports to a separate module.`;
201470
+ }
201160
201471
  function generateTypes({ configPath, packageName = "@cloudflare/config" }) {
201161
201472
  return import_dist.dedent`
201162
201473
  /* eslint-disable */
@@ -203335,27 +203646,27 @@ function convertBindingsAndAssets(config6, result) {
203335
203646
  agentMemory.push(omitUndefined({
203336
203647
  binding: name2,
203337
203648
  namespace: binding.namespace,
203338
- remote: binding.remote
203649
+ remote: binding.dev?.remote
203339
203650
  }));
203340
203651
  break;
203341
203652
  case "ai":
203342
203653
  result.ai = omitUndefined({
203343
203654
  binding: name2,
203344
- remote: binding.remote
203655
+ remote: binding.dev?.remote
203345
203656
  });
203346
203657
  break;
203347
203658
  case "ai-search":
203348
203659
  aiSearch.push(omitUndefined({
203349
203660
  binding: name2,
203350
203661
  instance_name: binding.name,
203351
- remote: binding.remote
203662
+ remote: binding.dev?.remote
203352
203663
  }));
203353
203664
  break;
203354
203665
  case "ai-search-namespace":
203355
203666
  aiSearchNamespaces.push(omitUndefined({
203356
203667
  binding: name2,
203357
203668
  namespace: binding.namespace,
203358
- remote: binding.remote
203669
+ remote: binding.dev?.remote
203359
203670
  }));
203360
203671
  break;
203361
203672
  case "analytics-engine-dataset":
@@ -203368,7 +203679,7 @@ function convertBindingsAndAssets(config6, result) {
203368
203679
  artifacts.push(omitUndefined({
203369
203680
  binding: name2,
203370
203681
  namespace: binding.namespace,
203371
- remote: binding.remote
203682
+ remote: binding.dev?.remote
203372
203683
  }));
203373
203684
  break;
203374
203685
  case "assets":
@@ -203377,7 +203688,7 @@ function convertBindingsAndAssets(config6, result) {
203377
203688
  case "browser":
203378
203689
  result.browser = omitUndefined({
203379
203690
  binding: name2,
203380
- remote: binding.remote
203691
+ remote: binding.dev?.remote
203381
203692
  });
203382
203693
  break;
203383
203694
  case "d1":
@@ -203385,7 +203696,7 @@ function convertBindingsAndAssets(config6, result) {
203385
203696
  binding: name2,
203386
203697
  database_id: binding.id,
203387
203698
  database_name: binding.name,
203388
- remote: binding.remote
203699
+ remote: binding.dev?.remote
203389
203700
  }));
203390
203701
  break;
203391
203702
  case "dispatch-namespace": {
@@ -203397,7 +203708,7 @@ function convertBindingsAndAssets(config6, result) {
203397
203708
  service: binding.outbound.workerName,
203398
203709
  parameters: binding.outbound.parameters
203399
203710
  });
203400
- if (binding.remote !== void 0) entry.remote = binding.remote;
203711
+ if (binding.dev?.remote !== void 0) entry.remote = binding.dev.remote;
203401
203712
  dispatchNamespaces.push(entry);
203402
203713
  break;
203403
203714
  }
@@ -203412,20 +203723,20 @@ function convertBindingsAndAssets(config6, result) {
203412
203723
  flagship.push(omitUndefined({
203413
203724
  binding: name2,
203414
203725
  app_id: binding.id,
203415
- remote: binding.remote
203726
+ remote: binding.dev?.remote
203416
203727
  }));
203417
203728
  break;
203418
203729
  case "hyperdrive":
203419
203730
  hyperdrive.push(omitUndefined({
203420
203731
  binding: name2,
203421
203732
  id: binding.id,
203422
- localConnectionString: binding.localConnectionString
203733
+ localConnectionString: binding.dev?.connectionString
203423
203734
  }));
203424
203735
  break;
203425
203736
  case "images":
203426
203737
  result.images = omitUndefined({
203427
203738
  binding: name2,
203428
- remote: binding.remote
203739
+ remote: binding.dev?.remote
203429
203740
  });
203430
203741
  break;
203431
203742
  case "json":
@@ -203435,7 +203746,7 @@ function convertBindingsAndAssets(config6, result) {
203435
203746
  kvNamespaces.push(omitUndefined({
203436
203747
  binding: name2,
203437
203748
  id: binding.id,
203438
- remote: binding.remote
203749
+ remote: binding.dev?.remote
203439
203750
  }));
203440
203751
  break;
203441
203752
  case "logfwdr":
@@ -203447,21 +203758,21 @@ function convertBindingsAndAssets(config6, result) {
203447
203758
  case "media":
203448
203759
  result.media = omitUndefined({
203449
203760
  binding: name2,
203450
- remote: binding.remote
203761
+ remote: binding.dev?.remote
203451
203762
  });
203452
203763
  break;
203453
203764
  case "mtls-certificate":
203454
203765
  mtlsCertificates.push(omitUndefined({
203455
203766
  binding: name2,
203456
203767
  certificate_id: binding.id,
203457
- remote: binding.remote
203768
+ remote: binding.dev?.remote
203458
203769
  }));
203459
203770
  break;
203460
203771
  case "pipeline":
203461
203772
  pipelines.push(omitUndefined({
203462
203773
  binding: name2,
203463
203774
  stream: binding.name,
203464
- remote: binding.remote
203775
+ remote: binding.dev?.remote
203465
203776
  }));
203466
203777
  break;
203467
203778
  case "queue":
@@ -203469,7 +203780,7 @@ function convertBindingsAndAssets(config6, result) {
203469
203780
  binding: name2,
203470
203781
  queue: binding.name,
203471
203782
  delivery_delay: binding.deliveryDelay,
203472
- remote: binding.remote
203783
+ remote: binding.dev?.remote
203473
203784
  }));
203474
203785
  break;
203475
203786
  case "rate-limit":
@@ -203480,12 +203791,12 @@ function convertBindingsAndAssets(config6, result) {
203480
203791
  });
203481
203792
  break;
203482
203793
  case "r2": {
203483
- const experimentalS3Credentials = binding.localDev?.experimentalS3Credentials;
203794
+ const experimentalS3Credentials = binding.dev?.experimentalS3Credentials;
203484
203795
  r2Buckets.push(omitUndefined({
203485
203796
  binding: name2,
203486
203797
  bucket_name: binding.name,
203487
203798
  jurisdiction: binding.jurisdiction,
203488
- remote: binding.remote,
203799
+ remote: binding.dev?.remote,
203489
203800
  local_dev: experimentalS3Credentials === void 0 ? void 0 : { experimental_s3_credentials: experimentalS3Credentials }
203490
203801
  }));
203491
203802
  break;
@@ -203506,13 +203817,13 @@ function convertBindingsAndAssets(config6, result) {
203506
203817
  destination_address: binding.destinationAddress,
203507
203818
  allowed_destination_addresses: binding.allowedDestinationAddresses,
203508
203819
  allowed_sender_addresses: binding.allowedSenderAddresses,
203509
- remote: binding.remote
203820
+ remote: binding.dev?.remote
203510
203821
  }));
203511
203822
  break;
203512
203823
  case "stream":
203513
203824
  result.stream = omitUndefined({
203514
203825
  binding: name2,
203515
- remote: binding.remote
203826
+ remote: binding.dev?.remote
203516
203827
  });
203517
203828
  break;
203518
203829
  case "text":
@@ -203522,7 +203833,7 @@ function convertBindingsAndAssets(config6, result) {
203522
203833
  vectorize.push(omitUndefined({
203523
203834
  binding: name2,
203524
203835
  index_name: binding.name,
203525
- remote: binding.remote
203836
+ remote: binding.dev?.remote
203526
203837
  }));
203527
203838
  break;
203528
203839
  case "version-metadata":
@@ -203532,25 +203843,25 @@ function convertBindingsAndAssets(config6, result) {
203532
203843
  vpcServices.push(omitUndefined({
203533
203844
  binding: name2,
203534
203845
  service_id: binding.id,
203535
- remote: binding.remote
203846
+ remote: binding.dev?.remote
203536
203847
  }));
203537
203848
  break;
203538
203849
  case "vpc-network":
203539
203850
  if (binding.tunnelId !== void 0) vpcNetworks.push(omitUndefined({
203540
203851
  binding: name2,
203541
203852
  tunnel_id: binding.tunnelId,
203542
- remote: binding.remote
203853
+ remote: binding.dev?.remote
203543
203854
  }));
203544
203855
  else if (binding.networkId !== void 0) vpcNetworks.push(omitUndefined({
203545
203856
  binding: name2,
203546
203857
  network_id: binding.networkId,
203547
- remote: binding.remote
203858
+ remote: binding.dev?.remote
203548
203859
  }));
203549
203860
  break;
203550
203861
  case "web-search":
203551
203862
  result.websearch = omitUndefined({
203552
203863
  binding: name2,
203553
- remote: binding.remote
203864
+ remote: binding.dev?.remote
203554
203865
  });
203555
203866
  break;
203556
203867
  case "worker":
@@ -203559,7 +203870,7 @@ function convertBindingsAndAssets(config6, result) {
203559
203870
  service: binding.workerName,
203560
203871
  entrypoint: binding.exportName,
203561
203872
  props: binding.props,
203562
- remote: binding.remote
203873
+ remote: binding.dev?.remote
203563
203874
  }));
203564
203875
  break;
203565
203876
  case "worker-loader":
@@ -203832,7 +204143,7 @@ async function loadAndValidateConfig(configPath, ctx, options) {
203832
204143
  dependencies
203833
204144
  };
203834
204145
  }
203835
- var __getOwnPropNames4, __commonJS4, AssetsSchema, BrowserBindingSchema, WorkerBindingSchema, D1BindingSchema, KVBindingSchema, QueueBindingSchema, R2BindingSchema, AnalyticsEngineDatasetBindingSchema, FlagshipBindingSchema, HyperdriveBindingSchema, KnownBindingSchema, UnsafeBindingSchema, BindingSchema, CacheSchema, SINGLETON_BINDING_TYPES, listFormatter, EnvSchema, DurableObjectCreatedExportSchema, DurableObjectDeletedExportSchema, DurableObjectRenamedExportSchema, DurableObjectTransferredExportSchema, DurableObjectExpectingTransferExportSchema, WorkerEntrypointExportSchema, DurableObjectCreatedSqliteExportSchema, DurableObjectCreatedLegacyKvExportSchema, DurableObjectExpectingTransferSqliteExportSchema, DurableObjectExpectingTransferLegacyKvExportSchema, ExportSchema, LimitsSchema, ObservabilitySchema, PlacementSchema, TailConsumerSchema, TriggerSchema, UnsafeSchema, BaseWorkerSchema, InputWorkerSchema, SettingsSchema, ConfigExportSchema, SETTINGS_EXPORT_NAME, ConfigExportsSchema, ModuleTypeSchema, ManifestSchema, require_dist2, import_dist, __defProp5, __name5, UserError2, FatalError2, JsonFriendlyFatalError2, CharacterCodes2, ParseOptions2, ScanError2, SyntaxKind2, parse24, ParseErrorCode2, TomlError3, DATE_TIME_RE3, TomlDate3, INT_REGEX3, FLOAT_REGEX3, LEADING_ZERO3, ESCAPE_REGEX3, ESC_MAP3, KEY_PART_RE3, BARE_KEY3, dist_default5, ParseError2, units2, UNSUPPORTED_BOMS2, PATH_TO_DEPLOY_CONFIG2, esm_default6, CF_WORKER_SCHEME, CF_WORKER_TYPE, CF_ATTR, CF_NO_CACHE_VALUE, CF_NO_CACHE_QUERY_KEY, RE_NODE_MODULES, depsStore, deregister;
204146
+ var __getOwnPropNames4, __commonJS4, RemoteBindingDevSchema, AssetsSchema, BrowserBindingSchema, WorkerBindingSchema, D1BindingSchema, KVBindingSchema, QueueBindingSchema, R2BindingSchema, AnalyticsEngineDatasetBindingSchema, FlagshipBindingSchema, HyperdriveBindingSchema, KnownBindingSchema, UnsafeBindingSchema, BindingSchema, CacheSchema, SINGLETON_BINDING_TYPES, listFormatter, EnvSchema, DurableObjectCreatedExportSchema, DurableObjectDeletedExportSchema, DurableObjectRenamedExportSchema, DurableObjectTransferredExportSchema, DurableObjectExpectingTransferExportSchema, WorkerEntrypointExportSchema, DurableObjectCreatedSqliteExportSchema, DurableObjectCreatedLegacyKvExportSchema, DurableObjectExpectingTransferSqliteExportSchema, DurableObjectExpectingTransferLegacyKvExportSchema, ExportSchema, LimitsSchema, ObservabilitySchema, PlacementSchema, TailConsumerSchema, TriggerSchema, UnsafeSchema, BaseWorkerSchema, InputWorkerSchema, InputSettingsSchema, SETTINGS_EXPORT_NAME, SUPPORTED_EXPORT_TYPES, ConfigExportsTypeSchema, ConfigExportsObjectSchema, ConfigExportsSchema, ModuleTypeSchema, ManifestSchema, require_dist2, import_dist, __defProp5, __name5, UserError2, FatalError2, JsonFriendlyFatalError2, CharacterCodes2, ParseOptions2, ScanError2, SyntaxKind2, parse24, ParseErrorCode2, TomlError3, DATE_TIME_RE3, TomlDate3, INT_REGEX3, FLOAT_REGEX3, LEADING_ZERO3, ESCAPE_REGEX3, ESC_MAP3, KEY_PART_RE3, BARE_KEY3, dist_default5, ParseError2, units2, UNSUPPORTED_BOMS2, PATH_TO_DEPLOY_CONFIG2, esm_default6, CF_WORKER_SCHEME, CF_WORKER_TYPE, CF_ATTR, CF_NO_CACHE_VALUE, CF_NO_CACHE_QUERY_KEY, RE_NODE_MODULES, depsStore, deregister;
203836
204147
  var init_dist13 = __esm({
203837
204148
  "../config/dist/index.mjs"() {
203838
204149
  init_import_meta_url();
@@ -203842,6 +204153,7 @@ var init_dist13 = __esm({
203842
204153
  __commonJS4 = /* @__PURE__ */ __name((cb2, mod2) => function() {
203843
204154
  return mod2 || (0, cb2[__getOwnPropNames4(cb2)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
203844
204155
  }, "__commonJS");
204156
+ RemoteBindingDevSchema = strictObject3({ remote: boolean6().optional() });
203845
204157
  AssetsSchema = strictObject3({
203846
204158
  htmlHandling: _enum5([
203847
204159
  "auto-trailing-slash",
@@ -203858,38 +204170,37 @@ var init_dist13 = __esm({
203858
204170
  });
203859
204171
  BrowserBindingSchema = strictObject3({
203860
204172
  type: literal3("browser"),
203861
- remote: boolean6().optional()
204173
+ dev: RemoteBindingDevSchema.optional()
203862
204174
  });
203863
204175
  WorkerBindingSchema = strictObject3({
203864
204176
  type: literal3("worker"),
203865
204177
  workerName: string6(),
203866
204178
  exportName: string6().optional(),
203867
204179
  props: record3(string6(), unknown3()).optional(),
203868
- remote: boolean6().optional()
204180
+ dev: RemoteBindingDevSchema.optional()
203869
204181
  });
203870
204182
  D1BindingSchema = strictObject3({
203871
204183
  type: literal3("d1"),
203872
204184
  name: string6().optional(),
203873
204185
  id: string6().optional(),
203874
- remote: boolean6().optional()
204186
+ dev: RemoteBindingDevSchema.optional()
203875
204187
  });
203876
204188
  KVBindingSchema = strictObject3({
203877
204189
  type: literal3("kv"),
203878
204190
  id: string6().optional(),
203879
- remote: boolean6().optional()
204191
+ dev: RemoteBindingDevSchema.optional()
203880
204192
  });
203881
204193
  QueueBindingSchema = strictObject3({
203882
204194
  type: literal3("queue"),
203883
204195
  name: string6().optional(),
203884
204196
  deliveryDelay: number6().optional(),
203885
- remote: boolean6().optional()
204197
+ dev: RemoteBindingDevSchema.optional()
203886
204198
  });
203887
204199
  R2BindingSchema = strictObject3({
203888
204200
  type: literal3("r2"),
203889
204201
  name: string6().optional(),
203890
204202
  jurisdiction: string6().optional(),
203891
- remote: boolean6().optional(),
203892
- localDev: strictObject3({ experimentalS3Credentials: object3({
204203
+ dev: RemoteBindingDevSchema.extend({ experimentalS3Credentials: object3({
203893
204204
  accessKeyId: string6(),
203894
204205
  secretAccessKey: string6()
203895
204206
  }).optional() }).optional()
@@ -203901,38 +204212,38 @@ var init_dist13 = __esm({
203901
204212
  FlagshipBindingSchema = strictObject3({
203902
204213
  type: literal3("flagship"),
203903
204214
  id: string6().optional(),
203904
- remote: boolean6().optional()
204215
+ dev: RemoteBindingDevSchema.optional()
203905
204216
  });
203906
204217
  HyperdriveBindingSchema = strictObject3({
203907
204218
  type: literal3("hyperdrive"),
203908
204219
  id: string6(),
203909
- localConnectionString: string6().optional()
204220
+ dev: strictObject3({ connectionString: string6().optional() }).optional()
203910
204221
  });
203911
204222
  KnownBindingSchema = discriminatedUnion3("type", [
203912
204223
  strictObject3({
203913
204224
  type: literal3("agent-memory"),
203914
204225
  namespace: string6(),
203915
- remote: boolean6().optional()
204226
+ dev: RemoteBindingDevSchema.optional()
203916
204227
  }),
203917
204228
  strictObject3({
203918
204229
  type: literal3("ai"),
203919
- remote: boolean6().optional()
204230
+ dev: RemoteBindingDevSchema.optional()
203920
204231
  }),
203921
204232
  strictObject3({
203922
204233
  type: literal3("ai-search"),
203923
204234
  name: string6(),
203924
- remote: boolean6().optional()
204235
+ dev: RemoteBindingDevSchema.optional()
203925
204236
  }),
203926
204237
  strictObject3({
203927
204238
  type: literal3("ai-search-namespace"),
203928
204239
  namespace: string6(),
203929
- remote: boolean6().optional()
204240
+ dev: RemoteBindingDevSchema.optional()
203930
204241
  }),
203931
204242
  AnalyticsEngineDatasetBindingSchema,
203932
204243
  strictObject3({
203933
204244
  type: literal3("artifacts"),
203934
204245
  namespace: string6(),
203935
- remote: boolean6().optional()
204246
+ dev: RemoteBindingDevSchema.optional()
203936
204247
  }),
203937
204248
  strictObject3({ type: literal3("assets") }),
203938
204249
  BrowserBindingSchema,
@@ -203944,7 +204255,7 @@ var init_dist13 = __esm({
203944
204255
  workerName: string6(),
203945
204256
  parameters: array3(string6()).optional()
203946
204257
  }).optional(),
203947
- remote: boolean6().optional()
204258
+ dev: RemoteBindingDevSchema.optional()
203948
204259
  }),
203949
204260
  strictObject3({
203950
204261
  type: literal3("durable-object"),
@@ -203955,7 +204266,7 @@ var init_dist13 = __esm({
203955
204266
  HyperdriveBindingSchema,
203956
204267
  strictObject3({
203957
204268
  type: literal3("images"),
203958
- remote: boolean6().optional()
204269
+ dev: RemoteBindingDevSchema.optional()
203959
204270
  }),
203960
204271
  strictObject3({
203961
204272
  type: literal3("json"),
@@ -203968,17 +204279,17 @@ var init_dist13 = __esm({
203968
204279
  }),
203969
204280
  strictObject3({
203970
204281
  type: literal3("media"),
203971
- remote: boolean6().optional()
204282
+ dev: RemoteBindingDevSchema.optional()
203972
204283
  }),
203973
204284
  strictObject3({
203974
204285
  type: literal3("mtls-certificate"),
203975
204286
  id: string6(),
203976
- remote: boolean6().optional()
204287
+ dev: RemoteBindingDevSchema.optional()
203977
204288
  }),
203978
204289
  strictObject3({
203979
204290
  type: literal3("pipeline"),
203980
204291
  name: string6(),
203981
- remote: boolean6().optional()
204292
+ dev: RemoteBindingDevSchema.optional()
203982
204293
  }),
203983
204294
  QueueBindingSchema,
203984
204295
  strictObject3({
@@ -204001,11 +204312,11 @@ var init_dist13 = __esm({
204001
204312
  destinationAddress: string6().optional(),
204002
204313
  allowedDestinationAddresses: array3(string6()).optional(),
204003
204314
  allowedSenderAddresses: array3(string6()).optional(),
204004
- remote: boolean6().optional()
204005
- }),
204315
+ dev: RemoteBindingDevSchema.optional()
204316
+ }).refine((value) => value.destinationAddress === void 0 || value.allowedDestinationAddresses === void 0, { message: '"send-email" bindings cannot specify both "destinationAddress" and "allowedDestinationAddresses"' }),
204006
204317
  strictObject3({
204007
204318
  type: literal3("stream"),
204008
- remote: boolean6().optional()
204319
+ dev: RemoteBindingDevSchema.optional()
204009
204320
  }),
204010
204321
  strictObject3({
204011
204322
  type: literal3("text"),
@@ -204014,29 +204325,26 @@ var init_dist13 = __esm({
204014
204325
  strictObject3({
204015
204326
  type: literal3("vectorize"),
204016
204327
  name: string6(),
204017
- remote: boolean6().optional()
204328
+ dev: RemoteBindingDevSchema.optional()
204018
204329
  }),
204019
204330
  strictObject3({ type: literal3("version-metadata") }),
204020
204331
  strictObject3({
204021
204332
  type: literal3("vpc-service"),
204022
204333
  id: string6(),
204023
- remote: boolean6().optional()
204334
+ dev: RemoteBindingDevSchema.optional()
204024
204335
  }),
204025
204336
  strictObject3({
204026
204337
  type: literal3("vpc-network"),
204027
204338
  tunnelId: string6().optional(),
204028
204339
  networkId: string6().optional(),
204029
- remote: boolean6().optional()
204030
- }).superRefine((value, ctx) => {
204031
- const hasTunnel = value.tunnelId !== void 0;
204032
- if (hasTunnel === (value.networkId !== void 0)) ctx.addIssue({
204033
- code: "custom",
204034
- message: hasTunnel ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`
204035
- });
204036
- }),
204340
+ dev: RemoteBindingDevSchema.optional()
204341
+ }).refine((value) => value.tunnelId !== void 0 !== (value.networkId !== void 0), { error: /* @__PURE__ */ __name(({ input }) => {
204342
+ const value = input;
204343
+ return value.tunnelId !== void 0 && value.networkId !== void 0 ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`;
204344
+ }, "error") }),
204037
204345
  strictObject3({
204038
204346
  type: literal3("web-search"),
204039
- remote: boolean6().optional()
204347
+ dev: RemoteBindingDevSchema.optional()
204040
204348
  }),
204041
204349
  WorkerBindingSchema,
204042
204350
  strictObject3({ type: literal3("worker-loader") })
@@ -204231,17 +204539,30 @@ var init_dist13 = __esm({
204231
204539
  exports: record3(string6(), ExportSchema).optional()
204232
204540
  });
204233
204541
  InputWorkerSchema = BaseWorkerSchema.extend({ entrypoint: union3([string6(), strictObject3({ default: string6() })]).transform((value) => typeof value === "string" ? value : value.default).optional() });
204234
- SettingsSchema = strictObject3({
204542
+ InputSettingsSchema = strictObject3({
204235
204543
  type: literal3("settings"),
204236
204544
  accountId: string6().optional(),
204237
204545
  complianceRegion: _enum5(["public", "fedramp-high"]).optional()
204238
204546
  });
204239
- ConfigExportSchema = discriminatedUnion3("type", [InputWorkerSchema, SettingsSchema]);
204547
+ InputSettingsSchema.extend({ mode: string6().optional() });
204240
204548
  SETTINGS_EXPORT_NAME = "settings";
204241
- ConfigExportsSchema = record3(string6(), ConfigExportSchema).check((ctx) => {
204549
+ SUPPORTED_EXPORT_TYPES = /* @__PURE__ */ new Set(["worker", "settings"]);
204550
+ __name(invalidConfigExportMessage, "invalidConfigExportMessage");
204551
+ ConfigExportsTypeSchema = record3(string6(), unknown3()).check((ctx) => {
204242
204552
  for (const [key, value] of Object.entries(ctx.value)) {
204553
+ const isObject9 = typeof value === "object" && value !== null;
204554
+ const type = isObject9 && "type" in value ? value.type : void 0;
204555
+ if (typeof type !== "string" || !SUPPORTED_EXPORT_TYPES.has(type)) {
204556
+ ctx.issues.push({
204557
+ code: "custom",
204558
+ input: value,
204559
+ path: isObject9 ? [key, "type"] : [key],
204560
+ message: invalidConfigExportMessage(key)
204561
+ });
204562
+ continue;
204563
+ }
204243
204564
  const isSettingsName = key === SETTINGS_EXPORT_NAME;
204244
- const isSettingsType = value.type === "settings";
204565
+ const isSettingsType = type === "settings";
204245
204566
  if (isSettingsType && !isSettingsName) ctx.issues.push({
204246
204567
  code: "custom",
204247
204568
  input: value,
@@ -204252,10 +204573,12 @@ var init_dist13 = __esm({
204252
204573
  code: "custom",
204253
204574
  input: value,
204254
204575
  path: [key],
204255
- message: `The \`${SETTINGS_EXPORT_NAME}\` export is reserved for a \`settings\` config; found a \`${value.type}\` config.`
204576
+ message: `The \`${SETTINGS_EXPORT_NAME}\` export is reserved for a \`settings\` config; found a \`${type}\` config.`
204256
204577
  });
204257
204578
  }
204258
204579
  });
204580
+ ConfigExportsObjectSchema = object3({ settings: InputSettingsSchema.optional() }).catchall(InputWorkerSchema);
204581
+ ConfigExportsSchema = ConfigExportsTypeSchema.pipe(ConfigExportsObjectSchema);
204259
204582
  ModuleTypeSchema = _enum5([
204260
204583
  "esm",
204261
204584
  "cjs",
@@ -205240,6 +205563,7 @@ ${formatWranglerConfigZodError(parsed.error)}`,
205240
205563
  rawConfig,
205241
205564
  parsedWorkerConfig: worker,
205242
205565
  parsedSettingsConfig: settings,
205566
+ mode,
205243
205567
  cloudflareConfigPath,
205244
205568
  wranglerConfigPath,
205245
205569
  dependencies,
@@ -211894,6 +212218,13 @@ function validateAndNormalizeTsconfig2(diagnostics, topLevelEnv, rawEnv, configP
211894
212218
  const tsconfig = inheritable2(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString3, void 0);
211895
212219
  return configPath && tsconfig ? path31__namespace.default.relative(process.cwd(), path31__namespace.default.join(path31__namespace.default.dirname(configPath), tsconfig)) : tsconfig;
211896
212220
  }
212221
+ function validateWorkflowRetentionValue2(diagnostics, field, key, value) {
212222
+ const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
212223
+ const isValidString = typeof value === "string" && value.length > 0;
212224
+ if (isValidNumber || isValidString) return true;
212225
+ diagnostics.errors.push(`"${field}" bindings "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(value)}.`);
212226
+ return false;
212227
+ }
211897
212228
  function validateSshPublicKeys2(diagnostics, field, value, nameRequired) {
211898
212229
  if (!Array.isArray(value)) {
211899
212230
  diagnostics.errors.push(`${field} must be an array`);
@@ -248828,6 +249159,8 @@ Please add a binding for each to "${fieldPath}.bindings":
248828
249159
  return isValid;
248829
249160
  }, "validateDurableObjectBinding");
248830
249161
  workflowNameFormatMessage2 = `Workflow names must be 1-64 characters long, start with a letter, number, or underscore, and may only contain letters, numbers, underscores, or hyphens.`;
249162
+ __name(validateWorkflowRetentionValue2, "validateWorkflowRetentionValue");
249163
+ __name6(validateWorkflowRetentionValue2, "validateWorkflowRetentionValue");
248831
249164
  validateWorkflowBinding2 = /* @__PURE__ */ __name6((diagnostics, field, value) => {
248832
249165
  if (typeof value !== "object" || value === null) {
248833
249166
  diagnostics.errors.push(`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`);
@@ -248886,13 +249219,34 @@ Please add a binding for each to "${fieldPath}.bindings":
248886
249219
  }
248887
249220
  validateAdditionalProperties2(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
248888
249221
  }
249222
+ if (hasProperty2(value, "default_retention") && value.default_retention !== void 0) if (typeof value.default_retention !== "object" || value.default_retention === null || Array.isArray(value.default_retention)) {
249223
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
249224
+ isValid = false;
249225
+ } else {
249226
+ const defaultRetention = value.default_retention;
249227
+ for (const key of ["success_retention", "error_retention"]) if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue2(diagnostics, field, key, defaultRetention[key])) isValid = false;
249228
+ validateAdditionalProperties2(diagnostics, `${field}.default_retention`, Object.keys(defaultRetention), ["success_retention", "error_retention"]);
249229
+ }
249230
+ if (hasProperty2(value, "concurrency") && value.concurrency !== void 0) if (typeof value.concurrency !== "object" || value.concurrency === null || Array.isArray(value.concurrency)) {
249231
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "concurrency" field but got ${JSON.stringify(value)}.`);
249232
+ isValid = false;
249233
+ } else {
249234
+ const concurrency = value.concurrency;
249235
+ if (concurrency.limit !== void 0 && (typeof concurrency.limit !== "number" || !Number.isInteger(concurrency.limit) || concurrency.limit < 1)) {
249236
+ diagnostics.errors.push(`"${field}" bindings "concurrency.limit" field must be a positive integer but got ${JSON.stringify(concurrency.limit)}.`);
249237
+ isValid = false;
249238
+ }
249239
+ validateAdditionalProperties2(diagnostics, `${field}.concurrency`, Object.keys(concurrency), ["limit"]);
249240
+ }
248889
249241
  validateAdditionalProperties2(diagnostics, field, Object.keys(value), [
248890
249242
  "binding",
248891
249243
  "name",
248892
249244
  "class_name",
248893
249245
  "script_name",
248894
249246
  "limits",
248895
- "schedules"
249247
+ "concurrency",
249248
+ "schedules",
249249
+ "default_retention"
248896
249250
  ]);
248897
249251
  return isValid;
248898
249252
  }, "validateWorkflowBinding");
@@ -250963,6 +251317,7 @@ async function readNewConfig(args, options = {}) {
250963
251317
  config: config6,
250964
251318
  parsedWorkerConfig: loaded.parsedWorkerConfig,
250965
251319
  parsedSettingsConfig: loaded.parsedSettingsConfig,
251320
+ mode: loaded.mode,
250966
251321
  dependencies: loaded.dependencies,
250967
251322
  types: loaded.types
250968
251323
  };
@@ -278376,6 +278731,13 @@ function validateAndNormalizeTsconfig3(diagnostics, topLevelEnv, rawEnv, configP
278376
278731
  const tsconfig = inheritable3(diagnostics, topLevelEnv, rawEnv, "tsconfig", isString4, void 0);
278377
278732
  return configPath && tsconfig ? path31__namespace.default.relative(process.cwd(), path31__namespace.default.join(path31__namespace.default.dirname(configPath), tsconfig)) : tsconfig;
278378
278733
  }
278734
+ function validateWorkflowRetentionValue3(diagnostics, field, key, value) {
278735
+ const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
278736
+ const isValidString = typeof value === "string" && value.length > 0;
278737
+ if (isValidNumber || isValidString) return true;
278738
+ diagnostics.errors.push(`"${field}" bindings "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(value)}.`);
278739
+ return false;
278740
+ }
278379
278741
  function validateSshPublicKeys3(diagnostics, field, value, nameRequired) {
278380
278742
  if (!Array.isArray(value)) {
278381
278743
  diagnostics.errors.push(`${field} must be an array`);
@@ -315036,6 +315398,8 @@ Please add a binding for each to "${fieldPath}.bindings":
315036
315398
  return isValid;
315037
315399
  }, "validateDurableObjectBinding");
315038
315400
  workflowNameFormatMessage3 = `Workflow names must be 1-64 characters long, start with a letter, number, or underscore, and may only contain letters, numbers, underscores, or hyphens.`;
315401
+ __name(validateWorkflowRetentionValue3, "validateWorkflowRetentionValue");
315402
+ __name7(validateWorkflowRetentionValue3, "validateWorkflowRetentionValue");
315039
315403
  validateWorkflowBinding3 = /* @__PURE__ */ __name7((diagnostics, field, value) => {
315040
315404
  if (typeof value !== "object" || value === null) {
315041
315405
  diagnostics.errors.push(`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`);
@@ -315094,13 +315458,34 @@ Please add a binding for each to "${fieldPath}.bindings":
315094
315458
  }
315095
315459
  validateAdditionalProperties3(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
315096
315460
  }
315461
+ if (hasProperty3(value, "default_retention") && value.default_retention !== void 0) if (typeof value.default_retention !== "object" || value.default_retention === null || Array.isArray(value.default_retention)) {
315462
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
315463
+ isValid = false;
315464
+ } else {
315465
+ const defaultRetention = value.default_retention;
315466
+ for (const key of ["success_retention", "error_retention"]) if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue3(diagnostics, field, key, defaultRetention[key])) isValid = false;
315467
+ validateAdditionalProperties3(diagnostics, `${field}.default_retention`, Object.keys(defaultRetention), ["success_retention", "error_retention"]);
315468
+ }
315469
+ if (hasProperty3(value, "concurrency") && value.concurrency !== void 0) if (typeof value.concurrency !== "object" || value.concurrency === null || Array.isArray(value.concurrency)) {
315470
+ diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "concurrency" field but got ${JSON.stringify(value)}.`);
315471
+ isValid = false;
315472
+ } else {
315473
+ const concurrency = value.concurrency;
315474
+ if (concurrency.limit !== void 0 && (typeof concurrency.limit !== "number" || !Number.isInteger(concurrency.limit) || concurrency.limit < 1)) {
315475
+ diagnostics.errors.push(`"${field}" bindings "concurrency.limit" field must be a positive integer but got ${JSON.stringify(concurrency.limit)}.`);
315476
+ isValid = false;
315477
+ }
315478
+ validateAdditionalProperties3(diagnostics, `${field}.concurrency`, Object.keys(concurrency), ["limit"]);
315479
+ }
315097
315480
  validateAdditionalProperties3(diagnostics, field, Object.keys(value), [
315098
315481
  "binding",
315099
315482
  "name",
315100
315483
  "class_name",
315101
315484
  "script_name",
315102
315485
  "limits",
315103
- "schedules"
315486
+ "concurrency",
315487
+ "schedules",
315488
+ "default_retention"
315104
315489
  ]);
315105
315490
  return isValid;
315106
315491
  }, "validateWorkflowBinding");
@@ -324974,11 +325359,11 @@ var init_is_wsl = __esm({
324974
325359
  is_wsl_default4 = process5__default.default.env.__IS_WSL_TEST__ ? isWsl4 : isWsl4();
324975
325360
  }
324976
325361
  });
324977
- var execFile5, powerShellPath5, executePowerShell4;
325362
+ var execFile6, powerShellPath5, executePowerShell4;
324978
325363
  var init_powershell_utils = __esm({
324979
325364
  "../../node_modules/.pnpm/powershell-utils@0.1.0/node_modules/powershell-utils/index.js"() {
324980
325365
  init_import_meta_url();
324981
- execFile5 = util.promisify(childProcess__default.default.execFile);
325366
+ execFile6 = util.promisify(childProcess__default.default.execFile);
324982
325367
  powerShellPath5 = /* @__PURE__ */ __name(() => `${process5__default.default.env.SYSTEMROOT || process5__default.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, "powerShellPath");
324983
325368
  executePowerShell4 = /* @__PURE__ */ __name(async (command2, options = {}) => {
324984
325369
  const {
@@ -324986,7 +325371,7 @@ var init_powershell_utils = __esm({
324986
325371
  ...execFileOptions
324987
325372
  } = options;
324988
325373
  const encodedCommand = executePowerShell4.encodeCommand(command2);
324989
- return execFile5(
325374
+ return execFile6(
324990
325375
  psPath ?? powerShellPath5(),
324991
325376
  [
324992
325377
  ...executePowerShell4.argumentsPrefix,
@@ -325029,7 +325414,7 @@ var init_utilities2 = __esm({
325029
325414
  __name(parseMountPointFromConfig4, "parseMountPointFromConfig");
325030
325415
  }
325031
325416
  });
325032
- var execFile6, wslDrivesMountPoint4, powerShellPathFromWsl2, powerShellPath6, canAccessPowerShellPromise4, canAccessPowerShell4, wslDefaultBrowser4, convertWslPathToWindows4;
325417
+ var execFile7, wslDrivesMountPoint4, powerShellPathFromWsl2, powerShellPath6, canAccessPowerShellPromise4, canAccessPowerShell4, wslDefaultBrowser4, convertWslPathToWindows4;
325033
325418
  var init_wsl_utils = __esm({
325034
325419
  "../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js"() {
325035
325420
  init_import_meta_url();
@@ -325037,7 +325422,7 @@ var init_wsl_utils = __esm({
325037
325422
  init_powershell_utils();
325038
325423
  init_utilities2();
325039
325424
  init_is_wsl();
325040
- execFile6 = util.promisify(childProcess__default.default.execFile);
325425
+ execFile7 = util.promisify(childProcess__default.default.execFile);
325041
325426
  wslDrivesMountPoint4 = /* @__PURE__ */ (() => {
325042
325427
  const defaultMountPoint = "/mnt/";
325043
325428
  let mountPoint;
@@ -325093,7 +325478,7 @@ var init_wsl_utils = __esm({
325093
325478
  return path89;
325094
325479
  }
325095
325480
  try {
325096
- const { stdout: stdout2 } = await execFile6("wslpath", ["-aw", path89], { encoding: "utf8" });
325481
+ const { stdout: stdout2 } = await execFile7("wslpath", ["-aw", path89], { encoding: "utf8" });
325097
325482
  return stdout2.trim();
325098
325483
  } catch {
325099
325484
  return path89;
@@ -330837,23 +331222,24 @@ var init_browser_rendering2 = __esm({
330837
331222
  function getBuildOutputDir(root) {
330838
331223
  return path31__namespace.resolve(root, BUILD_OUTPUT_ROOT);
330839
331224
  }
330840
- function getRootConfigPath(root) {
331225
+ function getSettingsConfigPath(root) {
330841
331226
  return path31__namespace.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, CONFIG_FILENAME);
330842
331227
  }
330843
331228
  function getWorkersDir(root) {
330844
331229
  return path31__namespace.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, "workers");
330845
331230
  }
330846
- function getWorkerDir(root) {
330847
- return path31__namespace.join(getWorkersDir(root), DEFAULT_WORKER_EXPORT);
331231
+ function getWorkerDir(root, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
331232
+ if (workerDirectoryName.length === 0 || workerDirectoryName === "." || workerDirectoryName === ".." || workerDirectoryName.includes("/") || workerDirectoryName.includes("\\") || workerDirectoryName.includes("\0")) throw new Error("Worker directory names must be non-empty, single path segments.");
331233
+ return path31__namespace.join(getWorkersDir(root), workerDirectoryName);
330848
331234
  }
330849
- function getWorkerConfigPath(root) {
330850
- return path31__namespace.join(getWorkerDir(root), CONFIG_FILENAME);
331235
+ function getWorkerConfigPath(root, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
331236
+ return path31__namespace.join(getWorkerDir(root, workerDirectoryName), CONFIG_FILENAME);
330851
331237
  }
330852
- function getWorkerBundleDir(root) {
330853
- return path31__namespace.join(getWorkerDir(root), "bundle");
331238
+ function getWorkerBundleDir(root, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
331239
+ return path31__namespace.join(getWorkerDir(root, workerDirectoryName), "bundle");
330854
331240
  }
330855
- function getWorkerAssetsDir(root) {
330856
- return path31__namespace.join(getWorkerDir(root), "assets");
331241
+ function getWorkerAssetsDir(root, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
331242
+ return path31__namespace.join(getWorkerDir(root, workerDirectoryName), "assets");
330857
331243
  }
330858
331244
  function isDirectory4(path$1) {
330859
331245
  return fs6__namespace.default.statSync(path$1, { throwIfNoEntry: false })?.isDirectory() ?? false;
@@ -330880,30 +331266,35 @@ function removeDirSync4(dirPath) {
330880
331266
  async function cleanBuildOutputDir(root) {
330881
331267
  await removeDir4(getBuildOutputDir(root));
330882
331268
  }
330883
- async function writeWorkerConfig(root, parsedConfig, manifest) {
330884
- const { entrypoint: _entrypoint, ...rest } = parsedConfig;
331269
+ async function writeWorkerConfig({ root, config: config6, manifest, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME }) {
331270
+ const { entrypoint: _entrypoint, ...rest } = config6;
330885
331271
  const outputConfig = {
330886
331272
  ...rest,
330887
331273
  manifest
330888
331274
  };
330889
- await fs$1__namespace.mkdir(getWorkerDir(root), { recursive: true });
330890
- await fs$1__namespace.writeFile(getWorkerConfigPath(root), JSON.stringify(outputConfig));
331275
+ await fs$1__namespace.mkdir(getWorkerDir(root, workerDirectoryName), { recursive: true });
331276
+ await fs$1__namespace.writeFile(getWorkerConfigPath(root, workerDirectoryName), JSON.stringify(outputConfig));
330891
331277
  }
330892
- async function writeRootConfig(root, settings) {
330893
- const configPath = getRootConfigPath(root);
331278
+ async function writeSettingsConfig(root, settings, mode) {
331279
+ const outputConfig = {
331280
+ ...settings,
331281
+ type: "settings",
331282
+ ...mode !== void 0 ? { mode } : {}
331283
+ };
331284
+ const configPath = getSettingsConfigPath(root);
330894
331285
  await fs$1__namespace.mkdir(path31__namespace.dirname(configPath), { recursive: true });
330895
- await fs$1__namespace.writeFile(configPath, JSON.stringify(settings));
331286
+ await fs$1__namespace.writeFile(configPath, JSON.stringify(outputConfig));
330896
331287
  }
330897
- var BUILD_OUTPUT_VERSION, BUILD_OUTPUT_ROOT, CONFIG_FILENAME, DEFAULT_WORKER_EXPORT, __defProp8, __name8;
331288
+ var BUILD_OUTPUT_VERSION, BUILD_OUTPUT_ROOT, CONFIG_FILENAME, DEFAULT_WORKER_DIRECTORY_NAME, __defProp8, __name8;
330898
331289
  var init_dist16 = __esm({
330899
331290
  "../build-output-utils/dist/index.mjs"() {
330900
331291
  init_import_meta_url();
330901
331292
  BUILD_OUTPUT_VERSION = "v0";
330902
331293
  BUILD_OUTPUT_ROOT = ".cloudflare/output";
330903
331294
  CONFIG_FILENAME = "config.json";
330904
- DEFAULT_WORKER_EXPORT = "default";
331295
+ DEFAULT_WORKER_DIRECTORY_NAME = "default";
330905
331296
  __name(getBuildOutputDir, "getBuildOutputDir");
330906
- __name(getRootConfigPath, "getRootConfigPath");
331297
+ __name(getSettingsConfigPath, "getSettingsConfigPath");
330907
331298
  __name(getWorkersDir, "getWorkersDir");
330908
331299
  __name(getWorkerDir, "getWorkerDir");
330909
331300
  __name(getWorkerConfigPath, "getWorkerConfigPath");
@@ -330922,13 +331313,14 @@ var init_dist16 = __esm({
330922
331313
  __name8(removeDirSync4, "removeDirSync");
330923
331314
  __name(cleanBuildOutputDir, "cleanBuildOutputDir");
330924
331315
  __name(writeWorkerConfig, "writeWorkerConfig");
330925
- __name(writeRootConfig, "writeRootConfig");
331316
+ __name(writeSettingsConfig, "writeSettingsConfig");
330926
331317
  }
330927
331318
  });
330928
331319
  async function writeBuildOutput({
330929
331320
  root,
330930
331321
  parsedWorkerConfig,
330931
331322
  parsedSettingsConfig,
331323
+ mode,
330932
331324
  buildResult,
330933
331325
  assetsOptions
330934
331326
  }) {
@@ -330943,10 +331335,8 @@ async function writeBuildOutput({
330943
331335
  buildResult ? writeBundle({ root, buildResult }) : Promise.resolve(void 0),
330944
331336
  assetsOptions ? writeAssets({ root, assetsOptions }) : Promise.resolve()
330945
331337
  ]);
330946
- await writeWorkerConfig(root, parsedWorkerConfig, manifest);
330947
- if (parsedSettingsConfig !== void 0) {
330948
- await writeRootConfig(root, parsedSettingsConfig);
330949
- }
331338
+ await writeWorkerConfig({ root, config: parsedWorkerConfig, manifest });
331339
+ await writeSettingsConfig(root, parsedSettingsConfig, mode);
330950
331340
  }
330951
331341
  async function writeBundle({
330952
331342
  root,
@@ -332112,7 +332502,7 @@ var init_merge_config_args = __esm({
332112
332502
 
332113
332503
  // src/build/run-build-output.ts
332114
332504
  async function runBuildOutput(buildArgs) {
332115
- const { config: config6, parsedWorkerConfig, parsedSettingsConfig } = await readNewConfig({
332505
+ const { config: config6, parsedWorkerConfig, parsedSettingsConfig, mode } = await readNewConfig({
332116
332506
  env: buildArgs.env
332117
332507
  });
332118
332508
  const { buildProps, assetsOptions } = await mergeBuildOutputProps(config6);
@@ -332126,6 +332516,7 @@ async function runBuildOutput(buildArgs) {
332126
332516
  root,
332127
332517
  parsedWorkerConfig,
332128
332518
  parsedSettingsConfig,
332519
+ mode,
332129
332520
  buildResult,
332130
332521
  assetsOptions
332131
332522
  });
@@ -340670,10 +341061,10 @@ Sentry.init({...});
340670
341061
  */
340671
341062
  startSession(context2) {
340672
341063
  const { scope, client } = this.getStackTop();
340673
- const { release: release3, environment = DEFAULT_ENVIRONMENT } = client && client.getOptions() || {};
341064
+ const { release: release4, environment = DEFAULT_ENVIRONMENT } = client && client.getOptions() || {};
340674
341065
  const { userAgent } = GLOBAL_OBJ.navigator || {};
340675
341066
  const session = makeSession({
340676
- release: release3,
341067
+ release: release4,
340677
341068
  environment,
340678
341069
  user: scope.getUser(),
340679
341070
  ...userAgent && { userAgent },
@@ -341413,12 +341804,12 @@ function prepareEvent(options, event, hint, scope, client) {
341413
341804
  });
341414
341805
  }
341415
341806
  function applyClientOptions(event, options) {
341416
- const { environment, release: release3, dist, maxValueLength = 250 } = options;
341807
+ const { environment, release: release4, dist, maxValueLength = 250 } = options;
341417
341808
  if (!("environment" in event)) {
341418
341809
  event.environment = "environment" in options ? environment : DEFAULT_ENVIRONMENT;
341419
341810
  }
341420
- if (event.release === void 0 && release3 !== void 0) {
341421
- event.release = release3;
341811
+ if (event.release === void 0 && release4 !== void 0) {
341812
+ event.release = release4;
341422
341813
  }
341423
341814
  if (event.dist === void 0 && dist !== void 0) {
341424
341815
  event.dist = dist;
@@ -342790,12 +343181,12 @@ var init_server_runtime_client = __esm({
342790
343181
  }
342791
343182
  /** Method that initialises an instance of SessionFlusher on Client */
342792
343183
  initSessionFlusher() {
342793
- const { release: release3, environment } = this._options;
342794
- if (!release3) {
343184
+ const { release: release4, environment } = this._options;
343185
+ if (!release4) {
342795
343186
  DEBUG_BUILD2 && logger4.warn("Cannot initialise an instance of SessionFlusher if no release is provided!");
342796
343187
  } else {
342797
343188
  this._sessionFlusher = new SessionFlusher(this, {
342798
- release: release3,
343189
+ release: release4,
342799
343190
  environment
342800
343191
  });
342801
343192
  }
@@ -342814,12 +343205,12 @@ var init_server_runtime_client = __esm({
342814
343205
  return id;
342815
343206
  }
342816
343207
  const options = this.getOptions();
342817
- const { release: release3, environment, tunnel } = options;
343208
+ const { release: release4, environment, tunnel } = options;
342818
343209
  const serializedCheckIn = {
342819
343210
  check_in_id: id,
342820
343211
  monitor_slug: checkIn.monitorSlug,
342821
343212
  status: checkIn.status,
342822
- release: release3,
343213
+ release: release4,
342823
343214
  environment
342824
343215
  };
342825
343216
  if ("duration" in checkIn) {
@@ -348307,13 +348698,14 @@ function createHandler2(def, argv) {
348307
348698
  );
348308
348699
  const shouldSuggestSkills = def.behaviour?.suggestSkillsAfterHandler ?? false;
348309
348700
  const suggestSkillsEnabled = shouldSuggestSkills === true || typeof shouldSuggestSkills === "function" && shouldSuggestSkills(args) === true;
348701
+ const shouldInstall = false;
348310
348702
  if (suggestSkillsEnabled) {
348311
348703
  try {
348312
- const justInstalled = await runSkillsInstallFlow({
348704
+ const justInstalled = shouldInstall ? await runSkillsInstallFlow({
348313
348705
  force: false,
348314
348706
  command: sanitizedCommand,
348315
348707
  promptMessage: skillInstallPromptMessageAfterWranglerCommandHandler
348316
- });
348708
+ }) : false;
348317
348709
  if (!justInstalled && getNoSkillsUpdatePromptsFromEnv() !== true) {
348318
348710
  await runSkillsUpdateFlow({
348319
348711
  command: sanitizedCommand
@@ -355881,6 +356273,11 @@ async function detectFramework(projectPath, context2, wranglerConfig) {
355881
356273
  buildSettings,
355882
356274
  context2
355883
356275
  );
356276
+ if (maybeDetectedFramework) {
356277
+ maybeDetectedFramework.devCommand = project.frameworks.get(maybeDetectedFramework.baseDirectory ?? "")?.find(
356278
+ ({ id }) => id === maybeDetectedFramework.framework.id
356279
+ )?.dev?.command;
356280
+ }
355884
356281
  if (await isPagesProject(
355885
356282
  projectPath,
355886
356283
  context2,
@@ -356050,15 +356447,15 @@ async function findAssetsDir(from) {
356050
356447
  async function getDetailsForAutoConfig({
356051
356448
  projectPath = process.cwd(),
356052
356449
  wranglerConfig,
356450
+ target = "cf",
356053
356451
  context: context2
356054
356452
  }) {
356055
356453
  const { logger: logger6 } = context2;
356056
356454
  logger6.debug(`Running autoconfig detection in ${projectPath}...`);
356057
- if (
356058
- // If a real Wrangler config has been found the project is already configured for Workers
356059
- wranglerConfig?.configPath && // Unless `pages_build_output_dir` is set, since that indicates that the project is a Pages one instead
356060
- !wranglerConfig.pages_build_output_dir
356061
- ) {
356455
+ const hasCloudflareConfig = target === "cf" && fs6.existsSync(path31.resolve(projectPath, CLOUDFLARE_CONFIG_FILE));
356456
+ if (target === "wrangler" && // If a real Wrangler config has been found the project is already configured for Workers
356457
+ wranglerConfig?.configPath && // Unless `pages_build_output_dir` is set, since that indicates that the project is a Pages one instead
356458
+ !wranglerConfig.pages_build_output_dir) {
356062
356459
  return {
356063
356460
  configured: true,
356064
356461
  projectPath,
@@ -356079,19 +356476,18 @@ async function getDetailsForAutoConfig({
356079
356476
  } catch {
356080
356477
  logger6.debug("No package.json found when running autoconfig");
356081
356478
  }
356082
- const configured = framework.isConfigured(projectPath) ?? false;
356479
+ const configured = hasCloudflareConfig || framework.isConfigured(projectPath, { target });
356083
356480
  const outputDir = detectedFramework?.dist ?? await findAssetsDir(projectPath);
356084
356481
  const baseDetails = {
356085
356482
  projectPath,
356086
356483
  framework,
356087
356484
  packageJson,
356088
356485
  packageManager,
356089
- ...detectedFramework ? {
356090
- buildCommand: getProjectBuildCommand(
356091
- detectedFramework,
356092
- packageManager
356093
- )
356094
- } : {},
356486
+ devCommand: getProjectCommand(detectedFramework.devCommand, packageManager),
356487
+ buildCommand: getProjectCommand(
356488
+ detectedFramework.buildCommand,
356489
+ packageManager
356490
+ ),
356095
356491
  workerName: getWorkerName(packageJson?.name, projectPath)
356096
356492
  };
356097
356493
  if (configured) {
@@ -356116,17 +356512,17 @@ async function getDetailsForAutoConfig({
356116
356512
  isWorkspaceRoot
356117
356513
  };
356118
356514
  }
356119
- function getProjectBuildCommand(detectedFramework, packageManager) {
356120
- if (!detectedFramework.buildCommand) {
356515
+ function getProjectCommand(command2, packageManager) {
356516
+ if (!command2) {
356121
356517
  return void 0;
356122
356518
  }
356123
356519
  const { type, dlx, npx } = packageManager;
356124
356520
  for (const packageManagerCommandPrefix of [type, dlx.join(" "), npx]) {
356125
- if (detectedFramework.buildCommand.startsWith(packageManagerCommandPrefix)) {
356126
- return detectedFramework.buildCommand;
356521
+ if (command2.startsWith(packageManagerCommandPrefix)) {
356522
+ return command2;
356127
356523
  }
356128
356524
  }
356129
- return `${npx} ${detectedFramework.buildCommand}`;
356525
+ return `${npx} ${command2}`;
356130
356526
  }
356131
356527
  function displayAutoConfigDetails(autoConfigDetails, context2, displayOptions) {
356132
356528
  const { logger: logger6 } = context2;
@@ -356218,11 +356614,12 @@ async function confirmAutoConfigDetails(autoConfigDetails, context2) {
356218
356614
  }
356219
356615
  async function runAutoConfig(autoConfigDetails, autoConfigOptions) {
356220
356616
  const { context: context2 } = autoConfigOptions;
356617
+ const target = autoConfigOptions.target ?? "cf";
356221
356618
  const { logger: logger6 } = context2;
356222
356619
  const dryRun = autoConfigOptions.dryRun === true;
356223
356620
  const runBuild2 = !dryRun && (autoConfigOptions.runBuild ?? true);
356224
356621
  const skipConfirmations = dryRun || autoConfigOptions.skipConfirmations === true;
356225
- const enableWranglerInstallation = autoConfigOptions.enableWranglerInstallation ?? true;
356622
+ const enableTargetCliInstallation = autoConfigOptions.enableTargetCliInstallation ?? true;
356226
356623
  assertNonConfigured(autoConfigDetails);
356227
356624
  displayAutoConfigDetails(autoConfigDetails, context2);
356228
356625
  const updatedAutoConfigDetails = skipConfirmations ? autoConfigDetails : await confirmAutoConfigDetails(autoConfigDetails, context2);
@@ -356249,10 +356646,9 @@ async function runAutoConfig(autoConfigDetails, autoConfigOptions) {
356249
356646
  "The Output Directory is unexpectedly missing"
356250
356647
  );
356251
356648
  const compatibilityDate = DEFAULT_COMPAT_DATE;
356252
- const wranglerConfig = {
356253
- $schema: "node_modules/wrangler/config-schema.json",
356649
+ const defaultWorkerConfig = {
356254
356650
  name: autoConfigDetails.workerName,
356255
- compatibility_date: compatibilityDate,
356651
+ compatibilityDate,
356256
356652
  observability: {
356257
356653
  enabled: true
356258
356654
  }
@@ -356270,6 +356666,7 @@ async function runAutoConfig(autoConfigDetails, autoConfigOptions) {
356270
356666
  );
356271
356667
  }
356272
356668
  const dryRunConfigurationResults = await autoConfigDetails.framework.configure({
356669
+ target,
356273
356670
  outputDir: autoConfigDetails.outputDir,
356274
356671
  projectPath: autoConfigDetails.projectPath,
356275
356672
  workerName: autoConfigDetails.workerName,
@@ -356278,18 +356675,32 @@ async function runAutoConfig(autoConfigDetails, autoConfigOptions) {
356278
356675
  packageManager,
356279
356676
  context: context2
356280
356677
  });
356678
+ const dryRunWorkerConfig = mergeWorkerConfig(
356679
+ defaultWorkerConfig,
356680
+ dryRunConfigurationResults.workerConfig
356681
+ );
356682
+ if (target === "cf" && dryRunConfigurationResults.buildTool === "wrangler" && dryRunConfigurationResults.buildConfig && fs6.existsSync(path31.resolve(autoConfigDetails.projectPath, "wrangler.config.ts"))) {
356683
+ throw new FatalError(
356684
+ "Cannot generate wrangler.config.ts because the file already exists. Remove or rename the existing file, then run autoconfig again.",
356685
+ { telemetryMessage: "autoconfig wrangler config conflict" }
356686
+ );
356687
+ }
356281
356688
  const { npx } = packageManager;
356689
+ let buildCommand3 = dryRunConfigurationResults.buildCommandOverride ?? autoConfigDetails.buildCommand;
356690
+ if (target === "cf" && autoConfigDetails.packageJson?.scripts?.build !== void 0) {
356691
+ buildCommand3 = `${packageManager.type} run build`;
356692
+ }
356282
356693
  const autoConfigSummary = await buildOperationsSummary(
356283
356694
  { ...autoConfigDetails, outputDir: autoConfigDetails.outputDir },
356284
- dryRunConfigurationResults.wranglerConfig === null ? null : ensureNodejsCompatIsEnabled({
356285
- ...wranglerConfig,
356286
- ...dryRunConfigurationResults.wranglerConfig
356287
- }),
356695
+ dryRunWorkerConfig,
356696
+ dryRunConfigurationResults,
356288
356697
  {
356289
- build: dryRunConfigurationResults.buildCommandOverride ?? autoConfigDetails.buildCommand,
356290
- deploy: dryRunConfigurationResults.deployCommandOverride ?? `${npx} wrangler deploy`,
356291
- version: dryRunConfigurationResults?.versionCommandOverride ?? `${npx} wrangler versions upload`
356698
+ build: buildCommand3,
356699
+ deploy: dryRunConfigurationResults.deployCommandOverride ?? `${npx} ${target} deploy`,
356700
+ version: dryRunConfigurationResults.versionCommandOverride ?? `${npx} ${target} versions upload`
356292
356701
  },
356702
+ enableTargetCliInstallation,
356703
+ target,
356293
356704
  context2,
356294
356705
  dryRunConfigurationResults.packageJsonScriptsOverrides
356295
356706
  );
@@ -356309,10 +356720,21 @@ async function runAutoConfig(autoConfigDetails, autoConfigOptions) {
356309
356720
  `Running autoconfig with:
356310
356721
  ${JSON.stringify(autoConfigDetails, null, 2)}...`
356311
356722
  );
356312
- if (autoConfigSummary.wranglerInstall && enableWranglerInstallation) {
356723
+ if (autoConfigDetails.packageJson && enableTargetCliInstallation) {
356724
+ if (target === "cf") {
356725
+ await installPackages(packageManager.type, ["cf@latest"], {
356726
+ dev: true,
356727
+ isWorkspaceRoot
356728
+ });
356729
+ } else {
356730
+ await installWrangler(packageManager.type, isWorkspaceRoot);
356731
+ }
356732
+ }
356733
+ if (autoConfigDetails.packageJson && target === "cf" && dryRunConfigurationResults.buildTool === "wrangler") {
356313
356734
  await installWrangler(packageManager.type, isWorkspaceRoot);
356314
356735
  }
356315
356736
  const configurationResults = await autoConfigDetails.framework.configure({
356737
+ target,
356316
356738
  outputDir: autoConfigDetails.outputDir,
356317
356739
  projectPath: autoConfigDetails.projectPath,
356318
356740
  workerName: autoConfigDetails.workerName,
@@ -356321,6 +356743,10 @@ ${JSON.stringify(autoConfigDetails, null, 2)}...`
356321
356743
  packageManager,
356322
356744
  context: context2
356323
356745
  });
356746
+ const workerConfig = mergeWorkerConfig(
356747
+ defaultWorkerConfig,
356748
+ configurationResults.workerConfig
356749
+ );
356324
356750
  if (autoConfigDetails.packageJson) {
356325
356751
  const packageJsonPath = path31.resolve(
356326
356752
  autoConfigDetails.projectPath,
@@ -356344,11 +356770,25 @@ ${JSON.stringify(autoConfigDetails, null, 2)}...`
356344
356770
  ) + "\n"
356345
356771
  );
356346
356772
  }
356347
- if (configurationResults.wranglerConfig !== null) {
356348
- await saveWranglerJsonc(autoConfigDetails.projectPath, {
356349
- ...wranglerConfig,
356350
- ...configurationResults.wranglerConfig
356351
- });
356773
+ if (target === "wrangler") {
356774
+ const wranglerConfig = getWranglerConfig(
356775
+ workerConfig,
356776
+ configurationResults
356777
+ );
356778
+ if (wranglerConfig !== null) {
356779
+ await saveWranglerJsonc(autoConfigDetails.projectPath, wranglerConfig);
356780
+ }
356781
+ }
356782
+ if (target === "cf") {
356783
+ if (workerConfig !== null) {
356784
+ await saveCloudflareConfig(autoConfigDetails.projectPath, workerConfig);
356785
+ }
356786
+ if (configurationResults.buildTool === "wrangler" && configurationResults.buildConfig) {
356787
+ await saveWranglerConfigTs(
356788
+ autoConfigDetails.projectPath,
356789
+ configurationResults.buildConfig
356790
+ );
356791
+ }
356352
356792
  }
356353
356793
  maybeAppendWranglerToGitIgnore(autoConfigDetails.projectPath);
356354
356794
  if (autoConfigDetails.outputDir === autoConfigDetails.projectPath) {
@@ -356356,7 +356796,6 @@ ${JSON.stringify(autoConfigDetails, null, 2)}...`
356356
356796
  `${autoConfigDetails.projectPath}/.assetsignore`
356357
356797
  );
356358
356798
  }
356359
- const buildCommand3 = configurationResults.buildCommandOverride ?? autoConfigDetails.buildCommand;
356360
356799
  if (buildCommand3 && runBuild2) {
356361
356800
  await context2.runCommand(
356362
356801
  buildCommand3,
@@ -356366,6 +356805,30 @@ ${JSON.stringify(autoConfigDetails, null, 2)}...`
356366
356805
  }
356367
356806
  return autoConfigSummary;
356368
356807
  }
356808
+ function mergeWorkerConfig(defaultWorkerConfig, workerConfig) {
356809
+ return workerConfig === null ? null : { ...defaultWorkerConfig, ...workerConfig };
356810
+ }
356811
+ function getWranglerConfig(workerConfig, configurationResults) {
356812
+ if (workerConfig === null) {
356813
+ return null;
356814
+ }
356815
+ const parsedWorkerConfig = InputWorkerSchema.parse({
356816
+ type: "worker",
356817
+ ...workerConfig
356818
+ });
356819
+ const convertedWranglerConfig = convertToWranglerConfig(parsedWorkerConfig);
356820
+ const wranglerConfig = ensureNodejsCompatIsEnabled({
356821
+ $schema: "node_modules/wrangler/config-schema.json",
356822
+ ...convertedWranglerConfig,
356823
+ ...configurationResults.buildConfig?.assetsDirectory ? {
356824
+ assets: {
356825
+ ...convertedWranglerConfig.assets,
356826
+ directory: configurationResults.buildConfig.assetsDirectory
356827
+ }
356828
+ } : {}
356829
+ });
356830
+ return wranglerConfig;
356831
+ }
356369
356832
  function ensureNodejsCompatIsEnabled(wranglerConfig) {
356370
356833
  const flags2 = (wranglerConfig.compatibility_flags ?? []).filter(
356371
356834
  (flag) => !flag.startsWith("nodejs_")
@@ -356398,39 +356861,83 @@ async function saveWranglerJsonc(projectPath, wranglerConfig) {
356398
356861
  JSON.stringify(mergedWranglerConfig, null, 2) + "\n"
356399
356862
  );
356400
356863
  }
356401
- async function buildOperationsSummary(autoConfigDetails, wranglerConfigToWrite, projectCommands, context2, packageJsonScriptsOverrides) {
356864
+ async function saveCloudflareConfig(projectPath, workerConfig) {
356865
+ await fs$1.writeFile(
356866
+ path31.resolve(projectPath, "cloudflare.config.ts"),
356867
+ renderCloudflareConfig(workerConfig)
356868
+ );
356869
+ }
356870
+ async function saveWranglerConfigTs(projectPath, buildConfig) {
356871
+ await fs$1.writeFile(
356872
+ path31.resolve(projectPath, "wrangler.config.ts"),
356873
+ renderWranglerConfigTs(buildConfig)
356874
+ );
356875
+ }
356876
+ function renderCloudflareConfig(workerConfig) {
356877
+ return `import { defineWorker } from "cf/config";
356878
+
356879
+ export default defineWorker(${JSON.stringify(workerConfig, null, 2)});
356880
+ `;
356881
+ }
356882
+ function renderWranglerConfigTs(buildConfig) {
356883
+ return `import { defineWranglerConfig } from "wrangler/experimental-config";
356884
+
356885
+ export default defineWranglerConfig(${JSON.stringify(buildConfig, null, 2)});
356886
+ `;
356887
+ }
356888
+ function indentFileContent(content) {
356889
+ return " " + content.trimEnd().replace(/\n/g, "\n ");
356890
+ }
356891
+ async function buildOperationsSummary(autoConfigDetails, workerConfig, configurationResults, projectCommands, enableTargetCliInstallation, target, context2, packageJsonScriptsOverrides) {
356402
356892
  const { logger: logger6 } = context2;
356403
356893
  logger6.log("");
356894
+ const wranglerConfig = target === "wrangler" ? getWranglerConfig(workerConfig, configurationResults) : null;
356404
356895
  const summary = {
356405
- wranglerInstall: false,
356406
356896
  scripts: {},
356407
- ...wranglerConfigToWrite !== null ? {
356408
- wranglerConfig: wranglerConfigToWrite
356409
- } : {},
356897
+ ...target === "wrangler" ? { wranglerConfig: wranglerConfig ?? void 0 } : {
356898
+ workerConfig: workerConfig ?? void 0,
356899
+ buildConfig: configurationResults.buildConfig
356900
+ },
356410
356901
  outputDir: autoConfigDetails.outputDir,
356411
356902
  frameworkId: autoConfigDetails.framework.id,
356412
356903
  buildCommand: projectCommands.build,
356413
356904
  deployCommand: projectCommands.deploy,
356414
356905
  versionCommand: projectCommands.version
356415
356906
  };
356907
+ const packagesToInstall = /* @__PURE__ */ new Set();
356416
356908
  if (autoConfigDetails.packageJson) {
356417
- summary.wranglerInstall = true;
356909
+ if (enableTargetCliInstallation) {
356910
+ packagesToInstall.add(target);
356911
+ }
356912
+ if (configurationResults.buildTool === "vite") {
356913
+ packagesToInstall.add("@cloudflare/vite-plugin");
356914
+ } else if (target === "cf" && configurationResults.buildTool === "wrangler") {
356915
+ packagesToInstall.add("wrangler");
356916
+ }
356917
+ }
356918
+ if (packagesToInstall.size > 0) {
356418
356919
  logger6.log("\u{1F4E6} Install packages:");
356419
- logger6.log(` - wrangler (devDependency)`);
356920
+ for (const packageName of packagesToInstall) {
356921
+ logger6.log(` - ${packageName} (devDependency)`);
356922
+ }
356420
356923
  logger6.log("");
356924
+ }
356925
+ if (autoConfigDetails.packageJson) {
356926
+ const scriptOverrides = target === "wrangler" ? packageJsonScriptsOverrides : void 0;
356927
+ const buildCommandPrefix = autoConfigDetails.buildCommand ? `${autoConfigDetails.buildCommand} && ` : "";
356421
356928
  summary.scripts = {
356422
- deploy: packageJsonScriptsOverrides?.deploy ?? (autoConfigDetails.buildCommand ? `${autoConfigDetails.buildCommand} && wrangler deploy` : `wrangler deploy`),
356423
- preview: packageJsonScriptsOverrides?.preview ?? (autoConfigDetails.buildCommand ? `${autoConfigDetails.buildCommand} && wrangler dev` : `wrangler dev`)
356929
+ deploy: scriptOverrides?.deploy ?? `${buildCommandPrefix}${target} deploy${target === "cf" && autoConfigDetails.buildCommand ? " --no-build" : ""}`,
356930
+ preview: scriptOverrides?.preview ?? `${target === "wrangler" ? buildCommandPrefix : ""}${target} dev`
356424
356931
  };
356425
356932
  const containsServerSideCode = (
356426
356933
  // If there is an entrypoint then we know that there is server side code
356427
- !!wranglerConfigToWrite?.main
356934
+ !!workerConfig?.entrypoint
356428
356935
  );
356429
356936
  if (
356430
356937
  // If there is no server side code, then there is no need to add the cf-typegen script
356431
356938
  containsServerSideCode && usesTypescript(autoConfigDetails.projectPath) && !("cf-typegen" in (autoConfigDetails.packageJson.scripts ?? {}))
356432
356939
  ) {
356433
- summary.scripts["cf-typegen"] = packageJsonScriptsOverrides?.typegen ?? "wrangler types";
356940
+ summary.scripts["cf-typegen"] = scriptOverrides?.typegen ?? `${target} types`;
356434
356941
  }
356435
356942
  logger6.log("\u{1F4DD} Update package.json scripts:");
356436
356943
  for (const [name2, script] of Object.entries(summary.scripts)) {
@@ -356438,7 +356945,21 @@ async function buildOperationsSummary(autoConfigDetails, wranglerConfigToWrite,
356438
356945
  }
356439
356946
  logger6.log("");
356440
356947
  }
356441
- if (wranglerConfigToWrite) {
356948
+ if (target === "cf" && workerConfig) {
356949
+ logger6.log("\u{1F4C4} Create cloudflare.config.ts:");
356950
+ logger6.log(indentFileContent(renderCloudflareConfig(workerConfig)));
356951
+ logger6.log("");
356952
+ }
356953
+ if (target === "cf" && configurationResults.buildTool === "wrangler" && configurationResults.buildConfig) {
356954
+ logger6.log("\u{1F4C4} Create wrangler.config.ts:");
356955
+ logger6.log(
356956
+ indentFileContent(
356957
+ renderWranglerConfigTs(configurationResults.buildConfig)
356958
+ )
356959
+ );
356960
+ logger6.log("");
356961
+ }
356962
+ if (target === "wrangler" && wranglerConfig) {
356442
356963
  const wranglerConfigPath = path31.resolve(
356443
356964
  autoConfigDetails.projectPath,
356444
356965
  "wrangler.jsonc"
@@ -356448,11 +356969,13 @@ async function buildOperationsSummary(autoConfigDetails, wranglerConfigToWrite,
356448
356969
  configExists ? "\u{1F4C4} Update wrangler.jsonc:" : "\u{1F4C4} Create wrangler.jsonc:"
356449
356970
  );
356450
356971
  logger6.log(
356451
- " " + JSON.stringify(wranglerConfigToWrite, null, 2).replace(/\n/g, "\n ")
356972
+ " " + JSON.stringify(wranglerConfig, null, 2).replace(/\n/g, "\n ")
356452
356973
  );
356453
356974
  logger6.log("");
356454
356975
  }
356455
- if (autoConfigDetails.framework && !(autoConfigDetails.framework instanceof Static) && !autoConfigDetails.framework.isConfigured(autoConfigDetails.projectPath)) {
356976
+ if (autoConfigDetails.framework && !(autoConfigDetails.framework instanceof Static) && !autoConfigDetails.framework.isConfigured(autoConfigDetails.projectPath, {
356977
+ target
356978
+ })) {
356456
356979
  summary.frameworkConfiguration = autoConfigDetails.framework.configurationDescription ?? `Configuring project for ${autoConfigDetails.framework.name}`;
356457
356980
  logger6.log(`\u{1F6E0}\uFE0F ${summary.frameworkConfiguration}`);
356458
356981
  logger6.log("");
@@ -356470,7 +356993,7 @@ function getDirWranglerJsonConfigPath(dir6) {
356470
356993
  }
356471
356994
  return void 0;
356472
356995
  }
356473
- var tslib_es6_exports, extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default, init_tslib_es6, require_shared, require_types, require_path2, require_scope, require_node_path, require_path_visitor, require_equiv, require_fork, require_core4, require_es2016, require_es2020, require_es2021, require_core22, require_es6, require_es20162, require_es2017, require_es2018, require_es2019, require_es20202, require_es20212, require_es2022, require_es_proposals, require_jsx, require_type_annotations, require_flow, require_esprima, require_babel_core, require_babel, require_typescript, require_namedTypes, require_main3, require_tiny_invariant_cjs, require_base644, require_base64_vlq, require_util12, require_array_set, require_mapping_list, require_source_map_generator, require_binary_search, require_quick_sort, require_source_map_consumer, require_source_node, require_source_map, require_util22, require_esprima2, require_esprima3, require_options, require_mapping, require_lines3, require_comments, require_parser2, require_fast_path, require_patcher, require_printer, require_main22, require_babel_options, require_lib5, require_babel2, require_typescript2, require_constants10, require_debug2, require_re, require_parse_options, require_identifiers, require_semver, require_parse5, require_valid, require_clean, require_inc, require_diff, require_major, require_minor, require_patch, require_prerelease, require_compare, require_rcompare, require_compare_loose, require_compare_build, require_sort, require_rsort, require_gt, require_lt, require_eq, require_neq, require_gte, require_lte, require_cmp, require_coerce, require_lrucache, require_range, require_comparator, require_satisfies, require_to_comparators, require_max_satisfying, require_min_satisfying, require_min_version, require_valid2, require_outside, require_gtr, require_ltr, require_intersects, require_simplify, require_subset, require_semver2, require_identity2, require_visit2, require_directives2, require_anchors2, require_applyReviver2, require_toJS2, require_Node2, require_Alias2, require_Scalar2, require_createNode2, require_Collection2, require_stringifyComment2, require_foldFlowLines2, require_stringifyString2, require_stringify2, require_stringifyPair2, require_log2, require_merge2, require_addPairToJSMap2, require_Pair2, require_stringifyCollection2, require_YAMLMap2, require_map2, require_YAMLSeq2, require_seq2, require_string2, require_null2, require_bool3, require_stringifyNumber2, require_float3, require_int3, require_schema4, require_schema22, require_binary2, require_pairs2, require_omap2, require_bool22, require_float22, require_int22, require_set2, require_timestamp2, require_schema32, require_tags2, require_Schema2, require_stringifyDocument2, require_Document2, require_errors5, require_resolve_props2, require_util_contains_newline2, require_util_flow_indent_check2, require_util_map_includes2, require_resolve_block_map2, require_resolve_block_seq2, require_resolve_end2, require_resolve_flow_collection2, require_compose_collection2, require_resolve_block_scalar2, require_resolve_flow_scalar2, require_compose_scalar2, require_util_empty_scalar_position2, require_compose_node2, require_compose_doc2, require_composer2, require_cst_scalar2, require_cst_stringify2, require_cst_visit2, require_cst2, require_lexer2, require_line_counter2, require_parser22, require_public_api3, require_dist6, require_stackframe, require_error_stack_parser, require_iserror, require_stack_generator, require_wrappy, require_once, require_end_of_stream, require_pump, require_byline, require_bugsnag, require_notifier, AutoConfigFrameworkConfigurationError, AutoConfigDetectionError, recast, esprimaParser, typescriptParser, __defProp10, __name22, recast2, fn2, Framework, Analog, esm_default9, Angular, recast3, Astro, NextJs, recast4, updateNuxtConfig, Nuxt, recast5, typescriptParser2, Qwik, recast7, recast6, b2, t4, knownIncompatiblePlugins, b22, ReactRouter, recast8, SolidStart, Static, SvelteKit, TanstackStart, recast9, b3, t22, Vike, vikeConfigExtendsPropName, Vite, recast10, b4, t32, Waku, allKnownFrameworks, staticFramework, allFrameworksInfos, NoOpFramework, allKnownFrameworksIds, LogLevel4, DefaultLogger, FileSystem, import_semver, NPM_DEV_SCRIPTS, EXCLUDED_DEV_SCRIPTS, NPM_BUILD_SCRIPTS, EXCLUDED_BUILD_SCRIPTS, isExcludedDevScript, isExcludedBuildScript, isScript, getSortIndex, sortScriptsByRelevance, isNpmDevScript, isNpmBuildScript, Category, Accuracy, VersionAccuracy, BaseFramework, Analog2, import_semver2, Angular2, Assemble, import_semver3, Astro2, Blitz, Brunch, Cecil, DocPad, Docusaurus, Eleventy, Ember, Expo, import_semver4, Gatsby, Gridsome, Grunt, Gulp, Harp, Hexo, Hono, Hugo, CLASSIC_COMPILER_CONFIG_FILES, CLASSIC_COMPILER_DEV, CLASSIC_COMPILER_BUILD, VITE_CONFIG_FILES, VITE_DEV, VITE_BUILD, Hydrogen, Jekyll, Mastra, Metalsmith, Middleman, import_semver5, Next, Nuxt2, Observable, Parcel, Phenomic, Quasar, Qwik2, import_semver6, ReactRouter2, ReactStatic, CreateReactApp, RedwoodJS, CLASSIC_COMPILER_CONFIG_FILES2, CLASSIC_COMPILER_DEV2, CLASSIC_COMPILER_BUILD2, VITE_CONFIG_FILES2, VITE_DEV2, VITE_BUILD2, Remix, Roots, Sapper, SolidJs, LEGACY_PACKAGE_NAME, LEGACY_DEV, LEGACY_BUILD, SolidStart2, Stencil, SvelteKit2, Svelte, TanStackRouter, import_semver7, TanStackStart, Vike2, Vite2, VitePress, Vue, VuePress, Waku2, Wintersmith, WMR, Zola, frameworks, import_semver9, BaseBuildTool, Bazel, Buck, Gradle, Lage, Lerna, Moon, Nix, import_yaml2, balanced, maybeMatch, range, escSlash, escOpen, escClose, escComma, escPeriod, escSlashPattern, escOpenPattern, escClosePattern, escCommaPattern, escPeriodPattern, slashPattern, openPattern, closePattern, commaPattern, periodPattern, EXPANSION_MAX, MAX_PATTERN_LENGTH, assertValidPattern, posixClasses, braceEscape, regexpEscape, rangesToString, parseClass, unescape2, _a10, types11, isExtglobType, isExtglobAST, adoptionMap, adoptionWithSpaceMap, adoptionAnyMap, usurpMap, startNoTraversal, startNoDot, addPatternStart, justDots, reSpecials, regExpEscape, qmark, star, starNoEmpty, ID, AST, escape2, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path69, sep5, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults2, braceExpand, makeRe, match2, globMagic, regExpEscape2, Minimatch3, defaultIdentifyPackage, WorkspaceInfo, Nx, PNPM, Yarn, NPM, Pants, Rush, Turbo, buildSystems, EventEmitter4, import_js, Bugsnag, normalizeError, import_semver8, AVAILABLE_PACKAGE_MANAGERS, lockFileMap, detectPackageManager, LangRuntime, Brew, Bun, Emacs, Dotnet, Erlang, Go, Java, Node, Php, Python, Ruby, Rust, Swift, runtimes, Project, Node2, Queue, EndError, testElement, finder, typeMappings, matchType, toPath, findUpStop, NodeFS, ANSI_BACKGROUND_OFFSET3, wrapAnsi163, wrapAnsi2563, wrapAnsi16m3, styles4, foregroundColorNames3, backgroundColorNames3, ansiStyles3, ansi_styles_default3, env5, flagForceColor3, supportsColor3, supports_color_default3, stdoutColor2, stderrColor2, GENERATOR2, STYLER2, IS_EMPTY2, levelMapping2, styles22, applyOptions2, chalkFactory2, getModelAnsi2, usedModels2, proto2, createStyler2, createBuilder2, applyStyle2, chalk2, source_default2, MultipleFrameworksCIError;
356996
+ var tslib_es6_exports, extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default, init_tslib_es6, require_shared, require_types, require_path2, require_scope, require_node_path, require_path_visitor, require_equiv, require_fork, require_core4, require_es2016, require_es2020, require_es2021, require_core22, require_es6, require_es20162, require_es2017, require_es2018, require_es2019, require_es20202, require_es20212, require_es2022, require_es_proposals, require_jsx, require_type_annotations, require_flow, require_esprima, require_babel_core, require_babel, require_typescript, require_namedTypes, require_main3, require_tiny_invariant_cjs, require_base644, require_base64_vlq, require_util12, require_array_set, require_mapping_list, require_source_map_generator, require_binary_search, require_quick_sort, require_source_map_consumer, require_source_node, require_source_map, require_util22, require_esprima2, require_esprima3, require_options, require_mapping, require_lines3, require_comments, require_parser2, require_fast_path, require_patcher, require_printer, require_main22, require_babel_options, require_lib5, require_babel2, require_typescript2, require_constants10, require_debug2, require_re, require_parse_options, require_identifiers, require_semver, require_parse5, require_valid, require_clean, require_inc, require_diff, require_major, require_minor, require_patch, require_prerelease, require_compare, require_rcompare, require_compare_loose, require_compare_build, require_sort, require_rsort, require_gt, require_lt, require_eq, require_neq, require_gte, require_lte, require_cmp, require_coerce, require_lrucache, require_range, require_comparator, require_satisfies, require_to_comparators, require_max_satisfying, require_min_satisfying, require_min_version, require_valid2, require_outside, require_gtr, require_ltr, require_intersects, require_simplify, require_subset, require_semver2, require_identity2, require_visit2, require_directives2, require_anchors2, require_applyReviver2, require_toJS2, require_Node2, require_Alias2, require_Scalar2, require_createNode2, require_Collection2, require_stringifyComment2, require_foldFlowLines2, require_stringifyString2, require_stringify2, require_stringifyPair2, require_log2, require_merge2, require_addPairToJSMap2, require_Pair2, require_stringifyCollection2, require_YAMLMap2, require_map2, require_YAMLSeq2, require_seq2, require_string2, require_null2, require_bool3, require_stringifyNumber2, require_float3, require_int3, require_schema4, require_schema22, require_binary2, require_pairs2, require_omap2, require_bool22, require_float22, require_int22, require_set2, require_timestamp2, require_schema32, require_tags2, require_Schema2, require_stringifyDocument2, require_Document2, require_errors5, require_resolve_props2, require_util_contains_newline2, require_util_flow_indent_check2, require_util_map_includes2, require_resolve_block_map2, require_resolve_block_seq2, require_resolve_end2, require_resolve_flow_collection2, require_compose_collection2, require_resolve_block_scalar2, require_resolve_flow_scalar2, require_compose_scalar2, require_util_empty_scalar_position2, require_compose_node2, require_compose_doc2, require_composer2, require_cst_scalar2, require_cst_stringify2, require_cst_visit2, require_cst2, require_lexer2, require_line_counter2, require_parser22, require_public_api3, require_dist6, require_stackframe, require_error_stack_parser, require_iserror, require_stack_generator, require_wrappy, require_once, require_end_of_stream, require_pump, require_byline, require_bugsnag, require_notifier, AutoConfigFrameworkConfigurationError, AutoConfigDetectionError, recast, esprimaParser, typescriptParser, __defProp10, __name22, recast2, fn2, Framework, Analog, esm_default9, Angular, recast3, Astro, NextJs, recast4, updateNuxtConfig, Nuxt, recast5, typescriptParser2, Qwik, recast7, recast6, b2, t4, knownIncompatiblePlugins, b22, ReactRouter, recast8, SolidStart, Static, SvelteKit, TanstackStart, recast9, b3, t22, Vike, vikeConfigExtendsPropName, Vite, recast10, b4, t32, Waku, allKnownFrameworks, staticFramework, allFrameworksInfos, NoOpFramework, allKnownFrameworksIds, LogLevel4, DefaultLogger, FileSystem, import_semver, NPM_DEV_SCRIPTS, EXCLUDED_DEV_SCRIPTS, NPM_BUILD_SCRIPTS, EXCLUDED_BUILD_SCRIPTS, isExcludedDevScript, isExcludedBuildScript, isScript, getSortIndex, sortScriptsByRelevance, isNpmDevScript, isNpmBuildScript, Category, Accuracy, VersionAccuracy, BaseFramework, Analog2, import_semver2, Angular2, Assemble, import_semver3, Astro2, Blitz, Brunch, Cecil, DocPad, Docusaurus, Eleventy, Ember, Expo, import_semver4, Gatsby, Gridsome, Grunt, Gulp, Harp, Hexo, Hono, Hugo, CLASSIC_COMPILER_CONFIG_FILES, CLASSIC_COMPILER_DEV, CLASSIC_COMPILER_BUILD, VITE_CONFIG_FILES, VITE_DEV, VITE_BUILD, Hydrogen, Jekyll, Mastra, Metalsmith, Middleman, import_semver5, Next, Nuxt2, Observable, Parcel, Phenomic, Quasar, Qwik2, import_semver6, ReactRouter2, ReactStatic, CreateReactApp, RedwoodJS, CLASSIC_COMPILER_CONFIG_FILES2, CLASSIC_COMPILER_DEV2, CLASSIC_COMPILER_BUILD2, VITE_CONFIG_FILES2, VITE_DEV2, VITE_BUILD2, Remix, Roots, Sapper, SolidJs, LEGACY_PACKAGE_NAME, LEGACY_DEV, LEGACY_BUILD, SolidStart2, Stencil, SvelteKit2, Svelte, TanStackRouter, import_semver7, TanStackStart, Vike2, Vite2, VitePress, Vue, VuePress, Waku2, Wintersmith, WMR, Zola, frameworks, import_semver9, BaseBuildTool, Bazel, Buck, Gradle, Lage, Lerna, Moon, Nix, import_yaml2, balanced, maybeMatch, range, escSlash, escOpen, escClose, escComma, escPeriod, escSlashPattern, escOpenPattern, escClosePattern, escCommaPattern, escPeriodPattern, slashPattern, openPattern, closePattern, commaPattern, periodPattern, EXPANSION_MAX, MAX_PATTERN_LENGTH, assertValidPattern, posixClasses, braceEscape, regexpEscape, rangesToString, parseClass, unescape2, _a10, types11, isExtglobType, isExtglobAST, adoptionMap, adoptionWithSpaceMap, adoptionAnyMap, usurpMap, startNoTraversal, startNoDot, addPatternStart, justDots, reSpecials, regExpEscape, qmark, star, starNoEmpty, ID, AST, escape2, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path69, sep5, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults2, braceExpand, makeRe, match2, globMagic, regExpEscape2, Minimatch3, defaultIdentifyPackage, WorkspaceInfo, Nx, PNPM, Yarn, NPM, Pants, Rush, Turbo, buildSystems, EventEmitter4, import_js, Bugsnag, normalizeError, import_semver8, AVAILABLE_PACKAGE_MANAGERS, lockFileMap, detectPackageManager, LangRuntime, Brew, Bun, Emacs, Dotnet, Erlang, Go, Java, Node, Php, Python, Ruby, Rust, Swift, runtimes, Project, Node2, Queue, EndError, testElement, finder, typeMappings, matchType, toPath, findUpStop, NodeFS, ANSI_BACKGROUND_OFFSET3, wrapAnsi163, wrapAnsi2563, wrapAnsi16m3, styles4, foregroundColorNames3, backgroundColorNames3, ansiStyles3, ansi_styles_default3, env5, flagForceColor3, supportsColor3, supports_color_default3, stdoutColor2, stderrColor2, GENERATOR2, STYLER2, IS_EMPTY2, levelMapping2, styles22, applyOptions2, chalkFactory2, getModelAnsi2, usedModels2, proto2, createStyler2, createBuilder2, applyStyle2, chalk2, source_default2, MultipleFrameworksCIError, CLOUDFLARE_CONFIG_FILE;
356474
356997
  var init_dist17 = __esm({
356475
356998
  "../autoconfig/dist/index.js"() {
356476
356999
  init_import_meta_url();
@@ -356483,6 +357006,7 @@ var init_dist17 = __esm({
356483
357006
  init_packages2();
356484
357007
  init_command3();
356485
357008
  init_gitignore();
357009
+ init_dist13();
356486
357010
  tslib_es6_exports = {};
356487
357011
  __export6(tslib_es6_exports, {
356488
357012
  __addDisposableResource: /* @__PURE__ */ __name(() => __addDisposableResource, "__addDisposableResource"),
@@ -388042,8 +388566,8 @@ var init_dist17 = __esm({
388042
388566
  }
388043
388567
  // preminor will bump the version up to the next minor release, and immediately
388044
388568
  // down to pre-release. premajor and prepatch work the same way.
388045
- inc(release3, identifier, identifierBase) {
388046
- if (release3.startsWith("pre")) {
388569
+ inc(release4, identifier, identifierBase) {
388570
+ if (release4.startsWith("pre")) {
388047
388571
  if (!identifier && identifierBase === false) {
388048
388572
  throw new Error("invalid increment argument: identifier is empty");
388049
388573
  }
@@ -388054,7 +388578,7 @@ var init_dist17 = __esm({
388054
388578
  }
388055
388579
  }
388056
388580
  }
388057
- switch (release3) {
388581
+ switch (release4) {
388058
388582
  case "premajor":
388059
388583
  this.prerelease.length = 0;
388060
388584
  this.patch = 0;
@@ -388145,7 +388669,7 @@ var init_dist17 = __esm({
388145
388669
  break;
388146
388670
  }
388147
388671
  default:
388148
- throw new Error(`invalid increment argument: ${release3}`);
388672
+ throw new Error(`invalid increment argument: ${release4}`);
388149
388673
  }
388150
388674
  this.raw = this.format();
388151
388675
  if (this.build.length) {
@@ -388199,7 +388723,7 @@ var init_dist17 = __esm({
388199
388723
  require_inc = __commonJS7({
388200
388724
  "../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.js"(exports$1, module2) {
388201
388725
  var SemVer = require_semver();
388202
- var inc = /* @__PURE__ */ __name9((version10, release3, options, identifier, identifierBase) => {
388726
+ var inc = /* @__PURE__ */ __name9((version10, release4, options, identifier, identifierBase) => {
388203
388727
  if (typeof options === "string") {
388204
388728
  identifierBase = identifier;
388205
388729
  identifier = options;
@@ -388209,7 +388733,7 @@ var init_dist17 = __esm({
388209
388733
  return new SemVer(
388210
388734
  version10 instanceof SemVer ? version10.version : version10,
388211
388735
  options
388212
- ).inc(release3, identifier, identifierBase).version;
388736
+ ).inc(release4, identifier, identifierBase).version;
388213
388737
  } catch (er2) {
388214
388738
  return null;
388215
388739
  }
@@ -400058,7 +400582,9 @@ ${end.comment}` : end.comment;
400058
400582
  this.id = frameworkInfo.id;
400059
400583
  this.name = frameworkInfo.name;
400060
400584
  }
400061
- isConfigured(_projectPath) {
400585
+ isConfigured(_projectPath, {
400586
+ target: _target = "cf"
400587
+ } = {}) {
400062
400588
  return false;
400063
400589
  }
400064
400590
  configurationDescription;
@@ -400117,13 +400643,14 @@ ${end.comment}` : end.comment;
400117
400643
  await updateViteConfig(projectPath);
400118
400644
  }
400119
400645
  return {
400120
- wranglerConfig: {
400121
- main: "./dist/analog/server/index.mjs",
400122
- assets: {
400123
- binding: "ASSETS",
400124
- directory: "./dist/analog/public"
400646
+ buildTool: "wrangler",
400647
+ workerConfig: {
400648
+ entrypoint: "./dist/analog/server/index.mjs",
400649
+ env: {
400650
+ ASSETS: { type: "assets" }
400125
400651
  }
400126
- }
400652
+ },
400653
+ buildConfig: { assetsDirectory: "./dist/analog/public" }
400127
400654
  };
400128
400655
  }
400129
400656
  };
@@ -400157,22 +400684,21 @@ ${end.comment}` : end.comment;
400157
400684
  await installAdditionalDependencies(packageManager, isWorkspaceRoot);
400158
400685
  }
400159
400686
  return {
400160
- wranglerConfig: {
400161
- main: "./dist/server/server.mjs",
400162
- assets: {
400163
- binding: "ASSETS",
400164
- directory: `${outputDir}browser`
400687
+ buildTool: "wrangler",
400688
+ workerConfig: {
400689
+ entrypoint: "./dist/server/server.mjs",
400690
+ env: {
400691
+ ASSETS: { type: "assets" }
400165
400692
  }
400166
- }
400693
+ },
400694
+ buildConfig: { assetsDirectory: `${outputDir}browser` }
400167
400695
  };
400168
400696
  } else {
400169
400697
  this.configurationDescription = "Configuring Angular SPA project (assets only)";
400170
400698
  return {
400171
- wranglerConfig: {
400172
- assets: {
400173
- directory: outputDir
400174
- }
400175
- }
400699
+ buildTool: "wrangler",
400700
+ workerConfig: {},
400701
+ buildConfig: { assetsDirectory: outputDir }
400176
400702
  };
400177
400703
  }
400178
400704
  }
@@ -400226,18 +400752,19 @@ ${end.comment}` : end.comment;
400226
400752
  }
400227
400753
  if (semiver_default2(astroVersion, "6.0.0") < 0) {
400228
400754
  return {
400229
- wranglerConfig: {
400230
- main: `${outputDir}/_worker.js/index.js`,
400231
- compatibility_flags: ["global_fetch_strictly_public"],
400232
- assets: {
400233
- binding: "ASSETS",
400234
- directory: outputDir
400755
+ buildTool: "wrangler",
400756
+ workerConfig: {
400757
+ entrypoint: `${outputDir}/_worker.js/index.js`,
400758
+ compatibilityFlags: ["global_fetch_strictly_public"],
400759
+ env: {
400760
+ ASSETS: { type: "assets" }
400235
400761
  }
400236
- }
400762
+ },
400763
+ buildConfig: { assetsDirectory: outputDir }
400237
400764
  };
400238
400765
  }
400239
400766
  return {
400240
- wranglerConfig: null
400767
+ workerConfig: null
400241
400768
  };
400242
400769
  }
400243
400770
  configurationDescription = 'Configuring project for Astro with "astro add cloudflare"';
@@ -400281,7 +400808,7 @@ ${end.comment}` : end.comment;
400281
400808
  }
400282
400809
  return {
400283
400810
  // `@opennextjs/cloudflare migrate` creates the wrangler config file
400284
- wranglerConfig: {},
400811
+ workerConfig: {},
400285
400812
  packageJsonScriptsOverrides: {
400286
400813
  preview: "opennextjs-cloudflare build && opennextjs-cloudflare preview",
400287
400814
  deploy: "opennextjs-cloudflare build && opennextjs-cloudflare deploy"
@@ -400356,16 +400883,17 @@ ${end.comment}` : end.comment;
400356
400883
  updateNuxtConfig(projectPath);
400357
400884
  }
400358
400885
  return {
400359
- wranglerConfig: {
400360
- main: "./.output/server/index.mjs",
400361
- assets: {
400362
- binding: "ASSETS",
400363
- directory: "./.output/public/"
400886
+ buildTool: "wrangler",
400887
+ workerConfig: {
400888
+ entrypoint: "./.output/server/index.mjs",
400889
+ env: {
400890
+ ASSETS: { type: "assets" }
400364
400891
  },
400365
400892
  observability: {
400366
400893
  enabled: true
400367
400894
  }
400368
- }
400895
+ },
400896
+ buildConfig: { assetsDirectory: "./.output/public/" }
400369
400897
  };
400370
400898
  }
400371
400899
  configurationDescription = "Configuring project for Nuxt";
@@ -400400,14 +400928,15 @@ ${end.comment}` : end.comment;
400400
400928
  addBindingsProxy(projectPath);
400401
400929
  }
400402
400930
  return {
400403
- wranglerConfig: {
400404
- main: "./dist/_worker.js",
400405
- compatibility_flags: ["global_fetch_strictly_public"],
400406
- assets: {
400407
- binding: "ASSET",
400408
- directory: "./dist"
400931
+ buildTool: "wrangler",
400932
+ workerConfig: {
400933
+ entrypoint: "./dist/_worker.js",
400934
+ compatibilityFlags: ["global_fetch_strictly_public"],
400935
+ env: {
400936
+ ASSET: { type: "assets" }
400409
400937
  }
400410
400938
  },
400939
+ buildConfig: { assetsDirectory: "./dist" },
400411
400940
  packageJsonScriptsOverrides: {
400412
400941
  preview: `${packageManager.type} run build && wrangler dev`,
400413
400942
  deploy: `${packageManager.type} run build && wrangler deploy`
@@ -400499,8 +401028,9 @@ ${end.comment}` : end.comment;
400499
401028
  }
400500
401029
  }
400501
401030
  return {
400502
- wranglerConfig: {
400503
- main: "./workers/app.ts"
401031
+ buildTool: "vite",
401032
+ workerConfig: {
401033
+ entrypoint: "./workers/app.ts"
400504
401034
  }
400505
401035
  };
400506
401036
  }
@@ -400527,13 +401057,14 @@ ${end.comment}` : end.comment;
400527
401057
  }
400528
401058
  }
400529
401059
  return {
400530
- wranglerConfig: {
400531
- main: "./.output/server/index.mjs",
400532
- assets: {
400533
- binding: "ASSETS",
400534
- directory: "./.output/public"
401060
+ buildTool: "wrangler",
401061
+ workerConfig: {
401062
+ entrypoint: "./.output/server/index.mjs",
401063
+ env: {
401064
+ ASSETS: { type: "assets" }
400535
401065
  }
400536
- }
401066
+ },
401067
+ buildConfig: { assetsDirectory: "./.output/public" }
400537
401068
  };
400538
401069
  }
400539
401070
  };
@@ -400550,11 +401081,9 @@ ${end.comment}` : end.comment;
400550
401081
  }
400551
401082
  configure({ outputDir }) {
400552
401083
  return {
400553
- wranglerConfig: {
400554
- assets: {
400555
- directory: outputDir
400556
- }
400557
- }
401084
+ buildTool: "wrangler",
401085
+ workerConfig: {},
401086
+ buildConfig: { assetsDirectory: outputDir }
400558
401087
  };
400559
401088
  }
400560
401089
  };
@@ -400599,13 +401128,14 @@ ${end.comment}` : end.comment;
400599
401128
  });
400600
401129
  }
400601
401130
  return {
400602
- wranglerConfig: {
400603
- main: ".svelte-kit/cloudflare/_worker.js",
400604
- assets: {
400605
- binding: "ASSETS",
400606
- directory: ".svelte-kit/cloudflare"
401131
+ buildTool: "wrangler",
401132
+ workerConfig: {
401133
+ entrypoint: ".svelte-kit/cloudflare/_worker.js",
401134
+ env: {
401135
+ ASSETS: { type: "assets" }
400607
401136
  }
400608
- }
401137
+ },
401138
+ buildConfig: { assetsDirectory: ".svelte-kit/cloudflare" }
400609
401139
  };
400610
401140
  }
400611
401141
  configurationDescription = 'Configuring project for SvelteKit with "sv add"';
@@ -400632,8 +401162,9 @@ ${end.comment}` : end.comment;
400632
401162
  transformViteConfig(projectPath, { viteEnvironmentName: "ssr" });
400633
401163
  }
400634
401164
  return {
400635
- wranglerConfig: {
400636
- main: "@tanstack/react-start/server-entry"
401165
+ buildTool: "vite",
401166
+ workerConfig: {
401167
+ entrypoint: "@tanstack/react-start/server-entry"
400637
401168
  }
400638
401169
  };
400639
401170
  }
@@ -400682,8 +401213,9 @@ ${end.comment}` : end.comment;
400682
401213
  addVikePhotonToConfigFile(projectPath);
400683
401214
  }
400684
401215
  return {
400685
- wranglerConfig: {
400686
- main: "virtual:photon:cloudflare:server-entry"
401216
+ buildTool: "vite",
401217
+ workerConfig: {
401218
+ entrypoint: "virtual:photon:cloudflare:server-entry"
400687
401219
  },
400688
401220
  packageJsonScriptsOverrides: {
400689
401221
  preview: "vike build && vike preview",
@@ -400716,7 +401248,10 @@ ${end.comment}` : end.comment;
400716
401248
  static {
400717
401249
  __name9(this, "Vite");
400718
401250
  }
400719
- isConfigured(projectPath) {
401251
+ isConfigured(projectPath, { target = "cf" } = {}) {
401252
+ if (target !== "wrangler") {
401253
+ return false;
401254
+ }
400720
401255
  if (!hasViteConfig(projectPath)) {
400721
401256
  return false;
400722
401257
  }
@@ -400741,9 +401276,10 @@ ${end.comment}` : end.comment;
400741
401276
  }
400742
401277
  }
400743
401278
  return {
400744
- wranglerConfig: {
401279
+ buildTool: "vite",
401280
+ workerConfig: {
400745
401281
  assets: {
400746
- not_found_handling: "single-page-application"
401282
+ notFoundHandling: "single-page-application"
400747
401283
  }
400748
401284
  }
400749
401285
  };
@@ -400783,14 +401319,17 @@ ${end.comment}` : end.comment;
400783
401319
  await updateWakuConfig(projectPath);
400784
401320
  }
400785
401321
  return {
400786
- wranglerConfig: {
400787
- main: "./src/waku.server",
401322
+ buildTool: "wrangler",
401323
+ workerConfig: {
401324
+ entrypoint: "./src/waku.server",
400788
401325
  assets: {
400789
- binding: "ASSETS",
400790
- directory: "./dist/public",
400791
- html_handling: "drop-trailing-slash"
401326
+ htmlHandling: "drop-trailing-slash"
401327
+ },
401328
+ env: {
401329
+ ASSETS: { type: "assets" }
400792
401330
  }
400793
- }
401331
+ },
401332
+ buildConfig: { assetsDirectory: "./dist/public" }
400794
401333
  };
400795
401334
  }
400796
401335
  };
@@ -401022,7 +401561,7 @@ ${end.comment}` : end.comment;
401022
401561
  }
401023
401562
  async configure() {
401024
401563
  return {
401025
- wranglerConfig: {}
401564
+ workerConfig: {}
401026
401565
  };
401027
401566
  }
401028
401567
  };
@@ -406560,6 +407099,7 @@ ${error115.stack}`;
406560
407099
  __name9(isPagesProject, "isPagesProject");
406561
407100
  __name(maybeFindDetectedFramework, "maybeFindDetectedFramework");
406562
407101
  __name9(maybeFindDetectedFramework, "maybeFindDetectedFramework");
407102
+ CLOUDFLARE_CONFIG_FILE = "cloudflare.config.ts";
406563
407103
  __name(assertNonConfigured, "assertNonConfigured");
406564
407104
  __name9(assertNonConfigured, "assertNonConfigured");
406565
407105
  __name(hasIndexHtml, "hasIndexHtml");
@@ -406568,18 +407108,32 @@ ${error115.stack}`;
406568
407108
  __name9(findAssetsDir, "findAssetsDir");
406569
407109
  __name(getDetailsForAutoConfig, "getDetailsForAutoConfig");
406570
407110
  __name9(getDetailsForAutoConfig, "getDetailsForAutoConfig");
406571
- __name(getProjectBuildCommand, "getProjectBuildCommand");
406572
- __name9(getProjectBuildCommand, "getProjectBuildCommand");
407111
+ __name(getProjectCommand, "getProjectCommand");
407112
+ __name9(getProjectCommand, "getProjectCommand");
406573
407113
  __name(displayAutoConfigDetails, "displayAutoConfigDetails");
406574
407114
  __name9(displayAutoConfigDetails, "displayAutoConfigDetails");
406575
407115
  __name(confirmAutoConfigDetails, "confirmAutoConfigDetails");
406576
407116
  __name9(confirmAutoConfigDetails, "confirmAutoConfigDetails");
406577
407117
  __name(runAutoConfig, "runAutoConfig");
406578
407118
  __name9(runAutoConfig, "runAutoConfig");
407119
+ __name(mergeWorkerConfig, "mergeWorkerConfig");
407120
+ __name9(mergeWorkerConfig, "mergeWorkerConfig");
407121
+ __name(getWranglerConfig, "getWranglerConfig");
407122
+ __name9(getWranglerConfig, "getWranglerConfig");
406579
407123
  __name(ensureNodejsCompatIsEnabled, "ensureNodejsCompatIsEnabled");
406580
407124
  __name9(ensureNodejsCompatIsEnabled, "ensureNodejsCompatIsEnabled");
406581
407125
  __name(saveWranglerJsonc, "saveWranglerJsonc");
406582
407126
  __name9(saveWranglerJsonc, "saveWranglerJsonc");
407127
+ __name(saveCloudflareConfig, "saveCloudflareConfig");
407128
+ __name9(saveCloudflareConfig, "saveCloudflareConfig");
407129
+ __name(saveWranglerConfigTs, "saveWranglerConfigTs");
407130
+ __name9(saveWranglerConfigTs, "saveWranglerConfigTs");
407131
+ __name(renderCloudflareConfig, "renderCloudflareConfig");
407132
+ __name9(renderCloudflareConfig, "renderCloudflareConfig");
407133
+ __name(renderWranglerConfigTs, "renderWranglerConfigTs");
407134
+ __name9(renderWranglerConfigTs, "renderWranglerConfigTs");
407135
+ __name(indentFileContent, "indentFileContent");
407136
+ __name9(indentFileContent, "indentFileContent");
406583
407137
  __name(buildOperationsSummary, "buildOperationsSummary");
406584
407138
  __name9(buildOperationsSummary, "buildOperationsSummary");
406585
407139
  __name(getDirWranglerJsonConfigPath, "getDirWranglerJsonConfigPath");
@@ -406652,6 +407206,7 @@ async function runAutoConfigDetection({
406652
407206
  try {
406653
407207
  const details = await getDetailsForAutoConfig({
406654
407208
  wranglerConfig,
407209
+ target: "wrangler",
406655
407210
  context: context2
406656
407211
  });
406657
407212
  sendMetricsEvent(
@@ -406689,7 +407244,10 @@ async function runAutoConfigLogic(details, options) {
406689
407244
  {}
406690
407245
  );
406691
407246
  try {
406692
- const summary = await runAutoConfig(details, options);
407247
+ const summary = await runAutoConfig(details, {
407248
+ ...options,
407249
+ target: "wrangler"
407250
+ });
406693
407251
  sendMetricsEvent(
406694
407252
  "autoconfig_configuration_completed",
406695
407253
  {
@@ -412460,6 +413018,16 @@ async function patchConfig(config6, id, body) {
412460
413018
  }
412461
413019
  );
412462
413020
  }
413021
+ async function createDatabaseSignature(config6, integration) {
413022
+ const accountId = await requireAuth(config6);
413023
+ return await fetchResult2(
413024
+ config6,
413025
+ `/accounts/${accountId}/hyperdrive/integrationsOperations/${integration}/createDatabaseSignature`,
413026
+ {
413027
+ method: "POST"
413028
+ }
413029
+ );
413030
+ }
412463
413031
  var PostgresSslmode, MySqlSslmode;
412464
413032
  var init_client10 = __esm({
412465
413033
  "src/hyperdrive/client.ts"() {
@@ -412473,6 +413041,7 @@ var init_client10 = __esm({
412473
413041
  __name(getConfig, "getConfig");
412474
413042
  __name(listConfigs, "listConfigs");
412475
413043
  __name(patchConfig, "patchConfig");
413044
+ __name(createDatabaseSignature, "createDatabaseSignature");
412476
413045
  }
412477
413046
  });
412478
413047
 
@@ -412998,6 +413567,42 @@ var init_list17 = __esm({
412998
413567
  }
412999
413568
  });
413000
413569
 
413570
+ // src/hyperdrive/planetscale.ts
413571
+ var hyperdrivePlanetscaleNamespace, hyperdrivePlanetscaleSignatureCommand;
413572
+ var init_planetscale = __esm({
413573
+ "src/hyperdrive/planetscale.ts"() {
413574
+ init_import_meta_url();
413575
+ init_create_command();
413576
+ init_logger();
413577
+ init_client10();
413578
+ hyperdrivePlanetscaleNamespace = createNamespace({
413579
+ metadata: {
413580
+ description: "Authorize Cloudflare-billed PlanetScale databases",
413581
+ status: "experimental",
413582
+ owner: "Product: Hyperdrive"
413583
+ }
413584
+ });
413585
+ hyperdrivePlanetscaleSignatureCommand = createCommand({
413586
+ metadata: {
413587
+ description: "Generate a signed authorization for creating a Cloudflare-billed PlanetScale database",
413588
+ status: "experimental",
413589
+ owner: "Product: Hyperdrive"
413590
+ },
413591
+ // Print only JSON, so the output can be piped into `pscale database create`.
413592
+ behaviour: { printBanner: false },
413593
+ args: {},
413594
+ async handler(_args, { config: config6 }) {
413595
+ const signature = await createDatabaseSignature(config6, "planetScale");
413596
+ logger2.json({
413597
+ account_id: signature.account_id,
413598
+ timestamp: signature.timestamp,
413599
+ signature: signature.signature
413600
+ });
413601
+ }
413602
+ });
413603
+ }
413604
+ });
413605
+
413001
413606
  // src/hyperdrive/update.ts
413002
413607
  var hyperdriveUpdateCommand;
413003
413608
  var init_update7 = __esm({
@@ -424206,13 +424811,13 @@ var init_dist_es8 = __esm({
424206
424811
  });
424207
424812
 
424208
424813
  // ../../node_modules/.pnpm/@smithy+util-base64@3.0.0/node_modules/@smithy/util-base64/dist-es/toBase64.js
424209
- var toBase642;
424814
+ var toBase64;
424210
424815
  var init_toBase64 = __esm({
424211
424816
  "../../node_modules/.pnpm/@smithy+util-base64@3.0.0/node_modules/@smithy/util-base64/dist-es/toBase64.js"() {
424212
424817
  init_import_meta_url();
424213
424818
  init_dist_es7();
424214
424819
  init_dist_es8();
424215
- toBase642 = /* @__PURE__ */ __name((_input) => {
424820
+ toBase64 = /* @__PURE__ */ __name((_input) => {
424216
424821
  let input;
424217
424822
  if (typeof _input === "string") {
424218
424823
  input = fromUtf8(_input);
@@ -424239,7 +424844,7 @@ var init_dist_es9 = __esm({
424239
424844
  // ../../node_modules/.pnpm/@smithy+util-stream@3.3.4/node_modules/@smithy/util-stream/dist-es/blob/transforms.js
424240
424845
  function transformToString(payload, encoding = "utf-8") {
424241
424846
  if (encoding === "base64") {
424242
- return toBase642(payload);
424847
+ return toBase64(payload);
424243
424848
  }
424244
424849
  return toUtf8(payload);
424245
424850
  }
@@ -425074,7 +425679,7 @@ var init_sdk_stream_mixin_browser = __esm({
425074
425679
  transformToString: /* @__PURE__ */ __name(async (encoding) => {
425075
425680
  const buf = await transformToByteArray();
425076
425681
  if (encoding === "base64") {
425077
- return toBase642(buf);
425682
+ return toBase64(buf);
425078
425683
  } else if (encoding === "hex") {
425079
425684
  return toHex(buf);
425080
425685
  } else if (encoding === void 0 || encoding === "utf8" || encoding === "utf-8") {
@@ -425292,7 +425897,7 @@ var init_ChecksumStream = __esm({
425292
425897
  } else {
425293
425898
  throw new Error(`@smithy/util-stream: unsupported source type ${source?.constructor?.name ?? source} in ChecksumStream.`);
425294
425899
  }
425295
- this.base64Encoder = base64Encoder ?? toBase642;
425900
+ this.base64Encoder = base64Encoder ?? toBase64;
425296
425901
  this.expectedChecksum = expectedChecksum;
425297
425902
  this.checksum = checksum;
425298
425903
  this.checksumSourceLocation = checksumSourceLocation;
@@ -425353,7 +425958,7 @@ var init_createChecksumStream_browser = __esm({
425353
425958
  if (!isReadableStream(source)) {
425354
425959
  throw new Error(`@smithy/util-stream: unsupported source type ${source?.constructor?.name ?? source} in ChecksumStream.`);
425355
425960
  }
425356
- const encoder2 = base64Encoder ?? toBase642;
425961
+ const encoder2 = base64Encoder ?? toBase64;
425357
425962
  if (typeof TransformStream !== "function") {
425358
425963
  throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");
425359
425964
  }
@@ -445323,7 +445928,7 @@ var init_runtimeConfig_shared = __esm({
445323
445928
  return {
445324
445929
  apiVersion: "2019-06-10",
445325
445930
  base64Decoder: config6?.base64Decoder ?? fromBase64,
445326
- base64Encoder: config6?.base64Encoder ?? toBase642,
445931
+ base64Encoder: config6?.base64Encoder ?? toBase64,
445327
445932
  disableHostPrefix: config6?.disableHostPrefix ?? false,
445328
445933
  endpointProvider: config6?.endpointProvider ?? defaultEndpointResolver2,
445329
445934
  extensions: config6?.extensions ?? [],
@@ -447100,7 +447705,7 @@ var init_runtimeConfig_shared2 = __esm({
447100
447705
  return {
447101
447706
  apiVersion: "2019-06-10",
447102
447707
  base64Decoder: config6?.base64Decoder ?? fromBase64,
447103
- base64Encoder: config6?.base64Encoder ?? toBase642,
447708
+ base64Encoder: config6?.base64Encoder ?? toBase64,
447104
447709
  disableHostPrefix: config6?.disableHostPrefix ?? false,
447105
447710
  endpointProvider: config6?.endpointProvider ?? defaultEndpointResolver3,
447106
447711
  extensions: config6?.extensions ?? [],
@@ -448364,7 +448969,7 @@ var init_runtimeConfig_shared3 = __esm({
448364
448969
  return {
448365
448970
  apiVersion: "2011-06-15",
448366
448971
  base64Decoder: config6?.base64Decoder ?? fromBase64,
448367
- base64Encoder: config6?.base64Encoder ?? toBase642,
448972
+ base64Encoder: config6?.base64Encoder ?? toBase64,
448368
448973
  disableHostPrefix: config6?.disableHostPrefix ?? false,
448369
448974
  endpointProvider: config6?.endpointProvider ?? defaultEndpointResolver4,
448370
448975
  extensions: config6?.extensions ?? [],
@@ -451533,7 +452138,7 @@ var init_runtimeConfig_shared4 = __esm({
451533
452138
  return {
451534
452139
  apiVersion: "2006-03-01",
451535
452140
  base64Decoder: config6?.base64Decoder ?? fromBase64,
451536
- base64Encoder: config6?.base64Encoder ?? toBase642,
452141
+ base64Encoder: config6?.base64Encoder ?? toBase64,
451537
452142
  disableHostPrefix: config6?.disableHostPrefix ?? false,
451538
452143
  endpointProvider: config6?.endpointProvider ?? defaultEndpointResolver,
451539
452144
  extensions: config6?.extensions ?? [],
@@ -458955,7 +459560,7 @@ async function patchPreviewDeploymentSecrets(config6, accountId, workerName, pre
458955
459560
  throw e9;
458956
459561
  }
458957
459562
  }
458958
- var previewSecretNamespace, NO_PREVIEW_DEPLOYMENT_PATCH_ERR_CODE, NO_PREVIEW_DEPLOYMENT_GET_ERR_CODE, PREVIEW_NOT_FOUND_ERR_CODE, NO_ACTIVE_PREVIEW_URLS_MESSAGE;
459563
+ var previewSecretNamespace, NO_PREVIEW_DEPLOYMENT_PATCH_ERR_CODE, NO_PREVIEW_DEPLOYMENT_GET_ERR_CODE, PREVIEW_NOT_FOUND_ERR_CODE;
458959
459564
  var init_secrets5 = __esm({
458960
459565
  "src/preview/secrets/index.ts"() {
458961
459566
  init_import_meta_url();
@@ -458975,7 +459580,6 @@ var init_secrets5 = __esm({
458975
459580
  NO_PREVIEW_DEPLOYMENT_PATCH_ERR_CODE = 10032;
458976
459581
  NO_PREVIEW_DEPLOYMENT_GET_ERR_CODE = 10222;
458977
459582
  PREVIEW_NOT_FOUND_ERR_CODE = 10025;
458978
- NO_ACTIVE_PREVIEW_URLS_MESSAGE = "Note: This Preview deployment has no active URLs. To get one, enable Preview Deployments on workers.dev or a custom domain. See https://developers.cloudflare.com/workers/previews/custom-domains/ for more information";
458979
459583
  __name(noPreviewDeploymentPatchMessage, "noPreviewDeploymentPatchMessage");
458980
459584
  __name(noPreviewDeploymentListMessage, "noPreviewDeploymentListMessage");
458981
459585
  __name(previewNotFoundMessage, "previewNotFoundMessage");
@@ -466307,7 +466911,7 @@ var init_setup2 = __esm({
466307
466911
  runBuild: args.build,
466308
466912
  skipConfirmations: args.yes,
466309
466913
  dryRun: !!args.dryRun,
466310
- enableWranglerInstallation: args.installWrangler
466914
+ enableTargetCliInstallation: args.installWrangler
466311
466915
  });
466312
466916
  } catch (error115) {
466313
466917
  sendAutoConfigProcessEndedMetricsEvent({
@@ -478171,6 +478775,14 @@ function createCLIParser(argv) {
478171
478775
  },
478172
478776
  { command: "wrangler hyperdrive get", definition: hyperdriveGetCommand },
478173
478777
  { command: "wrangler hyperdrive list", definition: hyperdriveListCommand },
478778
+ {
478779
+ command: "wrangler hyperdrive planetscale",
478780
+ definition: hyperdrivePlanetscaleNamespace
478781
+ },
478782
+ {
478783
+ command: "wrangler hyperdrive planetscale signature",
478784
+ definition: hyperdrivePlanetscaleSignatureCommand
478785
+ },
478174
478786
  {
478175
478787
  command: "wrangler hyperdrive update",
478176
478788
  definition: hyperdriveUpdateCommand
@@ -479419,6 +480031,7 @@ var init_src2 = __esm({
479419
480031
  init_get9();
479420
480032
  init_hyperdrive2();
479421
480033
  init_list17();
480034
+ init_planetscale();
479422
480035
  init_update7();
479423
480036
  init_init();
479424
480037
  init_kv2();