wrangler 4.147.0 → 4.148.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.
@@ -3593,12 +3593,23 @@ function findRedirectedWranglerConfig(cwd2, userConfigPath) {
3593
3593
  );
3594
3594
  }
3595
3595
  if (userConfigPath) {
3596
- if (path28__namespace.default.join(path28__namespace.default.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) {
3596
+ const expectedDeployConfigPath = path28__namespace.default.join(
3597
+ path28__namespace.default.dirname(userConfigPath),
3598
+ PATH_TO_DEPLOY_CONFIG
3599
+ );
3600
+ if (expectedDeployConfigPath !== deployConfigPath) {
3597
3601
  throw new UserError(
3598
3602
  esm_default`
3599
3603
  Found both a user configuration file at "${path28__namespace.default.relative(".", userConfigPath)}"
3600
3604
  and a deploy configuration file at "${path28__namespace.default.relative(".", deployConfigPath)}".
3601
3605
  But these do not share the same base path so it is not clear which should be used.
3606
+
3607
+ A deploy configuration file is generated by a build tool to redirect Wrangler to the configuration it generated.
3608
+ It is only applied when it sits alongside the user configuration file, which here would be "${path28__namespace.default.relative(".", expectedDeployConfigPath)}".
3609
+
3610
+ Please either delete "${path28__namespace.default.relative(".", deployConfigPath)}" if it is left over from a previous build,
3611
+ or try running this command from the directory containing the configuration you want to use.
3612
+ See https://developers.cloudflare.com/workers/wrangler/configuration/#generated-wrangler-configuration
3602
3613
  `,
3603
3614
  { telemetryMessage: false }
3604
3615
  );
@@ -24213,6 +24224,13 @@ Please add a binding for each to "${fieldPath}.bindings":
24213
24224
  "string",
24214
24225
  ["single-page-application", "404-page", "none"]
24215
24226
  ) && isValid;
24227
+ isValid = validateOptionalProperty(
24228
+ diagnostics,
24229
+ field,
24230
+ "base_path",
24231
+ value.base_path,
24232
+ "string"
24233
+ ) && isValid;
24216
24234
  if (value.run_worker_first !== void 0) {
24217
24235
  if (typeof value.run_worker_first === "boolean") {
24218
24236
  isValid = validateOptionalProperty(
@@ -24243,6 +24261,7 @@ Please add a binding for each to "${fieldPath}.bindings":
24243
24261
  "binding",
24244
24262
  "html_handling",
24245
24263
  "not_found_handling",
24264
+ "base_path",
24246
24265
  "run_worker_first"
24247
24266
  ]) && isValid;
24248
24267
  return isValid;
@@ -27412,7 +27431,7 @@ var DEFAULT_COMPAT_DATE;
27412
27431
  var init_default_compat_date = __esm({
27413
27432
  "../workers-utils/src/default-compat-date.ts"() {
27414
27433
  init_import_meta_url();
27415
- DEFAULT_COMPAT_DATE = "2026-10-01";
27434
+ DEFAULT_COMPAT_DATE = "2026-10-06";
27416
27435
  }
27417
27436
  });
27418
27437
 
@@ -58006,10 +58025,25 @@ function startTunnel(options) {
58006
58025
  const reminderIntervalMs = options.reminderIntervalMs ?? DEFAULT_TUNNEL_REMINDER_INTERVAL_MS;
58007
58026
  const defaultExpiryMs = options.expiryMs ?? DEFAULT_TUNNEL_EXPIRY_MS;
58008
58027
  const isNamedTunnel = options.token !== void 0;
58028
+ if (isNamedTunnel && (options.allowedMail?.length ?? 0) > 0) {
58029
+ throw new UserError(
58030
+ "The `allowedMail` option is only supported for Quick Tunnels.",
58031
+ { telemetryMessage: "tunnel allowed mail named tunnel conflict" }
58032
+ );
58033
+ }
58009
58034
  const timeFormatter = new Intl.DateTimeFormat(void 0, {
58010
58035
  timeStyle: "short"
58011
58036
  });
58012
- const cloudflaredArgs = isNamedTunnel ? ["tunnel", "--no-autoupdate", "run"] : ["tunnel", "--no-autoupdate", "--url", options.origin.href];
58037
+ const cloudflaredArgs = isNamedTunnel ? ["tunnel", "--no-autoupdate", "run"] : [
58038
+ "tunnel",
58039
+ "--no-autoupdate",
58040
+ "--url",
58041
+ options.origin.href,
58042
+ ...(options.allowedMail ?? []).flatMap((allowedMail) => [
58043
+ "--allowed-mail",
58044
+ allowedMail
58045
+ ])
58046
+ ];
58013
58047
  const cloudflaredPromise = spawnCloudflared(cloudflaredArgs, {
58014
58048
  stdio: "pipe",
58015
58049
  env: options.token ? { TUNNEL_TOKEN: options.token } : void 0,
@@ -63071,7 +63105,7 @@ var name, version2;
63071
63105
  var init_package = __esm({
63072
63106
  "package.json"() {
63073
63107
  name = "wrangler";
63074
- version2 = "4.147.0";
63108
+ version2 = "4.148.0";
63075
63109
  }
63076
63110
  });
63077
63111
 
@@ -125271,7 +125305,7 @@ function getCachedTemporaryPreviewAccount(storage) {
125271
125305
  }
125272
125306
  return temporaryPreviewAccount;
125273
125307
  }
125274
- async function requestPowSolution(logger7) {
125308
+ async function requestPowSolution(temporaryAccountLogger) {
125275
125309
  const response = await (0, import_undici3.fetch)(getTemporaryPreviewChallengeUrl(), {
125276
125310
  method: "POST",
125277
125311
  headers: { "Content-Type": "application/json" },
@@ -125309,11 +125343,11 @@ async function requestPowSolution(logger7) {
125309
125343
  }
125310
125344
  );
125311
125345
  }
125312
- logger7.log("Solving proof-of-work challenge\u2026");
125346
+ temporaryAccountLogger.log("Solving proof-of-work challenge\u2026");
125313
125347
  return solveChallenge({ challengeToken, seed, k: k7, g: g7 });
125314
125348
  }
125315
- async function createTemporaryPreviewAccount(logger7, request4) {
125316
- const pow = await requestPowSolution(logger7);
125349
+ async function createTemporaryPreviewAccount(temporaryAccountLogger, request4) {
125350
+ const pow = await requestPowSolution(temporaryAccountLogger);
125317
125351
  const response = await (0, import_undici3.fetch)(getTemporaryPreviewUrl(), {
125318
125352
  method: "POST",
125319
125353
  headers: { "Content-Type": "application/json" },
@@ -125407,7 +125441,7 @@ async function getOrCreateTemporaryPreviewAccount(options) {
125407
125441
  });
125408
125442
  }
125409
125443
  const temporaryPreviewAccount = await createTemporaryPreviewAccount(
125410
- options.logger,
125444
+ options.temporaryAccountLogger,
125411
125445
  options.request
125412
125446
  );
125413
125447
  options.storage.write(temporaryPreviewAccount);
@@ -126509,7 +126543,6 @@ function createOAuthFlow(ctx) {
126509
126543
  }
126510
126544
  const result = await getOrCreateTemporaryPreviewAccount({
126511
126545
  ...ctx.temporary,
126512
- logger: ctx.logger,
126513
126546
  ...temporaryRequest ? { request: temporaryRequest } : {}
126514
126547
  });
126515
126548
  activeTemporaryAccount = result.account;
@@ -127420,8 +127453,8 @@ function scrubEncryptedCredentials(options) {
127420
127453
  return { backendAvailable: false, encryptedFileExisted };
127421
127454
  }
127422
127455
  var import_undici3, 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, EVENT_ACCOUNT_ERRORS, esm_default3, ErrorOAuth2, ErrorUnknown, ErrorAuthServerUnreachable, 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, BARE_KEY2, HAS_WELLFORMED2, 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;
127423
- var init_chunk_FT2NMTJB = __esm({
127424
- "../workers-auth/dist/chunk-FT2NMTJB.mjs"() {
127456
+ var init_chunk_NDZDTP46 = __esm({
127457
+ "../workers-auth/dist/chunk-NDZDTP46.mjs"() {
127425
127458
  init_import_meta_url();
127426
127459
  init_chunk_VAZEJK55();
127427
127460
  init_src();
@@ -128413,7 +128446,7 @@ var init_chunk_FT2NMTJB = __esm({
128413
128446
  var init_dist2 = __esm({
128414
128447
  "../workers-auth/dist/index.mjs"() {
128415
128448
  init_import_meta_url();
128416
- init_chunk_FT2NMTJB();
128449
+ init_chunk_NDZDTP46();
128417
128450
  nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
128418
128451
  }
128419
128452
  });
@@ -128674,10 +128707,10 @@ function createFileStorage(format9, getPath) {
128674
128707
  };
128675
128708
  }
128676
128709
  function createTemporaryTermsPrompt(deps) {
128677
- const { logger: logger7, prompt: prompt3 } = deps;
128710
+ const { temporaryAccountLogger, prompt: prompt3 } = deps;
128678
128711
  return /* @__PURE__ */ __name2(/* @__PURE__ */ __name(async function ensureTemporaryTermsAccepted(question, notice) {
128679
128712
  if (isNonInteractiveOrCI()) {
128680
- logger7.log(notice);
128713
+ temporaryAccountLogger.log(notice);
128681
128714
  return true;
128682
128715
  }
128683
128716
  const answer = await prompt3(question);
@@ -128700,9 +128733,9 @@ function notLoggedInErrorBodies(loginCommand2) {
128700
128733
  "token-refresh-unreachable": `Your auth token has expired and could not be refreshed because the Cloudflare auth server could not be reached. This is usually a network problem (connectivity, proxy, or IPv6), not an invalid login: your stored credentials were left unchanged. Check your connection and try again.`
128701
128734
  };
128702
128735
  }
128703
- function logTemporaryPreviewAccount(logger7, temporaryPreviewAccount, cached2) {
128736
+ function logTemporaryPreviewAccount(temporaryAccountLogger, temporaryPreviewAccount, cached2) {
128704
128737
  const claimExpiresAt = new Date(temporaryPreviewAccount.claim.expiresAt);
128705
- logger7.log(
128738
+ temporaryAccountLogger.log(
128706
128739
  dedent2`
128707
128740
  Temporary account ready:
128708
128741
  Account: ${temporaryPreviewAccount.account.name} (${cached2 ? "reused" : "created"})
@@ -128713,6 +128746,7 @@ function logTemporaryPreviewAccount(logger7, temporaryPreviewAccount, cached2) {
128713
128746
  }
128714
128747
  function createCloudflareAuth(descriptor, ctx) {
128715
128748
  const { logger: logger7 } = ctx;
128749
+ const temporaryAccountLogger = ctx.temporaryAccountLogger ?? logger7;
128716
128750
  const cliName = descriptor.cliName;
128717
128751
  const NOT_LOGGED_IN_ERROR_BODIES = notLoggedInErrorBodies(
128718
128752
  descriptor.commands.login
@@ -128755,7 +128789,11 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
128755
128789
  descriptor.fileFormat,
128756
128790
  descriptor.getTemporaryAccountConfigPath
128757
128791
  ),
128758
- prompt: createTemporaryTermsPrompt({ logger: logger7, prompt: ctx.prompt })
128792
+ prompt: createTemporaryTermsPrompt({
128793
+ temporaryAccountLogger,
128794
+ prompt: ctx.prompt
128795
+ }),
128796
+ temporaryAccountLogger
128759
128797
  }
128760
128798
  });
128761
128799
  function setProfile2(profile) {
@@ -129044,7 +129082,11 @@ ${accounts.map(
129044
129082
  );
129045
129083
  }
129046
129084
  const { account: temporaryPreviewAccount, cached: cached2 } = await oauthFlow.activateTemporaryAccount();
129047
- logTemporaryPreviewAccount(logger7, temporaryPreviewAccount, cached2);
129085
+ logTemporaryPreviewAccount(
129086
+ temporaryAccountLogger,
129087
+ temporaryPreviewAccount,
129088
+ cached2
129089
+ );
129048
129090
  return temporaryPreviewAccount.account.id;
129049
129091
  }
129050
129092
  const result = await loginOrRefreshIfRequired2(config2);
@@ -129327,10 +129369,10 @@ function createAuthConfigFileHelpers(deps) {
129327
129369
  };
129328
129370
  }
129329
129371
  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;
129330
- var init_chunk_VVLCNASF = __esm({
129331
- "../workers-auth/dist/chunk-VVLCNASF.mjs"() {
129372
+ var init_chunk_PGZZHNWG = __esm({
129373
+ "../workers-auth/dist/chunk-PGZZHNWG.mjs"() {
129332
129374
  init_import_meta_url();
129333
- init_chunk_FT2NMTJB();
129375
+ init_chunk_NDZDTP46();
129334
129376
  init_chunk_VAZEJK55();
129335
129377
  init_src();
129336
129378
  nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
@@ -129845,7 +129887,7 @@ var DefaultScopes, DefaultScopeKeys, WRANGLER_KEYRING_SERVICE_NAME, WRANGLER_CLI
129845
129887
  var init_wrangler = __esm({
129846
129888
  "../workers-auth/dist/wrangler/index.mjs"() {
129847
129889
  init_import_meta_url();
129848
- init_chunk_VVLCNASF();
129890
+ init_chunk_PGZZHNWG();
129849
129891
  init_chunk_VAZEJK55();
129850
129892
  init_src();
129851
129893
  nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
@@ -135195,6 +135237,12 @@ var init_user2 = __esm({
135195
135237
  init_logger2();
135196
135238
  auth = createWranglerAuth({
135197
135239
  logger: logger2,
135240
+ // Temporary-account notices go to stderr so they never corrupt command
135241
+ // output on stdout (JSON, piped values), and stay visible when `--json`
135242
+ // commands lower the log level to "error".
135243
+ temporaryAccountLogger: {
135244
+ log: /* @__PURE__ */ __name((...args) => logger2.console("error", ...args), "log")
135245
+ },
135198
135246
  userAgent: `wrangler/${version2}`,
135199
135247
  prompt: prompt2,
135200
135248
  select: select2,
@@ -136151,6 +136199,7 @@ function convertBindingsAndAssets(config2, result) {
136151
136199
  if (assetsBindingName !== void 0) assets.binding = assetsBindingName;
136152
136200
  if (config2.assets?.htmlHandling !== void 0) assets.html_handling = config2.assets.htmlHandling;
136153
136201
  if (config2.assets?.notFoundHandling !== void 0) assets.not_found_handling = config2.assets.notFoundHandling;
136202
+ if (config2.assets?.basePath !== void 0) assets.base_path = config2.assets.basePath;
136154
136203
  if (config2.assets?.runWorkerFirst !== void 0) assets.run_worker_first = config2.assets.runWorkerFirst;
136155
136204
  result.assets = assets;
136156
136205
  }
@@ -136587,6 +136636,7 @@ var init_dist3 = __esm({
136587
136636
  "404-page",
136588
136637
  "none"
136589
136638
  ]).optional(),
136639
+ basePath: string2().optional(),
136590
136640
  runWorkerFirst: union([array(string2()), boolean2()]).optional()
136591
136641
  });
136592
136642
  BrowserBindingSchema = strictObject({
@@ -150898,7 +150948,7 @@ var init_bundle_type = __esm({
150898
150948
  function isJavaScriptModuleRule(rule) {
150899
150949
  return rule.type === "ESModule" || rule.type === "CommonJS";
150900
150950
  }
150901
- function parseRules(userRules = []) {
150951
+ function parseRules(userRules = [], logWarnings = true) {
150902
150952
  const rules = [...userRules, ...DEFAULT_MODULE_RULES];
150903
150953
  const completedRuleLocations = {};
150904
150954
  const redundantRules = {};
@@ -150927,7 +150977,7 @@ function parseRules(userRules = []) {
150927
150977
  }
150928
150978
  for (const completedRuleType in completedRuleLocations) {
150929
150979
  const r10 = redundantRules[completedRuleType];
150930
- if (r10) {
150980
+ if (r10 && logWarnings) {
150931
150981
  const completedRuleIndex = completedRuleLocations[completedRuleType];
150932
150982
  let warning = `The ${completedRuleIndex >= userRules.length ? "default " : ""}module rule ${JSON.stringify(
150933
150983
  rules[completedRuleIndex]
@@ -162808,6 +162858,7 @@ function resolveAssetOptions({ assetsDir, main: main2 }, config2) {
162808
162858
  const assetConfig = {
162809
162859
  html_handling: config2.assets?.html_handling,
162810
162860
  not_found_handling: config2.assets?.not_found_handling,
162861
+ base_path: config2.assets?.base_path,
162811
162862
  // The _redirects and _headers files are parsed in Miniflare in dev and parsing is not required for deploy
162812
162863
  compatibility_date: config2.compatibility_date,
162813
162864
  compatibility_flags: config2.compatibility_flags
@@ -163546,6 +163597,7 @@ function createWorkerUploadForm(worker, bindings, options) {
163546
163597
  const assetConfig = {
163547
163598
  html_handling: assets?.assetConfig?.html_handling,
163548
163599
  not_found_handling: assets?.assetConfig?.not_found_handling,
163600
+ base_path: assets?.assetConfig?.base_path,
163549
163601
  run_worker_first: assets?.run_worker_first,
163550
163602
  _redirects: assets?._redirects,
163551
163603
  _headers: assets?._headers
@@ -175338,13 +175390,92 @@ var init_match_tag = __esm({
175338
175390
  __name(verifyWorkerMatchesCITag, "verifyWorkerMatchesCITag");
175339
175391
  }
175340
175392
  });
175393
+
175394
+ // ../workers-shared/utils/base-path.ts
175395
+ function normalizeBasePath(value) {
175396
+ if (value === "/") {
175397
+ return { valid: true, value: "/" };
175398
+ }
175399
+ if (typeof value !== "string") {
175400
+ return {
175401
+ valid: false,
175402
+ error: `Expected a string but got ${typeof value}.`
175403
+ };
175404
+ }
175405
+ if (value.length === 0) {
175406
+ return { valid: false, error: `The value must not be empty.` };
175407
+ }
175408
+ if (value.startsWith("//") || /^[a-zA-Z][a-zA-Z\d+.-]*:/.test(value)) {
175409
+ return {
175410
+ valid: false,
175411
+ error: `The value must be a pathname, not a URL.`
175412
+ };
175413
+ }
175414
+ if (value.includes("\\")) {
175415
+ return { valid: false, error: `The value must not contain backslashes.` };
175416
+ }
175417
+ if (CONTROL_CHARACTER.test(value)) {
175418
+ return {
175419
+ valid: false,
175420
+ error: `The value must not contain control characters.`
175421
+ };
175422
+ }
175423
+ if (value.includes("?") || value.includes("#")) {
175424
+ return {
175425
+ valid: false,
175426
+ error: `The value must not contain query strings or fragments.`
175427
+ };
175428
+ }
175429
+ if (value.includes("%")) {
175430
+ return {
175431
+ valid: false,
175432
+ error: `The value must not contain percent-encoded sequences.`
175433
+ };
175434
+ }
175435
+ const normalizedSegments = [];
175436
+ for (const segment of value.split("/")) {
175437
+ if (segment === "" || segment === ".") {
175438
+ continue;
175439
+ }
175440
+ if (segment === "..") {
175441
+ normalizedSegments.pop();
175442
+ continue;
175443
+ }
175444
+ normalizedSegments.push(segment);
175445
+ }
175446
+ const canonical = normalizedSegments.length === 0 ? "/" : `/${normalizedSegments.join("/")}/`;
175447
+ return { valid: true, value: canonical };
175448
+ }
175449
+ var CONTROL_CHARACTER;
175450
+ var init_base_path = __esm({
175451
+ "../workers-shared/utils/base-path.ts"() {
175452
+ init_import_meta_url();
175453
+ CONTROL_CHARACTER = /[\u0000-\u001f\u007f]/;
175454
+ __name(normalizeBasePath, "normalizeBasePath");
175455
+ }
175456
+ });
175457
+ function routeMatchesPath(route, pathname) {
175458
+ if (typeof route !== "string" && route.custom_domain) {
175459
+ return !("enabled" in route) || route.enabled !== false;
175460
+ }
175461
+ const pattern = typeof route === "string" ? route : route.pattern;
175462
+ const patternWithoutScheme = pattern.replace(/^https?:\/\//, "");
175463
+ const pathStart = patternWithoutScheme.indexOf("/");
175464
+ if (pathStart === -1) {
175465
+ return false;
175466
+ }
175467
+ const pathPattern = patternWithoutScheme.slice(pathStart);
175468
+ const regexpPattern = pathPattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join(".*");
175469
+ return new RegExp(`^${regexpPattern}$`).test(pathname);
175470
+ }
175341
175471
  var validateRoutes2;
175342
175472
  var init_validate_routes = __esm({
175343
175473
  "../deploy-helpers/src/deploy/helpers/validate-routes.ts"() {
175344
175474
  init_import_meta_url();
175475
+ init_base_path();
175345
175476
  init_src();
175346
175477
  init_context();
175347
- validateRoutes2 = /* @__PURE__ */ __name((routes, assets) => {
175478
+ validateRoutes2 = /* @__PURE__ */ __name((routes, assets, workersDevEnabled) => {
175348
175479
  const invalidRoutes = {};
175349
175480
  const mountedAssetRoutes = [];
175350
175481
  for (const route of routes) {
@@ -175382,6 +175513,12 @@ var init_validate_routes = __esm({
175382
175513
  { telemetryMessage: "deploy invalid routes" }
175383
175514
  );
175384
175515
  }
175516
+ const basePath = normalizeBasePath(assets?.assetConfig.base_path);
175517
+ if (workersDevEnabled === false && basePath.valid && basePath.value !== "/" && !routes.some((route) => routeMatchesPath(route, basePath.value))) {
175518
+ logger.warn(
175519
+ `The configured assets base path "${basePath.value}" is not reachable through any configured route. Add a route that matches "${basePath.value}" or enable \`workers_dev\`.`
175520
+ );
175521
+ }
175385
175522
  if (mountedAssetRoutes.length > 0 && assets?.directory !== void 0) {
175386
175523
  const relativeAssetsDir = path28__namespace.default.relative(process.cwd(), assets.directory);
175387
175524
  const warnFn = logger.once?.warn ?? logger.warn;
@@ -175398,6 +175535,7 @@ ${mountedAssetRoutes.map((route) => {
175398
175535
  );
175399
175536
  }
175400
175537
  }, "validateRoutes");
175538
+ __name(routeMatchesPath, "routeMatchesPath");
175401
175539
  }
175402
175540
  });
175403
175541
  function validateWorkerProps(props, config2) {
@@ -175446,7 +175584,12 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
175446
175584
  validateOwnedWorkflowDeclarations(config2, name2);
175447
175585
  if (props.command === "deploy") {
175448
175586
  validateEventTriggerTargets(config2, name2);
175449
- validateRoutes2(props.routes, props.assetsOptions);
175587
+ const workersDevEnabled = getSubdomainValues(
175588
+ config2.workers_dev,
175589
+ config2.preview_urls,
175590
+ props.routes
175591
+ ).workers_dev;
175592
+ validateRoutes2(props.routes, props.assetsOptions, workersDevEnabled);
175450
175593
  assert38__default.default(
175451
175594
  !config2.site || config2.site.bucket,
175452
175595
  "A [site] definition requires a `bucket` field with a path to the site's assets directory."
@@ -176624,6 +176767,42 @@ var init_versions_upload = __esm({
176624
176767
  __name(uploadWorkerVersion, "uploadWorkerVersion");
176625
176768
  }
176626
176769
  });
176770
+ function gitCommandText(stdout2) {
176771
+ if (typeof stdout2 === "string") {
176772
+ return stdout2;
176773
+ }
176774
+ if (stdout2 instanceof Uint8Array) {
176775
+ return new TextDecoder().decode(stdout2);
176776
+ }
176777
+ return "";
176778
+ }
176779
+ function resolveGitBranchName() {
176780
+ try {
176781
+ childProcess.execSync(`git rev-parse --is-inside-work-tree`, {
176782
+ stdio: ["ignore", "ignore", "ignore"]
176783
+ });
176784
+ } catch {
176785
+ return void 0;
176786
+ }
176787
+ try {
176788
+ const branch = gitCommandText(
176789
+ childProcess.execSync(`git branch --show-current`, {
176790
+ encoding: "utf8",
176791
+ stdio: ["ignore", "pipe", "ignore"]
176792
+ })
176793
+ ).trim();
176794
+ return branch || void 0;
176795
+ } catch {
176796
+ return void 0;
176797
+ }
176798
+ }
176799
+ var init_git_branch = __esm({
176800
+ "../deploy-helpers/src/shared/git-branch.ts"() {
176801
+ init_import_meta_url();
176802
+ __name(gitCommandText, "gitCommandText");
176803
+ __name(resolveGitBranchName, "resolveGitBranchName");
176804
+ }
176805
+ });
176627
176806
  function truncateWithSuffix(body, suffix, maxLength) {
176628
176807
  const maxBodyLength = Math.max(0, maxLength - suffix.length);
176629
176808
  return `${body.slice(0, maxBodyLength)}${suffix}`;
@@ -176648,12 +176827,7 @@ function getBranchName() {
176648
176827
  if (ciBranchName) {
176649
176828
  return ciBranchName;
176650
176829
  }
176651
- try {
176652
- childProcess.execSync(`git rev-parse --is-inside-work-tree`, { stdio: "ignore" });
176653
- return childProcess.execSync(`git rev-parse --abbrev-ref HEAD`).toString().trim();
176654
- } catch {
176655
- return void 0;
176656
- }
176830
+ return resolveGitBranchName();
176657
176831
  }
176658
176832
  function createTruncatedAlias(branchName, sanitizedAlias, availableSpace) {
176659
176833
  const hash2 = crypto2.createHash("sha256").update(branchName).digest("hex").slice(0, HASH_LENGTH);
@@ -176695,6 +176869,7 @@ var init_preview_alias = __esm({
176695
176869
  init_import_meta_url();
176696
176870
  init_src();
176697
176871
  init_context();
176872
+ init_git_branch();
176698
176873
  init_names();
176699
176874
  MAX_DNS_LABEL_LENGTH = 63;
176700
176875
  HASH_LENGTH = 4;
@@ -176914,6 +177089,14 @@ var init_api2 = __esm({
176914
177089
  __name(patchPreviewBaseConfig, "patchPreviewBaseConfig");
176915
177090
  }
176916
177091
  });
177092
+ function readGitStdout(command2) {
177093
+ return gitCommandText(
177094
+ childProcess.execSync(command2, {
177095
+ encoding: "utf8",
177096
+ stdio: ["ignore", "pipe", "ignore"]
177097
+ })
177098
+ ).trim();
177099
+ }
176917
177100
  function getBranchName2() {
176918
177101
  const workersCIBranch = getWorkersCIBranchName();
176919
177102
  if (workersCIBranch) {
@@ -176927,12 +177110,7 @@ function getBranchName2() {
176927
177110
  if (gitlabBranch) {
176928
177111
  return gitlabBranch;
176929
177112
  }
176930
- try {
176931
- childProcess.execSync(`git rev-parse --is-inside-work-tree`, { stdio: "ignore" });
176932
- return childProcess.execSync(`git rev-parse --abbrev-ref HEAD`).toString().trim();
176933
- } catch {
176934
- return void 0;
176935
- }
177113
+ return resolveGitBranchName();
176936
177114
  }
176937
177115
  function shouldUseCIMetadataFallback() {
176938
177116
  return process.env.CI === "1" || process.env.CI === "true";
@@ -176940,7 +177118,7 @@ function shouldUseCIMetadataFallback() {
176940
177118
  function getHeadCommitRef() {
176941
177119
  try {
176942
177120
  childProcess.execSync(`git rev-parse --is-inside-work-tree`, { stdio: "ignore" });
176943
- return childProcess.execSync(`git rev-parse --short HEAD`).toString().trim();
177121
+ return readGitStdout(`git rev-parse --short HEAD`);
176944
177122
  } catch {
176945
177123
  return void 0;
176946
177124
  }
@@ -176948,7 +177126,7 @@ function getHeadCommitRef() {
176948
177126
  function getHeadCommitMessage() {
176949
177127
  try {
176950
177128
  childProcess.execSync(`git rev-parse --is-inside-work-tree`, { stdio: "ignore" });
176951
- return childProcess.execSync(`git log -1 --format=%B`).toString().trim();
177129
+ return readGitStdout(`git log -1 --format=%B`);
176952
177130
  } catch {
176953
177131
  return void 0;
176954
177132
  }
@@ -177001,7 +177179,7 @@ function getRepositoryUrl() {
177001
177179
  try {
177002
177180
  childProcess.execSync(`git rev-parse --is-inside-work-tree`, { stdio: "ignore" });
177003
177181
  return normalizeRepositoryUrl(
177004
- childProcess.execSync(`git config --get remote.origin.url`).toString()
177182
+ readGitStdout(`git config --get remote.origin.url`)
177005
177183
  );
177006
177184
  } catch {
177007
177185
  return void 0;
@@ -177438,8 +177616,10 @@ var init_shared2 = __esm({
177438
177616
  "../deploy-helpers/src/preview/shared.ts"() {
177439
177617
  init_import_meta_url();
177440
177618
  init_src();
177619
+ init_git_branch();
177441
177620
  init_names();
177442
177621
  MAX_CONTAINER_APP_NAME_LENGTH = 253;
177622
+ __name(readGitStdout, "readGitStdout");
177443
177623
  __name(getBranchName2, "getBranchName");
177444
177624
  __name(shouldUseCIMetadataFallback, "shouldUseCIMetadataFallback");
177445
177625
  __name(getHeadCommitRef, "getHeadCommitRef");
@@ -177752,6 +177932,7 @@ async function assemblePreviewDeploymentSettings(config2, buildResult, accountId
177752
177932
  config: {
177753
177933
  html_handling: options.assetsOptions.assetConfig.html_handling,
177754
177934
  not_found_handling: options.assetsOptions.assetConfig.not_found_handling,
177935
+ base_path: options.assetsOptions.assetConfig.base_path,
177755
177936
  run_worker_first: options.assetsOptions.run_worker_first
177756
177937
  }
177757
177938
  };
@@ -179593,7 +179774,7 @@ var CF_KEYRING_SERVICE_NAME, CF_CLI_NAME, CF_DISPLAY_NAME, CF_OAUTH_CALLBACK_URL
179593
179774
  var init_cf = __esm({
179594
179775
  "../workers-auth/dist/cf/index.mjs"() {
179595
179776
  init_import_meta_url();
179596
- init_chunk_VVLCNASF();
179777
+ init_chunk_PGZZHNWG();
179597
179778
  init_chunk_VAZEJK55();
179598
179779
  init_src();
179599
179780
  nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
@@ -180606,7 +180787,7 @@ var init_dist14 = __esm({
180606
180787
  init_wrapper();
180607
180788
  init_create_worker_upload_form();
180608
180789
  import_undici13 = __toESM(require_undici(), 1);
180609
- version3 = "0.0.43";
180790
+ version3 = "0.0.44";
180610
180791
  NoDefaultValueProvided2 = class extends UserError {
180611
180792
  static {
180612
180793
  __name(this, "NoDefaultValueProvided");
@@ -186587,6 +186768,12 @@ var init_dev = __esm({
186587
186768
  "tunnel-name": {
186588
186769
  describe: "Use an existing named Cloudflare Tunnel when `--tunnel` is enabled.",
186589
186770
  type: "string"
186771
+ },
186772
+ "tunnel-allowed-mail": {
186773
+ describe: "Require email authentication for a Quick Tunnel. Accepts an exact address or domain wildcard such as user@example.com or *@example.org. May be repeated or comma-separated.",
186774
+ type: "string",
186775
+ array: true,
186776
+ nargs: 1
186590
186777
  }
186591
186778
  },
186592
186779
  async validateArgs(args) {
@@ -186602,6 +186789,14 @@ var init_dev = __esm({
186602
186789
  { telemetryMessage: "dev command live reload remote conflict" }
186603
186790
  );
186604
186791
  }
186792
+ if (args.tunnelName && (args.tunnelAllowedMail?.length ?? 0) > 0) {
186793
+ throw new UserError(
186794
+ "--tunnel-allowed-mail is only supported for Quick Tunnels and cannot be used with --tunnel-name.",
186795
+ {
186796
+ telemetryMessage: "dev command tunnel allowed mail named conflict"
186797
+ }
186798
+ );
186799
+ }
186605
186800
  if (args.tunnel && args.remote) {
186606
186801
  throw new UserError(
186607
186802
  "--tunnel cannot be used with --remote. Tunnels expose your local dev server to the internet, which is only applicable in local mode. Remove --remote to use --tunnel, or remove --tunnel to use --remote.",
@@ -203576,14 +203771,267 @@ function constructTypeKey(key) {
203576
203771
  }
203577
203772
  return `"${escapeTypeScriptString(key)}"`;
203578
203773
  }
203579
- function constructTSModuleGlob(glob) {
203774
+ function getTSModuleGlob(glob) {
203580
203775
  if (!glob.includes("*")) {
203581
- return glob;
203582
- } else if (glob.includes(".")) {
203583
- return `*.${glob.split(".").at(-1)}`;
203584
- } else {
203585
- return glob.replace("**/*", "*").replace("**/", "*/").replace("/**", "/*");
203776
+ return {
203777
+ moduleGlob: glob,
203778
+ fallbackModuleGlob: getFallbackModuleGlob(glob),
203779
+ preservesScope: true,
203780
+ isRecursiveFallback: false,
203781
+ emitsFallback: false
203782
+ };
203783
+ }
203784
+ const moduleGlob = glob.replaceAll("**/*", "*").replaceAll("**/", "*/").replaceAll("/**", "/*");
203785
+ const fallbackModuleGlob = getFallbackModuleGlob(glob);
203786
+ const preservesScope = moduleGlob.indexOf("*") === moduleGlob.lastIndexOf("*");
203787
+ return {
203788
+ moduleGlob: preservesScope ? moduleGlob : fallbackModuleGlob ?? "*",
203789
+ fallbackModuleGlob,
203790
+ preservesScope,
203791
+ isRecursiveFallback: preservesScope && moduleGlob === fallbackModuleGlob && glob.startsWith("**/"),
203792
+ emitsFallback: true
203793
+ };
203794
+ }
203795
+ function getFallbackModuleGlob(glob) {
203796
+ const lastAsteriskIndex = glob.lastIndexOf("*");
203797
+ if (lastAsteriskIndex !== -1) {
203798
+ const suffix = glob.slice(lastAsteriskIndex + 1);
203799
+ return suffix ? `*${suffix}` : void 0;
203800
+ }
203801
+ const lastSlashIndex = Math.max(
203802
+ glob.lastIndexOf("/"),
203803
+ glob.lastIndexOf("\\")
203804
+ );
203805
+ const lastDotIndex = glob.lastIndexOf(".");
203806
+ return lastDotIndex > lastSlashIndex ? `*${glob.slice(lastDotIndex)}` : void 0;
203807
+ }
203808
+ function isAdditionalModuleDiscoveryEnabled(config2) {
203809
+ return config2.find_additional_modules ?? config2.no_bundle === true;
203810
+ }
203811
+ function generateModuleTypeDeclarations(rules = [], resolveOverlappingGlobs = false, findAdditionalModules2 = false) {
203812
+ const moduleTypeMap = {
203813
+ CompiledWasm: "WebAssembly.Module",
203814
+ Data: "ArrayBuffer",
203815
+ Text: "string"
203816
+ };
203817
+ const declarations = new Array();
203818
+ if (!resolveOverlappingGlobs) {
203819
+ for (const rule of rules) {
203820
+ const typeScriptType = moduleTypeMap[rule.type];
203821
+ if (typeScriptType === void 0) {
203822
+ continue;
203823
+ }
203824
+ for (const glob of rule.globs) {
203825
+ declarations.push(
203826
+ generateModuleTypeDeclaration(getTSModuleGlob(glob).moduleGlob, [
203827
+ typeScriptType
203828
+ ])
203829
+ );
203830
+ }
203831
+ }
203832
+ return declarations;
203833
+ }
203834
+ return generateCombinedModuleTypeDeclarations([
203835
+ { findAdditionalModules: findAdditionalModules2, rules }
203836
+ ]);
203837
+ }
203838
+ function resolveModuleTypeDeclarations(ruleSet5) {
203839
+ const { findAdditionalModules: findAdditionalModules2, rules } = ruleSet5;
203840
+ const moduleTypeMap = {
203841
+ CompiledWasm: "WebAssembly.Module",
203842
+ Data: "ArrayBuffer",
203843
+ Text: "string"
203844
+ };
203845
+ const seenRuleGlobs = /* @__PURE__ */ new Set();
203846
+ const scopedDeclarations = /* @__PURE__ */ new Map();
203847
+ const fallbackDeclarations = /* @__PURE__ */ new Map();
203848
+ const matchingRules = new Array();
203849
+ for (const rule of rules) {
203850
+ const typeScriptType = moduleTypeMap[rule.type];
203851
+ if (typeScriptType === void 0) {
203852
+ continue;
203853
+ }
203854
+ for (const glob of rule.globs) {
203855
+ const {
203856
+ moduleGlob,
203857
+ fallbackModuleGlob,
203858
+ preservesScope,
203859
+ isRecursiveFallback,
203860
+ emitsFallback
203861
+ } = getTSModuleGlob(glob);
203862
+ if (seenRuleGlobs.has(glob)) {
203863
+ continue;
203864
+ }
203865
+ seenRuleGlobs.add(glob);
203866
+ matchingRules.push({
203867
+ deploymentGlob: glob,
203868
+ isConservativeFallback: !preservesScope,
203869
+ moduleGlob,
203870
+ type: typeScriptType
203871
+ });
203872
+ if (fallbackModuleGlob === void 0) {
203873
+ const types14 = scopedDeclarations.get(moduleGlob) ?? /* @__PURE__ */ new Set();
203874
+ types14.add(typeScriptType);
203875
+ scopedDeclarations.set(moduleGlob, types14);
203876
+ continue;
203877
+ }
203878
+ const fallbackDeclaration = fallbackDeclarations.get(
203879
+ fallbackModuleGlob
203880
+ ) ?? {
203881
+ types: /* @__PURE__ */ new Set(),
203882
+ recursiveRuleSeen: false,
203883
+ shouldEmit: false
203884
+ };
203885
+ if (fallbackDeclaration.recursiveRuleSeen) {
203886
+ continue;
203887
+ }
203888
+ if (preservesScope && moduleGlob !== fallbackModuleGlob) {
203889
+ const types14 = scopedDeclarations.get(moduleGlob) ?? /* @__PURE__ */ new Set();
203890
+ types14.add(typeScriptType);
203891
+ scopedDeclarations.set(moduleGlob, types14);
203892
+ }
203893
+ fallbackDeclaration.types.add(typeScriptType);
203894
+ fallbackDeclaration.recursiveRuleSeen = isRecursiveFallback;
203895
+ fallbackDeclaration.shouldEmit ||= emitsFallback;
203896
+ fallbackDeclarations.set(fallbackModuleGlob, fallbackDeclaration);
203897
+ }
203586
203898
  }
203899
+ return {
203900
+ findAdditionalModules: findAdditionalModules2,
203901
+ scoped: scopedDeclarations,
203902
+ fallbacks: fallbackDeclarations,
203903
+ matchingRules
203904
+ };
203905
+ }
203906
+ function intersectModuleGlobs(left2, right2) {
203907
+ const leftAsteriskIndex = left2.indexOf("*");
203908
+ const rightAsteriskIndex = right2.indexOf("*");
203909
+ if (leftAsteriskIndex === -1) {
203910
+ return moduleGlobMatches(right2, left2) ? left2 : void 0;
203911
+ }
203912
+ if (rightAsteriskIndex === -1) {
203913
+ return moduleGlobMatches(left2, right2) ? right2 : void 0;
203914
+ }
203915
+ const leftPrefix = left2.slice(0, leftAsteriskIndex);
203916
+ const rightPrefix = right2.slice(0, rightAsteriskIndex);
203917
+ if (!leftPrefix.startsWith(rightPrefix) && !rightPrefix.startsWith(leftPrefix)) {
203918
+ return void 0;
203919
+ }
203920
+ const leftSuffix = left2.slice(leftAsteriskIndex + 1);
203921
+ const rightSuffix = right2.slice(rightAsteriskIndex + 1);
203922
+ if (!leftSuffix.endsWith(rightSuffix) && !rightSuffix.endsWith(leftSuffix)) {
203923
+ return void 0;
203924
+ }
203925
+ const prefix = leftPrefix.length >= rightPrefix.length ? leftPrefix : rightPrefix;
203926
+ const suffix = leftSuffix.length >= rightSuffix.length ? leftSuffix : rightSuffix;
203927
+ return `${prefix}*${suffix}`;
203928
+ }
203929
+ function moduleGlobMatches(moduleGlob, moduleName) {
203930
+ const asteriskIndex = moduleGlob.indexOf("*");
203931
+ if (asteriskIndex === -1) {
203932
+ return moduleGlob === moduleName;
203933
+ }
203934
+ const prefix = moduleGlob.slice(0, asteriskIndex);
203935
+ const suffix = moduleGlob.slice(asteriskIndex + 1);
203936
+ return moduleName.length >= prefix.length + suffix.length && moduleName.startsWith(prefix) && moduleName.endsWith(suffix);
203937
+ }
203938
+ function moduleGlobContains(container, contained) {
203939
+ const containedAsteriskIndex = contained.indexOf("*");
203940
+ if (containedAsteriskIndex === -1) {
203941
+ return moduleGlobMatches(container, contained);
203942
+ }
203943
+ const containerAsteriskIndex = container.indexOf("*");
203944
+ if (containerAsteriskIndex === -1) {
203945
+ return false;
203946
+ }
203947
+ const containerPrefix = container.slice(0, containerAsteriskIndex);
203948
+ const containedPrefix = contained.slice(0, containedAsteriskIndex);
203949
+ const containerSuffix = container.slice(containerAsteriskIndex + 1);
203950
+ const containedSuffix = contained.slice(containedAsteriskIndex + 1);
203951
+ return containedPrefix.startsWith(containerPrefix) && containedSuffix.endsWith(containerSuffix);
203952
+ }
203953
+ function resolveMatchingModuleTypes(moduleGlob, matchingRules, findAdditionalModules2) {
203954
+ const types14 = /* @__PURE__ */ new Set();
203955
+ const coveredPatterns = new Array();
203956
+ const exactModuleName = moduleGlob.includes("*") ? void 0 : moduleGlob;
203957
+ for (const rule of matchingRules) {
203958
+ const deploymentRegExp = findAdditionalModules2 ? (0, import_glob_to_regexp3.default)(rule.deploymentGlob, { globstar: true }) : (0, import_glob_to_regexp3.default)(rule.deploymentGlob);
203959
+ const conservativeFallbackMatchesExact = exactModuleName !== void 0 && rule.isConservativeFallback && deploymentRegExp.test(exactModuleName);
203960
+ if (exactModuleName !== void 0 && rule.isConservativeFallback && !conservativeFallbackMatchesExact) {
203961
+ continue;
203962
+ }
203963
+ const overlap = intersectModuleGlobs(moduleGlob, rule.moduleGlob);
203964
+ if (overlap === void 0 || coveredPatterns.some((pattern) => moduleGlobContains(pattern, overlap))) {
203965
+ continue;
203966
+ }
203967
+ types14.add(rule.type);
203968
+ if (!rule.isConservativeFallback || conservativeFallbackMatchesExact) {
203969
+ coveredPatterns.push(overlap);
203970
+ if (moduleGlobContains(rule.moduleGlob, moduleGlob)) {
203971
+ break;
203972
+ }
203973
+ }
203974
+ }
203975
+ return types14;
203976
+ }
203977
+ function generateCombinedModuleTypeDeclarations(ruleSets) {
203978
+ const combinedDeclarations = /* @__PURE__ */ new Map();
203979
+ const combinedFallbacks = /* @__PURE__ */ new Map();
203980
+ const resolvedRuleSets = ruleSets.map(resolveModuleTypeDeclarations);
203981
+ for (const { scoped, fallbacks } of resolvedRuleSets) {
203982
+ for (const moduleGlob of scoped.keys()) {
203983
+ combinedDeclarations.set(
203984
+ moduleGlob,
203985
+ combinedDeclarations.get(moduleGlob) ?? /* @__PURE__ */ new Set()
203986
+ );
203987
+ }
203988
+ for (const [moduleGlob, { types: types14, shouldEmit }] of fallbacks) {
203989
+ const combinedFallback = combinedFallbacks.get(moduleGlob) ?? {
203990
+ types: /* @__PURE__ */ new Set(),
203991
+ shouldEmit: false
203992
+ };
203993
+ for (const type of types14) {
203994
+ combinedFallback.types.add(type);
203995
+ }
203996
+ combinedFallback.shouldEmit ||= shouldEmit;
203997
+ combinedFallbacks.set(moduleGlob, combinedFallback);
203998
+ }
203999
+ }
204000
+ for (const [moduleGlob, { types: types14, shouldEmit }] of combinedFallbacks) {
204001
+ if (!shouldEmit && types14.size === 1) {
204002
+ continue;
204003
+ }
204004
+ combinedDeclarations.set(
204005
+ moduleGlob,
204006
+ combinedDeclarations.get(moduleGlob) ?? /* @__PURE__ */ new Set()
204007
+ );
204008
+ }
204009
+ for (const [moduleGlob, combinedTypes] of combinedDeclarations) {
204010
+ for (const { findAdditionalModules: findAdditionalModules2, matchingRules } of resolvedRuleSets) {
204011
+ for (const type of resolveMatchingModuleTypes(
204012
+ moduleGlob,
204013
+ matchingRules,
204014
+ findAdditionalModules2
204015
+ )) {
204016
+ combinedTypes.add(type);
204017
+ }
204018
+ }
204019
+ }
204020
+ return [...combinedDeclarations].map(
204021
+ ([moduleGlob, types14]) => generateModuleTypeDeclaration(moduleGlob, types14)
204022
+ );
204023
+ }
204024
+ function generateModuleTypeDeclaration(moduleGlob, types14) {
204025
+ return `declare module "${moduleGlob}" {
204026
+ const value: ${[...types14].join(" | ")};
204027
+ export default value;
204028
+ }`;
204029
+ }
204030
+ function generateServiceWorkerTypes(typeDefinitions, envTypeStructure) {
204031
+ return [
204032
+ ...typeDefinitions,
204033
+ ...envTypeStructure.map((value) => `declare const ${value}`)
204034
+ ].join("\n");
203587
204035
  }
203588
204036
  function generateImportSpecifier(from, to) {
203589
204037
  const relativePath = path28.relative(path28.dirname(from), path28.dirname(to)).replace(/\\/g, "/");
@@ -203843,33 +204291,22 @@ async function generateSimpleEnvTypes(config2, collectionArgs, envInterface, out
203843
204291
  });
203844
204292
  }
203845
204293
  }
203846
- const modulesTypeStructure = new Array();
203847
- if (config2.rules) {
203848
- const moduleTypeMap = {
203849
- CompiledWasm: "WebAssembly.Module",
203850
- Data: "ArrayBuffer",
203851
- Text: "string"
203852
- };
203853
- for (const ruleObject of config2.rules) {
203854
- const typeScriptType = moduleTypeMap[ruleObject.type];
203855
- if (typeScriptType === void 0) {
203856
- continue;
203857
- }
203858
- for (const glob of ruleObject.globs) {
203859
- modulesTypeStructure.push(`declare module "${constructTSModuleGlob(glob)}" {
203860
- const value: ${typeScriptType};
203861
- export default value;
203862
- }`);
203863
- }
203864
- }
203865
- }
203866
- const typesHaveBeenFound = envTypeStructure.length > 0 || modulesTypeStructure.length > 0;
204294
+ const configuredModulesTypeStructure = generateModuleTypeDeclarations(
204295
+ config2.rules
204296
+ );
204297
+ const effectiveModulesTypeStructure = generateModuleTypeDeclarations(
204298
+ parseRules(config2.rules, log2).rules,
204299
+ true,
204300
+ isAdditionalModuleDiscoveryEnabled(config2)
204301
+ );
204302
+ const typesHaveBeenFound = envTypeStructure.length > 0 || effectiveModulesTypeStructure.length > 0;
203867
204303
  if (entrypointFormat === "modules" || typesHaveBeenFound) {
203868
204304
  const { consoleOutput, fileContent } = generateTypeStrings(
203869
204305
  entrypointFormat,
203870
204306
  envInterface,
203871
204307
  envTypeStructure.map(({ key, type }) => `${key}: ${type};`),
203872
- modulesTypeStructure,
204308
+ configuredModulesTypeStructure,
204309
+ effectiveModulesTypeStructure,
203873
204310
  stringKeys,
203874
204311
  config2.compatibility_date,
203875
204312
  config2.compatibility_flags,
@@ -203882,7 +204319,7 @@ async function generateSimpleEnvTypes(config2, collectionArgs, envInterface, out
203882
204319
  ],
203883
204320
  typeDefinitions
203884
204321
  );
203885
- const hash2 = crypto2.createHash("sha256").update(consoleOutput).digest("hex").slice(0, 32);
204322
+ const hash2 = crypto2.createHash("sha256").update(fileContent).digest("hex").slice(0, 32);
203886
204323
  if (log2) {
203887
204324
  logger2.log(source_default.dim(consoleOutput));
203888
204325
  }
@@ -204149,31 +204586,41 @@ ${bindingLines}
204149
204586
  });
204150
204587
  }
204151
204588
  }
204152
- const modulesTypeStructure = new Array();
204153
- if (config2.rules) {
204154
- const moduleTypeMap = {
204155
- CompiledWasm: "WebAssembly.Module",
204156
- Data: "ArrayBuffer",
204157
- Text: "string"
204158
- };
204159
- for (const ruleObject of config2.rules) {
204160
- const typeScriptType = moduleTypeMap[ruleObject.type];
204161
- if (typeScriptType !== void 0) {
204162
- for (const glob of ruleObject.globs) {
204163
- modulesTypeStructure.push(`declare module "${constructTSModuleGlob(glob)}" {
204164
- const value: ${typeScriptType};
204165
- export default value;
204166
- }`);
204167
- }
204168
- }
204169
- }
204170
- }
204589
+ const environmentRuleSets = [
204590
+ {
204591
+ findAdditionalModules: isAdditionalModuleDiscoveryEnabled(config2),
204592
+ rules: config2.rules
204593
+ },
204594
+ ...envNames.map((envName) => {
204595
+ const environmentConfig = readConfig(
204596
+ { ...collectionArgs, env: envName },
204597
+ { hideWarnings: true }
204598
+ );
204599
+ return {
204600
+ findAdditionalModules: isAdditionalModuleDiscoveryEnabled(environmentConfig),
204601
+ rules: environmentConfig.rules
204602
+ };
204603
+ })
204604
+ ];
204605
+ const uniqueRuleSets = [
204606
+ ...new Map(
204607
+ environmentRuleSets.map((ruleSet5) => [JSON.stringify(ruleSet5), ruleSet5])
204608
+ ).values()
204609
+ ];
204610
+ const configuredModulesTypeStructure = generateCombinedModuleTypeDeclarations(uniqueRuleSets);
204611
+ const effectiveModulesTypeStructure = generateCombinedModuleTypeDeclarations(
204612
+ uniqueRuleSets.map(({ findAdditionalModules: findAdditionalModules2, rules }) => ({
204613
+ findAdditionalModules: findAdditionalModules2,
204614
+ rules: parseRules(rules, log2).rules
204615
+ }))
204616
+ );
204171
204617
  const { consoleOutput, fileContent } = generatePerEnvTypeStrings(
204172
204618
  entrypointFormat,
204173
204619
  envInterface,
204174
204620
  perEnvInterfaces,
204175
204621
  aggregatedEnvBindings,
204176
- modulesTypeStructure,
204622
+ configuredModulesTypeStructure,
204623
+ effectiveModulesTypeStructure,
204177
204624
  stringKeys,
204178
204625
  config2.compatibility_date,
204179
204626
  config2.compatibility_flags,
@@ -204186,7 +204633,7 @@ ${bindingLines}
204186
204633
  ],
204187
204634
  [...typeDefinitions]
204188
204635
  );
204189
- const hash2 = crypto2.createHash("sha256").update(consoleOutput).digest("hex").slice(0, 32);
204636
+ const hash2 = crypto2.createHash("sha256").update(fileContent).digest("hex").slice(0, 32);
204190
204637
  if (log2) {
204191
204638
  logger2.log(source_default.dim(consoleOutput));
204192
204639
  }
@@ -204198,8 +204645,9 @@ ${bindingLines}
204198
204645
  function prefixEnvInterface(envInterface) {
204199
204646
  return `__BaseEnv_${envInterface}`;
204200
204647
  }
204201
- function generatePerEnvTypeStrings(formatType, envInterface, perEnvInterfaces, aggregatedEnvBindings, modulesTypeStructure, stringKeys, compatibilityDate, compatibilityFlags, entrypointModule, configuredDurableObjects, typeDefinitions = []) {
204648
+ function generatePerEnvTypeStrings(formatType, envInterface, perEnvInterfaces, aggregatedEnvBindings, consoleModulesTypeStructure, fileModulesTypeStructure, stringKeys, compatibilityDate, compatibilityFlags, entrypointModule, configuredDurableObjects, typeDefinitions = []) {
204202
204649
  let baseContent = "";
204650
+ let fileBaseContent;
204203
204651
  let processEnv = "";
204204
204652
  const typeDefsContent = typeDefinitions.length > 0 ? typeDefinitions.map((def) => ` ${def}`).join("\n") : "";
204205
204653
  if (formatType === "modules") {
@@ -204236,17 +204684,22 @@ interface ${envInterface} extends ${internalEnvInterface} {}${processEnv}`;
204236
204684
  declare global {
204237
204685
  ${envBindingLines}
204238
204686
  }`;
204687
+ fileBaseContent = generateServiceWorkerTypes(
204688
+ typeDefinitions,
204689
+ aggregatedEnvBindings.map(({ key, type }) => `${key}: ${type};`)
204690
+ );
204239
204691
  }
204240
- const modulesContent = modulesTypeStructure.join("\n");
204692
+ const consoleModulesContent = consoleModulesTypeStructure.join("\n");
204693
+ const fileModulesContent = fileModulesTypeStructure.join("\n");
204241
204694
  return {
204242
204695
  consoleOutput: `${baseContent}
204243
- ${modulesContent}`,
204244
- fileContent: `${baseContent}
204245
- ${modulesContent}`
204696
+ ${consoleModulesContent}`,
204697
+ fileContent: [fileBaseContent ?? baseContent, fileModulesContent].filter((content) => content.length > 0).join("\n")
204246
204698
  };
204247
204699
  }
204248
- function generateTypeStrings(formatType, envInterface, envTypeStructure, modulesTypeStructure, stringKeys, compatibilityDate, compatibilityFlags, entrypointModule, configuredDurableObjects, typeDefinitions = []) {
204700
+ function generateTypeStrings(formatType, envInterface, envTypeStructure, consoleModulesTypeStructure, fileModulesTypeStructure, stringKeys, compatibilityDate, compatibilityFlags, entrypointModule, configuredDurableObjects, typeDefinitions = []) {
204249
204701
  let baseContent = "";
204702
+ let fileBaseContent;
204250
204703
  let processEnv = "";
204251
204704
  const typeDefsContent = typeDefinitions.length > 0 ? typeDefinitions.map((def) => ` ${def}`).join("\n") : "";
204252
204705
  if (formatType === "modules") {
@@ -204278,13 +204731,17 @@ interface ${envInterface} extends ${internalEnvInterface} {}${processEnv}`;
204278
204731
  declare global {
204279
204732
  ${envTypeStructure.map((value) => ` const ${value}`).join("\n")}
204280
204733
  }`;
204734
+ fileBaseContent = generateServiceWorkerTypes(
204735
+ typeDefinitions,
204736
+ envTypeStructure
204737
+ );
204281
204738
  }
204282
- const modulesContent = modulesTypeStructure.join("\n");
204739
+ const consoleModulesContent = consoleModulesTypeStructure.join("\n");
204740
+ const fileModulesContent = fileModulesTypeStructure.join("\n");
204283
204741
  return {
204284
- fileContent: `${baseContent}
204285
- ${modulesContent}`,
204742
+ fileContent: [fileBaseContent ?? baseContent, fileModulesContent].filter((content) => content.length > 0).join("\n"),
204286
204743
  consoleOutput: `${baseContent}
204287
- ${modulesContent}`
204744
+ ${consoleModulesContent}`
204288
204745
  };
204289
204746
  }
204290
204747
  function readTsconfigTypes(tsconfigPath) {
@@ -205853,7 +206310,7 @@ function collectPipelinesPerEnvironment(args) {
205853
206310
  }
205854
206311
  return result;
205855
206312
  }
205856
- var typesCommand, validateTypesFile, logHorizontalRule, INHERITABLE_BINDINGS;
206313
+ var import_glob_to_regexp3, typesCommand, validateTypesFile, logHorizontalRule, INHERITABLE_BINDINGS;
205857
206314
  var init_type_generation = __esm({
205858
206315
  "src/type-generation/index.ts"() {
205859
206316
  init_import_meta_url();
@@ -205861,10 +206318,12 @@ var init_type_generation = __esm({
205861
206318
  init_src();
205862
206319
  init_source();
205863
206320
  init_find();
206321
+ import_glob_to_regexp3 = __toESM(require_glob_to_regexp());
205864
206322
  init_yargs();
205865
206323
  init_config6();
205866
206324
  init_create_command();
205867
206325
  init_entry();
206326
+ init_rules13();
205868
206327
  init_class_names_sqlite();
205869
206328
  init_dev_vars();
205870
206329
  init_logger2();
@@ -206041,7 +206500,18 @@ var init_type_generation = __esm({
206041
206500
  __name(isValidIdentifier2, "isValidIdentifier");
206042
206501
  __name(escapeTypeScriptString, "escapeTypeScriptString");
206043
206502
  __name(constructTypeKey, "constructTypeKey");
206044
- __name(constructTSModuleGlob, "constructTSModuleGlob");
206503
+ __name(getTSModuleGlob, "getTSModuleGlob");
206504
+ __name(getFallbackModuleGlob, "getFallbackModuleGlob");
206505
+ __name(isAdditionalModuleDiscoveryEnabled, "isAdditionalModuleDiscoveryEnabled");
206506
+ __name(generateModuleTypeDeclarations, "generateModuleTypeDeclarations");
206507
+ __name(resolveModuleTypeDeclarations, "resolveModuleTypeDeclarations");
206508
+ __name(intersectModuleGlobs, "intersectModuleGlobs");
206509
+ __name(moduleGlobMatches, "moduleGlobMatches");
206510
+ __name(moduleGlobContains, "moduleGlobContains");
206511
+ __name(resolveMatchingModuleTypes, "resolveMatchingModuleTypes");
206512
+ __name(generateCombinedModuleTypeDeclarations, "generateCombinedModuleTypeDeclarations");
206513
+ __name(generateModuleTypeDeclaration, "generateModuleTypeDeclaration");
206514
+ __name(generateServiceWorkerTypes, "generateServiceWorkerTypes");
206045
206515
  __name(generateImportSpecifier, "generateImportSpecifier");
206046
206516
  __name(hasConfigSecrets, "hasConfigSecrets");
206047
206517
  __name(generateEnvTypes, "generateEnvTypes");
@@ -232135,7 +232605,7 @@ async function executeSql({
232135
232605
  preview: preview2
232136
232606
  }) {
232137
232607
  const existingLogLevel = logger2.loggerLevel;
232138
- if (json2) {
232608
+ if (json2 && existingLogLevel !== "none") {
232139
232609
  logger2.loggerLevel = "error";
232140
232610
  }
232141
232611
  try {
@@ -232594,7 +233064,7 @@ var init_execute = __esm({
232594
233064
  preview: preview2
232595
233065
  } = args;
232596
233066
  const existingLogLevel = logger2.loggerLevel;
232597
- if (json2) {
233067
+ if (json2 && existingLogLevel !== "none") {
232598
233068
  logger2.loggerLevel = "error";
232599
233069
  }
232600
233070
  if (file3 && command2) {
@@ -295650,7 +296120,7 @@ var init_split = __esm({
295650
296120
  conditions: [],
295651
296121
  serve_variation: variation,
295652
296122
  rollout: {
295653
- percentage: Math.min(100, Number(cumulative.toFixed(6))),
296123
+ percentage: Math.min(100, Number(cumulative.toFixed(2))),
295654
296124
  attribute: args.by
295655
296125
  }
295656
296126
  });
@@ -297833,6 +298303,14 @@ var init_kv2 = __esm({
297833
298303
  describe: 'The jurisdiction where the new namespace will be created (e.g. "us", "eu", "fedramp")',
297834
298304
  requiresArg: true
297835
298305
  },
298306
+ "experimental-mode": {
298307
+ alias: "x-mode",
298308
+ type: "string",
298309
+ describe: "The storage mode for the new namespace. Instant mode offers lower-latency reads and faster global updates [private beta].\nCannot be combined with --jurisdiction.",
298310
+ choices: ["instant"],
298311
+ requiresArg: true,
298312
+ conflicts: "jurisdiction"
298313
+ },
297836
298314
  ...sharedResourceCreationArgs
297837
298315
  },
297838
298316
  positionalArgs: ["namespace"],
@@ -297841,18 +298319,19 @@ var init_kv2 = __esm({
297841
298319
  const environment = args.env ? `${args.env}-` : "";
297842
298320
  const preview2 = args.preview ? "_preview" : "";
297843
298321
  const title = `${environment}${args.namespace}${preview2}`;
297844
- const { jurisdiction } = args;
298322
+ const { jurisdiction, experimentalMode: mode } = args;
297845
298323
  const accountId = await requireAuth(config2);
297846
298324
  printResourceLocation("remote");
297847
298325
  logger2.log(
297848
- `\u{1F300} Creating namespace with title "${title}"${jurisdiction ? ` (jurisdiction: ${jurisdiction})` : ""}`
298326
+ `\u{1F300} Creating namespace with title "${title}"${jurisdiction ? ` (jurisdiction: ${jurisdiction})` : ""}${mode ? ` (mode: ${mode})` : ""}`
297849
298327
  );
297850
298328
  let namespaceId;
297851
298329
  try {
297852
298330
  const createParams = {
297853
298331
  account_id: accountId,
297854
298332
  title,
297855
- jurisdiction
298333
+ jurisdiction,
298334
+ mode
297856
298335
  };
297857
298336
  const result = await sdk.kv.namespaces.create(createParams);
297858
298337
  namespaceId = result.id;
@@ -304842,6 +305321,7 @@ ${JSON.stringify(defaultRoutesJSONSpec, null, 2)}`
304842
305321
  tsconfig: void 0,
304843
305322
  minify: void 0,
304844
305323
  tunnelName: void 0,
305324
+ tunnelAllowedMail: void 0,
304845
305325
  env: void 0,
304846
305326
  envFile: void 0,
304847
305327
  ip,
@@ -305257,6 +305737,19 @@ var init_getLegacyScriptName = __esm({
305257
305737
  });
305258
305738
 
305259
305739
  // src/secret/index.ts
305740
+ function throwIfLatestVersionNotDeployed(e11, versionsCommand, telemetryMessage) {
305741
+ if (e11 instanceof APIError && e11.code !== void 0 && VERSION_NOT_DEPLOYED_ERR_CODES.includes(e11.code)) {
305742
+ throw new UserError(
305743
+ `Secret edit failed. You attempted to modify a secret, but the latest version of your Worker isn't currently deployed.
305744
+ This limitation exists to prevent accidental deployment when using Worker versions and secrets together.
305745
+ To resolve this, you have two options:
305746
+ (1) use the \`${versionsCommand}\` instead, which allows you to update secrets without deploying; or
305747
+ (2) deploy the latest version first, then modify secrets.
305748
+ Alternatively, you can use the Cloudflare dashboard to modify secrets and deploy the version.`,
305749
+ { telemetryMessage }
305750
+ );
305751
+ }
305752
+ }
305260
305753
  async function createDraftWorker({
305261
305754
  config: config2,
305262
305755
  accountId,
@@ -305325,14 +305818,23 @@ async function putBulkSecrets(config2, accountId, scriptName, content) {
305325
305818
  secrets[key] = null;
305326
305819
  }
305327
305820
  }
305328
- const resp = await fetchResult2(config2, url4, {
305329
- method: "PATCH",
305330
- headers: { "Content-Type": "application/merge-patch+json" },
305331
- body: JSON.stringify({ secrets })
305332
- });
305333
- return [resp, toCreate, toDelete];
305821
+ try {
305822
+ const resp = await fetchResult2(config2, url4, {
305823
+ method: "PATCH",
305824
+ headers: { "Content-Type": "application/merge-patch+json" },
305825
+ body: JSON.stringify({ secrets })
305826
+ });
305827
+ return [resp, toCreate, toDelete];
305828
+ } catch (e11) {
305829
+ throwIfLatestVersionNotDeployed(
305830
+ e11,
305831
+ "wrangler versions secret bulk",
305832
+ "secret bulk version not deployed"
305833
+ );
305834
+ throw e11;
305835
+ }
305334
305836
  }
305335
- var VERSION_NOT_DEPLOYED_ERR_CODE, secretNamespace, secretPutCommand, secretDeleteCommand, secretListCommand, secretBulkCommand;
305837
+ var VERSION_NOT_DEPLOYED_ERR_CODE, VERSION_SETTINGS_NOT_DEPLOYED_ERR_CODE, VERSION_NOT_DEPLOYED_ERR_CODES, secretNamespace, secretPutCommand, secretDeleteCommand, secretListCommand, secretBulkCommand;
305336
305838
  var init_secret = __esm({
305337
305839
  "src/secret/index.ts"() {
305338
305840
  init_import_meta_url();
@@ -305349,6 +305851,12 @@ var init_secret = __esm({
305349
305851
  init_std();
305350
305852
  init_src3();
305351
305853
  VERSION_NOT_DEPLOYED_ERR_CODE = 10215;
305854
+ VERSION_SETTINGS_NOT_DEPLOYED_ERR_CODE = 10214;
305855
+ VERSION_NOT_DEPLOYED_ERR_CODES = [
305856
+ VERSION_NOT_DEPLOYED_ERR_CODE,
305857
+ VERSION_SETTINGS_NOT_DEPLOYED_ERR_CODE
305858
+ ];
305859
+ __name(throwIfLatestVersionNotDeployed, "throwIfLatestVersionNotDeployed");
305352
305860
  __name(createDraftWorker, "createDraftWorker");
305353
305861
  secretNamespace = createNamespace({
305354
305862
  metadata: {
@@ -305415,14 +305923,12 @@ var init_secret = __esm({
305415
305923
  })
305416
305924
  });
305417
305925
  } catch (e11) {
305418
- if (e11 instanceof APIError && e11.code === VERSION_NOT_DEPLOYED_ERR_CODE) {
305419
- throw new UserError(
305420
- "Secret edit failed. You attempted to modify a secret, but the latest version of your Worker isn't currently deployed.\nThis limitation exists to prevent accidental deployment when using Worker versions and secrets together.\nTo resolve this, you have two options:\n(1) use the `wrangler versions secret put` instead, which allows you to update secrets without deploying; or\n(2) deploy the latest version first, then modify secrets.\nAlternatively, you can use the Cloudflare dashboard to modify secrets and deploy the version.",
305421
- { telemetryMessage: "secret put version not deployed" }
305422
- );
305423
- } else {
305424
- throw e11;
305425
- }
305926
+ throwIfLatestVersionNotDeployed(
305927
+ e11,
305928
+ "wrangler versions secret put",
305929
+ "secret put version not deployed"
305930
+ );
305931
+ throw e11;
305426
305932
  }
305427
305933
  }
305428
305934
  __name(submitSecret, "submitSecret");
@@ -344981,7 +345487,23 @@ function parseSourceArgument(source, args) {
344981
345487
  case "artifacts" /* ARTIFACTS */:
344982
345488
  return { type: "artifacts" /* ARTIFACTS */ };
344983
345489
  case "artifacts.repo" /* ARTIFACTS_REPO */:
344984
- return { type: "artifacts.repo" /* ARTIFACTS_REPO */ };
345490
+ if (!args.sourceNamespace) {
345491
+ throw new UserError(
345492
+ `--source-namespace is required when using source '${"artifacts.repo" /* ARTIFACTS_REPO */}'`,
345493
+ { telemetryMessage: "queues subscription create missing namespace" }
345494
+ );
345495
+ }
345496
+ if (!args.sourceRepoName) {
345497
+ throw new UserError(
345498
+ `--source-repo-name is required when using source '${"artifacts.repo" /* ARTIFACTS_REPO */}'`,
345499
+ { telemetryMessage: "queues subscription create missing repo name" }
345500
+ );
345501
+ }
345502
+ return {
345503
+ type: "artifacts.repo" /* ARTIFACTS_REPO */,
345504
+ namespace: args.sourceNamespace,
345505
+ repo_name: args.sourceRepoName
345506
+ };
344985
345507
  case "browserRun" /* BROWSER_RUN */:
344986
345508
  return { type: "browserRun" /* BROWSER_RUN */ };
344987
345509
  case "email.sending" /* EMAIL_SENDING */:
@@ -345085,7 +345607,7 @@ var init_create18 = __esm({
345085
345607
  choices: EVENT_SOURCE_TYPES
345086
345608
  },
345087
345609
  events: {
345088
- describe: "Comma-separated list of event types to subscribe to",
345610
+ describe: "Comma-separated list of event types to subscribe to (for artifacts.repo, use pushed, not cf.artifacts.repo.pushed)",
345089
345611
  type: "string",
345090
345612
  demandOption: true
345091
345613
  },
@@ -345117,6 +345639,14 @@ var init_create18 = __esm({
345117
345639
  domain: {
345118
345640
  describe: "Sending domain \u2014 zone apex or verified subdomain (required for email.sending source)",
345119
345641
  type: "string"
345642
+ },
345643
+ "source-namespace": {
345644
+ describe: "Artifacts namespace (required for artifacts.repo source)",
345645
+ type: "string"
345646
+ },
345647
+ "source-repo-name": {
345648
+ describe: "Artifacts repository name (required for artifacts.repo source)",
345649
+ type: "string"
345120
345650
  }
345121
345651
  },
345122
345652
  async handler(args, { config: config2 }) {
@@ -345125,7 +345655,9 @@ var init_create18 = __esm({
345125
345655
  workerName: args.workerName,
345126
345656
  workflowName: args.workflowName,
345127
345657
  zoneId: args.zoneId,
345128
- domain: args.domain
345658
+ domain: args.domain,
345659
+ sourceNamespace: args.sourceNamespace,
345660
+ sourceRepoName: args.sourceRepoName
345129
345661
  });
345130
345662
  const events7 = args.events.split(",").map((event) => event.trim()).filter(Boolean);
345131
345663
  if (events7.length === 0) {
@@ -345223,6 +345755,8 @@ function getSourceType(source) {
345223
345755
  }
345224
345756
  function getSourceResource(source) {
345225
345757
  switch (source.type) {
345758
+ case "artifacts.repo" /* ARTIFACTS_REPO */:
345759
+ return `${source.namespace}/${source.repo_name}`;
345226
345760
  case "email.sending" /* EMAIL_SENDING */:
345227
345761
  return source.domain;
345228
345762
  case "workersAi.model" /* WORKERS_AI_MODEL */:
@@ -348057,7 +348591,7 @@ async function usingLocalBucket(persistTo, config2, bucketName, closure) {
348057
348591
  try {
348058
348592
  if (request.method !== "PUT") return new Response(null, { status: 405 });
348059
348593
  const url = new URL(request.url);
348060
- const key = url.pathname.substring(1);
348594
+ const key = decodeURIComponent(url.pathname.substring(1));
348061
348595
  const optsHeader = request.headers.get("Wrangler-R2-Put-Options");
348062
348596
  const opts = JSON.parse(optsHeader);
348063
348597
  await env.BUCKET.put(key, request.body, opts);
@@ -348456,15 +348990,18 @@ var init_object3 = __esm({
348456
348990
  cacheExpiry: yArgs.expires === void 0 ? void 0 : parseInt(yArgs.expires)
348457
348991
  }
348458
348992
  };
348459
- await mf.dispatchFetch(`http://localhost/${key}`, {
348460
- method: "PUT",
348461
- body: objectStream,
348462
- duplex: "half",
348463
- headers: {
348464
- "Content-Length": String(sizeBytes),
348465
- "Wrangler-R2-Put-Options": JSON.stringify(putOptions)
348993
+ await mf.dispatchFetch(
348994
+ `http://localhost/${encodeURIComponent(key)}`,
348995
+ {
348996
+ method: "PUT",
348997
+ body: objectStream,
348998
+ duplex: "half",
348999
+ headers: {
349000
+ "Content-Length": String(sizeBytes),
349001
+ "Wrangler-R2-Put-Options": JSON.stringify(putOptions)
349002
+ }
348466
349003
  }
348467
- });
349004
+ );
348468
349005
  }
348469
349006
  );
348470
349007
  } else {
@@ -348709,15 +349246,18 @@ var init_object3 = __esm({
348709
349246
  if ((index + 1) % 100 === 0 || index + 1 === entries2.length) {
348710
349247
  logBulkProgress2("Uploaded", index + 1, entries2.length);
348711
349248
  }
348712
- await mf.dispatchFetch(`http://localhost/${entry.key}`, {
348713
- method: "PUT",
348714
- body: Stream__namespace.Readable.toWeb(fs14__namespace.createReadStream(entry.file)),
348715
- duplex: "half",
348716
- headers: {
348717
- "Content-Length": String(entry.size),
348718
- "Wrangler-R2-Put-Options": jsonPutOptions
349249
+ await mf.dispatchFetch(
349250
+ `http://localhost/${encodeURIComponent(entry.key)}`,
349251
+ {
349252
+ method: "PUT",
349253
+ body: Stream__namespace.Readable.toWeb(fs14__namespace.createReadStream(entry.file)),
349254
+ duplex: "half",
349255
+ headers: {
349256
+ "Content-Length": String(entry.size),
349257
+ "Wrangler-R2-Put-Options": jsonPutOptions
349258
+ }
348719
349259
  }
348720
- });
349260
+ );
348721
349261
  })
348722
349262
  );
348723
349263
  try {
@@ -355006,7 +355546,7 @@ var init_bulk5 = __esm({
355006
355546
  init_secrets6();
355007
355547
  versionsSecretBulkCommand = createCommand({
355008
355548
  metadata: {
355009
- description: "Create or update a secret variable for a Worker",
355549
+ description: "Create, update, or delete multiple secret variables for a Worker",
355010
355550
  owner: "Workers: Authoring and Testing",
355011
355551
  status: "stable"
355012
355552
  },
@@ -355018,7 +355558,7 @@ var init_bulk5 = __esm({
355018
355558
  },
355019
355559
  args: {
355020
355560
  file: {
355021
- describe: `The file of key-value pairs to upload, as JSON in form {"key": value, ...} or .dev.vars file in the form KEY=VALUE`,
355561
+ describe: `The file of key-value pairs to create, update, or delete, as JSON in form {"key": "value", ...} or .env file in the form KEY=VALUE. Set a key to null in the JSON file to delete it. Deletion is not supported with .env files. If omitted, Wrangler expects to receive input from stdin rather than a file.`,
355022
355562
  type: "string"
355023
355563
  },
355024
355564
  name: {
@@ -355048,9 +355588,9 @@ var init_bulk5 = __esm({
355048
355588
  }
355049
355589
  const accountId = await requireAuth(config2);
355050
355590
  logger2.log(
355051
- `\u{1F300} Creating the secrets for the Worker "${scriptName}" ${args.env ? `(${args.env})` : ""}`
355591
+ `\u{1F300} Processing the secrets for the Worker "${scriptName}" ${args.env ? `(${args.env})` : ""}`
355052
355592
  );
355053
- const result = await parseBulkInputToObject(args.file);
355593
+ const result = await parseBulkInputToObject(args.file, true);
355054
355594
  if (!result) {
355055
355595
  return logger2.error(`No content found in file or piped input.`);
355056
355596
  }
@@ -355066,8 +355606,16 @@ var init_bulk5 = __esm({
355066
355606
  sendMetrics: config2.send_metrics,
355067
355607
  noVersionsTelemetryMessage: "versions secrets bulk no uploaded versions"
355068
355608
  });
355069
- for (const [name2] of secretEntries) {
355070
- logger2.log(`\u2728 Successfully created secret for key: ${name2}`);
355609
+ let created = 0;
355610
+ let deleted = 0;
355611
+ for (const [name2, value] of secretEntries) {
355612
+ if (value === null) {
355613
+ deleted++;
355614
+ logger2.log(`\u{1F4A5} Successfully deleted secret for key: ${name2}`);
355615
+ } else {
355616
+ created++;
355617
+ logger2.log(`\u2728 Successfully created secret for key: ${name2}`);
355618
+ }
355071
355619
  }
355072
355620
  sendMetricsEvent(
355073
355621
  "create encrypted variable",
@@ -355082,7 +355630,7 @@ var init_bulk5 = __esm({
355082
355630
  }
355083
355631
  );
355084
355632
  logger2.log(
355085
- `\u2728 Success! Created version ${newVersion.id} with ${secretEntries.length} secrets.
355633
+ `\u2728 Success! Created version ${newVersion.id} with ${created} secret${created === 1 ? "" : "s"} created and ${deleted} secret${deleted === 1 ? "" : "s"} deleted.
355086
355634
  \u27A1\uFE0F To deploy this version to production traffic use the command "wrangler versions deploy".`
355087
355635
  );
355088
355636
  }, "versionsSecretPutBulkHandler")
@@ -366901,7 +367449,7 @@ var init_dev3 = __esm({
366901
367449
  const tunnelConfig = this.getCurrentTunnelConfig();
366902
367450
  const isQuickTunnel = tunnelConfig?.name === void 0;
366903
367451
  logger2.warn(
366904
- (isQuickTunnel ? source_default.dim("Once connected, this tunnel will be ") + "publicly accessible" : source_default.dim(
367452
+ (isQuickTunnel ? source_default.dim("Once connected, this tunnel may be ") + "publicly accessible" : source_default.dim(
366905
367453
  "Once connected, this tunnel may be reachable from the Internet"
366906
367454
  )) + source_default.dim(". Anyone who can reach it can:\n") + source_default.dim(
366907
367455
  "- Call ungated endpoints\n- Trigger logic that uses remote bindings\n- Reach internal services if your Worker proxies requests\n\n" + (isQuickTunnel ? "Consider using a named tunnel with Cloudflare Access to restrict access.\n" : "Consider using Cloudflare Access to restrict access.\n")
@@ -366914,6 +367462,7 @@ var init_dev3 = __esm({
366914
367462
  const nextTunnel = startTunnel({
366915
367463
  origin,
366916
367464
  token: namedTunnel?.token,
367465
+ allowedMail: tunnelConfig?.allowedMail,
366917
367466
  extendHint: "Press [a] to extend by 1 hour.",
366918
367467
  logger: logger2
366919
367468
  });
@@ -368194,7 +368743,7 @@ var init_compatibility_flags = __esm({
368194
368743
  });
368195
368744
 
368196
368745
  // ../workers-shared/asset-worker/src/utils/base-path.ts
368197
- var init_base_path = __esm({
368746
+ var init_base_path2 = __esm({
368198
368747
  "../workers-shared/asset-worker/src/utils/base-path.ts"() {
368199
368748
  init_import_meta_url();
368200
368749
  }
@@ -368226,7 +368775,7 @@ var init_handler2 = __esm({
368226
368775
  init_responses2();
368227
368776
  init_tracing2();
368228
368777
  init_compatibility_flags();
368229
- init_base_path();
368778
+ init_base_path2();
368230
368779
  init_headers();
368231
368780
  init_rules_engine();
368232
368781
  }
@@ -369501,7 +370050,8 @@ async function setupDevEnv(devEnv, configPath, auth2, args) {
369501
370050
  experimentalNewConfig: args.experimentalNewConfig,
369502
370051
  tunnel: {
369503
370052
  enabled: args.tunnel ?? false,
369504
- name: args.tunnelName
370053
+ name: args.tunnelName,
370054
+ allowedMail: args.tunnelAllowedMail?.length ? args.tunnelAllowedMail : void 0
369505
370055
  }
369506
370056
  },
369507
370057
  legacy: {
@@ -369724,6 +370274,7 @@ unstable_dev()'s behaviour will likely change in future releases`
369724
370274
  types: false,
369725
370275
  tunnel: void 0,
369726
370276
  tunnelName: void 0,
370277
+ tunnelAllowedMail: void 0,
369727
370278
  experimentalNewConfig: false
369728
370279
  };
369729
370280
  const devServer = await run(