Skip to content

Commit cb96350

Browse files
committed
build(deps): bump @flex-development/mlly from 1.0.0-alpha.19 to 1.0.0-alpha.20
Signed-off-by: Lexus Drumgold <[email protected]>
1 parent bace4e8 commit cb96350

18 files changed

+485
-472
lines changed

.dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ kaisugi
1717
ksort
1818
lcov
1919
mkbuild
20+
nocase
2021
nvmrc
2122
pkgs
2223
preid

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ convenience of TypeScript users who do not hoist packages, but may need to `impo
119119
### Types
120120

121121
- [`GetCanonicalFileName`](./src/types/get-canonical-file-name.mts)
122+
- [`ReadDirectory`](./src/types/read-directory.mts)
122123

123124
## Related
124125

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,8 @@
6666
"tsconfig-utils": "./src/internal/fs.browser.mts",
6767
"default": "./dist/internal/fs.browser.mjs"
6868
},
69-
"node": {
70-
"tsconfig-utils": "./src/internal/fs.node.mts",
71-
"default": "./dist/internal/fs.node.mjs"
72-
},
73-
"default": "./dist/internal/fs.node.mjs"
69+
"node": "fs",
70+
"default": "fs"
7471
},
7572
"#internal/*": {
7673
"tsconfig-utils": "./src/internal/*.mts",
@@ -128,7 +125,7 @@
128125
},
129126
"dependencies": {
130127
"@flex-development/errnode": "3.1.1",
131-
"@flex-development/mlly": "1.0.0-alpha.19",
128+
"@flex-development/mlly": "1.0.0-alpha.20",
132129
"@flex-development/pathe": "4.0.1",
133130
"@flex-development/pkg-types": "4.1.0",
134131
"@flex-development/tsconfig-types": "5.1.0",

src/interfaces/__tests__/file-system.spec-d.mts

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,8 @@ describe('unit-d:interfaces/FileSystem', () => {
1111
expectTypeOf<TestSubject>().toMatchTypeOf<mlly.FileSystem>()
1212
})
1313

14-
describe('readFile', () => {
15-
type Subject = TestSubject['readFile']
16-
17-
it('should match [this: void]', () => {
18-
expectTypeOf<Subject>().thisParameter.toEqualTypeOf<void>()
19-
})
20-
21-
describe('parameters', () => {
22-
it('should be callable with [mlly.ModuleId]', () => {
23-
expectTypeOf<Subject>().parameters.toEqualTypeOf<[mlly.ModuleId]>()
24-
})
25-
})
26-
27-
describe('returns', () => {
28-
it('should return Buffer | string', () => {
29-
expectTypeOf<Subject>().returns.toEqualTypeOf<Buffer | string>()
30-
})
31-
})
32-
})
33-
34-
describe('readdir', () => {
35-
type Subject = TestSubject['readdir']
14+
describe('readdirSync', () => {
15+
type Subject = TestSubject['readdirSync']
3616

3717
it('should match [this: void]', () => {
3818
expectTypeOf<Subject>().thisParameter.toEqualTypeOf<void>()
@@ -50,44 +30,4 @@ describe('unit-d:interfaces/FileSystem', () => {
5030
})
5131
})
5232
})
53-
54-
describe('realpath', () => {
55-
type Subject = TestSubject['realpath']
56-
57-
it('should match [this: void]', () => {
58-
expectTypeOf<Subject>().thisParameter.toEqualTypeOf<void>()
59-
})
60-
61-
describe('parameters', () => {
62-
it('should be callable with [mlly.ModuleId]', () => {
63-
expectTypeOf<Subject>().parameters.toEqualTypeOf<[mlly.ModuleId]>()
64-
})
65-
})
66-
67-
describe('returns', () => {
68-
it('should return string', () => {
69-
expectTypeOf<Subject>().returns.toEqualTypeOf<string>()
70-
})
71-
})
72-
})
73-
74-
describe('stat', () => {
75-
type Subject = TestSubject['stat']
76-
77-
it('should match [this: void]', () => {
78-
expectTypeOf<Subject>().thisParameter.toEqualTypeOf<void>()
79-
})
80-
81-
describe('parameters', () => {
82-
it('should be callable with [mlly.ModuleId]', () => {
83-
expectTypeOf<Subject>().parameters.toEqualTypeOf<[mlly.ModuleId]>()
84-
})
85-
})
86-
87-
describe('returns', () => {
88-
it('should return mlly.Stats', () => {
89-
expectTypeOf<Subject>().returns.toEqualTypeOf<mlly.Stats>()
90-
})
91-
})
92-
})
9333
})

src/interfaces/__tests__/host-parse-config.spec-d.mts

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,23 @@
44
*/
55

66
import type TestSubject from '#interfaces/host-parse-config'
7-
import type { ModuleId } from '@flex-development/mlly'
8-
import type { ModuleResolutionHost } from '@flex-development/tsconfig-utils'
7+
import type {
8+
ModuleResolutionHost,
9+
ReadDirectory
10+
} from '@flex-development/tsconfig-utils'
911
import type ts from 'typescript'
1012

1113
describe('unit-d:interfaces/ParseConfigHost', () => {
1214
it('should extend ModuleResolutionHost', () => {
1315
expectTypeOf<TestSubject>().toMatchTypeOf<ModuleResolutionHost>()
1416
})
1517

18+
it('should match [readDirectory: ReadDirectory]', () => {
19+
expectTypeOf<TestSubject>()
20+
.toHaveProperty('readDirectory')
21+
.toEqualTypeOf<ReadDirectory>
22+
})
23+
1624
it('should match [useCaseSensitiveFileNames: boolean]', () => {
1725
expectTypeOf<TestSubject>()
1826
.toHaveProperty('useCaseSensitiveFileNames')
@@ -23,30 +31,4 @@ describe('unit-d:interfaces/ParseConfigHost', () => {
2331
expectTypeOf<TestSubject>()
2432
.toMatchTypeOf<Required<Omit<ts.ParseConfigHost, 'trace'>>>()
2533
})
26-
27-
describe('readDirectory', () => {
28-
type Subject = TestSubject['readDirectory']
29-
30-
it('should match [this: void]', () => {
31-
expectTypeOf<Subject>().thisParameter.toEqualTypeOf<void>()
32-
})
33-
34-
describe('parameters', () => {
35-
it('should be callable with [ModuleId, Set<string> | readonly string[] | undefined, Set<string> | readonly string[] | undefined, Set<string> | readonly string[] | undefined, number | null | undefined]', () => {
36-
expectTypeOf<Subject>().parameters.toEqualTypeOf<[
37-
ModuleId,
38-
(Set<string> | readonly string[] | undefined)?,
39-
(Set<string> | readonly string[] | undefined)?,
40-
(Set<string> | readonly string[] | undefined)?,
41-
(number | null | undefined)?
42-
]>()
43-
})
44-
})
45-
46-
describe('returns', () => {
47-
it('should return readonly string[]', () => {
48-
expectTypeOf<Subject>().returns.toEqualTypeOf<readonly string[]>()
49-
})
50-
})
51-
})
5234
})

src/interfaces/file-system.mts

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,6 @@ import type * as mlly from '@flex-development/mlly'
1313
* @extends {mlly.FileSystem}
1414
*/
1515
interface FileSystem extends mlly.FileSystem {
16-
/**
17-
* Get the contents of a file.
18-
*
19-
* @see {@linkcode Buffer}
20-
* @see {@linkcode mlly.ModuleId}
21-
*
22-
* @override
23-
*
24-
* @this {void}
25-
*
26-
* @param {mlly.ModuleId} id
27-
* The path or `file:` URL to handle
28-
* @return {Buffer | string}
29-
* File contents
30-
*/
31-
readFile(this: void, id: mlly.ModuleId): Buffer | string
32-
3316
/**
3417
* Read the contents of a directory.
3518
*
@@ -42,39 +25,7 @@ interface FileSystem extends mlly.FileSystem {
4225
* @return {string[]}
4326
* List of filenames
4427
*/
45-
readdir(this: void, id: mlly.ModuleId): string[]
46-
47-
/**
48-
* Get the resolved pathname of `id`.
49-
*
50-
* @see {@linkcode mlly.ModuleId}
51-
*
52-
* @override
53-
*
54-
* @this {void}
55-
*
56-
* @param {mlly.ModuleId} id
57-
* The path or `file:` URL to handle
58-
* @return {string}
59-
* Canonical pathname of `id`
60-
*/
61-
realpath(this: void, id: mlly.ModuleId): string
62-
63-
/**
64-
* Get information about a directory or file.
65-
*
66-
* @see {@linkcode mlly.ModuleId}
67-
* @see {@linkcode mlly.Stats}
68-
*
69-
* @override
70-
*
71-
* @this {void}
72-
*
73-
* @param {mlly.ModuleId} id
74-
* The path or `file:` URL to handle
75-
* @return {mlly.Stats}
76-
* Info about `id`
77-
*/
78-
stat(this: void, id: mlly.ModuleId): mlly.Stats
28+
readdirSync(this: void, id: mlly.ModuleId): string[]
7929
}
30+
8031
export type { FileSystem as default }

src/interfaces/host-parse-config.mts

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/**
2-
* @file Interfaces - ModuleResolutionHost
3-
* @module tsconfig-utils/interfaces/ModuleResolutionHost
2+
* @file Interfaces - ParseConfigHost
3+
* @module tsconfig-utils/interfaces/ParseConfigHost
44
*/
55

6-
import type { ModuleId } from '@flex-development/mlly'
7-
import type { ModuleResolutionHost } from '@flex-development/tsconfig-utils'
6+
import type {
7+
ModuleResolutionHost,
8+
ReadDirectory
9+
} from '@flex-development/tsconfig-utils'
810

911
/**
1012
* Configuration parser host API.
@@ -19,31 +21,9 @@ interface ParseConfigHost extends ModuleResolutionHost {
1921
/**
2022
* Get a list of files in a directory.
2123
*
22-
* @see {@linkcode ModuleId}
23-
*
24-
* @this {void}
25-
*
26-
* @param {ModuleId} id
27-
* The directory path or URL to read
28-
* @param {Set<string> | ReadonlyArray<string> | undefined} [extensions]
29-
* List of file extensions to filter for
30-
* @param {Set<string> | ReadonlyArray<string> | undefined} [exclude]
31-
* List of of glob patterns matching files to exclude
32-
* @param {Set<string> | ReadonlyArray<string> | undefined} [include]
33-
* List of of glob patterns matching files to include
34-
* @param {number | null | undefined} [depth]
35-
* Maximum search depth (inclusive)
36-
* @return {ReadonlyArray<string>}
37-
* List of files under directory at `id`
24+
* @see {@linkcode ReadDirectory}
3825
*/
39-
readDirectory(
40-
this: void,
41-
id: ModuleId,
42-
extensions?: Set<string> | readonly string[] | undefined,
43-
exclude?: Set<string> | readonly string[] | undefined,
44-
include?: Set<string> | readonly string[] | undefined,
45-
depth?: number | null | undefined
46-
): readonly string[]
26+
readDirectory: ReadDirectory
4727

4828
/**
4929
* Treat filenames as case-sensitive?
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/**
2+
* @file Unit Tests - matchFiles
3+
* @module tsconfig-utils/internal/tests/unit/matchFiles
4+
*/
5+
6+
import testSubject from '#internal/match-files'
7+
import toPath from '#internal/to-path'
8+
import createModuleResolutionHost from '#lib/create-module-resolution-host'
9+
import * as mlly from '@flex-development/mlly'
10+
import type { FileSystem } from '@flex-development/tsconfig-utils'
11+
import { alphabetize, identity } from '@flex-development/tutils'
12+
import ts from 'typescript'
13+
import tsconfig from '../../../tsconfig.json' with { type: 'json' }
14+
15+
describe('unit:internal/matchFiles', () => {
16+
it.each<[
17+
id: mlly.ModuleId,
18+
extensions: Set<string> | readonly string[] | undefined,
19+
exclude: Set<string> | readonly string[] | undefined,
20+
include: Set<string> | readonly string[] | undefined,
21+
useCaseSensitiveFileNames?: boolean | null | undefined,
22+
depth?: number | null | undefined,
23+
fs?: FileSystem | null | undefined
24+
]>([
25+
[
26+
new URL('src', mlly.cwd()),
27+
['.cjs', '.cts', '.js', '.json', '.mjs', '.mts', '.ts'],
28+
tsconfig.exclude,
29+
tsconfig.include,
30+
null,
31+
0
32+
],
33+
[
34+
mlly.cwd(),
35+
['.cjs', '.cts', '.js', '.json', '.mjs', '.mts', '.ts'],
36+
tsconfig.exclude,
37+
tsconfig.include
38+
],
39+
[
40+
mlly.cwd(),
41+
['.mjs', '.mts', '.ts'],
42+
tsconfig.exclude,
43+
tsconfig.include,
44+
undefined,
45+
1
46+
]
47+
])('should return list of files under directory at `id` (%#)', (
48+
id,
49+
extensions,
50+
exclude,
51+
include,
52+
useCaseSensitiveFileNames,
53+
depth,
54+
fs
55+
) => {
56+
// Arrange
57+
const expected: readonly string[] = alphabetize(ts.sys.readDirectory(
58+
toPath(id),
59+
extensions ? [...extensions] : undefined,
60+
exclude ? [...exclude] : undefined,
61+
include ? [...include] : undefined,
62+
depth ?? undefined
63+
), identity)
64+
65+
// Act
66+
const result = testSubject(
67+
createModuleResolutionHost(),
68+
id,
69+
extensions,
70+
exclude,
71+
include,
72+
useCaseSensitiveFileNames,
73+
depth,
74+
fs
75+
)
76+
77+
// Expect
78+
expect(result).to.be.an('array').and.eql(expected).and.not.be.frozen
79+
})
80+
})

0 commit comments

Comments
 (0)