@openuji/speculator 0.1.0 → 0.2.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/README.md +15 -0
- package/dist/browser.cjs +908 -0
- package/dist/browser.d.cts +238 -0
- package/dist/browser.d.ts +238 -0
- package/dist/browser.js +26 -0
- package/dist/chunk-JAR5PGCK.js +862 -0
- package/dist/node.cjs +930 -0
- package/dist/node.d.cts +17 -0
- package/dist/node.d.ts +17 -0
- package/dist/node.js +47 -0
- package/package.json +28 -8
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -17
- package/dist/index.js.map +0 -1
- package/dist/markdown/index.d.ts +0 -5
- package/dist/markdown/index.d.ts.map +0 -1
- package/dist/markdown/index.js +0 -70
- package/dist/markdown/index.js.map +0 -1
- package/dist/markdown/plugins/cite.d.ts +0 -3
- package/dist/markdown/plugins/cite.d.ts.map +0 -1
- package/dist/markdown/plugins/cite.js +0 -36
- package/dist/markdown/plugins/cite.js.map +0 -1
- package/dist/markdown/plugins/concept.d.ts +0 -3
- package/dist/markdown/plugins/concept.d.ts.map +0 -1
- package/dist/markdown/plugins/concept.js +0 -30
- package/dist/markdown/plugins/concept.js.map +0 -1
- package/dist/markdown/plugins/idl.d.ts +0 -3
- package/dist/markdown/plugins/idl.d.ts.map +0 -1
- package/dist/markdown/plugins/idl.js +0 -28
- package/dist/markdown/plugins/idl.js.map +0 -1
- package/dist/pipeline/passes/boilerplate.d.ts +0 -3
- package/dist/pipeline/passes/boilerplate.d.ts.map +0 -1
- package/dist/pipeline/passes/boilerplate.js +0 -59
- package/dist/pipeline/passes/boilerplate.js.map +0 -1
- package/dist/pipeline/passes/diagnostics.d.ts +0 -3
- package/dist/pipeline/passes/diagnostics.d.ts.map +0 -1
- package/dist/pipeline/passes/diagnostics.js +0 -43
- package/dist/pipeline/passes/diagnostics.js.map +0 -1
- package/dist/pipeline/passes/idl.d.ts +0 -4
- package/dist/pipeline/passes/idl.d.ts.map +0 -1
- package/dist/pipeline/passes/idl.js +0 -188
- package/dist/pipeline/passes/idl.js.map +0 -1
- package/dist/pipeline/passes/references.d.ts +0 -3
- package/dist/pipeline/passes/references.d.ts.map +0 -1
- package/dist/pipeline/passes/references.js +0 -99
- package/dist/pipeline/passes/references.js.map +0 -1
- package/dist/pipeline/passes/toc.d.ts +0 -3
- package/dist/pipeline/passes/toc.d.ts.map +0 -1
- package/dist/pipeline/passes/toc.js +0 -30
- package/dist/pipeline/passes/toc.js.map +0 -1
- package/dist/pipeline/passes/xref.d.ts +0 -3
- package/dist/pipeline/passes/xref.d.ts.map +0 -1
- package/dist/pipeline/passes/xref.js +0 -132
- package/dist/pipeline/passes/xref.js.map +0 -1
- package/dist/pipeline/postprocess.d.ts +0 -6
- package/dist/pipeline/postprocess.d.ts.map +0 -1
- package/dist/pipeline/postprocess.js +0 -26
- package/dist/pipeline/postprocess.js.map +0 -1
- package/dist/speculator.d.ts +0 -40
- package/dist/speculator.d.ts.map +0 -1
- package/dist/speculator.js +0 -188
- package/dist/speculator.js.map +0 -1
- package/dist/types.d.ts +0 -146
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -16
- package/dist/types.js.map +0 -1
- package/dist/utils/file-loader.d.ts +0 -18
- package/dist/utils/file-loader.d.ts.map +0 -1
- package/dist/utils/file-loader.js +0 -100
- package/dist/utils/file-loader.js.map +0 -1
- package/dist/utils/strip-ident.d.ts +0 -2
- package/dist/utils/strip-ident.d.ts.map +0 -1
- package/dist/utils/strip-ident.js +0 -15
- package/dist/utils/strip-ident.js.map +0 -1
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.runIdlPass = runIdlPass;
|
|
37
|
-
const WebIDL2 = __importStar(require("webidl2"));
|
|
38
|
-
function norm(s) {
|
|
39
|
-
return s.toLowerCase().replace(/\s+/g, ' ').trim();
|
|
40
|
-
}
|
|
41
|
-
function slug(s) {
|
|
42
|
-
return s.trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
43
|
-
}
|
|
44
|
-
function uniqueId(doc, base) {
|
|
45
|
-
let id = base;
|
|
46
|
-
let i = 2;
|
|
47
|
-
while (doc.getElementById(id)) {
|
|
48
|
-
id = `${base}-${i++}`;
|
|
49
|
-
}
|
|
50
|
-
return id;
|
|
51
|
-
}
|
|
52
|
-
function collectTargetsFromAst(ast) {
|
|
53
|
-
const defs = [];
|
|
54
|
-
const addTop = (name) => {
|
|
55
|
-
const key = norm(name);
|
|
56
|
-
defs.push({ id: `idl-${slug(name)}`, key, text: name });
|
|
57
|
-
};
|
|
58
|
-
const addMember = (ifc, mem) => {
|
|
59
|
-
const key = `${norm(ifc)}.${norm(mem)}`;
|
|
60
|
-
defs.push({ id: `idl-${slug(ifc)}-${slug(mem)}`, key, text: `${ifc}.${mem}` });
|
|
61
|
-
};
|
|
62
|
-
for (const d of ast) {
|
|
63
|
-
switch (d.type) {
|
|
64
|
-
case 'interface':
|
|
65
|
-
case 'interface mixin':
|
|
66
|
-
case 'namespace':
|
|
67
|
-
case 'dictionary':
|
|
68
|
-
case 'callback interface':
|
|
69
|
-
case 'callback':
|
|
70
|
-
case 'typedef':
|
|
71
|
-
case 'enum': {
|
|
72
|
-
if (!('name' in d) || !d.name)
|
|
73
|
-
break;
|
|
74
|
-
addTop(d.name);
|
|
75
|
-
// members where applicable
|
|
76
|
-
if ('members' in d && Array.isArray(d.members)) {
|
|
77
|
-
for (const m of d.members) {
|
|
78
|
-
if (m.type === 'attribute' && m.name)
|
|
79
|
-
addMember(d.name, m.name);
|
|
80
|
-
else if (m.type === 'operation' && m.name)
|
|
81
|
-
addMember(d.name, m.name);
|
|
82
|
-
else if (m.type === 'const' && m.name)
|
|
83
|
-
addMember(d.name, m.name);
|
|
84
|
-
else if (m.type === 'field' && m.name)
|
|
85
|
-
addMember(d.name, m.name);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
// 'includes' doesn’t add new top-level names — skip
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return { defs };
|
|
94
|
-
}
|
|
95
|
-
/** Insert hidden anchors for each target before the given <pre>. */
|
|
96
|
-
function insertAnchorsBefore(pre, targets) {
|
|
97
|
-
if (!targets.length)
|
|
98
|
-
return;
|
|
99
|
-
const doc = pre.ownerDocument;
|
|
100
|
-
const wrapper = doc.createElement('div');
|
|
101
|
-
wrapper.className = 'idl-anchors';
|
|
102
|
-
wrapper.hidden = true; // JS property for broader envs
|
|
103
|
-
for (const t of targets) {
|
|
104
|
-
const a = doc.createElement('a');
|
|
105
|
-
a.id = uniqueId(doc, t.id);
|
|
106
|
-
a.textContent = t.text;
|
|
107
|
-
wrapper.appendChild(a);
|
|
108
|
-
}
|
|
109
|
-
pre.parentNode?.insertBefore(wrapper, pre);
|
|
110
|
-
}
|
|
111
|
-
/** Try to parse a string of IDL; return targets or throw. */
|
|
112
|
-
function parseIdlToTargets(idl) {
|
|
113
|
-
const ast = WebIDL2.parse(idl);
|
|
114
|
-
return collectTargetsFromAst(ast).defs;
|
|
115
|
-
}
|
|
116
|
-
/** Find candidate <pre> blocks containing IDL. */
|
|
117
|
-
function findIdlBlocks(root) {
|
|
118
|
-
const blocks = [];
|
|
119
|
-
const pres = root.querySelectorAll('pre');
|
|
120
|
-
pres.forEach((pre) => {
|
|
121
|
-
const cls = (pre.getAttribute('class') || '').toLowerCase();
|
|
122
|
-
const looksIdlClass = /\b(idl|language-idl)\b/.test(cls);
|
|
123
|
-
const code = pre.querySelector('code');
|
|
124
|
-
const text = (code ? code.textContent : pre.textContent) || '';
|
|
125
|
-
const maybeIdl = looksIdlClass || /^\s*(interface|dictionary|enum|namespace|callback|typedef)\b/.test(text);
|
|
126
|
-
if (maybeIdl && text.trim())
|
|
127
|
-
blocks.push(pre);
|
|
128
|
-
});
|
|
129
|
-
return blocks;
|
|
130
|
-
}
|
|
131
|
-
/** Build a map of resolvable IDL keys -> href based on parsed blocks. */
|
|
132
|
-
function buildIdlIndex(root, warnings) {
|
|
133
|
-
const map = new Map();
|
|
134
|
-
const blocks = findIdlBlocks(root);
|
|
135
|
-
for (const pre of blocks) {
|
|
136
|
-
const code = pre.querySelector('code');
|
|
137
|
-
const idl = (code ? code.textContent : pre.textContent) || '';
|
|
138
|
-
try {
|
|
139
|
-
const targets = parseIdlToTargets(idl);
|
|
140
|
-
insertAnchorsBefore(pre, targets);
|
|
141
|
-
for (const t of targets) {
|
|
142
|
-
const href = `#${t.id}`;
|
|
143
|
-
if (!map.has(t.key))
|
|
144
|
-
map.set(t.key, href);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
catch (e) {
|
|
148
|
-
const msg = e && e.message ? e.message : String(e);
|
|
149
|
-
warnings.push(`IDL parse error: ${msg}`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return map;
|
|
153
|
-
}
|
|
154
|
-
/** Resolve <a data-idl> anchors using the built index. */
|
|
155
|
-
function resolveIdlLinks(root, index, warnings, suppressClass) {
|
|
156
|
-
const anchors = root.querySelectorAll('a[data-idl]');
|
|
157
|
-
Array.from(anchors).forEach((a) => {
|
|
158
|
-
if (a.closest(`.${suppressClass}`))
|
|
159
|
-
return;
|
|
160
|
-
const raw = a.getAttribute('data-idl') || '';
|
|
161
|
-
const term = raw.trim();
|
|
162
|
-
const hasMember = term.includes('.');
|
|
163
|
-
let key = '';
|
|
164
|
-
if (hasMember) {
|
|
165
|
-
const [iface, member] = term.split('.', 2);
|
|
166
|
-
key = `${norm(iface)}.${norm(member)}`;
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
key = norm(term);
|
|
170
|
-
}
|
|
171
|
-
const href = index.get(key);
|
|
172
|
-
if (href) {
|
|
173
|
-
a.setAttribute('href', href);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
warnings.push(`Unresolved IDL link: "${term}"`);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
/** Public pass */
|
|
181
|
-
function runIdlPass(root, options) {
|
|
182
|
-
const warnings = [];
|
|
183
|
-
const suppressClass = options.diagnostics?.suppressClass ?? 'no-link-warnings';
|
|
184
|
-
const index = buildIdlIndex(root, warnings);
|
|
185
|
-
resolveIdlLinks(root, index, warnings, suppressClass);
|
|
186
|
-
return warnings;
|
|
187
|
-
}
|
|
188
|
-
//# sourceMappingURL=idl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"idl.js","sourceRoot":"","sources":["../../../src/pipeline/passes/idl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwJA,gCAMC;AA9JD,iDAAmC;AAKnC,SAAS,IAAI,CAAC,CAAS;IACrB,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACrD,CAAC;AAED,SAAS,IAAI,CAAC,CAAS;IACrB,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACpF,CAAC;AAED,SAAS,QAAQ,CAAC,GAAa,EAAE,IAAY;IAC3C,IAAI,EAAE,GAAG,IAAI,CAAC;IACd,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,CAAC;QAC9B,EAAE,GAAG,GAAG,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;IACxB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,qBAAqB,CAAC,GAA0B;IACvD,MAAM,IAAI,GAAgB,EAAE,CAAC;IAE7B,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE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":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAe,MAAM,SAAS,CAAC;AA6C/D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAuDtF"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runReferencesPass = runReferencesPass;
|
|
4
|
-
function ensureSection(root, id, title) {
|
|
5
|
-
let section = root.querySelector(`#${id}`);
|
|
6
|
-
if (!section) {
|
|
7
|
-
section = root.ownerDocument.createElement('section');
|
|
8
|
-
section.id = id;
|
|
9
|
-
section.innerHTML = `<h2>${title}</h2>`;
|
|
10
|
-
root.appendChild(section);
|
|
11
|
-
}
|
|
12
|
-
return section;
|
|
13
|
-
}
|
|
14
|
-
function ensureSubsection(parent, id, title) {
|
|
15
|
-
let sec = parent.querySelector(`#${id}`);
|
|
16
|
-
if (!sec) {
|
|
17
|
-
sec = parent.ownerDocument.createElement('section');
|
|
18
|
-
sec.id = id;
|
|
19
|
-
sec.innerHTML = `<h3>${title}</h3><ul></ul>`;
|
|
20
|
-
parent.appendChild(sec);
|
|
21
|
-
}
|
|
22
|
-
return sec;
|
|
23
|
-
}
|
|
24
|
-
function formatEntry(id, e) {
|
|
25
|
-
const parts = [];
|
|
26
|
-
// Label
|
|
27
|
-
parts.push(`<span class="ref-id">[${id}]</span>`);
|
|
28
|
-
// Title
|
|
29
|
-
if (e.href)
|
|
30
|
-
parts.push(`<a href="${e.href}">${e.title || id}</a>`);
|
|
31
|
-
else
|
|
32
|
-
parts.push(`<span class="ref-title">${e.title || id}</span>`);
|
|
33
|
-
// Metadata
|
|
34
|
-
const meta = [];
|
|
35
|
-
if (e.publisher)
|
|
36
|
-
meta.push(e.publisher);
|
|
37
|
-
if (e.status)
|
|
38
|
-
meta.push(e.status);
|
|
39
|
-
if (e.date)
|
|
40
|
-
meta.push(e.date);
|
|
41
|
-
if (meta.length)
|
|
42
|
-
parts.push(`<span class="ref-meta"> — ${meta.join(', ')}</span>`);
|
|
43
|
-
return parts.join(' ');
|
|
44
|
-
}
|
|
45
|
-
function idForRef(id) {
|
|
46
|
-
// stable, predictable
|
|
47
|
-
return `bib-${id.toLowerCase()}`;
|
|
48
|
-
}
|
|
49
|
-
function runReferencesPass(root, options) {
|
|
50
|
-
const warnings = [];
|
|
51
|
-
const biblio = options.biblio?.entries ?? {};
|
|
52
|
-
const cites = Array.from(root.querySelectorAll('a[data-spec]'));
|
|
53
|
-
if (!cites.length)
|
|
54
|
-
return warnings;
|
|
55
|
-
// Classify cites
|
|
56
|
-
const normative = new Set();
|
|
57
|
-
const informative = new Set();
|
|
58
|
-
for (const a of cites) {
|
|
59
|
-
const id = (a.getAttribute('data-spec') || '').trim();
|
|
60
|
-
const norm = (a.getAttribute('data-normative') || 'false') === 'true';
|
|
61
|
-
(norm ? normative : informative).add(id);
|
|
62
|
-
}
|
|
63
|
-
// Prefer Normative: if an id is normative, drop it from informative
|
|
64
|
-
for (const id of normative)
|
|
65
|
-
informative.delete(id);
|
|
66
|
-
// Build/refresh section skeleton
|
|
67
|
-
const refs = ensureSection(root, 'references', 'References');
|
|
68
|
-
const normSec = ensureSubsection(refs, 'normative-references', 'Normative references');
|
|
69
|
-
const infoSec = ensureSubsection(refs, 'informative-references', 'Informative references');
|
|
70
|
-
const renderList = (sec, ids) => {
|
|
71
|
-
const ul = sec.querySelector('ul');
|
|
72
|
-
ul.innerHTML = '';
|
|
73
|
-
Array.from(ids).sort((a, b) => a.localeCompare(b)).forEach(id => {
|
|
74
|
-
const li = root.ownerDocument.createElement('li');
|
|
75
|
-
li.id = idForRef(id);
|
|
76
|
-
const entry = biblio[id];
|
|
77
|
-
if (entry) {
|
|
78
|
-
li.innerHTML = formatEntry(id, entry);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
li.setAttribute('data-spec', id);
|
|
82
|
-
li.innerHTML = `<span class="ref-id">[${id}]</span> <span class="ref-missing">— unresolved reference</span>`;
|
|
83
|
-
warnings.push(`Unresolved reference: "${id}"`);
|
|
84
|
-
}
|
|
85
|
-
ul.appendChild(li);
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
renderList(normSec, normative);
|
|
89
|
-
renderList(infoSec, informative);
|
|
90
|
-
// Link in-text cites to their reference list item
|
|
91
|
-
for (const a of cites) {
|
|
92
|
-
const id = (a.getAttribute('data-spec') || '').trim();
|
|
93
|
-
const targetId = idForRef(id);
|
|
94
|
-
a.setAttribute('href', `#${targetId}`);
|
|
95
|
-
a.setAttribute('data-cite-ref', targetId); // useful for debugging
|
|
96
|
-
}
|
|
97
|
-
return warnings;
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=references.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"references.js","sourceRoot":"","sources":["../../../src/pipeline/passes/references.ts"],"names":[],"mappings":";;AA6CA,8CAuDC;AAlGD,SAAS,aAAa,CAAC,IAAa,EAAE,EAAU,EAAE,KAAa;IAC7D,IAAI,OAAO,GAAG,IAAI,CAAC,aAAa,CAAc,IAAI,EAAE,EAAE,CAAC,CAAC;IACxD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,IAAI,CAAC,aAAc,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACvD,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;QAChB,OAAO,CAAC,SAAS,GAAG,OAAO,KAAK,OAAO,CAAC;QACxC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAmB,EAAE,EAAU,EAAE,KAAa;IACtE,IAAI,GAAG,GAAG,MAAM,CAAC,aAAa,CAAc,IAAI,EAAE,EAAE,CAAC,CAAC;IACtD,IAAI,CAAC,GAAG,EAAE,CAAC;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AAM,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,YAAY,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC,uBAAuB;IACpE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toc.d.ts","sourceRoot":"","sources":["../../../src/pipeline/passes/toc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI,CA2B3E"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runTocPass = runTocPass;
|
|
4
|
-
function runTocPass(root, options) {
|
|
5
|
-
const { toc } = options;
|
|
6
|
-
if (toc?.enabled === false)
|
|
7
|
-
return;
|
|
8
|
-
const selector = toc?.selector ?? '#toc';
|
|
9
|
-
const mount = root.querySelector(selector);
|
|
10
|
-
if (!mount)
|
|
11
|
-
return;
|
|
12
|
-
const headings = Array.from(root.querySelectorAll('h2, h3'));
|
|
13
|
-
if (!headings.length)
|
|
14
|
-
return;
|
|
15
|
-
const doc = root.ownerDocument;
|
|
16
|
-
const ol = doc.createElement('ol');
|
|
17
|
-
ol.setAttribute('role', 'list');
|
|
18
|
-
for (const h of headings) {
|
|
19
|
-
if (!h.id)
|
|
20
|
-
continue;
|
|
21
|
-
const li = doc.createElement('li');
|
|
22
|
-
const depth = h.tagName.toLowerCase() === 'h3' ? 2 : 1;
|
|
23
|
-
li.setAttribute('data-depth', String(depth));
|
|
24
|
-
li.innerHTML = `<a href="#${h.id}">${h.textContent || ''}</a>`;
|
|
25
|
-
ol.appendChild(li);
|
|
26
|
-
}
|
|
27
|
-
mount.innerHTML = '';
|
|
28
|
-
mount.appendChild(ol);
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=toc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toc.js","sourceRoot":"","sources":["../../../src/pipeline/passes/toc.ts"],"names":[],"mappings":";;AAEA,gCA2BC;AA3BD,SAAgB,UAAU,CAAC,IAAa,EAAE,OAA2B;IACnE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACxB,IAAI,GAAG,EAAE,OAAO,KAAK,KAAK;QAAE,OAAO;IAEnC,MAAM,QAAQ,GAAG,GAAG,EAAE,QAAQ,IAAI,MAAM,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAc,QAAQ,CAAC,CAAC;IACxD,IAAI,CAAC,KAAK;QAAE,OAAO;IAEnB,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAc,QAAQ,CAAC,CAAC,CAAC;IAC1E,IAAI,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAO;IAE7B,MAAM,GAAG,GAAG,IAAI,CAAC,aAAc,CAAC;IAChC,MAAM,EAAE,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACnC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC,CAAC,EAAE;YAAE,SAAS;QACpB,MAAM,EAAE,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAE7C,EAAE,CAAC,SAAS,GAAG,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,WAAW,IAAI,EAAE,MAAM,CAAC;QAC/D,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;IACrB,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xref.d.ts","sourceRoot":"","sources":["../../../src/pipeline/passes/xref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAyFxD,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAqDhF"}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runXrefPass = runXrefPass;
|
|
4
|
-
function uniqueId(doc, base) {
|
|
5
|
-
let id = base;
|
|
6
|
-
let i = 2;
|
|
7
|
-
while (doc.getElementById(id))
|
|
8
|
-
id = `${base}-${i++}`;
|
|
9
|
-
return id;
|
|
10
|
-
}
|
|
11
|
-
function norm(term) {
|
|
12
|
-
return term.toLowerCase().replace(/\s+/g, ' ').trim();
|
|
13
|
-
}
|
|
14
|
-
function slugify(text) {
|
|
15
|
-
return text.trim().toLowerCase().replace(/[^\w]+/g, '-').replace(/^-+|-+$/g, '');
|
|
16
|
-
}
|
|
17
|
-
function isSuppressed(node, suppressClass) {
|
|
18
|
-
return !!node.closest(`.${suppressClass}`);
|
|
19
|
-
}
|
|
20
|
-
/** Build a local map of terms -> anchors from <dfn> and headings. */
|
|
21
|
-
function buildLocalMap(root) {
|
|
22
|
-
const map = new Map();
|
|
23
|
-
const doc = root.ownerDocument;
|
|
24
|
-
// 1) <dfn> terms (support data-lt="foo|bar,baz")
|
|
25
|
-
const dfns = root.querySelectorAll('dfn');
|
|
26
|
-
dfns.forEach(dfn => {
|
|
27
|
-
const text = (dfn.getAttribute('data-lt') || dfn.textContent || '').trim();
|
|
28
|
-
if (!text)
|
|
29
|
-
return;
|
|
30
|
-
// ensure an id so we can point to it
|
|
31
|
-
if (!dfn.id) {
|
|
32
|
-
// prefer first lt for id
|
|
33
|
-
const first = (text.split(/[|,]/)[0] || dfn.textContent || '').trim();
|
|
34
|
-
dfn.id = slugify(first);
|
|
35
|
-
}
|
|
36
|
-
const href = `#${dfn.id}`;
|
|
37
|
-
const variants = text
|
|
38
|
-
.split(/[|,]/)
|
|
39
|
-
.map(s => s.trim())
|
|
40
|
-
.filter(Boolean);
|
|
41
|
-
for (const v of variants) {
|
|
42
|
-
const key = norm(v);
|
|
43
|
-
if (!map.has(key)) {
|
|
44
|
-
map.set(key, { href, text: v, source: 'dfn' });
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
// 2) Headings (h2..h6) as fallback
|
|
49
|
-
const headings = root.querySelectorAll('h2, h3, h4, h5, h6');
|
|
50
|
-
headings.forEach(h => {
|
|
51
|
-
const label = (h.textContent || '').trim();
|
|
52
|
-
if (!label)
|
|
53
|
-
return;
|
|
54
|
-
// Prefer parent section id to avoid duplicate ids on heading + section
|
|
55
|
-
const parentSection = h.closest('section[id]');
|
|
56
|
-
let targetId = null;
|
|
57
|
-
if (parentSection) {
|
|
58
|
-
targetId = parentSection.id;
|
|
59
|
-
}
|
|
60
|
-
else if (h.id) {
|
|
61
|
-
targetId = h.id;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
const slug = slugify(label);
|
|
65
|
-
// generate a unique id that doesn't collide with anything
|
|
66
|
-
const uid = uniqueId(doc, slug);
|
|
67
|
-
h.id = uid;
|
|
68
|
-
targetId = uid;
|
|
69
|
-
}
|
|
70
|
-
if (!targetId)
|
|
71
|
-
return;
|
|
72
|
-
const key = norm(label);
|
|
73
|
-
if (!map.has(key)) {
|
|
74
|
-
map.set(key, { href: `#${targetId}`, text: label, source: 'heading' });
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
return map;
|
|
78
|
-
}
|
|
79
|
-
function runXrefPass(root, options) {
|
|
80
|
-
const suppressClass = options.diagnostics?.suppressClass ?? 'no-link-warnings';
|
|
81
|
-
const warnings = [];
|
|
82
|
-
const localMap = buildLocalMap(root);
|
|
83
|
-
// Make this an **array** to avoid TS/iterability issues
|
|
84
|
-
const xrefAnchors = Array.from(root.querySelectorAll('a[data-xref]'));
|
|
85
|
-
// 1) Resolve concept links locally
|
|
86
|
-
const unresolved = new Map();
|
|
87
|
-
for (const a of xrefAnchors) {
|
|
88
|
-
if (isSuppressed(a, suppressClass))
|
|
89
|
-
continue;
|
|
90
|
-
const term = a.getAttribute('data-xref') || '';
|
|
91
|
-
const key = norm(term);
|
|
92
|
-
const hit = localMap.get(key);
|
|
93
|
-
if (hit) {
|
|
94
|
-
a.setAttribute('href', hit.href);
|
|
95
|
-
// (optional) a.textContent = hit.text;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
const bucket = unresolved.get(key) || [];
|
|
99
|
-
bucket.push(a);
|
|
100
|
-
unresolved.set(key, bucket);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
// 2) Try external resolver if provided (optional; non-blocking)
|
|
104
|
-
const resolver = options.xref?.resolver;
|
|
105
|
-
if (resolver && unresolved.size) {
|
|
106
|
-
const queries = Array.from(unresolved.keys()).map(term => ({ term }));
|
|
107
|
-
resolver.resolveBatch(queries, options.xref?.specs)
|
|
108
|
-
.then(results => {
|
|
109
|
-
for (const [key, anchors] of unresolved.entries()) {
|
|
110
|
-
const res = results.get(key);
|
|
111
|
-
if (!res)
|
|
112
|
-
continue;
|
|
113
|
-
for (const a of anchors) {
|
|
114
|
-
a.setAttribute('href', res.href);
|
|
115
|
-
if (res.cite)
|
|
116
|
-
a.setAttribute('data-cite', res.cite);
|
|
117
|
-
}
|
|
118
|
-
unresolved.delete(key);
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
.catch(err => {
|
|
122
|
-
warnings.push(`Xref resolver failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
// 3) Anything still unresolved at this point: warn
|
|
126
|
-
for (const [key, anchors] of unresolved.entries()) {
|
|
127
|
-
const original = anchors[0].getAttribute('data-xref') || key;
|
|
128
|
-
warnings.push(`Unresolved xref: "${original}"`);
|
|
129
|
-
}
|
|
130
|
-
return warnings;
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=xref.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xref.js","sourceRoot":"","sources":["../../../src/pipeline/passes/xref.ts"],"names":[],"mappings":";;AAyFA,kCAqDC;AA5ID,SAAS,QAAQ,CAAC,GAAa,EAAE,IAAY;IAC3C,IAAI,EAAE,GAAG,IAAI,CAAC;IACd,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;QAAE,EAAE,GAAG,GAAG,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;IACrD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACxD,CAAC;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,YAAY,CAAC,IAAa,EAAE,aAAqB;IACx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C,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC;QAC7D,QAAQ,CAAC,IAAI,CAAC,qBAAqB,QAAQ,GAAG,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { PostprocessOptions } from '../types';
|
|
2
|
-
export interface PipelineResult {
|
|
3
|
-
warnings: string[];
|
|
4
|
-
}
|
|
5
|
-
export declare function postprocess(container: Element, options?: PostprocessOptions): Promise<PipelineResult>;
|
|
6
|
-
//# sourceMappingURL=postprocess.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postprocess.d.ts","sourceRoot":"","sources":["../../src/pipeline/postprocess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAQnD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAsB,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,cAAc,CAAC,CAyB/G"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.postprocess = postprocess;
|
|
4
|
-
const xref_1 = require("./passes/xref");
|
|
5
|
-
const references_1 = require("./passes/references");
|
|
6
|
-
const toc_1 = require("./passes/toc");
|
|
7
|
-
const idl_1 = require("./passes/idl");
|
|
8
|
-
const diagnostics_1 = require("./passes/diagnostics");
|
|
9
|
-
const boilerplate_1 = require("./passes/boilerplate");
|
|
10
|
-
async function postprocess(container, options = {}) {
|
|
11
|
-
const warnings = [];
|
|
12
|
-
// 1) IDL: parse blocks, export anchors, resolve {{ ... }}
|
|
13
|
-
warnings.push(...(0, idl_1.runIdlPass)(container, options));
|
|
14
|
-
// 2) Concepts: resolve [= ... =] locally (and possibly externally in future)
|
|
15
|
-
warnings.push(...(0, xref_1.runXrefPass)(container, options));
|
|
16
|
-
// 3) Build references section skeleton from [[...]] anchors
|
|
17
|
-
warnings.push(...(0, references_1.runReferencesPass)(container, options));
|
|
18
|
-
// 4) Boilerplate (insert after cites/refs so it can mount before/after them)
|
|
19
|
-
(0, boilerplate_1.runBoilerplatePass)(container, options);
|
|
20
|
-
// 5) ToC
|
|
21
|
-
(0, toc_1.runTocPass)(container, options);
|
|
22
|
-
// 6) Diagnostics sweep (duplicates + missing hrefs, etc.)
|
|
23
|
-
warnings.push(...(0, diagnostics_1.runDiagnosticsPass)(container, options.diagnostics));
|
|
24
|
-
return { warnings };
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=postprocess.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postprocess.js","sourceRoot":"","sources":["../../src/pipeline/postprocess.ts"],"names":[],"mappings":";;AAYA,kCAyBC;AApCD,wCAA4C;AAC5C,oDAAwD;AACxD,sCAA0C;AAC1C,sCAA0C;AAC1C,sDAA0D;AAC1D,sDAA0D;AAMnD,KAAK,UAAU,WAAW,CAAC,SAAkB,EAAE,UAA8B,EAAE;IACpF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAG9B,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAA,gBAAU,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAEjD,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAA,kBAAW,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAElD,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAA,8BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAExD,6EAA6E;IAC7E,IAAA,gCAAkB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEvC,SAAS;IACT,IAAA,gBAAU,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAE/B,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAA,gCAAkB,EAAC,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IAIrE,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC"}
|
package/dist/speculator.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { SpeculatorOptions, ProcessingResult } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Main Speculator renderer class
|
|
4
|
-
*/
|
|
5
|
-
export declare class Speculator {
|
|
6
|
-
private readonly baseUrl;
|
|
7
|
-
private readonly fileLoader;
|
|
8
|
-
private readonly markdownOptions;
|
|
9
|
-
private readonly postprocessOptions;
|
|
10
|
-
constructor(options?: SpeculatorOptions);
|
|
11
|
-
/**
|
|
12
|
-
* Process a single DOM element
|
|
13
|
-
*/
|
|
14
|
-
processElement(element: Element): Promise<ProcessingResult>;
|
|
15
|
-
/**
|
|
16
|
-
* Process data-include attribute
|
|
17
|
-
*/
|
|
18
|
-
private processDataInclude;
|
|
19
|
-
/**
|
|
20
|
-
* Process data-format attribute
|
|
21
|
-
*/
|
|
22
|
-
private processDataFormat;
|
|
23
|
-
/**
|
|
24
|
-
* Process content based on format
|
|
25
|
-
*/
|
|
26
|
-
private processContent;
|
|
27
|
-
/**
|
|
28
|
-
* Resolve file path relative to baseUrl
|
|
29
|
-
*/
|
|
30
|
-
private resolveFilePath;
|
|
31
|
-
/**
|
|
32
|
-
* Process an entire document
|
|
33
|
-
*/
|
|
34
|
-
renderDocument(container: Element): Promise<ProcessingResult>;
|
|
35
|
-
/**
|
|
36
|
-
* Process HTML string and return processed HTML
|
|
37
|
-
*/
|
|
38
|
-
renderHTML(html: string): Promise<string>;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=speculator.d.ts.map
|
package/dist/speculator.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"speculator.d.ts","sourceRoot":"","sources":["../src/speculator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAKjB,MAAM,SAAS,CAAC;AAKjB;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuC;IACvE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAmC;gBAE1D,OAAO,GAAE,iBAAsB;IAO3C;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAuCjE;;OAEG;YACW,kBAAkB;IAoChC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAsBzB;;OAEG;IACH,OAAO,CAAC,cAAc;IAWtB;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACG,cAAc,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqDnE;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAYhD"}
|