@html-validate/puppeteer-fetch 1.0.0 → 2.0.0

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 (3) hide show
  1. package/LICENSE +20 -0
  2. package/dist/index.js +385 -56
  3. package/package.json +4 -4
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 David Sveningsson <ext@sidvind.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/dist/index.js CHANGED
@@ -1,23 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __objRest = (source, exclude) => {
10
- var target = {};
11
- for (var prop in source)
12
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
13
- target[prop] = source[prop];
14
- if (source != null && __getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(source)) {
16
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
17
- target[prop] = source[prop];
18
- }
19
- return target;
20
- };
21
8
  var __commonJS = (cb, mod) => function __require() {
22
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
23
10
  };
@@ -29,7 +16,14 @@ var __copyProps = (to, from, except, desc) => {
29
16
  }
30
17
  return to;
31
18
  };
32
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
33
27
 
34
28
  // node_modules/argparse/lib/sub.js
35
29
  var require_sub = __commonJS({
@@ -102,6 +96,53 @@ var require_textwrap = __commonJS({
102
96
  "use strict";
103
97
  var wordsep_simple_re = /([\t\n\x0b\x0c\r ]+)/;
104
98
  var TextWrapper = class {
99
+ /*
100
+ * Object for wrapping/filling text. The public interface consists of
101
+ * the wrap() and fill() methods; the other methods are just there for
102
+ * subclasses to override in order to tweak the default behaviour.
103
+ * If you want to completely replace the main wrapping algorithm,
104
+ * you'll probably have to override _wrap_chunks().
105
+ *
106
+ * Several instance attributes control various aspects of wrapping:
107
+ * width (default: 70)
108
+ * the maximum width of wrapped lines (unless break_long_words
109
+ * is false)
110
+ * initial_indent (default: "")
111
+ * string that will be prepended to the first line of wrapped
112
+ * output. Counts towards the line's width.
113
+ * subsequent_indent (default: "")
114
+ * string that will be prepended to all lines save the first
115
+ * of wrapped output; also counts towards each line's width.
116
+ * expand_tabs (default: true)
117
+ * Expand tabs in input text to spaces before further processing.
118
+ * Each tab will become 0 .. 'tabsize' spaces, depending on its position
119
+ * in its line. If false, each tab is treated as a single character.
120
+ * tabsize (default: 8)
121
+ * Expand tabs in input text to 0 .. 'tabsize' spaces, unless
122
+ * 'expand_tabs' is false.
123
+ * replace_whitespace (default: true)
124
+ * Replace all whitespace characters in the input text by spaces
125
+ * after tab expansion. Note that if expand_tabs is false and
126
+ * replace_whitespace is true, every tab will be converted to a
127
+ * single space!
128
+ * fix_sentence_endings (default: false)
129
+ * Ensure that sentence-ending punctuation is always followed
130
+ * by two spaces. Off by default because the algorithm is
131
+ * (unavoidably) imperfect.
132
+ * break_long_words (default: true)
133
+ * Break words longer than 'width'. If false, those words will not
134
+ * be broken, and some lines might be longer than 'width'.
135
+ * break_on_hyphens (default: true)
136
+ * Allow breaking hyphenated words. If true, wrapping will occur
137
+ * preferably on whitespaces and right after hyphens part of
138
+ * compound words.
139
+ * drop_whitespace (default: true)
140
+ * Drop leading and trailing whitespace from lines.
141
+ * max_lines (default: None)
142
+ * Truncate wrapped lines.
143
+ * placeholder (default: ' [...]')
144
+ * Append to the last line of truncated text.
145
+ */
105
146
  constructor(options = {}) {
106
147
  let {
107
148
  width = 70,
@@ -130,6 +171,8 @@ var require_textwrap = __commonJS({
130
171
  this.max_lines = max_lines;
131
172
  this.placeholder = placeholder;
132
173
  }
174
+ // -- Private methods -----------------------------------------------
175
+ // (possibly useful for subclasses to override)
133
176
  _munge_whitespace(text) {
134
177
  if (this.expand_tabs) {
135
178
  text = text.replace(/\t/g, " ".repeat(this.tabsize));
@@ -240,6 +283,7 @@ var require_textwrap = __commonJS({
240
283
  text = this._munge_whitespace(text);
241
284
  return this._split(text);
242
285
  }
286
+ // -- Public interface ----------------------------------------------
243
287
  wrap(text) {
244
288
  let chunks = this._split_chunks(text);
245
289
  return this._wrap_chunks(chunks);
@@ -249,12 +293,12 @@ var require_textwrap = __commonJS({
249
293
  }
250
294
  };
251
295
  function wrap(text, options = {}) {
252
- let _a = options, { width = 70 } = _a, kwargs = __objRest(_a, ["width"]);
296
+ let { width = 70, ...kwargs } = options;
253
297
  let w = new TextWrapper(Object.assign({ width }, kwargs));
254
298
  return w.wrap(text);
255
299
  }
256
300
  function fill(text, options = {}) {
257
- let _a = options, { width = 70 } = _a, kwargs = __objRest(_a, ["width"]);
301
+ let { width = 70, ...kwargs } = options;
258
302
  let w = new TextWrapper(Object.assign({ width }, kwargs));
259
303
  return w.fill(text);
260
304
  }
@@ -407,6 +451,7 @@ var require_argparse = __commonJS({
407
451
  }
408
452
  function _callable(cls) {
409
453
  let result = {
454
+ // object is needed for inferred class name
410
455
  [cls.name]: function(...args) {
411
456
  let this_class = new.target === result || !new.target;
412
457
  return Reflect.construct(cls, args, this_class ? cls : new.target);
@@ -420,7 +465,13 @@ var require_argparse = __commonJS({
420
465
  try {
421
466
  let name = object.constructor.name;
422
467
  Object.defineProperty(object, from, {
423
- value: util.deprecate(object[to], sub("%s.%s() is renamed to %s.%s()", name, from, name, to)),
468
+ value: util.deprecate(object[to], sub(
469
+ "%s.%s() is renamed to %s.%s()",
470
+ name,
471
+ from,
472
+ name,
473
+ to
474
+ )),
424
475
  enumerable: false
425
476
  });
426
477
  } catch {
@@ -481,7 +532,11 @@ var require_argparse = __commonJS({
481
532
  }
482
533
  if (renames.length) {
483
534
  let name = get_name();
484
- deprecate("camelcase_" + name, sub("%s(): following options are renamed: %s", name, renames.map(([a, b]) => sub("%r -> %r", a, b))));
535
+ deprecate("camelcase_" + name, sub(
536
+ "%s(): following options are renamed: %s",
537
+ name,
538
+ renames.map(([a, b]) => sub("%r -> %r", a, b))
539
+ ));
485
540
  }
486
541
  let missing_positionals = [];
487
542
  let positional_count = args.length;
@@ -502,7 +557,11 @@ var require_argparse = __commonJS({
502
557
  }
503
558
  if (renames2.length) {
504
559
  let name = get_name();
505
- deprecate("camelcase_" + name, sub("%s(): following options are renamed: %s", name, renames2.map(([a, b]) => sub("%r -> %r", a, b))));
560
+ deprecate("camelcase_" + name, sub(
561
+ "%s(): following options are renamed: %s",
562
+ name,
563
+ renames2.map(([a, b]) => sub("%r -> %r", a, b))
564
+ ));
506
565
  }
507
566
  result.push(kwargs);
508
567
  kwargs = {};
@@ -524,19 +583,36 @@ var require_argparse = __commonJS({
524
583
  }
525
584
  }
526
585
  if (Object.keys(kwargs).length) {
527
- throw new TypeError(sub("%s() got an unexpected keyword argument %r", get_name(), Object.keys(kwargs)[0]));
586
+ throw new TypeError(sub(
587
+ "%s() got an unexpected keyword argument %r",
588
+ get_name(),
589
+ Object.keys(kwargs)[0]
590
+ ));
528
591
  }
529
592
  if (args.length) {
530
593
  let from = Object.entries(descriptor).filter(([k, v]) => k[0] !== "*" && v !== no_default).length;
531
594
  let to = Object.entries(descriptor).filter(([k]) => k[0] !== "*").length;
532
- throw new TypeError(sub("%s() takes %s positional argument%s but %s %s given", get_name(), from === to ? sub("from %s to %s", from, to) : to, from === to && to === 1 ? "" : "s", positional_count, positional_count === 1 ? "was" : "were"));
595
+ throw new TypeError(sub(
596
+ "%s() takes %s positional argument%s but %s %s given",
597
+ get_name(),
598
+ from === to ? sub("from %s to %s", from, to) : to,
599
+ from === to && to === 1 ? "" : "s",
600
+ positional_count,
601
+ positional_count === 1 ? "was" : "were"
602
+ ));
533
603
  }
534
604
  if (missing_positionals.length) {
535
605
  let strs = missing_positionals.map(repr);
536
606
  if (strs.length > 1)
537
607
  strs[strs.length - 1] = "and " + strs[strs.length - 1];
538
608
  let str_joined = strs.join(strs.length === 2 ? "" : ", ");
539
- throw new TypeError(sub("%s() missing %i required positional argument%s: %s", get_name(), strs.length, strs.length === 1 ? "" : "s", str_joined));
609
+ throw new TypeError(sub(
610
+ "%s() missing %i required positional argument%s: %s",
611
+ get_name(),
612
+ strs.length,
613
+ strs.length === 1 ? "" : "s",
614
+ str_joined
615
+ ));
540
616
  }
541
617
  return result;
542
618
  }
@@ -585,6 +661,12 @@ var require_argparse = __commonJS({
585
661
  return items.slice(0);
586
662
  }
587
663
  var HelpFormatter = _camelcase_alias(_callable(class HelpFormatter {
664
+ /*
665
+ * Formatter for generating usage messages and argument help strings.
666
+ *
667
+ * Only the name of this class is considered a public API. All the methods
668
+ * provided by the class are considered an implementation detail.
669
+ */
588
670
  constructor() {
589
671
  let [
590
672
  prog,
@@ -603,7 +685,10 @@ var require_argparse = __commonJS({
603
685
  }
604
686
  this._prog = prog;
605
687
  this._indent_increment = indent_increment;
606
- this._max_help_position = Math.min(max_help_position, Math.max(width - 20, indent_increment * 2));
688
+ this._max_help_position = Math.min(
689
+ max_help_position,
690
+ Math.max(width - 20, indent_increment * 2)
691
+ );
607
692
  this._width = width;
608
693
  this._current_indent = 0;
609
694
  this._level = 0;
@@ -613,6 +698,9 @@ var require_argparse = __commonJS({
613
698
  this._whitespace_matcher = /[ \t\n\r\f\v]+/g;
614
699
  this._long_break_matcher = /\n\n\n+/g;
615
700
  }
701
+ // ===============================
702
+ // Section and indentation methods
703
+ // ===============================
616
704
  _indent() {
617
705
  this._current_indent += this._indent_increment;
618
706
  this._level += 1;
@@ -625,6 +713,9 @@ var require_argparse = __commonJS({
625
713
  _add_item(func, args) {
626
714
  this._current_section.items.push([func, args]);
627
715
  }
716
+ // ========================
717
+ // Message building methods
718
+ // ========================
628
719
  start_section(heading) {
629
720
  this._indent();
630
721
  let section = this._Section(this, this._current_section, heading);
@@ -654,7 +745,10 @@ var require_argparse = __commonJS({
654
745
  }
655
746
  let invocation_length = Math.max(...invocations.map((invocation) => invocation.length));
656
747
  let action_length = invocation_length + this._current_indent;
657
- this._action_max_length = Math.max(this._action_max_length, action_length);
748
+ this._action_max_length = Math.max(
749
+ this._action_max_length,
750
+ action_length
751
+ );
658
752
  this._add_item(this._format_action.bind(this), [action]);
659
753
  }
660
754
  }
@@ -663,6 +757,9 @@ var require_argparse = __commonJS({
663
757
  this.add_argument(action);
664
758
  }
665
759
  }
760
+ // =======================
761
+ // Help-formatting methods
762
+ // =======================
666
763
  format_help() {
667
764
  let help = this._root_section.format_help();
668
765
  if (help) {
@@ -853,7 +950,10 @@ var require_argparse = __commonJS({
853
950
  return this._fill_text(text, text_width, indent) + "\n\n";
854
951
  }
855
952
  _format_action(action) {
856
- let help_position = Math.min(this._action_max_length + 2, this._max_help_position);
953
+ let help_position = Math.min(
954
+ this._action_max_length + 2,
955
+ this._max_help_position
956
+ );
857
957
  let help_width = Math.max(this._width - help_position, 11);
858
958
  let action_width = help_position - this._current_indent - 2;
859
959
  let action_header = this._format_action_invocation(action);
@@ -1041,16 +1141,34 @@ var require_argparse = __commonJS({
1041
1141
  }
1042
1142
  });
1043
1143
  var RawDescriptionHelpFormatter = _camelcase_alias(_callable(class RawDescriptionHelpFormatter extends HelpFormatter {
1144
+ /*
1145
+ * Help message formatter which retains any formatting in descriptions.
1146
+ *
1147
+ * Only the name of this class is considered a public API. All the methods
1148
+ * provided by the class are considered an implementation detail.
1149
+ */
1044
1150
  _fill_text(text, width, indent) {
1045
1151
  return splitlines(text, true).map((line) => indent + line).join("");
1046
1152
  }
1047
1153
  }));
1048
1154
  var RawTextHelpFormatter = _camelcase_alias(_callable(class RawTextHelpFormatter extends RawDescriptionHelpFormatter {
1155
+ /*
1156
+ * Help message formatter which retains formatting of all help text.
1157
+ *
1158
+ * Only the name of this class is considered a public API. All the methods
1159
+ * provided by the class are considered an implementation detail.
1160
+ */
1049
1161
  _split_lines(text) {
1050
1162
  return splitlines(text);
1051
1163
  }
1052
1164
  }));
1053
1165
  var ArgumentDefaultsHelpFormatter = _camelcase_alias(_callable(class ArgumentDefaultsHelpFormatter extends HelpFormatter {
1166
+ /*
1167
+ * Help message formatter which adds default values to argument help.
1168
+ *
1169
+ * Only the name of this class is considered a public API. All the methods
1170
+ * provided by the class are considered an implementation detail.
1171
+ */
1054
1172
  _get_help_string(action) {
1055
1173
  let help = action.help;
1056
1174
  if (!action.help.includes("%(default)") && !action.help.includes("%(defaultValue)")) {
@@ -1065,6 +1183,13 @@ var require_argparse = __commonJS({
1065
1183
  }
1066
1184
  }));
1067
1185
  var MetavarTypeHelpFormatter = _camelcase_alias(_callable(class MetavarTypeHelpFormatter extends HelpFormatter {
1186
+ /*
1187
+ * Help message formatter which uses the argument 'type' as the default
1188
+ * metavar value (instead of the argument 'dest')
1189
+ *
1190
+ * Only the name of this class is considered a public API. All the methods
1191
+ * provided by the class are considered an implementation detail.
1192
+ */
1068
1193
  _get_default_metavar_for_optional(action) {
1069
1194
  return typeof action.type === "function" ? action.type.name : action.type;
1070
1195
  }
@@ -1086,6 +1211,12 @@ var require_argparse = __commonJS({
1086
1211
  }
1087
1212
  }
1088
1213
  var ArgumentError = _callable(class ArgumentError extends Error {
1214
+ /*
1215
+ * An error from creating or using an argument (optional or positional).
1216
+ *
1217
+ * The string value of this exception is the message, augmented with
1218
+ * information about the argument that caused it.
1219
+ */
1089
1220
  constructor(argument, message) {
1090
1221
  super();
1091
1222
  this.name = "ArgumentError";
@@ -1107,12 +1238,65 @@ var require_argparse = __commonJS({
1107
1238
  }
1108
1239
  });
1109
1240
  var ArgumentTypeError = _callable(class ArgumentTypeError extends Error {
1241
+ /*
1242
+ * An error from trying to convert a command line string to a type.
1243
+ */
1110
1244
  constructor(message) {
1111
1245
  super(message);
1112
1246
  this.name = "ArgumentTypeError";
1113
1247
  }
1114
1248
  });
1115
1249
  var Action = _camelcase_alias(_callable(class Action extends _AttributeHolder(Function) {
1250
+ /*
1251
+ * Information about how to convert command line strings to Python objects.
1252
+ *
1253
+ * Action objects are used by an ArgumentParser to represent the information
1254
+ * needed to parse a single argument from one or more strings from the
1255
+ * command line. The keyword arguments to the Action constructor are also
1256
+ * all attributes of Action instances.
1257
+ *
1258
+ * Keyword Arguments:
1259
+ *
1260
+ * - option_strings -- A list of command-line option strings which
1261
+ * should be associated with this action.
1262
+ *
1263
+ * - dest -- The name of the attribute to hold the created object(s)
1264
+ *
1265
+ * - nargs -- The number of command-line arguments that should be
1266
+ * consumed. By default, one argument will be consumed and a single
1267
+ * value will be produced. Other values include:
1268
+ * - N (an integer) consumes N arguments (and produces a list)
1269
+ * - '?' consumes zero or one arguments
1270
+ * - '*' consumes zero or more arguments (and produces a list)
1271
+ * - '+' consumes one or more arguments (and produces a list)
1272
+ * Note that the difference between the default and nargs=1 is that
1273
+ * with the default, a single value will be produced, while with
1274
+ * nargs=1, a list containing a single value will be produced.
1275
+ *
1276
+ * - const -- The value to be produced if the option is specified and the
1277
+ * option uses an action that takes no values.
1278
+ *
1279
+ * - default -- The value to be produced if the option is not specified.
1280
+ *
1281
+ * - type -- A callable that accepts a single string argument, and
1282
+ * returns the converted value. The standard Python types str, int,
1283
+ * float, and complex are useful examples of such callables. If None,
1284
+ * str is used.
1285
+ *
1286
+ * - choices -- A container of values that should be allowed. If not None,
1287
+ * after a command-line argument has been converted to the appropriate
1288
+ * type, an exception will be raised if it is not a member of this
1289
+ * collection.
1290
+ *
1291
+ * - required -- True if the action must always be specified at the
1292
+ * command line. This is only meaningful for optional command-line
1293
+ * arguments.
1294
+ *
1295
+ * - help -- The help string describing the argument.
1296
+ *
1297
+ * - metavar -- The name to be used for the option's argument with the
1298
+ * help string. If None, the 'dest' value will be used as the name.
1299
+ */
1116
1300
  constructor() {
1117
1301
  let [
1118
1302
  option_strings,
@@ -1280,6 +1464,7 @@ var require_argparse = __commonJS({
1280
1464
  default_value,
1281
1465
  required,
1282
1466
  help
1467
+ //, metavar
1283
1468
  ] = _parse_opts(arguments, {
1284
1469
  option_strings: no_default,
1285
1470
  dest: no_default,
@@ -1642,6 +1827,22 @@ var require_argparse = __commonJS({
1642
1827
  }
1643
1828
  });
1644
1829
  var FileType = _callable(class FileType extends Function {
1830
+ /*
1831
+ * Factory for creating file object types
1832
+ *
1833
+ * Instances of FileType are typically passed as type= arguments to the
1834
+ * ArgumentParser add_argument() method.
1835
+ *
1836
+ * Keyword Arguments:
1837
+ * - mode -- A string indicating how the file is to be opened. Accepts the
1838
+ * same values as the builtin open() function.
1839
+ * - bufsize -- The file's desired buffer size. Accepts the same values as
1840
+ * the builtin open() function.
1841
+ * - encoding -- The file's encoding. Accepts the same values as the
1842
+ * builtin open() function.
1843
+ * - errors -- A string indicating how encoding and decoding errors are to
1844
+ * be handled. Accepts the same value as the builtin open() function.
1845
+ */
1645
1846
  constructor() {
1646
1847
  let [
1647
1848
  flags,
@@ -1657,11 +1858,17 @@ var require_argparse = __commonJS({
1657
1858
  flags: "r",
1658
1859
  encoding: void 0,
1659
1860
  mode: void 0,
1861
+ // 0o666
1660
1862
  autoClose: void 0,
1863
+ // true
1661
1864
  emitClose: void 0,
1865
+ // false
1662
1866
  start: void 0,
1867
+ // 0
1663
1868
  end: void 0,
1869
+ // Infinity
1664
1870
  highWaterMark: void 0,
1871
+ // 64 * 1024
1665
1872
  fs: void 0
1666
1873
  });
1667
1874
  super("return arguments.callee.call.apply(arguments.callee, arguments)");
@@ -1735,6 +1942,12 @@ var require_argparse = __commonJS({
1735
1942
  }
1736
1943
  });
1737
1944
  var Namespace = _callable(class Namespace extends _AttributeHolder() {
1945
+ /*
1946
+ * Simple object for storing attributes.
1947
+ *
1948
+ * Implements equality by attribute names and values, and provides a simple
1949
+ * string representation.
1950
+ */
1738
1951
  constructor(options = {}) {
1739
1952
  super();
1740
1953
  Object.assign(this, options);
@@ -1773,7 +1986,10 @@ var require_argparse = __commonJS({
1773
1986
  this.register("action", "extend", _ExtendAction);
1774
1987
  ["storeConst", "storeTrue", "storeFalse", "appendConst"].forEach((old_name) => {
1775
1988
  let new_name = _to_new_name(old_name);
1776
- this.register("action", old_name, util.deprecate(this._registry_get("action", new_name), sub('{action: "%s"} is renamed to {action: "%s"}', old_name, new_name)));
1989
+ this.register("action", old_name, util.deprecate(
1990
+ this._registry_get("action", new_name),
1991
+ sub('{action: "%s"} is renamed to {action: "%s"}', old_name, new_name)
1992
+ ));
1777
1993
  });
1778
1994
  this._get_handler();
1779
1995
  this._actions = [];
@@ -1784,6 +2000,9 @@ var require_argparse = __commonJS({
1784
2000
  this._negative_number_matcher = /^-\d+$|^-\d*\.\d+$/;
1785
2001
  this._has_negative_number_optionals = [];
1786
2002
  }
2003
+ // ====================
2004
+ // Registration methods
2005
+ // ====================
1787
2006
  register(registry_name, value, object) {
1788
2007
  let registry = setdefault(this._registries, registry_name, {});
1789
2008
  registry[value] = object;
@@ -1791,6 +2010,9 @@ var require_argparse = __commonJS({
1791
2010
  _registry_get(registry_name, value, default_value = void 0) {
1792
2011
  return getattr(this._registries[registry_name], value, default_value);
1793
2012
  }
2013
+ // ==================================
2014
+ // Namespace default accessor methods
2015
+ // ==================================
1794
2016
  set_defaults(kwargs) {
1795
2017
  Object.assign(this._defaults, kwargs);
1796
2018
  for (let action of this._actions) {
@@ -1807,6 +2029,9 @@ var require_argparse = __commonJS({
1807
2029
  }
1808
2030
  return this._defaults[dest];
1809
2031
  }
2032
+ // =======================
2033
+ // Adding argument actions
2034
+ // =======================
1810
2035
  add_argument() {
1811
2036
  let [
1812
2037
  args,
@@ -1817,9 +2042,12 @@ var require_argparse = __commonJS({
1817
2042
  });
1818
2043
  if (args.length === 1 && Array.isArray(args[0])) {
1819
2044
  args = args[0];
1820
- deprecate("argument-array", sub("use add_argument(%(args)s, {...}) instead of add_argument([ %(args)s ], { ... })", {
1821
- args: args.map(repr).join(", ")
1822
- }));
2045
+ deprecate(
2046
+ "argument-array",
2047
+ sub("use add_argument(%(args)s, {...}) instead of add_argument([ %(args)s ], { ... })", {
2048
+ args: args.map(repr).join(", ")
2049
+ })
2050
+ );
1823
2051
  }
1824
2052
  let chars = this.prefix_chars;
1825
2053
  if (!args.length || args.length === 1 && !chars.includes(args[0][0])) {
@@ -2018,7 +2246,10 @@ var require_argparse = __commonJS({
2018
2246
  }
2019
2247
  _handle_conflict_error(action, conflicting_actions) {
2020
2248
  let message = conflicting_actions.length === 1 ? "conflicting option string: %s" : "conflicting option strings: %s";
2021
- let conflict_string = conflicting_actions.map(([option_string]) => option_string).join(", ");
2249
+ let conflict_string = conflicting_actions.map(([
2250
+ option_string
2251
+ /*, action*/
2252
+ ]) => option_string).join(", ");
2022
2253
  throw new ArgumentError(action, sub(message, conflict_string));
2023
2254
  }
2024
2255
  _handle_conflict_resolve(action, conflicting_actions) {
@@ -2095,6 +2326,26 @@ var require_argparse = __commonJS({
2095
2326
  }
2096
2327
  });
2097
2328
  var ArgumentParser2 = _camelcase_alias(_callable(class ArgumentParser extends _AttributeHolder(_ActionsContainer) {
2329
+ /*
2330
+ * Object for parsing command line strings into Python objects.
2331
+ *
2332
+ * Keyword Arguments:
2333
+ * - prog -- The name of the program (default: sys.argv[0])
2334
+ * - usage -- A usage message (default: auto-generated from arguments)
2335
+ * - description -- A description of what the program does
2336
+ * - epilog -- Text following the argument descriptions
2337
+ * - parents -- Parsers whose arguments should be copied into this one
2338
+ * - formatter_class -- HelpFormatter class for printing help messages
2339
+ * - prefix_chars -- Characters that prefix optional arguments
2340
+ * - fromfile_prefix_chars -- Characters that prefix files containing
2341
+ * additional arguments
2342
+ * - argument_default -- The default value for all arguments
2343
+ * - conflict_handler -- String indicating how to handle conflicts
2344
+ * - add_help -- Add a -h/-help option
2345
+ * - allow_abbrev -- Allow long options to be abbreviated unambiguously
2346
+ * - exit_on_error -- Determines whether or not ArgumentParser exits with
2347
+ * error info when an error occurs
2348
+ */
2098
2349
  constructor() {
2099
2350
  let [
2100
2351
  prog,
@@ -2111,7 +2362,9 @@ var require_argparse = __commonJS({
2111
2362
  allow_abbrev,
2112
2363
  exit_on_error,
2113
2364
  debug,
2365
+ // LEGACY (v1 compatibility), debug mode
2114
2366
  version
2367
+ // LEGACY (v1 compatibility), version
2115
2368
  ] = _parse_opts(arguments, {
2116
2369
  prog: void 0,
2117
2370
  usage: void 0,
@@ -2127,13 +2380,21 @@ var require_argparse = __commonJS({
2127
2380
  allow_abbrev: true,
2128
2381
  exit_on_error: true,
2129
2382
  debug: void 0,
2383
+ // LEGACY (v1 compatibility), debug mode
2130
2384
  version: void 0
2385
+ // LEGACY (v1 compatibility), version
2131
2386
  });
2132
2387
  if (debug !== void 0) {
2133
- deprecate("debug", 'The "debug" argument to ArgumentParser is deprecated. Please override ArgumentParser.exit function instead.');
2388
+ deprecate(
2389
+ "debug",
2390
+ 'The "debug" argument to ArgumentParser is deprecated. Please override ArgumentParser.exit function instead.'
2391
+ );
2134
2392
  }
2135
2393
  if (version !== void 0) {
2136
- deprecate("version", `The "version" argument to ArgumentParser is deprecated. Please use add_argument(..., { action: 'version', version: 'N', ... }) instead.`);
2394
+ deprecate(
2395
+ "version",
2396
+ `The "version" argument to ArgumentParser is deprecated. Please use add_argument(..., { action: 'version', version: 'N', ... }) instead.`
2397
+ );
2137
2398
  }
2138
2399
  super({
2139
2400
  description,
@@ -2177,28 +2438,43 @@ var require_argparse = __commonJS({
2177
2438
  return result;
2178
2439
  });
2179
2440
  this.register("type", "str", String);
2180
- this.register("type", "string", util.deprecate(String, 'use {type:"str"} or {type:String} instead of {type:"string"}'));
2441
+ this.register(
2442
+ "type",
2443
+ "string",
2444
+ util.deprecate(String, 'use {type:"str"} or {type:String} instead of {type:"string"}')
2445
+ );
2181
2446
  let default_prefix = prefix_chars.includes("-") ? "-" : prefix_chars[0];
2182
2447
  if (this.add_help) {
2183
- this.add_argument(default_prefix + "h", default_prefix.repeat(2) + "help", {
2184
- action: "help",
2185
- default: SUPPRESS,
2186
- help: "show this help message and exit"
2187
- });
2448
+ this.add_argument(
2449
+ default_prefix + "h",
2450
+ default_prefix.repeat(2) + "help",
2451
+ {
2452
+ action: "help",
2453
+ default: SUPPRESS,
2454
+ help: "show this help message and exit"
2455
+ }
2456
+ );
2188
2457
  }
2189
2458
  if (version) {
2190
- this.add_argument(default_prefix + "v", default_prefix.repeat(2) + "version", {
2191
- action: "version",
2192
- default: SUPPRESS,
2193
- version: this.version,
2194
- help: "show program's version number and exit"
2195
- });
2459
+ this.add_argument(
2460
+ default_prefix + "v",
2461
+ default_prefix.repeat(2) + "version",
2462
+ {
2463
+ action: "version",
2464
+ default: SUPPRESS,
2465
+ version: this.version,
2466
+ help: "show program's version number and exit"
2467
+ }
2468
+ );
2196
2469
  }
2197
2470
  for (let parent of parents) {
2198
2471
  this._add_container_actions(parent);
2199
2472
  Object.assign(this._defaults, parent._defaults);
2200
2473
  }
2201
2474
  }
2475
+ // =======================
2476
+ // Pretty __repr__ methods
2477
+ // =======================
2202
2478
  _get_kwargs() {
2203
2479
  let names = [
2204
2480
  "prog",
@@ -2210,6 +2486,9 @@ var require_argparse = __commonJS({
2210
2486
  ];
2211
2487
  return names.map((name) => [name, getattr(this, name)]);
2212
2488
  }
2489
+ // ==================================
2490
+ // Optional/Positional adding methods
2491
+ // ==================================
2213
2492
  add_subparsers() {
2214
2493
  let [
2215
2494
  kwargs
@@ -2255,6 +2534,9 @@ var require_argparse = __commonJS({
2255
2534
  _get_positional_actions() {
2256
2535
  return this._actions.filter((action) => !action.option_strings.length);
2257
2536
  }
2537
+ // =====================================
2538
+ // Command line argument parsing methods
2539
+ // =====================================
2258
2540
  parse_args(args = void 0, namespace = void 0) {
2259
2541
  let argv;
2260
2542
  [args, argv] = this.parse_known_args(args, namespace);
@@ -2429,7 +2711,9 @@ var require_argparse = __commonJS({
2429
2711
  let start_index = 0;
2430
2712
  let max_option_string_index = Math.max(-1, ...Object.keys(option_string_indices).map(Number));
2431
2713
  while (start_index <= max_option_string_index) {
2432
- let next_option_string_index = Math.min(...Object.keys(option_string_indices).map(Number).filter((index) => index >= start_index));
2714
+ let next_option_string_index = Math.min(
2715
+ ...Object.keys(option_string_indices).map(Number).filter((index) => index >= start_index)
2716
+ );
2433
2717
  if (start_index !== next_option_string_index) {
2434
2718
  let positionals_end_index = consume_positionals(start_index);
2435
2719
  if (positionals_end_index > start_index) {
@@ -2455,13 +2739,20 @@ var require_argparse = __commonJS({
2455
2739
  required_actions.push(_get_action_name(action));
2456
2740
  } else {
2457
2741
  if (action.default !== void 0 && typeof action.default === "string" && hasattr(namespace, action.dest) && action.default === getattr(namespace, action.dest)) {
2458
- setattr(namespace, action.dest, this._get_value(action, action.default));
2742
+ setattr(
2743
+ namespace,
2744
+ action.dest,
2745
+ this._get_value(action, action.default)
2746
+ );
2459
2747
  }
2460
2748
  }
2461
2749
  }
2462
2750
  }
2463
2751
  if (required_actions.length) {
2464
- this.error(sub("the following arguments are required: %s", required_actions.join(", ")));
2752
+ this.error(sub(
2753
+ "the following arguments are required: %s",
2754
+ required_actions.join(", ")
2755
+ ));
2465
2756
  }
2466
2757
  for (let group of this._mutually_exclusive_groups) {
2467
2758
  if (group.required) {
@@ -2560,7 +2851,11 @@ var require_argparse = __commonJS({
2560
2851
  }
2561
2852
  let option_tuples = this._get_option_tuples(arg_string);
2562
2853
  if (option_tuples.length > 1) {
2563
- let options = option_tuples.map(([, option_string]) => option_string).join(", ");
2854
+ let options = option_tuples.map(([
2855
+ ,
2856
+ option_string
2857
+ /*, explicit_arg*/
2858
+ ]) => option_string).join(", ");
2564
2859
  let args = { option: arg_string, matches: options };
2565
2860
  let msg = "ambiguous option: %(option)s could match %(matches)s";
2566
2861
  this.error(sub(msg, args));
@@ -2645,6 +2940,9 @@ var require_argparse = __commonJS({
2645
2940
  }
2646
2941
  return nargs_pattern;
2647
2942
  }
2943
+ // ========================
2944
+ // Alt command line argument parsing, allowing free intermix
2945
+ // ========================
2648
2946
  parse_intermixed_args(args = void 0, namespace = void 0) {
2649
2947
  let argv;
2650
2948
  [args, argv] = this.parse_known_intermixed_args(args, namespace);
@@ -2682,7 +2980,10 @@ var require_argparse = __commonJS({
2682
2980
  action.save_default = action.default;
2683
2981
  action.default = SUPPRESS;
2684
2982
  }
2685
- [namespace, remaining_args] = this.parse_known_args(args, namespace);
2983
+ [namespace, remaining_args] = this.parse_known_args(
2984
+ args,
2985
+ namespace
2986
+ );
2686
2987
  for (let action of positionals) {
2687
2988
  let attr = getattr(namespace, action.dest);
2688
2989
  if (Array.isArray(attr) && attr.length === 0) {
@@ -2706,7 +3007,10 @@ var require_argparse = __commonJS({
2706
3007
  group.save_required = group.required;
2707
3008
  group.required = false;
2708
3009
  }
2709
- [namespace, extras] = this.parse_known_args(remaining_args, namespace);
3010
+ [namespace, extras] = this.parse_known_args(
3011
+ remaining_args,
3012
+ namespace
3013
+ );
2710
3014
  } finally {
2711
3015
  for (let action of optionals) {
2712
3016
  action.required = action.save_required;
@@ -2720,6 +3024,9 @@ var require_argparse = __commonJS({
2720
3024
  }
2721
3025
  return [namespace, extras];
2722
3026
  }
3027
+ // ========================
3028
+ // Value conversion methods
3029
+ // ========================
2723
3030
  _get_values(action, arg_strings) {
2724
3031
  if (![PARSER, REMAINDER].includes(action.nargs)) {
2725
3032
  try {
@@ -2806,14 +3113,25 @@ var require_argparse = __commonJS({
2806
3113
  throw new ArgumentError(action, sub(msg, args));
2807
3114
  }
2808
3115
  }
3116
+ // =======================
3117
+ // Help-formatting methods
3118
+ // =======================
2809
3119
  format_usage() {
2810
3120
  let formatter = this._get_formatter();
2811
- formatter.add_usage(this.usage, this._actions, this._mutually_exclusive_groups);
3121
+ formatter.add_usage(
3122
+ this.usage,
3123
+ this._actions,
3124
+ this._mutually_exclusive_groups
3125
+ );
2812
3126
  return formatter.format_help();
2813
3127
  }
2814
3128
  format_help() {
2815
3129
  let formatter = this._get_formatter();
2816
- formatter.add_usage(this.usage, this._actions, this._mutually_exclusive_groups);
3130
+ formatter.add_usage(
3131
+ this.usage,
3132
+ this._actions,
3133
+ this._mutually_exclusive_groups
3134
+ );
2817
3135
  formatter.add_text(this.description);
2818
3136
  for (let action_group of this._action_groups) {
2819
3137
  formatter.start_section(action_group.title);
@@ -2827,6 +3145,9 @@ var require_argparse = __commonJS({
2827
3145
  _get_formatter() {
2828
3146
  return new this.formatter_class({ prog: this.prog });
2829
3147
  }
3148
+ // =====================
3149
+ // Help-printing methods
3150
+ // =====================
2830
3151
  print_usage(file = void 0) {
2831
3152
  if (file === void 0)
2832
3153
  file = process.stdout;
@@ -2844,6 +3165,9 @@ var require_argparse = __commonJS({
2844
3165
  file.write(message);
2845
3166
  }
2846
3167
  }
3168
+ // ===============
3169
+ // Exiting methods
3170
+ // ===============
2847
3171
  exit(status = 0, message = void 0) {
2848
3172
  if (message) {
2849
3173
  this._print_message(message, process.stderr);
@@ -2916,8 +3240,9 @@ function normalizeUrl(url) {
2916
3240
  return `https://${url}`;
2917
3241
  }
2918
3242
  }
2919
- (async () => {
2920
- const pkg = JSON.parse(await import_fs.promises.readFile(import_path.default.join(__dirname, "../package.json"), "utf-8"));
3243
+ async function run() {
3244
+ const content = await import_fs.promises.readFile(import_path.default.join(__dirname, "../package.json"), "utf-8");
3245
+ const pkg = JSON.parse(content);
2921
3246
  const parser = new import_argparse.ArgumentParser({
2922
3247
  description: pkg.description
2923
3248
  });
@@ -2933,4 +3258,8 @@ function normalizeUrl(url) {
2933
3258
  const source = await page.content();
2934
3259
  await browser.close();
2935
3260
  console.log(source);
2936
- })();
3261
+ }
3262
+ run().catch((err) => {
3263
+ console.error(err);
3264
+ process.exitCode = 1;
3265
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/puppeteer-fetch",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Fetch HTML source from a webpage using Chrome as backend",
5
5
  "keywords": [
6
6
  "puppeteer",
@@ -16,7 +16,7 @@
16
16
  "type": "git",
17
17
  "url": "https://gitlab.com/html-validate/puppeteer-fetch.git"
18
18
  },
19
- "license": "ISC",
19
+ "license": "MIT",
20
20
  "author": "David Sveningsson <ext@sidvind.com>",
21
21
  "main": "dist/index.js",
22
22
  "bin": "puppeteer-fetch.js",
@@ -25,10 +25,10 @@
25
25
  "puppeteer-fetch.js"
26
26
  ],
27
27
  "dependencies": {
28
- "puppeteer": "13.6.0"
28
+ "puppeteer": "20.1.1"
29
29
  },
30
30
  "engines": {
31
- "node": ">= 12.22",
31
+ "node": ">= 16",
32
32
  "npm": ">= 7"
33
33
  },
34
34
  "publishConfig": {