@moku-labs/worker 0.6.0 → 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/{cli-DgZv5A0G.mjs → cli-Bb37rYq_.mjs} +1253 -501
- package/dist/{cli-Dc0q0hIy.cjs → cli-C8DdTtzn.cjs} +1254 -502
- package/dist/cli.cjs +1 -1
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{index-VZ99IAMv.d.cts → index-BKOUpKtC.d.cts} +60 -9
- package/dist/{index-VZ99IAMv.d.mts → index-BKOUpKtC.d.mts} +60 -9
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +331 -163
- package/dist/index.d.mts +331 -163
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_cli = require("./cli-
|
|
2
|
+
const require_cli = require("./cli-C8DdTtzn.cjs");
|
|
3
3
|
exports.cliPlugin = require_cli.cliPlugin;
|
|
4
4
|
exports.deployPlugin = require_cli.deployPlugin;
|
package/dist/cli.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as ResourceManifest, n as cliPlugin, r as ExternalManifest, t as deployPlugin } from "./index-
|
|
1
|
+
import { i as ResourceManifest, n as cliPlugin, r as ExternalManifest, t as deployPlugin } from "./index-BKOUpKtC.cjs";
|
|
2
2
|
export { type ExternalManifest, type ResourceManifest, cliPlugin, deployPlugin };
|
package/dist/cli.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as ResourceManifest, n as cliPlugin, r as ExternalManifest, t as deployPlugin } from "./index-
|
|
1
|
+
import { i as ResourceManifest, n as cliPlugin, r as ExternalManifest, t as deployPlugin } from "./index-BKOUpKtC.mjs";
|
|
2
2
|
export { type ExternalManifest, type ResourceManifest, cliPlugin, deployPlugin };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as deployPlugin, t as cliPlugin } from "./cli-
|
|
1
|
+
import { n as deployPlugin, t as cliPlugin } from "./cli-Bb37rYq_.mjs";
|
|
2
2
|
export { cliPlugin, deployPlugin };
|
|
@@ -109,6 +109,32 @@ type Config$1 = {
|
|
|
109
109
|
* Also the file parsed in the universal/non-moku path.
|
|
110
110
|
*/
|
|
111
111
|
configFile: string;
|
|
112
|
+
/**
|
|
113
|
+
* The Worker entry module → wrangler `main` (e.g. "src/cloudflare/worker.ts"). Required for any
|
|
114
|
+
* real Worker deploy (its absence is wrangler's "Missing entry-point" error).
|
|
115
|
+
*/
|
|
116
|
+
entry?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Enable Node.js compat → `compatibility_flags: ["nodejs_compat"]`. Needed when the Worker bundle
|
|
119
|
+
* pulls in Node-flavored code (e.g. composing the deploy/cli tooling into the runtime app).
|
|
120
|
+
*/
|
|
121
|
+
nodeCompat?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Static assets served via `env.<binding>` → the wrangler `assets` block. `spa: true` sets
|
|
124
|
+
* `not_found_handling: "single-page-application"` so client-routed deep links resolve to index.html.
|
|
125
|
+
*/
|
|
126
|
+
assets?: {
|
|
127
|
+
binding: string;
|
|
128
|
+
directory: string;
|
|
129
|
+
spa?: boolean;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Escape hatch — extra top-level wrangler keys merged into the generated config for anything the
|
|
133
|
+
* typed fields above don't cover (`vars`, `routes`, `observability`, `triggers`, …). The
|
|
134
|
+
* deploy-managed resource keys (name, compatibility_date, kv_namespaces, r2_buckets, d1_databases,
|
|
135
|
+
* queues, durable_objects, and the auto-derived Durable Object `migrations`) always win over these.
|
|
136
|
+
*/
|
|
137
|
+
wrangler?: Record<string, unknown>;
|
|
112
138
|
/**
|
|
113
139
|
* Standing CI/automated default for `run()`. When true (or when stdout is non-TTY) the deploy
|
|
114
140
|
* never prompts and auto-confirms every gate; `run({ ci })` overrides it per call. CF credentials
|
|
@@ -127,24 +153,35 @@ type Config$1 = {
|
|
|
127
153
|
migrateLocal: boolean; /** Debounce window (ms) coalescing rapid file changes into one rebuild. */
|
|
128
154
|
debounceMs: number;
|
|
129
155
|
};
|
|
130
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Discriminated union of per-INSTANCE resource descriptors. Each resource plugin's `deployManifest()`
|
|
158
|
+
* returns an ARRAY of these (one per configured instance). `name` is the base Cloudflare resource
|
|
159
|
+
* name (stage-suffixed downstream via {@link stageName}); `binding` is the stable env var. Durable
|
|
160
|
+
* Objects carry no provisioned `name` — they ship with the Worker script — and declare the exported
|
|
161
|
+
* `className` instead.
|
|
162
|
+
*/
|
|
131
163
|
type ResourceManifest = {
|
|
132
164
|
kind: "r2";
|
|
133
|
-
|
|
165
|
+
name: string;
|
|
166
|
+
binding: string;
|
|
134
167
|
upload?: string;
|
|
135
168
|
} | {
|
|
136
169
|
kind: "kv";
|
|
170
|
+
name: string;
|
|
137
171
|
binding: string;
|
|
138
172
|
} | {
|
|
139
173
|
kind: "d1";
|
|
174
|
+
name: string;
|
|
140
175
|
binding: string;
|
|
141
176
|
migrations?: string;
|
|
142
177
|
} | {
|
|
143
178
|
kind: "queue";
|
|
144
|
-
|
|
179
|
+
name: string;
|
|
180
|
+
binding: string;
|
|
145
181
|
} | {
|
|
146
182
|
kind: "do";
|
|
147
|
-
|
|
183
|
+
binding: string;
|
|
184
|
+
className: string;
|
|
148
185
|
};
|
|
149
186
|
/**
|
|
150
187
|
* The whole deploy manifest the pipeline consumes (assembled, or caller-supplied for the
|
|
@@ -174,12 +211,23 @@ type InfraPlan = {
|
|
|
174
211
|
missing: ResourceManifest[];
|
|
175
212
|
};
|
|
176
213
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
214
|
+
* A resource that failed to provision, with the (branded) error message captured so the guided flow
|
|
215
|
+
* can show WHICH resource failed and why — instead of aborting the whole run on the first failure.
|
|
216
|
+
*/
|
|
217
|
+
type ProvisionFailure = {
|
|
218
|
+
/** The resource descriptor that failed to create. */resource: ResourceManifest; /** The captured error message (e.g. the branded wrangler failure). */
|
|
219
|
+
error: string;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Outcome of acting on an {@link InfraPlan}: the resources just created, those skipped because they
|
|
223
|
+
* already existed, those that FAILED to create, and the merged id map (binding → Cloudflare id) for
|
|
224
|
+
* the config writer. Provisioning is resilient — a single resource failure is captured here, not
|
|
225
|
+
* thrown, so the guided flow can report a clear per-resource result.
|
|
179
226
|
*/
|
|
180
227
|
type ProvisionResult = {
|
|
181
228
|
/** Resources created during this run. */created: ProvisionedRef[]; /** Resources skipped because they already existed. */
|
|
182
|
-
skipped: ProvisionedRef[]; /**
|
|
229
|
+
skipped: ProvisionedRef[]; /** Resources that failed to create (captured, not thrown). */
|
|
230
|
+
failed: ProvisionFailure[]; /** Merged binding → Cloudflare id map (existing + created) for writeWranglerConfig. */
|
|
183
231
|
ids: Record<string, string>;
|
|
184
232
|
};
|
|
185
233
|
/** Result of verifying the `.env` Cloudflare API token and resolving its account. */
|
|
@@ -332,13 +380,15 @@ declare const cliPlugin: import("@moku-labs/core").PluginInstance<"cli", Config,
|
|
|
332
380
|
declare const deployPlugin: import("@moku-labs/core").PluginInstance<"deploy", Config$1, Record<string, never>, {
|
|
333
381
|
run(opts?: {
|
|
334
382
|
ci?: boolean;
|
|
383
|
+
stage?: string;
|
|
335
384
|
webBuild?: WebBuild;
|
|
336
385
|
manifest?: ExternalManifest;
|
|
337
386
|
}): Promise<void>;
|
|
338
|
-
dev
|
|
387
|
+
dev(opts?: {
|
|
339
388
|
port?: number;
|
|
389
|
+
stage?: string;
|
|
340
390
|
webBuild?: WebBuild;
|
|
341
|
-
})
|
|
391
|
+
}): Promise<void>;
|
|
342
392
|
init: (opts?: {
|
|
343
393
|
ci?: boolean;
|
|
344
394
|
}) => Promise<void>;
|
|
@@ -346,6 +396,7 @@ declare const deployPlugin: import("@moku-labs/core").PluginInstance<"deploy", C
|
|
|
346
396
|
provisionInfra: (plan: InfraPlan) => Promise<ProvisionResult>;
|
|
347
397
|
verifyAuth: () => Promise<AuthStatus>;
|
|
348
398
|
requiredToken: () => TokenRequirement;
|
|
399
|
+
ciToken: () => PermissionGroup[];
|
|
349
400
|
tokenInstructions: () => string;
|
|
350
401
|
wrangler: (args: string[]) => Promise<void>;
|
|
351
402
|
}, {}> & Record<never, never>;
|
|
@@ -109,6 +109,32 @@ type Config$1 = {
|
|
|
109
109
|
* Also the file parsed in the universal/non-moku path.
|
|
110
110
|
*/
|
|
111
111
|
configFile: string;
|
|
112
|
+
/**
|
|
113
|
+
* The Worker entry module → wrangler `main` (e.g. "src/cloudflare/worker.ts"). Required for any
|
|
114
|
+
* real Worker deploy (its absence is wrangler's "Missing entry-point" error).
|
|
115
|
+
*/
|
|
116
|
+
entry?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Enable Node.js compat → `compatibility_flags: ["nodejs_compat"]`. Needed when the Worker bundle
|
|
119
|
+
* pulls in Node-flavored code (e.g. composing the deploy/cli tooling into the runtime app).
|
|
120
|
+
*/
|
|
121
|
+
nodeCompat?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Static assets served via `env.<binding>` → the wrangler `assets` block. `spa: true` sets
|
|
124
|
+
* `not_found_handling: "single-page-application"` so client-routed deep links resolve to index.html.
|
|
125
|
+
*/
|
|
126
|
+
assets?: {
|
|
127
|
+
binding: string;
|
|
128
|
+
directory: string;
|
|
129
|
+
spa?: boolean;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Escape hatch — extra top-level wrangler keys merged into the generated config for anything the
|
|
133
|
+
* typed fields above don't cover (`vars`, `routes`, `observability`, `triggers`, …). The
|
|
134
|
+
* deploy-managed resource keys (name, compatibility_date, kv_namespaces, r2_buckets, d1_databases,
|
|
135
|
+
* queues, durable_objects, and the auto-derived Durable Object `migrations`) always win over these.
|
|
136
|
+
*/
|
|
137
|
+
wrangler?: Record<string, unknown>;
|
|
112
138
|
/**
|
|
113
139
|
* Standing CI/automated default for `run()`. When true (or when stdout is non-TTY) the deploy
|
|
114
140
|
* never prompts and auto-confirms every gate; `run({ ci })` overrides it per call. CF credentials
|
|
@@ -127,24 +153,35 @@ type Config$1 = {
|
|
|
127
153
|
migrateLocal: boolean; /** Debounce window (ms) coalescing rapid file changes into one rebuild. */
|
|
128
154
|
debounceMs: number;
|
|
129
155
|
};
|
|
130
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Discriminated union of per-INSTANCE resource descriptors. Each resource plugin's `deployManifest()`
|
|
158
|
+
* returns an ARRAY of these (one per configured instance). `name` is the base Cloudflare resource
|
|
159
|
+
* name (stage-suffixed downstream via {@link stageName}); `binding` is the stable env var. Durable
|
|
160
|
+
* Objects carry no provisioned `name` — they ship with the Worker script — and declare the exported
|
|
161
|
+
* `className` instead.
|
|
162
|
+
*/
|
|
131
163
|
type ResourceManifest = {
|
|
132
164
|
kind: "r2";
|
|
133
|
-
|
|
165
|
+
name: string;
|
|
166
|
+
binding: string;
|
|
134
167
|
upload?: string;
|
|
135
168
|
} | {
|
|
136
169
|
kind: "kv";
|
|
170
|
+
name: string;
|
|
137
171
|
binding: string;
|
|
138
172
|
} | {
|
|
139
173
|
kind: "d1";
|
|
174
|
+
name: string;
|
|
140
175
|
binding: string;
|
|
141
176
|
migrations?: string;
|
|
142
177
|
} | {
|
|
143
178
|
kind: "queue";
|
|
144
|
-
|
|
179
|
+
name: string;
|
|
180
|
+
binding: string;
|
|
145
181
|
} | {
|
|
146
182
|
kind: "do";
|
|
147
|
-
|
|
183
|
+
binding: string;
|
|
184
|
+
className: string;
|
|
148
185
|
};
|
|
149
186
|
/**
|
|
150
187
|
* The whole deploy manifest the pipeline consumes (assembled, or caller-supplied for the
|
|
@@ -174,12 +211,23 @@ type InfraPlan = {
|
|
|
174
211
|
missing: ResourceManifest[];
|
|
175
212
|
};
|
|
176
213
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
214
|
+
* A resource that failed to provision, with the (branded) error message captured so the guided flow
|
|
215
|
+
* can show WHICH resource failed and why — instead of aborting the whole run on the first failure.
|
|
216
|
+
*/
|
|
217
|
+
type ProvisionFailure = {
|
|
218
|
+
/** The resource descriptor that failed to create. */resource: ResourceManifest; /** The captured error message (e.g. the branded wrangler failure). */
|
|
219
|
+
error: string;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Outcome of acting on an {@link InfraPlan}: the resources just created, those skipped because they
|
|
223
|
+
* already existed, those that FAILED to create, and the merged id map (binding → Cloudflare id) for
|
|
224
|
+
* the config writer. Provisioning is resilient — a single resource failure is captured here, not
|
|
225
|
+
* thrown, so the guided flow can report a clear per-resource result.
|
|
179
226
|
*/
|
|
180
227
|
type ProvisionResult = {
|
|
181
228
|
/** Resources created during this run. */created: ProvisionedRef[]; /** Resources skipped because they already existed. */
|
|
182
|
-
skipped: ProvisionedRef[]; /**
|
|
229
|
+
skipped: ProvisionedRef[]; /** Resources that failed to create (captured, not thrown). */
|
|
230
|
+
failed: ProvisionFailure[]; /** Merged binding → Cloudflare id map (existing + created) for writeWranglerConfig. */
|
|
183
231
|
ids: Record<string, string>;
|
|
184
232
|
};
|
|
185
233
|
/** Result of verifying the `.env` Cloudflare API token and resolving its account. */
|
|
@@ -332,13 +380,15 @@ declare const cliPlugin: import("@moku-labs/core").PluginInstance<"cli", Config,
|
|
|
332
380
|
declare const deployPlugin: import("@moku-labs/core").PluginInstance<"deploy", Config$1, Record<string, never>, {
|
|
333
381
|
run(opts?: {
|
|
334
382
|
ci?: boolean;
|
|
383
|
+
stage?: string;
|
|
335
384
|
webBuild?: WebBuild;
|
|
336
385
|
manifest?: ExternalManifest;
|
|
337
386
|
}): Promise<void>;
|
|
338
|
-
dev
|
|
387
|
+
dev(opts?: {
|
|
339
388
|
port?: number;
|
|
389
|
+
stage?: string;
|
|
340
390
|
webBuild?: WebBuild;
|
|
341
|
-
})
|
|
391
|
+
}): Promise<void>;
|
|
342
392
|
init: (opts?: {
|
|
343
393
|
ci?: boolean;
|
|
344
394
|
}) => Promise<void>;
|
|
@@ -346,6 +396,7 @@ declare const deployPlugin: import("@moku-labs/core").PluginInstance<"deploy", C
|
|
|
346
396
|
provisionInfra: (plan: InfraPlan) => Promise<ProvisionResult>;
|
|
347
397
|
verifyAuth: () => Promise<AuthStatus>;
|
|
348
398
|
requiredToken: () => TokenRequirement;
|
|
399
|
+
ciToken: () => PermissionGroup[];
|
|
349
400
|
tokenInstructions: () => string;
|
|
350
401
|
wrangler: (args: string[]) => Promise<void>;
|
|
351
402
|
}, {}> & Record<never, never>;
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_cli = require("./cli-
|
|
2
|
+
const require_cli = require("./cli-C8DdTtzn.cjs");
|
|
3
3
|
let _moku_labs_common = require("@moku-labs/common");
|
|
4
4
|
//#region src/env-provider.ts
|
|
5
5
|
/**
|