forked from enviPath/enviPy
Current Dev State
This commit is contained in:
12
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/Map.js
generated
vendored
Normal file
12
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/Map.js
generated
vendored
Normal 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"];
|
||||
67
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/MapCache.js
generated
vendored
Normal file
67
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/MapCache.js
generated
vendored
Normal 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'];
|
||||
132
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/ModuleCache.js
generated
vendored
Normal file
132
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/ModuleCache.js
generated
vendored
Normal 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'];
|
||||
41
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/Package.js
generated
vendored
Normal file
41
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/Package.js
generated
vendored
Normal 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'];
|
||||
68
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/Store.js
generated
vendored
Normal file
68
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/Store.js
generated
vendored
Normal 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'];
|
||||
57
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/config.js
generated
vendored
Normal file
57
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/config.js
generated
vendored
Normal 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'];
|
||||
44
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/importModule.js
generated
vendored
Normal file
44
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/importModule.js
generated
vendored
Normal 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'];
|
||||
192
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/index.js
generated
vendored
Normal file
192
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/index.js
generated
vendored
Normal 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'];
|
||||
14
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/mapping.js
generated
vendored
Normal file
14
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/mapping.js
generated
vendored
Normal 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'];
|
||||
27
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/util.js
generated
vendored
Normal file
27
static/js/ketcher2/node_modules/babel-plugin-lodash/lib/util.js
generated
vendored
Normal 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, '/');
|
||||
};
|
||||
Reference in New Issue
Block a user