We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ae13f5 commit 880c4f4Copy full SHA for 880c4f4
src/cli.ts
@@ -305,7 +305,5 @@ export function isMain(
305
}
306
307
export function normalizeExt(ext?: string) {
308
- if (!ext) return
309
- if (!/^\.?\w+(\.\w+)*$/.test(ext)) throw new Error(`Invalid extension ${ext}`)
310
- return ext[0] === '.' ? ext : `.${ext}`
+ return ext ? path.parse(`foo.${ext}`).ext : ext
311
test/cli.test.js
@@ -271,7 +271,7 @@ describe('cli', () => {
271
test('normalizeExt()', () => {
272
assert.equal(normalizeExt('.ts'), '.ts')
273
assert.equal(normalizeExt('ts'), '.ts')
274
+ assert.equal(normalizeExt('.'), '.')
275
assert.equal(normalizeExt(), undefined)
- assert.throws(() => normalizeExt('.'))
276
})
277
0 commit comments