postext 1.89.3 → 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__/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/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/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/pipeline/blocks/buildHelpers.d.ts.map +1 -1
- package/dist/pipeline/blocks/buildHelpers.js +2 -1
- 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/build/drivers.d.ts +3 -1
- package/dist/pipeline/build/drivers.d.ts.map +1 -1
- package/dist/pipeline/build/drivers.js +34 -1
- 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,215 @@
|
|
|
1
|
+
// The setups of two passes compared (#1639): whether a pass over edited
|
|
2
|
+
// content may start from a checkpoint of the pass before it, and the
|
|
3
|
+
// numbers its checkpoints name the objects of a setup by.
|
|
4
|
+
import { SOURCE_KEYS } from './passMade.js';
|
|
5
|
+
import { ALL_OF_IT, HintGroupRead, groupHint } from './passTape.js';
|
|
6
|
+
/** Members of a setup the comparison leaves alone: the text itself and
|
|
7
|
+
* its parse (the blocks made from it are compared one by one). */
|
|
8
|
+
const TEXT_KEYS = new Set(['markdown', 'markdownBody', 'parsedBody']);
|
|
9
|
+
/** The numbers of the objects of a pass's setups, build after build. */
|
|
10
|
+
export class Names {
|
|
11
|
+
ids = new WeakMap();
|
|
12
|
+
objects = new Map();
|
|
13
|
+
next = 0;
|
|
14
|
+
idOf(value) {
|
|
15
|
+
return this.ids.get(value);
|
|
16
|
+
}
|
|
17
|
+
byId(id) {
|
|
18
|
+
return this.objects.get(id);
|
|
19
|
+
}
|
|
20
|
+
name(value) {
|
|
21
|
+
let id = this.ids.get(value);
|
|
22
|
+
if (id === undefined) {
|
|
23
|
+
id = this.next++;
|
|
24
|
+
this.ids.set(value, id);
|
|
25
|
+
this.objects.set(id, value);
|
|
26
|
+
}
|
|
27
|
+
return id;
|
|
28
|
+
}
|
|
29
|
+
/** A new setup takes the numbers of the one before: each object of
|
|
30
|
+
* `pairs` its predecessor's. What the new setup has no pair for (what a
|
|
31
|
+
* changed block holds) is forgotten with the old setup. */
|
|
32
|
+
succeed(pairs) {
|
|
33
|
+
const objects = new Map();
|
|
34
|
+
for (const [before, now] of pairs) {
|
|
35
|
+
const id = this.ids.get(before);
|
|
36
|
+
if (id === undefined)
|
|
37
|
+
continue;
|
|
38
|
+
this.ids.set(now, id);
|
|
39
|
+
objects.set(id, now);
|
|
40
|
+
}
|
|
41
|
+
this.objects = objects;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Whether `before` and `now` are equal for a layout: the same data, the
|
|
45
|
+
* places in the source after the edit moved by its length. Pairs the
|
|
46
|
+
* objects it finds equal. `key`: the member name they stand under. */
|
|
47
|
+
function same(before, now, key, p) {
|
|
48
|
+
if (typeof before !== 'object' || before === null) {
|
|
49
|
+
if (Object.is(before, now))
|
|
50
|
+
return true;
|
|
51
|
+
return typeof before === 'number' && SOURCE_KEYS.has(key) && p.delta !== 0 && before >= p.at && now === before + p.delta;
|
|
52
|
+
}
|
|
53
|
+
// Objects are walked even when they are one object in both setups: the
|
|
54
|
+
// pairing must hold every object the checkpoints may name.
|
|
55
|
+
if (typeof now !== 'object' || now === null)
|
|
56
|
+
return false;
|
|
57
|
+
const other = now;
|
|
58
|
+
const paired = p.pairs.get(before);
|
|
59
|
+
if (paired !== undefined)
|
|
60
|
+
return paired === other;
|
|
61
|
+
const stateBefore = p.tracksBefore(before);
|
|
62
|
+
if (stateBefore || p.tracksNow(other))
|
|
63
|
+
return stateBefore && p.tracksNow(other);
|
|
64
|
+
p.pairs.set(before, other);
|
|
65
|
+
if (Array.isArray(before)) {
|
|
66
|
+
if (!Array.isArray(other) || other.length !== before.length)
|
|
67
|
+
return false;
|
|
68
|
+
for (let i = 0; i < before.length; i++)
|
|
69
|
+
if (!same(before[i], other[i], key, p))
|
|
70
|
+
return false;
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (before instanceof Map) {
|
|
74
|
+
if (!(other instanceof Map) || other.size !== before.size)
|
|
75
|
+
return false;
|
|
76
|
+
const entries = other.entries();
|
|
77
|
+
for (const [k, v] of before) {
|
|
78
|
+
const [ok, ov] = entries.next().value;
|
|
79
|
+
if (!same(k, ok, '', p) || !same(v, ov, key, p))
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
if (before instanceof Set) {
|
|
85
|
+
if (!(other instanceof Set) || other.size !== before.size)
|
|
86
|
+
return false;
|
|
87
|
+
const items = other.values();
|
|
88
|
+
for (const item of before)
|
|
89
|
+
if (!same(item, items.next().value, '', p))
|
|
90
|
+
return false;
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
const proto = Object.getPrototypeOf(before);
|
|
94
|
+
if ((proto !== Object.prototype && proto !== null) || Object.getPrototypeOf(other) !== proto)
|
|
95
|
+
return false;
|
|
96
|
+
const a = before;
|
|
97
|
+
const b = other;
|
|
98
|
+
// Under a member that holds places in the source (`attrSources`: each
|
|
99
|
+
// attribute's start and end) every number is one.
|
|
100
|
+
const places = SOURCE_KEYS.has(key);
|
|
101
|
+
for (const name in a)
|
|
102
|
+
if (!same(a[name], b[name], places ? key : name, p))
|
|
103
|
+
return false;
|
|
104
|
+
for (const name in b)
|
|
105
|
+
if (!(name in a) && b[name] !== undefined)
|
|
106
|
+
return false;
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Compare the setup of the pass before (`before`) with this pass's
|
|
111
|
+
* (`now`). Undefined with the reason when they differ in more than the
|
|
112
|
+
* blocks an edit changed; else the pairing, its `changed` the blocks that
|
|
113
|
+
* differ. The roots are objects of named members: the text and its parse
|
|
114
|
+
* are left out, a function that is a member of a root stands for itself
|
|
115
|
+
* (the helpers a setup makes from what is compared here), and the content
|
|
116
|
+
* blocks are compared one by one.
|
|
117
|
+
*/
|
|
118
|
+
export function pairSetups(before, roots, body, tracksNow) {
|
|
119
|
+
let at = 0;
|
|
120
|
+
const limit = Math.min(before.body.length, body.length);
|
|
121
|
+
while (at < limit && before.body.charCodeAt(at) === body.charCodeAt(at))
|
|
122
|
+
at++;
|
|
123
|
+
const p = { at, delta: body.length - before.body.length, pairs: new Map(), changed: [], tracksBefore: before.tracks, tracksNow };
|
|
124
|
+
// The content blocks first, each a zone of its own: a block that differs
|
|
125
|
+
// is paired with its successor all the same, so that the lists that
|
|
126
|
+
// hold it compare equal; what it holds stays unpaired.
|
|
127
|
+
const blocksBefore = before.roots.contentSetup?.contentBlocks;
|
|
128
|
+
const blocksNow = roots.contentSetup?.contentBlocks;
|
|
129
|
+
if (!blocksBefore || !blocksNow || blocksBefore.length !== blocksNow.length)
|
|
130
|
+
return 'the number of blocks changed';
|
|
131
|
+
for (let i = 0; i < blocksBefore.length; i++) {
|
|
132
|
+
const a = blocksBefore[i];
|
|
133
|
+
const b = blocksNow[i];
|
|
134
|
+
if (same(a, b, '', p))
|
|
135
|
+
continue;
|
|
136
|
+
p.changed.push(i);
|
|
137
|
+
p.pairs.set(a, b);
|
|
138
|
+
}
|
|
139
|
+
p.pairs.set(before.roots, roots);
|
|
140
|
+
for (const rootName in before.roots) {
|
|
141
|
+
if (rootName === 'hints')
|
|
142
|
+
continue;
|
|
143
|
+
const a = before.roots[rootName];
|
|
144
|
+
const b = roots[rootName];
|
|
145
|
+
if (a === undefined && b === undefined)
|
|
146
|
+
continue;
|
|
147
|
+
if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null)
|
|
148
|
+
return `${rootName} changed`;
|
|
149
|
+
p.pairs.set(a, b);
|
|
150
|
+
for (const name in a) {
|
|
151
|
+
if (TEXT_KEYS.has(name) || name === 'contentBlocks')
|
|
152
|
+
continue;
|
|
153
|
+
if (typeof a[name] === 'function' && typeof b[name] === 'function')
|
|
154
|
+
continue;
|
|
155
|
+
if (!same(a[name], b[name], name, p))
|
|
156
|
+
return `${rootName}.${name} changed`;
|
|
157
|
+
}
|
|
158
|
+
for (const name in b)
|
|
159
|
+
if (!(name in a) && b[name] !== undefined)
|
|
160
|
+
return `${rootName}.${name} is new`;
|
|
161
|
+
}
|
|
162
|
+
return p;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* How many of the reads the pass before made of its hints this pass's
|
|
166
|
+
* hints answer the same way: a checkpoint taken before the first read
|
|
167
|
+
* that differs was reached under the same answers. Pairs the hint objects
|
|
168
|
+
* found equal. A hint that is no map or set (read with no note) must be
|
|
169
|
+
* equal, or none of the reads counts.
|
|
170
|
+
*/
|
|
171
|
+
export function sameHintReads(before, hints, p) {
|
|
172
|
+
const old = before.roots.hints;
|
|
173
|
+
p.pairs.set(old, hints);
|
|
174
|
+
const strict = { ...p, delta: 0 };
|
|
175
|
+
for (const member of new Set([...Object.keys(old), ...Object.keys(hints)])) {
|
|
176
|
+
const a = old[member];
|
|
177
|
+
const b = hints[member];
|
|
178
|
+
if (a instanceof Map || a instanceof Set || b instanceof Map || b instanceof Set)
|
|
179
|
+
continue;
|
|
180
|
+
if (!same(a, b, member, strict))
|
|
181
|
+
return 0;
|
|
182
|
+
}
|
|
183
|
+
const whole = new Map();
|
|
184
|
+
const wholeSame = (member) => {
|
|
185
|
+
let known = whole.get(member);
|
|
186
|
+
if (known === undefined)
|
|
187
|
+
whole.set(member, (known = same(old[member], hints[member], member, { ...strict, pairs: new Map(p.pairs) })));
|
|
188
|
+
return known;
|
|
189
|
+
};
|
|
190
|
+
for (let i = 0; i < before.hintReads.length; i++) {
|
|
191
|
+
const [member, key] = before.hintReads[i];
|
|
192
|
+
const a = old[member];
|
|
193
|
+
const b = hints[member];
|
|
194
|
+
if (key === ALL_OF_IT || a === undefined || b === undefined) {
|
|
195
|
+
if (!wholeSame(member))
|
|
196
|
+
return i;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (key instanceof HintGroupRead) {
|
|
200
|
+
if (!(a instanceof Map) || !(b instanceof Map))
|
|
201
|
+
return i;
|
|
202
|
+
const before = groupHint(member, a).get(key.group) ?? [];
|
|
203
|
+
const now = groupHint(member, b).get(key.group) ?? [];
|
|
204
|
+
if (before.length !== now.length || !before.every(([k, v], n) => Object.is(k, now[n][0]) && same(v, now[n][1], member, strict)))
|
|
205
|
+
return i;
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (a.has(key) !== b.has(key))
|
|
209
|
+
return i;
|
|
210
|
+
if (a instanceof Map && b instanceof Map && !same(a.get(key), b.get(key), member, strict))
|
|
211
|
+
return i;
|
|
212
|
+
}
|
|
213
|
+
return before.hintReads.length;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=passSetups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passSetups.js","sourceRoot":"","sources":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,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;gBAAE,OAAO,CAAC,CAAC;YAC5I,SAAS;QACX,CAAC;QACD,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC;YAAE,OAAO,CAAC,CAAC;IACtG,CAAC;IACD,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/** A table another module keeps by an object of the document. */
|
|
2
|
+
type SideTable = WeakMap<object, unknown> | WeakSet<object>;
|
|
3
|
+
/** Name a side table kept by objects of the document being built: a
|
|
4
|
+
* checkpoint copies the entries of the objects it copies. Returns the
|
|
5
|
+
* table. */
|
|
6
|
+
export declare function passSideTable<T extends SideTable>(name: string, table: T): T;
|
|
7
|
+
/** What a checkpoint holds: a copy of every binding and variable on the
|
|
8
|
+
* tape, and the side-table entries of the objects copied. Opaque to its
|
|
9
|
+
* holders. */
|
|
10
|
+
export interface TapeImage {
|
|
11
|
+
bindings: Map<string, unknown>;
|
|
12
|
+
variables: Map<string, unknown>;
|
|
13
|
+
/** Entries of the side tables, by the copy of their key and the
|
|
14
|
+
* table's name (a pass's own weak collections are made anew by every
|
|
15
|
+
* pass, under the same names). */
|
|
16
|
+
side: {
|
|
17
|
+
key: object;
|
|
18
|
+
table: string;
|
|
19
|
+
value: unknown;
|
|
20
|
+
}[];
|
|
21
|
+
/** The image holds something a pass over other content could not take
|
|
22
|
+
* up: a function, an object of a class, an object of the setup with no
|
|
23
|
+
* number. It serves the pass that made it alone. */
|
|
24
|
+
opaque?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** A read of a whole hint collection (its size, its entries), in
|
|
27
|
+
* {@link PassTape.hintReads}. */
|
|
28
|
+
export declare const ALL_OF_IT: unique symbol;
|
|
29
|
+
/** A read of one group of a hint map ({@link PassTape.hintGroup}). */
|
|
30
|
+
export declare class HintGroupRead {
|
|
31
|
+
readonly group: string;
|
|
32
|
+
constructor(group: string);
|
|
33
|
+
}
|
|
34
|
+
/** The entries of the hint map `member` by group, in the map's order. */
|
|
35
|
+
export declare function groupHint(member: string, hints: ReadonlyMap<unknown, unknown>): Map<string, [unknown, unknown][]>;
|
|
36
|
+
/** How the end of the pass before is taken as the end of a pass that
|
|
37
|
+
* rejoined it (`passRejoin.ts`): the closed objects it holds of the
|
|
38
|
+
* pages the two passes share by place give way to this pass's
|
|
39
|
+
* (`stands`); a closed object of a page the edit changed that nothing
|
|
40
|
+
* stands for stops it (`gone`); and what is copied has its places in the
|
|
41
|
+
* source moved by the edit. */
|
|
42
|
+
export interface TapeTaken {
|
|
43
|
+
stands: ReadonlyMap<object, object>;
|
|
44
|
+
gone: ReadonlySet<object>;
|
|
45
|
+
at: number;
|
|
46
|
+
delta: number;
|
|
47
|
+
}
|
|
48
|
+
/** An object of the setup as a checkpoint names it when the pass's setup
|
|
49
|
+
* is numbered ({@link SetupNames}): by its number, which the same object
|
|
50
|
+
* of a later setup carries too. */
|
|
51
|
+
export declare class SetupRef {
|
|
52
|
+
readonly id: number;
|
|
53
|
+
constructor(id: number);
|
|
54
|
+
}
|
|
55
|
+
/** The numbers of the objects of a setup. */
|
|
56
|
+
export interface SetupNames {
|
|
57
|
+
idOf(value: object): number | undefined;
|
|
58
|
+
byId(id: number): object | undefined;
|
|
59
|
+
/** A number for an object that has none yet. */
|
|
60
|
+
name(value: object): number;
|
|
61
|
+
}
|
|
62
|
+
export declare class PassTape {
|
|
63
|
+
private readonly bindings;
|
|
64
|
+
private readonly variables;
|
|
65
|
+
/** The tables of this pass, beside the modules': the weak collections
|
|
66
|
+
* its factories track. */
|
|
67
|
+
private readonly tables;
|
|
68
|
+
private readonly tracked;
|
|
69
|
+
private readonly kept;
|
|
70
|
+
/** Whether a page was closed: a write to one then throws. */
|
|
71
|
+
closedAny: boolean;
|
|
72
|
+
/** The numbers of the setup's objects, when checkpoints are to outlive
|
|
73
|
+
* the pass (#1639): they then name those objects by number. */
|
|
74
|
+
names: SetupNames | undefined;
|
|
75
|
+
private readonly refs;
|
|
76
|
+
/** The highest content block read since {@link counting} began, and
|
|
77
|
+
* whether reads count now (not while the setup reads the whole list). */
|
|
78
|
+
readUpTo: number;
|
|
79
|
+
countsReads: boolean;
|
|
80
|
+
/** Whether the pass's checkpoints are to outlive it. */
|
|
81
|
+
recording: boolean;
|
|
82
|
+
/** Called once what follows the placing is done (`passReuse.ts`). */
|
|
83
|
+
afterFinish: (() => void) | undefined;
|
|
84
|
+
/** The hints the pass has read, in order: the member of the hints and
|
|
85
|
+
* the key asked of it, or `ALL_OF_IT` for a read of the whole
|
|
86
|
+
* collection. A checkpoint keeps how long the list was. */
|
|
87
|
+
hintReads: [member: string, key: unknown][];
|
|
88
|
+
/** `hints` as the pass is to read them when checkpoints outlive the
|
|
89
|
+
* pass: each map and set through a note of what was asked of it. A
|
|
90
|
+
* checkpoint then serves a later pass whose hints differ only in what
|
|
91
|
+
* had not been read yet (the cap of the last page, say). */
|
|
92
|
+
countingHints<T extends object>(hints: T): T;
|
|
93
|
+
/** The collections the pass was given, by what it reads them through. */
|
|
94
|
+
private readonly givenHints;
|
|
95
|
+
private readonly hintGroups;
|
|
96
|
+
/**
|
|
97
|
+
* The entries of the hint `member` (a map, as the pass reads it) that
|
|
98
|
+
* {@link HINT_GROUPS} puts in `group`, in the map's order. For a hint
|
|
99
|
+
* the pass looks up by something other than its key (the band caps, by
|
|
100
|
+
* the block their band opens with): the read is noted as a read of the
|
|
101
|
+
* group, not of the whole map, so that a cap for another band does not
|
|
102
|
+
* count as read here.
|
|
103
|
+
*/
|
|
104
|
+
hintGroup<K, V>(member: string, hints: ReadonlyMap<K, V>, group: string): readonly [K, V][];
|
|
105
|
+
private countingCollection;
|
|
106
|
+
/** Whether `value` is on the tape: state of the pass, not its setup. */
|
|
107
|
+
tracks(value: object): boolean;
|
|
108
|
+
/** `blocks` as the pass is to read it when checkpoints outlive the pass:
|
|
109
|
+
* through a counter of the highest block read, so that a checkpoint
|
|
110
|
+
* knows how far ahead of its block the pass had looked. */
|
|
111
|
+
counting<T extends object>(blocks: T[]): T[];
|
|
112
|
+
/** What the factories named, as they named it: read into the tables
|
|
113
|
+
* above only when a checkpoint is first asked for ({@link named}). A
|
|
114
|
+
* pass that takes none pays one list entry per factory. */
|
|
115
|
+
private pending;
|
|
116
|
+
/** Name the collections and objects `owner` changes during the pass. A
|
|
117
|
+
* weak collection becomes a side table of the pass. */
|
|
118
|
+
track(owner: string, bindings: Record<string, object>): void;
|
|
119
|
+
/** Read what {@link track} was given since the last call. */
|
|
120
|
+
private named;
|
|
121
|
+
/** Name a loose variable of `owner`. */
|
|
122
|
+
variable<T>(name: string, get: () => T, set: (value: T) => void): void;
|
|
123
|
+
/** Name the objects of the setup: everything reachable from `roots`
|
|
124
|
+
* that is not on the tape is kept by reference in a checkpoint. Call
|
|
125
|
+
* it after the factories that own what is tracked. */
|
|
126
|
+
atoms(roots: unknown): void;
|
|
127
|
+
/** Close `pages`: nothing of them is written from here on, so every
|
|
128
|
+
* checkpoint after this holds them by reference. Their objects are
|
|
129
|
+
* frozen, and a write to one throws: a pass that still had something to
|
|
130
|
+
* set on a page behind it is placed again from its first block, with no
|
|
131
|
+
* page closed. The objects of the setup they point at are left alone. */
|
|
132
|
+
close(pages: readonly unknown[]): void;
|
|
133
|
+
/** Give the tape pages it may write to again: the closed pages are left
|
|
134
|
+
* as they are, for the checkpoints that hold them, and the tape goes on
|
|
135
|
+
* with copies. For what comes after the blocks are placed, which sets
|
|
136
|
+
* things on every page. `finished`: pages and blocks that take, in
|
|
137
|
+
* place of a copy, the object given for them (what the build before
|
|
138
|
+
* made of the same page, #1639); those stay frozen. */
|
|
139
|
+
open(finished?: ReadonlyMap<object, object>): void;
|
|
140
|
+
/** `mode`: `thaw` copies what is frozen too (the closed pages); `name` writes the objects
|
|
141
|
+
* of the setup as their numbers and notes in `flags` what a later pass
|
|
142
|
+
* could not take up; `resolve` reads those numbers back as the objects
|
|
143
|
+
* of this pass's setup, and throws on a number it does not have. */
|
|
144
|
+
private copier;
|
|
145
|
+
/** A copy of everything on the tape. */
|
|
146
|
+
record(): TapeImage;
|
|
147
|
+
/** (`taken`: the image is the end of the pass before, taken as the end
|
|
148
|
+
* of this one where the two rejoined, see {@link TapeTaken}.)
|
|
149
|
+
* Put the tape back to `image`, which stays as it is: the collections
|
|
150
|
+
* are emptied and filled with a copy of it, in place, so that every
|
|
151
|
+
* closure that holds one sees it. */
|
|
152
|
+
putBack(image: TapeImage, taken?: TapeTaken): void;
|
|
153
|
+
/** Fill the tape with `fresh`, which becomes its own. */
|
|
154
|
+
private fill;
|
|
155
|
+
/** What the tape holds, for the code that reads it whole (the check of
|
|
156
|
+
* a resumed pass, the search for where two layouts rejoin). */
|
|
157
|
+
parts(): {
|
|
158
|
+
bindings: ReadonlyMap<string, object>;
|
|
159
|
+
variables: ReadonlyMap<string, {
|
|
160
|
+
get: () => unknown;
|
|
161
|
+
}>;
|
|
162
|
+
tables: readonly {
|
|
163
|
+
name: string;
|
|
164
|
+
table: WeakMap<object, unknown> | WeakSet<object>;
|
|
165
|
+
}[];
|
|
166
|
+
kept: ReadonlySet<object>;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/** The tape of the pass being run. */
|
|
170
|
+
export declare function passTape(): PassTape;
|
|
171
|
+
/** Run `pass` with a new tape. */
|
|
172
|
+
export declare function withPassTape<T>(pass: (tape: PassTape) => T): T;
|
|
173
|
+
/** Thrown out of a pass that wrote to a page it had closed, or that could
|
|
174
|
+
* not take up the checkpoint it started from: the pass is placed again
|
|
175
|
+
* from its first block, with no checkpoint. */
|
|
176
|
+
export declare class ClosedPageWrite extends Error {
|
|
177
|
+
}
|
|
178
|
+
export {};
|
|
179
|
+
//# sourceMappingURL=passTape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passTape.d.ts","sourceRoot":"","sources":["../../../src/pipeline/build/passTape.ts"],"names":[],"mappings":"AAqBA,iEAAiE;AACjE,KAAK,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAI5D;;aAEa;AACb,wBAAgB,aAAa,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAG5E;AAQD;;eAEe;AACf,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;;uCAEmC;IACnC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IACvD;;yDAEqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;kCACkC;AAClC,eAAO,MAAM,SAAS,eAAsB,CAAC;AAE7C,sEAAsE;AACtE,qBAAa,aAAa;IACZ,QAAQ,CAAC,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;CACnC;AAWD,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,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