@cloudflare/vite-plugin 2.0.0-rc.0 → 2.0.0-rc.1
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 +3 -3
- package/dist/{package-DdTPrOmV.mjs → package-2STS8qz3.mjs} +2 -3
- package/package.json +13 -17
- package/bin/cf-vite +0 -2
- package/dist/cf-vite.mjs +0 -152
package/dist/index.mjs
CHANGED
|
@@ -50923,7 +50923,7 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
50923
50923
|
}, {});
|
|
50924
50924
|
}
|
|
50925
50925
|
__name$3(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
|
|
50926
|
-
var DEFAULT_COMPAT_DATE = "2026-11-
|
|
50926
|
+
var DEFAULT_COMPAT_DATE = "2026-11-17";
|
|
50927
50927
|
function constructWranglerConfig(config$3) {
|
|
50928
50928
|
const mappedBindings = mapWorkerMetadataBindings(config$3.bindings);
|
|
50929
50929
|
const durableObjectClassNames = config$3.bindings.filter((binding) => binding.type === "durable_object_namespace" && binding.script_name === config$3.name).map((durableObject) => durableObject.class_name);
|
|
@@ -78731,7 +78731,7 @@ async function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
|
|
|
78731
78731
|
localEnv,
|
|
78732
78732
|
devVars
|
|
78733
78733
|
};
|
|
78734
|
-
const remoteBindings =
|
|
78734
|
+
const remoteBindings = pluginConfig.remoteBindings ?? true;
|
|
78735
78735
|
if (preview !== void 0) {
|
|
78736
78736
|
const { accountId, complianceRegion } = preview.rootConfig.settings ?? {};
|
|
78737
78737
|
return {
|
|
@@ -89983,7 +89983,7 @@ var ProxyControllerLogger = class extends Log {
|
|
|
89983
89983
|
super.log(message);
|
|
89984
89984
|
}
|
|
89985
89985
|
};
|
|
89986
|
-
var version$1 = "0.0.
|
|
89986
|
+
var version$1 = "0.0.67";
|
|
89987
89987
|
const TRACE_VERSION = "trace-v1";
|
|
89988
89988
|
/**
|
|
89989
89989
|
* Maximum time (ms) to wait for an individual preview API request before
|
|
@@ -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-rc.
|
|
4
|
+
version: "2.0.0-rc.1",
|
|
5
5
|
description: "Cloudflare plugin for Vite",
|
|
6
6
|
keywords: [
|
|
7
7
|
"cloudflare",
|
|
@@ -18,8 +18,7 @@ var package_default = {
|
|
|
18
18
|
"url": "https://github.com/cloudflare/workers-sdk.git",
|
|
19
19
|
"directory": "packages/vite-plugin-cloudflare"
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
files: ["bin", "dist"],
|
|
21
|
+
files: ["dist"],
|
|
23
22
|
type: "module",
|
|
24
23
|
sideEffects: false,
|
|
25
24
|
main: "./dist/index.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -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",
|
|
@@ -42,14 +38,14 @@
|
|
|
42
38
|
"dependencies": {
|
|
43
39
|
"unenv": "2.0.0-rc.24",
|
|
44
40
|
"ws": "8.21.0",
|
|
45
|
-
"@cloudflare/build-output-utils": "1.0.0-rc.
|
|
46
|
-
"@cloudflare/config": "1.0.0-rc.
|
|
47
|
-
"@cloudflare/
|
|
48
|
-
"miniflare": "5.
|
|
49
|
-
"@cloudflare/
|
|
41
|
+
"@cloudflare/build-output-utils": "1.0.0-rc.1",
|
|
42
|
+
"@cloudflare/config": "1.0.0-rc.1",
|
|
43
|
+
"@cloudflare/unenv-preset": "2.16.2",
|
|
44
|
+
"miniflare": "5.20261117.0-beta",
|
|
45
|
+
"@cloudflare/runtime-types": "0.1.30"
|
|
50
46
|
},
|
|
51
47
|
"devDependencies": {
|
|
52
|
-
"@cloudflare/workers-types": "^5.
|
|
48
|
+
"@cloudflare/workers-types": "^5.20261117.1",
|
|
53
49
|
"@remix-run/node-fetch-server": "^1.0.0",
|
|
54
50
|
"@types/node": "22.15.17",
|
|
55
51
|
"@types/semver": "^7.5.1",
|
|
@@ -69,14 +65,14 @@
|
|
|
69
65
|
"vite": "8.3.4",
|
|
70
66
|
"vite-legacy": "npm:vite@7.1.12",
|
|
71
67
|
"vitest": "5.0.4",
|
|
72
|
-
"@cloudflare/cli-shared-helpers": "0.3.
|
|
73
|
-
"@cloudflare/containers-shared": "0.26.
|
|
68
|
+
"@cloudflare/cli-shared-helpers": "0.3.10",
|
|
69
|
+
"@cloudflare/containers-shared": "0.26.3",
|
|
70
|
+
"@cloudflare/remote-bindings": "0.0.67",
|
|
71
|
+
"@cloudflare/workers-auth": "0.18.4",
|
|
74
72
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
75
|
-
"@cloudflare/remote-bindings": "0.0.66",
|
|
76
|
-
"@cloudflare/workers-auth": "0.18.3",
|
|
77
73
|
"@cloudflare/workers-shared": "0.20.3",
|
|
78
|
-
"@cloudflare/workers-
|
|
79
|
-
"@cloudflare/workers-
|
|
74
|
+
"@cloudflare/workers-utils": "0.54.2",
|
|
75
|
+
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
80
76
|
},
|
|
81
77
|
"peerDependencies": {
|
|
82
78
|
"vite": "^7.0.0 || ^8.0.0"
|
package/bin/cf-vite
DELETED
package/dist/cf-vite.mjs
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { parseArgs } from "node:util";
|
|
2
|
-
import { createBuilder, createServer } from "vite";
|
|
3
|
-
|
|
4
|
-
//#region src/cf-vite.ts
|
|
5
|
-
/**
|
|
6
|
-
* `cf-vite` delegate binary entry point for `@cloudflare/vite-plugin`.
|
|
7
|
-
*
|
|
8
|
-
* EXPERIMENTAL / internal: spawned by Cloudflare's "cf-dev" parent
|
|
9
|
-
* process, not invoked directly by end users. Contract may change.
|
|
10
|
-
*
|
|
11
|
-
* Usage: `<pkgRoot>/bin/cf-vite <verb> [flags...]`. `dev` and `build`
|
|
12
|
-
* are the verbs today; future verbs follow the same shape.
|
|
13
|
-
* Unknown/missing verbs exit 2 (also the parent's version-detection
|
|
14
|
-
* signal).
|
|
15
|
-
*
|
|
16
|
-
* Spawn contract for `dev`: parent uses `stdio: "inherit"` and forwards
|
|
17
|
-
* SIGINT/SIGTERM. Accepted flags mirror the sibling `cf-wrangler`
|
|
18
|
-
* delegate (`--mode`, `--port`, `--host`, `--local`) so the parent can
|
|
19
|
-
* drive either impl interchangeably; everything else lives in the user's
|
|
20
|
-
* `vite.config.ts` / `cloudflare.config.ts`. `cf-vite` boots
|
|
21
|
-
* Vite via `createServer()` against the user's own config (expected to
|
|
22
|
-
* include `cloudflare()`); flags are bridged to it as documented inline.
|
|
23
|
-
*
|
|
24
|
-
* `build` runs Vite's full multi-environment app build via
|
|
25
|
-
* `createBuilder().buildApp()` (NOT the legacy single-environment
|
|
26
|
-
* `build()` helper, which would skip the plugin's worker builds). It
|
|
27
|
-
* accepts only `--mode`. Preview build context is supplied through the
|
|
28
|
-
* `CLOUDFLARE_PREVIEW_BUILD` environment variable so framework-owned build
|
|
29
|
-
* commands can use the same contract.
|
|
30
|
-
*
|
|
31
|
-
* Exit codes: 0 graceful, 2 unknown verb / parse error, 130 SIGINT,
|
|
32
|
-
* 143 SIGTERM.
|
|
33
|
-
*/
|
|
34
|
-
var ArgParseError = class extends Error {
|
|
35
|
-
constructor(message) {
|
|
36
|
-
super(message);
|
|
37
|
-
this.name = "ArgParseError";
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
/** Strict argv parser; mirrors `cf-wrangler`'s flags (unknown → throw). */
|
|
41
|
-
function parseDevArgs(argv) {
|
|
42
|
-
let parsed;
|
|
43
|
-
try {
|
|
44
|
-
parsed = parseArgs({
|
|
45
|
-
args: argv,
|
|
46
|
-
options: {
|
|
47
|
-
mode: { type: "string" },
|
|
48
|
-
host: { type: "string" },
|
|
49
|
-
port: { type: "string" },
|
|
50
|
-
local: { type: "boolean" }
|
|
51
|
-
},
|
|
52
|
-
strict: true,
|
|
53
|
-
allowPositionals: false
|
|
54
|
-
});
|
|
55
|
-
} catch (err) {
|
|
56
|
-
throw new ArgParseError(err instanceof Error ? err.message : String(err));
|
|
57
|
-
}
|
|
58
|
-
const out = {};
|
|
59
|
-
if (parsed.values.mode !== void 0) out.mode = parsed.values.mode;
|
|
60
|
-
if (parsed.values.host !== void 0) out.host = parsed.values.host;
|
|
61
|
-
if (parsed.values.port !== void 0) {
|
|
62
|
-
const raw = parsed.values.port;
|
|
63
|
-
const n = Number(raw);
|
|
64
|
-
if (!Number.isInteger(n) || n < 0 || n > 65535) throw new ArgParseError(`--port expects an integer between 0 and 65535, got "${raw}"`);
|
|
65
|
-
out.port = n;
|
|
66
|
-
}
|
|
67
|
-
if (parsed.values.local !== void 0) out.local = parsed.values.local;
|
|
68
|
-
return out;
|
|
69
|
-
}
|
|
70
|
-
function parseBuildArgs(argv) {
|
|
71
|
-
let parsed;
|
|
72
|
-
try {
|
|
73
|
-
parsed = parseArgs({
|
|
74
|
-
args: argv,
|
|
75
|
-
options: { mode: { type: "string" } },
|
|
76
|
-
strict: true,
|
|
77
|
-
allowPositionals: false
|
|
78
|
-
});
|
|
79
|
-
} catch (err) {
|
|
80
|
-
throw new ArgParseError(err instanceof Error ? err.message : String(err));
|
|
81
|
-
}
|
|
82
|
-
const out = {};
|
|
83
|
-
if (parsed.values.mode !== void 0) out.mode = parsed.values.mode;
|
|
84
|
-
return out;
|
|
85
|
-
}
|
|
86
|
-
async function main() {
|
|
87
|
-
const verb = process.argv[2];
|
|
88
|
-
const userArgv = process.argv.slice(3);
|
|
89
|
-
if (verb === "dev") return runDev(userArgv);
|
|
90
|
-
if (verb === "build") return runBuild(userArgv);
|
|
91
|
-
process.stderr.write(`Error: unknown subcommand "${verb ?? ""}".\nUsage: cf-vite <dev|build> [args]\n`);
|
|
92
|
-
return 2;
|
|
93
|
-
}
|
|
94
|
-
async function runDev(userArgv) {
|
|
95
|
-
let args;
|
|
96
|
-
try {
|
|
97
|
-
args = parseDevArgs(userArgv);
|
|
98
|
-
} catch (err) {
|
|
99
|
-
if (err instanceof ArgParseError) {
|
|
100
|
-
process.stderr.write(`Error: ${err.message}\n`);
|
|
101
|
-
return 2;
|
|
102
|
-
}
|
|
103
|
-
throw err;
|
|
104
|
-
}
|
|
105
|
-
if (args.local) process.env.CLOUDFLARE_VITE_FORCE_LOCAL = "true";
|
|
106
|
-
const serverOptions = {};
|
|
107
|
-
if (args.port !== void 0) serverOptions.port = args.port;
|
|
108
|
-
if (args.host !== void 0) serverOptions.host = args.host;
|
|
109
|
-
const inlineConfig = { server: serverOptions };
|
|
110
|
-
if (args.mode !== void 0) inlineConfig.mode = args.mode;
|
|
111
|
-
const server = await createServer(inlineConfig);
|
|
112
|
-
await server.listen();
|
|
113
|
-
server.printUrls();
|
|
114
|
-
server.bindCLIShortcuts({ print: true });
|
|
115
|
-
let closing = false;
|
|
116
|
-
const shutdown = (signal) => {
|
|
117
|
-
if (closing) return;
|
|
118
|
-
closing = true;
|
|
119
|
-
(async () => {
|
|
120
|
-
try {
|
|
121
|
-
await server.close();
|
|
122
|
-
process.exit(0);
|
|
123
|
-
} catch {
|
|
124
|
-
process.exit(signal === "SIGINT" ? 130 : 143);
|
|
125
|
-
}
|
|
126
|
-
})();
|
|
127
|
-
};
|
|
128
|
-
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
129
|
-
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
130
|
-
return new Promise(() => {});
|
|
131
|
-
}
|
|
132
|
-
async function runBuild(userArgv) {
|
|
133
|
-
let args;
|
|
134
|
-
try {
|
|
135
|
-
args = parseBuildArgs(userArgv);
|
|
136
|
-
} catch (err) {
|
|
137
|
-
if (err instanceof ArgParseError) {
|
|
138
|
-
process.stderr.write(`Error: ${err.message}\n`);
|
|
139
|
-
return 2;
|
|
140
|
-
}
|
|
141
|
-
throw err;
|
|
142
|
-
}
|
|
143
|
-
const inlineConfig = {};
|
|
144
|
-
if (args.mode !== void 0) inlineConfig.mode = args.mode;
|
|
145
|
-
await (await createBuilder(inlineConfig)).buildApp();
|
|
146
|
-
return 0;
|
|
147
|
-
}
|
|
148
|
-
const exitCode = await main();
|
|
149
|
-
process.exit(exitCode);
|
|
150
|
-
|
|
151
|
-
//#endregion
|
|
152
|
-
export { };
|