Compare commits

..

No commits in common. "a44c691c5c12466fff273a2ae59428f4c3e76dda" and "8cb334c91d95075cd49ee3180eb9e452e8b48f62" have entirely different histories.

2 changed files with 8 additions and 5 deletions

View File

@ -100,15 +100,14 @@ type WalkVueNode = RootNode | TemplateChildNode | SimpleExpressionNode;
*/
function walkVueElements<C extends {} | null>(nodes: WalkVueNode[], context: C, callback: (node: ElementNode, context: C) => C | undefined | void | false): void {
for (const node of nodes) {
let currentContext = context;
if (node.type === NodeTypes.COMPOUND_EXPRESSION) throw new Error("Unexpected COMPOUND_EXPRESSION");
if (node.type === NodeTypes.ELEMENT) {
const result = callback(node, context);
if (result === false) return;
if (result !== undefined) currentContext = result;
if (result !== undefined) context = result;
}
if ('children' in node) {
walkVueElements(node.children, currentContext, callback);
walkVueElements(node.children, context, callback);
}
}
}

View File

@ -17,13 +17,13 @@ export type SearchIndexItem = {
const rootMods = new Map(generated.map(item => [item.id, item]));
// link inlining here
for (const item of generated) {
function walk(item: GeneratedSearchIndexItem) {
if (item.inlining) {
for (const id of item.inlining) {
const inline = rootMods.get(id);
if (inline) {
inline.parentId = item.id;
rootMods.delete(id);
} else {
console.log('[Settings Search Index] Failed to inline', id);
}
@ -31,5 +31,9 @@ for (const item of generated) {
}
}
for (const item of generated) {
walk(item);
}
export const searchIndexes: SearchIndexItem[] = generated;