@cloudflare/vite-plugin 0.0.5 → 0.0.7

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.
@@ -5,9 +5,13 @@ import {
5
5
  WorkflowEntrypoint
6
6
  } from "cloudflare:workers";
7
7
 
8
+ // src/constants.ts
9
+ var MODULE_TYPES = ["CompiledWasm"];
10
+
8
11
  // src/shared.ts
9
12
  var UNKNOWN_HOST = "http://localhost";
10
13
  var INIT_PATH = "/__vite_plugin_cloudflare_init__";
14
+ var MODULE_PATTERN = `__CLOUDFLARE_MODULE__(${MODULE_TYPES.join("|")})__(.*?)__`;
11
15
 
12
16
  // src/runner-worker/env.ts
13
17
  function stripInternalEnv(internalEnv) {
@@ -1409,7 +1413,8 @@ async function createModuleRunner(env, webSocket) {
1409
1413
  }
1410
1414
  },
1411
1415
  async runExternalModule(filepath) {
1412
- if (filepath.includes("/node_modules") && !filepath.includes("/node_modules/.vite")) {
1416
+ const moduleRE = new RegExp(MODULE_PATTERN);
1417
+ if (!moduleRE.test(filepath) && filepath.includes("/node_modules") && !filepath.includes("/node_modules/.vite")) {
1413
1418
  throw new Error(
1414
1419
  `[Error] Trying to import non-prebundled module (only prebundled modules are allowed): ${filepath}
1415
1420
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/vite-plugin",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Cloudflare plugin for Vite",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -36,19 +36,19 @@
36
36
  "@hattip/adapter-node": "^0.0.49",
37
37
  "unenv": "npm:unenv-nightly@2.0.0-20241218-183400-5d6aec3",
38
38
  "ws": "^8.18.0",
39
- "miniflare": "3.20250124.1"
39
+ "miniflare": "3.20250204.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@cloudflare/workers-types": "^4.20250121.0",
42
+ "@cloudflare/workers-types": "^4.20250204.0",
43
43
  "@types/node": "^22.10.1",
44
44
  "@types/ws": "^8.5.13",
45
45
  "magic-string": "^0.30.12",
46
46
  "tsup": "8.3.0",
47
47
  "typescript": "^5.7.2",
48
48
  "vite": "^6.0.7",
49
- "@cloudflare/workers-shared": "0.13.0",
49
+ "@cloudflare/workers-shared": "0.13.2",
50
50
  "@cloudflare/workers-tsconfig": "0.0.0",
51
- "wrangler": "3.107.0"
51
+ "wrangler": "3.108.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "vite": "^6.0.7",