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