postext 1.89.2 → 1.90.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/__tests__/bundle/layoutCache.test.js +19 -0
- package/dist/__tests__/bundle/layoutCache.test.js.map +1 -1
- package/dist/__tests__/composed/reflow/pageMemo.test.js +4 -0
- package/dist/__tests__/composed/reflow/pageMemo.test.js.map +1 -1
- package/dist/__tests__/exports.test.js +1 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/fonts/glyphFallback.test.js +26 -1
- package/dist/__tests__/fonts/glyphFallback.test.js.map +1 -1
- package/dist/__tests__/math/pathTransformMemo.test.d.ts +2 -0
- package/dist/__tests__/math/pathTransformMemo.test.d.ts.map +1 -0
- package/dist/__tests__/math/pathTransformMemo.test.js +22 -0
- package/dist/__tests__/math/pathTransformMemo.test.js.map +1 -0
- package/dist/__tests__/measure/inkWithWidth.test.d.ts +2 -0
- package/dist/__tests__/measure/inkWithWidth.test.d.ts.map +1 -0
- package/dist/__tests__/measure/inkWithWidth.test.js +50 -0
- package/dist/__tests__/measure/inkWithWidth.test.js.map +1 -0
- package/dist/__tests__/pipeline/passEdit.test.d.ts +2 -0
- package/dist/__tests__/pipeline/passEdit.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/passEdit.test.js +113 -0
- package/dist/__tests__/pipeline/passEdit.test.js.map +1 -0
- package/dist/__tests__/pipeline/passResume.test.d.ts +2 -0
- package/dist/__tests__/pipeline/passResume.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/passResume.test.js +136 -0
- package/dist/__tests__/pipeline/passResume.test.js.map +1 -0
- package/dist/__tests__/resumeCheck.d.ts +2 -0
- package/dist/__tests__/resumeCheck.d.ts.map +1 -0
- package/dist/__tests__/resumeCheck.js +47 -0
- package/dist/__tests__/resumeCheck.js.map +1 -0
- package/dist/bundle/book.js +8 -1
- package/dist/bundle/book.js.map +1 -1
- package/dist/comics/layoutPage/records.d.ts.map +1 -1
- package/dist/comics/layoutPage/records.js +3 -2
- package/dist/comics/layoutPage/records.js.map +1 -1
- package/dist/comics/transform.d.ts.map +1 -1
- package/dist/comics/transform.js +2 -1
- package/dist/comics/transform.js.map +1 -1
- package/dist/composed/labels.d.ts.map +1 -1
- package/dist/composed/labels.js +4 -2
- package/dist/composed/labels.js.map +1 -1
- package/dist/fonts/glyphFallback.d.ts +15 -0
- package/dist/fonts/glyphFallback.d.ts.map +1 -1
- package/dist/fonts/glyphFallback.js +21 -5
- package/dist/fonts/glyphFallback.js.map +1 -1
- package/dist/fonts/glyphPlaces.d.ts +1 -1
- package/dist/fonts/glyphPlaces.d.ts.map +1 -1
- package/dist/fonts/glyphPlaces.js +25 -1
- package/dist/fonts/glyphPlaces.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/knuthPlass/richAdapter.d.ts.map +1 -1
- package/dist/knuthPlass/richAdapter.js +61 -24
- package/dist/knuthPlass/richAdapter.js.map +1 -1
- package/dist/marks/arabicMarks.d.ts +0 -7
- package/dist/marks/arabicMarks.d.ts.map +1 -1
- package/dist/marks/arabicMarks.js +47 -2
- package/dist/marks/arabicMarks.js.map +1 -1
- package/dist/marks/cjkMarks.d.ts.map +1 -1
- package/dist/marks/cjkMarks.js +2 -1
- package/dist/marks/cjkMarks.js.map +1 -1
- package/dist/marks/emphasisOverline.d.ts.map +1 -1
- package/dist/marks/emphasisOverline.js +2 -1
- package/dist/marks/emphasisOverline.js.map +1 -1
- package/dist/marks/highlightMarks.d.ts.map +1 -1
- package/dist/marks/highlightMarks.js +5 -0
- package/dist/marks/highlightMarks.js.map +1 -1
- package/dist/math/pathTransform.d.ts.map +1 -1
- package/dist/math/pathTransform.js +16 -0
- package/dist/math/pathTransform.js.map +1 -1
- package/dist/measure/canvas/ink.d.ts +2 -1
- package/dist/measure/canvas/ink.d.ts.map +1 -1
- package/dist/measure/canvas/ink.js +6 -2
- package/dist/measure/canvas/ink.js.map +1 -1
- package/dist/measure/canvas/state.d.ts +9 -0
- package/dist/measure/canvas/state.d.ts.map +1 -1
- package/dist/measure/canvas/state.js +2 -1
- package/dist/measure/canvas/state.js.map +1 -1
- package/dist/measure/canvas/widths.d.ts +5 -0
- package/dist/measure/canvas/widths.d.ts.map +1 -1
- package/dist/measure/canvas/widths.js +34 -2
- package/dist/measure/canvas/widths.js.map +1 -1
- package/dist/measure/rtl/kashida.d.ts.map +1 -1
- package/dist/measure/rtl/kashida.js +12 -8
- package/dist/measure/rtl/kashida.js.map +1 -1
- package/dist/measure/rtl/kashidaPatterns.d.ts.map +1 -1
- package/dist/measure/rtl/kashidaPatterns.js +17 -3
- package/dist/measure/rtl/kashidaPatterns.js.map +1 -1
- package/dist/pipeline/blocks/buildHelpers.d.ts +1 -13
- package/dist/pipeline/blocks/buildHelpers.d.ts.map +1 -1
- package/dist/pipeline/blocks/buildHelpers.js +4 -150
- package/dist/pipeline/blocks/buildHelpers.js.map +1 -1
- package/dist/pipeline/blocks/mirrorFrame.d.ts.map +1 -1
- package/dist/pipeline/blocks/mirrorFrame.js +5 -1
- package/dist/pipeline/blocks/mirrorFrame.js.map +1 -1
- package/dist/pipeline/blocks/placement.d.ts.map +1 -1
- package/dist/pipeline/blocks/placement.js +2 -1
- package/dist/pipeline/blocks/placement.js.map +1 -1
- package/dist/pipeline/blocks/sourceRanges.d.ts +15 -0
- package/dist/pipeline/blocks/sourceRanges.d.ts.map +1 -0
- package/dist/pipeline/blocks/sourceRanges.js +157 -0
- package/dist/pipeline/blocks/sourceRanges.js.map +1 -0
- package/dist/pipeline/build/drivers.d.ts +3 -1
- package/dist/pipeline/build/drivers.d.ts.map +1 -1
- package/dist/pipeline/build/drivers.js +40 -4
- package/dist/pipeline/build/drivers.js.map +1 -1
- package/dist/pipeline/build/pageMarks.d.ts.map +1 -1
- package/dist/pipeline/build/pageMarks.js +3 -0
- package/dist/pipeline/build/pageMarks.js.map +1 -1
- package/dist/pipeline/build/pass/bands.d.ts.map +1 -1
- package/dist/pipeline/build/pass/bands.js +5 -3
- package/dist/pipeline/build/pass/bands.js.map +1 -1
- package/dist/pipeline/build/pass/breaks.d.ts.map +1 -1
- package/dist/pipeline/build/pass/breaks.js +2 -0
- package/dist/pipeline/build/pass/breaks.js.map +1 -1
- package/dist/pipeline/build/pass/callouts/calloutCommit.d.ts.map +1 -1
- package/dist/pipeline/build/pass/callouts/calloutCommit.js +2 -0
- package/dist/pipeline/build/pass/callouts/calloutCommit.js.map +1 -1
- package/dist/pipeline/build/pass/comics.d.ts.map +1 -1
- package/dist/pipeline/build/pass/comics.js +2 -0
- package/dist/pipeline/build/pass/comics.js.map +1 -1
- package/dist/pipeline/build/pass/composed/jumps.d.ts.map +1 -1
- package/dist/pipeline/build/pass/composed/jumps.js +2 -0
- package/dist/pipeline/build/pass/composed/jumps.js.map +1 -1
- package/dist/pipeline/build/pass/composed.d.ts.map +1 -1
- package/dist/pipeline/build/pass/composed.js +2 -0
- package/dist/pipeline/build/pass/composed.js.map +1 -1
- package/dist/pipeline/build/pass/floats/citationPull.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/citationPull.js +2 -0
- package/dist/pipeline/build/pass/floats/citationPull.js.map +1 -1
- package/dist/pipeline/build/pass/floats/floatBands.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/floatBands.js +2 -0
- package/dist/pipeline/build/pass/floats/floatBands.js.map +1 -1
- package/dist/pipeline/build/pass/floats/floatFlush.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/floatFlush.js +3 -5
- package/dist/pipeline/build/pass/floats/floatFlush.js.map +1 -1
- package/dist/pipeline/build/pass/floats/floatMeasure.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/floatMeasure.js +2 -0
- package/dist/pipeline/build/pass/floats/floatMeasure.js.map +1 -1
- package/dist/pipeline/build/pass/floats/floatPlace.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/floatPlace.js +2 -0
- package/dist/pipeline/build/pass/floats/floatPlace.js.map +1 -1
- package/dist/pipeline/build/pass/floats/floatQueue.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/floatQueue.js +2 -0
- package/dist/pipeline/build/pass/floats/floatQueue.js.map +1 -1
- package/dist/pipeline/build/pass/floats/floatRows.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/floatRows.js +2 -0
- package/dist/pipeline/build/pass/floats/floatRows.js.map +1 -1
- package/dist/pipeline/build/pass/floats/footStack.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/footStack.js +2 -0
- package/dist/pipeline/build/pass/floats/footStack.js.map +1 -1
- package/dist/pipeline/build/pass/floats/strips.d.ts.map +1 -1
- package/dist/pipeline/build/pass/floats/strips.js +2 -0
- package/dist/pipeline/build/pass/floats/strips.js.map +1 -1
- package/dist/pipeline/build/pass/measuringAsFound.d.ts +9 -0
- package/dist/pipeline/build/pass/measuringAsFound.d.ts.map +1 -0
- package/dist/pipeline/build/pass/measuringAsFound.js +48 -0
- package/dist/pipeline/build/pass/measuringAsFound.js.map +1 -0
- package/dist/pipeline/build/pass/notes.d.ts.map +1 -1
- package/dist/pipeline/build/pass/notes.js +13 -0
- package/dist/pipeline/build/pass/notes.js.map +1 -1
- package/dist/pipeline/build/pass/setup/contentSetup.d.ts +1 -0
- package/dist/pipeline/build/pass/setup/contentSetup.d.ts.map +1 -1
- package/dist/pipeline/build/pass/setup/contentSetup.js +8 -2
- package/dist/pipeline/build/pass/setup/contentSetup.js.map +1 -1
- package/dist/pipeline/build/pass/setup/pageSetup.d.ts.map +1 -1
- package/dist/pipeline/build/pass/setup/pageSetup.js +2 -0
- package/dist/pipeline/build/pass/setup/pageSetup.js.map +1 -1
- package/dist/pipeline/build/pass/setup/passFinish.d.ts.map +1 -1
- package/dist/pipeline/build/pass/setup/passFinish.js +6 -2
- package/dist/pipeline/build/pass/setup/passFinish.js.map +1 -1
- package/dist/pipeline/build/pass/shortLists.d.ts.map +1 -1
- package/dist/pipeline/build/pass/shortLists.js +2 -0
- package/dist/pipeline/build/pass/shortLists.js.map +1 -1
- package/dist/pipeline/build/pass.d.ts.map +1 -1
- package/dist/pipeline/build/pass.js +122 -92
- package/dist/pipeline/build/pass.js.map +1 -1
- package/dist/pipeline/build/passMade.d.ts +50 -0
- package/dist/pipeline/build/passMade.d.ts.map +1 -0
- package/dist/pipeline/build/passMade.js +194 -0
- package/dist/pipeline/build/passMade.js.map +1 -0
- package/dist/pipeline/build/passRejoin.d.ts +12 -0
- package/dist/pipeline/build/passRejoin.d.ts.map +1 -0
- package/dist/pipeline/build/passRejoin.js +172 -0
- package/dist/pipeline/build/passRejoin.js.map +1 -0
- package/dist/pipeline/build/passResume.d.ts +54 -0
- package/dist/pipeline/build/passResume.d.ts.map +1 -0
- package/dist/pipeline/build/passResume.js +212 -0
- package/dist/pipeline/build/passResume.js.map +1 -0
- package/dist/pipeline/build/passReuse.d.ts +117 -0
- package/dist/pipeline/build/passReuse.d.ts.map +1 -0
- package/dist/pipeline/build/passReuse.js +417 -0
- package/dist/pipeline/build/passReuse.js.map +1 -0
- package/dist/pipeline/build/passSetups.d.ts +53 -0
- package/dist/pipeline/build/passSetups.d.ts.map +1 -0
- package/dist/pipeline/build/passSetups.js +215 -0
- package/dist/pipeline/build/passSetups.js.map +1 -0
- package/dist/pipeline/build/passTape.d.ts +179 -0
- package/dist/pipeline/build/passTape.d.ts.map +1 -0
- package/dist/pipeline/build/passTape.js +534 -0
- package/dist/pipeline/build/passTape.js.map +1 -0
- package/dist/pipeline/build/passTypes.d.ts +12 -0
- package/dist/pipeline/build/passTypes.d.ts.map +1 -1
- package/dist/pipeline/build/passTypes.js.map +1 -1
- package/dist/pipeline/build/warnings.d.ts.map +1 -1
- package/dist/pipeline/build/warnings.js +2 -1
- package/dist/pipeline/build/warnings.js.map +1 -1
- package/dist/pipeline/build.d.ts +1 -0
- package/dist/pipeline/build.d.ts.map +1 -1
- package/dist/pipeline/build.js +1 -0
- package/dist/pipeline/build.js.map +1 -1
- package/dist/pipeline/callouts/calloutLayout/inputs.d.ts.map +1 -1
- package/dist/pipeline/callouts/calloutLayout/inputs.js +2 -1
- package/dist/pipeline/callouts/calloutLayout/inputs.js.map +1 -1
- package/dist/pipeline/code/codeLines.d.ts.map +1 -1
- package/dist/pipeline/code/codeLines.js +2 -1
- package/dist/pipeline/code/codeLines.js.map +1 -1
- package/dist/pipeline/floats/textWrap.d.ts.map +1 -1
- package/dist/pipeline/floats/textWrap.js +3 -2
- package/dist/pipeline/floats/textWrap.js.map +1 -1
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.d.ts.map +1 -1
- package/dist/pipeline/index.js +1 -1
- package/dist/pipeline/index.js.map +1 -1
- package/dist/pipeline/pages/dieCuts.d.ts.map +1 -1
- package/dist/pipeline/pages/dieCuts.js +6 -1
- package/dist/pipeline/pages/dieCuts.js.map +1 -1
- package/dist/pipeline/pages/headerFooter/layoutHeadersAndFooters.d.ts.map +1 -1
- package/dist/pipeline/pages/headerFooter/layoutHeadersAndFooters.js +4 -0
- package/dist/pipeline/pages/headerFooter/layoutHeadersAndFooters.js.map +1 -1
- package/dist/pipeline/pages/headerFooter/pass.d.ts.map +1 -1
- package/dist/pipeline/pages/headerFooter/pass.js +2 -1
- package/dist/pipeline/pages/headerFooter/pass.js.map +1 -1
- package/dist/pipeline/pages/pageRoles.d.ts.map +1 -1
- package/dist/pipeline/pages/pageRoles.js +4 -0
- package/dist/pipeline/pages/pageRoles.js.map +1 -1
- package/dist/pipeline/pages/paper.d.ts.map +1 -1
- package/dist/pipeline/pages/paper.js +4 -0
- package/dist/pipeline/pages/paper.js.map +1 -1
- package/dist/pipeline/text/dropCap.d.ts +5 -0
- package/dist/pipeline/text/dropCap.d.ts.map +1 -1
- package/dist/pipeline/text/dropCap.js +7 -0
- package/dist/pipeline/text/dropCap.js.map +1 -1
- package/dist/pipeline/text/verticalMetrics.d.ts.map +1 -1
- package/dist/pipeline/text/verticalMetrics.js +4 -0
- package/dist/pipeline/text/verticalMetrics.js.map +1 -1
- package/dist/worker/client.d.ts +5 -0
- package/dist/worker/client.d.ts.map +1 -1
- package/dist/worker/client.js +1 -1
- package/dist/worker/client.js.map +1 -1
- package/dist/worker/layout.worker.js +15 -3
- package/dist/worker/layout.worker.js.map +1 -1
- package/dist/worker/protocol.d.ts +12 -1
- package/dist/worker/protocol.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
const isPlain = (value) => {
|
|
2
|
+
const proto = Object.getPrototypeOf(value);
|
|
3
|
+
return proto === Object.prototype || proto === null;
|
|
4
|
+
};
|
|
5
|
+
export { ClosedPageWrite, withPassTape } from './passTape.js';
|
|
6
|
+
/** The checker listening, when one is. */
|
|
7
|
+
export function passResumeCheck() {
|
|
8
|
+
return globalThis.__postextPassResumeCheck;
|
|
9
|
+
}
|
|
10
|
+
/** A pass under the check: its checkpoints, and the runs from them. */
|
|
11
|
+
export class PassResume {
|
|
12
|
+
tape;
|
|
13
|
+
check;
|
|
14
|
+
saved = [];
|
|
15
|
+
/** The document being built. */
|
|
16
|
+
doc;
|
|
17
|
+
/** Whether the pages behind a checkpoint are closed. */
|
|
18
|
+
closes = true;
|
|
19
|
+
/** `setup`: the objects of the pass's setup, kept by reference in a
|
|
20
|
+
* checkpoint; everything else on the tape is copied. */
|
|
21
|
+
constructor(tape, check, setup) {
|
|
22
|
+
this.tape = tape;
|
|
23
|
+
this.check = check;
|
|
24
|
+
tape.atoms(setup);
|
|
25
|
+
}
|
|
26
|
+
/** The first run is about to place block `blockIdx`. */
|
|
27
|
+
atBlock(blockIdx, pages, blocks) {
|
|
28
|
+
if (!this.check.saveAt(blockIdx, pages, blocks))
|
|
29
|
+
return;
|
|
30
|
+
// Every page but the one being filled is closed (#1639): the rest of
|
|
31
|
+
// a pass writes to the open page alone, but for a box or a story that
|
|
32
|
+
// goes back to a page behind it.
|
|
33
|
+
if (this.closes && this.doc)
|
|
34
|
+
this.tape.close(this.doc.pages.slice(0, -1));
|
|
35
|
+
const then = this.check.wroteBack && this.doc ? this.doc.pages.map((p) => JSON.stringify(p)) : undefined;
|
|
36
|
+
this.saved.push({ blockIdx, image: this.tape.record(), ...(then ? { pages: then } : {}) });
|
|
37
|
+
}
|
|
38
|
+
/** The first run has placed its blocks. Each checkpoint is put back and
|
|
39
|
+
* the rest placed again (`placeFrom(blockIdx, true)`): the tape must
|
|
40
|
+
* end as the first run left it. Then the first run's end is put back,
|
|
41
|
+
* so the pass finishes from a restored tape too. */
|
|
42
|
+
again(placeFrom) {
|
|
43
|
+
if (this.saved.length === 0)
|
|
44
|
+
return;
|
|
45
|
+
const first = printTape(this.tape);
|
|
46
|
+
const end = this.tape.record();
|
|
47
|
+
if (this.check.wroteBack && this.doc) {
|
|
48
|
+
const now = this.doc.pages.map((p) => JSON.stringify(p));
|
|
49
|
+
for (const { pages } of this.saved) {
|
|
50
|
+
if (!pages)
|
|
51
|
+
continue;
|
|
52
|
+
let at = 0;
|
|
53
|
+
while (at < pages.length && pages[at] === now[at])
|
|
54
|
+
at++;
|
|
55
|
+
this.check.wroteBack(pages.length, at);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
for (const { blockIdx, image } of this.saved) {
|
|
59
|
+
this.tape.putBack(image);
|
|
60
|
+
placeFrom(blockIdx, true);
|
|
61
|
+
this.check.compared(blockIdx, first, printTape(this.tape));
|
|
62
|
+
}
|
|
63
|
+
this.tape.putBack(end);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Whether `error` is a write to a closed page: the engine's own refusal
|
|
67
|
+
* to write to a frozen object, on a tape that closed pages. */
|
|
68
|
+
export function isClosedPageWrite(tape, error) {
|
|
69
|
+
return tape.closedAny && error instanceof TypeError;
|
|
70
|
+
}
|
|
71
|
+
/** Everything on the tape as text: two tapes in the same state give
|
|
72
|
+
* the same text. An object that is a key of a map, a member of a set or
|
|
73
|
+
* a key of a side table is numbered where it is first met and named by
|
|
74
|
+
* its number after that, so the text says which of them are one object;
|
|
75
|
+
* any other object is written out wherever it stands, so two copies of
|
|
76
|
+
* a line's words read as the words shared (what comes back from a memo
|
|
77
|
+
* is a copy). The objects of the setup are numbered and not read. */
|
|
78
|
+
export function printTape(tape) {
|
|
79
|
+
const { bindings, variables, tables, kept } = tape.parts();
|
|
80
|
+
// The objects whose identity the pass reads.
|
|
81
|
+
const keyed = new Set();
|
|
82
|
+
const met = new Set();
|
|
83
|
+
const find = (value, key) => {
|
|
84
|
+
if (typeof value !== 'object' || value === null)
|
|
85
|
+
return;
|
|
86
|
+
if (key)
|
|
87
|
+
keyed.add(value);
|
|
88
|
+
if (met.has(value) || kept.has(value))
|
|
89
|
+
return;
|
|
90
|
+
met.add(value);
|
|
91
|
+
if (Array.isArray(value))
|
|
92
|
+
for (const item of value)
|
|
93
|
+
find(item, false);
|
|
94
|
+
else if (value instanceof Map)
|
|
95
|
+
for (const [k, v] of value) {
|
|
96
|
+
find(k, true);
|
|
97
|
+
find(v, false);
|
|
98
|
+
}
|
|
99
|
+
else if (value instanceof Set)
|
|
100
|
+
for (const item of value)
|
|
101
|
+
find(item, true);
|
|
102
|
+
else if (isPlain(value))
|
|
103
|
+
for (const name in value)
|
|
104
|
+
find(value[name], false);
|
|
105
|
+
else
|
|
106
|
+
return;
|
|
107
|
+
for (const { table } of tables) {
|
|
108
|
+
if (!table.has(value))
|
|
109
|
+
continue;
|
|
110
|
+
keyed.add(value);
|
|
111
|
+
if (table instanceof WeakMap)
|
|
112
|
+
find(table.get(value), false);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
for (const value of bindings.values())
|
|
116
|
+
find(value, false);
|
|
117
|
+
for (const v of variables.values())
|
|
118
|
+
find(v.get(), false);
|
|
119
|
+
const out = [];
|
|
120
|
+
const ids = new Map();
|
|
121
|
+
const open = new Set();
|
|
122
|
+
const walk = (value) => {
|
|
123
|
+
if (typeof value === 'function')
|
|
124
|
+
value = { function: value.name };
|
|
125
|
+
if (typeof value !== 'object' || value === null) {
|
|
126
|
+
out.push(typeof value === 'string' ? JSON.stringify(value) : typeof value === 'number' && Object.is(value, -0) ? '-0' : String(value));
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const atom = kept.has(value);
|
|
130
|
+
if (atom || keyed.has(value)) {
|
|
131
|
+
const seen = ids.get(value);
|
|
132
|
+
if (seen !== undefined) {
|
|
133
|
+
out.push(`${atom ? '@' : '#'}${seen}`);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
ids.set(value, ids.size);
|
|
137
|
+
out.push(`${atom ? '@' : '#'}${ids.size - 1}`);
|
|
138
|
+
if (atom)
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (open.has(value)) {
|
|
142
|
+
out.push('<itself>');
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
open.add(value);
|
|
146
|
+
if (Array.isArray(value)) {
|
|
147
|
+
out.push('[');
|
|
148
|
+
for (let i = 0; i < value.length; i++) {
|
|
149
|
+
if (i in value)
|
|
150
|
+
walk(value[i]);
|
|
151
|
+
else
|
|
152
|
+
out.push('<hole>');
|
|
153
|
+
out.push(',');
|
|
154
|
+
}
|
|
155
|
+
out.push(']');
|
|
156
|
+
}
|
|
157
|
+
else if (value instanceof Map) {
|
|
158
|
+
out.push('Map{');
|
|
159
|
+
for (const [k, v] of value) {
|
|
160
|
+
walk(k);
|
|
161
|
+
out.push('=>');
|
|
162
|
+
walk(v);
|
|
163
|
+
out.push(',');
|
|
164
|
+
}
|
|
165
|
+
out.push('}');
|
|
166
|
+
}
|
|
167
|
+
else if (value instanceof Set) {
|
|
168
|
+
out.push('Set{');
|
|
169
|
+
for (const item of value) {
|
|
170
|
+
walk(item);
|
|
171
|
+
out.push(',');
|
|
172
|
+
}
|
|
173
|
+
out.push('}');
|
|
174
|
+
}
|
|
175
|
+
else if (isPlain(value)) {
|
|
176
|
+
out.push('{');
|
|
177
|
+
for (const key in value) {
|
|
178
|
+
// A key set to undefined reads as a key left out: what comes
|
|
179
|
+
// back from a memo kept as JSON has lost them.
|
|
180
|
+
const member = value[key];
|
|
181
|
+
if (member === undefined)
|
|
182
|
+
continue;
|
|
183
|
+
out.push(`${key}:`);
|
|
184
|
+
walk(member);
|
|
185
|
+
out.push(',');
|
|
186
|
+
}
|
|
187
|
+
out.push('}');
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
out.push(`<${value.constructor?.name ?? 'object'}>`);
|
|
191
|
+
open.delete(value);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
for (const { name, table } of tables) {
|
|
195
|
+
if (!table.has(value))
|
|
196
|
+
continue;
|
|
197
|
+
out.push(`~${name}=`);
|
|
198
|
+
walk(table instanceof WeakMap ? table.get(value) : true);
|
|
199
|
+
}
|
|
200
|
+
open.delete(value);
|
|
201
|
+
};
|
|
202
|
+
for (const [name, value] of bindings) {
|
|
203
|
+
out.push(`\n${name}: `);
|
|
204
|
+
walk(value);
|
|
205
|
+
}
|
|
206
|
+
for (const [name, v] of variables) {
|
|
207
|
+
out.push(`\n${name}= `);
|
|
208
|
+
walk(v.get());
|
|
209
|
+
}
|
|
210
|
+
return out.join('');
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=passResume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passResume.js","sourceRoot":"","sources":["../../../src/pipeline/build/passResume.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,GAAG,CAAC,KAAa,EAAW,EAAE;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAY,CAAC;IACtD,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AACtD,CAAC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAiB,MAAM,eAAe,CAAC;AAwB7E,0CAA0C;AAC1C,MAAM,UAAU,eAAe;IAC7B,OAAQ,U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E,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ClosedPageWrite, type PassTape } from './passTape.js';
|
|
2
|
+
/** What the last build with a set of tapes did, for tests and benchmarks. */
|
|
3
|
+
export interface LayoutTapeStats {
|
|
4
|
+
/** Placement passes run. */
|
|
5
|
+
passes: number;
|
|
6
|
+
/** The block each pass started from (0: from the first). */
|
|
7
|
+
startedAt: number[];
|
|
8
|
+
/** Why a pass that had a pass before it started from its first block. */
|
|
9
|
+
reasons: string[];
|
|
10
|
+
/** Passes placed again from the first block after starting from a
|
|
11
|
+
* checkpoint (a write to a closed page). */
|
|
12
|
+
placedAgain: number;
|
|
13
|
+
/** For each pass, the pages that kept what the build before made of
|
|
14
|
+
* them: not finished again. */
|
|
15
|
+
pagesKept: number[];
|
|
16
|
+
/** For each pass, the block where it rejoined the pass before it and
|
|
17
|
+
* stopped placing (undefined: it placed to its last block), and the
|
|
18
|
+
* pages after that block it took from the build before. */
|
|
19
|
+
rejoinedAt: (number | undefined)[];
|
|
20
|
+
pagesTaken: number[];
|
|
21
|
+
/** For a pass that tried to rejoin and did not: the last block it tried
|
|
22
|
+
* at and what first differed there. */
|
|
23
|
+
apartAt: (string | undefined)[];
|
|
24
|
+
/** The build was done again without what the build before left: a
|
|
25
|
+
* step after the placing wrote to a page that was kept. */
|
|
26
|
+
builtAgain: boolean;
|
|
27
|
+
/** Where that write was, when there was one. */
|
|
28
|
+
builtAgainAt?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The checkpoints of a document's layout, kept by its host from one build
|
|
32
|
+
* to the next (`BuildDocumentOptions.tapes`): a build of the document
|
|
33
|
+
* after an edit then places only from the page before the edit. One set
|
|
34
|
+
* of tapes serves one document (a chapter); its content, configuration
|
|
35
|
+
* and resources must not be changed in place between two builds.
|
|
36
|
+
*/
|
|
37
|
+
export interface LayoutTapes {
|
|
38
|
+
readonly stats: LayoutTapeStats;
|
|
39
|
+
}
|
|
40
|
+
/** Tapes for one document. */
|
|
41
|
+
export declare function createLayoutTapes(): LayoutTapes;
|
|
42
|
+
/** A build with `tapes` starts. */
|
|
43
|
+
export declare function beginLayoutTapes(tapes: LayoutTapes | undefined): void;
|
|
44
|
+
/** A build with `tapes` did not end. */
|
|
45
|
+
export declare function abandonLayoutTapes(tapes: LayoutTapes | undefined): void;
|
|
46
|
+
/** A build with `tapes` wrote to a page it had kept from the build before
|
|
47
|
+
* and is done again: with the same tapes, emptied. */
|
|
48
|
+
export declare function forgetLayoutTapes(tapes: LayoutTapes, error: Error): void;
|
|
49
|
+
/** The place of the next pass among the passes of the build. */
|
|
50
|
+
export declare function nextTapePass(tapes: LayoutTapes | undefined): number | undefined;
|
|
51
|
+
/** Pass `ordinal` started from a checkpoint and could not go on: it leaves
|
|
52
|
+
* no record, and is placed again without the tapes. */
|
|
53
|
+
export declare function dropTapePass(tapes: LayoutTapes, ordinal: number): void;
|
|
54
|
+
/** What a pass hands over to be recorded. */
|
|
55
|
+
export interface PassRecordingInput {
|
|
56
|
+
/** The setup, as objects of named members (see {@link pairSetups}). */
|
|
57
|
+
roots: Record<string, unknown>;
|
|
58
|
+
/** The text the content blocks were read from. */
|
|
59
|
+
body: string;
|
|
60
|
+
blocks: readonly {
|
|
61
|
+
sourceStart: number;
|
|
62
|
+
sourceEnd: number;
|
|
63
|
+
}[];
|
|
64
|
+
doc: {
|
|
65
|
+
pages: unknown[];
|
|
66
|
+
};
|
|
67
|
+
/** The document numbers its lines in the margin. */
|
|
68
|
+
numbersLines: boolean;
|
|
69
|
+
/** Where the text starts in the source the places count from. */
|
|
70
|
+
bodyOffset: number;
|
|
71
|
+
}
|
|
72
|
+
/** One pass of a build with tapes: where it starts, and the checkpoints
|
|
73
|
+
* it leaves. */
|
|
74
|
+
export declare class PassRecording {
|
|
75
|
+
private readonly tapes;
|
|
76
|
+
private readonly ordinal;
|
|
77
|
+
private readonly tape;
|
|
78
|
+
private readonly input;
|
|
79
|
+
private readonly record;
|
|
80
|
+
private readonly from;
|
|
81
|
+
private readonly adopted;
|
|
82
|
+
/** Where the edit starts in the source, and by how much it moves what
|
|
83
|
+
* follows (0: nothing moves). */
|
|
84
|
+
private editAt;
|
|
85
|
+
private editDelta;
|
|
86
|
+
/** The checkpoints of the pass before that this pass may rejoin, by
|
|
87
|
+
* their block; and where it did: the pages and blocks it had then. */
|
|
88
|
+
private rejoins;
|
|
89
|
+
/** The setup of this pass is that of the pass before, but for the edit. */
|
|
90
|
+
private paired;
|
|
91
|
+
private rejoined;
|
|
92
|
+
private readonly before;
|
|
93
|
+
private lastPages;
|
|
94
|
+
constructor(tapes: LayoutTapes, ordinal: number, tape: PassTape, input: PassRecordingInput);
|
|
95
|
+
/** Put the pass where it starts: at its first block (0), or at the
|
|
96
|
+
* block of the checkpoint it takes up. */
|
|
97
|
+
start(): number;
|
|
98
|
+
/** The pass is about to place block `blockIdx`. True when it need not:
|
|
99
|
+
* it has rejoined the pass before it, and its tape is now as that pass
|
|
100
|
+
* left its own. */
|
|
101
|
+
atBlock(blockIdx: number): boolean;
|
|
102
|
+
/** Try to rejoin the pass before at its checkpoint `c`. */
|
|
103
|
+
private rejoin;
|
|
104
|
+
private checkpoint;
|
|
105
|
+
/**
|
|
106
|
+
* The pass has placed its blocks; what follows sets things on its pages
|
|
107
|
+
* (notes at the column feet, page labels, running heads, line frames).
|
|
108
|
+
* The pages the pass took from its checkpoint are the pages the pass
|
|
109
|
+
* before placed: what the build before made of them stands, frozen, and
|
|
110
|
+
* the steps that follow leave a frozen page alone. The other pages are
|
|
111
|
+
* opened (`PassTape.open`). Kept only while the document has as many
|
|
112
|
+
* pages as it had: a page's foot may print their number.
|
|
113
|
+
*/
|
|
114
|
+
done(): void;
|
|
115
|
+
}
|
|
116
|
+
export { ClosedPageWrite };
|
|
117
|
+
//# sourceMappingURL=passReuse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passReuse.d.ts","sourceRoot":"","sources":["../../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