@cloudflare/vite-plugin 1.13.19 → 1.14.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.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14588 -14532
- package/dist/index.js.map +1 -1
- package/dist/workers/asset-worker.js +2 -0
- package/dist/workers/runner-worker.js +2 -68
- package/package.json +7 -7
|
@@ -5721,6 +5721,8 @@ var worker_default = class extends WorkerEntrypoint {
|
|
|
5721
5721
|
//#endregion
|
|
5722
5722
|
//#region src/shared.ts
|
|
5723
5723
|
const UNKNOWN_HOST = "http://localhost";
|
|
5724
|
+
const virtualPrefix = "virtual:cloudflare/";
|
|
5725
|
+
const VIRTUAL_WORKER_ENTRY = `${virtualPrefix}worker-entry`;
|
|
5724
5726
|
|
|
5725
5727
|
//#endregion
|
|
5726
5728
|
//#region src/workers/asset-worker/index.ts
|
|
@@ -5,6 +5,8 @@ const UNKNOWN_HOST = "http://localhost";
|
|
|
5
5
|
const INIT_PATH = "/__vite_plugin_cloudflare_init__";
|
|
6
6
|
const WORKER_ENTRY_PATH_HEADER = "__VITE_WORKER_ENTRY_PATH__";
|
|
7
7
|
const IS_ENTRY_WORKER_HEADER = "__VITE_IS_ENTRY_WORKER__";
|
|
8
|
+
const virtualPrefix = "virtual:cloudflare/";
|
|
9
|
+
const VIRTUAL_WORKER_ENTRY = `${virtualPrefix}worker-entry`;
|
|
8
10
|
|
|
9
11
|
//#endregion
|
|
10
12
|
//#region src/workers/runner-worker/env.ts
|
|
@@ -1218,74 +1220,6 @@ function exportAll(exports, sourceModule) {
|
|
|
1218
1220
|
}
|
|
1219
1221
|
}
|
|
1220
1222
|
|
|
1221
|
-
//#endregion
|
|
1222
|
-
//#region src/plugins/utils.ts
|
|
1223
|
-
function createPlugin(name, pluginFactory) {
|
|
1224
|
-
return (ctx) => {
|
|
1225
|
-
return {
|
|
1226
|
-
name: `vite-plugin-cloudflare:${name}`,
|
|
1227
|
-
sharedDuringBuild: true,
|
|
1228
|
-
...pluginFactory(ctx)
|
|
1229
|
-
};
|
|
1230
|
-
};
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
//#endregion
|
|
1234
|
-
//#region src/plugins/virtual-modules.ts
|
|
1235
|
-
const virtualPrefix = "virtual:cloudflare/";
|
|
1236
|
-
const VIRTUAL_USER_ENTRY = `${virtualPrefix}user-entry`;
|
|
1237
|
-
const VIRTUAL_WORKER_ENTRY = `${virtualPrefix}worker-entry`;
|
|
1238
|
-
const VIRTUAL_CLIENT_FALLBACK_ENTRY = `${virtualPrefix}client-fallback-entry`;
|
|
1239
|
-
/**
|
|
1240
|
-
* Plugin to provide virtual modules
|
|
1241
|
-
*/
|
|
1242
|
-
const virtualModulesPlugin = createPlugin("virtual-modules", (ctx) => {
|
|
1243
|
-
return {
|
|
1244
|
-
applyToEnvironment(environment) {
|
|
1245
|
-
return ctx.getWorkerConfig(environment.name) !== void 0;
|
|
1246
|
-
},
|
|
1247
|
-
resolveId(source) {
|
|
1248
|
-
if (source === VIRTUAL_WORKER_ENTRY) return `\0${VIRTUAL_WORKER_ENTRY}`;
|
|
1249
|
-
if (source === VIRTUAL_USER_ENTRY) {
|
|
1250
|
-
const workerConfig = ctx.getWorkerConfig(this.environment.name);
|
|
1251
|
-
if (!workerConfig) return;
|
|
1252
|
-
return this.resolve(workerConfig.main);
|
|
1253
|
-
}
|
|
1254
|
-
},
|
|
1255
|
-
load(id) {
|
|
1256
|
-
if (id === `\0${VIRTUAL_WORKER_ENTRY}`) {
|
|
1257
|
-
const nodeJsCompat = ctx.getNodeJsCompat(this.environment.name);
|
|
1258
|
-
return `
|
|
1259
|
-
${nodeJsCompat ? nodeJsCompat.injectGlobalCode() : ""}
|
|
1260
|
-
import * as mod from "${VIRTUAL_USER_ENTRY}";
|
|
1261
|
-
export * from "${VIRTUAL_USER_ENTRY}";
|
|
1262
|
-
export default mod.default ?? {};
|
|
1263
|
-
if (import.meta.hot) {
|
|
1264
|
-
import.meta.hot.accept();
|
|
1265
|
-
}
|
|
1266
|
-
`;
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
};
|
|
1270
|
-
});
|
|
1271
|
-
/**
|
|
1272
|
-
* Plugin to provide a virtual fallback entry file for the `client` environment.
|
|
1273
|
-
* This is used as the entry file for the client build when only the `public` directory is present.
|
|
1274
|
-
*/
|
|
1275
|
-
const virtualClientFallbackPlugin = createPlugin("virtual-client-fallback", () => {
|
|
1276
|
-
return {
|
|
1277
|
-
applyToEnvironment(environment) {
|
|
1278
|
-
return environment.name === "client";
|
|
1279
|
-
},
|
|
1280
|
-
resolveId(source) {
|
|
1281
|
-
if (source === VIRTUAL_CLIENT_FALLBACK_ENTRY) return `\0${VIRTUAL_CLIENT_FALLBACK_ENTRY}`;
|
|
1282
|
-
},
|
|
1283
|
-
load(id) {
|
|
1284
|
-
if (id === `\0${VIRTUAL_CLIENT_FALLBACK_ENTRY}`) return ``;
|
|
1285
|
-
}
|
|
1286
|
-
};
|
|
1287
|
-
});
|
|
1288
|
-
|
|
1289
1223
|
//#endregion
|
|
1290
1224
|
//#region src/workers/runner-worker/module-runner.ts
|
|
1291
1225
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"tinyglobby": "^0.2.12",
|
|
40
40
|
"unenv": "2.0.0-rc.24",
|
|
41
41
|
"ws": "8.18.0",
|
|
42
|
-
"@cloudflare/unenv-preset": "2.7.
|
|
43
|
-
"miniflare": "4.
|
|
44
|
-
"wrangler": "4.
|
|
42
|
+
"@cloudflare/unenv-preset": "2.7.10",
|
|
43
|
+
"miniflare": "4.20251109.0",
|
|
44
|
+
"wrangler": "4.47.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@cloudflare/workers-types": "^4.
|
|
47
|
+
"@cloudflare/workers-types": "^4.20251109.0",
|
|
48
48
|
"@types/node": "^22.10.1",
|
|
49
49
|
"@types/ws": "^8.5.13",
|
|
50
50
|
"magic-string": "^0.30.12",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"typescript": "^5.8.3",
|
|
54
54
|
"vite": "7.0.0",
|
|
55
55
|
"vitest": "~3.2.0",
|
|
56
|
-
"@cloudflare/containers-shared": "0.
|
|
56
|
+
"@cloudflare/containers-shared": "0.3.0",
|
|
57
57
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
58
58
|
"@cloudflare/workers-shared": "0.18.8",
|
|
59
59
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"vite": "^6.1.0 || ^7.0.0",
|
|
63
|
-
"wrangler": "^4.
|
|
63
|
+
"wrangler": "^4.47.0"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|