@cloudflare/vite-plugin 0.0.0-665ebd857 → 0.0.0-66edd2f3b
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 -540
- package/dist/asset-workers/asset-worker.js +5512 -1967
- package/dist/asset-workers/router-worker.js +4277 -1611
- package/dist/index.d.ts +2 -0
- package/dist/index.js +555 -271
- package/dist/runner-worker/index.js +12 -24
- package/package.json +12 -11
|
@@ -11,11 +11,12 @@ var ADDITIONAL_MODULE_TYPES = [
|
|
|
11
11
|
"Data",
|
|
12
12
|
"Text"
|
|
13
13
|
];
|
|
14
|
+
var kRequestType = Symbol("kRequestType");
|
|
14
15
|
|
|
15
16
|
// src/shared.ts
|
|
16
17
|
var UNKNOWN_HOST = "http://localhost";
|
|
17
18
|
var INIT_PATH = "/__vite_plugin_cloudflare_init__";
|
|
18
|
-
var ADDITIONAL_MODULE_PATTERN = `__CLOUDFLARE_MODULE__(${ADDITIONAL_MODULE_TYPES.join("|")})__(.*?)
|
|
19
|
+
var ADDITIONAL_MODULE_PATTERN = `__CLOUDFLARE_MODULE__(${ADDITIONAL_MODULE_TYPES.join("|")})__(.*?)__CLOUDFLARE_MODULE__`;
|
|
19
20
|
var additionalModuleRE = new RegExp(ADDITIONAL_MODULE_PATTERN);
|
|
20
21
|
var additionalModuleGlobalRE = new RegExp(
|
|
21
22
|
ADDITIONAL_MODULE_PATTERN,
|
|
@@ -29,7 +30,7 @@ function stripInternalEnv(internalEnv) {
|
|
|
29
30
|
return userEnv;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
// ../../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
|
|
33
34
|
var VALID_ID_PREFIX = "/@id/";
|
|
34
35
|
var NULL_BYTE_PLACEHOLDER = "__x00__";
|
|
35
36
|
var SOURCEMAPPING_URL = "sourceMa";
|
|
@@ -1394,13 +1395,6 @@ async function createModuleRunner(env, webSocket, viteRoot) {
|
|
|
1394
1395
|
},
|
|
1395
1396
|
{
|
|
1396
1397
|
async runInlinedModule(context, transformed, module) {
|
|
1397
|
-
if (module.file.includes("/node_modules") && !module.file.includes("/node_modules/.vite")) {
|
|
1398
|
-
throw new Error(
|
|
1399
|
-
`[Error] Trying to import non-prebundled module (only prebundled modules are allowed): ${module.id}
|
|
1400
|
-
|
|
1401
|
-
(have you excluded the module via \`optimizeDeps.exclude\`?)`
|
|
1402
|
-
);
|
|
1403
|
-
}
|
|
1404
1398
|
const codeDefinition = `'use strict';async (${Object.keys(context).join(
|
|
1405
1399
|
","
|
|
1406
1400
|
)})=>{{`;
|
|
@@ -1426,13 +1420,6 @@ async function createModuleRunner(env, webSocket, viteRoot) {
|
|
|
1426
1420
|
)
|
|
1427
1421
|
});
|
|
1428
1422
|
}
|
|
1429
|
-
if (!additionalModuleRE.test(filepath) && filepath.includes("/node_modules") && !filepath.includes("/node_modules/.vite")) {
|
|
1430
|
-
throw new Error(
|
|
1431
|
-
`[Error] Trying to import non-prebundled module (only prebundled modules are allowed): ${filepath}
|
|
1432
|
-
|
|
1433
|
-
(have you externalized the module via \`resolve.external\`?)`
|
|
1434
|
-
);
|
|
1435
|
-
}
|
|
1436
1423
|
filepath = filepath.replace(/^file:\/\//, "");
|
|
1437
1424
|
return import(filepath);
|
|
1438
1425
|
}
|
|
@@ -1449,20 +1436,21 @@ async function getWorkerEntryExport(path, entrypoint) {
|
|
|
1449
1436
|
}
|
|
1450
1437
|
|
|
1451
1438
|
// src/runner-worker/index.ts
|
|
1439
|
+
var IGNORED_KEYS = ["self", "tailStream"];
|
|
1452
1440
|
var WORKER_ENTRYPOINT_KEYS = [
|
|
1453
1441
|
"fetch",
|
|
1442
|
+
"queue",
|
|
1454
1443
|
"tail",
|
|
1444
|
+
"test",
|
|
1455
1445
|
"trace",
|
|
1456
|
-
"scheduled"
|
|
1457
|
-
"queue",
|
|
1458
|
-
"test"
|
|
1446
|
+
"scheduled"
|
|
1459
1447
|
];
|
|
1460
1448
|
var DURABLE_OBJECT_KEYS = [
|
|
1461
|
-
"fetch",
|
|
1462
1449
|
"alarm",
|
|
1463
|
-
"
|
|
1450
|
+
"fetch",
|
|
1464
1451
|
"webSocketClose",
|
|
1465
|
-
"webSocketError"
|
|
1452
|
+
"webSocketError",
|
|
1453
|
+
"webSocketMessage"
|
|
1466
1454
|
];
|
|
1467
1455
|
var WORKFLOW_ENTRYPOINT_KEYS = ["run"];
|
|
1468
1456
|
var entryPath = "";
|
|
@@ -1527,7 +1515,7 @@ function createWorkerEntrypointWrapper(entrypoint) {
|
|
|
1527
1515
|
if (value !== void 0) {
|
|
1528
1516
|
return value;
|
|
1529
1517
|
}
|
|
1530
|
-
if (key === "
|
|
1518
|
+
if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || DURABLE_OBJECT_KEYS.includes(key)) {
|
|
1531
1519
|
return;
|
|
1532
1520
|
}
|
|
1533
1521
|
const property = getWorkerEntrypointRpcProperty.call(
|
|
@@ -1625,7 +1613,7 @@ function createDurableObjectWrapper(className) {
|
|
|
1625
1613
|
if (value !== void 0) {
|
|
1626
1614
|
return value;
|
|
1627
1615
|
}
|
|
1628
|
-
if (key === "
|
|
1616
|
+
if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || WORKER_ENTRYPOINT_KEYS.includes(key)) {
|
|
1629
1617
|
return;
|
|
1630
1618
|
}
|
|
1631
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-66edd2f3b",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -33,29 +33,30 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@
|
|
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",
|
|
37
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
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"wrangler": "0.0.0-665ebd857"
|
|
44
|
+
"miniflare": "0.0.0-66edd2f3b",
|
|
45
|
+
"wrangler": "0.0.0-66edd2f3b"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
|
-
"@cloudflare/workers-types": "^4.
|
|
48
|
+
"@cloudflare/workers-types": "^4.20250604.0",
|
|
47
49
|
"@types/node": "^22.10.1",
|
|
48
50
|
"@types/ws": "^8.5.13",
|
|
49
51
|
"magic-string": "^0.30.12",
|
|
50
52
|
"mlly": "^1.7.4",
|
|
51
53
|
"tsup": "8.3.0",
|
|
52
54
|
"typescript": "^5.7.2",
|
|
53
|
-
"undici": "^5.28.5",
|
|
54
55
|
"vite": "^6.1.0",
|
|
55
|
-
"vitest": "~3.
|
|
56
|
+
"vitest": "~3.1.1",
|
|
56
57
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
57
|
-
"@cloudflare/workers-
|
|
58
|
-
"@cloudflare/workers-
|
|
58
|
+
"@cloudflare/workers-shared": "0.0.0-66edd2f3b",
|
|
59
|
+
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
62
|
"vite": "^6.1.0",
|