@cloudflare/vite-plugin 0.1.14 → 0.1.15
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.
|
@@ -2487,6 +2487,13 @@ var CustomAssetWorker = class extends fr {
|
|
|
2487
2487
|
const exists = await response.json();
|
|
2488
2488
|
return exists ? pathname : null;
|
|
2489
2489
|
}
|
|
2490
|
+
async unstable_canFetch(request) {
|
|
2491
|
+
const secFetchMode = request.headers.get("X-Mf-Sec-Fetch-Mode");
|
|
2492
|
+
if (secFetchMode) {
|
|
2493
|
+
request.headers.set("Sec-Fetch-Mode", secFetchMode);
|
|
2494
|
+
}
|
|
2495
|
+
return await super.unstable_canFetch(request);
|
|
2496
|
+
}
|
|
2490
2497
|
};
|
|
2491
2498
|
export {
|
|
2492
2499
|
CustomAssetWorker as default
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8155,6 +8155,10 @@ function getRouterWorker(miniflare) {
|
|
|
8155
8155
|
return miniflare.getWorker(ROUTER_WORKER_NAME);
|
|
8156
8156
|
}
|
|
8157
8157
|
function toMiniflareRequest(request) {
|
|
8158
|
+
const secFetchMode = request.headers.get("Sec-Fetch-Mode");
|
|
8159
|
+
if (secFetchMode) {
|
|
8160
|
+
request.headers.set("X-Mf-Sec-Fetch-Mode", secFetchMode);
|
|
8161
|
+
}
|
|
8158
8162
|
return new MiniflareRequest(request.url, {
|
|
8159
8163
|
method: request.method,
|
|
8160
8164
|
headers: [["accept-encoding", "identity"], ...request.headers],
|
|
@@ -8595,6 +8599,13 @@ function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer) {
|
|
|
8595
8599
|
const resolvedViteConfig = viteDevServer.config;
|
|
8596
8600
|
const entryWorkerConfig = getEntryWorkerConfig(resolvedPluginConfig);
|
|
8597
8601
|
const assetsConfig = resolvedPluginConfig.type === "assets-only" ? resolvedPluginConfig.config.assets : entryWorkerConfig?.assets;
|
|
8602
|
+
const compatibilityOptions = resolvedPluginConfig.type === "assets-only" ? {
|
|
8603
|
+
compatibility_date: resolvedPluginConfig.config.compatibility_date,
|
|
8604
|
+
compatibility_flags: resolvedPluginConfig.config.compatibility_flags
|
|
8605
|
+
} : {
|
|
8606
|
+
...entryWorkerConfig?.compatibility_date ? { compatibility_date: entryWorkerConfig?.compatibility_date } : {},
|
|
8607
|
+
...entryWorkerConfig?.compatibility_flags ? { compatibility_flags: entryWorkerConfig?.compatibility_flags } : {}
|
|
8608
|
+
};
|
|
8598
8609
|
const assetWorkers = [
|
|
8599
8610
|
{
|
|
8600
8611
|
name: ROUTER_WORKER_NAME,
|
|
@@ -8634,6 +8645,7 @@ function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer) {
|
|
|
8634
8645
|
],
|
|
8635
8646
|
bindings: {
|
|
8636
8647
|
CONFIG: {
|
|
8648
|
+
...compatibilityOptions,
|
|
8637
8649
|
...assetsConfig?.html_handling ? { html_handling: assetsConfig.html_handling } : {},
|
|
8638
8650
|
...assetsConfig?.not_found_handling ? { not_found_handling: assetsConfig.not_found_handling } : {}
|
|
8639
8651
|
}
|
|
@@ -1417,6 +1417,15 @@ async function createModuleRunner(env, webSocket, viteRoot) {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
},
|
|
1419
1419
|
async runExternalModule(filepath) {
|
|
1420
|
+
if (filepath === "cloudflare:workers") {
|
|
1421
|
+
const originalCloudflareWorkersModule = await import("cloudflare:workers");
|
|
1422
|
+
return Object.seal({
|
|
1423
|
+
...originalCloudflareWorkersModule,
|
|
1424
|
+
env: stripInternalEnv(
|
|
1425
|
+
originalCloudflareWorkersModule.env
|
|
1426
|
+
)
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1420
1429
|
if (!additionalModuleRE.test(filepath) && filepath.includes("/node_modules") && !filepath.includes("/node_modules/.vite")) {
|
|
1421
1430
|
throw new Error(
|
|
1422
1431
|
`[Error] Trying to import non-prebundled module (only prebundled modules are allowed): ${filepath}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"unenv": "2.0.0-rc.15",
|
|
40
40
|
"ws": "8.18.0",
|
|
41
41
|
"@cloudflare/unenv-preset": "2.3.0",
|
|
42
|
-
"miniflare": "4.
|
|
43
|
-
"wrangler": "4.
|
|
42
|
+
"miniflare": "4.20250320.0",
|
|
43
|
+
"wrangler": "4.4.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@cloudflare/workers-types": "^4.
|
|
46
|
+
"@cloudflare/workers-types": "^4.20250320.0",
|
|
47
47
|
"@types/node": "^22.10.1",
|
|
48
48
|
"@types/ws": "^8.5.13",
|
|
49
49
|
"magic-string": "^0.30.12",
|