maka-agent 0.2.0-dev.30.20260912 → 0.2.0-dev.31.20260913
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/THIRD_PARTY_NOTICES.txt +392 -0
- package/dist/acp/maka-acp-agent.js +8 -2
- package/dist/acp/prompt-content.js +225 -0
- package/dist/acp/session-event-mapper.js +103 -0
- package/dist/acp/session-registry.js +654 -17
- package/dist/acp/stdio-server.js +10 -1
- package/dist/cli-core.js +1 -1
- package/dist/pi-transcript-tools.js +3 -2
- package/dist/pi-transcript.js +12 -2
- package/dist/runtime-host-session-channel.js +63 -9
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/core/dist/artifacts.js +6 -0
- package/node_modules/@maka/core/dist/attachments.js +7 -2
- package/node_modules/@maka/core/dist/durable-tool-result-projection.js +3 -1
- package/node_modules/@maka/core/dist/events.js +21 -0
- package/node_modules/@maka/core/dist/goal.js +44 -2
- package/node_modules/@maka/core/dist/permission.js +0 -1
- package/node_modules/@maka/core/dist/runtime-boundary.js +73 -29
- package/node_modules/@maka/core/dist/runtime-event.js +6 -3
- package/node_modules/@maka/core/dist/runtime-handoff.js +10 -2
- package/node_modules/@maka/core/dist/runtime-logical-execution.js +39 -14
- package/node_modules/@maka/core/dist/tool-result-archive-evidence.js +3 -1
- package/node_modules/@maka/core/dist/tool-result-record-schema.js +2 -1
- package/node_modules/@maka/core/dist/unified-diff.js +33 -26
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +49 -178
- package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +7 -2
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +15 -53
- package/node_modules/@maka/runtime/dist/bash-model-output.js +7 -1
- package/node_modules/@maka/runtime/dist/bash-tail-buffer.js +13 -52
- package/node_modules/@maka/runtime/dist/builtin-tools.js +59 -111
- package/node_modules/@maka/runtime/dist/child-fd-input.js +3 -2
- package/node_modules/@maka/runtime/dist/context-budget-policy.js +1 -11
- package/node_modules/@maka/runtime/dist/context-budget.js +12 -1
- package/node_modules/@maka/runtime/dist/conversation-copy.js +104 -9
- package/node_modules/@maka/runtime/dist/filesystem-executor.js +10 -6
- package/node_modules/@maka/runtime/dist/filesystem-worker/client.js +77 -19
- package/node_modules/@maka/runtime/dist/filesystem-worker/launch-spec.js +66 -55
- package/node_modules/@maka/runtime/dist/filesystem-worker/operations.js +34 -97
- package/node_modules/@maka/runtime/dist/filesystem-worker/protocol.js +25 -10
- package/node_modules/@maka/runtime/dist/filesystem-worker/worker-entry.js +2 -0
- package/node_modules/@maka/runtime/dist/glob-search.js +74 -0
- package/node_modules/@maka/runtime/dist/goal-continuation.js +78 -8
- package/node_modules/@maka/runtime/dist/goal-state.js +7 -0
- package/node_modules/@maka/runtime/dist/grep-search.js +155 -0
- package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +84 -94
- package/node_modules/@maka/runtime/dist/model-history.js +25 -3
- package/node_modules/@maka/runtime/dist/pipe-tail-collector.js +6 -9
- package/node_modules/@maka/runtime/dist/read-page.js +231 -0
- package/node_modules/@maka/runtime/dist/request-projection.js +2 -15
- package/node_modules/@maka/runtime/dist/ripgrep-executable.js +62 -0
- package/node_modules/@maka/runtime/dist/ripgrep-guidance.js +81 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +187 -20
- package/node_modules/@maka/runtime/dist/runtime-read-model.js +2 -1
- package/node_modules/@maka/runtime/dist/sandbox/linux-profile-path.js +7 -1
- package/node_modules/@maka/runtime/dist/sandbox/linux-sandbox.js +20 -5
- package/node_modules/@maka/runtime/dist/session-manager.js +6 -6
- package/node_modules/@maka/runtime/dist/session-recap.js +9 -5
- package/node_modules/@maka/runtime/dist/shell-exec.js +7 -25
- package/node_modules/@maka/runtime/dist/shell-run-manager.js +1 -1
- package/node_modules/@maka/runtime/dist/shell-run-tool-result.js +1 -1
- package/node_modules/@maka/runtime/dist/shell-tools.js +6 -12
- package/node_modules/@maka/runtime/dist/tool-availability.js +0 -1
- package/node_modules/@maka/runtime/dist/tool-output.js +1 -1
- package/node_modules/@maka/runtime/dist/tool-result-archive-capability.js +24 -36
- package/node_modules/@maka/runtime/dist/tool-result-archive-resource.js +32 -527
- package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +17 -119
- package/node_modules/@maka/runtime/dist/tool-result-archive.js +7 -25
- package/node_modules/@maka/runtime/dist/tool-runtime.js +7 -5
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +6933 -3681
- package/node_modules/@maka/runtime/dist/workspace-executor.js +20 -24
- package/node_modules/@maka/runtime/package.json +2 -0
- package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +185 -191
- package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +3 -0
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +5 -1
- package/node_modules/@maka/runtime-host/dist/protocol/message.js +2 -2
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +2 -2
- package/node_modules/@maka/runtime-host/dist/protocol/turn.js +10 -2
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +38 -0
- package/node_modules/@maka/runtime-host/dist/server/execution-artifacts.js +2 -8
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +2 -0
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +81 -7
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +13 -13
- package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +65 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +1 -0
- package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +5 -2
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +88 -72
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +21 -4
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +145 -1
- package/node_modules/@maka/storage/dist/agent-run-store.js +5 -2
- package/node_modules/@maka/storage/dist/execution-stores.js +2 -1
- package/node_modules/@maka/storage/dist/runtime-transcript-query.js +27 -14
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +69 -3
- package/node_modules/balanced-match/LICENSE.md +23 -0
- package/node_modules/balanced-match/README.md +57 -0
- package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
- package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
- package/node_modules/balanced-match/dist/esm/index.js +54 -0
- package/node_modules/balanced-match/dist/esm/package.json +3 -0
- package/node_modules/balanced-match/package.json +68 -0
- package/node_modules/brace-expansion/LICENSE +23 -0
- package/node_modules/brace-expansion/README.md +105 -0
- package/node_modules/brace-expansion/dist/commonjs/index.js +289 -0
- package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
- package/node_modules/brace-expansion/dist/esm/index.js +285 -0
- package/node_modules/brace-expansion/dist/esm/package.json +3 -0
- package/node_modules/brace-expansion/package.json +64 -0
- package/node_modules/glob/LICENSE.md +63 -0
- package/node_modules/glob/README.md +1203 -0
- package/node_modules/glob/dist/commonjs/glob.js +248 -0
- package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
- package/node_modules/glob/dist/commonjs/ignore.js +119 -0
- package/node_modules/glob/dist/commonjs/index.js +68 -0
- package/node_modules/glob/dist/commonjs/index.min.js +4 -0
- package/node_modules/glob/dist/commonjs/package.json +3 -0
- package/node_modules/glob/dist/commonjs/pattern.js +223 -0
- package/node_modules/glob/dist/commonjs/processor.js +301 -0
- package/node_modules/glob/dist/commonjs/walker.js +387 -0
- package/node_modules/glob/dist/esm/glob.js +244 -0
- package/node_modules/glob/dist/esm/has-magic.js +23 -0
- package/node_modules/glob/dist/esm/ignore.js +115 -0
- package/node_modules/glob/dist/esm/index.js +55 -0
- package/node_modules/glob/dist/esm/index.min.js +4 -0
- package/node_modules/glob/dist/esm/package.json +3 -0
- package/node_modules/glob/dist/esm/pattern.js +219 -0
- package/node_modules/glob/dist/esm/processor.js +294 -0
- package/node_modules/glob/dist/esm/walker.js +381 -0
- package/node_modules/glob/package.json +98 -0
- package/node_modules/minimatch/LICENSE.md +55 -0
- package/node_modules/minimatch/README.md +528 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/node_modules/minimatch/dist/commonjs/ast.js +845 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
- package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
- package/node_modules/minimatch/dist/commonjs/index.js +1127 -0
- package/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- package/node_modules/minimatch/dist/esm/ast.js +841 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
- package/node_modules/minimatch/dist/esm/escape.js +26 -0
- package/node_modules/minimatch/dist/esm/index.js +1114 -0
- package/node_modules/minimatch/dist/esm/package.json +3 -0
- package/node_modules/minimatch/dist/esm/unescape.js +34 -0
- package/node_modules/minimatch/package.json +73 -0
- package/node_modules/minipass/LICENSE.md +55 -0
- package/node_modules/minipass/README.md +825 -0
- package/node_modules/minipass/dist/commonjs/index.js +1038 -0
- package/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/node_modules/minipass/dist/esm/index.js +1020 -0
- package/node_modules/minipass/dist/esm/package.json +3 -0
- package/node_modules/minipass/package.json +77 -0
- package/node_modules/path-scurry/LICENSE.md +55 -0
- package/node_modules/path-scurry/README.md +636 -0
- package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
- package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/dist/esm/index.js +1983 -0
- package/node_modules/path-scurry/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/LICENSE.md +55 -0
- package/node_modules/path-scurry/node_modules/lru-cache/README.md +469 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.js +1726 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.js +10 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1726 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.js +1726 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.js +10 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.js +10 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.js +1722 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1722 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +6 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.js +1722 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/package.json +154 -0
- package/node_modules/path-scurry/package.json +72 -0
- package/package.json +1 -1
- package/node_modules/@maka/runtime/dist/active-tool-result-prune.js +0 -248
- package/node_modules/@maka/runtime/dist/active-tool-result-working-set.js +0 -218
- package/node_modules/@maka/runtime/dist/archive-read-tool.js +0 -115
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// translate the various posix character classes into unicode properties
|
|
3
|
+
// this works across all unicode locales
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.parseClass = void 0;
|
|
6
|
+
// { <posix class>: [<translation>, /u flag required, negated]
|
|
7
|
+
const posixClasses = {
|
|
8
|
+
'[:alnum:]': ['\\p{L}\\p{Nl}\\p{Nd}', true],
|
|
9
|
+
'[:alpha:]': ['\\p{L}\\p{Nl}', true],
|
|
10
|
+
'[:ascii:]': ['\\x' + '00-\\x' + '7f', false],
|
|
11
|
+
'[:blank:]': ['\\p{Zs}\\t', true],
|
|
12
|
+
'[:cntrl:]': ['\\p{Cc}', true],
|
|
13
|
+
'[:digit:]': ['\\p{Nd}', true],
|
|
14
|
+
'[:graph:]': ['\\p{Z}\\p{C}', true, true],
|
|
15
|
+
'[:lower:]': ['\\p{Ll}', true],
|
|
16
|
+
'[:print:]': ['\\p{C}', true],
|
|
17
|
+
'[:punct:]': ['\\p{P}', true],
|
|
18
|
+
'[:space:]': ['\\p{Z}\\t\\r\\n\\v\\f', true],
|
|
19
|
+
'[:upper:]': ['\\p{Lu}', true],
|
|
20
|
+
'[:word:]': ['\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}', true],
|
|
21
|
+
'[:xdigit:]': ['A-Fa-f0-9', false],
|
|
22
|
+
};
|
|
23
|
+
// only need to escape a few things inside of brace expressions
|
|
24
|
+
// escapes: [ \ ] -
|
|
25
|
+
const braceEscape = (s) => s.replace(/[[\]\\-]/g, '\\$&');
|
|
26
|
+
// escape all regexp magic characters
|
|
27
|
+
const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
28
|
+
// everything has already been escaped, we just have to join
|
|
29
|
+
const rangesToString = (ranges) => ranges.join('');
|
|
30
|
+
// takes a glob string at a posix brace expression, and returns
|
|
31
|
+
// an equivalent regular expression source, and boolean indicating
|
|
32
|
+
// whether the /u flag needs to be applied, and the number of chars
|
|
33
|
+
// consumed to parse the character class.
|
|
34
|
+
// This also removes out of order ranges, and returns ($.) if the
|
|
35
|
+
// entire class just no good.
|
|
36
|
+
const parseClass = (glob, position) => {
|
|
37
|
+
const pos = position;
|
|
38
|
+
/* c8 ignore start */
|
|
39
|
+
if (glob.charAt(pos) !== '[') {
|
|
40
|
+
throw new Error('not in a brace expression');
|
|
41
|
+
}
|
|
42
|
+
/* c8 ignore stop */
|
|
43
|
+
const ranges = [];
|
|
44
|
+
const negs = [];
|
|
45
|
+
let i = pos + 1;
|
|
46
|
+
let sawStart = false;
|
|
47
|
+
let uflag = false;
|
|
48
|
+
let escaping = false;
|
|
49
|
+
let negate = false;
|
|
50
|
+
let endPos = pos;
|
|
51
|
+
let rangeStart = '';
|
|
52
|
+
WHILE: while (i < glob.length) {
|
|
53
|
+
const c = glob.charAt(i);
|
|
54
|
+
if ((c === '!' || c === '^') && i === pos + 1) {
|
|
55
|
+
negate = true;
|
|
56
|
+
i++;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (c === ']' && sawStart && !escaping) {
|
|
60
|
+
endPos = i + 1;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
sawStart = true;
|
|
64
|
+
if (c === '\\') {
|
|
65
|
+
if (!escaping) {
|
|
66
|
+
escaping = true;
|
|
67
|
+
i++;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
// escaped \ char, fall through and treat like normal char
|
|
71
|
+
}
|
|
72
|
+
if (c === '[' && !escaping) {
|
|
73
|
+
// either a posix class, a collation equivalent, or just a [
|
|
74
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
75
|
+
if (glob.startsWith(cls, i)) {
|
|
76
|
+
// invalid, [a-[] is fine, but not [a-[:alpha]]
|
|
77
|
+
if (rangeStart) {
|
|
78
|
+
return ['$.', false, glob.length - pos, true];
|
|
79
|
+
}
|
|
80
|
+
i += cls.length;
|
|
81
|
+
if (neg)
|
|
82
|
+
negs.push(unip);
|
|
83
|
+
else
|
|
84
|
+
ranges.push(unip);
|
|
85
|
+
uflag = uflag || u;
|
|
86
|
+
continue WHILE;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// now it's just a normal character, effectively
|
|
91
|
+
escaping = false;
|
|
92
|
+
if (rangeStart) {
|
|
93
|
+
// throw this range away if it's not valid, but others
|
|
94
|
+
// can still match.
|
|
95
|
+
if (c > rangeStart) {
|
|
96
|
+
ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c));
|
|
97
|
+
}
|
|
98
|
+
else if (c === rangeStart) {
|
|
99
|
+
ranges.push(braceEscape(c));
|
|
100
|
+
}
|
|
101
|
+
rangeStart = '';
|
|
102
|
+
i++;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
// now might be the start of a range.
|
|
106
|
+
// can be either c-d or c-] or c<more...>] or c] at this point
|
|
107
|
+
if (glob.startsWith('-]', i + 1)) {
|
|
108
|
+
ranges.push(braceEscape(c + '-'));
|
|
109
|
+
i += 2;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (glob.startsWith('-', i + 1)) {
|
|
113
|
+
rangeStart = c;
|
|
114
|
+
i += 2;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
// not the start of a range, just a single character
|
|
118
|
+
ranges.push(braceEscape(c));
|
|
119
|
+
i++;
|
|
120
|
+
}
|
|
121
|
+
if (endPos < i) {
|
|
122
|
+
// didn't see the end of the class, not a valid class,
|
|
123
|
+
// but might still be valid as a literal match.
|
|
124
|
+
return ['', false, 0, false];
|
|
125
|
+
}
|
|
126
|
+
// if we got no ranges and no negates, then we have a range that
|
|
127
|
+
// cannot possibly match anything, and that poisons the whole glob
|
|
128
|
+
if (!ranges.length && !negs.length) {
|
|
129
|
+
return ['$.', false, glob.length - pos, true];
|
|
130
|
+
}
|
|
131
|
+
// if we got one positive range, and it's a single character, then that's
|
|
132
|
+
// not actually a magic pattern, it's just that one literal character.
|
|
133
|
+
// we should not treat that as "magic", we should just return the literal
|
|
134
|
+
// character. [_] is a perfectly valid way to escape glob magic chars.
|
|
135
|
+
if (negs.length === 0 &&
|
|
136
|
+
ranges.length === 1 &&
|
|
137
|
+
/^\\?.$/.test(ranges[0]) &&
|
|
138
|
+
!negate) {
|
|
139
|
+
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
140
|
+
return [regexpEscape(r), false, endPos - pos, false];
|
|
141
|
+
}
|
|
142
|
+
const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
|
|
143
|
+
const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
|
|
144
|
+
const comb = ranges.length && negs.length ? '(' + sranges + '|' + snegs + ')'
|
|
145
|
+
: ranges.length ? sranges
|
|
146
|
+
: snegs;
|
|
147
|
+
return [comb, uflag, endPos - pos, true];
|
|
148
|
+
};
|
|
149
|
+
exports.parseClass = parseClass;
|
|
150
|
+
//# sourceMappingURL=brace-expressions.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.escape = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Escape all magic characters in a glob pattern.
|
|
6
|
+
*
|
|
7
|
+
* If the {@link MinimatchOptions.windowsPathsNoEscape}
|
|
8
|
+
* option is used, then characters are escaped by wrapping in `[]`, because
|
|
9
|
+
* a magic character wrapped in a character class can only be satisfied by
|
|
10
|
+
* that exact character. In this mode, `\` is _not_ escaped, because it is
|
|
11
|
+
* not interpreted as a magic character, but instead as a path separator.
|
|
12
|
+
*
|
|
13
|
+
* If the {@link MinimatchOptions.magicalBraces} option is used,
|
|
14
|
+
* then braces (`{` and `}`) will be escaped.
|
|
15
|
+
*/
|
|
16
|
+
const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false, } = {}) => {
|
|
17
|
+
// don't need to escape +@! because we escape the parens
|
|
18
|
+
// that make those magic, and escaping ! as [!] isn't valid,
|
|
19
|
+
// because [!]] is a valid glob class meaning not ']'.
|
|
20
|
+
if (magicalBraces) {
|
|
21
|
+
return windowsPathsNoEscape ?
|
|
22
|
+
s.replace(/[?*()[\]{}]/g, '[$&]')
|
|
23
|
+
: s.replace(/[?*()[\]\\{}]/g, '\\$&');
|
|
24
|
+
}
|
|
25
|
+
return windowsPathsNoEscape ?
|
|
26
|
+
s.replace(/[?*()[\]]/g, '[$&]')
|
|
27
|
+
: s.replace(/[?*()[\]\\]/g, '\\$&');
|
|
28
|
+
};
|
|
29
|
+
exports.escape = escape;
|
|
30
|
+
//# sourceMappingURL=escape.js.map
|