@cloudflare/vite-plugin 2.0.0-beta.v.1 → 2.0.0-beta.v.3

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
@@ -50144,7 +50144,7 @@ function mapWorkerMetadataBindings(bindings) {
50144
50144
  }, {});
50145
50145
  }
50146
50146
  __name$3(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
50147
- var DEFAULT_COMPAT_DATE = "2026-10-12";
50147
+ var DEFAULT_COMPAT_DATE = "2026-10-19";
50148
50148
  function constructWranglerConfig(config$3) {
50149
50149
  const mappedBindings = mapWorkerMetadataBindings(config$3.bindings);
50150
50150
  const durableObjectClassNames = config$3.bindings.filter((binding) => binding.type === "durable_object_namespace" && binding.script_name === config$3.name).map((durableObject) => durableObject.class_name);
@@ -52249,50 +52249,6 @@ The local dev server started at ${origin.href}
52249
52249
  return new Error(errorMessage);
52250
52250
  }
52251
52251
  __name$3(createTunnelStartupError, "createTunnelStartupError");
52252
- var WRANGLER_COMMANDS = {
52253
- deploy: "wrangler deploy",
52254
- preview: "wrangler preview",
52255
- versionsUpload: "wrangler versions upload",
52256
- versionsDeploy: "wrangler versions deploy",
52257
- versionsDeployAt: /* @__PURE__ */ __name$3((n2) => `wrangler versions deploy <new-version-id>@${n2}%`, "versionsDeployAt"),
52258
- triggersDeploy: "wrangler triggers deploy",
52259
- d1List: "wrangler d1 list",
52260
- d1Delete: "wrangler d1 delete",
52261
- queuesCreate: "wrangler queues create",
52262
- secretPut: "wrangler secret put",
52263
- versionsSecretPut: "wrangler versions secret put",
52264
- containerRegistryConfigure: "wrangler containers registries configure"
52265
- };
52266
- var WRANGLER_CONFIG_FIELDS = {
52267
- workersDev: "workers_dev",
52268
- containerObservabilityTargetPercentage: "target_instance_percentage",
52269
- containerObservabilityTargetCount: "target_instance_count"
52270
- };
52271
- var WRANGLER_CLI_PRESENTATION = {
52272
- cliName: "wrangler",
52273
- displayName: "Wrangler",
52274
- displayConfigFileName: "Wrangler config file",
52275
- configFieldAssignmentSeparator: " = ",
52276
- commands: WRANGLER_COMMANDS,
52277
- configFields: WRANGLER_CONFIG_FIELDS
52278
- };
52279
- function resolveCliPresentation(overrides) {
52280
- return {
52281
- cliName: overrides?.cliName ?? WRANGLER_CLI_PRESENTATION.cliName,
52282
- displayName: overrides?.displayName ?? WRANGLER_CLI_PRESENTATION.displayName,
52283
- displayConfigFileName: overrides?.displayConfigFileName ?? WRANGLER_CLI_PRESENTATION.displayConfigFileName,
52284
- configFieldAssignmentSeparator: overrides?.configFieldAssignmentSeparator ?? WRANGLER_CLI_PRESENTATION.configFieldAssignmentSeparator,
52285
- commands: {
52286
- ...WRANGLER_COMMANDS,
52287
- ...overrides?.commands
52288
- },
52289
- configFields: {
52290
- ...WRANGLER_CONFIG_FIELDS,
52291
- ...overrides?.configFields
52292
- }
52293
- };
52294
- }
52295
- __name$3(resolveCliPresentation, "resolveCliPresentation");
52296
52252
  var UPDATE_CHECK_TIMEOUT_MS = 3e3;
52297
52253
  var CACHE_TTL_MS = 3600 * 1e3;
52298
52254
  var NPM_REGISTRY_URL = "https://registry.npmjs.org/";
@@ -75691,9 +75647,7 @@ var fetchResult$1 = /* @__PURE__ */ __name$2(() => {
75691
75647
  var fetchPagedListResult = /* @__PURE__ */ __name$2(() => {
75692
75648
  throw new Error("initContainersSharedContext() must be called first");
75693
75649
  }, "fetchPagedListResult");
75694
- var cliPresentation = resolveCliPresentation();
75695
75650
  function initContainersSharedContext(ctx) {
75696
- cliPresentation = resolveCliPresentation(ctx.cliPresentation);
75697
75651
  logger$1 = ctx.logger;
75698
75652
  fetchResult$1 = ctx.fetchResult;
75699
75653
  if (ctx.fetchPagedListResult !== void 0) fetchPagedListResult = ctx.fetchPagedListResult;
@@ -75950,7 +75904,7 @@ async function pullEgressInterceptorImage(dockerPath) {
75950
75904
  await runDockerCmd(dockerPath, args);
75951
75905
  }
75952
75906
  __name$2(pullEgressInterceptorImage, "pullEgressInterceptorImage");
75953
- async function pullImage(dockerPath, options, logger2, complianceConfig) {
75907
+ async function pullImage(dockerPath, options, logger2, complianceConfig, registryConfigureCommand) {
75954
75908
  const domain$1 = new URL(`http://${options.image_uri}`).hostname;
75955
75909
  const isExternalRegistry = domain$1 !== getCloudflareContainerRegistry(complianceConfig);
75956
75910
  try {
@@ -75958,7 +75912,7 @@ async function pullImage(dockerPath, options, logger2, complianceConfig) {
75958
75912
  } catch (e) {
75959
75913
  if (!isExternalRegistry) throw e;
75960
75914
  logger2?.warn(`Unable to retrieve configured registry credentials from Cloudflare.
75961
- Unless this is a public image, you will need to run \`${cliPresentation.commands.containerRegistryConfigure}\` before deploying.
75915
+ Unless this is a public image, you will need to run \`${registryConfigureCommand}\` before deploying.
75962
75916
  Attempting to pull image anyway...`);
75963
75917
  }
75964
75918
  const pull = runDockerCmd(dockerPath, [
@@ -75991,7 +75945,7 @@ async function prepareContainerImagesForDev(args) {
75991
75945
  dockerPath,
75992
75946
  operation: "running dev",
75993
75947
  imageNoun: containerOptions.length !== 1 ? "the configured images" : "the configured image",
75994
- hint: `To suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your ${cliPresentation.displayConfigFileName} or pass --enable-containers=false.`
75948
+ hint: `To suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your ${args.configFileName} or pass --enable-containers=false.`
75995
75949
  });
75996
75950
  for (const options of containerOptions) {
75997
75951
  if ("dockerfile" in options) {
@@ -76016,7 +75970,7 @@ async function prepareContainerImagesForDev(args) {
76016
75970
  await build.ready;
76017
75971
  onContainerImagePreparationEnd({ containerOptions: options });
76018
75972
  } else {
76019
- const pull = await pullImage(dockerPath, options, args.logger, args.complianceConfig);
75973
+ const pull = await pullImage(dockerPath, options, args.logger, args.complianceConfig, args.registryConfigureCommand);
76020
75974
  onContainerImagePreparationStart({
76021
75975
  containerOptions: options,
76022
75976
  abort: /* @__PURE__ */ __name$2(() => {
@@ -77134,7 +77088,7 @@ function createDurableObjectNamespaceResolver(config$3, { versionId, accountId,
77134
77088
  };
77135
77089
  }
77136
77090
  __name$2(createDurableObjectNamespaceResolver, "createDurableObjectNamespaceResolver");
77137
- async function deployContainers(config$3, containerDeployments, { versionId, accountId, scriptName, dispatchNamespace }) {
77091
+ async function deployContainers(config$3, containerDeployments, { versionId, accountId, scriptName, dispatchNamespace, configFileName: configFileName$1, observabilityTargetPercentageField, observabilityTargetCountField }) {
77138
77092
  const resolveNamespaceId = createDurableObjectNamespaceResolver(config$3, {
77139
77093
  versionId,
77140
77094
  accountId,
@@ -77143,7 +77097,10 @@ async function deployContainers(config$3, containerDeployments, { versionId, acc
77143
77097
  });
77144
77098
  for (const { container, imageRef } of containerDeployments) await apply({
77145
77099
  imageRef,
77146
- durable_object_namespace_id: await resolveNamespaceId(container.class_name)
77100
+ durable_object_namespace_id: await resolveNamespaceId(container.class_name),
77101
+ configFileName: configFileName$1,
77102
+ observabilityTargetPercentageField,
77103
+ observabilityTargetCountField
77147
77104
  }, container, config$3, accountId);
77148
77105
  }
77149
77106
  __name$2(deployContainers, "deployContainers");
@@ -77287,10 +77244,10 @@ function buildApplicationObservabilityPatch(observability, writeTarget, prevApp)
77287
77244
  return nextTopLevelObservability !== void 0 ? { observability: nextTopLevelObservability } : {};
77288
77245
  }
77289
77246
  __name$2(buildApplicationObservabilityPatch, "buildApplicationObservabilityPatch");
77290
- function assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig) {
77247
+ function assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig, options) {
77291
77248
  if (!hasTopLevelOnlyObservabilityFields(containerConfig.observability)) return;
77292
77249
  if (!hasLegacyRolloutObservabilityEnabled(prevApp)) return;
77293
- throw new UserError(`Application-level observability targeting cannot be enabled for container ${containerConfig.name} while it still uses legacy rollout-based observability. Set containers[].observability.enabled = false in your ${cliPresentation.displayConfigFileName} and deploy once, then deploy again with ${cliPresentation.configFields.containerObservabilityTargetPercentage} or ${cliPresentation.configFields.containerObservabilityTargetCount}.`, { telemetryMessage: "containers deploy observability migration blocked" });
77250
+ throw new UserError(`Application-level observability targeting cannot be enabled for container ${containerConfig.name} while it still uses legacy rollout-based observability. Set containers[].observability.enabled = false in your ${options.configFileName} and deploy once, then deploy again with ${options.observabilityTargetPercentageField} or ${options.observabilityTargetCountField}.`, { telemetryMessage: "containers deploy observability migration blocked" });
77294
77251
  }
77295
77252
  __name$2(assertCanUseApplicationObservabilityTargeting, "assertCanUseApplicationObservabilityTargeting");
77296
77253
  function hasRolloutDiff(prevApp, nextApp) {
@@ -77363,7 +77320,7 @@ async function apply(args, containerConfig, config$3, accountId) {
77363
77320
  }
77364
77321
  }
77365
77322
  const observabilityWriteTarget = selectObservabilityWriteTarget(prevApp);
77366
- if (prevApp !== void 0) assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig);
77323
+ if (prevApp !== void 0) assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig, args);
77367
77324
  const appConfig = stripUndefined(mergeIfUnsafe(config$3, containerConfigToCreateRequest(accountId, containerConfig, imageRef, args.durable_object_namespace_id, config$3, observabilityWriteTarget, prevApp), containerConfig.name));
77368
77325
  if (prevApp !== void 0 && prevApp !== null) {
77369
77326
  const normalisedPrevApp = sortObjectRecursive(stripUndefined(cleanApplicationFromAPI(prevApp, containerConfig, accountId, observabilityWriteTarget, config$3)));
@@ -77726,7 +77683,7 @@ __toESM(require_sender());
77726
77683
  __toESM(require_subprotocol());
77727
77684
  var import_websocket = __toESM(require_websocket());
77728
77685
  __toESM(require_websocket_server());
77729
- async function sshCommand(sshArgs) {
77686
+ async function sshCommand(sshArgs, userAgent) {
77730
77687
  const useStdio = shouldUseStdio(sshArgs);
77731
77688
  let sshResponse;
77732
77689
  try {
@@ -77743,7 +77700,7 @@ async function sshCommand(sshArgs) {
77743
77700
  }
77744
77701
  const ws = new import_websocket.default(sshResponse.url, { headers: {
77745
77702
  authorization: `Bearer ${sshResponse.token}`,
77746
- "user-agent": cliPresentation.cliName
77703
+ "user-agent": userAgent
77747
77704
  } });
77748
77705
  ws.binaryType = "arraybuffer";
77749
77706
  if (useStdio) {
@@ -85146,6 +85103,11 @@ function resolveWorker(workerConfig, devOnly, directoryName) {
85146
85103
  };
85147
85104
  }
85148
85105
  const CONFIG_FILENAME = "cloudflare.config.ts";
85106
+ const WRANGLER_CONFIG_FILENAMES = [
85107
+ "wrangler.json",
85108
+ "wrangler.jsonc",
85109
+ "wrangler.toml"
85110
+ ];
85149
85111
  const TYPES_OUTPUT_PATH = ".cloudflare/types/index.d.ts";
85150
85112
  const CONFIG_PACKAGE = "cf/config";
85151
85113
  /**
@@ -85158,7 +85120,11 @@ const CONFIG_PACKAGE = "cf/config";
85158
85120
  */
85159
85121
  async function loadCloudflareConfig(options) {
85160
85122
  const configPath = path.resolve(options.root, CONFIG_FILENAME);
85161
- if (!fs$3.existsSync(configPath)) return;
85123
+ if (!fs$3.existsSync(configPath)) {
85124
+ const wranglerConfigFilename = WRANGLER_CONFIG_FILENAMES.find((filename) => fs$3.existsSync(path.resolve(options.root, filename)));
85125
+ if (wranglerConfigFilename !== void 0) throw new Error(`Found \`${wranglerConfigFilename}\` but no \`${CONFIG_FILENAME}\`. The Cloudflare Vite plugin no longer reads Wrangler configuration files, so this configuration would be ignored. Run \`npx cf migrate --bundler vite\` to generate \`${CONFIG_FILENAME}\`.`);
85126
+ return;
85127
+ }
85162
85128
  const { result, dependencies } = await loadAndParseConfig(configPath, {
85163
85129
  isPreview: isPreviewBuild(),
85164
85130
  mode: options.mode
@@ -87604,7 +87570,9 @@ async function prepareContainerImagesForVite(options) {
87604
87570
  onContainerImagePreparationStart: () => {},
87605
87571
  onContainerImagePreparationEnd: () => {},
87606
87572
  logger: options.logger,
87607
- complianceConfig
87573
+ complianceConfig,
87574
+ configFileName: "cloudflare.config.ts",
87575
+ registryConfigureCommand: options.cliDisplayName === "cf" ? "cf containers registries create" : "wrangler containers registries configure"
87608
87576
  });
87609
87577
  }
87610
87578
 
@@ -88427,7 +88395,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
88427
88395
  //#endregion
88428
88396
  //#region ../remote-bindings/dist/index.mjs
88429
88397
  var import_undici = require_undici();
88430
- var version$1 = "0.0.49";
88398
+ var version$1 = "0.0.51";
88431
88399
  var NoDefaultValueProvided = class extends UserError {
88432
88400
  constructor() {
88433
88401
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
@@ -89233,6 +89201,7 @@ function findRemoteSessionAuthError(error$3) {
89233
89201
  }
89234
89202
  async function startRemoteProxySession(bindings, options) {
89235
89203
  for (const [name, binding] of Object.entries(bindings ?? {})) 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" });
89204
+ if (process.versions.bun) throw new UserError("Remote bindings can't work under Bun, because Bun's `fetch()` ignores the undici `dispatcher` that Miniflare routes them through (https://github.com/oven-sh/bun/issues/39247). Run this using Node.js, or turn remote bindings off.", { telemetryMessage: "remote proxy session under bun" });
89236
89205
  options.logger.log(source_default.dim("⎔ Establishing remote connection..."));
89237
89206
  initLogger(getInternalLogger(options.logger));
89238
89207
  const rawBindings = toRawBindings(bindings);
@@ -90363,7 +90332,8 @@ const devPlugin = createPlugin("dev", (ctx) => {
90363
90332
  dockerPath,
90364
90333
  containerOptions,
90365
90334
  settings: ctx.resolvedPluginConfig.settings,
90366
- logger: viteDevServer.config.logger
90335
+ logger: viteDevServer.config.logger,
90336
+ cliDisplayName: ctx.resolvedPluginConfig.cliDisplayName
90367
90337
  });
90368
90338
  containerCleanup.track(dockerPath, containerOptions.map(({ image_tag }) => image_tag));
90369
90339
  viteDevServer.config.logger.info(import_picocolors$2.default.dim(import_picocolors$2.default.yellow("\n⚡️ Containers successfully built. To rebuild your containers during development, restart the Vite dev server (r + enter).")));
@@ -90509,7 +90479,8 @@ const previewPlugin = createPlugin("preview", (ctx) => {
90509
90479
  dockerPath: getDockerPath(),
90510
90480
  containerOptions,
90511
90481
  settings: ctx.resolvedPluginConfig.settings,
90512
- logger: vitePreviewServer.config.logger
90482
+ logger: vitePreviewServer.config.logger,
90483
+ cliDisplayName: ctx.resolvedPluginConfig.cliDisplayName
90513
90484
  });
90514
90485
  }
90515
90486
  if (vitePreviewServer.httpServer) vitePreviewServer.httpServer.on("listening", () => {
@@ -1,7 +1,7 @@
1
1
  //#region package.json
2
2
  var package_default = {
3
3
  name: "@cloudflare/vite-plugin",
4
- version: "2.0.0-beta.v.1",
4
+ version: "2.0.0-beta.v.3",
5
5
  description: "Cloudflare plugin for Vite",
6
6
  keywords: [
7
7
  "cloudflare",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/vite-plugin",
3
- "version": "2.0.0-beta.v.1",
3
+ "version": "2.0.0-beta.v.3",
4
4
  "description": "Cloudflare plugin for Vite",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -42,14 +42,14 @@
42
42
  "dependencies": {
43
43
  "unenv": "2.0.0-rc.24",
44
44
  "ws": "8.21.0",
45
- "@cloudflare/config": "0.27.0",
46
- "@cloudflare/runtime-types": "0.1.12",
47
45
  "@cloudflare/build-output-utils": "0.9.3",
46
+ "@cloudflare/config": "0.27.0",
47
+ "@cloudflare/runtime-types": "0.1.14",
48
48
  "@cloudflare/unenv-preset": "2.16.2",
49
- "miniflare": "5.20261012.1-beta"
49
+ "miniflare": "5.20261019.1-beta"
50
50
  },
51
51
  "devDependencies": {
52
- "@cloudflare/workers-types": "^5.20261006.1",
52
+ "@cloudflare/workers-types": "^5.20261019.1",
53
53
  "@remix-run/node-fetch-server": "^0.8.0",
54
54
  "@types/node": "22.15.17",
55
55
  "@types/semver": "^7.5.1",
@@ -69,15 +69,15 @@
69
69
  "typescript": "5.8.3",
70
70
  "vite": "8.1.5",
71
71
  "vite-legacy": "npm:vite@7.1.12",
72
- "vitest": "4.1.0",
72
+ "vitest": "5.0.4",
73
+ "@cloudflare/cli-shared-helpers": "0.2.7",
74
+ "@cloudflare/remote-bindings": "0.0.51",
75
+ "@cloudflare/containers-shared": "0.23.1",
76
+ "@cloudflare/workers-auth": "0.14.1",
73
77
  "@cloudflare/mock-npm-registry": "0.0.0",
74
- "@cloudflare/containers-shared": "0.22.1",
75
- "@cloudflare/workers-auth": "0.14.0",
76
78
  "@cloudflare/workers-shared": "0.20.1",
77
- "@cloudflare/remote-bindings": "0.0.49",
78
79
  "@cloudflare/workers-tsconfig": "0.0.0",
79
- "@cloudflare/cli-shared-helpers": "0.2.6",
80
- "@cloudflare/workers-utils": "0.47.2"
80
+ "@cloudflare/workers-utils": "0.47.3"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "vite": "^7.0.0 || ^8.0.0"