{"_id":"@typhonjs/babel-parser","_rev":"294985","name":"@typhonjs/babel-parser","description":"Provides a front end for Javascript / Typescript AST generation by Babel parser with TyphonJS plugin support.","dist-tags":{"latest":"0.2.0"},"maintainers":[{"name":"typhonrt","email":"support@typhonrt.org"}],"time":{"modified":"2021-06-03T18:56:43.000Z","created":"2018-12-19T02:49:37.929Z","0.2.0":"2018-12-19T07:46:11.260Z","0.1.0":"2018-12-19T04:32:04.944Z","0.0.1":"2018-12-19T02:49:37.929Z"},"users":{},"author":{"name":"Michael Leahy"},"repository":{"type":"git","url":"git+https://github.com/typhonjs-node-ast/babel-parser.git"},"versions":{"0.2.0":{"name":"@typhonjs/babel-parser","version":"0.2.0","description":"Provides a front end for Javascript / Typescript AST generation by Babel parser with TyphonJS plugin support.","homepage":"https://github.com/typhonjs-node-ast/babel-parser","license":"MPL-2.0","author":{"name":"Michael Leahy"},"main":"./dist/BabelParser.js","repository":{"type":"git","url":"git+https://github.com/typhonjs-node-ast/babel-parser.git"},"maintainers":[{"name":"typhonrt","email":"support@typhonrt.org"}],"dependencies":{"babel-runtime":"^6.0.0","@babel/parser":"^7.0.0"},"devDependencies":{"typhonjs-config-eslint":"^0.5.0","typhonjs-npm-build-test":"^0.7.0"},"scripts":{"build":"babel-node ./node_modules/typhonjs-npm-scripts-build-babel/scripts/build.js","eslint":"eslint .","prepublish":"babel-node ./node_modules/typhonjs-npm-scripts-publish/scripts/prepublish.js","test":"babel-node ./node_modules/typhonjs-npm-scripts-test-mocha/scripts/mocha.js","test-coverage":"babel-node ./node_modules/typhonjs-npm-scripts-test-mocha/scripts/mocha-istanbul.js"},"keywords":["typhonjs","babel","parser","AST"],"directories":{},"bugs":{"url":"https://github.com/typhonjs-node-ast/babel-parser/issues"},"gitHead":"778de654ac76a2cab83b82790246440c017155d6","_id":"@typhonjs/babel-parser@0.2.0","_npmVersion":"6.5.0","_nodeVersion":"6.9.4","_npmUser":{"name":"typhonrt","email":"support@typhonjs.io"},"dist":{"shasum":"30a9bdbb843dd645188fae6a816db2ba2dcb5305","size":9508,"noattachment":false,"key":"/@typhonjs/babel-parser/-/@typhonjs/babel-parser-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@typhonjs/babel-parser/download/@typhonjs/babel-parser-0.2.0.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-parser_0.2.0_1545205571094_0.20175430177373221"},"_hasShrinkwrap":false,"publish_time":1545205571260,"_cnpm_publish_time":1545205571260},"0.1.0":{"name":"@typhonjs/babel-parser","version":"0.1.0","description":"Provides a front end for loading code for Javascript / Typescript AST generation by Babel parser with TyphonJS plugin support.","homepage":"https://github.com/typhonjs-node-ast/babel-parser","license":"MPL-2.0","author":{"name":"Michael Leahy"},"main":"./dist/BabelParser.js","repository":{"type":"git","url":"git+https://github.com/typhonjs-node-ast/babel-parser.git"},"maintainers":[{"name":"typhonrt","email":"support@typhonrt.org"}],"dependencies":{"babel-runtime":"^6.0.0","@babel/parser":"^7.0.0"},"devDependencies":{"typhonjs-config-eslint":"^0.5.0","typhonjs-npm-build-test":"^0.7.0"},"scripts":{"build":"babel-node ./node_modules/typhonjs-npm-scripts-build-babel/scripts/build.js","eslint":"eslint .","prepublish":"babel-node ./node_modules/typhonjs-npm-scripts-publish/scripts/prepublish.js","test":"babel-node ./node_modules/typhonjs-npm-scripts-test-mocha/scripts/mocha.js","test-coverage":"babel-node ./node_modules/typhonjs-npm-scripts-test-mocha/scripts/mocha-istanbul.js"},"keywords":["typhonjs","babel","parser","AST"],"directories":{},"bugs":{"url":"https://github.com/typhonjs-node-ast/babel-parser/issues"},"gitHead":"5b87f050a76cb889373d40ecff0bac445e7a99f6","_id":"@typhonjs/babel-parser@0.1.0","_npmVersion":"6.5.0","_nodeVersion":"6.9.4","_npmUser":{"name":"typhonrt","email":"support@typhonjs.io"},"dist":{"shasum":"250e23132222eb9f4d96bd6799b84a1cea1f67f9","size":9337,"noattachment":false,"key":"/@typhonjs/babel-parser/-/@typhonjs/babel-parser-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@typhonjs/babel-parser/download/@typhonjs/babel-parser-0.1.0.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-parser_0.1.0_1545193924777_0.28420469832777484"},"_hasShrinkwrap":false,"publish_time":1545193924944,"_cnpm_publish_time":1545193924944},"0.0.1":{"name":"@typhonjs/babel-parser","version":"0.0.1","description":"Provides a front end for loading code for AST generation by Babel parser with TyphonJS plugin support.","homepage":"https://github.com/typhonjs-node-ast/babel-parser","license":"MPL-2.0","author":{"name":"Michael Leahy"},"main":"./dist/BabelParser.js","repository":{"type":"git","url":"git+https://github.com/typhonjs-node-ast/babel-parser.git"},"maintainers":[{"name":"typhonrt","email":"support@typhonrt.org"}],"dependencies":{"babel-runtime":"^6.0.0","@babel/parser":"^7.0.0"},"devDependencies":{"typhonjs-config-eslint":"^0.5.0","typhonjs-npm-build-test":"^0.7.0"},"scripts":{"build":"babel-node ./node_modules/typhonjs-npm-scripts-build-babel/scripts/build.js","eslint":"eslint .","prepublish":"babel-node ./node_modules/typhonjs-npm-scripts-publish/scripts/prepublish.js","test":"babel-node ./node_modules/typhonjs-npm-scripts-test-mocha/scripts/mocha.js","test-coverage":"babel-node ./node_modules/typhonjs-npm-scripts-test-mocha/scripts/mocha-istanbul.js"},"keywords":["typhonjs","babel","parser","AST"],"directories":{},"bugs":{"url":"https://github.com/typhonjs-node-ast/babel-parser/issues"},"gitHead":"f89d5cba47975f22c2ad22d464f6da2765f6fba5","_id":"@typhonjs/babel-parser@0.0.1","_npmVersion":"6.5.0","_nodeVersion":"6.9.4","_npmUser":{"name":"typhonrt","email":"support@typhonjs.io"},"dist":{"shasum":"9832c3eec2c3858f9ca3068471ae5104fa933767","size":8393,"noattachment":false,"key":"/@typhonjs/babel-parser/-/@typhonjs/babel-parser-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@typhonjs/babel-parser/download/@typhonjs/babel-parser-0.0.1.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-parser_0.0.1_1545187777738_0.5624202877805662"},"_hasShrinkwrap":false,"publish_time":1545187777929,"_cnpm_publish_time":1545187777929}},"readme":"![@typhonjs/babel-parser](https://i.imgur.com/hN409kK.png)\n\n[![NPM](https://img.shields.io/npm/v/@typhonjs/babel-parser.svg?label=npm)](https://www.npmjs.com/package/@typhonjs/babel-parser)\n[![Code Style](https://img.shields.io/badge/code%20style-allman-yellowgreen.svg?style=flat)](https://en.wikipedia.org/wiki/Indent_style#Allman_style)\n[![License](https://img.shields.io/badge/license-MPLv2-yellowgreen.svg?style=flat)](https://github.com/typhonjs-node-ast/babel-parser/blob/master/LICENSE)\n[![Gitter](https://img.shields.io/gitter/room/typhonjs/TyphonJS.svg)](https://gitter.im/typhonjs/TyphonJS)\n\n[![Build Status](https://travis-ci.org/typhonjs-node-ast/babel-parser.svg?branch=master)](https://travis-ci.org/typhonjs-node-ast/babel-parser)\n[![Coverage](https://img.shields.io/codecov/c/github/typhonjs-node-ast/babel-parser.svg)](https://codecov.io/github/typhonjs-node-ast/babel-parser)\n[![Dependency Status](https://david-dm.org/typhonjs-node-ast/babel-parser/status.svg)](https://david-dm.org/typhonjs-node-ast/babel-parser)\n\nProvides a front end for Javascript / Typescript AST generation by Babel parser with TyphonJS plugin support. By default all Babel parser plugins are enabled except for `flow` and there is a handy override mechanism to change relevant defaults without having to provide a full set of options to the parser. \n\nThis NPM module can be installed as a dependency in `package.json` as follows:\n```js\n\"dependencies\": {\n  \"@typhonjs/babel-parser\": \"^0.2.0\"\n}\n```\n\nPlease see [Babel Parser Docs](https://babeljs.io/docs/en/babel-parser) for specific plugin information. By default `babel-parser` enables all plugins except for `flow` as it is incompatible with the `typescript` plugin. Also by default the `decorators` plugins is enabled and not compatible with `decorators-legacy`. \n\nThe default Babel parser options is as follows:\n```\nconst s_DEFAULT_BABELPARSER_OPTIONS =\n{\n   plugins: ['asyncGenerators', 'bigInt', 'classProperties', 'classPrivateProperties', 'classPrivateMethods',\n    ['decorators', { decoratorsBeforeExport: false }], 'doExpressions', 'dynamicImport',\n     'exportDefaultFrom', 'exportNamespaceFrom',  'functionBind', 'functionSent', 'importMeta',\n      'jsx', 'logicalAssignment', 'nullishCoalescingOperator', 'numericSeparator', 'objectRestSpread',\n       'optionalCatchBinding', 'optionalChaining', ['pipelineOperator', { proposal: 'minimal' }], 'throwExpressions',\n        'typescript']\n};\n```\n\nThere is a way to provide additional override directives to `babel-parser` which modifies the default babel parser options above. This only activates when no manual parser options are provided. A third parameter can be passed into `parse` which will modify the default parameters above. For example Flow is supported by passing in `{ flow: true }` as the override object. This allows flow to be enabled and typescript to be disabled without providing the full babel parser options manually. A few other optional overrides are available:\n\n```\n{\n   decoratorsBeforeExport: <boolean>,   // Sets the associated configuration value\n   decoratorsLegacy: true,              // Removes the proposal decorators plugin for `decorators-legacy`\n   flow: true,                          // Enables flow / disables typescript plugins\n   pipelineOperatorProposal: <string>   // Sets the proposal field of pipelineOperator plugin\n}\n```\n\n\nAn ES6 example follows:\n```js\nimport BabelParser from '@typhonjs/babel-parser';\n\n// Basic usage to parse text / source code with default options.\nconst ast = BabelParser.parse(`<some JS or Typescript source code>`);\n\n// Providing custom options\nconst parserOptions = { plugins: [<any parser options desired to be enabled>] };\nconst ast = BabelParser.parse(`<some JS or Typescript source code>`, parserOptions);\n\n// Basic usage with default options, but with an override to disable Typescript and enable Flow plugins\nconst ast = BabelParser.parse(`<some JS w/ Flow typing>`, void 0, { flow: true });\n```\n\n`@typhonjs/babel-parser` may be loaded as a TyphonJS plugin with [typhonjs-plugin-manager](https://www.npmjs.com/package/typhonjs-plugin-manager) and if an eventbus is associated the following event categories are registered:\n\n`typhonjs:babel:parser:parse` - invokes `BabelParser.parse`\n","_attachments":{},"homepage":"https://github.com/typhonjs-node-ast/babel-parser","bugs":{"url":"https://github.com/typhonjs-node-ast/babel-parser/issues"},"license":"MPL-2.0"}