Commit 6b91c4a7 authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

delete and ignore node_modules

parent 22482a26
No related merge requests found
Showing with 0 additions and 1042 deletions
+0 -1042
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.enableFeature = enableFeature;
exports.hasFeature = hasFeature;
exports.runtimeKey = exports.featuresKey = exports.FEATURES = void 0;
const FEATURES = Object.freeze({
unicodeFlag: 1 << 0,
dotAllFlag: 1 << 1,
unicodePropertyEscape: 1 << 2,
namedCaptureGroups: 1 << 3
});
exports.FEATURES = FEATURES;
const featuresKey = "@babel/plugin-regexp-features/featuresKey";
exports.featuresKey = featuresKey;
const runtimeKey = "@babel/plugin-regexp-features/runtimeKey";
exports.runtimeKey = runtimeKey;
function enableFeature(features, feature) {
return features | feature;
}
function hasFeature(features, feature) {
return !!(features & feature);
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createRegExpFeaturePlugin = createRegExpFeaturePlugin;
var _regexpuCore = _interopRequireDefault(require("regexpu-core"));
var _features = require("./features");
var _util = require("./util");
var _package = _interopRequireDefault(require("../package.json"));
var _core = require("@babel/core");
var _helperRegex = require("@babel/helper-regex");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const version = _package.default.version.split(".").reduce((v, x) => v * 1e5 + +x, 0);
const versionKey = "@babel/plugin-regexp-features/version";
function createRegExpFeaturePlugin({
name,
feature,
options = {}
}) {
return {
name,
pre() {
var _file$get;
const {
file
} = this;
const features = (_file$get = file.get(_features.featuresKey)) !== null && _file$get !== void 0 ? _file$get : 0;
let newFeatures = (0, _features.enableFeature)(features, _features.FEATURES[feature]);
const {
useUnicodeFlag,
runtime = true
} = options;
if (useUnicodeFlag === false) {
newFeatures = (0, _features.enableFeature)(newFeatures, _features.FEATURES.unicodeFlag);
}
if (newFeatures !== features) {
file.set(_features.featuresKey, newFeatures);
}
if (!runtime) {
file.set(_features.runtimeKey, false);
}
if (!file.has(versionKey) || file.get(versionKey) < version) {
file.set(versionKey, version);
}
},
visitor: {
RegExpLiteral(path) {
var _file$get2;
const {
node
} = path;
const {
file
} = this;
const features = file.get(_features.featuresKey);
const runtime = (_file$get2 = file.get(_features.runtimeKey)) !== null && _file$get2 !== void 0 ? _file$get2 : true;
const regexpuOptions = (0, _util.generateRegexpuOptions)(node, features);
if (regexpuOptions === null) {
return;
}
const namedCaptureGroups = {};
if (regexpuOptions.namedGroup) {
regexpuOptions.onNamedGroup = (name, index) => {
namedCaptureGroups[name] = index;
};
}
node.pattern = (0, _regexpuCore.default)(node.pattern, node.flags, regexpuOptions);
if (regexpuOptions.namedGroup && Object.keys(namedCaptureGroups).length > 0 && runtime && !isRegExpTest(path)) {
path.replaceWith(_core.types.callExpression(this.addHelper("wrapRegExp"), [node, _core.types.valueToNode(namedCaptureGroups)]));
}
if ((0, _features.hasFeature)(features, _features.FEATURES.unicodeFlag)) {
(0, _helperRegex.pullFlag)(node, "u");
}
if ((0, _features.hasFeature)(features, _features.FEATURES.dotAllFlag)) {
(0, _helperRegex.pullFlag)(node, "s");
}
}
}
};
}
function isRegExpTest(path) {
return path.parentPath.isMemberExpression({
object: path.node,
computed: false
}) && path.parentPath.get("property").isIdentifier({
name: "test"
});
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.generateRegexpuOptions = generateRegexpuOptions;
var _features = require("./features");
function generateRegexpuOptions(node, features) {
let useUnicodeFlag = false,
dotAllFlag = false,
unicodePropertyEscape = false,
namedGroup = false;
const {
flags,
pattern
} = node;
const flagsIncludesU = flags.includes("u");
if (flagsIncludesU) {
if (!(0, _features.hasFeature)(features, _features.FEATURES.unicodeFlag)) {
useUnicodeFlag = true;
}
if ((0, _features.hasFeature)(features, _features.FEATURES.unicodePropertyEscape) && /\\[pP]{/.test(pattern)) {
unicodePropertyEscape = true;
}
}
if ((0, _features.hasFeature)(features, _features.FEATURES.dotAllFlag) && flags.indexOf("s") >= 0) {
dotAllFlag = true;
}
if ((0, _features.hasFeature)(features, _features.FEATURES.namedCaptureGroups) && /\(\?<(?![=!])/.test(pattern)) {
namedGroup = true;
}
if (!namedGroup && !unicodePropertyEscape && !dotAllFlag && (!flagsIncludesU || useUnicodeFlag)) {
return null;
}
if (flagsIncludesU && flags.indexOf("s") >= 0) {
dotAllFlag = true;
}
return {
useUnicodeFlag,
onNamedGroup: () => {},
namedGroup,
unicodePropertyEscape,
dotAllFlag,
lookbehind: true
};
}
\ No newline at end of file
{
"_from": "@babel/helper-create-regexp-features-plugin@^7.7.0",
"_id": "@babel/helper-create-regexp-features-plugin@7.7.2",
"_inBundle": false,
"_integrity": "sha512-pAil/ZixjTlrzNpjx+l/C/wJk002Wo7XbbZ8oujH/AoJ3Juv0iN/UTcPUHXKMFLqsfS0Hy6Aow8M31brUYBlQQ==",
"_location": "/@babel/helper-create-regexp-features-plugin",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-create-regexp-features-plugin@^7.7.0",
"name": "@babel/helper-create-regexp-features-plugin",
"escapedName": "@babel%2fhelper-create-regexp-features-plugin",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
},
"_requiredBy": [
"/@babel/plugin-proposal-unicode-property-regex",
"/@babel/plugin-transform-dotall-regex",
"/@babel/plugin-transform-named-capturing-groups-regex",
"/@babel/plugin-transform-unicode-regex"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.7.2.tgz",
"_shasum": "6f20443778c8fce2af2ff4206284afc0ced65db6",
"_spec": "@babel/helper-create-regexp-features-plugin@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\plugin-proposal-unicode-property-regex",
"author": {
"name": "The Babel Team",
"url": "https://babeljs.io/team"
},
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/helper-regex": "^7.4.4",
"regexpu-core": "^4.6.0"
},
"deprecated": false,
"description": "Compile ESNext Regular Expressions to ES5",
"devDependencies": {
"@babel/core": "^7.7.2",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"gitHead": "35f4d1276310bac6fede4a6f86a5c76f951e179e",
"homepage": "https://github.com/babel/babel#readme",
"keywords": [
"babel",
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-create-regexp-features-plugin",
"peerDependencies": {
"@babel/core": "^7.0.0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-helper-create-regexp-features-plugin"
},
"version": "7.7.2"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
# @babel/helper-define-map
> Helper function to define a map
See our website [@babel/helper-define-map](https://babeljs.io/docs/en/next/babel-helper-define-map.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-define-map
```
or using yarn:
```sh
yarn add @babel/helper-define-map --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.push = push;
exports.hasComputed = hasComputed;
exports.toComputedObjectFromClass = toComputedObjectFromClass;
exports.toClassObject = toClassObject;
exports.toDefineObject = toDefineObject;
var _helperFunctionName = _interopRequireDefault(require("@babel/helper-function-name"));
var _has = _interopRequireDefault(require("lodash/has"));
var t = _interopRequireWildcard(require("@babel/types"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function toKind(node) {
if (t.isClassMethod(node) || t.isObjectMethod(node)) {
if (node.kind === "get" || node.kind === "set") {
return node.kind;
}
}
return "value";
}
function push(mutatorMap, node, kind, file, scope) {
const alias = t.toKeyAlias(node);
let map = {};
if ((0, _has.default)(mutatorMap, alias)) map = mutatorMap[alias];
mutatorMap[alias] = map;
map._inherits = map._inherits || [];
map._inherits.push(node);
map._key = node.key;
if (node.computed) {
map._computed = true;
}
if (node.decorators) {
const decorators = map.decorators = map.decorators || t.arrayExpression([]);
decorators.elements = decorators.elements.concat(node.decorators.map(dec => dec.expression).reverse());
}
if (map.value || map.initializer) {
throw file.buildCodeFrameError(node, "Key conflict with sibling node");
}
let key, value;
if (t.isObjectProperty(node) || t.isObjectMethod(node) || t.isClassMethod(node)) {
key = t.toComputedKey(node, node.key);
}
if (t.isProperty(node)) {
value = node.value;
} else if (t.isObjectMethod(node) || t.isClassMethod(node)) {
value = t.functionExpression(null, node.params, node.body, node.generator, node.async);
value.returnType = node.returnType;
}
const inheritedKind = toKind(node);
if (!kind || inheritedKind !== "value") {
kind = inheritedKind;
}
if (scope && t.isStringLiteral(key) && (kind === "value" || kind === "initializer") && t.isFunctionExpression(value)) {
value = (0, _helperFunctionName.default)({
id: key,
node: value,
scope
});
}
if (value) {
t.inheritsComments(value, node);
map[kind] = value;
}
return map;
}
function hasComputed(mutatorMap) {
for (const key of Object.keys(mutatorMap)) {
if (mutatorMap[key]._computed) {
return true;
}
}
return false;
}
function toComputedObjectFromClass(obj) {
const objExpr = t.arrayExpression([]);
for (let i = 0; i < obj.properties.length; i++) {
const prop = obj.properties[i];
const val = prop.value;
val.properties.unshift(t.objectProperty(t.identifier("key"), t.toComputedKey(prop)));
objExpr.elements.push(val);
}
return objExpr;
}
function toClassObject(mutatorMap) {
const objExpr = t.objectExpression([]);
Object.keys(mutatorMap).forEach(function (mutatorMapKey) {
const map = mutatorMap[mutatorMapKey];
const mapNode = t.objectExpression([]);
const propNode = t.objectProperty(map._key, mapNode, map._computed);
Object.keys(map).forEach(function (key) {
const node = map[key];
if (key[0] === "_") return;
const prop = t.objectProperty(t.identifier(key), node);
t.inheritsComments(prop, node);
t.removeComments(node);
mapNode.properties.push(prop);
});
objExpr.properties.push(propNode);
});
return objExpr;
}
function toDefineObject(mutatorMap) {
Object.keys(mutatorMap).forEach(function (key) {
const map = mutatorMap[key];
if (map.value) map.writable = t.booleanLiteral(true);
map.configurable = t.booleanLiteral(true);
map.enumerable = t.booleanLiteral(true);
});
return toClassObject(mutatorMap);
}
\ No newline at end of file
{
"_from": "@babel/helper-define-map@^7.7.0",
"_id": "@babel/helper-define-map@7.7.0",
"_inBundle": false,
"_integrity": "sha512-kPKWPb0dMpZi+ov1hJiwse9dWweZsz3V9rP4KdytnX1E7z3cTNmFGglwklzFPuqIcHLIY3bgKSs4vkwXXdflQA==",
"_location": "/@babel/helper-define-map",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-define-map@^7.7.0",
"name": "@babel/helper-define-map",
"escapedName": "@babel%2fhelper-define-map",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
},
"_requiredBy": [
"/@babel/plugin-transform-classes"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.7.0.tgz",
"_shasum": "60b0e9fd60def9de5054c38afde8c8ee409c7529",
"_spec": "@babel/helper-define-map@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\plugin-transform-classes",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-function-name": "^7.7.0",
"@babel/types": "^7.7.0",
"lodash": "^4.17.13"
},
"deprecated": false,
"description": "Helper function to define a map",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-define-map",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map"
},
"version": "7.7.0"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
# @babel/helper-explode-assignable-expression
> Helper function to explode an assignable expression
See our website [@babel/helper-explode-assignable-expression](https://babeljs.io/docs/en/next/babel-helper-explode-assignable-expression.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-explode-assignable-expression
```
or using yarn:
```sh
yarn add @babel/helper-explode-assignable-expression --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var t = _interopRequireWildcard(require("@babel/types"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function getObjRef(node, nodes, file, scope) {
let ref;
if (t.isSuper(node)) {
return node;
} else if (t.isIdentifier(node)) {
if (scope.hasBinding(node.name)) {
return node;
} else {
ref = node;
}
} else if (t.isMemberExpression(node)) {
ref = node.object;
if (t.isSuper(ref) || t.isIdentifier(ref) && scope.hasBinding(ref.name)) {
return ref;
}
} else {
throw new Error(`We can't explode this node type ${node.type}`);
}
const temp = scope.generateUidIdentifierBasedOnNode(ref);
scope.push({
id: temp
});
nodes.push(t.assignmentExpression("=", t.cloneNode(temp), t.cloneNode(ref)));
return temp;
}
function getPropRef(node, nodes, file, scope) {
const prop = node.property;
const key = t.toComputedKey(node, prop);
if (t.isLiteral(key) && t.isPureish(key)) return key;
const temp = scope.generateUidIdentifierBasedOnNode(prop);
scope.push({
id: temp
});
nodes.push(t.assignmentExpression("=", t.cloneNode(temp), t.cloneNode(prop)));
return temp;
}
function _default(node, nodes, file, scope, allowedSingleIdent) {
let obj;
if (t.isIdentifier(node) && allowedSingleIdent) {
obj = node;
} else {
obj = getObjRef(node, nodes, file, scope);
}
let ref, uid;
if (t.isIdentifier(node)) {
ref = t.cloneNode(node);
uid = obj;
} else {
const prop = getPropRef(node, nodes, file, scope);
const computed = node.computed || t.isLiteral(prop);
uid = t.memberExpression(t.cloneNode(obj), t.cloneNode(prop), computed);
ref = t.memberExpression(t.cloneNode(obj), t.cloneNode(prop), computed);
}
return {
uid: uid,
ref: ref
};
}
\ No newline at end of file
{
"_from": "@babel/helper-explode-assignable-expression@^7.7.0",
"_id": "@babel/helper-explode-assignable-expression@7.7.0",
"_inBundle": false,
"_integrity": "sha512-CDs26w2shdD1urNUAji2RJXyBFCaR+iBEGnFz3l7maizMkQe3saVw9WtjG1tz8CwbjvlFnaSLVhgnu1SWaherg==",
"_location": "/@babel/helper-explode-assignable-expression",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-explode-assignable-expression@^7.7.0",
"name": "@babel/helper-explode-assignable-expression",
"escapedName": "@babel%2fhelper-explode-assignable-expression",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
},
"_requiredBy": [
"/@babel/helper-builder-binary-assignment-operator-visitor"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.7.0.tgz",
"_shasum": "db2a6705555ae1f9f33b4b8212a546bc7f9dc3ef",
"_spec": "@babel/helper-explode-assignable-expression@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\helper-builder-binary-assignment-operator-visitor",
"bundleDependencies": false,
"dependencies": {
"@babel/traverse": "^7.7.0",
"@babel/types": "^7.7.0"
},
"deprecated": false,
"description": "Helper function to explode an assignable expression",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-explode-assignable-expression",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-assignable-expression"
},
"version": "7.7.0"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
# @babel/helper-function-name
> Helper function to change the property 'name' of every function
See our website [@babel/helper-function-name](https://babeljs.io/docs/en/next/babel-helper-function-name.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-function-name
```
or using yarn:
```sh
yarn add @babel/helper-function-name --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _helperGetFunctionArity = _interopRequireDefault(require("@babel/helper-get-function-arity"));
var _template = _interopRequireDefault(require("@babel/template"));
var t = _interopRequireWildcard(require("@babel/types"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const buildPropertyMethodAssignmentWrapper = (0, _template.default)(`
(function (FUNCTION_KEY) {
function FUNCTION_ID() {
return FUNCTION_KEY.apply(this, arguments);
}
FUNCTION_ID.toString = function () {
return FUNCTION_KEY.toString();
}
return FUNCTION_ID;
})(FUNCTION)
`);
const buildGeneratorPropertyMethodAssignmentWrapper = (0, _template.default)(`
(function (FUNCTION_KEY) {
function* FUNCTION_ID() {
return yield* FUNCTION_KEY.apply(this, arguments);
}
FUNCTION_ID.toString = function () {
return FUNCTION_KEY.toString();
};
return FUNCTION_ID;
})(FUNCTION)
`);
const visitor = {
"ReferencedIdentifier|BindingIdentifier"(path, state) {
if (path.node.name !== state.name) return;
const localDeclar = path.scope.getBindingIdentifier(state.name);
if (localDeclar !== state.outerDeclar) return;
state.selfReference = true;
path.stop();
}
};
function getNameFromLiteralId(id) {
if (t.isNullLiteral(id)) {
return "null";
}
if (t.isRegExpLiteral(id)) {
return `_${id.pattern}_${id.flags}`;
}
if (t.isTemplateLiteral(id)) {
return id.quasis.map(quasi => quasi.value.raw).join("");
}
if (id.value !== undefined) {
return id.value + "";
}
return "";
}
function wrap(state, method, id, scope) {
if (state.selfReference) {
if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
scope.rename(id.name);
} else {
if (!t.isFunction(method)) return;
let build = buildPropertyMethodAssignmentWrapper;
if (method.generator) {
build = buildGeneratorPropertyMethodAssignmentWrapper;
}
const template = build({
FUNCTION: method,
FUNCTION_ID: id,
FUNCTION_KEY: scope.generateUidIdentifier(id.name)
}).expression;
const params = template.callee.body.body[0].params;
for (let i = 0, len = (0, _helperGetFunctionArity.default)(method); i < len; i++) {
params.push(scope.generateUidIdentifier("x"));
}
return template;
}
}
method.id = id;
scope.getProgramParent().references[id.name] = true;
}
function visit(node, name, scope) {
const state = {
selfAssignment: false,
selfReference: false,
outerDeclar: scope.getBindingIdentifier(name),
references: [],
name: name
};
const binding = scope.getOwnBinding(name);
if (binding) {
if (binding.kind === "param") {
state.selfReference = true;
} else {}
} else if (state.outerDeclar || scope.hasGlobal(name)) {
scope.traverse(node, visitor, state);
}
return state;
}
function _default({
node,
parent,
scope,
id
}, localBinding = false) {
if (node.id) return;
if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, {
kind: "method"
})) && (!parent.computed || t.isLiteral(parent.key))) {
id = parent.key;
} else if (t.isVariableDeclarator(parent)) {
id = parent.id;
if (t.isIdentifier(id) && !localBinding) {
const binding = scope.parent.getBinding(id.name);
if (binding && binding.constant && scope.getBinding(id.name) === binding) {
node.id = t.cloneNode(id);
node.id[t.NOT_LOCAL_BINDING] = true;
return;
}
}
} else if (t.isAssignmentExpression(parent)) {
id = parent.left;
} else if (!id) {
return;
}
let name;
if (id && t.isLiteral(id)) {
name = getNameFromLiteralId(id);
} else if (id && t.isIdentifier(id)) {
name = id.name;
}
if (name === undefined) {
return;
}
name = t.toBindingIdentifierName(name);
id = t.identifier(name);
id[t.NOT_LOCAL_BINDING] = true;
const state = visit(node, name, scope);
return wrap(state, node, id, scope) || node;
}
\ No newline at end of file
{
"_from": "@babel/helper-function-name@^7.7.0",
"_id": "@babel/helper-function-name@7.7.0",
"_inBundle": false,
"_integrity": "sha512-tDsJgMUAP00Ugv8O2aGEua5I2apkaQO7lBGUq1ocwN3G23JE5Dcq0uh3GvFTChPa4b40AWiAsLvCZOA2rdnQ7Q==",
"_location": "/@babel/helper-function-name",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-function-name@^7.7.0",
"name": "@babel/helper-function-name",
"escapedName": "@babel%2fhelper-function-name",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
},
"_requiredBy": [
"/@babel/helper-create-class-features-plugin",
"/@babel/helper-define-map",
"/@babel/helper-wrap-function",
"/@babel/plugin-transform-classes",
"/@babel/plugin-transform-function-name",
"/@babel/traverse"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.7.0.tgz",
"_shasum": "44a5ad151cfff8ed2599c91682dda2ec2c8430a3",
"_spec": "@babel/helper-function-name@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\traverse",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-get-function-arity": "^7.7.0",
"@babel/template": "^7.7.0",
"@babel/types": "^7.7.0"
},
"deprecated": false,
"description": "Helper function to change the property 'name' of every function",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-function-name",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name"
},
"version": "7.7.0"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
# @babel/helper-get-function-arity
> Helper function to get function arity
See our website [@babel/helper-get-function-arity](https://babeljs.io/docs/en/next/babel-helper-get-function-arity.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-get-function-arity
```
or using yarn:
```sh
yarn add @babel/helper-get-function-arity --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var t = _interopRequireWildcard(require("@babel/types"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _default(node) {
const params = node.params;
for (let i = 0; i < params.length; i++) {
const param = params[i];
if (t.isAssignmentPattern(param) || t.isRestElement(param)) {
return i;
}
}
return params.length;
}
\ No newline at end of file
{
"_from": "@babel/helper-get-function-arity@^7.7.0",
"_id": "@babel/helper-get-function-arity@7.7.0",
"_inBundle": false,
"_integrity": "sha512-tLdojOTz4vWcEnHWHCuPN5P85JLZWbm5Fx5ZsMEMPhF3Uoe3O7awrbM2nQ04bDOUToH/2tH/ezKEOR8zEYzqyw==",
"_location": "/@babel/helper-get-function-arity",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-get-function-arity@^7.7.0",
"name": "@babel/helper-get-function-arity",
"escapedName": "@babel%2fhelper-get-function-arity",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
},
"_requiredBy": [
"/@babel/helper-function-name",
"/@babel/plugin-transform-parameters"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.0.tgz",
"_shasum": "c604886bc97287a1d1398092bc666bc3d7d7aa2d",
"_spec": "@babel/helper-get-function-arity@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\helper-function-name",
"bundleDependencies": false,
"dependencies": {
"@babel/types": "^7.7.0"
},
"deprecated": false,
"description": "Helper function to get function arity",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-get-function-arity",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity"
},
"version": "7.7.0"
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment