@cloudflare/vite-plugin 2.0.0-beta.sha-67fa336fd → 2.0.0-beta.v.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/cf-vite.mjs CHANGED
@@ -155,5 +155,4 @@ const exitCode = await main();
155
155
  process.exit(exitCode);
156
156
 
157
157
  //#endregion
158
- export { };
159
- //# sourceMappingURL=cf-vite.mjs.map
158
+ export { };
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
 
3
- //#region ../workers-utils/dist/chunk-53YJWLG7.mjs
3
+ //#region ../workers-utils/dist/chunk-U6NEESU5.mjs
4
4
  const require$1 = createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
5
5
  var __create = Object.create;
6
6
  var __defProp = Object.defineProperty;
@@ -40,5 +40,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
40
  }) : target, mod));
41
41
 
42
42
  //#endregion
43
- export { __toESM as a, __require as i, __export as n, __name as r, __commonJS as t };
44
- //# sourceMappingURL=chunk-53YJWLG7-dSmyuxCA.mjs.map
43
+ export { __toESM as a, __require as i, __export as n, __name as r, __commonJS as t };
package/dist/index.d.mts CHANGED
@@ -111,5 +111,4 @@ declare function getLocalWorkerdCompatibilityDate(_options?: {
111
111
  */
112
112
  declare function cloudflare(pluginConfig?: PluginConfig): vite.Plugin[];
113
113
  //#endregion
114
- export { type PluginConfig, type WorkerConfig, cloudflare, getLocalWorkerdCompatibilityDate };
115
- //# sourceMappingURL=index.d.mts.map
114
+ export { type PluginConfig, type WorkerConfig, cloudflare, getLocalWorkerdCompatibilityDate };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as __toESM$1, i as __require$1, n as __export, r as __name$3, t as __commonJS$1 } from "./chunk-53YJWLG7-dSmyuxCA.mjs";
1
+ import { a as __toESM$1, i as __require$1, n as __export, r as __name$3, t as __commonJS$1 } from "./chunk-U6NEESU5-BzWFpRaS.mjs";
2
2
  import { builtinModules, createRequire } from "node:module";
3
3
  import * as fs$3 from "node:fs";
4
4
  import fs2, { accessSync, appendFileSync, chmodSync, constants, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
@@ -63,7 +63,7 @@ var __toESM$2 = (mod$1, isNodeMode, target$1) => (target$1 = mod$1 != null ? __c
63
63
  var __require$2 = /* @__PURE__ */ createRequire(import.meta.url);
64
64
 
65
65
  //#endregion
66
- //#region ../workers-utils/dist/chunk-4HKF63BA.mjs
66
+ //#region ../workers-utils/dist/chunk-CAPCWVOB.mjs
67
67
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
68
68
  var external_exports$1 = {};
69
69
  __export(external_exports$1, {
@@ -19067,7 +19067,7 @@ function formatZodError(error62) {
19067
19067
  __name$3(formatZodError, "formatZodError");
19068
19068
 
19069
19069
  //#endregion
19070
- //#region ../workers-utils/dist/chunk-ZTBZBPY2.mjs
19070
+ //#region ../workers-utils/dist/chunk-M3RITKR3.mjs
19071
19071
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
19072
19072
  function dedent$1(templ) {
19073
19073
  var values = [];
@@ -19105,7 +19105,7 @@ __name$3(dedent$1, "dedent");
19105
19105
  var esm_default$1 = dedent$1;
19106
19106
 
19107
19107
  //#endregion
19108
- //#region ../workers-utils/dist/chunk-DAAH4XXB.mjs
19108
+ //#region ../workers-utils/dist/chunk-OWPFSLY6.mjs
19109
19109
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
19110
19110
  var UserError = class extends Error {
19111
19111
  static {
@@ -19164,7 +19164,7 @@ function createFatalError(message, isJson, options) {
19164
19164
  __name$3(createFatalError, "createFatalError");
19165
19165
 
19166
19166
  //#endregion
19167
- //#region ../workers-utils/dist/chunk-A5AS5XTW.mjs
19167
+ //#region ../workers-utils/dist/chunk-2HLTAS5V.mjs
19168
19168
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
19169
19169
  function hasKnownExportType(entry) {
19170
19170
  const type = entry?.type;
@@ -21679,7 +21679,7 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
21679
21679
  __name$3(formatConfigSnippet, "formatConfigSnippet");
21680
21680
 
21681
21681
  //#endregion
21682
- //#region ../workers-utils/dist/chunk-WGNL6U3K.mjs
21682
+ //#region ../workers-utils/dist/chunk-QSRIB43D.mjs
21683
21683
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
21684
21684
  function getBooleanEnvironmentVariableFactory(options) {
21685
21685
  return () => {
@@ -21724,7 +21724,7 @@ var getDockerPath = getEnvironmentVariableFactory({
21724
21724
  });
21725
21725
 
21726
21726
  //#endregion
21727
- //#region ../workers-utils/dist/chunk-WFKY67B6.mjs
21727
+ //#region ../workers-utils/dist/chunk-MIA26B4M.mjs
21728
21728
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
21729
21729
  function isDirectory(path$3) {
21730
21730
  return fs2.statSync(path$3, { throwIfNoEntry: false })?.isDirectory() ?? false;
@@ -21752,7 +21752,7 @@ function removeDirSync(dirPath) {
21752
21752
  __name$3(removeDirSync, "removeDirSync");
21753
21753
 
21754
21754
  //#endregion
21755
- //#region ../workers-utils/dist/chunk-RCVSIVZ4.mjs
21755
+ //#region ../workers-utils/dist/chunk-MV2OJK3L.mjs
21756
21756
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
21757
21757
  function isWindows() {
21758
21758
  return /^win/i.test(process.platform);
@@ -21884,7 +21884,7 @@ function getGlobalWranglerCachePath() {
21884
21884
  __name$3(getGlobalWranglerCachePath, "getGlobalWranglerCachePath");
21885
21885
 
21886
21886
  //#endregion
21887
- //#region ../workers-utils/dist/chunk-P5QNBYLE.mjs
21887
+ //#region ../workers-utils/dist/chunk-FR75DWDU.mjs
21888
21888
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
21889
21889
  var getC3CommandFromEnv = getEnvironmentVariableFactory({
21890
21890
  variableName: "WRANGLER_C3_COMMAND",
@@ -52371,7 +52371,7 @@ function compareVersions(a, b) {
52371
52371
  __name$3(compareVersions, "compareVersions");
52372
52372
  async function openInBrowser(url$2, logger$2) {
52373
52373
  try {
52374
- const { default: open$3 } = await import("./open-NPEHYJ5T-C8ZFejjd.mjs");
52374
+ const { default: open$3 } = await import("./open-PCXX3ZDZ-BXBWVkHI.mjs");
52375
52375
  (await open$3(url$2)).on("error", (err) => {
52376
52376
  handleBrowserOpenError(url$2, err, logger$2);
52377
52377
  });
@@ -60615,6 +60615,7 @@ function getAssetsConfig(resolvedPluginConfig, entryWorkerConfig, resolvedConfig
60615
60615
  ...workerConfig?.compatibilityFlags ? { compatibility_flags: workerConfig.compatibilityFlags } : {},
60616
60616
  ...assetsConfig?.htmlHandling ? { html_handling: assetsConfig.htmlHandling } : {},
60617
60617
  ...assetsConfig?.notFoundHandling ? { not_found_handling: assetsConfig.notFoundHandling } : {},
60618
+ ...assetsConfig?.basePath !== void 0 ? { base_path: assetsConfig.basePath } : {},
60618
60619
  has_static_routing: resolvedPluginConfig.type === "workers" && resolvedPluginConfig.staticRouting ? true : false
60619
60620
  };
60620
60621
  if (!resolvedPluginConfig.experimental?.headersAndRedirectsDevModeSupport) return config$3;
@@ -65442,7 +65443,7 @@ function isInteractive() {
65442
65443
  }
65443
65444
 
65444
65445
  //#endregion
65445
- //#region ../workers-auth/dist/chunk-PATSIG4T.mjs
65446
+ //#region ../workers-auth/dist/chunk-VAZEJK55.mjs
65446
65447
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
65447
65448
  var __defProp$2 = Object.defineProperty;
65448
65449
  var __name$1 = (target$1, value) => __defProp$2(target$1, "name", {
@@ -65451,7 +65452,7 @@ var __name$1 = (target$1, value) => __defProp$2(target$1, "name", {
65451
65452
  });
65452
65453
 
65453
65454
  //#endregion
65454
- //#region ../workers-auth/dist/chunk-RNFAO324.mjs
65455
+ //#region ../workers-auth/dist/chunk-2K52M2W5.mjs
65455
65456
  var import_undici$2 = require_undici();
65456
65457
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
65457
65458
  var hasWarnedAboutDeprecatedV1ApiToken = false;
@@ -67936,7 +67937,7 @@ function scrubEncryptedCredentials(options) {
67936
67937
  __name$1(scrubEncryptedCredentials, "scrubEncryptedCredentials");
67937
67938
 
67938
67939
  //#endregion
67939
- //#region ../workers-auth/dist/chunk-6KNWUFJ7.mjs
67940
+ //#region ../workers-auth/dist/chunk-F2REEYJC.mjs
67940
67941
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
67941
67942
  function createPreferences(getConfigPath) {
67942
67943
  function getUserPreferencesPath() {
@@ -87733,7 +87734,7 @@ function setKeyringPreference(enabled, ctx) {
87733
87734
  __name$1(setKeyringPreference, "setKeyringPreference");
87734
87735
 
87735
87736
  //#endregion
87736
- //#region ../deploy-helpers/dist/chunk-53YJWLG7.mjs
87737
+ //#region ../deploy-helpers/dist/chunk-U6NEESU5.mjs
87737
87738
  const require$1 = createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
87738
87739
  var __defProp = Object.defineProperty;
87739
87740
  var __name = (target$1, value) => __defProp(target$1, "name", {
@@ -87855,7 +87856,7 @@ var require_command_exists = /* @__PURE__ */ __commonJS$2({ "../../node_modules/
87855
87856
  }) });
87856
87857
 
87857
87858
  //#endregion
87858
- //#region ../deploy-helpers/dist/chunk-FJXXHDTG.mjs
87859
+ //#region ../deploy-helpers/dist/chunk-DSGVRFIS.mjs
87859
87860
  var import_undici$1 = require_undici();
87860
87861
  var import_command_exists = require_command_exists();
87861
87862
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
@@ -88426,7 +88427,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
88426
88427
  //#endregion
88427
88428
  //#region ../remote-bindings/dist/index.mjs
88428
88429
  var import_undici = require_undici();
88429
- var version$1 = "0.0.47";
88430
+ var version$1 = "0.0.48";
88430
88431
  var NoDefaultValueProvided = class extends UserError {
88431
88432
  constructor() {
88432
88433
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
@@ -89417,6 +89418,12 @@ function getRemoteBindings(config$3) {
89417
89418
  remote: binding.dev?.remote
89418
89419
  };
89419
89420
  break;
89421
+ case "analytics":
89422
+ bindings[name] = {
89423
+ type: "analytics",
89424
+ remote: binding.dev?.remote
89425
+ };
89426
+ break;
89420
89427
  case "ai-search":
89421
89428
  bindings[name] = {
89422
89429
  type: "ai_search",
@@ -89503,6 +89510,13 @@ function getRemoteBindings(config$3) {
89503
89510
  remote: binding.dev?.remote
89504
89511
  };
89505
89512
  break;
89513
+ case "k2":
89514
+ bindings[name] = {
89515
+ type: "k2",
89516
+ stream: binding.stream,
89517
+ remote: binding.dev?.remote
89518
+ };
89519
+ break;
89506
89520
  case "queue":
89507
89521
  bindings[name] = {
89508
89522
  type: "queue",
@@ -91307,5 +91321,4 @@ function cloudflare(pluginConfig = {}) {
91307
91321
  }
91308
91322
 
91309
91323
  //#endregion
91310
- export { cloudflare, getLocalWorkerdCompatibilityDate };
91311
- //# sourceMappingURL=index.mjs.map
91324
+ export { cloudflare, getLocalWorkerdCompatibilityDate };
@@ -1,4 +1,4 @@
1
- import { r as __name } from "./chunk-53YJWLG7-dSmyuxCA.mjs";
1
+ import { r as __name } from "./chunk-U6NEESU5-BzWFpRaS.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import fs2 from "node:fs";
4
4
  import path__default from "node:path";
@@ -10,7 +10,7 @@ import { Buffer } from "node:buffer";
10
10
  import fs, { constants as constants$1 } from "node:fs/promises";
11
11
  import childProcess, { execFile } from "node:child_process";
12
12
 
13
- //#region ../workers-utils/dist/open-NPEHYJ5T.mjs
13
+ //#region ../workers-utils/dist/open-PCXX3ZDZ.mjs
14
14
  createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
15
15
  var isDockerCached;
16
16
  function hasDockerEnv() {
@@ -527,5 +527,4 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({ darwin: "Safari"
527
527
  var open_default = open;
528
528
 
529
529
  //#endregion
530
- export { open_default as default };
531
- //# sourceMappingURL=open-NPEHYJ5T-C8ZFejjd.mjs.map
530
+ export { open_default as default };
@@ -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.sha-67fa336fd",
4
+ version: "2.0.0-beta.v.0",
5
5
  description: "Cloudflare plugin for Vite",
6
6
  keywords: [
7
7
  "cloudflare",
@@ -39,11 +39,11 @@ var package_default = {
39
39
  "test:watch": "vitest"
40
40
  },
41
41
  dependencies: {
42
- "@cloudflare/build-output-utils": "0.9.2",
43
- "@cloudflare/config": "0.26.0",
44
- "@cloudflare/runtime-types": "0.1.11",
45
- "@cloudflare/unenv-preset": "2.16.2",
46
- "miniflare": "5.20261012.0-beta",
42
+ "@cloudflare/build-output-utils": "workspace:*",
43
+ "@cloudflare/config": "workspace:*",
44
+ "@cloudflare/runtime-types": "workspace:*",
45
+ "@cloudflare/unenv-preset": "workspace:*",
46
+ "miniflare": "workspace:*",
47
47
  "unenv": "2.0.0-rc.24",
48
48
  "ws": "catalog:default"
49
49
  },
@@ -79,9 +79,14 @@ var package_default = {
79
79
  "vitest": "catalog:default"
80
80
  },
81
81
  peerDependencies: { "vite": "^7.0.0 || ^8.0.0" },
82
- "workers-sdk": { "prerelease": true }
82
+ "workers-sdk": {
83
+ "prerelease": true,
84
+ "npmPrerelease": {
85
+ "tag": "beta",
86
+ "numbered": true
87
+ }
88
+ }
83
89
  };
84
90
 
85
91
  //#endregion
86
- export { package_default as default };
87
- //# sourceMappingURL=package-DN5VHrZK.mjs.map
92
+ export { package_default as default };
@@ -5993,5 +5993,4 @@ var CustomAssetWorker = class extends AssetWorkerInner {
5993
5993
  };
5994
5994
 
5995
5995
  //#endregion
5996
- export { CustomAssetWorker as default };
5997
- //# sourceMappingURL=index.js.map
5996
+ export { CustomAssetWorker as default };
@@ -6411,5 +6411,4 @@ function shouldBlockContentType(response) {
6411
6411
  }
6412
6412
 
6413
6413
  //#endregion
6414
- export { RouterInnerEntrypoint, RouterOuterEntrypoint, worker_default as default };
6415
- //# sourceMappingURL=index.js.map
6414
+ export { RouterInnerEntrypoint, RouterOuterEntrypoint, worker_default as default };
@@ -453,5 +453,4 @@ function createWorkflowEntrypointWrapper(exportName) {
453
453
  }
454
454
 
455
455
  //#endregion
456
- export { __VITE_RUNNER_OBJECT__, createDurableObjectWrapper, createWorkerEntrypointWrapper, createWorkflowEntrypointWrapper };
457
- //# sourceMappingURL=index.js.map
456
+ export { __VITE_RUNNER_OBJECT__, createDurableObjectWrapper, createWorkerEntrypointWrapper, createWorkflowEntrypointWrapper };
@@ -1126,5 +1126,4 @@ function exportAll(exports, sourceModule) {
1126
1126
  }
1127
1127
 
1128
1128
  //#endregion
1129
- export { ESModulesEvaluator, EvaluatedModules, ModuleRunner, createDefaultImportMeta, createNodeImportMeta, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
1130
- //# sourceMappingURL=module-runner-legacy.js.map
1129
+ export { ESModulesEvaluator, EvaluatedModules, ModuleRunner, createDefaultImportMeta, createNodeImportMeta, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
@@ -1232,5 +1232,4 @@ function exportAll(exports, sourceModule) {
1232
1232
  }
1233
1233
 
1234
1234
  //#endregion
1235
- export { ESModulesEvaluator, EvaluatedModules, ModuleRunner, createDefaultImportMeta, createNodeImportMeta, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
1236
- //# sourceMappingURL=module-runner.js.map
1235
+ export { ESModulesEvaluator, EvaluatedModules, ModuleRunner, createDefaultImportMeta, createNodeImportMeta, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
@@ -28,5 +28,4 @@ function tailEventsReviver(_, value) {
28
28
  }
29
29
 
30
30
  //#endregion
31
- export { ViteProxyWorker as default };
32
- //# sourceMappingURL=index.js.map
31
+ export { ViteProxyWorker as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/vite-plugin",
3
- "version": "2.0.0-beta.sha-67fa336fd",
3
+ "version": "2.0.0-beta.v.0",
4
4
  "description": "Cloudflare plugin for Vite",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -40,13 +40,13 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
+ "unenv": "2.0.0-rc.24",
44
+ "ws": "8.21.0",
43
45
  "@cloudflare/build-output-utils": "0.9.2",
44
46
  "@cloudflare/config": "0.26.0",
45
47
  "@cloudflare/runtime-types": "0.1.11",
46
48
  "@cloudflare/unenv-preset": "2.16.2",
47
- "miniflare": "5.20261012.0-beta",
48
- "unenv": "2.0.0-rc.24",
49
- "ws": "8.21.0"
49
+ "miniflare": "5.20261012.0-beta"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@cloudflare/workers-types": "^5.20261006.1",
@@ -70,20 +70,24 @@
70
70
  "vite": "8.1.5",
71
71
  "vite-legacy": "npm:vite@7.1.12",
72
72
  "vitest": "4.1.0",
73
- "@cloudflare/containers-shared": "0.21.7",
73
+ "@cloudflare/cli-shared-helpers": "0.2.6",
74
+ "@cloudflare/containers-shared": "0.22.0",
74
75
  "@cloudflare/mock-npm-registry": "0.0.0",
76
+ "@cloudflare/remote-bindings": "0.0.48",
75
77
  "@cloudflare/workers-auth": "0.14.0",
76
- "@cloudflare/remote-bindings": "0.0.47",
77
- "@cloudflare/cli-shared-helpers": "0.2.6",
78
78
  "@cloudflare/workers-shared": "0.20.1",
79
- "@cloudflare/workers-utils": "0.47.2",
80
- "@cloudflare/workers-tsconfig": "0.0.0"
79
+ "@cloudflare/workers-tsconfig": "0.0.0",
80
+ "@cloudflare/workers-utils": "0.47.2"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "vite": "^7.0.0 || ^8.0.0"
84
84
  },
85
85
  "workers-sdk": {
86
- "prerelease": true
86
+ "prerelease": true,
87
+ "npmPrerelease": {
88
+ "tag": "beta",
89
+ "numbered": true
90
+ }
87
91
  },
88
92
  "scripts": {
89
93
  "build": "tsdown",
@@ -1 +0,0 @@
1
- {"version":3,"file":"cf-vite.mjs","names":["nodeParseArgs","out: DevArgs","out: BuildArgs","args: DevArgs","serverOptions: ServerOptions","inlineConfig: InlineConfig","args: BuildArgs"],"sources":["../src/build-output-env.ts","../src/cf-vite.ts"],"sourcesContent":["/** Internal caller name set by the `cf-vite` delegate. */\nexport const CLI_DISPLAY_NAME_ENV_VAR = \"CLOUDFLARE_VITE_CLI_DISPLAY_NAME\";\n\n/** Shared build context flag set by Cloudflare tooling for Preview builds. */\nexport const PREVIEW_BUILD_ENV_VAR = \"CLOUDFLARE_PREVIEW_BUILD\";\n\n/** Return the CLI name used in actionable messages. */\nexport function getCliDisplayName(): \"cf\" | \"Wrangler\" {\n\treturn process.env[CLI_DISPLAY_NAME_ENV_VAR] === \"cf\" ? \"cf\" : \"Wrangler\";\n}\n\n/** Whether Cloudflare tooling requested Preview Build Output. */\nexport function isPreviewBuild(): boolean {\n\treturn process.env[PREVIEW_BUILD_ENV_VAR] === \"true\";\n}\n","/**\n * `cf-vite` delegate binary entry point for `@cloudflare/vite-plugin`.\n *\n * EXPERIMENTAL / internal: spawned by Cloudflare's \"cf-dev\" parent\n * process, not invoked directly by end users. Contract may change.\n *\n * Usage: `<pkgRoot>/bin/cf-vite <verb> [flags...]`. `dev` and `build`\n * are the verbs today; future verbs follow the same shape.\n * Unknown/missing verbs exit 2 (also the parent's version-detection\n * signal).\n *\n * Spawn contract for `dev`: parent uses `stdio: \"inherit\"` and forwards\n * SIGINT/SIGTERM. Accepted flags mirror the sibling `cf-wrangler`\n * delegate (`--mode`, `--port`, `--host`, `--local`) so the parent can\n * drive either impl interchangeably; everything else lives in the user's\n * `vite.config.ts` / `cloudflare.config.ts`. `cf-vite` boots\n * Vite via `createServer()` against the user's own config (expected to\n * include `cloudflare()`); flags are bridged to it as documented inline.\n *\n * `build` runs Vite's full multi-environment app build via\n * `createBuilder().buildApp()` (NOT the legacy single-environment\n * `build()` helper, which would skip the plugin's worker builds). It\n * accepts only `--mode`. Preview build context is supplied through the\n * `CLOUDFLARE_PREVIEW_BUILD` environment variable so framework-owned build\n * commands can use the same contract.\n *\n * Exit codes: 0 graceful, 2 unknown verb / parse error, 130 SIGINT,\n * 143 SIGTERM.\n */\n\nimport { parseArgs as nodeParseArgs } from \"node:util\";\nimport { createBuilder, createServer } from \"vite\";\nimport { CLI_DISPLAY_NAME_ENV_VAR } from \"./build-output-env\";\nimport type { InlineConfig, ServerOptions } from \"vite\";\n\ninterface DevArgs {\n\tmode?: string;\n\tport?: number;\n\thost?: string;\n\tlocal?: boolean;\n}\n\nclass ArgParseError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"ArgParseError\";\n\t}\n}\n\n/** Strict argv parser; mirrors `cf-wrangler`'s flags (unknown → throw). */\nfunction parseDevArgs(argv: string[]): DevArgs {\n\tlet parsed;\n\ttry {\n\t\tparsed = nodeParseArgs({\n\t\t\targs: argv,\n\t\t\toptions: {\n\t\t\t\tmode: { type: \"string\" },\n\t\t\t\thost: { type: \"string\" },\n\t\t\t\t// `node:util.parseArgs` has no `number` type; coerce below.\n\t\t\t\tport: { type: \"string\" },\n\t\t\t\tlocal: { type: \"boolean\" },\n\t\t\t},\n\t\t\tstrict: true,\n\t\t\tallowPositionals: false,\n\t\t});\n\t} catch (err) {\n\t\tthrow new ArgParseError(err instanceof Error ? err.message : String(err));\n\t}\n\n\tconst out: DevArgs = {};\n\tif (parsed.values.mode !== undefined) {\n\t\tout.mode = parsed.values.mode;\n\t}\n\tif (parsed.values.host !== undefined) {\n\t\tout.host = parsed.values.host;\n\t}\n\tif (parsed.values.port !== undefined) {\n\t\tconst raw = parsed.values.port;\n\t\tconst n = Number(raw);\n\t\t// TCP port range; 0 = OS-assigned.\n\t\tif (!Number.isInteger(n) || n < 0 || n > 65535) {\n\t\t\tthrow new ArgParseError(\n\t\t\t\t`--port expects an integer between 0 and 65535, got \"${raw}\"`\n\t\t\t);\n\t\t}\n\t\tout.port = n;\n\t}\n\tif (parsed.values.local !== undefined) {\n\t\tout.local = parsed.values.local;\n\t}\n\n\treturn out;\n}\n\ninterface BuildArgs {\n\tmode?: string;\n}\n\nfunction parseBuildArgs(argv: string[]): BuildArgs {\n\tlet parsed;\n\ttry {\n\t\tparsed = nodeParseArgs({\n\t\t\targs: argv,\n\t\t\toptions: {\n\t\t\t\tmode: { type: \"string\" },\n\t\t\t},\n\t\t\tstrict: true,\n\t\t\tallowPositionals: false,\n\t\t});\n\t} catch (err) {\n\t\tthrow new ArgParseError(err instanceof Error ? err.message : String(err));\n\t}\n\n\tconst out: BuildArgs = {};\n\tif (parsed.values.mode !== undefined) {\n\t\tout.mode = parsed.values.mode;\n\t}\n\n\treturn out;\n}\n\nasync function main(): Promise<number> {\n\tprocess.env[CLI_DISPLAY_NAME_ENV_VAR] = \"cf\";\n\n\t// argv: [0] node [1] cf-vite.mjs [2] verb [3+] forwarded flags.\n\tconst verb = process.argv[2];\n\tconst userArgv = process.argv.slice(3);\n\n\tif (verb === \"dev\") {\n\t\treturn runDev(userArgv);\n\t}\n\n\tif (verb === \"build\") {\n\t\treturn runBuild(userArgv);\n\t}\n\n\t// Format mirrors `cf-wrangler`.\n\tprocess.stderr.write(\n\t\t`Error: unknown subcommand \"${verb ?? \"\"}\".\\n` +\n\t\t\t`Usage: cf-vite <dev|build> [args]\\n`\n\t);\n\treturn 2;\n}\n\nasync function runDev(userArgv: string[]): Promise<number> {\n\tlet args: DevArgs;\n\ttry {\n\t\targs = parseDevArgs(userArgv);\n\t} catch (err) {\n\t\tif (err instanceof ArgParseError) {\n\t\t\tprocess.stderr.write(`Error: ${err.message}\\n`);\n\t\t\treturn 2;\n\t\t}\n\t\tthrow err;\n\t}\n\n\t// Bridge plugin-owned flags via env vars the plugin reads during config\n\t// resolution — must be set before `createServer()`.\n\t// - `--local`: overrides `remoteBindings` outright, mirroring\n\t// `wrangler dev --local` (force local even if config opts into\n\t// remote).\n\tif (args.local) {\n\t\tprocess.env.CLOUDFLARE_VITE_FORCE_LOCAL = \"true\";\n\t}\n\n\t// Bridge Vite-owned flags via inline config; the rest auto-loads from\n\t// the user's `vite.config.{ts,js,mjs}` (which supplies `cloudflare()`).\n\tconst serverOptions: ServerOptions = {};\n\tif (args.port !== undefined) {\n\t\tserverOptions.port = args.port;\n\t}\n\tif (args.host !== undefined) {\n\t\tserverOptions.host = args.host;\n\t}\n\tconst inlineConfig: InlineConfig = { server: serverOptions };\n\tif (args.mode !== undefined) {\n\t\tinlineConfig.mode = args.mode;\n\t}\n\n\tconst server = await createServer(inlineConfig);\n\n\tawait server.listen();\n\tserver.printUrls();\n\tserver.bindCLIShortcuts({ print: true });\n\n\t// Close cleanly on signal so the dev registry entry, workerd\n\t// subprocess, and ports release. `closing` guards against a\n\t// double-signal (e.g. rapid Ctrl+C, or SIGINT then SIGTERM) racing\n\t// two `server.close()` / `process.exit()` calls.\n\tlet closing = false;\n\tconst shutdown = (signal: NodeJS.Signals) => {\n\t\tif (closing) {\n\t\t\treturn;\n\t\t}\n\t\tclosing = true;\n\t\t// Signal handlers can't be async; void the IIFE to avoid unhandled\n\t\t// rejections if `close()` throws.\n\t\tvoid (async () => {\n\t\t\ttry {\n\t\t\t\tawait server.close();\n\t\t\t\tprocess.exit(0);\n\t\t\t} catch {\n\t\t\t\t// Forced-exit: terminate with the 128+N code rather than\n\t\t\t\t// hang. SIGINT=130, SIGTERM=143.\n\t\t\t\tprocess.exit(signal === \"SIGINT\" ? 130 : 143);\n\t\t\t}\n\t\t})();\n\t};\n\tprocess.on(\"SIGINT\", () => shutdown(\"SIGINT\"));\n\tprocess.on(\"SIGTERM\", () => shutdown(\"SIGTERM\"));\n\n\t// Keep the event loop alive until a signal handler exits; Vite's own\n\t// handles (HTTP listener, watchers, workerd) hold the process open.\n\treturn new Promise<number>(() => {});\n}\n\nasync function runBuild(userArgv: string[]): Promise<number> {\n\tlet args: BuildArgs;\n\ttry {\n\t\targs = parseBuildArgs(userArgv);\n\t} catch (err) {\n\t\tif (err instanceof ArgParseError) {\n\t\t\tprocess.stderr.write(`Error: ${err.message}\\n`);\n\t\t\treturn 2;\n\t\t}\n\t\tthrow err;\n\t}\n\n\tconst inlineConfig: InlineConfig = {};\n\tif (args.mode !== undefined) {\n\t\tinlineConfig.mode = args.mode;\n\t}\n\tconst builder = await createBuilder(inlineConfig);\n\tawait builder.buildApp();\n\n\treturn 0;\n}\n\n// Let unhandled rejections propagate — Node prints the stack and exits\n// non-zero, which the parent surfaces via inherited stdio.\nconst exitCode = await main();\nprocess.exit(exitCode);\n"],"mappings":";;;;;AACA,MAAa,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACyCxC,IAAM,gBAAN,cAA4B,MAAM;CACjC,YAAY,SAAiB;AAC5B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;AAKd,SAAS,aAAa,MAAyB;CAC9C,IAAI;AACJ,KAAI;AACH,WAASA,UAAc;GACtB,MAAM;GACN,SAAS;IACR,MAAM,EAAE,MAAM,UAAU;IACxB,MAAM,EAAE,MAAM,UAAU;IAExB,MAAM,EAAE,MAAM,UAAU;IACxB,OAAO,EAAE,MAAM,WAAW;IAC1B;GACD,QAAQ;GACR,kBAAkB;GAClB,CAAC;UACM,KAAK;AACb,QAAM,IAAI,cAAc,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI,CAAC;;CAG1E,MAAMC,M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equire } from 'node:module';\n\nconst require$1 = createRequire(import.meta.url || (typeof __filename === \"string\" ? __filename : \"/\"));\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\nvar __require = /* @__PURE__ */ ((x) => typeof require$1 !== \"undefined\" ? require$1 : typeof Proxy !== \"undefined\" ? new Proxy(x, {\n get: (a, b) => (typeof require$1 !== \"undefined\" ? require$1 : a)[b]\n}) : x)(function(x) {\n if (typeof require$1 !== \"undefined\") return require$1.apply(this, arguments);\n throw Error('Dynamic require of \"' + x + '\" is not supported');\n});\nvar __commonJS = (cb, mod) => function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\n\nexport { __commonJS, __export, __name, __require, __toESM };\n//# sourceMappingURL=chunk-53YJWLG7.mjs.map\n//# sourceMappingURL=chunk-53YJWLG7.mjs.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