@skrillex1224/playwright-toolkit 3.0.28 → 3.0.30

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.
package/dist/browser.js CHANGED
@@ -34,7 +34,6 @@ var require_constants = __commonJS({
34
34
  "use strict";
35
35
  var WIN_SLASH = "\\\\/";
36
36
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
37
- var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
38
37
  var DOT_LITERAL = "\\.";
39
38
  var PLUS_LITERAL = "\\+";
40
39
  var QMARK_LITERAL = "\\?";
@@ -85,7 +84,6 @@ var require_constants = __commonJS({
85
84
  SEP: "\\"
86
85
  };
87
86
  var POSIX_REGEX_SOURCE = {
88
- __proto__: null,
89
87
  alnum: "a-zA-Z0-9",
90
88
  alpha: "a-zA-Z",
91
89
  ascii: "\\x00-\\x7F",
@@ -102,7 +100,6 @@ var require_constants = __commonJS({
102
100
  xdigit: "A-Fa-f0-9"
103
101
  };
104
102
  module.exports = {
105
- DEFAULT_MAX_EXTGLOB_RECURSION,
106
103
  MAX_LENGTH: 1024 * 64,
107
104
  POSIX_REGEX_SOURCE,
108
105
  // regular expressions
@@ -653,213 +650,6 @@ var require_parse = __commonJS({
653
650
  var syntaxError = (type, char) => {
654
651
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
655
652
  };
656
- var splitTopLevel = (input) => {
657
- const parts = [];
658
- let bracket = 0;
659
- let paren = 0;
660
- let quote = 0;
661
- let value = "";
662
- let escaped = false;
663
- for (const ch of input) {
664
- if (escaped === true) {
665
- value += ch;
666
- escaped = false;
667
- continue;
668
- }
669
- if (ch === "\\") {
670
- value += ch;
671
- escaped = true;
672
- continue;
673
- }
674
- if (ch === '"') {
675
- quote = quote === 1 ? 0 : 1;
676
- value += ch;
677
- continue;
678
- }
679
- if (quote === 0) {
680
- if (ch === "[") {
681
- bracket++;
682
- } else if (ch === "]" && bracket > 0) {
683
- bracket--;
684
- } else if (bracket === 0) {
685
- if (ch === "(") {
686
- paren++;
687
- } else if (ch === ")" && paren > 0) {
688
- paren--;
689
- } else if (ch === "|" && paren === 0) {
690
- parts.push(value);
691
- value = "";
692
- continue;
693
- }
694
- }
695
- }
696
- value += ch;
697
- }
698
- parts.push(value);
699
- return parts;
700
- };
701
- var isPlainBranch = (branch) => {
702
- let escaped = false;
703
- for (const ch of branch) {
704
- if (escaped === true) {
705
- escaped = false;
706
- continue;
707
- }
708
- if (ch === "\\") {
709
- escaped = true;
710
- continue;
711
- }
712
- if (/[?*+@!()[\]{}]/.test(ch)) {
713
- return false;
714
- }
715
- }
716
- return true;
717
- };
718
- var normalizeSimpleBranch = (branch) => {
719
- let value = branch.trim();
720
- let changed = true;
721
- while (changed === true) {
722
- changed = false;
723
- if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
724
- value = value.slice(2, -1);
725
- changed = true;
726
- }
727
- }
728
- if (!isPlainBranch(value)) {
729
- return;
730
- }
731
- return value.replace(/\\(.)/g, "$1");
732
- };
733
- var hasRepeatedCharPrefixOverlap = (branches) => {
734
- const values = branches.map(normalizeSimpleBranch).filter(Boolean);
735
- for (let i = 0; i < values.length; i++) {
736
- for (let j = i + 1; j < values.length; j++) {
737
- const a = values[i];
738
- const b = values[j];
739
- const char = a[0];
740
- if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
741
- continue;
742
- }
743
- if (a === b || a.startsWith(b) || b.startsWith(a)) {
744
- return true;
745
- }
746
- }
747
- }
748
- return false;
749
- };
750
- var parseRepeatedExtglob = (pattern, requireEnd = true) => {
751
- if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
752
- return;
753
- }
754
- let bracket = 0;
755
- let paren = 0;
756
- let quote = 0;
757
- let escaped = false;
758
- for (let i = 1; i < pattern.length; i++) {
759
- const ch = pattern[i];
760
- if (escaped === true) {
761
- escaped = false;
762
- continue;
763
- }
764
- if (ch === "\\") {
765
- escaped = true;
766
- continue;
767
- }
768
- if (ch === '"') {
769
- quote = quote === 1 ? 0 : 1;
770
- continue;
771
- }
772
- if (quote === 1) {
773
- continue;
774
- }
775
- if (ch === "[") {
776
- bracket++;
777
- continue;
778
- }
779
- if (ch === "]" && bracket > 0) {
780
- bracket--;
781
- continue;
782
- }
783
- if (bracket > 0) {
784
- continue;
785
- }
786
- if (ch === "(") {
787
- paren++;
788
- continue;
789
- }
790
- if (ch === ")") {
791
- paren--;
792
- if (paren === 0) {
793
- if (requireEnd === true && i !== pattern.length - 1) {
794
- return;
795
- }
796
- return {
797
- type: pattern[0],
798
- body: pattern.slice(2, i),
799
- end: i
800
- };
801
- }
802
- }
803
- }
804
- };
805
- var getStarExtglobSequenceOutput = (pattern) => {
806
- let index = 0;
807
- const chars = [];
808
- while (index < pattern.length) {
809
- const match = parseRepeatedExtglob(pattern.slice(index), false);
810
- if (!match || match.type !== "*") {
811
- return;
812
- }
813
- const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
814
- if (branches.length !== 1) {
815
- return;
816
- }
817
- const branch = normalizeSimpleBranch(branches[0]);
818
- if (!branch || branch.length !== 1) {
819
- return;
820
- }
821
- chars.push(branch);
822
- index += match.end + 1;
823
- }
824
- if (chars.length < 1) {
825
- return;
826
- }
827
- const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
828
- return `${source}*`;
829
- };
830
- var repeatedExtglobRecursion = (pattern) => {
831
- let depth = 0;
832
- let value = pattern.trim();
833
- let match = parseRepeatedExtglob(value);
834
- while (match) {
835
- depth++;
836
- value = match.body.trim();
837
- match = parseRepeatedExtglob(value);
838
- }
839
- return depth;
840
- };
841
- var analyzeRepeatedExtglob = (body, options) => {
842
- if (options.maxExtglobRecursion === false) {
843
- return { risky: false };
844
- }
845
- const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
846
- const branches = splitTopLevel(body).map((branch) => branch.trim());
847
- if (branches.length > 1) {
848
- if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
849
- return { risky: true };
850
- }
851
- }
852
- for (const branch of branches) {
853
- const safeOutput = getStarExtglobSequenceOutput(branch);
854
- if (safeOutput) {
855
- return { risky: true, safeOutput };
856
- }
857
- if (repeatedExtglobRecursion(branch) > max) {
858
- return { risky: true };
859
- }
860
- }
861
- return { risky: false };
862
- };
863
653
  var parse = (input, options) => {
864
654
  if (typeof input !== "string") {
865
655
  throw new TypeError("Expected a string");
@@ -990,8 +780,6 @@ var require_parse = __commonJS({
990
780
  token.prev = prev;
991
781
  token.parens = state2.parens;
992
782
  token.output = state2.output;
993
- token.startIndex = state2.index;
994
- token.tokensIndex = tokens.length;
995
783
  const output = (opts.capture ? "(" : "") + token.open;
996
784
  increment("parens");
997
785
  push({ type, value: value2, output: state2.output ? "" : ONE_CHAR });
@@ -999,26 +787,6 @@ var require_parse = __commonJS({
999
787
  extglobs.push(token);
1000
788
  };
1001
789
  const extglobClose = (token) => {
1002
- const literal = input.slice(token.startIndex, state2.index + 1);
1003
- const body = input.slice(token.startIndex + 2, state2.index);
1004
- const analysis = analyzeRepeatedExtglob(body, opts);
1005
- if ((token.type === "plus" || token.type === "star") && analysis.risky) {
1006
- const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
1007
- const open = tokens[token.tokensIndex];
1008
- open.type = "text";
1009
- open.value = literal;
1010
- open.output = safeOutput || utils.escapeRegex(literal);
1011
- for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
1012
- tokens[i].value = "";
1013
- tokens[i].output = "";
1014
- delete tokens[i].suffix;
1015
- }
1016
- state2.output = token.output + open.output;
1017
- state2.backtrack = true;
1018
- push({ type: "paren", extglob: true, value, output: "" });
1019
- decrement("parens");
1020
- return;
1021
- }
1022
790
  let output = token.close + (opts.capture ? ")" : "");
1023
791
  let rest;
1024
792
  if (token.type === "negate") {