vite-plugin-windmill 1.683.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/LICENSE +21 -0
- package/README.md +220 -0
- package/bin/vite-plugin-windmill +3 -0
- package/dist/cli.d.mts +4 -0
- package/dist/cli.mjs +475 -0
- package/dist/index.d.mts +128 -0
- package/dist/index.mjs +1044 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jerry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# vite-plugin-windmill
|
|
2
|
+
|
|
3
|
+
Vite plugin and deploy tooling for Windmill raw apps.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- infers a Windmill raw-app path and `base` from a `.raw_app` or `__raw_app` directory
|
|
8
|
+
- injects a virtual `wmill` runtime for local dev and production builds
|
|
9
|
+
- configures authenticated `/api` proxying for Vite dev and preview when a Windmill URL and token are available
|
|
10
|
+
- assembles raw-app payloads from `raw_app.yaml`, `backend/`, and tracked app files
|
|
11
|
+
- honors repo `wmill.yaml` exclude globs when collecting app files for deploy
|
|
12
|
+
- optionally deploys the built raw app after `vite build`
|
|
13
|
+
|
|
14
|
+
## Versioning
|
|
15
|
+
|
|
16
|
+
This package version tracks Windmill minor releases. New package versions are published for new Windmill minor lines; patch releases within a line are absorbed by the `windmill-client` range and the pinned generated runtime source.
|
|
17
|
+
|
|
18
|
+
<!-- windmill-release:compat-start -->
|
|
19
|
+
|
|
20
|
+
Current release line: `1.683.x`
|
|
21
|
+
|
|
22
|
+
It currently depends on `windmill-client@^1.683.0` and bundles `rawAppWmillTs.ts` generated from `windmill-labs/windmill@v1.683.2`.
|
|
23
|
+
|
|
24
|
+
<!-- windmill-release:compat-end -->
|
|
25
|
+
|
|
26
|
+
Install the release line that matches your Windmill minor version:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add -D vite-plugin-windmill@1.687.0
|
|
30
|
+
pnpm add -D vite-plugin-windmill@1.686.0
|
|
31
|
+
pnpm add -D vite-plugin-windmill@1.685.0
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Backfilled historical lines are published as `1.<windmill-minor>.0`. For example, a workspace on Windmill `1.684.1` should install `vite-plugin-windmill@1.684.0`.
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pnpm add -D vite vite-plugin-windmill
|
|
40
|
+
npm install --save-dev vite vite-plugin-windmill
|
|
41
|
+
bun add -d vite vite-plugin-windmill
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`vite` is a peer dependency. `windmill-client` and `yaml` are bundled runtime dependencies. The package currently targets Node.js 22+.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { defineConfig } from "vite";
|
|
50
|
+
import windmill from "vite-plugin-windmill";
|
|
51
|
+
|
|
52
|
+
export default defineConfig({
|
|
53
|
+
plugins: [windmill({ entry: "src/main.tsx" })],
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Expected project shape:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
f/example/app.raw_app/
|
|
61
|
+
raw_app.yaml
|
|
62
|
+
index.tsx
|
|
63
|
+
backend/
|
|
64
|
+
hello.py
|
|
65
|
+
hello.yaml
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The plugin resolves the raw-app directory from `dir` or by searching upward for `raw_app.yaml`. It infers the Windmill app path from the raw-app folder name, so `f/example/app.raw_app` becomes `f/example/app`.
|
|
69
|
+
|
|
70
|
+
## Environment Variables
|
|
71
|
+
|
|
72
|
+
The plugin and CLI resolve connection settings in this order:
|
|
73
|
+
|
|
74
|
+
- `WM_WORKSPACE`: Windmill workspace name when `workspace` is not passed directly
|
|
75
|
+
- `WM_TOKEN`: API token used for authenticated proxying and deploys
|
|
76
|
+
- `BASE_INTERNAL_URL`: preferred Windmill base URL for local proxying and deploys
|
|
77
|
+
- `BASE_URL`: fallback Windmill base URL when `BASE_INTERNAL_URL` is unset
|
|
78
|
+
- `WM_DEPLOY`: optional deploy toggle for `vite build`; accepts `true`, `false`, `dry`, and `check`
|
|
79
|
+
|
|
80
|
+
## Options
|
|
81
|
+
|
|
82
|
+
`windmill(options)` accepts:
|
|
83
|
+
|
|
84
|
+
- `dir`: raw-app directory. Defaults to the nearest ancestor containing `raw_app.yaml`.
|
|
85
|
+
- `entry`: entry file relative to `dir`. Defaults to `index.ts` or `index.tsx`.
|
|
86
|
+
- `path`: override the inferred Windmill app path.
|
|
87
|
+
- `base`: override the inferred raw-app base URL.
|
|
88
|
+
- `root`: workspace root used for path inference and `wmill.yaml` discovery.
|
|
89
|
+
- `workspace`: Windmill workspace override.
|
|
90
|
+
- `token`: Windmill API token override.
|
|
91
|
+
- `url`: Windmill base URL override.
|
|
92
|
+
- `proxy`: `false` to disable proxying, or an object with `context`, `target`, `token`, and any Vite proxy options.
|
|
93
|
+
- `deploy`: `true`, `false`, or `{ dry?: boolean; message?: string }`.
|
|
94
|
+
- `nonDotted`: override `wmill.yaml` `nonDottedPaths`.
|
|
95
|
+
- `ts`: default TypeScript runnable language override.
|
|
96
|
+
|
|
97
|
+
Connection resolution order:
|
|
98
|
+
|
|
99
|
+
- `workspace`: plugin option `workspace`, then `WM_WORKSPACE`
|
|
100
|
+
- `token`: plugin option `token`, then `WM_TOKEN`
|
|
101
|
+
- `url`: plugin option `url`, then `BASE_INTERNAL_URL`, then `BASE_URL`
|
|
102
|
+
|
|
103
|
+
By default, the plugin adds a shared `/api` proxy for both `vite dev` and `vite preview` when it can resolve a Windmill URL and token from plugin options or from `BASE_INTERNAL_URL` or `BASE_URL` plus `WM_TOKEN`.
|
|
104
|
+
|
|
105
|
+
Use `proxy: false` to disable it, or pass overrides such as `proxy: { context: '/wm-api', target: 'https://windmill.internal', token: process.env.WM_TOKEN }`.
|
|
106
|
+
|
|
107
|
+
## Quick Start
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
import { defineConfig } from "vite";
|
|
111
|
+
import windmill from "vite-plugin-windmill";
|
|
112
|
+
|
|
113
|
+
export default defineConfig({
|
|
114
|
+
plugins: [
|
|
115
|
+
windmill({
|
|
116
|
+
dir: "f/example/app.raw_app",
|
|
117
|
+
entry: "index.tsx",
|
|
118
|
+
}),
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"scripts": {
|
|
126
|
+
"dev": "vite",
|
|
127
|
+
"build": "vite build",
|
|
128
|
+
"deploy": "WM_DEPLOY=true vite build"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Deploy After Build
|
|
134
|
+
|
|
135
|
+
The plugin can deploy the built raw-app bundle after `vite build`.
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
windmill({
|
|
139
|
+
deploy: true,
|
|
140
|
+
entry: "src/main.tsx",
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`deploy` also accepts an options object:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
windmill({
|
|
148
|
+
deploy: {
|
|
149
|
+
dry: true,
|
|
150
|
+
message: "preview release",
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Behavior:
|
|
156
|
+
|
|
157
|
+
- `deploy: true`: deploy after build
|
|
158
|
+
- `deploy: { dry: true }`: validate the local deploy payload without contacting or mutating Windmill
|
|
159
|
+
- `deploy: { message: '...' }`: override the deployment message sent to Windmill
|
|
160
|
+
- explicit `deploy` config wins over `WM_DEPLOY`
|
|
161
|
+
|
|
162
|
+
If you prefer environment-driven deploys, leave `deploy` unset and use `WM_DEPLOY`:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
WM_DEPLOY=true vite build
|
|
166
|
+
WM_DEPLOY=dry vite build
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Accepted `WM_DEPLOY` values:
|
|
170
|
+
|
|
171
|
+
- truthy: `true`, `1`, `yes`, `on`, empty string
|
|
172
|
+
- falsy: `false`, `0`, `no`, `off`
|
|
173
|
+
- dry-run: `dry`, `check`
|
|
174
|
+
|
|
175
|
+
## Deploy CLI
|
|
176
|
+
|
|
177
|
+
The package also exposes a deploy CLI:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
vite-plugin-windmill --dir ./f/example/app.raw_app --dry
|
|
181
|
+
vite-plugin-windmill --dir ./f/example/app.raw_app --message "manual deploy"
|
|
182
|
+
vite-plugin-windmill --dir ./f/example/app.raw_app --js ./dist/assets/index.js --css ./dist/assets/index.css
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Use `vite-plugin-windmill --help` for all flags.
|
|
186
|
+
|
|
187
|
+
## Programmatic Deploy
|
|
188
|
+
|
|
189
|
+
You can also deploy outside the Vite plugin lifecycle:
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
import { deploy } from "vite-plugin-windmill";
|
|
193
|
+
|
|
194
|
+
await deploy({
|
|
195
|
+
dir: "./f/example/app.raw_app",
|
|
196
|
+
dry: true,
|
|
197
|
+
workspace: process.env.WM_WORKSPACE,
|
|
198
|
+
token: process.env.WM_TOKEN,
|
|
199
|
+
url: process.env.BASE_URL,
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`deploy()` resolves the same raw-app metadata as the plugin and accepts optional `bundles`, `js`, and `css` overrides when you want to supply build artifacts explicitly.
|
|
204
|
+
|
|
205
|
+
## Release Integrity
|
|
206
|
+
|
|
207
|
+
Release tags are created in GitHub Actions and published to npm through npm Trusted Publisher. That gives newly published versions registry-backed provenance attestations without storing an npm automation token in GitHub.
|
|
208
|
+
|
|
209
|
+
The initial bootstrap publish of `1.687.0` happened before the Trusted Publisher workflow was active, so it does not carry npm provenance. Older backfilled versions and future releases are published from CI.
|
|
210
|
+
|
|
211
|
+
## Example Scripts
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"scripts": {
|
|
216
|
+
"bundle": "vite build",
|
|
217
|
+
"deploy": "WM_DEPLOY=\"${WM_DEPLOY:-true}\" vite build"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
package/dist/cli.d.mts
ADDED