wrangler 0.0.0-e33294b0 → 0.0.0-e351afcf

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 (127) hide show
  1. package/bin/wrangler.js +1 -1
  2. package/miniflare-dist/index.mjs +183 -92
  3. package/package.json +15 -10
  4. package/src/__tests__/api-devregistry.test.ts +121 -0
  5. package/src/__tests__/api.test.ts +27 -5
  6. package/src/__tests__/configuration.test.ts +294 -18
  7. package/src/__tests__/constellation.test.ts +371 -0
  8. package/src/__tests__/d1/execute.test.ts +3 -1
  9. package/src/__tests__/d1/migrate.test.ts +102 -0
  10. package/src/__tests__/delete.test.ts +6 -0
  11. package/src/__tests__/deployments.test.ts +335 -95
  12. package/src/__tests__/dev.test.tsx +87 -57
  13. package/src/__tests__/generate.test.ts +3 -4
  14. package/src/__tests__/guess-worker-format.test.ts +35 -0
  15. package/src/__tests__/helpers/mock-console.ts +6 -0
  16. package/src/__tests__/helpers/msw/handlers/deployments.ts +70 -3
  17. package/src/__tests__/helpers/msw/index.ts +4 -2
  18. package/src/__tests__/helpers/worker-scripts/parent-worker.js +4 -1
  19. package/src/__tests__/index.test.ts +14 -6
  20. package/src/__tests__/init.test.ts +136 -104
  21. package/src/__tests__/jest.setup.ts +4 -0
  22. package/src/__tests__/kv.test.ts +9 -9
  23. package/src/__tests__/logger.test.ts +68 -2
  24. package/src/__tests__/middleware.scheduled.test.ts +2 -2
  25. package/src/__tests__/middleware.test.ts +4 -3
  26. package/src/__tests__/mtls-certificates.test.ts +7 -3
  27. package/src/__tests__/pages/deployment-list.test.ts +2 -0
  28. package/src/__tests__/pages/functions-build.test.ts +159 -39
  29. package/src/__tests__/pages/project-list.test.ts +2 -0
  30. package/src/__tests__/pages/project-upload.test.ts +43 -24
  31. package/src/__tests__/pages/publish.test.ts +267 -148
  32. package/src/__tests__/publish.test.ts +1040 -339
  33. package/src/__tests__/pubsub.test.ts +3 -0
  34. package/src/__tests__/queues.test.ts +5 -2
  35. package/src/__tests__/test-old-node-version.js +3 -3
  36. package/src/__tests__/traverse-module-graph.test.ts +220 -0
  37. package/src/__tests__/tsconfig.tsbuildinfo +1 -1
  38. package/src/__tests__/type-generation.test.ts +1 -0
  39. package/src/__tests__/user.test.ts +2 -2
  40. package/src/__tests__/worker-namespace.test.ts +1 -0
  41. package/src/api/dev.ts +15 -22
  42. package/src/api/pages/create-worker-bundle-contents.ts +1 -0
  43. package/src/api/pages/publish.tsx +64 -61
  44. package/src/bundle.ts +51 -16
  45. package/src/config/environment.ts +36 -4
  46. package/src/config/index.ts +30 -2
  47. package/src/config/validation-helpers.ts +1 -1
  48. package/src/config/validation.ts +149 -5
  49. package/src/constellation/createProject.tsx +51 -0
  50. package/src/constellation/deleteProject.ts +51 -0
  51. package/src/constellation/deleteProjectModel.ts +68 -0
  52. package/src/constellation/index.ts +75 -0
  53. package/src/constellation/listCatalog.tsx +35 -0
  54. package/src/constellation/listModel.tsx +41 -0
  55. package/src/constellation/listProject.tsx +28 -0
  56. package/src/constellation/listRuntime.tsx +28 -0
  57. package/src/constellation/options.ts +17 -0
  58. package/src/constellation/types.ts +17 -0
  59. package/src/constellation/uploadModel.tsx +64 -0
  60. package/src/constellation/utils.ts +90 -0
  61. package/src/create-worker-preview.ts +19 -8
  62. package/src/create-worker-upload-form.ts +28 -3
  63. package/src/d1/backups.tsx +19 -15
  64. package/src/d1/create.tsx +45 -39
  65. package/src/d1/delete.ts +1 -1
  66. package/src/d1/execute.tsx +23 -20
  67. package/src/d1/list.tsx +14 -12
  68. package/src/d1/migrations/apply.tsx +36 -30
  69. package/src/d1/migrations/create.tsx +15 -12
  70. package/src/d1/migrations/helpers.ts +5 -8
  71. package/src/d1/migrations/list.tsx +10 -7
  72. package/src/deployments.ts +260 -8
  73. package/src/dev/dev.tsx +6 -4
  74. package/src/dev/local.tsx +65 -40
  75. package/src/dev/start-server.ts +57 -52
  76. package/src/dev/use-esbuild.ts +59 -52
  77. package/src/dev/validate-dev-props.ts +9 -0
  78. package/src/dev-registry.ts +2 -1
  79. package/src/dev.tsx +38 -18
  80. package/src/docs/helpers.ts +50 -0
  81. package/src/docs/index.ts +25 -68
  82. package/src/entry.ts +19 -9
  83. package/src/environment-variables/factory.ts +2 -1
  84. package/src/generate/index.ts +2 -2
  85. package/src/index.ts +87 -24
  86. package/src/init.ts +144 -134
  87. package/src/inspect.ts +16 -1
  88. package/src/kv/helpers.ts +7 -4
  89. package/src/logger.ts +23 -4
  90. package/src/metrics/send-event.ts +2 -1
  91. package/src/miniflare-cli/assets.ts +8 -7
  92. package/src/miniflare-cli/index.ts +3 -3
  93. package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -1
  94. package/src/module-collection.ts +92 -26
  95. package/src/pages/build.ts +290 -100
  96. package/src/pages/buildFunctions.ts +20 -10
  97. package/src/pages/deployments.tsx +3 -5
  98. package/src/pages/dev.ts +44 -26
  99. package/src/pages/errors.ts +1 -0
  100. package/src/pages/functions/buildPlugin.ts +57 -34
  101. package/src/pages/functions/buildWorker.ts +91 -31
  102. package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
  103. package/src/pages/projects.tsx +2 -5
  104. package/src/pages/publish.tsx +1 -10
  105. package/src/pages/upload.tsx +29 -9
  106. package/src/paths.ts +1 -1
  107. package/src/publish/index.ts +1 -1
  108. package/src/publish/publish.ts +29 -34
  109. package/src/queues/cli/commands/consumer/add.ts +6 -0
  110. package/src/queues/client.ts +1 -0
  111. package/src/r2/helpers.ts +1 -0
  112. package/src/secret/index.ts +2 -1
  113. package/src/sites.ts +164 -52
  114. package/src/traverse-module-graph.ts +53 -0
  115. package/src/type-generation.ts +1 -1
  116. package/src/user/user.ts +2 -1
  117. package/src/utils/render.ts +93 -0
  118. package/src/worker.ts +18 -1
  119. package/templates/d1-beta-facade.js +5 -2
  120. package/templates/gitignore +1 -0
  121. package/templates/middleware/middleware-miniflare3-json-error.ts +17 -5
  122. package/templates/pages-template-plugin.ts +7 -3
  123. package/templates/tsconfig.init.json +1 -2
  124. package/templates/tsconfig.tsbuildinfo +1 -1
  125. package/wrangler-dist/cli.d.ts +552 -16
  126. package/wrangler-dist/cli.js +32141 -24052
  127. package/src/__tests__/api-devregistry.test.js +0 -64
package/src/init.ts CHANGED
@@ -19,7 +19,10 @@ import { CommandLineArgsError, printWranglerBanner } from "./index";
19
19
 
20
20
  import type { RawConfig } from "./config";
21
21
  import type { Route, SimpleRoute } from "./config/environment";
22
- import type { WorkerMetadata } from "./create-worker-upload-form";
22
+ import type {
23
+ WorkerMetadata,
24
+ WorkerMetadataBinding,
25
+ } from "./create-worker-upload-form";
23
26
  import type { PackageManager } from "./package-manager";
24
27
  import type { PackageJSON } from "./parse";
25
28
  import type {
@@ -838,139 +841,7 @@ async function getWorkerConfig(
838
841
  );
839
842
  });
840
843
 
841
- const mappedBindings = bindings
842
- .filter((binding) => (binding.type as string) !== "secret_text")
843
- // Combine the same types into {[type]: [binding]}
844
- .reduce((configObj, binding) => {
845
- // Some types have different names in wrangler.toml
846
- // I want the type safety of the binding being destructured after the case narrowing the union but type is unused
847
-
848
- switch (binding.type) {
849
- case "plain_text":
850
- {
851
- configObj.vars = {
852
- ...(configObj.vars ?? {}),
853
- [binding.name]: binding.text,
854
- };
855
- }
856
- break;
857
- case "json":
858
- {
859
- configObj.vars = {
860
- ...(configObj.vars ?? {}),
861
- name: binding.name,
862
- json: binding.json,
863
- };
864
- }
865
- break;
866
- case "kv_namespace":
867
- {
868
- configObj.kv_namespaces = [
869
- ...(configObj.kv_namespaces ?? []),
870
- { id: binding.namespace_id, binding: binding.name },
871
- ];
872
- }
873
- break;
874
- case "durable_object_namespace":
875
- {
876
- configObj.durable_objects = {
877
- bindings: [
878
- ...(configObj.durable_objects?.bindings ?? []),
879
- {
880
- name: binding.name,
881
- class_name: binding.class_name,
882
- script_name: binding.script_name,
883
- environment: binding.environment,
884
- },
885
- ],
886
- };
887
- }
888
- break;
889
- case "r2_bucket":
890
- {
891
- configObj.r2_buckets = [
892
- ...(configObj.r2_buckets ?? []),
893
- { binding: binding.name, bucket_name: binding.bucket_name },
894
- ];
895
- }
896
- break;
897
- case "service":
898
- {
899
- configObj.services = [
900
- ...(configObj.services ?? []),
901
- {
902
- binding: binding.name,
903
- service: binding.service,
904
- environment: binding.environment,
905
- },
906
- ];
907
- }
908
- break;
909
- case "analytics_engine":
910
- {
911
- configObj.analytics_engine_datasets = [
912
- ...(configObj.analytics_engine_datasets ?? []),
913
- { binding: binding.name, dataset: binding.dataset },
914
- ];
915
- }
916
- break;
917
- case "dispatch_namespace":
918
- {
919
- configObj.dispatch_namespaces = [
920
- ...(configObj.dispatch_namespaces ?? []),
921
- { binding: binding.name, namespace: binding.namespace },
922
- ];
923
- }
924
- break;
925
- case "logfwdr":
926
- {
927
- configObj.logfwdr = {
928
- // TODO: Messaging about adding schema file path
929
- schema: "",
930
- bindings: [
931
- ...(configObj.logfwdr?.bindings ?? []),
932
- { name: binding.name, destination: binding.destination },
933
- ],
934
- };
935
- }
936
- break;
937
- case "wasm_module":
938
- {
939
- configObj.wasm_modules = {
940
- ...(configObj.wasm_modules ?? {}),
941
- [binding.name]: binding.part,
942
- };
943
- }
944
- break;
945
- case "text_blob":
946
- {
947
- configObj.text_blobs = {
948
- ...(configObj.text_blobs ?? {}),
949
- [binding.name]: binding.part,
950
- };
951
- }
952
- break;
953
- case "data_blob":
954
- {
955
- configObj.data_blobs = {
956
- ...(configObj.data_blobs ?? {}),
957
- [binding.name]: binding.part,
958
- };
959
- }
960
- break;
961
- default: {
962
- // If we don't know what the type is, its an unsafe binding
963
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
964
- if (!(binding as any)?.type) break;
965
- configObj.unsafe = {
966
- bindings: [...(configObj.unsafe?.bindings ?? []), binding],
967
- };
968
- }
969
- }
970
-
971
- return configObj;
972
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
973
- }, {} as RawConfig);
844
+ const mappedBindings = mapBindings(bindings);
974
845
 
975
846
  const durableObjectClassNames = bindings
976
847
  .filter((binding) => binding.type === "durable_object_namespace")
@@ -1020,3 +891,142 @@ async function getWorkerConfig(
1020
891
  ...mappedBindings,
1021
892
  };
1022
893
  }
894
+
895
+ export function mapBindings(bindings: WorkerMetadataBinding[]): RawConfig {
896
+ return (
897
+ bindings
898
+ .filter((binding) => (binding.type as string) !== "secret_text")
899
+ // Combine the same types into {[type]: [binding]}
900
+ .reduce((configObj, binding) => {
901
+ // Some types have different names in wrangler.toml
902
+ // I want the type safety of the binding being destructured after the case narrowing the union but type is unused
903
+
904
+ switch (binding.type) {
905
+ case "plain_text":
906
+ {
907
+ configObj.vars = {
908
+ ...(configObj.vars ?? {}),
909
+ [binding.name]: binding.text,
910
+ };
911
+ }
912
+ break;
913
+ case "json":
914
+ {
915
+ configObj.vars = {
916
+ ...(configObj.vars ?? {}),
917
+ name: binding.name,
918
+ json: binding.json,
919
+ };
920
+ }
921
+ break;
922
+ case "kv_namespace":
923
+ {
924
+ configObj.kv_namespaces = [
925
+ ...(configObj.kv_namespaces ?? []),
926
+ { id: binding.namespace_id, binding: binding.name },
927
+ ];
928
+ }
929
+ break;
930
+ case "durable_object_namespace":
931
+ {
932
+ configObj.durable_objects = {
933
+ bindings: [
934
+ ...(configObj.durable_objects?.bindings ?? []),
935
+ {
936
+ name: binding.name,
937
+ class_name: binding.class_name,
938
+ script_name: binding.script_name,
939
+ environment: binding.environment,
940
+ },
941
+ ],
942
+ };
943
+ }
944
+ break;
945
+ case "r2_bucket":
946
+ {
947
+ configObj.r2_buckets = [
948
+ ...(configObj.r2_buckets ?? []),
949
+ { binding: binding.name, bucket_name: binding.bucket_name },
950
+ ];
951
+ }
952
+ break;
953
+ case "service":
954
+ {
955
+ configObj.services = [
956
+ ...(configObj.services ?? []),
957
+ {
958
+ binding: binding.name,
959
+ service: binding.service,
960
+ environment: binding.environment,
961
+ },
962
+ ];
963
+ }
964
+ break;
965
+ case "analytics_engine":
966
+ {
967
+ configObj.analytics_engine_datasets = [
968
+ ...(configObj.analytics_engine_datasets ?? []),
969
+ { binding: binding.name, dataset: binding.dataset },
970
+ ];
971
+ }
972
+ break;
973
+ case "dispatch_namespace":
974
+ {
975
+ configObj.dispatch_namespaces = [
976
+ ...(configObj.dispatch_namespaces ?? []),
977
+ { binding: binding.name, namespace: binding.namespace },
978
+ ];
979
+ }
980
+ break;
981
+ case "logfwdr":
982
+ {
983
+ configObj.logfwdr = {
984
+ // TODO: Messaging about adding schema file path
985
+ schema: "",
986
+ bindings: [
987
+ ...(configObj.logfwdr?.bindings ?? []),
988
+ { name: binding.name, destination: binding.destination },
989
+ ],
990
+ };
991
+ }
992
+ break;
993
+ case "wasm_module":
994
+ {
995
+ configObj.wasm_modules = {
996
+ ...(configObj.wasm_modules ?? {}),
997
+ [binding.name]: binding.part,
998
+ };
999
+ }
1000
+ break;
1001
+ case "text_blob":
1002
+ {
1003
+ configObj.text_blobs = {
1004
+ ...(configObj.text_blobs ?? {}),
1005
+ [binding.name]: binding.part,
1006
+ };
1007
+ }
1008
+ break;
1009
+ case "data_blob":
1010
+ {
1011
+ configObj.data_blobs = {
1012
+ ...(configObj.data_blobs ?? {}),
1013
+ [binding.name]: binding.part,
1014
+ };
1015
+ }
1016
+ break;
1017
+ default: {
1018
+ // If we don't know what the type is, its an unsafe binding
1019
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1020
+ if (!(binding as any)?.type) break;
1021
+ configObj.unsafe = {
1022
+ bindings: [...(configObj.unsafe?.bindings ?? []), binding],
1023
+ metadata: configObj.unsafe?.metadata ?? undefined,
1024
+ };
1025
+ }
1026
+ }
1027
+
1028
+ return configObj;
1029
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1030
+ }, {} as RawConfig)
1031
+ );
1032
+ }
package/src/inspect.ts CHANGED
@@ -151,6 +151,18 @@ export default function useInspector(props: InspectorProps) {
151
151
  );
152
152
  ws.close(1013, "Too many clients; only one can be connected at a time");
153
153
  } else {
154
+ // Since Wrangler proxies the inspector, reloading Chrome DevTools won't trigger debugger initialisation events (because it's connecting to an extant session).
155
+ // This sends a `Debugger.disable` message to the remote when a new WebSocket connection is initialised,
156
+ // with the assumption that the new connection will shortly send a `Debugger.enable` event and trigger re-initialisation.
157
+ // The key initialisation messages that are needed are the `Debugger.scriptParsed events`.
158
+ remoteWebSocket?.send(
159
+ JSON.stringify({
160
+ // This number is arbitrary, and is chosen to be high so as not to conflict with messages that DevTools might actually send.
161
+ // For completeness, these options don't work: 0, -1, or Number.MAX_SAFE_INTEGER
162
+ id: 100_000_000,
163
+ method: "Debugger.disable",
164
+ })
165
+ );
154
166
  // As promised, save the created websocket in a state hook
155
167
  setLocalWebSocket(ws);
156
168
 
@@ -733,7 +745,7 @@ function logConsoleMessage(evt: Protocol.Runtime.ConsoleAPICalledEvent): void {
733
745
  * Opens the chrome debugger
734
746
  */
735
747
  export const openInspector = async (inspectorPort: number) => {
736
- const url = `https://built-devtools.pages.dev/js_app?experiments=true&v8only=true&ws=localhost:${inspectorPort}/ws`;
748
+ const url = `https://devtools.devprod.cloudflare.dev/js_app?theme=systemPreferred&ws=localhost:${inspectorPort}/ws`;
737
749
  const errorMessage =
738
750
  "Failed to open inspector.\nInspector depends on having a Chromium-based browser installed, maybe you need to install one?";
739
751
 
@@ -759,6 +771,9 @@ export const openInspector = async (inspectorPort: number) => {
759
771
  {
760
772
  name: open.apps.edge,
761
773
  },
774
+ {
775
+ name: open.apps.firefox,
776
+ },
762
777
  ],
763
778
  });
764
779
  childProcess.on("error", () => {
package/src/kv/helpers.ts CHANGED
@@ -8,7 +8,7 @@ import type { Config } from "../config";
8
8
  const API_MAX = 10000;
9
9
  // The const below are halved from the API's true capacity to help avoid
10
10
  // hammering it with large requests.
11
- const BATCH_KEY_MAX = API_MAX / 2;
11
+ export const BATCH_KEY_MAX = API_MAX / 2;
12
12
 
13
13
  type KvArgs = {
14
14
  binding?: string;
@@ -256,7 +256,7 @@ export async function deleteKVKeyValue(
256
256
  /**
257
257
  * Formatter for converting e.g. 5328 --> 5,328
258
258
  */
259
- const formatNumber = new Intl.NumberFormat("en-US", {
259
+ export const formatNumber = new Intl.NumberFormat("en-US", {
260
260
  notation: "standard",
261
261
  }).format;
262
262
 
@@ -279,7 +279,8 @@ export async function putKVBulkKeyValue(
279
279
  accountId: string,
280
280
  namespaceId: string,
281
281
  keyValues: KeyValue[],
282
- quiet = false
282
+ quiet = false,
283
+ abortSignal?: AbortSignal
283
284
  ) {
284
285
  for (let index = 0; index < keyValues.length; index += BATCH_KEY_MAX) {
285
286
  if (!quiet && keyValues.length > BATCH_KEY_MAX) {
@@ -292,7 +293,9 @@ export async function putKVBulkKeyValue(
292
293
  method: "PUT",
293
294
  body: JSON.stringify(keyValues.slice(index, index + BATCH_KEY_MAX)),
294
295
  headers: { "Content-Type": "application/json" },
295
- }
296
+ },
297
+ undefined,
298
+ abortSignal
296
299
  );
297
300
  }
298
301
 
package/src/logger.ts CHANGED
@@ -26,15 +26,30 @@ const LOGGER_LEVEL_FORMAT_TYPE_MAP = {
26
26
 
27
27
  const getLogLevelFromEnv = getEnvironmentVariableFactory({
28
28
  variableName: "WRANGLER_LOG",
29
- defaultValue: () => "log",
30
29
  });
31
30
 
31
+ function getLoggerLevel(): LoggerLevel {
32
+ const fromEnv = getLogLevelFromEnv()?.toLowerCase();
33
+ if (fromEnv !== undefined) {
34
+ if (fromEnv in LOGGER_LEVELS) return fromEnv as LoggerLevel;
35
+ const expected = Object.keys(LOGGER_LEVELS)
36
+ .map((level) => `"${level}"`)
37
+ .join(" | ");
38
+ console.warn(
39
+ `Unrecognised WRANGLER_LOG value ${JSON.stringify(
40
+ fromEnv
41
+ )}, expected ${expected}, defaulting to "log"...`
42
+ );
43
+ }
44
+ return "log";
45
+ }
46
+
32
47
  export type TableRow<Keys extends string> = Record<Keys, string>;
33
48
 
34
- class Logger {
49
+ export class Logger {
35
50
  constructor() {}
36
51
 
37
- loggerLevel: LoggerLevel = (getLogLevelFromEnv() as LoggerLevel) ?? "log";
52
+ loggerLevel = getLoggerLevel();
38
53
  columns = process.stdout.columns;
39
54
 
40
55
  debug = (...args: unknown[]) => this.doLog("debug", args);
@@ -46,7 +61,11 @@ class Logger {
46
61
  const keys: Keys[] =
47
62
  data.length === 0 ? [] : (Object.keys(data[0]) as Keys[]);
48
63
  const t = new CLITable({
49
- head: keys.map((k) => chalk.bold.blue(k)),
64
+ head: keys,
65
+ style: {
66
+ head: chalk.level ? ["blue"] : [],
67
+ border: chalk.level ? ["gray"] : [],
68
+ },
50
69
  });
51
70
  t.push(...data.map((row) => keys.map((k) => row[k])));
52
71
  return this.doLog("log", [t.toString()]);
@@ -57,7 +57,8 @@ export type EventNames =
57
57
  | "run dev (api)"
58
58
  | "run pages dev"
59
59
  | "view docs"
60
- | "view deployments";
60
+ | "view deployments"
61
+ | "rollback deployments";
61
62
 
62
63
  /**
63
64
  * Send a metrics event, with no extra properties, to Cloudflare, if usage tracking is enabled.
@@ -12,9 +12,10 @@ import type {
12
12
  ParsedHeaders,
13
13
  } from "@cloudflare/pages-shared/metadata-generator/types";
14
14
  import type {
15
- RequestInfo as TreRequestInfo,
16
- RequestInit as TreRequestInit,
17
- } from "@miniflare/tre";
15
+ Request as MiniflareRequest,
16
+ RequestInfo as MiniflareRequestInfo,
17
+ RequestInit as MiniflareRequestInit,
18
+ } from "@miniflare/core";
18
19
 
19
20
  interface Logger {
20
21
  log: (message: string) => void;
@@ -39,7 +40,7 @@ export default async function generateASSETSBinding(options: Options) {
39
40
  ? await import("@miniflare/tre")
40
41
  : await import("@miniflare/core");
41
42
 
42
- const Request = miniflare.Request;
43
+ const Request = miniflare.Request as typeof MiniflareRequest;
43
44
  const Response = miniflare.Response;
44
45
  // WebSockets won't work with `--experimental-local` until we expose something like `upgradingFetch` from `@miniflare/tre`.
45
46
  const fetch = (
@@ -108,7 +109,7 @@ async function generateAssetsFetch(
108
109
  const miniflare = tre
109
110
  ? await import("@miniflare/tre")
110
111
  : await import("@miniflare/core");
111
- const Request = miniflare.Request;
112
+ const Request = miniflare.Request as typeof MiniflareRequest;
112
113
 
113
114
  const { generateHandler, parseQualityWeightedList } = await import(
114
115
  "@cloudflare/pages-shared/asset-server/handler"
@@ -237,10 +238,10 @@ async function generateAssetsFetch(
237
238
  });
238
239
  };
239
240
 
240
- return (async (input: TreRequestInfo, init?: TreRequestInit) => {
241
+ return async (input: MiniflareRequestInfo, init?: MiniflareRequestInit) => {
241
242
  const request = new Request(input, init);
242
243
  return await generateResponse(request as unknown as Request);
243
- }) as typeof fetch;
244
+ };
244
245
  }
245
246
 
246
247
  const invalidAssetsFetch: typeof fetch = () => {
@@ -1,8 +1,8 @@
1
- import { fetch } from "@miniflare/core";
2
1
  import {
3
2
  DurableObjectNamespace,
4
3
  DurableObjectStub,
5
4
  } from "@miniflare/durable-objects";
5
+ import { upgradingFetch } from "@miniflare/web-sockets";
6
6
  import {
7
7
  Log as MiniflareLog,
8
8
  LogLevel as MiniflareLogLevel,
@@ -47,7 +47,7 @@ async function main() {
47
47
  config.log =
48
48
  logLevel === MiniflareLogLevel.NONE
49
49
  ? new MiniflareNoOpLog()
50
- : new MiniflareLog(logLevel, config.logOptions);
50
+ : new MiniflareLog(logLevel);
51
51
 
52
52
  if (logLevel === MiniflareLogLevel.DEBUG) {
53
53
  console.log("MINIFLARE OPTIONS:\n", JSON.stringify(config, null, 2));
@@ -87,7 +87,7 @@ async function main() {
87
87
  id.toString()
88
88
  );
89
89
 
90
- return fetch(request);
90
+ return upgradingFetch(request);
91
91
  };
92
92
  return stub;
93
93
  };