wrangler 4.137.0 → 4.138.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.137.0",
3
+ "version": "4.138.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "assembly",
@@ -74,7 +74,7 @@
74
74
  "workerd": "1.20260921.1",
75
75
  "@cloudflare/kv-asset-handler": "0.5.0",
76
76
  "@cloudflare/unenv-preset": "2.16.2",
77
- "miniflare": "5.20260921.0-alpha"
77
+ "miniflare": "5.20260921.1-alpha"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@aws-sdk/client-s3": "^3.721.0",
@@ -161,22 +161,22 @@
161
161
  "yaml": "^2.8.1",
162
162
  "yargs": "^17.7.2",
163
163
  "zod": "4.4.3",
164
+ "@cloudflare/autoconfig": "0.6.3",
164
165
  "@cloudflare/build-output-utils": "0.7.1",
165
- "@cloudflare/autoconfig": "0.6.2",
166
- "@cloudflare/cli-shared-helpers": "0.1.36",
166
+ "@cloudflare/cli-shared-helpers": "0.1.37",
167
167
  "@cloudflare/config": "0.17.0",
168
- "@cloudflare/containers-shared": "0.19.1",
169
- "@cloudflare/deploy-helpers": "0.15.0",
170
- "@cloudflare/pages-functions": "0.1.0",
171
- "@cloudflare/remote-bindings": "0.0.32",
172
- "@cloudflare/pages-shared": "^0.13.186",
173
- "@cloudflare/workers-auth": "0.9.0",
168
+ "@cloudflare/containers-shared": "0.19.2",
169
+ "@cloudflare/deploy-helpers": "0.15.1",
170
+ "@cloudflare/pages-shared": "^0.13.187",
174
171
  "@cloudflare/shared-ast-primitives": "1.1.0",
175
- "@cloudflare/runtime-types": "0.1.0",
176
- "@cloudflare/workers-shared": "0.19.9",
177
- "@cloudflare/workflows-shared": "0.14.0",
172
+ "@cloudflare/remote-bindings": "0.0.33",
173
+ "@cloudflare/runtime-types": "0.1.1",
174
+ "@cloudflare/workers-auth": "0.9.1",
175
+ "@cloudflare/workers-shared": "0.20.0",
176
+ "@cloudflare/pages-functions": "0.1.0",
178
177
  "@cloudflare/workers-tsconfig": "0.0.0",
179
- "@cloudflare/workers-utils": "0.41.1"
178
+ "@cloudflare/workers-utils": "0.41.2",
179
+ "@cloudflare/workflows-shared": "0.14.0"
180
180
  },
181
181
  "peerDependencies": {
182
182
  "@cloudflare/workers-types": "^5.20260921.1"
@@ -3478,7 +3478,6 @@ interface DevArgs {
3478
3478
  }
3479
3479
  interface BuildArgs {
3480
3480
  mode?: string;
3481
- preview?: boolean;
3482
3481
  }
3483
3482
  declare class ArgParseError extends Error {
3484
3483
  constructor(message: string);
@@ -59401,6 +59401,18 @@ var init_worker_name = __esm({
59401
59401
  __name(getWorkerNameFromProject, "getWorkerNameFromProject");
59402
59402
  }
59403
59403
  });
59404
+
59405
+ // ../workers-utils/src/zod-format.ts
59406
+ function formatZodError(error53) {
59407
+ return external_exports.prettifyError(error53);
59408
+ }
59409
+ var init_zod_format = __esm({
59410
+ "../workers-utils/src/zod-format.ts"() {
59411
+ init_import_meta_url();
59412
+ init_zod();
59413
+ __name(formatZodError, "formatZodError");
59414
+ }
59415
+ });
59404
59416
  function toUrlPath(filePath) {
59405
59417
  assert38__default.default(
59406
59418
  !/^[a-z]:/i.test(filePath),
@@ -60383,6 +60395,7 @@ var init_src = __esm({
60383
60395
  init_route_utils();
60384
60396
  init_package_manager();
60385
60397
  init_worker_name();
60398
+ init_zod_format();
60386
60399
  init_url_path();
60387
60400
  init_d1_migrations();
60388
60401
  friendlyBindingNames2 = friendlyBindingNames;
@@ -62178,7 +62191,7 @@ var name, version2;
62178
62191
  var init_package = __esm({
62179
62192
  "package.json"() {
62180
62193
  name = "wrangler";
62181
- version2 = "4.137.0";
62194
+ version2 = "4.138.0";
62182
62195
  }
62183
62196
  });
62184
62197
 
@@ -124309,6 +124322,41 @@ function solveChallenge(challenge) {
124309
124322
  solution: { checkpoints: encodeCheckpoints(checkpoints) }
124310
124323
  };
124311
124324
  }
124325
+ function getResponseErrorCode(body) {
124326
+ if (typeof body !== "object" || body === null || !("errors" in body)) {
124327
+ return void 0;
124328
+ }
124329
+ const { errors } = body;
124330
+ if (!Array.isArray(errors) || errors.length === 0) {
124331
+ return void 0;
124332
+ }
124333
+ const [error53] = errors;
124334
+ if (typeof error53 !== "object" || error53 === null || !("code" in error53)) {
124335
+ return void 0;
124336
+ }
124337
+ return typeof error53.code === "number" ? error53.code : void 0;
124338
+ }
124339
+ async function getEventAccountError(response) {
124340
+ let body;
124341
+ try {
124342
+ body = await response.json();
124343
+ } catch {
124344
+ return void 0;
124345
+ }
124346
+ const errorCode = getResponseErrorCode(body);
124347
+ if (errorCode === void 0) {
124348
+ return void 0;
124349
+ }
124350
+ const eventError = EVENT_ACCOUNT_ERRORS.get(errorCode);
124351
+ if (!eventError) {
124352
+ return void 0;
124353
+ }
124354
+ const options = { telemetryMessage: eventError.telemetryMessage };
124355
+ if (eventError.fatal) {
124356
+ return new FatalError(eventError.message, options);
124357
+ }
124358
+ return new UserError(eventError.message, options);
124359
+ }
124312
124360
  function getTemporaryPreviewUrl() {
124313
124361
  return `${getCloudflareApiBaseUrl(COMPLIANCE_REGION_CONFIG_PUBLIC)}/provisioning/previews`;
124314
124362
  }
@@ -124370,7 +124418,7 @@ async function requestPowSolution(logger7) {
124370
124418
  logger7.log("Solving proof-of-work challenge\u2026");
124371
124419
  return solveChallenge({ challengeToken, seed, k: k7, g: g7 });
124372
124420
  }
124373
- async function createTemporaryPreviewAccount(logger7) {
124421
+ async function createTemporaryPreviewAccount(logger7, request4) {
124374
124422
  const pow = await requestPowSolution(logger7);
124375
124423
  const response = await (0, import_undici3.fetch)(getTemporaryPreviewUrl(), {
124376
124424
  method: "POST",
@@ -124380,10 +124428,17 @@ async function createTemporaryPreviewAccount(logger7) {
124380
124428
  privacyPolicy: TEMPORARY_TERMS_URLS.privacyPolicy,
124381
124429
  acceptTermsOfService: "yes",
124382
124430
  challengeToken: pow.challengeToken,
124383
- solution: pow.solution
124431
+ solution: pow.solution,
124432
+ ...request4?.eventCode ? { eventCode: request4.eventCode } : {}
124384
124433
  })
124385
124434
  });
124386
124435
  if (!response.ok) {
124436
+ if (request4?.eventCode) {
124437
+ const eventError = await getEventAccountError(response);
124438
+ if (eventError) {
124439
+ throw eventError;
124440
+ }
124441
+ }
124387
124442
  throw new FatalError(
124388
124443
  `Failed to create a temporary preview account (${response.status} ${response.statusText}).`,
124389
124444
  { telemetryMessage: "deploy temporary account create failed" }
@@ -124405,12 +124460,21 @@ async function createTemporaryPreviewAccount(logger7) {
124405
124460
  const accountExpiresAt = previewAccount?.account?.expiresAt;
124406
124461
  const claimUrl = previewAccount?.claim?.url;
124407
124462
  const claimExpiresAt = previewAccount?.claim?.expiresAt;
124463
+ const eventCodeAccepted = previewAccount?.eventCodeAccepted;
124408
124464
  if (accountId === void 0 || accountName === void 0 || apiToken === void 0 || accountExpiresAt === void 0 || claimUrl === void 0 || claimExpiresAt === void 0) {
124409
124465
  throw new FatalError(
124410
124466
  "Failed to create a temporary preview account because the response was missing required fields.",
124411
124467
  { telemetryMessage: "deploy temporary account response incomplete" }
124412
124468
  );
124413
124469
  }
124470
+ if (request4?.eventCode && eventCodeAccepted !== true) {
124471
+ throw new FatalError(
124472
+ "Failed to create a temporary preview account because the response did not acknowledge the event code.",
124473
+ {
124474
+ telemetryMessage: "deploy temporary event acknowledgement missing"
124475
+ }
124476
+ );
124477
+ }
124414
124478
  return {
124415
124479
  account: {
124416
124480
  id: accountId,
@@ -124429,6 +124493,14 @@ async function getOrCreateTemporaryPreviewAccount(options) {
124429
124493
  options.storage
124430
124494
  );
124431
124495
  if (cachedPreviewAccount) {
124496
+ if (options.request?.eventCode) {
124497
+ throw new UserError(
124498
+ "A temporary account is already cached. Rerun without --event-code to reuse it, or run `wrangler logout` and retry to create an account for this event.",
124499
+ {
124500
+ telemetryMessage: "deploy temporary event cache conflict"
124501
+ }
124502
+ );
124503
+ }
124432
124504
  return { account: cachedPreviewAccount, cached: true };
124433
124505
  }
124434
124506
  const termsAccepted = await options.prompt(
@@ -124441,7 +124513,8 @@ async function getOrCreateTemporaryPreviewAccount(options) {
124441
124513
  });
124442
124514
  }
124443
124515
  const temporaryPreviewAccount = await createTemporaryPreviewAccount(
124444
- options.logger
124516
+ options.logger,
124517
+ options.request
124445
124518
  );
124446
124519
  options.storage.write(temporaryPreviewAccount);
124447
124520
  return { account: temporaryPreviewAccount, cached: false };
@@ -125275,7 +125348,7 @@ function createOAuthFlow(ctx) {
125275
125348
  __name2(getStorage, "getStorage");
125276
125349
  const getClientId = /* @__PURE__ */ __name2(() => typeof ctx.clientId === "function" ? ctx.clientId() : ctx.clientId, "getClientId");
125277
125350
  const consent = ctx.consent;
125278
- let temporaryAllowed = false;
125351
+ let temporaryRequest;
125279
125352
  let activeTemporaryAccount;
125280
125353
  const redirectUrl = new URL(ctx.redirectUri);
125281
125354
  const defaultCallbackHost = redirectUrl.hostname;
@@ -125510,14 +125583,14 @@ function createOAuthFlow(ctx) {
125510
125583
  }
125511
125584
  __name(requireApiTokenInternal, "requireApiTokenInternal");
125512
125585
  __name2(requireApiTokenInternal, "requireApiTokenInternal");
125513
- function setTemporaryAllowed2(allowed) {
125514
- temporaryAllowed = allowed && ctx.temporary !== void 0;
125586
+ function setTemporaryAllowed2(allowed, request4) {
125587
+ temporaryRequest = allowed && ctx.temporary !== void 0 ? request4 ?? {} : void 0;
125515
125588
  activeTemporaryAccount = void 0;
125516
125589
  }
125517
125590
  __name(setTemporaryAllowed2, "setTemporaryAllowed");
125518
125591
  __name2(setTemporaryAllowed2, "setTemporaryAllowed");
125519
125592
  function isTemporaryAllowed() {
125520
- return temporaryAllowed;
125593
+ return temporaryRequest !== void 0;
125521
125594
  }
125522
125595
  __name(isTemporaryAllowed, "isTemporaryAllowed");
125523
125596
  __name2(isTemporaryAllowed, "isTemporaryAllowed");
@@ -125535,7 +125608,8 @@ function createOAuthFlow(ctx) {
125535
125608
  }
125536
125609
  const result = await getOrCreateTemporaryPreviewAccount({
125537
125610
  ...ctx.temporary,
125538
- logger: ctx.logger
125611
+ logger: ctx.logger,
125612
+ ...temporaryRequest ? { request: temporaryRequest } : {}
125539
125613
  });
125540
125614
  activeTemporaryAccount = result.account;
125541
125615
  return result;
@@ -126930,9 +127004,9 @@ function scrubEncryptedCredentials(options) {
126930
127004
  }
126931
127005
  return { backendAvailable: false, encryptedFileExisted };
126932
127006
  }
126933
- 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, 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, DATE_TIME_RE2, TomlDate2, TomlError2, INT_REGEX2, FLOAT_REGEX2, LEADING_ZERO2, 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;
126934
- var init_chunk_4CJO23DA = __esm({
126935
- "../workers-auth/dist/chunk-4CJO23DA.mjs"() {
127007
+ 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, 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, DATE_TIME_RE2, TomlDate2, TomlError2, INT_REGEX2, FLOAT_REGEX2, LEADING_ZERO2, 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;
127008
+ var init_chunk_XLADBZ7F = __esm({
127009
+ "../workers-auth/dist/chunk-XLADBZ7F.mjs"() {
126936
127010
  init_import_meta_url();
126937
127011
  init_chunk_O6YSETKJ();
126938
127012
  init_src();
@@ -127055,6 +127129,62 @@ var init_chunk_4CJO23DA = __esm({
127055
127129
  TEMPORARY_TERMS_PROMPT = `You must accept Cloudflare's Terms of Service (${TEMPORARY_TERMS_URLS.termsOfService}) and Privacy Policy (${TEMPORARY_TERMS_URLS.privacyPolicy}) in order to continue. By typing "yes", you agree to these terms. Type "yes" to continue.`;
127056
127130
  TEMPORARY_TERMS_NOTICE = `Continuing means you accept Cloudflare's Terms of Service (${TEMPORARY_TERMS_URLS.termsOfService}) and Privacy Policy (${TEMPORARY_TERMS_URLS.privacyPolicy}).`;
127057
127131
  TEMPORARY_TERMS_ERROR = `You must accept Cloudflare's Terms of Service (${TEMPORARY_TERMS_URLS.termsOfService}) and Privacy Policy (${TEMPORARY_TERMS_URLS.privacyPolicy}) to use --temporary.`;
127132
+ EVENT_ACCOUNT_ERRORS = /* @__PURE__ */ new Map([
127133
+ [
127134
+ 1035,
127135
+ {
127136
+ message: "The event code is malformed. Check it and try again.",
127137
+ telemetryMessage: "deploy temporary event code invalid"
127138
+ }
127139
+ ],
127140
+ [
127141
+ 1036,
127142
+ {
127143
+ message: "The event code was not found. Check it and try again.",
127144
+ telemetryMessage: "deploy temporary event not found"
127145
+ }
127146
+ ],
127147
+ [
127148
+ 1037,
127149
+ {
127150
+ message: "This event has not started yet.",
127151
+ telemetryMessage: "deploy temporary event not started"
127152
+ }
127153
+ ],
127154
+ [
127155
+ 1038,
127156
+ {
127157
+ message: "This event has ended.",
127158
+ telemetryMessage: "deploy temporary event expired"
127159
+ }
127160
+ ],
127161
+ [
127162
+ 1039,
127163
+ {
127164
+ message: "This event is disabled. Contact the event organizer.",
127165
+ telemetryMessage: "deploy temporary event disabled"
127166
+ }
127167
+ ],
127168
+ [
127169
+ 1040,
127170
+ {
127171
+ message: "This event has no temporary accounts remaining.",
127172
+ telemetryMessage: "deploy temporary event exhausted"
127173
+ }
127174
+ ],
127175
+ [
127176
+ 1041,
127177
+ {
127178
+ message: "The event account could not be prepared. Try again later or contact the event organizer.",
127179
+ telemetryMessage: "deploy temporary event provisioning unavailable",
127180
+ fatal: true
127181
+ }
127182
+ ]
127183
+ ]);
127184
+ __name(getResponseErrorCode, "getResponseErrorCode");
127185
+ __name2(getResponseErrorCode, "getResponseErrorCode");
127186
+ __name(getEventAccountError, "getEventAccountError");
127187
+ __name2(getEventAccountError, "getEventAccountError");
127058
127188
  __name(getTemporaryPreviewUrl, "getTemporaryPreviewUrl");
127059
127189
  __name2(getTemporaryPreviewUrl, "getTemporaryPreviewUrl");
127060
127190
  __name(getTemporaryPreviewChallengeUrl, "getTemporaryPreviewChallengeUrl");
@@ -128005,7 +128135,7 @@ ${codeblock}`, options);
128005
128135
  var init_dist2 = __esm({
128006
128136
  "../workers-auth/dist/index.mjs"() {
128007
128137
  init_import_meta_url();
128008
- init_chunk_4CJO23DA();
128138
+ init_chunk_XLADBZ7F();
128009
128139
  }
128010
128140
  });
128011
128141
  function createPreferences(getConfigPath2) {
@@ -128363,8 +128493,8 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
128363
128493
  }
128364
128494
  __name(getCredentialStore2, "getCredentialStore");
128365
128495
  __name2(getCredentialStore2, "getCredentialStore");
128366
- function setTemporaryAllowed2(allowed) {
128367
- oauthFlow.setTemporaryAllowed(allowed);
128496
+ function setTemporaryAllowed2(allowed, request4) {
128497
+ oauthFlow.setTemporaryAllowed(allowed, request4);
128368
128498
  }
128369
128499
  __name(setTemporaryAllowed2, "setTemporaryAllowed");
128370
128500
  __name2(setTemporaryAllowed2, "setTemporaryAllowed");
@@ -128913,10 +129043,10 @@ function createAuthConfigFileHelpers(deps) {
128913
129043
  };
128914
129044
  }
128915
129045
  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;
128916
- var init_chunk_A6F4WXCF = __esm({
128917
- "../workers-auth/dist/chunk-A6F4WXCF.mjs"() {
129046
+ var init_chunk_3U6VZT7T = __esm({
129047
+ "../workers-auth/dist/chunk-3U6VZT7T.mjs"() {
128918
129048
  init_import_meta_url();
128919
- init_chunk_4CJO23DA();
129049
+ init_chunk_XLADBZ7F();
128920
129050
  init_chunk_O6YSETKJ();
128921
129051
  init_src();
128922
129052
  __name(createPreferences, "createPreferences");
@@ -129430,7 +129560,7 @@ var DefaultScopes, DefaultScopeKeys, WRANGLER_KEYRING_SERVICE_NAME, WRANGLER_CLI
129430
129560
  var init_wrangler = __esm({
129431
129561
  "../workers-auth/dist/wrangler/index.mjs"() {
129432
129562
  init_import_meta_url();
129433
- init_chunk_A6F4WXCF();
129563
+ init_chunk_3U6VZT7T();
129434
129564
  init_chunk_O6YSETKJ();
129435
129565
  init_src();
129436
129566
  DefaultScopes = {
@@ -134716,8 +134846,8 @@ function getActiveProfile() {
134716
134846
  function getCredentialStore() {
134717
134847
  return auth.getCredentialStore();
134718
134848
  }
134719
- function setTemporaryAllowed(allowed) {
134720
- auth.setTemporaryAllowed(allowed);
134849
+ function setTemporaryAllowed(allowed, request4) {
134850
+ auth.setTemporaryAllowed(allowed, request4);
134721
134851
  }
134722
134852
  function getAuthFromEnv2() {
134723
134853
  return getAuthFromEnv();
@@ -170824,6 +170954,7 @@ var init_types3 = __esm({
170824
170954
  "none"
170825
170955
  ]).optional(),
170826
170956
  not_found_handling: external_exports.enum(["single-page-application", "404-page", "none"]).optional(),
170957
+ base_path: external_exports.string().optional(),
170827
170958
  redirects: RedirectsSchema,
170828
170959
  headers: HeadersSchema,
170829
170960
  has_static_routing: external_exports.boolean().optional(),
@@ -178888,7 +179019,7 @@ var CF_KEYRING_SERVICE_NAME, CF_CLI_NAME, CF_DISPLAY_NAME, CF_OAUTH_CALLBACK_URL
178888
179019
  var init_cf = __esm({
178889
179020
  "../workers-auth/dist/cf/index.mjs"() {
178890
179021
  init_import_meta_url();
178891
- init_chunk_A6F4WXCF();
179022
+ init_chunk_3U6VZT7T();
178892
179023
  init_chunk_O6YSETKJ();
178893
179024
  init_src();
178894
179025
  CF_KEYRING_SERVICE_NAME = "cloudflare";
@@ -179893,7 +180024,7 @@ var init_dist14 = __esm({
179893
180024
  init_wrapper();
179894
180025
  init_create_worker_upload_form();
179895
180026
  import_undici13 = __toESM(require_undici(), 1);
179896
- version3 = "0.0.32";
180027
+ version3 = "0.0.33";
179897
180028
  NoDefaultValueProvided2 = class extends UserError {
179898
180029
  static {
179899
180030
  __name(this, "NoDefaultValueProvided");
@@ -180678,15 +180809,6 @@ function mergeRawConfigs(worker, tooling) {
180678
180809
  function dottedPath(issuePath) {
180679
180810
  return issuePath.filter((p8) => typeof p8 !== "symbol").join(".");
180680
180811
  }
180681
- function formatZodError(err) {
180682
- if (!err.issues || err.issues.length === 0) {
180683
- return err.message ?? "Unknown validation error";
180684
- }
180685
- return err.issues.map((issue2) => {
180686
- const dotted = dottedPath(issue2.path);
180687
- return dotted ? ` \u2022 ${dotted}: ${issue2.message}` : ` \u2022 ${issue2.message}`;
180688
- }).join("\n");
180689
- }
180690
180812
  function formatWranglerConfigZodError(err) {
180691
180813
  if (!err.issues || err.issues.length === 0) {
180692
180814
  return err.message ?? "Unknown validation error";
@@ -180719,7 +180841,6 @@ var init_load = __esm({
180719
180841
  __name(loadNewConfig, "loadNewConfig");
180720
180842
  __name(mergeRawConfigs, "mergeRawConfigs");
180721
180843
  __name(dottedPath, "dottedPath");
180722
- __name(formatZodError, "formatZodError");
180723
180844
  __name(formatWranglerConfigZodError, "formatWranglerConfigZodError");
180724
180845
  }
180725
180846
  });
@@ -229254,8 +229375,11 @@ function createHandler2(def, argv) {
229254
229375
  RESOURCES_PROVISION: args.experimentalProvision ?? false,
229255
229376
  AUTOCREATE_RESOURCES: args.experimentalAutoCreate
229256
229377
  };
229378
+ const temporaryAllowed = def.behaviour?.supportTemporary === true && Boolean(args.temporary);
229379
+ const eventCode = "eventCode" in args && typeof args.eventCode === "string" ? args.eventCode : void 0;
229257
229380
  setTemporaryAllowed(
229258
- def.behaviour?.supportTemporary === true && Boolean(args.temporary)
229381
+ temporaryAllowed,
229382
+ temporaryAllowed && eventCode ? { eventCode } : void 0
229259
229383
  );
229260
229384
  await run(experimentalFlags, async () => {
229261
229385
  const config2 = def.behaviour?.provideConfig ?? true ? newConfigEnabled ? (await readNewConfig(args, {
@@ -287295,15 +287419,32 @@ function assertNonConfigured(details) {
287295
287419
  "Error: expected the current project not to be already configured"
287296
287420
  );
287297
287421
  }
287422
+ function isExpectedFileSystemError(error53) {
287423
+ return typeof error53 === "object" && error53 !== null && "code" in error53 && (error53.code === "ENOENT" || error53.code === "ENOTDIR" || error53.code === "EACCES" || error53.code === "EPERM");
287424
+ }
287425
+ async function getPathStats(path107) {
287426
+ try {
287427
+ return await fs$1.stat(path107);
287428
+ } catch (error53) {
287429
+ if (isExpectedFileSystemError(error53)) {
287430
+ return void 0;
287431
+ }
287432
+ throw error53;
287433
+ }
287434
+ }
287298
287435
  async function hasIndexHtml(dir2) {
287299
- const children = await fs$1.readdir(dir2);
287300
- for (const child of children) {
287301
- const stats = await fs$1.stat(path28.join(dir2, child));
287302
- if (stats.isFile() && child === "index.html") {
287303
- return true;
287436
+ const stats = await getPathStats(path28.join(dir2, "index.html"));
287437
+ if (!stats?.isFile()) {
287438
+ return false;
287439
+ }
287440
+ try {
287441
+ return (await fs$1.readdir(dir2)).includes("index.html");
287442
+ } catch (error53) {
287443
+ if (isExpectedFileSystemError(error53)) {
287444
+ return false;
287304
287445
  }
287446
+ throw error53;
287305
287447
  }
287306
- return false;
287307
287448
  }
287308
287449
  async function findAssetsDir(from) {
287309
287450
  if (await hasIndexHtml(from)) {
@@ -287312,8 +287453,8 @@ async function findAssetsDir(from) {
287312
287453
  const children = await fs$1.readdir(from);
287313
287454
  for (const child of children) {
287314
287455
  const path107 = path28.join(from, child);
287315
- const stats = await fs$1.stat(path107);
287316
- if (stats.isDirectory() && await hasIndexHtml(path107)) {
287456
+ const stats = await getPathStats(path107);
287457
+ if (stats?.isDirectory() && await hasIndexHtml(path107)) {
287317
287458
  return path28.relative(from, path107);
287318
287459
  }
287319
287460
  }
@@ -287500,6 +287641,8 @@ var init_details2 = __esm({
287500
287641
  init_framework_detection();
287501
287642
  CLOUDFLARE_CONFIG_FILE = "cloudflare.config.ts";
287502
287643
  __name(assertNonConfigured, "assertNonConfigured");
287644
+ __name(isExpectedFileSystemError, "isExpectedFileSystemError");
287645
+ __name(getPathStats, "getPathStats");
287503
287646
  __name(hasIndexHtml, "hasIndexHtml");
287504
287647
  __name(findAssetsDir, "findAssetsDir");
287505
287648
  __name(getDetailsForAutoConfig, "getDetailsForAutoConfig");
@@ -288476,6 +288619,20 @@ var init_open_next = __esm({
288476
288619
  });
288477
288620
 
288478
288621
  // src/deploy/index.ts
288622
+ function parseEventCode(value) {
288623
+ if (Array.isArray(value)) {
288624
+ throw new CommandLineArgsError("--event-code expects a single value.", {
288625
+ telemetryMessage: "deploy event code multiple values"
288626
+ });
288627
+ }
288628
+ const eventCode = value.trim();
288629
+ if (!eventCode) {
288630
+ throw new CommandLineArgsError("--event-code cannot be empty.", {
288631
+ telemetryMessage: "deploy event code empty"
288632
+ });
288633
+ }
288634
+ return eventCode;
288635
+ }
288479
288636
  async function runDeployCommandHandler(args, {
288480
288637
  config: config2,
288481
288638
  pagesToWorkersDelegation = false
@@ -288578,6 +288735,7 @@ var init_deploy3 = __esm({
288578
288735
  init_getScriptName();
288579
288736
  init_autoconfig2();
288580
288737
  init_open_next();
288738
+ __name(parseEventCode, "parseEventCode");
288581
288739
  deployCommand = createCommand({
288582
288740
  metadata: {
288583
288741
  description: "\u{1F199} Deploy a Worker to Cloudflare",
@@ -288589,6 +288747,13 @@ var init_deploy3 = __esm({
288589
288747
  args: {
288590
288748
  ...experimentalNewConfigArg,
288591
288749
  ...sharedDeployVersionsArgs,
288750
+ "event-code": {
288751
+ describe: "Create a temporary account for an event",
288752
+ type: "string",
288753
+ requiresArg: true,
288754
+ hidden: true,
288755
+ coerce: parseEventCode
288756
+ },
288592
288757
  triggers: {
288593
288758
  describe: "cron schedules to attach",
288594
288759
  alias: ["schedule", "schedules"],
@@ -288651,6 +288816,11 @@ var init_deploy3 = __esm({
288651
288816
  suggestSkillsAfterHandler: true
288652
288817
  },
288653
288818
  validateArgs(args) {
288819
+ if (args.eventCode && !args.temporary) {
288820
+ throw new CommandLineArgsError("--event-code requires --temporary.", {
288821
+ telemetryMessage: "deploy event code temporary required"
288822
+ });
288823
+ }
288654
288824
  validateDeployVersionsArgs(args, "deploy");
288655
288825
  validateRouteZoneArgs(args);
288656
288826
  },
@@ -299359,6 +299529,7 @@ async function runPagesToWorkersDeploy(delegation) {
299359
299529
  envFile: void 0,
299360
299530
  experimentalProvision: void 0,
299361
299531
  profile: void 0,
299532
+ eventCode: void 0,
299362
299533
  triggers: void 0,
299363
299534
  routes: void 0,
299364
299535
  zone: void 0,
@@ -359279,6 +359450,21 @@ var init_trigger = __esm({
359279
359450
  });
359280
359451
  }
359281
359452
  });
359453
+ function redactEventCode(argv) {
359454
+ return argv.map((arg, index) => {
359455
+ const previousArg = argv[index - 1];
359456
+ if (previousArg === "--event-code" || previousArg === "--eventCode") {
359457
+ return "<redacted>";
359458
+ }
359459
+ if (arg.startsWith("--event-code=")) {
359460
+ return "--event-code=<redacted>";
359461
+ }
359462
+ if (arg.startsWith("--eventCode=")) {
359463
+ return "--eventCode=<redacted>";
359464
+ }
359465
+ return arg;
359466
+ });
359467
+ }
359282
359468
  function createCLIParser(argv) {
359283
359469
  const globalFlags = {
359284
359470
  v: {
@@ -359360,7 +359546,7 @@ function createCLIParser(argv) {
359360
359546
  type: "wrangler-session",
359361
359547
  version: 1,
359362
359548
  wrangler_version: version2,
359363
- command_line_args: argv,
359549
+ command_line_args: redactEventCode(argv),
359364
359550
  log_file_path: debugLogFilepath
359365
359551
  });
359366
359552
  return true;
@@ -361603,6 +361789,7 @@ var init_src7 = __esm({
361603
361789
  `Proxy environment variables detected. We'll use your proxy for fetch requests.`
361604
361790
  );
361605
361791
  }
361792
+ __name(redactEventCode, "redactEventCode");
361606
361793
  __name(createCLIParser, "createCLIParser");
361607
361794
  __name(main, "main");
361608
361795
  __name(dispatchGenericCommandErrorEvent, "dispatchGenericCommandErrorEvent");
@@ -366656,6 +366843,13 @@ var init_compatibility_flags = __esm({
366656
366843
  }
366657
366844
  });
366658
366845
 
366846
+ // ../workers-shared/asset-worker/src/utils/base-path.ts
366847
+ var init_base_path = __esm({
366848
+ "../workers-shared/asset-worker/src/utils/base-path.ts"() {
366849
+ init_import_meta_url();
366850
+ }
366851
+ });
366852
+
366659
366853
  // ../workers-shared/asset-worker/src/constants.ts
366660
366854
  var init_constants23 = __esm({
366661
366855
  "../workers-shared/asset-worker/src/constants.ts"() {
@@ -366682,6 +366876,7 @@ var init_handler2 = __esm({
366682
366876
  init_responses2();
366683
366877
  init_tracing2();
366684
366878
  init_compatibility_flags();
366879
+ init_base_path();
366685
366880
  init_headers();
366686
366881
  init_rules_engine();
366687
366882
  }
@@ -369801,8 +369996,12 @@ init_client14();
369801
369996
  // src/cf-wrangler/build.ts
369802
369997
  init_import_meta_url();
369803
369998
  init_write_build_output();
369999
+ var PREVIEW_BUILD_ENV_VAR = "CLOUDFLARE_PREVIEW_BUILD";
369804
370000
  async function runCfWranglerBuild(args) {
369805
- await writeBuildOutput({ env: args.mode, isPreview: args.preview });
370001
+ await writeBuildOutput({
370002
+ env: args.mode,
370003
+ isPreview: process.env[PREVIEW_BUILD_ENV_VAR] === "true"
370004
+ });
369806
370005
  return 0;
369807
370006
  }
369808
370007
  __name(runCfWranglerBuild, "runCfWranglerBuild");
@@ -369891,8 +370090,7 @@ function parseBuildArgs(argv) {
369891
370090
  parsed = util.parseArgs({
369892
370091
  args: argv,
369893
370092
  options: {
369894
- mode: { type: "string" },
369895
- preview: { type: "boolean" }
370093
+ mode: { type: "string" }
369896
370094
  },
369897
370095
  strict: true,
369898
370096
  allowPositionals: false
@@ -369904,9 +370102,6 @@ function parseBuildArgs(argv) {
369904
370102
  if (parsed.values.mode !== void 0) {
369905
370103
  out.mode = parsed.values.mode;
369906
370104
  }
369907
- if (parsed.values.preview !== void 0) {
369908
- out.preview = parsed.values.preview;
369909
- }
369910
370105
  return out;
369911
370106
  }
369912
370107
  __name(parseBuildArgs, "parseBuildArgs");