Skip to content

finding(docs): snippets that import a package's own third-party dependency (lucide-react) cannot resolve it — the whole content/docs/layout group is blocked from #5867 #6120

Description

@yinlianghui-tw

Measured by #5867 batch 2 while probing which remaining groups can be re-fenced (session session_019b5UBNMtTzKbVtZZGvFuxe, on origin/mainb9c367717).

The measurement

check-doc-snippet-types compiles each snippet as its own module at the repository root. It builds paths for every workspace package from that package's own exports, so @object-ui/layout resolves fine — but a third-party specifier is resolved the ordinary way, from the root node_modules, and a package's own dependency does not live there under pnpm:

node -e "require.resolve('lucide-react', { paths: ['<repo root>'] })"
→ MODULE_NOT_FOUND

lucide-react is a declared dependency of @object-ui/layout (packages/layout/package.json:35) and @object-ui/components (packages/components/package.json:77), at ^1.31.0. It is simply not hoisted to the root.

What it blocks

Re-fencing the three content/docs/layout/** pages (12 blocks, the #5867 remainder for that group) was probed with a throwaway mutation, gate run, and restore under a trap. Five of the twelve blocks red on this alone:

content/docs/layout/app-shell.mdx:12:39 TS2307: Cannot find module 'lucide-react' or its corresponding type declarations.
content/docs/layout/app-shell.mdx:166:64 TS2307: (same)
content/docs/layout/page-header.mdx:274:42 TS2307: (same)
content/docs/layout/sidebar-nav.mdx:12:39 TS2307: (same)
content/docs/layout/sidebar-nav.mdx:201:8 TS2307: (same)

These snippets are correct documentationSidebarNav's NavItem.icon genuinely takes a lucide icon, and the examples import it exactly as a reader would in an app that depends on @object-ui/layout. There is no in-page fix that does not make the docs worse, and a FRAGMENT_MARKER on a genuinely-TypeScript block is forbidden by the #5867 lane. So the layout group cannot be taken until this is decided.

The deciding question, ⛔ not decided here

Which of these is the intended shape:

  1. the root declares lucide-react as a devDependency so the snippet program can resolve what the documented packages depend on (smallest change, but the root then carries a dep for the gate's benefit);
  2. the gate derives paths/typeRoots entries for the declared dependencies of the packages a covered document imports, so any package's own deps resolve the way a real consumer's would (matches the gate's existing "resolve against what a reader actually imports" principle, more work);
  3. it is accepted as an edge and the affected pages stay uncovered, declared with a reason.

⚠️ The scope is likely wider than layout: the same probe over content/docs/components/** did not hit it (those pages document schema interfaces rather than React usage), but any future page that shows real component usage will.

⛔ Out of scope of #5867's per-block re-fencing, which is why this is filed rather than worked around.

Refs: #5867 (the parent lane) · #6107 (the sibling blocker batch 1 filed).

Metadata

Metadata

Labels

domain:devxobjectui devx stream: fix lands on .github/, scripts/ or release pipeline — devx lane cross-repopm:dispatchedtooling

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions