@cagov/ca-ds 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +600 -2
- package/bin/ca-ds.js +5 -0
- package/package.json +62 -4
- package/src/cli/add.js +134 -0
- package/src/cli/build.js +15 -0
- package/src/cli/diff.js +39 -0
- package/src/cli/eject.js +112 -0
- package/src/cli/exit.js +22 -0
- package/src/cli/format.js +52 -0
- package/src/cli/init.js +148 -0
- package/src/cli/install.js +178 -0
- package/src/cli/items.js +10 -0
- package/src/cli/login.js +331 -0
- package/src/cli/main.js +108 -0
- package/src/cli/new.js +230 -0
- package/src/cli/outdated.js +74 -0
- package/src/cli/pack.js +75 -0
- package/src/cli/preview.js +31 -0
- package/src/cli/publish.js +295 -0
- package/src/cli/pull.js +208 -0
- package/src/cli/remote.js +52 -0
- package/src/cli/remove.js +69 -0
- package/src/cli/update.js +223 -0
- package/src/cli/validate.js +131 -0
- package/src/lib/browser.js +12 -0
- package/src/lib/build.js +249 -0
- package/src/lib/bundle.js +148 -0
- package/src/lib/catalog.js +44 -0
- package/src/lib/checks.js +31 -0
- package/src/lib/collection.js +65 -0
- package/src/lib/emblem.js +29 -0
- package/src/lib/fixtures.js +59 -0
- package/src/lib/floor.js +79 -0
- package/src/lib/glyph.js +148 -0
- package/src/lib/image.js +138 -0
- package/src/lib/json-text.js +213 -0
- package/src/lib/keys.js +322 -0
- package/src/lib/links.js +321 -0
- package/src/lib/markdown.js +408 -0
- package/src/lib/merge.js +93 -0
- package/src/lib/pack.js +30 -0
- package/src/lib/page-schema.js +368 -0
- package/src/lib/page.js +372 -0
- package/src/lib/patch.js +9 -0
- package/src/lib/regions.js +173 -0
- package/src/lib/registry.js +371 -0
- package/src/lib/release.js +119 -0
- package/src/lib/repoints.js +120 -0
- package/src/lib/resolve.js +32 -0
- package/src/lib/schema.js +28 -0
- package/src/lib/serial.js +4 -0
- package/src/lib/serialize.js +444 -0
- package/src/lib/structured.js +72 -0
- package/src/lib/system.js +13 -0
- package/src/lib/targets.js +85 -0
- package/src/lib/terms.js +11 -0
- package/src/lib/token-view.js +289 -0
- package/src/lib/tokens.js +247 -0
- package/src/lib/version.js +34 -0
- package/src/preview/frame.js +75 -0
- package/src/preview/pages.js +128 -0
- package/src/preview/preview.css +58 -0
- package/src/preview/screenshots.js +72 -0
- package/src/preview/server.js +378 -0
- package/src/preview/shell.js +153 -0
- package/src/schema/a11y.schema.json +56 -0
- package/src/schema/collection.lock.schema.json +58 -0
- package/src/schema/collection.schema.json +65 -0
- package/src/schema/composition.schema.json +98 -0
- package/src/schema/contract.schema.json +116 -0
- package/src/schema/interface.schema.json +257 -0
- package/src/schema/item.schema.json +362 -0
- package/src/schema/release.schema.json +39 -0
- package/src/schema/system.schema.json +75 -0
- package/src/schema/variants.schema.json +60 -0
- package/src/validate/collection.js +19 -0
- package/src/validate/collisions.js +124 -0
- package/src/validate/context.js +357 -0
- package/src/validate/facts.js +253 -0
- package/src/validate/files.js +103 -0
- package/src/validate/findings.js +19 -0
- package/src/validate/glyphs.js +126 -0
- package/src/validate/html.js +215 -0
- package/src/validate/imports.js +29 -0
- package/src/validate/index.js +75 -0
- package/src/validate/item.js +47 -0
- package/src/validate/links.js +113 -0
- package/src/validate/manifest.js +147 -0
- package/src/validate/media.js +65 -0
- package/src/validate/page.js +74 -0
- package/src/validate/prefixes.js +58 -0
- package/src/validate/relations.js +310 -0
- package/src/validate/release.js +109 -0
- package/src/validate/skill.js +122 -0
- package/src/validate/structured.js +335 -0
- package/src/validate/tasc.js +80 -0
- package/src/validate/template.js +129 -0
- package/src/validate/tokens.js +154 -0
- package/src/validate/zip.js +40 -0
package/src/lib/links.js
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
// The legacy pointer, a repo path in a code span, still renders for versions published before links.
|
|
2
|
+
|
|
3
|
+
import MarkdownIt from 'markdown-it';
|
|
4
|
+
import { roleOf, recordIds, proseStrings, SUFFIX, TOPICS } from './structured.js';
|
|
5
|
+
import { parseTarget, decodeFragment } from './targets.js';
|
|
6
|
+
|
|
7
|
+
const md = new MarkdownIt({ html: false, linkify: false, typographer: false });
|
|
8
|
+
|
|
9
|
+
// The grammar sits in ./targets.js, which imports nothing, so an editor's bundle skips the parser.
|
|
10
|
+
export { parseTarget };
|
|
11
|
+
|
|
12
|
+
export function seeTarget(see) {
|
|
13
|
+
const target = parseTarget(see);
|
|
14
|
+
return target && target.file === null && target.fragment !== null ? target : null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// The docs site's heading ids. A repeat takes -1, -2, and on.
|
|
18
|
+
export const slug = (text) =>
|
|
19
|
+
text
|
|
20
|
+
.trim()
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.replace(/[^\p{L}\p{N}\s_-]/gu, '')
|
|
23
|
+
.replace(/\s/g, '-');
|
|
24
|
+
|
|
25
|
+
const part = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
26
|
+
|
|
27
|
+
export const sectionAnchor = (role) => (role === 'contract' ? 'rules' : role);
|
|
28
|
+
|
|
29
|
+
// The docs site gives each record its id by this.
|
|
30
|
+
export function recordAnchor(role, id) {
|
|
31
|
+
if (role === 'contract') return `rule-${id}`;
|
|
32
|
+
if (role === 'variants') return `variant-${id}`;
|
|
33
|
+
if (role === 'accessibility') return `accessibility-${id}`;
|
|
34
|
+
if (role === 'composition') return `composition-${part(id)}`;
|
|
35
|
+
if (id.startsWith('.')) return `class-${part(id)}`;
|
|
36
|
+
if (id.startsWith('--')) return `property-${part(id)}`;
|
|
37
|
+
const event = /^([a-z][a-z0-9-]*)@(.+)$/.exec(id);
|
|
38
|
+
if (event) return `event-${event[1]}-${part(event[2])}`;
|
|
39
|
+
const owned = /^([a-z][a-z0-9-]*)\[(.+)\]$/.exec(id);
|
|
40
|
+
if (owned) return `attribute-${owned[1]}-${part(owned[2])}`;
|
|
41
|
+
if (/^ca-[a-z0-9]+(-[a-z0-9]+)*$/.test(id)) return `element-${id}`;
|
|
42
|
+
return `attribute-${part(id)}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const PREFIXES = [
|
|
46
|
+
['rule-', 'contract'],
|
|
47
|
+
['variant-', 'variants'],
|
|
48
|
+
['accessibility-', 'accessibility'],
|
|
49
|
+
['composition-', 'composition'],
|
|
50
|
+
['element-', 'interface'],
|
|
51
|
+
['class-', 'interface'],
|
|
52
|
+
['property-', 'interface'],
|
|
53
|
+
['attribute-', 'interface'],
|
|
54
|
+
['event-', 'interface'],
|
|
55
|
+
];
|
|
56
|
+
export const anchorRole = (anchor) => PREFIXES.find(([prefix]) => anchor.startsWith(prefix))?.[1] ?? null;
|
|
57
|
+
|
|
58
|
+
export const recordAnchors = (role, data) => new Set([...recordIds(role, data)].map((id) => recordAnchor(role, id)));
|
|
59
|
+
|
|
60
|
+
// Blanks a YAML frontmatter block line for line, so the lines after it keep their numbers.
|
|
61
|
+
function body(text) {
|
|
62
|
+
const m = /^?---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/.exec(text);
|
|
63
|
+
return m ? m[0].replace(/[^\n]/g, '') + text.slice(m[0].length) : text;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const plain = (tokens) => tokens.map((t) => (t.type === 'text' || t.type === 'code_inline' ? t.content : t.type === 'softbreak' ? ' ' : t.children ? plain(t.children) : '')).join('');
|
|
67
|
+
|
|
68
|
+
export function headings(markdown) {
|
|
69
|
+
const tokens = md.parse(body(markdown), {});
|
|
70
|
+
const seen = new Map();
|
|
71
|
+
const out = [];
|
|
72
|
+
tokens.forEach((token, i) => {
|
|
73
|
+
if (token.type !== 'heading_open') return;
|
|
74
|
+
const text = plain(tokens[i + 1].children ?? []);
|
|
75
|
+
let id = slug(text);
|
|
76
|
+
const n = seen.get(id) ?? 0;
|
|
77
|
+
seen.set(id, n + 1);
|
|
78
|
+
if (n > 0) id = `${id}-${n}`;
|
|
79
|
+
out.push({ id, text, level: Number(token.tag.slice(1)), line: token.map ? token.map[0] + 1 : null });
|
|
80
|
+
});
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function anchorsOf({ doc = null, structured = {} } = {}) {
|
|
85
|
+
const heads = new Map();
|
|
86
|
+
if (typeof doc === 'string') for (const h of headings(doc)) if (!heads.has(h.id)) heads.set(h.id, h.line);
|
|
87
|
+
const records = new Map();
|
|
88
|
+
const sections = new Map();
|
|
89
|
+
for (const [role, data] of Object.entries(structured)) {
|
|
90
|
+
if (!data) continue;
|
|
91
|
+
sections.set(sectionAnchor(role), role);
|
|
92
|
+
let anchors;
|
|
93
|
+
try {
|
|
94
|
+
anchors = recordAnchors(role, data);
|
|
95
|
+
} catch {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
for (const a of anchors) if (!records.has(a)) records.set(a, role);
|
|
99
|
+
}
|
|
100
|
+
return { headings: heads, records, sections };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const SECTION_TITLES = { rules: 'Rules', variants: 'Variants', interface: 'Interface', accessibility: 'Accessibility', composition: 'Composition' };
|
|
104
|
+
|
|
105
|
+
export function anchorList({ doc = null, structured = {} } = {}) {
|
|
106
|
+
const out = [];
|
|
107
|
+
const seen = new Set();
|
|
108
|
+
const add = (entry) => {
|
|
109
|
+
if (seen.has(entry.fragment)) return;
|
|
110
|
+
seen.add(entry.fragment);
|
|
111
|
+
out.push(entry);
|
|
112
|
+
};
|
|
113
|
+
if (typeof doc === 'string') for (const h of headings(doc)) add({ fragment: h.id, kind: 'heading', label: h.text, role: null, level: h.level });
|
|
114
|
+
for (const [role, data] of Object.entries(structured)) {
|
|
115
|
+
if (!data) continue;
|
|
116
|
+
const section = sectionAnchor(role);
|
|
117
|
+
add({ fragment: section, kind: 'section', label: SECTION_TITLES[section] ?? section, role, level: null });
|
|
118
|
+
let ids;
|
|
119
|
+
try {
|
|
120
|
+
ids = [...recordIds(role, data)];
|
|
121
|
+
} catch {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
for (const id of ids) add({ fragment: recordAnchor(role, id), kind: 'record', label: role === 'accessibility' ? (TOPICS[id] ?? id) : id, role, level: null });
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const hasAnchor = (anchors, fragment) => anchors.headings.has(fragment) || anchors.records.has(fragment) || anchors.sections.has(fragment);
|
|
130
|
+
|
|
131
|
+
// Headings whose id a record or section also takes, which leave a link to either ambiguous.
|
|
132
|
+
export const anchorCollisions = (anchors) =>
|
|
133
|
+
[...anchors.headings].filter(([id]) => anchors.records.has(id) || anchors.sections.has(id)).map(([id, line]) => ({ id, line, role: anchors.records.get(id) ?? anchors.sections.get(id) }));
|
|
134
|
+
|
|
135
|
+
export function itemPage(manifest, read) {
|
|
136
|
+
const files = new Set(['item.json', ...(manifest.files ?? []).map((f) => f.path)]);
|
|
137
|
+
const json = (path) => {
|
|
138
|
+
const text = read(path);
|
|
139
|
+
if (text === null) return null;
|
|
140
|
+
try {
|
|
141
|
+
return JSON.parse(text);
|
|
142
|
+
} catch {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const structured = {};
|
|
147
|
+
for (const f of manifest.files ?? []) {
|
|
148
|
+
if (Object.hasOwn(SUFFIX, f.role) && !f.path.includes('/') && !structured[f.role]) structured[f.role] = json(f.path);
|
|
149
|
+
}
|
|
150
|
+
const doc = typeof manifest.doc === 'string' ? read(manifest.doc) : null;
|
|
151
|
+
const anchors = anchorsOf({ doc, structured });
|
|
152
|
+
const empty = { headings: new Map(), records: new Map(), sections: new Map() };
|
|
153
|
+
return {
|
|
154
|
+
name: manifest.name,
|
|
155
|
+
files,
|
|
156
|
+
anchors,
|
|
157
|
+
fileAnchors(path) {
|
|
158
|
+
if (!files.has(path)) return null;
|
|
159
|
+
if (path === manifest.doc) return anchors;
|
|
160
|
+
if (path.endsWith('.md')) {
|
|
161
|
+
const text = read(path);
|
|
162
|
+
return text === null ? null : { ...empty, headings: new Map(headings(text).map((h) => [h.id, h.line])) };
|
|
163
|
+
}
|
|
164
|
+
const role = roleOf(path);
|
|
165
|
+
if (!role) return null;
|
|
166
|
+
const data = path.includes('/') ? json(path) : structured[role];
|
|
167
|
+
return data ? anchorsOf({ structured: { [role]: data } }) : null;
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const anchorKind = (anchors, fragment) => (anchors.headings.has(fragment) ? 'heading' : anchors.sections.has(fragment) ? 'section' : 'record');
|
|
173
|
+
|
|
174
|
+
export function resolveTarget(target, pageOf) {
|
|
175
|
+
const { name, file, fragment } = target;
|
|
176
|
+
const page = pageOf(name);
|
|
177
|
+
if (!page) return { missing: 'item', name, file };
|
|
178
|
+
if (file !== null && !page.files.has(file)) return { missing: 'file', name, file };
|
|
179
|
+
if (fragment === null) return { name, file, fragment, kind: file === null ? 'item' : 'file' };
|
|
180
|
+
const anchors = file === null ? page.anchors : page.fileAnchors(file);
|
|
181
|
+
if (!anchors || !hasAnchor(anchors, fragment)) return { missing: 'anchor', name, file };
|
|
182
|
+
const kind = anchorKind(anchors, fragment);
|
|
183
|
+
const role = kind === 'record' ? anchors.records.get(fragment) : kind === 'section' ? anchors.sections.get(fragment) : null;
|
|
184
|
+
return { name, file, fragment, kind, ...(role ? { role } : {}) };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const PATH = /^(?!\/)[A-Za-z0-9_./-]*\/[A-Za-z0-9_./-]*$/;
|
|
188
|
+
// A URL written without its scheme.
|
|
189
|
+
const HOST = /^[a-z0-9-]+(\.[a-z0-9-]+)+\//i;
|
|
190
|
+
|
|
191
|
+
export const isPointer = (token) => {
|
|
192
|
+
const path = recordPointer(token)?.path ?? token;
|
|
193
|
+
return PATH.test(path) && !HOST.test(path) && (/^\.\.?\//.test(path) || /\.[A-Za-z0-9]+$/.test(path) || path.endsWith('/'));
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export function recordPointer(token) {
|
|
197
|
+
const i = token.indexOf('#');
|
|
198
|
+
if (i < 1 || i === token.length - 1) return null;
|
|
199
|
+
const path = token.slice(0, i);
|
|
200
|
+
const role = roleOf(path);
|
|
201
|
+
return role ? { path, role, id: token.slice(i + 1) } : null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// A path into the package, the service, or a build names no item, nor does a folder such as standard/guidance/.
|
|
205
|
+
const intoItem = (token) => {
|
|
206
|
+
const path = recordPointer(token)?.path ?? token;
|
|
207
|
+
return isPointer(token) && (/^\.\.?\//.test(path) || (path.startsWith('standard/') && !path.endsWith('/')));
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const ABSOLUTE = /^([a-z][a-z0-9+.-]*:|\/|#)/i;
|
|
211
|
+
|
|
212
|
+
// A code span's pointer and the § *Title* after it count as one.
|
|
213
|
+
function scan(children, line, out) {
|
|
214
|
+
let at = line;
|
|
215
|
+
const link = (href, text, image) => {
|
|
216
|
+
if (!href) return;
|
|
217
|
+
const target = parseTarget(href);
|
|
218
|
+
if (target) out.push({ type: 'link', href, text, image, line: at, target });
|
|
219
|
+
else if (href.startsWith('#') && href.length > 1) out.push({ type: 'link', href, text, image, line: at, self: decodeFragment(href.slice(1)) });
|
|
220
|
+
else if (!ABSOLUTE.test(href)) out.push({ type: 'legacy', form: 'relative', token: href, line: at });
|
|
221
|
+
};
|
|
222
|
+
for (let i = 0; i < children.length; i++) {
|
|
223
|
+
const t = children[i];
|
|
224
|
+
if (t.type === 'softbreak' || t.type === 'hardbreak') at = at === null ? null : at + 1;
|
|
225
|
+
else if (t.type === 'image') link(t.attrGet('src'), plain(t.children ?? []), true);
|
|
226
|
+
else if (t.type === 'link_open') {
|
|
227
|
+
const close = children.findIndex((c, k) => k > i && c.type === 'link_close');
|
|
228
|
+
link(t.attrGet('href'), plain(children.slice(i + 1, close === -1 ? undefined : close)), false);
|
|
229
|
+
} else if (t.type === 'code_inline' && intoItem(t.content)) out.push({ type: 'legacy', form: 'code', token: t.content, line: at });
|
|
230
|
+
else if (t.type === 'em_open' && children[i - 1]?.type === 'text' && /§ $/.test(children[i - 1].content) && !(children[i - 2]?.type === 'code_inline' && intoItem(children[i - 2].content))) out.push({ type: 'legacy', form: 'section', token: null, line: at });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function linksOf(markdown) {
|
|
235
|
+
const out = [];
|
|
236
|
+
for (const token of md.parse(body(markdown), {})) {
|
|
237
|
+
if (token.type === 'inline' && token.children) scan(token.children, token.map ? token.map[0] + 1 : null, out);
|
|
238
|
+
}
|
|
239
|
+
return out;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function inlineLinksOf(text) {
|
|
243
|
+
const out = [];
|
|
244
|
+
for (const token of md.parseInline(text, {})) if (token.children) scan(token.children, null, out);
|
|
245
|
+
return out.map((l) => ({ ...l, line: null }));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export const proseLinksOf = (role, data) => proseStrings(role, data).flatMap(inlineLinksOf);
|
|
249
|
+
|
|
250
|
+
// CommonMark: the next backtick run of the same length closes a span, and an unclosed run stays literal.
|
|
251
|
+
function codeSpans(text) {
|
|
252
|
+
const out = [];
|
|
253
|
+
let i = 0;
|
|
254
|
+
while (i < text.length) {
|
|
255
|
+
if (text[i] === '\\') {
|
|
256
|
+
i += 2;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (text[i] !== '`') {
|
|
260
|
+
i++;
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
let n = 0;
|
|
264
|
+
while (text[i + n] === '`') n++;
|
|
265
|
+
const run = new RegExp(`(?<!\`)\`{${n}}(?!\`)`, 'g');
|
|
266
|
+
run.lastIndex = i + n;
|
|
267
|
+
const close = run.exec(text);
|
|
268
|
+
if (!close) {
|
|
269
|
+
i += n;
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
out.push([i, close.index + n]);
|
|
273
|
+
i = close.index + n;
|
|
274
|
+
}
|
|
275
|
+
return out;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const INLINE_DEST = /(\]\(\s*)(<?)([^\s()<>]+)(>?)/g;
|
|
279
|
+
const DEFINITION = /^( {0,3}\[[^\]]+\]:[ \t]*)(<?)(\S+?)(>?)(?=\s|$)/gm;
|
|
280
|
+
|
|
281
|
+
// replace answers the new destination, or null to keep it. Links inside code stay, since they're text.
|
|
282
|
+
export function rewriteTargets(markdown, replace) {
|
|
283
|
+
const lines = markdown.split('\n');
|
|
284
|
+
const code = new Array(lines.length).fill(false);
|
|
285
|
+
for (const token of md.parse(body(markdown), {})) {
|
|
286
|
+
if ((token.type === 'fence' || token.type === 'code_block') && token.map) for (let l = token.map[0]; l < token.map[1]; l++) code[l] = true;
|
|
287
|
+
}
|
|
288
|
+
const swap = (whole, dest, open, close, head) => {
|
|
289
|
+
const target = parseTarget(dest);
|
|
290
|
+
const href = target ? replace(target, dest) : null;
|
|
291
|
+
return href === null ? whole : `${head}${open}${href}${close}`;
|
|
292
|
+
};
|
|
293
|
+
const prose = (chunk) => {
|
|
294
|
+
const spans = codeSpans(chunk);
|
|
295
|
+
let out = '';
|
|
296
|
+
let at = 0;
|
|
297
|
+
const outside = (text) =>
|
|
298
|
+
text
|
|
299
|
+
.replace(INLINE_DEST, (whole, head, open, dest, close) => swap(whole, dest, open, close, head))
|
|
300
|
+
.replace(DEFINITION, (whole, head, open, dest, close) => swap(whole, dest, open, close, head));
|
|
301
|
+
for (const [start, end] of spans) {
|
|
302
|
+
out += outside(chunk.slice(at, start)) + chunk.slice(start, end);
|
|
303
|
+
at = end;
|
|
304
|
+
}
|
|
305
|
+
return out + outside(chunk.slice(at));
|
|
306
|
+
};
|
|
307
|
+
const out = [];
|
|
308
|
+
let run = [];
|
|
309
|
+
const flush = () => {
|
|
310
|
+
if (run.length) out.push(prose(run.join('\n')));
|
|
311
|
+
run = [];
|
|
312
|
+
};
|
|
313
|
+
lines.forEach((line, l) => {
|
|
314
|
+
if (code[l]) {
|
|
315
|
+
flush();
|
|
316
|
+
out.push(line);
|
|
317
|
+
} else run.push(line);
|
|
318
|
+
});
|
|
319
|
+
flush();
|
|
320
|
+
return out.join('\n');
|
|
321
|
+
}
|