@cloudflare/vite-plugin 1.7.0 → 1.7.2

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.d.ts CHANGED
@@ -21,8 +21,8 @@ interface PluginConfig extends EntryWorkerConfig {
21
21
  experimental?: {
22
22
  /** Experimental support for handling the _headers and _redirects files during Vite dev mode. */
23
23
  headersAndRedirectsDevModeSupport?: boolean;
24
- /** Experimental support for mixed mode (where bindings configured with `remote: true` access remote resources). */
25
- mixedMode?: boolean;
24
+ /** Experimental support for remote bindings (where bindings configured with `experimental_experimental_remote: true` access remote resources). */
25
+ remoteBindings?: boolean;
26
26
  };
27
27
  }
28
28
 
package/dist/index.js CHANGED
@@ -13457,7 +13457,7 @@ import { unstable_readConfig } from "wrangler";
13457
13457
  function getDeployConfigPath(root) {
13458
13458
  return path6.resolve(root, ".wrangler", "deploy", "config.json");
13459
13459
  }
13460
- function getWorkerConfigs(root, mixedModeEnabled) {
13460
+ function getWorkerConfigs(root, remoteBindingsEnabled) {
13461
13461
  const deployConfigPath = getDeployConfigPath(root);
13462
13462
  const deployConfig = JSON.parse(
13463
13463
  fs3.readFileSync(deployConfigPath, "utf-8")
@@ -13472,7 +13472,7 @@ function getWorkerConfigs(root, mixedModeEnabled) {
13472
13472
  );
13473
13473
  return unstable_readConfig(
13474
13474
  { config: resolvedConfigPath },
13475
- { experimental: { mixedModeEnabled } }
13475
+ { experimental: { remoteBindingsEnabled } }
13476
13476
  );
13477
13477
  });
13478
13478
  }
@@ -13550,7 +13550,7 @@ import colors3 from "picocolors";
13550
13550
  import { globSync } from "tinyglobby";
13551
13551
  import "vite";
13552
13552
  import {
13553
- experimental_maybeStartOrUpdateMixedModeSession,
13553
+ experimental_maybeStartOrUpdateRemoteProxySession,
13554
13554
  unstable_convertConfigBindingsToStartWorkerBindings,
13555
13555
  unstable_getMiniflareWorkerOptions
13556
13556
  } from "wrangler";
@@ -13671,7 +13671,7 @@ function logUnknownTails(tails, userWorkers, log) {
13671
13671
  }
13672
13672
  }
13673
13673
  }
13674
- var mixedModeSessionsDataMap = /* @__PURE__ */ new Map();
13674
+ var remoteProxySessionsDataMap = /* @__PURE__ */ new Map();
13675
13675
  async function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer, inspectorPort) {
13676
13676
  const resolvedViteConfig = viteDevServer.config;
13677
13677
  const entryWorkerConfig = getEntryWorkerConfig(resolvedPluginConfig);
@@ -13774,18 +13774,18 @@ async function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer, inspe
13774
13774
  const bindings = unstable_convertConfigBindingsToStartWorkerBindings(
13775
13775
  workerConfig
13776
13776
  );
13777
- const preExistingMixedModeSession = workerConfig.configPath ? mixedModeSessionsDataMap.get(workerConfig.configPath) : void 0;
13778
- const mixedModeSessionData = resolvedPluginConfig.experimental.mixedMode ? await experimental_maybeStartOrUpdateMixedModeSession(
13777
+ const preExistingRemoteProxySession = workerConfig.configPath ? remoteProxySessionsDataMap.get(workerConfig.configPath) : void 0;
13778
+ const remoteProxySessionData = resolvedPluginConfig.experimental.remoteBindings ? await experimental_maybeStartOrUpdateRemoteProxySession(
13779
13779
  {
13780
13780
  name: workerConfig.name,
13781
13781
  bindings: bindings ?? {}
13782
13782
  },
13783
- preExistingMixedModeSession ?? null
13783
+ preExistingRemoteProxySession ?? null
13784
13784
  ) : void 0;
13785
- if (workerConfig.configPath && mixedModeSessionData) {
13786
- mixedModeSessionsDataMap.set(
13785
+ if (workerConfig.configPath && remoteProxySessionData) {
13786
+ remoteProxySessionsDataMap.set(
13787
13787
  workerConfig.configPath,
13788
- mixedModeSessionData
13788
+ remoteProxySessionData
13789
13789
  );
13790
13790
  }
13791
13791
  const miniflareWorkerOptions = unstable_getMiniflareWorkerOptions(
@@ -13795,8 +13795,8 @@ async function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer, inspe
13795
13795
  },
13796
13796
  resolvedPluginConfig.cloudflareEnv,
13797
13797
  {
13798
- mixedModeConnectionString: mixedModeSessionData?.session?.mixedModeConnectionString,
13799
- mixedModeEnabled: resolvedPluginConfig.experimental.mixedMode
13798
+ remoteProxyConnectionString: remoteProxySessionData?.session?.remoteProxyConnectionString,
13799
+ remoteBindingsEnabled: resolvedPluginConfig.experimental.remoteBindings
13800
13800
  }
13801
13801
  );
13802
13802
  const { externalWorkers: externalWorkers2 } = miniflareWorkerOptions;
@@ -14003,31 +14003,31 @@ function getPreviewModules(main, modulesRules) {
14003
14003
  ]
14004
14004
  };
14005
14005
  }
14006
- async function getPreviewMiniflareOptions(vitePreviewServer, workerConfigs, persistState, mixedModeEnabled, inspectorPort) {
14006
+ async function getPreviewMiniflareOptions(vitePreviewServer, workerConfigs, persistState, remoteBindingsEnabled, inspectorPort) {
14007
14007
  const resolvedViteConfig = vitePreviewServer.config;
14008
14008
  const workers = (await Promise.all(
14009
14009
  workerConfigs.map(async (workerConfig, i) => {
14010
14010
  const bindings = unstable_convertConfigBindingsToStartWorkerBindings(workerConfig);
14011
- const preExistingMixedModeSessionData = workerConfig.configPath ? mixedModeSessionsDataMap.get(workerConfig.configPath) : void 0;
14012
- const mixedModeSessionData = mixedModeEnabled ? await experimental_maybeStartOrUpdateMixedModeSession(
14011
+ const preExistingRemoteProxySessionData = workerConfig.configPath ? remoteProxySessionsDataMap.get(workerConfig.configPath) : void 0;
14012
+ const remoteProxySessionData = remoteBindingsEnabled ? await experimental_maybeStartOrUpdateRemoteProxySession(
14013
14013
  {
14014
14014
  name: workerConfig.name,
14015
14015
  bindings: bindings ?? {}
14016
14016
  },
14017
- preExistingMixedModeSessionData ?? null
14017
+ preExistingRemoteProxySessionData ?? null
14018
14018
  ) : void 0;
14019
- if (workerConfig.configPath && mixedModeSessionData) {
14020
- mixedModeSessionsDataMap.set(
14019
+ if (workerConfig.configPath && remoteProxySessionData) {
14020
+ remoteProxySessionsDataMap.set(
14021
14021
  workerConfig.configPath,
14022
- mixedModeSessionData
14022
+ remoteProxySessionData
14023
14023
  );
14024
14024
  }
14025
14025
  const miniflareWorkerOptions = unstable_getMiniflareWorkerOptions(
14026
14026
  workerConfig,
14027
14027
  void 0,
14028
14028
  {
14029
- mixedModeConnectionString: mixedModeSessionData?.session?.mixedModeConnectionString,
14030
- mixedModeEnabled
14029
+ remoteProxyConnectionString: remoteProxySessionData?.session?.remoteProxyConnectionString,
14030
+ remoteBindingsEnabled
14031
14031
  }
14032
14032
  );
14033
14033
  const { externalWorkers } = miniflareWorkerOptions;
@@ -14236,14 +14236,14 @@ var nullableNonApplicable = [
14236
14236
  "site",
14237
14237
  "tsconfig"
14238
14238
  ];
14239
- function readWorkerConfig(configPath, env2, mixedModeEnabled) {
14239
+ function readWorkerConfig(configPath, env2, remoteBindingsEnabled) {
14240
14240
  const nonApplicable = {
14241
14241
  replacedByVite: /* @__PURE__ */ new Set(),
14242
14242
  notRelevant: /* @__PURE__ */ new Set()
14243
14243
  };
14244
14244
  const config = unstable_readConfig2(
14245
14245
  { config: configPath, env: env2 },
14246
- { experimental: { mixedModeEnabled } }
14246
+ { experimental: { remoteBindingsEnabled } }
14247
14247
  );
14248
14248
  const raw = structuredClone(config);
14249
14249
  nullableNonApplicable.forEach((prop) => {
@@ -14339,14 +14339,14 @@ function isNotRelevant(configName) {
14339
14339
  function missingFieldErrorMessage(field, configPath, env2) {
14340
14340
  return `No ${field} field provided in '${configPath}'${env2 ? ` for '${env2}' environment` : ""}`;
14341
14341
  }
14342
- function getWorkerConfig(configPath, env2, mixedModeEnabled, opts) {
14342
+ function getWorkerConfig(configPath, env2, remoteBindingsEnabled, opts) {
14343
14343
  if (opts?.visitedConfigPaths?.has(configPath)) {
14344
14344
  throw new Error(`Duplicate Wrangler config path found: ${configPath}`);
14345
14345
  }
14346
14346
  const { raw, config, nonApplicable } = readWorkerConfig(
14347
14347
  configPath,
14348
14348
  env2,
14349
- mixedModeEnabled
14349
+ remoteBindingsEnabled
14350
14350
  );
14351
14351
  opts?.visitedConfigPaths?.add(configPath);
14352
14352
  if (!config.name) {
@@ -14472,7 +14472,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14472
14472
  const entryWorkerResolvedConfig = getWorkerConfig(
14473
14473
  entryWorkerConfigPath,
14474
14474
  cloudflareEnv,
14475
- pluginConfig.experimental?.mixedMode ?? false,
14475
+ pluginConfig.experimental?.remoteBindings ?? false,
14476
14476
  {
14477
14477
  visitedConfigPaths: configPaths,
14478
14478
  isEntryWorker: true
@@ -14512,7 +14512,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14512
14512
  const workerResolvedConfig = getWorkerConfig(
14513
14513
  workerConfigPath,
14514
14514
  cloudflareEnv,
14515
- pluginConfig.experimental?.mixedMode ?? false,
14515
+ pluginConfig.experimental?.remoteBindings ?? false,
14516
14516
  {
14517
14517
  visitedConfigPaths: configPaths
14518
14518
  }
@@ -14903,7 +14903,7 @@ function cloudflare2(pluginConfig = {}) {
14903
14903
  async configurePreviewServer(vitePreviewServer) {
14904
14904
  const workerConfigs = getWorkerConfigs(
14905
14905
  vitePreviewServer.config.root,
14906
- pluginConfig.experimental?.mixedMode ?? false
14906
+ pluginConfig.experimental?.remoteBindings ?? false
14907
14907
  );
14908
14908
  const inputInspectorPort = await getInputInspectorPortOption(
14909
14909
  pluginConfig,
@@ -14914,7 +14914,7 @@ function cloudflare2(pluginConfig = {}) {
14914
14914
  vitePreviewServer,
14915
14915
  workerConfigs,
14916
14916
  pluginConfig.persistState ?? true,
14917
- !!pluginConfig.experimental?.mixedMode,
14917
+ !!pluginConfig.experimental?.remoteBindings,
14918
14918
  inputInspectorPort
14919
14919
  )
14920
14920
  );
@@ -15183,7 +15183,7 @@ function cloudflare2(pluginConfig = {}) {
15183
15183
  async configurePreviewServer(vitePreviewServer) {
15184
15184
  const workerConfigs = getWorkerConfigs(
15185
15185
  vitePreviewServer.config.root,
15186
- pluginConfig.experimental?.mixedMode ?? false
15186
+ pluginConfig.experimental?.remoteBindings ?? false
15187
15187
  );
15188
15188
  if (workerConfigs.length >= 1 && pluginConfig.inspectorPort !== false) {
15189
15189
  addDebugToVitePrintUrls(vitePreviewServer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/vite-plugin",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Cloudflare plugin for Vite",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -41,11 +41,11 @@
41
41
  "tinyglobby": "^0.2.12",
42
42
  "unenv": "2.0.0-rc.17",
43
43
  "ws": "8.18.0",
44
- "miniflare": "4.20250612.0",
45
- "wrangler": "4.20.1"
44
+ "miniflare": "4.20250617.1",
45
+ "wrangler": "4.20.3"
46
46
  },
47
47
  "devDependencies": {
48
- "@cloudflare/workers-types": "^4.20250612.0",
48
+ "@cloudflare/workers-types": "^4.20250617.0",
49
49
  "@types/node": "^22.10.1",
50
50
  "@types/ws": "^8.5.13",
51
51
  "magic-string": "^0.30.12",