From e72f4fd61d2a05740247e9702fdf5b983781c656 Mon Sep 17 00:00:00 2001 From: tai-cha Date: Mon, 3 Mar 2025 01:06:53 +0900 Subject: [PATCH] =?UTF-8?q?path=E3=81=AE=E5=85=A5=E5=8A=9B=E3=82=92?= =?UTF-8?q?=E7=9C=81=E7=95=A5=E5=8F=AF=E8=83=BD=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/lib/vite-plugin-create-search-index.ts | 7 +++++-- .../frontend/src/scripts/autogen/settings-search-index.ts | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/frontend/lib/vite-plugin-create-search-index.ts b/packages/frontend/lib/vite-plugin-create-search-index.ts index 120ec8d132..2d7d71473d 100644 --- a/packages/frontend/lib/vite-plugin-create-search-index.ts +++ b/packages/frontend/lib/vite-plugin-create-search-index.ts @@ -740,7 +740,7 @@ function extractLabelsAndKeywords(nodes: VueAstNode[]): { label: string | null, function extractUsageInfoFromTemplateAst( templateAst: any, - code: string, + id: string, ): SearchIndexItem[] { const allMarkers: SearchIndexItem[] = []; const markerMap = new Map(); @@ -789,6 +789,9 @@ function extractUsageInfoFromTemplateAst( } } + //pathがない場合はファイルパスを設定 + if (markerInfo.path == null && parentId == null) markerInfo.path = id.match(/.*(\/settings\/[^\/]+)\.vue$/)?.[1]; + // SearchLabelとSearchKeywordを抽出 (AST全体を探索) if (node.children && Array.isArray(node.children)) { console.log(`Processing marker ${markerId} for labels and keywords`); @@ -1050,7 +1053,7 @@ export async function analyzeVueProps(options: { continue; // エラーが発生したファイルはスキップ } - const fileMarkers = extractUsageInfoFromTemplateAst(descriptor.template?.ast, options.transformedCodeCache[id]); + const fileMarkers = extractUsageInfoFromTemplateAst(descriptor.template?.ast, id); if (fileMarkers && fileMarkers.length > 0) { allMarkers.push(...fileMarkers); // すべてのマーカーを収集 diff --git a/packages/frontend/src/scripts/autogen/settings-search-index.ts b/packages/frontend/src/scripts/autogen/settings-search-index.ts index bddcc70e7f..49e30e29df 100644 --- a/packages/frontend/src/scripts/autogen/settings-search-index.ts +++ b/packages/frontend/src/scripts/autogen/settings-search-index.ts @@ -502,6 +502,7 @@ export const searchIndexes:SearchIndexItem[] = [ label: i18n.ts.general, keywords: ['general'], icon: 'ti ti-adjustments', + path: '/settings/general', }, ] as const;