lens-content-processor 0.78.0 → 0.80.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.
Files changed (133) hide show
  1. package/dist/authoring-markup.d.ts +22 -0
  2. package/dist/authoring-markup.js +24 -0
  3. package/dist/authoring-markup.js.map +1 -1
  4. package/dist/cache.d.ts +10 -0
  5. package/dist/cache.js +6 -5
  6. package/dist/cache.js.map +1 -1
  7. package/dist/cli-steps.d.ts +37 -0
  8. package/dist/cli-steps.js +80 -0
  9. package/dist/cli-steps.js.map +1 -0
  10. package/dist/cli.d.ts +7 -0
  11. package/dist/cli.js +52 -70
  12. package/dist/cli.js.map +1 -1
  13. package/dist/course-graph.d.ts +2 -2
  14. package/dist/course-graph.js +7 -2
  15. package/dist/course-graph.js.map +1 -1
  16. package/dist/criticmarkup-forms.d.ts +8 -6
  17. package/dist/criticmarkup-forms.js +22 -19
  18. package/dist/criticmarkup-forms.js.map +1 -1
  19. package/dist/dedupe-errors.d.ts +16 -0
  20. package/dist/dedupe-errors.js +23 -9
  21. package/dist/dedupe-errors.js.map +1 -1
  22. package/dist/dependency-cache.d.ts +15 -5
  23. package/dist/dependency-cache.js +33 -74
  24. package/dist/dependency-cache.js.map +1 -1
  25. package/dist/dropped.d.ts +114 -0
  26. package/dist/dropped.js +253 -0
  27. package/dist/dropped.js.map +1 -0
  28. package/dist/engine/assemble.d.ts +44 -0
  29. package/dist/engine/assemble.js +132 -0
  30. package/dist/engine/assemble.js.map +1 -0
  31. package/dist/engine/build.d.ts +8 -0
  32. package/dist/engine/build.js +558 -0
  33. package/dist/engine/build.js.map +1 -0
  34. package/dist/engine/file-facts.d.ts +26 -0
  35. package/dist/engine/file-facts.js +63 -0
  36. package/dist/engine/file-facts.js.map +1 -0
  37. package/dist/engine/git-source.d.ts +35 -0
  38. package/dist/engine/git-source.js +242 -0
  39. package/dist/engine/git-source.js.map +1 -0
  40. package/dist/engine/overlay.d.ts +43 -0
  41. package/dist/engine/overlay.js +167 -0
  42. package/dist/engine/overlay.js.map +1 -0
  43. package/dist/engine/protocol.d.ts +146 -0
  44. package/dist/engine/protocol.js +40 -0
  45. package/dist/engine/protocol.js.map +1 -0
  46. package/dist/engine/reader.d.ts +133 -0
  47. package/dist/engine/reader.js +298 -0
  48. package/dist/engine/reader.js.map +1 -0
  49. package/dist/engine/sources.d.ts +39 -0
  50. package/dist/engine/sources.js +137 -0
  51. package/dist/engine/sources.js.map +1 -0
  52. package/dist/engine/sqlite-store.d.ts +99 -0
  53. package/dist/engine/sqlite-store.js +452 -0
  54. package/dist/engine/sqlite-store.js.map +1 -0
  55. package/dist/engine/store.d.ts +85 -0
  56. package/dist/engine/store.js +31 -0
  57. package/dist/engine/store.js.map +1 -0
  58. package/dist/engine/tables.d.ts +15 -0
  59. package/dist/engine/tables.js +70 -0
  60. package/dist/engine/tables.js.map +1 -0
  61. package/dist/engine/units.d.ts +58 -0
  62. package/dist/engine/units.js +186 -0
  63. package/dist/engine/units.js.map +1 -0
  64. package/dist/engine/version.d.ts +6 -0
  65. package/dist/engine/version.js +21 -0
  66. package/dist/engine/version.js.map +1 -0
  67. package/dist/engine/worker.d.ts +1 -0
  68. package/dist/engine/worker.js +220 -0
  69. package/dist/engine/worker.js.map +1 -0
  70. package/dist/flattener/index.d.ts +34 -17
  71. package/dist/flattener/index.js +247 -116
  72. package/dist/flattener/index.js.map +1 -1
  73. package/dist/flattener/resolve-text-links.d.ts +15 -14
  74. package/dist/flattener/resolve-text-links.js +24 -25
  75. package/dist/flattener/resolve-text-links.js.map +1 -1
  76. package/dist/glossary.d.ts +2 -2
  77. package/dist/glossary.js.map +1 -1
  78. package/dist/index.d.ts +168 -2
  79. package/dist/index.js +888 -616
  80. package/dist/index.js.map +1 -1
  81. package/dist/markdown-parse.d.ts +6 -0
  82. package/dist/markdown-parse.js +14 -0
  83. package/dist/markdown-parse.js.map +1 -1
  84. package/dist/parser/learning-outcome.js +11 -2
  85. package/dist/parser/learning-outcome.js.map +1 -1
  86. package/dist/parser/lens.d.ts +15 -2
  87. package/dist/parser/lens.js +38 -11
  88. package/dist/parser/lens.js.map +1 -1
  89. package/dist/parser/meeting-doc.d.ts +2 -1
  90. package/dist/parser/meeting-doc.js +2 -1
  91. package/dist/parser/meeting-doc.js.map +1 -1
  92. package/dist/parser/module.d.ts +3 -1
  93. package/dist/parser/module.js +7 -5
  94. package/dist/parser/module.js.map +1 -1
  95. package/dist/parser/question-embeds.d.ts +46 -0
  96. package/dist/parser/question-embeds.js +302 -0
  97. package/dist/parser/question-embeds.js.map +1 -0
  98. package/dist/parser/response-segments.js +12 -0
  99. package/dist/parser/response-segments.js.map +1 -1
  100. package/dist/parser/sections.d.ts +18 -0
  101. package/dist/parser/sections.js +31 -3
  102. package/dist/parser/sections.js.map +1 -1
  103. package/dist/parser/widget.d.ts +2 -1
  104. package/dist/parser/widget.js.map +1 -1
  105. package/dist/parser/wikilink.d.ts +13 -3
  106. package/dist/parser/wikilink.js +55 -34
  107. package/dist/parser/wikilink.js.map +1 -1
  108. package/dist/reference-graph.d.ts +21 -3
  109. package/dist/reference-graph.js +35 -12
  110. package/dist/reference-graph.js.map +1 -1
  111. package/dist/same-page-links.d.ts +11 -1
  112. package/dist/same-page-links.js +9 -0
  113. package/dist/same-page-links.js.map +1 -1
  114. package/dist/skill-tree.d.ts +2 -1
  115. package/dist/skill-tree.js.map +1 -1
  116. package/dist/source-location.d.ts +0 -4
  117. package/dist/source-location.js +0 -43
  118. package/dist/source-location.js.map +1 -1
  119. package/dist/validator/card-module-membership.d.ts +17 -1
  120. package/dist/validator/card-module-membership.js +60 -56
  121. package/dist/validator/card-module-membership.js.map +1 -1
  122. package/dist/validator/criticmarkup.js +1 -1
  123. package/dist/validator/criticmarkup.js.map +1 -1
  124. package/dist/validator/field-typos.d.ts +1 -1
  125. package/dist/validator/field-typos.js +21 -21
  126. package/dist/validator/field-typos.js.map +1 -1
  127. package/dist/validator/output-integrity.d.ts +9 -5
  128. package/dist/validator/output-integrity.js +43 -45
  129. package/dist/validator/output-integrity.js.map +1 -1
  130. package/dist/validator/tier.d.ts +2 -2
  131. package/dist/validator/tier.js.map +1 -1
  132. package/dist/validator/uuid.d.ts +1 -1
  133. package/package.json +2 -1
@@ -0,0 +1,253 @@
1
+ // What errors left out of pages: the "dropped" artifact behind the error
2
+ // boxes that admins see on staging. It is side data: no page, error or other
3
+ // output changes because of it.
4
+ //
5
+ // Each place that leaves content out because of an error records it, with
6
+ // the error that dropped it:
7
+ // - a section that could not be built stays in its module as a placeholder
8
+ // (droppedSection), so the module's own ordering (tests to the end of their
9
+ // submodule, module-level tests to "Test Your Understanding") puts it where
10
+ // the section would have been; so does a section header that the parser
11
+ // refused. Every decision about sections skips the placeholders, and
12
+ // placeDropped takes them out before the pages are made;
13
+ // - a segment that could not be built rides on its section
14
+ // (attachDroppedSegments); one that the parser refused rides on the parsed
15
+ // lens or test until its section is made. Its item follows that section;
16
+ // - a page that could not be built at all is a moduleError entry.
17
+ // crossCheck is the check that is not a hand-kept list: a section that a
18
+ // module declares, that none of its pages holds, and that no record
19
+ // explains, becomes an item too.
20
+ //
21
+ // The entries travel in their path unit's contribution, so an incremental
22
+ // job keeps them exactly as current as the pages. droppedArtifact swaps each
23
+ // recorded error for its copy in the final error list (same dedupe key),
24
+ // which carries the category.
25
+ import { errorKey } from "./dedupe-errors.js";
26
+ import { parseFrontmatter } from "./parser/frontmatter.js";
27
+ import { parseWikilink, resolveWikilinkPath } from "./parser/wikilink.js";
28
+ /** A record placed after `sections[index]` (-1: before the first). */
29
+ export function placedAfter(index, sections, drop) {
30
+ const afterContentId = sections[index]?.contentId ?? null;
31
+ return { afterSection: index, afterContentId, ...drop };
32
+ }
33
+ export function droppedContent(kind, title, sourcePath, error) {
34
+ return { what: { kind, title, sourcePath }, error };
35
+ }
36
+ /**
37
+ * The error that made a step return nothing: the first error of severity
38
+ * "error" it reported, else its first error. Undefined when it reported none,
39
+ * which leaves nothing to record.
40
+ */
41
+ export function dropCause(errors) {
42
+ return errors.find((error) => error.severity === "error") ?? errors[0];
43
+ }
44
+ /** A file's name without its folder and `.md`: the title of what it held when nothing better is known. */
45
+ export function fileStem(path) {
46
+ return path.slice(path.lastIndexOf("/") + 1).replace(/\.md$/i, "");
47
+ }
48
+ // Symbol-keyed and not enumerable, like source lines (source-location.ts):
49
+ // JSON and the build layer's codec never see them, so pages are unchanged.
50
+ const PLACEHOLDER = Symbol("lens-content-dropped-section");
51
+ const SEGMENTS = Symbol("lens-content-dropped-segments");
52
+ /**
53
+ * A section that an error dropped, standing where the section would have
54
+ * been. It has the section's type, so ordering by type moves it as it would
55
+ * have moved the section, and no sourcePath, so outcome tagging skips it.
56
+ */
57
+ export function droppedSection(type, drop) {
58
+ const placeholder = {
59
+ type,
60
+ meta: {},
61
+ segments: [],
62
+ contentId: null,
63
+ learningOutcomes: [],
64
+ };
65
+ return Object.defineProperty(placeholder, PLACEHOLDER, { value: drop });
66
+ }
67
+ /** True for anything but a droppedSection placeholder. */
68
+ export function isBuilt(item) {
69
+ return !(PLACEHOLDER in item);
70
+ }
71
+ /** Record segments that errors dropped from `section` (or from a parsed lens or test, before it has a section). */
72
+ export function attachDroppedSegments(section, drops) {
73
+ if (drops.length === 0)
74
+ return section;
75
+ return Object.defineProperty(section, SEGMENTS, {
76
+ value: [...droppedSegmentsOf(section), ...drops],
77
+ configurable: true,
78
+ });
79
+ }
80
+ /** The segment records attached to `value`: a section, or a parsed lens or test whose parser refused some. */
81
+ export function droppedSegmentsOf(value) {
82
+ return value[SEGMENTS] ?? [];
83
+ }
84
+ /**
85
+ * The record of a segment that a step returned no segment for, with the
86
+ * error that dropped it (none when the step reported no error). A segment
87
+ * with a source is named after its file; one without, after its type.
88
+ */
89
+ export function droppedSegment(type, source, path, errors) {
90
+ const cause = dropCause(errors);
91
+ if (!cause)
92
+ return [];
93
+ const target = source && parseWikilink(source, path);
94
+ const sourcePath = target && !target.error && target.path
95
+ ? resolveWikilinkPath(target.path, path)
96
+ : path;
97
+ const title = sourcePath !== path
98
+ ? fileStem(sourcePath)
99
+ : type[0].toUpperCase() + type.slice(1);
100
+ return [droppedContent("segment", title, sourcePath, cause)];
101
+ }
102
+ /**
103
+ * Take the placeholders out of a page's sections and place every record: a
104
+ * placeholder follows the section before it, a dropped segment follows its
105
+ * own section.
106
+ */
107
+ export function placeDropped(sections) {
108
+ const kept = [];
109
+ const items = [];
110
+ const place = (drop) => items.push(placedAfter(kept.length - 1, kept, drop));
111
+ for (const section of sections) {
112
+ const drop = section[PLACEHOLDER];
113
+ if (drop) {
114
+ place(drop);
115
+ continue;
116
+ }
117
+ kept.push(section);
118
+ droppedSegmentsOf(section).forEach(place);
119
+ }
120
+ return { sections: kept, items };
121
+ }
122
+ /**
123
+ * The check that does not depend on every drop site recording itself, as a
124
+ * site added later may not. A section that the module declares, that none of
125
+ * its pages holds, and that no record explains, is matched by sourcePath and
126
+ * recorded after the last section of its page. Its error says that no error
127
+ * explains it; it is not in the error list, which stays as it is. A header
128
+ * the parser refused (`refused`, SectionsResult.refused) declares nothing, so
129
+ * its record, known by its error, explains no declared section.
130
+ */
131
+ export function crossCheck(modulePath, pages, items, declared, refused) {
132
+ const unmatched = new Map();
133
+ const add = (path) => {
134
+ if (path !== undefined)
135
+ unmatched.set(path, (unmatched.get(path) ?? 0) + 1);
136
+ };
137
+ for (const page of pages)
138
+ page.sections.forEach((s) => add(s.sourcePath));
139
+ const refusedErrors = new Set(refused.map(({ error }) => errorKey(error)));
140
+ for (const { what, error } of items.flat()) {
141
+ if (what.kind === "section" && !refusedErrors.has(errorKey(error)))
142
+ add(what.sourcePath);
143
+ }
144
+ for (const section of declared) {
145
+ const left = unmatched.get(section.sourcePath) ?? 0;
146
+ if (left > 0) {
147
+ unmatched.set(section.sourcePath, left - 1);
148
+ continue;
149
+ }
150
+ const page = Math.min(section.page, pages.length - 1);
151
+ const { sections } = pages[page];
152
+ const error = {
153
+ file: modulePath,
154
+ line: section.line,
155
+ code: "validator.section-dropped",
156
+ message: "This section is missing from its page, and no error says why",
157
+ suggestion: "Tell a developer: the validator left content out without an error",
158
+ severity: "error",
159
+ };
160
+ items[page].push(placedAfter(sections.length - 1, sections, droppedContent("section", section.title, section.sourcePath, error)));
161
+ }
162
+ }
163
+ /** The entries of a file's pages that lost something, in page order. */
164
+ export function pageEntries(sourcePath, pages, items) {
165
+ return pages.flatMap((page, i) => items[i]?.length
166
+ ? [{ page: page.slug, sourcePath, items: items[i], moduleError: null }]
167
+ : []);
168
+ }
169
+ /** The entry of a page that a file could not make at all, with the errors that stopped it. */
170
+ export function failedPage(page, sourcePath, errors) {
171
+ return {
172
+ page,
173
+ sourcePath,
174
+ items: [],
175
+ moduleError: {
176
+ sourcePath,
177
+ errors: errors.filter((error) => error.severity === "error"),
178
+ },
179
+ };
180
+ }
181
+ /**
182
+ * The entry of a module that made no page, under the slug its file declares.
183
+ * None when it declares no slug (a frontmatter error, for example): readers
184
+ * find an entry by its page's slug.
185
+ */
186
+ export function failedModule(content, path, errors) {
187
+ const { slug } = parseFrontmatter(content, path).frontmatter;
188
+ return typeof slug === "string" && slug.trim()
189
+ ? [failedPage(slug, path, errors)]
190
+ : [];
191
+ }
192
+ /**
193
+ * The "dropped" artifact: page → entry, in path order. A later page with the
194
+ * same slug wins, as in the platform's page table, except that a module that
195
+ * made no page never hides a page that exists. Each error is the copy in the
196
+ * final error list, which carries its category. An item that repeats another
197
+ * of its page exactly (two excerpts of one missing article, say) is shown once.
198
+ */
199
+ export function droppedArtifact(entries, errors) {
200
+ const final = reportedErrors(errors);
201
+ const artifact = {};
202
+ for (const entry of entries) {
203
+ const held = artifact[entry.page];
204
+ if (held && !held.moduleError && entry.moduleError)
205
+ continue;
206
+ const seen = new Set();
207
+ artifact[entry.page] = {
208
+ page: entry.page,
209
+ sourcePath: entry.sourcePath,
210
+ items: entry.items.flatMap((item) => {
211
+ const { afterSection, what, error } = item;
212
+ const key = JSON.stringify([afterSection, what, errorKey(error)]);
213
+ if (seen.has(key))
214
+ return [];
215
+ seen.add(key);
216
+ return [{ ...item, error: final(error) }];
217
+ }),
218
+ moduleError: entry.moduleError && {
219
+ sourcePath: entry.moduleError.sourcePath,
220
+ errors: entry.moduleError.errors.map(final),
221
+ },
222
+ };
223
+ }
224
+ return artifact;
225
+ }
226
+ /**
227
+ * The copy of a recorded error in the final error list: the one with the same
228
+ * dedupe key. The bundler numbers an article's inline element from the start
229
+ * of the published body; the article's own check, which reports the
230
+ * element's parse errors, numbers it from the start of the file. So when no
231
+ * key matches, the reported error with the same file, severity and message,
232
+ * at or after the recorded line, is the one. With neither, the recorded error
233
+ * stays as it is (nothing reported it).
234
+ */
235
+ function reportedErrors(errors) {
236
+ const byKey = new Map(errors.map((error) => [errorKey(error), error]));
237
+ const sameText = (error) => [error.file, error.severity, error.message].join("\x1f");
238
+ const byText = new Map();
239
+ for (const error of errors) {
240
+ const list = byText.get(sameText(error)) ?? [];
241
+ list.push(error);
242
+ byText.set(sameText(error), list);
243
+ }
244
+ for (const list of byText.values()) {
245
+ list.sort((a, b) => (a.line ?? 0) - (b.line ?? 0));
246
+ }
247
+ return (error) => byKey.get(errorKey(error)) ??
248
+ byText
249
+ .get(sameText(error))
250
+ ?.find((candidate) => (candidate.line ?? 0) >= (error.line ?? 0)) ??
251
+ error;
252
+ }
253
+ //# sourceMappingURL=dropped.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropped.js","sourceRoot":"","sources":["../src/dropped.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,6EAA6E;AAC7E,gCAAgC;AAChC,EAAE;AACF,0EAA0E;AAC1E,6BAA6B;AAC7B,2EAA2E;AAC3E,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,uEAAuE;AACvE,2DAA2D;AAC3D,2DAA2D;AAC3D,6EAA6E;AAC7E,2EAA2E;AAC3E,kEAAkE;AAClE,yEAAyE;AACzE,oEAAoE;AACpE,iCAAiC;AACjC,EAAE;AACF,0EAA0E;AAC1E,6EAA6E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AC,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,CAAC,KAAK,EAAE,EAAE,CACf,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM;aACH,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACrB,EAAE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;QACnE,KAAK,CAAC;AACV,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { type ContentError, type PageFinish, type WholeContent } from "../index.js";
2
+ import { type DeferredUrlReport } from "../cli-steps.js";
3
+ import { type FileReferences } from "../reference-graph.js";
4
+ import { type DroppedEntry } from "../dropped.js";
5
+ import type { ContentState } from "./reader.js";
6
+ import { type BuildStore } from "./store.js";
7
+ /**
8
+ * Lay out the errors, write the artifacts whose JSON changed, and compute
9
+ * the URL report. The stored hash of each artifact (store.ts) tells a change
10
+ * without reading the stored JSON back.
11
+ */
12
+ export declare function assemble(store: BuildStore, units: {
13
+ source: string;
14
+ errors: ContentError[];
15
+ dropped?: DroppedEntry[];
16
+ }[], whole: WholeContent, pages: {
17
+ source: string;
18
+ finish: PageFinish;
19
+ }[], state: ContentState, references: ReadonlyMap<string, FileReferences>): {
20
+ errors: ContentError[];
21
+ changedArtifacts: string[];
22
+ urlReport: DeferredUrlReport;
23
+ };
24
+ /**
25
+ * Write the complete output of `cli.ts --stdin --defer-urls` for the build
26
+ * layer's content; without `courseGraph`, that of `--skip-course-graph` too.
27
+ * The pages (141 of the 157 MB on the frozen content) are read from the store
28
+ * one at a time as they are written, so the job holds one page, not all.
29
+ */
30
+ export declare function writeFullOutput(path: string, store: BuildStore, whole: WholeContent, errors: ContentError[], texts: ReadonlyMap<string, string>, { courseGraph }: {
31
+ courseGraph: boolean;
32
+ }): void;
33
+ /** An array that writeJson writes one item at a time, as `items` yields them. */
34
+ export declare class Streamed {
35
+ readonly items: Iterable<unknown>;
36
+ constructor(items: Iterable<unknown>);
37
+ }
38
+ /**
39
+ * Write `JSON.stringify(object, null, 2)` to `path` one top-level value at a
40
+ * time, and a Streamed value one item at a time. JSON text has no raw newline
41
+ * inside a string, so a value serialised on its own takes its nested place
42
+ * once each line after its first is indented to its depth.
43
+ */
44
+ export declare function writeJson(path: string, object: object): void;
@@ -0,0 +1,132 @@
1
+ // What the engine hands out after a job: the error list in today's order with
2
+ // the units that reported each error, the artifacts the platform reads, the
3
+ // URL report, and (for tests, the harness and shadow comparisons) the
4
+ // complete output of `cli.ts --stdin --defer-urls`, byte for byte.
5
+ import { closeSync, openSync, writeFileSync } from "fs";
6
+ import { assembleErrors, processResult, } from "../index.js";
7
+ import { courseReachability, deferredUrlReport, withCourseGraph, } from "../cli-steps.js";
8
+ import { fileToCoursesFrom } from "../reference-graph.js";
9
+ import { droppedArtifact } from "../dropped.js";
10
+ import { NO_ARTIFACT, artifactHash } from "./store.js";
11
+ /** The artifacts the platform reads (protocol.ts, "Artifacts"). */
12
+ const PLATFORM_ARTIFACTS = [
13
+ "errors",
14
+ "errorSources",
15
+ "courses",
16
+ "surveys",
17
+ "meetingDocs",
18
+ "articleSegments",
19
+ "urlsToValidate",
20
+ "skillTree",
21
+ "fileToCourses",
22
+ "dropped",
23
+ ];
24
+ /**
25
+ * Lay out the errors, write the artifacts whose JSON changed, and compute
26
+ * the URL report. The stored hash of each artifact (store.ts) tells a change
27
+ * without reading the stored JSON back.
28
+ */
29
+ export function assemble(store, units, whole, pages, state, references) {
30
+ const views = state.views();
31
+ const { errors, sources } = assembleErrors(units, whole.errors, pages, views.tierMap);
32
+ const output = processResult([], whole, errors);
33
+ const artifacts = {
34
+ errors,
35
+ errorSources: sources,
36
+ courses: output.courses,
37
+ surveys: output.surveys,
38
+ meetingDocs: output.meetingDocs,
39
+ articleSegments: output.articleSegments,
40
+ urlsToValidate: output.urlsToValidate,
41
+ skillTree: output.skillTree,
42
+ fileToCourses: courseReachability(() => fileToCoursesFrom(references, views.files)),
43
+ dropped: droppedArtifact(units.flatMap((unit) => unit.dropped ?? []), errors),
44
+ };
45
+ const changedArtifacts = [];
46
+ for (const name of PLATFORM_ARTIFACTS) {
47
+ const json = JSON.stringify(artifacts[name]);
48
+ const hash = json === undefined ? NO_ARTIFACT : artifactHash(json);
49
+ if (hash === store.getArtifactHash(name))
50
+ continue;
51
+ if (json === undefined)
52
+ store.deleteArtifact(name);
53
+ else
54
+ store.putArtifact(name, json);
55
+ changedArtifacts.push(name);
56
+ }
57
+ return {
58
+ errors,
59
+ changedArtifacts,
60
+ urlReport: deferredUrlReport(errors, output.urlsToValidate),
61
+ };
62
+ }
63
+ /**
64
+ * Write the complete output of `cli.ts --stdin --defer-urls` for the build
65
+ * layer's content; without `courseGraph`, that of `--skip-course-graph` too.
66
+ * The pages (141 of the 157 MB on the frozen content) are read from the store
67
+ * one at a time as they are written, so the job holds one page, not all.
68
+ */
69
+ export function writeFullOutput(path, store, whole, errors, texts, { courseGraph }) {
70
+ const full = {
71
+ // processResult gives the keys their order.
72
+ ...processResult([], whole, errors),
73
+ modules: new Streamed(storedPages(store)),
74
+ errors: courseGraph ? withCourseGraph(errors, texts) : errors,
75
+ fileToCourses: JSON.parse(store.getArtifact("fileToCourses") ?? "{}"),
76
+ };
77
+ writeJson(path, {
78
+ ...full,
79
+ ...deferredUrlReport(full.errors, full.urlsToValidate),
80
+ });
81
+ }
82
+ /** The finished pages in today's order, each read when it is needed. */
83
+ function* storedPages(store) {
84
+ for (const { sourcePath, index } of store.listPages())
85
+ yield JSON.parse(store.getPage(sourcePath, index).json);
86
+ }
87
+ /** An array that writeJson writes one item at a time, as `items` yields them. */
88
+ export class Streamed {
89
+ items;
90
+ constructor(items) {
91
+ this.items = items;
92
+ }
93
+ }
94
+ /**
95
+ * Write `JSON.stringify(object, null, 2)` to `path` one top-level value at a
96
+ * time, and a Streamed value one item at a time. JSON text has no raw newline
97
+ * inside a string, so a value serialised on its own takes its nested place
98
+ * once each line after its first is indented to its depth.
99
+ */
100
+ export function writeJson(path, object) {
101
+ const nested = (value, indent) => JSON.stringify(value, null, 2)?.replaceAll("\n", `\n${indent}`);
102
+ const fd = openSync(path, "w");
103
+ try {
104
+ const write = (text) => writeFileSync(fd, text);
105
+ let comma = "";
106
+ write("{");
107
+ for (const [key, value] of Object.entries(object)) {
108
+ const name = `${comma}\n ${JSON.stringify(key)}: `;
109
+ if (value instanceof Streamed) {
110
+ write(`${name}[`);
111
+ let itemComma = "";
112
+ for (const item of value.items) {
113
+ write(`${itemComma}\n ${nested(item, " ") ?? "null"}`);
114
+ itemComma = ",";
115
+ }
116
+ write(itemComma ? "\n ]" : "]");
117
+ }
118
+ else {
119
+ const json = nested(value, " ");
120
+ if (json === undefined)
121
+ continue;
122
+ write(name + json);
123
+ }
124
+ comma = ",";
125
+ }
126
+ write(comma ? "\n}" : "}");
127
+ }
128
+ finally {
129
+ closeSync(fd);
130
+ }
131
+ }
132
+ //# sourceMappingURL=assemble.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../src/engine/assemble.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,sEAAsE;AACtE,mEAAmE;AAEnE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxD,OAAO,EACL,cAAc,EACd,aAAa,GAId,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAEhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAuB,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;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,CAAC;oBAC/B,KAAK,CAAC,GAAG,SAAS,SAAS,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;oBAC7D,SAAS,GAAG,GAAG,CAAC;gBAClB,CAAC;gBACD,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBACjC,IAAI,IAAI,KAAK,SAAS;oBAAE,SAAS;gBACjC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;YACrB,CAAC;YACD,KAAK,GAAG,GAAG,CAAC;QACd,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;YAAS,CAAC;QACT,SAAS,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ContentSource, Job, JobHooks, JobResult } from "./protocol.js";
2
+ import { type BuildStore } from "./store.js";
3
+ /**
4
+ * Run one job. Throws when the job cannot complete; the worker reports that
5
+ * as a result with status "error". The store must belong to the running
6
+ * validator version.
7
+ */
8
+ export declare function runJob(job: Job, store: BuildStore, source: ContentSource, hooks?: JobHooks): JobResult;