@cloudflare/vite-plugin 0.0.0-dae7bd4dd → 0.0.0-db2cdc6b1

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.
@@ -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@18.19.76_jiti@2.4.2/node_modules/vite/dist/node/module-runner.js
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
  )})=>{{`;
@@ -1417,12 +1411,14 @@ async function createModuleRunner(env, webSocket, viteRoot) {
1417
1411
  }
1418
1412
  },
1419
1413
  async runExternalModule(filepath) {
1420
- if (!additionalModuleRE.test(filepath) && filepath.includes("/node_modules") && !filepath.includes("/node_modules/.vite")) {
1421
- throw new Error(
1422
- `[Error] Trying to import non-prebundled module (only prebundled modules are allowed): ${filepath}
1423
-
1424
- (have you externalized the module via \`resolve.external\`?)`
1425
- );
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
+ });
1426
1422
  }
1427
1423
  filepath = filepath.replace(/^file:\/\//, "");
1428
1424
  return import(filepath);
@@ -1440,20 +1436,21 @@ async function getWorkerEntryExport(path, entrypoint) {
1440
1436
  }
1441
1437
 
1442
1438
  // src/runner-worker/index.ts
1439
+ var IGNORED_KEYS = ["self", "tailStream"];
1443
1440
  var WORKER_ENTRYPOINT_KEYS = [
1444
1441
  "fetch",
1442
+ "queue",
1445
1443
  "tail",
1444
+ "test",
1446
1445
  "trace",
1447
- "scheduled",
1448
- "queue",
1449
- "test"
1446
+ "scheduled"
1450
1447
  ];
1451
1448
  var DURABLE_OBJECT_KEYS = [
1452
- "fetch",
1453
1449
  "alarm",
1454
- "webSocketMessage",
1450
+ "fetch",
1455
1451
  "webSocketClose",
1456
- "webSocketError"
1452
+ "webSocketError",
1453
+ "webSocketMessage"
1457
1454
  ];
1458
1455
  var WORKFLOW_ENTRYPOINT_KEYS = ["run"];
1459
1456
  var entryPath = "";
@@ -1518,7 +1515,7 @@ function createWorkerEntrypointWrapper(entrypoint) {
1518
1515
  if (value !== void 0) {
1519
1516
  return value;
1520
1517
  }
1521
- if (key === "self" || typeof key === "symbol" || DURABLE_OBJECT_KEYS.includes(key)) {
1518
+ if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || DURABLE_OBJECT_KEYS.includes(key)) {
1522
1519
  return;
1523
1520
  }
1524
1521
  const property = getWorkerEntrypointRpcProperty.call(
@@ -1616,7 +1613,7 @@ function createDurableObjectWrapper(className) {
1616
1613
  if (value !== void 0) {
1617
1614
  return value;
1618
1615
  }
1619
- if (key === "self" || typeof key === "symbol" || WORKER_ENTRYPOINT_KEYS.includes(key)) {
1616
+ if (typeof key === "symbol" || IGNORED_KEYS.includes(key) || WORKER_ENTRYPOINT_KEYS.includes(key)) {
1620
1617
  return;
1621
1618
  }
1622
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-dae7bd4dd",
3
+ "version": "0.0.0-db2cdc6b1",
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
- "@hattip/adapter-node": "^0.0.49",
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",
37
41
  "tinyglobby": "^0.2.12",
38
- "unenv": "2.0.0-rc.15",
42
+ "unenv": "2.0.0-rc.17",
39
43
  "ws": "8.18.0",
40
- "@cloudflare/unenv-preset": "0.0.0-dae7bd4dd",
41
- "miniflare": "0.0.0-dae7bd4dd",
42
- "wrangler": "0.0.0-dae7bd4dd"
44
+ "miniflare": "0.0.0-db2cdc6b1",
45
+ "wrangler": "0.0.0-db2cdc6b1"
43
46
  },
44
47
  "devDependencies": {
45
- "@cloudflare/workers-types": "^4.20250319.0",
48
+ "@cloudflare/workers-types": "^4.20250525.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.0.8",
56
+ "vitest": "~3.1.1",
57
+ "@cloudflare/workers-shared": "0.0.0-db2cdc6b1",
55
58
  "@cloudflare/mock-npm-registry": "0.0.0",
56
- "@cloudflare/workers-tsconfig": "0.0.0",
57
- "@cloudflare/workers-shared": "0.0.0-dae7bd4dd"
59
+ "@cloudflare/workers-tsconfig": "0.0.0"
58
60
  },
59
61
  "peerDependencies": {
60
62
  "vite": "^6.1.0",