Skip to content

fix(components,layout): emit explicit extensions in the published typings so nodenext consumers can follow them - #5441

Merged
os-support-ai merged 3 commits into
mainfrom
claude/issue-5365-dts-extensionless-reexports
Aug 20, 2026
Merged

fix(components,layout): emit explicit extensions in the published typings so nodenext consumers can follow them#5441
os-support-ai merged 3 commits into
mainfrom
claude/issue-5365-dts-extensionless-reexports

Conversation

@os-support-ai

@os-support-aios-support-ai commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Fixes#5365

vite-plugin-dts emits one declaration file per source file and TypeScript copies a module specifier into the declaration verbatim, so export * from './ui' shipped extensionless in dist/index.d.ts. Node16/NodeNext resolution does not extension-search a relative specifier, so the compiler could follow none of the hops and every symbol they carried read as absent from the package.

Dispatched at the scope the thread establishes, not the card body's: @object-ui/layout is in the same shape as @object-ui/components, and a fix covering one leaves app-shell — the consumer that pulls in both — still unable to take the pin.

What changed

  • scripts/vite-dts-explicit-extensions.ts (new) — a shared vite-plugin-dtsbeforeWriteFile / afterBuild pair. It resolves each relative specifier against the source tree the declaration output mirrors (a file hop becomes ./x.js, a directory hop ./x/index.js), throws on anything it cannot resolve, and after the build re-parses the emitted declarations to assert every relative specifier both carries an extension and names a file the build really emitted. It lives in scripts/ beside vite-crypto-stub.ts / vite-objectstack-spec-dist.ts, which is already a turbo.json build input ($TURBO_ROOT$/scripts/vite-*.ts), so cache invalidation comes for free.
  • packages/components/vite.config.ts, packages/layout/vite.config.ts — three lines each, spreading the hooks into the existing dts({ ... }) call.
  • packages/fields/tsconfig.json — takes the nodenext pin, the same two lines packages/react has carried since finding(react): the built dist emits extensionless relative imports, so plain Node ESM cannot load the published entry #4538.
  • scripts/__tests__/vite-dts-explicit-extensions.test.ts (new) — 10 cases.
  • A changeset (patch on both packages — the published typings change).

Why the emit and not the sources

@object-ui/react had the same defect in its .js (#4538) and fixed it at the source, because it builds with a bare emitting tsc. These two are bundler builds, and that one difference decides the route: rolldown resolves their relative specifiers away, so the same source line produces a clean .js and a broken .d.ts. No source edit can express that difference, and pnpm check:esm-specifiers — whose verdict is about specifier-preserving .js builds — is correct to have never scanned either package.

Why the parser and not a regex

removeComments is false in this repository's build configs and the comments really do contain specifiers — packages/app-shell/src/views/metadata-admin/i18n.ts documents itself with import { t } from './i18n', and packages/fields/src/widgets/MasterDetailField.tsx names './widgets/MasterDetailField' the same way. A text scan rewrites those, and when the prose names a path that does not exist it throws and breaks a correct build. The module locates specifiers with ts.createSourceFile instead, and a test pins that prose survives untouched.

Acceptance, measured

The card's acceptance is named: the consumer-side pin goes green. The artifact is the thing under test, so both legs were built and the emitted dist/**/*.d.ts inspected afterwards — BEFORE was measured on the pristine build, then the fix was applied, pnpm --filter @object-ui/components --filter @object-ui/layout build re-run, and the consumers re-checked against the rebuilt tree.

Emitted typings, extensionless relative specifiers (AST-located, prose excluded):

packagedist/index.d.tswhole dist/**/*.d.ts tree
@object-ui/components21 to 0120 to 0 (208 files)
@object-ui/layout7 to 08 to 0 (8 files)

tsc --noEmit under the module/moduleResolution: nodenext pin:

consumerbeforeafter
@object-ui/fields235 — 178 TS2305 (all @object-ui/components), 57 TS7006, 50 files0
@object-ui/app-shell1097 — 880 TS2305 (864 components + 16 layout), 215 TS7006, 2 TS2345, 165 files23 — 21 TS7006, 2 TS2345

The app-shell before-numbers reproduce the thread's measurement exactly (1097 / 880 / 864+16 / 215 / 2).

The pin lands on fields only — app-shell was the instrument

Stated explicitly because the dispatch asked for it. packages/fields goes fully clean, so its pin is landed here and the property is enforced by the compiler from now on. packages/app-shell's pin is not in this diff (its tsconfig.json is byte-identical to main), because a control run settles where the residue comes from:

app-shell/tsconfig.jsontypingserrors
pinnedbefore1097
pinnedafter23
no pin (control)after0

app-shell type-checks clean today, so all 23 are produced by the pin, not by this card. Verified rather than assumed, as asked: 194 of the 215 TS7006 were indeed fallout and cleared; the remaining 21 are a different package's instance of the same defect class, and the 2 TS2345 are a third-party interop question. Both are filed:

Neither is addressed in this PR, per the card's fence.

(The generic above is written with a space after < on purpose — GitHub's body sanitizer strips < followed by a letter as an HTML tag, and it ate that fragment on the first revision of this description.)

Scope fence honoured

Triage ruled the "third gate leg watching published typings" a design add-on and out of this dispatch. scripts/check-node-esm-load.mjs is untouched and its specifier leg is not widened — the assertions added here are a build's assertions about its own output, inside the two packages' own dts invocation, not a repository-wide gate. #5439 records the case for the gate leg so the decision is not lost.

packages/plugin-list and packages/plugin-view are untouched (sibling cards in flight), even though the sweep found the same defect in both.

Verification

Gate union re-run on the final commit, 22b7d781c, working tree clean:

pnpm vitest run scripts/__tests__/vite-dts-explicit-extensions.test.ts 10 passed (10)
pnpm type-check:scripts rc=0
pnpm check:esm-specifiers 13 of 39 packages specifier-preserving; no findings
pnpm check:control-bytes OK (4496 tracked text files)
node scripts/check-type-check-coverage.mjs rc=0
node scripts/check-phantom-dependencies.mjs rc=0
node scripts/check-published-dist-tooling.mjs 39 packages, 0 tooling artifacts
node scripts/check-changeset-presence.mjs / -no-major / -fixed rc=0
vitest scripts/__tests__/{scripts-type-check,turbo-build-inputs,turbo-test-inputs,
turbo-type-check-inputs,check-type-check-coverage}.test.ts rc=0
eslint (the four changed .ts files) rc=0

Reverse verification of the new pin test, direction predicted before running: plain RED, because the directory-hop branch is the sole input to two of the cases and removing it can only add findings. Deleting that branch from resolveExplicitSpecifier gave 2 failed / 8 passed, the failure naming ./ui at the throw site. Restored with git checkout HEAD --, byte-identical. No build artifact sits between that edit and the test — vitest imports the helper source directly, so no rebuild leg applies to it. The fix itself is the opposite case, and both of its legs were rebuilt, as recorded above.


Generated by Claude Code

`vite-plugin-dts` copies module specifiers into the declaration output
verbatim, so `export * from './ui'` shipped extensionless in
`dist/index.d.ts` and no consumer on `moduleResolution: nodenext` could
follow any hop — every named export read as missing (objectui#5365).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RV6yuVCxymHYE16PL9vQkE
…ument
app-shell type-checks clean without the pin and shows 23 errors with it —
21 TS7006 traced to `@object-ui/plugin-chatbot`'s own extensionless typings
(named re-exports degrade to `any` rather than going missing) and 2 TS2345
from `@monaco-editor/react` ESM interop. Neither is this card's defect.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RV6yuVCxymHYE16PL9vQkE
@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)25.3 KB350 KB
Entry fileindex-BzYQLBnD.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)10.04KB3.72KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)10.06KB3.86KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)29.34KB7.05KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.15KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.65KB2.22KB
auth (SocialSignInButtons.js)9.61KB3.89KB
auth (UserMenu.js)3.41KB1.23KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)40.21KB10.80KB
auth (createAuthenticatedFetch.js)6.35KB2.43KB
auth (index.js)2.77KB1.22KB
auth (invitation-status.js)1.22KB0.70KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)5.02KB0.89KB
auth (useIsWorkspaceAdmin.js)3.04KB1.45KB
collaboration (CommentThread.js)26.08KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.68KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)506.94KB113.61KB
core (index.js)4.11KB1.62KB
create-plugin (index.js)10.08KB3.26KB
data-objectstack (index.js)159.80KB44.34KB
fields (index.js)237.21KB59.50KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.28KB1.75KB
i18n (index.js)3.44KB1.39KB
i18n (pickLocalized.js)7.22KB3.08KB
i18n (provider.js)23.13KB7.63KB
i18n (useDisplayLocale.js)2.85KB1.45KB
i18n (useObjectLabel.js)30.51KB7.57KB
i18n (useSafeTranslation.js)7.77KB3.13KB
layout (index.js)38.95KB10.97KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.75KB
mobile (index.js)1.55KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.72KB0.42KB
mobile (useResponsiveConfig.js)1.37KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)9.35KB3.31KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)4.42KB1.42KB
permissions (evaluator.js)5.12KB1.74KB
permissions (index.js)0.93KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.53KB
permissions (usePermissions.js)1.81KB0.83KB
plugin-ai (index.js)15.75KB3.80KB
plugin-calendar (index.js)46.62KB12.83KB
plugin-charts (index.js)64.75KB18.37KB
plugin-chatbot (index.js)181.21KB43.14KB
plugin-dashboard (index.js)128.43KB32.92KB
plugin-designer (index.js)212.39KB42.83KB
plugin-detail (index.js)241.46KB60.56KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)124.19KB30.20KB
plugin-gantt (index.js)164.10KB39.87KB
plugin-grid (index.js)197.28KB53.06KB
plugin-kanban (index.js)52.93KB14.60KB
plugin-list (index.js)111.64KB27.13KB
plugin-map (index.js)20.08KB6.62KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)43.49KB11.93KB
plugin-timeline (index.js)26.68KB7.66KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.52KB20.67KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.66KB3.50KB
providers (index.js)0.45KB0.23KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.62KB2.34KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)36.10KB12.26KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.33KB0.69KB
react (schema-input.js)1.45KB0.83KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)5.41KB2.34KB
sdui-parser (index.js)4.77KB2.16KB
sdui-parser (input-type.js)2.84KB1.40KB
sdui-parser (parse.js)10.76KB3.17KB
sdui-parser (provenance.js)3.66KB1.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)6.92KB2.40KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (dashboard-filter-alias.js)6.23KB2.74KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)3.08KB1.53KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants

@os-support-ai@claude