@cloudflare/vite-plugin 0.1.6 → 0.1.8
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 +18 -12
- package/package.json +5 -5
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.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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": "3.20250214.
|
|
40
|
+
"miniflare": "3.20250214.2"
|
|
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/mock-npm-registry": "0.0.0",
|
|
54
53
|
"@cloudflare/workers-shared": "0.14.4",
|
|
55
|
-
"@cloudflare/
|
|
56
|
-
"wrangler": "3.
|
|
54
|
+
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
55
|
+
"wrangler": "3.112.0",
|
|
56
|
+
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"vite": "^6.1.0",
|