@qwik.dev/devtools 0.0.3 → 0.0.4

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 (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -47
  3. package/dist/component/_virtual/_commonjsHelpers.qwik.cjs +6 -0
  4. package/dist/component/_virtual/_commonjsHelpers.qwik.mjs +6 -0
  5. package/{lib → dist/component}/devtools.qwik.cjs +19 -20
  6. package/{lib → dist/component}/devtools.qwik.mjs +11 -12
  7. package/{lib → dist/component}/index.qwik.cjs +0 -2
  8. package/dist/component/index.qwik.mjs +4 -0
  9. package/{lib-types → dist/component/lib-types/devtools/src}/index.d.ts +0 -1
  10. package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/hi.qwik.qwik.cjs +60 -0
  11. package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/hi.qwik.qwik.mjs +60 -0
  12. package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/lu.qwik.qwik.cjs +32 -0
  13. package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/lu.qwik.qwik.mjs +32 -0
  14. package/dist/component/node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.qwik.cjs +54 -0
  15. package/dist/component/node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.qwik.mjs +54 -0
  16. package/dist/component/node_modules/.pnpm/birpc@0.2.19/node_modules/birpc/dist/index.qwik.cjs +128 -0
  17. package/dist/component/node_modules/.pnpm/birpc@0.2.19/node_modules/birpc/dist/index.qwik.mjs +128 -0
  18. package/dist/component/node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.qwik.cjs +149 -0
  19. package/dist/component/node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.qwik.mjs +150 -0
  20. package/dist/component/node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.qwik.cjs +36 -0
  21. package/dist/component/node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.qwik.mjs +36 -0
  22. package/dist/component/node_modules/.pnpm/dree@5.1.5/node_modules/dree/bundled/lib/esm/index.esm.qwik.cjs +12 -0
  23. package/dist/component/node_modules/.pnpm/dree@5.1.5/node_modules/dree/bundled/lib/esm/index.esm.qwik.mjs +12 -0
  24. package/dist/component/node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.qwik.cjs +17 -0
  25. package/dist/component/node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.qwik.mjs +17 -0
  26. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/assert-valid-pattern.qwik.cjs +12 -0
  27. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/assert-valid-pattern.qwik.mjs +12 -0
  28. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/ast.qwik.cjs +513 -0
  29. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/ast.qwik.mjs +513 -0
  30. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/brace-expressions.qwik.cjs +110 -0
  31. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/brace-expressions.qwik.mjs +110 -0
  32. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/escape.qwik.cjs +6 -0
  33. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/escape.qwik.mjs +6 -0
  34. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.qwik.cjs +738 -0
  35. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.qwik.mjs +738 -0
  36. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/unescape.qwik.cjs +6 -0
  37. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/unescape.qwik.mjs +6 -0
  38. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.qwik.cjs +120 -0
  39. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.qwik.mjs +120 -0
  40. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.qwik.cjs +23 -0
  41. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.qwik.mjs +23 -0
  42. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.qwik.cjs +18 -0
  43. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.qwik.mjs +18 -0
  44. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.qwik.cjs +23 -0
  45. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.qwik.mjs +23 -0
  46. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.cjs +91 -0
  47. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.mjs +91 -0
  48. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.qwik.cjs +51 -0
  49. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.qwik.mjs +51 -0
  50. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.qwik.cjs +30 -0
  51. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.qwik.mjs +30 -0
  52. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.qwik.cjs +148 -0
  53. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.qwik.mjs +148 -0
  54. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.qwik.cjs +28 -0
  55. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.qwik.mjs +28 -0
  56. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.qwik.cjs +203 -0
  57. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.qwik.mjs +203 -0
  58. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.qwik.cjs +47 -0
  59. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.qwik.mjs +47 -0
  60. package/dist/component/node_modules/.pnpm/vite-hot-client@0.2.4_vite@5.4.10_@types_node@20.14.11_/node_modules/vite-hot-client/dist/index.qwik.cjs +35 -0
  61. package/dist/component/node_modules/.pnpm/vite-hot-client@0.2.4_vite@5.4.10_@types_node@20.14.11_/node_modules/vite-hot-client/dist/index.qwik.mjs +35 -0
  62. package/{lib/kit → dist/component/packages/kit/src}/client.qwik.cjs +5 -5
  63. package/{lib/kit → dist/component/packages/kit/src}/client.qwik.mjs +2 -2
  64. package/{lib/kit → dist/component/packages/kit/src}/context.qwik.cjs +0 -12
  65. package/{lib/kit → dist/component/packages/kit/src}/context.qwik.mjs +2 -14
  66. package/{lib/kit → dist/component/packages/kit/src}/globals.qwik.cjs +0 -4
  67. package/dist/component/packages/kit/src/globals.qwik.mjs +6 -0
  68. package/dist/plugin/index.cjs +10504 -0
  69. package/dist/plugin/index.mjs +10492 -0
  70. package/package.json +26 -41
  71. package/lib/index.qwik.mjs +0 -6
  72. package/lib/kit/globals.qwik.mjs +0 -10
  73. package/lib/kit/server.qwik.cjs +0 -18
  74. package/lib/kit/server.qwik.mjs +0 -18
  75. package/lib/plugin/assets/index.qwik.cjs +0 -67
  76. package/lib/plugin/assets/index.qwik.mjs +0 -67
  77. package/lib/plugin/index.qwik.cjs +0 -49
  78. package/lib/plugin/index.qwik.mjs +0 -49
  79. package/lib/plugin/npm/index.qwik.cjs +0 -19
  80. package/lib/plugin/npm/index.qwik.mjs +0 -19
  81. package/lib/plugin/routes/index.qwik.cjs +0 -17
  82. package/lib/plugin/routes/index.qwik.mjs +0 -17
  83. package/lib/plugin/rpc/index.qwik.cjs +0 -14
  84. package/lib/plugin/rpc/index.qwik.mjs +0 -14
  85. package/lib/utils/location.qwik.cjs +0 -9
  86. package/lib/utils/location.qwik.mjs +0 -9
  87. package/lib-types/plugin/assets/index.d.ts +0 -5
  88. package/lib-types/plugin/components/index.d.ts +0 -0
  89. package/lib-types/plugin/index.d.ts +0 -2
  90. package/lib-types/plugin/npm/index.d.ts +0 -5
  91. package/lib-types/plugin/routes/index.d.ts +0 -5
  92. package/lib-types/plugin/rpc/index.d.ts +0 -3
  93. package/lib-types/plugin/types/index.d.ts +0 -5
  94. package/src/devtools.css +0 -558
  95. package/src/devtools.tsx +0 -404
  96. package/src/entry.dev.tsx +0 -17
  97. package/src/entry.ssr.tsx +0 -25
  98. package/src/index.ts +0 -2
  99. package/src/kit/client.ts +0 -21
  100. package/src/kit/constants.ts +0 -1
  101. package/src/kit/context.ts +0 -42
  102. package/src/kit/globals.ts +0 -22
  103. package/src/kit/index.ts +0 -4
  104. package/src/kit/server.ts +0 -21
  105. package/src/kit/shared.ts +0 -11
  106. package/src/kit/types.ts +0 -48
  107. package/src/plugin/assets/index.ts +0 -126
  108. package/src/plugin/components/index.ts +0 -0
  109. package/src/plugin/index.ts +0 -50
  110. package/src/plugin/npm/index.ts +0 -24
  111. package/src/plugin/routes/index.ts +0 -16
  112. package/src/plugin/rpc/index.ts +0 -14
  113. package/src/plugin/types/index.ts +0 -6
  114. package/src/root.tsx +0 -15
  115. package/src/utils/location.ts +0 -9
  116. /package/{lib → dist/component}/devtools.css.qwik.cjs +0 -0
  117. /package/{lib → dist/component}/devtools.css.qwik.mjs +0 -0
  118. /package/{lib-types → dist/component/lib-types/devtools/src}/devtools.d.ts +0 -0
  119. /package/{lib-types → dist/component/lib-types/devtools/src}/entry.dev.d.ts +0 -0
  120. /package/{lib-types → dist/component/lib-types/devtools/src}/entry.ssr.d.ts +0 -0
  121. /package/{lib-types → dist/component/lib-types/devtools/src}/root.d.ts +0 -0
  122. /package/{lib-types → dist/component/lib-types/devtools/src}/utils/location.d.ts +0 -0
  123. /package/{lib-types/kit → dist/component/lib-types/kit/src}/client.d.ts +0 -0
  124. /package/{lib-types/kit → dist/component/lib-types/kit/src}/constants.d.ts +0 -0
  125. /package/{lib-types/kit → dist/component/lib-types/kit/src}/context.d.ts +0 -0
  126. /package/{lib-types/kit → dist/component/lib-types/kit/src}/globals.d.ts +0 -0
  127. /package/{lib-types/kit → dist/component/lib-types/kit/src}/index.d.ts +0 -0
  128. /package/{lib-types/kit → dist/component/lib-types/kit/src}/server.d.ts +0 -0
  129. /package/{lib-types/kit → dist/component/lib-types/kit/src}/shared.d.ts +0 -0
  130. /package/{lib-types/kit → dist/component/lib-types/kit/src}/types.d.ts +0 -0
  131. /package/{lib/kit → dist/component/packages/kit/src}/constants.qwik.cjs +0 -0
  132. /package/{lib/kit → dist/component/packages/kit/src}/constants.qwik.mjs +0 -0
  133. /package/{lib/kit → dist/component/packages/kit/src}/shared.qwik.cjs +0 -0
  134. /package/{lib/kit → dist/component/packages/kit/src}/shared.qwik.mjs +0 -0
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const MAX_PATTERN_LENGTH = 1024 * 64;
4
+ const assertValidPattern = (pattern) => {
5
+ if (typeof pattern !== "string") {
6
+ throw new TypeError("invalid pattern");
7
+ }
8
+ if (pattern.length > MAX_PATTERN_LENGTH) {
9
+ throw new TypeError("pattern is too long");
10
+ }
11
+ };
12
+ exports.assertValidPattern = assertValidPattern;
@@ -0,0 +1,12 @@
1
+ const MAX_PATTERN_LENGTH = 1024 * 64;
2
+ const assertValidPattern = (pattern) => {
3
+ if (typeof pattern !== "string") {
4
+ throw new TypeError("invalid pattern");
5
+ }
6
+ if (pattern.length > MAX_PATTERN_LENGTH) {
7
+ throw new TypeError("pattern is too long");
8
+ }
9
+ };
10
+ export {
11
+ assertValidPattern
12
+ };
@@ -0,0 +1,513 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __typeError = (msg) => {
4
+ throw TypeError(msg);
5
+ };
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
9
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
10
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
11
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
12
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
13
+ var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
14
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
15
+ const braceExpressions = require("./brace-expressions.qwik.cjs");
16
+ const unescape = require("./unescape.qwik.cjs");
17
+ const types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
18
+ const isExtglobType = (c) => types.has(c);
19
+ const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
20
+ const startNoDot = "(?!\\.)";
21
+ const addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
22
+ const justDots = /* @__PURE__ */ new Set(["..", "."]);
23
+ const reSpecials = new Set("().*{}+?[]^$\\!");
24
+ const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
25
+ const qmark = "[^/]";
26
+ const star = qmark + "*?";
27
+ const starNoEmpty = qmark + "+?";
28
+ const _AST = class _AST {
29
+ constructor(type, parent, options = {}) {
30
+ __privateAdd(this, _AST_instances);
31
+ __publicField(this, "type");
32
+ __privateAdd(this, _root);
33
+ __privateAdd(this, _hasMagic);
34
+ __privateAdd(this, _uflag, false);
35
+ __privateAdd(this, _parts, []);
36
+ __privateAdd(this, _parent);
37
+ __privateAdd(this, _parentIndex);
38
+ __privateAdd(this, _negs);
39
+ __privateAdd(this, _filledNegs, false);
40
+ __privateAdd(this, _options);
41
+ __privateAdd(this, _toString);
42
+ // set to true if it's an extglob with no children
43
+ // (which really means one child of '')
44
+ __privateAdd(this, _emptyExt, false);
45
+ this.type = type;
46
+ if (type)
47
+ __privateSet(this, _hasMagic, true);
48
+ __privateSet(this, _parent, parent);
49
+ __privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
50
+ __privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
51
+ __privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
52
+ if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
53
+ __privateGet(this, _negs).push(this);
54
+ __privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
55
+ }
56
+ get hasMagic() {
57
+ if (__privateGet(this, _hasMagic) !== void 0)
58
+ return __privateGet(this, _hasMagic);
59
+ for (const p of __privateGet(this, _parts)) {
60
+ if (typeof p === "string")
61
+ continue;
62
+ if (p.type || p.hasMagic)
63
+ return __privateSet(this, _hasMagic, true);
64
+ }
65
+ return __privateGet(this, _hasMagic);
66
+ }
67
+ // reconstructs the pattern
68
+ toString() {
69
+ if (__privateGet(this, _toString) !== void 0)
70
+ return __privateGet(this, _toString);
71
+ if (!this.type) {
72
+ return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
73
+ } else {
74
+ return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
75
+ }
76
+ }
77
+ push(...parts) {
78
+ for (const p of parts) {
79
+ if (p === "")
80
+ continue;
81
+ if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
82
+ throw new Error("invalid part: " + p);
83
+ }
84
+ __privateGet(this, _parts).push(p);
85
+ }
86
+ }
87
+ toJSON() {
88
+ const ret = this.type === null ? __privateGet(this, _parts).slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...__privateGet(this, _parts).map((p) => p.toJSON())];
89
+ if (this.isStart() && !this.type)
90
+ ret.unshift([]);
91
+ if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && __privateGet(this, _parent)?.type === "!")) {
92
+ ret.push({});
93
+ }
94
+ return ret;
95
+ }
96
+ isStart() {
97
+ if (__privateGet(this, _root) === this)
98
+ return true;
99
+ if (!__privateGet(this, _parent)?.isStart())
100
+ return false;
101
+ if (__privateGet(this, _parentIndex) === 0)
102
+ return true;
103
+ const p = __privateGet(this, _parent);
104
+ for (let i = 0; i < __privateGet(this, _parentIndex); i++) {
105
+ const pp = __privateGet(p, _parts)[i];
106
+ if (!(pp instanceof _AST && pp.type === "!")) {
107
+ return false;
108
+ }
109
+ }
110
+ return true;
111
+ }
112
+ isEnd() {
113
+ if (__privateGet(this, _root) === this)
114
+ return true;
115
+ if (__privateGet(this, _parent)?.type === "!")
116
+ return true;
117
+ if (!__privateGet(this, _parent)?.isEnd())
118
+ return false;
119
+ if (!this.type)
120
+ return __privateGet(this, _parent)?.isEnd();
121
+ const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
122
+ return __privateGet(this, _parentIndex) === pl - 1;
123
+ }
124
+ copyIn(part) {
125
+ if (typeof part === "string")
126
+ this.push(part);
127
+ else
128
+ this.push(part.clone(this));
129
+ }
130
+ clone(parent) {
131
+ const c = new _AST(this.type, parent);
132
+ for (const p of __privateGet(this, _parts)) {
133
+ c.copyIn(p);
134
+ }
135
+ return c;
136
+ }
137
+ static fromGlob(pattern, options = {}) {
138
+ var _a;
139
+ const ast = new _AST(null, void 0, options);
140
+ __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
141
+ return ast;
142
+ }
143
+ // returns the regular expression if there's magic, or the unescaped
144
+ // string if not.
145
+ toMMPattern() {
146
+ if (this !== __privateGet(this, _root))
147
+ return __privateGet(this, _root).toMMPattern();
148
+ const glob = this.toString();
149
+ const [re, body, hasMagic, uflag] = this.toRegExpSource();
150
+ const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
151
+ if (!anyMagic) {
152
+ return body;
153
+ }
154
+ const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
155
+ return Object.assign(new RegExp(`^${re}$`, flags), {
156
+ _src: re,
157
+ _glob: glob
158
+ });
159
+ }
160
+ get options() {
161
+ return __privateGet(this, _options);
162
+ }
163
+ // returns the string match, the regexp source, whether there's magic
164
+ // in the regexp (so a regular expression is required) and whether or
165
+ // not the uflag is needed for the regular expression (for posix classes)
166
+ // TODO: instead of injecting the start/end at this point, just return
167
+ // the BODY of the regexp, along with the start/end portions suitable
168
+ // for binding the start/end in either a joined full-path makeRe context
169
+ // (where we bind to (^|/), or a standalone matchPart context (where
170
+ // we bind to ^, and not /). Otherwise slashes get duped!
171
+ //
172
+ // In part-matching mode, the start is:
173
+ // - if not isStart: nothing
174
+ // - if traversal possible, but not allowed: ^(?!\.\.?$)
175
+ // - if dots allowed or not possible: ^
176
+ // - if dots possible and not allowed: ^(?!\.)
177
+ // end is:
178
+ // - if not isEnd(): nothing
179
+ // - else: $
180
+ //
181
+ // In full-path matching mode, we put the slash at the START of the
182
+ // pattern, so start is:
183
+ // - if first pattern: same as part-matching mode
184
+ // - if not isStart(): nothing
185
+ // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
186
+ // - if dots allowed or not possible: /
187
+ // - if dots possible and not allowed: /(?!\.)
188
+ // end is:
189
+ // - if last pattern, same as part-matching mode
190
+ // - else nothing
191
+ //
192
+ // Always put the (?:$|/) on negated tails, though, because that has to be
193
+ // there to bind the end of the negated pattern portion, and it's easier to
194
+ // just stick it in now rather than try to inject it later in the middle of
195
+ // the pattern.
196
+ //
197
+ // We can just always return the same end, and leave it up to the caller
198
+ // to know whether it's going to be used joined or in parts.
199
+ // And, if the start is adjusted slightly, can do the same there:
200
+ // - if not isStart: nothing
201
+ // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
202
+ // - if dots allowed or not possible: (?:/|^)
203
+ // - if dots possible and not allowed: (?:/|^)(?!\.)
204
+ //
205
+ // But it's better to have a simpler binding without a conditional, for
206
+ // performance, so probably better to return both start options.
207
+ //
208
+ // Then the caller just ignores the end if it's not the first pattern,
209
+ // and the start always gets applied.
210
+ //
211
+ // But that's always going to be $ if it's the ending pattern, or nothing,
212
+ // so the caller can just attach $ at the end of the pattern when building.
213
+ //
214
+ // So the todo is:
215
+ // - better detect what kind of start is needed
216
+ // - return both flavors of starting pattern
217
+ // - attach $ at the end of the pattern when creating the actual RegExp
218
+ //
219
+ // Ah, but wait, no, that all only applies to the root when the first pattern
220
+ // is not an extglob. If the first pattern IS an extglob, then we need all
221
+ // that dot prevention biz to live in the extglob portions, because eg
222
+ // +(*|.x*) can match .xy but not .yx.
223
+ //
224
+ // So, return the two flavors if it's #root and the first child is not an
225
+ // AST, otherwise leave it to the child AST to handle it, and there,
226
+ // use the (?:^|/) style of start binding.
227
+ //
228
+ // Even simplified further:
229
+ // - Since the start for a join is eg /(?!\.) and the start for a part
230
+ // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
231
+ // or start or whatever) and prepend ^ or / at the Regexp construction.
232
+ toRegExpSource(allowDot) {
233
+ const dot = allowDot ?? !!__privateGet(this, _options).dot;
234
+ if (__privateGet(this, _root) === this)
235
+ __privateMethod(this, _AST_instances, fillNegs_fn).call(this);
236
+ if (!this.type) {
237
+ const noEmpty = this.isStart() && this.isEnd();
238
+ const src = __privateGet(this, _parts).map((p) => {
239
+ var _a;
240
+ const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a = _AST, _AST_static, parseGlob_fn).call(_a, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
241
+ __privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
242
+ __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
243
+ return re;
244
+ }).join("");
245
+ let start2 = "";
246
+ if (this.isStart()) {
247
+ if (typeof __privateGet(this, _parts)[0] === "string") {
248
+ const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
249
+ if (!dotTravAllowed) {
250
+ const aps = addPatternStart;
251
+ const needNoTrav = (
252
+ // dots are allowed, and the pattern starts with [ or .
253
+ dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
254
+ src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
255
+ src.startsWith("\\.\\.") && aps.has(src.charAt(4))
256
+ );
257
+ const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
258
+ start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
259
+ }
260
+ }
261
+ }
262
+ let end = "";
263
+ if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && __privateGet(this, _parent)?.type === "!") {
264
+ end = "(?:$|\\/)";
265
+ }
266
+ const final2 = start2 + src + end;
267
+ return [
268
+ final2,
269
+ unescape.unescape(src),
270
+ __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
271
+ __privateGet(this, _uflag)
272
+ ];
273
+ }
274
+ const repeated = this.type === "*" || this.type === "+";
275
+ const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
276
+ let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
277
+ if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
278
+ const s = this.toString();
279
+ __privateSet(this, _parts, [s]);
280
+ this.type = null;
281
+ __privateSet(this, _hasMagic, void 0);
282
+ return [s, unescape.unescape(this.toString()), false, false];
283
+ }
284
+ let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
285
+ if (bodyDotAllowed === body) {
286
+ bodyDotAllowed = "";
287
+ }
288
+ if (bodyDotAllowed) {
289
+ body = `(?:${body})(?:${bodyDotAllowed})*?`;
290
+ }
291
+ let final = "";
292
+ if (this.type === "!" && __privateGet(this, _emptyExt)) {
293
+ final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
294
+ } else {
295
+ const close = this.type === "!" ? (
296
+ // !() must match something,but !(x) can match ''
297
+ "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
298
+ ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
299
+ final = start + body + close;
300
+ }
301
+ return [
302
+ final,
303
+ unescape.unescape(body),
304
+ __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
305
+ __privateGet(this, _uflag)
306
+ ];
307
+ }
308
+ };
309
+ _root = new WeakMap();
310
+ _hasMagic = new WeakMap();
311
+ _uflag = new WeakMap();
312
+ _parts = new WeakMap();
313
+ _parent = new WeakMap();
314
+ _parentIndex = new WeakMap();
315
+ _negs = new WeakMap();
316
+ _filledNegs = new WeakMap();
317
+ _options = new WeakMap();
318
+ _toString = new WeakMap();
319
+ _emptyExt = new WeakMap();
320
+ _AST_instances = new WeakSet();
321
+ fillNegs_fn = function() {
322
+ if (this !== __privateGet(this, _root))
323
+ throw new Error("should only call on root");
324
+ if (__privateGet(this, _filledNegs))
325
+ return this;
326
+ this.toString();
327
+ __privateSet(this, _filledNegs, true);
328
+ let n;
329
+ while (n = __privateGet(this, _negs).pop()) {
330
+ if (n.type !== "!")
331
+ continue;
332
+ let p = n;
333
+ let pp = __privateGet(p, _parent);
334
+ while (pp) {
335
+ for (let i = __privateGet(p, _parentIndex) + 1; !pp.type && i < __privateGet(pp, _parts).length; i++) {
336
+ for (const part of __privateGet(n, _parts)) {
337
+ if (typeof part === "string") {
338
+ throw new Error("string part in extglob AST??");
339
+ }
340
+ part.copyIn(__privateGet(pp, _parts)[i]);
341
+ }
342
+ }
343
+ p = pp;
344
+ pp = __privateGet(p, _parent);
345
+ }
346
+ }
347
+ return this;
348
+ };
349
+ _AST_static = new WeakSet();
350
+ parseAST_fn = function(str, ast, pos, opt) {
351
+ var _a, _b;
352
+ let escaping = false;
353
+ let inBrace = false;
354
+ let braceStart = -1;
355
+ let braceNeg = false;
356
+ if (ast.type === null) {
357
+ let i2 = pos;
358
+ let acc2 = "";
359
+ while (i2 < str.length) {
360
+ const c = str.charAt(i2++);
361
+ if (escaping || c === "\\") {
362
+ escaping = !escaping;
363
+ acc2 += c;
364
+ continue;
365
+ }
366
+ if (inBrace) {
367
+ if (i2 === braceStart + 1) {
368
+ if (c === "^" || c === "!") {
369
+ braceNeg = true;
370
+ }
371
+ } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
372
+ inBrace = false;
373
+ }
374
+ acc2 += c;
375
+ continue;
376
+ } else if (c === "[") {
377
+ inBrace = true;
378
+ braceStart = i2;
379
+ braceNeg = false;
380
+ acc2 += c;
381
+ continue;
382
+ }
383
+ if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
384
+ ast.push(acc2);
385
+ acc2 = "";
386
+ const ext = new _AST(c, ast);
387
+ i2 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext, i2, opt);
388
+ ast.push(ext);
389
+ continue;
390
+ }
391
+ acc2 += c;
392
+ }
393
+ ast.push(acc2);
394
+ return i2;
395
+ }
396
+ let i = pos + 1;
397
+ let part = new _AST(null, ast);
398
+ const parts = [];
399
+ let acc = "";
400
+ while (i < str.length) {
401
+ const c = str.charAt(i++);
402
+ if (escaping || c === "\\") {
403
+ escaping = !escaping;
404
+ acc += c;
405
+ continue;
406
+ }
407
+ if (inBrace) {
408
+ if (i === braceStart + 1) {
409
+ if (c === "^" || c === "!") {
410
+ braceNeg = true;
411
+ }
412
+ } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
413
+ inBrace = false;
414
+ }
415
+ acc += c;
416
+ continue;
417
+ } else if (c === "[") {
418
+ inBrace = true;
419
+ braceStart = i;
420
+ braceNeg = false;
421
+ acc += c;
422
+ continue;
423
+ }
424
+ if (isExtglobType(c) && str.charAt(i) === "(") {
425
+ part.push(acc);
426
+ acc = "";
427
+ const ext = new _AST(c, part);
428
+ part.push(ext);
429
+ i = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext, i, opt);
430
+ continue;
431
+ }
432
+ if (c === "|") {
433
+ part.push(acc);
434
+ acc = "";
435
+ parts.push(part);
436
+ part = new _AST(null, ast);
437
+ continue;
438
+ }
439
+ if (c === ")") {
440
+ if (acc === "" && __privateGet(ast, _parts).length === 0) {
441
+ __privateSet(ast, _emptyExt, true);
442
+ }
443
+ part.push(acc);
444
+ acc = "";
445
+ ast.push(...parts, part);
446
+ return i;
447
+ }
448
+ acc += c;
449
+ }
450
+ ast.type = null;
451
+ __privateSet(ast, _hasMagic, void 0);
452
+ __privateSet(ast, _parts, [str.substring(pos - 1)]);
453
+ return i;
454
+ };
455
+ partsToRegExp_fn = function(dot) {
456
+ return __privateGet(this, _parts).map((p) => {
457
+ if (typeof p === "string") {
458
+ throw new Error("string type in extglob ast??");
459
+ }
460
+ const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
461
+ __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
462
+ return re;
463
+ }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
464
+ };
465
+ parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
466
+ let escaping = false;
467
+ let re = "";
468
+ let uflag = false;
469
+ for (let i = 0; i < glob.length; i++) {
470
+ const c = glob.charAt(i);
471
+ if (escaping) {
472
+ escaping = false;
473
+ re += (reSpecials.has(c) ? "\\" : "") + c;
474
+ continue;
475
+ }
476
+ if (c === "\\") {
477
+ if (i === glob.length - 1) {
478
+ re += "\\\\";
479
+ } else {
480
+ escaping = true;
481
+ }
482
+ continue;
483
+ }
484
+ if (c === "[") {
485
+ const [src, needUflag, consumed, magic] = braceExpressions.parseClass(glob, i);
486
+ if (consumed) {
487
+ re += src;
488
+ uflag = uflag || needUflag;
489
+ i += consumed - 1;
490
+ hasMagic = hasMagic || magic;
491
+ continue;
492
+ }
493
+ }
494
+ if (c === "*") {
495
+ if (noEmpty && glob === "*")
496
+ re += starNoEmpty;
497
+ else
498
+ re += star;
499
+ hasMagic = true;
500
+ continue;
501
+ }
502
+ if (c === "?") {
503
+ re += qmark;
504
+ hasMagic = true;
505
+ continue;
506
+ }
507
+ re += regExpEscape(c);
508
+ }
509
+ return [re, unescape.unescape(glob), !!hasMagic, uflag];
510
+ };
511
+ __privateAdd(_AST, _AST_static);
512
+ let AST = _AST;
513
+ exports.AST = AST;