Repository navigation
fix(deps): per-icon lucide-solid imports to shrink vite transform burst (#389) - #433
Conversation
…st (#389) Barrel imports from lucide-solid pulled all ~1700 icon modules through the vite transform on every cold start (92% of @conciv/app's vitest-browser cold-start import burst). Converted every value import across the 54 files that used the barrel to per-icon default imports resolved from lucide-solid's actual export map, and added a no-restricted-imports guard so the barrel can't come back (type-only imports still allowed). lucide-solid ships no "type": "module" field and shares one ambient .d.ts across its import/require/browser export conditions, so under this repo's strict NodeNext module resolution the per-icon default export types as the whole module namespace instead of the icon component (TS2604). A wildcard ambient override (`declare module 'lucide-solid/icons/*'`) does not fix this: TypeScript only consults wildcard ambient modules when normal resolution fails, and it succeeds here (just with the wrong shape). Exact-specifier module augmentation does override the resolved type, so each affected package gets one generated src/lucide-solid-icons.d.ts (or src/cards/lucide-solid-icons.d.ts where the cards tsconfig scopes separately) with one declare-module block per icon in the repo-wide union, identical content everywhere. apps/conciv needs no shim: its tsconfig uses moduleResolution: "bundler", which isn't affected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR adds the ChangesLucide direct import migration
Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/ui-kit-system/src/lucide-solid-icons.d.ts (1)
1-475: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift11 byte-identical 475-line declaration files. Each file declares the same 66
lucide-solid/icons/*modules with the same body. The shared root cause is the generator: it emits the union of all icons into every package instead of emitting one shared declaration that packages reference. This adds about 5,200 duplicated lines and creates drift risk, because adding one icon requires regenerating 11 files.Two additional consequences:
- Each package declares icons it does not import. For example, the tanstack extension uses one icon.
declare module 'lucide-solid/icons/<name>'is a global augmentation. If two of these packages are ever compiled in one TypeScript program, the duplicate module declarations conflict.Recommended direction: publish one declaration file from a single shared package, then reference it from each package
tsconfig.jsonthroughtypesor an include path. Keep the generator, but have it write one file.Note the path inconsistency as well: 9 files sit at
<package>/src/, but two sit undersrc/cards/. Align them if the per-package files are kept.
packages/ui-kit-system/src/lucide-solid-icons.d.ts#L1-L475: keep this as the single source of truth, or move it to a dedicated types package, and export it for the other packages to reference.packages/core/src/cards/lucide-solid-icons.d.ts#L1-L475: delete and reference the shared declaration; also move out ofsrc/cards/if the file is kept.packages/extensions/recorder/src/lucide-solid-icons.d.ts#L1-L475: delete and reference the shared declaration.packages/extensions/tanstack/src/lucide-solid-icons.d.ts#L1-L475: delete and reference the shared declaration.packages/extensions/terminal/src/lucide-solid-icons.d.ts#L1-L475: delete and reference the shared declaration.packages/extensions/test-runner/src/lucide-solid-icons.d.ts#L1-L475: delete and reference the shared declaration.packages/extensions/try-it/src/lucide-solid-icons.d.ts#L1-L475: delete and reference the shared declaration.packages/extensions/whiteboard/src/lucide-solid-icons.d.ts#L1-L475: delete and reference the shared declaration.packages/tools/src/cards/lucide-solid-icons.d.ts#L1-L475: delete and reference the shared declaration; also move out ofsrc/cards/if the file is kept.packages/ui-kit-chat-tools/src/lucide-solid-icons.d.ts#L1-L475: delete and reference the shared declaration.packages/ui-kit-chat/src/lucide-solid-icons.d.ts#L1-L475: delete and reference the shared declaration.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui-kit-system/src/lucide-solid-icons.d.ts` around lines 1 - 475, Replace the generator’s per-package output with one shared declaration containing the 66 lucide-solid icon modules, keeping packages/ui-kit-system/src/lucide-solid-icons.d.ts as the source of truth or moving it to a dedicated types package. Configure every other package to reference that declaration through its tsconfig types/include settings, and delete the duplicated files in packages/core/src/cards/lucide-solid-icons.d.ts, packages/extensions/recorder/src/lucide-solid-icons.d.ts, packages/extensions/tanstack/src/lucide-solid-icons.d.ts, packages/extensions/terminal/src/lucide-solid-icons.d.ts, packages/extensions/test-runner/src/lucide-solid-icons.d.ts, packages/extensions/try-it/src/lucide-solid-icons.d.ts, packages/extensions/whiteboard/src/lucide-solid-icons.d.ts, packages/tools/src/cards/lucide-solid-icons.d.ts, packages/ui-kit-chat-tools/src/lucide-solid-icons.d.ts, and packages/ui-kit-chat/src/lucide-solid-icons.d.ts; if retained, move the files currently under src/cards/ to the common declaration location.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/ui-kit-system/src/lucide-solid-icons.d.ts`:
- Around line 1-475: Replace the generator’s per-package output with one shared
declaration containing the 66 lucide-solid icon modules, keeping
packages/ui-kit-system/src/lucide-solid-icons.d.ts as the source of truth or
moving it to a dedicated types package. Configure every other package to
reference that declaration through its tsconfig types/include settings, and
delete the duplicated files in packages/core/src/cards/lucide-solid-icons.d.ts,
packages/extensions/recorder/src/lucide-solid-icons.d.ts,
packages/extensions/tanstack/src/lucide-solid-icons.d.ts,
packages/extensions/terminal/src/lucide-solid-icons.d.ts,
packages/extensions/test-runner/src/lucide-solid-icons.d.ts,
packages/extensions/try-it/src/lucide-solid-icons.d.ts,
packages/extensions/whiteboard/src/lucide-solid-icons.d.ts,
packages/tools/src/cards/lucide-solid-icons.d.ts,
packages/ui-kit-chat-tools/src/lucide-solid-icons.d.ts, and
packages/ui-kit-chat/src/lucide-solid-icons.d.ts; if retained, move the files
currently under src/cards/ to the common declaration location.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 14fa6ae0-3cd3-474c-865d-2a70ef8f2304
📒 Files selected for processing (66)
.oxlintrc.jsonapps/conciv/src/composer/actions.tsxapps/conciv/src/composer/launch-menu.tsxapps/conciv/src/composer/model-selector.tsxapps/conciv/src/composer/session-selector.tsxapps/conciv/src/pane/grab-reference.tsxapps/conciv/src/pane/indicators.tsxapps/conciv/src/pane/pane-composer.tsxapps/conciv/src/pane/tool-fallback-card.tsxapps/conciv/src/routes/panel.$sessionId.tsxapps/conciv/src/routes/quick.tsxapps/conciv/src/shell/notices.tsxpackages/core/src/cards/code-run-card.tsxpackages/core/src/cards/lucide-solid-icons.d.tspackages/extensions/recorder/src/client.tsxpackages/extensions/recorder/src/lucide-solid-icons.d.tspackages/extensions/recorder/src/tool/card.tsxpackages/extensions/tanstack/src/client/inspector-chip.tsxpackages/extensions/tanstack/src/lucide-solid-icons.d.tspackages/extensions/terminal/src/client.tsxpackages/extensions/terminal/src/client/terminal-actions.tsxpackages/extensions/terminal/src/lucide-solid-icons.d.tspackages/extensions/test-runner/src/lucide-solid-icons.d.tspackages/extensions/test-runner/src/tool/card.tsxpackages/extensions/try-it/src/client/connect-pane.tsxpackages/extensions/try-it/src/lucide-solid-icons.d.tspackages/extensions/whiteboard/src/client.tsxpackages/extensions/whiteboard/src/client/inbox.tsxpackages/extensions/whiteboard/src/lucide-solid-icons.d.tspackages/extensions/whiteboard/src/tool/canvas/card.tsxpackages/extensions/whiteboard/src/tool/comment/card.tsxpackages/tools/src/cards/lucide-solid-icons.d.tspackages/tools/src/cards/ui-card.tsxpackages/ui-kit-chat-tools/src/lucide-solid-icons.d.tspackages/ui-kit-chat-tools/src/styled/tools/apply-patch-diff.tsxpackages/ui-kit-chat-tools/src/styled/tools/bash-card.tsxpackages/ui-kit-chat-tools/src/styled/tools/discovered-apis-card.tsxpackages/ui-kit-chat-tools/src/styled/tools/file-edit-card.tsxpackages/ui-kit-chat-tools/src/styled/tools/file-read-card.tsxpackages/ui-kit-chat-tools/src/styled/tools/search-card.tsxpackages/ui-kit-chat-tools/src/styled/tools/todo-card.tsxpackages/ui-kit-chat-tools/src/styled/tools/tool-lookup-card.tsxpackages/ui-kit-chat/src/lucide-solid-icons.d.tspackages/ui-kit-chat/src/styled/action-bar.tsxpackages/ui-kit-chat/src/styled/activity.tsxpackages/ui-kit-chat/src/styled/attachment-dispatch.tsxpackages/ui-kit-chat/src/styled/attachment-ui.tsxpackages/ui-kit-chat/src/styled/branch-picker.tsxpackages/ui-kit-chat/src/styled/chain-of-thought.stories.tsxpackages/ui-kit-chat/src/styled/chain-of-thought.tsxpackages/ui-kit-chat/src/styled/composer.tsxpackages/ui-kit-chat/src/styled/model-selector.tsxpackages/ui-kit-chat/src/styled/now-line.tsxpackages/ui-kit-chat/src/styled/thread.tsxpackages/ui-kit-chat/src/tools/primitives/status-visual.tsxpackages/ui-kit-chat/src/tools/styled/collapsible-card.tsxpackages/ui-kit-chat/src/tools/styled/collapsible-section.tsxpackages/ui-kit-chat/src/tools/styled/json-tree.tsxpackages/ui-kit-chat/src/tools/styled/meta-tool-card.tsxpackages/ui-kit-chat/src/tools/styled/note-row.tsxpackages/ui-kit-chat/src/tools/styled/permission-card.tsxpackages/ui-kit-chat/src/tools/styled/tool-fallback.tsxpackages/ui-kit-chat/src/tools/styled/tool-group.tsxpackages/ui-kit-chat/src/tools/styled/tool-icon.tsxpackages/ui-kit-system/src/lucide-solid-icons.d.tspackages/ui-kit-system/src/toast.tsx
The per-icon lucide-solid default-import fix (previous commit) needed type shims because lucide-solid ships no "type": "module" field and shares one ambient .d.ts across its import/require/browser export conditions. Under NodeNext, TypeScript infers that ambient .d.ts as CommonJS-implied and applies esModuleInterop synthetic-default semantics, so a per-icon default import types as the whole module namespace instead of the icon component. Exact-specifier module augmentation worked around it, but needed a generated shim file duplicated into every affected package. Flip the repo's moduleResolution to "bundler" instead (module: "ESNext" to match), the same combination apps/conciv already proved out. Bundler resolution reads a package's conditional exports map directly rather than inferring an implied module format from a missing "type" field, so lucide-solid's per-icon subpaths type-check correctly with zero shims. Removed apps/conciv's now-redundant local module/moduleResolution override since it's identical to the new base. No other fallout: the repo's relative imports already carry ".js" extensions, which stay valid path segments under bundler resolution; tsc only ever emits declarations here (emitDeclarationOnly via each package's tsconfig.build.json), so no runtime JS output changes. pnpm release:check (build + publint + attw) is the artifact-correctness gate that now covers what NodeNext used to check at the source level. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…static path guard The static no-restricted-imports entry banning the lucide-solid barrel only caught the mistake after the fact and offered no fix. Replace it with an oxlint JS plugin rule that flags any value import from the 'lucide-solid' barrel (type-only imports stay allowed) and, when the guessed per-icon path actually resolves on disk via the same node module resolution the runtime uses, autofixes it to per-icon default imports in one pass, splitting any type-only names into a separate import type. Icon file names are derived with a plain camelCase to kebab-case conversion, verified against the real lucide-solid package export map: it matches the canonical name for the ~86% of icons that were never renamed, and correctly recognizes when a name is a legacy alias for a renamed icon (verified with MoreHorizontal, which is not a mechanical kebab-case of its own name) by reporting without a fix rather than emitting a guessed, wrong import path. Added lucide-solid as a devDependency of @conciv/oxlint-plugin so its own test fixtures can resolve real per-icon paths the same way a consuming package would. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
packages/oxlint-plugin/src/lucide-per-icon.js (2)
56-65: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winDefault and namespace barrel imports bypass the rule.
splitSpecifiersdropsImportDefaultSpecifierandImportNamespaceSpecifier.import * as Icons from 'lucide-solid'therefore produces no diagnostic and still pulls the whole barrel through the transform, which is the cost this PR removes. Add a non-fixable diagnostic for those forms.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/oxlint-plugin/src/lucide-per-icon.js` around lines 56 - 65, Update splitSpecifiers to detect ImportDefaultSpecifier and ImportNamespaceSpecifier entries and emit a non-fixable diagnostic for those import forms, while preserving the existing value/type classification for named ImportSpecifier entries. Ensure namespace and default barrel imports are not silently accepted or transformed without reporting.
6-12: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winResolve canonical Lucide icon paths before reporting them as unresolved.
kebabCasemapsGrid2x2togrid-2-x-2andArrowUpAZtoarrow-up-az, but the valid entry points aregrid-2x2andarrow-up-a-z. The rule therefore emitsbarrelImportUnresolved, incorrectly suggests a legacy alias, and cannot autofix these imports. Resolve against the package's icon entry points or try the supported candidate spellings before reporting an icon as unresolved.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/oxlint-plugin/src/lucide-per-icon.js` around lines 6 - 12, Update the icon-resolution flow that uses kebabCase to resolve canonical Lucide entry-point names before emitting barrelImportUnresolved. Support candidates such as grid-2x2 and arrow-up-a-z, resolving against the package’s available icon paths or supported spelling alternatives; only report unresolved icons and suggest legacy aliases after all valid candidates fail, while preserving autofix behavior for resolved imports.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/oxlint-plugin/test/run-lint.ts`:
- Around line 31-40: Update lintFix to wrap scratch-file creation and reading in
a try/finally so rm(scratchAbsolute) always executes, including when readFile or
oxlint fails. Replace the blanket catch around runFile with handling that
suppresses expected non-zero oxlint diagnostic exits while propagating spawn or
tooling failures; preserve the existing returned fixed content behavior and do
not change the test-controlled execFile arguments.
In `@tsconfig.base.json`:
- Around line 6-7: Update the shared tsconfig.base.json compiler settings to use
NodeNext for module and moduleResolution, and move the bundler resolution
setting into the browser-bundled package configurations. Ensure Node-executed
packages inherit NodeNext while browser packages explicitly retain bundler
resolution.
---
Nitpick comments:
In `@packages/oxlint-plugin/src/lucide-per-icon.js`:
- Around line 56-65: Update splitSpecifiers to detect ImportDefaultSpecifier and
ImportNamespaceSpecifier entries and emit a non-fixable diagnostic for those
import forms, while preserving the existing value/type classification for named
ImportSpecifier entries. Ensure namespace and default barrel imports are not
silently accepted or transformed without reporting.
- Around line 6-12: Update the icon-resolution flow that uses kebabCase to
resolve canonical Lucide entry-point names before emitting
barrelImportUnresolved. Support candidates such as grid-2x2 and arrow-up-a-z,
resolving against the package’s available icon paths or supported spelling
alternatives; only report unresolved icons and suggest legacy aliases after all
valid candidates fail, while preserving autofix behavior for resolved imports.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c7664567-c6c3-4065-b560-8656c1e0a5db
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (14)
.oxlintrc.jsonapps/conciv/tsconfig.jsonpackages/oxlint-plugin/package.jsonpackages/oxlint-plugin/src/lucide-per-icon.jspackages/oxlint-plugin/src/plugin.jspackages/oxlint-plugin/test/fixtures/lucide-per-icon/already-per-icon.tsxpackages/oxlint-plugin/test/fixtures/lucide-per-icon/barrel-value-import.tsxpackages/oxlint-plugin/test/fixtures/lucide-per-icon/mixed-value-and-type.tsxpackages/oxlint-plugin/test/fixtures/lucide-per-icon/type-only-import.tsxpackages/oxlint-plugin/test/fixtures/lucide-per-icon/unresolvable-legacy-alias.tsxpackages/oxlint-plugin/test/lucide-per-icon.test.tspackages/oxlint-plugin/test/oxlintrc-lucide-per-icon.jsonpackages/oxlint-plugin/test/run-lint.tstsconfig.base.json
💤 Files with no reviewable changes (1)
- apps/conciv/tsconfig.json
| export async function lintFix(configFile: string, fixture: string): Promise<string> { | ||
| const source = await readFile(join(packageDir, fixture), 'utf8') | ||
| const scratchPath = `${fixture}.scratch.tsx` | ||
| const scratchAbsolute = join(packageDir, scratchPath) | ||
| await writeFile(scratchAbsolute, source) | ||
| await runFile(oxlintBin, ['-c', configFile, '--fix', scratchPath], {cwd: packageDir}).catch(() => undefined) | ||
| const fixed = await readFile(scratchAbsolute, 'utf8') | ||
| await rm(scratchAbsolute) | ||
| return fixed | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Guarantee scratch-file cleanup and do not hide oxlint failures.
Two problems in lintFix:
-
rm(scratchAbsolute)runs only on the success path. IfreadFilethrows, the scratch file stays intest/fixtures/lucide-per-icon/. A leaked.scratch.tsxfile is then picked up by later lint runs and can be committed. Move the cleanup into afinallyblock. -
.catch(() => undefined)discards every failure of the oxlint invocation, including a missing binary.lintFixthen returns the unmodified source, and the test fails with a message that blames the rule instead of the tooling. oxlint exits non-zero when diagnostics remain, so keep that case silent, but surface spawn failures.
The ast-grep detect-child-process-typescript hint on the execFile import is a false positive here. All arguments are test-controlled literals.
🛡️ Proposed fix
export async function lintFix(configFile: string, fixture: string): Promise<string> {
const source = await readFile(join(packageDir, fixture), 'utf8')
const scratchPath = `${fixture}.scratch.tsx`
const scratchAbsolute = join(packageDir, scratchPath)
await writeFile(scratchAbsolute, source)
- await runFile(oxlintBin, ['-c', configFile, '--fix', scratchPath], {cwd: packageDir}).catch(() => undefined)
- const fixed = await readFile(scratchAbsolute, 'utf8')
- await rm(scratchAbsolute)
- return fixed
+ try {
+ await runFile(oxlintBin, ['-c', configFile, '--fix', scratchPath], {cwd: packageDir}).catch((error: unknown) => {
+ if (isRecord(error) && typeof error.code === 'string') throw error
+ return undefined
+ })
+ return await readFile(scratchAbsolute, 'utf8')
+ } finally {
+ await rm(scratchAbsolute, {force: true})
+ }
}🧰 Tools
🪛 ast-grep (0.45.1)
[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: import {execFile} from 'node:child_process'
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
(detect-child-process-typescript)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/oxlint-plugin/test/run-lint.ts` around lines 31 - 40, Update lintFix
to wrap scratch-file creation and reading in a try/finally so
rm(scratchAbsolute) always executes, including when readFile or oxlint fails.
Replace the blanket catch around runFile with handling that suppresses expected
non-zero oxlint diagnostic exits while propagating spawn or tooling failures;
preserve the existing returned fixed content behavior and do not change the
test-controlled execFile arguments.
Source: Linters/SAST tools
| "module": "ESNext", | ||
| "moduleResolution": "bundler", |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Find packages that still declare NodeNext and those that run under Node.
fd -t f 'tsconfig*.json' --exclude node_modules --exec sh -c 'printf "== %s\n" "$1"; grep -n "moduleResolution\|\"module\"" "$1"' _ {}
# Check whether AGENTS.md still mandates NodeNext.
rg -n 'NodeNext|moduleResolution' --glob 'AGENTS.md' --glob '**/AGENTS.md'Repository: conciv-dev/conciv
Length of output: 3910
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '== instruction and skill files =='
git ls-files '*AGENTS.md' '*CLAUDE.md' '.github/skills/*' | sed -n '1,160p'
printf '%s\n' '== root files =='
git ls-files | sed -n '1,100p'
printf '%s\n' '== candidate instruction text =='
for f in AGENTS.md CLAUDE.md .github/skills/code-review/SKILL.md; do
if [ -f "$f" ]; then
printf '\n== %s ==\n' "$f"
sed -n '1,180p' "$f"
fi
done
printf '%s\n' '== tsconfig.base.json =='
cat -n tsconfig.base.json
printf '%s\n' '== package config inheritance and scripts =='
for f in packages/{cli,serve,harness,harness-init,core,tools,publish,extension-compiler}/tsconfig.json apps/conciv/tsconfig.json; do
if [ -f "$f" ]; then
printf '\n== %s ==\n' "$f"
cat -n "$f"
fi
done
printf '%s\n' '== package scripts for candidate Node packages =='
for f in packages/{cli,serve,harness,harness-init,core,tools,publish,extension-compiler}/package.json apps/conciv/package.json; do
if [ -f "$f" ]; then
printf '\n== %s ==\n' "$f"
grep -nE '"(name|type|main|module|exports|bin|scripts)"|"(dev|build|test|start|serve|cli|harness)' "$f" | sed -n '1,100p'
fi
doneRepository: conciv-dev/conciv
Length of output: 30282
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '== TanStack Intent skill check =='
pnpm dlx `@tanstack/intent`@latest list
printf '%s\n' '== all tsconfig inheritance and module settings =='
python3 - <<'PY'
import json
from pathlib import Path
for path in sorted(Path('.').rglob('tsconfig*.json')):
if 'node_modules' in path.parts:
continue
try:
data = json.loads(path.read_text())
except Exception:
continue
compiler = data.get('compilerOptions', {})
if 'extends' in data or 'module' in compiler or 'moduleResolution' in compiler:
print(path)
print(' extends:', data.get('extends'))
print(' module:', compiler.get('module'))
print(' moduleResolution:', compiler.get('moduleResolution'))
PY
printf '%s\n' '== build configuration files =='
git ls-files '*tsdown*' '*vite.config.*' '*package.json' | rg '(^|/)(tsdown|vite\.config|package\.json)' | sed -n '1,180p'
printf '%s\n' '== build scripts and tsdown references =='
rg -n '"build"|tsdown|tsconfig' packages/{cli,serve,harness,harness-init,core,tools,publish,extension-compiler} apps/conciv --glob 'package.json' --glob '*.config.*' --glob '*.json' | sed -n '1,220p'Repository: conciv-dev/conciv
Length of output: 20383
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '== tsdown configs =='
for f in packages/{cli,serve,harness,harness-init,core,tools,extension-compiler}/tsdown.config.ts; do
if [ -f "$f" ]; then
printf '\n== %s ==\n' "$f"
cat -n "$f"
fi
done
printf '%s\n' '== package exports and entry fields =='
python3 - <<'PY'
import json
from pathlib import Path
names = {
'packages/cli/package.json',
'packages/serve/package.json',
'packages/harness/package.json',
'packages/harness-init/package.json',
'packages/core/package.json',
'packages/tools/package.json',
'packages/extension-compiler/package.json',
'packages/publish/package.json',
}
for name in sorted(names):
path = Path(name)
data = json.loads(path.read_text())
print(f'== {name} ==')
for key in ('type', 'main', 'module', 'bin', 'exports', 'files'):
if key in data:
print(json.dumps({key: data[key]}, indent=2))
PY
printf '%s\n' '== relative imports and require calls in Node-side source =='
rg -n --glob '*.ts' --glob '*.tsx' \
'(^|[^[:alnum:]_])(import|export)[[:space:]]+[^;]*from[[:space:]]+['"'"'"]\.{1,2}/|(^|[^[:alnum:]_])import[[:space:]]*\\(['"'"'"]\.{1,2}/|(^|[^[:alnum:]_])require[[:space:]]*\\(' \
packages/{cli,serve,harness,harness-init,core,tools,extension-compiler,publish}/src \
| sed -n '1,260p'
printf '%s\n' '== build output references =='
rg -n 'bundle|outDir|entry|dts|platform|format|external|unbundle|inlineOnly|input' packages/{cli,serve,harness,harness-init,core,tools,extension-compiler}/tsdown.config.tsRepository: conciv-dev/conciv
Length of output: 10016
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
import json
import re
from pathlib import Path
packages = [
Path('packages/cli'),
Path('packages/serve'),
Path('packages/harness'),
Path('packages/harness-init'),
Path('packages/core'),
Path('packages/tools'),
Path('packages/extension-compiler'),
Path('packages/publish'),
]
pattern = re.compile(
r"""(?:\b(?:from|import)\s*\(?\s*['"](?P<import>[^'"]+)['"]|\brequire\s*\(\s*['"](?P<require>[^'"]+)['"])"""
)
relative = re.compile(r'^\.\.?/')
extensions = ('.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs', '.json')
for package in packages:
manifest = json.loads((package / 'package.json').read_text())
print(f'== {package} ({manifest.get("name")}) ==')
count = 0
for source in sorted((package / 'src').rglob('*')):
if source.suffix not in {'.ts', '.tsx', '.mts', '.cts'}:
continue
text = source.read_text(errors='replace')
for match in pattern.finditer(text):
specifier = match.group('import') or match.group('require')
if not relative.match(specifier) or specifier.endswith(extensions):
continue
count += 1
target = (source.parent / specifier).resolve()
candidates = [
target,
Path(str(target) + '.ts'),
Path(str(target) + '.tsx'),
Path(str(target) + '.mts'),
Path(str(target) + '.cts'),
target / 'index.ts',
target / 'index.tsx',
target / 'index.mts',
target / 'index.cts',
]
existing = [str(p) for p in candidates if p.exists()]
print(f'{source}:{text[:source.read_text().find(chr(10), 0)] if False else ""}{specifier} -> {existing}')
print(f'extensionless relative specifiers: {count}')
PY
printf '%s\n' '== direct source-entry execution references =='
rg -n 'src/.*\.ts|tsx|tsx|tsx' \
packages/{cli,serve,harness,harness-init,core,tools,extension-compiler,publish}/package.json \
package.json turbo.json .github --glob '*.json' --glob '*.yml' --glob '*.yaml' \
| sed -n '1,180p'
printf '%s\n' '== publish package complete script section =='
sed -n '1,45p' packages/publish/package.jsonRepository: conciv-dev/conciv
Length of output: 2858
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
import json
import re
from pathlib import Path
packages = [
Path('packages/cli'),
Path('packages/serve'),
Path('packages/harness'),
Path('packages/harness-init'),
Path('packages/core'),
Path('packages/tools'),
Path('packages/extension-compiler'),
Path('packages/publish'),
]
pattern = re.compile(
r"""(?:\b(?:from|import)\s*\(?\s*['"](?P<import>[^'"]+)['"]|\brequire\s*\(\s*['"](?P<require>[^'"]+)['"])"""
)
relative = re.compile(r'^\.\.?/')
extensions = ('.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs', '.json')
for package in packages:
manifest = json.loads((package / 'package.json').read_text())
print(f'== {package} ({manifest.get("name")}) ==')
count = 0
for source in sorted((package / 'src').rglob('*')):
if source.suffix not in {'.ts', '.tsx', '.mts', '.cts'}:
continue
text = source.read_text(errors='replace')
for match in pattern.finditer(text):
specifier = match.group('import') or match.group('require')
if not relative.match(specifier) or specifier.endswith(extensions):
continue
count += 1
target = (source.parent / specifier).resolve()
candidates = [
target,
Path(str(target) + '.ts'),
Path(str(target) + '.tsx'),
Path(str(target) + '.mts'),
Path(str(target) + '.cts'),
target / 'index.ts',
target / 'index.tsx',
target / 'index.mts',
target / 'index.cts',
]
existing = [str(p) for p in candidates if p.exists()]
print(f'{source}:{specifier} -> {existing}')
print(f'extensionless relative specifiers: {count}')
PY
printf '%s\n' '== direct source-entry execution references =='
rg -n 'src/.*\.ts|tsx|tsx|tsx' \
packages/{cli,serve,harness,harness-init,core,tools,extension-compiler,publish}/package.json \
package.json turbo.json .github --glob '*.json' --glob '*.yml' --glob '*.yaml' \
| sed -n '1,180p'
printf '%s\n' '== publish package complete script section =='
sed -n '1,45p' packages/publish/package.jsonRepository: conciv-dev/conciv
Length of output: 2858
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '== focused diff =='
git diff -- tsconfig.base.json AGENTS.md
printf '%s\n' '== available tool versions =='
command -v node || true
node --version 2>/dev/null || true
command -v tsc || true
tsc --version 2>/dev/null || true
printf '%s\n' '== import and require forms in Node-side source =='
rg -n --glob '*.ts' --glob '*.tsx' \
'\b(require|import|export)\b' \
packages/{cli,serve,harness,harness-init,core,tools,extension-compiler,publish}/src \
| sed -n '1,220p'Repository: conciv-dev/conciv
Length of output: 21774
🏁 Script executed:
#!/bin/bash
set -eu
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
mkdir -p "$tmp/src"
cat >"$tmp/src/main.ts" <<'EOF'
import {value} from './dep'
export {value}
EOF
cat >"$tmp/src/dep.ts" <<'EOF'
export const value = 1
EOF
cat >"$tmp/tsconfig.bundler.json" <<'EOF'
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noEmit": true
},
"include": ["src/**/*.ts"]
}
EOF
cat >"$tmp/tsconfig.nodenext.json" <<'EOF'
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noEmit": true
},
"include": ["src/**/*.ts"]
}
EOF
printf '%s\n' '== bundler diagnostics =='
tsc -p "$tmp/tsconfig.bundler.json" --pretty false 2>&1 || true
printf '%s\n' '== NodeNext diagnostics =='
tsc -p "$tmp/tsconfig.nodenext.json" --pretty false 2>&1 || trueRepository: conciv-dev/conciv
Length of output: 208
🏁 Script executed:
#!/bin/bash
set -eu
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
mkdir -p "$tmp/src"
cat >"$tmp/package.json" <<'EOF'
{"type":"module"}
EOF
cat >"$tmp/src/main.ts" <<'EOF'
import {value} from './dep'
export {value}
EOF
cat >"$tmp/src/dep.ts" <<'EOF'
export const value = 1
EOF
cat >"$tmp/tsconfig.bundler.json" <<'EOF'
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noEmit": true
},
"include": ["src/**/*.ts"]
}
EOF
cat >"$tmp/tsconfig.nodenext.json" <<'EOF'
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noEmit": true
},
"include": ["src/**/*.ts"]
}
EOF
printf '%s\n' '== bundler diagnostics =='
tsc -p "$tmp/tsconfig.bundler.json" --pretty false 2>&1 || true
printf '%s\n' '== NodeNext diagnostics =='
tsc -p "$tmp/tsconfig.nodenext.json" --pretty false 2>&1 || trueRepository: conciv-dev/conciv
Length of output: 421
Keep NodeNext for Node-executed packages.
tsconfig.base.json sets module to ESNext and moduleResolution to bundler, but AGENTS.md requires NodeNext. Node-side packages inherit this configuration. Restore NodeNext in the shared config and scope bundler to browser-bundled packages.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tsconfig.base.json` around lines 6 - 7, Update the shared tsconfig.base.json
compiler settings to use NodeNext for module and moduleResolution, and move the
bundler resolution setting into the browser-bundled package configurations.
Ensure Node-executed packages inherit NodeNext while browser packages explicitly
retain bundler resolution.
Sources: Coding guidelines, Learnings
Root cause (#389 strand)
The @conciv/app vitest-browser suite's cold-start import burst was 92% lucide-solid: barrel imports pulled all ~1700 icon modules through the vite transform on every cold run (solid packages are excluded from dep-prebundle, so the icons never hit the .vite cache). On starved x86 CI runners that 60-530s window is where Chromium's network service kills all page websockets at one instant, the vite client reloads the tester frame, and vitest browser mode cannot reconnect (upstream vitest-dev/vitest#10791) — the rotating-victim
Browser connection was closedfailure.Profiled with
DEBUG=vite:transform: 1969 of 2759 transformed modules were lucide-solid icons. With this change: 826 modules; local cold import 27.2s → 12.8s; Rosetta rig (x86, --cpus 1, cold .vite) import 190-290s → 46-69s, strand 0/6 vs 1/6 control (historical cold baseline ~35-50%/run).Change
lucide-solid/icons/<name>) across 54 files — lucide's own recommended pattern for vite dev perf.no-restricted-importsguard in .oxlintrc.json so the barrel can't come back (type-only imports still allowed)."type"field and one ambient .d.ts shared across export conditions, so NodeNext types the per-icon default export as the module namespace (TS2604) — unfixed as of lucide-solid@1.31.0. Wildcard ambient overrides don't work (TS only consults them on resolution miss); each NodeNext package gets one generatedlucide-solid-icons.d.tswith exact-specifier augmentation per icon (repo-wide union, identical content). apps/conciv needs none (bundler resolution). Deletable once upstream ships dual declarations.Verification
Closes #389
🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
New Features
Bug Fixes
Tests