@cloudflare/vite-plugin 1.14.2 → 1.15.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/index.mjs +231 -106
- package/dist/index.mjs.map +1 -1
- package/dist/workers/asset-worker.js +1 -0
- package/dist/workers/runner-worker.js +16 -3
- package/package.json +7 -6
|
@@ -5723,6 +5723,7 @@ var worker_default = class extends WorkerEntrypoint {
|
|
|
5723
5723
|
const UNKNOWN_HOST = "http://localhost";
|
|
5724
5724
|
const virtualPrefix = "virtual:cloudflare/";
|
|
5725
5725
|
const VIRTUAL_WORKER_ENTRY = `${virtualPrefix}worker-entry`;
|
|
5726
|
+
const VIRTUAL_EXPORT_TYPES = `${virtualPrefix}export-types`;
|
|
5726
5727
|
|
|
5727
5728
|
//#endregion
|
|
5728
5729
|
//#region src/workers/asset-worker/index.ts
|
|
@@ -3,10 +3,12 @@ import { DurableObject, WorkerEntrypoint, WorkflowEntrypoint } from "cloudflare:
|
|
|
3
3
|
//#region src/shared.ts
|
|
4
4
|
const UNKNOWN_HOST = "http://localhost";
|
|
5
5
|
const INIT_PATH = "/__vite_plugin_cloudflare_init__";
|
|
6
|
+
const GET_EXPORT_TYPES_PATH = "/__vite_plugin_cloudflare_get_export_types__";
|
|
6
7
|
const WORKER_ENTRY_PATH_HEADER = "__VITE_WORKER_ENTRY_PATH__";
|
|
7
8
|
const IS_ENTRY_WORKER_HEADER = "__VITE_IS_ENTRY_WORKER__";
|
|
8
9
|
const virtualPrefix = "virtual:cloudflare/";
|
|
9
10
|
const VIRTUAL_WORKER_ENTRY = `${virtualPrefix}worker-entry`;
|
|
11
|
+
const VIRTUAL_EXPORT_TYPES = `${virtualPrefix}export-types`;
|
|
10
12
|
|
|
11
13
|
//#endregion
|
|
12
14
|
//#region src/workers/runner-worker/env.ts
|
|
@@ -1363,11 +1365,16 @@ async function getWorkerEntryExport(workerEntryPath$1, exportName) {
|
|
|
1363
1365
|
if (!exportValue) throw new Error(`"${workerEntryPath$1}" does not define a "${exportName}" export.`);
|
|
1364
1366
|
return exportValue;
|
|
1365
1367
|
}
|
|
1368
|
+
async function getWorkerEntryExportTypes() {
|
|
1369
|
+
if (!moduleRunner) throw new Error(`Module runner not initialized`);
|
|
1370
|
+
const { getExportTypes } = await moduleRunner.import(VIRTUAL_EXPORT_TYPES);
|
|
1371
|
+
return getExportTypes(await moduleRunner.import(VIRTUAL_WORKER_ENTRY));
|
|
1372
|
+
}
|
|
1366
1373
|
|
|
1367
1374
|
//#endregion
|
|
1368
1375
|
//#region src/workers/runner-worker/index.ts
|
|
1369
1376
|
/** Keys that should be ignored during RPC property access */
|
|
1370
|
-
const IGNORED_KEYS = ["self"
|
|
1377
|
+
const IGNORED_KEYS = ["self"];
|
|
1371
1378
|
/** Available methods for `WorkerEntrypoint` class */
|
|
1372
1379
|
const WORKER_ENTRYPOINT_KEYS = [
|
|
1373
1380
|
"fetch",
|
|
@@ -1375,7 +1382,8 @@ const WORKER_ENTRYPOINT_KEYS = [
|
|
|
1375
1382
|
"tail",
|
|
1376
1383
|
"test",
|
|
1377
1384
|
"trace",
|
|
1378
|
-
"scheduled"
|
|
1385
|
+
"scheduled",
|
|
1386
|
+
"tailStream"
|
|
1379
1387
|
];
|
|
1380
1388
|
/** Available methods for `DurableObject` class */
|
|
1381
1389
|
const DURABLE_OBJECT_KEYS = [
|
|
@@ -1473,7 +1481,8 @@ function createWorkerEntrypointWrapper(exportName) {
|
|
|
1473
1481
|
}, async () => {
|
|
1474
1482
|
if (key === "fetch") {
|
|
1475
1483
|
const request = arg;
|
|
1476
|
-
|
|
1484
|
+
const url = new URL(request.url);
|
|
1485
|
+
if (url.pathname === INIT_PATH) {
|
|
1477
1486
|
const workerEntryPathHeader = request.headers.get(WORKER_ENTRY_PATH_HEADER);
|
|
1478
1487
|
if (!workerEntryPathHeader) throw new Error(`Unexpected error: "${WORKER_ENTRY_PATH_HEADER}" header not set.`);
|
|
1479
1488
|
const isEntryWorkerHeader = request.headers.get(IS_ENTRY_WORKER_HEADER);
|
|
@@ -1482,6 +1491,10 @@ function createWorkerEntrypointWrapper(exportName) {
|
|
|
1482
1491
|
isEntryWorker = isEntryWorkerHeader === "true";
|
|
1483
1492
|
return this.env.__VITE_RUNNER_OBJECT__.get("singleton").fetch(request);
|
|
1484
1493
|
}
|
|
1494
|
+
if (url.pathname === GET_EXPORT_TYPES_PATH) {
|
|
1495
|
+
const workerEntryExportTypes = await getWorkerEntryExportTypes();
|
|
1496
|
+
return Response.json(workerEntryExportTypes);
|
|
1497
|
+
}
|
|
1485
1498
|
}
|
|
1486
1499
|
const exportValue = await getWorkerEntryExport(workerEntryPath, exportName);
|
|
1487
1500
|
const userEnv = stripInternalEnv(this.env);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -40,27 +40,28 @@
|
|
|
40
40
|
"unenv": "2.0.0-rc.24",
|
|
41
41
|
"ws": "8.18.0",
|
|
42
42
|
"@cloudflare/unenv-preset": "2.7.10",
|
|
43
|
-
"miniflare": "4.
|
|
44
|
-
"wrangler": "4.
|
|
43
|
+
"miniflare": "4.20251113.0",
|
|
44
|
+
"wrangler": "4.49.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@cloudflare/workers-types": "^4.
|
|
47
|
+
"@cloudflare/workers-types": "^4.20251113.0",
|
|
48
48
|
"@types/node": "^22.10.1",
|
|
49
49
|
"@types/ws": "^8.5.13",
|
|
50
50
|
"magic-string": "^0.30.12",
|
|
51
51
|
"mlly": "^1.7.4",
|
|
52
|
+
"tree-kill": "^1.2.2",
|
|
52
53
|
"tsdown": "0.16.3",
|
|
53
54
|
"typescript": "^5.8.3",
|
|
54
55
|
"vite": "7.0.0",
|
|
55
56
|
"vitest": "~3.2.0",
|
|
56
|
-
"@cloudflare/containers-shared": "0.3.0",
|
|
57
57
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
58
|
+
"@cloudflare/containers-shared": "0.3.0",
|
|
58
59
|
"@cloudflare/workers-shared": "0.18.8",
|
|
59
60
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
63
|
"vite": "^6.1.0 || ^7.0.0",
|
|
63
|
-
"wrangler": "^4.
|
|
64
|
+
"wrangler": "^4.49.0"
|
|
64
65
|
},
|
|
65
66
|
"publishConfig": {
|
|
66
67
|
"access": "public"
|