refactor: React 组件消费改叶子路径直连,桶 chunk 不再进产物
CI / check (pull_request) Successful in 3m0s

./react 伞入口仍是裸桶:打包器不做摇树,任一组件的导入都会让页面闭包
拉满全部 14 个组件模块。本次把仓内 31 处伞入口引用改为
'@idealjs/stack-ui-kit/react/<叶子路径>' 直连(react/components/* 与
react/hooks/useControllableState);./react 桶出口保留作 React 层伞入口。

配套:
- site-ui-kit tsconfig 补 ui-kit react 子路径 paths——此前零 paths、靠包
  exports 解析,而 TS bundler 模式对 exports 通配目标不做扩展名探测
  (traceResolution 实证),叶子路径必须走 paths;
- tutorial tsconfig 补 react/* 通配映射,清掉指向不存在文件的 components
  幽灵映射(#66 时代遗留)。

页面闭包从「任意导入拉满 14 组件」变为按需直连:html/index 页闭包内
react 组件 7 个(Dock 三件、BrowserMockup、Scatter、ShadowCard 不再被
强制拉入),dist 桶 chunk 消失(183→181 模块)。DOM 与视觉产物不变,
159 条 e2e(含 28 张视觉基线)原样通过。
This commit is contained in:
arnold.cui-agent committed 2026-11-29 19:03:10 +08:00
1 parent 84a79735eb
commit 5cee0913d1
33 files changed
+71 -42

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
import type { TicketProps } from '@idealjs/stack-ui-kit/react/components/Ticket'
import type { Page } from '@playwright/test'
import { expect, test } from '@playwright/test'
import type { TicketProps } from '@idealjs/stack-ui-kit/react'
const PAGES = [
'/design/',
+2 -1
View File
@@ -1,5 +1,6 @@
import { Dropdown } from '@idealjs/stack-ui-kit/react/components/dock/Dropdown'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Dropdown } from '@idealjs/stack-ui-kit/react'
import type { ReactNode } from 'react'
export function AgentDock({
+2 -1
View File
@@ -1,5 +1,6 @@
import { BrickDot, Mark, Tri } from '@idealjs/stack-ui-kit/react/components/shapes'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { BrickDot, Mark, Tri } from '@idealjs/stack-ui-kit/react'
import type { ReactNode } from 'react'
import { MONTHS, monthOf, POSTS } from '../content/blogs'
import { type PageKey, relHref } from '../lib/pages'
+2 -2
View File
@@ -1,7 +1,7 @@
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Mark, Ring, Tri, Wave } from '@idealjs/stack-ui-kit/react'
import type { ChapterId } from '@idealjs/stack-site-ui-kit'
import { BrickDots } from '@idealjs/stack-site-ui-kit'
import { Mark, Ring, Tri, Wave } from '@idealjs/stack-ui-kit/react/components/shapes'
import * as styles from '@idealjs/stack-ui-kit/styles'
import type { CSSProperties, ReactNode } from 'react'
import { CHAPTERS, CONTENT } from '../lib/chapters'
import { Page, Section } from '../lib/ui'
@@ -1,5 +1,6 @@
import { Dropdown } from '@idealjs/stack-ui-kit/react/components/dock/Dropdown'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Dropdown } from '@idealjs/stack-ui-kit/react'
import type { ReactNode } from 'react'
export function ChecklistDock({
@@ -1,5 +1,6 @@
import { DockSheet } from '@idealjs/stack-ui-kit/react/components/dock/DockSheet'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { DockSheet } from '@idealjs/stack-ui-kit/react'
import type { ReactNode } from 'react'
import { useEffect, useState } from 'react'
+2 -1
View File
@@ -1,5 +1,6 @@
import { Dropdown } from '@idealjs/stack-ui-kit/react/components/dock/Dropdown'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Dropdown } from '@idealjs/stack-ui-kit/react'
import type { ReactNode } from 'react'
export function TipsDock({
+2 -1
View File
@@ -1,5 +1,6 @@
import { Button } from '@idealjs/stack-ui-kit/react/components/Button'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Button } from '@idealjs/stack-ui-kit/react'
import { relHref } from '../../lib/pages'
import { Page, Section } from '../../lib/ui'
@@ -1,5 +1,3 @@
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Button, Mark, ShadowButton, ShadowCard } from '@idealjs/stack-ui-kit/react'
import {
ChapterTicket,
EntryGuide,
@@ -9,6 +7,11 @@ import {
RoutableScene,
RouteLine,
} from '@idealjs/stack-site-ui-kit'
import { Button } from '@idealjs/stack-ui-kit/react/components/Button'
import { ShadowButton } from '@idealjs/stack-ui-kit/react/components/ShadowButton'
import { ShadowCard } from '@idealjs/stack-ui-kit/react/components/ShadowCard'
import { Mark } from '@idealjs/stack-ui-kit/react/components/shapes'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { CHAPTERS, PROFILES } from '../../lib/chapters'
import { relHref } from '../../lib/pages'
import { Page, Section } from '../../lib/ui'
@@ -1,5 +1,7 @@
import { BrowserMockup } from '@idealjs/stack-ui-kit/react/components/BrowserMockup'
import { ShadowButton } from '@idealjs/stack-ui-kit/react/components/ShadowButton'
import { Mark } from '@idealjs/stack-ui-kit/react/components/shapes'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { BrowserMockup, Mark, ShadowButton } from '@idealjs/stack-ui-kit/react'
export function BrowserMockupPreview() {
return (
@@ -1,5 +1,6 @@
import { Dropdown } from '@idealjs/stack-ui-kit/react/components/dock/Dropdown'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Dropdown } from '@idealjs/stack-ui-kit/react'
import { useState } from 'react'
const ZONE_BASE = `${styles.tSmallMute} rounded-xl border-2 border-dashed ${styles.borderInk25} px-2.5 pt-1.5`
@@ -1,5 +1,6 @@
import { Ticket } from '@idealjs/stack-ui-kit/react/components/Ticket'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Ticket } from '@idealjs/stack-ui-kit/react'
import { useState } from 'react'
export function TicketPreview() {
@@ -1,6 +1,6 @@
import * as styles from '@idealjs/stack-ui-kit/styles'
import { ShadowButton } from '@idealjs/stack-ui-kit/react'
import { ChapterTicket } from '@idealjs/stack-site-ui-kit'
import { ShadowButton } from '@idealjs/stack-ui-kit/react/components/ShadowButton'
import * as styles from '@idealjs/stack-ui-kit/styles'
import type { ReactNode } from 'react'
import { CHAPTERS } from '../../lib/chapters'
import { Page, Section } from '../../lib/ui'
@@ -1,5 +1,6 @@
import { BrickDot, Mark, Ring, Tri, Wave } from '@idealjs/stack-ui-kit/react/components/shapes'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { BrickDot, Mark, Ring, Tri, Wave } from '@idealjs/stack-ui-kit/react'
import type { ReactNode } from 'react'
import { Page, Section } from '../../lib/ui'
+2 -1
View File
@@ -1,5 +1,6 @@
import { Button } from '@idealjs/stack-ui-kit/react/components/Button'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Button } from '@idealjs/stack-ui-kit/react'
import { relHref } from '../../lib/pages'
import { Page, Section } from '../../lib/ui'
+2 -1
View File
@@ -1,5 +1,6 @@
import { Button } from '@idealjs/stack-ui-kit/react/components/Button'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Button } from '@idealjs/stack-ui-kit/react'
import { MONTHS } from '../../content/blogs'
import { relHref } from '../../lib/pages'
import { Page } from '../../lib/ui'
+2 -1
View File
@@ -1,5 +1,6 @@
import { Button } from '@idealjs/stack-ui-kit/react/components/Button'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { Button } from '@idealjs/stack-ui-kit/react'
import { relHref } from '../../lib/pages'
import { Page, Section } from '../../lib/ui'
+3 -1
View File
@@ -1,4 +1,3 @@
import { BrowserMockup, Button, Mark } from '@idealjs/stack-ui-kit/react'
import type { DataFlowStep, ToolboxBrick } from '@idealjs/stack-site-ui-kit'
import {
BrickToolbox,
@@ -6,6 +5,9 @@ import {
DataFlowBoard,
StickyNote,
} from '@idealjs/stack-site-ui-kit'
import { BrowserMockup } from '@idealjs/stack-ui-kit/react/components/BrowserMockup'
import { Button } from '@idealjs/stack-ui-kit/react/components/Button'
import { Mark } from '@idealjs/stack-ui-kit/react/components/shapes'
import { relHref } from '../../lib/pages'
import { Page, Section } from '../../lib/ui'
import { TodoPreview } from './components/TodoPreview'
@@ -1,4 +1,4 @@
import { ShadowButton } from '@idealjs/stack-ui-kit/react'
import { ShadowButton } from '@idealjs/stack-ui-kit/react/components/ShadowButton'
import { useEffect, useRef, useState } from 'react'
import { Joyride } from 'react-joyride'
import type { TourAction } from './tourSteps'
@@ -1,4 +1,4 @@
import { ShadowButton } from '@idealjs/stack-ui-kit/react'
import { ShadowButton } from '@idealjs/stack-ui-kit/react/components/ShadowButton'
import type { Step } from 'react-joyride'
export const INTRO = 0
@@ -1,5 +1,6 @@
import { DockModal } from '@idealjs/stack-ui-kit/react/components/dock/DockModal'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { DockModal } from '@idealjs/stack-ui-kit/react'
import { useState } from 'react'
import type { LlmConfig } from '../lib/agent/llm'
+2 -2
View File
@@ -1,6 +1,6 @@
import * as styles from '@idealjs/stack-ui-kit/styles'
import { ShadowButton } from '@idealjs/stack-ui-kit/react'
import runtimeDoc from 'virtual:web-runner-doc'
import { ShadowButton } from '@idealjs/stack-ui-kit/react/components/ShadowButton'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { RUNTIME_ORIGIN, usePlayground } from './context'
import { OutputPanel } from './OutputPanel'
+2 -2
View File
@@ -21,10 +21,10 @@
"@idealjs/stack-ui-kit/themes": ["../../packages/stack-ui-kit/src/themes/index.ts"],
"@idealjs/stack-ui-kit/tokens": ["../../packages/stack-ui-kit/src/tokens/index.ts"],
"@idealjs/stack-ui-kit/styles": ["../../packages/stack-ui-kit/src/styles/index.ts"],
"@idealjs/stack-ui-kit/components": ["../../packages/stack-ui-kit/src/components/index.ts"],
"@idealjs/stack-ui-kit/stack-plugin": ["../../packages/stack-ui-kit/stack-plugin/index.ts"],
"@idealjs/stack-site-ui-kit": ["../../packages/stack-site-ui-kit/src/index.ts"],
"@idealjs/stack-site-ui-kit/*": ["../../packages/stack-site-ui-kit/*"]
"@idealjs/stack-site-ui-kit/*": ["../../packages/stack-site-ui-kit/*"],
"@idealjs/stack-ui-kit/react/*": ["../../packages/stack-ui-kit/src/react/*"]
}
},
"include": ["src", "stack.config.ts", "stack-plugins"]
@@ -1,4 +1,4 @@
import { Ticket, TicketProps } from '@idealjs/stack-ui-kit/react'
import { Ticket, type TicketProps } from '@idealjs/stack-ui-kit/react/components/Ticket'
import { ticketStub, ticketTitle } from '@idealjs/stack-ui-kit/styles'
import type { Chapter } from '../types'
import {
@@ -1,5 +1,5 @@
import { Ring, Tri } from '@idealjs/stack-ui-kit/react'
import { hoverHost, hoverableShadow, shadowInk } from '@idealjs/stack-ui-kit/styles'
import { Ring, Tri } from '@idealjs/stack-ui-kit/react/components/shapes'
import { hoverableShadow, hoverHost, shadowInk } from '@idealjs/stack-ui-kit/styles'
import { type ReactNode, useEffect, useRef, useState } from 'react'
import type { Chapter } from '../types'
import {
@@ -1,5 +1,9 @@
import {
ShadowButton,
shadowButtonClasses,
} from '@idealjs/stack-ui-kit/react/components/ShadowButton'
import * as styles from '@idealjs/stack-ui-kit/styles'
import { ShadowButton, shadowButtonClasses } from '@idealjs/stack-ui-kit/react'
import type { CSSProperties, ReactNode } from 'react'
import { Fragment } from 'react'
@@ -1,4 +1,7 @@
import { ShadowButton, shadowButtonClasses } from '@idealjs/stack-ui-kit/react'
import {
ShadowButton,
shadowButtonClasses,
} from '@idealjs/stack-ui-kit/react/components/ShadowButton'
import * as styles from '@idealjs/stack-ui-kit/styles'
import type { NavRowGroup, NavSectionLink } from './SiteNavbar'
import {
@@ -1,4 +1,4 @@
import { ToggleButton } from '@idealjs/stack-ui-kit/react'
import { ToggleButton } from '@idealjs/stack-ui-kit/react/components/ToggleButton'
import type { LearningTone } from './shared'
import { toneStyle } from './shared'
@@ -1,4 +1,4 @@
import { FlipCard } from '@idealjs/stack-ui-kit/react'
import { FlipCard } from '@idealjs/stack-ui-kit/react/components/FlipCard'
import type { ReactNode } from 'react'
import type { LearningTone } from './shared'
import { toneStyle } from './shared'
@@ -1,6 +1,4 @@
import { Tabs } from '@idealjs/stack-ui-kit/react'
import type { TabItem, TabsProps } from '@idealjs/stack-ui-kit/react'
import { type TabItem, Tabs, type TabsProps } from '@idealjs/stack-ui-kit/react/components/Tabs'
export type FolderTab = TabItem
export interface FolderTabsProps {
@@ -1,3 +1,5 @@
export { useControllableState as useLearningState } from '@idealjs/stack-ui-kit/react/hooks/useControllableState'
import type { CSSProperties } from 'react'
export type LearningTone = 'coral' | 'teal' | 'yellow' | 'violet' | 'pink' | 'blue'
@@ -14,5 +16,3 @@ const COLORS: Record<LearningTone, string> = {
export function toneStyle(tone: LearningTone): CSSProperties {
return { '--learning-accent': COLORS[tone] } as CSSProperties
}
export { useControllableState as useLearningState } from '@idealjs/stack-ui-kit/react'
@@ -1,4 +1,4 @@
import { Mark } from '@idealjs/stack-ui-kit/react'
import { Mark } from '@idealjs/stack-ui-kit/react/components/shapes'
import type { ReactNode } from 'react'
import { Bookmark } from '../components/learning/Bookmark'
import { BrickToolbox } from '../components/learning/BrickToolbox'
+5 -1
View File
@@ -14,7 +14,11 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"paths": {
"@idealjs/stack-ui-kit/react": ["../../packages/stack-ui-kit/src/react/index.ts"],
"@idealjs/stack-ui-kit/react/*": ["../../packages/stack-ui-kit/src/react/*"]
}
},
"include": ["src"]
}