{
  "name": "jstransform",
  "version": "3.0.0",
  "description": "A simple AST visitor-based JS transformer",
  "contributors": [
    {
      "name": "Jeff Morrison",
      "email": "jeffmo@fb.com"
    }
  ],
  "main": "src/jstransform",
  "repository": {
    "type": "git",
    "url": "git@github.com:facebook/jstransform.git"
  },
  "keywords": [
    "transformer",
    "compiler",
    "syntax",
    "visitor"
  ],
  "dependencies": {
    "base62": "0.1.1",
    "esprima-fb": "~3001.1.0-dev-harmony-fb",
    "source-map": "0.1.31"
  },
  "licenses": [
    {
      "type": "Apache-2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0"
    }
  ],
  "engines": {
    "node": ">=0.8.8"
  },
  "readme": "# JSTransform\n\nA simple utility for pluggable JS syntax transforms using the esprima parser.\n\n* Makes it simple to write and plug-in syntax transformations\n* Makes it simple to coalesce multiple syntax transformations in a single pass of the AST\n* Gives complete control over the formatting of the output on a per-transformation basis\n* Supports source map generation\n* Comes pre-bundled with a small set of (optional) ES6 -> ES5 transforms\n\n## Examples\nUsing a pre-bundled or existing transform:\n```js\n/**\n * Reads a source file that may (or may not) contain ES6 classes, transforms it\n * to ES5 compatible code using the pre-bundled ES6 class visitors, and prints \n * out the result.\n */\nvar es6ClassVisitors = require('jstransform/visitors/es6-class-visitors').visitorList;\nvar fs = require('fs');\nvar jstransform = require('jstransform');\n\nvar originalFileContents = fs.readFileSync('path/to/original/file.js', 'utf-8');\n\nvar transformedFileData = jstransform.transform(\n  es6ClassVisitors,\n  originalFileContents\n);\n\nconsole.log(transformedFileData.code);\n```\n\nUsing multiple pre-bundled or existing transforms at once:\n```js\n/**\n * Reads a source file that may (or may not) contain ES6 classes *or* arrow\n * functions, transforms them to ES5 compatible code using the pre-bundled ES6 \n * visitors, and prints out the result.\n */\nvar es6ArrowFuncVisitors = require('jstransform/visitors/es6-arrow-function-visitors').visitorList;\nvar es6ClassVisitors = require('jstransform/visitors/es6-class-visitors').visitorList;\nvar jstransform = require('jstransform');\n\n// Normally you'd read this from the filesystem, but I'll just use a string here\n// to simplify the example.\nvar originalFileContents = \"var a = (param1) => param1; class FooClass {}\";\n\nvar transformedFileData = jstransform.transform(\n  es6ClassVisitors.concat(es6ArrowFuncVisitors),\n  originalFileContents\n);\n\n// var a = function(param1)  {return param1;}; function FooClass(){\"use strict\";}\nconsole.log(transformedFileData.code);\n```\n\nWriting a simple custom transform:\n```js\n/**\n * Creates a custom transformation visitor that prefixes all calls to the\n * `eval()` function with a call to `alert()` saying how much of a clown you are\n * for using eval.\n */\nvar jstransform = require('jstransform');\nvar Syntax = require('esprima-fb').Syntax;\nvar utils = require('jstransform/src/utils');\n\nfunction visitEvalCallExpressions(traverse, node, path, state) {\n  // Appends an alert() call to the output buffer *before* the visited node\n  // (in this case the eval call) is appended to the output buffer\n  utils.append('alert(\"...eval?...really?...\");', state);\n\n  // Now we copy the eval expression to the output buffer from the original\n  // source\n  utils.catchup(node.range[1], state);\n}\nvisitEvalCallExpressions.test = function(node, path, state) {\n  return node.type === Syntax.CallExpression\n         && node.callee.type === Syntax.Identifier\n         && node.callee.name === 'eval';\n};\n\n// Normally you'd read this from the filesystem, but I'll just use a string here\n// to simplify the example.\nvar originalFileContents = \"eval('foo');\";\n\nvar transformedFileData = jstransform.transform(\n  [visitEvalCallExpressions], // Multiple visitors may be applied at once, so an\n                              // array is always expected for the first argument\n  originalFileContents\n);\n\n// alert(\"...eval?...really?...\");eval('foo');\nconsole.log(transformedFileData.code);\n```\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/facebook/jstransform/issues"
  },
  "homepage": "https://github.com/facebook/jstransform",
  "_id": "jstransform@3.0.0",
  "_shasum": "a2591ab6cee8d97bf3be830dbfa2313b87cd640b",
  "_from": "jstransform@~3.0.0",
  "_resolved": "https://registry.npmjs.org/jstransform/-/jstransform-3.0.0.tgz"
}
