devflare 1.0.0-next.5 → 1.0.0-next.7
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 +7 -2
- package/README.md +4 -2
- package/dist/browser.d.ts +50 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +149 -0
- package/dist/{build-mnf6v8gd.js → build-9myaxf07.js} +22 -5
- 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-nhceck39.js → deploy-h1wz5p7m.js} +29 -13
- package/dist/{dev-b9dmrj7b.js → dev-rsdssknb.js} +381 -91
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/index-62b3gt2g.js +12 -0
- package/dist/index-9ats0s83.js +70 -0
- package/dist/index-a0fjkq68.js +198 -0
- package/dist/{index-pf5s73n9.js → index-ccrh4w3t.js} +1 -281
- package/dist/{index-ep3445yc.js → index-f8qh2tyh.js} +34 -107
- package/dist/index-k7r18na8.js +0 -0
- package/dist/{index-m2q41jwa.js → index-n3np2d6t.js} +1 -1
- package/dist/index-npc1c8jx.js +44 -0
- package/dist/index-p7g30wd2.js +281 -0
- package/dist/{index-07q6yxyc.js → index-v8vvsn9x.js} +1 -0
- package/dist/index.js +25 -26
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +73 -0
- package/dist/sveltekit/index.js +5 -3
- package/dist/test/index.js +10 -5
- package/dist/test/simple-context.d.ts +1 -1
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/{types-5nyrz1sz.js → types-wdcpnfvy.js} +44 -11
- 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 +3 -2
- package/dist/{doctor-fmgb3d28.js → doctor-v7jy4s3r.js} +3 -3
package/LLM.md
CHANGED
|
@@ -84,7 +84,7 @@ Use package subpaths intentionally.
|
|
|
84
84
|
| Import | What it is for | What it exposes in practice |
|
|
85
85
|
|---|---|---|
|
|
86
86
|
| `devflare` | Main package entrypoint | `defineConfig`, config loading/compilation helpers, `ref()`, unified `env`, CLI helpers, bridge helpers, decorators, transform helpers, test helpers re-exported for convenience, `workerName` |
|
|
87
|
-
| `devflare/runtime` | Worker-safe runtime utilities |
|
|
87
|
+
| `devflare/runtime` | Worker-safe runtime utilities | request-scoped helpers like `env`, `ctx`, `event`, `locals`, `runWithContext`, plus middleware, validation helpers, and decorators |
|
|
88
88
|
| `devflare/test` | Testing API | `createTestContext`, `cf`, `email`, `queue`, `scheduled`, `worker`, `tail`, mock helpers, remote skip helpers, bridge test context |
|
|
89
89
|
| `devflare/vite` | Vite integration | `devflarePlugin`, plugin context helpers, config helpers, Vite-side types |
|
|
90
90
|
| `devflare/sveltekit` | SvelteKit integration | `handle`, `createDevflarePlatform`, `createHandle`, dev/reset helpers, integration types |
|
|
@@ -95,7 +95,12 @@ Use package subpaths intentionally.
|
|
|
95
95
|
|
|
96
96
|
`devflare/runtime` is intentionally **smaller** than the main package.
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
It now exports the **worker-safe request-scoped runtime helpers** such as `env`, `ctx`, `event`, `locals`, and `runWithContext`.
|
|
99
|
+
|
|
100
|
+
The main `devflare` entrypoint still exports the **unified** `env` proxy that can fall back to test or bridge contexts outside a live request. Use:
|
|
101
|
+
|
|
102
|
+
- `import { env } from 'devflare/runtime'` for worker-only request-scoped runtime access
|
|
103
|
+
- `import { env } from 'devflare'` when you specifically want the unified request/test/bridge-aware proxy
|
|
99
104
|
|
|
100
105
|
### Common main-package exports
|
|
101
106
|
|
package/README.md
CHANGED
|
@@ -119,7 +119,7 @@ Use subpaths intentionally.
|
|
|
119
119
|
| Import | Use for |
|
|
120
120
|
|---|---|
|
|
121
121
|
| `devflare` | main package entrypoint: config helpers, `ref()`, unified `env`, CLI helpers, bridge helpers, decorators, test helpers, `workerName` |
|
|
122
|
-
| `devflare/runtime` | worker-safe middleware/validation/decorator utilities |
|
|
122
|
+
| `devflare/runtime` | worker-safe runtime helpers like `env`, `ctx`, `event`, `locals`, `runWithContext`, plus middleware/validation/decorator utilities |
|
|
123
123
|
| `devflare/test` | `createTestContext`, `cf.*`, mock helpers, bridge test context, skip helpers |
|
|
124
124
|
| `devflare/vite` | Vite integration |
|
|
125
125
|
| `devflare/sveltekit` | SvelteKit integration |
|
|
@@ -128,7 +128,9 @@ Use subpaths intentionally.
|
|
|
128
128
|
|
|
129
129
|
### Important runtime note
|
|
130
130
|
|
|
131
|
-
The published `devflare/runtime` subpath is intentionally smaller than the main package
|
|
131
|
+
The published `devflare/runtime` subpath is intentionally smaller than the main package, but it now includes the worker-safe request-scoped runtime helpers such as `env`, `ctx`, `event`, `locals`, and `runWithContext`.
|
|
132
|
+
|
|
133
|
+
Use `import { env } from 'devflare/runtime'` for request-scoped worker runtime access, or `import { env } from 'devflare'` when you specifically want the unified request/test/bridge-aware proxy.
|
|
132
134
|
|
|
133
135
|
---
|
|
134
136
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export { defineConfig } from './config/define';
|
|
2
|
+
export { ref, resolveRef, serviceBinding } from './config/ref';
|
|
3
|
+
export { workerName } from './workerName';
|
|
4
|
+
export { env } from './env';
|
|
5
|
+
export { setBindingHints, createEnvProxy, initEnv, } from './bridge/proxy';
|
|
6
|
+
export type { EnvProxyOptions, BindingHints } from './bridge/proxy';
|
|
7
|
+
export { BridgeClient, getClient } from './bridge/client';
|
|
8
|
+
export type { BridgeClientOptions } from './bridge/client';
|
|
9
|
+
export { durableObject, getDurableObjectOptions, type DurableObjectOptions } from './decorators';
|
|
10
|
+
export declare function loadConfig(..._args: any[]): Promise<never>;
|
|
11
|
+
export declare const compileConfig: (...args: any[]) => any;
|
|
12
|
+
export declare const stringifyConfig: (...args: any[]) => any;
|
|
13
|
+
export declare const configSchema: Record<string, unknown>;
|
|
14
|
+
export declare class ConfigNotFoundError extends Error {
|
|
15
|
+
readonly code = "CONFIG_NOT_FOUND";
|
|
16
|
+
constructor(..._args: any[]);
|
|
17
|
+
}
|
|
18
|
+
export declare class ConfigValidationError extends Error {
|
|
19
|
+
readonly code = "CONFIG_VALIDATION_ERROR";
|
|
20
|
+
constructor(..._args: any[]);
|
|
21
|
+
}
|
|
22
|
+
export declare const runCli: (...args: any[]) => any;
|
|
23
|
+
export declare const parseArgs: (...args: any[]) => any;
|
|
24
|
+
export declare const findDurableObjectClasses: (...args: any[]) => any;
|
|
25
|
+
export declare const findDurableObjectClassesDetailed: (...args: any[]) => any;
|
|
26
|
+
export declare const generateWrapper: (...args: any[]) => any;
|
|
27
|
+
export declare const transformDurableObject: (...args: any[]) => any;
|
|
28
|
+
export declare const transformWorkerEntrypoint: (...args: any[]) => any;
|
|
29
|
+
export declare const findExportedFunctions: (...args: any[]) => any;
|
|
30
|
+
export declare const shouldTransformWorker: (...args: any[]) => any;
|
|
31
|
+
export declare const generateRpcInterface: (...args: any[]) => any;
|
|
32
|
+
export declare const startMiniflare: (...args: any[]) => any;
|
|
33
|
+
export declare const startMiniflareFromConfig: (...args: any[]) => any;
|
|
34
|
+
export declare const getMiniflare: (...args: any[]) => any;
|
|
35
|
+
export declare const stopMiniflare: (...args: any[]) => any;
|
|
36
|
+
export declare const gateway: Record<string, unknown>;
|
|
37
|
+
export declare const createTestContext: (...args: any[]) => any;
|
|
38
|
+
export declare const createMockTestContext: (...args: any[]) => any;
|
|
39
|
+
export declare const createMockKV: (...args: any[]) => any;
|
|
40
|
+
export declare const createMockD1: (...args: any[]) => any;
|
|
41
|
+
export declare const createMockR2: (...args: any[]) => any;
|
|
42
|
+
export declare const createMockQueue: (...args: any[]) => any;
|
|
43
|
+
export declare const createMockEnv: (...args: any[]) => any;
|
|
44
|
+
export declare const withTestContext: (...args: any[]) => any;
|
|
45
|
+
export declare const createBridgeTestContext: (...args: any[]) => any;
|
|
46
|
+
export declare const stopBridgeTestContext: (...args: any[]) => any;
|
|
47
|
+
export declare const getBridgeTestContext: (...args: any[]) => any;
|
|
48
|
+
export declare const testEnv: Record<string, unknown>;
|
|
49
|
+
export { defineConfig as default } from './config/define';
|
|
50
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG9D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAG3B,OAAO,EACN,eAAe,EACf,cAAc,EACd,OAAO,GACP,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACzD,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAG1D,OAAO,EACN,aAAa,EACb,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,MAAM,cAAc,CAAA;AAgCrB,wBAAsB,UAAU,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAEhE;AAED,eAAO,MAAM,aAAa,yBAAuC,CAAA;AACjE,eAAO,MAAM,eAAe,yBAAyC,CAAA;AACrE,eAAO,MAAM,YAAY,yBAAmE,CAAA;AAE5F,qBAAa,mBAAoB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,sBAAqB;IAElC,YAAY,GAAG,KAAK,EAAE,GAAG,EAAE,EAG1B;CACD;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,IAAI,6BAA4B;IAEzC,YAAY,GAAG,KAAK,EAAE,GAAG,EAAE,EAG1B;CACD;AAED,eAAO,MAAM,MAAM,yBAAgC,CAAA;AACnD,eAAO,MAAM,SAAS,yBAAmC,CAAA;AAEzD,eAAO,MAAM,wBAAwB,yBAAkD,CAAA;AACvF,eAAO,MAAM,gCAAgC,yBAA0D,CAAA;AACvG,eAAO,MAAM,eAAe,yBAAyC,CAAA;AACrE,eAAO,MAAM,sBAAsB,yBAAgD,CAAA;AACnF,eAAO,MAAM,yBAAyB,yBAAmD,CAAA;AACzF,eAAO,MAAM,qBAAqB,yBAA+C,CAAA;AACjF,eAAO,MAAM,qBAAqB,yBAA+C,CAAA;AACjF,eAAO,MAAM,oBAAoB,yBAA8C,CAAA;AAE/E,eAAO,MAAM,cAAc,yBAAwC,CAAA;AACnE,eAAO,MAAM,wBAAwB,yBAAkD,CAAA;AACvF,eAAO,MAAM,YAAY,yBAAsC,CAAA;AAC/D,eAAO,MAAM,aAAa,yBAAuC,CAAA;AACjE,eAAO,MAAM,OAAO,yBAA8D,CAAA;AAElF,eAAO,MAAM,iBAAiB,yBAA2C,CAAA;AACzE,eAAO,MAAM,qBAAqB,yBAA+C,CAAA;AACjF,eAAO,MAAM,YAAY,yBAAsC,CAAA;AAC/D,eAAO,MAAM,YAAY,yBAAsC,CAAA;AAC/D,eAAO,MAAM,YAAY,yBAAsC,CAAA;AAC/D,eAAO,MAAM,eAAe,yBAAyC,CAAA;AACrE,eAAO,MAAM,aAAa,yBAAuC,CAAA;AACjE,eAAO,MAAM,eAAe,yBAAyC,CAAA;AACrE,eAAO,MAAM,uBAAuB,yBAAiD,CAAA;AACrF,eAAO,MAAM,qBAAqB,yBAA+C,CAAA;AACjF,eAAO,MAAM,oBAAoB,yBAA8C,CAAA;AAC/E,eAAO,MAAM,OAAO,yBAA8D,CAAA;AAElF,OAAO,EAAE,YAAY,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
workerName
|
|
3
|
+
} from "./index-62b3gt2g.js";
|
|
4
|
+
import {
|
|
5
|
+
env
|
|
6
|
+
} from "./index-9ats0s83.js";
|
|
7
|
+
import"./index-npc1c8jx.js";
|
|
8
|
+
import {
|
|
9
|
+
BridgeClient,
|
|
10
|
+
createEnvProxy,
|
|
11
|
+
getClient,
|
|
12
|
+
initEnv,
|
|
13
|
+
setBindingHints
|
|
14
|
+
} from "./index-ccrh4w3t.js";
|
|
15
|
+
import {
|
|
16
|
+
defineConfig,
|
|
17
|
+
ref,
|
|
18
|
+
resolveRef,
|
|
19
|
+
serviceBinding
|
|
20
|
+
} from "./index-v8vvsn9x.js";
|
|
21
|
+
import {
|
|
22
|
+
durableObject,
|
|
23
|
+
getDurableObjectOptions
|
|
24
|
+
} from "./index-a855bdsx.js";
|
|
25
|
+
import"./index-37x76zdn.js";
|
|
26
|
+
|
|
27
|
+
// src/browser.ts
|
|
28
|
+
function createUnsupportedApiError(name) {
|
|
29
|
+
return new Error(`${name} is not available in worker/browser bundles. ` + `Import it from the Node-side devflare package entry instead.`);
|
|
30
|
+
}
|
|
31
|
+
function unsupportedFunction(name) {
|
|
32
|
+
return (..._args) => {
|
|
33
|
+
throw createUnsupportedApiError(name);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function createUnsupportedObject(name) {
|
|
37
|
+
return new Proxy({}, {
|
|
38
|
+
get() {
|
|
39
|
+
throw createUnsupportedApiError(name);
|
|
40
|
+
},
|
|
41
|
+
has() {
|
|
42
|
+
return false;
|
|
43
|
+
},
|
|
44
|
+
ownKeys() {
|
|
45
|
+
return [];
|
|
46
|
+
},
|
|
47
|
+
getOwnPropertyDescriptor() {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async function loadConfig(..._args) {
|
|
53
|
+
throw createUnsupportedApiError("loadConfig");
|
|
54
|
+
}
|
|
55
|
+
var compileConfig = unsupportedFunction("compileConfig");
|
|
56
|
+
var stringifyConfig = unsupportedFunction("stringifyConfig");
|
|
57
|
+
var configSchema = createUnsupportedObject("configSchema");
|
|
58
|
+
|
|
59
|
+
class ConfigNotFoundError extends Error {
|
|
60
|
+
code = "CONFIG_NOT_FOUND";
|
|
61
|
+
constructor(..._args) {
|
|
62
|
+
super(createUnsupportedApiError("ConfigNotFoundError").message);
|
|
63
|
+
this.name = "ConfigNotFoundError";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
class ConfigValidationError extends Error {
|
|
68
|
+
code = "CONFIG_VALIDATION_ERROR";
|
|
69
|
+
constructor(..._args) {
|
|
70
|
+
super(createUnsupportedApiError("ConfigValidationError").message);
|
|
71
|
+
this.name = "ConfigValidationError";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
var runCli = unsupportedFunction("runCli");
|
|
75
|
+
var parseArgs = unsupportedFunction("parseArgs");
|
|
76
|
+
var findDurableObjectClasses = unsupportedFunction("findDurableObjectClasses");
|
|
77
|
+
var findDurableObjectClassesDetailed = unsupportedFunction("findDurableObjectClassesDetailed");
|
|
78
|
+
var generateWrapper = unsupportedFunction("generateWrapper");
|
|
79
|
+
var transformDurableObject = unsupportedFunction("transformDurableObject");
|
|
80
|
+
var transformWorkerEntrypoint = unsupportedFunction("transformWorkerEntrypoint");
|
|
81
|
+
var findExportedFunctions = unsupportedFunction("findExportedFunctions");
|
|
82
|
+
var shouldTransformWorker = unsupportedFunction("shouldTransformWorker");
|
|
83
|
+
var generateRpcInterface = unsupportedFunction("generateRpcInterface");
|
|
84
|
+
var startMiniflare = unsupportedFunction("startMiniflare");
|
|
85
|
+
var startMiniflareFromConfig = unsupportedFunction("startMiniflareFromConfig");
|
|
86
|
+
var getMiniflare = unsupportedFunction("getMiniflare");
|
|
87
|
+
var stopMiniflare = unsupportedFunction("stopMiniflare");
|
|
88
|
+
var gateway = createUnsupportedObject("gateway");
|
|
89
|
+
var createTestContext = unsupportedFunction("createTestContext");
|
|
90
|
+
var createMockTestContext = unsupportedFunction("createMockTestContext");
|
|
91
|
+
var createMockKV = unsupportedFunction("createMockKV");
|
|
92
|
+
var createMockD1 = unsupportedFunction("createMockD1");
|
|
93
|
+
var createMockR2 = unsupportedFunction("createMockR2");
|
|
94
|
+
var createMockQueue = unsupportedFunction("createMockQueue");
|
|
95
|
+
var createMockEnv = unsupportedFunction("createMockEnv");
|
|
96
|
+
var withTestContext = unsupportedFunction("withTestContext");
|
|
97
|
+
var createBridgeTestContext = unsupportedFunction("createBridgeTestContext");
|
|
98
|
+
var stopBridgeTestContext = unsupportedFunction("stopBridgeTestContext");
|
|
99
|
+
var getBridgeTestContext = unsupportedFunction("getBridgeTestContext");
|
|
100
|
+
var testEnv = createUnsupportedObject("testEnv");
|
|
101
|
+
export {
|
|
102
|
+
workerName,
|
|
103
|
+
withTestContext,
|
|
104
|
+
transformWorkerEntrypoint,
|
|
105
|
+
transformDurableObject,
|
|
106
|
+
testEnv,
|
|
107
|
+
stringifyConfig,
|
|
108
|
+
stopMiniflare,
|
|
109
|
+
stopBridgeTestContext,
|
|
110
|
+
startMiniflareFromConfig,
|
|
111
|
+
startMiniflare,
|
|
112
|
+
shouldTransformWorker,
|
|
113
|
+
setBindingHints,
|
|
114
|
+
serviceBinding,
|
|
115
|
+
runCli,
|
|
116
|
+
resolveRef,
|
|
117
|
+
ref,
|
|
118
|
+
parseArgs,
|
|
119
|
+
loadConfig,
|
|
120
|
+
initEnv,
|
|
121
|
+
getMiniflare,
|
|
122
|
+
getDurableObjectOptions,
|
|
123
|
+
getClient,
|
|
124
|
+
getBridgeTestContext,
|
|
125
|
+
generateWrapper,
|
|
126
|
+
generateRpcInterface,
|
|
127
|
+
gateway,
|
|
128
|
+
findExportedFunctions,
|
|
129
|
+
findDurableObjectClassesDetailed,
|
|
130
|
+
findDurableObjectClasses,
|
|
131
|
+
env,
|
|
132
|
+
durableObject,
|
|
133
|
+
defineConfig,
|
|
134
|
+
defineConfig as default,
|
|
135
|
+
createTestContext,
|
|
136
|
+
createMockTestContext,
|
|
137
|
+
createMockR2,
|
|
138
|
+
createMockQueue,
|
|
139
|
+
createMockKV,
|
|
140
|
+
createMockEnv,
|
|
141
|
+
createMockD1,
|
|
142
|
+
createEnvProxy,
|
|
143
|
+
createBridgeTestContext,
|
|
144
|
+
configSchema,
|
|
145
|
+
compileConfig,
|
|
146
|
+
ConfigValidationError,
|
|
147
|
+
ConfigNotFoundError,
|
|
148
|
+
BridgeClient
|
|
149
|
+
};
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
detectViteProject
|
|
3
|
+
} from "./index-18hvb6gb.js";
|
|
4
|
+
import {
|
|
5
|
+
getDependencies
|
|
6
|
+
} from "./index-1xpj0m4r.js";
|
|
7
|
+
import {
|
|
8
|
+
prepareComposedWorkerEntrypoint
|
|
9
|
+
} from "./index-a0fjkq68.js";
|
|
1
10
|
import {
|
|
2
11
|
compileConfig,
|
|
3
12
|
writeWranglerConfig
|
|
@@ -5,9 +14,6 @@ import {
|
|
|
5
14
|
import {
|
|
6
15
|
loadConfig
|
|
7
16
|
} from "./index-hcex3rgh.js";
|
|
8
|
-
import {
|
|
9
|
-
getDependencies
|
|
10
|
-
} from "./index-1xpj0m4r.js";
|
|
11
17
|
import"./index-37x76zdn.js";
|
|
12
18
|
|
|
13
19
|
// src/cli/commands/build.ts
|
|
@@ -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,3 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
detectViteProject
|
|
3
|
+
} from "./index-18hvb6gb.js";
|
|
4
|
+
import {
|
|
5
|
+
getDependencies
|
|
6
|
+
} from "./index-1xpj0m4r.js";
|
|
7
|
+
import {
|
|
8
|
+
prepareComposedWorkerEntrypoint
|
|
9
|
+
} from "./index-a0fjkq68.js";
|
|
1
10
|
import {
|
|
2
11
|
compileConfig,
|
|
3
12
|
stringifyConfig,
|
|
@@ -6,9 +15,6 @@ import {
|
|
|
6
15
|
import {
|
|
7
16
|
loadConfig
|
|
8
17
|
} from "./index-hcex3rgh.js";
|
|
9
|
-
import {
|
|
10
|
-
getDependencies
|
|
11
|
-
} from "./index-1xpj0m4r.js";
|
|
12
18
|
import"./index-37x76zdn.js";
|
|
13
19
|
|
|
14
20
|
// src/cli/commands/deploy.ts
|
|
@@ -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
|
});
|