Skip to content

Commit

Permalink
Added support for parsing/processing TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
swernerx committed Jun 4, 2019
1 parent b5e49da commit e6e3094
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@loadable/babel-plugin": "^5.10.0",
"app-root-dir": "^1.0.2",
"babel-plugin-dynamic-import-node": "^2.2.0",
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import importsPart from "./parts/imports"
import proposalsPart from "./parts/proposals"
import reactPart from "./parts/react"
import shouldPrintComment from "./shouldPrintComment"
import typescriptPart from "./parts/typescript"

export default function buildPreset(context, input) {
const options = getOptions(input)
Expand Down Expand Up @@ -37,6 +38,7 @@ export default function buildPreset(context, input) {
compressionPart(presets, plugins, options)
reactPart(presets, plugins, options)
envPart(presets, plugins, options)
typescriptPart(presets, plugins, options)

// Assemble final config
return {
Expand Down
12 changes: 12 additions & 0 deletions src/parts/typescript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import typescriptPreset from "@babel/preset-typescript"

export default function typescript(presets, plugins, options) {
presets.push([
typescriptPreset,
{
isTSX: true,
jsxPragma: options.jsxPragma,
allExtensions: true
}
])
}

0 comments on commit e6e3094

Please sign in to comment.