@fnndsc/brasa 0.23.1 → 0.24.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/dist/buildinfo.json +1 -1
- package/dist/builtins/fs/pull.args.d.ts +1 -1
- package/dist/builtins/fs/pull.args.js +5 -3
- package/dist/builtins/fs/pull.args.js.map +1 -1
- package/dist/builtins/fs/pull.js +2 -2
- package/dist/builtins/fs/touch.js +1 -1
- package/dist/builtins/fs/touch.js.map +1 -1
- package/dist/builtins/help.js +128 -10
- package/dist/builtins/help.js.map +1 -1
- package/dist/builtins/index.d.ts +5 -0
- package/dist/builtins/index.js +5 -0
- package/dist/builtins/index.js.map +1 -1
- package/dist/builtins/net/query.csv.js +14 -0
- package/dist/builtins/net/query.csv.js.map +1 -1
- package/dist/builtins/net/query.js +3 -0
- package/dist/builtins/net/query.js.map +1 -1
- package/dist/builtins/pluginExecute.js +28 -3
- package/dist/builtins/pluginExecute.js.map +1 -1
- package/dist/builtins/proc.js +32 -2
- package/dist/builtins/proc.js.map +1 -1
- package/dist/builtins/res/dicom.d.ts +35 -1
- package/dist/builtins/res/dicom.js +62 -3
- package/dist/builtins/res/dicom.js.map +1 -1
- package/dist/builtins/res/expect.d.ts +40 -0
- package/dist/builtins/res/expect.js +447 -0
- package/dist/builtins/res/expect.js.map +1 -0
- package/dist/builtins/res/gather.d.ts +10 -0
- package/dist/builtins/res/gather.js +224 -0
- package/dist/builtins/res/gather.js.map +1 -0
- package/dist/builtins/res/gather.store.d.ts +131 -0
- package/dist/builtins/res/gather.store.js +225 -0
- package/dist/builtins/res/gather.store.js.map +1 -0
- package/dist/builtins/res/pipeline.args.d.ts +5 -2
- package/dist/builtins/res/pipeline.args.js +8 -3
- package/dist/builtins/res/pipeline.args.js.map +1 -1
- package/dist/builtins/res/pipeline.js +23 -0
- package/dist/builtins/res/pipeline.js.map +1 -1
- package/dist/builtins/res/play.d.ts +70 -0
- package/dist/builtins/res/play.js +334 -0
- package/dist/builtins/res/play.js.map +1 -0
- package/dist/builtins/res/plugin.js +21 -6
- package/dist/builtins/res/plugin.js.map +1 -1
- package/dist/builtins/res/record.d.ts +49 -0
- package/dist/builtins/res/record.js +150 -0
- package/dist/builtins/res/record.js.map +1 -0
- package/dist/builtins/res/runWait.d.ts +49 -0
- package/dist/builtins/res/runWait.js +193 -0
- package/dist/builtins/res/runWait.js.map +1 -0
- package/dist/builtins/sys/weather.d.ts +132 -0
- package/dist/builtins/sys/weather.js +297 -0
- package/dist/builtins/sys/weather.js.map +1 -0
- package/dist/command-keys.js +4 -0
- package/dist/command-keys.js.map +1 -1
- package/dist/core/connect.d.ts +31 -1
- package/dist/core/connect.js +32 -1
- package/dist/core/connect.js.map +1 -1
- package/dist/core/dispatch.d.ts +0 -14
- package/dist/core/dispatch.js +83 -27
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/engine.d.ts +10 -0
- package/dist/core/engine.js +48 -3
- package/dist/core/engine.js.map +1 -1
- package/dist/core/expansion.d.ts +70 -0
- package/dist/core/expansion.js +289 -0
- package/dist/core/expansion.js.map +1 -0
- package/dist/core/promptContext.js +5 -1
- package/dist/core/promptContext.js.map +1 -1
- package/dist/lib/duration.d.ts +17 -0
- package/dist/lib/duration.js +25 -0
- package/dist/lib/duration.js.map +1 -0
- package/dist/lib/parser.d.ts +50 -0
- package/dist/lib/parser.js +119 -0
- package/dist/lib/parser.js.map +1 -1
- package/dist/logo/brain.d.ts +6 -27
- package/dist/logo/brain.js +5 -250
- package/dist/logo/brain.js.map +1 -1
- package/dist/session/answer.d.ts +141 -0
- package/dist/session/answer.js +163 -0
- package/dist/session/answer.js.map +1 -0
- package/dist/session/answerAdapters.d.ts +4 -0
- package/dist/session/answerAdapters.js +106 -0
- package/dist/session/answerAdapters.js.map +1 -0
- package/dist/session/recent.d.ts +68 -0
- package/dist/session/recent.js +99 -0
- package/dist/session/recent.js.map +1 -0
- package/dist/session/recorder.d.ts +61 -0
- package/dist/session/recorder.js +95 -0
- package/dist/session/recorder.js.map +1 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptContext.js","sourceRoot":"","sources":["../../src/core/promptContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAkB,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAsB,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAiB,QAAQ,EAE9B,aAAa,
|
|
1
|
+
{"version":3,"file":"promptContext.js","sourceRoot":"","sources":["../../src/core/promptContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAkB,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAsB,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAiB,QAAQ,EAE9B,aAAa,GAOd,MAAM,eAAe,CAAC;AA0CvB;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,KAAK,GAAG,aAAa,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAoB,QAAQ,EAAE,CAAC;IACzC,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,MAAM;QACvC,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,KAAK;QAC1C,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CA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ACjE,MAAM,SAAS,GACb,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC;QACvF,CAAC,CAAC;YACE,IAAI,EAAE,SAAS,CAAC,MAAM;YACtB,KAAK,EAAE,aAAa,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK;SACrE;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO;QACL,IAAI,EAAmB,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,cAAc,CAAC;QACpF,GAAG,EAAoB,SAAS,CAAC,CAAC,CAAC,SAAS,CAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,IAAK,SAAS,CAAC;QAC/E,GAAG,EAAoB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAY,CAAC,CAAC,GAAG;QACvD,UAAU,EAAa,OAAO,CAAC,UAAU,IAAI,IAAI;QACjD,YAAY,EAAW,OAAO,CAAC,gBAAgB,EAAE;QACjD,YAAY,EAAW,OAAO,CAAC,YAAY,IAAI,CAAC;QAChD,qBAAqB,EAAE,OAAO,CAAC,qBAAqB,IAAI,CAAC;QACzD,UAAU;QACV,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file How the language reads a duration.
|
|
3
|
+
*
|
|
4
|
+
* `expect --within` and `play --pace` are the same notion of time, so they
|
|
5
|
+
* read it with the same function: a second parser beside this one is a
|
|
6
|
+
* second set of durations that mean something slightly else, and a manifest
|
|
7
|
+
* that says `20m` in two places must mean twenty minutes in both.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Reads a duration the way an operator writes one.
|
|
13
|
+
*
|
|
14
|
+
* @param text - A duration such as `30s`, `20m`, `2h`, `250ms`, or bare seconds.
|
|
15
|
+
* @returns Milliseconds, or null when the text is not a duration.
|
|
16
|
+
*/
|
|
17
|
+
export declare function duration_parse(text: string): number | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file How the language reads a duration.
|
|
3
|
+
*
|
|
4
|
+
* `expect --within` and `play --pace` are the same notion of time, so they
|
|
5
|
+
* read it with the same function: a second parser beside this one is a
|
|
6
|
+
* second set of durations that mean something slightly else, and a manifest
|
|
7
|
+
* that says `20m` in two places must mean twenty minutes in both.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/** How long each unit lasts, in milliseconds. */
|
|
12
|
+
const UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000 };
|
|
13
|
+
/**
|
|
14
|
+
* Reads a duration the way an operator writes one.
|
|
15
|
+
*
|
|
16
|
+
* @param text - A duration such as `30s`, `20m`, `2h`, `250ms`, or bare seconds.
|
|
17
|
+
* @returns Milliseconds, or null when the text is not a duration.
|
|
18
|
+
*/
|
|
19
|
+
export function duration_parse(text) {
|
|
20
|
+
const match = text.trim().match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);
|
|
21
|
+
if (match === null)
|
|
22
|
+
return null;
|
|
23
|
+
return Number(match[1]) * UNIT_MS[match[2] ?? 's'];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.js","sourceRoot":"","sources":["../../src/lib/duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,iDAAiD;AACjD,MAAM,OAAO,GAA2B,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,KAAK,GAA4B,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACzF,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;AACrD,CAAC"}
|
package/dist/lib/parser.d.ts
CHANGED
|
@@ -5,12 +5,32 @@
|
|
|
5
5
|
* backslash escapes. Quotes are stripped from rendered values, but their
|
|
6
6
|
* pathname-expansion meaning is retained.
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* One piece of a word: literal text, or a reference the line asked for.
|
|
10
|
+
*
|
|
11
|
+
* The tokenizer records references rather than resolving them, because
|
|
12
|
+
* resolving is asynchronous (a pronoun asks the session) and tokenizing is
|
|
13
|
+
* not. What it must record is the QUOTING, since that is known only here:
|
|
14
|
+
* inside single quotes a `$` is text, inside double quotes a reference is
|
|
15
|
+
* one operand however many values it carries, and bare it may become
|
|
16
|
+
* several — the shell's rule, which the stack claims to wear.
|
|
17
|
+
*/
|
|
18
|
+
export interface ShellSegment {
|
|
19
|
+
/** Literal text, when this piece is text. */
|
|
20
|
+
text: string;
|
|
21
|
+
/** The reference's name, when this piece is one. */
|
|
22
|
+
ref: string | null;
|
|
23
|
+
/** Whether the reference stood inside double quotes. */
|
|
24
|
+
quoted: boolean;
|
|
25
|
+
}
|
|
8
26
|
/** A rendered shell word and the glob pattern it may contribute. */
|
|
9
27
|
export interface ShellWord {
|
|
10
28
|
value: string;
|
|
11
29
|
globPattern: string;
|
|
12
30
|
pathnameExpansion: boolean;
|
|
13
31
|
pathnameExpanded: boolean;
|
|
32
|
+
/** The word's pieces, when it holds a reference; absent when it is plain text. */
|
|
33
|
+
segments?: ShellSegment[];
|
|
14
34
|
}
|
|
15
35
|
/** String arguments with per-operand pathname-expansion provenance. */
|
|
16
36
|
export type ShellArguments = string[] & {
|
|
@@ -84,3 +104,33 @@ export declare function shellWords_tokenize(line: string): ShellWord[];
|
|
|
84
104
|
* @returns Array of tokens with quotes removed.
|
|
85
105
|
*/
|
|
86
106
|
export declare function args_tokenize(line: string): string[];
|
|
107
|
+
/** What a reference turned out to be. */
|
|
108
|
+
export type ReferenceValue = {
|
|
109
|
+
values: string[];
|
|
110
|
+
} | null;
|
|
111
|
+
/** Answers what a reference refers to, or null when nothing does. */
|
|
112
|
+
export type ReferenceResolver = (name: string) => Promise<ReferenceValue>;
|
|
113
|
+
/** How reference expansion went. */
|
|
114
|
+
export type ReferenceExpansion = {
|
|
115
|
+
ok: true;
|
|
116
|
+
words: ShellWord[];
|
|
117
|
+
} | {
|
|
118
|
+
ok: false;
|
|
119
|
+
missing: string;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Resolves the references in a line's words, respecting how they were quoted.
|
|
123
|
+
*
|
|
124
|
+
* The shell's rule, kept: a bare reference carrying several values becomes
|
|
125
|
+
* several operands, a double-quoted one stays a single operand however many
|
|
126
|
+
* values it holds, and a single-quoted `$` never got here at all. An
|
|
127
|
+
* expanded value never globs afterwards — a filename with a bracket in it is
|
|
128
|
+
* a filename, not a pattern.
|
|
129
|
+
*
|
|
130
|
+
* @param words - The tokenized words.
|
|
131
|
+
* @param resolve - Answers what a reference refers to.
|
|
132
|
+
* @param unresolvedStands - Leave an unanswerable reference as written
|
|
133
|
+
* instead of refusing: what a dry run does, having run nothing.
|
|
134
|
+
* @returns The expanded words, or the reference nothing could answer.
|
|
135
|
+
*/
|
|
136
|
+
export declare function shellWords_referencesExpand(words: readonly ShellWord[], resolve: ReferenceResolver, unresolvedStands?: boolean): Promise<ReferenceExpansion>;
|
package/dist/lib/parser.js
CHANGED
|
@@ -5,6 +5,23 @@
|
|
|
5
5
|
* backslash escapes. Quotes are stripped from rendered values, but their
|
|
6
6
|
* pathname-expansion meaning is retained.
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* What a reference looks like: `${name}` or a bare `$NAME`.
|
|
10
|
+
*
|
|
11
|
+
* A braced name may carry dots, which is how a session pronoun names part
|
|
12
|
+
* of what it refers to (`${gather.first.place}`); a bare one may not, so
|
|
13
|
+
* `$HOME.txt` keeps its extension.
|
|
14
|
+
*/
|
|
15
|
+
const REFERENCE_PATTERN = /^\$(?:\{([A-Za-z_][A-Za-z0-9_.]*)\}|([A-Za-z_][A-Za-z0-9_]*))/;
|
|
16
|
+
/**
|
|
17
|
+
* What an index looks like: `@SER3`, `@STD001`, `@FIL2,3,7`, `@DIR2-4`.
|
|
18
|
+
*
|
|
19
|
+
* A row of the session's last answer, named by the handle the listing shows
|
|
20
|
+
* beside it — the KIND it counts, then its place in that kind's sequence.
|
|
21
|
+
* The sigil keeps it unambiguous: a directory called `SER3` is a path, and
|
|
22
|
+
* `@SER3` never is.
|
|
23
|
+
*/
|
|
24
|
+
const INDEX_PATTERN = /^@([A-Z]{3}\d+(?:-\d+)?(?:,\d+(?:-\d+)?)*)/;
|
|
8
25
|
/** Escapes wildcard metacharacters for literal minimatch use. */
|
|
9
26
|
function globLiteral_escape(value) {
|
|
10
27
|
return value.replace(/[\\*?\[\]]/g, '\\$&');
|
|
@@ -132,25 +149,49 @@ export function shellWords_tokenize(line) {
|
|
|
132
149
|
let inSingle = false;
|
|
133
150
|
let inDouble = false;
|
|
134
151
|
let escapeNext = false;
|
|
152
|
+
let segments = [];
|
|
153
|
+
let pendingText = '';
|
|
154
|
+
const text_flush = () => {
|
|
155
|
+
if (pendingText.length === 0)
|
|
156
|
+
return;
|
|
157
|
+
segments.push({ text: pendingText, ref: null, quoted: false });
|
|
158
|
+
pendingText = '';
|
|
159
|
+
};
|
|
135
160
|
const character_append = (char, literal) => {
|
|
136
161
|
currentValue += char;
|
|
137
162
|
currentPattern += literal ? globLiteral_escape(char) : char;
|
|
138
163
|
pathnameExpansion ||= !literal && /[*?[\]]/.test(char);
|
|
164
|
+
pendingText += char;
|
|
165
|
+
wordStarted = true;
|
|
166
|
+
};
|
|
167
|
+
const reference_append = (name, raw, quoted) => {
|
|
168
|
+
text_flush();
|
|
169
|
+
segments.push({ text: '', ref: name, quoted });
|
|
170
|
+
// The value keeps the reference as written: every reader that does not
|
|
171
|
+
// resolve references (completion, help, the tests) sees the line as the
|
|
172
|
+
// operator typed it.
|
|
173
|
+
currentValue += raw;
|
|
174
|
+
currentPattern += globLiteral_escape(raw);
|
|
139
175
|
wordStarted = true;
|
|
140
176
|
};
|
|
141
177
|
const word_pushCurrent = () => {
|
|
142
178
|
if (!wordStarted)
|
|
143
179
|
return;
|
|
180
|
+
text_flush();
|
|
181
|
+
const held = segments;
|
|
144
182
|
tokens.push({
|
|
145
183
|
value: currentValue,
|
|
146
184
|
globPattern: currentPattern,
|
|
147
185
|
pathnameExpansion,
|
|
148
186
|
pathnameExpanded: false,
|
|
187
|
+
...(held.some((segment) => segment.ref !== null) ? { segments: held } : {}),
|
|
149
188
|
});
|
|
150
189
|
currentValue = '';
|
|
151
190
|
currentPattern = '';
|
|
152
191
|
pathnameExpansion = false;
|
|
153
192
|
wordStarted = false;
|
|
193
|
+
segments = [];
|
|
194
|
+
pendingText = '';
|
|
154
195
|
};
|
|
155
196
|
for (let i = 0; i < line.length; i++) {
|
|
156
197
|
const char = line[i];
|
|
@@ -178,6 +219,29 @@ export function shellWords_tokenize(line) {
|
|
|
178
219
|
word_pushCurrent();
|
|
179
220
|
continue;
|
|
180
221
|
}
|
|
222
|
+
// An index into the session's last answer, unless it stands in quotes.
|
|
223
|
+
// Only at the START of a word: `user@host` is not an index, and neither
|
|
224
|
+
// is an email address in a tag value.
|
|
225
|
+
if (char === '@' && !inSingle && !inDouble && !wordStarted) {
|
|
226
|
+
const rest = line.slice(i);
|
|
227
|
+
const match = rest.match(INDEX_PATTERN);
|
|
228
|
+
if (match !== null) {
|
|
229
|
+
reference_append(`@${match[1]}`, match[0], false);
|
|
230
|
+
i += match[0].length - 1;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// A reference, unless it stands in single quotes, where a `$` is text —
|
|
235
|
+
// which is what makes a quoted DICOM value or a literal price safe.
|
|
236
|
+
if (char === '$' && !inSingle) {
|
|
237
|
+
const rest = line.slice(i);
|
|
238
|
+
const match = rest.match(REFERENCE_PATTERN);
|
|
239
|
+
if (match !== null) {
|
|
240
|
+
reference_append(match[1] ?? match[2], match[0], inDouble);
|
|
241
|
+
i += match[0].length - 1;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
181
245
|
character_append(char, inSingle || inDouble);
|
|
182
246
|
}
|
|
183
247
|
word_pushCurrent();
|
|
@@ -192,4 +256,59 @@ export function shellWords_tokenize(line) {
|
|
|
192
256
|
export function args_tokenize(line) {
|
|
193
257
|
return shellWords_tokenize(line).map((word) => word.value);
|
|
194
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Resolves the references in a line's words, respecting how they were quoted.
|
|
261
|
+
*
|
|
262
|
+
* The shell's rule, kept: a bare reference carrying several values becomes
|
|
263
|
+
* several operands, a double-quoted one stays a single operand however many
|
|
264
|
+
* values it holds, and a single-quoted `$` never got here at all. An
|
|
265
|
+
* expanded value never globs afterwards — a filename with a bracket in it is
|
|
266
|
+
* a filename, not a pattern.
|
|
267
|
+
*
|
|
268
|
+
* @param words - The tokenized words.
|
|
269
|
+
* @param resolve - Answers what a reference refers to.
|
|
270
|
+
* @param unresolvedStands - Leave an unanswerable reference as written
|
|
271
|
+
* instead of refusing: what a dry run does, having run nothing.
|
|
272
|
+
* @returns The expanded words, or the reference nothing could answer.
|
|
273
|
+
*/
|
|
274
|
+
export async function shellWords_referencesExpand(words, resolve, unresolvedStands = false) {
|
|
275
|
+
const expanded = [];
|
|
276
|
+
for (const word of words) {
|
|
277
|
+
const segments = word.segments;
|
|
278
|
+
if (segments === undefined) {
|
|
279
|
+
expanded.push(word);
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
// A word that is nothing but one bare reference is the list case: it may
|
|
283
|
+
// leave as several operands. Anything else joins into one word.
|
|
284
|
+
const lone = segments.length === 1 && segments[0].ref !== null && !segments[0].quoted;
|
|
285
|
+
let rendered = '';
|
|
286
|
+
let split = null;
|
|
287
|
+
for (const segment of segments) {
|
|
288
|
+
if (segment.ref === null) {
|
|
289
|
+
rendered += segment.text;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
const held = await resolve(segment.ref);
|
|
293
|
+
if (held === null) {
|
|
294
|
+
if (!unresolvedStands)
|
|
295
|
+
return { ok: false, missing: segment.ref };
|
|
296
|
+
rendered += `\${${segment.ref}}`;
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (lone && held.values.length !== 1) {
|
|
300
|
+
split = held.values;
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
rendered += held.values.join(' ');
|
|
304
|
+
}
|
|
305
|
+
if (split !== null) {
|
|
306
|
+
for (const value of split)
|
|
307
|
+
expanded.push(shellWord_literal(value));
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
expanded.push(shellWord_literal(rendered));
|
|
311
|
+
}
|
|
312
|
+
return { ok: true, words: expanded };
|
|
313
|
+
}
|
|
195
314
|
//# sourceMappingURL=parser.js.map
|
package/dist/lib/parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/lib/parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/lib/parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqCH;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAW,+DAA+D,CAAC;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C"}
|
package/dist/logo/brain.d.ts
CHANGED
|
@@ -1,31 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @file The mise brain, as the kernel's hosts have always imported it.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export declare function logo_linesRender(colorize: boolean, reverse?: boolean): string[];
|
|
9
|
-
/**
|
|
10
|
-
* Renders a single frame of the brain activity animation, where the core brain
|
|
11
|
-
* structure retains its original hue'd color gradient, and only the inner spaces
|
|
12
|
-
* (stylized nodes) pulse, grow, and fade physically as spatial blooms.
|
|
13
|
-
*
|
|
14
|
-
* @param frameIndex - The index of the animation frame.
|
|
15
|
-
* @param isStaticEndState - If true, renders the final steady state where holes are blank.
|
|
16
|
-
* @returns Array of rendered lines with color codes.
|
|
17
|
-
*/
|
|
18
|
-
export declare function logo_frameRender(frameIndex: number, isStaticEndState?: boolean): string[];
|
|
19
|
-
/**
|
|
20
|
-
* The number of terminal rows one rendered frame occupies.
|
|
21
|
-
*
|
|
22
|
-
* @returns The frame height in rows.
|
|
23
|
-
*/
|
|
24
|
-
export declare function logoRows_count(): number;
|
|
25
|
-
/**
|
|
26
|
-
* The number of terminal columns the widest rendered line occupies,
|
|
27
|
-
* including the two-column indent every frame line carries.
|
|
4
|
+
* The art and its frame renderer moved to the wire package so a browser can
|
|
5
|
+
* draw the same brain a terminal boot does; the kernel re-exports them here so
|
|
6
|
+
* chell and calypso keep their import.
|
|
28
7
|
*
|
|
29
|
-
* @
|
|
8
|
+
* @module
|
|
30
9
|
*/
|
|
31
|
-
export
|
|
10
|
+
export { logo_linesRender, logo_frameRender, logoRows_count, logoColumns_count } from '@fnndsc/menu/logo';
|