Skip to content

Commit

Permalink
fix: edge case of dts RegExp
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 committed Jan 9, 2025
1 parent e2e2896 commit 76c7b1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const JS_EXTENSIONS: string[] = [
'js',
'mjs',
'jsx',
'(?<!d.)ts', // ignore d.ts,
'(?<!d.)mts', // ditto
'(?<!d.)cts', // ditto
'(?<!\\.d\\.)ts', // ignore d.ts,
'(?<!\\.d\\.)mts', // ditto
'(?<!\\.d\\.)cts', // ditto
'tsx',
'cjs',
'cjsx',
Expand Down
2 changes: 2 additions & 0 deletions packages/core/tests/constant.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const jsTestStrings = [
{ str: 'index.js', expected: true },
{ str: './index.ts', expected: true },
{ str: './index.d.ts', expected: false },
{ str: './spread.ts', expected: true },
{ str: './index.d.jts', expected: false },
{ str: '/Users/path/index.ts', expected: true },
{ str: '/Users/path/index.d.ts', expected: false },
{ str: '/Users/path/index.d.mts', expected: false },
Expand Down

0 comments on commit 76c7b1b

Please sign in to comment.