1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-02 14:54:14 +02:00

fix: unnecesary HMR when we opened setting page (#15756)

* refactor: add MarkerIdAssigner instead of processVueFile and remove transformedCodeCache object

* chore: add minimatch, a glob matcher

* chore: expose MarkerIdAssigner from plugin

* Revert "chore: expose MarkerIdAssigner from plugin"

This reverts commit 88c6d820f8.

* chore: add plugin to generate virtual module

* chore: parse inlining earlier

* chore: use virtual module in search

* chore: use remove old generation

* chore: fix type errors

* chore: add patch to workaround vitejs/vite#19792

* chore: improve filtering files to process

* chore: rename plugin

* docs: add comment for plugin ordering

* fix: unnecessary log

* fix: spdx license header
This commit is contained in:
anatawa12
2025-04-05 08:46:17 +09:00
committed by GitHub
parent ea9d85a0cc
commit 5949bb6c7f
12 changed files with 447 additions and 1382 deletions

View File

@@ -0,0 +1,43 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { searchIndexes as generated } from 'search-index:settings';
import type { GeneratedSearchIndexItem } from 'search-index:settings';
export type SearchIndexItem = {
id: string;
path?: string;
label: string;
keywords: string[];
icon?: string;
children?: SearchIndexItem[];
};
const rootMods = new Map(generated.map(item => [item.id, item]));
function walk(item: GeneratedSearchIndexItem) {
if (item.inlining) {
for (const id of item.inlining) {
const inline = rootMods.get(id);
if (inline) {
(item.children ??= []).push(inline);
rootMods.delete(id);
} else {
console.log('[Settings Search Index] Failed to inline', id);
}
}
}
for (const child of item.children ?? []) {
walk(child);
}
}
for (const item of generated) {
walk(item);
}
export const searchIndexes: SearchIndexItem[] = generated;