@cloudflare/vite-plugin 0.0.0-8278db5c8 → 0.0.0-82e220e94
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/README.md +15 -480
- package/dist/asset-workers/asset-worker.js +727 -692
- package/dist/asset-workers/router-worker.js +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +5702 -376
- package/dist/runner-worker/index.js +29 -25
- package/package.json +11 -8
|
@@ -6,12 +6,21 @@ import {
|
|
|
6
6
|
} from "cloudflare:workers";
|
|
7
7
|
|
|
8
8
|
// src/constants.ts
|
|
9
|
-
var
|
|
9
|
+
var ADDITIONAL_MODULE_TYPES = [
|
|
10
|
+
"CompiledWasm",
|
|
11
|
+
"Data",
|
|
12
|
+
"Text"
|
|
13
|
+
];
|
|
10
14
|
|
|
11
15
|
// src/shared.ts
|
|
12
16
|
var UNKNOWN_HOST = "http://localhost";
|
|
13
17
|
var INIT_PATH = "/__vite_plugin_cloudflare_init__";
|
|
14
|
-
var
|
|
18
|
+
var ADDITIONAL_MODULE_PATTERN = `__CLOUDFLARE_MODULE__(${ADDITIONAL_MODULE_TYPES.join("|")})__(.*?)__`;
|
|
19
|
+
var additionalModuleRE = new RegExp(ADDITIONAL_MODULE_PATTERN);
|
|
20
|
+
var additionalModuleGlobalRE = new RegExp(
|
|
21
|
+
ADDITIONAL_MODULE_PATTERN,
|
|
22
|
+
"g"
|
|
23
|
+
);
|
|
15
24
|
var VITE_DEV_METADATA_HEADER = "__VITE_DEV_METADATA__";
|
|
16
25
|
|
|
17
26
|
// src/runner-worker/env.ts
|
|
@@ -20,7 +29,7 @@ function stripInternalEnv(internalEnv) {
|
|
|
20
29
|
return userEnv;
|
|
21
30
|
}
|
|
22
31
|
|
|
23
|
-
// ../../node_modules/.pnpm/vite@6.1.0_@types+node@18.19.76_jiti@2.4.2/node_modules/vite/dist/node/module-runner.js
|
|
32
|
+
// ../../node_modules/.pnpm/vite@6.1.0_@types+node@18.19.76_jiti@2.4.2_lightningcss@1.29.2/node_modules/vite/dist/node/module-runner.js
|
|
24
33
|
var VALID_ID_PREFIX = "/@id/";
|
|
25
34
|
var NULL_BYTE_PLACEHOLDER = "__x00__";
|
|
26
35
|
var SOURCEMAPPING_URL = "sourceMa";
|
|
@@ -1385,13 +1394,6 @@ async function createModuleRunner(env, webSocket, viteRoot) {
|
|
|
1385
1394
|
},
|
|
1386
1395
|
{
|
|
1387
1396
|
async runInlinedModule(context, transformed, module) {
|
|
1388
|
-
if (module.file.includes("/node_modules") && !module.file.includes("/node_modules/.vite")) {
|
|
1389
|
-
throw new Error(
|
|
1390
|
-
`[Error] Trying to import non-prebundled module (only prebundled modules are allowed): ${module.id}
|
|
1391
|
-
|
|
1392
|
-
(have you excluded the module via \`optimizeDeps.exclude\`?)`
|
|
1393
|
-
);
|
|
1394
|
-
}
|
|
1395
1397
|
const codeDefinition = `'use strict';async (${Object.keys(context).join(
|
|
1396
1398
|
","
|
|
1397
1399
|
)})=>{{`;
|
|
@@ -1408,13 +1410,14 @@ async function createModuleRunner(env, webSocket, viteRoot) {
|
|
|
1408
1410
|
}
|
|
1409
1411
|
},
|
|
1410
1412
|
async runExternalModule(filepath) {
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1413
|
+
if (filepath === "cloudflare:workers") {
|
|
1414
|
+
const originalCloudflareWorkersModule = await import("cloudflare:workers");
|
|
1415
|
+
return Object.seal({
|
|
1416
|
+
...originalCloudflareWorkersModule,
|
|
1417
|
+
env: stripInternalEnv(
|
|
1418
|
+
originalCloudflareWorkersModule.env
|
|
1419
|
+
)
|
|
1420
|
+
});
|
|
1418
1421
|
}
|
|
1419
1422
|
filepath = filepath.replace(/^file:\/\//, "");
|
|
1420
1423
|
return import(filepath);
|
|
@@ -1432,20 +1435,21 @@ async function getWorkerEntryExport(path, entrypoint) {
|
|
|
1432
1435
|
}
|
|
1433
1436
|
|
|
1434
1437
|
// src/runner-worker/index.ts
|
|
1438
|
+
var IGNORED_KEYS = ["self", "tailStream"];
|
|
1435
1439
|
var WORKER_ENTRYPOINT_KEYS = [
|
|
1436
1440
|
"fetch",
|
|
1441
|
+
"queue",
|
|
1437
1442
|
"tail",
|
|
1443
|
+
"test",
|
|
1438
1444
|
"trace",
|
|
1439
|
-
"scheduled"
|
|
1440
|
-
"queue",
|
|
1441
|
-
"test"
|
|
1445
|
+
"scheduled"
|
|
1442
1446
|
];
|
|
1443
1447
|
var DURABLE_OBJECT_KEYS = [
|
|
1444
|
-
"fetch",
|
|
1445
1448
|
"alarm",
|
|
1446
|
-
"
|
|
1449
|
+
"fetch",
|
|
1447
1450
|
"webSocketClose",
|
|
1448
|
-
"webSocketError"
|
|
1451
|
+
"webSocketError",
|
|
1452
|
+
"webSocketMessage"
|
|
1449
1453
|
];
|
|
1450
1454
|
var WORKFLOW_ENTRYPOINT_KEYS = ["run"];
|
|
1451
1455
|
var entryPath = "";
|
|
@@ -1510,7 +1514,7 @@ function createWorkerEntrypointWrapper(entrypoint) {
|
|
|
1510
1514
|
if (value !== void 0) {
|
|
1511
1515
|
return value;
|
|
1512
1516
|
}
|
|
1513
|
-
if (key === "
|
|
1517
|
+
if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || DURABLE_OBJECT_KEYS.includes(key)) {
|
|
1514
1518
|
return;
|
|
1515
1519
|
}
|
|
1516
1520
|
const property = getWorkerEntrypointRpcProperty.call(
|
|
@@ -1608,7 +1612,7 @@ function createDurableObjectWrapper(className) {
|
|
|
1608
1612
|
if (value !== void 0) {
|
|
1609
1613
|
return value;
|
|
1610
1614
|
}
|
|
1611
|
-
if (key === "
|
|
1615
|
+
if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || WORKER_ENTRYPOINT_KEYS.includes(key)) {
|
|
1612
1616
|
return;
|
|
1613
1617
|
}
|
|
1614
1618
|
const property = getDurableObjectRpcProperty.call(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-82e220e94",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -33,16 +33,19 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@cloudflare/unenv-preset": "1.1.1",
|
|
37
36
|
"@hattip/adapter-node": "^0.0.49",
|
|
37
|
+
"@rollup/plugin-replace": "^6.0.1",
|
|
38
|
+
"get-port": "^7.1.0",
|
|
39
|
+
"picocolors": "^1.1.1",
|
|
38
40
|
"tinyglobby": "^0.2.12",
|
|
39
|
-
"unenv": "2.0.0-rc.
|
|
41
|
+
"unenv": "2.0.0-rc.15",
|
|
40
42
|
"ws": "8.18.0",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
+
"@cloudflare/unenv-preset": "0.0.0-82e220e94",
|
|
44
|
+
"miniflare": "0.0.0-82e220e94",
|
|
45
|
+
"wrangler": "0.0.0-82e220e94"
|
|
43
46
|
},
|
|
44
47
|
"devDependencies": {
|
|
45
|
-
"@cloudflare/workers-types": "^4.
|
|
48
|
+
"@cloudflare/workers-types": "^4.20250428.0",
|
|
46
49
|
"@types/node": "^22.10.1",
|
|
47
50
|
"@types/ws": "^8.5.13",
|
|
48
51
|
"magic-string": "^0.30.12",
|
|
@@ -51,9 +54,9 @@
|
|
|
51
54
|
"typescript": "^5.7.2",
|
|
52
55
|
"undici": "^5.28.5",
|
|
53
56
|
"vite": "^6.1.0",
|
|
54
|
-
"vitest": "~3.
|
|
57
|
+
"vitest": "~3.1.1",
|
|
55
58
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
56
|
-
"@cloudflare/workers-shared": "0.0.0-
|
|
59
|
+
"@cloudflare/workers-shared": "0.0.0-82e220e94",
|
|
57
60
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
58
61
|
},
|
|
59
62
|
"peerDependencies": {
|