@descent-vtt/spec-guard 0.10.3 → 0.12.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/CHANGELOG.md +410 -0
- package/README.md +385 -27
- package/dist/cites.d.ts +192 -0
- package/dist/cites.d.ts.map +1 -0
- package/dist/cites.js +599 -0
- package/dist/cites.js.map +1 -0
- package/dist/cli.d.ts +14 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +315 -22
- package/dist/cli.js.map +1 -1
- package/dist/comments.d.ts +51 -2
- package/dist/comments.d.ts.map +1 -1
- package/dist/comments.js +353 -57
- package/dist/comments.js.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +46 -5
- package/dist/config.js.map +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +38 -14
- package/dist/engine.js.map +1 -1
- package/dist/glob.d.ts +128 -24
- package/dist/glob.d.ts.map +1 -1
- package/dist/glob.js +304 -61
- package/dist/glob.js.map +1 -1
- package/dist/impact.d.ts +179 -0
- package/dist/impact.d.ts.map +1 -0
- package/dist/impact.js +360 -0
- package/dist/impact.js.map +1 -0
- package/dist/imports.d.ts.map +1 -1
- package/dist/imports.js +5 -58
- package/dist/imports.js.map +1 -1
- package/dist/index.d.ts +13 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +16 -75
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +198 -370
- package/dist/mcp.js.map +1 -1
- package/dist/overlay.d.ts +39 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +133 -0
- package/dist/overlay.js.map +1 -0
- package/dist/parser.d.ts +41 -24
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +217 -160
- package/dist/parser.js.map +1 -1
- package/dist/prove.d.ts +46 -0
- package/dist/prove.d.ts.map +1 -0
- package/dist/prove.js +549 -0
- package/dist/prove.js.map +1 -0
- package/dist/query.d.ts +11 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +9 -3
- package/dist/query.js.map +1 -1
- package/dist/reporter.d.ts +139 -1
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +593 -21
- package/dist/reporter.js.map +1 -1
- package/dist/rules.js +3 -3
- package/dist/rules.js.map +1 -1
- package/dist/runner.d.ts +24 -1
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +84 -21
- package/dist/runner.js.map +1 -1
- package/dist/specs.d.ts +5 -1
- package/dist/specs.d.ts.map +1 -1
- package/dist/specs.js +5 -1
- package/dist/specs.js.map +1 -1
- package/dist/structure.d.ts.map +1 -1
- package/dist/structure.js +7 -6
- package/dist/structure.js.map +1 -1
- package/dist/types.d.ts +193 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/vendor/spec-core/jsonrpc/index.d.ts +3 -0
- package/dist/vendor/spec-core/jsonrpc/index.d.ts.map +1 -0
- package/dist/vendor/spec-core/jsonrpc/index.js +2 -0
- package/dist/vendor/spec-core/jsonrpc/index.js.map +1 -0
- package/dist/vendor/spec-core/jsonrpc/mcp.d.ts +158 -0
- package/dist/vendor/spec-core/jsonrpc/mcp.d.ts.map +1 -0
- package/dist/vendor/spec-core/jsonrpc/mcp.js +353 -0
- package/dist/vendor/spec-core/jsonrpc/mcp.js.map +1 -0
- package/dist/vendor/spec-core/markdown/frontmatter.d.ts +104 -0
- package/dist/vendor/spec-core/markdown/frontmatter.d.ts.map +1 -0
- package/dist/vendor/spec-core/markdown/frontmatter.js +459 -0
- package/dist/vendor/spec-core/markdown/frontmatter.js.map +1 -0
- package/dist/vendor/spec-core/markdown/headings.d.ts +46 -0
- package/dist/vendor/spec-core/markdown/headings.d.ts.map +1 -0
- package/dist/vendor/spec-core/markdown/headings.js +199 -0
- package/dist/vendor/spec-core/markdown/headings.js.map +1 -0
- package/dist/vendor/spec-core/markdown/index.d.ts +6 -0
- package/dist/vendor/spec-core/markdown/index.d.ts.map +1 -0
- package/dist/vendor/spec-core/markdown/index.js +4 -0
- package/dist/vendor/spec-core/markdown/index.js.map +1 -0
- package/dist/vendor/spec-core/markdown/layout.d.ts +40 -0
- package/dist/vendor/spec-core/markdown/layout.d.ts.map +1 -0
- package/dist/vendor/spec-core/markdown/layout.js +28 -0
- package/dist/vendor/spec-core/markdown/layout.js.map +1 -0
- package/dist/vendor/spec-core/markdown/links.d.ts +23 -0
- package/dist/vendor/spec-core/markdown/links.d.ts.map +1 -0
- package/dist/vendor/spec-core/markdown/links.js +364 -0
- package/dist/vendor/spec-core/markdown/links.js.map +1 -0
- package/dist/vendor/spec-core/markdown/lists.d.ts +23 -0
- package/dist/vendor/spec-core/markdown/lists.d.ts.map +1 -0
- package/dist/vendor/spec-core/markdown/lists.js +127 -0
- package/dist/vendor/spec-core/markdown/lists.js.map +1 -0
- package/dist/vendor/spec-core/markdown/scan.d.ts +37 -0
- package/dist/vendor/spec-core/markdown/scan.d.ts.map +1 -0
- package/dist/vendor/spec-core/markdown/scan.js +439 -0
- package/dist/vendor/spec-core/markdown/scan.js.map +1 -0
- package/dist/vendor/spec-core/markdown/syntax.d.ts +76 -0
- package/dist/vendor/spec-core/markdown/syntax.d.ts.map +1 -0
- package/dist/vendor/spec-core/markdown/syntax.js +181 -0
- package/dist/vendor/spec-core/markdown/syntax.js.map +1 -0
- package/dist/vendor/spec-core/markdown/tables.d.ts +19 -0
- package/dist/vendor/spec-core/markdown/tables.d.ts.map +1 -0
- package/dist/vendor/spec-core/markdown/tables.js +86 -0
- package/dist/vendor/spec-core/markdown/tables.js.map +1 -0
- package/dist/vendor/spec-core/markdown/types.d.ts +288 -0
- package/dist/vendor/spec-core/markdown/types.d.ts.map +1 -0
- package/dist/vendor/spec-core/markdown/types.js +9 -0
- package/dist/vendor/spec-core/markdown/types.js.map +1 -0
- package/dist/vendor/spec-core/path/index.d.ts +2 -0
- package/dist/vendor/spec-core/path/index.d.ts.map +1 -0
- package/dist/vendor/spec-core/path/index.js +2 -0
- package/dist/vendor/spec-core/path/index.js.map +1 -0
- package/dist/vendor/spec-core/path/posix.d.ts +84 -0
- package/dist/vendor/spec-core/path/posix.d.ts.map +1 -0
- package/dist/vendor/spec-core/path/posix.js +150 -0
- package/dist/vendor/spec-core/path/posix.js.map +1 -0
- package/dist/vendor/spec-core/pattern/automaton.d.ts +130 -0
- package/dist/vendor/spec-core/pattern/automaton.d.ts.map +1 -0
- package/dist/vendor/spec-core/pattern/automaton.js +340 -0
- package/dist/vendor/spec-core/pattern/automaton.js.map +1 -0
- package/dist/vendor/spec-core/pattern/charset.d.ts +59 -0
- package/dist/vendor/spec-core/pattern/charset.d.ts.map +1 -0
- package/dist/vendor/spec-core/pattern/charset.js +116 -0
- package/dist/vendor/spec-core/pattern/charset.js.map +1 -0
- package/dist/vendor/spec-core/pattern/glob.d.ts +122 -0
- package/dist/vendor/spec-core/pattern/glob.d.ts.map +1 -0
- package/dist/vendor/spec-core/pattern/glob.js +481 -0
- package/dist/vendor/spec-core/pattern/glob.js.map +1 -0
- package/dist/vendor/spec-core/pattern/index.d.ts +7 -0
- package/dist/vendor/spec-core/pattern/index.d.ts.map +1 -0
- package/dist/vendor/spec-core/pattern/index.js +4 -0
- package/dist/vendor/spec-core/pattern/index.js.map +1 -0
- package/dist/vendor/spec-core/pattern/regex.d.ts +68 -0
- package/dist/vendor/spec-core/pattern/regex.d.ts.map +1 -0
- package/dist/vendor/spec-core/pattern/regex.js +813 -0
- package/dist/vendor/spec-core/pattern/regex.js.map +1 -0
- package/dist/vendor/spec-core/text/index.d.ts +3 -0
- package/dist/vendor/spec-core/text/index.d.ts.map +1 -0
- package/dist/vendor/spec-core/text/index.js +2 -0
- package/dist/vendor/spec-core/text/index.js.map +1 -0
- package/dist/vendor/spec-core/text/lines.d.ts +73 -0
- package/dist/vendor/spec-core/text/lines.d.ts.map +1 -0
- package/dist/vendor/spec-core/text/lines.js +156 -0
- package/dist/vendor/spec-core/text/lines.js.map +1 -0
- package/package.json +8 -1
- package/src/vendor/spec-core/LICENSE +21 -0
- package/src/vendor/spec-core/README.md +8 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../../src/vendor/spec-core/pattern/glob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAKL,KAAK,SAAS,EAEd,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAC;AAGxB,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,CAAC;AAE3D,wDAAwD;AACxD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,cAAc,CAAC,GAAG,SAAS,CAAC;IACnF;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;CACzD;AAED,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,wFAAwF;IACxF,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC9B;AAED,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE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QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5H;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,CAoB9F"}
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Globs, in the three dialects the spec-* tools speak, compiled to one kind of
|
|
3
|
+
* automaton.
|
|
4
|
+
*
|
|
5
|
+
* The syntax is the part people type: `*`, `**`, `?`, `[abc]`, `[!a-z]`,
|
|
6
|
+
* `{a,b}`, and `\` to escape. What differs between the tools is not the
|
|
7
|
+
* syntax but what a pattern is matched against, and those differences are
|
|
8
|
+
* deliberate, so each has a name (docs/adr/0003-glob-dialects.md):
|
|
9
|
+
*
|
|
10
|
+
* - `path` - the whole repository-relative path, anchored at the root. A
|
|
11
|
+
* pattern with no glob syntax names a file, a directory, or either, as the
|
|
12
|
+
* caller says; `src/auth` may cover `src/auth/login.ts`.
|
|
13
|
+
* - `ripgrep` - as ripgrep's `-g`: a pattern with no `/` is matched against
|
|
14
|
+
* the last segment at any depth, so `*.ts` matches `src/deep/a.ts`; one with
|
|
15
|
+
* a `/` is matched against the whole path.
|
|
16
|
+
* - `gitignore` - as an exclusion list reads: a pattern matches a path or any
|
|
17
|
+
* directory above it, so `tests` excludes everything under any `tests`; one
|
|
18
|
+
* with a `/` other than a trailing one is anchored at the root, and a
|
|
19
|
+
* leading `/` only anchors.
|
|
20
|
+
*
|
|
21
|
+
* Shared by all three:
|
|
22
|
+
*
|
|
23
|
+
* - `**` is a globstar only as a whole segment. `a/**\/b` matches `a/b` and
|
|
24
|
+
* `a/x/y/b`; a trailing `/**` matches everything inside a directory and not
|
|
25
|
+
* the directory itself. Two stars inside a name, `**.md`, are refused: the
|
|
26
|
+
* tools read it three ways, and the quiet reading narrowed their scope.
|
|
27
|
+
* - `*`, `?` and classes never match `/`, and `*` matches a leading dot.
|
|
28
|
+
* - Case is the caller's decision, stated every time. A result must not
|
|
29
|
+
* depend on the host it ran on.
|
|
30
|
+
* - A malformed pattern is an error, never a literal. An unclosed `[` or `{`,
|
|
31
|
+
* an extended glob, a `..` - each is refused with a reason, because a typo
|
|
32
|
+
* read as a literal is a scope that silently matches nothing. An extended
|
|
33
|
+
* glob is a group holding a `|`, `+(a|b)`: without one, `C++(notes).md` is
|
|
34
|
+
* a name with parentheses in it, as ripgrep and `.gitignore` read it.
|
|
35
|
+
*/
|
|
36
|
+
import { Builder, findWitness, Matcher, WITNESS_BUDGET, } from './automaton.js';
|
|
37
|
+
import { ANY, classSet, literalSet, SEPARATOR } from './charset.js';
|
|
38
|
+
export class GlobError extends Error {
|
|
39
|
+
source;
|
|
40
|
+
constructor(source, reason) {
|
|
41
|
+
super(`invalid glob "${source}": ${reason}`);
|
|
42
|
+
this.name = 'GlobError';
|
|
43
|
+
this.source = source;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** More alternatives than this is a pattern nobody meant. */
|
|
47
|
+
export const MAX_ALTERNATIVES = 256;
|
|
48
|
+
/** Whether a string uses glob syntax at all. */
|
|
49
|
+
export function isGlobSyntax(source) {
|
|
50
|
+
return /[*?[\]{}]/.test(source);
|
|
51
|
+
}
|
|
52
|
+
/** Parses and compiles a glob, or says why it cannot. */
|
|
53
|
+
export function parseGlob(source, options) {
|
|
54
|
+
const result = build(source, options);
|
|
55
|
+
return typeof result === 'string' ? { ok: false, error: result } : { ok: true, glob: result };
|
|
56
|
+
}
|
|
57
|
+
/** Parses and compiles a glob, throwing {@link GlobError} when it cannot. */
|
|
58
|
+
export function compileGlob(source, options) {
|
|
59
|
+
const result = build(source, options);
|
|
60
|
+
if (typeof result === 'string')
|
|
61
|
+
throw new GlobError(source, result);
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
function build(source, options) {
|
|
65
|
+
const escapes = options.backslash !== 'separator';
|
|
66
|
+
let pattern = source.trim();
|
|
67
|
+
if (!escapes)
|
|
68
|
+
pattern = pattern.replace(/\\/g, '/');
|
|
69
|
+
if (pattern.length === 0)
|
|
70
|
+
return 'the pattern is empty';
|
|
71
|
+
if (pattern.startsWith('!'))
|
|
72
|
+
return 'a negated pattern is a list entry, not a glob; narrow the positive pattern';
|
|
73
|
+
if (/(?:^|[^\\])[?*+@!]\([^)]*\|/.test(pattern))
|
|
74
|
+
return EXTGLOB;
|
|
75
|
+
while (pattern.startsWith('./'))
|
|
76
|
+
pattern = pattern.slice(2);
|
|
77
|
+
// A leading slash roots a pattern at the filesystem's root in the path and
|
|
78
|
+
// ripgrep dialects, and only anchors it at the repository root in gitignore.
|
|
79
|
+
let rooted = false;
|
|
80
|
+
let anchored = false;
|
|
81
|
+
if (pattern.startsWith('/')) {
|
|
82
|
+
if (options.dialect === 'gitignore')
|
|
83
|
+
anchored = true;
|
|
84
|
+
else
|
|
85
|
+
rooted = true;
|
|
86
|
+
pattern = pattern.replace(/^\/+/, '');
|
|
87
|
+
}
|
|
88
|
+
// A trailing slash means a directory's contents, except in an exclusion,
|
|
89
|
+
// where `build/` and `build` exclude the same things.
|
|
90
|
+
if (pattern.endsWith('/')) {
|
|
91
|
+
pattern = pattern.replace(/\/+$/, '');
|
|
92
|
+
if (options.dialect !== 'gitignore')
|
|
93
|
+
pattern = `${pattern}/**`;
|
|
94
|
+
}
|
|
95
|
+
if (pattern.length === 0)
|
|
96
|
+
return 'the pattern names the root itself, not a path under it';
|
|
97
|
+
const expanded = expandBraces(pattern, escapes);
|
|
98
|
+
if (typeof expanded === 'string')
|
|
99
|
+
return expanded;
|
|
100
|
+
const alternatives = [];
|
|
101
|
+
for (const text of expanded) {
|
|
102
|
+
const parsed = parseAlternative(text, escapes);
|
|
103
|
+
if (typeof parsed === 'string')
|
|
104
|
+
return parsed;
|
|
105
|
+
alternatives.push(parsed);
|
|
106
|
+
}
|
|
107
|
+
const builder = new Builder();
|
|
108
|
+
const fragments = [];
|
|
109
|
+
const bases = [];
|
|
110
|
+
for (const alternative of alternatives) {
|
|
111
|
+
const compiled = compileAlternative(builder, alternative, options, rooted, anchored);
|
|
112
|
+
fragments.push(compiled.fragment);
|
|
113
|
+
bases.push(compiled.base);
|
|
114
|
+
}
|
|
115
|
+
const automaton = builder.finish(builder.either(fragments), options.caseSensitive);
|
|
116
|
+
let matcher = null;
|
|
117
|
+
return {
|
|
118
|
+
source,
|
|
119
|
+
dialect: options.dialect,
|
|
120
|
+
caseSensitive: options.caseSensitive,
|
|
121
|
+
bases: [...new Set(bases)],
|
|
122
|
+
automaton,
|
|
123
|
+
match(path) {
|
|
124
|
+
matcher ??= new Matcher(automaton);
|
|
125
|
+
return matcher.test(path);
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/* ------------------------------------------------------------------ braces */
|
|
130
|
+
/**
|
|
131
|
+
* Expands `{a,b}` groups into the patterns they stand for, or says why the
|
|
132
|
+
* pattern is malformed.
|
|
133
|
+
*
|
|
134
|
+
* Classes and escapes are skipped while looking for braces and commas, so
|
|
135
|
+
* `{[,]x,y}` is two alternatives, `[,]x` and `y`. A lone `}` is a literal: it
|
|
136
|
+
* cannot be read as anything else. An unclosed `{` is an error.
|
|
137
|
+
*/
|
|
138
|
+
function expandBraces(pattern, escapes) {
|
|
139
|
+
let depth = 0;
|
|
140
|
+
let open = -1;
|
|
141
|
+
for (let i = 0; i < pattern.length; i += 1) {
|
|
142
|
+
const ch = pattern.charAt(i);
|
|
143
|
+
if (ch === '\\' && escapes) {
|
|
144
|
+
i += 1;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (ch === '[') {
|
|
148
|
+
const close = classEnd(pattern, i, escapes);
|
|
149
|
+
if (close > 0)
|
|
150
|
+
i = close;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (ch === '{') {
|
|
154
|
+
if (depth === 0)
|
|
155
|
+
open = i;
|
|
156
|
+
depth += 1;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (ch !== '}' || depth === 0)
|
|
160
|
+
continue;
|
|
161
|
+
depth -= 1;
|
|
162
|
+
if (depth > 0)
|
|
163
|
+
continue;
|
|
164
|
+
const prefix = pattern.slice(0, open);
|
|
165
|
+
const suffix = pattern.slice(i + 1);
|
|
166
|
+
const results = [];
|
|
167
|
+
for (const option of splitOptions(pattern.slice(open + 1, i), escapes)) {
|
|
168
|
+
const expanded = expandBraces(`${prefix}${option}${suffix}`, escapes);
|
|
169
|
+
if (typeof expanded === 'string')
|
|
170
|
+
return expanded;
|
|
171
|
+
results.push(...expanded);
|
|
172
|
+
if (results.length > MAX_ALTERNATIVES)
|
|
173
|
+
return `the braces expand to more than ${MAX_ALTERNATIVES} patterns`;
|
|
174
|
+
}
|
|
175
|
+
return results;
|
|
176
|
+
}
|
|
177
|
+
if (depth > 0)
|
|
178
|
+
return 'a "{" is never closed';
|
|
179
|
+
return [pattern];
|
|
180
|
+
}
|
|
181
|
+
/** Splits a brace body on its top-level commas. */
|
|
182
|
+
function splitOptions(body, escapes) {
|
|
183
|
+
const parts = [];
|
|
184
|
+
let depth = 0;
|
|
185
|
+
let start = 0;
|
|
186
|
+
for (let i = 0; i < body.length; i += 1) {
|
|
187
|
+
const ch = body.charAt(i);
|
|
188
|
+
if (ch === '\\' && escapes) {
|
|
189
|
+
i += 1;
|
|
190
|
+
}
|
|
191
|
+
else if (ch === '[') {
|
|
192
|
+
const close = classEnd(body, i, escapes);
|
|
193
|
+
if (close > 0)
|
|
194
|
+
i = close;
|
|
195
|
+
}
|
|
196
|
+
else if (ch === '{') {
|
|
197
|
+
depth += 1;
|
|
198
|
+
}
|
|
199
|
+
else if (ch === '}') {
|
|
200
|
+
depth -= 1;
|
|
201
|
+
}
|
|
202
|
+
else if (ch === ',' && depth === 0) {
|
|
203
|
+
parts.push(body.slice(start, i));
|
|
204
|
+
start = i + 1;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
parts.push(body.slice(start));
|
|
208
|
+
return parts;
|
|
209
|
+
}
|
|
210
|
+
/** The index of the `]` closing a class opened at `open`, or -1 when none does within the segment. */
|
|
211
|
+
function classEnd(pattern, open, escapes) {
|
|
212
|
+
let i = open + 1;
|
|
213
|
+
if (pattern.charAt(i) === '!' || pattern.charAt(i) === '^')
|
|
214
|
+
i += 1;
|
|
215
|
+
// The first member is always a member, even `]`.
|
|
216
|
+
if (pattern.charAt(i) === ']')
|
|
217
|
+
i += 1;
|
|
218
|
+
for (; i < pattern.length; i += 1) {
|
|
219
|
+
const ch = pattern.charAt(i);
|
|
220
|
+
if (ch === '\\' && escapes) {
|
|
221
|
+
i += 1;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (ch === '/')
|
|
225
|
+
return -1;
|
|
226
|
+
if (ch === ']')
|
|
227
|
+
return i;
|
|
228
|
+
}
|
|
229
|
+
return -1;
|
|
230
|
+
}
|
|
231
|
+
/* ---------------------------------------------------------------- segments */
|
|
232
|
+
function parseAlternative(text, escapes) {
|
|
233
|
+
const segments = [];
|
|
234
|
+
const raw = text.split('/');
|
|
235
|
+
for (const part of raw) {
|
|
236
|
+
if (part === '' || part === '.')
|
|
237
|
+
continue;
|
|
238
|
+
if (part === '..')
|
|
239
|
+
return 'a pattern cannot climb out of its root with ".."';
|
|
240
|
+
if (part === '**') {
|
|
241
|
+
if (segments[segments.length - 1]?.kind !== 'globstar')
|
|
242
|
+
segments.push({ kind: 'globstar' });
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
const tokens = tokenize(part, escapes);
|
|
246
|
+
if (typeof tokens === 'string')
|
|
247
|
+
return tokens;
|
|
248
|
+
segments.push({ kind: 'name', tokens });
|
|
249
|
+
}
|
|
250
|
+
if (segments.length === 0)
|
|
251
|
+
return 'the pattern names no path';
|
|
252
|
+
return { segments, slashed: raw.filter((part) => part !== '' && part !== '.').length > 1 };
|
|
253
|
+
}
|
|
254
|
+
const EXTGLOB = 'extended globs such as "+(a|b)" are not supported: write alternatives as "{a,b}", and a literal parenthesis as "[(]"';
|
|
255
|
+
const GLOBSTAR_IN_NAME = '"**" means any number of directories only as a whole segment: write "docs/**/*.md" for any depth, or "*.md" for one level';
|
|
256
|
+
function tokenize(segment, escapes) {
|
|
257
|
+
const tokens = [];
|
|
258
|
+
const chars = Array.from(segment);
|
|
259
|
+
for (let i = 0; i < chars.length; i += 1) {
|
|
260
|
+
const ch = chars[i];
|
|
261
|
+
if (ch === '\\' && escapes) {
|
|
262
|
+
const next = chars[i + 1];
|
|
263
|
+
if (next === undefined || /[A-Za-z0-9]/.test(next)) {
|
|
264
|
+
return '"\\" escapes glob syntax; separate directories with "/"';
|
|
265
|
+
}
|
|
266
|
+
tokens.push({ kind: 'literal', point: next.codePointAt(0) });
|
|
267
|
+
i += 1;
|
|
268
|
+
}
|
|
269
|
+
else if (ch === '*') {
|
|
270
|
+
// Two stars inside a name are refused rather than read as one. The
|
|
271
|
+
// tools this replaces read `docs/**.md` three ways - recursive, one
|
|
272
|
+
// level, and as ripgrep does - and reading it as one level silently
|
|
273
|
+
// dropped every nested document from a run that used to include them.
|
|
274
|
+
if (chars[i + 1] === '*')
|
|
275
|
+
return GLOBSTAR_IN_NAME;
|
|
276
|
+
tokens.push({ kind: 'star' });
|
|
277
|
+
}
|
|
278
|
+
else if (ch === '?') {
|
|
279
|
+
tokens.push({ kind: 'any' });
|
|
280
|
+
}
|
|
281
|
+
else if (ch === '[') {
|
|
282
|
+
const parsed = readClass(chars, i, escapes);
|
|
283
|
+
if (typeof parsed === 'string')
|
|
284
|
+
return parsed;
|
|
285
|
+
tokens.push(parsed.token);
|
|
286
|
+
i = parsed.end;
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
tokens.push({ kind: 'literal', point: ch.codePointAt(0) });
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return tokens;
|
|
293
|
+
}
|
|
294
|
+
function readClass(chars, open, escapes) {
|
|
295
|
+
let i = open + 1;
|
|
296
|
+
let negated = false;
|
|
297
|
+
if (chars[i] === '!' || chars[i] === '^') {
|
|
298
|
+
negated = true;
|
|
299
|
+
i += 1;
|
|
300
|
+
}
|
|
301
|
+
const ranges = [];
|
|
302
|
+
let first = true;
|
|
303
|
+
for (; i < chars.length; i += 1) {
|
|
304
|
+
const ch = chars[i];
|
|
305
|
+
if (ch === ']' && !first)
|
|
306
|
+
return { token: { kind: 'class', negated, ranges }, end: i };
|
|
307
|
+
first = false;
|
|
308
|
+
let low = ch;
|
|
309
|
+
if (ch === '\\' && escapes && chars[i + 1] !== undefined) {
|
|
310
|
+
i += 1;
|
|
311
|
+
low = chars[i];
|
|
312
|
+
}
|
|
313
|
+
let high = low;
|
|
314
|
+
if (chars[i + 1] === '-' && chars[i + 2] !== undefined && chars[i + 2] !== ']') {
|
|
315
|
+
i += 2;
|
|
316
|
+
high = chars[i];
|
|
317
|
+
if (high === '\\' && escapes && chars[i + 1] !== undefined) {
|
|
318
|
+
i += 1;
|
|
319
|
+
high = chars[i];
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
const from = low.codePointAt(0);
|
|
323
|
+
const to = high.codePointAt(0);
|
|
324
|
+
if (to < from)
|
|
325
|
+
return `the range "${low}-${high}" runs backwards`;
|
|
326
|
+
ranges.push([from, to]);
|
|
327
|
+
}
|
|
328
|
+
return 'a "[" is never closed';
|
|
329
|
+
}
|
|
330
|
+
/* --------------------------------------------------------------- compiling */
|
|
331
|
+
function literalText(segments) {
|
|
332
|
+
const names = [];
|
|
333
|
+
for (const segment of segments) {
|
|
334
|
+
if (segment.kind !== 'name')
|
|
335
|
+
return null;
|
|
336
|
+
let name = '';
|
|
337
|
+
for (const token of segment.tokens) {
|
|
338
|
+
if (token.kind !== 'literal')
|
|
339
|
+
return null;
|
|
340
|
+
name += String.fromCodePoint(token.point);
|
|
341
|
+
}
|
|
342
|
+
names.push(name);
|
|
343
|
+
}
|
|
344
|
+
return names.join('/');
|
|
345
|
+
}
|
|
346
|
+
/** One segment name: at least one character, none of them `/`. */
|
|
347
|
+
function name(b) {
|
|
348
|
+
return b.plus(b.char(ANY));
|
|
349
|
+
}
|
|
350
|
+
/** Zero or more whole directories: `(name/)*`. */
|
|
351
|
+
function anyDirectories(b) {
|
|
352
|
+
return b.star(b.sequence([name(b), b.char(SEPARATOR)]));
|
|
353
|
+
}
|
|
354
|
+
/** One or more whole segments below a path: `/name(/name)*`. */
|
|
355
|
+
function beneath(b) {
|
|
356
|
+
return b.sequence([b.char(SEPARATOR), name(b), b.star(b.sequence([b.char(SEPARATOR), name(b)]))]);
|
|
357
|
+
}
|
|
358
|
+
function tokens(b, list) {
|
|
359
|
+
return b.sequence(list.map((token) => {
|
|
360
|
+
switch (token.kind) {
|
|
361
|
+
case 'literal':
|
|
362
|
+
return b.char(literalSet(token.point));
|
|
363
|
+
case 'any':
|
|
364
|
+
return b.char(ANY);
|
|
365
|
+
case 'star':
|
|
366
|
+
return b.star(b.char(ANY));
|
|
367
|
+
case 'class':
|
|
368
|
+
return b.char(classSet(token.ranges, token.negated));
|
|
369
|
+
}
|
|
370
|
+
}));
|
|
371
|
+
}
|
|
372
|
+
function segmentsFragment(b, segments) {
|
|
373
|
+
const parts = [];
|
|
374
|
+
segments.forEach((segment, i) => {
|
|
375
|
+
const last = i === segments.length - 1;
|
|
376
|
+
if (segment.kind === 'globstar') {
|
|
377
|
+
// Inside a path a globstar is any number of whole directories, the
|
|
378
|
+
// separator after them included; at its end, at least one segment.
|
|
379
|
+
parts.push(last ? b.sequence([name(b), b.star(b.sequence([b.char(SEPARATOR), name(b)]))]) : anyDirectories(b));
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
parts.push(tokens(b, segment.tokens));
|
|
383
|
+
if (!last)
|
|
384
|
+
parts.push(b.char(SEPARATOR));
|
|
385
|
+
});
|
|
386
|
+
return b.sequence(parts);
|
|
387
|
+
}
|
|
388
|
+
function compileAlternative(b, alternative, options, rooted, anchored) {
|
|
389
|
+
const { segments } = alternative;
|
|
390
|
+
const body = segmentsFragment(b, segments);
|
|
391
|
+
const root = rooted ? '/' : '';
|
|
392
|
+
const literal = literalText(segments);
|
|
393
|
+
const leading = leadingLiteral(segments);
|
|
394
|
+
if (options.dialect === 'gitignore') {
|
|
395
|
+
const floating = !anchored && !alternative.slashed;
|
|
396
|
+
const parts = [body, b.optional(beneath(b))];
|
|
397
|
+
if (floating)
|
|
398
|
+
parts.unshift(anyDirectories(b));
|
|
399
|
+
const base = literal !== null ? leading.slice(0, -1) : leading;
|
|
400
|
+
return { fragment: b.sequence(parts), base: floating ? '' : base.join('/') };
|
|
401
|
+
}
|
|
402
|
+
if (options.dialect === 'ripgrep' && !rooted && !alternative.slashed) {
|
|
403
|
+
return { fragment: b.sequence([anyDirectories(b), body]), base: '' };
|
|
404
|
+
}
|
|
405
|
+
const parts = rooted ? [b.char(SEPARATOR), body] : [body];
|
|
406
|
+
if (options.dialect === 'path' && literal !== null) {
|
|
407
|
+
const reading = typeof options.literal === 'function' ? options.literal(root + literal) : options.literal ?? 'either';
|
|
408
|
+
if (reading === 'directory') {
|
|
409
|
+
parts.push(beneath(b));
|
|
410
|
+
return { fragment: b.sequence(parts), base: root + literal };
|
|
411
|
+
}
|
|
412
|
+
if (reading === 'either')
|
|
413
|
+
parts.push(b.optional(beneath(b)));
|
|
414
|
+
}
|
|
415
|
+
// A literal path may be a file, whose base is the directory holding it.
|
|
416
|
+
const base = literal !== null ? leading.slice(0, -1) : leading;
|
|
417
|
+
return { fragment: b.sequence(parts), base: root + base.join('/') };
|
|
418
|
+
}
|
|
419
|
+
function leadingLiteral(segments) {
|
|
420
|
+
const out = [];
|
|
421
|
+
for (const segment of segments) {
|
|
422
|
+
const text = literalText([segment]);
|
|
423
|
+
if (text === null)
|
|
424
|
+
break;
|
|
425
|
+
out.push(text);
|
|
426
|
+
}
|
|
427
|
+
return out;
|
|
428
|
+
}
|
|
429
|
+
/* ---------------------------------------------------------------- questions */
|
|
430
|
+
function assertComparable(globs) {
|
|
431
|
+
for (const glob of globs) {
|
|
432
|
+
if (!glob.caseSensitive)
|
|
433
|
+
throw new Error(`"${glob.source}" ignores case; scopes are compared case-sensitively`);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* A shortest path every glob in `include` matches and no glob in `exclude`
|
|
438
|
+
* does: the file two scopes would both write, less what either protects.
|
|
439
|
+
* `none` is a proof that there is no such path. Case-sensitive globs only.
|
|
440
|
+
*/
|
|
441
|
+
export function globWitness(include, exclude = [], budget = WITNESS_BUDGET) {
|
|
442
|
+
assertComparable([...include, ...exclude]);
|
|
443
|
+
return findWitness(include.map((glob) => glob.automaton), exclude.map((glob) => glob.automaton), budget);
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Whether every path `inner` matches is matched by one of `outer`: `true`,
|
|
447
|
+
* `false`, or `undecided` when the search met its budget.
|
|
448
|
+
*/
|
|
449
|
+
export function globCovers(outer, inner, budget = WITNESS_BUDGET) {
|
|
450
|
+
const witness = globWitness([inner], outer, budget);
|
|
451
|
+
return witness.kind === 'undecided' ? 'undecided' : witness.kind === 'none';
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* A list of patterns read the way a `.gitignore` reads: in order, each entry
|
|
455
|
+
* deciding the paths it matches, a leading `!` taking them back out.
|
|
456
|
+
*/
|
|
457
|
+
export function parseGlobList(patterns, options) {
|
|
458
|
+
const entries = [];
|
|
459
|
+
for (const pattern of patterns) {
|
|
460
|
+
const trimmed = pattern.trim();
|
|
461
|
+
const negated = trimmed.startsWith('!');
|
|
462
|
+
const parsed = parseGlob(negated ? trimmed.slice(1) : trimmed, options);
|
|
463
|
+
if (!parsed.ok)
|
|
464
|
+
return { ok: false, error: `"${pattern}": ${parsed.error}` };
|
|
465
|
+
entries.push({ negated, glob: parsed.glob });
|
|
466
|
+
}
|
|
467
|
+
return {
|
|
468
|
+
ok: true,
|
|
469
|
+
list: {
|
|
470
|
+
entries,
|
|
471
|
+
match(path) {
|
|
472
|
+
let included = false;
|
|
473
|
+
for (const entry of entries)
|
|
474
|
+
if (entry.glob.match(path))
|
|
475
|
+
included = !entry.negated;
|
|
476
|
+
return included;
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
//# sourceMappingURL=glob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../../src/vendor/spec-core/pattern/glob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EACL,OAAO,EACP,WAAW,EACX,OAAO,EACP,cAAc,GAIf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAkB,MAAM,cAAc,CAAC;AA2CpF,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,MAAM,CAAS;IACxB,YAAY,MAAc,EAAE,MAAc;QACxC,KAAK,CAAC,iBAAiB,MAAM,MAAM,MAAM,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,6DAA6D;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAgBpC,gDAAgD;AAChD,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,SAAS,CAAC,MAAc,EAAE,OAAoB;IAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,O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,OAAO;YACP,KAAK,CAAC,IAAY;gBAChB,IAAI,QAAQ,GAAG,KAAK,CAAC;gBACrB,KAAK,MAAM,KAAK,IAAI,OAAO;oBAAE,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;wBAAE,QAAQ,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC;gBACnF,OAAO,QAAQ,CAAC;YAClB,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { compileGlob, globCovers, globWitness, isGlobSyntax, parseGlob, parseGlobList, GlobError, MAX_ALTERNATIVES } from './glob.js';
|
|
2
|
+
export type { Glob, GlobDialect, GlobList, GlobListParse, GlobOptions, GlobParse, LiteralReading } from './glob.js';
|
|
3
|
+
export { AutomatonTooLarge, MAX_STATES, WITNESS_BUDGET } from './automaton.js';
|
|
4
|
+
export type { Witness } from './automaton.js';
|
|
5
|
+
export { compileRegex, RegexError } from './regex.js';
|
|
6
|
+
export type { RegexMatcher, RegexOptions } from './regex.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/vendor/spec-core/pattern/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACtI,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpH,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/E,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACtD,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { compileGlob, globCovers, globWitness, isGlobSyntax, parseGlob, parseGlobList, GlobError, MAX_ALTERNATIVES } from './glob.js';
|
|
2
|
+
export { AutomatonTooLarge, MAX_STATES, WITNESS_BUDGET } from './automaton.js';
|
|
3
|
+
export { compileRegex, RegexError } from './regex.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/vendor/spec-core/pattern/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEtI,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A regular-expression matcher that cannot backtrack.
|
|
3
|
+
*
|
|
4
|
+
* Written for spec-graph, whose `~=` selector used to hand a user-supplied
|
|
5
|
+
* string to `RegExp` and wait (spec-graph ADR-0017), and moved here so that
|
|
6
|
+
* every tool that accepts a pattern from configuration or from a document can
|
|
7
|
+
* run it unattended in CI without a pattern deciding how long CI takes.
|
|
8
|
+
*
|
|
9
|
+
* The cost is neither theoretical nor exotic. `^([A-Za-z0-9_]+[ ]?)+$` is what
|
|
10
|
+
* somebody writes to say "the title is words separated by single spaces", and
|
|
11
|
+
* against a title that does not match, V8 tries one branch per way of cutting
|
|
12
|
+
* each word into pieces:
|
|
13
|
+
*
|
|
14
|
+
* ```text
|
|
15
|
+
* RegExp here
|
|
16
|
+
* the quick brown fox jumps over the lazy dog! 0.9s 11us
|
|
17
|
+
* the quick brown fox jumps over the lazy dog and! 5.4s 12us
|
|
18
|
+
* the quick brown fox jumps over the lazy dog and keeps! 103s 13us
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* So a pattern here is compiled to a non-deterministic finite automaton and
|
|
22
|
+
* simulated over the subject one character at a time (Thompson, 1968), keeping
|
|
23
|
+
* a set of live states instead of a stack of choices. Each state is visited at
|
|
24
|
+
* most once per position, which makes the work O(pattern x subject), growing
|
|
25
|
+
* with the subject and not with the pattern's ambiguity.
|
|
26
|
+
*
|
|
27
|
+
* What it costs is a dialect. Backreferences and lookaround are not regular and
|
|
28
|
+
* have no place in a linear automaton, so they are rejected while compiling,
|
|
29
|
+
* with a message and an offset, rather than accepted and then slow.
|
|
30
|
+
*
|
|
31
|
+
* The dialect is JavaScript's without the `u` flag, character for character,
|
|
32
|
+
* and is held to that by a differential test against `RegExp`: code units,
|
|
33
|
+
* not code points, and `i` folding by the specification's `Canonicalize`.
|
|
34
|
+
* Matching is unanchored and, unless `ignoreCase: false` is passed,
|
|
35
|
+
* case-insensitive, which is what spec-graph's `~=` has always been. There
|
|
36
|
+
* are no captures: nothing asks where a match was, only whether there was one.
|
|
37
|
+
*/
|
|
38
|
+
/** A pattern that will not compile, and where in it the problem starts. */
|
|
39
|
+
export declare class RegexError extends Error {
|
|
40
|
+
/** Offset into the pattern source. */
|
|
41
|
+
readonly offset: number;
|
|
42
|
+
constructor(message: string, offset: number);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A compiled pattern. Reusable and safe to cache.
|
|
46
|
+
*
|
|
47
|
+
* Not reentrant, which nothing can ask of it: `test` is synchronous and calls
|
|
48
|
+
* out to nothing, and the buffers it keeps between subjects are what make it
|
|
49
|
+
* cheap enough to run against every path a walk visits.
|
|
50
|
+
*/
|
|
51
|
+
export interface RegexMatcher {
|
|
52
|
+
/** True when the pattern matches anywhere in the subject. */
|
|
53
|
+
test(subject: string): boolean;
|
|
54
|
+
/** State count. Published for the size test, and for nothing else. */
|
|
55
|
+
readonly size: number;
|
|
56
|
+
}
|
|
57
|
+
export interface RegexOptions {
|
|
58
|
+
/** Fold case the way the `i` flag does. On unless set to `false`. */
|
|
59
|
+
readonly ignoreCase?: boolean | undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Compiles a pattern into a matcher.
|
|
63
|
+
*
|
|
64
|
+
* Throws {@link RegexError} on anything it cannot run in linear time, which
|
|
65
|
+
* is the point: the alternative to a message here is a build that stops.
|
|
66
|
+
*/
|
|
67
|
+
export declare function compileRegex(source: string, options?: RegexOptions): RegexMatcher;
|
|
68
|
+
//# sourceMappingURL=regex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../../../src/vendor/spec-core/pattern/regex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAMH,2EAA2E;AAC3E,qBAAa,UAAW,SAAQ,KAAK;IACnC,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,YAAY,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAI1C;CACF;AAioBD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,YAAY,CAcrF"}
|