Skip to content

Commit b6d2b6a

Browse files
chore: fix types.
1 parent 0e83422 commit b6d2b6a

3 files changed

Lines changed: 3 additions & 23 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
path: npm-debug.log
3434
- name: Lint
3535
run: npm run lint
36+
- name: Type Check
37+
run: npm run check-types
3638
- name: Test
3739
run: npm test
3840
- name: Report Coverage

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env sh
22
npm run prettier:check
33
npm run lint
4+
npm run check-types
45
npm test

src/utils.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,11 @@
1-
import { extname } from 'node:path'
21
import { ancestorWalk } from './walk.js'
32

43
import type { Node } from 'oxc-parser'
5-
import type { Specifier } from '@knighted/specifier'
64

75
import type { IdentMeta, SpannedNode, Scope, CjsExport } from './types.js'
86
import { identifier } from './helpers/identifier.js'
97
import { scopeNodes } from './utils/scopeNodes.js'
108

11-
type UpdateSrcLang = Parameters<Specifier['updateSrc']>[1]
12-
const getLangFromExt = (filename: string): UpdateSrcLang => {
13-
const ext = extname(filename).toLowerCase()
14-
15-
if (ext === '.js' || ext === '.mjs' || ext === '.cjs') {
16-
return 'js'
17-
}
18-
19-
if (ext === '.ts' || ext === '.mts' || ext === '.cts') {
20-
return 'ts'
21-
}
22-
23-
if (ext === '.tsx') {
24-
return 'tsx'
25-
}
26-
27-
if (ext === '.jsx') {
28-
return 'jsx'
29-
}
30-
}
319
const isValidUrl = (url: string) => {
3210
try {
3311
new URL(url)
@@ -337,7 +315,6 @@ const collectModuleIdentifiers = async (ast: Node, hoisting: boolean = true) =>
337315
}
338316

339317
export {
340-
getLangFromExt,
341318
isValidUrl,
342319
collectScopeIdentifiers,
343320
collectModuleIdentifiers,

0 commit comments

Comments
 (0)