@cloudflare/vite-plugin 0.0.0-9adbd50cf → 0.0.0-9b66c33e4
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 +5527 -1946
- package/dist/asset-workers/router-worker.js +4277 -1611
- package/dist/index.d.ts +8 -1
- package/dist/index.js +6021 -595
- package/dist/runner-worker/index.js +30 -25
- package/package.json +12 -10
|
@@ -6,12 +6,22 @@ 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
|
+
];
|
|
14
|
+
var kRequestType = Symbol("kRequestType");
|
|
10
15
|
|
|
11
16
|
// src/shared.ts
|
|
12
17
|
var UNKNOWN_HOST = "http://localhost";
|
|
13
18
|
var INIT_PATH = "/__vite_plugin_cloudflare_init__";
|
|
14
|
-
var
|
|
19
|
+
var ADDITIONAL_MODULE_PATTERN = `__CLOUDFLARE_MODULE__(${ADDITIONAL_MODULE_TYPES.join("|")})__(.*?)__CLOUDFLARE_MODULE__`;
|
|
20
|
+
var additionalModuleRE = new RegExp(ADDITIONAL_MODULE_PATTERN);
|
|
21
|
+
var additionalModuleGlobalRE = new RegExp(
|
|
22
|
+
ADDITIONAL_MODULE_PATTERN,
|
|
23
|
+
"g"
|
|
24
|
+
);
|
|
15
25
|
var VITE_DEV_METADATA_HEADER = "__VITE_DEV_METADATA__";
|
|
16
26
|
|
|
17
27
|
// src/runner-worker/env.ts
|
|
@@ -20,7 +30,7 @@ function stripInternalEnv(internalEnv) {
|
|
|
20
30
|
return userEnv;
|
|
21
31
|
}
|
|
22
32
|
|
|
23
|
-
// ../../node_modules/.pnpm/vite@6.1.0_@types+node@
|
|
33
|
+
// ../../node_modules/.pnpm/vite@6.1.0_@types+node@20.17.32_jiti@2.4.2_lightningcss@1.29.2/node_modules/vite/dist/node/module-runner.js
|
|
24
34
|
var VALID_ID_PREFIX = "/@id/";
|
|
25
35
|
var NULL_BYTE_PLACEHOLDER = "__x00__";
|
|
26
36
|
var SOURCEMAPPING_URL = "sourceMa";
|
|
@@ -1385,13 +1395,6 @@ async function createModuleRunner(env, webSocket, viteRoot) {
|
|
|
1385
1395
|
},
|
|
1386
1396
|
{
|
|
1387
1397
|
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
1398
|
const codeDefinition = `'use strict';async (${Object.keys(context).join(
|
|
1396
1399
|
","
|
|
1397
1400
|
)})=>{{`;
|
|
@@ -1408,13 +1411,14 @@ async function createModuleRunner(env, webSocket, viteRoot) {
|
|
|
1408
1411
|
}
|
|
1409
1412
|
},
|
|
1410
1413
|
async runExternalModule(filepath) {
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1414
|
+
if (filepath === "cloudflare:workers") {
|
|
1415
|
+
const originalCloudflareWorkersModule = await import("cloudflare:workers");
|
|
1416
|
+
return Object.seal({
|
|
1417
|
+
...originalCloudflareWorkersModule,
|
|
1418
|
+
env: stripInternalEnv(
|
|
1419
|
+
originalCloudflareWorkersModule.env
|
|
1420
|
+
)
|
|
1421
|
+
});
|
|
1418
1422
|
}
|
|
1419
1423
|
filepath = filepath.replace(/^file:\/\//, "");
|
|
1420
1424
|
return import(filepath);
|
|
@@ -1432,20 +1436,21 @@ async function getWorkerEntryExport(path, entrypoint) {
|
|
|
1432
1436
|
}
|
|
1433
1437
|
|
|
1434
1438
|
// src/runner-worker/index.ts
|
|
1439
|
+
var IGNORED_KEYS = ["self", "tailStream"];
|
|
1435
1440
|
var WORKER_ENTRYPOINT_KEYS = [
|
|
1436
1441
|
"fetch",
|
|
1442
|
+
"queue",
|
|
1437
1443
|
"tail",
|
|
1444
|
+
"test",
|
|
1438
1445
|
"trace",
|
|
1439
|
-
"scheduled"
|
|
1440
|
-
"queue",
|
|
1441
|
-
"test"
|
|
1446
|
+
"scheduled"
|
|
1442
1447
|
];
|
|
1443
1448
|
var DURABLE_OBJECT_KEYS = [
|
|
1444
|
-
"fetch",
|
|
1445
1449
|
"alarm",
|
|
1446
|
-
"
|
|
1450
|
+
"fetch",
|
|
1447
1451
|
"webSocketClose",
|
|
1448
|
-
"webSocketError"
|
|
1452
|
+
"webSocketError",
|
|
1453
|
+
"webSocketMessage"
|
|
1449
1454
|
];
|
|
1450
1455
|
var WORKFLOW_ENTRYPOINT_KEYS = ["run"];
|
|
1451
1456
|
var entryPath = "";
|
|
@@ -1510,7 +1515,7 @@ function createWorkerEntrypointWrapper(entrypoint) {
|
|
|
1510
1515
|
if (value !== void 0) {
|
|
1511
1516
|
return value;
|
|
1512
1517
|
}
|
|
1513
|
-
if (key === "
|
|
1518
|
+
if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || DURABLE_OBJECT_KEYS.includes(key)) {
|
|
1514
1519
|
return;
|
|
1515
1520
|
}
|
|
1516
1521
|
const property = getWorkerEntrypointRpcProperty.call(
|
|
@@ -1608,7 +1613,7 @@ function createDurableObjectWrapper(className) {
|
|
|
1608
1613
|
if (value !== void 0) {
|
|
1609
1614
|
return value;
|
|
1610
1615
|
}
|
|
1611
|
-
if (key === "
|
|
1616
|
+
if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || WORKER_ENTRYPOINT_KEYS.includes(key)) {
|
|
1612
1617
|
return;
|
|
1613
1618
|
}
|
|
1614
1619
|
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-9b66c33e4",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -33,28 +33,30 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@cloudflare/unenv-preset": "
|
|
37
|
-
"@
|
|
36
|
+
"@cloudflare/unenv-preset": "2.3.2",
|
|
37
|
+
"@mjackson/node-fetch-server": "^0.6.1",
|
|
38
|
+
"@rollup/plugin-replace": "^6.0.1",
|
|
39
|
+
"get-port": "^7.1.0",
|
|
40
|
+
"picocolors": "^1.1.1",
|
|
38
41
|
"tinyglobby": "^0.2.12",
|
|
39
|
-
"unenv": "2.0.0-rc.
|
|
42
|
+
"unenv": "2.0.0-rc.17",
|
|
40
43
|
"ws": "8.18.0",
|
|
41
|
-
"miniflare": "0.0.0-
|
|
42
|
-
"wrangler": "0.0.0-
|
|
44
|
+
"miniflare": "0.0.0-9b66c33e4",
|
|
45
|
+
"wrangler": "0.0.0-9b66c33e4"
|
|
43
46
|
},
|
|
44
47
|
"devDependencies": {
|
|
45
|
-
"@cloudflare/workers-types": "^4.
|
|
48
|
+
"@cloudflare/workers-types": "^4.20250604.0",
|
|
46
49
|
"@types/node": "^22.10.1",
|
|
47
50
|
"@types/ws": "^8.5.13",
|
|
48
51
|
"magic-string": "^0.30.12",
|
|
49
52
|
"mlly": "^1.7.4",
|
|
50
53
|
"tsup": "8.3.0",
|
|
51
54
|
"typescript": "^5.7.2",
|
|
52
|
-
"undici": "^5.28.5",
|
|
53
55
|
"vite": "^6.1.0",
|
|
54
|
-
"vitest": "~3.
|
|
56
|
+
"vitest": "~3.1.1",
|
|
55
57
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
56
58
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
57
|
-
"@cloudflare/workers-shared": "0.0.0-
|
|
59
|
+
"@cloudflare/workers-shared": "0.0.0-9b66c33e4"
|
|
58
60
|
},
|
|
59
61
|
"peerDependencies": {
|
|
60
62
|
"vite": "^6.1.0",
|