Socket
Socket
Sign inDemoInstall

babel-core

Package Overview
Dependencies
49
Maintainers
6
Versions
257
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.21.0 to 6.22.0

lib/helpers/get-possible-plugin-names.js

26

lib/api/node.js
"use strict";
exports.__esModule = true;
exports.transformFromAst = exports.transform = exports.analyse = exports.Pipeline = exports.OptionManager = exports.traverse = exports.types = exports.messages = exports.util = exports.version = exports.template = exports.buildExternalHelpers = exports.options = exports.File = undefined;
exports.transformFromAst = exports.transform = exports.analyse = exports.Pipeline = exports.OptionManager = exports.traverse = exports.types = exports.messages = exports.util = exports.version = exports.resolvePreset = exports.resolvePlugin = exports.template = exports.buildExternalHelpers = exports.options = exports.File = undefined;

@@ -42,2 +42,20 @@ var _file = require("../transformation/file");

var _resolvePlugin = require("../helpers/resolve-plugin");
Object.defineProperty(exports, "resolvePlugin", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_resolvePlugin).default;
}
});
var _resolvePreset = require("../helpers/resolve-preset");
Object.defineProperty(exports, "resolvePreset", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_resolvePreset).default;
}
});
var _package = require("../../package");

@@ -55,6 +73,2 @@

var _isFunction = require("lodash/isFunction");
var _isFunction2 = _interopRequireDefault(_isFunction);
var _fs = require("fs");

@@ -110,3 +124,3 @@

function transformFile(filename, opts, callback) {
if ((0, _isFunction2.default)(opts)) {
if (typeof opts === "function") {
callback = opts;

@@ -113,0 +127,0 @@ opts = {};

@@ -47,6 +47,2 @@ "use strict";

var _each = require("lodash/each");
var _each2 = _interopRequireDefault(_each);
var _babelTypes = require("babel-types");

@@ -99,3 +95,3 @@

function buildHelpers(body, namespace, whitelist) {
(0, _each2.default)(helpers.list, function (name) {
helpers.list.forEach(function (name) {
if (whitelist && whitelist.indexOf(name) < 0) return;

@@ -102,0 +98,0 @@

@@ -43,6 +43,10 @@ "use strict";

var _resolve = require("../../../helpers/resolve");
var _resolvePlugin = require("../../../helpers/resolve-plugin");
var _resolve2 = _interopRequireDefault(_resolve);
var _resolvePlugin2 = _interopRequireDefault(_resolvePlugin);
var _resolvePreset = require("../../../helpers/resolve-preset");
var _resolvePreset2 = _interopRequireDefault(_resolvePreset);
var _cloneDeepWith = require("lodash/cloneDeepWith");

@@ -173,3 +177,3 @@

if (typeof plugin === "string") {
var pluginLoc = (0, _resolve2.default)("babel-plugin-" + plugin, dirname) || (0, _resolve2.default)(plugin, dirname);
var pluginLoc = (0, _resolvePlugin2.default)(plugin, dirname);
if (pluginLoc) {

@@ -287,16 +291,5 @@ plugin = require(pluginLoc);

if (typeof val === "string") {
presetLoc = (0, _resolve2.default)("babel-preset-" + val, dirname) || (0, _resolve2.default)(val, dirname);
presetLoc = (0, _resolvePreset2.default)(val, dirname);
if (!presetLoc) {
var matches = val.match(/^(@[^/]+)\/(.+)$/);
if (matches) {
var orgName = matches[1],
presetPath = matches[2];
val = orgName + "/babel-preset-" + presetPath;
presetLoc = (0, _resolve2.default)(val, dirname);
}
}
if (!presetLoc) {
throw new Error("Couldn't find preset " + (0, _stringify2.default)(val) + " relative to directory " + (0, _stringify2.default)(dirname));

@@ -303,0 +296,0 @@ }

@@ -39,6 +39,2 @@ "use strict";

var _isBoolean = require("lodash/isBoolean");
var _isBoolean2 = _interopRequireDefault(_isBoolean);
var _minimatch = require("minimatch");

@@ -52,6 +48,2 @@

var _isString = require("lodash/isString");
var _isString2 = _interopRequireDefault(_isString);
var _isRegExp = require("lodash/isRegExp");

@@ -119,4 +111,4 @@

if (!val) return [];
if ((0, _isBoolean2.default)(val)) return arrayify([val], mapFn);
if ((0, _isString2.default)(val)) return arrayify(list(val), mapFn);
if (typeof val === "boolean") return arrayify([val], mapFn);
if (typeof val === "string") return arrayify(list(val), mapFn);

@@ -123,0 +115,0 @@ if (Array.isArray(val)) {

{
"name": "babel-core",
"version": "6.21.0",
"version": "6.22.0",
"description": "Babel compiler core.",

@@ -28,11 +28,11 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"dependencies": {
"babel-code-frame": "^6.20.0",
"babel-generator": "^6.21.0",
"babel-helpers": "^6.16.0",
"babel-messages": "^6.8.0",
"babel-template": "^6.16.0",
"babel-runtime": "^6.20.0",
"babel-register": "^6.18.0",
"babel-traverse": "^6.21.0",
"babel-types": "^6.21.0",
"babel-code-frame": "^6.22.0",
"babel-generator": "^6.22.0",
"babel-helpers": "^6.22.0",
"babel-messages": "^6.22.0",
"babel-template": "^6.22.0",
"babel-runtime": "^6.22.0",
"babel-register": "^6.22.0",
"babel-traverse": "^6.22.0",
"babel-types": "^6.22.0",
"babylon": "^6.11.0",

@@ -50,6 +50,6 @@ "convert-source-map": "^1.1.0",

"devDependencies": {
"babel-helper-fixtures": "^6.20.0",
"babel-helper-transform-fixture-test-runner": "^6.21.0",
"babel-polyfill": "^6.20.0"
"babel-helper-fixtures": "^6.22.0",
"babel-helper-transform-fixture-test-runner": "^6.22.0",
"babel-polyfill": "^6.22.0"
}
}

@@ -12,4 +12,6 @@ # babel-core

## babel.transform(code: string, [options?](/docs/usage/api/#options): Object)
All transformations will use your local configuration files (.babelrc or in package.json). See [options](#options) to disable it.
## babel.transform(code: string, [options?](#options): Object)
Transforms the passed in `code`. Returning an object with the generated code,

@@ -31,3 +33,3 @@ source map, and AST.

## babel.transformFile(filename: string, [options?](/docs/usage/api/#options): Object, callback: Function)
## babel.transformFile(filename: string, [options?](#options): Object, callback: Function)

@@ -48,3 +50,3 @@ Asynchronously transforms the entire contents of a file.

## babel.transformFileSync(filename: string, [options?](/docs/usage/api/#options): Object)
## babel.transformFileSync(filename: string, [options?](#options): Object)

@@ -64,3 +66,3 @@ Synchronous version of `babel.transformFile`. Returns the transformed contents of

## babel.transformFromAst(ast: Object, code?: string, [options?](/docs/usage/api/#options): Object)
## babel.transformFromAst(ast: Object, code?: string, [options?](#options): Object)

@@ -91,32 +93,33 @@ Given, an [AST](https://astexplorer.net/), transform it.

| ------------------------ | -------------------- | ------------------------------- |
| `ast` | `true` | Include the AST in the returned object |
| `auxiliaryCommentAfter` | `null` | Attach a comment after all non-user injected code. |
| `auxiliaryCommentBefore` | `null` | Attach a comment before all non-user injected code. |
| `babelrc` | `true` | Specify whether or not to use .babelrc and .babelignore files. Not available when using the CLI, [use `--no-babelrc` instead](https://babeljs.io/docs/usage/cli/#babel-ignoring-babelrc). |
| `code` | `true` | Enable code generation |
| `comments` | `true` | Output comments in generated output. |
| `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB. |
| `env` | `{}` | This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { /* specific options */ } } }` which will use those options when the environment variable `BABEL_ENV` is set to `"production"`. If `BABEL_ENV` isn't set then `NODE_ENV` will be used, if it's not set then it defaults to `"development"` |
| `extends` | `null` | A path to an `.babelrc` file to extend |
| `filename` | `"unknown"` | Filename for use in errors etc. |
| `filenameRelative` | `(filename)` | Filename relative to `sourceRoot`. |
| `presets` | `[]` | List of [presets](/docs/plugins/#presets) (a set of plugins) to load and use. |
| `plugins` | `[]` | List of [plugins](/docs/plugins/) to load and use. |
| `parserOpts` | `{}` | An object containing the options to be passed down to the babel parser, babylon |
| `generatorOpts` | `{}` | An object containing the options to be passed down to the babel code generator, babel-generator |
| `getModuleId` | `null` | Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used. |
| `highlightCode` | `true` | ANSI highlight syntax error code frames |
| `ignore` | `null` | Opposite to the `only` option. `ignore` is disregarded if `only` is specified. |
| `inputSourceMap` | `null` | A source map object that the output source map will be based on. |
| `minified` | `false` | Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe) |
| `moduleId` | `null` | Specify a custom name for module ids. |
| `moduleIds` | `false` | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) |
| `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. |
| `only` | `null` | A [glob](https://github.com/isaacs/minimatch), regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim. |
| `ignore` | `null` | Opposite to the `only` option. `ignore` is disregarded if `only` is specified. |
| `auxiliaryCommentBefore` | `null` | Attach a comment before all non-user injected code. |
| `auxiliaryCommentAfter` | `null` | Attach a comment after all non-user injected code. |
| `parserOpts` | `{}` | An object containing the options to be passed down to the babel parser, babylon |
| `plugins` | `[]` | List of [plugins](/docs/plugins/) to load and use. |
| `presets` | `[]` | List of [presets](/docs/plugins/#presets) (a set of plugins) to load and use. |
| `retainLines` | `false` | Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE:** This will not retain the columns) |
| `resolveModuleSource` | `null` | Resolve a module source ie. `import "SOURCE";` to a custom value. Called as `resolveModuleSource(source, filename)`. |
| `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used. |
| `sourceFileName` | `(filenameRelative)` | Set `sources[0]` on returned source map. |
| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option. |
| `inputSourceMap` | `null` | A source map object that the output source map will be based on. |
| `sourceMapTarget` | `(filenameRelative)` | Set `file` on returned source map. |
| `sourceFileName` | `(filenameRelative)` | Set `sources[0]` on returned source map. |
| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative. |
| `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. |
| `moduleIds` | `false` | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) |
| `moduleId` | `null` | Specify a custom name for module ids. |
| `getModuleId` | `null` | Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used. |
| `resolveModuleSource` | `null` | Resolve a module source ie. `import "SOURCE";` to a custom value. Called as `resolveModuleSource(source, filename)`. |
| `code` | `true` | Enable code generation |
| `no-babelrc` | [CLI flag](http://babeljs.io/docs/usage/cli/#ignoring-babelrc) | Specify whether or not to use .babelrc and .babelignore files. Only available when using the CLI. |
| `ast` | `true` | Include the AST in the returned object |
| `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB. |
| `minified` | `false` | Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe) |
| `comments` | `true` | Output comments in generated output. |
| `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used. |
| `env` | `{}` | This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { /* specific options */ } } }` which will use those options when the enviroment variable `BABEL_ENV` is set to `"production"`. If `BABEL_ENV` isn't set then `NODE_ENV` will be used, if it's not set then it defaults to `"development"` |
| `retainLines` | `false` | Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE:** This will not retain the columns) |
| `extends` | `null` | A path to an `.babelrc` file to extend |
| `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc