-
-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typescript): add types everywhere
The whole codebase has been rewritten to TypeScript.
- Loading branch information
Showing
174 changed files
with
6,808 additions
and
19,453 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
node_modules/ | ||
lib/ | ||
dist/ | ||
!svgr.now.sh/lib/ | ||
__fixtures_build__/ | ||
src/__fixtures__/dist/ | ||
|
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
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
const path = require('path') | ||
const fs = require('fs') | ||
module.exports = (api) => { | ||
api.cache(true) | ||
|
||
const config = fs.readFileSync(path.join(__dirname, '.babelrc')) | ||
|
||
module.exports = JSON.parse(config) | ||
return { | ||
presets: [ | ||
['@babel/preset-env', { targets: { node: '12' }, loose: true }], | ||
'@babel/preset-typescript', | ||
], | ||
} | ||
} |
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,41 @@ | ||
import path from 'path' | ||
import json from '@rollup/plugin-json' | ||
import dts from 'rollup-plugin-dts' | ||
import esbuild from 'rollup-plugin-esbuild' | ||
|
||
// eslint-disable-next-line import/no-dynamic-require | ||
const pkg = require(path.resolve(process.cwd(), './package.json')) | ||
|
||
// eslint-disable-next-line import/no-dynamic-require | ||
const name = pkg.main ? pkg.main.replace(/\.js$/, '') : './dist/index' | ||
|
||
const bundle = (config) => ({ | ||
...config, | ||
input: 'src/index.ts', | ||
external: (id) => !/^[./]/.test(id), | ||
}) | ||
|
||
export default [ | ||
bundle({ | ||
plugins: [json(), esbuild()], | ||
output: [ | ||
{ | ||
file: `${name}.js`, | ||
format: 'cjs', | ||
sourcemap: Boolean(pkg.main), | ||
exports: 'auto', | ||
}, | ||
], | ||
}), | ||
...(pkg.main | ||
? [ | ||
bundle({ | ||
plugins: [dts()], | ||
output: { | ||
file: `${name}.d.ts`, | ||
format: 'es', | ||
}, | ||
}), | ||
] | ||
: []), | ||
] |
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
module.exports = { | ||
watchPathIgnorePatterns: ['__fixtures__', '__fixtures__build__'], | ||
rootDir: 'packages', | ||
transform: { | ||
'^.+\\.(j|t)sx?$': 'babel-jest', | ||
}, | ||
} |
Oops, something went wrong.