wrangler 4.99.0 → 4.101.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/bin/cf-wrangler.js +115 -0
- package/package.json +31 -19
- package/templates/startDevWorker/InspectorProxyWorker.ts +19 -5
- package/wrangler-dist/InspectorProxyWorker.js +10 -4
- package/wrangler-dist/cli.d.ts +316 -273
- package/wrangler-dist/cli.js +213004 -194764
- package/wrangler-dist/experimental-config.d.mts +1516 -0
- package/wrangler-dist/experimental-config.d.mts.map +1 -0
- package/wrangler-dist/experimental-config.mjs +208 -0
- package/wrangler-dist/experimental-config.mjs.map +1 -0
- package/wrangler-dist/metafile-cjs.json +1 -1
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Rule as Rule$1, CfModule, Environment as Environment$1, Entry, CfModuleType,
|
|
1
|
+
import { Rule as Rule$1, CfModule, Environment as Environment$1, Entry, CfModuleType, StartDevWorkerInput, NodeJSCompatMode, CfScriptFormat, Config as Config$1, AsyncHook, CfAccount as CfAccount$1, AssetsOptions as AssetsOptions$1, Binding, ConfigBindingFieldName, RawConfig as RawConfig$1, NormalizeAndValidateConfigArgs, ResolveConfigPathOptions, PackageJSON, ApiCredentials, ParseError, LoggerLevel, ComplianceConfig, UserError, FatalError } from '@cloudflare/workers-utils';
|
|
2
2
|
export { Binding, experimental_patchConfig, experimental_readRawConfig, defaultWranglerConfig as unstable_defaultWranglerConfig } from '@cloudflare/workers-utils';
|
|
3
|
-
import { Json as Json$1,
|
|
3
|
+
import { Json as Json$1, WorkerdStructuredLog, DispatchFetch, Miniflare, WorkerRegistry, MiniflareOptions, Mutex, Response as Response$1, RemoteProxyConnectionString, WorkerOptions, ModuleRule, Request } from 'miniflare';
|
|
4
4
|
import * as undici from 'undici';
|
|
5
5
|
import { RequestInfo, RequestInit, Response, FormData } from 'undici';
|
|
6
6
|
import { Metafile } from 'esbuild';
|
|
@@ -9,6 +9,7 @@ import { EventEmitter } from 'node:events';
|
|
|
9
9
|
import { ContainerNormalizedConfig } from '@cloudflare/containers-shared';
|
|
10
10
|
import { FetcherScheduledOptions, FetcherScheduledResult, IncomingRequestCfProperties } from '@cloudflare/workers-types/experimental';
|
|
11
11
|
import { RouterConfig, AssetConfig } from '@cloudflare/workers-shared';
|
|
12
|
+
export { printBindings as unstable_printBindings } from '@cloudflare/deploy-helpers';
|
|
12
13
|
import { URLSearchParams } from 'node:url';
|
|
13
14
|
import { Argv, PositionalOptions, Options, ArgumentsCamelCase, InferredOptionTypes, InferredOptionType } from 'yargs';
|
|
14
15
|
import Cloudflare from 'cloudflare';
|
|
@@ -168,8 +169,8 @@ interface PagesDeployOptions {
|
|
|
168
169
|
*/
|
|
169
170
|
declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, sourceMaps, args, }: PagesDeployOptions): Promise<{
|
|
170
171
|
deploymentResponse: {
|
|
171
|
-
url: string;
|
|
172
172
|
id: string;
|
|
173
|
+
url: string;
|
|
173
174
|
environment: "production" | "preview";
|
|
174
175
|
build_config: {
|
|
175
176
|
build_command: string;
|
|
@@ -192,14 +193,14 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
|
192
193
|
};
|
|
193
194
|
};
|
|
194
195
|
latest_stage: {
|
|
195
|
-
status: "skipped" | "active" | "canceled" | "
|
|
196
|
-
name: "
|
|
196
|
+
status: "skipped" | "active" | "canceled" | "success" | "idle" | "failure";
|
|
197
|
+
name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
|
|
197
198
|
started_on: string | null;
|
|
198
199
|
ended_on: string | null;
|
|
199
200
|
};
|
|
200
201
|
stages: {
|
|
201
|
-
status: "skipped" | "active" | "canceled" | "
|
|
202
|
-
name: "
|
|
202
|
+
status: "skipped" | "active" | "canceled" | "success" | "idle" | "failure";
|
|
203
|
+
name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
|
|
203
204
|
started_on: string | null;
|
|
204
205
|
ended_on: string | null;
|
|
205
206
|
}[];
|
|
@@ -303,6 +304,13 @@ type Experimental_GenerateTypesResult = GenerateTypesResult;
|
|
|
303
304
|
*/
|
|
304
305
|
declare function generateTypes(options: Experimental_GenerateTypesOptions): Promise<Experimental_GenerateTypesResult>;
|
|
305
306
|
|
|
307
|
+
type _Params<ParamsArray extends [unknown?]> = ParamsArray extends [infer P] ? P : undefined;
|
|
308
|
+
type _EventMethods = keyof Protocol.Events;
|
|
309
|
+
type DevToolsEvent<Method extends _EventMethods> = Method extends unknown ? {
|
|
310
|
+
method: Method;
|
|
311
|
+
params: _Params<Protocol.Events[Method]>;
|
|
312
|
+
} : never;
|
|
313
|
+
|
|
306
314
|
/**
|
|
307
315
|
* Information about Wrangler's bundling process that needs passed through
|
|
308
316
|
* for DevTools sourcemap transformation
|
|
@@ -324,28 +332,64 @@ type EsbuildBundle = {
|
|
|
324
332
|
sourceMapMetadata: SourceMapMetadata | undefined;
|
|
325
333
|
};
|
|
326
334
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
apiToken: ApiCredentials;
|
|
337
|
-
/**
|
|
338
|
-
* An account ID.
|
|
339
|
-
*/
|
|
340
|
-
accountId: string;
|
|
335
|
+
declare class ConfigController extends Controller {
|
|
336
|
+
#private;
|
|
337
|
+
latestInput?: StartDevWorkerInput;
|
|
338
|
+
latestConfig?: StartDevWorkerOptions;
|
|
339
|
+
set(input: StartDevWorkerInput, throwErrors?: boolean): Promise<StartDevWorkerOptions | undefined>;
|
|
340
|
+
patch(input: Partial<StartDevWorkerInput>): Promise<StartDevWorkerOptions | undefined>;
|
|
341
|
+
onDevRegistryUpdate(event: DevRegistryUpdateEvent): void;
|
|
342
|
+
teardown(): Promise<void>;
|
|
343
|
+
emitConfigUpdateEvent(config: StartDevWorkerOptions): void;
|
|
341
344
|
}
|
|
342
345
|
|
|
343
|
-
type
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
type MiniflareWorker = Awaited<ReturnType<Miniflare["getWorker"]>>;
|
|
347
|
+
interface Worker {
|
|
348
|
+
ready: Promise<void>;
|
|
349
|
+
url: Promise<URL>;
|
|
350
|
+
inspectorUrl: Promise<URL | undefined>;
|
|
351
|
+
config: StartDevWorkerOptions;
|
|
352
|
+
setConfig: ConfigController["set"];
|
|
353
|
+
patchConfig: ConfigController["patch"];
|
|
354
|
+
fetch: DispatchFetch;
|
|
355
|
+
scheduled: MiniflareWorker["scheduled"];
|
|
356
|
+
queue: MiniflareWorker["queue"];
|
|
357
|
+
dispose(): Promise<void>;
|
|
358
|
+
raw: DevEnv;
|
|
359
|
+
}
|
|
360
|
+
type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets" | "config" | "containers" | "dev"> & {
|
|
361
|
+
/** The configuration path of the worker */
|
|
362
|
+
config?: string;
|
|
363
|
+
/** A worker's directory. Usually where the Wrangler configuration file is located */
|
|
364
|
+
projectRoot: string;
|
|
365
|
+
build: StartDevWorkerInput["build"] & {
|
|
366
|
+
nodejsCompatMode: NodeJSCompatMode;
|
|
367
|
+
format: CfScriptFormat;
|
|
368
|
+
moduleRoot: string;
|
|
369
|
+
moduleRules: Rule$1[];
|
|
370
|
+
define: Record<string, string>;
|
|
371
|
+
additionalModules: CfModule[];
|
|
372
|
+
exports: string[];
|
|
373
|
+
processEntrypoint: boolean;
|
|
374
|
+
};
|
|
375
|
+
legacy: StartDevWorkerInput["legacy"] & {
|
|
376
|
+
site?: Config$1["site"];
|
|
377
|
+
};
|
|
378
|
+
dev: StartDevWorkerInput["dev"] & {
|
|
379
|
+
persist: string | false;
|
|
380
|
+
auth?: AsyncHook<CfAccount$1>;
|
|
381
|
+
/** Handles structured runtime logs. */
|
|
382
|
+
structuredLogsHandler?: (log: WorkerdStructuredLog) => void;
|
|
383
|
+
/** An undici MockAgent to declaratively mock fetch calls to particular resources. */
|
|
384
|
+
mockFetch?: undici.MockAgent;
|
|
385
|
+
};
|
|
386
|
+
entrypoint: string;
|
|
387
|
+
assets?: AssetsOptions$1;
|
|
388
|
+
containers?: ContainerNormalizedConfig[];
|
|
389
|
+
name: string;
|
|
390
|
+
complianceRegion: Config$1["compliance_region"];
|
|
391
|
+
};
|
|
392
|
+
type Bundle = EsbuildBundle;
|
|
349
393
|
|
|
350
394
|
type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker" | "MultiworkerRuntimeController"> | BaseErrorEvent<"ProxyController", {
|
|
351
395
|
config?: StartDevWorkerOptions;
|
|
@@ -476,17 +520,6 @@ declare abstract class RuntimeController extends Controller {
|
|
|
476
520
|
protected emitDevRegistryUpdateEvent(data: DevRegistryUpdateEvent): void;
|
|
477
521
|
}
|
|
478
522
|
|
|
479
|
-
declare class ConfigController extends Controller {
|
|
480
|
-
#private;
|
|
481
|
-
latestInput?: StartDevWorkerInput;
|
|
482
|
-
latestConfig?: StartDevWorkerOptions;
|
|
483
|
-
set(input: StartDevWorkerInput, throwErrors?: boolean): Promise<StartDevWorkerOptions | undefined>;
|
|
484
|
-
patch(input: Partial<StartDevWorkerInput>): Promise<StartDevWorkerOptions | undefined>;
|
|
485
|
-
onDevRegistryUpdate(event: DevRegistryUpdateEvent): void;
|
|
486
|
-
teardown(): Promise<void>;
|
|
487
|
-
emitConfigUpdateEvent(config: StartDevWorkerOptions): void;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
523
|
declare class BundlerController extends Controller {
|
|
491
524
|
#private;
|
|
492
525
|
onConfigUpdate(event: ConfigUpdateEvent): void;
|
|
@@ -495,6 +528,13 @@ declare class BundlerController extends Controller {
|
|
|
495
528
|
emitBundleCompleteEvent(config: StartDevWorkerOptions, bundle: EsbuildBundle): void;
|
|
496
529
|
}
|
|
497
530
|
|
|
531
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
532
|
+
type DeferredPromise<T> = {
|
|
533
|
+
promise: Promise<T>;
|
|
534
|
+
resolve: (_: MaybePromise<T>) => void;
|
|
535
|
+
reject: (_: Error) => void;
|
|
536
|
+
};
|
|
537
|
+
|
|
498
538
|
declare class ProxyController extends Controller {
|
|
499
539
|
ready: DeferredPromise<ReadyEvent>;
|
|
500
540
|
localServerReady: DeferredPromise<void>;
|
|
@@ -561,219 +601,131 @@ declare class DevEnv extends EventEmitter implements ControllerBus {
|
|
|
561
601
|
teardown(): Promise<void>;
|
|
562
602
|
}
|
|
563
603
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
604
|
+
declare function startWorker(options: StartDevWorkerInput): Promise<Worker>;
|
|
605
|
+
|
|
606
|
+
declare const dev: {
|
|
607
|
+
args: {
|
|
608
|
+
v: boolean | undefined;
|
|
609
|
+
cwd: string | undefined;
|
|
610
|
+
config: string | undefined;
|
|
611
|
+
env: string | undefined;
|
|
612
|
+
envFile: string[] | undefined;
|
|
613
|
+
experimentalProvision: boolean | undefined;
|
|
614
|
+
experimentalAutoCreate: boolean;
|
|
615
|
+
installSkills: boolean;
|
|
616
|
+
script: string | undefined;
|
|
617
|
+
name: string | undefined;
|
|
618
|
+
compatibilityDate: string | undefined;
|
|
619
|
+
compatibilityFlags: string[] | undefined;
|
|
620
|
+
latest: boolean;
|
|
621
|
+
assets: string | undefined;
|
|
622
|
+
bundle: boolean | undefined;
|
|
623
|
+
noBundle: boolean;
|
|
624
|
+
ip: string | undefined;
|
|
625
|
+
port: number | undefined;
|
|
626
|
+
inspectorPort: number | undefined;
|
|
627
|
+
inspectorIp: string | undefined;
|
|
628
|
+
routes: string[] | undefined;
|
|
629
|
+
host: string | undefined;
|
|
630
|
+
localProtocol: "http" | "https" | undefined;
|
|
631
|
+
httpsKeyPath: string | undefined;
|
|
632
|
+
httpsCertPath: string | undefined;
|
|
633
|
+
localUpstream: string | undefined;
|
|
634
|
+
enableContainers: boolean | undefined;
|
|
635
|
+
site: string | undefined;
|
|
636
|
+
siteInclude: string[] | undefined;
|
|
637
|
+
siteExclude: string[] | undefined;
|
|
638
|
+
upstreamProtocol: "http" | "https" | undefined;
|
|
639
|
+
var: string[] | undefined;
|
|
640
|
+
define: string[] | undefined;
|
|
641
|
+
alias: string[] | undefined;
|
|
642
|
+
jsxFactory: string | undefined;
|
|
643
|
+
jsxFragment: string | undefined;
|
|
644
|
+
tsconfig: string | undefined;
|
|
645
|
+
remote: boolean;
|
|
646
|
+
local: boolean | undefined;
|
|
647
|
+
minify: boolean | undefined;
|
|
648
|
+
nodeCompat: boolean | undefined;
|
|
649
|
+
persistTo: string | undefined;
|
|
650
|
+
liveReload: boolean | undefined;
|
|
651
|
+
legacyEnv: boolean | undefined;
|
|
652
|
+
testScheduled: boolean;
|
|
653
|
+
logLevel: "debug" | "none" | "error" | "log" | "info" | "warn" | undefined;
|
|
654
|
+
showInteractiveDevSession: boolean | undefined;
|
|
655
|
+
types: boolean | undefined;
|
|
656
|
+
tunnel: boolean | undefined;
|
|
657
|
+
tunnelName: string | undefined;
|
|
658
|
+
experimentalNewConfig: boolean;
|
|
659
|
+
_: (string | number)[];
|
|
660
|
+
$0: string;
|
|
598
661
|
};
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
* An array of paths to the .env files to load for this worker, relative to the project directory.
|
|
602
|
-
*
|
|
603
|
-
* If not specified, defaults to the standard `.env` files as given by `getDefaultEnvFiles()`.
|
|
604
|
-
* The project directory is where the Wrangler configuration file is located or the current working directory otherwise.
|
|
605
|
-
*/
|
|
606
|
-
envFiles?: string[];
|
|
607
|
-
/** The bindings available to the worker. The specified bindind type will be exposed to the worker on the `env` object under the same key. */
|
|
608
|
-
bindings?: Record<string, Binding>;
|
|
662
|
+
};
|
|
663
|
+
type AdditionalDevProps = {
|
|
609
664
|
/**
|
|
610
|
-
* Default
|
|
665
|
+
* Default vars that can be overridden by config vars.
|
|
611
666
|
* Useful for injecting environment-specific defaults like CF_PAGES variables.
|
|
612
667
|
*/
|
|
613
668
|
defaultBindings?: Record<string, Extract<Binding, {
|
|
614
669
|
type: "plain_text";
|
|
615
670
|
}>>;
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
/** Whether the bundled worker is minified. Only takes effect if bundle: true. */
|
|
643
|
-
minify?: boolean;
|
|
644
|
-
/** Whether to keep function names after JavaScript transpilations. */
|
|
645
|
-
keepNames?: boolean;
|
|
646
|
-
/** Options controlling a custom build step. */
|
|
647
|
-
custom?: {
|
|
648
|
-
/** Custom shell command to run before bundling. Runs even if bundle. */
|
|
649
|
-
command?: string;
|
|
650
|
-
/** The cwd to run the command in. */
|
|
651
|
-
workingDirectory?: string;
|
|
652
|
-
/** Filepath(s) to watch for changes. Upon changes, the command will be rerun. */
|
|
653
|
-
watch?: string | string[];
|
|
654
|
-
};
|
|
655
|
-
jsxFactory?: string;
|
|
656
|
-
jsxFragment?: string;
|
|
657
|
-
tsconfig?: string;
|
|
658
|
-
nodejsCompatMode?: Hook<NodeJSCompatMode, [Config$1]>;
|
|
659
|
-
moduleRoot?: string;
|
|
660
|
-
};
|
|
661
|
-
/** Options applying to the worker's development preview environment. */
|
|
662
|
-
dev?: {
|
|
663
|
-
/** Options applying to the worker's inspector server. False disables the inspector server. */
|
|
664
|
-
inspector?: {
|
|
665
|
-
hostname?: string;
|
|
666
|
-
port?: number;
|
|
667
|
-
secure?: boolean;
|
|
668
|
-
} | false;
|
|
669
|
-
/** Whether the worker runs on the edge or locally. This has several options:
|
|
670
|
-
* - true | "minimal": Run your Worker's code & bindings in a remote preview session, optionally using minimal mode as an internal detail
|
|
671
|
-
* - false: Run your Worker's code & bindings in a local simulator
|
|
672
|
-
* - undefined (default): Run your Worker's code locally, and any configured remote bindings remotely
|
|
673
|
-
*/
|
|
674
|
-
remote?: boolean | "minimal";
|
|
675
|
-
/** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
|
|
676
|
-
auth?: AsyncHook<CfAccount, [Pick<Config$1, "account_id">]>;
|
|
677
|
-
/** Whether local storage (KV, Durable Objects, R2, D1, etc) is persisted. You can also specify the directory to persist data to. Set to `false` to disable persistence. */
|
|
678
|
-
persist?: string | false;
|
|
679
|
-
/** Controls which logs are logged 🤙. */
|
|
680
|
-
logLevel?: LogLevel;
|
|
681
|
-
/** Whether the worker server restarts upon source/config file changes. */
|
|
682
|
-
watch?: boolean;
|
|
683
|
-
/** Whether a script tag is inserted on text/html responses which will reload the page upon file changes. Defaults to false. */
|
|
684
|
-
liveReload?: boolean;
|
|
685
|
-
/** The local address to reach your worker. Applies to remote: true (remote mode) and remote: false (local mode). */
|
|
686
|
-
server?: {
|
|
687
|
-
hostname?: string;
|
|
688
|
-
port?: number;
|
|
689
|
-
secure?: boolean;
|
|
690
|
-
httpsKeyPath?: string;
|
|
691
|
-
httpsCertPath?: string;
|
|
692
|
-
};
|
|
693
|
-
/** Controls what request.url looks like inside the worker. */
|
|
694
|
-
origin?: {
|
|
695
|
-
hostname?: string;
|
|
696
|
-
secure?: boolean;
|
|
697
|
-
};
|
|
698
|
-
/** A hook for outbound fetch calls from within the worker. */
|
|
699
|
-
outboundService?: ServiceFetch;
|
|
700
|
-
/** Handles structured runtime logs. */
|
|
701
|
-
structuredLogsHandler?: (log: WorkerdStructuredLog) => void;
|
|
702
|
-
/** An undici MockAgent to declaratively mock fetch calls to particular resources. */
|
|
703
|
-
mockFetch?: undici.MockAgent;
|
|
704
|
-
testScheduled?: boolean;
|
|
705
|
-
/** Treat this as the primary worker in a multiworker setup (i.e. the first Worker in Miniflare's options) */
|
|
706
|
-
multiworkerPrimary?: boolean;
|
|
707
|
-
/** Whether to infer the local request origin from configured routes. */
|
|
708
|
-
inferOriginFromRoutes?: boolean;
|
|
709
|
-
containerBuildId?: string;
|
|
710
|
-
/** Whether to build and connect to containers during local dev. Requires Docker daemon to be running. Defaults to true. */
|
|
711
|
-
enableContainers?: boolean;
|
|
712
|
-
/** Path to the dev registry directory */
|
|
713
|
-
registry?: string;
|
|
714
|
-
/** Path to the docker executable. Defaults to 'docker' */
|
|
715
|
-
dockerPath?: string;
|
|
716
|
-
/** Options for the container engine */
|
|
717
|
-
containerEngine?: ContainerEngine$1;
|
|
718
|
-
/** Re-generate your worker types when your Wrangler configuration file changes */
|
|
719
|
-
generateTypes?: boolean;
|
|
720
|
-
/** Tunnel configuration for this dev session. */
|
|
721
|
-
tunnel?: {
|
|
722
|
-
enabled: boolean;
|
|
723
|
-
name?: string;
|
|
724
|
-
};
|
|
725
|
-
};
|
|
726
|
-
legacy?: {
|
|
727
|
-
site?: Hook<Config$1["site"], [Config$1]>;
|
|
728
|
-
useServiceEnvironments?: boolean;
|
|
729
|
-
};
|
|
730
|
-
unsafe?: Omit<CfUnsafe, "bindings">;
|
|
731
|
-
assets?: string;
|
|
732
|
-
experimental?: Record<string, never>;
|
|
733
|
-
}
|
|
734
|
-
type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets" | "config" | "containers" | "dev"> & {
|
|
735
|
-
/** The configuration path of the worker */
|
|
736
|
-
config?: string;
|
|
737
|
-
/** A worker's directory. Usually where the Wrangler configuration file is located */
|
|
738
|
-
projectRoot: string;
|
|
739
|
-
build: StartDevWorkerInput["build"] & {
|
|
740
|
-
nodejsCompatMode: NodeJSCompatMode;
|
|
741
|
-
format: CfScriptFormat;
|
|
742
|
-
moduleRoot: string;
|
|
743
|
-
moduleRules: Rule$1[];
|
|
744
|
-
define: Record<string, string>;
|
|
745
|
-
additionalModules: CfModule[];
|
|
746
|
-
exports: string[];
|
|
747
|
-
processEntrypoint: boolean;
|
|
671
|
+
vars?: Record<string, string | Json$1>;
|
|
672
|
+
kv?: {
|
|
673
|
+
binding: string;
|
|
674
|
+
id?: string;
|
|
675
|
+
preview_id?: string;
|
|
676
|
+
}[];
|
|
677
|
+
durableObjects?: {
|
|
678
|
+
name: string;
|
|
679
|
+
class_name: string;
|
|
680
|
+
script_name?: string | undefined;
|
|
681
|
+
environment?: string | undefined;
|
|
682
|
+
}[];
|
|
683
|
+
services?: {
|
|
684
|
+
binding: string;
|
|
685
|
+
service: string;
|
|
686
|
+
environment?: string;
|
|
687
|
+
entrypoint?: string;
|
|
688
|
+
}[];
|
|
689
|
+
r2?: {
|
|
690
|
+
binding: string;
|
|
691
|
+
bucket_name?: string;
|
|
692
|
+
preview_bucket_name?: string;
|
|
693
|
+
jurisdiction?: string;
|
|
694
|
+
}[];
|
|
695
|
+
ai?: {
|
|
696
|
+
binding: string;
|
|
748
697
|
};
|
|
749
|
-
|
|
750
|
-
|
|
698
|
+
stream?: {
|
|
699
|
+
binding: string;
|
|
700
|
+
remote?: boolean;
|
|
751
701
|
};
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
auth?: AsyncHook<CfAccount>;
|
|
702
|
+
version_metadata?: {
|
|
703
|
+
binding: string;
|
|
755
704
|
};
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
705
|
+
d1Databases?: Array<Omit<Environment$1["d1_databases"][number], "database_id"> & {
|
|
706
|
+
database_id?: string;
|
|
707
|
+
}>;
|
|
708
|
+
processEntrypoint?: boolean;
|
|
709
|
+
additionalModules?: CfModule[];
|
|
710
|
+
moduleRoot?: string;
|
|
711
|
+
rules?: Rule$1[];
|
|
712
|
+
showInteractiveDevSession?: boolean;
|
|
761
713
|
};
|
|
762
|
-
type
|
|
763
|
-
type
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
714
|
+
type DevArguments = Omit<(typeof dev)["args"], "installSkills">;
|
|
715
|
+
type StartDevOptions = DevArguments & AdditionalDevProps & {
|
|
716
|
+
forceLocal?: boolean;
|
|
717
|
+
accountId?: string;
|
|
718
|
+
disableDevRegistry?: boolean;
|
|
719
|
+
enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
|
|
720
|
+
onReady?: (ip: string, port: number) => void;
|
|
721
|
+
enableIpc?: boolean;
|
|
722
|
+
dockerPath?: string;
|
|
723
|
+
containerEngine?: string;
|
|
724
|
+
/** Set to `false` to disable persistence. When `true` or `undefined`, uses default persistence path. */
|
|
725
|
+
persist?: boolean;
|
|
773
726
|
};
|
|
774
|
-
declare function convertConfigBindingsToStartWorkerBindings(configBindings: Partial<Pick<Config$1, ConfigBindingFieldName>>): StartDevWorkerOptions["bindings"];
|
|
775
727
|
|
|
776
|
-
declare function
|
|
728
|
+
declare function convertConfigBindingsToStartWorkerBindings(configBindings: Partial<Pick<Config$1, ConfigBindingFieldName>>): StartDevWorkerOptions["bindings"];
|
|
777
729
|
|
|
778
730
|
type TestHarnessOptions = {
|
|
779
731
|
/**
|
|
@@ -812,6 +764,47 @@ type WorkerHandle = {
|
|
|
812
764
|
* ```
|
|
813
765
|
*/
|
|
814
766
|
scheduled(options: FetcherScheduledOptions): Promise<FetcherScheduledResult>;
|
|
767
|
+
/**
|
|
768
|
+
* Returns a KV namespace binding configured on this Worker.
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* ```ts
|
|
772
|
+
* const store = await worker.getKVNamespace("STORE");
|
|
773
|
+
* const value = await store.get("key");
|
|
774
|
+
* ```
|
|
775
|
+
*/
|
|
776
|
+
getKVNamespace(bindingName: string): ReturnType<Miniflare["getKVNamespace"]>;
|
|
777
|
+
/**
|
|
778
|
+
* Returns an R2 bucket binding configured on this Worker.
|
|
779
|
+
*
|
|
780
|
+
* @example
|
|
781
|
+
* ```ts
|
|
782
|
+
* const bucket = await worker.getR2Bucket("BUCKET");
|
|
783
|
+
* const object = await bucket.get("key");
|
|
784
|
+
* ```
|
|
785
|
+
*/
|
|
786
|
+
getR2Bucket(bindingName: string): ReturnType<Miniflare["getR2Bucket"]>;
|
|
787
|
+
/**
|
|
788
|
+
* Returns a D1 database binding configured on this Worker.
|
|
789
|
+
*
|
|
790
|
+
* @example
|
|
791
|
+
* ```ts
|
|
792
|
+
* const db = await worker.getD1Database("DB");
|
|
793
|
+
* const value = await db.prepare("SELECT value FROM entries").first("value");
|
|
794
|
+
* ```
|
|
795
|
+
*/
|
|
796
|
+
getD1Database(bindingName: string): ReturnType<Miniflare["getD1Database"]>;
|
|
797
|
+
/**
|
|
798
|
+
* Returns a Durable Object namespace binding configured on this Worker.
|
|
799
|
+
*
|
|
800
|
+
* @example
|
|
801
|
+
* ```ts
|
|
802
|
+
* const namespace = await worker.getDurableObjectNamespace("OBJECT");
|
|
803
|
+
* const stub = namespace.getByName("counter");
|
|
804
|
+
* const response = await stub.fetch("http://example.com/");
|
|
805
|
+
* ```
|
|
806
|
+
*/
|
|
807
|
+
getDurableObjectNamespace(bindingName: string): ReturnType<Miniflare["getDurableObjectNamespace"]>;
|
|
815
808
|
};
|
|
816
809
|
type TestHarness = {
|
|
817
810
|
/**
|
|
@@ -3125,6 +3118,22 @@ declare function unstable_getMiniflareWorkerOptions(config: Config, env?: string
|
|
|
3125
3118
|
containerBuildId?: string;
|
|
3126
3119
|
}): Unstable_MiniflareWorkerOptions;
|
|
3127
3120
|
|
|
3121
|
+
/**
|
|
3122
|
+
* A Cloudflare account.
|
|
3123
|
+
*/
|
|
3124
|
+
interface CfAccount {
|
|
3125
|
+
/**
|
|
3126
|
+
* An API token.
|
|
3127
|
+
*
|
|
3128
|
+
* @link https://api.cloudflare.com/#user-api-tokens-properties
|
|
3129
|
+
*/
|
|
3130
|
+
apiToken: ApiCredentials;
|
|
3131
|
+
/**
|
|
3132
|
+
* An account ID.
|
|
3133
|
+
*/
|
|
3134
|
+
accountId: string;
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3128
3137
|
type StartRemoteProxySessionOptions = {
|
|
3129
3138
|
workerName?: string;
|
|
3130
3139
|
auth?: NonNullable<StartDevWorkerInput["dev"]>["auth"];
|
|
@@ -3174,23 +3183,14 @@ declare function maybeStartOrUpdateRemoteProxySession(wranglerOrWorkerConfigObje
|
|
|
3174
3183
|
auth?: AsyncHook<CfAccount> | undefined;
|
|
3175
3184
|
} | null>;
|
|
3176
3185
|
|
|
3177
|
-
declare const LOGGER_LEVELS: {
|
|
3178
|
-
readonly none: -1;
|
|
3179
|
-
readonly error: 0;
|
|
3180
|
-
readonly warn: 1;
|
|
3181
|
-
readonly info: 2;
|
|
3182
|
-
readonly log: 3;
|
|
3183
|
-
readonly debug: 4;
|
|
3184
|
-
};
|
|
3185
|
-
type LoggerLevel = keyof typeof LOGGER_LEVELS;
|
|
3186
3186
|
type TableRow<Keys extends string> = Record<Keys, string>;
|
|
3187
3187
|
declare class Logger {
|
|
3188
3188
|
#private;
|
|
3189
3189
|
constructor();
|
|
3190
3190
|
private overrideLoggerLevel?;
|
|
3191
3191
|
private onceHistory;
|
|
3192
|
-
get loggerLevel(): "debug" | "none" | "error" | "
|
|
3193
|
-
set loggerLevel(val: "debug" | "none" | "error" | "
|
|
3192
|
+
get loggerLevel(): "debug" | "none" | "error" | "log" | "info" | "warn";
|
|
3193
|
+
set loggerLevel(val: "debug" | "none" | "error" | "log" | "info" | "warn");
|
|
3194
3194
|
resetLoggerLevel(): void;
|
|
3195
3195
|
columns: number;
|
|
3196
3196
|
json: (data: unknown) => void;
|
|
@@ -3220,23 +3220,6 @@ declare class Logger {
|
|
|
3220
3220
|
private formatMessage;
|
|
3221
3221
|
}
|
|
3222
3222
|
|
|
3223
|
-
type PrintContext = {
|
|
3224
|
-
log?: (message: string) => void;
|
|
3225
|
-
registry?: WorkerRegistry | null;
|
|
3226
|
-
local?: boolean;
|
|
3227
|
-
isMultiWorker?: boolean;
|
|
3228
|
-
remoteBindingsDisabled?: boolean;
|
|
3229
|
-
name?: string;
|
|
3230
|
-
provisioning?: boolean;
|
|
3231
|
-
warnIfNoBindings?: boolean;
|
|
3232
|
-
unsafeMetadata?: Record<string, unknown>;
|
|
3233
|
-
};
|
|
3234
|
-
/**
|
|
3235
|
-
* Print all the bindings a worker would have access to.
|
|
3236
|
-
* Accepts StartDevWorkerInput["bindings"] format
|
|
3237
|
-
*/
|
|
3238
|
-
declare function printBindings(bindings: StartDevWorkerInput["bindings"], tailConsumers?: CfTailConsumer[], streamingTailConsumers?: CfTailConsumer[], containers?: ContainerApp$1[], context?: PrintContext): void;
|
|
3239
|
-
|
|
3240
3223
|
/**
|
|
3241
3224
|
* Resolves the named tunnel to hostnames whose ingress rules
|
|
3242
3225
|
* target the current local dev origin and the token needed
|
|
@@ -3250,6 +3233,28 @@ declare function resolveNamedTunnel(name: string, origin: URL, options: {
|
|
|
3250
3233
|
token: string;
|
|
3251
3234
|
}>;
|
|
3252
3235
|
|
|
3236
|
+
/**
|
|
3237
|
+
* Run the dev server until it tears down (a hotkey quit in a TTY, or a
|
|
3238
|
+
* signal from a non-interactive parent). Mirrors `wrangler dev`'s command
|
|
3239
|
+
* handler and installs no signal handlers of its own, so signal handling
|
|
3240
|
+
* and exit codes match `wrangler dev` exactly.
|
|
3241
|
+
*
|
|
3242
|
+
* @param options Fully-built `StartDevOptions` (built in `bin/cf-wrangler.js`).
|
|
3243
|
+
* @returns `0` on a clean teardown.
|
|
3244
|
+
*/
|
|
3245
|
+
declare function runCfWranglerDev(options: StartDevOptions): Promise<number>;
|
|
3246
|
+
|
|
3247
|
+
interface DevArgs {
|
|
3248
|
+
mode?: string;
|
|
3249
|
+
port?: number;
|
|
3250
|
+
host?: string;
|
|
3251
|
+
local?: boolean;
|
|
3252
|
+
}
|
|
3253
|
+
declare class ArgParseError extends Error {
|
|
3254
|
+
constructor(message: string);
|
|
3255
|
+
}
|
|
3256
|
+
declare function parseArgs(argv: string[]): DevArgs;
|
|
3257
|
+
|
|
3253
3258
|
/**
|
|
3254
3259
|
* Split an SQLQuery into an array of statements
|
|
3255
3260
|
*/
|
|
@@ -3257,6 +3262,18 @@ declare function splitSqlQuery(sql: string): string[];
|
|
|
3257
3262
|
|
|
3258
3263
|
declare function runAutoConfig(autoConfigDetails: AutoConfigDetails, autoConfigOptions?: AutoConfigOptions): Promise<AutoConfigSummary>;
|
|
3259
3264
|
|
|
3265
|
+
/**
|
|
3266
|
+
* The implementation for fetching a kv value from the cloudflare API.
|
|
3267
|
+
* We special-case this one call, because it's the only API call that
|
|
3268
|
+
* doesn't return json. We inline the implementation and try not to share
|
|
3269
|
+
* any code with the other calls. We should push back on any new APIs that
|
|
3270
|
+
* try to introduce non-"standard" response structures.
|
|
3271
|
+
*
|
|
3272
|
+
* Note: any calls to fetchKVGetValue must call encodeURIComponent on key
|
|
3273
|
+
* before passing it
|
|
3274
|
+
*/
|
|
3275
|
+
declare function fetchKVGetValue(complianceConfig: ComplianceConfig, accountId: string, namespaceId: string, key: string): Promise<ArrayBuffer>;
|
|
3276
|
+
|
|
3260
3277
|
/**
|
|
3261
3278
|
* Make a fetch request, and extract the `result` from the JSON response.
|
|
3262
3279
|
*/
|
|
@@ -3267,6 +3284,14 @@ declare function fetchResult<ResponseType>(complianceConfig: ComplianceConfig, r
|
|
|
3267
3284
|
* and repeating the request if the results are paginated.
|
|
3268
3285
|
*/
|
|
3269
3286
|
declare function fetchListResult<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams): Promise<ResponseType[]>;
|
|
3287
|
+
/**
|
|
3288
|
+
* Make a fetch request for a list of values,
|
|
3289
|
+
* extracting the `result` from the JSON response,
|
|
3290
|
+
* and repeating the request if the results are paginated.
|
|
3291
|
+
*
|
|
3292
|
+
* This is similar to fetchListResult, but it uses the `page` query parameter instead of `cursor`.
|
|
3293
|
+
*/
|
|
3294
|
+
declare function fetchPagedListResult<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams): Promise<ResponseType[]>;
|
|
3270
3295
|
|
|
3271
3296
|
interface ConfirmOptions {
|
|
3272
3297
|
defaultValue?: boolean;
|
|
@@ -3395,6 +3420,8 @@ type HandlerContext = {
|
|
|
3395
3420
|
*/
|
|
3396
3421
|
fetchResult: typeof fetchResult;
|
|
3397
3422
|
fetchListResult: typeof fetchListResult;
|
|
3423
|
+
fetchPagedListResult: typeof fetchPagedListResult;
|
|
3424
|
+
fetchKVGetValue: typeof fetchKVGetValue;
|
|
3398
3425
|
/**
|
|
3399
3426
|
* Interactive prompts
|
|
3400
3427
|
*/
|
|
@@ -3476,12 +3503,25 @@ type CommandDefinition<NamedArgDefs extends NamedArgDefinitions = NamedArgDefini
|
|
|
3476
3503
|
*/
|
|
3477
3504
|
sendMetrics?: boolean;
|
|
3478
3505
|
/**
|
|
3479
|
-
*
|
|
3480
|
-
*
|
|
3481
|
-
*
|
|
3506
|
+
* After the command handler completes successfully, suggest installing
|
|
3507
|
+
* Cloudflare skills for detected AI coding agents that don't have them.
|
|
3508
|
+
*
|
|
3509
|
+
* When set to `true`, the suggestion always runs after the handler.
|
|
3510
|
+
* When set to a function, it receives the parsed args and should return
|
|
3511
|
+
* `true` to enable the suggestion — use this to skip the prompt in modes
|
|
3512
|
+
* where interactive output is inappropriate (e.g. `--json`).
|
|
3513
|
+
*
|
|
3482
3514
|
* @default false
|
|
3483
3515
|
*/
|
|
3484
|
-
|
|
3516
|
+
suggestSkillsAfterHandler?: boolean | ((args: HandlerArgs<NamedArgDefs>) => boolean);
|
|
3517
|
+
/**
|
|
3518
|
+
* Whether this command can authenticate with a temporary preview account
|
|
3519
|
+
* (via the hidden `--temporary` flag) when no real credentials are available.
|
|
3520
|
+
* Only enable this for commands whose API calls are covered by the temporary
|
|
3521
|
+
* preview-account deploy token (Workers, KV, D1, Hyperdrive, Queues, SSL/Certs).
|
|
3522
|
+
* @default false
|
|
3523
|
+
*/
|
|
3524
|
+
supportTemporary?: boolean;
|
|
3485
3525
|
};
|
|
3486
3526
|
/**
|
|
3487
3527
|
* A plain key-value object describing the CLI args for this command.
|
|
@@ -3499,8 +3539,11 @@ type CommandDefinition<NamedArgDefs extends NamedArgDefinitions = NamedArgDefini
|
|
|
3499
3539
|
* A hook to implement custom validation of the args before the handler is called.
|
|
3500
3540
|
* Throw `CommandLineArgsError` with actionable error message if args are invalid.
|
|
3501
3541
|
* The return value is ignored.
|
|
3542
|
+
*
|
|
3543
|
+
* @param args - The parsed CLI arguments
|
|
3544
|
+
* @param def - The command definition, useful for passing to helpers like `demandOneOfOption`
|
|
3502
3545
|
*/
|
|
3503
|
-
validateArgs?: (args: HandlerArgs<NamedArgDefs>) => void | Promise<void>;
|
|
3546
|
+
validateArgs?: (args: HandlerArgs<NamedArgDefs>, def: CommandDefinition<NamedArgDefs>) => void | Promise<void>;
|
|
3504
3547
|
/**
|
|
3505
3548
|
* The implementation of the command which is given camelCase'd args
|
|
3506
3549
|
* and a ctx object of convenience properties
|
|
@@ -3644,7 +3687,7 @@ declare function createCLIParser(argv: string[]): {
|
|
|
3644
3687
|
readonly alias: "x-auto-create";
|
|
3645
3688
|
};
|
|
3646
3689
|
readonly "install-skills": {
|
|
3647
|
-
readonly describe: "Install Cloudflare
|
|
3690
|
+
readonly describe: "Install Cloudflare skills for detected AI coding agents before running the command";
|
|
3648
3691
|
readonly type: "boolean";
|
|
3649
3692
|
readonly default: false;
|
|
3650
3693
|
};
|
|
@@ -3676,4 +3719,4 @@ interface Unstable_ASSETSBindingsOptions {
|
|
|
3676
3719
|
}
|
|
3677
3720
|
declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
|
|
3678
3721
|
|
|
3679
|
-
export { type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type TestHarness, type TestHarnessOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, type WorkerHandle, createTestHarness, Framework as experimental_AutoConfigFramework, generateTypes as experimental_generateTypes, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, unstable_generateASSETSBinding, unstable_getDevCompatibilityDate, getDurableObjectClassNameToUseSQLiteMap as unstable_getDurableObjectClassNameToUseSQLiteMap, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, getWorkerNameFromProject as unstable_getWorkerNameFromProject, unstable_pages,
|
|
3722
|
+
export { ArgParseError, type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type TestHarness, type TestHarnessOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, type WorkerHandle, createTestHarness, Framework as experimental_AutoConfigFramework, generateTypes as experimental_generateTypes, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, parseArgs as parseCfWranglerArgs, runCfWranglerDev, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, unstable_generateASSETSBinding, unstable_getDevCompatibilityDate, getDurableObjectClassNameToUseSQLiteMap as unstable_getDurableObjectClassNameToUseSQLiteMap, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, getWorkerNameFromProject as unstable_getWorkerNameFromProject, unstable_pages, readConfig as unstable_readConfig, resolveNamedTunnel as unstable_resolveNamedTunnel, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
|