devflare 1.0.0-next.6 → 1.0.0-next.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/LLM.md +219 -23
- package/README.md +36 -5
- package/dist/{build-nz5yrj7f.js → build-9myaxf07.js} +19 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/{deploy-a5pcxd5w.js → deploy-h1wz5p7m.js} +26 -10
- package/dist/{dev-7agn9g5s.js → dev-074w858d.js} +467 -126
- package/dist/dev-server/miniflare-log.d.ts +12 -0
- package/dist/dev-server/miniflare-log.d.ts.map +1 -0
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/index-a0fjkq68.js +198 -0
- package/dist/{index-rprrn24p.js → index-f8qh2tyh.js} +9 -10
- package/dist/index.js +5 -5
- package/dist/test/index.js +1 -1
- package/dist/test/simple-context.d.ts +1 -1
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/{types-vss6vrz7.js → types-wdcpnfvy.js} +39 -7
- package/dist/vite/index.js +118 -50
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-entry/composed-worker.d.ts +10 -0
- package/dist/worker-entry/composed-worker.d.ts.map +1 -0
- package/package.json +2 -2
package/LLM.md
CHANGED
|
@@ -349,8 +349,8 @@ This table shows what each top-level config key means, which layer uses it, and
|
|
|
349
349
|
| `limits` | worker runtime limits | compile/runtime | Yes | current native shape only models `cpu_ms` |
|
|
350
350
|
| `observability` | worker logs / sampling | compile/runtime | Yes | passes through directly |
|
|
351
351
|
| `migrations` | Durable Object migrations | compile/runtime | Yes | used for DO class evolution |
|
|
352
|
-
| `
|
|
353
|
-
| `
|
|
352
|
+
| `rolldown` | Rolldown-related config for Devflare's DO bundler | schema/dev/build tooling | No direct compiler output | `rolldown.options` is currently forwarded to DO bundling in dev; see caveats below |
|
|
353
|
+
| `vite` | Vite-related config namespace and extension point | schema/build tooling | No direct compiler output | current modeled field is `vite.plugins`; raw Vite config still belongs in `vite.config.*`; see caveats below |
|
|
354
354
|
| `env` | environment-specific overrides | Devflare pre-compilation merge layer | Not as nested env blocks | only a subset of top-level keys is supported inside each env block; see the dedicated section |
|
|
355
355
|
| `wrangler.passthrough` | raw Wrangler fields not modeled natively | compiler/deploy | Yes | merged at top level into compiled config |
|
|
356
356
|
|
|
@@ -990,14 +990,16 @@ The current `env` schema supports overrides for these keys:
|
|
|
990
990
|
- `limits`
|
|
991
991
|
- `observability`
|
|
992
992
|
- `migrations`
|
|
993
|
-
- `
|
|
993
|
+
- `rolldown`
|
|
994
|
+
- `vite`
|
|
994
995
|
- `wrangler`
|
|
995
996
|
|
|
996
997
|
Not currently supported inside `config.env.<name>`:
|
|
997
998
|
|
|
998
999
|
- `accountId`
|
|
999
1000
|
- `wsRoutes`
|
|
1000
|
-
|
|
1001
|
+
|
|
1002
|
+
Legacy aliases `build` and `plugins` are still accepted for compatibility and normalized to `rolldown` and `vite` during validation.
|
|
1001
1003
|
|
|
1002
1004
|
So if you need environment-specific values for one of those unsupported keys, compute them in the outer `defineConfig()` function yourself instead of assuming `config.env` can hold them.
|
|
1003
1005
|
|
|
@@ -1203,28 +1205,213 @@ This is the correct escape hatch when native Devflare config is intentionally na
|
|
|
1203
1205
|
|
|
1204
1206
|
---
|
|
1205
1207
|
|
|
1206
|
-
##
|
|
1208
|
+
## Vite and Rolldown
|
|
1207
1209
|
|
|
1208
|
-
Devflare
|
|
1210
|
+
Vite and Rolldown both matter in Devflare, but they do **different jobs**.
|
|
1211
|
+
|
|
1212
|
+
If users blur them together, the resulting mental model gets messy fast.
|
|
1213
|
+
|
|
1214
|
+
### Short mental model
|
|
1215
|
+
|
|
1216
|
+
- **Vite** is the main **application-facing** dev/build pipeline in Devflare
|
|
1217
|
+
- **Rolldown** is the current **Durable Object bundler** Devflare uses in local dev
|
|
1218
|
+
- if you are working on `vite.config.*`, the `devflare/vite` plugin, frontend HMR, or the default `devflare build` / `devflare deploy` path, you are in **Vite land**
|
|
1219
|
+
- if you are customizing how Durable Object source files are resolved, transformed, or bundled during local dev, you are in **Rolldown land**
|
|
1220
|
+
|
|
1221
|
+
They are related, but they are not interchangeable.
|
|
1222
|
+
|
|
1223
|
+
### What Vite does in Devflare
|
|
1224
|
+
|
|
1225
|
+
Vite is Devflare’s main integration point for:
|
|
1226
|
+
|
|
1227
|
+
- app-facing development with a local `vite.config.*`
|
|
1228
|
+
- frontend HMR when the package actually has a local Vite config
|
|
1229
|
+
- the `devflare/vite` integration surface
|
|
1230
|
+
- the default `devflare build` and `devflare deploy` build subprocesses, which currently run `bunx vite build`
|
|
1231
|
+
- SvelteKit and other framework workflows that already speak Vite natively
|
|
1232
|
+
|
|
1233
|
+
Put differently: if you are building the main worker application experience, Devflare still primarily leans on **Vite**.
|
|
1234
|
+
|
|
1235
|
+
### What `config.vite` is and is not
|
|
1236
|
+
|
|
1237
|
+
The top-level `vite` field is Devflare’s **Vite-related config namespace**.
|
|
1238
|
+
|
|
1239
|
+
Right now, its most concrete public field is:
|
|
1240
|
+
|
|
1241
|
+
- `vite.plugins`
|
|
1242
|
+
|
|
1243
|
+
That field exists to keep Vite-related extension points grouped under a clearly named namespace instead of using a vague top-level `plugins` field.
|
|
1244
|
+
|
|
1245
|
+
However, it is important to be precise about what this does **not** mean:
|
|
1246
|
+
|
|
1247
|
+
- `config.vite` is **not** a full mirror of raw Vite configuration
|
|
1248
|
+
- Devflare does **not** currently forward arbitrary `config.vite` keys straight into the `vite build` CLI invocation
|
|
1249
|
+
- raw Vite configuration still belongs in your real `vite.config.ts`, `vite.config.js`, `vite.config.mts`, or `vite.config.mjs`
|
|
1250
|
+
|
|
1251
|
+
So the correct user-facing rule is:
|
|
1252
|
+
|
|
1253
|
+
> Use `config.vite` for Devflare-level Vite-related metadata and extension points, but use `vite.config.*` for actual Vite build/server configuration.
|
|
1254
|
+
|
|
1255
|
+
### What Rolldown does in Devflare
|
|
1256
|
+
|
|
1257
|
+
Rolldown is currently used most concretely in Devflare for:
|
|
1258
|
+
|
|
1259
|
+
- bundling Durable Object source files in local dev
|
|
1260
|
+
- rebuilding Durable Object bundles when watched DO files change
|
|
1261
|
+
- handling non-JS imports or custom transform/resolve needs inside the DO bundler path
|
|
1262
|
+
|
|
1263
|
+
That means `rolldown` is the right top-level namespace for settings that conceptually belong to Devflare’s DO bundler.
|
|
1264
|
+
|
|
1265
|
+
### What `config.rolldown` is and is not
|
|
1266
|
+
|
|
1267
|
+
The top-level `rolldown` field is the public home for Devflare’s Rolldown-related config.
|
|
1268
|
+
|
|
1269
|
+
The current shape is:
|
|
1270
|
+
|
|
1271
|
+
- `rolldown.minify`
|
|
1272
|
+
- `rolldown.sourcemap`
|
|
1273
|
+
- `rolldown.target`
|
|
1274
|
+
- `rolldown.options`
|
|
1275
|
+
|
|
1276
|
+
Where:
|
|
1277
|
+
|
|
1278
|
+
- `rolldown.minify` and `rolldown.sourcemap` are Devflare-level default output toggles for DO bundles
|
|
1279
|
+
- `rolldown.options` is the raw Rolldown options bag forwarded into the DO bundler
|
|
1280
|
+
- `rolldown.target` is currently a lighter modeled field and should not be assumed to be fully wired through every path yet
|
|
1281
|
+
|
|
1282
|
+
In other words, the raw Rolldown plugin and resolver surface lives under:
|
|
1283
|
+
|
|
1284
|
+
- `rolldown.options`
|
|
1285
|
+
|
|
1286
|
+
not under a generic `build` object.
|
|
1287
|
+
|
|
1288
|
+
### Canonical config shape
|
|
1289
|
+
|
|
1290
|
+
Prefer this structure in new configs:
|
|
1291
|
+
|
|
1292
|
+
```ts
|
|
1293
|
+
import { defineConfig } from 'devflare'
|
|
1294
|
+
|
|
1295
|
+
export default defineConfig({
|
|
1296
|
+
name: 'my-worker',
|
|
1297
|
+
vite: {
|
|
1298
|
+
plugins: []
|
|
1299
|
+
},
|
|
1300
|
+
rolldown: {
|
|
1301
|
+
minify: false,
|
|
1302
|
+
sourcemap: true,
|
|
1303
|
+
options: {}
|
|
1304
|
+
}
|
|
1305
|
+
})
|
|
1306
|
+
```
|
|
1307
|
+
|
|
1308
|
+
### Legacy aliases
|
|
1309
|
+
|
|
1310
|
+
For backward compatibility, Devflare still accepts these legacy top-level aliases:
|
|
1311
|
+
|
|
1312
|
+
- `plugins` → normalized to `vite.plugins`
|
|
1313
|
+
- `build` → normalized to `rolldown`
|
|
1314
|
+
|
|
1315
|
+
That means older configs keep loading, but the preferred documented surface is now:
|
|
1316
|
+
|
|
1317
|
+
- `vite`
|
|
1318
|
+
- `rolldown`
|
|
1319
|
+
|
|
1320
|
+
### Current Rolldown support surface
|
|
1321
|
+
|
|
1322
|
+
The current Rolldown support story is:
|
|
1323
|
+
|
|
1324
|
+
- validated against `rolldown@1.0.0-rc.12`
|
|
1325
|
+
- applies most concretely to **Durable Object bundling in dev mode**
|
|
1326
|
+
- especially useful when DO source files import non-JS assets or need custom resolve/transform behavior
|
|
1327
|
+
|
|
1328
|
+
The DO bundler forwards your `rolldown.options` into Rolldown while still reserving a few settings for Devflare itself:
|
|
1329
|
+
|
|
1330
|
+
- Devflare owns the entry input path
|
|
1331
|
+
- Devflare keeps the platform worker-friendly (`neutral`)
|
|
1332
|
+
- Devflare keeps Cloudflare and Node built-ins externalized as needed for local runtime compatibility
|
|
1333
|
+
- Devflare injects the internal `debug` shim alias used by browser-rendering-related dependencies
|
|
1334
|
+
- Devflare writes single-file ESM DO bundles with `output.codeSplitting = false`
|
|
1335
|
+
|
|
1336
|
+
That means the following kinds of settings are good candidates for `rolldown.options`:
|
|
1209
1337
|
|
|
1210
|
-
- `build`
|
|
1211
1338
|
- `plugins`
|
|
1339
|
+
- `resolve`
|
|
1340
|
+
- `external`
|
|
1341
|
+
- `moduleTypes`
|
|
1342
|
+
- `tsconfig`
|
|
1343
|
+
- `transform`
|
|
1344
|
+
- `onLog`
|
|
1345
|
+
- `output.sourcemap`
|
|
1346
|
+
- `output.minify`
|
|
1347
|
+
|
|
1348
|
+
One subtle but important detail:
|
|
1349
|
+
|
|
1350
|
+
- `rolldown.minify` and `rolldown.sourcemap` act as Devflare defaults
|
|
1351
|
+
- `rolldown.options.output.minify` and `rolldown.options.output.sourcemap` can still override them more specifically
|
|
1352
|
+
|
|
1353
|
+
### Svelte example for Durable Object rendering
|
|
1354
|
+
|
|
1355
|
+
Rolldown’s plugin API is broadly Rollup-compatible, so existing Rollup plugins are often the right starting point.
|
|
1356
|
+
|
|
1357
|
+
If a Durable Object imports `.svelte` files and renders them server-side, a practical pattern is:
|
|
1358
|
+
|
|
1359
|
+
```ts
|
|
1360
|
+
import { defineConfig } from 'devflare'
|
|
1361
|
+
import svelte from 'rollup-plugin-svelte'
|
|
1212
1362
|
|
|
1213
|
-
|
|
1363
|
+
export default defineConfig({
|
|
1364
|
+
name: 'chat-worker',
|
|
1365
|
+
files: {
|
|
1366
|
+
durableObjects: 'src/do.*.ts'
|
|
1367
|
+
},
|
|
1368
|
+
rolldown: {
|
|
1369
|
+
options: {
|
|
1370
|
+
plugins: [
|
|
1371
|
+
svelte({
|
|
1372
|
+
compilerOptions: {
|
|
1373
|
+
generate: 'ssr'
|
|
1374
|
+
}
|
|
1375
|
+
})
|
|
1376
|
+
],
|
|
1377
|
+
output: {
|
|
1378
|
+
sourcemap: true
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
})
|
|
1383
|
+
```
|
|
1214
1384
|
|
|
1215
|
-
|
|
1216
|
-
- `minify`
|
|
1217
|
-
- `sourcemap`
|
|
1218
|
-
- `rolldownOptions`
|
|
1385
|
+
Example DO module:
|
|
1219
1386
|
|
|
1220
|
-
|
|
1387
|
+
```ts
|
|
1388
|
+
import { DurableObject } from 'cloudflare:workers'
|
|
1389
|
+
import App from './App.svelte'
|
|
1221
1390
|
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
- they are **not** emitted directly by `compileConfig()` into `wrangler.jsonc`
|
|
1391
|
+
export class ChatRenderer extends DurableObject {
|
|
1392
|
+
async fetch(): Promise<Response> {
|
|
1393
|
+
const { html } = App.render({ name: 'Devflare' })
|
|
1226
1394
|
|
|
1227
|
-
|
|
1395
|
+
return new Response(html, {
|
|
1396
|
+
headers: {
|
|
1397
|
+
'content-type': 'text/html; charset=utf-8'
|
|
1398
|
+
}
|
|
1399
|
+
})
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
```
|
|
1403
|
+
|
|
1404
|
+
### Limitation to keep in mind
|
|
1405
|
+
|
|
1406
|
+
Rolldown is **not yet Devflare’s universal main-worker build hook**.
|
|
1407
|
+
|
|
1408
|
+
Today, the clearest supported Rolldown-plugin path is DO bundling in dev.
|
|
1409
|
+
For the main fetch worker build path, Devflare still centers on Vite, so if you want full Svelte/Vite-style app compilation for the main worker, prefer the Vite or SvelteKit integration surfaces.
|
|
1410
|
+
|
|
1411
|
+
So the practical rule is:
|
|
1412
|
+
|
|
1413
|
+
- use **Vite** for the main app/build/framework path
|
|
1414
|
+
- use **Rolldown** when you need to customize Devflare’s DO bundler path
|
|
1228
1415
|
|
|
1229
1416
|
When these fields matter, validate the actual Vite/build behavior in your project.
|
|
1230
1417
|
|
|
@@ -1529,7 +1716,7 @@ It is a combined local development system that includes:
|
|
|
1529
1716
|
- Vite dev server behavior
|
|
1530
1717
|
- Miniflare-backed Cloudflare bindings
|
|
1531
1718
|
- bridge-backed communication between Bun/Node-side tooling and the worker runtime
|
|
1532
|
-
- DO-oriented local orchestration and bundling behavior
|
|
1719
|
+
- DO-oriented local orchestration and Rolldown-based bundling/watch behavior
|
|
1533
1720
|
- websocket-aware proxying for local DO workflows
|
|
1534
1721
|
- browser-shim behavior for browser rendering
|
|
1535
1722
|
- local migration handling when relevant resources are configured
|
|
@@ -1779,6 +1966,11 @@ Use it when you need Devflare-aware Vite integration, worker-aware transforms, o
|
|
|
1779
1966
|
|
|
1780
1967
|
The Vite plugin does more than inject one helper.
|
|
1781
1968
|
|
|
1969
|
+
If you are deciding between `vite` and `rolldown`, this is the headline distinction:
|
|
1970
|
+
|
|
1971
|
+
- `devflare/vite` is the **main application-facing integration**
|
|
1972
|
+
- `rolldown` config is the **DO bundler customization surface**
|
|
1973
|
+
|
|
1782
1974
|
It currently:
|
|
1783
1975
|
|
|
1784
1976
|
- loads and compiles `devflare.config.ts`
|
|
@@ -1954,7 +2146,8 @@ These are core Devflare strengths today:
|
|
|
1954
2146
|
- do not assume arbitrary JSON-valued vars are a native Devflare feature
|
|
1955
2147
|
|
|
1956
2148
|
3. **`config.env` only supports a subset of top-level config keys**
|
|
1957
|
-
- it does not currently support environment-local `accountId
|
|
2149
|
+
- it does not currently support environment-local `accountId` or `wsRoutes`
|
|
2150
|
+
- legacy `build` and `plugins` are accepted as aliases, but the canonical env-facing keys are `rolldown` and `vite`
|
|
1958
2151
|
|
|
1959
2152
|
4. **`config.env` uses `defu` merge semantics**
|
|
1960
2153
|
- nested objects inherit from the base config
|
|
@@ -1992,9 +2185,11 @@ These are core Devflare strengths today:
|
|
|
1992
2185
|
- workflow discovery naming is modeled
|
|
1993
2186
|
- but the broader runtime/compiler/test story is less mature than the most central surfaces
|
|
1994
2187
|
|
|
1995
|
-
13. **`
|
|
2188
|
+
13. **`vite` and `rolldown` are not equally wired in every path**
|
|
2189
|
+
- `rolldown.options` is currently wired into DO bundling in dev and validated against `rolldown@1.0.0-rc.12`
|
|
2190
|
+
- `vite` is the clearer Vite-side namespace, but it is still not a full mirror of raw `vite.config.*`
|
|
1996
2191
|
- the default build/deploy commands still center on Vite output
|
|
1997
|
-
- verify actual project behavior when relying on these fields
|
|
2192
|
+
- verify actual project behavior when relying on these fields outside the DO bundler path
|
|
1998
2193
|
|
|
1999
2194
|
14. **there is no stable public local-R2 browser URL contract today**
|
|
2000
2195
|
- Devflare uses internal `/_devflare/*` routes for dev-server behavior
|
|
@@ -2141,4 +2336,5 @@ If you only remember a few things, remember these:
|
|
|
2141
2336
|
12. use `ref()` for multi-worker composition instead of magic strings
|
|
2142
2337
|
13. store R2 object keys as the durable identifier instead of storing full delivery URLs
|
|
2143
2338
|
14. treat local preview or inspector URLs as dev conveniences, not as the production file-delivery contract
|
|
2144
|
-
15.
|
|
2339
|
+
15. Vite is the main application-facing build path, while Rolldown is currently the DO bundler path
|
|
2340
|
+
16. when native config does not cover a Wrangler feature, use `wrangler.passthrough`
|
package/README.md
CHANGED
|
@@ -178,13 +178,42 @@ These are the main config keys Devflare understands today.
|
|
|
178
178
|
| `limits` | worker resource limits |
|
|
179
179
|
| `observability` | worker logs / sampling |
|
|
180
180
|
| `migrations` | Durable Object migrations |
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
181
|
+
| `rolldown` | Rolldown-related config for Devflare’s DO bundler |
|
|
182
|
+
| `vite` | Vite-related config namespace and extension point |
|
|
183
183
|
| `env` | environment-specific overrides |
|
|
184
184
|
| `wrangler.passthrough` | escape hatch for Wrangler fields not modeled natively |
|
|
185
185
|
|
|
186
186
|
---
|
|
187
187
|
|
|
188
|
+
## Vite and Rolldown
|
|
189
|
+
|
|
190
|
+
Devflare uses both tools, but for different layers of the workflow.
|
|
191
|
+
|
|
192
|
+
- **Vite** is the main application-facing dev/build pipeline
|
|
193
|
+
- **Rolldown** is the current Durable Object bundler path in local dev
|
|
194
|
+
|
|
195
|
+
Use the top-level config namespaces like this:
|
|
196
|
+
|
|
197
|
+
- `vite` for Devflare-level Vite-related config such as `vite.plugins`
|
|
198
|
+
- `rolldown` for Devflare’s DO bundler settings, especially `rolldown.options`
|
|
199
|
+
|
|
200
|
+
Important distinction:
|
|
201
|
+
|
|
202
|
+
- raw Vite configuration still belongs in `vite.config.*`
|
|
203
|
+
- raw Rolldown plugin/options for the DO bundler belong in `rolldown.options`
|
|
204
|
+
|
|
205
|
+
Legacy aliases are still accepted for compatibility:
|
|
206
|
+
|
|
207
|
+
- `plugins` → `vite.plugins`
|
|
208
|
+
- `build` → `rolldown`
|
|
209
|
+
|
|
210
|
+
If you are deciding which one matters for your task, the simple rule is:
|
|
211
|
+
|
|
212
|
+
- main app/frontend/framework build path → **Vite**
|
|
213
|
+
- Durable Object bundler customization path → **Rolldown**
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
188
217
|
## Env files, `vars`, and `secrets`
|
|
189
218
|
|
|
190
219
|
This is the most important config nuance to understand.
|
|
@@ -542,9 +571,11 @@ Devflare has a broad surface area, but not every feature is equally mature.
|
|
|
542
571
|
- `ref().worker('Entrypoint')` is modeled at the Devflare layer
|
|
543
572
|
- validate deployment output if named entrypoint wiring is critical to your app
|
|
544
573
|
|
|
545
|
-
5. **workflows, `
|
|
546
|
-
|
|
547
|
-
|
|
574
|
+
5. **workflows, `vite`, and `rolldown` are lighter than the most central surfaces**
|
|
575
|
+
- they exist and matter
|
|
576
|
+
- `rolldown.options` is now wired into DO bundling in dev
|
|
577
|
+
- `vite` is the clearer Vite-side namespace, but raw Vite config still lives in `vite.config.*`
|
|
578
|
+
- they are not as battle-hardened as the fetch/queue/DO/test path
|
|
548
579
|
|
|
549
580
|
6. **use `wrangler.passthrough` for unsupported native fields**
|
|
550
581
|
- if Wrangler supports something Devflare does not model yet, passthrough is the supported escape hatch
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
detectViteProject
|
|
3
|
+
} from "./index-18hvb6gb.js";
|
|
1
4
|
import {
|
|
2
5
|
getDependencies
|
|
3
6
|
} from "./index-1xpj0m4r.js";
|
|
7
|
+
import {
|
|
8
|
+
prepareComposedWorkerEntrypoint
|
|
9
|
+
} from "./index-a0fjkq68.js";
|
|
4
10
|
import {
|
|
5
11
|
compileConfig,
|
|
6
12
|
writeWranglerConfig
|
|
@@ -19,12 +25,23 @@ async function runBuildCommand(parsed, logger, options) {
|
|
|
19
25
|
try {
|
|
20
26
|
const config = await loadConfig({ cwd, configFile: configPath });
|
|
21
27
|
logger.info(`Building: ${config.name}`);
|
|
28
|
+
const composedMainEntry = await prepareComposedWorkerEntrypoint(cwd, config, environment);
|
|
22
29
|
const wranglerConfig = compileConfig(config, environment);
|
|
30
|
+
if (composedMainEntry) {
|
|
31
|
+
wranglerConfig.main = composedMainEntry;
|
|
32
|
+
logger.info(`Generated composed worker entry: ${composedMainEntry}`);
|
|
33
|
+
}
|
|
23
34
|
await writeWranglerConfig(cwd, wranglerConfig);
|
|
24
35
|
logger.success("Generated wrangler.jsonc");
|
|
25
|
-
const
|
|
36
|
+
const deps = await getDependencies();
|
|
37
|
+
const viteProject = await detectViteProject(cwd, deps.fs);
|
|
38
|
+
if (!viteProject.shouldStartVite) {
|
|
39
|
+
logger.info("Skipping Vite build (no local vite.config.* found for this package)");
|
|
40
|
+
logger.success("Build complete!");
|
|
41
|
+
return { exitCode: 0 };
|
|
42
|
+
}
|
|
26
43
|
logger.info("Running vite build...");
|
|
27
|
-
const proc = await exec.exec("bunx", ["vite", "build"], {
|
|
44
|
+
const proc = await deps.exec.exec("bunx", ["vite", "build"], {
|
|
28
45
|
cwd,
|
|
29
46
|
stdio: "inherit",
|
|
30
47
|
env: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAOjE,wBAAsB,eAAe,CACpC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,CAAC,CA2DpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/deploy.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/deploy.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAOjE,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,CAAC,CAgFpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AA0qBjE,wBAAsB,eAAe,CACpC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,UAAU,GACjB,OAAO,CAAC,SAAS,CAAC,CA2HpB"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
detectViteProject
|
|
3
|
+
} from "./index-18hvb6gb.js";
|
|
1
4
|
import {
|
|
2
5
|
getDependencies
|
|
3
6
|
} from "./index-1xpj0m4r.js";
|
|
7
|
+
import {
|
|
8
|
+
prepareComposedWorkerEntrypoint
|
|
9
|
+
} from "./index-a0fjkq68.js";
|
|
4
10
|
import {
|
|
5
11
|
compileConfig,
|
|
6
12
|
stringifyConfig,
|
|
@@ -21,7 +27,12 @@ async function runDeployCommand(parsed, logger, options) {
|
|
|
21
27
|
try {
|
|
22
28
|
const config = await loadConfig({ cwd, configFile: configPath });
|
|
23
29
|
logger.info(`Deploying: ${config.name}`);
|
|
30
|
+
const composedMainEntry = await prepareComposedWorkerEntrypoint(cwd, config, environment);
|
|
24
31
|
const wranglerConfig = compileConfig(config, environment);
|
|
32
|
+
if (composedMainEntry) {
|
|
33
|
+
wranglerConfig.main = composedMainEntry;
|
|
34
|
+
logger.info(`Generated composed worker entry: ${composedMainEntry}`);
|
|
35
|
+
}
|
|
25
36
|
if (dryRun) {
|
|
26
37
|
logger.info("Dry run - skipping actual deployment");
|
|
27
38
|
logger.info("Would deploy with wrangler config:");
|
|
@@ -30,22 +41,27 @@ async function runDeployCommand(parsed, logger, options) {
|
|
|
30
41
|
}
|
|
31
42
|
await writeWranglerConfig(cwd, wranglerConfig);
|
|
32
43
|
logger.debug("Generated wrangler.jsonc");
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
const deps = await getDependencies();
|
|
45
|
+
const viteProject = await detectViteProject(cwd, deps.fs);
|
|
46
|
+
if (viteProject.shouldStartVite) {
|
|
47
|
+
logger.info("Building...");
|
|
48
|
+
const buildProc = await deps.exec.exec("bunx", ["vite", "build"], {
|
|
49
|
+
cwd,
|
|
50
|
+
stdio: "inherit"
|
|
51
|
+
});
|
|
52
|
+
if (buildProc.exitCode !== 0) {
|
|
53
|
+
logger.error("Build failed");
|
|
54
|
+
return { exitCode: 1 };
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
logger.info("Skipping Vite build (no local vite.config.* found for this package)");
|
|
42
58
|
}
|
|
43
59
|
logger.info("Deploying with wrangler...");
|
|
44
60
|
const wranglerArgs = ["wrangler", "deploy"];
|
|
45
61
|
if (environment) {
|
|
46
62
|
wranglerArgs.push("--env", environment);
|
|
47
63
|
}
|
|
48
|
-
const deployProc = await exec.exec("bunx", wranglerArgs, {
|
|
64
|
+
const deployProc = await deps.exec.exec("bunx", wranglerArgs, {
|
|
49
65
|
cwd,
|
|
50
66
|
stdio: "inherit"
|
|
51
67
|
});
|