Skip to content

Commit 091dd1d

Browse files
committed
fix(cli): strip comments before checking type-only import specifiers
A comment inside a named import clause (e.g. `import { type A, // note\ntype B } from 'octane'`) would produce a non-type fragment after comma-splitting, causing `importsOctaneAtRuntime` to misclassify a fully type-erased import as runtime. Strip line and block comments from the clause content before splitting.
1 parent f4990f4 commit 091dd1d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎packages/cli/src/commands/analyze/strong-coverage.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ function importsOctaneAtRuntime(source) {
137137
const named = /^\{([\s\S]*)\}$/.exec(clause);
138138
if (named === null) return true;
139139
const specifiers = named[1]
140+
.replace(/\/\/[^\n]*|\/\*[\s\S]*?\*\//g, '')
140141
.split(',')
141142
.map((specifier) => specifier.trim())
142143
.filter(Boolean);

0 commit comments

Comments
 (0)