@cloudflare/vite-plugin 1.8.0 → 1.9.1

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.
@@ -6168,7 +6168,7 @@ var worker_default = {
6168
6168
  dispatchType: "worker" /* WORKER */
6169
6169
  });
6170
6170
  let shouldBlockNonImageResponse = false;
6171
- if (url.pathname === "/_next/image") {
6171
+ if (url.pathname.endsWith("/_next/image")) {
6172
6172
  const queryURLParam = url.searchParams.get("url");
6173
6173
  if (queryURLParam && !queryURLParam.startsWith("/")) {
6174
6174
  if (maybeSecondRequest.method !== "GET" || maybeSecondRequest.headers.get("sec-fetch-dest") !== "image") {
@@ -6179,7 +6179,9 @@ var worker_default = {
6179
6179
  }
6180
6180
  if (shouldBlockNonImageResponse) {
6181
6181
  const resp = await env.USER_WORKER.fetch(maybeSecondRequest);
6182
- if (!resp.headers.get("content-type")?.startsWith("image/") && resp.status !== 304) {
6182
+ const isImage = resp.headers.get("content-type")?.startsWith("image/");
6183
+ const isPlainText = resp.headers.get("content-type") === "text/plain";
6184
+ if (!isImage && !isPlainText && resp.status !== 304) {
6183
6185
  analytics.setData({ abuseMitigationBlocked: true });
6184
6186
  return new Response("Blocked", { status: 403 });
6185
6187
  }
package/dist/index.js CHANGED
@@ -13854,7 +13854,7 @@ async function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer, inspe
13854
13854
  }
13855
13855
  );
13856
13856
  const { externalWorkers: externalWorkers2 } = miniflareWorkerOptions;
13857
- const { ratelimits, ...workerOptions } = miniflareWorkerOptions.workerOptions;
13857
+ const workerOptions = miniflareWorkerOptions.workerOptions;
13858
13858
  return {
13859
13859
  externalWorkers: externalWorkers2,
13860
13860
  worker: {
@@ -14085,7 +14085,7 @@ async function getPreviewMiniflareOptions(resolvedPluginConfig, vitePreviewServe
14085
14085
  }
14086
14086
  );
14087
14087
  const { externalWorkers } = miniflareWorkerOptions;
14088
- const { ratelimits, modulesRules, ...workerOptions } = miniflareWorkerOptions.workerOptions;
14088
+ const { modulesRules, ...workerOptions } = miniflareWorkerOptions.workerOptions;
14089
14089
  logUnknownTails(
14090
14090
  workerOptions.tails,
14091
14091
  resolvedPluginConfig.workers,
@@ -15212,6 +15212,10 @@ function cloudflare2(pluginConfig = {}) {
15212
15212
  enforce: "pre",
15213
15213
  configureServer(viteDevServer) {
15214
15214
  assertIsNotPreview(resolvedPluginConfig);
15215
+ const inVscodeJsDebugTerminal = !!process.env.VSCODE_INSPECTOR_OPTIONS;
15216
+ if (inVscodeJsDebugTerminal) {
15217
+ return;
15218
+ }
15215
15219
  if (resolvedPluginConfig.type === "workers" && pluginConfig.inspectorPort !== false) {
15216
15220
  addDebugToVitePrintUrls(viteDevServer);
15217
15221
  }
@@ -15234,6 +15238,10 @@ function cloudflare2(pluginConfig = {}) {
15234
15238
  },
15235
15239
  async configurePreviewServer(vitePreviewServer) {
15236
15240
  assertIsPreview(resolvedPluginConfig);
15241
+ const inVscodeJsDebugTerminal = !!process.env.VSCODE_INSPECTOR_OPTIONS;
15242
+ if (inVscodeJsDebugTerminal) {
15243
+ return;
15244
+ }
15237
15245
  if (resolvedPluginConfig.workers.length >= 1 && resolvedPluginConfig.inspectorPort !== false) {
15238
15246
  addDebugToVitePrintUrls(vitePreviewServer);
15239
15247
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/vite-plugin",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "Cloudflare plugin for Vite",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -41,11 +41,11 @@
41
41
  "tinyglobby": "^0.2.12",
42
42
  "unenv": "2.0.0-rc.17",
43
43
  "ws": "8.18.0",
44
- "miniflare": "4.20250617.4",
45
- "wrangler": "4.22.0"
44
+ "miniflare": "4.20250705.0",
45
+ "wrangler": "4.24.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@cloudflare/workers-types": "^4.20250617.0",
48
+ "@cloudflare/workers-types": "^4.20250705.0",
49
49
  "@types/node": "^22.10.1",
50
50
  "@types/ws": "^8.5.13",
51
51
  "magic-string": "^0.30.12",
@@ -54,13 +54,13 @@
54
54
  "typescript": "^5.7.2",
55
55
  "vite": "7.0.0",
56
56
  "vitest": "~3.2.0",
57
- "@cloudflare/workers-tsconfig": "0.0.0",
58
- "@cloudflare/workers-shared": "0.18.0",
59
- "@cloudflare/mock-npm-registry": "0.0.0"
57
+ "@cloudflare/mock-npm-registry": "0.0.0",
58
+ "@cloudflare/workers-shared": "0.18.1",
59
+ "@cloudflare/workers-tsconfig": "0.0.0"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "vite": "^6.1.0 || ^7.0.0",
63
- "wrangler": "^3.101.0 || ^4.0.0"
63
+ "wrangler": "4.24.0"
64
64
  },
65
65
  "publishConfig": {
66
66
  "access": "public"