{ "_args": [ [ { "raw": "babel-generator@^6.26.0", "scope": null, "escapedName": "babel-generator", "name": "babel-generator", "rawSpec": "^6.26.0", "spec": ">=6.26.0 <7.0.0", "type": "range" }, "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/babel-core" ] ], "_from": "babel-generator@>=6.26.0 <7.0.0", "_id": "babel-generator@6.26.1", "_inCache": true, "_location": "/babel-generator", "_nodeVersion": "8.9.1", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/babel-generator-6.26.1.tgz_1517672519127_0.13255818048492074" }, "_npmUser": { "name": "hzoo", "email": "hi@henryzoo.com" }, "_npmVersion": "5.6.0", "_phantomChildren": {}, "_requested": { "raw": "babel-generator@^6.26.0", "scope": null, "escapedName": "babel-generator", "name": "babel-generator", "rawSpec": "^6.26.0", "spec": ">=6.26.0 <7.0.0", "type": "range" }, "_requiredBy": [ "/babel-core", "/istanbul-lib-instrument", "/metro" ], "_resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", "_shasum": "1844408d3b8f0d35a404ea7ac180f087a601bd90", "_shrinkwrap": null, "_spec": "babel-generator@^6.26.0", "_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/babel-core", "author": { "name": "Sebastian McKenzie", "email": "sebmck@gmail.com" }, "dependencies": { "babel-messages": "^6.23.0", "babel-runtime": "^6.26.0", "babel-types": "^6.26.0", "detect-indent": "^4.0.0", "jsesc": "^1.3.0", "lodash": "^4.17.4", "source-map": "^0.5.7", "trim-right": "^1.0.1" }, "description": "Turns an AST into code.", "devDependencies": { "babel-helper-fixtures": "^6.26.0", "babylon": "^6.18.0" }, "directories": {}, "dist": { "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", "shasum": "1844408d3b8f0d35a404ea7ac180f087a601bd90", "tarball": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz" }, "files": [ "lib" ], "homepage": "https://babeljs.io/", "license": "MIT", "main": "lib/index.js", "maintainers": [ { "name": "existentialism", "email": "bng412@gmail.com" }, { "name": "thejameskyle", "email": "me@thejameskyle.com" }, { "name": "sebmck", "email": "sebmck@gmail.com" }, { "name": "danez", "email": "daniel@tschinder.de" }, { "name": "hzoo", "email": "hi@henryzoo.com" }, { "name": "loganfsmyth", "email": "loganfsmyth@gmail.com" } ], "name": "babel-generator", "optionalDependencies": {}, "readme": "# babel-generator\n\n> Turns an AST into code.\n\n## Install\n\n```sh\nnpm install --save-dev babel-generator\n```\n\n## Usage\n\n```js\nimport {parse} from 'babylon';\nimport generate from 'babel-generator';\n\nconst code = 'class Example {}';\nconst ast = parse(code);\n\nconst output = generate(ast, { /* options */ }, code);\n```\n\n## Options\n\nOptions for formatting output:\n\nname | type | default | description\n-----------------------|----------|-----------------|--------------------------------------------------------------------------\nauxiliaryCommentBefore | string | | Optional string to add as a block comment at the start of the output file\nauxiliaryCommentAfter | string | | Optional string to add as a block comment at the end of the output file\nshouldPrintComment | function | `opts.comments` | Function that takes a comment (as a string) and returns `true` if the comment should be included in the output. By default, comments are included if `opts.comments` is `true` or if `opts.minifed` is `false` and the comment contains `@preserve` or `@license`\nretainLines | boolean | `false` | Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces)\nretainFunctionParens | boolean | `false` | Retain parens around function expressions (could be used to change engine parsing behavior)\ncomments | boolean | `true` | Should comments be included in output\ncompact | boolean or `'auto'` | `opts.minified` | Set to `true` to avoid adding whitespace for formatting\nminified | boolean | `false` | Should the output be minified\nconcise | boolean | `false` | Set to `true` to reduce whitespace (but not as much as `opts.compact`)\nquotes | `'single'` or `'double'` | autodetect based on `ast.tokens` | The type of quote to use in the output\nfilename | string | | Used in warning messages\nflowCommaSeparator | boolean | `false` | Set to `true` to use commas instead of semicolons as Flow property separators\njsonCompatibleStrings | boolean | `false` | Set to true to run `jsesc` with \"json\": true to print \"\\u00A9\" vs. \"©\";\n\nOptions for source maps:\n\nname | type | default | description\n-----------------------|----------|-----------------|--------------------------------------------------------------------------\nsourceMaps | boolean | `false` | Enable generating source maps\nsourceMapTarget | string | | The filename of the generated code that the source map will be associated with\nsourceRoot | string | | A root for all relative URLs in the source map\nsourceFileName | string | | The filename for the source code (i.e. the code in the `code` argument). This will only be used if `code` is a string.\n\n## AST from Multiple Sources\n\nIn most cases, Babel does a 1:1 transformation of input-file to output-file. However,\nyou may be dealing with AST constructed from multiple sources - JS files, templates, etc.\nIf this is the case, and you want the sourcemaps to reflect the correct sources, you'll need\nto pass an object to `generate` as the `code` parameter. Keys\nshould be the source filenames, and values should be the source content.\n\nHere's an example of what that might look like:\n\n```js\nimport {parse} from 'babylon';\nimport generate from 'babel-generator';\n\nconst a = 'var a = 1;';\nconst b = 'var b = 2;';\nconst astA = parse(a, { sourceFilename: 'a.js' });\nconst astB = parse(b, { sourceFilename: 'b.js' });\nconst ast = {\n type: 'Program',\n body: [].concat(astA.program.body, astB.program.body)\n};\n\nconst { code, map } = generate(ast, { sourceMaps: true }, {\n 'a.js': a,\n 'b.js': b\n});\n\n// Sourcemap will point to both a.js and b.js where appropriate.\n```\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "https://github.com/babel/babel/tree/master/packages/babel-generator" }, "version": "6.26.1" }