@cloudflare/vite-plugin 0.0.0-c62973b4c → 0.0.0-c8fab4d93
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/asset-workers/asset-worker.js +3 -3
- package/dist/index.js +18 -12
- package/package.json +5 -5
|
@@ -2072,8 +2072,8 @@ var Ve = class {
|
|
|
2072
2072
|
};
|
|
2073
2073
|
var Yn = "public, max-age=0, must-revalidate";
|
|
2074
2074
|
function Jn(t, e, n) {
|
|
2075
|
-
let r = new Headers({
|
|
2076
|
-
return Ds(n) && r.append("Cache-Control", Yn), r;
|
|
2075
|
+
let r = new Headers({ ETag: `"${t}"` });
|
|
2076
|
+
return e !== void 0 && r.append("Content-Type", e), Ds(n) && r.append("Cache-Control", Yn), r;
|
|
2077
2077
|
}
|
|
2078
2078
|
function Ds(t) {
|
|
2079
2079
|
return !t.headers.has("Authorization") && !t.headers.has("Range");
|
|
@@ -2280,7 +2280,7 @@ var Kn = class extends Us {
|
|
|
2280
2280
|
async unstable_getByETag(t) {
|
|
2281
2281
|
let e = await Wn(this.env.ASSETS_KV_NAMESPACE, t);
|
|
2282
2282
|
if (!e || !e.value) throw new Error(`Requested asset ${t} exists in the asset manifest but not in the KV namespace.`);
|
|
2283
|
-
return { readableStream: e.value, contentType: e.metadata?.contentType
|
|
2283
|
+
return { readableStream: e.value, contentType: e.metadata?.contentType };
|
|
2284
2284
|
}
|
|
2285
2285
|
async unstable_getByPathname(t) {
|
|
2286
2286
|
let e = await this.unstable_exists(t);
|
package/dist/index.js
CHANGED
|
@@ -1364,7 +1364,12 @@ import * as fs2 from "node:fs";
|
|
|
1364
1364
|
import * as fsp from "node:fs/promises";
|
|
1365
1365
|
import * as path3 from "node:path";
|
|
1366
1366
|
import { fileURLToPath } from "node:url";
|
|
1367
|
-
import {
|
|
1367
|
+
import {
|
|
1368
|
+
kCurrentWorker,
|
|
1369
|
+
Log,
|
|
1370
|
+
LogLevel,
|
|
1371
|
+
Response as MiniflareResponse
|
|
1372
|
+
} from "miniflare";
|
|
1368
1373
|
import "vite";
|
|
1369
1374
|
import {
|
|
1370
1375
|
unstable_getMiniflareWorkerOptions,
|
|
@@ -1398,11 +1403,10 @@ function getWorkerToWorkerEntrypointNamesMap(workers) {
|
|
|
1398
1403
|
);
|
|
1399
1404
|
for (const worker of workers) {
|
|
1400
1405
|
for (const value of Object.values(worker.serviceBindings ?? {})) {
|
|
1401
|
-
if (typeof value === "object" && "name" in value &&
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1404
|
-
);
|
|
1405
|
-
assert4(entrypointNames, missingWorkerErrorMessage(value.name));
|
|
1406
|
+
if (typeof value === "object" && "name" in value && value.entrypoint !== void 0 && value.entrypoint !== "default") {
|
|
1407
|
+
const targetWorkerName = value.name === kCurrentWorker ? worker.name : value.name;
|
|
1408
|
+
const entrypointNames = workerToWorkerEntrypointNamesMap.get(targetWorkerName);
|
|
1409
|
+
assert4(entrypointNames, missingWorkerErrorMessage(targetWorkerName));
|
|
1406
1410
|
entrypointNames.add(value.entrypoint);
|
|
1407
1411
|
}
|
|
1408
1412
|
}
|
|
@@ -1652,7 +1656,7 @@ function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer) {
|
|
|
1652
1656
|
const workflowEntrypointClassNames = workerToWorkflowEntrypointClassNamesMap.get(workerOptions.name);
|
|
1653
1657
|
assert4(
|
|
1654
1658
|
workflowEntrypointClassNames,
|
|
1655
|
-
`WorkflowEntrypoint class names not found for worker ${workerOptions.name}`
|
|
1659
|
+
`WorkflowEntrypoint class names not found for worker: ${workerOptions.name}`
|
|
1656
1660
|
);
|
|
1657
1661
|
for (const className of [...workflowEntrypointClassNames].sort()) {
|
|
1658
1662
|
wrappers.push(
|
|
@@ -1688,17 +1692,19 @@ function getDevMiniflareOptions(resolvedPluginConfig, viteDevServer) {
|
|
|
1688
1692
|
);
|
|
1689
1693
|
const moduleRE = new RegExp(MODULE_PATTERN);
|
|
1690
1694
|
const match = moduleRE.exec(rawSpecifier);
|
|
1691
|
-
assert4(match, `Unexpected error: no match for module ${rawSpecifier}.`);
|
|
1695
|
+
assert4(match, `Unexpected error: no match for module: ${rawSpecifier}.`);
|
|
1692
1696
|
const [full, moduleType, modulePath] = match;
|
|
1693
1697
|
assert4(
|
|
1694
1698
|
modulePath,
|
|
1695
|
-
`Unexpected error: module path not found in reference ${full}.`
|
|
1699
|
+
`Unexpected error: module path not found in reference: ${full}.`
|
|
1696
1700
|
);
|
|
1697
1701
|
let source;
|
|
1698
1702
|
try {
|
|
1699
1703
|
source = fs2.readFileSync(modulePath);
|
|
1700
1704
|
} catch (error) {
|
|
1701
|
-
throw new Error(
|
|
1705
|
+
throw new Error(
|
|
1706
|
+
`Import "${modulePath}" not found. Does the file exist?`
|
|
1707
|
+
);
|
|
1702
1708
|
}
|
|
1703
1709
|
return MiniflareResponse.json({
|
|
1704
1710
|
// Cap'n Proto expects byte arrays for `:Data` typed fields from JSON
|
|
@@ -9216,7 +9222,7 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
9216
9222
|
}
|
|
9217
9223
|
} : void 0,
|
|
9218
9224
|
builder: {
|
|
9219
|
-
|
|
9225
|
+
buildApp: userConfig.builder?.buildApp ?? (async (builder) => {
|
|
9220
9226
|
const clientEnvironment = builder.environments.client;
|
|
9221
9227
|
const defaultHtmlPath = path7.resolve(
|
|
9222
9228
|
builder.config.root,
|
|
@@ -9242,7 +9248,7 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
9242
9248
|
)
|
|
9243
9249
|
);
|
|
9244
9250
|
}
|
|
9245
|
-
}
|
|
9251
|
+
})
|
|
9246
9252
|
}
|
|
9247
9253
|
};
|
|
9248
9254
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-c8fab4d93",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@hattip/adapter-node": "^0.0.49",
|
|
38
38
|
"unenv": "2.0.0-rc.1",
|
|
39
39
|
"ws": "8.18.0",
|
|
40
|
-
"miniflare": "0.0.0-
|
|
40
|
+
"miniflare": "0.0.0-c8fab4d93"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@cloudflare/workers-types": "^4.20250214.0",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"undici": "^5.28.5",
|
|
51
51
|
"vite": "^6.1.0",
|
|
52
52
|
"vitest": "~3.0.5",
|
|
53
|
+
"@cloudflare/workers-shared": "0.0.0-c8fab4d93",
|
|
53
54
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
54
|
-
"
|
|
55
|
-
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
56
|
-
"wrangler": "0.0.0-c62973b4c"
|
|
55
|
+
"wrangler": "0.0.0-c8fab4d93",
|
|
56
|
+
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"vite": "^6.1.0",
|