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