@cloudflare/vite-plugin 1.46.0 → 1.47.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/dist/index.mjs CHANGED
@@ -1486,7 +1486,7 @@ async function assertWranglerVersion() {
1486
1486
  * The default compatibility date to use when the user omits one.
1487
1487
  * This value is injected at build time and remains fixed for each release.
1488
1488
  */
1489
- const DEFAULT_COMPAT_DATE = "2026-07-21";
1489
+ const DEFAULT_COMPAT_DATE = "2026-07-23";
1490
1490
 
1491
1491
  //#endregion
1492
1492
  //#region src/build-output-env.ts
@@ -41608,6 +41608,10 @@ var getLocalExplorerEnabledFromEnv = getBooleanEnvironmentVariableFactory({
41608
41608
  variableName: "X_LOCAL_EXPLORER",
41609
41609
  defaultValue: true
41610
41610
  });
41611
+ var getLocalObservabilityEnabledFromEnv = getBooleanEnvironmentVariableFactory({
41612
+ variableName: "X_LOCAL_OBSERVABILITY",
41613
+ defaultValue: false
41614
+ });
41611
41615
  var getBrowserRenderingHeadfulFromEnv = getBooleanEnvironmentVariableFactory({
41612
41616
  variableName: "X_BROWSER_HEADFUL",
41613
41617
  defaultValue: false
@@ -41978,12 +41982,13 @@ function isPagesConfig(rawConfig) {
41978
41982
  __name$3(isPagesConfig, "isPagesConfig");
41979
41983
  function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args, preserveOriginalMain = false) {
41980
41984
  const diagnostics = new Diagnostics(`Processing ${configPath ? path2__default.relative(process.cwd(), configPath) : "wrangler"} configuration:`);
41985
+ const isRedirectedConfig2 = isRedirectedRawConfig$1(rawConfig, configPath, userConfigPath);
41981
41986
  if ("legacy_env" in rawConfig) {
41982
- diagnostics.errors.push(dedent$1`
41983
- The "legacy_env" field is no longer supported, so please remove it from your configuration file.
41984
- Service environments have been removed, and each environment is now deployed as its own Worker named "<name>-<environment>". This matches the behaviour of "legacy_env = true", which was the default, so removing the field will not change how your Worker is deployed.
41985
- Refer to https://developers.cloudflare.com/workers/wrangler/environments/ for more information.
41986
- `);
41987
+ if (!isRedirectedConfig2) diagnostics.errors.push(dedent$1`
41988
+ The "legacy_env" field is no longer supported, so please remove it from your configuration file.
41989
+ Service environments have been removed, and each environment is now deployed as its own Worker named "<name>-<environment>". This matches the behaviour of "legacy_env = true", which was the default, so removing the field will not change how your Worker is deployed.
41990
+ Refer to https://developers.cloudflare.com/workers/wrangler/environments/ for more information.
41991
+ `);
41987
41992
  delete rawConfig.legacy_env;
41988
41993
  }
41989
41994
  validateOptionalProperty(diagnostics, "", "send_metrics", rawConfig.send_metrics, "boolean");
@@ -42000,7 +42005,6 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
42000
42005
  validateOptionalProperty(diagnostics, "", "$schema", rawConfig.$schema, "string");
42001
42006
  const isDispatchNamespace = typeof args["dispatch-namespace"] === "string" && args["dispatch-namespace"].trim() !== "";
42002
42007
  const topLevelEnv = normalizeAndValidateEnvironment(diagnostics, configPath, rawConfig, isDispatchNamespace, preserveOriginalMain);
42003
- const isRedirectedConfig2 = isRedirectedRawConfig$1(rawConfig, configPath, userConfigPath);
42004
42008
  const definedEnvironments = Object.keys(rawConfig.env ?? {});
42005
42009
  if (isRedirectedConfig2 && definedEnvironments.length > 0) diagnostics.errors.push(dedent$1`
42006
42010
  Redirected configurations cannot include environments but the following have been found:\n${definedEnvironments.map((env$3) => ` - ${env$3}`).join("\n")}
@@ -75574,7 +75578,7 @@ var __name$1 = (target$1, value) => __defProp$1(target$1, "name", {
75574
75578
  });
75575
75579
 
75576
75580
  //#endregion
75577
- //#region ../workers-auth/dist/chunk-N7JTI7BC.mjs
75581
+ //#region ../workers-auth/dist/chunk-5WRJ2ZUV.mjs
75578
75582
  var import_undici$2 = require_undici();
75579
75583
  var hasWarnedAboutDeprecatedV1ApiToken = false;
75580
75584
  function readStoredAuthState(options) {
@@ -76681,7 +76685,7 @@ function createProfileStore(args) {
76681
76685
  const boundProfile = currentBindings[normalizedDir];
76682
76686
  if (boundProfile === void 0) {
76683
76687
  const parentBinding = getProfileForDirectoryFromBindings(normalizedDir, currentBindings);
76684
- if (parentBinding) throw new UserError(`No profile is directly bound to "${formatDirectoryForUserError(normalizedDir)}". The active profile "${parentBinding.profile}" is bound at "${formatDirectoryForUserError(parentBinding.dir)}". Run \`wrangler auth deactivate\` from that directory instead.`, { telemetryMessage: "auth deactivate wrong directory" });
76688
+ if (parentBinding) throw new UserError(`No profile is directly bound to "${formatDirectoryForUserError(normalizedDir)}". The active profile "${parentBinding.profile}" is bound at "${formatDirectoryForUserError(parentBinding.dir)}". Run the deactivate command from that directory instead.`, { telemetryMessage: "auth deactivate wrong directory" });
76685
76689
  throw new UserError(`No profile is bound to "${formatDirectoryForUserError(normalizedDir)}". Nothing to deactivate.`, { telemetryMessage: "auth deactivate no binding" });
76686
76690
  }
76687
76691
  delete currentBindings[normalizedDir];
@@ -76743,7 +76747,7 @@ function createProfileStore(args) {
76743
76747
  }
76744
76748
  __name$1(createProfileStore, "createProfileStore");
76745
76749
  function validateProfileName(name) {
76746
- if (RESERVED_PROFILE_NAMES.includes(name.toLowerCase())) throw new UserError(`"${name}" is a reserved profile name. Use \`wrangler login\` and \`wrangler logout\` to manage the default profile, which applies as a global fallback.`, { telemetryMessage: "auth profile reserved name" });
76750
+ if (RESERVED_PROFILE_NAMES.includes(name.toLowerCase())) throw new UserError(`"${name}" is a reserved profile name. Use the login and logout commands to manage the default profile, which applies as a global fallback.`, { telemetryMessage: "auth profile reserved name" });
76747
76751
  if (!/^[a-zA-Z0-9_-]+$/.test(name)) throw new UserError(`Invalid profile name "${name}". Profile names may only contain alphanumeric characters, hyphens, and underscores.`, { telemetryMessage: "auth profile invalid name" });
76748
76752
  }
76749
76753
  __name$1(validateProfileName, "validateProfileName");
@@ -78215,7 +78219,7 @@ function scrubEncryptedCredentials(options) {
78215
78219
  __name$1(scrubEncryptedCredentials, "scrubEncryptedCredentials");
78216
78220
 
78217
78221
  //#endregion
78218
- //#region ../workers-auth/dist/chunk-FVDIXAPS.mjs
78222
+ //#region ../workers-auth/dist/chunk-7PS36DJW.mjs
78219
78223
  function createPreferences(getConfigPath) {
78220
78224
  function getUserPreferencesPath() {
78221
78225
  return path2__default.resolve(getConfigPath(), "preferences.json");
@@ -79482,7 +79486,8 @@ var CF_CLI = {
79482
79486
  cliName: CF_CLI_NAME,
79483
79487
  commands: {
79484
79488
  login: "cf auth login",
79485
- whoami: "cf auth whoami"
79489
+ whoami: "cf auth whoami",
79490
+ createProfile: "cf auth create"
79486
79491
  },
79487
79492
  keyringServiceName: CF_KEYRING_SERVICE_NAME,
79488
79493
  clientId: getClientIdFromEnv$1,
@@ -80634,7 +80639,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
80634
80639
  //#endregion
80635
80640
  //#region ../remote-bindings/dist/index.mjs
80636
80641
  var import_undici = require_undici();
80637
- var version$2 = "0.0.1";
80642
+ var version$2 = "0.0.2";
80638
80643
  var NoDefaultValueProvided = class extends UserError {
80639
80644
  constructor() {
80640
80645
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
@@ -81409,6 +81414,7 @@ function findRemoteSessionAuthError(error$2) {
81409
81414
  if (error$2 instanceof Error) return findRemoteSessionAuthError(error$2.cause);
81410
81415
  }
81411
81416
  async function startRemoteProxySession(bindings$1, options) {
81417
+ for (const [name, binding] of Object.entries(bindings$1 ?? {})) if (binding.type === "flagship" && binding.app_id === void 0) throw new UserError(`Flagship binding "${name}" has no \`app_id\` and has not been created, but needs to run remotely. Run \`wrangler flagship apps create\` to create an app.`, { telemetryMessage: "flagship remote binding missing app_id" });
81412
81418
  options.logger.log(source_default.dim("⎔ Establishing remote connection..."));
81413
81419
  initLogger(getInternalLogger(options.logger));
81414
81420
  const rawBindings = toRawBindings(bindings$1);
@@ -84456,8 +84462,13 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
84456
84462
  unsafeDevRegistryPath: getDefaultDevRegistryPath(),
84457
84463
  unsafeTriggerHandlers: true,
84458
84464
  unsafeLocalExplorer: getLocalExplorerEnabledFromEnv(),
84465
+ unsafeObservability: getLocalObservabilityEnabledFromEnv(),
84459
84466
  telemetry: { enabled: false },
84460
84467
  handleStructuredLogs: getStructuredLogsLogger(logger$1),
84468
+ async unsafeHandleRuntimeRestart() {
84469
+ debuglog("workerd restarted after a crash; restarting the Vite dev server");
84470
+ await viteDevServer.restart();
84471
+ },
84461
84472
  defaultPersistRoot: getPersistenceRoot(resolvedViteConfig.root, resolvedPluginConfig.persistState),
84462
84473
  defaultProjectTmpPath: path2.resolve(resolvedViteConfig.root, ".wrangler/tmp"),
84463
84474
  workers: [
@@ -84611,6 +84622,7 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
84611
84622
  unsafeDevRegistryPath: getDefaultDevRegistryPath(),
84612
84623
  unsafeTriggerHandlers: true,
84613
84624
  unsafeLocalExplorer: getLocalExplorerEnabledFromEnv(),
84625
+ unsafeObservability: getLocalObservabilityEnabledFromEnv(),
84614
84626
  telemetry: { enabled: false },
84615
84627
  handleStructuredLogs: getStructuredLogsLogger(logger$1),
84616
84628
  defaultPersistRoot: getPersistenceRoot(resolvedViteConfig.root, resolvedPluginConfig.persistState),