Skip to content

fix: preserve empty type-only imports without introducing runtime side effects - #219

Merged
dummdidumm merged 3 commits into
mainfrom
fix/171-empty-type-imports
Sep 25, 2026
Merged

dummdidumm merged 3 commits into
mainfrom
fix/171-empty-type-imports

Conversation

@Rich-Harris

Copy link
Copy Markdown
Member

closes #171

@pkg-svelte-dev

Copy link
Copy Markdown

Install the latest version of esrap from 255b99d:

pnpm add https://pkg.svelte.dev/esrap/c/255b99d79b4fc61825ea9ac1243791ff9f7517c6

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/esrap/pr/219

@changeset-bot

changeset-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 255b99d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
esrap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dummdidumm
dummdidumm merged commit 9edf6ef into main Sep 25, 2026
7 checks passed
@dummdidumm
dummdidumm deleted the fix/171-empty-type-imports branch September 25, 2026 08:10
leonidaz added a commit to leonidaz/esrap that referenced this pull request Sep 25, 2026
sveltejs#219 prints `import type {} from` as one string; route its keyword and braces
through the lookups like the non-empty form. Also mention keywords in the
`tokens` option's documentation.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
(cherry picked from commit f573c055666c07224f7666c2fb4a157d63d510de)
leonidaz added a commit to leonidaz/esrap that referenced this pull request Sep 26, 2026
…nst token matching

`import type {} from` was written as one string since sveltejs#219, so with tokens
neither the keyword nor the braces could match; write them one token at a time.

Add tests for the comment handling the token matcher relies on: a comment whose
text is a bracket (`/* ( */`, `// )`, a commented-out block, a comment line
that is a lone `}`) must not be consumed as the next source token, and the
real brackets after it must still map exactly.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
leonidaz added a commit to leonidaz/esrap that referenced this pull request Sep 26, 2026
…nst token matching

`import type {} from` was written as one string since sveltejs#219, so with tokens
neither the keyword nor the braces could match; write them one token at a time.

Add tests for the comment handling the token matcher relies on: a comment whose
text is a bracket (`/* ( */`, `// )`, a commented-out block, a comment line
that is a lone `}`) must not be consumed as the next source token, and the
real brackets after it must still map exactly.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
leonidaz added a commit to leonidaz/esrap that referenced this pull request Sep 26, 2026
…nst token matching

`import type {} from` was written as one string since sveltejs#219, so with tokens
neither the keyword nor the braces could match; write them one token at a time.

Add tests for the comment handling the token matcher relies on: a comment whose
text is a bracket (`/* ( */`, `// )`, a commented-out block, a comment line
that is a lone `}`) must not be consumed as the next source token, and the
real brackets after it must still map exactly.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
leonidaz added a commit to leonidaz/esrap that referenced this pull request Sep 26, 2026
…nst token matching

`import type {} from` was written as one string since sveltejs#219, so with tokens
neither the keyword nor the braces could match; write them one token at a time.

Add tests for the comment handling the token matcher relies on: a comment whose
text is a bracket (`/* ( */`, `// )`, a commented-out block, a comment line
that is a lone `}`) must not be consumed as the next source token, and the
real brackets after it must still map exactly.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
dummdidumm pushed a commit that referenced this pull request Nov 17, 2026
…nst token matching (#240)

`import type {} from` was written as one string since #219, so with tokens
neither the keyword nor the braces could match; write them one token at a time.

Add tests for the comment handling the token matcher relies on: a comment whose
text is a bracket (`/* ( */`, `// )`, a commented-out block, a comment line
that is a lone `}`) must not be consumed as the next source token, and the
real brackets after it must still map exactly.
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.

import type {} from 'x' prints as a value import

2 participants