From d53d86332aef81ec0999f047bb7c7243c825dd67 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 26 Oct 2026 21:15:21 +0800 Subject: [PATCH] fix(admin): ship the color picker styles in the naive-ui bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 工单状态弹窗的取色器糊成一团、像代码而不是颜色预览,根因不在页面代码: extract-naive-styles.mjs 把取色器样式路径写成了 color-picker/src/styles/indexcode/index.cssr.mjs,该路径不存在, import 抛 ERR_MODULE_NOT_FOUND 后被 catch 静默计数跳过,于是 build/naive-ui.css 里一条 .n-color-picker 规则都没有——组件没有边框、 没有高度、没有棋盘格色块,但页面不报错。 - 修正 color-picker 与 input-otp 的样式路径(两处都误写成 indexcode) - catch 改为显式报出路径不存在与模块结构异常,避免同类问题再次无声滑过 提取结果:成功 42 → 44,跳过 22 → 20,CSS 195.0 KB → 197.0 KB。 Co-Authored-By: Claude Fable 5 --- assets/admin/extract-naive-styles.mjs | 14 +++++++++++--- tools/admin-contract-report.json | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/assets/admin/extract-naive-styles.mjs b/assets/admin/extract-naive-styles.mjs index 8315f791..caabd2b7 100644 --- a/assets/admin/extract-naive-styles.mjs +++ b/assets/admin/extract-naive-styles.mjs @@ -86,13 +86,13 @@ const COMPONENT_STYLES = [ ['tree-select/src/styles/index.cssr.mjs'], ['tree/src/styles/index.cssr.mjs'], ['thing/src/styles/index.cssr.mjs'], - ['color-picker/src/styles/indexcode/index.cssr.mjs'], + ['color-picker/src/styles/index.cssr.mjs'], ['typography/src/styles/index.cssr.mjs'], ['auto-complete/src/styles/index.cssr.mjs'], ['cascader/src/styles/index.cssr.mjs'], ['dynamic-input/src/styles/index.cssr.mjs'], ['dynamic-tags/src/styles/index.cssr.mjs'], - ['input-otp/src/styles/indexcode/index.cssr.mjs'], + ['input-otp/src/styles/index.cssr.mjs'], // 过渡动画 ['_styles/transitions/fade-in-width-expand.cssr.mjs'], ['_styles/transitions/fade-in-height-expand.cssr.mjs'], @@ -138,7 +138,15 @@ async function extractStyles() { } } } catch (err) { - // 某些路径可能不存在或结构不同,跳过但不中断 + const code = err && err.code + // 路径写错时 import 会直接抛 MODULE_NOT_FOUND。这类错误必须显式报出来: + // 静默跳过的后果是组件样式整体缺失(取色器曾因此没有尺寸和边框,糊成一团), + // 而页面不报错,只能靠肉眼发现。 + if (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND') { + console.error(`[AKSRT] 样式路径不存在,已跳过: ${componentPath}`) + } else { + console.error(`[AKSRT] 样式提取异常,已跳过: ${componentPath}: ${err && err.message}`) + } failCount++ } } diff --git a/tools/admin-contract-report.json b/tools/admin-contract-report.json index 3f33eaa8..f1a4be59 100644 --- a/tools/admin-contract-report.json +++ b/tools/admin-contract-report.json @@ -1,5 +1,5 @@ { - "generated_at": "2026-10-26T12:40:28+00:00", + "generated_at": "2026-10-26T13:10:51+00:00", "errors": [], "warnings": [ "customPage tools-update section 'tools/update' not in PHP schema (ok if pure operational page)",