@collectui/bdui 0.1.10 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collectui/bdui",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Add BoardUI components to your project.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/hints.js CHANGED
@@ -11,11 +11,12 @@ export function itemHints(item) {
11
11
  const hints = [];
12
12
  const src = (item.files ?? []).map((f) => f.content ?? "").join("\n");
13
13
 
14
- // render 期读当前时间(new Date() / react-aria .toDate()):Next.js 16
15
- // Cache Components 预渲染会炸,官方目前 calendar 系如此
14
+ // render 期读当前时间(new Date() / react-aria .toDate()):在 Next.js
15
+ // Cache Components 下,这类组件参与 prerender 时可能炸 build(是否炸取
16
+ // 决于该组件是否在预渲染路径渲染——实测未渲染于预渲染页时不炸)
16
17
  if (/\bnew Date\(\)|\.toDate\(/.test(src)) {
17
18
  hints.push(
18
- "Note: this item reads the current time while rendering (per current registry source). On Next.js 16 Cache Components, wrap it in <Suspense> or `next build` prerendering fails."
19
+ "Note: this item reads the current time while rendering (per current registry source). Under Next.js Cache Components it can fail `next build` prerendering when it renders during prerender — wrap in <Suspense> if that happens (or preemptively)."
19
20
  );
20
21
  }
21
22
  return hints;
package/src/init.js CHANGED
@@ -182,13 +182,21 @@ export async function cmdInit(flags) {
182
182
  /^\s*import\s+["']\.\/globals\.css["'];?\s*$/.test(l)
183
183
  );
184
184
  const oldGlobals = path.join(project.sourceRoot, "app/globals.css");
185
- const oldIsTw =
186
- existsSync(oldGlobals) &&
187
- readFileSync(oldGlobals, "utf8").includes('@import "tailwindcss"');
188
- if (oldIdx !== -1 && oldIsTw) {
185
+ const oldContent = existsSync(oldGlobals)
186
+ ? readFileSync(oldGlobals, "utf8")
187
+ : "";
188
+ // 接管条件(r3 🔴 实测:no-tailwind CNA 的 body Arial 直接声明压过
189
+ // html 继承的 --font-inter,只追加不接管=全站 Arial):旧 globals 是
190
+ // Tailwind 入口或 CNA 默认存量(--background/--foreground 签名,含
191
+ // tailwind/no-tailwind 两形态)即替换;不像模板的自定义文件才追加
192
+ const oldIsTw = oldContent.includes('@import "tailwindcss"');
193
+ const oldIsCnaStock =
194
+ oldContent.includes("--background") &&
195
+ oldContent.includes("--foreground");
196
+ if (oldIdx !== -1 && (oldIsTw || oldIsCnaStock)) {
189
197
  lines[oldIdx] = 'import "@/styles/globals.css";';
190
198
  console.log(
191
- ` ${c.green("add")} ${rel}: replaced "./globals.css" → "@/styles/globals.css" (old file was a second Tailwind entry; merge custom styles into BoardUI's if needed)`
199
+ ` ${c.green("add")} ${rel}: replaced "./globals.css" → "@/styles/globals.css" (old file was a stock scaffold stylesheet whose body rules would override BoardUI; merge any custom styles into BoardUI's)`
192
200
  );
193
201
  } else {
194
202
  // 插到最后一个顶层 import 之后;没有 import 则插到文件头
@@ -206,6 +214,20 @@ export async function cmdInit(flags) {
206
214
  // 字体接线(r2 P4):theme.css 期望 --font-inter/--font-mono-source 由
207
215
  // next/font 暴露,模板默认 Geist 不定义它们,注入 Inter + JetBrains Mono
208
216
  if (!content.includes("--font-inter")) {
217
+ // 清理模板残留的 Geist 字体(注入 Inter 后纯属浪费带宽,r3 伴随问题)
218
+ const geistImport =
219
+ 'import { Geist, Geist_Mono } from "next/font/google";';
220
+ if (content.includes(geistImport) && content.includes("geistSans")) {
221
+ content = content
222
+ .replace(geistImport + "\n", "")
223
+ .replace(/const geistSans = Geist\(\{[\s\S]*?\}\);?\n+/, "")
224
+ .replace(/const geistMono = Geist_Mono\(\{[\s\S]*?\}\);?\n+/, "")
225
+ .replace(/\$\{geistSans\.variable\}\s*/g, "")
226
+ .replace(/\$\{geistMono\.variable\}\s*/g, "");
227
+ console.log(
228
+ ` ${c.green("add")} ${rel}: removed leftover Geist fonts (Inter takes over)`
229
+ );
230
+ }
209
231
  const lines = content.split("\n");
210
232
  let at = 0;
211
233
  for (let i = 0; i < lines.length; i++)