babel-parser-minimal
v1.1.0
Published
This is a minimal build of [`@babel/parser`](https://babeljs.io/docs/en/babel-parser), with most of the non-standard/proposal features stripped out. It is heavily minified and any unused code is attempted to be removed. It should work exactly the same as
Readme
@babel/parser minimal bundle
This is a minimal build of @babel/parser, with most of the non-standard/proposal features stripped out. It is heavily minified and any unused code is attempted to be removed. It should work exactly the same as @babel/parser (except for unsupported plugins), and any case where it emits different output is a bug.
It includes support for TypeScript and JSX, as well as standardized modern features. It does not support most proposals.
Supported plugins:
functionSentestreeclassPropertiesclassPrivatePropertiesclassPrivateMethodsmoduleStringNamestopLevelAwaitjsxtypescript
Unsupported plugins:
placeholdersflowdecoratorsv8intrinsicimportAssertionsmoduleAttributesflowCommentsprivateInrecordAndTuplefunctionBindpipelineOperatorthrowExpressionsdoExpressionspartialApplicationdecimalclassStaticBlockdecorators-legacyexportDefaultFrom
Install
npm i -D babel-parser-minimalAPI
The API is exactly the same as https://babeljs.io/docs/en/babel-parser#api, but if you attempt to use any unsupported plugin, it will throw an error.
Example
import { parse } from 'babel-parser-minimal'
// TS source code
const input = 'const foo: string = "bar"'
const ast = parse(input, { plugins: ['typescript'] })