Skip to content

Commit ee15b2d

Browse files
authored
feat: node next module resolution for ts (#320)
1 parent d00ba6d commit ee15b2d

12 files changed

Lines changed: 31 additions & 26 deletions

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": [
33
"@trigen/eslint-config",
4+
"@trigen/eslint-config/tsm",
45
"@trigen/eslint-config/typescript",
56
"@trigen/eslint-config/typescript-requiring-type-checking",
67
"@trigen/eslint-config/jest"

src/args.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect } from 'vitest'
2-
import { alias, option } from './args'
2+
import { alias, option } from './args.js'
33

44
describe('args', () => {
55
describe('option', () => {

src/args.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
OptionsReaderState,
66
OptionsReaderRead,
77
OptionResult
8-
} from './types'
9-
import { matchArgName } from './utils'
8+
} from './types.js'
9+
import { matchArgName } from './utils.js'
1010

1111
/**
1212
* Describe argument with aliases.

src/core.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, it, expect } from 'vitest'
2-
import { setArgs } from './argv'
3-
import * as core from './core'
4-
import { alias } from './args'
2+
import { setArgs } from './argv.js'
3+
import * as core from './core.js'
4+
import { alias } from './args.js'
55

66
describe('core', () => {
77
describe('read', () => {

src/core.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { argv } from './argv'
2-
import { ArgRef } from './types'
3-
import { findArgName } from './utils'
1+
import { argv } from './argv.js'
2+
import { ArgRef } from './types.js'
3+
import { findArgName } from './utils.js'
44

55
/**
66
* Read next argument.

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export * from './types'
2-
export * from './argv'
3-
export * from './core'
4-
export * from './args'
5-
export * from './options'
1+
export * from './types.js'
2+
export * from './argv.js'
3+
export * from './core.js'
4+
export * from './args.js'
5+
export * from './options.js'

src/options.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, it, expect } from 'vitest'
2-
import { setArgs, argv } from './argv'
3-
import { option } from './args'
4-
import { readOptions } from './options'
2+
import { setArgs, argv } from './argv.js'
3+
import { option } from './args.js'
4+
import { readOptions } from './options.js'
55

66
describe('options', () => {
77
describe('readOptions', () => {

src/options.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { argv } from './argv'
2-
import { OptionReader, OptionResult } from './types'
3-
import { Merge, ReturnTypes, UnionMerge } from './utils'
1+
import { argv } from './argv.js'
2+
import { OptionReader, OptionResult } from './types.js'
3+
import { Merge, ReturnTypes, UnionMerge } from './utils.js'
44

55
function isOption(arg: string) {
66
return /^--?[^-].*/.test(arg)

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import { ArgRef } from './types'
2+
import { ArgRef } from './types.js'
33

44
type FlatMerge<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
55

test/argue.test-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expectType } from 'tsd'
2-
import { alias, expect, option, readOptions } from '../src'
2+
import { alias, expect, option, readOptions } from '../src/index.js'
33

44
expectType<'add' | 'install'>(expect('add', alias('install', 'i')))
55

0 commit comments

Comments
 (0)