Skip to content

Commit 402bed6

Browse files
committed
chore: .mts migration
Signed-off-by: Lexus Drumgold <[email protected]>
1 parent 2c4d3e2 commit 402bed6

File tree

122 files changed

+457
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+457
-468
lines changed

.codecov.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ component_management:
2727
- component_id: internal
2828
name: internal
2929
paths:
30-
- src/internal/*.ts
30+
- src/internal/*.mts
3131
- component_id: lib
3232
name: lib
3333
paths:
34-
- src/lib/*.ts
34+
- src/lib/*.mts
3535

3636
coverage:
3737
precision: 2
@@ -89,14 +89,15 @@ github_checks:
8989
annotations: true
9090

9191
ignore:
92+
- '**/*.d.mts'
9293
- '**/__mocks__/**'
9394
- '**/__tests__/**'
94-
- '**/index.ts'
95+
- '**/index.mts'
9596
- '**/interfaces/**'
9697
- '**/types/**'
97-
- '!src/index.ts'
98-
- src/internal/*.browser.ts
98+
- '!src/index.mts'
99+
- src/internal/*.browser.mts
99100

100101
profiling:
101102
critical_files_paths:
102-
- src/lib/*.ts
103+
- src/lib/*.mts

.dictionary.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ hmarr
1919
iife
2020
jchen
2121
kaisugi
22+
ksort
2223
lcov
2324
lintstagedrc
2425
mkbuild
2526
mlly
27+
nocheck
2628
nvmrc
2729
pathe
2830
pjson

.github/workflows/ci.yml

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ jobs:
5858
runs-on: ubuntu-latest
5959
outputs:
6060
cache-key: ${{ steps.cache-key.outputs.result }}
61-
version: ${{ steps.version.outputs.result }}
61+
test-files: ${{ steps.test-files.outputs.files_exists }}
62+
typecheck-files: ${{ steps.typecheck-files.outputs.files_exists }}
6263
version-typescript: ${{ steps.version-typescript.outputs.result }}
64+
version: ${{ steps.version.outputs.result }}
6365
steps:
6466
- id: debug
6567
name: Print environment variables and event payload
@@ -97,6 +99,16 @@ jobs:
9799
- id: version-typescript
98100
name: Get TypeScript version
99101
run: echo "result=$(jq .devDependencies.typescript package.json -r)" >>$GITHUB_OUTPUT
102+
- id: test-files
103+
name: Check for test files
104+
uses: andstor/[email protected]
105+
with:
106+
files: '**/__tests__/*.spec.+(mts|tsx)'
107+
- id: typecheck-files
108+
name: Check for typecheck files
109+
uses: andstor/[email protected]
110+
with:
111+
files: '**/__tests__/*.spec-d.mts'
100112
commitlint:
101113
needs: preflight
102114
runs-on: ubuntu-latest
@@ -248,43 +260,34 @@ jobs:
248260
- 5.5.4
249261
- 5.4.5
250262
- 5.0.4
263+
if: ${{ fromJson(needs.preflight.outputs.typecheck-files) }}
251264
steps:
252265
- id: checkout
253266
name: Checkout ${{ env.REF_NAME }}
254267
uses: actions/[email protected]
255268
with:
256269
persist-credentials: false
257270
ref: ${{ env.REF }}
258-
- id: test-files-check
259-
name: Check for typecheck files
260-
uses: andstor/[email protected]
261-
with:
262-
files: '**/__tests__/*.spec-d.ts'
263271
- id: node
264-
if: steps.test-files-check.outputs.files_exists == 'true'
265272
name: Setup Node.js
266273
uses: actions/[email protected]
267274
with:
268275
cache: yarn
269276
cache-dependency-path: yarn.lock
270277
node-version-file: .nvmrc
271278
- id: cache
272-
if: steps.test-files-check.outputs.files_exists == 'true'
273279
name: Restore dependencies cache
274280
uses: actions/[email protected]
275281
with:
276282
key: ${{ needs.preflight.outputs.cache-key }}
277283
path: ${{ env.CACHE_PATH }}
278284
- id: typescript
279-
if: steps.test-files-check.outputs.files_exists == 'true'
280285
name: Install typescript@${{ matrix.typescript-version }}
281286
run: yarn add -D typescript@${{ matrix.typescript-version }}
282287
- id: print-typescript-version
283-
if: steps.test-files-check.outputs.files_exists == 'true'
284288
name: Print TypeScript version
285289
run: jq .devDependencies.typescript package.json -r
286290
- id: typecheck
287-
if: steps.test-files-check.outputs.files_exists == 'true'
288291
name: Run typecheck
289292
run: yarn typecheck
290293
test:
@@ -302,20 +305,15 @@ jobs:
302305
COVERAGE_SUMMARY: ./coverage/coverage-summary.json
303306
PCT: .total.branches.pct + .total.functions.pct + .total.lines.pct + .total.statements.pct
304307
VITEST_REPORT: ./.vitest-reports/test.blob.json
308+
if: ${{ fromJson(needs.preflight.outputs.test-files) }}
305309
steps:
306310
- id: checkout
307311
name: Checkout ${{ env.REF_NAME }}
308312
uses: actions/[email protected]
309313
with:
310314
persist-credentials: false
311315
ref: ${{ env.REF }}
312-
- id: test-files-check
313-
name: Check for test files
314-
uses: andstor/[email protected]
315-
with:
316-
files: '**/__tests__/*.spec.+(ts|tsx)'
317316
- id: node
318-
if: steps.test-files-check.outputs.files_exists == 'true'
319317
name: Setup Node.js v${{ matrix.node-version }}
320318
uses: actions/[email protected]
321319
with:
@@ -324,35 +322,30 @@ jobs:
324322
check-latest: true
325323
node-version: ${{ matrix.node-version }}
326324
- id: cache
327-
if: steps.test-files-check.outputs.files_exists == 'true'
328325
name: Restore dependencies cache
329326
uses: actions/[email protected]
330327
with:
331328
key: ${{ needs.preflight.outputs.cache-key }}
332329
path: ${{ env.CACHE_PATH }}
333330
- id: test
334-
if: steps.test-files-check.outputs.files_exists == 'true'
335331
name: Run tests
336332
run: |
337333
yarn test:cov --coverage.thresholds.100=false \
338334
&& echo "coverage=$(jq '${{ env.PCT }}' ${{ env.COVERAGE_SUMMARY }} -r)" >>$GITHUB_OUTPUT
339335
- id: report
340-
if: steps.test-files-check.outputs.files_exists == 'true'
341336
name: Upload report
342337
uses: actions/[email protected]
343338
with:
344339
name: ${{ format('vitest-report-{0}-{1}.json', github.event.repository.name, env.SHA) }}
345340
path: ${{ env.VITEST_REPORT }}
346341
- id: coverage-summary
347-
if: steps.test-files-check.outputs.files_exists == 'true'
348342
name: Upload coverage summary
349343
uses: actions/[email protected]
350344
with:
351345
name: |
352346
${{ format('coverage-summary-{0}-{1}.json', github.event.repository.name, env.SHA) }}
353347
path: ${{ env.COVERAGE_SUMMARY }}
354348
- id: codecov
355-
if: steps.test-files-check.outputs.files_exists == 'true'
356349
name: Upload coverage report to Codecov
357350
uses: codecov/[email protected]
358351
env:
@@ -373,9 +366,7 @@ jobs:
373366
token: ${{ secrets.CODECOV_TOKEN }}
374367
verbose: true
375368
- id: coverage-failure
376-
if: |
377-
steps.test-files-check.outputs.files_exists == 'true'
378-
&& ${{ toJson(steps.test.outputs.coverage) }} != 400
369+
if: ${{ toJson(steps.test.outputs.coverage) }} != 400
379370
name: Coverage threshold failure (${{ steps.test.outputs.coverage }})
380371
run: yarn test:cov:reports
381372
build:

.lintstagedrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
],
77
"**/*.{cts,mts,ts}": "yarn test --changed --typecheck --mode=typecheck",
88
"**/yarn.lock": "yarn dedupe --check",
9-
"src/**/*.ts": [
9+
"src/**/*.mts": [
1010
"yarn test --changed --coverage",
1111
"yarn build",
1212
"bash -c tsc -p tsconfig.build.json"

.vscode/settings.json

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,6 @@
231231
"resolutions"
232232
],
233233
"vsicons.associations.files": [
234-
{
235-
"extensions": [".eslintrc.base.cjs"],
236-
"format": "svg",
237-
"icon": "eslint"
238-
},
239234
{
240235
"extensions": ["build.json", "typecheck.json"],
241236
"format": "svg",
@@ -247,14 +242,9 @@
247242
"icon": "vitest"
248243
},
249244
{
250-
"extensions": ["spec-d.ts"],
245+
"extensions": ["spec-d.mts"],
251246
"format": "svg",
252247
"icon": "testts"
253-
},
254-
{
255-
"extensions": ["yarnrc.yml"],
256-
"format": "svg",
257-
"icon": "yarn"
258248
}
259249
],
260250
"vsicons.associations.folders": [
@@ -273,11 +263,6 @@
273263
"format": "svg",
274264
"icon": "private"
275265
},
276-
{
277-
"extensions": ["namespaces"],
278-
"format": "svg",
279-
"icon": "module"
280-
},
281266
{
282267
"extensions": ["patches"],
283268
"format": "svg",

.yarnrc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ changesetBaseRefs:
77
changesetIgnorePatterns:
88
- '!{docs,src/**,{CHANGELOG,LICENSE,README}.md,package.json}'
99
- '**/*.snap'
10-
- '**/*.spec.ts'
11-
- '**/*.spec-d.ts'
10+
- '**/*.spec.mts'
11+
- '**/*.spec-d.mts'
1212

1313
compressionLevel: mixed
1414

README.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -99,27 +99,27 @@ import {
9999

100100
This package exports the following identifiers:
101101

102-
- [`canParseUrl`](./src/lib/can-parse-url.ts)
103-
- [`cwd`](./src/lib/cwd.ts)
104-
- [`defaultConditions`](./src/lib/default-conditions.ts)
105-
- [`defaultExtensions`](./src/lib/default-extensions.ts)
106-
- [`defaultMainFields`](./src/lib/default-main-fields.ts)
107-
- [`extensionFormatMap`](./src/lib/extension-format-map.ts)
108-
- [`formats`](./src/lib/formats.ts)
109-
- [`isAbsoluteSpecifier`](./src/lib/is-absolute-specifier.ts)
110-
- [`isArrayIndex`](./src/lib/is-array-index.ts)
111-
- [`isBareSpecifier`](./src/lib/is-bare-specifier.ts)
112-
- [`isDirectory`](./src/lib/is-directory.ts)
113-
- [`isFile`](./src/lib/is-file.ts)
114-
- [`isImportsSubpath`](./src/lib/is-imports-subpath.ts)
115-
- [`isRelativeSpecifier`](./src/lib/is-relative-specifier.ts)
116-
- [`lookupPackageScope`](./src/lib/lookup-package-scope.ts)
117-
- [`patternKeyCompare`](./src/lib/pattern-key-compare.ts)
118-
- [`patternMatch`](./src/lib/pattern-match.ts)
119-
- [`readPackageJson`](./src/lib/read-package-json.ts)
120-
- [`resolveAlias`](./src/lib/resolve-alias.ts)
121-
- [`resolveModule`](./src/lib/resolve-module.ts)
122-
- [`resolver`](./src/lib/resolver.ts)
102+
- [`canParseUrl`](./src/lib/can-parse-url.mts)
103+
- [`cwd`](./src/lib/cwd.mts)
104+
- [`defaultConditions`](./src/lib/default-conditions.mts)
105+
- [`defaultExtensions`](./src/lib/default-extensions.mts)
106+
- [`defaultMainFields`](./src/lib/default-main-fields.mts)
107+
- [`extensionFormatMap`](./src/lib/extension-format-map.mts)
108+
- [`formats`](./src/lib/formats.mts)
109+
- [`isAbsoluteSpecifier`](./src/lib/is-absolute-specifier.mts)
110+
- [`isArrayIndex`](./src/lib/is-array-index.mts)
111+
- [`isBareSpecifier`](./src/lib/is-bare-specifier.mts)
112+
- [`isDirectory`](./src/lib/is-directory.mts)
113+
- [`isFile`](./src/lib/is-file.mts)
114+
- [`isImportsSubpath`](./src/lib/is-imports-subpath.mts)
115+
- [`isRelativeSpecifier`](./src/lib/is-relative-specifier.mts)
116+
- [`lookupPackageScope`](./src/lib/lookup-package-scope.mts)
117+
- [`patternKeyCompare`](./src/lib/pattern-key-compare.mts)
118+
- [`patternMatch`](./src/lib/pattern-match.mts)
119+
- [`readPackageJson`](./src/lib/read-package-json.mts)
120+
- [`resolveAlias`](./src/lib/resolve-alias.mts)
121+
- [`resolveModule`](./src/lib/resolve-module.mts)
122+
- [`resolver`](./src/lib/resolver.mts)
123123
- `legacyMainResolve`
124124
- `moduleResolve`
125125
- `packageExportsResolve`
@@ -128,8 +128,8 @@ This package exports the following identifiers:
128128
- `packageResolve`
129129
- `packageSelfResolve`
130130
- `packageTargetResolve`
131-
- [`root`](./src/lib/root.ts)
132-
- [`toRelativeSpecifier`](./src/lib/to-relative-specifier.ts)
131+
- [`root`](./src/lib/root.mts)
132+
- [`toRelativeSpecifier`](./src/lib/to-relative-specifier.mts)
133133

134134
There is no default export.
135135

@@ -139,25 +139,25 @@ This package is fully typed with [TypeScript][].
139139

140140
### Interfaces
141141

142-
- [`Aliases`](src/interfaces/aliases.ts)
143-
- [`FileSystem`](src/interfaces/file-system.ts)
144-
- [`MainFieldMap`](src/interfaces/main-field-map.ts)
145-
- [`ModuleFormatMap`](src/interfaces/module-format-map.ts)
146-
- [`ResolveAliasOptions`](src/interfaces/options-resolve-alias.ts)
147-
- [`ResolveModuleOptions`](src/interfaces/options-resolve-module.ts)
148-
- [`ProtocolMap`](src/interfaces/protocol-map.ts)
149-
- [`Stats`](src/interfaces/stats.ts)
142+
- [`Aliases`](src/interfaces/aliases.mts)
143+
- [`FileSystem`](src/interfaces/file-system.mts)
144+
- [`MainFieldMap`](src/interfaces/main-field-map.mts)
145+
- [`ModuleFormatMap`](src/interfaces/module-format-map.mts)
146+
- [`ResolveAliasOptions`](src/interfaces/options-resolve-alias.mts)
147+
- [`ResolveModuleOptions`](src/interfaces/options-resolve-module.mts)
148+
- [`ProtocolMap`](src/interfaces/protocol-map.mts)
149+
- [`Stats`](src/interfaces/stats.mts)
150150

151151
### Type Aliases
152152

153-
- [`ChangeExtFn`](src/types/change-ext-fn.ts)
154-
- [`MainField`](src/types/main-field.ts)
155-
- [`ModuleFormat`](src/types/module-format.ts)
156-
- [`ModuleId`](src/types/module-id.ts)
157-
- [`Numeric`](src/types/numeric.ts)
158-
- [`PatternKeyCompareResult`](src/types/pattern-key-compare-result.ts)
159-
- [`PatternMatch`](src/types/pattern-match.ts)
160-
- [`Protocol`](src/types/protocol.ts)
153+
- [`ChangeExtFn`](src/types/change-ext-fn.mts)
154+
- [`MainField`](src/types/main-field.mts)
155+
- [`ModuleFormat`](src/types/module-format.mts)
156+
- [`ModuleId`](src/types/module-id.mts)
157+
- [`Numeric`](src/types/numeric.mts)
158+
- [`PatternKeyCompareResult`](src/types/pattern-key-compare-result.mts)
159+
- [`PatternMatch`](src/types/pattern-match.mts)
160+
- [`Protocol`](src/types/protocol.mts)
161161

162162
## Contribute
163163

File renamed without changes.
File renamed without changes.

__fixtures__/parent.ts renamed to __fixtures__/parent.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ import pathe from '@flex-development/pathe'
1010
*
1111
* @const {URL} parent
1212
*/
13-
const parent: URL = pathe.pathToFileURL('__fixtures__/parent.ts')
13+
const parent: URL = pathe.pathToFileURL('__fixtures__/parent.mts')
1414

1515
export default parent

__mocks__/.gitkeep

Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

build/build.ts renamed to build/build.mts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ await make({
1111
{
1212
dts: 'only',
1313
entryPoints: [
14-
'src/*.ts',
15-
'src/interfaces/*.ts',
16-
'src/lib/*.ts',
17-
'src/types/*.ts'
14+
'src/*.mts',
15+
'src/interfaces/*.mts',
16+
'src/lib/*.mts',
17+
'src/types/*.mts'
1818
]
1919
},
2020
{
2121
dts: false,
22-
entryPoints: ['src/internal/*.ts', 'src/lib/*.ts', 'src/*.ts']
22+
entryPoints: ['src/internal/*.mts', 'src/lib/*.mts', 'src/*.mts']
2323
}
2424
],
2525
target: ['node18', tsconfig.compilerOptions.target],

0 commit comments

Comments
 (0)