@pithy-sh/vite 0.6.1 → 0.7.0
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/plugin.d.ts +9 -2
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +2 -2
- package/src/plugin.ts +10 -3
package/dist/plugin.d.ts
CHANGED
|
@@ -89,8 +89,15 @@ export interface PithyPluginOptions {
|
|
|
89
89
|
configFile?: string;
|
|
90
90
|
/**
|
|
91
91
|
* The environment this bundle is built for. Defaults to `ENVIRONMENT` in the process env, then
|
|
92
|
-
* `dev`. `pithy deploy --env <name>` is what threads a real value in, so a
|
|
93
|
-
* production's projection and a dev bundle sees dev's.
|
|
92
|
+
* `CLOUDFLARE_ENV`, then `dev`. `pithy deploy --env <name>` is what threads a real value in, so a
|
|
93
|
+
* production bundle sees production's projection and a dev bundle sees dev's.
|
|
94
|
+
*
|
|
95
|
+
* **`CLOUDFLARE_ENV` is in that chain because it is the name Cloudflare's own tooling uses (#579).**
|
|
96
|
+
* It is what `@cloudflare/vite-plugin` reads to select the wrangler stanza, so a hand-run
|
|
97
|
+
* `CLOUDFLARE_ENV=staging vite build` — the Cloudflare-native spelling, and what CI reaches for —
|
|
98
|
+
* produced staging's Worker config and this plugin's **dev** projections, silently. That is the same
|
|
99
|
+
* class of miss as the deploy defect itself: one environment, two names, and only one of them read.
|
|
100
|
+
* `ENVIRONMENT` stays first, so nothing that already sets it changes behavior.
|
|
94
101
|
*/
|
|
95
102
|
environment?: string;
|
|
96
103
|
}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,WAAW,WAAW;IAC1B,mGAAmG;IACnG,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,EAAE,KAAK,CAAC;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,YAAI,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,CAAU,CAAC;AAEnH,yDAAyD;AACzD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,+FAA+F;AAC/F,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,WAAW,WAAW;IAC1B,mGAAmG;IACnG,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,EAAE,KAAK,CAAC;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,YAAI,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,CAAU,CAAC;AAEnH,yDAAyD;AACzD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,+FAA+F;AAC/F,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,OAAO,GAAE,kBAAuB,GAAG,WAAW,CA4FnE"}
|
package/dist/plugin.js
CHANGED
|
@@ -37,7 +37,7 @@ const PITHY_PLUGIN_HOOKS = [
|
|
|
37
37
|
* heard of: a screen branches on `enabled`, it does not guard on whether the module exists.
|
|
38
38
|
*/
|
|
39
39
|
function pithy(options = {}) {
|
|
40
|
-
const environment = options.environment ?? process.env.ENVIRONMENT ?? "dev";
|
|
40
|
+
const environment = options.environment ?? process.env.ENVIRONMENT ?? process.env.CLOUDFLARE_ENV ?? "dev";
|
|
41
41
|
let configFile = "";
|
|
42
42
|
let loading = null;
|
|
43
43
|
let server;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pithy-sh/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"reset": "bun run clean && rm -rf node_modules"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@pithy-sh/core": "^0.
|
|
36
|
+
"@pithy-sh/core": "^0.7.0",
|
|
37
37
|
"vite": "^6.1.0 || ^7.0.0 || ^8.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
package/src/plugin.ts
CHANGED
|
@@ -104,8 +104,15 @@ export interface PithyPluginOptions {
|
|
|
104
104
|
configFile?: string;
|
|
105
105
|
/**
|
|
106
106
|
* The environment this bundle is built for. Defaults to `ENVIRONMENT` in the process env, then
|
|
107
|
-
* `dev`. `pithy deploy --env <name>` is what threads a real value in, so a
|
|
108
|
-
* production's projection and a dev bundle sees dev's.
|
|
107
|
+
* `CLOUDFLARE_ENV`, then `dev`. `pithy deploy --env <name>` is what threads a real value in, so a
|
|
108
|
+
* production bundle sees production's projection and a dev bundle sees dev's.
|
|
109
|
+
*
|
|
110
|
+
* **`CLOUDFLARE_ENV` is in that chain because it is the name Cloudflare's own tooling uses (#579).**
|
|
111
|
+
* It is what `@cloudflare/vite-plugin` reads to select the wrangler stanza, so a hand-run
|
|
112
|
+
* `CLOUDFLARE_ENV=staging vite build` — the Cloudflare-native spelling, and what CI reaches for —
|
|
113
|
+
* produced staging's Worker config and this plugin's **dev** projections, silently. That is the same
|
|
114
|
+
* class of miss as the deploy defect itself: one environment, two names, and only one of them read.
|
|
115
|
+
* `ENVIRONMENT` stays first, so nothing that already sets it changes behavior.
|
|
109
116
|
*/
|
|
110
117
|
environment?: string;
|
|
111
118
|
}
|
|
@@ -120,7 +127,7 @@ export interface PithyPluginOptions {
|
|
|
120
127
|
* heard of: a screen branches on `enabled`, it does not guard on whether the module exists.
|
|
121
128
|
*/
|
|
122
129
|
export function pithy(options: PithyPluginOptions = {}): PithyPlugin {
|
|
123
|
-
const environment = options.environment ?? process.env.ENVIRONMENT ?? "dev";
|
|
130
|
+
const environment = options.environment ?? process.env.ENVIRONMENT ?? process.env.CLOUDFLARE_ENV ?? "dev";
|
|
124
131
|
let configFile = "";
|
|
125
132
|
// Memoize the promise, not the value: `load` runs concurrently for every virtual module a bundle
|
|
126
133
|
// imports, and each `runnerImport` builds a fresh environment. One promise means one config load.
|