wrangler 0.0.0-e64812e → 0.0.0-e6c9c5c0

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.
Files changed (338) hide show
  1. package/README.md +23 -3
  2. package/bin/wrangler.js +170 -62
  3. package/kv-asset-handler.js +1 -0
  4. package/miniflare-dist/index.mjs +1499 -21
  5. package/package.json +193 -152
  6. package/src/__tests__/access.test.ts +25 -0
  7. package/src/__tests__/api-dev.test.ts +238 -0
  8. package/src/__tests__/api-devregistry.test.js +64 -0
  9. package/src/__tests__/api.test.ts +80 -0
  10. package/src/__tests__/config-cache-without-cache-dir.test.ts +38 -0
  11. package/src/__tests__/config-cache.test.ts +30 -24
  12. package/src/__tests__/configuration.test.ts +4152 -3363
  13. package/src/__tests__/d1/d1.test.ts +127 -0
  14. package/src/__tests__/d1/splitter.test.ts +255 -0
  15. package/src/__tests__/delete.test.ts +266 -0
  16. package/src/__tests__/deployments.test.ts +105 -0
  17. package/src/__tests__/dev.test.tsx +1558 -952
  18. package/src/__tests__/generate.test.ts +238 -0
  19. package/src/__tests__/get-host-from-url.test.ts +16 -0
  20. package/src/__tests__/guess-worker-format.test.ts +68 -68
  21. package/src/__tests__/helpers/cmd-shim.d.ts +6 -6
  22. package/src/__tests__/helpers/mock-account-id.ts +24 -24
  23. package/src/__tests__/helpers/mock-auth-domain.ts +20 -0
  24. package/src/__tests__/helpers/mock-bin.ts +20 -20
  25. package/src/__tests__/helpers/mock-console.ts +58 -39
  26. package/src/__tests__/helpers/mock-dialogs.ts +88 -79
  27. package/src/__tests__/helpers/mock-get-zone-from-host.ts +11 -0
  28. package/src/__tests__/helpers/mock-http-server.ts +30 -30
  29. package/src/__tests__/helpers/mock-istty.ts +65 -18
  30. package/src/__tests__/helpers/mock-known-routes.ts +12 -0
  31. package/src/__tests__/helpers/mock-kv.ts +41 -28
  32. package/src/__tests__/helpers/mock-oauth-flow.ts +241 -233
  33. package/src/__tests__/helpers/mock-process.ts +34 -0
  34. package/src/__tests__/helpers/mock-stdin.ts +82 -77
  35. package/src/__tests__/helpers/mock-web-socket.ts +21 -21
  36. package/src/__tests__/helpers/msw/blob-worker.cjs +19 -0
  37. package/src/__tests__/helpers/msw/handlers/access.ts +13 -0
  38. package/src/__tests__/helpers/msw/handlers/deployments.ts +69 -0
  39. package/src/__tests__/helpers/msw/handlers/namespaces.ts +81 -0
  40. package/src/__tests__/helpers/msw/handlers/oauth.ts +31 -0
  41. package/src/__tests__/helpers/msw/handlers/r2.ts +60 -0
  42. package/src/__tests__/helpers/msw/handlers/script.ts +56 -0
  43. package/src/__tests__/helpers/msw/handlers/user.ts +52 -0
  44. package/src/__tests__/helpers/msw/handlers/zones.ts +20 -0
  45. package/src/__tests__/helpers/msw/index.ts +50 -0
  46. package/src/__tests__/helpers/msw/read-file-sync.js +61 -0
  47. package/src/__tests__/helpers/run-in-tmp.ts +27 -28
  48. package/src/__tests__/helpers/run-wrangler.ts +8 -8
  49. package/src/__tests__/helpers/worker-scripts/child-wrangler.toml +1 -0
  50. package/src/__tests__/helpers/worker-scripts/hello-world-worker.js +5 -0
  51. package/src/__tests__/helpers/worker-scripts/hello-world-wrangler.toml +1 -0
  52. package/src/__tests__/helpers/worker-scripts/parent-worker.js +8 -0
  53. package/src/__tests__/helpers/worker-scripts/parent-wrangler.toml +5 -0
  54. package/src/__tests__/helpers/write-worker-source.ts +16 -16
  55. package/src/__tests__/helpers/write-wrangler-toml.ts +9 -9
  56. package/src/__tests__/https-options.test.ts +142 -109
  57. package/src/__tests__/index.test.ts +245 -233
  58. package/src/__tests__/init.test.ts +3135 -1605
  59. package/src/__tests__/jest.setup.ts +148 -50
  60. package/src/__tests__/kv.test.ts +1778 -1471
  61. package/src/__tests__/logger.test.ts +100 -74
  62. package/src/__tests__/logout.test.ts +47 -0
  63. package/src/__tests__/metrics.test.ts +493 -0
  64. package/src/__tests__/middleware.scheduled.test.ts +145 -0
  65. package/src/__tests__/middleware.test.ts +750 -0
  66. package/src/__tests__/package-manager.test.ts +303 -303
  67. package/src/__tests__/pages-deployment-tail.test.ts +955 -0
  68. package/src/__tests__/pages.test.ts +2887 -743
  69. package/src/__tests__/parse.test.ts +252 -252
  70. package/src/__tests__/paths.test.ts +39 -0
  71. package/src/__tests__/publish.test.ts +8004 -5355
  72. package/src/__tests__/pubsub.test.ts +490 -0
  73. package/src/__tests__/queues.test.ts +522 -0
  74. package/src/__tests__/r2.test.ts +364 -228
  75. package/src/__tests__/route.test.ts +18 -18
  76. package/src/__tests__/secret.test.ts +681 -469
  77. package/src/__tests__/tail.test.ts +835 -567
  78. package/src/__tests__/test-old-node-version.js +31 -0
  79. package/src/__tests__/tsconfig-sanity.ts +12 -0
  80. package/src/__tests__/tsconfig.json +8 -0
  81. package/src/__tests__/tsconfig.tsbuildinfo +1 -0
  82. package/src/__tests__/type-generation.test.ts +233 -0
  83. package/src/__tests__/user.test.ts +107 -120
  84. package/src/__tests__/utils-collectKeyValues.test.ts +47 -0
  85. package/src/__tests__/validate-dev-props.test.ts +56 -0
  86. package/src/__tests__/version.test.ts +35 -0
  87. package/src/__tests__/whoami.test.tsx +165 -98
  88. package/src/__tests__/worker-namespace.test.ts +334 -0
  89. package/src/abort.d.ts +1 -1
  90. package/src/api/dev.ts +259 -0
  91. package/src/api/index.ts +3 -0
  92. package/src/api/pages/index.ts +5 -0
  93. package/src/api/pages/publish.tsx +321 -0
  94. package/src/bundle-reporter.ts +68 -0
  95. package/src/bundle.ts +838 -163
  96. package/src/cfetch/index.ts +120 -83
  97. package/src/cfetch/internal.ts +210 -97
  98. package/src/cli.ts +23 -8
  99. package/src/config/config.ts +236 -195
  100. package/src/config/diagnostics.ts +61 -61
  101. package/src/config/environment.ts +516 -357
  102. package/src/config/index.ts +326 -193
  103. package/src/config/validation-helpers.ts +379 -357
  104. package/src/config/validation.ts +1979 -1367
  105. package/src/config-cache.ts +81 -41
  106. package/src/create-worker-preview.ts +239 -142
  107. package/src/create-worker-upload-form.ts +309 -238
  108. package/src/d1/backups.tsx +219 -0
  109. package/src/d1/constants.ts +2 -0
  110. package/src/d1/create.tsx +63 -0
  111. package/src/d1/delete.ts +56 -0
  112. package/src/d1/execute.tsx +323 -0
  113. package/src/d1/formatTimeAgo.ts +14 -0
  114. package/src/d1/index.ts +101 -0
  115. package/src/d1/list.tsx +48 -0
  116. package/src/d1/migrations/apply.tsx +197 -0
  117. package/src/d1/migrations/create.tsx +77 -0
  118. package/src/d1/migrations/helpers.ts +147 -0
  119. package/src/d1/migrations/index.ts +3 -0
  120. package/src/d1/migrations/list.tsx +79 -0
  121. package/src/d1/migrations/options.ts +18 -0
  122. package/src/d1/options.ts +22 -0
  123. package/src/d1/splitter.ts +161 -0
  124. package/src/d1/types.ts +24 -0
  125. package/src/d1/utils.ts +48 -0
  126. package/src/delete.ts +103 -0
  127. package/src/deployments.ts +93 -0
  128. package/src/deprecated/index.ts +145 -0
  129. package/src/dev/dev-vars.ts +20 -17
  130. package/src/dev/dev.tsx +547 -352
  131. package/src/dev/get-local-persistence-path.ts +31 -0
  132. package/src/dev/local.tsx +903 -298
  133. package/src/dev/remote.tsx +620 -215
  134. package/src/dev/start-server.ts +538 -0
  135. package/src/dev/use-esbuild.ts +184 -97
  136. package/src/dev/validate-dev-props.ts +31 -0
  137. package/src/dev-registry.ts +201 -0
  138. package/src/dev.tsx +949 -0
  139. package/src/dialogs.ts +136 -0
  140. package/src/dispatch-namespace.ts +207 -0
  141. package/src/docs/index.ts +98 -0
  142. package/src/durable.ts +87 -87
  143. package/src/entry.ts +236 -230
  144. package/src/environment-variables/factory.ts +88 -0
  145. package/src/environment-variables/misc-variables.ts +30 -0
  146. package/src/errors.ts +6 -6
  147. package/src/generate/index.ts +300 -0
  148. package/src/git-client.ts +135 -0
  149. package/src/global-wrangler-config-path.ts +26 -0
  150. package/src/https-options.ts +84 -80
  151. package/src/index.ts +694 -0
  152. package/src/init.ts +1024 -0
  153. package/src/inspect.ts +698 -593
  154. package/src/intl-polyfill.d.ts +123 -123
  155. package/src/is-ci.ts +14 -0
  156. package/src/is-interactive.ts +16 -0
  157. package/src/jest.d.ts +4 -0
  158. package/src/kv/helpers.ts +430 -0
  159. package/src/kv/index.ts +596 -0
  160. package/src/logger.ts +80 -42
  161. package/src/metrics/index.ts +5 -0
  162. package/src/metrics/metrics-config.ts +239 -0
  163. package/src/metrics/metrics-dispatcher.ts +96 -0
  164. package/src/metrics/metrics-usage-headers.ts +24 -0
  165. package/src/metrics/send-event.ts +98 -0
  166. package/src/miniflare-cli/assets.ts +250 -0
  167. package/src/miniflare-cli/index.ts +202 -33
  168. package/src/miniflare-cli/request-context.ts +18 -18
  169. package/src/miniflare-cli/tsconfig.json +9 -0
  170. package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -0
  171. package/src/miniflare-cli/types.ts +11 -0
  172. package/src/module-collection.ts +221 -212
  173. package/src/open-in-browser.ts +4 -6
  174. package/src/package-manager.ts +173 -128
  175. package/src/pages/build.ts +150 -0
  176. package/src/pages/buildFunctions.ts +129 -0
  177. package/src/pages/constants.ts +18 -0
  178. package/src/pages/deployment-tails.ts +284 -0
  179. package/src/pages/deployments.tsx +84 -0
  180. package/src/pages/dev.ts +716 -0
  181. package/src/pages/errors.ts +66 -0
  182. package/src/pages/functions/buildPlugin.ts +90 -0
  183. package/src/pages/functions/buildWorker.ts +288 -0
  184. package/{pages → src/pages}/functions/filepath-routing.test.ts +113 -113
  185. package/src/pages/functions/filepath-routing.ts +189 -0
  186. package/src/pages/functions/identifiers.ts +78 -0
  187. package/src/pages/functions/routes-consolidation.test.ts +250 -0
  188. package/src/pages/functions/routes-consolidation.ts +73 -0
  189. package/src/pages/functions/routes-transformation.test.ts +282 -0
  190. package/src/pages/functions/routes-transformation.ts +115 -0
  191. package/src/pages/functions/routes-validation.test.ts +403 -0
  192. package/src/pages/functions/routes-validation.ts +202 -0
  193. package/src/pages/functions/routes.ts +151 -0
  194. package/src/pages/functions/tsconfig.json +8 -0
  195. package/src/pages/functions/tsconfig.tsbuildinfo +1 -0
  196. package/src/pages/functions.ts +82 -0
  197. package/src/pages/hash.ts +13 -0
  198. package/src/pages/index.ts +102 -0
  199. package/src/pages/projects.tsx +167 -0
  200. package/src/pages/prompt-select-project.tsx +31 -0
  201. package/src/pages/publish.tsx +263 -0
  202. package/src/pages/types.ts +41 -0
  203. package/src/pages/upload.tsx +447 -0
  204. package/src/pages/utils.ts +23 -0
  205. package/src/parse.ts +209 -125
  206. package/src/paths.ts +53 -8
  207. package/src/proxy.ts +623 -394
  208. package/src/publish/index.ts +270 -0
  209. package/src/publish/publish.ts +1064 -0
  210. package/src/pubsub/index.ts +286 -0
  211. package/src/pubsub/pubsub-commands.ts +624 -0
  212. package/src/queues/cli/commands/consumer/add.ts +71 -0
  213. package/src/queues/cli/commands/consumer/index.ts +22 -0
  214. package/src/queues/cli/commands/consumer/remove.ts +38 -0
  215. package/src/queues/cli/commands/create.ts +25 -0
  216. package/src/queues/cli/commands/delete.ts +26 -0
  217. package/src/queues/cli/commands/index.ts +36 -0
  218. package/src/queues/cli/commands/list.ts +25 -0
  219. package/src/queues/client.ts +135 -0
  220. package/src/queues/utils.ts +18 -0
  221. package/src/r2/constants.ts +4 -0
  222. package/src/r2/helpers.ts +131 -0
  223. package/src/r2/index.ts +289 -0
  224. package/src/routes.ts +140 -0
  225. package/src/secret/index.ts +379 -0
  226. package/src/selfsigned.d.ts +23 -23
  227. package/src/sites.ts +372 -0
  228. package/src/tail/createTail.ts +406 -0
  229. package/src/tail/filters.ts +108 -110
  230. package/src/tail/index.ts +210 -296
  231. package/src/tail/printing.ts +101 -46
  232. package/src/tsconfig-sanity.ts +16 -0
  233. package/src/type-generation.ts +181 -0
  234. package/src/update-check.ts +11 -11
  235. package/src/user/access.ts +68 -0
  236. package/src/user/auth-variables.ts +113 -0
  237. package/src/user/choose-account.tsx +39 -0
  238. package/src/user/generate-auth-url.ts +33 -0
  239. package/src/user/generate-random-state.ts +16 -0
  240. package/src/user/index.ts +2 -0
  241. package/src/user/user.ts +1232 -0
  242. package/src/utils/collectKeyValues.ts +14 -0
  243. package/src/whoami.ts +135 -0
  244. package/src/worker.ts +177 -106
  245. package/src/yargs-types.ts +24 -0
  246. package/src/zones.ts +191 -0
  247. package/templates/__tests__/pages-dev-util.test.ts +128 -0
  248. package/templates/__tests__/tsconfig-sanity.ts +12 -0
  249. package/templates/__tests__/tsconfig.json +8 -0
  250. package/templates/__tests__/tsconfig.tsbuildinfo +1 -0
  251. package/templates/checked-fetch.js +15 -0
  252. package/templates/d1-beta-facade.js +241 -0
  253. package/templates/facade.d.ts +14 -0
  254. package/templates/first-party-worker-module-facade.ts +19 -0
  255. package/templates/format-dev-errors.ts +33 -0
  256. package/templates/init-tests/test-jest-new-worker.js +23 -0
  257. package/templates/init-tests/test-vitest-new-worker.js +24 -0
  258. package/templates/init-tests/test-vitest-new-worker.ts +25 -0
  259. package/templates/middleware/common.ts +62 -0
  260. package/templates/middleware/loader-modules.ts +84 -0
  261. package/templates/middleware/loader-sw.ts +233 -0
  262. package/templates/middleware/middleware-miniflare3-json-error.ts +20 -0
  263. package/templates/middleware/middleware-pretty-error.ts +40 -0
  264. package/templates/middleware/middleware-scheduled.ts +15 -0
  265. package/templates/new-worker-scheduled.js +3 -3
  266. package/templates/new-worker-scheduled.ts +15 -15
  267. package/templates/new-worker.js +3 -3
  268. package/templates/new-worker.ts +15 -15
  269. package/templates/no-op-worker.js +10 -0
  270. package/templates/pages-dev-pipeline.ts +31 -0
  271. package/templates/pages-dev-util.ts +52 -0
  272. package/templates/pages-shim.ts +12 -0
  273. package/templates/pages-template-plugin.ts +176 -0
  274. package/templates/pages-template-worker.ts +189 -0
  275. package/templates/serve-static-assets.ts +65 -0
  276. package/templates/service-bindings-module-facade.js +54 -0
  277. package/templates/service-bindings-sw-facade.js +42 -0
  278. package/templates/tsconfig-sanity.ts +11 -0
  279. package/templates/tsconfig.init.json +106 -0
  280. package/templates/tsconfig.json +6 -103
  281. package/templates/tsconfig.tsbuildinfo +1 -0
  282. package/wrangler-dist/cli.d.ts +1028 -0
  283. package/wrangler-dist/cli.js +129259 -110922
  284. package/wrangler-dist/wasm-sync.wasm +0 -0
  285. package/pages/functions/buildPlugin.ts +0 -105
  286. package/pages/functions/buildWorker.ts +0 -151
  287. package/pages/functions/filepath-routing.ts +0 -189
  288. package/pages/functions/identifiers.ts +0 -78
  289. package/pages/functions/routes.ts +0 -156
  290. package/pages/functions/template-plugin.ts +0 -147
  291. package/pages/functions/template-worker.ts +0 -143
  292. package/src/__tests__/helpers/faye-websocket.d.ts +0 -6
  293. package/src/__tests__/helpers/mock-cfetch.ts +0 -211
  294. package/src/dialogs.tsx +0 -135
  295. package/src/environment-variables.ts +0 -35
  296. package/src/index.tsx +0 -2864
  297. package/src/kv.ts +0 -408
  298. package/src/miniflare-cli/enum-keys.ts +0 -17
  299. package/src/pages.tsx +0 -2038
  300. package/src/publish.ts +0 -583
  301. package/src/r2.ts +0 -50
  302. package/src/sites.tsx +0 -295
  303. package/src/user.tsx +0 -1203
  304. package/src/whoami.tsx +0 -70
  305. package/templates/static-asset-facade.js +0 -47
  306. package/vendor/@cloudflare/kv-asset-handler/CHANGELOG.md +0 -332
  307. package/vendor/@cloudflare/kv-asset-handler/LICENSE_APACHE +0 -176
  308. package/vendor/@cloudflare/kv-asset-handler/LICENSE_MIT +0 -25
  309. package/vendor/@cloudflare/kv-asset-handler/README.md +0 -245
  310. package/vendor/@cloudflare/kv-asset-handler/dist/index.d.ts +0 -32
  311. package/vendor/@cloudflare/kv-asset-handler/dist/index.js +0 -354
  312. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.d.ts +0 -13
  313. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.js +0 -148
  314. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.d.ts +0 -1
  315. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.js +0 -436
  316. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.d.ts +0 -1
  317. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.js +0 -40
  318. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.d.ts +0 -1
  319. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.js +0 -42
  320. package/vendor/@cloudflare/kv-asset-handler/dist/types.d.ts +0 -26
  321. package/vendor/@cloudflare/kv-asset-handler/dist/types.js +0 -31
  322. package/vendor/@cloudflare/kv-asset-handler/package.json +0 -52
  323. package/vendor/@cloudflare/kv-asset-handler/src/index.ts +0 -296
  324. package/vendor/@cloudflare/kv-asset-handler/src/mocks.ts +0 -136
  325. package/vendor/@cloudflare/kv-asset-handler/src/test/getAssetFromKV.ts +0 -464
  326. package/vendor/@cloudflare/kv-asset-handler/src/test/mapRequestToAsset.ts +0 -33
  327. package/vendor/@cloudflare/kv-asset-handler/src/test/serveSinglePageApp.ts +0 -42
  328. package/vendor/@cloudflare/kv-asset-handler/src/types.ts +0 -39
  329. package/vendor/wrangler-mime/CHANGELOG.md +0 -289
  330. package/vendor/wrangler-mime/LICENSE +0 -21
  331. package/vendor/wrangler-mime/Mime.js +0 -97
  332. package/vendor/wrangler-mime/README.md +0 -187
  333. package/vendor/wrangler-mime/cli.js +0 -46
  334. package/vendor/wrangler-mime/index.js +0 -4
  335. package/vendor/wrangler-mime/lite.js +0 -4
  336. package/vendor/wrangler-mime/package.json +0 -52
  337. package/vendor/wrangler-mime/types/other.js +0 -1
  338. package/vendor/wrangler-mime/types/standard.js +0 -1
@@ -0,0 +1,1028 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Blob as Blob_2 } from 'buffer';
4
+ import Dispatcher = require('./dispatcher');
5
+ import { ReadableStream } from 'stream/web';
6
+ import { URL as URL_2 } from 'url';
7
+ import { URLSearchParams as URLSearchParams_2 } from 'url';
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
+ }
35
+
36
+ /**
37
+ * The possible types for a `Rule`.
38
+ */
39
+ declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data";
40
+
41
+ declare type CustomDomainRoute = {
42
+ pattern: string;
43
+ custom_domain: boolean;
44
+ };
45
+
46
+ /**
47
+ * Deprecated upload configuration.
48
+ */
49
+ declare interface DeprecatedUpload {
50
+ /**
51
+ * The format of the Worker script.
52
+ *
53
+ * @deprecated We infer the format automatically now.
54
+ */
55
+ format?: "modules" | "service-worker";
56
+ /**
57
+ * The directory you wish to upload your worker from,
58
+ * relative to the wrangler.toml file.
59
+ *
60
+ * Defaults to the directory containing the wrangler.toml file.
61
+ *
62
+ * @deprecated
63
+ */
64
+ dir?: string;
65
+ /**
66
+ * The path to the Worker script, relative to `upload.dir`.
67
+ *
68
+ * @deprecated This will be replaced by a command line argument.
69
+ */
70
+ main?: string;
71
+ /**
72
+ * @deprecated This is now defined at the top level `rules` field.
73
+ */
74
+ rules?: Environment["rules"];
75
+ }
76
+
77
+ declare type DurableObjectBindings = {
78
+ /** The name of the binding used to refer to the Durable Object */
79
+ name: string;
80
+ /** The exported class name of the Durable Object */
81
+ class_name: string;
82
+ /** The script where the Durable Object is defined (if it's external to this worker) */
83
+ script_name?: string;
84
+ /** The service environment of the script_name to bind to */
85
+ environment?: string;
86
+ }[];
87
+
88
+ declare interface EnablePagesAssetsServiceBindingOptions {
89
+ proxyPort?: number;
90
+ directory?: string;
91
+ }
92
+
93
+ /**
94
+ * The `Environment` interface declares all the configuration fields that
95
+ * can be specified for an environment.
96
+ *
97
+ * This could be the top-level default environment, or a specific named environment.
98
+ */
99
+ declare interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
100
+ }
101
+
102
+ /**
103
+ * The `EnvironmentInheritable` interface declares all the configuration fields for an environment
104
+ * that can be inherited (and overridden) from the top-level environment.
105
+ */
106
+ declare interface EnvironmentInheritable {
107
+ /**
108
+ * The name of your worker. Alphanumeric + dashes only.
109
+ *
110
+ * @inheritable
111
+ */
112
+ name: string | undefined;
113
+ /**
114
+ * This is the ID of the account associated with your zone.
115
+ * You might have more than one account, so make sure to use
116
+ * the ID of the account associated with the zone/route you
117
+ * provide, if you provide one. It can also be specified through
118
+ * the CLOUDFLARE_ACCOUNT_ID environment variable.
119
+ *
120
+ * @inheritable
121
+ */
122
+ account_id: string | undefined;
123
+ /**
124
+ * A date in the form yyyy-mm-dd, which will be used to determine
125
+ * which version of the Workers runtime is used.
126
+ *
127
+ * More details at https://developers.cloudflare.com/workers/platform/compatibility-dates
128
+ *
129
+ * @inheritable
130
+ */
131
+ compatibility_date: string | undefined;
132
+ /**
133
+ * A list of flags that enable features from upcoming features of
134
+ * the Workers runtime, usually used together with compatibility_flags.
135
+ *
136
+ * More details at https://developers.cloudflare.com/workers/platform/compatibility-dates
137
+ *
138
+ * @inheritable
139
+ */
140
+ compatibility_flags: string[];
141
+ /**
142
+ * The entrypoint/path to the JavaScript file that will be executed.
143
+ */
144
+ main: string | undefined;
145
+ /**
146
+ * Whether we use <name>.<subdomain>.workers.dev to
147
+ * test and deploy your worker.
148
+ *
149
+ * @default `true` (This is a breaking change from wrangler 1)
150
+ * @breaking
151
+ * @inheritable
152
+ */
153
+ workers_dev: boolean | undefined;
154
+ /**
155
+ * A list of routes that your worker should be published to.
156
+ * Only one of `routes` or `route` is required.
157
+ *
158
+ * Only required when workers_dev is false, and there's no scheduled worker (see `triggers`)
159
+ *
160
+ * @inheritable
161
+ */
162
+ routes: Route[] | undefined;
163
+ /**
164
+ * A route that your worker should be published to. Literally
165
+ * the same as routes, but only one.
166
+ * Only one of `routes` or `route` is required.
167
+ *
168
+ * Only required when workers_dev is false, and there's no scheduled worker
169
+ *
170
+ * @inheritable
171
+ */
172
+ route: Route | undefined;
173
+ /**
174
+ * Path to a custom tsconfig
175
+ */
176
+ tsconfig: string | undefined;
177
+ /**
178
+ * The function to use to replace jsx syntax.
179
+ *
180
+ * @default `"React.createElement"`
181
+ * @inheritable
182
+ */
183
+ jsx_factory: string;
184
+ /**
185
+ * The function to use to replace jsx fragment syntax.
186
+ *
187
+ * @default `"React.Fragment"`
188
+ * @inheritable
189
+ */
190
+ jsx_fragment: string;
191
+ /**
192
+ * "Cron" definitions to trigger a worker's "scheduled" function.
193
+ *
194
+ * Lets you call workers periodically, much like a cron job.
195
+ *
196
+ * More details here https://developers.cloudflare.com/workers/platform/cron-triggers
197
+ *
198
+ * @default `{crons:[]}`
199
+ * @inheritable
200
+ */
201
+ triggers: {
202
+ crons: string[];
203
+ };
204
+ /**
205
+ * Specifies the Usage Model for your Worker. There are two options -
206
+ * [bundled](https://developers.cloudflare.com/workers/platform/limits#bundled-usage-model) and
207
+ * [unbound](https://developers.cloudflare.com/workers/platform/limits#unbound-usage-model).
208
+ * For newly created Workers, if the Usage Model is omitted
209
+ * it will be set to the [default Usage Model set on the account](https://dash.cloudflare.com/?account=workers/default-usage-model).
210
+ * For existing Workers, if the Usage Model is omitted, it will be
211
+ * set to the Usage Model configured in the dashboard for that Worker.
212
+ *
213
+ * @inheritable
214
+ */
215
+ usage_model: "bundled" | "unbound" | undefined;
216
+ /**
217
+ * An ordered list of rules that define which modules to import,
218
+ * and what type to import them as. You will need to specify rules
219
+ * to use Text, Data, and CompiledWasm modules, or when you wish to
220
+ * have a .js file be treated as an ESModule instead of CommonJS.
221
+ *
222
+ * @inheritable
223
+ */
224
+ rules: Rule[];
225
+ /**
226
+ * Configures a custom build step to be run by Wrangler when building your Worker.
227
+ *
228
+ * Refer to the [custom builds documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration#build)
229
+ * for more details.
230
+ *
231
+ * @default {}
232
+ */
233
+ build: {
234
+ /** 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. */
235
+ command?: string;
236
+ /** The directory in which the command is executed. */
237
+ cwd?: string;
238
+ /** The directory to watch for changes while using wrangler dev, defaults to the current working directory */
239
+ watch_dir?: string | string[];
240
+ /**
241
+ * Deprecated field previously used to configure the build and upload of the script.
242
+ * @deprecated
243
+ */
244
+ upload?: DeprecatedUpload;
245
+ };
246
+ /**
247
+ * Skip internal build steps and directly publish script
248
+ * @inheritable
249
+ */
250
+ no_bundle: boolean | undefined;
251
+ /**
252
+ * Minify the script before uploading.
253
+ * @inheritable
254
+ */
255
+ minify: boolean | undefined;
256
+ /**
257
+ * Add polyfills for node builtin modules and globals
258
+ * @inheritable
259
+ */
260
+ node_compat: boolean | undefined;
261
+ /**
262
+ * Specifies namespace bindings that are bound to this Worker environment.
263
+ *
264
+ * NOTE: This field is not automatically inherited from the top level environment,
265
+ * and so must be specified in every named environment.
266
+ *
267
+ * @default `[]`
268
+ * @nonInheritable
269
+ */
270
+ dispatch_namespaces: {
271
+ /** The binding name used to refer to the bound service. */
272
+ binding: string;
273
+ /** The namespace to bind to. */
274
+ namespace: string;
275
+ }[];
276
+ /**
277
+ * Designates this worker as an internal-only "first-party" worker.
278
+ */
279
+ first_party_worker: boolean | undefined;
280
+ /**
281
+ * TODO: remove this as it has been deprecated.
282
+ *
283
+ * This is just here for now because the `route` commands use it.
284
+ * So we need to include it in this type so it is available.
285
+ */
286
+ zone_id?: string;
287
+ /**
288
+ * Specify a compiled capnp schema to use
289
+ * Then add a binding per field in the top level message that you will send to logfwdr
290
+ *
291
+ * @default `{schema:undefined,bindings:[]}`
292
+ * @inheritable
293
+ */
294
+ logfwdr: {
295
+ /** capnp schema filename */
296
+ schema: string | undefined;
297
+ bindings: {
298
+ /** The binding name used to refer to logfwdr */
299
+ name: string;
300
+ /** The destination for this logged message */
301
+ destination: string;
302
+ }[];
303
+ };
304
+ /**
305
+ * Send Trace Events from this worker to Workers Logpush.
306
+ *
307
+ * This will not configure a corresponding Logpush job automatically.
308
+ *
309
+ * For more information about Workers Logpush, see:
310
+ * https://blog.cloudflare.com/logpush-for-workers/
311
+ *
312
+ * @inheritable
313
+ */
314
+ logpush: boolean | undefined;
315
+ }
316
+
317
+ /**
318
+ * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
319
+ * that cannot be inherited from the top-level environment, and must be defined specifically.
320
+ *
321
+ * If any of these fields are defined at the top-level then they should also be specifically defined
322
+ * for each named environment.
323
+ */
324
+ declare interface EnvironmentNonInheritable {
325
+ /**
326
+ * A map of values to substitute when deploying your worker.
327
+ *
328
+ * NOTE: This field is not automatically inherited from the top level environment,
329
+ * and so must be specified in every named environment.
330
+ *
331
+ * @default `{}`
332
+ * @nonInheritable
333
+ */
334
+ define: Record<string, string>;
335
+ /**
336
+ * A map of environment variables to set when deploying your worker.
337
+ *
338
+ * NOTE: This field is not automatically inherited from the top level environment,
339
+ * and so must be specified in every named environment.
340
+ *
341
+ * @default `{}`
342
+ * @nonInheritable
343
+ */
344
+ vars: {
345
+ [key: string]: unknown;
346
+ };
347
+ /**
348
+ * A list of durable objects that your worker should be bound to.
349
+ *
350
+ * For more information about Durable Objects, see the documentation at
351
+ * https://developers.cloudflare.com/workers/learning/using-durable-objects
352
+ *
353
+ * NOTE: This field is not automatically inherited from the top level environment,
354
+ * and so must be specified in every named environment.
355
+ *
356
+ * @default `{bindings:[]}`
357
+ * @nonInheritable
358
+ */
359
+ durable_objects: {
360
+ bindings: DurableObjectBindings;
361
+ };
362
+ /**
363
+ * These specify any Workers KV Namespaces you want to
364
+ * access from inside your Worker.
365
+ *
366
+ * To learn more about KV Namespaces,
367
+ * see the documentation at https://developers.cloudflare.com/workers/learning/how-kv-works
368
+ *
369
+ * NOTE: This field is not automatically inherited from the top level environment,
370
+ * and so must be specified in every named environment.
371
+ *
372
+ * @default `[]`
373
+ * @nonInheritable
374
+ */
375
+ kv_namespaces: {
376
+ /** The binding name used to refer to the KV Namespace */
377
+ binding: string;
378
+ /** The ID of the KV namespace */
379
+ id: string;
380
+ /** The ID of the KV namespace used during `wrangler dev` */
381
+ preview_id?: string;
382
+ }[];
383
+ /**
384
+ * Specifies Queues that are bound to this Worker environment.
385
+ *
386
+ * NOTE: This field is not automatically inherited from the top level environment,
387
+ * and so must be specified in every named environment.
388
+ *
389
+ * @default `{}`
390
+ * @nonInheritable
391
+ */
392
+ queues: {
393
+ /** Producer bindings */
394
+ producers?: {
395
+ /** The binding name used to refer to the Queue in the worker. */
396
+ binding: string;
397
+ /** The name of this Queue. */
398
+ queue: string;
399
+ }[];
400
+ /** Consumer configuration */
401
+ consumers?: {
402
+ /** The name of the queue from which this script should consume. */
403
+ queue: string;
404
+ /** The maximum number of messages per batch */
405
+ max_batch_size?: number;
406
+ /** The maximum number of seconds to wait to fill a batch with messages. */
407
+ max_batch_timeout?: number;
408
+ /** The maximum number of retries for each message. */
409
+ max_retries?: number;
410
+ /** The queue to send messages that failed to be consumed. */
411
+ dead_letter_queue?: string;
412
+ }[];
413
+ };
414
+ /**
415
+ * Specifies R2 buckets that are bound to this Worker environment.
416
+ *
417
+ * NOTE: This field is not automatically inherited from the top level environment,
418
+ * and so must be specified in every named environment.
419
+ *
420
+ * @default `[]`
421
+ * @nonInheritable
422
+ */
423
+ r2_buckets: {
424
+ /** The binding name used to refer to the R2 bucket in the worker. */
425
+ binding: string;
426
+ /** The name of this R2 bucket at the edge. */
427
+ bucket_name: string;
428
+ /** The preview name of this R2 bucket at the edge. */
429
+ preview_bucket_name?: string;
430
+ }[];
431
+ /**
432
+ * Specifies D1 databases that are bound to this Worker environment.
433
+ *
434
+ * NOTE: This field is not automatically inherited from the top level environment,
435
+ * and so must be specified in every named environment.
436
+ *
437
+ * @default `[]`
438
+ * @nonInheritable
439
+ */
440
+ d1_databases: {
441
+ /** The binding name used to refer to the D1 database in the worker. */
442
+ binding: string;
443
+ /** The name of this D1 database. */
444
+ database_name: string;
445
+ /** The UUID of this D1 database (not required). */
446
+ database_id: string;
447
+ /** The UUID of this D1 database for Wrangler Dev (if specified). */
448
+ preview_database_id?: string;
449
+ /** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
450
+ migrations_table?: string;
451
+ /** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
452
+ migrations_dir?: string;
453
+ /** Internal use only. */
454
+ database_internal_env?: string;
455
+ }[];
456
+ /**
457
+ * Specifies service bindings (worker-to-worker) that are bound to this Worker environment.
458
+ *
459
+ * NOTE: This field is not automatically inherited from the top level environment,
460
+ * and so must be specified in every named environment.
461
+ *
462
+ * @default `[]`
463
+ * @nonInheritable
464
+ */
465
+ services: {
466
+ /** The binding name used to refer to the bound service. */
467
+ binding: string;
468
+ /** The name of the service. */
469
+ service: string;
470
+ /** The environment of the service (e.g. production, staging, etc). */
471
+ environment?: string;
472
+ }[] | undefined;
473
+ /**
474
+ * Specifies analytics engine datasets that are bound to this Worker environment.
475
+ *
476
+ * NOTE: This field is not automatically inherited from the top level environment,
477
+ * and so must be specified in every named environment.
478
+ *
479
+ * @default `[]`
480
+ * @nonInheritable
481
+ */
482
+ analytics_engine_datasets: {
483
+ /** The binding name used to refer to the dataset in the worker. */
484
+ binding: string;
485
+ /** The name of this dataset to write to. */
486
+ dataset?: string;
487
+ }[];
488
+ /**
489
+ * "Unsafe" tables for features that aren't directly supported by wrangler.
490
+ *
491
+ * NOTE: This field is not automatically inherited from the top level environment,
492
+ * and so must be specified in every named environment.
493
+ *
494
+ * @default `{ bindings: [] }`
495
+ * @nonInheritable
496
+ */
497
+ unsafe: {
498
+ /**
499
+ * A set of bindings that should be put into a Worker's upload metadata without changes. These
500
+ * can be used to implement bindings for features that haven't released and aren't supported
501
+ * directly by wrangler or miniflare.
502
+ *
503
+ * @default []
504
+ */
505
+ bindings: {
506
+ name: string;
507
+ type: string;
508
+ [key: string]: unknown;
509
+ }[];
510
+ };
511
+ }
512
+
513
+ declare class File extends Blob_2 {
514
+ /**
515
+ * Creates a new File instance.
516
+ *
517
+ * @param fileBits An `Array` strings, or [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView), [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).
518
+ * @param fileName The name of the file.
519
+ * @param options An options object containing optional attributes for the file.
520
+ */
521
+ constructor(fileBits: ReadonlyArray<string | NodeJS.ArrayBufferView | Blob_2>, fileName: string, options?: FilePropertyBag)
522
+
523
+ /**
524
+ * Name of the file referenced by the File object.
525
+ */
526
+ readonly name: string
527
+
528
+ /**
529
+ * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.
530
+ */
531
+ readonly lastModified: number
532
+
533
+ readonly [Symbol.toStringTag]: string
534
+ }
535
+
536
+ declare interface FilePropertyBag extends BlobPropertyBag {
537
+ /**
538
+ * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.
539
+ */
540
+ lastModified?: number
541
+ }
542
+
543
+ /**
544
+ * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch().
545
+ */
546
+ declare class FormData {
547
+ /**
548
+ * Appends a new value onto an existing key inside a FormData object,
549
+ * or adds the key if it does not already exist.
550
+ *
551
+ * The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values.
552
+ *
553
+ * @param name The name of the field whose data is contained in `value`.
554
+ * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
555
+ 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.
556
+ * @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.
557
+ */
558
+ append(name: string, value: unknown, fileName?: string): void
559
+
560
+ /**
561
+ * Set a new value for an existing key inside FormData,
562
+ * or add the new field if it does not already exist.
563
+ *
564
+ * @param name The name of the field whose data is contained in `value`.
565
+ * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
566
+ 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.
567
+ * @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.
568
+ *
569
+ */
570
+ set(name: string, value: unknown, fileName?: string): void
571
+
572
+ /**
573
+ * Returns the first value associated with a given key from within a `FormData` object.
574
+ * If you expect multiple values and want all of them, use the `getAll()` method instead.
575
+ *
576
+ * @param {string} name A name of the value you want to retrieve.
577
+ *
578
+ * @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null.
579
+ */
580
+ get(name: string): FormDataEntryValue | null
581
+
582
+ /**
583
+ * Returns all the values associated with a given key from within a `FormData` object.
584
+ *
585
+ * @param {string} name A name of the value you want to retrieve.
586
+ *
587
+ * @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list.
588
+ */
589
+ getAll(name: string): FormDataEntryValue[]
590
+
591
+ /**
592
+ * Returns a boolean stating whether a `FormData` object contains a certain key.
593
+ *
594
+ * @param name A string representing the name of the key you want to test for.
595
+ *
596
+ * @return A boolean value.
597
+ */
598
+ has(name: string): boolean
599
+
600
+ /**
601
+ * Deletes a key and its value(s) from a `FormData` object.
602
+ *
603
+ * @param name The name of the key you want to delete.
604
+ */
605
+ delete(name: string): void
606
+
607
+ /**
608
+ * Executes given callback function for each field of the FormData instance
609
+ */
610
+ forEach: (
611
+ callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void,
612
+ thisArg?: unknown
613
+ ) => void
614
+
615
+ /**
616
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all keys contained in this `FormData` object.
617
+ * Each key is a `string`.
618
+ */
619
+ keys: () => SpecIterableIterator<string>
620
+
621
+ /**
622
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all values contained in this object `FormData` object.
623
+ * Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
624
+ */
625
+ values: () => SpecIterableIterator<FormDataEntryValue>
626
+
627
+ /**
628
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
629
+ * The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
630
+ */
631
+ entries: () => SpecIterableIterator<[string, FormDataEntryValue]>
632
+
633
+ /**
634
+ * An alias for FormData#entries()
635
+ */
636
+ [Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]>
637
+
638
+ readonly [Symbol.toStringTag]: string
639
+ }
640
+
641
+ /**
642
+ * A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
643
+ */
644
+ declare type FormDataEntryValue = string | File
645
+
646
+ declare class Headers implements SpecIterable<[string, string]> {
647
+ constructor (init?: HeadersInit)
648
+ readonly append: (name: string, value: string) => void
649
+ readonly delete: (name: string) => void
650
+ readonly get: (name: string) => string | null
651
+ readonly has: (name: string) => boolean
652
+ readonly set: (name: string, value: string) => void
653
+ readonly forEach: (
654
+ callbackfn: (value: string, key: string, iterable: Headers) => void,
655
+ thisArg?: unknown
656
+ ) => void
657
+
658
+ readonly keys: () => SpecIterableIterator<string>
659
+ readonly values: () => SpecIterableIterator<string>
660
+ readonly entries: () => SpecIterableIterator<[string, string]>
661
+ readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
662
+ }
663
+
664
+ declare type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
665
+
666
+ declare interface PagesPublishOptions {
667
+ /**
668
+ * Path to static assets to publish to Pages
669
+ */
670
+ directory: string;
671
+ /**
672
+ * The Cloudflare Account ID that owns the project that's
673
+ * being published
674
+ */
675
+ accountId: string;
676
+ /**
677
+ * The name of the project to be published
678
+ */
679
+ projectName: string;
680
+ /**
681
+ * Branch name to use. Defaults to production branch
682
+ */
683
+ branch?: string;
684
+ /**
685
+ * Whether or not to skip local file upload result caching
686
+ */
687
+ skipCaching?: boolean;
688
+ /**
689
+ * Commit message associated to deployment
690
+ */
691
+ commitMessage?: string;
692
+ /**
693
+ * Commit hash associated to deployment
694
+ */
695
+ commitHash?: string;
696
+ /**
697
+ * Whether or not the deployment should be considered to be
698
+ * in a dirty commit state
699
+ */
700
+ commitDirty?: boolean;
701
+ /**
702
+ * Path to the project's functions directory. Default uses
703
+ * the current working directory + /functions since this is
704
+ * typically called in a CLI
705
+ */
706
+ functionsDirectory?: string;
707
+ /**
708
+ * Whether to run bundling on `_worker.js` before deploying.
709
+ * Default: false
710
+ */
711
+ bundle?: boolean;
712
+ }
713
+
714
+ /**
715
+ * Publish a directory to an account/project.
716
+ * NOTE: You will need the `CLOUDFLARE_API_KEY` environment
717
+ * variable set
718
+ */
719
+ declare function publish({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, }: PagesPublishOptions): Promise<{
720
+ environment: "production" | "preview";
721
+ id: string;
722
+ url: string;
723
+ project_name: string;
724
+ build_config: {
725
+ build_command: string;
726
+ destination_dir: string;
727
+ root_dir: string;
728
+ web_analytics_tag?: string | undefined;
729
+ web_analytics_token?: string | undefined;
730
+ fast_builds?: boolean | undefined;
731
+ };
732
+ created_on: string;
733
+ production_branch: string;
734
+ project_id: string;
735
+ deployment_trigger: {
736
+ type: string;
737
+ metadata: {
738
+ branch: string;
739
+ commit_hash: string;
740
+ commit_message: string;
741
+ };
742
+ };
743
+ latest_stage: {
744
+ name: "build" | "queued" | "initialize" | "clone_repo" | "deploy";
745
+ status: "active" | "canceled" | "success" | "idle" | "failure" | "skipped";
746
+ started_on: string | null;
747
+ ended_on: string | null;
748
+ };
749
+ stages: {
750
+ name: "build" | "queued" | "initialize" | "clone_repo" | "deploy";
751
+ status: "active" | "canceled" | "success" | "idle" | "failure" | "skipped";
752
+ started_on: string | null;
753
+ ended_on: string | null;
754
+ }[];
755
+ aliases: string[];
756
+ modified_on: string;
757
+ short_id: string;
758
+ build_image_major_version: number;
759
+ kv_namespaces?: any;
760
+ source?: {
761
+ type: "github" | "gitlab";
762
+ config: {
763
+ owner: string;
764
+ repo_name: string;
765
+ production_branch?: string | undefined;
766
+ pr_comments_enabled?: boolean | undefined;
767
+ deployments_enabled?: boolean | undefined;
768
+ production_deployments_enabled?: boolean | undefined;
769
+ preview_deployment_setting?: "none" | "all" | "custom" | undefined;
770
+ preview_branch_includes?: string[] | undefined;
771
+ preview_branch_excludes?: string[] | undefined;
772
+ };
773
+ } | undefined;
774
+ env_vars?: any;
775
+ durable_object_namespaces?: any;
776
+ is_skipped?: boolean | undefined;
777
+ files?: {
778
+ [x: string]: string | undefined;
779
+ } | undefined;
780
+ }>;
781
+
782
+ declare type ReferrerPolicy =
783
+ | ''
784
+ | 'no-referrer'
785
+ | 'no-referrer-when-downgrade'
786
+ | 'origin'
787
+ | 'origin-when-cross-origin'
788
+ | 'same-origin'
789
+ | 'strict-origin'
790
+ | 'strict-origin-when-cross-origin'
791
+ | 'unsafe-url';
792
+
793
+ declare class Request implements BodyMixin {
794
+ constructor (input: RequestInfo, init?: RequestInit)
795
+
796
+ readonly cache: RequestCache
797
+ readonly credentials: RequestCredentials
798
+ readonly destination: RequestDestination
799
+ readonly headers: Headers
800
+ readonly integrity: string
801
+ readonly method: string
802
+ readonly mode: RequestMode
803
+ readonly redirect: RequestRedirect
804
+ readonly referrerPolicy: string
805
+ readonly url: string
806
+
807
+ readonly keepalive: boolean
808
+ readonly signal: AbortSignal
809
+
810
+ readonly body: ReadableStream | null
811
+ readonly bodyUsed: boolean
812
+
813
+ readonly arrayBuffer: () => Promise<ArrayBuffer>
814
+ readonly blob: () => Promise<Blob_2>
815
+ readonly formData: () => Promise<FormData>
816
+ readonly json: () => Promise<unknown>
817
+ readonly text: () => Promise<string>
818
+
819
+ readonly clone: () => Request
820
+ }
821
+
822
+ declare type RequestCache =
823
+ | 'default'
824
+ | 'force-cache'
825
+ | 'no-cache'
826
+ | 'no-store'
827
+ | 'only-if-cached'
828
+ | 'reload'
829
+
830
+ declare type RequestCredentials = 'omit' | 'include' | 'same-origin'
831
+
832
+ declare type RequestDestination =
833
+ | ''
834
+ | 'audio'
835
+ | 'audioworklet'
836
+ | 'document'
837
+ | 'embed'
838
+ | 'font'
839
+ | 'image'
840
+ | 'manifest'
841
+ | 'object'
842
+ | 'paintworklet'
843
+ | 'report'
844
+ | 'script'
845
+ | 'sharedworker'
846
+ | 'style'
847
+ | 'track'
848
+ | 'video'
849
+ | 'worker'
850
+ | 'xslt'
851
+
852
+ declare type RequestInfo = string | URL_2 | Request
853
+
854
+ declare interface RequestInit {
855
+ method?: string
856
+ keepalive?: boolean
857
+ headers?: HeadersInit
858
+ body?: BodyInit
859
+ redirect?: RequestRedirect
860
+ integrity?: string
861
+ signal?: AbortSignal
862
+ credentials?: RequestCredentials
863
+ mode?: RequestMode
864
+ referrer?: string
865
+ referrerPolicy?: ReferrerPolicy
866
+ window?: null
867
+ dispatcher?: Dispatcher
868
+ }
869
+
870
+ declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
871
+
872
+ declare type RequestRedirect = 'error' | 'follow' | 'manual'
873
+
874
+ declare class Response implements BodyMixin {
875
+ constructor (body?: BodyInit, init?: ResponseInit)
876
+
877
+ readonly headers: Headers
878
+ readonly ok: boolean
879
+ readonly status: number
880
+ readonly statusText: string
881
+ readonly type: ResponseType
882
+ readonly url: string
883
+ readonly redirected: boolean
884
+
885
+ readonly body: ReadableStream | null
886
+ readonly bodyUsed: boolean
887
+
888
+ readonly arrayBuffer: () => Promise<ArrayBuffer>
889
+ readonly blob: () => Promise<Blob_2>
890
+ readonly formData: () => Promise<FormData>
891
+ readonly json: () => Promise<unknown>
892
+ readonly text: () => Promise<string>
893
+
894
+ readonly clone: () => Response
895
+
896
+ static error (): Response
897
+ static json(data: any, init?: ResponseInit): Response
898
+ static redirect (url: string | URL_2, status: ResponseRedirectStatus): Response
899
+ }
900
+
901
+ declare interface ResponseInit {
902
+ readonly status?: number
903
+ readonly statusText?: string
904
+ readonly headers?: HeadersInit
905
+ }
906
+
907
+ declare type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
908
+
909
+ declare type ResponseType =
910
+ | 'basic'
911
+ | 'cors'
912
+ | 'default'
913
+ | 'error'
914
+ | 'opaque'
915
+ | 'opaqueredirect'
916
+
917
+ declare type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
918
+
919
+ /**
920
+ * A bundling resolver rule, defining the modules type for paths that match the specified globs.
921
+ */
922
+ declare type Rule = {
923
+ type: ConfigModuleRuleType;
924
+ globs: string[];
925
+ fallthrough?: boolean;
926
+ };
927
+
928
+ declare type SimpleRoute = string;
929
+
930
+ declare interface SpecIterable<T> {
931
+ [Symbol.iterator](): SpecIterator<T>;
932
+ }
933
+
934
+ declare interface SpecIterableIterator<T> extends SpecIterator<T> {
935
+ [Symbol.iterator](): SpecIterableIterator<T>;
936
+ }
937
+
938
+ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
939
+ next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
940
+ }
941
+
942
+ /**
943
+ * unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
944
+ */
945
+ export declare function unstable_dev(script: string, options?: UnstableDevOptions, apiOptions?: unknown): Promise<UnstableDevWorker>;
946
+
947
+ export declare const unstable_pages: {
948
+ publish: typeof publish;
949
+ };
950
+
951
+ export declare interface UnstableDevOptions {
952
+ config?: string;
953
+ env?: string;
954
+ ip?: string;
955
+ port?: number;
956
+ bundle?: boolean;
957
+ inspectorPort?: number;
958
+ localProtocol?: "http" | "https";
959
+ assets?: string;
960
+ site?: string;
961
+ siteInclude?: string[];
962
+ siteExclude?: string[];
963
+ nodeCompat?: boolean;
964
+ compatibilityDate?: string;
965
+ compatibilityFlags?: string[];
966
+ persist?: boolean;
967
+ persistTo?: string;
968
+ vars?: {
969
+ [key: string]: unknown;
970
+ };
971
+ kv?: {
972
+ binding: string;
973
+ id: string;
974
+ preview_id?: string;
975
+ }[];
976
+ durableObjects?: {
977
+ name: string;
978
+ class_name: string;
979
+ script_name?: string | undefined;
980
+ environment?: string | undefined;
981
+ }[];
982
+ r2?: {
983
+ binding: string;
984
+ bucket_name: string;
985
+ preview_bucket_name?: string;
986
+ }[];
987
+ logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
988
+ logPrefix?: string;
989
+ inspect?: boolean;
990
+ local?: boolean;
991
+ accountId?: string;
992
+ experimental?: {
993
+ d1Databases?: Environment["d1_databases"];
994
+ disableExperimentalWarning?: boolean;
995
+ disableDevRegistry?: boolean;
996
+ enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
997
+ experimentalLocal?: boolean;
998
+ experimentalLocalRemoteKv?: boolean;
999
+ forceLocal?: boolean;
1000
+ liveReload?: boolean;
1001
+ showInteractiveDevSession?: boolean;
1002
+ testMode?: boolean;
1003
+ testScheduled?: boolean;
1004
+ watch?: boolean;
1005
+ };
1006
+ }
1007
+
1008
+ export declare interface UnstableDevWorker {
1009
+ port: number;
1010
+ address: string;
1011
+ stop: () => Promise<void>;
1012
+ fetch: (input?: RequestInfo, init?: RequestInit) => Promise<Response>;
1013
+ waitUntilExit: () => Promise<void>;
1014
+ }
1015
+
1016
+ declare type ZoneIdRoute = {
1017
+ pattern: string;
1018
+ zone_id: string;
1019
+ custom_domain?: boolean;
1020
+ };
1021
+
1022
+ declare type ZoneNameRoute = {
1023
+ pattern: string;
1024
+ zone_name: string;
1025
+ custom_domain?: boolean;
1026
+ };
1027
+
1028
+ export { }