Skip to content

fix(cli): resolve bare '.' and '..' import specifiers to directory index files [RED-918] [ship] - #1458

Merged
sorccu merged 1 commit into
mainfrom
simo/red-918-bare-dot-imports
Aug 28, 2026
Merged

fix(cli): resolve bare '.' and '..' import specifiers to directory index files [RED-918] [ship]#1458
sorccu merged 1 commit into
mainfrom
simo/red-918-bare-dot-imports

Conversation

@sorccu

@sorccu sorccu commented Aug 28, 2026

Copy link
Copy Markdown
Member

What

Bare . and .. import specifiers (e.g. import { foo } from '..') were misclassified as npm package names by isLocalPath in the check parser, which only tested the /, ./ and ../ prefixes. The imported directory's index file was silently omitted from the code bundle — the importing file itself shipped fine — so the gap only surfaced at runtime as Directory import '…' is not supported resolving ES modules (in a real customer suite this cascaded to 0 discoverable tests). In restricted mode the same misclassification instead reported the specifier as an unsupported npm module.

How

isLocalPath now treats exact . and .. as local paths. The existing extension-less lookup chain then resolves them to the directory's index file via the normal candidate order; no resolver changes were needed. A code comment notes that the predicate also gates tsconfig extends and package.json imports target resolution, where a bare ./.. is a degenerate config either way.

Tests

New bare-dot-imports fixture covering from '.', from '..' and from '../' directory-index imports, exercised in both restricted and unrestricted parser modes. Both tests were verified to fail without the fix.

Closes RED-918.

🤖 Generated with Claude Code

…dex files [RED-918]

isLocalPath only recognized the '/', './' and '../' prefixes, so bare '.'
and '..' import specifiers fell through and were classified as npm package
names. The imported directory's index file was silently omitted from the
code bundle, and checks failed at runtime with "Directory import '...' is
not supported resolving ES modules".

Treat exact '.' and '..' as local paths; the existing extension-less
lookup chain then resolves them to the directory's index file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sorccu
sorccu enabled auto-merge (squash) August 28, 2026 10:39
@sorccu sorccu changed the title fix(cli): resolve bare '.' and '..' import specifiers to directory index files [RED-918] fix(cli): resolve bare '.' and '..' import specifiers to directory index files [RED-918] [ship] Aug 28, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: ship/show PR from a same-repo branch.

@sorccu
sorccu merged commit 519cfcb into main Aug 28, 2026
28 of 30 checks passed
@sorccu
sorccu deleted the simo/red-918-bare-dot-imports branch August 28, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant