@cloudflare/vite-plugin 0.0.0-349cffcd5 → 0.0.0-34c71ce92

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/dist/index.js CHANGED
@@ -1589,7 +1589,7 @@ function matchAdditionalModule(source) {
1589
1589
  return null;
1590
1590
  }
1591
1591
  function createModuleReference(type, id) {
1592
- return `__CLOUDFLARE_MODULE__${type}__${id}__`;
1592
+ return `__CLOUDFLARE_MODULE__${type}__${id}__CLOUDFLARE_MODULE__`;
1593
1593
  }
1594
1594
 
1595
1595
  // src/asset-config.ts
@@ -5787,8 +5787,14 @@ var InternalConfigSchema = z.object({
5787
5787
  script_id: z.number().optional(),
5788
5788
  debug: z.boolean().optional()
5789
5789
  });
5790
+ var StaticRoutingSchema = z.object({
5791
+ version: z.literal(1),
5792
+ include: z.array(z.string()),
5793
+ exclude: z.array(z.string()).optional()
5794
+ });
5790
5795
  var RouterConfigSchema = z.object({
5791
5796
  invoke_user_worker_ahead_of_assets: z.boolean().optional(),
5797
+ static_routing: StaticRoutingSchema.optional(),
5792
5798
  has_user_worker: z.boolean().optional(),
5793
5799
  ...InternalConfigSchema.shape
5794
5800
  });
@@ -5829,6 +5835,7 @@ var AssetConfigSchema = z.object({
5829
5835
  not_found_handling: z.enum(["single-page-application", "404-page", "none"]).optional(),
5830
5836
  redirects: RedirectsSchema,
5831
5837
  headers: HeadersSchema,
5838
+ has_static_routing: z.boolean().optional(),
5832
5839
  ...InternalConfigSchema.shape
5833
5840
  });
5834
5841
 
@@ -12993,7 +13000,7 @@ var NodeJsCompatWarnings = class {
12993
13000
  // src/shared.ts
12994
13001
  var UNKNOWN_HOST = "http://localhost";
12995
13002
  var INIT_PATH = "/__vite_plugin_cloudflare_init__";
12996
- var ADDITIONAL_MODULE_PATTERN = `__CLOUDFLARE_MODULE__(${ADDITIONAL_MODULE_TYPES.join("|")})__(.*?)__`;
13003
+ var ADDITIONAL_MODULE_PATTERN = `__CLOUDFLARE_MODULE__(${ADDITIONAL_MODULE_TYPES.join("|")})__(.*?)__CLOUDFLARE_MODULE__`;
12997
13004
  var additionalModuleRE = new RegExp(ADDITIONAL_MODULE_PATTERN);
12998
13005
  var additionalModuleGlobalRE = new RegExp(
12999
13006
  ADDITIONAL_MODULE_PATTERN,
@@ -13029,19 +13036,6 @@ function toMiniflareRequest(request) {
13029
13036
  duplex: "half"
13030
13037
  });
13031
13038
  }
13032
- function nodeHeadersToWebHeaders(nodeHeaders) {
13033
- const headers = new Headers();
13034
- for (const [key, value] of Object.entries(nodeHeaders)) {
13035
- if (typeof value === "string") {
13036
- headers.append(key, value);
13037
- } else if (Array.isArray(value)) {
13038
- for (const item of value) {
13039
- headers.append(key, item);
13040
- }
13041
- }
13042
- }
13043
- return headers;
13044
- }
13045
13039
  var postfixRE = /[?#].*$/;
13046
13040
  function cleanUrl(url) {
13047
13041
  return url.replace(postfixRE, "");
@@ -13359,9 +13353,9 @@ import colors2 from "picocolors";
13359
13353
  import { globSync } from "tinyglobby";
13360
13354
  import "vite";
13361
13355
  import { unstable_getMiniflareWorkerOptions } from "wrangler";
13362
- function getPersistence(root, persistState) {
13356
+ function getPersistenceRoot(root, persistState) {
13363
13357
  if (persistState === false) {
13364
- return {};
13358
+ return;
13365
13359
  }
13366
13360
  const defaultPersistPath = ".wrangler/state";
13367
13361
  const persistPath = path6.resolve(
@@ -13369,14 +13363,7 @@ function getPersistence(root, persistState) {
13369
13363
  typeof persistState === "object" ? persistState.path : defaultPersistPath,
13370
13364
  "v3"
13371
13365
  );
13372
- return {
13373
- cachePersist: path6.join(persistPath, "cache"),
13374
- d1Persist: path6.join(persistPath, "d1"),
13375
- durableObjectsPersist: path6.join(persistPath, "do"),
13376
- kvPersist: path6.join(persistPath, "kv"),
13377
- r2Persist: path6.join(persistPath, "r2"),
13378
- workflowsPersist: path6.join(persistPath, "workflows")
13379
- };
13366
+ return persistPath;
13380
13367
  }
13381
13368
  function missingWorkerErrorMessage(workerName) {
13382
13369
  return `${workerName} does not match a worker name.`;
@@ -13626,7 +13613,7 @@ function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer, inspectorPo
13626
13613
  (error) => logger.logWithLevel(LogLevel.ERROR, decoder.decode(error))
13627
13614
  );
13628
13615
  },
13629
- ...getPersistence(
13616
+ defaultPersistRoot: getPersistenceRoot(
13630
13617
  resolvedViteConfig.root,
13631
13618
  resolvedPluginConfig.persistState
13632
13619
  ),
@@ -13793,7 +13780,10 @@ function getPreviewMiniflareOptions(vitePreviewServer, workerConfigs, persistSta
13793
13780
  (error) => logger.logWithLevel(LogLevel.ERROR, decoder.decode(error))
13794
13781
  );
13795
13782
  },
13796
- ...getPersistence(resolvedViteConfig.root, persistState),
13783
+ defaultPersistRoot: getPersistenceRoot(
13784
+ resolvedViteConfig.root,
13785
+ persistState
13786
+ ),
13797
13787
  workers
13798
13788
  };
13799
13789
  }
@@ -14182,6 +14172,7 @@ function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
14182
14172
  }
14183
14173
 
14184
14174
  // src/websockets.ts
14175
+ import { createHeaders } from "@mjackson/node-fetch-server";
14185
14176
  import { coupleWebSocket } from "miniflare";
14186
14177
  import { WebSocketServer } from "ws";
14187
14178
  function handleWebSocket(httpServer, getFetcher) {
@@ -14193,7 +14184,7 @@ function handleWebSocket(httpServer, getFetcher) {
14193
14184
  if (request.headers["sec-websocket-protocol"]?.startsWith("vite")) {
14194
14185
  return;
14195
14186
  }
14196
- const headers = nodeHeadersToWebHeaders(request.headers);
14187
+ const headers = createHeaders(request);
14197
14188
  const fetcher = await getFetcher();
14198
14189
  const response = await fetcher(url, {
14199
14190
  headers,
@@ -15,7 +15,7 @@ var ADDITIONAL_MODULE_TYPES = [
15
15
  // src/shared.ts
16
16
  var UNKNOWN_HOST = "http://localhost";
17
17
  var INIT_PATH = "/__vite_plugin_cloudflare_init__";
18
- var ADDITIONAL_MODULE_PATTERN = `__CLOUDFLARE_MODULE__(${ADDITIONAL_MODULE_TYPES.join("|")})__(.*?)__`;
18
+ var ADDITIONAL_MODULE_PATTERN = `__CLOUDFLARE_MODULE__(${ADDITIONAL_MODULE_TYPES.join("|")})__(.*?)__CLOUDFLARE_MODULE__`;
19
19
  var additionalModuleRE = new RegExp(ADDITIONAL_MODULE_PATTERN);
20
20
  var additionalModuleGlobalRE = new RegExp(
21
21
  ADDITIONAL_MODULE_PATTERN,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/vite-plugin",
3
- "version": "0.0.0-349cffcd5",
3
+ "version": "0.0.0-34c71ce92",
4
4
  "description": "Cloudflare plugin for Vite",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -33,19 +33,19 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
+ "@cloudflare/unenv-preset": "2.3.2",
36
37
  "@mjackson/node-fetch-server": "^0.6.1",
37
38
  "@rollup/plugin-replace": "^6.0.1",
38
39
  "get-port": "^7.1.0",
39
40
  "picocolors": "^1.1.1",
40
41
  "tinyglobby": "^0.2.12",
41
- "unenv": "2.0.0-rc.15",
42
+ "unenv": "2.0.0-rc.17",
42
43
  "ws": "8.18.0",
43
- "@cloudflare/unenv-preset": "0.0.0-349cffcd5",
44
- "miniflare": "0.0.0-349cffcd5",
45
- "wrangler": "0.0.0-349cffcd5"
44
+ "miniflare": "0.0.0-34c71ce92",
45
+ "wrangler": "0.0.0-34c71ce92"
46
46
  },
47
47
  "devDependencies": {
48
- "@cloudflare/workers-types": "^4.20250508.0",
48
+ "@cloudflare/workers-types": "^4.20250523.0",
49
49
  "@types/node": "^22.10.1",
50
50
  "@types/ws": "^8.5.13",
51
51
  "magic-string": "^0.30.12",
@@ -55,9 +55,9 @@
55
55
  "undici": "^5.28.5",
56
56
  "vite": "^6.1.0",
57
57
  "vitest": "~3.1.1",
58
- "@cloudflare/workers-tsconfig": "0.0.0",
59
58
  "@cloudflare/mock-npm-registry": "0.0.0",
60
- "@cloudflare/workers-shared": "0.0.0-349cffcd5"
59
+ "@cloudflare/workers-shared": "0.0.0-34c71ce92",
60
+ "@cloudflare/workers-tsconfig": "0.0.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "vite": "^6.1.0",