@cloudflare/vite-plugin 1.64.0 → 1.66.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": "@cloudflare/vite-plugin",
3
- "version": "1.64.0",
3
+ "version": "1.66.0",
4
4
  "description": "Cloudflare plugin for Vite",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -9,7 +9,7 @@
9
9
  "vite-plugin",
10
10
  "workers"
11
11
  ],
12
- "homepage": "https://github.com/cloudflare/workers-sdk/tree/main/packages/vite-plugin-cloudflare#readme",
12
+ "homepage": "https://github.com/cloudflare/workers-sdk/tree/vite-plugin-v1/packages/vite-plugin-cloudflare#readme",
13
13
  "bugs": {
14
14
  "url": "https://github.com/cloudflare/workers-sdk/issues"
15
15
  },
@@ -19,11 +19,7 @@
19
19
  "url": "https://github.com/cloudflare/workers-sdk.git",
20
20
  "directory": "packages/vite-plugin-cloudflare"
21
21
  },
22
- "bin": {
23
- "cf-vite": "./bin/cf-vite"
24
- },
25
22
  "files": [
26
- "bin",
27
23
  "dist"
28
24
  ],
29
25
  "type": "module",
@@ -40,48 +36,44 @@
40
36
  "access": "public"
41
37
  },
42
38
  "dependencies": {
43
- "unenv": "2.0.0-rc.24",
44
- "workerd": "1.20261012.1",
45
- "ws": "8.21.0",
46
39
  "@cloudflare/unenv-preset": "2.16.2",
47
- "wrangler": "4.151.0",
48
- "miniflare": "5.20261012.0-beta"
40
+ "miniflare": "5.20261023.1-beta",
41
+ "unenv": "2.0.0-rc.24",
42
+ "wrangler": "4.154.0",
43
+ "ws": "8.22.0"
49
44
  },
50
45
  "devDependencies": {
51
- "@cloudflare/workers-types": "^5.20261006.1",
52
- "@remix-run/node-fetch-server": "^0.8.0",
46
+ "@cloudflare/containers-shared": "0.23.3",
47
+ "@cloudflare/workers-types": "5.20261023.1",
48
+ "@cloudflare/workers-utils": "0.49.0",
49
+ "@remix-run/node-fetch-server": "1.0.0",
53
50
  "@types/node": "22.15.17",
54
- "@types/semver": "^7.5.1",
55
- "@types/ws": "^8.5.13",
56
- "am-i-vibing": "^0.5.0",
57
- "defu": "^6.1.4",
58
- "get-port": "^7.1.0",
59
- "magic-string": "^0.30.12",
60
- "mlly": "^1.7.4",
51
+ "@types/semver": "7.8.0",
52
+ "@types/ws": "8.18.2",
53
+ "am-i-vibing": "0.5.0",
54
+ "defu": "6.1.7",
55
+ "get-port": "7.2.0",
56
+ "magic-string": "0.30.21",
57
+ "mlly": "1.8.2",
61
58
  "open": "11.0.0",
62
- "picocolors": "^1.1.1",
63
- "qr": "^0.6.0",
64
- "semver": "^7.7.1",
59
+ "picocolors": "1.1.1",
60
+ "qr": "0.6.0",
61
+ "semver": "7.8.5",
65
62
  "tinyglobby": "0.2.16",
66
63
  "tree-kill": "1.2.2",
67
64
  "tsdown": "0.16.3",
68
65
  "typescript": "5.8.3",
69
- "vite": "8.1.5",
66
+ "vite": "8.3.4",
70
67
  "vite-legacy": "npm:vite@7.1.12",
71
- "vitest": "4.1.0",
72
- "@cloudflare/config": "0.26.0",
73
- "@cloudflare/build-output-utils": "0.9.2",
74
- "@cloudflare/containers-shared": "0.21.7",
75
- "@cloudflare/mock-npm-registry": "0.0.0",
68
+ "vitest": "5.0.4",
76
69
  "@cloudflare/remote-bindings": "0.0.47",
77
- "@cloudflare/runtime-types": "0.1.11",
70
+ "@cloudflare/mock-npm-registry": "0.0.0",
78
71
  "@cloudflare/workers-shared": "0.20.1",
79
- "@cloudflare/workers-tsconfig": "0.0.0",
80
- "@cloudflare/workers-utils": "0.47.2"
72
+ "@cloudflare/workers-tsconfig": "0.0.0"
81
73
  },
82
74
  "peerDependencies": {
83
75
  "vite": "^6.1.0 || ^7.0.0 || ^8.0.0",
84
- "wrangler": "^4.151.0"
76
+ "wrangler": "^4.154.0"
85
77
  },
86
78
  "workers-sdk": {
87
79
  "prerelease": true
package/bin/cf-vite DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import("../dist/cf-vite.mjs");
package/dist/cf-vite.mjs DELETED
@@ -1,167 +0,0 @@
1
- import { parseArgs } from "node:util";
2
- import { createBuilder, createServer } from "vite";
3
-
4
- //#region src/build-output-env.ts
5
- /**
6
- * Shared definition of the internal env var that the `cf-vite build`
7
- * delegate uses to force the experimental Build Output Specification on by default.
8
- */
9
- const FORCE_BUILD_OUTPUT_ENV_VAR = "CLOUDFLARE_VITE_FORCE_BUILD_OUTPUT";
10
-
11
- //#endregion
12
- //#region src/cf-vite.ts
13
- /**
14
- * `cf-vite` delegate binary entry point for `@cloudflare/vite-plugin`.
15
- *
16
- * EXPERIMENTAL / internal: spawned by Cloudflare's "cf-dev" parent
17
- * process, not invoked directly by end users. Contract may change.
18
- *
19
- * Usage: `<pkgRoot>/bin/cf-vite <verb> [flags...]`. `dev` and `build`
20
- * are the verbs today; future verbs follow the same shape.
21
- * Unknown/missing verbs exit 2 (also the parent's version-detection
22
- * signal).
23
- *
24
- * Every verb forces the experimental Build Output Specification on by default by
25
- * setting `CLOUDFLARE_VITE_FORCE_BUILD_OUTPUT` in `main()` before Vite
26
- * loads the user's config; the plugin reads it during config resolution
27
- * to enable `experimental.newConfig` + `experimental.newConfig.cfBuildOutput`.
28
- *
29
- * Spawn contract for `dev`: parent uses `stdio: "inherit"` and forwards
30
- * SIGINT/SIGTERM. Accepted flags mirror the sibling `cf-wrangler`
31
- * delegate (`--mode`, `--port`, `--host`, `--local`) so the parent can
32
- * drive either impl interchangeably; everything else lives in the user's
33
- * `vite.config.ts` / `wrangler.jsonc` (including the wrangler config
34
- * file, which is discovered by `cloudflare()` itself). `cf-vite` boots
35
- * Vite via `createServer()` against the user's own config (expected to
36
- * include `cloudflare()`); flags are bridged to it as documented inline.
37
- *
38
- * `build` runs Vite's full multi-environment app build via
39
- * `createBuilder().buildApp()` (NOT the legacy single-environment
40
- * `build()` helper, which would skip the plugin's worker builds). It
41
- * accepts only `--mode`. Preview build context is supplied through the
42
- * `CLOUDFLARE_PREVIEW_BUILD` environment variable so framework-owned build
43
- * commands can use the same contract.
44
- *
45
- * Exit codes: 0 graceful, 2 unknown verb / parse error, 130 SIGINT,
46
- * 143 SIGTERM.
47
- */
48
- var ArgParseError = class extends Error {
49
- constructor(message) {
50
- super(message);
51
- this.name = "ArgParseError";
52
- }
53
- };
54
- /** Strict argv parser; mirrors `cf-wrangler`'s flags (unknown → throw). */
55
- function parseDevArgs(argv) {
56
- let parsed;
57
- try {
58
- parsed = parseArgs({
59
- args: argv,
60
- options: {
61
- mode: { type: "string" },
62
- host: { type: "string" },
63
- port: { type: "string" },
64
- local: { type: "boolean" }
65
- },
66
- strict: true,
67
- allowPositionals: false
68
- });
69
- } catch (err) {
70
- throw new ArgParseError(err instanceof Error ? err.message : String(err));
71
- }
72
- const out = {};
73
- if (parsed.values.mode !== void 0) out.mode = parsed.values.mode;
74
- if (parsed.values.host !== void 0) out.host = parsed.values.host;
75
- if (parsed.values.port !== void 0) {
76
- const raw = parsed.values.port;
77
- const n = Number(raw);
78
- if (!Number.isInteger(n) || n < 0 || n > 65535) throw new ArgParseError(`--port expects an integer between 0 and 65535, got "${raw}"`);
79
- out.port = n;
80
- }
81
- if (parsed.values.local !== void 0) out.local = parsed.values.local;
82
- return out;
83
- }
84
- function parseBuildArgs(argv) {
85
- let parsed;
86
- try {
87
- parsed = parseArgs({
88
- args: argv,
89
- options: { mode: { type: "string" } },
90
- strict: true,
91
- allowPositionals: false
92
- });
93
- } catch (err) {
94
- throw new ArgParseError(err instanceof Error ? err.message : String(err));
95
- }
96
- const out = {};
97
- if (parsed.values.mode !== void 0) out.mode = parsed.values.mode;
98
- return out;
99
- }
100
- async function main() {
101
- const verb = process.argv[2];
102
- const userArgv = process.argv.slice(3);
103
- process.env[FORCE_BUILD_OUTPUT_ENV_VAR] = "true";
104
- if (verb === "dev") return runDev(userArgv);
105
- if (verb === "build") return runBuild(userArgv);
106
- process.stderr.write(`Error: unknown subcommand "${verb ?? ""}".\nUsage: cf-vite <dev|build> [args]\n`);
107
- return 2;
108
- }
109
- async function runDev(userArgv) {
110
- let args;
111
- try {
112
- args = parseDevArgs(userArgv);
113
- } catch (err) {
114
- if (err instanceof ArgParseError) {
115
- process.stderr.write(`Error: ${err.message}\n`);
116
- return 2;
117
- }
118
- throw err;
119
- }
120
- if (args.local) process.env.CLOUDFLARE_VITE_FORCE_LOCAL = "true";
121
- const serverOptions = {};
122
- if (args.port !== void 0) serverOptions.port = args.port;
123
- if (args.host !== void 0) serverOptions.host = args.host;
124
- const inlineConfig = { server: serverOptions };
125
- if (args.mode !== void 0) inlineConfig.mode = args.mode;
126
- const server = await createServer(inlineConfig);
127
- await server.listen();
128
- server.printUrls();
129
- server.bindCLIShortcuts({ print: true });
130
- let closing = false;
131
- const shutdown = (signal) => {
132
- if (closing) return;
133
- closing = true;
134
- (async () => {
135
- try {
136
- await server.close();
137
- process.exit(0);
138
- } catch {
139
- process.exit(signal === "SIGINT" ? 130 : 143);
140
- }
141
- })();
142
- };
143
- process.on("SIGINT", () => shutdown("SIGINT"));
144
- process.on("SIGTERM", () => shutdown("SIGTERM"));
145
- return new Promise(() => {});
146
- }
147
- async function runBuild(userArgv) {
148
- let args;
149
- try {
150
- args = parseBuildArgs(userArgv);
151
- } catch (err) {
152
- if (err instanceof ArgParseError) {
153
- process.stderr.write(`Error: ${err.message}\n`);
154
- return 2;
155
- }
156
- throw err;
157
- }
158
- const inlineConfig = {};
159
- if (args.mode !== void 0) inlineConfig.mode = args.mode;
160
- await (await createBuilder(inlineConfig)).buildApp();
161
- return 0;
162
- }
163
- const exitCode = await main();
164
- process.exit(exitCode);
165
-
166
- //#endregion
167
- export { };