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
@@ -179,6 +179,9 @@ function mergeHeaders(base, extra) {
179
179
  ...Object.fromEntries(extra.entries())
180
180
  });
181
181
  }
182
+ function stripLeadingDoubleSlashes(location) {
183
+ return location.replace(/^(\/|%2F|%2f|%5C|%5c|%09|\s|\\)+(.*)/, "/$2");
184
+ }
182
185
  var OkResponse, MovedPermanentlyResponse, FoundResponse, NotModifiedResponse, PermanentRedirectResponse, NotFoundResponse, MethodNotAllowedResponse, NotAcceptableResponse, InternalServerErrorResponse, SeeOtherResponse, TemporaryRedirectResponse;
183
186
  var init_responses = __esm({
184
187
  "../pages-shared/asset-server/responses.ts"() {
@@ -192,7 +195,12 @@ var init_responses = __esm({
192
195
  }
193
196
  };
194
197
  MovedPermanentlyResponse = class extends Response {
195
- constructor(location, init) {
198
+ constructor(location, init, {
199
+ preventLeadingDoubleSlash = true
200
+ } = {
201
+ preventLeadingDoubleSlash: true
202
+ }) {
203
+ location = preventLeadingDoubleSlash ? stripLeadingDoubleSlashes(location) : location;
196
204
  super(`Redirecting to ${location}`, {
197
205
  ...init,
198
206
  status: 301,
@@ -204,7 +212,12 @@ var init_responses = __esm({
204
212
  }
205
213
  };
206
214
  FoundResponse = class extends Response {
207
- constructor(location, init) {
215
+ constructor(location, init, {
216
+ preventLeadingDoubleSlash = true
217
+ } = {
218
+ preventLeadingDoubleSlash: true
219
+ }) {
220
+ location = preventLeadingDoubleSlash ? stripLeadingDoubleSlashes(location) : location;
208
221
  super(`Redirecting to ${location}`, {
209
222
  ...init,
210
223
  status: 302,
@@ -224,7 +237,12 @@ var init_responses = __esm({
224
237
  }
225
238
  };
226
239
  PermanentRedirectResponse = class extends Response {
227
- constructor(location, init) {
240
+ constructor(location, init, {
241
+ preventLeadingDoubleSlash = true
242
+ } = {
243
+ preventLeadingDoubleSlash: true
244
+ }) {
245
+ location = preventLeadingDoubleSlash ? stripLeadingDoubleSlashes(location) : location;
228
246
  super(void 0, {
229
247
  ...init,
230
248
  status: 308,
@@ -278,7 +296,12 @@ ${err.stack}`;
278
296
  }
279
297
  };
280
298
  SeeOtherResponse = class extends Response {
281
- constructor(location, init) {
299
+ constructor(location, init, {
300
+ preventLeadingDoubleSlash = true
301
+ } = {
302
+ preventLeadingDoubleSlash: true
303
+ }) {
304
+ location = preventLeadingDoubleSlash ? stripLeadingDoubleSlashes(location) : location;
282
305
  super(`Redirecting to ${location}`, {
283
306
  ...init,
284
307
  status: 303,
@@ -288,7 +311,12 @@ ${err.stack}`;
288
311
  }
289
312
  };
290
313
  TemporaryRedirectResponse = class extends Response {
291
- constructor(location, init) {
314
+ constructor(location, init, {
315
+ preventLeadingDoubleSlash = true
316
+ } = {
317
+ preventLeadingDoubleSlash: true
318
+ }) {
319
+ location = preventLeadingDoubleSlash ? stripLeadingDoubleSlashes(location) : location;
292
320
  super(`Redirecting to ${location}`, {
293
321
  ...init,
294
322
  status: 307,
@@ -351,15 +379,6 @@ var init_rulesEngine = __esm({
351
379
  }
352
380
  });
353
381
 
354
- // ../pages-shared/asset-server/url.ts
355
- function stringifyURLToRootRelativePathname(url) {
356
- return `${url.pathname}${url.search}${url.hash}`;
357
- }
358
- var init_url = __esm({
359
- "../pages-shared/asset-server/url.ts"() {
360
- }
361
- });
362
-
363
382
  // ../pages-shared/asset-server/handler.ts
364
383
  var handler_exports = {};
365
384
  __export(handler_exports, {
@@ -370,7 +389,6 @@ __export(handler_exports, {
370
389
  HEADERS_VERSION_V1: () => HEADERS_VERSION_V1,
371
390
  REDIRECTS_VERSION: () => REDIRECTS_VERSION2,
372
391
  generateHandler: () => generateHandler,
373
- getResponseFromMatch: () => getResponseFromMatch,
374
392
  normaliseHeaders: () => normaliseHeaders,
375
393
  parseQualityWeightedList: () => parseQualityWeightedList
376
394
  });
@@ -441,7 +459,36 @@ async function generateHandler({
441
459
  async function generateResponse() {
442
460
  const match = staticRedirectsMatcher() || generateRedirectsMatcher()({ request })[0];
443
461
  if (match) {
444
- return getResponseFromMatch(match, url);
462
+ if (match.status === 200) {
463
+ pathname = new URL(match.to, request.url).pathname;
464
+ } else {
465
+ const { status, to } = match;
466
+ const destination = new URL(to, request.url);
467
+ const location = destination.origin === new URL(request.url).origin ? `${destination.pathname}${destination.search || search}${destination.hash}` : `${destination.href}${destination.search ? "" : search}${destination.hash}`;
468
+ switch (status) {
469
+ case 301:
470
+ return new MovedPermanentlyResponse(location, void 0, {
471
+ preventLeadingDoubleSlash: false
472
+ });
473
+ case 303:
474
+ return new SeeOtherResponse(location, void 0, {
475
+ preventLeadingDoubleSlash: false
476
+ });
477
+ case 307:
478
+ return new TemporaryRedirectResponse(location, void 0, {
479
+ preventLeadingDoubleSlash: false
480
+ });
481
+ case 308:
482
+ return new PermanentRedirectResponse(location, void 0, {
483
+ preventLeadingDoubleSlash: false
484
+ });
485
+ case 302:
486
+ default:
487
+ return new FoundResponse(location, void 0, {
488
+ preventLeadingDoubleSlash: false
489
+ });
490
+ }
491
+ }
445
492
  }
446
493
  if (!request.method.match(/^(get|head)$/i)) {
447
494
  return new MethodNotAllowedResponse();
@@ -720,27 +767,6 @@ async function generateHandler({
720
767
  );
721
768
  }
722
769
  }
723
- function getResponseFromMatch({
724
- status,
725
- to
726
- }, requestUrl) {
727
- const destination = new URL(to, requestUrl);
728
- destination.search = destination.search || requestUrl.search;
729
- const location = destination.origin === requestUrl.origin ? stringifyURLToRootRelativePathname(destination) : destination.toString();
730
- switch (status) {
731
- case 301:
732
- return new MovedPermanentlyResponse(location);
733
- case 303:
734
- return new SeeOtherResponse(location);
735
- case 307:
736
- return new TemporaryRedirectResponse(location);
737
- case 308:
738
- return new PermanentRedirectResponse(location);
739
- case 302:
740
- default:
741
- return new FoundResponse(location);
742
- }
743
- }
744
770
  function parseQualityWeightedList(list = "") {
745
771
  const items = {};
746
772
  list.replace(/\s/g, "").split(",").forEach((el) => {
@@ -766,7 +792,6 @@ var init_handler = __esm({
766
792
  "../pages-shared/asset-server/handler.ts"() {
767
793
  init_responses();
768
794
  init_rulesEngine();
769
- init_url();
770
795
  ASSET_PRESERVATION_CACHE = "assetPreservationCache";
771
796
  CACHE_CONTROL_PRESERVATION = "public, s-maxage=604800";
772
797
  CACHE_CONTROL_BROWSER = "public, max-age=0, must-revalidate";
@@ -779,11 +804,11 @@ var init_handler = __esm({
779
804
  });
780
805
 
781
806
  // src/miniflare-cli/index.ts
782
- import { fetch } from "@miniflare/core";
783
807
  import {
784
808
  DurableObjectNamespace,
785
809
  DurableObjectStub
786
810
  } from "@miniflare/durable-objects";
811
+ import { upgradingFetch } from "@miniflare/web-sockets";
787
812
  import {
788
813
  Log as MiniflareLog,
789
814
  LogLevel as MiniflareLogLevel,
@@ -795,7 +820,7 @@ import {
795
820
  // ../../node_modules/yargs/lib/platform-shims/esm.mjs
796
821
  import { notStrictEqual, strictEqual } from "assert";
797
822
 
798
- // ../../node_modules/cliui/build/lib/index.js
823
+ // ../../node_modules/yargs/node_modules/cliui/build/lib/index.js
799
824
  var align = {
800
825
  right: alignRight,
801
826
  center: alignCenter
@@ -806,9 +831,9 @@ var bottom = 2;
806
831
  var left = 3;
807
832
  var UI = class {
808
833
  constructor(opts) {
809
- var _a;
834
+ var _a2;
810
835
  this.width = opts.width;
811
- this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
836
+ this.wrap = (_a2 = opts.wrap) !== null && _a2 !== void 0 ? _a2 : true;
812
837
  this.rows = [];
813
838
  }
814
839
  span(...args) {
@@ -1049,7 +1074,7 @@ function cliui(opts, _mixin) {
1049
1074
  });
1050
1075
  }
1051
1076
 
1052
- // ../../node_modules/cliui/build/lib/string-utils.js
1077
+ // ../../node_modules/yargs/node_modules/cliui/build/lib/string-utils.js
1053
1078
  var ansi = new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)", "g");
1054
1079
  function stripAnsi(str) {
1055
1080
  return str.replace(ansi, "");
@@ -1070,7 +1095,7 @@ function wrap(str, width) {
1070
1095
  return wrapped;
1071
1096
  }
1072
1097
 
1073
- // ../../node_modules/cliui/index.mjs
1098
+ // ../../node_modules/yargs/node_modules/cliui/index.mjs
1074
1099
  function ui(opts) {
1075
1100
  return cliui(opts, {
1076
1101
  stringWidth: (str) => {
@@ -1361,9 +1386,9 @@ var YargsParser = class {
1361
1386
  let m;
1362
1387
  let next;
1363
1388
  let value;
1364
- if (arg !== "--" && isUnknownOptionAsArg(arg)) {
1389
+ if (arg !== "--" && /^-/.test(arg) && isUnknownOptionAsArg(arg)) {
1365
1390
  pushPositional(arg);
1366
- } else if (truncatedArg.match(/---+(=|$)/)) {
1391
+ } else if (truncatedArg.match(/^---+(=|$)/)) {
1367
1392
  pushPositional(arg);
1368
1393
  continue;
1369
1394
  } else if (arg.match(/^--.+=/) || !configuration["short-option-groups"] && arg.match(/^-.+=/)) {
@@ -2046,9 +2071,13 @@ function stripQuotes(val) {
2046
2071
 
2047
2072
  // ../../node_modules/yargs/node_modules/yargs-parser/build/lib/index.js
2048
2073
  import { readFileSync } from "fs";
2074
+ var _a;
2075
+ var _b;
2076
+ var _c;
2049
2077
  var minNodeVersion = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12;
2050
- if (process && process.version) {
2051
- const major = Number(process.version.match(/v([^.]+)/)[1]);
2078
+ var nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1);
2079
+ if (nodeVersion) {
2080
+ const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
2052
2081
  if (major < minNodeVersion) {
2053
2082
  throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
2054
2083
  }
@@ -2111,7 +2140,9 @@ var YError = class extends Error {
2111
2140
  constructor(msg) {
2112
2141
  super(msg || "yargs error");
2113
2142
  this.name = "YError";
2114
- Error.captureStackTrace(this, YError);
2143
+ if (Error.captureStackTrace) {
2144
+ Error.captureStackTrace(this, YError);
2145
+ }
2115
2146
  }
2116
2147
  };
2117
2148
 
@@ -2311,7 +2342,7 @@ try {
2311
2342
  } catch (e) {
2312
2343
  __dirname = process.cwd();
2313
2344
  }
2314
- var mainFilename = __dirname.split("node_modules")[0];
2345
+ var mainFilename = __dirname.substring(0, __dirname.lastIndexOf("node_modules"));
2315
2346
  var esm_default = {
2316
2347
  assert: {
2317
2348
  notStrictEqual,
@@ -2696,6 +2727,7 @@ var CommandInstance = class {
2696
2727
  const builder = commandHandler.builder;
2697
2728
  let innerYargs = yargs;
2698
2729
  if (isCommandBuilderCallback(builder)) {
2730
+ yargs.getInternalMethods().getUsageInstance().freeze();
2699
2731
  const builderOutput = builder(yargs.getInternalMethods().reset(aliases), helpOrVersionSet);
2700
2732
  if (isPromise(builderOutput)) {
2701
2733
  return builderOutput.then((output) => {
@@ -2704,6 +2736,7 @@ var CommandInstance = class {
2704
2736
  });
2705
2737
  }
2706
2738
  } else if (isCommandBuilderOptionDefinitions(builder)) {
2739
+ yargs.getInternalMethods().getUsageInstance().freeze();
2707
2740
  innerYargs = yargs.getInternalMethods().reset(aliases);
2708
2741
  Object.keys(commandHandler.builder).forEach((key) => {
2709
2742
  innerYargs.option(key, builder[key]);
@@ -2737,15 +2770,7 @@ var CommandInstance = class {
2737
2770
  pc.push(c);
2738
2771
  return `$0 ${pc.join(" ")}`;
2739
2772
  }
2740
- applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, helpOnly, aliases, yargs) {
2741
- let positionalMap = {};
2742
- if (helpOnly)
2743
- return innerArgv;
2744
- if (!yargs.getInternalMethods().getHasOutput()) {
2745
- positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs);
2746
- }
2747
- const middlewares = this.globalMiddleware.getMiddleware().slice(0).concat(commandHandler.middlewares);
2748
- innerArgv = applyMiddleware(innerArgv, yargs, middlewares, true);
2773
+ handleValidationAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, aliases, yargs, middlewares, positionalMap) {
2749
2774
  if (!yargs.getInternalMethods().getHasOutput()) {
2750
2775
  const validation2 = yargs.getInternalMethods().runValidation(aliases, positionalMap, yargs.parsed.error, isDefaultCommand);
2751
2776
  innerArgv = maybeAsyncResult(innerArgv, (result) => {
@@ -2780,6 +2805,17 @@ var CommandInstance = class {
2780
2805
  }
2781
2806
  return innerArgv;
2782
2807
  }
2808
+ applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, helpOnly, aliases, yargs) {
2809
+ let positionalMap = {};
2810
+ if (helpOnly)
2811
+ return innerArgv;
2812
+ if (!yargs.getInternalMethods().getHasOutput()) {
2813
+ positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs);
2814
+ }
2815
+ const middlewares = this.globalMiddleware.getMiddleware().slice(0).concat(commandHandler.middlewares);
2816
+ const maybePromiseArgv = applyMiddleware(innerArgv, yargs, middlewares, true);
2817
+ return isPromise(maybePromiseArgv) ? maybePromiseArgv.then((resolvedInnerArgv) => this.handleValidationAndGetResult(isDefaultCommand, commandHandler, resolvedInnerArgv, currentContext, aliases, yargs, middlewares, positionalMap)) : this.handleValidationAndGetResult(isDefaultCommand, commandHandler, maybePromiseArgv, currentContext, aliases, yargs, middlewares, positionalMap);
2818
+ }
2783
2819
  populatePositionals(commandHandler, argv, context, yargs) {
2784
2820
  argv._ = argv._.slice(context.commands.length);
2785
2821
  const demanded = commandHandler.demanded.slice(0);
@@ -2866,12 +2902,11 @@ var CommandInstance = class {
2866
2902
  Object.keys(positionalMap).forEach((key) => {
2867
2903
  positionalKeys.push(...parsed.aliases[key]);
2868
2904
  });
2869
- const defaults = yargs.getOptions().default;
2870
2905
  Object.keys(parsed.argv).forEach((key) => {
2871
2906
  if (positionalKeys.includes(key)) {
2872
2907
  if (!positionalMap[key])
2873
2908
  positionalMap[key] = parsed.argv[key];
2874
- if (!Object.hasOwnProperty.call(defaults, key) && Object.hasOwnProperty.call(argv, key) && Object.hasOwnProperty.call(parsed.argv, key) && (Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))) {
2909
+ if (!this.isInConfigs(yargs, key) && !this.isDefaulted(yargs, key) && Object.prototype.hasOwnProperty.call(argv, key) && Object.prototype.hasOwnProperty.call(parsed.argv, key) && (Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))) {
2875
2910
  argv[key] = [].concat(argv[key], parsed.argv[key]);
2876
2911
  } else {
2877
2912
  argv[key] = parsed.argv[key];
@@ -2880,6 +2915,14 @@ var CommandInstance = class {
2880
2915
  });
2881
2916
  }
2882
2917
  }
2918
+ isDefaulted(yargs, key) {
2919
+ const { default: defaults } = yargs.getOptions();
2920
+ return Object.prototype.hasOwnProperty.call(defaults, key) || Object.prototype.hasOwnProperty.call(defaults, this.shim.Parser.camelCase(key));
2921
+ }
2922
+ isInConfigs(yargs, key) {
2923
+ const { configObjects } = yargs.getOptions();
2924
+ return configObjects.some((c) => Object.prototype.hasOwnProperty.call(c, key)) || configObjects.some((c) => Object.prototype.hasOwnProperty.call(c, this.shim.Parser.camelCase(key)));
2925
+ }
2883
2926
  runDefaultBuilderOn(yargs) {
2884
2927
  if (!this.defaultCommand)
2885
2928
  return;
@@ -3107,13 +3150,16 @@ function usage(yargs, shim3) {
3107
3150
  wrapSet = true;
3108
3151
  wrap2 = cols;
3109
3152
  };
3110
- function getWrap() {
3153
+ self.getWrap = () => {
3154
+ if (shim3.getEnv("YARGS_DISABLE_WRAP")) {
3155
+ return null;
3156
+ }
3111
3157
  if (!wrapSet) {
3112
3158
  wrap2 = windowWidth();
3113
3159
  wrapSet = true;
3114
3160
  }
3115
3161
  return wrap2;
3116
- }
3162
+ };
3117
3163
  const deferY18nLookupPrefix = "__yargsString__:";
3118
3164
  self.deferY18nLookup = (str) => deferY18nLookupPrefix + str;
3119
3165
  self.help = function help() {
@@ -3137,7 +3183,7 @@ function usage(yargs, shim3) {
3137
3183
  acc[key] = true;
3138
3184
  return acc;
3139
3185
  }, {}));
3140
- const theWrap = getWrap();
3186
+ const theWrap = self.getWrap();
3141
3187
  const ui2 = shim3.cliui({
3142
3188
  width: theWrap,
3143
3189
  wrap: !!theWrap
@@ -3277,7 +3323,8 @@ function usage(yargs, shim3) {
3277
3323
  padding: [0, 2, 0, 2 + getIndentation(kswitch)],
3278
3324
  width: maxWidth(switches, theWrap) + 4
3279
3325
  }, desc);
3280
- if (extra)
3326
+ const shouldHideOptionExtras = yargs.getInternalMethods().getUsageConfiguration()["hide-types"] === true;
3327
+ if (extra && !shouldHideOptionExtras)
3281
3328
  ui2.div({ text: extra, padding: [0, 0, 0, 2], align: "right" });
3282
3329
  else
3283
3330
  ui2.div();
@@ -3538,7 +3585,7 @@ var completionZshTemplate = `#compdef {{app_name}}
3538
3585
  # yargs command completion script
3539
3586
  #
3540
3587
  # Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
3541
- # or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.
3588
+ # or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
3542
3589
  #
3543
3590
  _{{app_name}}_yargs_completions()
3544
3591
  {
@@ -3556,7 +3603,7 @@ compdef _{{app_name}}_yargs_completions {{app_name}}
3556
3603
  // ../../node_modules/yargs/build/lib/completion.js
3557
3604
  var Completion = class {
3558
3605
  constructor(yargs, usage2, command2, shim3) {
3559
- var _a, _b, _c;
3606
+ var _a2, _b2, _c2;
3560
3607
  this.yargs = yargs;
3561
3608
  this.usage = usage2;
3562
3609
  this.command = command2;
@@ -3565,7 +3612,7 @@ var Completion = class {
3565
3612
  this.aliases = null;
3566
3613
  this.customCompletionFunction = null;
3567
3614
  this.indexAfterLastReset = 0;
3568
- this.zshShell = (_c = ((_a = this.shim.getEnv("SHELL")) === null || _a === void 0 ? void 0 : _a.includes("zsh")) || ((_b = this.shim.getEnv("ZSH_NAME")) === null || _b === void 0 ? void 0 : _b.includes("zsh"))) !== null && _c !== void 0 ? _c : false;
3615
+ this.zshShell = (_c2 = ((_a2 = this.shim.getEnv("SHELL")) === null || _a2 === void 0 ? void 0 : _a2.includes("zsh")) || ((_b2 = this.shim.getEnv("ZSH_NAME")) === null || _b2 === void 0 ? void 0 : _b2.includes("zsh"))) !== null && _c2 !== void 0 ? _c2 : false;
3569
3616
  }
3570
3617
  defaultCompletion(args, argv, current, done) {
3571
3618
  const handlers = this.command.getCommandHandlers();
@@ -3610,7 +3657,7 @@ var Completion = class {
3610
3657
  Object.keys(options.key).forEach((key) => {
3611
3658
  const negable = !!options.configuration["boolean-negation"] && options.boolean.includes(key);
3612
3659
  const isPositionalKey = positionalKeys.includes(key);
3613
- if (!isPositionalKey && !options.hiddenOptions.includes(key) && !this.argsContainKey(args, argv, key, negable)) {
3660
+ if (!isPositionalKey && !options.hiddenOptions.includes(key) && !this.argsContainKey(args, key, negable)) {
3614
3661
  this.completeOptionKey(key, completions, current);
3615
3662
  if (negable && !!options.default[key])
3616
3663
  this.completeOptionKey(`no-${key}`, completions, current);
@@ -3675,20 +3722,22 @@ var Completion = class {
3675
3722
  const choices = this.getPreviousArgChoices(args);
3676
3723
  return choices !== void 0 && choices.length > 0;
3677
3724
  }
3678
- argsContainKey(args, argv, key, negable) {
3679
- if (args.indexOf(`--${key}`) !== -1)
3725
+ argsContainKey(args, key, negable) {
3726
+ const argsContains = (s) => args.indexOf((/^[^0-9]$/.test(s) ? "-" : "--") + s) !== -1;
3727
+ if (argsContains(key))
3680
3728
  return true;
3681
- if (negable && args.indexOf(`--no-${key}`) !== -1)
3729
+ if (negable && argsContains(`no-${key}`))
3682
3730
  return true;
3683
3731
  if (this.aliases) {
3684
3732
  for (const alias of this.aliases[key]) {
3685
- if (argv[alias] !== void 0)
3733
+ if (argsContains(alias))
3686
3734
  return true;
3687
3735
  }
3688
3736
  }
3689
3737
  return false;
3690
3738
  }
3691
3739
  completeOptionKey(key, completions, current) {
3740
+ var _a2, _b2, _c2;
3692
3741
  const descs = this.usage.getDescriptions();
3693
3742
  const startsByTwoDashes = (s) => /^--/.test(s);
3694
3743
  const isShortOption = (s) => /^[^0-9]$/.test(s);
@@ -3696,8 +3745,13 @@ var Completion = class {
3696
3745
  if (!this.zshShell) {
3697
3746
  completions.push(dashes + key);
3698
3747
  } else {
3699
- const desc = descs[key] || "";
3700
- completions.push(dashes + `${key.replace(/:/g, "\\:")}:${desc.replace("__yargsString__:", "")}`);
3748
+ const aliasKey = (_a2 = this === null || this === void 0 ? void 0 : this.aliases) === null || _a2 === void 0 ? void 0 : _a2[key].find((alias) => {
3749
+ const desc2 = descs[alias];
3750
+ return typeof desc2 === "string" && desc2.length > 0;
3751
+ });
3752
+ const descFromAlias = aliasKey ? descs[aliasKey] : void 0;
3753
+ const desc = (_c2 = (_b2 = descs[key]) !== null && _b2 !== void 0 ? _b2 : descFromAlias) !== null && _c2 !== void 0 ? _c2 : "";
3754
+ completions.push(dashes + `${key.replace(/:/g, "\\:")}:${desc.replace("__yargsString__:", "").replace(/(\r\n|\n|\r)/gm, " ")}`);
3701
3755
  }
3702
3756
  }
3703
3757
  customCompletion(args, argv, current, done) {
@@ -3842,7 +3896,7 @@ ${customMsgs.join("\n")}` : "";
3842
3896
  }
3843
3897
  };
3844
3898
  self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand, checkPositionals = true) {
3845
- var _a;
3899
+ var _a2;
3846
3900
  const commandKeys = yargs.getInternalMethods().getCommandInstance().getCommands();
3847
3901
  const unknown = [];
3848
3902
  const currentContext = yargs.getInternalMethods().getContext();
@@ -3860,7 +3914,7 @@ ${customMsgs.join("\n")}` : "";
3860
3914
  }
3861
3915
  if (checkPositionals) {
3862
3916
  const demandedCommands = yargs.getDemandedCommands();
3863
- const maxNonOptDemanded = ((_a = demandedCommands._) === null || _a === void 0 ? void 0 : _a.max) || 0;
3917
+ const maxNonOptDemanded = ((_a2 = demandedCommands._) === null || _a2 === void 0 ? void 0 : _a2.max) || 0;
3864
3918
  const expected = currentContext.commands.length + maxNonOptDemanded;
3865
3919
  if (expected < argv._.length) {
3866
3920
  argv._.slice(expected).forEach((key) => {
@@ -4160,6 +4214,7 @@ var _YargsInstance_strict;
4160
4214
  var _YargsInstance_strictCommands;
4161
4215
  var _YargsInstance_strictOptions;
4162
4216
  var _YargsInstance_usage;
4217
+ var _YargsInstance_usageConfig;
4163
4218
  var _YargsInstance_versionOpt;
4164
4219
  var _YargsInstance_validation;
4165
4220
  function YargsFactory(_shim) {
@@ -4183,6 +4238,7 @@ var kEmitWarning = Symbol("emitWarning");
4183
4238
  var kFreeze = Symbol("freeze");
4184
4239
  var kGetDollarZero = Symbol("getDollarZero");
4185
4240
  var kGetParserConfiguration = Symbol("getParserConfiguration");
4241
+ var kGetUsageConfiguration = Symbol("getUsageConfiguration");
4186
4242
  var kGuessLocale = Symbol("guessLocale");
4187
4243
  var kGuessVersion = Symbol("guessVersion");
4188
4244
  var kParsePositionalNumbers = Symbol("parsePositionalNumbers");
@@ -4247,6 +4303,7 @@ var YargsInstance = class {
4247
4303
  _YargsInstance_strictCommands.set(this, false);
4248
4304
  _YargsInstance_strictOptions.set(this, false);
4249
4305
  _YargsInstance_usage.set(this, void 0);
4306
+ _YargsInstance_usageConfig.set(this, {});
4250
4307
  _YargsInstance_versionOpt.set(this, null);
4251
4308
  _YargsInstance_validation.set(this, void 0);
4252
4309
  __classPrivateFieldSet(this, _YargsInstance_shim, shim3, "f");
@@ -4356,7 +4413,7 @@ var YargsInstance = class {
4356
4413
  __classPrivateFieldGet(this, _YargsInstance_options, "f").key[keys] = true;
4357
4414
  __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").addCoerceMiddleware((argv, yargs) => {
4358
4415
  let aliases;
4359
- const shouldCoerce = Object.hasOwnProperty.call(argv, keys);
4416
+ const shouldCoerce = Object.prototype.hasOwnProperty.call(argv, keys);
4360
4417
  if (!shouldCoerce) {
4361
4418
  return argv;
4362
4419
  }
@@ -4671,7 +4728,7 @@ var YargsInstance = class {
4671
4728
  }
4672
4729
  locale(locale) {
4673
4730
  argsert("[string]", [locale], arguments.length);
4674
- if (!locale) {
4731
+ if (locale === void 0) {
4675
4732
  this[kGuessLocale]();
4676
4733
  return __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.getLocale();
4677
4734
  }
@@ -4793,7 +4850,10 @@ var YargsInstance = class {
4793
4850
  this.skipValidation(key);
4794
4851
  }
4795
4852
  const desc = opt.describe || opt.description || opt.desc;
4796
- this.describe(key, desc);
4853
+ const descriptions = __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions();
4854
+ if (!Object.prototype.hasOwnProperty.call(descriptions, key) || typeof desc === "string") {
4855
+ this.describe(key, desc);
4856
+ }
4797
4857
  if (opt.hidden) {
4798
4858
  this.hide(key);
4799
4859
  }
@@ -5034,6 +5094,11 @@ var YargsInstance = class {
5034
5094
  return this;
5035
5095
  }
5036
5096
  }
5097
+ usageConfiguration(config) {
5098
+ argsert("<object>", [config], arguments.length);
5099
+ __classPrivateFieldSet(this, _YargsInstance_usageConfig, config, "f");
5100
+ return this;
5101
+ }
5037
5102
  version(opt, msg, ver) {
5038
5103
  const defaultVersionOpt = "version";
5039
5104
  argsert("[boolean|string] [string] [string]", [opt, msg, ver], arguments.length);
@@ -5067,7 +5132,7 @@ var YargsInstance = class {
5067
5132
  __classPrivateFieldGet(this, _YargsInstance_usage, "f").wrap(cols);
5068
5133
  return this;
5069
5134
  }
5070
- [(_YargsInstance_command = /* @__PURE__ */ new WeakMap(), _YargsInstance_cwd = /* @__PURE__ */ new WeakMap(), _YargsInstance_context = /* @__PURE__ */ new WeakMap(), _YargsInstance_completion = /* @__PURE__ */ new WeakMap(), _YargsInstance_completionCommand = /* @__PURE__ */ new WeakMap(), _YargsInstance_defaultShowHiddenOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_exitError = /* @__PURE__ */ new WeakMap(), _YargsInstance_detectLocale = /* @__PURE__ */ new WeakMap(), _YargsInstance_emittedWarnings = /* @__PURE__ */ new WeakMap(), _YargsInstance_exitProcess = /* @__PURE__ */ new WeakMap(), _YargsInstance_frozens = /* @__PURE__ */ new WeakMap(), _YargsInstance_globalMiddleware = /* @__PURE__ */ new WeakMap(), _YargsInstance_groups = /* @__PURE__ */ new WeakMap(), _YargsInstance_hasOutput = /* @__PURE__ */ new WeakMap(), _YargsInstance_helpOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_isGlobalContext = /* @__PURE__ */ new WeakMap(), _YargsInstance_logger = /* @__PURE__ */ new WeakMap(), _YargsInstance_output = /* @__PURE__ */ new WeakMap(), _YargsInstance_options = /* @__PURE__ */ new WeakMap(), _YargsInstance_parentRequire = /* @__PURE__ */ new WeakMap(), _YargsInstance_parserConfig = /* @__PURE__ */ new WeakMap(), _YargsInstance_parseFn = /* @__PURE__ */ new WeakMap(), _YargsInstance_parseContext = /* @__PURE__ */ new WeakMap(), _YargsInstance_pkgs = /* @__PURE__ */ new WeakMap(), _YargsInstance_preservedGroups = /* @__PURE__ */ new WeakMap(), _YargsInstance_processArgs = /* @__PURE__ */ new WeakMap(), _YargsInstance_recommendCommands = /* @__PURE__ */ new WeakMap(), _YargsInstance_shim = /* @__PURE__ */ new WeakMap(), _YargsInstance_strict = /* @__PURE__ */ new WeakMap(), _YargsInstance_strictCommands = /* @__PURE__ */ new WeakMap(), _YargsInstance_strictOptions = /* @__PURE__ */ new WeakMap(), _YargsInstance_usage = /* @__PURE__ */ new WeakMap(), _YargsInstance_versionOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_validation = /* @__PURE__ */ new WeakMap(), kCopyDoubleDash)](argv) {
5135
+ [(_YargsInstance_command = /* @__PURE__ */ new WeakMap(), _YargsInstance_cwd = /* @__PURE__ */ new WeakMap(), _YargsInstance_context = /* @__PURE__ */ new WeakMap(), _YargsInstance_completion = /* @__PURE__ */ new WeakMap(), _YargsInstance_completionCommand = /* @__PURE__ */ new WeakMap(), _YargsInstance_defaultShowHiddenOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_exitError = /* @__PURE__ */ new WeakMap(), _YargsInstance_detectLocale = /* @__PURE__ */ new WeakMap(), _YargsInstance_emittedWarnings = /* @__PURE__ */ new WeakMap(), _YargsInstance_exitProcess = /* @__PURE__ */ new WeakMap(), _YargsInstance_frozens = /* @__PURE__ */ new WeakMap(), _YargsInstance_globalMiddleware = /* @__PURE__ */ new WeakMap(), _YargsInstance_groups = /* @__PURE__ */ new WeakMap(), _YargsInstance_hasOutput = /* @__PURE__ */ new WeakMap(), _YargsInstance_helpOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_isGlobalContext = /* @__PURE__ */ new WeakMap(), _YargsInstance_logger = /* @__PURE__ */ new WeakMap(), _YargsInstance_output = /* @__PURE__ */ new WeakMap(), _YargsInstance_options = /* @__PURE__ */ new WeakMap(), _YargsInstance_parentRequire = /* @__PURE__ */ new WeakMap(), _YargsInstance_parserConfig = /* @__PURE__ */ new WeakMap(), _YargsInstance_parseFn = /* @__PURE__ */ new WeakMap(), _YargsInstance_parseContext = /* @__PURE__ */ new WeakMap(), _YargsInstance_pkgs = /* @__PURE__ */ new WeakMap(), _YargsInstance_preservedGroups = /* @__PURE__ */ new WeakMap(), _YargsInstance_processArgs = /* @__PURE__ */ new WeakMap(), _YargsInstance_recommendCommands = /* @__PURE__ */ new WeakMap(), _YargsInstance_shim = /* @__PURE__ */ new WeakMap(), _YargsInstance_strict = /* @__PURE__ */ new WeakMap(), _YargsInstance_strictCommands = /* @__PURE__ */ new WeakMap(), _YargsInstance_strictOptions = /* @__PURE__ */ new WeakMap(), _YargsInstance_usage = /* @__PURE__ */ new WeakMap(), _YargsInstance_usageConfig = /* @__PURE__ */ new WeakMap(), _YargsInstance_versionOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_validation = /* @__PURE__ */ new WeakMap(), kCopyDoubleDash)](argv) {
5071
5136
  if (!argv._ || !argv["--"])
5072
5137
  return argv;
5073
5138
  argv._.push.apply(argv._, argv["--"]);
@@ -5159,6 +5224,9 @@ var YargsInstance = class {
5159
5224
  [kGetParserConfiguration]() {
5160
5225
  return __classPrivateFieldGet(this, _YargsInstance_parserConfig, "f");
5161
5226
  }
5227
+ [kGetUsageConfiguration]() {
5228
+ return __classPrivateFieldGet(this, _YargsInstance_usageConfig, "f");
5229
+ }
5162
5230
  [kGuessLocale]() {
5163
5231
  if (!__classPrivateFieldGet(this, _YargsInstance_detectLocale, "f"))
5164
5232
  return;
@@ -5242,20 +5310,20 @@ var YargsInstance = class {
5242
5310
  return this;
5243
5311
  }
5244
5312
  [kUnfreeze]() {
5245
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
5313
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _j, _k, _l, _m;
5246
5314
  const frozen = __classPrivateFieldGet(this, _YargsInstance_frozens, "f").pop();
5247
5315
  assertNotStrictEqual(frozen, void 0, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
5248
5316
  let configObjects;
5249
- _a = this, _b = this, _c = this, _d = this, _e = this, _f = this, _g = this, _h = this, _j = this, _k = this, _l = this, _m = this, {
5317
+ _a2 = this, _b2 = this, _c2 = this, _d = this, _e = this, _f = this, _g = this, _h = this, _j = this, _k = this, _l = this, _m = this, {
5250
5318
  options: { set value(_o) {
5251
- __classPrivateFieldSet(_a, _YargsInstance_options, _o, "f");
5319
+ __classPrivateFieldSet(_a2, _YargsInstance_options, _o, "f");
5252
5320
  } }.value,
5253
5321
  configObjects,
5254
5322
  exitProcess: { set value(_o) {
5255
- __classPrivateFieldSet(_b, _YargsInstance_exitProcess, _o, "f");
5323
+ __classPrivateFieldSet(_b2, _YargsInstance_exitProcess, _o, "f");
5256
5324
  } }.value,
5257
5325
  groups: { set value(_o) {
5258
- __classPrivateFieldSet(_c, _YargsInstance_groups, _o, "f");
5326
+ __classPrivateFieldSet(_c2, _YargsInstance_groups, _o, "f");
5259
5327
  } }.value,
5260
5328
  output: { set value(_o) {
5261
5329
  __classPrivateFieldSet(_d, _YargsInstance_output, _o, "f");
@@ -5306,6 +5374,7 @@ var YargsInstance = class {
5306
5374
  getLoggerInstance: this[kGetLoggerInstance].bind(this),
5307
5375
  getParseContext: this[kGetParseContext].bind(this),
5308
5376
  getParserConfiguration: this[kGetParserConfiguration].bind(this),
5377
+ getUsageConfiguration: this[kGetUsageConfiguration].bind(this),
5309
5378
  getUsageInstance: this[kGetUsageInstance].bind(this),
5310
5379
  getValidationInstance: this[kGetValidationInstance].bind(this),
5311
5380
  hasParseCallback: this[kHasParseCallback].bind(this),
@@ -5615,7 +5684,7 @@ import { join } from "node:path";
5615
5684
  var REDIRECTS_VERSION = 1;
5616
5685
  var HEADERS_VERSION = 2;
5617
5686
  var ANALYTICS_VERSION = 1;
5618
- var PERMITTED_STATUS_CODES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
5687
+ var PERMITTED_STATUS_CODES = /* @__PURE__ */ new Set([200, 301, 302, 303, 307, 308]);
5619
5688
  var HEADER_SEPARATOR = ":";
5620
5689
  var MAX_LINE_LENGTH = 2e3;
5621
5690
  var MAX_HEADER_RULES = 100;
@@ -5786,6 +5855,10 @@ var validateUrl = (token, onlyRelative = false, includeSearch = false, includeHa
5786
5855
  onlyRelative ? "URLs should begin with a forward-slash." : 'URLs should either be relative (e.g. begin with a forward-slash), or use HTTPS (e.g. begin with "https://").'
5787
5856
  ];
5788
5857
  };
5858
+ function urlHasHost(token) {
5859
+ const host = URL_REGEX.exec(token);
5860
+ return Boolean(host && host.groups && host.groups.host);
5861
+ }
5789
5862
 
5790
5863
  // ../pages-shared/metadata-generator/parseHeaders.ts
5791
5864
  var LINE_IS_PROBABLY_A_PATH = new RegExp(/^([^\s]+:\/\/|^\/)/);
@@ -5994,7 +6067,15 @@ function parseRedirects(input) {
5994
6067
  invalid.push({
5995
6068
  line,
5996
6069
  lineNumber: i + 1,
5997
- message: `Valid status codes are 301, 302 (default), 303, 307, or 308. Got ${str_status}.`
6070
+ message: `Valid status codes are 200, 301, 302 (default), 303, 307, or 308. Got ${str_status}.`
6071
+ });
6072
+ continue;
6073
+ }
6074
+ if (/\/\*?$/.test(from) && /\/index(.html)?$/.test(to) && !urlHasHost(to)) {
6075
+ invalid.push({
6076
+ line,
6077
+ lineNumber: i + 1,
6078
+ message: "Infinite loop detected in this rule and has been ignored. This will cause a redirect to strip `.html` or `/index` and end up triggering this rule again. Please fix or remove this rule to silence this warning."
5998
6079
  });
5999
6080
  continue;
6000
6081
  }
@@ -6007,6 +6088,16 @@ function parseRedirects(input) {
6007
6088
  continue;
6008
6089
  }
6009
6090
  seen_paths.add(from);
6091
+ if (status === 200) {
6092
+ if (urlHasHost(to)) {
6093
+ invalid.push({
6094
+ line,
6095
+ lineNumber: i + 1,
6096
+ message: `Proxy (200) redirects can only point to relative paths. Got ${to}`
6097
+ });
6098
+ continue;
6099
+ }
6100
+ }
6010
6101
  rules.push({ from, to, status, lineNumber: i + 1 });
6011
6102
  }
6012
6103
  return {
@@ -6036,7 +6127,7 @@ async function generateASSETSBinding(options) {
6036
6127
  const miniflare = options.tre ? await import("@miniflare/tre") : await import("@miniflare/core");
6037
6128
  const Request = miniflare.Request;
6038
6129
  const Response2 = miniflare.Response;
6039
- const fetch2 = options.tre ? miniflare.fetch : (await import("@miniflare/web-sockets")).upgradingFetch;
6130
+ const fetch = options.tre ? miniflare.fetch : (await import("@miniflare/web-sockets")).upgradingFetch;
6040
6131
  return async function(miniflareRequest) {
6041
6132
  if (options.proxyPort) {
6042
6133
  try {
@@ -6047,7 +6138,7 @@ async function generateASSETSBinding(options) {
6047
6138
  proxyRequest.headers.delete("Sec-WebSocket-Accept");
6048
6139
  proxyRequest.headers.delete("Sec-WebSocket-Key");
6049
6140
  }
6050
- return await fetch2(proxyRequest);
6141
+ return await fetch(proxyRequest);
6051
6142
  } catch (thrown) {
6052
6143
  options.log.error(new Error(`Could not proxy request: ${thrown}`));
6053
6144
  return new Response2(`[wrangler] Could not proxy request: ${thrown}`, {
@@ -6213,7 +6304,7 @@ async function main() {
6213
6304
  if (logLevelString === "LOG")
6214
6305
  logLevelString = "INFO";
6215
6306
  const logLevel = MiniflareLogLevel[logLevelString];
6216
- config.log = logLevel === MiniflareLogLevel.NONE ? new MiniflareNoOpLog() : new MiniflareLog(logLevel, config.logOptions);
6307
+ config.log = logLevel === MiniflareLogLevel.NONE ? new MiniflareNoOpLog() : new MiniflareLog(logLevel);
6217
6308
  if (logLevel === MiniflareLogLevel.DEBUG) {
6218
6309
  console.log("MINIFLARE OPTIONS:\n", JSON.stringify(config, null, 2));
6219
6310
  }
@@ -6247,7 +6338,7 @@ async function main() {
6247
6338
  "x-miniflare-durable-object-id",
6248
6339
  id.toString()
6249
6340
  );
6250
- return fetch(request);
6341
+ return upgradingFetch(request);
6251
6342
  };
6252
6343
  return stub;
6253
6344
  };