wrangler 0.0.0-e7a0cd5b → 0.0.0-e87ad068

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 (255) hide show
  1. package/README.md +3 -3
  2. package/bin/wrangler.js +30 -10
  3. package/miniflare-dist/index.mjs +254 -128
  4. package/package.json +27 -19
  5. package/src/__tests__/api-dev.test.ts +65 -36
  6. package/src/__tests__/api-devregistry.test.ts +121 -0
  7. package/src/__tests__/api.test.ts +27 -5
  8. package/src/__tests__/configuration.test.ts +797 -98
  9. package/src/__tests__/constellation.test.ts +371 -0
  10. package/src/__tests__/d1/d1.test.ts +82 -0
  11. package/src/__tests__/d1/execute.test.ts +66 -0
  12. package/src/__tests__/d1/migrate.test.ts +257 -0
  13. package/src/__tests__/d1/splitter.test.ts +255 -0
  14. package/src/__tests__/delete.test.ts +91 -49
  15. package/src/__tests__/deployments.test.ts +330 -56
  16. package/src/__tests__/dev.test.tsx +198 -90
  17. package/src/__tests__/generate.test.ts +12 -10
  18. package/src/__tests__/guess-worker-format.test.ts +35 -0
  19. package/src/__tests__/helpers/end-event-loop.ts +6 -0
  20. package/src/__tests__/helpers/mock-auth-domain.ts +20 -0
  21. package/src/__tests__/helpers/mock-console.ts +6 -0
  22. package/src/__tests__/helpers/mock-dialogs.ts +71 -85
  23. package/src/__tests__/helpers/mock-get-pages-upload-token.ts +25 -0
  24. package/src/__tests__/helpers/mock-get-zone-from-host.ts +8 -5
  25. package/src/__tests__/helpers/mock-known-routes.ts +7 -2
  26. package/src/__tests__/helpers/mock-kv.ts +29 -16
  27. package/src/__tests__/helpers/mock-oauth-flow.ts +103 -92
  28. package/src/__tests__/helpers/mock-process.ts +8 -13
  29. package/src/__tests__/helpers/mock-set-timeout.ts +16 -0
  30. package/src/__tests__/helpers/msw/blob-worker.cjs +19 -0
  31. package/src/__tests__/helpers/msw/handlers/deployments.ts +128 -27
  32. package/src/__tests__/helpers/msw/handlers/namespaces.ts +18 -41
  33. package/src/__tests__/helpers/msw/handlers/oauth.ts +13 -18
  34. package/src/__tests__/helpers/msw/handlers/r2.ts +14 -34
  35. package/src/__tests__/helpers/msw/handlers/script.ts +9 -28
  36. package/src/__tests__/helpers/msw/handlers/user.ts +13 -24
  37. package/src/__tests__/helpers/msw/handlers/zones.ts +6 -8
  38. package/src/__tests__/helpers/msw/index.ts +32 -1
  39. package/src/__tests__/helpers/msw/read-file-sync.js +61 -0
  40. package/src/__tests__/helpers/string-dynamic-values-matcher.ts +28 -0
  41. package/src/__tests__/helpers/worker-scripts/parent-worker.js +4 -1
  42. package/src/__tests__/index.test.ts +92 -72
  43. package/src/__tests__/init.test.ts +1033 -631
  44. package/src/__tests__/jest.setup.ts +19 -42
  45. package/src/__tests__/kv.test.ts +355 -231
  46. package/src/__tests__/logger.test.ts +68 -2
  47. package/src/__tests__/logout.test.ts +47 -0
  48. package/src/__tests__/metrics.test.ts +94 -51
  49. package/src/__tests__/middleware.scheduled.test.ts +42 -32
  50. package/src/__tests__/middleware.test.ts +212 -122
  51. package/src/__tests__/mtls-certificates.test.ts +589 -0
  52. package/src/__tests__/pages/deployment-list.test.ts +80 -0
  53. package/src/__tests__/pages/functions-build.test.ts +529 -0
  54. package/src/__tests__/pages/pages.test.ts +81 -0
  55. package/src/__tests__/pages/project-create.test.ts +63 -0
  56. package/src/__tests__/pages/project-list.test.ts +110 -0
  57. package/src/__tests__/pages/project-upload.test.ts +500 -0
  58. package/src/__tests__/pages/publish.test.ts +2864 -0
  59. package/src/__tests__/pages-deployment-tail.test.ts +957 -0
  60. package/src/__tests__/parse.test.ts +106 -0
  61. package/src/__tests__/publish.test.ts +2227 -1005
  62. package/src/__tests__/pubsub.test.ts +226 -100
  63. package/src/__tests__/queues.test.ts +238 -77
  64. package/src/__tests__/r2.test.ts +55 -57
  65. package/src/__tests__/secret.test.ts +179 -130
  66. package/src/__tests__/tail.test.ts +313 -113
  67. package/src/__tests__/test-old-node-version.js +3 -3
  68. package/src/__tests__/traverse-module-graph.test.ts +220 -0
  69. package/src/__tests__/tsconfig-sanity.ts +12 -0
  70. package/src/__tests__/tsconfig.json +8 -0
  71. package/src/__tests__/tsconfig.tsbuildinfo +1 -0
  72. package/src/__tests__/type-generation.test.ts +43 -26
  73. package/src/__tests__/unstableDev.test.ts +61 -0
  74. package/src/__tests__/user.test.ts +35 -72
  75. package/src/__tests__/whoami.test.tsx +8 -114
  76. package/src/__tests__/worker-namespace.test.ts +83 -69
  77. package/src/api/dev.ts +180 -60
  78. package/src/api/index.ts +10 -1
  79. package/src/api/mtls-certificate.ts +148 -0
  80. package/src/api/pages/create-worker-bundle-contents.ts +80 -0
  81. package/src/api/pages/index.ts +5 -0
  82. package/src/api/pages/publish.tsx +371 -0
  83. package/src/bundle.ts +315 -148
  84. package/src/cfetch/index.ts +0 -2
  85. package/src/cfetch/internal.ts +33 -33
  86. package/src/cli.ts +4 -4
  87. package/src/config/config.ts +14 -7
  88. package/src/config/environment.ts +120 -24
  89. package/src/config/index.ts +117 -35
  90. package/src/config/validation-helpers.ts +1 -1
  91. package/src/config/validation.ts +430 -19
  92. package/src/constellation/createProject.tsx +51 -0
  93. package/src/constellation/deleteProject.ts +51 -0
  94. package/src/constellation/deleteProjectModel.ts +76 -0
  95. package/src/constellation/index.ts +75 -0
  96. package/src/constellation/listCatalog.tsx +35 -0
  97. package/src/constellation/listModel.tsx +49 -0
  98. package/src/constellation/listProject.tsx +28 -0
  99. package/src/constellation/listRuntime.tsx +28 -0
  100. package/src/constellation/options.ts +17 -0
  101. package/src/constellation/types.ts +17 -0
  102. package/src/constellation/uploadModel.tsx +84 -0
  103. package/src/constellation/utils.ts +90 -0
  104. package/src/create-worker-preview.ts +19 -8
  105. package/src/create-worker-upload-form.ts +81 -18
  106. package/src/d1/backups.tsx +47 -46
  107. package/src/d1/constants.ts +5 -0
  108. package/src/d1/create.tsx +85 -37
  109. package/src/d1/{delete.tsx → delete.ts} +12 -15
  110. package/src/d1/execute.tsx +228 -156
  111. package/src/d1/index.ts +31 -7
  112. package/src/d1/list.tsx +27 -13
  113. package/src/d1/migrations/apply.tsx +235 -0
  114. package/src/d1/migrations/create.tsx +79 -0
  115. package/src/d1/migrations/helpers.ts +171 -0
  116. package/src/d1/migrations/index.ts +3 -0
  117. package/src/d1/migrations/list.tsx +95 -0
  118. package/src/d1/migrations/options.ts +23 -0
  119. package/src/d1/options.ts +12 -2
  120. package/src/d1/splitter.ts +161 -0
  121. package/src/d1/types.ts +32 -0
  122. package/src/d1/utils.ts +12 -2
  123. package/src/delete.ts +8 -16
  124. package/src/deployments.ts +340 -46
  125. package/src/deprecated/index.ts +8 -302
  126. package/src/dev/dev.tsx +66 -46
  127. package/src/dev/local.tsx +339 -104
  128. package/src/dev/remote.tsx +36 -3
  129. package/src/dev/start-server.ts +146 -101
  130. package/src/dev/use-esbuild.ts +82 -56
  131. package/src/dev/validate-dev-props.ts +9 -0
  132. package/src/{dev-registry.tsx → dev-registry.ts} +13 -1
  133. package/src/dev.tsx +202 -125
  134. package/src/dialogs.ts +136 -0
  135. package/src/dispatch-namespace.ts +21 -17
  136. package/src/docs/helpers.ts +50 -0
  137. package/src/docs/index.ts +54 -0
  138. package/src/entry.ts +26 -11
  139. package/src/environment-variables/factory.ts +89 -0
  140. package/src/environment-variables/misc-variables.ts +30 -0
  141. package/src/generate/index.ts +303 -0
  142. package/src/git-client.ts +15 -4
  143. package/src/{index.tsx → index.ts} +148 -63
  144. package/src/init.ts +301 -197
  145. package/src/inspect.ts +122 -6
  146. package/src/jest.d.ts +4 -0
  147. package/src/kv/helpers.ts +7 -4
  148. package/src/kv/index.ts +15 -17
  149. package/src/logger.ts +36 -5
  150. package/src/metrics/metrics-config.ts +3 -3
  151. package/src/metrics/send-event.ts +6 -1
  152. package/src/miniflare-cli/assets.ts +64 -28
  153. package/src/miniflare-cli/index.ts +6 -9
  154. package/src/miniflare-cli/tsconfig.json +9 -0
  155. package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -0
  156. package/src/miniflare-cli/types.ts +11 -0
  157. package/src/module-collection.ts +92 -26
  158. package/src/mtls-certificate/cli.ts +155 -0
  159. package/src/pages/build.ts +423 -0
  160. package/src/pages/buildFunctions.ts +140 -0
  161. package/src/pages/deployment-tails.ts +281 -0
  162. package/src/pages/deployments.tsx +11 -33
  163. package/src/pages/{dev.tsx → dev.ts} +192 -126
  164. package/src/pages/errors.ts +1 -0
  165. package/src/pages/functions/buildPlugin.ts +73 -69
  166. package/src/pages/functions/buildWorker.ts +342 -117
  167. package/src/pages/functions/tsconfig.json +8 -0
  168. package/src/pages/functions/tsconfig.tsbuildinfo +1 -0
  169. package/src/pages/{functions.tsx → functions.ts} +8 -4
  170. package/src/pages/{index.tsx → index.ts} +11 -3
  171. package/src/pages/projects.tsx +12 -22
  172. package/src/pages/prompt-select-project.tsx +31 -0
  173. package/src/pages/publish.tsx +45 -214
  174. package/src/pages/types.ts +6 -9
  175. package/src/pages/upload.tsx +58 -14
  176. package/src/pages/utils.ts +14 -3
  177. package/src/parse.ts +23 -1
  178. package/src/paths.ts +1 -1
  179. package/src/proxy.ts +5 -0
  180. package/src/publish/index.ts +20 -16
  181. package/src/publish/publish.ts +81 -48
  182. package/src/pubsub/{pubsub-commands.tsx → pubsub-commands.ts} +19 -20
  183. package/src/queues/cli/commands/consumer/add.ts +24 -24
  184. package/src/queues/cli/commands/consumer/index.ts +3 -6
  185. package/src/queues/cli/commands/consumer/remove.ts +11 -18
  186. package/src/queues/cli/commands/create.ts +8 -8
  187. package/src/queues/cli/commands/delete.ts +8 -8
  188. package/src/queues/cli/commands/index.ts +6 -4
  189. package/src/queues/cli/commands/list.ts +8 -8
  190. package/src/queues/client.ts +1 -0
  191. package/src/queues/utils.ts +18 -0
  192. package/src/r2/constants.ts +4 -0
  193. package/src/r2/helpers.ts +1 -0
  194. package/src/r2/index.ts +40 -28
  195. package/src/secret/index.ts +18 -17
  196. package/src/{sites.tsx → sites.ts} +165 -53
  197. package/src/tail/createTail.ts +103 -3
  198. package/src/tail/filters.ts +1 -1
  199. package/src/tail/index.ts +8 -11
  200. package/src/tail/printing.ts +27 -0
  201. package/src/traverse-module-graph.ts +54 -0
  202. package/src/tsconfig-sanity.ts +16 -0
  203. package/src/type-generation.ts +85 -57
  204. package/src/user/access.ts +0 -1
  205. package/src/user/auth-variables.ts +113 -0
  206. package/src/user/choose-account.tsx +1 -31
  207. package/src/user/index.ts +0 -1
  208. package/src/user/{user.tsx → user.ts} +124 -82
  209. package/src/utils/render.ts +93 -0
  210. package/src/{whoami.tsx → whoami.ts} +37 -71
  211. package/src/worker.ts +61 -3
  212. package/src/yargs-types.ts +22 -5
  213. package/templates/__tests__/tsconfig-sanity.ts +12 -0
  214. package/templates/__tests__/tsconfig.json +8 -0
  215. package/templates/__tests__/tsconfig.tsbuildinfo +1 -0
  216. package/templates/checked-fetch.js +9 -3
  217. package/templates/d1-beta-facade.js +95 -25
  218. package/templates/facade.d.ts +14 -0
  219. package/templates/first-party-worker-module-facade.ts +4 -3
  220. package/templates/format-dev-errors.ts +8 -6
  221. package/templates/gitignore +1 -0
  222. package/templates/init-tests/test-jest-new-worker.js +3 -5
  223. package/templates/init-tests/test-vitest-new-worker.js +3 -5
  224. package/templates/init-tests/test-vitest-new-worker.ts +25 -0
  225. package/templates/middleware/loader-modules.ts +2 -2
  226. package/templates/middleware/loader-sw.ts +51 -31
  227. package/templates/middleware/middleware-miniflare3-json-error.ts +32 -0
  228. package/templates/new-worker.ts +3 -0
  229. package/templates/pages-dev-pipeline.ts +4 -1
  230. package/templates/pages-dev-util.ts +4 -1
  231. package/templates/pages-shim.ts +4 -1
  232. package/templates/pages-template-plugin.ts +19 -10
  233. package/templates/serve-static-assets.ts +17 -14
  234. package/templates/service-bindings-module-facade.js +1 -0
  235. package/templates/tsconfig-sanity.ts +11 -0
  236. package/templates/tsconfig.init.json +105 -0
  237. package/templates/tsconfig.json +5 -103
  238. package/templates/tsconfig.tsbuildinfo +1 -0
  239. package/wrangler-dist/cli.d.ts +902 -77
  240. package/wrangler-dist/cli.js +131685 -140615
  241. package/wrangler-dist/wasm-sync.wasm +0 -0
  242. package/src/__tests__/api-devregistry.test.js +0 -57
  243. package/src/__tests__/d1.test.ts +0 -72
  244. package/src/__tests__/dialogs.test.tsx +0 -40
  245. package/src/__tests__/helpers/mock-cfetch.ts +0 -333
  246. package/src/__tests__/pages.test.ts +0 -2223
  247. package/src/d1/types.tsx +0 -14
  248. package/src/dialogs.tsx +0 -163
  249. package/src/environment-variables.ts +0 -50
  250. package/src/pages/build.tsx +0 -238
  251. package/src/user/env-vars.ts +0 -46
  252. package/templates/experimental-local-cache-stubs.js +0 -27
  253. /package/src/{bundle-reporter.tsx → bundle-reporter.ts} +0 -0
  254. /package/src/dev/{get-local-persistence-path.tsx → get-local-persistence-path.ts} +0 -0
  255. /package/src/pages/{hash.tsx → hash.ts} +0 -0
@@ -1,8 +1,15 @@
1
- import { Awaitable, Dispatcher, Middleware, __facade_invoke__ } from "./common";
2
- export { __facade_register__, __facade_registerInternal__ } from "./common";
3
-
4
- // Miniflare's `EventTarget` follows the spec and doesn't allow exceptions to
5
- // be caught by `dispatchEvent`. Instead it has a custom`ThrowingEventTarget`
1
+ import {
2
+ Awaitable,
3
+ Dispatcher,
4
+ Middleware,
5
+ __facade_invoke__,
6
+ __facade_register__,
7
+ __facade_registerInternal__,
8
+ } from "./common";
9
+ export { __facade_register__, __facade_registerInternal__ };
10
+
11
+ // Miniflare 2's `EventTarget` follows the spec and doesn't allow exceptions to
12
+ // be caught by `dispatchEvent`. Instead it has a custom `ThrowingEventTarget`
6
13
  // class that rethrows errors from event listeners in `dispatchEvent`.
7
14
  // We'd like errors to be propagated to the top-level `addEventListener`, so
8
15
  // we'd like to use `ThrowingEventTarget`. Unfortunately, `ThrowingEventTarget`
@@ -15,45 +22,52 @@ if ((globalThis as any).MINIFLARE) {
15
22
  __FACADE_EVENT_TARGET__ = new EventTarget();
16
23
  }
17
24
 
18
- declare global {
19
- var __facade_addEventListener__: (
20
- type: string,
21
- listener: EventListenerOrEventListenerObject,
22
- options?: EventTargetAddEventListenerOptions | boolean
23
- ) => void;
24
- var __facade_removeEventListener__: (
25
- type: string,
26
- listener: EventListenerOrEventListenerObject,
27
- options?: EventTargetEventListenerOptions | boolean
28
- ) => void;
29
- var __facade_dispatchEvent__: (event: Event) => void;
30
- }
31
-
32
- function __facade_isSpecialEvent__(type: string) {
25
+ function __facade_isSpecialEvent__(
26
+ type: string
27
+ ): type is "fetch" | "scheduled" {
33
28
  return type === "fetch" || type === "scheduled";
34
29
  }
35
- globalThis.__facade_addEventListener__ = function (type, listener, options) {
30
+ const __facade__originalAddEventListener__ = globalThis.addEventListener;
31
+ const __facade__originalRemoveEventListener__ = globalThis.removeEventListener;
32
+ const __facade__originalDispatchEvent__ = globalThis.dispatchEvent;
33
+
34
+ globalThis.addEventListener = function (type, listener, options) {
36
35
  if (__facade_isSpecialEvent__(type)) {
37
- __FACADE_EVENT_TARGET__.addEventListener(type, listener, options);
36
+ __FACADE_EVENT_TARGET__.addEventListener(
37
+ type,
38
+ listener as EventListenerOrEventListenerObject,
39
+ options
40
+ );
38
41
  } else {
39
- globalThis.addEventListener(type as any, listener, options);
42
+ __facade__originalAddEventListener__(type, listener, options);
40
43
  }
41
44
  };
42
- globalThis.__facade_removeEventListener__ = function (type, listener, options) {
45
+ globalThis.removeEventListener = function (type, listener, options) {
43
46
  if (__facade_isSpecialEvent__(type)) {
44
- __FACADE_EVENT_TARGET__.removeEventListener(type, listener, options);
47
+ __FACADE_EVENT_TARGET__.removeEventListener(
48
+ type,
49
+ listener as EventListenerOrEventListenerObject,
50
+ options
51
+ );
45
52
  } else {
46
- globalThis.removeEventListener(type as any, listener, options);
53
+ __facade__originalRemoveEventListener__(type, listener, options);
47
54
  }
48
55
  };
49
- globalThis.__facade_dispatchEvent__ = function (event) {
56
+ globalThis.dispatchEvent = function (event) {
50
57
  if (__facade_isSpecialEvent__(event.type)) {
51
- __FACADE_EVENT_TARGET__.dispatchEvent(event);
58
+ return __FACADE_EVENT_TARGET__.dispatchEvent(event);
52
59
  } else {
53
- globalThis.dispatchEvent(event as any);
60
+ return __facade__originalDispatchEvent__(event);
54
61
  }
55
62
  };
56
63
 
64
+ declare global {
65
+ var addMiddleware: typeof __facade_register__;
66
+ var addMiddlewareInternal: typeof __facade_registerInternal__;
67
+ }
68
+ globalThis.addMiddleware = __facade_register__;
69
+ globalThis.addMiddlewareInternal = __facade_registerInternal__;
70
+
57
71
  const __facade_waitUntil__ = Symbol("__facade_waitUntil__");
58
72
  const __facade_response__ = Symbol("__facade_response__");
59
73
  const __facade_dispatched__ = Symbol("__facade_dispatched__");
@@ -154,7 +168,7 @@ class __Facade_ScheduledEvent__ extends __Facade_ExtendableEvent__ {
154
168
  }
155
169
  }
156
170
 
157
- globalThis.addEventListener("fetch", (event) => {
171
+ __facade__originalAddEventListener__("fetch", (event) => {
158
172
  const ctx: ExecutionContext = {
159
173
  waitUntil: event.waitUntil.bind(event),
160
174
  passThroughOnException: event.passThroughOnException.bind(event),
@@ -169,6 +183,8 @@ globalThis.addEventListener("fetch", (event) => {
169
183
  });
170
184
 
171
185
  __FACADE_EVENT_TARGET__.dispatchEvent(facadeEvent);
186
+ // @ts-expect-error `waitUntil` types are currently broken, blocked on
187
+ // https://github.com/cloudflare/workerd/pull/191
172
188
  event.waitUntil(Promise.all(facadeEvent[__facade_waitUntil__]));
173
189
  }
174
190
  };
@@ -181,6 +197,8 @@ globalThis.addEventListener("fetch", (event) => {
181
197
 
182
198
  __FACADE_EVENT_TARGET__.dispatchEvent(facadeEvent);
183
199
  facadeEvent[__facade_dispatched__] = true;
200
+ // @ts-expect-error `waitUntil` types are currently broken, blocked on
201
+ // https://github.com/cloudflare/workerd/pull/191
184
202
  event.waitUntil(Promise.all(facadeEvent[__facade_waitUntil__]));
185
203
 
186
204
  const response = facadeEvent[__facade_response__];
@@ -201,7 +219,7 @@ globalThis.addEventListener("fetch", (event) => {
201
219
  );
202
220
  });
203
221
 
204
- globalThis.addEventListener("scheduled", (event) => {
222
+ __facade__originalAddEventListener__("scheduled", (event) => {
205
223
  const facadeEvent = new __Facade_ScheduledEvent__("scheduled", {
206
224
  scheduledTime: event.scheduledTime,
207
225
  cron: event.cron,
@@ -209,5 +227,7 @@ globalThis.addEventListener("scheduled", (event) => {
209
227
  });
210
228
 
211
229
  __FACADE_EVENT_TARGET__.dispatchEvent(facadeEvent);
230
+ // @ts-expect-error `waitUntil` types are currently broken, blocked on
231
+ // https://github.com/cloudflare/workerd/pull/191
212
232
  event.waitUntil(Promise.all(facadeEvent[__facade_waitUntil__]));
213
233
  });
@@ -0,0 +1,32 @@
1
+ import type { Middleware } from "./common";
2
+
3
+ interface JsonError {
4
+ message?: string;
5
+ name?: string;
6
+ stack?: string;
7
+ cause?: JsonError;
8
+ }
9
+
10
+ function reduceError(e: any): JsonError {
11
+ return {
12
+ name: e?.name,
13
+ message: e?.message ?? String(e),
14
+ stack: e?.stack,
15
+ cause: e?.cause === undefined ? undefined : reduceError(e.cause),
16
+ };
17
+ }
18
+
19
+ // See comment in `bundle.ts` for details on why this is needed
20
+ const jsonError: Middleware = async (request, env, _ctx, middlewareCtx) => {
21
+ try {
22
+ return await middlewareCtx.next(request, env);
23
+ } catch (e: any) {
24
+ const error = reduceError(e);
25
+ return Response.json(error, {
26
+ status: 500,
27
+ headers: { "MF-Experimental-Error-Stack": "true" },
28
+ });
29
+ }
30
+ };
31
+
32
+ export default jsonError;
@@ -17,6 +17,9 @@ export interface Env {
17
17
  //
18
18
  // Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
19
19
  // MY_BUCKET: R2Bucket;
20
+ //
21
+ // Example binding to a Service. Learn more at https://developers.cloudflare.com/workers/runtime-apis/service-bindings/
22
+ // MY_SERVICE: Fetcher;
20
23
  }
21
24
 
22
25
  export default {
@@ -7,7 +7,7 @@ import { isRoutingRuleMatch } from "./pages-dev-util";
7
7
  // @ts-ignore routes are injected
8
8
  const routes = __ROUTES__;
9
9
 
10
- export default {
10
+ export default <ExportedHandler<{ ASSETS: Fetcher }>>{
11
11
  fetch(request, env, context) {
12
12
  const { pathname } = new URL(request.url);
13
13
 
@@ -19,6 +19,9 @@ export default {
19
19
 
20
20
  for (const include of routes.include) {
21
21
  if (isRoutingRuleMatch(pathname, include)) {
22
+ if (worker.fetch === undefined) {
23
+ throw new TypeError("Entry point missing `fetch` handler");
24
+ }
22
25
  return worker.fetch(request, env, context);
23
26
  }
24
27
  }
@@ -45,7 +45,10 @@ function transformRoutingRuleToRegExp(rule: string): RegExp {
45
45
  }
46
46
 
47
47
  // /foo* => /foo.* => ^/foo.*$
48
- transformedRule = `^${transformedRule.replace("*", ".*")}$`;
48
+ // /*.* => /*\.* => /.*\..* => ^/.*\..*$
49
+ transformedRule = `^${transformedRule
50
+ .replaceAll(/\./g, "\\.")
51
+ .replaceAll(/\*/g, ".*")}$`;
49
52
 
50
53
  // ^/foo.*$ => /^\/foo.*$/
51
54
  return new RegExp(transformedRule);
@@ -1,8 +1,11 @@
1
1
  // This Worker is used as a default when no Pages Functions are present.
2
2
  // It proxies the request directly on to the asset server binding.
3
3
 
4
- export default {
4
+ export default <ExportedHandler<{ ASSETS: Fetcher }>>{
5
5
  async fetch(request, env, context) {
6
+ // @ts-expect-error due to a bug in `@cloudflare/workers-types`, the `cf`
7
+ // types from the `request` parameter and `RequestInit` are incompatible.
8
+ // We'll get this fixed very soon.
6
9
  const response = await env.ASSETS.fetch(request.url, request);
7
10
  return new Response(response.body, response);
8
11
  },
@@ -119,20 +119,25 @@ function* executeRequest(request: Request, relativePathname: string) {
119
119
  }
120
120
  }
121
121
 
122
- export default function (pluginArgs) {
122
+ export default function (pluginArgs: unknown) {
123
123
  const onRequest: PagesPluginFunction = async (workerContext) => {
124
124
  let { request } = workerContext;
125
125
  const { env, next, data } = workerContext;
126
126
 
127
127
  const url = new URL(request.url);
128
+ // TODO: Replace this with something actually legible.
128
129
  const relativePathname = `/${
129
- url.pathname.split(workerContext.functionPath)[1] || ""
130
+ url.pathname.replace(workerContext.functionPath, "") || ""
130
131
  }`.replace(/^\/\//, "/");
131
132
 
132
133
  const handlerIterator = executeRequest(request, relativePathname);
133
134
  const pluginNext = async (input?: RequestInfo, init?: RequestInit) => {
134
135
  if (input !== undefined) {
135
- request = new Request(input, init);
136
+ let url = input;
137
+ if (typeof input === "string") {
138
+ url = new URL(input, request.url).toString();
139
+ }
140
+ request = new Request(url, init);
136
141
  }
137
142
 
138
143
  const result = handlerIterator.next();
@@ -140,7 +145,7 @@ export default function (pluginArgs) {
140
145
  if (result.done === false) {
141
146
  const { handler, params, path } = result.value;
142
147
  const context = {
143
- request,
148
+ request: new Request(request.clone()),
144
149
  functionPath: workerContext.functionPath + path,
145
150
  next: pluginNext,
146
151
  params,
@@ -154,13 +159,9 @@ export default function (pluginArgs) {
154
159
 
155
160
  const response = await handler(context);
156
161
 
157
- // https://fetch.spec.whatwg.org/#null-body-status
158
- return new Response(
159
- [101, 204, 205, 304].includes(response.status) ? null : response.body,
160
- { ...response, headers: new Headers(response.headers) }
161
- );
162
+ return cloneResponse(response);
162
163
  } else {
163
- return next();
164
+ return next(request);
164
165
  }
165
166
  };
166
167
 
@@ -169,3 +170,11 @@ export default function (pluginArgs) {
169
170
 
170
171
  return onRequest;
171
172
  }
173
+
174
+ // This makes a Response mutable
175
+ const cloneResponse = (response: Response) =>
176
+ // https://fetch.spec.whatwg.org/#null-body-status
177
+ new Response(
178
+ [101, 204, 205, 304].includes(response.status) ? null : response.body,
179
+ response
180
+ );
@@ -1,31 +1,34 @@
1
- // @ts-expect-error
2
1
  import worker from "__ENTRY_POINT__";
3
2
  import {
4
3
  getAssetFromKV,
5
4
  NotFoundError,
6
5
  MethodNotAllowedError,
7
- // @ts-expect-error
6
+ serveSinglePageApp,
8
7
  } from "__KV_ASSET_HANDLER__";
9
- // @ts-expect-error
8
+ import type { Options, CacheControl } from "__KV_ASSET_HANDLER__";
10
9
  import manifest from "__STATIC_CONTENT_MANIFEST";
11
10
  import type * as kvAssetHandler from "@cloudflare/kv-asset-handler";
12
11
 
13
12
  const ASSET_MANIFEST = JSON.parse(manifest);
14
13
 
15
- // @ts-expect-error
16
14
  export * from "__ENTRY_POINT__";
17
15
 
18
- export default {
19
- async fetch(
20
- request: Request,
21
- env: { __STATIC_CONTENT: string },
22
- ctx: ExecutionContext
23
- ) {
24
- let options = {
16
+ // Injected as `esbuild` `define`s
17
+ declare global {
18
+ const __CACHE_CONTROL_OPTIONS__: Partial<CacheControl>;
19
+ const __SERVE_SINGLE_PAGE_APP__: boolean;
20
+ }
21
+
22
+ export default <ExportedHandler<{ __STATIC_CONTENT: KVNamespace }>>{
23
+ ...worker,
24
+ async fetch(request, env, ctx) {
25
+ let options: Partial<Options> = {
25
26
  ASSET_MANIFEST,
26
27
  ASSET_NAMESPACE: env.__STATIC_CONTENT,
27
28
  cacheControl: __CACHE_CONTROL_OPTIONS__,
28
- serveSinglePageApp: __SERVE_SINGLE_PAGE_APP__,
29
+ mapRequestToAsset: __SERVE_SINGLE_PAGE_APP__
30
+ ? serveSinglePageApp
31
+ : undefined,
29
32
  };
30
33
 
31
34
  try {
@@ -34,7 +37,7 @@ export default {
34
37
  )(
35
38
  {
36
39
  request,
37
- waitUntil(promise: Promise<unknown>) {
40
+ waitUntil(promise) {
38
41
  return ctx.waitUntil(promise);
39
42
  },
40
43
  },
@@ -54,7 +57,7 @@ export default {
54
57
  } catch (e) {
55
58
  if (e instanceof NotFoundError || e instanceof MethodNotAllowedError) {
56
59
  // if a known error is thrown then serve from actual worker
57
- return await worker.fetch(request, env, ctx);
60
+ return await worker.fetch?.(request, env, ctx);
58
61
  }
59
62
  // otherwise it's a real error, so throw it
60
63
  throw e;
@@ -4,6 +4,7 @@ const Workers = __WORKERS__;
4
4
  export * from "__ENTRY_POINT__";
5
5
 
6
6
  export default {
7
+ ...worker,
7
8
  async fetch(req, env, ctx) {
8
9
  const facadeEnv = { ...env };
9
10
  // For every Worker definition that's available,
@@ -0,0 +1,11 @@
1
+ // @ts-nocheck `@types/node` should NOT be included
2
+ Buffer.from("test");
3
+
4
+ // @ts-expect-error `@types/jest` should NOT be included
5
+ test("test");
6
+
7
+ // `@cloudflare/workers-types` should be included
8
+ const _handler: ExportedHandler = {};
9
+ new HTMLRewriter();
10
+
11
+ export {};
@@ -0,0 +1,105 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Enable incremental compilation */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
+ "lib": [
16
+ "es2021"
17
+ ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
18
+ "jsx": "react" /* Specify what JSX code is generated. */,
19
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
20
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
21
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
22
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
23
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
24
+ // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
25
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
26
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
27
+
28
+ /* Modules */
29
+ "module": "es2022" /* Specify what module code is generated. */,
30
+ // "rootDir": "./", /* Specify the root folder within your source files. */
31
+ "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
32
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
33
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
34
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
35
+ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
36
+ "types": [
37
+ "@cloudflare/workers-types"
38
+ ] /* Specify type package names to be included without being referenced in a source file. */,
39
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
40
+ "resolveJsonModule": true /* Enable importing .json files */,
41
+ // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
42
+
43
+ /* JavaScript Support */
44
+ "allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */,
45
+ "checkJs": false /* Enable error reporting in type-checked JavaScript files. */,
46
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
47
+
48
+ /* Emit */
49
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
50
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
51
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
52
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
53
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
54
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
55
+ // "removeComments": true, /* Disable emitting comments. */
56
+ "noEmit": true /* Disable emitting files from a compilation. */,
57
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
58
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
59
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
60
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
61
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
62
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
63
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
64
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
65
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
66
+ // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
67
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
68
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
69
+ // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
70
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
71
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
72
+
73
+ /* Interop Constraints */
74
+ "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
75
+ "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
76
+ // "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
77
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
78
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
79
+
80
+ /* Type Checking */
81
+ "strict": true /* Enable all strict type-checking options. */,
82
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
83
+ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
84
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
85
+ // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
86
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
87
+ // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
88
+ // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
89
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
90
+ // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
91
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
92
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
93
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
94
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
95
+ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
96
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
97
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
98
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
99
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
100
+
101
+ /* Completeness */
102
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
103
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
104
+ }
105
+ }
@@ -1,106 +1,8 @@
1
1
  {
2
+ "extends": "../tsconfig.json",
2
3
  "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
-
5
- /* Projects */
6
- // "incremental": true, /* Enable incremental compilation */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
- /* Language and Environment */
14
- "target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
- "lib": [
16
- "es2021"
17
- ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
18
- "jsx": "react" /* Specify what JSX code is generated. */,
19
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
20
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
21
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
22
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
23
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
24
- // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
25
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
26
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
27
-
28
- /* Modules */
29
- "module": "es2022" /* Specify what module code is generated. */,
30
- // "rootDir": "./", /* Specify the root folder within your source files. */
31
- "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
32
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
33
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
34
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
35
- // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
36
- "types": [
37
- "@cloudflare/workers-types",
38
- "jest"
39
- ] /* Specify type package names to be included without being referenced in a source file. */,
40
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
41
- "resolveJsonModule": true /* Enable importing .json files */,
42
- // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
43
-
44
- /* JavaScript Support */
45
- "allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */,
46
- "checkJs": false /* Enable error reporting in type-checked JavaScript files. */,
47
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
48
-
49
- /* Emit */
50
- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
51
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
52
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
53
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
54
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
55
- // "outDir": "./", /* Specify an output folder for all emitted files. */
56
- // "removeComments": true, /* Disable emitting comments. */
57
- "noEmit": true /* Disable emitting files from a compilation. */,
58
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
59
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
60
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
61
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
62
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
63
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
64
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
65
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
66
- // "newLine": "crlf", /* Set the newline character for emitting files. */
67
- // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
68
- // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
69
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
70
- // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
71
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
72
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
73
-
74
- /* Interop Constraints */
75
- "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
76
- "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
77
- // "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
78
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
79
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
80
-
81
- /* Type Checking */
82
- "strict": true /* Enable all strict type-checking options. */,
83
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
84
- // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
85
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
86
- // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
87
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
88
- // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
89
- // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
90
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
91
- // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
92
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
93
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
94
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
95
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
96
- // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
97
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
98
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
99
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
100
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
101
-
102
- /* Completeness */
103
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
104
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
105
- }
4
+ "types": ["@cloudflare/workers-types"]
5
+ },
6
+ "include": ["**/*.ts"],
7
+ "exclude": ["__tests__", "./init-tests/**"]
106
8
  }