Skip to content

Commit 0eddfc4

Browse files
authored
fix: extractImports supports reading CRLF files (#848
1 parent 6d86696 commit 0eddfc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/declaration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const singlelineCommentsRE = /\/\/.*$/gm
1212

1313
function extractImports(code: string) {
1414
// eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/no-misleading-capturing-group
15-
return Object.fromEntries(Array.from(code.matchAll(/['"]?([^\s'"]+)['"]?\s*:\s*(.+?)[,;\n]/g)).map(i => [i[1], i[2]]))
15+
return Object.fromEntries(Array.from(code.matchAll(/['"]?([^\s'"]+)['"]?\s*:\s*(.+?)[,;\r\n]/g)).map(i => [i[1], i[2]]))
1616
}
1717

1818
export function parseDeclaration(code: string): DeclarationImports | undefined {

0 commit comments

Comments
 (0)