@cloudflare/vite-plugin 1.0.0 → 1.0.2
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 +16 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -490,6 +490,7 @@ import * as fs5 from "node:fs";
|
|
|
490
490
|
import * as fsp2 from "node:fs/promises";
|
|
491
491
|
import * as path9 from "node:path";
|
|
492
492
|
import { createMiddleware } from "@hattip/adapter-node";
|
|
493
|
+
import replace from "@rollup/plugin-replace";
|
|
493
494
|
|
|
494
495
|
// ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
495
496
|
var comma = ",".charCodeAt(0);
|
|
@@ -14598,6 +14599,18 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14598
14599
|
configEnvironment(name) {
|
|
14599
14600
|
if (isNodeCompat(getWorkerConfig2(name))) {
|
|
14600
14601
|
return {
|
|
14602
|
+
build: {
|
|
14603
|
+
rollupOptions: {
|
|
14604
|
+
plugins: [
|
|
14605
|
+
replace({
|
|
14606
|
+
"process.env.NODE_ENV": JSON.stringify(
|
|
14607
|
+
process.env.NODE_ENV ?? "production"
|
|
14608
|
+
),
|
|
14609
|
+
preventAssignment: true
|
|
14610
|
+
})
|
|
14611
|
+
]
|
|
14612
|
+
}
|
|
14613
|
+
},
|
|
14601
14614
|
resolve: {
|
|
14602
14615
|
builtins: [...nodeCompatExternals]
|
|
14603
14616
|
},
|
|
@@ -14639,7 +14652,9 @@ function cloudflare2(pluginConfig = {}) {
|
|
|
14639
14652
|
},
|
|
14640
14653
|
async transform(code, id) {
|
|
14641
14654
|
const workerConfig = getWorkerConfig2(this.environment.name);
|
|
14642
|
-
|
|
14655
|
+
if (!workerConfig) {
|
|
14656
|
+
return;
|
|
14657
|
+
}
|
|
14643
14658
|
const resolvedId = await this.resolve(workerConfig.main);
|
|
14644
14659
|
if (id === resolvedId?.id) {
|
|
14645
14660
|
return injectGlobalCode(id, code);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/vite-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Cloudflare plugin for Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -34,17 +34,18 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@hattip/adapter-node": "^0.0.49",
|
|
37
|
+
"@rollup/plugin-replace": "^6.0.1",
|
|
37
38
|
"get-port": "^7.1.0",
|
|
38
39
|
"picocolors": "^1.1.1",
|
|
39
40
|
"tinyglobby": "^0.2.12",
|
|
40
41
|
"unenv": "2.0.0-rc.15",
|
|
41
42
|
"ws": "8.18.0",
|
|
42
43
|
"@cloudflare/unenv-preset": "2.3.1",
|
|
43
|
-
"miniflare": "4.
|
|
44
|
-
"wrangler": "4.
|
|
44
|
+
"miniflare": "4.20250405.1",
|
|
45
|
+
"wrangler": "4.9.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@cloudflare/workers-types": "^4.
|
|
48
|
+
"@cloudflare/workers-types": "^4.20250405.0",
|
|
48
49
|
"@types/node": "^22.10.1",
|
|
49
50
|
"@types/ws": "^8.5.13",
|
|
50
51
|
"magic-string": "^0.30.12",
|