wrangler 4.99.0 → 4.100.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 +30 -18
- package/templates/startDevWorker/InspectorProxyWorker.ts +19 -5
- package/wrangler-dist/InspectorProxyWorker.js +10 -4
- package/wrangler-dist/cli.d.ts +253 -267
- package/wrangler-dist/cli.js +205926 -196403
- 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
|
/**
|
|
@@ -3125,6 +3077,22 @@ declare function unstable_getMiniflareWorkerOptions(config: Config, env?: string
|
|
|
3125
3077
|
containerBuildId?: string;
|
|
3126
3078
|
}): Unstable_MiniflareWorkerOptions;
|
|
3127
3079
|
|
|
3080
|
+
/**
|
|
3081
|
+
* A Cloudflare account.
|
|
3082
|
+
*/
|
|
3083
|
+
interface CfAccount {
|
|
3084
|
+
/**
|
|
3085
|
+
* An API token.
|
|
3086
|
+
*
|
|
3087
|
+
* @link https://api.cloudflare.com/#user-api-tokens-properties
|
|
3088
|
+
*/
|
|
3089
|
+
apiToken: ApiCredentials;
|
|
3090
|
+
/**
|
|
3091
|
+
* An account ID.
|
|
3092
|
+
*/
|
|
3093
|
+
accountId: string;
|
|
3094
|
+
}
|
|
3095
|
+
|
|
3128
3096
|
type StartRemoteProxySessionOptions = {
|
|
3129
3097
|
workerName?: string;
|
|
3130
3098
|
auth?: NonNullable<StartDevWorkerInput["dev"]>["auth"];
|
|
@@ -3174,23 +3142,14 @@ declare function maybeStartOrUpdateRemoteProxySession(wranglerOrWorkerConfigObje
|
|
|
3174
3142
|
auth?: AsyncHook<CfAccount> | undefined;
|
|
3175
3143
|
} | null>;
|
|
3176
3144
|
|
|
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
3145
|
type TableRow<Keys extends string> = Record<Keys, string>;
|
|
3187
3146
|
declare class Logger {
|
|
3188
3147
|
#private;
|
|
3189
3148
|
constructor();
|
|
3190
3149
|
private overrideLoggerLevel?;
|
|
3191
3150
|
private onceHistory;
|
|
3192
|
-
get loggerLevel(): "debug" | "none" | "error" | "
|
|
3193
|
-
set loggerLevel(val: "debug" | "none" | "error" | "
|
|
3151
|
+
get loggerLevel(): "debug" | "none" | "error" | "log" | "info" | "warn";
|
|
3152
|
+
set loggerLevel(val: "debug" | "none" | "error" | "log" | "info" | "warn");
|
|
3194
3153
|
resetLoggerLevel(): void;
|
|
3195
3154
|
columns: number;
|
|
3196
3155
|
json: (data: unknown) => void;
|
|
@@ -3220,23 +3179,6 @@ declare class Logger {
|
|
|
3220
3179
|
private formatMessage;
|
|
3221
3180
|
}
|
|
3222
3181
|
|
|
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
3182
|
/**
|
|
3241
3183
|
* Resolves the named tunnel to hostnames whose ingress rules
|
|
3242
3184
|
* target the current local dev origin and the token needed
|
|
@@ -3250,6 +3192,28 @@ declare function resolveNamedTunnel(name: string, origin: URL, options: {
|
|
|
3250
3192
|
token: string;
|
|
3251
3193
|
}>;
|
|
3252
3194
|
|
|
3195
|
+
/**
|
|
3196
|
+
* Run the dev server until it tears down (a hotkey quit in a TTY, or a
|
|
3197
|
+
* signal from a non-interactive parent). Mirrors `wrangler dev`'s command
|
|
3198
|
+
* handler and installs no signal handlers of its own, so signal handling
|
|
3199
|
+
* and exit codes match `wrangler dev` exactly.
|
|
3200
|
+
*
|
|
3201
|
+
* @param options Fully-built `StartDevOptions` (built in `bin/cf-wrangler.js`).
|
|
3202
|
+
* @returns `0` on a clean teardown.
|
|
3203
|
+
*/
|
|
3204
|
+
declare function runCfWranglerDev(options: StartDevOptions): Promise<number>;
|
|
3205
|
+
|
|
3206
|
+
interface DevArgs {
|
|
3207
|
+
mode?: string;
|
|
3208
|
+
port?: number;
|
|
3209
|
+
host?: string;
|
|
3210
|
+
local?: boolean;
|
|
3211
|
+
}
|
|
3212
|
+
declare class ArgParseError extends Error {
|
|
3213
|
+
constructor(message: string);
|
|
3214
|
+
}
|
|
3215
|
+
declare function parseArgs(argv: string[]): DevArgs;
|
|
3216
|
+
|
|
3253
3217
|
/**
|
|
3254
3218
|
* Split an SQLQuery into an array of statements
|
|
3255
3219
|
*/
|
|
@@ -3257,6 +3221,18 @@ declare function splitSqlQuery(sql: string): string[];
|
|
|
3257
3221
|
|
|
3258
3222
|
declare function runAutoConfig(autoConfigDetails: AutoConfigDetails, autoConfigOptions?: AutoConfigOptions): Promise<AutoConfigSummary>;
|
|
3259
3223
|
|
|
3224
|
+
/**
|
|
3225
|
+
* The implementation for fetching a kv value from the cloudflare API.
|
|
3226
|
+
* We special-case this one call, because it's the only API call that
|
|
3227
|
+
* doesn't return json. We inline the implementation and try not to share
|
|
3228
|
+
* any code with the other calls. We should push back on any new APIs that
|
|
3229
|
+
* try to introduce non-"standard" response structures.
|
|
3230
|
+
*
|
|
3231
|
+
* Note: any calls to fetchKVGetValue must call encodeURIComponent on key
|
|
3232
|
+
* before passing it
|
|
3233
|
+
*/
|
|
3234
|
+
declare function fetchKVGetValue(complianceConfig: ComplianceConfig, accountId: string, namespaceId: string, key: string): Promise<ArrayBuffer>;
|
|
3235
|
+
|
|
3260
3236
|
/**
|
|
3261
3237
|
* Make a fetch request, and extract the `result` from the JSON response.
|
|
3262
3238
|
*/
|
|
@@ -3267,6 +3243,14 @@ declare function fetchResult<ResponseType>(complianceConfig: ComplianceConfig, r
|
|
|
3267
3243
|
* and repeating the request if the results are paginated.
|
|
3268
3244
|
*/
|
|
3269
3245
|
declare function fetchListResult<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams): Promise<ResponseType[]>;
|
|
3246
|
+
/**
|
|
3247
|
+
* Make a fetch request for a list of values,
|
|
3248
|
+
* extracting the `result` from the JSON response,
|
|
3249
|
+
* and repeating the request if the results are paginated.
|
|
3250
|
+
*
|
|
3251
|
+
* This is similar to fetchListResult, but it uses the `page` query parameter instead of `cursor`.
|
|
3252
|
+
*/
|
|
3253
|
+
declare function fetchPagedListResult<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams): Promise<ResponseType[]>;
|
|
3270
3254
|
|
|
3271
3255
|
interface ConfirmOptions {
|
|
3272
3256
|
defaultValue?: boolean;
|
|
@@ -3395,6 +3379,8 @@ type HandlerContext = {
|
|
|
3395
3379
|
*/
|
|
3396
3380
|
fetchResult: typeof fetchResult;
|
|
3397
3381
|
fetchListResult: typeof fetchListResult;
|
|
3382
|
+
fetchPagedListResult: typeof fetchPagedListResult;
|
|
3383
|
+
fetchKVGetValue: typeof fetchKVGetValue;
|
|
3398
3384
|
/**
|
|
3399
3385
|
* Interactive prompts
|
|
3400
3386
|
*/
|
|
@@ -3676,4 +3662,4 @@ interface Unstable_ASSETSBindingsOptions {
|
|
|
3676
3662
|
}
|
|
3677
3663
|
declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
|
|
3678
3664
|
|
|
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,
|
|
3665
|
+
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 };
|