Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

View File

@ -0,0 +1,44 @@
Copyright JS Foundation and other contributors <https://js.foundation/>
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/lodash/lodash
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code displayed within the prose of the
documentation.
CC0: http://creativecommons.org/publicdomain/zero/1.0/
====
Files located in the node_modules and vendor directories are externally
maintained libraries used by this software which have their own
licenses; we recommend you read them, as their terms may differ from the
terms above.

View File

@ -0,0 +1,104 @@
# babel-plugin-lodash v3.2.11
A simple transform to cherry-pick Lodash modules so you dont have to.
Combine with [lodash-webpack-plugin](https://www.npmjs.com/package/lodash-webpack-plugin)
for even smaller cherry-picked builds!
## Install
```shell
$ npm i --save lodash
$ npm i --save-dev babel-plugin-lodash babel-cli babel-preset-es2015
```
## Example
Transforms
```js
import _ from 'lodash';
import { add } from 'lodash/fp';
const addOne = add(1);
_.map([1, 2, 3], addOne);
```
roughly to
```js
import _add from 'lodash/fp/add';
import _map from 'lodash/map';
const addOne = _add(1);
_map([1, 2, 3], addOne);
```
## Usage
###### .babelrc
```json
{
"plugins": ["lodash"],
"presets": ["es2015"]
}
```
Set plugin options using an array of `[pluginName, optionsObject]`.
```json
{
"plugins": [["lodash", { "id": "lodash-compat", "cwd": "some/path" }]],
"presets": ["es2015"]
}
```
The `options.id` can be an array of ids.
```json
{
"plugins": [["lodash", { "id": ["async", "lodash-bound"] }]],
"presets": ["es2015"]
}
```
###### Babel CLI
```sh
$ babel --plugins lodash --presets es2015 script.js
```
###### Babel API
```js
require('babel-core').transform('code', {
'plugins': ['lodash'],
'presets': ['es2015']
});
```
###### webpack.config.js
```js
'module': {
'loaders': [{
'loader': 'babel-loader',
'test': /\.js$/,
'exclude': /node_modules/,
'query': {
'plugins': ['lodash'],
'presets': ['es2015']
}
}]
}
```
## FAQ
> Can this plugin produce ES2015 imports rather than CommonJS imports?
This plugin produces ES2015 imports by default. The
[transform-es2015-modules-commonjs](https://www.npmjs.com/package/babel-plugin-transform-es2015-modules-commonjs)
plugin, which is included in the Babel [es2015](http://babeljs.io/docs/plugins/preset-es2015/)
preset, transforms ES2015 `import` statements to CommonJS. Omit it from your
preset to preserve ES2015 style imports.
## Limitations
* You must use ES2015 imports to load Lodash
* Babel < 6 & Node.js < 4 arent supported
* Chain sequences arent supported. See [this blog post](https://medium.com/making-internets/why-using-chain-is-a-mistake-9bc1f80d51ba) for alternatives.
* Modularized [method packages](https://www.npmjs.com/browse/keyword/lodash-modularized) arent supported

View File

@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = MapCtor;
function MapCtor(entries) {
return Object.setPrototypeOf(new Map(entries), Object.getPrototypeOf(this));
};
MapCtor.prototype = Map.prototype;
module.exports = exports["default"];

View File

@ -0,0 +1,67 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _Map2 = require('./Map');
var _Map3 = _interopRequireDefault(_Map2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var BREAK = {};
/*----------------------------------------------------------------------------*/
var MapCache = function (_Map) {
_inherits(MapCache, _Map);
function MapCache() {
_classCallCheck(this, MapCache);
return _possibleConstructorReturn(this, (MapCache.__proto__ || Object.getPrototypeOf(MapCache)).apply(this, arguments));
}
_createClass(MapCache, [{
key: 'clear',
value: function clear() {
_get(MapCache.prototype.__proto__ || Object.getPrototypeOf(MapCache.prototype), 'clear', this).call(this);
return this;
}
}, {
key: 'findKey',
value: function findKey(iteratee) {
var result = void 0;
try {
this.forEach(function (value, key, map) {
if (iteratee(value, key, map)) {
result = key;
throw BREAK;
}
});
} catch (e) {
if (e !== BREAK) {
throw e;
}
}
return result;
}
}]);
return MapCache;
}(_Map3.default);
exports.default = MapCache;
;
module.exports = exports['default'];

View File

@ -0,0 +1,132 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _assign2 = require('lodash/assign');
var _assign3 = _interopRequireDefault(_assign2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _each2 = require('lodash/each');
var _each3 = _interopRequireDefault(_each2);
var _startsWith2 = require('lodash/startsWith');
var _startsWith3 = _interopRequireDefault(_startsWith2);
var _orderBy2 = require('lodash/orderBy');
var _orderBy3 = _interopRequireDefault(_orderBy2);
var _toString2 = require('lodash/toString');
var _toString3 = _interopRequireDefault(_toString2);
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _fs = require('fs');
var _fs2 = _interopRequireDefault(_fs);
var _glob = require('glob');
var _glob2 = _interopRequireDefault(_glob);
var _MapCache2 = require('./MapCache');
var _MapCache3 = _interopRequireDefault(_MapCache2);
var _module = require('module');
var _module2 = _interopRequireDefault(_module);
var _util = require('./util');
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/*----------------------------------------------------------------------------*/
var ModuleCache = function (_MapCache) {
_inherits(ModuleCache, _MapCache);
function ModuleCache(moduleRoot) {
_classCallCheck(this, ModuleCache);
var _this = _possibleConstructorReturn(this, (ModuleCache.__proto__ || Object.getPrototypeOf(ModuleCache)).call(this));
moduleRoot = (0, _toString3.default)(moduleRoot);
if (!moduleRoot) {
return _possibleConstructorReturn(_this);
}
var pkgPath = _path2.default.join(moduleRoot, 'package.json');
var pkg = _fs2.default.existsSync(pkgPath) ? require(pkgPath) : { 'main': 'index.js' };
var mainPath = (0, _util.normalizePath)(_path2.default.dirname(_path2.default.resolve(moduleRoot, pkg.main)));
// Sort paths by the “main” entry first.
var dirPaths = (0, _orderBy3.default)(_glob2.default.sync(_path2.default.join(moduleRoot, '**/'), {
'ignore': _path2.default.join(moduleRoot, 'node_modules/**/')
}), function (dirPath) {
return (0, _startsWith3.default)(dirPath, mainPath);
}, ['desc']);
(0, _each3.default)(dirPaths, function (dirPath) {
var base = _path2.default.relative(moduleRoot, dirPath);
var filePaths = _glob2.default.sync(_path2.default.join(dirPath, '*.js'));
var pairs = (0, _map3.default)(filePaths, function (filePath) {
var name = _path2.default.basename(filePath, '.js');
return [name.toLowerCase(), name];
});
_this.set(base, new _MapCache3.default(pairs));
});
return _this;
}
_createClass(ModuleCache, null, [{
key: 'resolve',
value: function resolve(id) {
var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
try {
var dirs = _path2.default.dirname(_module2.default._resolveFilename(id, (0, _assign3.default)(new _module2.default(), {
'paths': _module2.default._nodeModulePaths(from)
}))).split(_path2.default.sep);
var length = dirs.length;
while (length--) {
var dirSub = dirs.slice(0, length + 1);
var dirPath = dirSub.join('/');
var pkgPath = _path2.default.join(dirPath, 'package.json');
if (length && dirs[length - 1] == 'node_modules' || _fs2.default.existsSync(pkgPath) && require(pkgPath).name == id) {
return dirPath;
}
}
return dirs.join('/');
} catch (e) {}
return '';
}
}]);
return ModuleCache;
}(_MapCache3.default);
exports.default = ModuleCache;
;
module.exports = exports['default'];

View File

@ -0,0 +1,41 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _constant2 = require('lodash/constant');
var _constant3 = _interopRequireDefault(_constant2);
var _tail2 = require('lodash/tail');
var _tail3 = _interopRequireDefault(_tail2);
var _toString2 = require('lodash/toString');
var _toString3 = _interopRequireDefault(_toString2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var reLodash = /^lodash(?:-compat|-es)?$/;
/*----------------------------------------------------------------------------*/
var Package = function Package(pkgPath) {
_classCallCheck(this, Package);
pkgPath = (0, _toString3.default)(pkgPath);
var parts = pkgPath.split('/');
this.base = (0, _tail3.default)(parts).join('/');
this.id = parts[0];
this.isLodash = (0, _constant3.default)(reLodash.test(this.id));
this.path = pkgPath;
};
exports.default = Package;
;
module.exports = exports['default'];

View File

@ -0,0 +1,68 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _each2 = require('lodash/each');
var _each3 = _interopRequireDefault(_each2);
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _MapCache2 = require('./MapCache');
var _MapCache3 = _interopRequireDefault(_MapCache2);
var _util = require('./util');
var _Package = require('./Package');
var _Package2 = _interopRequireDefault(_Package);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/*----------------------------------------------------------------------------*/
var Store = function (_MapCache) {
_inherits(Store, _MapCache);
function Store(pkgPaths) {
_classCallCheck(this, Store);
var _this = _possibleConstructorReturn(this, (Store.__proto__ || Object.getPrototypeOf(Store)).call(this));
(0, _each3.default)(pkgPaths, function (pkgPath) {
return _this.set(pkgPath);
});
return _this;
}
_createClass(Store, [{
key: 'get',
value: function get(pkgPath) {
return _get(Store.prototype.__proto__ || Object.getPrototypeOf(Store.prototype), 'get', this).call(this, (0, _util.normalizePath)(pkgPath));
}
}, {
key: 'set',
value: function set(pkgPath) {
var pkgStore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _Package2.default((0, _util.normalizePath)(pkgPath));
return _get(Store.prototype.__proto__ || Object.getPrototypeOf(Store.prototype), 'set', this).call(this, (0, _util.normalizePath)(pkgPath), pkgStore);
}
}]);
return Store;
}(_MapCache3.default);
exports.default = Store;
;
module.exports = exports['default'];

View File

@ -0,0 +1,57 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _castArray2 = require('lodash/castArray');
var _castArray3 = _interopRequireDefault(_castArray2);
var _each2 = require('lodash/each');
var _each3 = _interopRequireDefault(_each2);
exports.default = config;
var _MapCache = require('./MapCache');
var _MapCache2 = _interopRequireDefault(_MapCache);
var _ModuleCache = require('./ModuleCache');
var _ModuleCache2 = _interopRequireDefault(_ModuleCache);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var defaultIds = ['lodash', 'lodash-es', 'lodash-compat'];
var oldCwd = void 0;
var ids = [];
var modules = new _MapCache2.default();
/*----------------------------------------------------------------------------*/
function config() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$cwd = _ref.cwd,
cwd = _ref$cwd === undefined ? process.cwd() : _ref$cwd,
_ref$id = _ref.id,
id = _ref$id === undefined ? defaultIds : _ref$id;
if (oldCwd !== cwd) {
oldCwd = cwd;
modules.clear();
}
(0, _each3.default)((0, _castArray3.default)(id), function (id) {
if (!modules.get(id)) {
var moduleRoot = _ModuleCache2.default.resolve(id, cwd);
if (moduleRoot) {
ids.push(id);
modules.set(id, new _ModuleCache2.default(moduleRoot));
}
}
});
return { ids, modules };
};
module.exports = exports['default'];

View File

@ -0,0 +1,44 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _memoize2 = require('lodash/memoize');
var _memoize3 = _interopRequireDefault(_memoize2);
var _mapping = require('./mapping');
var _mapping2 = _interopRequireDefault(_mapping);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*----------------------------------------------------------------------------*/
function resolvePath(pkgStore, name, path) {
var base = pkgStore.base,
id = pkgStore.id;
var lower = name.toLowerCase();
var module = _mapping2.default.modules.get(id);
if (!module.get(base).has(lower)) {
base = base ? '' : module.findKey(function (map) {
return map.has(lower);
});
if (!base) {
throw path.buildCodeFrameError([`The '${ id }' method \`${ name }\` is not a known module.`, 'Please report bugs to https://github.com/lodash/babel-plugin-lodash/issues.'].join('\n'));
}
}
return id + '/' + (base ? base + '/' : '') + module.get(base).get(lower);
}
function importModule(pkgStore, name, path) {
return path.hub.file.addImport(resolvePath(pkgStore, name, path), 'default', name);
}
exports.default = (0, _memoize3.default)(importModule, function (pkgStore, name) {
return (pkgStore.path + '/' + name).toLowerCase();
});
module.exports = exports['default'];

View File

@ -0,0 +1,192 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _get2 = require('lodash/get');
var _get3 = _interopRequireDefault(_get2);
var _sortBy2 = require('lodash/sortBy');
var _sortBy3 = _interopRequireDefault(_sortBy2);
var _each2 = require('lodash/each');
var _each3 = _interopRequireDefault(_each2);
var _assign3 = require('lodash/assign');
var _assign4 = _interopRequireDefault(_assign3);
exports.default = lodash;
var _config = require('./config');
var _config2 = _interopRequireDefault(_config);
var _importModule3 = require('./importModule');
var _importModule4 = _interopRequireDefault(_importModule3);
var _mapping = require('./mapping');
var _mapping2 = _interopRequireDefault(_mapping);
var _Store = require('./Store');
var _Store2 = _interopRequireDefault(_Store);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/** The error message used when chain sequences are detected. */
var CHAIN_ERROR = ['Lodash chain sequences are not supported by babel-plugin-lodash.', 'Consider substituting chain sequences with composition patterns.', 'See https://medium.com/making-internets/why-using-chain-is-a-mistake-9bc1f80d51ba'].join('\n');
/*----------------------------------------------------------------------------*/
function lodash(_ref) {
var types = _ref.types;
var identifiers = {
'PLACEHOLDER': types.identifier('placeholder'),
'UNDEFINED': types.identifier('undefined')
};
/**
* Used to track variables built during the AST pass. We instantiate these in
* the `Program` visitor in order to support running the plugin in watch mode
* or on multiple files.
*
* @type Store
*/
var store = new _Store2.default();
function getCallee(_ref2) {
var parentPath = _ref2.parentPath;
// Trace curried calls to their origin, e.g. `fp.partial(func)([fp, 2])(1)`.
while (!parentPath.isStatement()) {
if (parentPath.isCallExpression()) {
var result = parentPath.node.callee;
while (types.isCallExpression(result)) {
result = result.callee;
}
return result;
}
parentPath = parentPath.parentPath;
}
}
/*--------------------------------------------------------------------------*/
var visitor = {
Program(path, state) {
var _assign2 = (0, _assign4.default)(_mapping2.default, (0, _config2.default)(state.opts)),
ids = _assign2.ids;
var file = path.hub.file;
// Clear tracked method imports.
_importModule4.default.cache.clear();
store.clear();
// Populate module paths per package.
(0, _each3.default)(ids, function (id) {
store.set(id);
_mapping2.default.modules.get(id).forEach(function (value, key) {
store.set(id + '/' + key);
});
});
// Replace old members with their method imports.
(0, _each3.default)(file.metadata.modules.imports, function (module) {
var pkgStore = store.get(module.source);
if (!pkgStore) {
return;
}
var isLodash = pkgStore.isLodash();
var specs = (0, _sortBy3.default)(module.specifiers, function (spec) {
return spec.imported == 'default';
});
(0, _each3.default)(specs, function (spec) {
var imported = spec.imported,
local = spec.local;
var binding = file.scope.getBinding(local);
var _binding$path$parent$ = binding.path.parent.importKind,
importKind = _binding$path$parent$ === undefined ? 'value' : _binding$path$parent$;
// Skip type annotation specifiers.
if (importKind != 'value') {
return;
}
var isChain = isLodash && imported == 'chain';
(0, _each3.default)(binding.referencePaths, function (refPath) {
var node = refPath.node,
parentPath = refPath.parentPath;
var type = node.type;
if (imported && imported != 'default') {
if (isChain && refPath.parentPath.isCallExpression()) {
throw refPath.buildCodeFrameError(CHAIN_ERROR);
}
var _importModule = (0, _importModule4.default)(pkgStore, imported, refPath),
name = _importModule.name;
refPath.replaceWith({ type, name });
} else if (parentPath.isMemberExpression()) {
var key = refPath.parent.property.name;
if (isLodash && key == 'chain' && parentPath.parentPath.isCallExpression()) {
throw refPath.buildCodeFrameError(CHAIN_ERROR);
}
var _importModule2 = (0, _importModule4.default)(pkgStore, key, refPath),
_name = _importModule2.name;
parentPath.replaceWith({ type, name: _name });
} else if (isLodash) {
var callee = getCallee(refPath);
if (callee && callee.name == local) {
throw refPath.buildCodeFrameError(CHAIN_ERROR);
}
refPath.replaceWith(callee ? types.memberExpression(callee, identifiers.PLACEHOLDER) : identifiers.UNDEFINED);
}
});
});
});
},
ImportDeclaration(path) {
if (store.get(path.node.source.value)) {
// Remove old import.
path.remove();
}
},
ExportNamedDeclaration(path) {
var node = path.node;
var pkgPath = (0, _get3.default)(node, 'source.value');
var pkgStore = store.get(pkgPath);
if (!pkgStore) {
return;
}
node.source = null;
(0, _each3.default)(node.specifiers, function (spec) {
spec.local = (0, _importModule4.default)(pkgStore, spec.local.name, path);
});
}
};
return { visitor };
};
module.exports = exports['default'];

View File

@ -0,0 +1,14 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _config = require('./config');
var _config2 = _interopRequireDefault(_config);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = (0, _config2.default)();
module.exports = exports['default'];

View File

@ -0,0 +1,27 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _toString2 = require('lodash/toString');
var _toString3 = _interopRequireDefault(_toString2);
exports.normalizePath = normalizePath;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*----------------------------------------------------------------------------*/
/**
* Normalizes `pkgPath` by converting path separators to forward slashes.
*
* @static
* @memberOf util
* @param {string} [pkgPath=''] The package path to normalize.
* @returns {string} Returns the normalized package path.
*/
function normalizePath(pkgPath) {
return (0, _toString3.default)(pkgPath).replace(/\\/g, '/');
};

View File

@ -0,0 +1,103 @@
{
"_from": "babel-plugin-lodash@3.2.11",
"_id": "babel-plugin-lodash@3.2.11",
"_inBundle": false,
"_integrity": "sha1-Icj97J/hg176pzeHPjkCvdZtVwE=",
"_location": "/babel-plugin-lodash",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-plugin-lodash@3.2.11",
"name": "babel-plugin-lodash",
"escapedName": "babel-plugin-lodash",
"rawSpec": "3.2.11",
"saveSpec": null,
"fetchSpec": "3.2.11"
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-lodash/-/babel-plugin-lodash-3.2.11.tgz",
"_shasum": "21c8fdec9fe1835efaa737873e3902bdd66d5701",
"_spec": "babel-plugin-lodash@3.2.11",
"_where": "/home/manfred/enviPath/ketcher2/ketcher",
"author": {
"name": "Graeme Yeates",
"email": "megawac@gmail.com",
"url": "https://github.com/megawac"
},
"bugs": {
"url": "https://github.com/lodash/babel-plugin-lodash/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Graeme Yeates",
"email": "megawac@gmail.com",
"url": "https://github.com/megawac"
},
{
"name": "John-David Dalton",
"email": "john.david.dalton@gmail.com",
"url": "http://allyoucanleet.com/"
}
],
"dependencies": {
"glob": "^7.1.1",
"lodash": "^4.17.2"
},
"deprecated": false,
"description": "Modular Lodash builds without the hassle.",
"devDependencies": {
"async": "^2.1.4",
"babel-cli": "^6.18.0",
"babel-core": "^6.20.0",
"babel-plugin-add-module-exports": "~0.2.1",
"babel-plugin-lodash": "3.2.10",
"babel-plugin-syntax-flow": "^6.18.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-object-rest-spread": "^6.20.2",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-env": "^1.1.1",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"babel-register": "^6.18.0",
"chai": "^3.5.0",
"lodash-bound": "^1.1.2",
"lodash-compat": "^3.10.2",
"lodash-es": "^4.17.2",
"mocha": "^3.2.0",
"ramda": "^0.22.1",
"react-bootstrap": "^0.30.7"
},
"files": [
"lib"
],
"greenkeeper": {
"ignore": [
"babel-plugin-lodash"
]
},
"homepage": "https://github.com/lodash/babel-plugin-lodash#readme",
"keywords": [
"babel-plugin",
"cherry-pick",
"lodash",
"modules"
],
"license": "MIT",
"main": "lib/index.js",
"name": "babel-plugin-lodash",
"repository": {
"type": "git",
"url": "git+https://github.com/lodash/babel-plugin-lodash.git"
},
"scripts": {
"build": "babel src --out-dir lib || true",
"prepublish": "npm run build",
"test": "mocha --check-leaks --compilers js:babel-register"
},
"version": "3.2.11"
}