Repository navigation
fix(design-core): emit Node-compatible ES modules - #898
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
All 148 relative specifiers use .js, resolve to source files, and the release plan follows repository requirements.
0 open findings
What changed in this PR
Updates @ledgerhq/lumen-design-core output so it can be loaded directly by Node.js as ESM.
Changes:
- Adds
.jsextensions to all relative imports and exports. - Enables
nodenextcompilation and resolution. - Adds the required patch version plan.
| File | Description |
|---|---|
libs/design-core/tsconfig.lib.json |
Enforces Node-compatible ESM resolution. |
libs/design-core/src/lib/utils/createPrimitivesPlugin.ts |
Adds explicit ESM extensions. |
libs/design-core/src/lib/utils/createIconUtilities.test.ts |
Updates test import. |
libs/design-core/src/lib/themes/jsThemeSync.test.ts |
Updates theme synchronization imports. |
libs/design-core/src/lib/themes/js/websites/theme.ts |
Updates website theme imports. |
libs/design-core/src/lib/themes/js/websites/theme.light.ts |
Updates light-theme imports. |
libs/design-core/src/lib/themes/js/websites/theme.dark.ts |
Updates dark-theme imports. |
libs/design-core/src/lib/themes/js/utils/extractCryptoGradients.ts |
Updates primitive token import. |
libs/design-core/src/lib/themes/js/typographies/typography.xs.ts |
Updates typography imports. |
libs/design-core/src/lib/themes/js/typographies/typography.xl.ts |
Updates typography imports. |
libs/design-core/src/lib/themes/js/typographies/typography.sm.ts |
Updates typography imports. |
libs/design-core/src/lib/themes/js/typographies/typography.md.ts |
Updates typography imports. |
libs/design-core/src/lib/themes/js/typographies/typography.lg.ts |
Updates typography imports. |
libs/design-core/src/lib/themes/js/typographies/index.ts |
Updates typography barrel imports. |
libs/design-core/src/lib/themes/js/primitives/primitives.shadows.ts |
Updates primitive imports. |
libs/design-core/src/lib/themes/js/primitives/primitives.others.ts |
Updates type import. |
libs/design-core/src/lib/themes/js/primitives/primitives.motion.ts |
Updates type import. |
libs/design-core/src/lib/themes/js/primitives/primitive.typographies.ts |
Updates type import. |
libs/design-core/src/lib/themes/js/primitives/primitive.gradients.ts |
Updates gradient imports. |
libs/design-core/src/lib/themes/js/primitives/primitive.colors.ts |
Updates type import. |
libs/design-core/src/lib/themes/js/ledger-live/theme.ts |
Updates Ledger Live theme imports. |
libs/design-core/src/lib/themes/js/ledger-live/theme.light.ts |
Updates light-theme imports. |
libs/design-core/src/lib/themes/js/ledger-live/theme.dark.ts |
Updates dark-theme imports. |
libs/design-core/src/lib/themes/js/index.ts |
Updates JS theme exports. |
libs/design-core/src/lib/themes/js/enterprise/theme.ts |
Updates enterprise theme imports. |
libs/design-core/src/lib/themes/js/enterprise/theme.light.ts |
Updates light-theme imports. |
libs/design-core/src/lib/themes/js/enterprise/theme.dark.ts |
Updates dark-theme imports. |
libs/design-core/src/lib/themes/css/tokenIntegrity.test.ts |
Updates token test imports. |
libs/design-core/src/lib/themes/css/index.ts |
Updates CSS token imports. |
libs/design-core/src/lib/presets/websites.ts |
Updates preset imports. |
libs/design-core/src/lib/presets/ledger-live.ts |
Updates preset imports. |
libs/design-core/src/lib/presets/index.ts |
Updates preset exports. |
libs/design-core/src/lib/presets/enterprise.ts |
Updates preset imports. |
libs/design-core/src/lib/presets/allBrands.ts |
Updates preset imports. |
libs/design-core/src/lib/cssVar/cssVar.ts |
Updates theme type import. |
libs/design-core/src/lib/cssVar/cssVar.test.ts |
Updates test imports. |
libs/design-core/src/lib/colorContrast/hslToHex.ts |
Updates type import. |
libs/design-core/src/lib/colorContrast/colorContrast.ts |
Updates utility imports. |
libs/design-core/src/lib/colorContrast/colorContrast.test.ts |
Updates test import. |
libs/design-core/src/index.ts |
Updates public barrel exports. |
.nx/version-plans/version-plan-1791391200000-design-core.md |
Adds the required patch release plan. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Relative imports in the built output had no file extension, so `dist` only loaded through bundlers and lenient loaders. Plain Node, used for example by @shadcn/lint to load a `tailwind.config.ts` that imports the Lumen presets, rejected it. All relative imports in `src` now carry their `.js` (or `/index.js`) extension, and the build uses `nodenext` resolution so the compiler rejects new extensionless imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gamegee
force-pushed
the
fix/design-core-node-esm
branch
from
October 15, 2026 09:07
a987a84 to
4bdfdc5
Compare
Signed-off-by: Simon Bruneaud <simon.bruneaud@ledger.fr>
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
@ledgerhq/lumen-design-core's built output only loads through bundlers. Its relative imports have no file extension (import … from './lib/themes/css/index'), which plain Node rejects for ES modules:This breaks any tool that loads a
tailwind.config.tsimporting the Lumen presets with Node. For example,@shadcn/lintcan't build Lumen's theme, so itsno-unknown-classesrule reported 373 valid Lumen classes as unknown onui-react(body-2,heading-4…). With this fix, it reports 9, all real.libs/design-core/src(39 files) now carry.js, or/index.jsfor folders. The change was made by a codemod, and every path was resolved against an existing file.tsconfig.lib.jsonusesnodenextmodule resolution, so the compiler rejects any new extensionless import.dist, and nothing imports design-core's source directly.Split out of #895 (lint presets), where it was found.
How to test
npx nx run-many -t build test typecheck lint --projects=@ledgerhq/lumen-design-coreshould pass (112 tests).node --input-type=module -e "await import('./libs/design-core/dist/index.js')"should succeed. Onmainit fails with the error above.npx nx run-many -t build typecheck test --projects=@ledgerhq/lumen-ui-react,@ledgerhq/lumen-ui-rnative,@ledgerhq/lumen-utils-shared(verified locally, includingui-rnative's 1,419 Jest tests).Screenshots
N/A (no UI change).
🤖 Generated with Claude Code