wrangler 0.0.0-e41c7e41 → 0.0.0-e44afaf79
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/README.md +35 -45
- package/bin/wrangler.js +27 -102
- package/config-schema.json +2487 -0
- package/package.json +179 -192
- package/templates/__tests__/tsconfig-sanity.ts +12 -0
- package/templates/__tests__/tsconfig.json +8 -0
- package/templates/checked-fetch.js +19 -6
- package/templates/facade.d.ts +19 -0
- package/templates/gitignore +2 -3
- package/templates/init-tests/test-jest-new-worker.js +3 -5
- package/templates/init-tests/test-vitest-new-worker.js +4 -6
- package/templates/init-tests/test-vitest-new-worker.ts +25 -0
- package/templates/middleware/common.ts +9 -4
- package/templates/middleware/loader-modules.ts +94 -44
- package/templates/middleware/loader-sw.ts +6 -4
- package/templates/middleware/middleware-ensure-req-body-drained.ts +18 -0
- package/templates/middleware/middleware-miniflare3-json-error.ts +17 -5
- package/templates/middleware/middleware-patch-console-prefix.d.ts +3 -0
- package/templates/middleware/middleware-patch-console-prefix.ts +21 -0
- package/templates/middleware/middleware-scheduled.ts +15 -1
- package/templates/mixedMode/proxyServerWorker/index.ts +40 -0
- package/templates/mixedMode/proxyServerWorker/wrangler.jsonc +4 -0
- package/templates/modules-watch-stub.js +4 -0
- package/templates/new-worker-scheduled.ts +1 -1
- package/templates/new-worker.ts +4 -1
- package/templates/pages-dev-pipeline.ts +8 -3
- package/templates/pages-dev-util.ts +4 -1
- package/templates/pages-shim.ts +1 -1
- package/templates/pages-template-plugin.ts +33 -14
- package/templates/pages-template-worker.ts +12 -3
- package/templates/startDevWorker/InspectorProxyWorker.ts +679 -0
- package/templates/startDevWorker/ProxyWorker.ts +336 -0
- package/templates/strip-cf-connecting-ip-header.js +13 -0
- package/templates/tsconfig-sanity.ts +11 -0
- package/templates/tsconfig.init.json +22 -0
- package/templates/tsconfig.json +12 -103
- package/templates/tsconfig.tsbuildinfo +1 -0
- package/wrangler-dist/InspectorProxyWorker.js +471 -0
- package/wrangler-dist/InspectorProxyWorker.js.map +6 -0
- package/wrangler-dist/ProxyWorker.js +238 -0
- package/wrangler-dist/ProxyWorker.js.map +6 -0
- package/wrangler-dist/cli.d.ts +2054 -512
- package/wrangler-dist/cli.js +172903 -159717
- package/wrangler-dist/cli.js.map +1 -0
- package/wrangler-dist/metafile-cjs.json +1 -0
- package/Cloudflare_CA.pem +0 -18
- package/import_meta_url.js +0 -3
- package/miniflare-config-stubs/.env.empty +0 -0
- package/miniflare-config-stubs/package.empty.json +0 -1
- package/miniflare-config-stubs/wrangler.empty.toml +0 -0
- package/miniflare-dist/index.mjs +0 -6316
- package/src/__tests__/access.test.ts +0 -25
- package/src/__tests__/api-dev.test.ts +0 -209
- package/src/__tests__/api-devregistry.test.js +0 -56
- package/src/__tests__/api.test.ts +0 -80
- package/src/__tests__/config-cache-without-cache-dir.test.ts +0 -38
- package/src/__tests__/config-cache.test.ts +0 -42
- package/src/__tests__/configuration.test.ts +0 -3981
- package/src/__tests__/d1.test.ts +0 -80
- package/src/__tests__/delete.test.ts +0 -230
- package/src/__tests__/deployments.test.ts +0 -91
- package/src/__tests__/dev.test.tsx +0 -1536
- package/src/__tests__/dialogs.test.tsx +0 -40
- package/src/__tests__/generate.test.ts +0 -235
- package/src/__tests__/get-host-from-url.test.ts +0 -16
- package/src/__tests__/guess-worker-format.test.ts +0 -85
- package/src/__tests__/helpers/clipboardy-mock.js +0 -4
- package/src/__tests__/helpers/cmd-shim.d.ts +0 -11
- package/src/__tests__/helpers/mock-account-id.ts +0 -48
- package/src/__tests__/helpers/mock-bin.ts +0 -36
- package/src/__tests__/helpers/mock-cfetch.ts +0 -333
- package/src/__tests__/helpers/mock-console.ts +0 -106
- package/src/__tests__/helpers/mock-dialogs.ts +0 -153
- package/src/__tests__/helpers/mock-get-zone-from-host.ts +0 -8
- package/src/__tests__/helpers/mock-http-server.ts +0 -46
- package/src/__tests__/helpers/mock-istty.ts +0 -74
- package/src/__tests__/helpers/mock-known-routes.ts +0 -7
- package/src/__tests__/helpers/mock-kv.ts +0 -33
- package/src/__tests__/helpers/mock-oauth-flow.ts +0 -252
- package/src/__tests__/helpers/mock-process.ts +0 -39
- package/src/__tests__/helpers/mock-stdin.ts +0 -108
- package/src/__tests__/helpers/mock-web-socket.ts +0 -29
- package/src/__tests__/helpers/msw/handlers/access.ts +0 -13
- package/src/__tests__/helpers/msw/handlers/deployments.ts +0 -59
- package/src/__tests__/helpers/msw/handlers/namespaces.ts +0 -104
- package/src/__tests__/helpers/msw/handlers/oauth.ts +0 -36
- package/src/__tests__/helpers/msw/handlers/r2.ts +0 -80
- package/src/__tests__/helpers/msw/handlers/script.ts +0 -75
- package/src/__tests__/helpers/msw/handlers/user.ts +0 -63
- package/src/__tests__/helpers/msw/handlers/zones.ts +0 -22
- package/src/__tests__/helpers/msw/index.ts +0 -21
- package/src/__tests__/helpers/run-in-tmp.ts +0 -38
- package/src/__tests__/helpers/run-wrangler.ts +0 -16
- package/src/__tests__/helpers/worker-scripts/child-wrangler.toml +0 -1
- package/src/__tests__/helpers/worker-scripts/hello-world-worker.js +0 -5
- package/src/__tests__/helpers/worker-scripts/hello-world-wrangler.toml +0 -1
- package/src/__tests__/helpers/worker-scripts/parent-worker.js +0 -8
- package/src/__tests__/helpers/worker-scripts/parent-wrangler.toml +0 -5
- package/src/__tests__/helpers/write-worker-source.ts +0 -31
- package/src/__tests__/helpers/write-wrangler-toml.ts +0 -17
- package/src/__tests__/https-options.test.ts +0 -163
- package/src/__tests__/index.test.ts +0 -264
- package/src/__tests__/init.test.ts +0 -2900
- package/src/__tests__/jest.setup.ts +0 -202
- package/src/__tests__/kv.test.ts +0 -1675
- package/src/__tests__/logger.test.ts +0 -141
- package/src/__tests__/metrics.test.ts +0 -450
- package/src/__tests__/middleware.scheduled.test.ts +0 -135
- package/src/__tests__/middleware.test.ts +0 -726
- package/src/__tests__/package-manager.test.ts +0 -353
- package/src/__tests__/pages-deployment-tail.test.ts +0 -820
- package/src/__tests__/pages.test.ts +0 -2442
- package/src/__tests__/parse.test.ts +0 -330
- package/src/__tests__/paths.test.ts +0 -39
- package/src/__tests__/publish.test.ts +0 -7633
- package/src/__tests__/pubsub.test.ts +0 -370
- package/src/__tests__/queues.test.ts +0 -371
- package/src/__tests__/r2.test.ts +0 -393
- package/src/__tests__/route.test.ts +0 -45
- package/src/__tests__/secret.test.ts +0 -644
- package/src/__tests__/tail.test.ts +0 -800
- package/src/__tests__/test-old-node-version.js +0 -31
- package/src/__tests__/type-generation.test.ts +0 -226
- package/src/__tests__/user.test.ts +0 -155
- package/src/__tests__/utils-collectKeyValues.test.ts +0 -47
- package/src/__tests__/validate-dev-props.test.ts +0 -56
- package/src/__tests__/version.test.ts +0 -35
- package/src/__tests__/whoami.test.tsx +0 -278
- package/src/__tests__/worker-namespace.test.ts +0 -326
- package/src/abort.d.ts +0 -3
- package/src/api/dev.ts +0 -210
- package/src/api/index.ts +0 -2
- package/src/bundle-reporter.tsx +0 -68
- package/src/bundle.ts +0 -823
- package/src/cfetch/index.ts +0 -160
- package/src/cfetch/internal.ts +0 -263
- package/src/cli.ts +0 -28
- package/src/config/README.md +0 -107
- package/src/config/config.ts +0 -275
- package/src/config/diagnostics.ts +0 -80
- package/src/config/environment.ts +0 -561
- package/src/config/index.ts +0 -334
- package/src/config/validation-helpers.ts +0 -597
- package/src/config/validation.ts +0 -2103
- package/src/config-cache.ts +0 -85
- package/src/create-worker-preview.ts +0 -282
- package/src/create-worker-upload-form.ts +0 -316
- package/src/d1/backups.tsx +0 -218
- package/src/d1/constants.ts +0 -2
- package/src/d1/create.tsx +0 -63
- package/src/d1/delete.tsx +0 -56
- package/src/d1/execute.tsx +0 -352
- package/src/d1/formatTimeAgo.ts +0 -14
- package/src/d1/index.ts +0 -99
- package/src/d1/list.tsx +0 -48
- package/src/d1/migrations.tsx +0 -446
- package/src/d1/options.ts +0 -22
- package/src/d1/types.tsx +0 -24
- package/src/d1/utils.ts +0 -48
- package/src/delete.ts +0 -108
- package/src/deployments.ts +0 -77
- package/src/deprecated/index.ts +0 -438
- package/src/dev/dev-vars.ts +0 -39
- package/src/dev/dev.tsx +0 -590
- package/src/dev/get-local-persistence-path.tsx +0 -31
- package/src/dev/local.tsx +0 -886
- package/src/dev/remote.tsx +0 -603
- package/src/dev/start-server.ts +0 -538
- package/src/dev/use-esbuild.ts +0 -204
- package/src/dev/validate-dev-props.ts +0 -31
- package/src/dev-registry.tsx +0 -201
- package/src/dev.tsx +0 -905
- package/src/dialogs.tsx +0 -168
- package/src/dispatch-namespace.ts +0 -207
- package/src/durable.ts +0 -102
- package/src/entry.ts +0 -329
- package/src/environment-variables.ts +0 -50
- package/src/errors.ts +0 -11
- package/src/git-client.ts +0 -124
- package/src/global-wrangler-config-path.ts +0 -26
- package/src/https-options.ts +0 -127
- package/src/index.tsx +0 -682
- package/src/init.ts +0 -970
- package/src/inspect.ts +0 -767
- package/src/intl-polyfill.d.ts +0 -139
- package/src/is-ci.ts +0 -14
- package/src/is-interactive.ts +0 -16
- package/src/kv/helpers.ts +0 -430
- package/src/kv/index.ts +0 -596
- package/src/logger.ts +0 -92
- package/src/metrics/index.ts +0 -5
- package/src/metrics/metrics-config.ts +0 -239
- package/src/metrics/metrics-dispatcher.ts +0 -96
- package/src/metrics/metrics-usage-headers.ts +0 -24
- package/src/metrics/send-event.ts +0 -96
- package/src/miniflare-cli/README.md +0 -30
- package/src/miniflare-cli/assets.ts +0 -215
- package/src/miniflare-cli/index.ts +0 -213
- package/src/miniflare-cli/request-context.ts +0 -40
- package/src/module-collection.ts +0 -267
- package/src/open-in-browser.ts +0 -17
- package/src/package-manager.ts +0 -219
- package/src/pages/build.tsx +0 -270
- package/src/pages/constants.ts +0 -18
- package/src/pages/deployment-tails.tsx +0 -284
- package/src/pages/deployments.tsx +0 -84
- package/src/pages/dev.tsx +0 -708
- package/src/pages/errors.ts +0 -66
- package/src/pages/functions/buildPlugin.ts +0 -107
- package/src/pages/functions/buildWorker.ts +0 -166
- package/src/pages/functions/filepath-routing.test.ts +0 -234
- package/src/pages/functions/filepath-routing.ts +0 -189
- package/src/pages/functions/identifiers.ts +0 -78
- package/src/pages/functions/routes-consolidation.test.ts +0 -250
- package/src/pages/functions/routes-consolidation.ts +0 -73
- package/src/pages/functions/routes-transformation.test.ts +0 -282
- package/src/pages/functions/routes-transformation.ts +0 -115
- package/src/pages/functions/routes-validation.test.ts +0 -403
- package/src/pages/functions/routes-validation.ts +0 -202
- package/src/pages/functions/routes.ts +0 -151
- package/src/pages/functions.tsx +0 -82
- package/src/pages/hash.tsx +0 -13
- package/src/pages/index.tsx +0 -102
- package/src/pages/projects.tsx +0 -169
- package/src/pages/prompt-select-project.tsx +0 -31
- package/src/pages/publish.tsx +0 -451
- package/src/pages/types.ts +0 -41
- package/src/pages/upload.tsx +0 -426
- package/src/pages/utils.ts +0 -23
- package/src/parse.ts +0 -286
- package/src/paths.ts +0 -71
- package/src/proxy.ts +0 -689
- package/src/publish/index.ts +0 -270
- package/src/publish/publish.ts +0 -1035
- package/src/pubsub/index.ts +0 -286
- package/src/pubsub/pubsub-commands.tsx +0 -624
- package/src/queues/cli/commands/consumer/add.ts +0 -71
- package/src/queues/cli/commands/consumer/index.ts +0 -22
- package/src/queues/cli/commands/consumer/remove.ts +0 -38
- package/src/queues/cli/commands/create.ts +0 -25
- package/src/queues/cli/commands/delete.ts +0 -26
- package/src/queues/cli/commands/index.ts +0 -33
- package/src/queues/cli/commands/list.ts +0 -25
- package/src/queues/client.ts +0 -135
- package/src/r2/constants.ts +0 -4
- package/src/r2/helpers.ts +0 -131
- package/src/r2/index.ts +0 -289
- package/src/routes.ts +0 -140
- package/src/secret/index.ts +0 -378
- package/src/selfsigned.d.ts +0 -29
- package/src/sites.tsx +0 -372
- package/src/tail/createTail.ts +0 -379
- package/src/tail/filters.ts +0 -277
- package/src/tail/index.ts +0 -214
- package/src/tail/printing.ts +0 -107
- package/src/type-generation.ts +0 -173
- package/src/update-check.ts +0 -19
- package/src/user/access.ts +0 -69
- package/src/user/choose-account.tsx +0 -69
- package/src/user/env-vars.ts +0 -46
- package/src/user/generate-auth-url.ts +0 -33
- package/src/user/generate-random-state.ts +0 -16
- package/src/user/index.ts +0 -3
- package/src/user/user.tsx +0 -1192
- package/src/utils/collectKeyValues.ts +0 -14
- package/src/whoami.tsx +0 -169
- package/src/worker.ts +0 -245
- package/src/yargs-types.ts +0 -24
- package/src/zones.ts +0 -191
- package/templates/d1-beta-facade.js +0 -205
- package/templates/first-party-worker-module-facade.ts +0 -18
- package/templates/format-dev-errors.ts +0 -32
- package/templates/serve-static-assets.ts +0 -63
- package/templates/service-bindings-module-facade.js +0 -54
- package/templates/service-bindings-sw-facade.js +0 -42
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -1,159 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
declare interface BlobPropertyBag {
|
|
10
|
-
type?: string
|
|
11
|
-
endings?: 'native' | 'transparent'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare type BodyInit =
|
|
15
|
-
| ArrayBuffer
|
|
16
|
-
| AsyncIterable<Uint8Array>
|
|
17
|
-
| Blob_2
|
|
18
|
-
| FormData
|
|
19
|
-
| Iterable<Uint8Array>
|
|
20
|
-
| NodeJS.ArrayBufferView
|
|
21
|
-
| URLSearchParams_2
|
|
22
|
-
| null
|
|
23
|
-
| string
|
|
24
|
-
|
|
25
|
-
declare interface BodyMixin {
|
|
26
|
-
readonly body: ReadableStream | null
|
|
27
|
-
readonly bodyUsed: boolean
|
|
28
|
-
|
|
29
|
-
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
30
|
-
readonly blob: () => Promise<Blob_2>
|
|
31
|
-
readonly formData: () => Promise<FormData>
|
|
32
|
-
readonly json: () => Promise<unknown>
|
|
33
|
-
readonly text: () => Promise<string>
|
|
34
|
-
}
|
|
1
|
+
import { Json, DispatchFetch, NodeJSCompatMode, Request, Response as Response$1, Miniflare, MiniflareOptions, Mutex, WorkerOptions, ModuleRule, MixedModeConnectionString } from 'miniflare';
|
|
2
|
+
import * as undici from 'undici';
|
|
3
|
+
import { RequestInfo, RequestInit, Response, FormData } from 'undici';
|
|
4
|
+
import { RouterConfig, AssetConfig } from '@cloudflare/workers-shared';
|
|
5
|
+
import { EventEmitter } from 'node:events';
|
|
6
|
+
import Protocol from 'devtools-protocol/types/protocol-mapping';
|
|
7
|
+
import { Metafile } from 'esbuild';
|
|
8
|
+
import { IncomingRequestCfProperties } from '@cloudflare/workers-types/experimental';
|
|
35
9
|
|
|
36
10
|
/**
|
|
37
|
-
* The
|
|
11
|
+
* The `Environment` interface declares all the configuration fields that
|
|
12
|
+
* can be specified for an environment.
|
|
13
|
+
*
|
|
14
|
+
* This could be the top-level default environment, or a specific named environment.
|
|
38
15
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
16
|
+
interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
|
|
17
|
+
}
|
|
18
|
+
type SimpleRoute = string;
|
|
19
|
+
type ZoneIdRoute = {
|
|
20
|
+
pattern: string;
|
|
21
|
+
zone_id: string;
|
|
22
|
+
custom_domain?: boolean;
|
|
23
|
+
};
|
|
24
|
+
type ZoneNameRoute = {
|
|
25
|
+
pattern: string;
|
|
26
|
+
zone_name: string;
|
|
27
|
+
custom_domain?: boolean;
|
|
28
|
+
};
|
|
29
|
+
type CustomDomainRoute = {
|
|
42
30
|
pattern: string;
|
|
43
31
|
custom_domain: boolean;
|
|
44
32
|
};
|
|
45
|
-
|
|
33
|
+
type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
|
|
34
|
+
/**
|
|
35
|
+
* Configuration in wrangler for Cloudchamber
|
|
36
|
+
*/
|
|
37
|
+
type CloudchamberConfig = {
|
|
38
|
+
image?: string;
|
|
39
|
+
location?: string;
|
|
40
|
+
vcpu?: number;
|
|
41
|
+
memory?: string;
|
|
42
|
+
ipv4?: boolean;
|
|
43
|
+
};
|
|
46
44
|
/**
|
|
47
|
-
*
|
|
45
|
+
* Configuration for a container application
|
|
48
46
|
*/
|
|
49
|
-
|
|
47
|
+
type ContainerApp = {
|
|
48
|
+
/** Name of the application*/
|
|
49
|
+
name: string;
|
|
50
|
+
/** Number of application instances */
|
|
51
|
+
instances?: number;
|
|
52
|
+
/** Number of maximum application instances. Only applicable to Durable Object container applications */
|
|
53
|
+
max_instances?: number;
|
|
50
54
|
/**
|
|
51
|
-
* The
|
|
52
|
-
*
|
|
53
|
-
* @deprecated We infer the format automatically now.
|
|
55
|
+
* The path to a Dockerfile, or an image URI.
|
|
56
|
+
* Can be defined both here or by setting the `image` key in the `ContainerApp` configuration
|
|
54
57
|
*/
|
|
55
|
-
|
|
58
|
+
image?: string;
|
|
56
59
|
/**
|
|
57
|
-
*
|
|
58
|
-
* relative to the wrangler.toml file.
|
|
59
|
-
*
|
|
60
|
-
* Defaults to the directory containing the wrangler.toml file.
|
|
61
|
-
*
|
|
62
|
-
* @deprecated
|
|
60
|
+
* Build context of the application. By default it is the directory of `image`.
|
|
63
61
|
*/
|
|
64
|
-
|
|
62
|
+
image_build_context?: string;
|
|
65
63
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* @deprecated This will be replaced by a command line argument.
|
|
64
|
+
* Image variables to be passed along the image
|
|
69
65
|
*/
|
|
70
|
-
|
|
66
|
+
image_vars?: Record<string, string>;
|
|
67
|
+
class_name: string;
|
|
68
|
+
/** The scheduling policy of the application, default is regional */
|
|
69
|
+
scheduling_policy?: "regional" | "moon";
|
|
70
|
+
configuration: {
|
|
71
|
+
image: string;
|
|
72
|
+
labels?: {
|
|
73
|
+
name: string;
|
|
74
|
+
value: string;
|
|
75
|
+
}[];
|
|
76
|
+
secrets?: {
|
|
77
|
+
name: string;
|
|
78
|
+
type: "env";
|
|
79
|
+
secret: string;
|
|
80
|
+
}[];
|
|
81
|
+
};
|
|
82
|
+
/** Scheduling constraints */
|
|
83
|
+
constraints?: {
|
|
84
|
+
regions?: string[];
|
|
85
|
+
cities?: string[];
|
|
86
|
+
tier?: number;
|
|
87
|
+
};
|
|
88
|
+
durable_objects?: {
|
|
89
|
+
namespace_id: string;
|
|
90
|
+
};
|
|
91
|
+
/** How a rollout should be done, defining the size of it */
|
|
92
|
+
rollout_step_percentage?: number;
|
|
71
93
|
/**
|
|
72
|
-
*
|
|
94
|
+
* How a rollout should be created. It supports the following modes:
|
|
95
|
+
* - full_auto: The container application will be rolled out fully automatically.
|
|
96
|
+
* - none: The container application won't have a roll out or update.
|
|
97
|
+
* - manual: The container application will be rollout fully by manually actioning progress steps.
|
|
73
98
|
*/
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
declare interface DevApiOptions {
|
|
78
|
-
testMode?: boolean;
|
|
79
|
-
disableExperimentalWarning?: boolean;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
declare interface DevOptions {
|
|
83
|
-
config?: string;
|
|
84
|
-
env?: string;
|
|
85
|
-
ip?: string;
|
|
86
|
-
port?: number;
|
|
87
|
-
bundle?: boolean;
|
|
88
|
-
inspectorPort?: number;
|
|
89
|
-
localProtocol?: "http" | "https";
|
|
90
|
-
assets?: string;
|
|
91
|
-
site?: string;
|
|
92
|
-
siteInclude?: string[];
|
|
93
|
-
siteExclude?: string[];
|
|
94
|
-
nodeCompat?: boolean;
|
|
95
|
-
compatibilityDate?: string;
|
|
96
|
-
compatibilityFlags?: string[];
|
|
97
|
-
persist?: boolean;
|
|
98
|
-
persistTo?: string;
|
|
99
|
-
liveReload?: boolean;
|
|
100
|
-
watch?: boolean;
|
|
101
|
-
vars?: {
|
|
102
|
-
[key: string]: unknown;
|
|
103
|
-
};
|
|
104
|
-
kv?: {
|
|
105
|
-
binding: string;
|
|
106
|
-
id: string;
|
|
107
|
-
preview_id?: string;
|
|
108
|
-
}[];
|
|
109
|
-
durableObjects?: {
|
|
110
|
-
name: string;
|
|
111
|
-
class_name: string;
|
|
112
|
-
script_name?: string | undefined;
|
|
113
|
-
environment?: string | undefined;
|
|
114
|
-
}[];
|
|
115
|
-
r2?: {
|
|
116
|
-
binding: string;
|
|
117
|
-
bucket_name: string;
|
|
118
|
-
preview_bucket_name?: string;
|
|
119
|
-
}[];
|
|
120
|
-
d1Databases?: Environment["d1_databases"];
|
|
121
|
-
showInteractiveDevSession?: boolean;
|
|
122
|
-
logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
|
|
123
|
-
logPrefix?: string;
|
|
124
|
-
inspect?: boolean;
|
|
125
|
-
local?: boolean;
|
|
126
|
-
forceLocal?: boolean;
|
|
127
|
-
enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
|
|
128
|
-
_?: (string | number)[];
|
|
129
|
-
$0?: string;
|
|
130
|
-
testScheduled?: boolean;
|
|
131
|
-
experimentalLocal?: boolean;
|
|
132
|
-
accountId?: string;
|
|
133
|
-
experimentalLocalRemoteKv?: boolean;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
declare interface EnablePagesAssetsServiceBindingOptions {
|
|
137
|
-
proxyPort?: number;
|
|
138
|
-
directory?: string;
|
|
139
|
-
}
|
|
140
|
-
|
|
99
|
+
rollout_kind?: "full_auto" | "none" | "full_manual";
|
|
100
|
+
};
|
|
141
101
|
/**
|
|
142
|
-
*
|
|
143
|
-
* can be specified for an environment.
|
|
144
|
-
*
|
|
145
|
-
* This could be the top-level default environment, or a specific named environment.
|
|
102
|
+
* Configuration in wrangler for Durable Object Migrations
|
|
146
103
|
*/
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
104
|
+
type DurableObjectMigration = {
|
|
105
|
+
/** A unique identifier for this migration. */
|
|
106
|
+
tag: string;
|
|
107
|
+
/** The new Durable Objects being defined. */
|
|
108
|
+
new_classes?: string[];
|
|
109
|
+
/** The new SQLite Durable Objects being defined. */
|
|
110
|
+
new_sqlite_classes?: string[];
|
|
111
|
+
/** The Durable Objects being renamed. */
|
|
112
|
+
renamed_classes?: {
|
|
113
|
+
from: string;
|
|
114
|
+
to: string;
|
|
115
|
+
}[];
|
|
116
|
+
/** The Durable Objects being removed. */
|
|
117
|
+
deleted_classes?: string[];
|
|
118
|
+
};
|
|
150
119
|
/**
|
|
151
120
|
* The `EnvironmentInheritable` interface declares all the configuration fields for an environment
|
|
152
121
|
* that can be inherited (and overridden) from the top-level environment.
|
|
153
122
|
*/
|
|
154
|
-
|
|
123
|
+
interface EnvironmentInheritable {
|
|
155
124
|
/**
|
|
156
|
-
* The name of your
|
|
125
|
+
* The name of your Worker. Alphanumeric + dashes only.
|
|
157
126
|
*
|
|
158
127
|
* @inheritable
|
|
159
128
|
*/
|
|
@@ -172,101 +141,154 @@ declare interface EnvironmentInheritable {
|
|
|
172
141
|
* A date in the form yyyy-mm-dd, which will be used to determine
|
|
173
142
|
* which version of the Workers runtime is used.
|
|
174
143
|
*
|
|
175
|
-
* More details at https://developers.cloudflare.com/workers/
|
|
144
|
+
* More details at https://developers.cloudflare.com/workers/configuration/compatibility-dates
|
|
176
145
|
*
|
|
177
146
|
* @inheritable
|
|
178
147
|
*/
|
|
179
148
|
compatibility_date: string | undefined;
|
|
180
149
|
/**
|
|
181
150
|
* A list of flags that enable features from upcoming features of
|
|
182
|
-
* the Workers runtime, usually used together with
|
|
151
|
+
* the Workers runtime, usually used together with compatibility_date.
|
|
183
152
|
*
|
|
184
|
-
* More details at https://developers.cloudflare.com/workers/
|
|
153
|
+
* More details at https://developers.cloudflare.com/workers/configuration/compatibility-flags/
|
|
185
154
|
*
|
|
155
|
+
* @default []
|
|
186
156
|
* @inheritable
|
|
187
157
|
*/
|
|
188
158
|
compatibility_flags: string[];
|
|
189
159
|
/**
|
|
190
160
|
* The entrypoint/path to the JavaScript file that will be executed.
|
|
161
|
+
*
|
|
162
|
+
* @inheritable
|
|
191
163
|
*/
|
|
192
164
|
main: string | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* If true then Wrangler will traverse the file tree below `base_dir`;
|
|
167
|
+
* Any files that match `rules` will be included in the deployed Worker.
|
|
168
|
+
* Defaults to true if `no_bundle` is true, otherwise false.
|
|
169
|
+
*
|
|
170
|
+
* @inheritable
|
|
171
|
+
*/
|
|
172
|
+
find_additional_modules: boolean | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* Determines whether Wrangler will preserve bundled file names.
|
|
175
|
+
* Defaults to false.
|
|
176
|
+
* If left unset, files will be named using the pattern ${fileHash}-${basename},
|
|
177
|
+
* for example, `34de60b44167af5c5a709e62a4e20c4f18c9e3b6-favicon.ico`.
|
|
178
|
+
*
|
|
179
|
+
* @inheritable
|
|
180
|
+
*/
|
|
181
|
+
preserve_file_names: boolean | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* The directory in which module rules should be evaluated when including additional files into a Worker deployment.
|
|
184
|
+
* This defaults to the directory containing the `main` entry point of the Worker if not specified.
|
|
185
|
+
*
|
|
186
|
+
* @inheritable
|
|
187
|
+
*/
|
|
188
|
+
base_dir: string | undefined;
|
|
193
189
|
/**
|
|
194
190
|
* Whether we use <name>.<subdomain>.workers.dev to
|
|
195
|
-
* test and deploy your
|
|
191
|
+
* test and deploy your Worker.
|
|
192
|
+
*
|
|
193
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workersdev
|
|
196
194
|
*
|
|
197
|
-
* @default
|
|
195
|
+
* @default true
|
|
198
196
|
* @breaking
|
|
199
197
|
* @inheritable
|
|
200
198
|
*/
|
|
201
199
|
workers_dev: boolean | undefined;
|
|
202
200
|
/**
|
|
203
|
-
*
|
|
201
|
+
* Whether we use <version>-<name>.<subdomain>.workers.dev to
|
|
202
|
+
* serve Preview URLs for your Worker.
|
|
203
|
+
*
|
|
204
|
+
* @default true
|
|
205
|
+
* @inheritable
|
|
206
|
+
*/
|
|
207
|
+
preview_urls: boolean | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* A list of routes that your Worker should be published to.
|
|
204
210
|
* Only one of `routes` or `route` is required.
|
|
205
211
|
*
|
|
206
|
-
* Only required when workers_dev is false, and there's no scheduled
|
|
212
|
+
* Only required when workers_dev is false, and there's no scheduled Worker (see `triggers`)
|
|
213
|
+
*
|
|
214
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#types-of-routes
|
|
207
215
|
*
|
|
208
216
|
* @inheritable
|
|
209
217
|
*/
|
|
210
218
|
routes: Route[] | undefined;
|
|
211
219
|
/**
|
|
212
|
-
* A route that your
|
|
220
|
+
* A route that your Worker should be published to. Literally
|
|
213
221
|
* the same as routes, but only one.
|
|
214
222
|
* Only one of `routes` or `route` is required.
|
|
215
223
|
*
|
|
216
|
-
* Only required when workers_dev is false, and there's no scheduled
|
|
224
|
+
* Only required when workers_dev is false, and there's no scheduled Worker
|
|
217
225
|
*
|
|
218
226
|
* @inheritable
|
|
219
227
|
*/
|
|
220
228
|
route: Route | undefined;
|
|
221
229
|
/**
|
|
222
230
|
* Path to a custom tsconfig
|
|
231
|
+
*
|
|
232
|
+
* @inheritable
|
|
223
233
|
*/
|
|
224
234
|
tsconfig: string | undefined;
|
|
225
235
|
/**
|
|
226
236
|
* The function to use to replace jsx syntax.
|
|
227
237
|
*
|
|
228
|
-
* @default
|
|
238
|
+
* @default "React.createElement"
|
|
229
239
|
* @inheritable
|
|
230
240
|
*/
|
|
231
241
|
jsx_factory: string;
|
|
232
242
|
/**
|
|
233
243
|
* The function to use to replace jsx fragment syntax.
|
|
234
244
|
*
|
|
235
|
-
* @default
|
|
245
|
+
* @default "React.Fragment"
|
|
236
246
|
* @inheritable
|
|
237
247
|
*/
|
|
238
248
|
jsx_fragment: string;
|
|
239
249
|
/**
|
|
240
|
-
*
|
|
250
|
+
* A list of migrations that should be uploaded with your Worker.
|
|
251
|
+
*
|
|
252
|
+
* These define changes in your Durable Object declarations.
|
|
253
|
+
*
|
|
254
|
+
* More details at https://developers.cloudflare.com/workers/learning/using-durable-objects#configuring-durable-object-classes-with-migrations
|
|
255
|
+
*
|
|
256
|
+
* @default []
|
|
257
|
+
* @inheritable
|
|
258
|
+
*/
|
|
259
|
+
migrations: DurableObjectMigration[];
|
|
260
|
+
/**
|
|
261
|
+
* "Cron" definitions to trigger a Worker's "scheduled" function.
|
|
241
262
|
*
|
|
242
|
-
* Lets you call
|
|
263
|
+
* Lets you call Workers periodically, much like a cron job.
|
|
243
264
|
*
|
|
244
265
|
* More details here https://developers.cloudflare.com/workers/platform/cron-triggers
|
|
245
266
|
*
|
|
246
|
-
*
|
|
267
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers
|
|
268
|
+
*
|
|
269
|
+
* @default {crons: undefined}
|
|
247
270
|
* @inheritable
|
|
248
271
|
*/
|
|
249
272
|
triggers: {
|
|
250
|
-
crons: string[];
|
|
273
|
+
crons: string[] | undefined;
|
|
251
274
|
};
|
|
252
275
|
/**
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
* For
|
|
257
|
-
* it will be set to the [default Usage Model set on the account](https://dash.cloudflare.com/?account=workers/default-usage-model).
|
|
258
|
-
* For existing Workers, if the Usage Model is omitted, it will be
|
|
259
|
-
* set to the Usage Model configured in the dashboard for that Worker.
|
|
276
|
+
* Specify limits for runtime behavior.
|
|
277
|
+
* Only supported for the "standard" Usage Model
|
|
278
|
+
*
|
|
279
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#limits
|
|
260
280
|
*
|
|
261
281
|
* @inheritable
|
|
262
282
|
*/
|
|
263
|
-
|
|
283
|
+
limits: UserLimits | undefined;
|
|
264
284
|
/**
|
|
265
285
|
* An ordered list of rules that define which modules to import,
|
|
266
286
|
* and what type to import them as. You will need to specify rules
|
|
267
287
|
* to use Text, Data, and CompiledWasm modules, or when you wish to
|
|
268
288
|
* have a .js file be treated as an ESModule instead of CommonJS.
|
|
269
289
|
*
|
|
290
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#bundling
|
|
291
|
+
*
|
|
270
292
|
* @inheritable
|
|
271
293
|
*/
|
|
272
294
|
rules: Rule[];
|
|
@@ -276,7 +298,9 @@ declare interface EnvironmentInheritable {
|
|
|
276
298
|
* Refer to the [custom builds documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration#build)
|
|
277
299
|
* for more details.
|
|
278
300
|
*
|
|
279
|
-
*
|
|
301
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#custom-builds
|
|
302
|
+
*
|
|
303
|
+
* @default {watch_dir:"./src"}
|
|
280
304
|
*/
|
|
281
305
|
build: {
|
|
282
306
|
/** The command used to build your Worker. On Linux and macOS, the command is executed in the `sh` shell and the `cmd` shell for Windows. The `&&` and `||` shell operators may be used. */
|
|
@@ -285,14 +309,9 @@ declare interface EnvironmentInheritable {
|
|
|
285
309
|
cwd?: string;
|
|
286
310
|
/** The directory to watch for changes while using wrangler dev, defaults to the current working directory */
|
|
287
311
|
watch_dir?: string | string[];
|
|
288
|
-
/**
|
|
289
|
-
* Deprecated field previously used to configure the build and upload of the script.
|
|
290
|
-
* @deprecated
|
|
291
|
-
*/
|
|
292
|
-
upload?: DeprecatedUpload;
|
|
293
312
|
};
|
|
294
313
|
/**
|
|
295
|
-
* Skip internal build steps and directly
|
|
314
|
+
* Skip internal build steps and directly deploy script
|
|
296
315
|
* @inheritable
|
|
297
316
|
*/
|
|
298
317
|
no_bundle: boolean | undefined;
|
|
@@ -302,46 +321,25 @@ declare interface EnvironmentInheritable {
|
|
|
302
321
|
*/
|
|
303
322
|
minify: boolean | undefined;
|
|
304
323
|
/**
|
|
305
|
-
*
|
|
324
|
+
* Keep function names after javascript transpilations.
|
|
325
|
+
*
|
|
326
|
+
* @default {true}
|
|
306
327
|
* @inheritable
|
|
307
328
|
*/
|
|
308
|
-
|
|
329
|
+
keep_names: boolean | undefined;
|
|
309
330
|
/**
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
* NOTE: This field is not automatically inherited from the top level environment,
|
|
313
|
-
* and so must be specified in every named environment.
|
|
331
|
+
* Designates this Worker as an internal-only "first-party" Worker.
|
|
314
332
|
*
|
|
315
|
-
* @
|
|
316
|
-
* @nonInheritable
|
|
317
|
-
*/
|
|
318
|
-
dispatch_namespaces: {
|
|
319
|
-
/** The binding name used to refer to the bound service. */
|
|
320
|
-
binding: string;
|
|
321
|
-
/** The namespace to bind to. */
|
|
322
|
-
namespace: string;
|
|
323
|
-
}[];
|
|
324
|
-
/**
|
|
325
|
-
* Designates this worker as an internal-only "first-party" worker.
|
|
333
|
+
* @inheritable
|
|
326
334
|
*/
|
|
327
335
|
first_party_worker: boolean | undefined;
|
|
328
336
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
* This is just here for now because the `route` commands use it.
|
|
332
|
-
* So we need to include it in this type so it is available.
|
|
333
|
-
*/
|
|
334
|
-
zone_id?: string;
|
|
335
|
-
/**
|
|
336
|
-
* Specify a compiled capnp schema to use
|
|
337
|
-
* Then add a binding per field in the top level message that you will send to logfwdr
|
|
337
|
+
* List of bindings that you will send to logfwdr
|
|
338
338
|
*
|
|
339
|
-
* @default
|
|
339
|
+
* @default {bindings:[]}
|
|
340
340
|
* @inheritable
|
|
341
341
|
*/
|
|
342
342
|
logfwdr: {
|
|
343
|
-
/** capnp schema filename */
|
|
344
|
-
schema: string | undefined;
|
|
345
343
|
bindings: {
|
|
346
344
|
/** The binding name used to refer to logfwdr */
|
|
347
345
|
name: string;
|
|
@@ -350,7 +348,7 @@ declare interface EnvironmentInheritable {
|
|
|
350
348
|
}[];
|
|
351
349
|
};
|
|
352
350
|
/**
|
|
353
|
-
* Send Trace Events from this
|
|
351
|
+
* Send Trace Events from this Worker to Workers Logpush.
|
|
354
352
|
*
|
|
355
353
|
* This will not configure a corresponding Logpush job automatically.
|
|
356
354
|
*
|
|
@@ -360,8 +358,73 @@ declare interface EnvironmentInheritable {
|
|
|
360
358
|
* @inheritable
|
|
361
359
|
*/
|
|
362
360
|
logpush: boolean | undefined;
|
|
361
|
+
/**
|
|
362
|
+
* Include source maps when uploading this worker.
|
|
363
|
+
*
|
|
364
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#source-maps
|
|
365
|
+
*
|
|
366
|
+
* @inheritable
|
|
367
|
+
*/
|
|
368
|
+
upload_source_maps: boolean | undefined;
|
|
369
|
+
/**
|
|
370
|
+
* Specify how the Worker should be located to minimize round-trip time.
|
|
371
|
+
*
|
|
372
|
+
* More details: https://developers.cloudflare.com/workers/platform/smart-placement/
|
|
373
|
+
*
|
|
374
|
+
* @inheritable
|
|
375
|
+
*/
|
|
376
|
+
placement: {
|
|
377
|
+
mode: "off" | "smart";
|
|
378
|
+
hint?: string;
|
|
379
|
+
} | undefined;
|
|
380
|
+
/**
|
|
381
|
+
* Specify the directory of static assets to deploy/serve
|
|
382
|
+
*
|
|
383
|
+
* More details at https://developers.cloudflare.com/workers/frameworks/
|
|
384
|
+
*
|
|
385
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#assets
|
|
386
|
+
*
|
|
387
|
+
* @inheritable
|
|
388
|
+
*/
|
|
389
|
+
assets: Assets | undefined;
|
|
390
|
+
/**
|
|
391
|
+
* Specify the observability behavior of the Worker.
|
|
392
|
+
*
|
|
393
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#observability
|
|
394
|
+
*
|
|
395
|
+
* @inheritable
|
|
396
|
+
*/
|
|
397
|
+
observability: Observability | undefined;
|
|
398
|
+
/**
|
|
399
|
+
* Specify the compliance region mode of the Worker.
|
|
400
|
+
*
|
|
401
|
+
* Although if the user does not specify a compliance region, the default is `public`,
|
|
402
|
+
* it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable.
|
|
403
|
+
*/
|
|
404
|
+
compliance_region: "public" | "fedramp_high" | undefined;
|
|
363
405
|
}
|
|
364
|
-
|
|
406
|
+
type DurableObjectBindings = {
|
|
407
|
+
/** The name of the binding used to refer to the Durable Object */
|
|
408
|
+
name: string;
|
|
409
|
+
/** The exported class name of the Durable Object */
|
|
410
|
+
class_name: string;
|
|
411
|
+
/** The script where the Durable Object is defined (if it's external to this Worker) */
|
|
412
|
+
script_name?: string;
|
|
413
|
+
/** The service environment of the script_name to bind to */
|
|
414
|
+
environment?: string;
|
|
415
|
+
}[];
|
|
416
|
+
type WorkflowBinding = {
|
|
417
|
+
/** The name of the binding used to refer to the Workflow */
|
|
418
|
+
binding: string;
|
|
419
|
+
/** The name of the Workflow */
|
|
420
|
+
name: string;
|
|
421
|
+
/** The exported class name of the Workflow */
|
|
422
|
+
class_name: string;
|
|
423
|
+
/** The script where the Workflow is defined (if it's external to this Worker) */
|
|
424
|
+
script_name?: string;
|
|
425
|
+
/** Whether the Workflow should be remote or not (only available under `--x-mixed-mode`) */
|
|
426
|
+
remote?: boolean;
|
|
427
|
+
};
|
|
365
428
|
/**
|
|
366
429
|
* The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
|
|
367
430
|
* that cannot be inherited from the top-level environment, and must be defined specifically.
|
|
@@ -369,31 +432,31 @@ declare interface EnvironmentInheritable {
|
|
|
369
432
|
* If any of these fields are defined at the top-level then they should also be specifically defined
|
|
370
433
|
* for each named environment.
|
|
371
434
|
*/
|
|
372
|
-
|
|
435
|
+
interface EnvironmentNonInheritable {
|
|
373
436
|
/**
|
|
374
|
-
* A map of values to substitute when deploying your
|
|
437
|
+
* A map of values to substitute when deploying your Worker.
|
|
375
438
|
*
|
|
376
439
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
377
440
|
* and so must be specified in every named environment.
|
|
378
441
|
*
|
|
379
|
-
* @default
|
|
442
|
+
* @default {}
|
|
380
443
|
* @nonInheritable
|
|
381
444
|
*/
|
|
382
445
|
define: Record<string, string>;
|
|
383
446
|
/**
|
|
384
|
-
* A map of environment variables to set when deploying your
|
|
447
|
+
* A map of environment variables to set when deploying your Worker.
|
|
385
448
|
*
|
|
386
449
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
387
450
|
* and so must be specified in every named environment.
|
|
388
451
|
*
|
|
389
|
-
*
|
|
452
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
|
453
|
+
*
|
|
454
|
+
* @default {}
|
|
390
455
|
* @nonInheritable
|
|
391
456
|
*/
|
|
392
|
-
vars:
|
|
393
|
-
[key: string]: unknown;
|
|
394
|
-
};
|
|
457
|
+
vars: Record<string, string | Json>;
|
|
395
458
|
/**
|
|
396
|
-
* A list of durable objects that your
|
|
459
|
+
* A list of durable objects that your Worker should be bound to.
|
|
397
460
|
*
|
|
398
461
|
* For more information about Durable Objects, see the documentation at
|
|
399
462
|
* https://developers.cloudflare.com/workers/learning/using-durable-objects
|
|
@@ -401,21 +464,41 @@ declare interface EnvironmentNonInheritable {
|
|
|
401
464
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
402
465
|
* and so must be specified in every named environment.
|
|
403
466
|
*
|
|
404
|
-
*
|
|
467
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
468
|
+
*
|
|
469
|
+
* @default {bindings:[]}
|
|
405
470
|
* @nonInheritable
|
|
406
471
|
*/
|
|
407
472
|
durable_objects: {
|
|
408
|
-
bindings:
|
|
409
|
-
/** The name of the binding used to refer to the Durable Object */
|
|
410
|
-
name: string;
|
|
411
|
-
/** The exported class name of the Durable Object */
|
|
412
|
-
class_name: string;
|
|
413
|
-
/** The script where the Durable Object is defined (if it's external to this worker) */
|
|
414
|
-
script_name?: string;
|
|
415
|
-
/** The service environment of the script_name to bind to */
|
|
416
|
-
environment?: string;
|
|
417
|
-
}[];
|
|
473
|
+
bindings: DurableObjectBindings;
|
|
418
474
|
};
|
|
475
|
+
/**
|
|
476
|
+
* A list of workflows that your Worker should be bound to.
|
|
477
|
+
*
|
|
478
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
479
|
+
* and so must be specified in every named environment.
|
|
480
|
+
*
|
|
481
|
+
* @default []
|
|
482
|
+
* @nonInheritable
|
|
483
|
+
*/
|
|
484
|
+
workflows: WorkflowBinding[];
|
|
485
|
+
/**
|
|
486
|
+
* Cloudchamber configuration
|
|
487
|
+
*
|
|
488
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
489
|
+
* and so must be specified in every named environment.
|
|
490
|
+
*
|
|
491
|
+
* @default {}
|
|
492
|
+
* @nonInheritable
|
|
493
|
+
*/
|
|
494
|
+
cloudchamber: CloudchamberConfig;
|
|
495
|
+
/**
|
|
496
|
+
* Container related configuration
|
|
497
|
+
*
|
|
498
|
+
* @default []
|
|
499
|
+
* @nonInheritable
|
|
500
|
+
*/
|
|
501
|
+
containers?: ContainerApp[];
|
|
419
502
|
/**
|
|
420
503
|
* These specify any Workers KV Namespaces you want to
|
|
421
504
|
* access from inside your Worker.
|
|
@@ -426,16 +509,39 @@ declare interface EnvironmentNonInheritable {
|
|
|
426
509
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
427
510
|
* and so must be specified in every named environment.
|
|
428
511
|
*
|
|
429
|
-
*
|
|
512
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
|
|
513
|
+
*
|
|
514
|
+
* @default []
|
|
430
515
|
* @nonInheritable
|
|
431
516
|
*/
|
|
432
517
|
kv_namespaces: {
|
|
433
518
|
/** The binding name used to refer to the KV Namespace */
|
|
434
519
|
binding: string;
|
|
435
520
|
/** The ID of the KV namespace */
|
|
436
|
-
id
|
|
521
|
+
id?: string;
|
|
437
522
|
/** The ID of the KV namespace used during `wrangler dev` */
|
|
438
523
|
preview_id?: string;
|
|
524
|
+
/** Whether the KV namespace should be remote or not (only available under `--x-mixed-mode`) */
|
|
525
|
+
remote?: boolean;
|
|
526
|
+
}[];
|
|
527
|
+
/**
|
|
528
|
+
* These specify bindings to send email from inside your Worker.
|
|
529
|
+
*
|
|
530
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
531
|
+
* and so must be specified in every named environment.
|
|
532
|
+
*
|
|
533
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#email-bindings
|
|
534
|
+
*
|
|
535
|
+
* @default []
|
|
536
|
+
* @nonInheritable
|
|
537
|
+
*/
|
|
538
|
+
send_email: {
|
|
539
|
+
/** The binding name used to refer to the this binding */
|
|
540
|
+
name: string;
|
|
541
|
+
/** If this binding should be restricted to a specific verified address */
|
|
542
|
+
destination_address?: string;
|
|
543
|
+
/** If this binding should be restricted to a set of verified addresses */
|
|
544
|
+
allowed_destination_addresses?: string[];
|
|
439
545
|
}[];
|
|
440
546
|
/**
|
|
441
547
|
* Specifies Queues that are bound to this Worker environment.
|
|
@@ -443,21 +549,29 @@ declare interface EnvironmentNonInheritable {
|
|
|
443
549
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
444
550
|
* and so must be specified in every named environment.
|
|
445
551
|
*
|
|
446
|
-
*
|
|
552
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#queues
|
|
553
|
+
*
|
|
554
|
+
* @default {consumers:[],producers:[]}
|
|
447
555
|
* @nonInheritable
|
|
448
556
|
*/
|
|
449
557
|
queues: {
|
|
450
558
|
/** Producer bindings */
|
|
451
559
|
producers?: {
|
|
452
|
-
/** The binding name used to refer to the Queue in the
|
|
560
|
+
/** The binding name used to refer to the Queue in the Worker. */
|
|
453
561
|
binding: string;
|
|
454
562
|
/** The name of this Queue. */
|
|
455
563
|
queue: string;
|
|
564
|
+
/** The number of seconds to wait before delivering a message */
|
|
565
|
+
delivery_delay?: number;
|
|
566
|
+
/** Whether the Queue producer should be remote or not (only available under `--x-mixed-mode`) */
|
|
567
|
+
remote?: boolean;
|
|
456
568
|
}[];
|
|
457
569
|
/** Consumer configuration */
|
|
458
570
|
consumers?: {
|
|
459
|
-
/** The name of the queue from which this
|
|
571
|
+
/** The name of the queue from which this consumer should consume. */
|
|
460
572
|
queue: string;
|
|
573
|
+
/** The consumer type, e.g., worker, http-pull, r2-bucket, etc. Default is worker. */
|
|
574
|
+
type?: string;
|
|
461
575
|
/** The maximum number of messages per batch */
|
|
462
576
|
max_batch_size?: number;
|
|
463
577
|
/** The maximum number of seconds to wait to fill a batch with messages. */
|
|
@@ -466,6 +580,12 @@ declare interface EnvironmentNonInheritable {
|
|
|
466
580
|
max_retries?: number;
|
|
467
581
|
/** The queue to send messages that failed to be consumed. */
|
|
468
582
|
dead_letter_queue?: string;
|
|
583
|
+
/** The maximum number of concurrent consumer Worker invocations. Leaving this unset will allow your consumer to scale to the maximum concurrency needed to keep up with the message backlog. */
|
|
584
|
+
max_concurrency?: number | null;
|
|
585
|
+
/** The number of milliseconds to wait for pulled messages to become visible again */
|
|
586
|
+
visibility_timeout_ms?: number;
|
|
587
|
+
/** The number of seconds to wait before retrying a message */
|
|
588
|
+
retry_delay?: number;
|
|
469
589
|
}[];
|
|
470
590
|
};
|
|
471
591
|
/**
|
|
@@ -474,16 +594,22 @@ declare interface EnvironmentNonInheritable {
|
|
|
474
594
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
475
595
|
* and so must be specified in every named environment.
|
|
476
596
|
*
|
|
477
|
-
*
|
|
597
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
|
|
598
|
+
*
|
|
599
|
+
* @default []
|
|
478
600
|
* @nonInheritable
|
|
479
601
|
*/
|
|
480
602
|
r2_buckets: {
|
|
481
|
-
/** The binding name used to refer to the R2 bucket in the
|
|
603
|
+
/** The binding name used to refer to the R2 bucket in the Worker. */
|
|
482
604
|
binding: string;
|
|
483
605
|
/** The name of this R2 bucket at the edge. */
|
|
484
|
-
bucket_name
|
|
606
|
+
bucket_name?: string;
|
|
485
607
|
/** The preview name of this R2 bucket at the edge. */
|
|
486
608
|
preview_bucket_name?: string;
|
|
609
|
+
/** The jurisdiction that the bucket exists in. Default if not present. */
|
|
610
|
+
jurisdiction?: string;
|
|
611
|
+
/** Whether the R2 bucket should be remote or not (only available under `--x-mixed-mode`) */
|
|
612
|
+
remote?: boolean;
|
|
487
613
|
}[];
|
|
488
614
|
/**
|
|
489
615
|
* Specifies D1 databases that are bound to this Worker environment.
|
|
@@ -491,16 +617,18 @@ declare interface EnvironmentNonInheritable {
|
|
|
491
617
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
492
618
|
* and so must be specified in every named environment.
|
|
493
619
|
*
|
|
494
|
-
*
|
|
620
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
|
|
621
|
+
*
|
|
622
|
+
* @default []
|
|
495
623
|
* @nonInheritable
|
|
496
624
|
*/
|
|
497
625
|
d1_databases: {
|
|
498
|
-
/** The binding name used to refer to the D1 database in the
|
|
626
|
+
/** The binding name used to refer to the D1 database in the Worker. */
|
|
499
627
|
binding: string;
|
|
500
628
|
/** The name of this D1 database. */
|
|
501
|
-
database_name
|
|
629
|
+
database_name?: string;
|
|
502
630
|
/** The UUID of this D1 database (not required). */
|
|
503
|
-
database_id
|
|
631
|
+
database_id?: string;
|
|
504
632
|
/** The UUID of this D1 database for Wrangler Dev (if specified). */
|
|
505
633
|
preview_database_id?: string;
|
|
506
634
|
/** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
|
|
@@ -509,14 +637,56 @@ declare interface EnvironmentNonInheritable {
|
|
|
509
637
|
migrations_dir?: string;
|
|
510
638
|
/** Internal use only. */
|
|
511
639
|
database_internal_env?: string;
|
|
640
|
+
/** Whether the D1 database should be remote or not (only available under `--x-mixed-mode`) */
|
|
641
|
+
remote?: boolean;
|
|
642
|
+
}[];
|
|
643
|
+
/**
|
|
644
|
+
* Specifies Vectorize indexes that are bound to this Worker environment.
|
|
645
|
+
*
|
|
646
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
647
|
+
* and so must be specified in every named environment.
|
|
648
|
+
*
|
|
649
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
|
|
650
|
+
*
|
|
651
|
+
* @default []
|
|
652
|
+
* @nonInheritable
|
|
653
|
+
*/
|
|
654
|
+
vectorize: {
|
|
655
|
+
/** The binding name used to refer to the Vectorize index in the Worker. */
|
|
656
|
+
binding: string;
|
|
657
|
+
/** The name of the index. */
|
|
658
|
+
index_name: string;
|
|
659
|
+
/** Whether the Vectorize index should be remote or not (only available under `--x-mixed-mode`) */
|
|
660
|
+
remote?: boolean;
|
|
512
661
|
}[];
|
|
513
662
|
/**
|
|
514
|
-
* Specifies
|
|
663
|
+
* Specifies Hyperdrive configs that are bound to this Worker environment.
|
|
515
664
|
*
|
|
516
665
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
517
666
|
* and so must be specified in every named environment.
|
|
518
667
|
*
|
|
519
|
-
*
|
|
668
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive
|
|
669
|
+
*
|
|
670
|
+
* @default []
|
|
671
|
+
* @nonInheritable
|
|
672
|
+
*/
|
|
673
|
+
hyperdrive: {
|
|
674
|
+
/** The binding name used to refer to the project in the Worker. */
|
|
675
|
+
binding: string;
|
|
676
|
+
/** The id of the database. */
|
|
677
|
+
id: string;
|
|
678
|
+
/** The local database connection string for `wrangler dev` */
|
|
679
|
+
localConnectionString?: string;
|
|
680
|
+
}[];
|
|
681
|
+
/**
|
|
682
|
+
* Specifies service bindings (Worker-to-Worker) that are bound to this Worker environment.
|
|
683
|
+
*
|
|
684
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
685
|
+
* and so must be specified in every named environment.
|
|
686
|
+
*
|
|
687
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
|
|
688
|
+
*
|
|
689
|
+
* @default []
|
|
520
690
|
* @nonInheritable
|
|
521
691
|
*/
|
|
522
692
|
services: {
|
|
@@ -526,368 +696,1740 @@ declare interface EnvironmentNonInheritable {
|
|
|
526
696
|
service: string;
|
|
527
697
|
/** The environment of the service (e.g. production, staging, etc). */
|
|
528
698
|
environment?: string;
|
|
699
|
+
/** Optionally, the entrypoint (named export) of the service to bind to. */
|
|
700
|
+
entrypoint?: string;
|
|
701
|
+
/** Optional properties that will be made available to the service via ctx.props. */
|
|
702
|
+
props?: Record<string, unknown>;
|
|
703
|
+
/** Whether the service binding should be remote or not (only available under `--x-mixed-mode`) */
|
|
704
|
+
remote?: boolean;
|
|
529
705
|
}[] | undefined;
|
|
530
706
|
/**
|
|
531
|
-
*
|
|
707
|
+
* Specifies analytics engine datasets that are bound to this Worker environment.
|
|
532
708
|
*
|
|
533
709
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
534
710
|
* and so must be specified in every named environment.
|
|
535
711
|
*
|
|
536
|
-
*
|
|
712
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets
|
|
713
|
+
*
|
|
714
|
+
* @default []
|
|
537
715
|
* @nonInheritable
|
|
538
716
|
*/
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
* @default []
|
|
546
|
-
*/
|
|
547
|
-
bindings: {
|
|
548
|
-
name: string;
|
|
549
|
-
type: string;
|
|
550
|
-
[key: string]: unknown;
|
|
551
|
-
}[];
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
declare class File extends Blob_2 {
|
|
717
|
+
analytics_engine_datasets: {
|
|
718
|
+
/** The binding name used to refer to the dataset in the Worker. */
|
|
719
|
+
binding: string;
|
|
720
|
+
/** The name of this dataset to write to. */
|
|
721
|
+
dataset?: string;
|
|
722
|
+
}[];
|
|
556
723
|
/**
|
|
557
|
-
*
|
|
724
|
+
* A browser that will be usable from the Worker.
|
|
558
725
|
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
*
|
|
726
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
727
|
+
* and so must be specified in every named environment.
|
|
728
|
+
*
|
|
729
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering
|
|
730
|
+
*
|
|
731
|
+
* @default {}
|
|
732
|
+
* @nonInheritable
|
|
562
733
|
*/
|
|
563
|
-
|
|
564
|
-
|
|
734
|
+
browser: {
|
|
735
|
+
binding: string;
|
|
736
|
+
/** Whether the Browser binding should be remote or not (only available under `--x-mixed-mode`) */
|
|
737
|
+
remote?: boolean;
|
|
738
|
+
} | undefined;
|
|
565
739
|
/**
|
|
566
|
-
*
|
|
740
|
+
* Binding to the AI project.
|
|
741
|
+
*
|
|
742
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
743
|
+
* and so must be specified in every named environment.
|
|
744
|
+
*
|
|
745
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai
|
|
746
|
+
*
|
|
747
|
+
* @default {}
|
|
748
|
+
* @nonInheritable
|
|
567
749
|
*/
|
|
568
|
-
|
|
569
|
-
|
|
750
|
+
ai: {
|
|
751
|
+
binding: string;
|
|
752
|
+
staging?: boolean;
|
|
753
|
+
/** Whether the AI binding should be remote or not (only available under `--x-mixed-mode`) */
|
|
754
|
+
remote?: boolean;
|
|
755
|
+
} | undefined;
|
|
570
756
|
/**
|
|
571
|
-
*
|
|
757
|
+
* Binding to Cloudflare Images
|
|
758
|
+
*
|
|
759
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
760
|
+
* and so must be specified in every named environment.
|
|
761
|
+
*
|
|
762
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#images
|
|
763
|
+
*
|
|
764
|
+
* @default {}
|
|
765
|
+
* @nonInheritable
|
|
572
766
|
*/
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
declare interface FilePropertyBag extends BlobPropertyBag {
|
|
767
|
+
images: {
|
|
768
|
+
binding: string;
|
|
769
|
+
/** Whether the Images binding should be remote or not (only available under `--x-mixed-mode`) */
|
|
770
|
+
remote?: boolean;
|
|
771
|
+
} | undefined;
|
|
579
772
|
/**
|
|
580
|
-
*
|
|
773
|
+
* Binding to the Worker Version's metadata
|
|
581
774
|
*/
|
|
582
|
-
|
|
775
|
+
version_metadata: {
|
|
776
|
+
binding: string;
|
|
777
|
+
} | undefined;
|
|
778
|
+
/**
|
|
779
|
+
* "Unsafe" tables for features that aren't directly supported by wrangler.
|
|
780
|
+
*
|
|
781
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
782
|
+
* and so must be specified in every named environment.
|
|
783
|
+
*
|
|
784
|
+
* @default {}
|
|
785
|
+
* @nonInheritable
|
|
786
|
+
*/
|
|
787
|
+
unsafe: {
|
|
788
|
+
/**
|
|
789
|
+
* A set of bindings that should be put into a Worker's upload metadata without changes. These
|
|
790
|
+
* can be used to implement bindings for features that haven't released and aren't supported
|
|
791
|
+
* directly by wrangler or miniflare.
|
|
792
|
+
*/
|
|
793
|
+
bindings?: {
|
|
794
|
+
name: string;
|
|
795
|
+
type: string;
|
|
796
|
+
[key: string]: unknown;
|
|
797
|
+
}[];
|
|
798
|
+
/**
|
|
799
|
+
* Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
|
|
800
|
+
* here will always be applied to metadata last, so can add new or override existing fields.
|
|
801
|
+
*/
|
|
802
|
+
metadata?: {
|
|
803
|
+
[key: string]: unknown;
|
|
804
|
+
};
|
|
805
|
+
/**
|
|
806
|
+
* Used for internal capnp uploads for the Workers runtime
|
|
807
|
+
*/
|
|
808
|
+
capnp?: {
|
|
809
|
+
base_path: string;
|
|
810
|
+
source_schemas: string[];
|
|
811
|
+
compiled_schema?: never;
|
|
812
|
+
} | {
|
|
813
|
+
base_path?: never;
|
|
814
|
+
source_schemas?: never;
|
|
815
|
+
compiled_schema: string;
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
/**
|
|
819
|
+
* Specifies a list of mTLS certificates that are bound to this Worker environment.
|
|
820
|
+
*
|
|
821
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
822
|
+
* and so must be specified in every named environment.
|
|
823
|
+
*
|
|
824
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates
|
|
825
|
+
*
|
|
826
|
+
* @default []
|
|
827
|
+
* @nonInheritable
|
|
828
|
+
*/
|
|
829
|
+
mtls_certificates: {
|
|
830
|
+
/** The binding name used to refer to the certificate in the Worker */
|
|
831
|
+
binding: string;
|
|
832
|
+
/** The uuid of the uploaded mTLS certificate */
|
|
833
|
+
certificate_id: string;
|
|
834
|
+
}[];
|
|
835
|
+
/**
|
|
836
|
+
* Specifies a list of Tail Workers that are bound to this Worker environment
|
|
837
|
+
*
|
|
838
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
839
|
+
* and so must be specified in every named environment.
|
|
840
|
+
*
|
|
841
|
+
* @default []
|
|
842
|
+
* @nonInheritable
|
|
843
|
+
*/
|
|
844
|
+
tail_consumers?: TailConsumer[];
|
|
845
|
+
/**
|
|
846
|
+
* Specifies namespace bindings that are bound to this Worker environment.
|
|
847
|
+
*
|
|
848
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
849
|
+
* and so must be specified in every named environment.
|
|
850
|
+
*
|
|
851
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
|
|
852
|
+
*
|
|
853
|
+
* @default []
|
|
854
|
+
* @nonInheritable
|
|
855
|
+
*/
|
|
856
|
+
dispatch_namespaces: {
|
|
857
|
+
/** The binding name used to refer to the bound service. */
|
|
858
|
+
binding: string;
|
|
859
|
+
/** The namespace to bind to. */
|
|
860
|
+
namespace: string;
|
|
861
|
+
/** Details about the outbound Worker which will handle outbound requests from your namespace */
|
|
862
|
+
outbound?: DispatchNamespaceOutbound;
|
|
863
|
+
/** Whether the Dispatch Namespace should be remote or not (only available under `--x-mixed-mode`) */
|
|
864
|
+
remote?: boolean;
|
|
865
|
+
}[];
|
|
866
|
+
/**
|
|
867
|
+
* Specifies list of Pipelines bound to this Worker environment
|
|
868
|
+
*
|
|
869
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
870
|
+
* and so must be specified in every named environment.
|
|
871
|
+
*
|
|
872
|
+
* @default []
|
|
873
|
+
* @nonInheritable
|
|
874
|
+
*/
|
|
875
|
+
pipelines: {
|
|
876
|
+
/** The binding name used to refer to the bound service. */
|
|
877
|
+
binding: string;
|
|
878
|
+
/** Name of the Pipeline to bind */
|
|
879
|
+
pipeline: string;
|
|
880
|
+
}[];
|
|
881
|
+
/**
|
|
882
|
+
* Specifies Secret Store bindings that are bound to this Worker environment.
|
|
883
|
+
*
|
|
884
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
885
|
+
* and so must be specified in every named environment.
|
|
886
|
+
*
|
|
887
|
+
* @default []
|
|
888
|
+
* @nonInheritable
|
|
889
|
+
*/
|
|
890
|
+
secrets_store_secrets: {
|
|
891
|
+
/** The binding name used to refer to the bound service. */
|
|
892
|
+
binding: string;
|
|
893
|
+
/** Id of the secret store */
|
|
894
|
+
store_id: string;
|
|
895
|
+
/** Name of the secret */
|
|
896
|
+
secret_name: string;
|
|
897
|
+
}[];
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* The raw environment configuration that we read from the config file.
|
|
901
|
+
*
|
|
902
|
+
* All the properties are optional, and will be replaced with defaults in the configuration that
|
|
903
|
+
* is used in the rest of the codebase.
|
|
904
|
+
*/
|
|
905
|
+
type RawEnvironment = Partial<Environment>;
|
|
906
|
+
/**
|
|
907
|
+
* A bundling resolver rule, defining the modules type for paths that match the specified globs.
|
|
908
|
+
*/
|
|
909
|
+
type Rule = {
|
|
910
|
+
type: ConfigModuleRuleType;
|
|
911
|
+
globs: string[];
|
|
912
|
+
fallthrough?: boolean;
|
|
913
|
+
};
|
|
914
|
+
/**
|
|
915
|
+
* The possible types for a `Rule`.
|
|
916
|
+
*/
|
|
917
|
+
type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
|
|
918
|
+
type TailConsumer = {
|
|
919
|
+
/** The name of the service tail events will be forwarded to. */
|
|
920
|
+
service: string;
|
|
921
|
+
/** (Optional) The environment of the service. */
|
|
922
|
+
environment?: string;
|
|
923
|
+
};
|
|
924
|
+
interface DispatchNamespaceOutbound {
|
|
925
|
+
/** Name of the service handling the outbound requests */
|
|
926
|
+
service: string;
|
|
927
|
+
/** (Optional) Name of the environment handling the outbound requests. */
|
|
928
|
+
environment?: string;
|
|
929
|
+
/** (Optional) List of parameter names, for sending context from your dispatch Worker to the outbound handler */
|
|
930
|
+
parameters?: string[];
|
|
931
|
+
}
|
|
932
|
+
interface UserLimits {
|
|
933
|
+
/** Maximum allowed CPU time for a Worker's invocation in milliseconds */
|
|
934
|
+
cpu_ms: number;
|
|
935
|
+
}
|
|
936
|
+
type Assets = {
|
|
937
|
+
/** Absolute path to assets directory */
|
|
938
|
+
directory?: string;
|
|
939
|
+
/** Name of `env` binding property in the User Worker. */
|
|
940
|
+
binding?: string;
|
|
941
|
+
/** How to handle HTML requests. */
|
|
942
|
+
html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none";
|
|
943
|
+
/** How to handle requests that do not match an asset. */
|
|
944
|
+
not_found_handling?: "single-page-application" | "404-page" | "none";
|
|
945
|
+
/**
|
|
946
|
+
* If true, route every request to the User Worker, whether or not it matches an asset.
|
|
947
|
+
* If false, then respond to requests that match an asset with that asset directly.
|
|
948
|
+
* */
|
|
949
|
+
run_worker_first?: boolean;
|
|
950
|
+
};
|
|
951
|
+
interface Observability {
|
|
952
|
+
/** If observability is enabled for this Worker */
|
|
953
|
+
enabled?: boolean;
|
|
954
|
+
/** The sampling rate */
|
|
955
|
+
head_sampling_rate?: number;
|
|
956
|
+
logs?: {
|
|
957
|
+
enabled?: boolean;
|
|
958
|
+
/** The sampling rate */
|
|
959
|
+
head_sampling_rate?: number;
|
|
960
|
+
/** Set to false to disable invocation logs */
|
|
961
|
+
invocation_logs?: boolean;
|
|
962
|
+
};
|
|
583
963
|
}
|
|
584
964
|
|
|
585
965
|
/**
|
|
586
|
-
*
|
|
966
|
+
* This is the static type definition for the configuration object.
|
|
967
|
+
*
|
|
968
|
+
* It reflects a normalized and validated version of the configuration that you can write in a Wrangler configuration file,
|
|
969
|
+
* and optionally augment with arguments passed directly to wrangler.
|
|
970
|
+
*
|
|
971
|
+
* For more information about the configuration object, see the
|
|
972
|
+
* documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration
|
|
973
|
+
*
|
|
974
|
+
* Notes:
|
|
975
|
+
*
|
|
976
|
+
* - Fields that are only specified in `ConfigFields` and not `Environment` can only appear
|
|
977
|
+
* in the top level config and should not appear in any environments.
|
|
978
|
+
* - Fields that are specified in `PagesConfigFields` are only relevant for Pages projects
|
|
979
|
+
* - All top level fields in config and environments are optional in the Wrangler configuration file.
|
|
980
|
+
*
|
|
981
|
+
* Legend for the annotations:
|
|
982
|
+
*
|
|
983
|
+
* - `@breaking`: the deprecation/optionality is a breaking change from Wrangler v1.
|
|
984
|
+
* - `@todo`: there's more work to be done (with details attached).
|
|
587
985
|
*/
|
|
588
|
-
|
|
986
|
+
type Config = ComputedFields & ConfigFields<DevConfig> & PagesConfigFields & Environment;
|
|
987
|
+
type RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & RawEnvironment & EnvironmentMap & {
|
|
988
|
+
$schema?: string;
|
|
989
|
+
};
|
|
990
|
+
interface ComputedFields {
|
|
991
|
+
/** The path to the Wrangler configuration file (if any, and possibly redirected from the user Wrangler configuration) used to create this configuration. */
|
|
992
|
+
configPath: string | undefined;
|
|
993
|
+
/** The path to the user's Wrangler configuration file (if any), which may have been redirected to another file that used to create this configuration. */
|
|
994
|
+
userConfigPath: string | undefined;
|
|
589
995
|
/**
|
|
590
|
-
*
|
|
591
|
-
* or adds the key if it does not already exist.
|
|
996
|
+
* The original top level name for the Worker in the raw configuration.
|
|
592
997
|
*
|
|
593
|
-
*
|
|
998
|
+
* When a raw configuration has been flattened to a single environment the worker name may have been replaced or transformed.
|
|
999
|
+
* It can be useful to know what the top-level name was before the flattening.
|
|
1000
|
+
*/
|
|
1001
|
+
topLevelName: string | undefined;
|
|
1002
|
+
}
|
|
1003
|
+
interface ConfigFields<Dev extends RawDevConfig> {
|
|
1004
|
+
/**
|
|
1005
|
+
* A boolean to enable "legacy" style wrangler environments (from Wrangler v1).
|
|
1006
|
+
* These have been superseded by Services, but there may be projects that won't
|
|
1007
|
+
* (or can't) use them. If you're using a legacy environment, you can set this
|
|
1008
|
+
* to `true` to enable it.
|
|
1009
|
+
*/
|
|
1010
|
+
legacy_env: boolean;
|
|
1011
|
+
/**
|
|
1012
|
+
* Whether Wrangler should send usage metrics to Cloudflare for this project.
|
|
594
1013
|
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
|
|
598
|
-
* @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
|
|
1014
|
+
* When defined this will override any user settings.
|
|
1015
|
+
* Otherwise, Wrangler will use the user's preference.
|
|
599
1016
|
*/
|
|
600
|
-
|
|
601
|
-
|
|
1017
|
+
send_metrics: boolean | undefined;
|
|
602
1018
|
/**
|
|
603
|
-
*
|
|
604
|
-
* or add the new field if it does not already exist.
|
|
1019
|
+
* Options to configure the development server that your worker will use.
|
|
605
1020
|
*
|
|
606
|
-
*
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
1021
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#local-development-settings
|
|
1022
|
+
*/
|
|
1023
|
+
dev: Dev;
|
|
1024
|
+
/**
|
|
1025
|
+
* The definition of a Worker Site, a feature that lets you upload
|
|
1026
|
+
* static assets with your Worker.
|
|
1027
|
+
*
|
|
1028
|
+
* More details at https://developers.cloudflare.com/workers/platform/sites
|
|
610
1029
|
*
|
|
1030
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#workers-sites
|
|
611
1031
|
*/
|
|
612
|
-
|
|
613
|
-
|
|
1032
|
+
site: {
|
|
1033
|
+
/**
|
|
1034
|
+
* The directory containing your static assets.
|
|
1035
|
+
*
|
|
1036
|
+
* It must be a path relative to your Wrangler configuration file.
|
|
1037
|
+
* Example: bucket = "./public"
|
|
1038
|
+
*
|
|
1039
|
+
* If there is a `site` field then it must contain this `bucket` field.
|
|
1040
|
+
*/
|
|
1041
|
+
bucket: string;
|
|
1042
|
+
/**
|
|
1043
|
+
* The location of your Worker script.
|
|
1044
|
+
*
|
|
1045
|
+
* @deprecated DO NOT use this (it's a holdover from Wrangler v1.x). Either use the top level `main` field, or pass the path to your entry file as a command line argument.
|
|
1046
|
+
* @breaking
|
|
1047
|
+
*/
|
|
1048
|
+
"entry-point"?: string;
|
|
1049
|
+
/**
|
|
1050
|
+
* An exclusive list of .gitignore-style patterns that match file
|
|
1051
|
+
* or directory names from your bucket location. Only matched
|
|
1052
|
+
* items will be uploaded. Example: include = ["upload_dir"]
|
|
1053
|
+
*
|
|
1054
|
+
* @optional
|
|
1055
|
+
* @default []
|
|
1056
|
+
*/
|
|
1057
|
+
include?: string[];
|
|
1058
|
+
/**
|
|
1059
|
+
* A list of .gitignore-style patterns that match files or
|
|
1060
|
+
* directories in your bucket that should be excluded from
|
|
1061
|
+
* uploads. Example: exclude = ["ignore_dir"]
|
|
1062
|
+
*
|
|
1063
|
+
* @optional
|
|
1064
|
+
* @default []
|
|
1065
|
+
*/
|
|
1066
|
+
exclude?: string[];
|
|
1067
|
+
} | undefined;
|
|
1068
|
+
/**
|
|
1069
|
+
* A list of wasm modules that your worker should be bound to. This is
|
|
1070
|
+
* the "legacy" way of binding to a wasm module. ES module workers should
|
|
1071
|
+
* do proper module imports.
|
|
1072
|
+
*/
|
|
1073
|
+
wasm_modules: {
|
|
1074
|
+
[key: string]: string;
|
|
1075
|
+
} | undefined;
|
|
1076
|
+
/**
|
|
1077
|
+
* A list of text files that your worker should be bound to. This is
|
|
1078
|
+
* the "legacy" way of binding to a text file. ES module workers should
|
|
1079
|
+
* do proper module imports.
|
|
1080
|
+
*/
|
|
1081
|
+
text_blobs: {
|
|
1082
|
+
[key: string]: string;
|
|
1083
|
+
} | undefined;
|
|
1084
|
+
/**
|
|
1085
|
+
* A list of data files that your worker should be bound to. This is
|
|
1086
|
+
* the "legacy" way of binding to a data file. ES module workers should
|
|
1087
|
+
* do proper module imports.
|
|
1088
|
+
*/
|
|
1089
|
+
data_blobs: {
|
|
1090
|
+
[key: string]: string;
|
|
1091
|
+
} | undefined;
|
|
1092
|
+
/**
|
|
1093
|
+
* A map of module aliases. Lets you swap out a module for any others.
|
|
1094
|
+
* Corresponds with esbuild's `alias` config
|
|
1095
|
+
*
|
|
1096
|
+
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#module-aliasing
|
|
1097
|
+
*/
|
|
1098
|
+
alias: {
|
|
1099
|
+
[key: string]: string;
|
|
1100
|
+
} | undefined;
|
|
614
1101
|
/**
|
|
615
|
-
*
|
|
616
|
-
* If you expect multiple values and want all of them, use the `getAll()` method instead.
|
|
1102
|
+
* By default, the Wrangler configuration file is the source of truth for your environment configuration, like a terraform file.
|
|
617
1103
|
*
|
|
618
|
-
*
|
|
1104
|
+
* If you change your vars in the dashboard, wrangler *will* override/delete them on its next deploy.
|
|
619
1105
|
*
|
|
620
|
-
*
|
|
1106
|
+
* If you want to keep your dashboard vars when wrangler deploys, set this field to true.
|
|
1107
|
+
*
|
|
1108
|
+
* @default false
|
|
1109
|
+
* @nonInheritable
|
|
621
1110
|
*/
|
|
622
|
-
|
|
623
|
-
|
|
1111
|
+
keep_vars?: boolean;
|
|
1112
|
+
}
|
|
1113
|
+
interface PagesConfigFields {
|
|
624
1114
|
/**
|
|
625
|
-
*
|
|
1115
|
+
* The directory of static assets to serve.
|
|
626
1116
|
*
|
|
627
|
-
*
|
|
1117
|
+
* The presence of this field in a Wrangler configuration file indicates a Pages project,
|
|
1118
|
+
* and will prompt the handling of the configuration file according to the
|
|
1119
|
+
* Pages-specific validation rules.
|
|
1120
|
+
*/
|
|
1121
|
+
pages_build_output_dir?: string;
|
|
1122
|
+
}
|
|
1123
|
+
interface DevConfig {
|
|
1124
|
+
/**
|
|
1125
|
+
* IP address for the local dev server to listen on,
|
|
628
1126
|
*
|
|
629
|
-
* @
|
|
1127
|
+
* @default localhost
|
|
630
1128
|
*/
|
|
631
|
-
|
|
632
|
-
|
|
1129
|
+
ip: string;
|
|
633
1130
|
/**
|
|
634
|
-
*
|
|
1131
|
+
* Port for the local dev server to listen on
|
|
635
1132
|
*
|
|
636
|
-
* @
|
|
1133
|
+
* @default 8787
|
|
1134
|
+
*/
|
|
1135
|
+
port: number | undefined;
|
|
1136
|
+
/**
|
|
1137
|
+
* Port for the local dev server's inspector to listen on
|
|
637
1138
|
*
|
|
638
|
-
* @
|
|
1139
|
+
* @default 9229
|
|
639
1140
|
*/
|
|
640
|
-
|
|
641
|
-
|
|
1141
|
+
inspector_port: number | undefined;
|
|
642
1142
|
/**
|
|
643
|
-
*
|
|
1143
|
+
* Protocol that local wrangler dev server listens to requests on.
|
|
644
1144
|
*
|
|
645
|
-
* @
|
|
1145
|
+
* @default http
|
|
646
1146
|
*/
|
|
647
|
-
|
|
648
|
-
|
|
1147
|
+
local_protocol: "http" | "https";
|
|
649
1148
|
/**
|
|
650
|
-
*
|
|
1149
|
+
* Protocol that wrangler dev forwards requests on
|
|
1150
|
+
*
|
|
1151
|
+
* Setting this to `http` is not currently implemented for remote mode.
|
|
1152
|
+
* See https://github.com/cloudflare/workers-sdk/issues/583
|
|
1153
|
+
*
|
|
1154
|
+
* @default https
|
|
651
1155
|
*/
|
|
652
|
-
|
|
653
|
-
callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void,
|
|
654
|
-
thisArg?: unknown
|
|
655
|
-
) => void
|
|
656
|
-
|
|
1156
|
+
upstream_protocol: "https" | "http";
|
|
657
1157
|
/**
|
|
658
|
-
*
|
|
659
|
-
* Each key is a `string`.
|
|
1158
|
+
* Host to forward requests to, defaults to the host of the first route of project
|
|
660
1159
|
*/
|
|
661
|
-
|
|
662
|
-
|
|
1160
|
+
host: string | undefined;
|
|
1161
|
+
}
|
|
1162
|
+
type RawDevConfig = Partial<DevConfig>;
|
|
1163
|
+
interface EnvironmentMap {
|
|
663
1164
|
/**
|
|
664
|
-
*
|
|
665
|
-
*
|
|
1165
|
+
* The `env` section defines overrides for the configuration for different environments.
|
|
1166
|
+
*
|
|
1167
|
+
* All environment fields can be specified at the top level of the config indicating the default environment settings.
|
|
1168
|
+
*
|
|
1169
|
+
* - Some fields are inherited and overridable in each environment.
|
|
1170
|
+
* - But some are not inherited and must be explicitly specified in every environment, if they are specified at the top level.
|
|
1171
|
+
*
|
|
1172
|
+
* For more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments
|
|
1173
|
+
*
|
|
1174
|
+
* @default {}
|
|
666
1175
|
*/
|
|
667
|
-
|
|
1176
|
+
env?: {
|
|
1177
|
+
[envName: string]: RawEnvironment;
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
type ResolveConfigPathOptions = {
|
|
1182
|
+
useRedirectIfAvailable?: boolean;
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
type NormalizeAndValidateConfigArgs = {
|
|
1186
|
+
name?: string;
|
|
1187
|
+
env?: string;
|
|
1188
|
+
"legacy-env"?: boolean;
|
|
1189
|
+
"dispatch-namespace"?: string;
|
|
1190
|
+
remote?: boolean;
|
|
1191
|
+
localProtocol?: string;
|
|
1192
|
+
upstreamProtocol?: string;
|
|
1193
|
+
script?: string;
|
|
1194
|
+
};
|
|
668
1195
|
|
|
1196
|
+
type ReadConfigCommandArgs = NormalizeAndValidateConfigArgs & {
|
|
1197
|
+
config?: string;
|
|
1198
|
+
script?: string;
|
|
1199
|
+
};
|
|
1200
|
+
type ReadConfigOptions = ResolveConfigPathOptions & {
|
|
1201
|
+
hideWarnings?: boolean;
|
|
1202
|
+
experimental?: {
|
|
1203
|
+
mixedModeEnabled?: boolean;
|
|
1204
|
+
};
|
|
1205
|
+
};
|
|
1206
|
+
type ConfigBindingOptions = Pick<Config, "ai" | "browser" | "d1_databases" | "dispatch_namespaces" | "durable_objects" | "queues" | "r2_buckets" | "services" | "kv_namespaces" | "mtls_certificates" | "vectorize" | "workflows">;
|
|
1207
|
+
/**
|
|
1208
|
+
* Get the Wrangler configuration; read it from the give `configPath` if available.
|
|
1209
|
+
*/
|
|
1210
|
+
declare function readConfig(args: ReadConfigCommandArgs, options?: ReadConfigOptions): Config;
|
|
1211
|
+
declare const experimental_readRawConfig: (args: ReadConfigCommandArgs, options?: ReadConfigOptions) => {
|
|
1212
|
+
rawConfig: RawConfig;
|
|
1213
|
+
configPath: string | undefined;
|
|
1214
|
+
userConfigPath: string | undefined;
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* A symbol to inherit a binding from the deployed worker.
|
|
1219
|
+
*/
|
|
1220
|
+
declare const INHERIT_SYMBOL: unique symbol;
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* The type of Worker
|
|
1224
|
+
*/
|
|
1225
|
+
type CfScriptFormat = "modules" | "service-worker";
|
|
1226
|
+
/**
|
|
1227
|
+
* A module type.
|
|
1228
|
+
*/
|
|
1229
|
+
type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
|
|
1230
|
+
/**
|
|
1231
|
+
* An imported module.
|
|
1232
|
+
*/
|
|
1233
|
+
interface CfModule {
|
|
669
1234
|
/**
|
|
670
|
-
*
|
|
671
|
-
*
|
|
1235
|
+
* The module name.
|
|
1236
|
+
*
|
|
1237
|
+
* @example
|
|
1238
|
+
* './src/index.js'
|
|
672
1239
|
*/
|
|
673
|
-
|
|
674
|
-
|
|
1240
|
+
name: string;
|
|
1241
|
+
/**
|
|
1242
|
+
* The absolute path of the module on disk, or `undefined` if this is a
|
|
1243
|
+
* virtual module. Used as the source URL for this module, so source maps are
|
|
1244
|
+
* correctly resolved.
|
|
1245
|
+
*
|
|
1246
|
+
* @example
|
|
1247
|
+
* '/path/to/src/index.js'
|
|
1248
|
+
*/
|
|
1249
|
+
filePath: string | undefined;
|
|
1250
|
+
/**
|
|
1251
|
+
* The module content, usually JavaScript or WASM code.
|
|
1252
|
+
*
|
|
1253
|
+
* @example
|
|
1254
|
+
* export default {
|
|
1255
|
+
* async fetch(request) {
|
|
1256
|
+
* return new Response('Ok')
|
|
1257
|
+
* }
|
|
1258
|
+
* }
|
|
1259
|
+
*/
|
|
1260
|
+
content: string | Buffer<ArrayBuffer>;
|
|
1261
|
+
/**
|
|
1262
|
+
* An optional sourcemap for this module if it's of a ESM or CJS type, this will only be present
|
|
1263
|
+
* if we're deploying with sourcemaps enabled. Since we copy extra modules that aren't bundled
|
|
1264
|
+
* we need to also copy the relevant sourcemaps into the final out directory.
|
|
1265
|
+
*/
|
|
1266
|
+
sourceMap?: CfWorkerSourceMap;
|
|
1267
|
+
/**
|
|
1268
|
+
* The module type.
|
|
1269
|
+
*
|
|
1270
|
+
* If absent, will default to the main module's type.
|
|
1271
|
+
*/
|
|
1272
|
+
type?: CfModuleType;
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* A KV namespace.
|
|
1276
|
+
*/
|
|
1277
|
+
interface CfKvNamespace {
|
|
1278
|
+
binding: string;
|
|
1279
|
+
id?: string | typeof INHERIT_SYMBOL;
|
|
1280
|
+
remote?: boolean;
|
|
1281
|
+
raw?: boolean;
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* A binding to send email.
|
|
1285
|
+
*/
|
|
1286
|
+
type CfSendEmailBindings = {
|
|
1287
|
+
name: string;
|
|
1288
|
+
} & ({
|
|
1289
|
+
destination_address?: string;
|
|
1290
|
+
} | {
|
|
1291
|
+
allowed_destination_addresses?: string[];
|
|
1292
|
+
});
|
|
1293
|
+
/**
|
|
1294
|
+
* A Durable Object.
|
|
1295
|
+
*/
|
|
1296
|
+
interface CfDurableObject {
|
|
1297
|
+
name: string;
|
|
1298
|
+
class_name: string;
|
|
1299
|
+
script_name?: string;
|
|
1300
|
+
environment?: string;
|
|
1301
|
+
}
|
|
1302
|
+
interface CfWorkflow {
|
|
1303
|
+
name: string;
|
|
1304
|
+
class_name: string;
|
|
1305
|
+
binding: string;
|
|
1306
|
+
script_name?: string;
|
|
1307
|
+
remote?: boolean;
|
|
1308
|
+
raw?: boolean;
|
|
1309
|
+
}
|
|
1310
|
+
interface CfQueue {
|
|
1311
|
+
binding: string;
|
|
1312
|
+
queue_name: string;
|
|
1313
|
+
delivery_delay?: number;
|
|
1314
|
+
remote?: boolean;
|
|
1315
|
+
raw?: boolean;
|
|
1316
|
+
}
|
|
1317
|
+
interface CfR2Bucket {
|
|
1318
|
+
binding: string;
|
|
1319
|
+
bucket_name?: string | typeof INHERIT_SYMBOL;
|
|
1320
|
+
jurisdiction?: string;
|
|
1321
|
+
remote?: boolean;
|
|
1322
|
+
raw?: boolean;
|
|
1323
|
+
}
|
|
1324
|
+
interface CfD1Database {
|
|
1325
|
+
binding: string;
|
|
1326
|
+
database_id?: string | typeof INHERIT_SYMBOL;
|
|
1327
|
+
database_name?: string;
|
|
1328
|
+
preview_database_id?: string;
|
|
1329
|
+
database_internal_env?: string;
|
|
1330
|
+
migrations_table?: string;
|
|
1331
|
+
migrations_dir?: string;
|
|
1332
|
+
remote?: boolean;
|
|
1333
|
+
raw?: boolean;
|
|
1334
|
+
}
|
|
1335
|
+
interface CfVectorize {
|
|
1336
|
+
binding: string;
|
|
1337
|
+
index_name: string;
|
|
1338
|
+
raw?: boolean;
|
|
1339
|
+
remote?: boolean;
|
|
1340
|
+
}
|
|
1341
|
+
interface CfSecretsStoreSecrets {
|
|
1342
|
+
binding: string;
|
|
1343
|
+
store_id: string;
|
|
1344
|
+
secret_name: string;
|
|
1345
|
+
}
|
|
1346
|
+
interface CfHyperdrive {
|
|
1347
|
+
binding: string;
|
|
1348
|
+
id: string;
|
|
1349
|
+
localConnectionString?: string;
|
|
1350
|
+
}
|
|
1351
|
+
interface CfService {
|
|
1352
|
+
binding: string;
|
|
1353
|
+
service: string;
|
|
1354
|
+
environment?: string;
|
|
1355
|
+
entrypoint?: string;
|
|
1356
|
+
props?: Record<string, unknown>;
|
|
1357
|
+
remote?: boolean;
|
|
1358
|
+
}
|
|
1359
|
+
interface CfAnalyticsEngineDataset {
|
|
1360
|
+
binding: string;
|
|
1361
|
+
dataset?: string;
|
|
1362
|
+
}
|
|
1363
|
+
interface CfDispatchNamespace {
|
|
1364
|
+
binding: string;
|
|
1365
|
+
namespace: string;
|
|
1366
|
+
outbound?: {
|
|
1367
|
+
service: string;
|
|
1368
|
+
environment?: string;
|
|
1369
|
+
parameters?: string[];
|
|
1370
|
+
};
|
|
1371
|
+
remote?: boolean;
|
|
1372
|
+
}
|
|
1373
|
+
interface CfMTlsCertificate {
|
|
1374
|
+
binding: string;
|
|
1375
|
+
certificate_id: string;
|
|
1376
|
+
}
|
|
1377
|
+
interface CfLogfwdrBinding {
|
|
1378
|
+
name: string;
|
|
1379
|
+
destination: string;
|
|
1380
|
+
}
|
|
1381
|
+
interface CfPipeline {
|
|
1382
|
+
binding: string;
|
|
1383
|
+
pipeline: string;
|
|
1384
|
+
}
|
|
1385
|
+
interface CfUnsafeBinding {
|
|
1386
|
+
name: string;
|
|
1387
|
+
type: string;
|
|
1388
|
+
}
|
|
1389
|
+
type CfUnsafeMetadata = Record<string, unknown>;
|
|
1390
|
+
type CfCapnp = {
|
|
1391
|
+
base_path?: never;
|
|
1392
|
+
source_schemas?: never;
|
|
1393
|
+
compiled_schema: string;
|
|
1394
|
+
} | {
|
|
1395
|
+
base_path: string;
|
|
1396
|
+
source_schemas: string[];
|
|
1397
|
+
compiled_schema?: never;
|
|
1398
|
+
};
|
|
1399
|
+
interface CfUnsafe {
|
|
1400
|
+
bindings: CfUnsafeBinding[] | undefined;
|
|
1401
|
+
metadata: CfUnsafeMetadata | undefined;
|
|
1402
|
+
capnp: CfCapnp | undefined;
|
|
1403
|
+
}
|
|
1404
|
+
interface CfTailConsumer {
|
|
1405
|
+
service: string;
|
|
1406
|
+
environment?: string;
|
|
1407
|
+
}
|
|
1408
|
+
interface CfWorkerSourceMap {
|
|
1409
|
+
/**
|
|
1410
|
+
* The name of the source map.
|
|
1411
|
+
*
|
|
1412
|
+
* @example
|
|
1413
|
+
* 'out.js.map'
|
|
1414
|
+
*/
|
|
1415
|
+
name: string;
|
|
675
1416
|
/**
|
|
676
|
-
*
|
|
1417
|
+
* The content of the source map, which is a JSON object described by the v3
|
|
1418
|
+
* spec.
|
|
1419
|
+
*
|
|
1420
|
+
* @example
|
|
1421
|
+
* {
|
|
1422
|
+
* "version" : 3,
|
|
1423
|
+
* "file": "out.js",
|
|
1424
|
+
* "sourceRoot": "",
|
|
1425
|
+
* "sources": ["foo.js", "bar.js"],
|
|
1426
|
+
* "sourcesContent": [null, null],
|
|
1427
|
+
* "names": ["src", "maps", "are", "fun"],
|
|
1428
|
+
* "mappings": "A,AAAB;;ABCDE;"
|
|
1429
|
+
* }
|
|
677
1430
|
*/
|
|
678
|
-
|
|
1431
|
+
content: string | Buffer;
|
|
1432
|
+
}
|
|
679
1433
|
|
|
680
|
-
|
|
1434
|
+
interface EnablePagesAssetsServiceBindingOptions {
|
|
1435
|
+
proxyPort?: number;
|
|
1436
|
+
directory?: string;
|
|
681
1437
|
}
|
|
682
1438
|
|
|
1439
|
+
interface Unstable_DevOptions {
|
|
1440
|
+
config?: string;
|
|
1441
|
+
env?: string;
|
|
1442
|
+
ip?: string;
|
|
1443
|
+
port?: number;
|
|
1444
|
+
bundle?: boolean;
|
|
1445
|
+
inspectorPort?: number;
|
|
1446
|
+
localProtocol?: "http" | "https";
|
|
1447
|
+
httpsKeyPath?: string;
|
|
1448
|
+
httpsCertPath?: string;
|
|
1449
|
+
assets?: string;
|
|
1450
|
+
site?: string;
|
|
1451
|
+
siteInclude?: string[];
|
|
1452
|
+
siteExclude?: string[];
|
|
1453
|
+
compatibilityDate?: string;
|
|
1454
|
+
compatibilityFlags?: string[];
|
|
1455
|
+
persist?: boolean;
|
|
1456
|
+
persistTo?: string;
|
|
1457
|
+
vars?: Record<string, string | Json>;
|
|
1458
|
+
kv?: {
|
|
1459
|
+
binding: string;
|
|
1460
|
+
id?: string;
|
|
1461
|
+
preview_id?: string;
|
|
1462
|
+
remote?: boolean;
|
|
1463
|
+
}[];
|
|
1464
|
+
durableObjects?: {
|
|
1465
|
+
name: string;
|
|
1466
|
+
class_name: string;
|
|
1467
|
+
script_name?: string | undefined;
|
|
1468
|
+
environment?: string | undefined;
|
|
1469
|
+
}[];
|
|
1470
|
+
services?: {
|
|
1471
|
+
binding: string;
|
|
1472
|
+
service: string;
|
|
1473
|
+
environment?: string | undefined;
|
|
1474
|
+
entrypoint?: string | undefined;
|
|
1475
|
+
remote?: boolean;
|
|
1476
|
+
}[];
|
|
1477
|
+
r2?: {
|
|
1478
|
+
binding: string;
|
|
1479
|
+
bucket_name?: string;
|
|
1480
|
+
preview_bucket_name?: string;
|
|
1481
|
+
remote?: boolean;
|
|
1482
|
+
}[];
|
|
1483
|
+
ai?: {
|
|
1484
|
+
binding: string;
|
|
1485
|
+
};
|
|
1486
|
+
version_metadata?: {
|
|
1487
|
+
binding: string;
|
|
1488
|
+
};
|
|
1489
|
+
moduleRoot?: string;
|
|
1490
|
+
rules?: Rule[];
|
|
1491
|
+
logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
|
|
1492
|
+
inspect?: boolean;
|
|
1493
|
+
local?: boolean;
|
|
1494
|
+
accountId?: string;
|
|
1495
|
+
experimental?: {
|
|
1496
|
+
processEntrypoint?: boolean;
|
|
1497
|
+
additionalModules?: CfModule[];
|
|
1498
|
+
d1Databases?: Environment["d1_databases"];
|
|
1499
|
+
disableExperimentalWarning?: boolean;
|
|
1500
|
+
disableDevRegistry?: boolean;
|
|
1501
|
+
enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
|
|
1502
|
+
forceLocal?: boolean;
|
|
1503
|
+
liveReload?: boolean;
|
|
1504
|
+
showInteractiveDevSession?: boolean;
|
|
1505
|
+
testMode?: boolean;
|
|
1506
|
+
testScheduled?: boolean;
|
|
1507
|
+
watch?: boolean;
|
|
1508
|
+
devEnv?: boolean;
|
|
1509
|
+
fileBasedRegistry?: boolean;
|
|
1510
|
+
vectorizeBindToProd?: boolean;
|
|
1511
|
+
imagesLocalMode?: boolean;
|
|
1512
|
+
enableIpc?: boolean;
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
interface Unstable_DevWorker {
|
|
1516
|
+
port: number;
|
|
1517
|
+
address: string;
|
|
1518
|
+
stop: () => Promise<void>;
|
|
1519
|
+
fetch: (input?: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
1520
|
+
waitUntilExit: () => Promise<void>;
|
|
1521
|
+
}
|
|
683
1522
|
/**
|
|
684
|
-
*
|
|
1523
|
+
* unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
|
|
685
1524
|
*/
|
|
686
|
-
declare
|
|
687
|
-
|
|
688
|
-
declare class Headers implements SpecIterable<[string, string]> {
|
|
689
|
-
constructor (init?: HeadersInit)
|
|
690
|
-
readonly append: (name: string, value: string) => void
|
|
691
|
-
readonly delete: (name: string) => void
|
|
692
|
-
readonly get: (name: string) => string | null
|
|
693
|
-
readonly has: (name: string) => boolean
|
|
694
|
-
readonly set: (name: string, value: string) => void
|
|
695
|
-
readonly forEach: (
|
|
696
|
-
callbackfn: (value: string, key: string, iterable: Headers) => void,
|
|
697
|
-
thisArg?: unknown
|
|
698
|
-
) => void
|
|
699
|
-
|
|
700
|
-
readonly keys: () => SpecIterableIterator<string>
|
|
701
|
-
readonly values: () => SpecIterableIterator<string>
|
|
702
|
-
readonly entries: () => SpecIterableIterator<[string, string]>
|
|
703
|
-
readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
declare type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
|
|
707
|
-
|
|
708
|
-
declare type ReferrerPolicy =
|
|
709
|
-
| ''
|
|
710
|
-
| 'no-referrer'
|
|
711
|
-
| 'no-referrer-when-downgrade'
|
|
712
|
-
| 'origin'
|
|
713
|
-
| 'origin-when-cross-origin'
|
|
714
|
-
| 'same-origin'
|
|
715
|
-
| 'strict-origin'
|
|
716
|
-
| 'strict-origin-when-cross-origin'
|
|
717
|
-
| 'unsafe-url';
|
|
718
|
-
|
|
719
|
-
declare class Request implements BodyMixin {
|
|
720
|
-
constructor (input: RequestInfo, init?: RequestInit)
|
|
721
|
-
|
|
722
|
-
readonly cache: RequestCache
|
|
723
|
-
readonly credentials: RequestCredentials
|
|
724
|
-
readonly destination: RequestDestination
|
|
725
|
-
readonly headers: Headers
|
|
726
|
-
readonly integrity: string
|
|
727
|
-
readonly method: string
|
|
728
|
-
readonly mode: RequestMode
|
|
729
|
-
readonly redirect: RequestRedirect
|
|
730
|
-
readonly referrerPolicy: string
|
|
731
|
-
readonly url: string
|
|
732
|
-
|
|
733
|
-
readonly keepalive: boolean
|
|
734
|
-
readonly signal: AbortSignal
|
|
735
|
-
|
|
736
|
-
readonly body: ReadableStream | null
|
|
737
|
-
readonly bodyUsed: boolean
|
|
738
|
-
|
|
739
|
-
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
740
|
-
readonly blob: () => Promise<Blob_2>
|
|
741
|
-
readonly formData: () => Promise<FormData>
|
|
742
|
-
readonly json: () => Promise<unknown>
|
|
743
|
-
readonly text: () => Promise<string>
|
|
744
|
-
|
|
745
|
-
readonly clone: () => Request
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
declare type RequestCache =
|
|
749
|
-
| 'default'
|
|
750
|
-
| 'force-cache'
|
|
751
|
-
| 'no-cache'
|
|
752
|
-
| 'no-store'
|
|
753
|
-
| 'only-if-cached'
|
|
754
|
-
| 'reload'
|
|
755
|
-
|
|
756
|
-
declare type RequestCredentials = 'omit' | 'include' | 'same-origin'
|
|
757
|
-
|
|
758
|
-
declare type RequestDestination =
|
|
759
|
-
| ''
|
|
760
|
-
| 'audio'
|
|
761
|
-
| 'audioworklet'
|
|
762
|
-
| 'document'
|
|
763
|
-
| 'embed'
|
|
764
|
-
| 'font'
|
|
765
|
-
| 'image'
|
|
766
|
-
| 'manifest'
|
|
767
|
-
| 'object'
|
|
768
|
-
| 'paintworklet'
|
|
769
|
-
| 'report'
|
|
770
|
-
| 'script'
|
|
771
|
-
| 'sharedworker'
|
|
772
|
-
| 'style'
|
|
773
|
-
| 'track'
|
|
774
|
-
| 'video'
|
|
775
|
-
| 'worker'
|
|
776
|
-
| 'xslt'
|
|
777
|
-
|
|
778
|
-
declare type RequestInfo = string | URL_2 | Request
|
|
779
|
-
|
|
780
|
-
declare interface RequestInit {
|
|
781
|
-
method?: string
|
|
782
|
-
keepalive?: boolean
|
|
783
|
-
headers?: HeadersInit
|
|
784
|
-
body?: BodyInit
|
|
785
|
-
redirect?: RequestRedirect
|
|
786
|
-
integrity?: string
|
|
787
|
-
signal?: AbortSignal
|
|
788
|
-
credentials?: RequestCredentials
|
|
789
|
-
mode?: RequestMode
|
|
790
|
-
referrer?: string
|
|
791
|
-
referrerPolicy?: ReferrerPolicy
|
|
792
|
-
window?: null
|
|
793
|
-
dispatcher?: Dispatcher
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
|
|
797
|
-
|
|
798
|
-
declare type RequestRedirect = 'error' | 'follow' | 'manual'
|
|
799
|
-
|
|
800
|
-
declare class Response implements BodyMixin {
|
|
801
|
-
constructor (body?: BodyInit, init?: ResponseInit)
|
|
802
|
-
|
|
803
|
-
readonly headers: Headers
|
|
804
|
-
readonly ok: boolean
|
|
805
|
-
readonly status: number
|
|
806
|
-
readonly statusText: string
|
|
807
|
-
readonly type: ResponseType
|
|
808
|
-
readonly url: string
|
|
809
|
-
readonly redirected: boolean
|
|
810
|
-
|
|
811
|
-
readonly body: ReadableStream | null
|
|
812
|
-
readonly bodyUsed: boolean
|
|
813
|
-
|
|
814
|
-
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
815
|
-
readonly blob: () => Promise<Blob_2>
|
|
816
|
-
readonly formData: () => Promise<FormData>
|
|
817
|
-
readonly json: () => Promise<unknown>
|
|
818
|
-
readonly text: () => Promise<string>
|
|
819
|
-
|
|
820
|
-
readonly clone: () => Response
|
|
821
|
-
|
|
822
|
-
static error (): Response
|
|
823
|
-
static json(data: any, init?: ResponseInit): Response
|
|
824
|
-
static redirect (url: string | URL_2, status: ResponseRedirectStatus): Response
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
declare interface ResponseInit {
|
|
828
|
-
readonly status?: number
|
|
829
|
-
readonly statusText?: string
|
|
830
|
-
readonly headers?: HeadersInit
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
declare type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
|
|
834
|
-
|
|
835
|
-
declare type ResponseType =
|
|
836
|
-
| 'basic'
|
|
837
|
-
| 'cors'
|
|
838
|
-
| 'default'
|
|
839
|
-
| 'error'
|
|
840
|
-
| 'opaque'
|
|
841
|
-
| 'opaqueredirect'
|
|
842
|
-
|
|
843
|
-
declare type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
|
|
1525
|
+
declare function unstable_dev(script: string, options?: Unstable_DevOptions, apiOptions?: unknown): Promise<Unstable_DevWorker>;
|
|
844
1526
|
|
|
1527
|
+
interface PagesDeployOptions {
|
|
1528
|
+
/**
|
|
1529
|
+
* Path to static assets to deploy to Pages
|
|
1530
|
+
*/
|
|
1531
|
+
directory: string;
|
|
1532
|
+
/**
|
|
1533
|
+
* The Cloudflare Account ID that owns the project that's
|
|
1534
|
+
* being published
|
|
1535
|
+
*/
|
|
1536
|
+
accountId: string;
|
|
1537
|
+
/**
|
|
1538
|
+
* The name of the project to be published
|
|
1539
|
+
*/
|
|
1540
|
+
projectName: string;
|
|
1541
|
+
/**
|
|
1542
|
+
* Branch name to use. Defaults to production branch
|
|
1543
|
+
*/
|
|
1544
|
+
branch?: string;
|
|
1545
|
+
/**
|
|
1546
|
+
* Whether or not to skip local file upload result caching
|
|
1547
|
+
*/
|
|
1548
|
+
skipCaching?: boolean;
|
|
1549
|
+
/**
|
|
1550
|
+
* Commit message associated to deployment
|
|
1551
|
+
*/
|
|
1552
|
+
commitMessage?: string;
|
|
1553
|
+
/**
|
|
1554
|
+
* Commit hash associated to deployment
|
|
1555
|
+
*/
|
|
1556
|
+
commitHash?: string;
|
|
1557
|
+
/**
|
|
1558
|
+
* Whether or not the deployment should be considered to be
|
|
1559
|
+
* in a dirty commit state
|
|
1560
|
+
*/
|
|
1561
|
+
commitDirty?: boolean;
|
|
1562
|
+
/**
|
|
1563
|
+
* Path to the project's functions directory. Default uses
|
|
1564
|
+
* the current working directory + /functions since this is
|
|
1565
|
+
* typically called in a CLI
|
|
1566
|
+
*/
|
|
1567
|
+
functionsDirectory?: string;
|
|
1568
|
+
/**
|
|
1569
|
+
* Whether to run bundling on `_worker.js` before deploying.
|
|
1570
|
+
* Default: true
|
|
1571
|
+
*/
|
|
1572
|
+
bundle?: boolean;
|
|
1573
|
+
/**
|
|
1574
|
+
* Whether to upload any server-side sourcemaps with this deployment
|
|
1575
|
+
*/
|
|
1576
|
+
sourceMaps: boolean;
|
|
1577
|
+
/**
|
|
1578
|
+
* Command line args passed to the `pages deploy` cmd
|
|
1579
|
+
*/
|
|
1580
|
+
args?: Record<string, unknown>;
|
|
1581
|
+
}
|
|
845
1582
|
/**
|
|
846
|
-
*
|
|
1583
|
+
* Publish a directory to an account/project.
|
|
1584
|
+
* NOTE: You will need the `CLOUDFLARE_API_KEY` environment
|
|
1585
|
+
* variable set
|
|
847
1586
|
*/
|
|
848
|
-
declare
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
1587
|
+
declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, sourceMaps, args, }: PagesDeployOptions): Promise<{
|
|
1588
|
+
deploymentResponse: {
|
|
1589
|
+
url: string;
|
|
1590
|
+
id: string;
|
|
1591
|
+
environment: "production" | "preview";
|
|
1592
|
+
build_config: {
|
|
1593
|
+
build_command: string;
|
|
1594
|
+
destination_dir: string;
|
|
1595
|
+
root_dir: string;
|
|
1596
|
+
web_analytics_tag?: string | undefined;
|
|
1597
|
+
web_analytics_token?: string | undefined;
|
|
1598
|
+
fast_builds?: boolean | undefined;
|
|
1599
|
+
};
|
|
1600
|
+
created_on: string;
|
|
1601
|
+
production_branch: string;
|
|
1602
|
+
project_id: string;
|
|
1603
|
+
project_name: string;
|
|
1604
|
+
deployment_trigger: {
|
|
1605
|
+
metadata: {
|
|
1606
|
+
branch: string;
|
|
1607
|
+
commit_hash: string;
|
|
1608
|
+
commit_message: string;
|
|
1609
|
+
};
|
|
1610
|
+
type: string;
|
|
1611
|
+
};
|
|
1612
|
+
latest_stage: {
|
|
1613
|
+
status: "canceled" | "active" | "idle" | "success" | "failure" | "skipped";
|
|
1614
|
+
name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
|
|
1615
|
+
started_on: string | null;
|
|
1616
|
+
ended_on: string | null;
|
|
1617
|
+
};
|
|
1618
|
+
stages: {
|
|
1619
|
+
status: "canceled" | "active" | "idle" | "success" | "failure" | "skipped";
|
|
1620
|
+
name: "queued" | "build" | "deploy" | "initialize" | "clone_repo";
|
|
1621
|
+
started_on: string | null;
|
|
1622
|
+
ended_on: string | null;
|
|
1623
|
+
}[];
|
|
1624
|
+
aliases: string[];
|
|
1625
|
+
modified_on: string;
|
|
1626
|
+
short_id: string;
|
|
1627
|
+
build_image_major_version: number;
|
|
1628
|
+
kv_namespaces?: any;
|
|
1629
|
+
source?: {
|
|
1630
|
+
type: "github" | "gitlab";
|
|
1631
|
+
config: {
|
|
1632
|
+
owner: string;
|
|
1633
|
+
repo_name: string;
|
|
1634
|
+
production_branch?: string | undefined;
|
|
1635
|
+
pr_comments_enabled?: boolean | undefined;
|
|
1636
|
+
deployments_enabled?: boolean | undefined;
|
|
1637
|
+
production_deployments_enabled?: boolean | undefined;
|
|
1638
|
+
preview_deployment_setting?: "none" | "custom" | "all" | undefined;
|
|
1639
|
+
preview_branch_includes?: string[] | undefined;
|
|
1640
|
+
preview_branch_excludes?: string[] | undefined;
|
|
1641
|
+
};
|
|
1642
|
+
} | undefined;
|
|
1643
|
+
env_vars?: any;
|
|
1644
|
+
durable_object_namespaces?: any;
|
|
1645
|
+
is_skipped?: boolean | undefined;
|
|
1646
|
+
files?: {
|
|
1647
|
+
[x: string]: string | undefined;
|
|
1648
|
+
} | undefined;
|
|
1649
|
+
};
|
|
1650
|
+
formData: FormData;
|
|
1651
|
+
}>;
|
|
1652
|
+
|
|
1653
|
+
declare const unstable_pages: {
|
|
1654
|
+
deploy: typeof deploy;
|
|
1655
|
+
};
|
|
1656
|
+
|
|
1657
|
+
type WorkerRegistry = Record<string, WorkerDefinition>;
|
|
1658
|
+
type WorkerEntrypointsDefinition = Record<"default" | string, {
|
|
1659
|
+
host: string;
|
|
1660
|
+
port: number;
|
|
1661
|
+
} | undefined>;
|
|
1662
|
+
type WorkerDefinition = {
|
|
1663
|
+
port: number | undefined;
|
|
1664
|
+
protocol: "http" | "https" | undefined;
|
|
1665
|
+
host: string | undefined;
|
|
1666
|
+
mode: "local" | "remote";
|
|
1667
|
+
headers?: Record<string, string>;
|
|
1668
|
+
entrypointAddresses?: WorkerEntrypointsDefinition;
|
|
1669
|
+
durableObjects: {
|
|
1670
|
+
name: string;
|
|
1671
|
+
className: string;
|
|
1672
|
+
}[];
|
|
1673
|
+
durableObjectsHost?: string;
|
|
1674
|
+
durableObjectsPort?: number;
|
|
1675
|
+
};
|
|
1676
|
+
|
|
1677
|
+
type _Params<ParamsArray extends [unknown?]> = ParamsArray extends [infer P] ? P : undefined;
|
|
1678
|
+
type _EventMethods = keyof Protocol.Events;
|
|
1679
|
+
type DevToolsEvent<Method extends _EventMethods> = Method extends unknown ? {
|
|
1680
|
+
method: Method;
|
|
1681
|
+
params: _Params<Protocol.Events[Method]>;
|
|
1682
|
+
} : never;
|
|
1683
|
+
|
|
1684
|
+
type AssetsOptions = {
|
|
1685
|
+
directory: string;
|
|
1686
|
+
binding?: string;
|
|
1687
|
+
routerConfig: RouterConfig;
|
|
1688
|
+
assetConfig: AssetConfig;
|
|
1689
|
+
_redirects?: string;
|
|
1690
|
+
_headers?: string;
|
|
852
1691
|
};
|
|
853
1692
|
|
|
854
|
-
|
|
1693
|
+
type ApiCredentials = {
|
|
1694
|
+
apiToken: string;
|
|
1695
|
+
} | {
|
|
1696
|
+
authKey: string;
|
|
1697
|
+
authEmail: string;
|
|
1698
|
+
};
|
|
855
1699
|
|
|
856
|
-
|
|
857
|
-
|
|
1700
|
+
/**
|
|
1701
|
+
* An entry point for the Worker.
|
|
1702
|
+
*
|
|
1703
|
+
* It consists not just of a `file`, but also of a `directory` that is used to resolve relative paths.
|
|
1704
|
+
*/
|
|
1705
|
+
type Entry = {
|
|
1706
|
+
/** A worker's entrypoint */
|
|
1707
|
+
file: string;
|
|
1708
|
+
/** A worker's directory. Usually where the Wrangler configuration file is located */
|
|
1709
|
+
projectRoot: string;
|
|
1710
|
+
/** The path to the config file, if it exists. */
|
|
1711
|
+
configPath: string | undefined;
|
|
1712
|
+
/** Is this a module worker or a service worker? */
|
|
1713
|
+
format: CfScriptFormat;
|
|
1714
|
+
/** The directory that contains all of a `--no-bundle` worker's modules. Usually `${directory}/src`. Defaults to path.dirname(file) */
|
|
1715
|
+
moduleRoot: string;
|
|
1716
|
+
/**
|
|
1717
|
+
* A worker's name
|
|
1718
|
+
*/
|
|
1719
|
+
name?: string | undefined;
|
|
1720
|
+
/** Export from a Worker's entrypoint */
|
|
1721
|
+
exports: string[];
|
|
1722
|
+
};
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Information about Wrangler's bundling process that needs passed through
|
|
1726
|
+
* for DevTools sourcemap transformation
|
|
1727
|
+
*/
|
|
1728
|
+
interface SourceMapMetadata {
|
|
1729
|
+
tmpDir: string;
|
|
1730
|
+
entryDirectory: string;
|
|
858
1731
|
}
|
|
859
1732
|
|
|
860
|
-
|
|
861
|
-
|
|
1733
|
+
type EsbuildBundle = {
|
|
1734
|
+
id: number;
|
|
1735
|
+
path: string;
|
|
1736
|
+
entrypointSource: string;
|
|
1737
|
+
entry: Entry;
|
|
1738
|
+
type: CfModuleType;
|
|
1739
|
+
modules: CfModule[];
|
|
1740
|
+
dependencies: Metafile["outputs"][string]["inputs"];
|
|
1741
|
+
sourceMapPath: string | undefined;
|
|
1742
|
+
sourceMapMetadata: SourceMapMetadata | undefined;
|
|
1743
|
+
};
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* A Cloudflare account.
|
|
1747
|
+
*/
|
|
1748
|
+
interface CfAccount {
|
|
1749
|
+
/**
|
|
1750
|
+
* An API token.
|
|
1751
|
+
*
|
|
1752
|
+
* @link https://api.cloudflare.com/#user-api-tokens-properties
|
|
1753
|
+
*/
|
|
1754
|
+
apiToken: ApiCredentials;
|
|
1755
|
+
/**
|
|
1756
|
+
* An account ID.
|
|
1757
|
+
*/
|
|
1758
|
+
accountId: string;
|
|
862
1759
|
}
|
|
863
1760
|
|
|
864
|
-
|
|
865
|
-
|
|
1761
|
+
type ConfigControllerEventMap = ControllerEventMap & {
|
|
1762
|
+
configUpdate: [ConfigUpdateEvent];
|
|
1763
|
+
};
|
|
1764
|
+
declare class ConfigController extends Controller<ConfigControllerEventMap> {
|
|
1765
|
+
#private;
|
|
1766
|
+
latestInput?: StartDevWorkerInput;
|
|
1767
|
+
latestConfig?: StartDevWorkerOptions;
|
|
1768
|
+
set(input: StartDevWorkerInput, throwErrors?: boolean): Promise<StartDevWorkerOptions | undefined>;
|
|
1769
|
+
patch(input: Partial<StartDevWorkerInput>): Promise<StartDevWorkerOptions | undefined>;
|
|
1770
|
+
teardown(): Promise<void>;
|
|
1771
|
+
emitConfigUpdateEvent(config: StartDevWorkerOptions): void;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
type MiniflareWorker = Awaited<ReturnType<Miniflare["getWorker"]>>;
|
|
1775
|
+
interface Worker {
|
|
1776
|
+
ready: Promise<void>;
|
|
1777
|
+
url: Promise<URL>;
|
|
1778
|
+
inspectorUrl: Promise<URL>;
|
|
1779
|
+
config: StartDevWorkerOptions;
|
|
1780
|
+
setConfig: ConfigController["set"];
|
|
1781
|
+
patchConfig: ConfigController["patch"];
|
|
1782
|
+
fetch: DispatchFetch;
|
|
1783
|
+
scheduled: MiniflareWorker["scheduled"];
|
|
1784
|
+
queue: MiniflareWorker["queue"];
|
|
1785
|
+
dispose(): Promise<void>;
|
|
1786
|
+
raw: DevEnv;
|
|
1787
|
+
}
|
|
1788
|
+
interface StartDevWorkerInput {
|
|
1789
|
+
/** The name of the worker. */
|
|
1790
|
+
name?: string;
|
|
1791
|
+
/**
|
|
1792
|
+
* The javascript or typescript entry-point of the worker.
|
|
1793
|
+
* This is the `main` property of a Wrangler configuration file.
|
|
1794
|
+
*/
|
|
1795
|
+
entrypoint?: string;
|
|
1796
|
+
/** The configuration of the worker. */
|
|
1797
|
+
config?: string;
|
|
1798
|
+
/** The compatibility date for the workerd runtime. */
|
|
1799
|
+
compatibilityDate?: string;
|
|
1800
|
+
/** The compatibility flags for the workerd runtime. */
|
|
1801
|
+
compatibilityFlags?: string[];
|
|
1802
|
+
/** Specify the compliance region mode of the Worker. */
|
|
1803
|
+
complianceRegion?: Config["compliance_region"];
|
|
1804
|
+
env?: string;
|
|
1805
|
+
/** The bindings available to the worker. The specified bindind type will be exposed to the worker on the `env` object under the same key. */
|
|
1806
|
+
bindings?: Record<string, Binding>;
|
|
1807
|
+
migrations?: DurableObjectMigration[];
|
|
1808
|
+
/** The triggers which will cause the worker's exported default handlers to be called. */
|
|
1809
|
+
triggers?: Trigger[];
|
|
1810
|
+
tailConsumers?: CfTailConsumer[];
|
|
1811
|
+
/**
|
|
1812
|
+
* Whether Wrangler should send usage metrics to Cloudflare for this project.
|
|
1813
|
+
*
|
|
1814
|
+
* When defined this will override any user settings.
|
|
1815
|
+
* Otherwise, Wrangler will use the user's preference.
|
|
1816
|
+
*/
|
|
1817
|
+
sendMetrics?: boolean;
|
|
1818
|
+
/** Options applying to the worker's build step. Applies to deploy and dev. */
|
|
1819
|
+
build?: {
|
|
1820
|
+
/** Whether the worker and its dependencies are bundled. Defaults to true. */
|
|
1821
|
+
bundle?: boolean;
|
|
1822
|
+
additionalModules?: CfModule[];
|
|
1823
|
+
findAdditionalModules?: boolean;
|
|
1824
|
+
processEntrypoint?: boolean;
|
|
1825
|
+
/** Specifies types of modules matched by globs. */
|
|
1826
|
+
moduleRules?: Rule[];
|
|
1827
|
+
/** Replace global identifiers with constant expressions, e.g. { debug: 'true', version: '"1.0.0"' }. Only takes effect if bundle: true. */
|
|
1828
|
+
define?: Record<string, string>;
|
|
1829
|
+
/** Alias modules */
|
|
1830
|
+
alias?: Record<string, string>;
|
|
1831
|
+
/** Whether the bundled worker is minified. Only takes effect if bundle: true. */
|
|
1832
|
+
minify?: boolean;
|
|
1833
|
+
/** Whether to keep function names after JavaScript transpilations. */
|
|
1834
|
+
keepNames?: boolean;
|
|
1835
|
+
/** Options controlling a custom build step. */
|
|
1836
|
+
custom?: {
|
|
1837
|
+
/** Custom shell command to run before bundling. Runs even if bundle. */
|
|
1838
|
+
command?: string;
|
|
1839
|
+
/** The cwd to run the command in. */
|
|
1840
|
+
workingDirectory?: string;
|
|
1841
|
+
/** Filepath(s) to watch for changes. Upon changes, the command will be rerun. */
|
|
1842
|
+
watch?: string | string[];
|
|
1843
|
+
};
|
|
1844
|
+
jsxFactory?: string;
|
|
1845
|
+
jsxFragment?: string;
|
|
1846
|
+
tsconfig?: string;
|
|
1847
|
+
nodejsCompatMode?: Hook<NodeJSCompatMode, [Config]>;
|
|
1848
|
+
moduleRoot?: string;
|
|
1849
|
+
};
|
|
1850
|
+
/** Options applying to the worker's development preview environment. */
|
|
1851
|
+
dev?: {
|
|
1852
|
+
/** Options applying to the worker's inspector server. */
|
|
1853
|
+
inspector?: {
|
|
1854
|
+
hostname?: string;
|
|
1855
|
+
port?: number;
|
|
1856
|
+
secure?: boolean;
|
|
1857
|
+
};
|
|
1858
|
+
/** Whether the worker runs on the edge or locally. Can also be set to "minimal" for minimal mode. */
|
|
1859
|
+
remote?: boolean | "minimal";
|
|
1860
|
+
/** Cloudflare Account credentials. Can be provided upfront or as a function which will be called only when required. */
|
|
1861
|
+
auth?: AsyncHook<CfAccount, [Pick<Config, "account_id">]>;
|
|
1862
|
+
/** Whether local storage (KV, Durable Objects, R2, D1, etc) is persisted. You can also specify the directory to persist data to. */
|
|
1863
|
+
persist?: string;
|
|
1864
|
+
/** Controls which logs are logged 🤙. */
|
|
1865
|
+
logLevel?: LogLevel;
|
|
1866
|
+
/** Whether the worker server restarts upon source/config file changes. */
|
|
1867
|
+
watch?: boolean;
|
|
1868
|
+
/** Whether a script tag is inserted on text/html responses which will reload the page upon file changes. Defaults to false. */
|
|
1869
|
+
liveReload?: boolean;
|
|
1870
|
+
/** The local address to reach your worker. Applies to remote: true (remote mode) and remote: false (local mode). */
|
|
1871
|
+
server?: {
|
|
1872
|
+
hostname?: string;
|
|
1873
|
+
port?: number;
|
|
1874
|
+
secure?: boolean;
|
|
1875
|
+
httpsKeyPath?: string;
|
|
1876
|
+
httpsCertPath?: string;
|
|
1877
|
+
};
|
|
1878
|
+
/** Controls what request.url looks like inside the worker. */
|
|
1879
|
+
origin?: {
|
|
1880
|
+
hostname?: string;
|
|
1881
|
+
secure?: boolean;
|
|
1882
|
+
};
|
|
1883
|
+
/** A hook for outbound fetch calls from within the worker. */
|
|
1884
|
+
outboundService?: ServiceFetch;
|
|
1885
|
+
/** An undici MockAgent to declaratively mock fetch calls to particular resources. */
|
|
1886
|
+
mockFetch?: undici.MockAgent;
|
|
1887
|
+
/** Describes the registry of other Workers running locally */
|
|
1888
|
+
registry?: WorkerRegistry | null;
|
|
1889
|
+
testScheduled?: boolean;
|
|
1890
|
+
/** Whether to use Vectorize mixed mode -- the worker is run locally but accesses to Vectorize are made remotely */
|
|
1891
|
+
bindVectorizeToProd?: boolean;
|
|
1892
|
+
/** Whether to use Images local mode -- this is lower fidelity, but doesn't require network access */
|
|
1893
|
+
imagesLocalMode?: boolean;
|
|
1894
|
+
/** Treat this as the primary worker in a multiworker setup (i.e. the first Worker in Miniflare's options) */
|
|
1895
|
+
multiworkerPrimary?: boolean;
|
|
1896
|
+
};
|
|
1897
|
+
legacy?: {
|
|
1898
|
+
site?: Hook<Config["site"], [Config]>;
|
|
1899
|
+
enableServiceEnvironments?: boolean;
|
|
1900
|
+
};
|
|
1901
|
+
unsafe?: Omit<CfUnsafe, "bindings">;
|
|
1902
|
+
assets?: string;
|
|
1903
|
+
}
|
|
1904
|
+
type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
|
|
1905
|
+
/** A worker's directory. Usually where the Wrangler configuration file is located */
|
|
1906
|
+
projectRoot: string;
|
|
1907
|
+
build: StartDevWorkerInput["build"] & {
|
|
1908
|
+
nodejsCompatMode: NodeJSCompatMode;
|
|
1909
|
+
format: CfScriptFormat;
|
|
1910
|
+
moduleRoot: string;
|
|
1911
|
+
moduleRules: Rule[];
|
|
1912
|
+
define: Record<string, string>;
|
|
1913
|
+
additionalModules: CfModule[];
|
|
1914
|
+
exports: string[];
|
|
1915
|
+
processEntrypoint: boolean;
|
|
1916
|
+
};
|
|
1917
|
+
legacy: StartDevWorkerInput["legacy"] & {
|
|
1918
|
+
site?: Config["site"];
|
|
1919
|
+
};
|
|
1920
|
+
dev: StartDevWorkerInput["dev"] & {
|
|
1921
|
+
persist: string;
|
|
1922
|
+
auth?: AsyncHook<CfAccount>;
|
|
1923
|
+
};
|
|
1924
|
+
entrypoint: string;
|
|
1925
|
+
assets?: AssetsOptions;
|
|
1926
|
+
name: string;
|
|
1927
|
+
complianceRegion: Config["compliance_region"];
|
|
1928
|
+
};
|
|
1929
|
+
type HookValues = string | number | boolean | object | undefined | null;
|
|
1930
|
+
type Hook<T extends HookValues, Args extends unknown[] = []> = T | ((...args: Args) => T);
|
|
1931
|
+
type AsyncHook<T extends HookValues, Args extends unknown[] = []> = Hook<T, Args> | Hook<Promise<T>, Args>;
|
|
1932
|
+
type Bundle = EsbuildBundle;
|
|
1933
|
+
type LogLevel = "debug" | "info" | "log" | "warn" | "error" | "none";
|
|
1934
|
+
type File<Contents = string, Path = string> = {
|
|
1935
|
+
path: Path;
|
|
1936
|
+
} | {
|
|
1937
|
+
contents: Contents;
|
|
1938
|
+
path?: Path;
|
|
1939
|
+
};
|
|
1940
|
+
type BinaryFile = File<Uint8Array>;
|
|
1941
|
+
type QueueConsumer = NonNullable<Config["queues"]["consumers"]>[number];
|
|
1942
|
+
type Trigger = {
|
|
1943
|
+
type: "workers.dev";
|
|
1944
|
+
} | {
|
|
1945
|
+
type: "route";
|
|
1946
|
+
pattern: string;
|
|
1947
|
+
} | ({
|
|
1948
|
+
type: "route";
|
|
1949
|
+
} & ZoneIdRoute) | ({
|
|
1950
|
+
type: "route";
|
|
1951
|
+
} & ZoneNameRoute) | ({
|
|
1952
|
+
type: "route";
|
|
1953
|
+
} & CustomDomainRoute) | {
|
|
1954
|
+
type: "cron";
|
|
1955
|
+
cron: string;
|
|
1956
|
+
} | ({
|
|
1957
|
+
type: "queue-consumer";
|
|
1958
|
+
} & QueueConsumer);
|
|
1959
|
+
type BindingOmit<T> = Omit<T, "binding">;
|
|
1960
|
+
type NameOmit<T> = Omit<T, "name">;
|
|
1961
|
+
type Binding = {
|
|
1962
|
+
type: "plain_text";
|
|
1963
|
+
value: string;
|
|
1964
|
+
} | {
|
|
1965
|
+
type: "json";
|
|
1966
|
+
value: Json;
|
|
1967
|
+
} | ({
|
|
1968
|
+
type: "kv_namespace";
|
|
1969
|
+
} & BindingOmit<CfKvNamespace>) | ({
|
|
1970
|
+
type: "send_email";
|
|
1971
|
+
} & NameOmit<CfSendEmailBindings>) | {
|
|
1972
|
+
type: "wasm_module";
|
|
1973
|
+
source: BinaryFile;
|
|
1974
|
+
} | {
|
|
1975
|
+
type: "text_blob";
|
|
1976
|
+
source: File;
|
|
1977
|
+
} | {
|
|
1978
|
+
type: "browser";
|
|
1979
|
+
} | {
|
|
1980
|
+
type: "ai";
|
|
1981
|
+
} | {
|
|
1982
|
+
type: "images";
|
|
1983
|
+
} | {
|
|
1984
|
+
type: "version_metadata";
|
|
1985
|
+
} | {
|
|
1986
|
+
type: "data_blob";
|
|
1987
|
+
source: BinaryFile;
|
|
1988
|
+
} | ({
|
|
1989
|
+
type: "durable_object_namespace";
|
|
1990
|
+
} & NameOmit<CfDurableObject>) | ({
|
|
1991
|
+
type: "workflow";
|
|
1992
|
+
} & BindingOmit<CfWorkflow>) | ({
|
|
1993
|
+
type: "queue";
|
|
1994
|
+
} & BindingOmit<CfQueue>) | ({
|
|
1995
|
+
type: "r2_bucket";
|
|
1996
|
+
} & BindingOmit<CfR2Bucket>) | ({
|
|
1997
|
+
type: "d1";
|
|
1998
|
+
} & BindingOmit<CfD1Database>) | ({
|
|
1999
|
+
type: "vectorize";
|
|
2000
|
+
} & BindingOmit<CfVectorize>) | ({
|
|
2001
|
+
type: "hyperdrive";
|
|
2002
|
+
} & BindingOmit<CfHyperdrive>) | ({
|
|
2003
|
+
type: "service";
|
|
2004
|
+
} & BindingOmit<CfService>) | {
|
|
2005
|
+
type: "fetcher";
|
|
2006
|
+
fetcher: ServiceFetch;
|
|
2007
|
+
} | ({
|
|
2008
|
+
type: "analytics_engine";
|
|
2009
|
+
} & BindingOmit<CfAnalyticsEngineDataset>) | ({
|
|
2010
|
+
type: "dispatch_namespace";
|
|
2011
|
+
} & BindingOmit<CfDispatchNamespace>) | ({
|
|
2012
|
+
type: "mtls_certificate";
|
|
2013
|
+
} & BindingOmit<CfMTlsCertificate>) | ({
|
|
2014
|
+
type: "pipeline";
|
|
2015
|
+
} & BindingOmit<CfPipeline>) | ({
|
|
2016
|
+
type: "secrets_store_secret";
|
|
2017
|
+
} & BindingOmit<CfSecretsStoreSecrets>) | ({
|
|
2018
|
+
type: "logfwdr";
|
|
2019
|
+
} & NameOmit<CfLogfwdrBinding>) | {
|
|
2020
|
+
type: `unsafe_${string}`;
|
|
2021
|
+
} | {
|
|
2022
|
+
type: "assets";
|
|
2023
|
+
};
|
|
2024
|
+
type ServiceFetch = (request: Request) => Promise<Response$1> | Response$1;
|
|
2025
|
+
|
|
2026
|
+
type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker" | "MultiworkerRuntimeController"> | BaseErrorEvent<"ProxyController", {
|
|
2027
|
+
config?: StartDevWorkerOptions;
|
|
2028
|
+
bundle?: Bundle;
|
|
2029
|
+
}> | BaseErrorEvent<"BundlerController", {
|
|
2030
|
+
config?: StartDevWorkerOptions;
|
|
2031
|
+
filePath?: string;
|
|
2032
|
+
}>;
|
|
2033
|
+
type BaseErrorEvent<Source = string, Data = undefined> = {
|
|
2034
|
+
type: "error";
|
|
2035
|
+
reason: string;
|
|
2036
|
+
cause: Error | SerializedError;
|
|
2037
|
+
source: Source;
|
|
2038
|
+
data: Data;
|
|
2039
|
+
};
|
|
2040
|
+
type ConfigUpdateEvent = {
|
|
2041
|
+
type: "configUpdate";
|
|
2042
|
+
config: StartDevWorkerOptions;
|
|
2043
|
+
};
|
|
2044
|
+
type BundleStartEvent = {
|
|
2045
|
+
type: "bundleStart";
|
|
2046
|
+
config: StartDevWorkerOptions;
|
|
2047
|
+
};
|
|
2048
|
+
type BundleCompleteEvent = {
|
|
2049
|
+
type: "bundleComplete";
|
|
2050
|
+
config: StartDevWorkerOptions;
|
|
2051
|
+
bundle: Bundle;
|
|
2052
|
+
};
|
|
2053
|
+
type ReloadStartEvent = {
|
|
2054
|
+
type: "reloadStart";
|
|
2055
|
+
config: StartDevWorkerOptions;
|
|
2056
|
+
bundle: Bundle;
|
|
2057
|
+
};
|
|
2058
|
+
type ReloadCompleteEvent = {
|
|
2059
|
+
type: "reloadComplete";
|
|
2060
|
+
config: StartDevWorkerOptions;
|
|
2061
|
+
bundle: Bundle;
|
|
2062
|
+
proxyData: ProxyData;
|
|
2063
|
+
};
|
|
2064
|
+
type PreviewTokenExpiredEvent = {
|
|
2065
|
+
type: "previewTokenExpired";
|
|
2066
|
+
proxyData: ProxyData;
|
|
2067
|
+
};
|
|
2068
|
+
type ReadyEvent = {
|
|
2069
|
+
type: "ready";
|
|
2070
|
+
proxyWorker: Miniflare;
|
|
2071
|
+
url: URL;
|
|
2072
|
+
inspectorUrl: URL;
|
|
2073
|
+
};
|
|
2074
|
+
type ProxyWorkerIncomingRequestBody = {
|
|
2075
|
+
type: "play";
|
|
2076
|
+
proxyData: ProxyData;
|
|
2077
|
+
} | {
|
|
2078
|
+
type: "pause";
|
|
2079
|
+
};
|
|
2080
|
+
type ProxyWorkerOutgoingRequestBody = {
|
|
2081
|
+
type: "error";
|
|
2082
|
+
error: SerializedError;
|
|
2083
|
+
} | {
|
|
2084
|
+
type: "previewTokenExpired";
|
|
2085
|
+
proxyData: ProxyData;
|
|
2086
|
+
} | {
|
|
2087
|
+
type: "debug-log";
|
|
2088
|
+
args: Parameters<typeof console.debug>;
|
|
2089
|
+
};
|
|
2090
|
+
|
|
2091
|
+
type InspectorProxyWorkerIncomingWebSocketMessage = {
|
|
2092
|
+
type: ReloadStartEvent["type"];
|
|
2093
|
+
} | {
|
|
2094
|
+
type: ReloadCompleteEvent["type"];
|
|
2095
|
+
proxyData: ProxyData;
|
|
2096
|
+
};
|
|
2097
|
+
type InspectorProxyWorkerOutgoingWebsocketMessage = DevToolsEvent<"Runtime.consoleAPICalled"> | DevToolsEvent<"Runtime.exceptionThrown">;
|
|
2098
|
+
type InspectorProxyWorkerOutgoingRequestBody = {
|
|
2099
|
+
type: "error";
|
|
2100
|
+
error: SerializedError;
|
|
2101
|
+
} | {
|
|
2102
|
+
type: "runtime-websocket-error";
|
|
2103
|
+
error: SerializedError;
|
|
2104
|
+
} | {
|
|
2105
|
+
type: "debug-log";
|
|
2106
|
+
args: Parameters<typeof console.debug>;
|
|
2107
|
+
} | {
|
|
2108
|
+
type: "load-network-resource";
|
|
2109
|
+
url: string;
|
|
2110
|
+
};
|
|
2111
|
+
type SerializedError = {
|
|
2112
|
+
message: string;
|
|
2113
|
+
name?: string;
|
|
2114
|
+
stack?: string | undefined;
|
|
2115
|
+
cause?: unknown;
|
|
2116
|
+
};
|
|
2117
|
+
type UrlOriginParts = Pick<URL, "protocol" | "hostname" | "port">;
|
|
2118
|
+
type UrlOriginAndPathnameParts = Pick<URL, "protocol" | "hostname" | "port" | "pathname">;
|
|
2119
|
+
type ProxyData = {
|
|
2120
|
+
userWorkerUrl: UrlOriginParts;
|
|
2121
|
+
userWorkerInspectorUrl: UrlOriginAndPathnameParts;
|
|
2122
|
+
userWorkerInnerUrlOverrides?: Partial<UrlOriginParts>;
|
|
2123
|
+
headers: Record<string, string>;
|
|
2124
|
+
liveReload?: boolean;
|
|
2125
|
+
proxyLogsToController?: boolean;
|
|
2126
|
+
internalDurableObjects?: CfDurableObject[];
|
|
2127
|
+
entrypointAddresses: WorkerEntrypointsDefinition | undefined;
|
|
2128
|
+
};
|
|
2129
|
+
|
|
2130
|
+
interface TypedEventEmitter<EventMap extends Record<string | symbol, unknown[]>> extends EventEmitter {
|
|
2131
|
+
addListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
2132
|
+
on<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
2133
|
+
once<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
2134
|
+
removeListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
2135
|
+
off<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
2136
|
+
removeAllListeners(event?: keyof EventMap): this;
|
|
2137
|
+
listeners<Name extends keyof EventMap>(eventName: Name): ((...args: EventMap[Name]) => void)[];
|
|
2138
|
+
rawListeners<Name extends keyof EventMap>(eventName: Name): ((...args: EventMap[Name]) => void)[];
|
|
2139
|
+
emit<Name extends keyof EventMap>(eventName: Name, ...args: EventMap[Name]): boolean;
|
|
2140
|
+
listenerCount<Name extends keyof EventMap>(eventName: Name, listener?: (...args: EventMap[Name]) => void): number;
|
|
2141
|
+
prependListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
2142
|
+
prependOnceListener<Name extends keyof EventMap>(eventName: Name, listener: (...args: EventMap[Name]) => void): this;
|
|
2143
|
+
}
|
|
2144
|
+
declare const TypedEventEmitterImpl: {
|
|
2145
|
+
new <EventMap extends Record<string | symbol, unknown[]>>(): TypedEventEmitter<EventMap>;
|
|
2146
|
+
};
|
|
2147
|
+
type ControllerEventMap = {
|
|
2148
|
+
error: [ErrorEvent];
|
|
2149
|
+
};
|
|
2150
|
+
declare abstract class Controller<EventMap extends ControllerEventMap = ControllerEventMap> extends TypedEventEmitterImpl<EventMap> {
|
|
2151
|
+
emitErrorEvent(data: ErrorEvent): void;
|
|
2152
|
+
}
|
|
2153
|
+
type RuntimeControllerEventMap = ControllerEventMap & {
|
|
2154
|
+
reloadStart: [ReloadStartEvent];
|
|
2155
|
+
reloadComplete: [ReloadCompleteEvent];
|
|
2156
|
+
};
|
|
2157
|
+
declare abstract class RuntimeController extends Controller<RuntimeControllerEventMap> {
|
|
2158
|
+
abstract onBundleStart(_: BundleStartEvent): void;
|
|
2159
|
+
abstract onBundleComplete(_: BundleCompleteEvent): void;
|
|
2160
|
+
abstract onPreviewTokenExpired(_: PreviewTokenExpiredEvent): void;
|
|
2161
|
+
abstract teardown(): Promise<void>;
|
|
2162
|
+
abstract emitReloadStartEvent(data: ReloadStartEvent): void;
|
|
2163
|
+
abstract emitReloadCompleteEvent(data: ReloadCompleteEvent): void;
|
|
866
2164
|
}
|
|
867
2165
|
|
|
2166
|
+
type BundlerControllerEventMap = ControllerEventMap & {
|
|
2167
|
+
bundleStart: [BundleStartEvent];
|
|
2168
|
+
bundleComplete: [BundleCompleteEvent];
|
|
2169
|
+
};
|
|
2170
|
+
declare class BundlerController extends Controller<BundlerControllerEventMap> {
|
|
2171
|
+
#private;
|
|
2172
|
+
onConfigUpdate(event: ConfigUpdateEvent): void;
|
|
2173
|
+
teardown(): Promise<void>;
|
|
2174
|
+
emitBundleStartEvent(config: StartDevWorkerOptions): void;
|
|
2175
|
+
emitBundleCompleteEvent(config: StartDevWorkerOptions, bundle: EsbuildBundle): void;
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
2179
|
+
type DeferredPromise<T> = {
|
|
2180
|
+
promise: Promise<T>;
|
|
2181
|
+
resolve: (_: MaybePromise<T>) => void;
|
|
2182
|
+
reject: (_: Error) => void;
|
|
2183
|
+
};
|
|
2184
|
+
declare function convertConfigBindingsToStartWorkerBindings(configBindings: ConfigBindingOptions): StartDevWorkerOptions["bindings"];
|
|
2185
|
+
|
|
2186
|
+
type ProxyControllerEventMap = ControllerEventMap & {
|
|
2187
|
+
ready: [ReadyEvent];
|
|
2188
|
+
previewTokenExpired: [PreviewTokenExpiredEvent];
|
|
2189
|
+
};
|
|
2190
|
+
declare class ProxyController extends Controller<ProxyControllerEventMap> {
|
|
2191
|
+
ready: DeferredPromise<ReadyEvent>;
|
|
2192
|
+
proxyWorker?: Miniflare;
|
|
2193
|
+
proxyWorkerOptions?: MiniflareOptions;
|
|
2194
|
+
private inspectorProxyWorkerWebSocket?;
|
|
2195
|
+
protected latestConfig?: StartDevWorkerOptions;
|
|
2196
|
+
protected latestBundle?: EsbuildBundle;
|
|
2197
|
+
secret: `${string}-${string}-${string}-${string}-${string}`;
|
|
2198
|
+
protected createProxyWorker(): void;
|
|
2199
|
+
private reconnectInspectorProxyWorker;
|
|
2200
|
+
runtimeMessageMutex: Mutex;
|
|
2201
|
+
sendMessageToProxyWorker(message: ProxyWorkerIncomingRequestBody, retries?: number): Promise<void>;
|
|
2202
|
+
sendMessageToInspectorProxyWorker(message: InspectorProxyWorkerIncomingWebSocketMessage, retries?: number): Promise<void>;
|
|
2203
|
+
onConfigUpdate(data: ConfigUpdateEvent): void;
|
|
2204
|
+
onBundleStart(data: BundleStartEvent): void;
|
|
2205
|
+
onReloadStart(data: ReloadStartEvent): void;
|
|
2206
|
+
onReloadComplete(data: ReloadCompleteEvent): void;
|
|
2207
|
+
onProxyWorkerMessage(message: ProxyWorkerOutgoingRequestBody): void;
|
|
2208
|
+
onInspectorProxyWorkerMessage(message: InspectorProxyWorkerOutgoingWebsocketMessage): void;
|
|
2209
|
+
onInspectorProxyWorkerRequest(message: InspectorProxyWorkerOutgoingRequestBody): Promise<Response$1>;
|
|
2210
|
+
_torndown: boolean;
|
|
2211
|
+
teardown(): Promise<void>;
|
|
2212
|
+
emitReadyEvent(proxyWorker: Miniflare, url: URL, inspectorUrl: URL): void;
|
|
2213
|
+
emitPreviewTokenExpiredEvent(proxyData: ProxyData): void;
|
|
2214
|
+
emitErrorEvent(data: ErrorEvent): void;
|
|
2215
|
+
emitErrorEvent(reason: string, cause?: Error | SerializedError): void;
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
declare class DevEnv extends EventEmitter {
|
|
2219
|
+
config: ConfigController;
|
|
2220
|
+
bundler: BundlerController;
|
|
2221
|
+
runtimes: RuntimeController[];
|
|
2222
|
+
proxy: ProxyController;
|
|
2223
|
+
startWorker(options: StartDevWorkerInput): Promise<Worker>;
|
|
2224
|
+
constructor({ config, bundler, runtimes, proxy, }?: {
|
|
2225
|
+
config?: ConfigController | undefined;
|
|
2226
|
+
bundler?: BundlerController | undefined;
|
|
2227
|
+
runtimes?: RuntimeController[] | undefined;
|
|
2228
|
+
proxy?: ProxyController | undefined;
|
|
2229
|
+
});
|
|
2230
|
+
teardown(): Promise<void>;
|
|
2231
|
+
emitErrorEvent(ev: ErrorEvent): void;
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
declare function startWorker(options: StartDevWorkerInput): Promise<Worker>;
|
|
2235
|
+
|
|
868
2236
|
/**
|
|
869
|
-
*
|
|
2237
|
+
* Note about this file:
|
|
2238
|
+
*
|
|
2239
|
+
* Here we are providing a no-op implementation of the runtime Cache API instead of using
|
|
2240
|
+
* the miniflare implementation (via `mf.getCaches()`).
|
|
2241
|
+
*
|
|
2242
|
+
* We are not using miniflare's implementation because that would require the user to provide
|
|
2243
|
+
* miniflare-specific Request objects and they would receive back miniflare-specific Response
|
|
2244
|
+
* objects, this (in particular the Request part) is not really suitable for `getPlatformProxy`
|
|
2245
|
+
* as people would ideally interact with their bindings in a very production-like manner and
|
|
2246
|
+
* requiring them to deal with miniflare-specific classes defeats a bit the purpose of the utility.
|
|
2247
|
+
*
|
|
2248
|
+
* Similarly the Request and Response types here are set to `undefined` as not to use specific ones
|
|
2249
|
+
* that would require us to make a choice right now or the user to adapt their code in order to work
|
|
2250
|
+
* with the api.
|
|
2251
|
+
*
|
|
2252
|
+
* We need to find a better/generic manner in which we can reuse the miniflare cache implementation,
|
|
2253
|
+
* but until then the no-op implementation below will have to do.
|
|
2254
|
+
*/
|
|
2255
|
+
/**
|
|
2256
|
+
* No-op implementation of CacheStorage
|
|
2257
|
+
*/
|
|
2258
|
+
declare class CacheStorage {
|
|
2259
|
+
constructor();
|
|
2260
|
+
open(cacheName: string): Promise<Cache>;
|
|
2261
|
+
get default(): Cache;
|
|
2262
|
+
}
|
|
2263
|
+
type CacheRequest = any;
|
|
2264
|
+
type CacheResponse = any;
|
|
2265
|
+
/**
|
|
2266
|
+
* No-op implementation of Cache
|
|
870
2267
|
*/
|
|
871
|
-
|
|
2268
|
+
declare class Cache {
|
|
2269
|
+
delete(request: CacheRequest, options?: CacheQueryOptions): Promise<boolean>;
|
|
2270
|
+
match(request: CacheRequest, options?: CacheQueryOptions): Promise<CacheResponse | undefined>;
|
|
2271
|
+
put(request: CacheRequest, response: CacheResponse): Promise<void>;
|
|
2272
|
+
}
|
|
2273
|
+
type CacheQueryOptions = {
|
|
2274
|
+
ignoreMethod?: boolean;
|
|
2275
|
+
};
|
|
872
2276
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
fetch: (input?: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
878
|
-
waitUntilExit: () => Promise<void>;
|
|
2277
|
+
declare class ExecutionContext {
|
|
2278
|
+
waitUntil(promise: Promise<any>): void;
|
|
2279
|
+
passThroughOnException(): void;
|
|
2280
|
+
props: any;
|
|
879
2281
|
}
|
|
880
2282
|
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
2283
|
+
/**
|
|
2284
|
+
* Options for the `getPlatformProxy` utility
|
|
2285
|
+
*/
|
|
2286
|
+
type GetPlatformProxyOptions = {
|
|
2287
|
+
/**
|
|
2288
|
+
* The name of the environment to use
|
|
2289
|
+
*/
|
|
2290
|
+
environment?: string;
|
|
2291
|
+
/**
|
|
2292
|
+
* The path to the config file to use.
|
|
2293
|
+
* If no path is specified the default behavior is to search from the
|
|
2294
|
+
* current directory up the filesystem for a Wrangler configuration file to use.
|
|
2295
|
+
*
|
|
2296
|
+
* Note: this field is optional but if a path is specified it must
|
|
2297
|
+
* point to a valid file on the filesystem
|
|
2298
|
+
*/
|
|
2299
|
+
configPath?: string;
|
|
2300
|
+
/**
|
|
2301
|
+
* Indicates if and where to persist the bindings data, if not present or `true` it defaults to the same location
|
|
2302
|
+
* used by wrangler: `.wrangler/state/v3` (so that the same data can be easily used by the caller and wrangler).
|
|
2303
|
+
* If `false` is specified no data is persisted on the filesystem.
|
|
2304
|
+
*/
|
|
2305
|
+
persist?: boolean | {
|
|
2306
|
+
path: string;
|
|
2307
|
+
};
|
|
2308
|
+
};
|
|
2309
|
+
/**
|
|
2310
|
+
* Result of the `getPlatformProxy` utility
|
|
2311
|
+
*/
|
|
2312
|
+
type PlatformProxy<Env = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties> = {
|
|
2313
|
+
/**
|
|
2314
|
+
* Environment object containing the various Cloudflare bindings
|
|
2315
|
+
*/
|
|
2316
|
+
env: Env;
|
|
2317
|
+
/**
|
|
2318
|
+
* Mock of the context object that Workers received in their request handler, all the object's methods are no-op
|
|
2319
|
+
*/
|
|
2320
|
+
cf: CfProperties;
|
|
2321
|
+
/**
|
|
2322
|
+
* Mock of the context object that Workers received in their request handler, all the object's methods are no-op
|
|
2323
|
+
*/
|
|
2324
|
+
ctx: ExecutionContext;
|
|
2325
|
+
/**
|
|
2326
|
+
* Caches object emulating the Workers Cache runtime API
|
|
2327
|
+
*/
|
|
2328
|
+
caches: CacheStorage;
|
|
2329
|
+
/**
|
|
2330
|
+
* Function used to dispose of the child process providing the bindings implementation
|
|
2331
|
+
*/
|
|
2332
|
+
dispose: () => Promise<void>;
|
|
885
2333
|
};
|
|
2334
|
+
/**
|
|
2335
|
+
* By reading from a Wrangler configuration file this function generates proxy objects that can be
|
|
2336
|
+
* used to simulate the interaction with the Cloudflare platform during local development
|
|
2337
|
+
* in a Node.js environment
|
|
2338
|
+
*
|
|
2339
|
+
* @param options The various options that can tweak this function's behavior
|
|
2340
|
+
* @returns An Object containing the generated proxies alongside other related utilities
|
|
2341
|
+
*/
|
|
2342
|
+
declare function getPlatformProxy<Env = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties>(options?: GetPlatformProxyOptions): Promise<PlatformProxy<Env, CfProperties>>;
|
|
2343
|
+
type SourcelessWorkerOptions = Omit<WorkerOptions, "script" | "scriptPath" | "modules" | "modulesRoot"> & {
|
|
2344
|
+
modulesRules?: ModuleRule[];
|
|
2345
|
+
};
|
|
2346
|
+
interface Unstable_MiniflareWorkerOptions {
|
|
2347
|
+
workerOptions: SourcelessWorkerOptions;
|
|
2348
|
+
define: Record<string, string>;
|
|
2349
|
+
main?: string;
|
|
2350
|
+
externalWorkers: WorkerOptions[];
|
|
2351
|
+
}
|
|
2352
|
+
declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string, options?: {
|
|
2353
|
+
imagesLocalMode?: boolean;
|
|
2354
|
+
mixedModeConnectionString?: MixedModeConnectionString;
|
|
2355
|
+
mixedModeEnabled?: boolean;
|
|
2356
|
+
overrides?: {
|
|
2357
|
+
assets?: Partial<AssetsOptions>;
|
|
2358
|
+
};
|
|
2359
|
+
}): Unstable_MiniflareWorkerOptions;
|
|
2360
|
+
declare function unstable_getMiniflareWorkerOptions(config: Config, env?: string, options?: {
|
|
2361
|
+
imagesLocalMode?: boolean;
|
|
2362
|
+
mixedModeConnectionString?: MixedModeConnectionString;
|
|
2363
|
+
mixedModeEnabled?: boolean;
|
|
2364
|
+
overrides?: {
|
|
2365
|
+
assets?: Partial<AssetsOptions>;
|
|
2366
|
+
};
|
|
2367
|
+
}): Unstable_MiniflareWorkerOptions;
|
|
886
2368
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
custom_domain?: boolean;
|
|
2369
|
+
type MixedModeSession = Pick<Worker, "ready" | "dispose"> & {
|
|
2370
|
+
updateBindings: (bindings: StartDevWorkerInput["bindings"]) => Promise<void>;
|
|
2371
|
+
mixedModeConnectionString: MixedModeConnectionString;
|
|
891
2372
|
};
|
|
2373
|
+
declare function startMixedModeSession(bindings: StartDevWorkerInput["bindings"], options?: {
|
|
2374
|
+
auth?: NonNullable<StartDevWorkerInput["dev"]>["auth"];
|
|
2375
|
+
/** If running in a non-public compliance region, set this here. */
|
|
2376
|
+
complianceRegion?: Config["compliance_region"];
|
|
2377
|
+
}): Promise<MixedModeSession>;
|
|
2378
|
+
declare function pickRemoteBindings(bindings: Record<string, Binding>): Record<string, Binding>;
|
|
2379
|
+
|
|
2380
|
+
declare const LOGGER_LEVELS: {
|
|
2381
|
+
readonly none: -1;
|
|
2382
|
+
readonly error: 0;
|
|
2383
|
+
readonly warn: 1;
|
|
2384
|
+
readonly info: 2;
|
|
2385
|
+
readonly log: 3;
|
|
2386
|
+
readonly debug: 4;
|
|
2387
|
+
};
|
|
2388
|
+
type LoggerLevel = keyof typeof LOGGER_LEVELS;
|
|
2389
|
+
type TableRow<Keys extends string> = Record<Keys, string>;
|
|
2390
|
+
declare class Logger {
|
|
2391
|
+
#private;
|
|
2392
|
+
constructor();
|
|
2393
|
+
private overrideLoggerLevel?;
|
|
2394
|
+
private onceHistory;
|
|
2395
|
+
get loggerLevel(): "log" | "error" | "none" | "debug" | "info" | "warn";
|
|
2396
|
+
set loggerLevel(val: "log" | "error" | "none" | "debug" | "info" | "warn");
|
|
2397
|
+
resetLoggerLevel(): void;
|
|
2398
|
+
columns: number;
|
|
2399
|
+
debug: (...args: unknown[]) => void;
|
|
2400
|
+
debugWithSanitization: (label: string, ...args: unknown[]) => void;
|
|
2401
|
+
info: (...args: unknown[]) => void;
|
|
2402
|
+
log: (...args: unknown[]) => void;
|
|
2403
|
+
warn: (...args: unknown[]) => void;
|
|
2404
|
+
error: (...args: unknown[]) => void;
|
|
2405
|
+
table<Keys extends string>(data: TableRow<Keys>[]): void;
|
|
2406
|
+
console<M extends Exclude<keyof Console, "Console">>(method: M, ...args: Parameters<Console[M]>): void;
|
|
2407
|
+
get once(): {
|
|
2408
|
+
info: (...args: unknown[]) => void;
|
|
2409
|
+
log: (...args: unknown[]) => void;
|
|
2410
|
+
warn: (...args: unknown[]) => void;
|
|
2411
|
+
error: (...args: unknown[]) => void;
|
|
2412
|
+
};
|
|
2413
|
+
clearHistory(): void;
|
|
2414
|
+
doLogOnce(messageLevel: Exclude<LoggerLevel, "none">, args: unknown[]): void;
|
|
2415
|
+
private doLog;
|
|
2416
|
+
static registerBeforeLogHook(callback: (() => void) | undefined): void;
|
|
2417
|
+
static registerAfterLogHook(callback: (() => void) | undefined): void;
|
|
2418
|
+
private formatMessage;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
/**
|
|
2422
|
+
* Split an SQLQuery into an array of statements
|
|
2423
|
+
*/
|
|
2424
|
+
declare function splitSqlQuery(sql: string): string[];
|
|
2425
|
+
|
|
2426
|
+
declare const experimental_patchConfig: (configPath: string, patch: RawConfig, isArrayInsertion?: boolean) => string;
|
|
2427
|
+
|
|
2428
|
+
interface Unstable_ASSETSBindingsOptions {
|
|
2429
|
+
log: Logger;
|
|
2430
|
+
proxyPort?: number;
|
|
2431
|
+
directory?: string;
|
|
2432
|
+
}
|
|
2433
|
+
declare const generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
|
|
892
2434
|
|
|
893
|
-
export { }
|
|
2435
|
+
export { type ConfigBindingOptions as Experimental_ConfigBindingOptions, type MixedModeSession as Experimental_MixedModeSession, type GetPlatformProxyOptions, type PlatformProxy, type SourcelessWorkerOptions, 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, experimental_patchConfig, pickRemoteBindings as experimental_pickRemoteBindings, experimental_readRawConfig, startMixedModeSession as experimental_startMixedModeSession, getPlatformProxy, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, generateASSETSBinding as unstable_generateASSETSBinding, unstable_getMiniflareWorkerOptions, unstable_pages, readConfig as unstable_readConfig, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
|