@cloudflare/deploy-helpers 0.27.2 → 0.29.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/context-B9S8CBD7.d.mts +214 -0
- package/dist/context.d.mts +2 -3
- package/dist/context.mjs +38 -5
- package/dist/create-worker-upload-form-DhzLEfNO.mjs +579 -0
- package/dist/create-worker-upload-form.d.mts +11 -13
- package/dist/create-worker-upload-form.mjs +1 -5
- package/dist/index.d.mts +712 -614
- package/dist/index.mjs +15717 -33679
- package/dist/rolldown-runtime-BMUeFane.mjs +30 -0
- package/dist/startup-profile.d.mts +13 -13
- package/dist/startup-profile.mjs +492 -610
- package/package.json +12 -12
- package/dist/chunk-DSGVRFIS.mjs +0 -828
- package/dist/chunk-U6NEESU5.mjs +0 -41
- package/dist/chunk-Y4VATABS.mjs +0 -27
- package/dist/context-BY_xpg-t.d.mts +0 -211
- package/dist/metafile-esm.json +0 -1
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { BuiltContainerImage, BuiltImage, ContainerNormalizedConfig } from "@cloudflare/containers-shared";
|
|
2
|
+
import { CfModule, CfModuleType, CfWorkerSourceMap, Entry, FetchKVGetValueFetcher, FetchListResultFetcher, FetchPagedListResultFetcher, FetchResultFetcher, LegacyAssetPaths, Logger, ValidatedAssetsOptions } from "@cloudflare/workers-utils";
|
|
3
|
+
import { Config, ContainerApp, DurableObjectCodeUpdateStrategy, Route } from "@cloudflare/workers-utils/config";
|
|
4
|
+
//#region src/shared/types.d.ts
|
|
5
|
+
/** API, logging, and prompt implementations supplied by the consumer. */
|
|
6
|
+
type DeployHelpersContext = {
|
|
7
|
+
fetchResult: FetchResultFetcher;
|
|
8
|
+
fetchListResult: FetchListResultFetcher;
|
|
9
|
+
fetchPagedListResult: FetchPagedListResultFetcher;
|
|
10
|
+
fetchKVGetValue: FetchKVGetValueFetcher;
|
|
11
|
+
logger: Logger;
|
|
12
|
+
confirm: (text: string, options?: {
|
|
13
|
+
defaultValue?: boolean;
|
|
14
|
+
fallbackValue?: boolean;
|
|
15
|
+
}) => Promise<boolean>;
|
|
16
|
+
prompt: (text: string, options?: {
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
}) => Promise<string>;
|
|
19
|
+
select: <Values extends string>(text: string, options: {
|
|
20
|
+
choices: {
|
|
21
|
+
title: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
value: Values;
|
|
24
|
+
}[];
|
|
25
|
+
defaultOption?: number;
|
|
26
|
+
fallbackOption?: number;
|
|
27
|
+
}) => Promise<Values>;
|
|
28
|
+
};
|
|
29
|
+
type ContainerlessConfig = Omit<Config, "containers">;
|
|
30
|
+
type BuiltDurableObjectContainerImage = BuiltImage & {
|
|
31
|
+
className: string;
|
|
32
|
+
imageName: string;
|
|
33
|
+
};
|
|
34
|
+
type ContainerDeployConfig = {
|
|
35
|
+
/** Original resolved container configuration. */
|
|
36
|
+
source: ContainerApp[] | undefined;
|
|
37
|
+
standard: {
|
|
38
|
+
/** Normalized non-Durable-Object container applications. */
|
|
39
|
+
normalized: ContainerNormalizedConfig[];
|
|
40
|
+
/** Locally built images awaiting deployment or cleanup. */
|
|
41
|
+
builtImages: BuiltContainerImage[];
|
|
42
|
+
};
|
|
43
|
+
durableObjects: {
|
|
44
|
+
/** Locally built named images awaiting upload or cleanup. */
|
|
45
|
+
builtImages: BuiltDurableObjectContainerImage[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Shared fields produced by merging CLI args with wrangler config.
|
|
50
|
+
* After this point, no raw config/arg merging should happen.
|
|
51
|
+
*
|
|
52
|
+
* Use props for all resolved/merged values. Only access config directly
|
|
53
|
+
* for raw values that aren't merged with CLI args (e.g., config.durable_objects,
|
|
54
|
+
* config.unsafe, config.tail_consumers).
|
|
55
|
+
*/
|
|
56
|
+
type SharedDeployVersionsProps = {
|
|
57
|
+
/** Merged from args.script/config.main/config.site.entry-point/config.assets. */
|
|
58
|
+
entry: Entry;
|
|
59
|
+
/** Merged: --name arg ?? config.name, with CI override applied. Validated as required separately. */
|
|
60
|
+
name: string | undefined;
|
|
61
|
+
/** Merged: --compatibility-date arg ?? config.compatibility_date. Still optional — validated as required later. */
|
|
62
|
+
compatibilityDate: string | undefined;
|
|
63
|
+
/** Merged: --compatibility-flags arg ?? config.compatibility_flags. */
|
|
64
|
+
compatibilityFlags: string[];
|
|
65
|
+
/**
|
|
66
|
+
* Validated/resolved assets directory, merged from --assets arg and
|
|
67
|
+
* config.assets. The full AssetsOptions are resolved later via
|
|
68
|
+
* `resolveAssetOptions`.
|
|
69
|
+
*/
|
|
70
|
+
assetsDir: ValidatedAssetsOptions | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* The user Worker entry, merged: --script arg ?? config.main. Undefined for
|
|
73
|
+
* assets-only Workers. Drives `has_user_worker` when resolving assets.
|
|
74
|
+
*/
|
|
75
|
+
main: string | undefined;
|
|
76
|
+
/** Merged: --keep-vars arg || config.keep_vars. */
|
|
77
|
+
keepVars: boolean;
|
|
78
|
+
/** Merged from --site arg and config.site. */
|
|
79
|
+
isWorkersSite: boolean;
|
|
80
|
+
/** From --dry-run arg. */
|
|
81
|
+
dryRun: boolean;
|
|
82
|
+
/** From --env arg. */
|
|
83
|
+
env: string | undefined;
|
|
84
|
+
/** From --outfile arg. */
|
|
85
|
+
outfile: string | undefined;
|
|
86
|
+
/** From --tag arg. */
|
|
87
|
+
tag: string | undefined;
|
|
88
|
+
/** From --message arg. */
|
|
89
|
+
message: string | undefined;
|
|
90
|
+
/** From --secrets-file arg. */
|
|
91
|
+
secretsFile: string | undefined;
|
|
92
|
+
/** From collectKeyValues(--var arg). CLI-only vars; config vars flow separately via getBindings(config). */
|
|
93
|
+
cliVars: Record<string, string>;
|
|
94
|
+
/** From --experimental-auto-create arg. */
|
|
95
|
+
experimentalAutoCreate: boolean;
|
|
96
|
+
/** Resolved from requireAuth() before calling deploy-helpers. undefined only in dry-run. */
|
|
97
|
+
accountId: string | undefined;
|
|
98
|
+
/** Resolved from getMetricsUsageHeaders() / config.send_metrics. Controls whether usage metrics headers are sent with upload requests. */
|
|
99
|
+
sendMetrics: boolean;
|
|
100
|
+
/** Resolved from getFlag("RESOURCES_PROVISION"). Controls whether bindings are auto-provisioned before upload. */
|
|
101
|
+
resourcesProvision: boolean;
|
|
102
|
+
/** Controls whether provisioned resource IDs are written back to the config file. */
|
|
103
|
+
skipProvisioningConfigWriteback: boolean;
|
|
104
|
+
/** From --strict arg. In strict mode, conflicting pre-upload checks abort instead of auto-continuing. */
|
|
105
|
+
strict: boolean;
|
|
106
|
+
/** Optional consumer-specific message shown when strict mode aborts in a non-interactive session. */
|
|
107
|
+
strictModeAbortMessage?: string;
|
|
108
|
+
/** Container configuration and locally built image state. */
|
|
109
|
+
containers: ContainerDeployConfig;
|
|
110
|
+
/** Whether the resolved Worker name differs from the pre-merge config/args name. */
|
|
111
|
+
workerNameOverridden?: boolean;
|
|
112
|
+
};
|
|
113
|
+
type DeployProps = SharedDeployVersionsProps & {
|
|
114
|
+
/** Discriminant for DeployProps vs VersionsUploadProps */
|
|
115
|
+
command: "deploy";
|
|
116
|
+
/** If set, automatically register this `workers.dev` account subdomain when the account has none. */
|
|
117
|
+
autoRegisterWorkersDevSubdomain?: string;
|
|
118
|
+
/** Merged from --site arg and config.site. */
|
|
119
|
+
legacyAssetPaths: LegacyAssetPaths | undefined;
|
|
120
|
+
/** Merged: --triggers arg ?? config.triggers.crons. */
|
|
121
|
+
triggers: string[] | undefined;
|
|
122
|
+
/** Merged: --routes arg ?? config.routes ?? config.route. AND --domains and custom_domains*/
|
|
123
|
+
routes: Route[];
|
|
124
|
+
/** Merged: --logpush arg ?? config.logpush. */
|
|
125
|
+
logpush: boolean | undefined;
|
|
126
|
+
/** From --dispatch-namespace arg. Deploy-only (Workers for Platforms). */
|
|
127
|
+
dispatchNamespace: string | undefined;
|
|
128
|
+
/** From --old-asset-ttl arg. Deploy-only. */
|
|
129
|
+
oldAssetTtl: number | undefined;
|
|
130
|
+
/** From --containers-rollout arg. Deploy-only. */
|
|
131
|
+
containersRollout: "immediate" | "gradual" | "none" | undefined;
|
|
132
|
+
/** Controls how Durable Object code updates are applied. */
|
|
133
|
+
durableObjectsCodeUpdateStrategy?: DurableObjectCodeUpdateStrategy;
|
|
134
|
+
/**
|
|
135
|
+
* When true, an existing Worker with the same name aborts the deploy instead
|
|
136
|
+
* of updating it, because this run cannot confirm the local project owns the
|
|
137
|
+
* remote Worker. Set for non-interactive deploys with no pre-existing config
|
|
138
|
+
* file when either the name was generated automatically (no user-supplied
|
|
139
|
+
* name) or the deploy is the Pages-to-Workers delegation (where the name is a
|
|
140
|
+
* Pages project name carried across, not proof of Worker ownership). Deploys
|
|
141
|
+
* that carry a config file naming the Worker leave this false and update it as
|
|
142
|
+
* normal.
|
|
143
|
+
*/
|
|
144
|
+
failIfWorkerNameTaken?: boolean;
|
|
145
|
+
};
|
|
146
|
+
type VersionsUploadProps = SharedDeployVersionsProps & {
|
|
147
|
+
/** Discriminant for DeployProps vs VersionsUploadProps */
|
|
148
|
+
command: "versions upload";
|
|
149
|
+
/** CLI-only (--preview-alias), or auto-generated from CI branch name. */
|
|
150
|
+
previewAlias: string | undefined;
|
|
151
|
+
};
|
|
152
|
+
type WorkerBuildResult = {
|
|
153
|
+
modules: CfModule[];
|
|
154
|
+
sourceMaps: CfWorkerSourceMap[] | undefined;
|
|
155
|
+
dependencies: Record<string, {
|
|
156
|
+
bytesInOutput: number;
|
|
157
|
+
}>;
|
|
158
|
+
resolvedEntryPointPath: string;
|
|
159
|
+
bundleType: CfModuleType;
|
|
160
|
+
content: string;
|
|
161
|
+
};
|
|
162
|
+
interface TriggerDeployment {
|
|
163
|
+
targets: string[];
|
|
164
|
+
changed?: boolean;
|
|
165
|
+
category?: string;
|
|
166
|
+
resource?: string;
|
|
167
|
+
error?: Error;
|
|
168
|
+
}
|
|
169
|
+
type TriggerProps = {
|
|
170
|
+
config: Config;
|
|
171
|
+
accountId: string | undefined;
|
|
172
|
+
scriptName: string;
|
|
173
|
+
workerTag?: string | null;
|
|
174
|
+
crons: string[] | undefined;
|
|
175
|
+
routes: Route[];
|
|
176
|
+
firstDeploy: boolean;
|
|
177
|
+
dryRun: boolean;
|
|
178
|
+
showDiff?: boolean;
|
|
179
|
+
validated: boolean;
|
|
180
|
+
queueCreateCommand: (queueName: string) => string;
|
|
181
|
+
workersDevConfigFieldName: string;
|
|
182
|
+
workersDevConfigAssignment: (value: boolean) => string;
|
|
183
|
+
previewUrlsConfigFieldName: string;
|
|
184
|
+
previewUrlsConfigAssignment: (value: boolean) => string;
|
|
185
|
+
};
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/shared/context.d.ts
|
|
188
|
+
/**
|
|
189
|
+
* Module-level context globals for deploy-helpers.
|
|
190
|
+
*
|
|
191
|
+
* These are typed as non-nullable but are
|
|
192
|
+
* undefined until initDeployHelpersContext() is called. Consumers must import the live binding directly (e.g. `import { logger }`)
|
|
193
|
+
* and NOT destructure or cache the value at module-load time, otherwise they will
|
|
194
|
+
* capture `undefined` before init runs.
|
|
195
|
+
*
|
|
196
|
+
* Example:
|
|
197
|
+
* import { logger } from "./context"; // correct: live binding
|
|
198
|
+
* const { logger } = await import("./context"); // WRONG: captures undefined
|
|
199
|
+
*/
|
|
200
|
+
declare let logger: Logger;
|
|
201
|
+
declare let fetchResult: FetchResultFetcher;
|
|
202
|
+
declare let fetchListResult: FetchListResultFetcher;
|
|
203
|
+
declare let fetchPagedListResult: FetchPagedListResultFetcher;
|
|
204
|
+
declare let fetchKVGetValue: FetchKVGetValueFetcher;
|
|
205
|
+
declare let confirm: DeployHelpersContext["confirm"];
|
|
206
|
+
declare let prompt: DeployHelpersContext["prompt"];
|
|
207
|
+
declare let select: DeployHelpersContext["select"];
|
|
208
|
+
/**
|
|
209
|
+
* Set the global context for deploy-helpers. Must be called once at
|
|
210
|
+
* startup before any deploy-helpers function that needs these values.
|
|
211
|
+
*/
|
|
212
|
+
declare function initDeployHelpersContext(ctx: DeployHelpersContext): void;
|
|
213
|
+
//#endregion
|
|
214
|
+
export { TriggerProps as _, fetchResult as a, prompt as c, ContainerDeployConfig as d, ContainerlessConfig as f, TriggerDeployment as g, SharedDeployVersionsProps as h, fetchPagedListResult as i, select as l, DeployProps as m, fetchKVGetValue as n, initDeployHelpersContext as o, DeployHelpersContext as p, fetchListResult as r, logger as s, confirm as t, BuiltDurableObjectContainerImage as u, VersionsUploadProps as v, WorkerBuildResult as y };
|
package/dist/context.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import '@cloudflare/containers-shared';
|
|
1
|
+
import { a as fetchResult, c as prompt, i as fetchPagedListResult, l as select, n as fetchKVGetValue, o as initDeployHelpersContext, r as fetchListResult, s as logger, t as confirm } from "./context-B9S8CBD7.mjs";
|
|
2
|
+
export { confirm, fetchKVGetValue, fetchListResult, fetchPagedListResult, fetchResult, initDeployHelpersContext, logger, prompt, select };
|
package/dist/context.mjs
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import "./rolldown-runtime-BMUeFane.mjs";
|
|
2
|
+
//#region src/shared/context.ts
|
|
3
|
+
/**
|
|
4
|
+
* Module-level context globals for deploy-helpers.
|
|
5
|
+
*
|
|
6
|
+
* These are typed as non-nullable but are
|
|
7
|
+
* undefined until initDeployHelpersContext() is called. Consumers must import the live binding directly (e.g. `import { logger }`)
|
|
8
|
+
* and NOT destructure or cache the value at module-load time, otherwise they will
|
|
9
|
+
* capture `undefined` before init runs.
|
|
10
|
+
*
|
|
11
|
+
* Example:
|
|
12
|
+
* import { logger } from "./context"; // correct: live binding
|
|
13
|
+
* const { logger } = await import("./context"); // WRONG: captures undefined
|
|
14
|
+
*/
|
|
15
|
+
let logger;
|
|
16
|
+
let fetchResult;
|
|
17
|
+
let fetchListResult;
|
|
18
|
+
let fetchPagedListResult;
|
|
19
|
+
let fetchKVGetValue;
|
|
20
|
+
let confirm;
|
|
21
|
+
let prompt;
|
|
22
|
+
let select;
|
|
23
|
+
/**
|
|
24
|
+
* Set the global context for deploy-helpers. Must be called once at
|
|
25
|
+
* startup before any deploy-helpers function that needs these values.
|
|
26
|
+
*/
|
|
27
|
+
function initDeployHelpersContext(ctx) {
|
|
28
|
+
logger = ctx.logger;
|
|
29
|
+
fetchResult = ctx.fetchResult;
|
|
30
|
+
fetchListResult = ctx.fetchListResult;
|
|
31
|
+
fetchPagedListResult = ctx.fetchPagedListResult;
|
|
32
|
+
fetchKVGetValue = ctx.fetchKVGetValue;
|
|
33
|
+
confirm = ctx.confirm;
|
|
34
|
+
prompt = ctx.prompt;
|
|
35
|
+
select = ctx.select;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { confirm, fetchKVGetValue, fetchListResult, fetchPagedListResult, fetchResult, initDeployHelpersContext, logger, prompt, select };
|