@happyvertical/smrt-core 0.56.1 → 0.57.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.
- package/AGENTS.md +6 -0
- package/agents/browser-entry.md +5 -0
- package/agents/generators.md +24 -0
- package/agents/object-runtime.md +17 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/interceptors.d.ts +7 -0
- package/dist/interceptors.d.ts.map +1 -1
- package/dist/interceptors.js +15 -1
- package/dist/interceptors.js.map +1 -1
- package/dist/manifest/browser-capability.generated.d.ts.map +1 -1
- package/dist/manifest/browser-capability.generated.js +13 -0
- package/dist/manifest/browser-capability.generated.js.map +1 -1
- package/dist/manifest/manifest-loader.d.ts.map +1 -1
- package/dist/manifest/manifest-loader.js +1 -2
- package/dist/manifest/manifest-loader.js.map +1 -1
- package/dist/manifest/static-manifest.js +1 -1
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/mcp-serializer.js +1 -1
- package/dist/object.d.ts +1 -0
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +44 -13
- package/dist/object.js.map +1 -1
- package/dist/registry/collection-exposure.d.ts +99 -0
- package/dist/registry/collection-exposure.d.ts.map +1 -0
- package/dist/registry/collection-exposure.js +135 -0
- package/dist/registry/collection-exposure.js.map +1 -0
- package/dist/registry.d.ts +8 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +76 -3
- package/dist/registry.js.map +1 -1
- package/dist/scanner/manifest-generator.d.ts +14 -0
- package/dist/scanner/manifest-generator.d.ts.map +1 -1
- package/dist/scanner/manifest-generator.js +66 -13
- package/dist/scanner/manifest-generator.js.map +1 -1
- package/dist/smrt-knowledge.json +11 -11
- package/dist/testing/file-cleanup.d.ts +9 -0
- package/dist/testing/file-cleanup.d.ts.map +1 -0
- package/dist/utils/sha256.js +2 -2
- package/dist/vite-plugin/index.js +1 -1
- package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.js +4 -0
- package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
- package/package.json +4 -4
- package/dist/node_modules/.pnpm/@noble_hashes@2.4.0/node_modules/@noble/hashes/_md.js +0 -169
- package/dist/node_modules/.pnpm/@noble_hashes@2.4.0/node_modules/@noble/hashes/_md.js.map +0 -1
- package/dist/node_modules/.pnpm/@noble_hashes@2.4.0/node_modules/@noble/hashes/_u64.js +0 -13
- package/dist/node_modules/.pnpm/@noble_hashes@2.4.0/node_modules/@noble/hashes/_u64.js.map +0 -1
- package/dist/node_modules/.pnpm/@noble_hashes@2.4.0/node_modules/@noble/hashes/sha2.js +0 -198
- package/dist/node_modules/.pnpm/@noble_hashes@2.4.0/node_modules/@noble/hashes/sha2.js.map +0 -1
- package/dist/node_modules/.pnpm/@noble_hashes@2.4.0/node_modules/@noble/hashes/utils.js +0 -243
- package/dist/node_modules/.pnpm/@noble_hashes@2.4.0/node_modules/@noble/hashes/utils.js.map +0 -1
- package/dist/node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js +0 -51
- package/dist/node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js.map +0 -1
- package/dist/node_modules/.pnpm/brace-expansion@5.0.11/node_modules/brace-expansion/dist/esm/index.js +0 -202
- package/dist/node_modules/.pnpm/brace-expansion@5.0.11/node_modules/brace-expansion/dist/esm/index.js.map +0 -1
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/index.js +0 -34
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/index.js.map +0 -1
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/errors.js +0 -343
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/errors.js.map +0 -1
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/get-format.js +0 -109
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/get-format.js.map +0 -1
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/package-json-reader.js +0 -102
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/package-json-reader.js.map +0 -1
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/resolve.js +0 -673
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/resolve.js.map +0 -1
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/utils.js +0 -32
- package/dist/node_modules/.pnpm/import-meta-resolve@4.2.0/node_modules/import-meta-resolve/lib/utils.js.map +0 -1
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/assert-valid-pattern.js +0 -10
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +0 -1
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/ast.js +0 -514
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/ast.js.map +0 -1
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/brace-expressions.js +0 -124
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/brace-expressions.js.map +0 -1
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/escape.js +0 -21
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/escape.js.map +0 -1
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/index.js +0 -629
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/index.js.map +0 -1
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/unescape.js +0 -28
- package/dist/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/unescape.js.map +0 -1
|
@@ -1,629 +0,0 @@
|
|
|
1
|
-
import { expand } from "../../../../../brace-expansion@5.0.11/node_modules/brace-expansion/dist/esm/index.js";
|
|
2
|
-
import { assertValidPattern } from "./assert-valid-pattern.js";
|
|
3
|
-
import { unescape } from "./unescape.js";
|
|
4
|
-
import { AST } from "./ast.js";
|
|
5
|
-
import { escape } from "./escape.js";
|
|
6
|
-
//#region ../../node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/index.js
|
|
7
|
-
var minimatch = (p, pattern, options = {}) => {
|
|
8
|
-
assertValidPattern(pattern);
|
|
9
|
-
if (!options.nocomment && pattern.charAt(0) === "#") return false;
|
|
10
|
-
return new Minimatch(pattern, options).match(p);
|
|
11
|
-
};
|
|
12
|
-
var starDotExtRE = /^\*+([^+@!?*[(]*)$/;
|
|
13
|
-
var starDotExtTest = (ext) => (f) => !f.startsWith(".") && f.endsWith(ext);
|
|
14
|
-
var starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
|
|
15
|
-
var starDotExtTestNocase = (ext) => {
|
|
16
|
-
ext = ext.toLowerCase();
|
|
17
|
-
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext);
|
|
18
|
-
};
|
|
19
|
-
var starDotExtTestNocaseDot = (ext) => {
|
|
20
|
-
ext = ext.toLowerCase();
|
|
21
|
-
return (f) => f.toLowerCase().endsWith(ext);
|
|
22
|
-
};
|
|
23
|
-
var starDotStarRE = /^\*+\.\*+$/;
|
|
24
|
-
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
25
|
-
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
26
|
-
var dotStarRE = /^\.\*+$/;
|
|
27
|
-
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
28
|
-
var starRE = /^\*+$/;
|
|
29
|
-
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
30
|
-
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
31
|
-
var qmarksRE = /^\?+([^+@!?*[(]*)?$/;
|
|
32
|
-
var qmarksTestNocase = ([$0, ext = ""]) => {
|
|
33
|
-
const noext = qmarksTestNoExt([$0]);
|
|
34
|
-
if (!ext) return noext;
|
|
35
|
-
ext = ext.toLowerCase();
|
|
36
|
-
return (f) => noext(f) && f.toLowerCase().endsWith(ext);
|
|
37
|
-
};
|
|
38
|
-
var qmarksTestNocaseDot = ([$0, ext = ""]) => {
|
|
39
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
40
|
-
if (!ext) return noext;
|
|
41
|
-
ext = ext.toLowerCase();
|
|
42
|
-
return (f) => noext(f) && f.toLowerCase().endsWith(ext);
|
|
43
|
-
};
|
|
44
|
-
var qmarksTestDot = ([$0, ext = ""]) => {
|
|
45
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
46
|
-
return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
|
|
47
|
-
};
|
|
48
|
-
var qmarksTest = ([$0, ext = ""]) => {
|
|
49
|
-
const noext = qmarksTestNoExt([$0]);
|
|
50
|
-
return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
|
|
51
|
-
};
|
|
52
|
-
var qmarksTestNoExt = ([$0]) => {
|
|
53
|
-
const len = $0.length;
|
|
54
|
-
return (f) => f.length === len && !f.startsWith(".");
|
|
55
|
-
};
|
|
56
|
-
var qmarksTestNoExtDot = ([$0]) => {
|
|
57
|
-
const len = $0.length;
|
|
58
|
-
return (f) => f.length === len && f !== "." && f !== "..";
|
|
59
|
-
};
|
|
60
|
-
/* c8 ignore start */
|
|
61
|
-
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
62
|
-
var path = {
|
|
63
|
-
win32: { sep: "\\" },
|
|
64
|
-
posix: { sep: "/" }
|
|
65
|
-
};
|
|
66
|
-
/* c8 ignore stop */
|
|
67
|
-
var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
68
|
-
minimatch.sep = sep;
|
|
69
|
-
var GLOBSTAR = Symbol("globstar **");
|
|
70
|
-
minimatch.GLOBSTAR = GLOBSTAR;
|
|
71
|
-
var star = "[^/]*?";
|
|
72
|
-
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
73
|
-
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
74
|
-
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
75
|
-
minimatch.filter = filter;
|
|
76
|
-
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
77
|
-
var defaults = (def) => {
|
|
78
|
-
if (!def || typeof def !== "object" || !Object.keys(def).length) return minimatch;
|
|
79
|
-
const orig = minimatch;
|
|
80
|
-
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
81
|
-
return Object.assign(m, {
|
|
82
|
-
Minimatch: class Minimatch extends orig.Minimatch {
|
|
83
|
-
constructor(pattern, options = {}) {
|
|
84
|
-
super(pattern, ext(def, options));
|
|
85
|
-
}
|
|
86
|
-
static defaults(options) {
|
|
87
|
-
return orig.defaults(ext(def, options)).Minimatch;
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
AST: class AST extends orig.AST {
|
|
91
|
-
/* c8 ignore start */
|
|
92
|
-
constructor(type, parent, options = {}) {
|
|
93
|
-
super(type, parent, ext(def, options));
|
|
94
|
-
}
|
|
95
|
-
/* c8 ignore stop */
|
|
96
|
-
static fromGlob(pattern, options = {}) {
|
|
97
|
-
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
101
|
-
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
102
|
-
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
103
|
-
defaults: (options) => orig.defaults(ext(def, options)),
|
|
104
|
-
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
105
|
-
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
106
|
-
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
107
|
-
sep: orig.sep,
|
|
108
|
-
GLOBSTAR
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
minimatch.defaults = defaults;
|
|
112
|
-
var braceExpand = (pattern, options = {}) => {
|
|
113
|
-
assertValidPattern(pattern);
|
|
114
|
-
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [pattern];
|
|
115
|
-
return expand(pattern, { max: options.braceExpandMax });
|
|
116
|
-
};
|
|
117
|
-
minimatch.braceExpand = braceExpand;
|
|
118
|
-
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
119
|
-
minimatch.makeRe = makeRe;
|
|
120
|
-
var match = (list, pattern, options = {}) => {
|
|
121
|
-
const mm = new Minimatch(pattern, options);
|
|
122
|
-
list = list.filter((f) => mm.match(f));
|
|
123
|
-
if (mm.options.nonull && !list.length) list.push(pattern);
|
|
124
|
-
return list;
|
|
125
|
-
};
|
|
126
|
-
minimatch.match = match;
|
|
127
|
-
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
128
|
-
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
129
|
-
var Minimatch = class {
|
|
130
|
-
options;
|
|
131
|
-
set;
|
|
132
|
-
pattern;
|
|
133
|
-
windowsPathsNoEscape;
|
|
134
|
-
nonegate;
|
|
135
|
-
negate;
|
|
136
|
-
comment;
|
|
137
|
-
empty;
|
|
138
|
-
preserveMultipleSlashes;
|
|
139
|
-
partial;
|
|
140
|
-
globSet;
|
|
141
|
-
globParts;
|
|
142
|
-
nocase;
|
|
143
|
-
isWindows;
|
|
144
|
-
platform;
|
|
145
|
-
windowsNoMagicRoot;
|
|
146
|
-
maxGlobstarRecursion;
|
|
147
|
-
regexp;
|
|
148
|
-
constructor(pattern, options = {}) {
|
|
149
|
-
assertValidPattern(pattern);
|
|
150
|
-
options = options || {};
|
|
151
|
-
this.options = options;
|
|
152
|
-
this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
|
|
153
|
-
this.pattern = pattern;
|
|
154
|
-
this.platform = options.platform || defaultPlatform;
|
|
155
|
-
this.isWindows = this.platform === "win32";
|
|
156
|
-
const awe = "allowWindowsEscape";
|
|
157
|
-
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
|
|
158
|
-
if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
|
|
159
|
-
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
160
|
-
this.regexp = null;
|
|
161
|
-
this.negate = false;
|
|
162
|
-
this.nonegate = !!options.nonegate;
|
|
163
|
-
this.comment = false;
|
|
164
|
-
this.empty = false;
|
|
165
|
-
this.partial = !!options.partial;
|
|
166
|
-
this.nocase = !!this.options.nocase;
|
|
167
|
-
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
168
|
-
this.globSet = [];
|
|
169
|
-
this.globParts = [];
|
|
170
|
-
this.set = [];
|
|
171
|
-
this.make();
|
|
172
|
-
}
|
|
173
|
-
hasMagic() {
|
|
174
|
-
if (this.options.magicalBraces && this.set.length > 1) return true;
|
|
175
|
-
for (const pattern of this.set) for (const part of pattern) if (typeof part !== "string") return true;
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
debug(..._) {}
|
|
179
|
-
make() {
|
|
180
|
-
const pattern = this.pattern;
|
|
181
|
-
const options = this.options;
|
|
182
|
-
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
183
|
-
this.comment = true;
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
if (!pattern) {
|
|
187
|
-
this.empty = true;
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
this.parseNegate();
|
|
191
|
-
this.globSet = [...new Set(this.braceExpand())];
|
|
192
|
-
if (options.debug) this.debug = (...args) => console.error(...args);
|
|
193
|
-
this.debug(this.pattern, this.globSet);
|
|
194
|
-
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
195
|
-
this.globParts = this.preprocess(rawGlobParts);
|
|
196
|
-
this.debug(this.pattern, this.globParts);
|
|
197
|
-
let set = this.globParts.map((s, _, __) => {
|
|
198
|
-
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
199
|
-
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
200
|
-
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
201
|
-
if (isUNC) return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
202
|
-
else if (isDrive) return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
203
|
-
}
|
|
204
|
-
return s.map((ss) => this.parse(ss));
|
|
205
|
-
});
|
|
206
|
-
this.debug(this.pattern, set);
|
|
207
|
-
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
208
|
-
if (this.isWindows) for (let i = 0; i < this.set.length; i++) {
|
|
209
|
-
const p = this.set[i];
|
|
210
|
-
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) p[2] = "?";
|
|
211
|
-
}
|
|
212
|
-
this.debug(this.pattern, this.set);
|
|
213
|
-
}
|
|
214
|
-
preprocess(globParts) {
|
|
215
|
-
if (this.options.noglobstar) {
|
|
216
|
-
for (const partset of globParts) for (let j = 0; j < partset.length; j++) if (partset[j] === "**") partset[j] = "*";
|
|
217
|
-
}
|
|
218
|
-
const { optimizationLevel = 1 } = this.options;
|
|
219
|
-
if (optimizationLevel >= 2) {
|
|
220
|
-
globParts = this.firstPhasePreProcess(globParts);
|
|
221
|
-
globParts = this.secondPhasePreProcess(globParts);
|
|
222
|
-
} else if (optimizationLevel >= 1) globParts = this.levelOneOptimize(globParts);
|
|
223
|
-
else globParts = this.adjascentGlobstarOptimize(globParts);
|
|
224
|
-
return globParts;
|
|
225
|
-
}
|
|
226
|
-
adjascentGlobstarOptimize(globParts) {
|
|
227
|
-
return globParts.map((parts) => {
|
|
228
|
-
let gs = -1;
|
|
229
|
-
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
230
|
-
let i = gs;
|
|
231
|
-
while (parts[i + 1] === "**") i++;
|
|
232
|
-
if (i !== gs) parts.splice(gs, i - gs);
|
|
233
|
-
}
|
|
234
|
-
return parts;
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
levelOneOptimize(globParts) {
|
|
238
|
-
return globParts.map((parts) => {
|
|
239
|
-
parts = parts.reduce((set, part) => {
|
|
240
|
-
const prev = set[set.length - 1];
|
|
241
|
-
if (part === "**" && prev === "**") return set;
|
|
242
|
-
if (part === "..") {
|
|
243
|
-
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
244
|
-
set.pop();
|
|
245
|
-
return set;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
set.push(part);
|
|
249
|
-
return set;
|
|
250
|
-
}, []);
|
|
251
|
-
return parts.length === 0 ? [""] : parts;
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
levelTwoFileOptimize(parts) {
|
|
255
|
-
if (!Array.isArray(parts)) parts = this.slashSplit(parts);
|
|
256
|
-
let didSomething = false;
|
|
257
|
-
do {
|
|
258
|
-
didSomething = false;
|
|
259
|
-
if (!this.preserveMultipleSlashes) {
|
|
260
|
-
for (let i = 1; i < parts.length - 1; i++) {
|
|
261
|
-
const p = parts[i];
|
|
262
|
-
if (i === 1 && p === "" && parts[0] === "") continue;
|
|
263
|
-
if (p === "." || p === "") {
|
|
264
|
-
didSomething = true;
|
|
265
|
-
parts.splice(i, 1);
|
|
266
|
-
i--;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
270
|
-
didSomething = true;
|
|
271
|
-
parts.pop();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
let dd = 0;
|
|
275
|
-
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
276
|
-
const p = parts[dd - 1];
|
|
277
|
-
if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
|
|
278
|
-
didSomething = true;
|
|
279
|
-
parts.splice(dd - 1, 2);
|
|
280
|
-
dd -= 2;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
} while (didSomething);
|
|
284
|
-
return parts.length === 0 ? [""] : parts;
|
|
285
|
-
}
|
|
286
|
-
firstPhasePreProcess(globParts) {
|
|
287
|
-
let didSomething = false;
|
|
288
|
-
do {
|
|
289
|
-
didSomething = false;
|
|
290
|
-
for (let parts of globParts) {
|
|
291
|
-
let gs = -1;
|
|
292
|
-
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
293
|
-
let gss = gs;
|
|
294
|
-
while (parts[gss + 1] === "**") gss++;
|
|
295
|
-
if (gss > gs) parts.splice(gs + 1, gss - gs);
|
|
296
|
-
let next = parts[gs + 1];
|
|
297
|
-
const p = parts[gs + 2];
|
|
298
|
-
const p2 = parts[gs + 3];
|
|
299
|
-
if (next !== "..") continue;
|
|
300
|
-
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") continue;
|
|
301
|
-
didSomething = true;
|
|
302
|
-
parts.splice(gs, 1);
|
|
303
|
-
const other = parts.slice(0);
|
|
304
|
-
other[gs] = "**";
|
|
305
|
-
globParts.push(other);
|
|
306
|
-
gs--;
|
|
307
|
-
}
|
|
308
|
-
if (!this.preserveMultipleSlashes) {
|
|
309
|
-
for (let i = 1; i < parts.length - 1; i++) {
|
|
310
|
-
const p = parts[i];
|
|
311
|
-
if (i === 1 && p === "" && parts[0] === "") continue;
|
|
312
|
-
if (p === "." || p === "") {
|
|
313
|
-
didSomething = true;
|
|
314
|
-
parts.splice(i, 1);
|
|
315
|
-
i--;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
319
|
-
didSomething = true;
|
|
320
|
-
parts.pop();
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
let dd = 0;
|
|
324
|
-
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
325
|
-
const p = parts[dd - 1];
|
|
326
|
-
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
327
|
-
didSomething = true;
|
|
328
|
-
const splin = dd === 1 && parts[dd + 1] === "**" ? ["."] : [];
|
|
329
|
-
parts.splice(dd - 1, 2, ...splin);
|
|
330
|
-
if (parts.length === 0) parts.push("");
|
|
331
|
-
dd -= 2;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
} while (didSomething);
|
|
336
|
-
return globParts;
|
|
337
|
-
}
|
|
338
|
-
secondPhasePreProcess(globParts) {
|
|
339
|
-
for (let i = 0; i < globParts.length - 1; i++) for (let j = i + 1; j < globParts.length; j++) {
|
|
340
|
-
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
|
|
341
|
-
if (matched) {
|
|
342
|
-
globParts[i] = [];
|
|
343
|
-
globParts[j] = matched;
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
return globParts.filter((gs) => gs.length);
|
|
348
|
-
}
|
|
349
|
-
partsMatch(a, b, emptyGSMatch = false) {
|
|
350
|
-
let ai = 0;
|
|
351
|
-
let bi = 0;
|
|
352
|
-
let result = [];
|
|
353
|
-
let which = "";
|
|
354
|
-
while (ai < a.length && bi < b.length) if (a[ai] === b[bi]) {
|
|
355
|
-
result.push(which === "b" ? b[bi] : a[ai]);
|
|
356
|
-
ai++;
|
|
357
|
-
bi++;
|
|
358
|
-
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
359
|
-
result.push(a[ai]);
|
|
360
|
-
ai++;
|
|
361
|
-
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
362
|
-
result.push(b[bi]);
|
|
363
|
-
bi++;
|
|
364
|
-
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
365
|
-
if (which === "b") return false;
|
|
366
|
-
which = "a";
|
|
367
|
-
result.push(a[ai]);
|
|
368
|
-
ai++;
|
|
369
|
-
bi++;
|
|
370
|
-
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
371
|
-
if (which === "a") return false;
|
|
372
|
-
which = "b";
|
|
373
|
-
result.push(b[bi]);
|
|
374
|
-
ai++;
|
|
375
|
-
bi++;
|
|
376
|
-
} else return false;
|
|
377
|
-
return a.length === b.length && result;
|
|
378
|
-
}
|
|
379
|
-
parseNegate() {
|
|
380
|
-
if (this.nonegate) return;
|
|
381
|
-
const pattern = this.pattern;
|
|
382
|
-
let negate = false;
|
|
383
|
-
let negateOffset = 0;
|
|
384
|
-
for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
|
|
385
|
-
negate = !negate;
|
|
386
|
-
negateOffset++;
|
|
387
|
-
}
|
|
388
|
-
if (negateOffset) this.pattern = pattern.slice(negateOffset);
|
|
389
|
-
this.negate = negate;
|
|
390
|
-
}
|
|
391
|
-
matchOne(file, pattern, partial = false) {
|
|
392
|
-
let fileStartIndex = 0;
|
|
393
|
-
let patternStartIndex = 0;
|
|
394
|
-
if (this.isWindows) {
|
|
395
|
-
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
396
|
-
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
397
|
-
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
398
|
-
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
399
|
-
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
400
|
-
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
401
|
-
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
402
|
-
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
403
|
-
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
404
|
-
pattern[pdi] = fd;
|
|
405
|
-
patternStartIndex = pdi;
|
|
406
|
-
fileStartIndex = fdi;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
const { optimizationLevel = 1 } = this.options;
|
|
411
|
-
if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
|
|
412
|
-
if (pattern.includes(GLOBSTAR)) return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
413
|
-
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
414
|
-
}
|
|
415
|
-
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
|
416
|
-
const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
|
|
417
|
-
const lastgs = pattern.lastIndexOf(GLOBSTAR);
|
|
418
|
-
const [head, body, tail] = partial ? [
|
|
419
|
-
pattern.slice(patternIndex, firstgs),
|
|
420
|
-
pattern.slice(firstgs + 1),
|
|
421
|
-
[]
|
|
422
|
-
] : [
|
|
423
|
-
pattern.slice(patternIndex, firstgs),
|
|
424
|
-
pattern.slice(firstgs + 1, lastgs),
|
|
425
|
-
pattern.slice(lastgs + 1)
|
|
426
|
-
];
|
|
427
|
-
if (head.length) {
|
|
428
|
-
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
|
429
|
-
if (!this.#matchOne(fileHead, head, partial, 0, 0)) return false;
|
|
430
|
-
fileIndex += head.length;
|
|
431
|
-
patternIndex += head.length;
|
|
432
|
-
}
|
|
433
|
-
let fileTailMatch = 0;
|
|
434
|
-
if (tail.length) {
|
|
435
|
-
if (tail.length + fileIndex > file.length) return false;
|
|
436
|
-
let tailStart = file.length - tail.length;
|
|
437
|
-
if (this.#matchOne(file, tail, partial, tailStart, 0)) fileTailMatch = tail.length;
|
|
438
|
-
else {
|
|
439
|
-
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) return false;
|
|
440
|
-
tailStart--;
|
|
441
|
-
if (!this.#matchOne(file, tail, partial, tailStart, 0)) return false;
|
|
442
|
-
fileTailMatch = tail.length + 1;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
if (!body.length) {
|
|
446
|
-
let sawSome = !!fileTailMatch;
|
|
447
|
-
for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
|
|
448
|
-
const f = String(file[i]);
|
|
449
|
-
sawSome = true;
|
|
450
|
-
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
451
|
-
}
|
|
452
|
-
return partial || sawSome;
|
|
453
|
-
}
|
|
454
|
-
const bodySegments = [[[], 0]];
|
|
455
|
-
let currentBody = bodySegments[0];
|
|
456
|
-
let nonGsParts = 0;
|
|
457
|
-
const nonGsPartsSums = [0];
|
|
458
|
-
for (const b of body) if (b === GLOBSTAR) {
|
|
459
|
-
nonGsPartsSums.push(nonGsParts);
|
|
460
|
-
currentBody = [[], 0];
|
|
461
|
-
bodySegments.push(currentBody);
|
|
462
|
-
} else {
|
|
463
|
-
currentBody[0].push(b);
|
|
464
|
-
nonGsParts++;
|
|
465
|
-
}
|
|
466
|
-
let i = bodySegments.length - 1;
|
|
467
|
-
const fileLength = file.length - fileTailMatch;
|
|
468
|
-
for (const b of bodySegments) b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
|
|
469
|
-
return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
|
|
470
|
-
}
|
|
471
|
-
#matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
|
472
|
-
const bs = bodySegments[bodyIndex];
|
|
473
|
-
if (!bs) {
|
|
474
|
-
for (let i = fileIndex; i < file.length; i++) {
|
|
475
|
-
sawTail = true;
|
|
476
|
-
const f = file[i];
|
|
477
|
-
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
478
|
-
}
|
|
479
|
-
return sawTail;
|
|
480
|
-
}
|
|
481
|
-
const [body, after] = bs;
|
|
482
|
-
while (fileIndex <= after) {
|
|
483
|
-
if (this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
|
|
484
|
-
const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
|
|
485
|
-
if (sub !== false) return sub;
|
|
486
|
-
}
|
|
487
|
-
const f = file[fileIndex];
|
|
488
|
-
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
489
|
-
fileIndex++;
|
|
490
|
-
}
|
|
491
|
-
return partial || null;
|
|
492
|
-
}
|
|
493
|
-
#matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
|
494
|
-
let fi;
|
|
495
|
-
let pi;
|
|
496
|
-
let pl;
|
|
497
|
-
let fl;
|
|
498
|
-
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
499
|
-
this.debug("matchOne loop");
|
|
500
|
-
let p = pattern[pi];
|
|
501
|
-
let f = file[fi];
|
|
502
|
-
this.debug(pattern, p, f);
|
|
503
|
-
/* c8 ignore start */
|
|
504
|
-
if (p === false || p === GLOBSTAR) return false;
|
|
505
|
-
/* c8 ignore stop */
|
|
506
|
-
let hit;
|
|
507
|
-
if (typeof p === "string") {
|
|
508
|
-
hit = f === p;
|
|
509
|
-
this.debug("string match", p, f, hit);
|
|
510
|
-
} else {
|
|
511
|
-
hit = p.test(f);
|
|
512
|
-
this.debug("pattern match", p, f, hit);
|
|
513
|
-
}
|
|
514
|
-
if (!hit) return false;
|
|
515
|
-
}
|
|
516
|
-
if (fi === fl && pi === pl) return true;
|
|
517
|
-
else if (fi === fl) return partial;
|
|
518
|
-
else if (pi === pl) return fi === fl - 1 && file[fi] === "";
|
|
519
|
-
else throw new Error("wtf?");
|
|
520
|
-
/* c8 ignore stop */
|
|
521
|
-
}
|
|
522
|
-
braceExpand() {
|
|
523
|
-
return braceExpand(this.pattern, this.options);
|
|
524
|
-
}
|
|
525
|
-
parse(pattern) {
|
|
526
|
-
assertValidPattern(pattern);
|
|
527
|
-
const options = this.options;
|
|
528
|
-
if (pattern === "**") return GLOBSTAR;
|
|
529
|
-
if (pattern === "") return "";
|
|
530
|
-
let m;
|
|
531
|
-
let fastTest = null;
|
|
532
|
-
if (m = pattern.match(starRE)) fastTest = options.dot ? starTestDot : starTest;
|
|
533
|
-
else if (m = pattern.match(starDotExtRE)) fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
534
|
-
else if (m = pattern.match(qmarksRE)) fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
535
|
-
else if (m = pattern.match(starDotStarRE)) fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
536
|
-
else if (m = pattern.match(dotStarRE)) fastTest = dotStarTest;
|
|
537
|
-
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
538
|
-
if (fastTest && typeof re === "object") Reflect.defineProperty(re, "test", { value: fastTest });
|
|
539
|
-
return re;
|
|
540
|
-
}
|
|
541
|
-
makeRe() {
|
|
542
|
-
if (this.regexp || this.regexp === false) return this.regexp;
|
|
543
|
-
const set = this.set;
|
|
544
|
-
if (!set.length) {
|
|
545
|
-
this.regexp = false;
|
|
546
|
-
return this.regexp;
|
|
547
|
-
}
|
|
548
|
-
const options = this.options;
|
|
549
|
-
const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
|
|
550
|
-
const flags = new Set(options.nocase ? ["i"] : []);
|
|
551
|
-
let re = set.map((pattern) => {
|
|
552
|
-
const pp = pattern.map((p) => {
|
|
553
|
-
if (p instanceof RegExp) for (const f of p.flags.split("")) flags.add(f);
|
|
554
|
-
return typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
555
|
-
});
|
|
556
|
-
pp.forEach((p, i) => {
|
|
557
|
-
const next = pp[i + 1];
|
|
558
|
-
const prev = pp[i - 1];
|
|
559
|
-
if (p !== GLOBSTAR || prev === GLOBSTAR) return;
|
|
560
|
-
if (prev === void 0) if (next !== void 0 && next !== GLOBSTAR) pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
561
|
-
else pp[i] = twoStar;
|
|
562
|
-
else if (next === void 0) pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
563
|
-
else if (next !== GLOBSTAR) {
|
|
564
|
-
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
565
|
-
pp[i + 1] = GLOBSTAR;
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
const filtered = pp.filter((p) => p !== GLOBSTAR);
|
|
569
|
-
if (this.partial && filtered.length >= 1) {
|
|
570
|
-
const prefixes = [];
|
|
571
|
-
for (let i = 1; i <= filtered.length; i++) prefixes.push(filtered.slice(0, i).join("/"));
|
|
572
|
-
return "(?:" + prefixes.join("|") + ")";
|
|
573
|
-
}
|
|
574
|
-
return filtered.join("/");
|
|
575
|
-
}).join("|");
|
|
576
|
-
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
577
|
-
re = "^" + open + re + close + "$";
|
|
578
|
-
if (this.partial) re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
|
|
579
|
-
if (this.negate) re = "^(?!" + re + ").+$";
|
|
580
|
-
try {
|
|
581
|
-
this.regexp = new RegExp(re, [...flags].join(""));
|
|
582
|
-
} catch {
|
|
583
|
-
this.regexp = false;
|
|
584
|
-
}
|
|
585
|
-
/* c8 ignore stop */
|
|
586
|
-
return this.regexp;
|
|
587
|
-
}
|
|
588
|
-
slashSplit(p) {
|
|
589
|
-
if (this.preserveMultipleSlashes) return p.split("/");
|
|
590
|
-
else if (this.isWindows && /^\/\/[^/]+/.test(p)) return ["", ...p.split(/\/+/)];
|
|
591
|
-
else return p.split(/\/+/);
|
|
592
|
-
}
|
|
593
|
-
match(f, partial = this.partial) {
|
|
594
|
-
this.debug("match", f, this.pattern);
|
|
595
|
-
if (this.comment) return false;
|
|
596
|
-
if (this.empty) return f === "";
|
|
597
|
-
if (f === "/" && partial) return true;
|
|
598
|
-
const options = this.options;
|
|
599
|
-
if (this.isWindows) f = f.split("\\").join("/");
|
|
600
|
-
const ff = this.slashSplit(f);
|
|
601
|
-
this.debug(this.pattern, "split", ff);
|
|
602
|
-
const set = this.set;
|
|
603
|
-
this.debug(this.pattern, "set", set);
|
|
604
|
-
let filename = ff[ff.length - 1];
|
|
605
|
-
if (!filename) for (let i = ff.length - 2; !filename && i >= 0; i--) filename = ff[i];
|
|
606
|
-
for (const pattern of set) {
|
|
607
|
-
let file = ff;
|
|
608
|
-
if (options.matchBase && pattern.length === 1) file = [filename];
|
|
609
|
-
if (this.matchOne(file, pattern, partial)) {
|
|
610
|
-
if (options.flipNegate) return true;
|
|
611
|
-
return !this.negate;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
if (options.flipNegate) return false;
|
|
615
|
-
return this.negate;
|
|
616
|
-
}
|
|
617
|
-
static defaults(def) {
|
|
618
|
-
return minimatch.defaults(def).Minimatch;
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
/* c8 ignore stop */
|
|
622
|
-
minimatch.AST = AST;
|
|
623
|
-
minimatch.Minimatch = Minimatch;
|
|
624
|
-
minimatch.escape = escape;
|
|
625
|
-
minimatch.unescape = unescape;
|
|
626
|
-
//#endregion
|
|
627
|
-
export { GLOBSTAR, Minimatch, braceExpand, defaults, filter, makeRe, match, minimatch, sep };
|
|
628
|
-
|
|
629
|
-
//# sourceMappingURL=index.js.map
|