-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for TypeScript config files (
.size-limit.ts
, `.size-lim…
…it.mts`, `.size-limit.cts`) (#355) * Add `jiti` to dependencies * Add support for loading TypeScript config files dynamically * Test all config file extension/module type combos with fixtures. * Manually define `__filename` * Increase the `timeout` to accommodate the new added number of tests * Shorten test descriptions in `get-config.test.js` * Add very loose type definitions * Add types definition file to `package.json` * Copy documentation from `README.md` and paste as JSDocs * Add `SizeLimitConfig` type to `index.d.ts` * Fix minor type issue in JSDocs * Add `satisfies SizeLimitConfig` to TS fixtures * Rename `_jiti` to `buildJiti` in `get-config.js` * Remove manually defined `__filename` * Run ESLint fix on all files * Change `Config` from a `type` to an `interface` * Rename `Config` interface to `Check` * Add new lines between properties of `Check` interface * Run ESLint fix on all files * Add `sizeLimitAPI` function to `index.d.ts` * Dynamically import `jiti` - Dynamically import `jiti` to avoid unnecessary initialization for non TS config files * Exclude `.d.ts` files from coverage * Replace the deprecated `test.watchExclude` with `server.watch.ignored` * Retry failed tests during CI * Add JSDocs for the `Check` interface * Disable `fileParallelism` during CI * Run ESLint fix on all files
- Loading branch information
1 parent
4ffac80
commit b36e823
Showing
55 changed files
with
636 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "cjs-config-file-cjs", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "cjs-config-file-esm", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SizeLimitConfig } from '../../packages/size-limit' | ||
|
||
module.exports = [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] satisfies SizeLimitConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "cts-config-file-cjs", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SizeLimitConfig } from '../../packages/size-limit' | ||
|
||
export default [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] satisfies SizeLimitConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "cts-config-file-esm", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SizeLimitConfig } from '../../packages/size-limit' | ||
|
||
module.exports = [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] satisfies SizeLimitConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "cts-config-file", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "js-config-file-cjs", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "js-config-file-esm", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "mjs-config-file-cjs", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "mjs-config-file-esm", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SizeLimitConfig } from '../../packages/size-limit' | ||
|
||
module.exports = [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] satisfies SizeLimitConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "mts-config-file-cjs", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SizeLimitConfig } from '../../packages/size-limit' | ||
|
||
export default [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] satisfies SizeLimitConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "mts-config-file-esm", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SizeLimitConfig } from '../../packages/size-limit' | ||
|
||
export default [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] satisfies SizeLimitConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "mts-config-file", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SizeLimitConfig } from '../../packages/size-limit' | ||
|
||
module.exports = [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] satisfies SizeLimitConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "ts-config-file-cjs", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SizeLimitConfig } from '../../packages/size-limit' | ||
|
||
export default [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] satisfies SizeLimitConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "ts-config-file-esm", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SizeLimitConfig } from '../../packages/size-limit' | ||
|
||
export default [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] satisfies SizeLimitConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"private": true, | ||
"name": "ts-config-file-with-type-module", | ||
"type": "module", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { SizeLimitConfig } from '../../packages/size-limit' | ||
|
||
module.exports = [ | ||
{ | ||
path: 'index.js' | ||
} | ||
] satisfies SizeLimitConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const first = 'first' | ||
|
||
const second = 'second' | ||
|
||
export { first, second } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"private": true, | ||
"name": "ts-config-file", | ||
"devDependencies": { | ||
"@size-limit/webpack": ">= 0.0.0", | ||
"@size-limit/webpack-why": ">= 0.0.0", | ||
"size-limit": ">= 0.0.0" | ||
} | ||
} |
Oops, something went wrong.