Commit a2e8cafb authored by patri's avatar patri
Browse files

Test New PC

1 merge request!1update some ui
Showing with 488 additions and 556 deletions
+488 -556
......@@ -10,25 +10,22 @@ exports.ObjectPattern = exports.ObjectExpression = ObjectExpression;
exports.ObjectMethod = ObjectMethod;
exports.ObjectProperty = ObjectProperty;
exports.ArrayPattern = exports.ArrayExpression = ArrayExpression;
exports.RecordExpression = RecordExpression;
exports.TupleExpression = TupleExpression;
exports.RegExpLiteral = RegExpLiteral;
exports.BooleanLiteral = BooleanLiteral;
exports.NullLiteral = NullLiteral;
exports.NumericLiteral = NumericLiteral;
exports.StringLiteral = StringLiteral;
exports.BigIntLiteral = BigIntLiteral;
exports.DecimalLiteral = DecimalLiteral;
exports.PipelineTopicExpression = PipelineTopicExpression;
exports.PipelineBareFunction = PipelineBareFunction;
exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference;
var t = _interopRequireWildcard(require("@babel/types"));
var t = require("@babel/types");
var _jsesc = _interopRequireDefault(require("jsesc"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; }
var _jsesc = require("jsesc");
function Identifier(node) {
this.exactSource(node.loc, () => {
......@@ -117,6 +114,68 @@ function ArrayExpression(node) {
this.token("]");
}
function RecordExpression(node) {
const props = node.properties;
let startToken;
let endToken;
if (this.format.recordAndTupleSyntaxType === "bar") {
startToken = "{|";
endToken = "|}";
} else if (this.format.recordAndTupleSyntaxType === "hash") {
startToken = "#{";
endToken = "}";
} else {
throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);
}
this.token(startToken);
this.printInnerComments(node);
if (props.length) {
this.space();
this.printList(props, node, {
indent: true,
statement: true
});
this.space();
}
this.token(endToken);
}
function TupleExpression(node) {
const elems = node.elements;
const len = elems.length;
let startToken;
let endToken;
if (this.format.recordAndTupleSyntaxType === "bar") {
startToken = "[|";
endToken = "|]";
} else if (this.format.recordAndTupleSyntaxType === "hash") {
startToken = "#[";
endToken = "]";
} else {
throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);
}
this.token(startToken);
this.printInnerComments(node);
for (let i = 0; i < elems.length; i++) {
const elem = elems[i];
if (elem) {
if (i > 0) this.space();
this.print(elem, node);
if (i < len - 1) this.token(",");
}
}
this.token(endToken);
}
function RegExpLiteral(node) {
this.word(`/${node.pattern}/${node.flags}`);
}
......@@ -131,9 +190,12 @@ function NullLiteral() {
function NumericLiteral(node) {
const raw = this.getPossibleRaw(node);
const opts = this.format.jsescOption;
const value = node.value + "";
if (raw == null) {
if (opts.numbers) {
this.number(_jsesc(node.value, opts));
} else if (raw == null) {
this.number(value);
} else if (this.format.minified) {
this.number(raw.length < value.length ? raw : value);
......@@ -150,13 +212,10 @@ function StringLiteral(node) {
return;
}
const opts = this.format.jsescOption;
if (this.format.jsonCompatibleStrings) {
opts.json = true;
}
const val = _jsesc(node.value, Object.assign(this.format.jsescOption, this.format.jsonCompatibleStrings && {
json: true
}));
const val = (0, _jsesc.default)(node.value, opts);
return this.token(val);
}
......@@ -164,11 +223,22 @@ function BigIntLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
this.token(raw);
this.word(raw);
return;
}
this.word(node.value + "n");
}
function DecimalLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
this.word(raw);
return;
}
this.token(node.value);
this.word(node.value + "m");
}
function PipelineTopicExpression(node) {
......
......@@ -28,6 +28,7 @@ exports.TSVoidKeyword = TSVoidKeyword;
exports.TSUndefinedKeyword = TSUndefinedKeyword;
exports.TSNullKeyword = TSNullKeyword;
exports.TSNeverKeyword = TSNeverKeyword;
exports.TSIntrinsicKeyword = TSIntrinsicKeyword;
exports.TSThisType = TSThisType;
exports.TSFunctionType = TSFunctionType;
exports.TSConstructorType = TSConstructorType;
......@@ -42,6 +43,7 @@ exports.TSArrayType = TSArrayType;
exports.TSTupleType = TSTupleType;
exports.TSOptionalType = TSOptionalType;
exports.TSRestType = TSRestType;
exports.TSNamedTupleMember = TSNamedTupleMember;
exports.TSUnionType = TSUnionType;
exports.TSIntersectionType = TSIntersectionType;
exports.tsPrintUnionOrIntersectionType = tsPrintUnionOrIntersectionType;
......@@ -71,6 +73,8 @@ exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration;
exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase;
exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers;
var t = require("@babel/types");
function TSTypeAnnotation(node) {
this.token(":");
this.space();
......@@ -192,6 +196,15 @@ function tsPrintPropertyOrMethodName(node) {
}
function TSMethodSignature(node) {
const {
kind
} = node;
if (kind === "set" || kind === "get") {
this.word(kind);
this.space();
}
this.tsPrintPropertyOrMethodName(node);
this.tsPrintSignatureDeclarationBase(node);
this.token(";");
......@@ -199,9 +212,15 @@ function TSMethodSignature(node) {
function TSIndexSignature(node) {
const {
readonly
readonly,
static: isStatic
} = node;
if (isStatic) {
this.word("static");
this.space();
}
if (readonly) {
this.word("readonly");
this.space();
......@@ -264,6 +283,10 @@ function TSNeverKeyword() {
this.word("never");
}
function TSIntrinsicKeyword() {
this.word("intrinsic");
}
function TSThisType() {
this.word("this");
}
......@@ -273,6 +296,11 @@ function TSFunctionType(node) {
}
function TSConstructorType(node) {
if (node.abstract) {
this.word("abstract");
this.space();
}
this.word("new");
this.space();
this.tsPrintFunctionOrConstructorType(node);
......@@ -370,6 +398,14 @@ function TSRestType(node) {
this.print(node.typeAnnotation, node);
}
function TSNamedTupleMember(node) {
this.print(node.label, node);
if (node.optional) this.token("?");
this.token(":");
this.space();
this.print(node.elementType, node);
}
function TSUnionType(node) {
this.tsPrintUnionOrIntersectionType(node, "|");
}
......@@ -418,7 +454,7 @@ function TSParenthesizedType(node) {
}
function TSTypeOperator(node) {
this.token(node.operator);
this.word(node.operator);
this.space();
this.print(node.typeAnnotation, node);
}
......@@ -432,9 +468,10 @@ function TSIndexedAccessType(node) {
function TSMappedType(node) {
const {
nameType,
optional,
readonly,
typeParameter,
optional
typeParameter
} = node;
this.token("{");
this.space();
......@@ -451,6 +488,14 @@ function TSMappedType(node) {
this.word("in");
this.space();
this.print(typeParameter.constraint, typeParameter);
if (nameType) {
this.space();
this.word("as");
this.space();
this.print(nameType, node);
}
this.token("]");
if (optional) {
......@@ -499,7 +544,7 @@ function TSInterfaceDeclaration(node) {
this.print(id, node);
this.print(typeParameters, node);
if (extendz) {
if (extendz != null && extendz.length) {
this.space();
this.word("extends");
this.space();
......@@ -746,6 +791,11 @@ function tsPrintClassMemberModifiers(node, isField) {
this.space();
}
if (node.override) {
this.word("override");
this.space();
}
if (node.abstract) {
this.word("abstract");
this.space();
......
......@@ -3,20 +3,19 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
exports.default = generate;
exports.CodeGenerator = void 0;
var _sourceMap = _interopRequireDefault(require("./source-map"));
var _sourceMap = require("./source-map");
var _printer = _interopRequireDefault(require("./printer"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _printer = require("./printer");
class Generator extends _printer.default {
constructor(ast, opts = {}, code) {
const format = normalizeOptions(code, opts);
const map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null;
super(format, map);
this.ast = void 0;
this.ast = ast;
}
......@@ -37,7 +36,6 @@ function normalizeOptions(code, opts) {
compact: opts.compact,
minified: opts.minified,
concise: opts.concise,
jsonCompatibleStrings: opts.jsonCompatibleStrings,
indent: {
adjustMultilineComment: true,
style: " ",
......@@ -46,9 +44,14 @@ function normalizeOptions(code, opts) {
decoratorsBeforeExport: !!opts.decoratorsBeforeExport,
jsescOption: Object.assign({
quotes: "double",
wrap: true
}, opts.jsescOption)
wrap: true,
minimal: false
}, opts.jsescOption),
recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType
};
{
format.jsonCompatibleStrings = opts.jsonCompatibleStrings;
}
if (format.minified) {
format.compact = true;
......@@ -75,6 +78,7 @@ function normalizeOptions(code, opts) {
class CodeGenerator {
constructor(ast, opts, code) {
this._generator = void 0;
this._generator = new Generator(ast, opts, code);
}
......@@ -86,7 +90,7 @@ class CodeGenerator {
exports.CodeGenerator = CodeGenerator;
function _default(ast, opts, code) {
function generate(ast, opts, code) {
const gen = new Generator(ast, opts, code);
return gen.generate();
}
\ No newline at end of file
......@@ -8,15 +8,11 @@ exports.needsWhitespaceBefore = needsWhitespaceBefore;
exports.needsWhitespaceAfter = needsWhitespaceAfter;
exports.needsParens = needsParens;
var whitespace = _interopRequireWildcard(require("./whitespace"));
var whitespace = require("./whitespace");
var parens = _interopRequireWildcard(require("./parentheses"));
var parens = require("./parentheses");
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; }
var t = require("@babel/types");
function expandAliases(obj) {
const newObj = {};
......@@ -58,11 +54,7 @@ function isOrHasCallExpression(node) {
return true;
}
if (t.isMemberExpression(node)) {
return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property);
} else {
return false;
}
return t.isMemberExpression(node) && isOrHasCallExpression(node.object);
}
function needsWhitespace(node, parent, type) {
......@@ -107,6 +99,5 @@ function needsParens(node, parent, printStack) {
if (isOrHasCallExpression(node)) return true;
}
if (t.isLogicalExpression(node) && parent.operator === "??") return true;
return find(expandedParens, node, parent, printStack);
}
\ No newline at end of file
......@@ -10,9 +10,11 @@ exports.ObjectExpression = ObjectExpression;
exports.DoExpression = DoExpression;
exports.Binary = Binary;
exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation;
exports.OptionalIndexedAccessType = OptionalIndexedAccessType;
exports.TSAsExpression = TSAsExpression;
exports.TSTypeAssertion = TSTypeAssertion;
exports.TSIntersectionType = exports.TSUnionType = TSUnionType;
exports.TSInferType = TSInferType;
exports.BinaryExpression = BinaryExpression;
exports.SequenceExpression = SequenceExpression;
exports.AwaitExpression = exports.YieldExpression = YieldExpression;
......@@ -21,18 +23,16 @@ exports.UnaryLike = UnaryLike;
exports.FunctionExpression = FunctionExpression;
exports.ArrowFunctionExpression = ArrowFunctionExpression;
exports.ConditionalExpression = ConditionalExpression;
exports.OptionalMemberExpression = OptionalMemberExpression;
exports.OptionalCallExpression = exports.OptionalMemberExpression = OptionalMemberExpression;
exports.AssignmentExpression = AssignmentExpression;
exports.NewExpression = NewExpression;
exports.LogicalExpression = LogicalExpression;
exports.Identifier = Identifier;
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; }
var t = require("@babel/types");
const PRECEDENCE = {
"||": 0,
"??": 0,
"&&": 1,
"|": 2,
"^": 3,
......@@ -60,6 +60,8 @@ const PRECEDENCE = {
const isClassExtendsClause = (node, parent) => (t.isClassDeclaration(parent) || t.isClassExpression(parent)) && parent.superClass === node;
const hasPostfixPart = (node, parent) => (t.isMemberExpression(parent) || t.isOptionalMemberExpression(parent)) && parent.object === node || (t.isCallExpression(parent) || t.isOptionalCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node || t.isTaggedTemplateExpression(parent) && parent.tag === node || t.isTSNonNullExpression(parent);
function NullableTypeAnnotation(node, parent) {
return t.isArrayTypeAnnotation(parent);
}
......@@ -69,23 +71,20 @@ function FunctionTypeAnnotation(node, parent, printStack) {
}
function UpdateExpression(node, parent) {
return t.isMemberExpression(parent, {
object: node
}) || t.isCallExpression(parent, {
callee: node
}) || t.isNewExpression(parent, {
callee: node
}) || isClassExtendsClause(node, parent);
return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent);
}
function ObjectExpression(node, parent, printStack) {
return isFirstInStatement(printStack, {
considerArrow: true
return isFirstInContext(printStack, {
expressionStatement: true,
arrowBody: true
});
}
function DoExpression(node, parent, printStack) {
return isFirstInStatement(printStack);
return !node.async && isFirstInContext(printStack, {
expressionStatement: true
});
}
function Binary(node, parent) {
......@@ -99,7 +98,7 @@ function Binary(node, parent) {
return true;
}
if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node || t.isUnaryLike(parent) || t.isMemberExpression(parent) && parent.object === node || t.isAwaitExpression(parent)) {
if (hasPostfixPart(node, parent) || t.isUnaryLike(parent) || t.isAwaitExpression(parent)) {
return true;
}
......@@ -113,14 +112,18 @@ function Binary(node, parent) {
return true;
}
}
return false;
}
function UnionTypeAnnotation(node, parent) {
return t.isArrayTypeAnnotation(parent) || t.isNullableTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isUnionTypeAnnotation(parent);
}
function OptionalIndexedAccessType(node, parent) {
return t.isIndexedAccessType(parent, {
objectType: node
});
}
function TSAsExpression() {
return true;
}
......@@ -133,6 +136,10 @@ function TSUnionType(node, parent) {
return t.isTSArrayType(parent) || t.isTSOptionalType(parent) || t.isTSIntersectionType(parent) || t.isTSUnionType(parent) || t.isTSRestType(parent);
}
function TSInferType(node, parent) {
return t.isTSArrayType(parent) || t.isTSOptionalType(parent);
}
function BinaryExpression(node, parent) {
return node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent));
}
......@@ -146,31 +153,27 @@ function SequenceExpression(node, parent) {
}
function YieldExpression(node, parent) {
return t.isBinary(parent) || t.isUnaryLike(parent) || t.isCallExpression(parent) || t.isMemberExpression(parent) || t.isNewExpression(parent) || t.isAwaitExpression(parent) && t.isYieldExpression(node) || t.isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
return t.isBinary(parent) || t.isUnaryLike(parent) || hasPostfixPart(node, parent) || t.isAwaitExpression(parent) && t.isYieldExpression(node) || t.isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
}
function ClassExpression(node, parent, printStack) {
return isFirstInStatement(printStack, {
considerDefaultExports: true
return isFirstInContext(printStack, {
expressionStatement: true,
exportDefault: true
});
}
function UnaryLike(node, parent) {
return t.isMemberExpression(parent, {
object: node
}) || t.isCallExpression(parent, {
callee: node
}) || t.isNewExpression(parent, {
callee: node
}) || t.isBinaryExpression(parent, {
return hasPostfixPart(node, parent) || t.isBinaryExpression(parent, {
operator: "**",
left: node
}) || isClassExtendsClause(node, parent);
}
function FunctionExpression(node, parent, printStack) {
return isFirstInStatement(printStack, {
considerDefaultExports: true
return isFirstInContext(printStack, {
expressionStatement: true,
exportDefault: true
});
}
......@@ -181,7 +184,7 @@ function ArrowFunctionExpression(node, parent) {
function ConditionalExpression(node, parent) {
if (t.isUnaryLike(parent) || t.isBinary(parent) || t.isConditionalExpression(parent, {
test: node
}) || t.isAwaitExpression(parent) || t.isOptionalMemberExpression(parent) || t.isTaggedTemplateExpression(parent) || t.isTSTypeAssertion(parent) || t.isTSAsExpression(parent)) {
}) || t.isAwaitExpression(parent) || t.isTSTypeAssertion(parent) || t.isTSAsExpression(parent)) {
return true;
}
......@@ -189,46 +192,89 @@ function ConditionalExpression(node, parent) {
}
function OptionalMemberExpression(node, parent) {
return t.isCallExpression(parent) || t.isMemberExpression(parent);
return t.isCallExpression(parent, {
callee: node
}) || t.isMemberExpression(parent, {
object: node
});
}
function AssignmentExpression(node) {
function AssignmentExpression(node, parent) {
if (t.isObjectPattern(node.left)) {
return true;
} else {
return ConditionalExpression(...arguments);
return ConditionalExpression(node, parent);
}
}
function NewExpression(node, parent) {
return isClassExtendsClause(node, parent);
function LogicalExpression(node, parent) {
switch (node.operator) {
case "||":
if (!t.isLogicalExpression(parent)) return false;
return parent.operator === "??" || parent.operator === "&&";
case "&&":
return t.isLogicalExpression(parent, {
operator: "??"
});
case "??":
return t.isLogicalExpression(parent) && parent.operator !== "??";
}
}
function isFirstInStatement(printStack, {
considerArrow = false,
considerDefaultExports = false
} = {}) {
function Identifier(node, parent, printStack) {
if (node.name === "let") {
const isFollowedByBracket = t.isMemberExpression(parent, {
object: node,
computed: true
}) || t.isOptionalMemberExpression(parent, {
object: node,
computed: true,
optional: false
});
return isFirstInContext(printStack, {
expressionStatement: isFollowedByBracket,
forHead: isFollowedByBracket,
forInHead: isFollowedByBracket,
forOfHead: true
});
}
return node.name === "async" && t.isForOfStatement(parent) && node === parent.left;
}
function isFirstInContext(printStack, {
expressionStatement = false,
arrowBody = false,
exportDefault = false,
forHead = false,
forInHead = false,
forOfHead = false
}) {
let i = printStack.length - 1;
let node = printStack[i];
i--;
let parent = printStack[i];
while (i > 0) {
if (t.isExpressionStatement(parent, {
while (i >= 0) {
if (expressionStatement && t.isExpressionStatement(parent, {
expression: node
}) || t.isTaggedTemplateExpression(parent) || considerDefaultExports && t.isExportDefaultDeclaration(parent, {
}) || exportDefault && t.isExportDefaultDeclaration(parent, {
declaration: node
}) || considerArrow && t.isArrowFunctionExpression(parent, {
}) || arrowBody && t.isArrowFunctionExpression(parent, {
body: node
}) || forHead && t.isForStatement(parent, {
init: node
}) || forInHead && t.isForInStatement(parent, {
left: node
}) || forOfHead && t.isForOfStatement(parent, {
left: node
})) {
return true;
}
if (t.isCallExpression(parent, {
callee: node
}) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isMemberExpression(parent, {
object: node
}) || t.isConditional(parent, {
if (hasPostfixPart(node, parent) && !t.isNewExpression(parent) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isConditional(parent, {
test: node
}) || t.isBinary(parent, {
left: node
......
......@@ -5,20 +5,16 @@ Object.defineProperty(exports, "__esModule", {
});
exports.list = exports.nodes = void 0;
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; }
var t = require("@babel/types");
function crawl(node, state = {}) {
if (t.isMemberExpression(node)) {
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
crawl(node.object, state);
if (node.computed) crawl(node.property, state);
} else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
crawl(node.left, state);
crawl(node.right, state);
} else if (t.isCallExpression(node)) {
} else if (t.isCallExpression(node) || t.isOptionalCallExpression(node)) {
state.hasCall = true;
crawl(node.callee, state);
} else if (t.isFunction(node)) {
......@@ -62,7 +58,7 @@ const nodes = {
SwitchCase(node, parent) {
return {
before: node.consequent.length || parent.cases[0] === node,
before: !!node.consequent.length || parent.cases[0] === node,
after: !node.consequent.length && parent.cases[parent.cases.length - 1] === node
};
},
......@@ -76,7 +72,7 @@ const nodes = {
},
Literal(node) {
if (node.value === "use strict") {
if (t.isStringLiteral(node) && node.value === "use strict") {
return {
after: true
};
......@@ -92,6 +88,15 @@ const nodes = {
}
},
OptionalCallExpression(node) {
if (t.isFunction(node.callee)) {
return {
before: true,
after: true
};
}
},
VariableDeclaration(node) {
for (let i = 0; i < node.declarations.length; i++) {
const declar = node.declarations[i];
......@@ -132,7 +137,9 @@ nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function
};
nodes.ObjectTypeCallProperty = function (node, parent) {
if (parent.callProperties[0] === node && (!parent.properties || !parent.properties.length)) {
var _parent$properties;
if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) != null && _parent$properties.length)) {
return {
before: true
};
......@@ -140,7 +147,9 @@ nodes.ObjectTypeCallProperty = function (node, parent) {
};
nodes.ObjectTypeIndexer = function (node, parent) {
if (parent.indexers[0] === node && (!parent.properties || !parent.properties.length) && (!parent.callProperties || !parent.callProperties.length)) {
var _parent$properties2, _parent$callPropertie;
if (parent.indexers[0] === node && !((_parent$properties2 = parent.properties) != null && _parent$properties2.length) && !((_parent$callPropertie = parent.callProperties) != null && _parent$callPropertie.length)) {
return {
before: true
};
......@@ -148,7 +157,9 @@ nodes.ObjectTypeIndexer = function (node, parent) {
};
nodes.ObjectTypeInternalSlot = function (node, parent) {
if (parent.internalSlots[0] === node && (!parent.properties || !parent.properties.length) && (!parent.callProperties || !parent.callProperties.length) && (!parent.indexers || !parent.indexers.length)) {
var _parent$properties3, _parent$callPropertie2, _parent$indexers;
if (parent.internalSlots[0] === node && !((_parent$properties3 = parent.properties) != null && _parent$properties3.length) && !((_parent$callPropertie2 = parent.callProperties) != null && _parent$callPropertie2.length) && !((_parent$indexers = parent.indexers) != null && _parent$indexers.length)) {
return {
before: true
};
......
......@@ -5,27 +5,18 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = void 0;
var _isInteger = _interopRequireDefault(require("lodash/isInteger"));
var _buffer = require("./buffer");
var _repeat = _interopRequireDefault(require("lodash/repeat"));
var n = require("./node");
var _buffer = _interopRequireDefault(require("./buffer"));
var t = require("@babel/types");
var n = _interopRequireWildcard(require("./node"));
var t = _interopRequireWildcard(require("@babel/types"));
var generatorFunctions = _interopRequireWildcard(require("./generators"));
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 }; }
var generatorFunctions = require("./generators");
const SCIENTIFIC_NOTATION = /e/i;
const ZERO_DECIMAL_INTEGER = /\.0+$/;
const NON_DECIMAL_LITERAL = /^0[box]/;
const PURE_ANNOTATION_RE = /^\s*[@#]__PURE__\s*$/;
class Printer {
constructor(format, map) {
......@@ -33,14 +24,13 @@ class Printer {
this._printStack = [];
this._indent = 0;
this._insideAux = false;
this._printedCommentStarts = {};
this._parenPushNewlineState = null;
this._noLineTerminator = false;
this._printAuxAfterOnNextUserNode = false;
this._printedComments = new WeakSet();
this._endsWithInteger = false;
this._endsWithWord = false;
this.format = format || {};
this.format = format;
this._buf = new _buffer.default(map);
}
......@@ -98,7 +88,7 @@ class Printer {
number(str) {
this.word(str);
this._endsWithInteger = (0, _isInteger.default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
this._endsWithInteger = Number.isInteger(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
}
token(str) {
......@@ -183,19 +173,32 @@ class Printer {
_maybeAddParen(str) {
const parenPushNewlineState = this._parenPushNewlineState;
if (!parenPushNewlineState) return;
this._parenPushNewlineState = null;
let i;
for (i = 0; i < str.length && str[i] === " "; i++) continue;
if (i === str.length) return;
if (i === str.length) {
return;
}
const cha = str[i];
if (cha !== "\n") {
if (cha !== "/") return;
if (i + 1 === str.length) return;
if (cha !== "/" || i + 1 === str.length) {
this._parenPushNewlineState = null;
return;
}
const chaPost = str[i + 1];
if (chaPost !== "/" && chaPost !== "*") return;
if (chaPost === "*") {
if (PURE_ANNOTATION_RE.test(str.slice(i + 2, str.length - 2))) {
return;
}
} else if (chaPost !== "/") {
this._parenPushNewlineState = null;
return;
}
}
this.token("(");
......@@ -207,7 +210,7 @@ class Printer {
if (!this.format.retainLines) return;
const pos = loc ? loc[prop] : null;
if (pos && pos.line !== null) {
if ((pos == null ? void 0 : pos.line) != null) {
const count = pos.line - this._buf.getCurrentLine();
for (let i = 0; i < count; i++) {
......@@ -217,7 +220,7 @@ class Printer {
}
_getIndent() {
return (0, _repeat.default)(this.format.indent.style, this._indent);
return this.format.indent.style.repeat(this._indent);
}
startTerminatorless(isLabel = false) {
......@@ -234,7 +237,7 @@ class Printer {
endTerminatorless(state) {
this._noLineTerminator = false;
if (state && state.printed) {
if (state != null && state.printed) {
this.dedent();
this.newline();
this.token(")");
......@@ -252,7 +255,7 @@ class Printer {
const printMethod = this[node.type];
if (!printMethod) {
throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node && node.constructor.name)}`);
throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node == null ? void 0 : node.constructor.name)}`);
}
this._printStack.push(node);
......@@ -327,7 +330,7 @@ class Printer {
}
printJoin(nodes, parent, opts = {}) {
if (!nodes || !nodes.length) return;
if (!(nodes != null && nodes.length)) return;
if (opts.indent) this.indent();
const newlineOpts = {
addNewlines: opts.addNewlines
......@@ -375,11 +378,13 @@ class Printer {
}
_printLeadingComments(node) {
this._printComments(this._getComments(true, node));
this._printComments(this._getComments(true, node), true);
}
printInnerComments(node, indent = true) {
if (!node.innerComments || !node.innerComments.length) return;
var _node$innerComments;
if (!((_node$innerComments = node.innerComments) != null && _node$innerComments.length)) return;
if (indent) this.indent();
this._printComments(node.innerComments);
......@@ -424,54 +429,75 @@ class Printer {
return node && (leading ? node.leadingComments : node.trailingComments) || [];
}
_printComment(comment) {
_printComment(comment, skipNewLines) {
if (!this.format.shouldPrintComment(comment.value)) return;
if (comment.ignore) return;
if (this._printedComments.has(comment)) return;
this._printedComments.add(comment);
if (comment.start != null) {
if (this._printedCommentStarts[comment.start]) return;
this._printedCommentStarts[comment.start] = true;
}
const isBlockComment = comment.type === "CommentBlock";
this.newline(this._buf.hasContent() && !this._noLineTerminator && isBlockComment ? 1 : 0);
const printNewLines = isBlockComment && !skipNewLines && !this._noLineTerminator;
if (printNewLines && this._buf.hasContent()) this.newline(1);
if (!this.endsWith("[") && !this.endsWith("{")) this.space();
let val = !isBlockComment && !this._noLineTerminator ? `//${comment.value}\n` : `/*${comment.value}*/`;
if (isBlockComment && this.format.indent.adjustMultilineComment) {
const offset = comment.loc && comment.loc.start.column;
var _comment$loc;
const offset = (_comment$loc = comment.loc) == null ? void 0 : _comment$loc.start.column;
if (offset) {
const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
val = val.replace(newlineRegex, "\n");
}
const indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn());
val = val.replace(/\n(?!$)/g, `\n${(0, _repeat.default)(" ", indentSize)}`);
const indentSize = Math.max(this._getIndent().length, this.format.retainLines ? 0 : this._buf.getCurrentColumn());
val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`);
}
if (this.endsWith("/")) this._space();
this.withSource("start", comment.loc, () => {
this._append(val);
});
this.newline(isBlockComment && !this._noLineTerminator ? 1 : 0);
if (printNewLines) this.newline(1);
}
_printComments(comments, inlinePureAnnotation) {
if (!(comments != null && comments.length)) return;
if (inlinePureAnnotation && comments.length === 1 && PURE_ANNOTATION_RE.test(comments[0].value)) {
this._printComment(comments[0], this._buf.hasContent() && !this.endsWith("\n"));
} else {
for (const comment of comments) {
this._printComment(comment);
}
}
}
_printComments(comments) {
if (!comments || !comments.length) return;
printAssertions(node) {
var _node$assertions;
for (const comment of comments) {
this._printComment(comment);
if ((_node$assertions = node.assertions) != null && _node$assertions.length) {
this.space();
this.word("assert");
this.space();
this.token("{");
this.space();
this.printList(node.assertions, node);
this.space();
this.token("}");
}
}
}
exports.default = Printer;
Object.assign(Printer.prototype, generatorFunctions);
{
Printer.prototype.Noop = function Noop() {};
}
var _default = Printer;
exports.default = _default;
function commaSeparator() {
this.token(",");
......
......@@ -5,12 +5,17 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = void 0;
var _sourceMap = _interopRequireDefault(require("source-map"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _sourceMap = require("source-map");
class SourceMap {
constructor(opts, code) {
this._cachedMap = void 0;
this._code = void 0;
this._opts = void 0;
this._rawMappings = void 0;
this._lastGenLine = void 0;
this._lastSourceLine = void 0;
this._lastSourceColumn = void 0;
this._cachedMap = null;
this._code = code;
this._opts = opts;
......@@ -19,7 +24,7 @@ class SourceMap {
get() {
if (!this._cachedMap) {
const map = this._cachedMap = new _sourceMap.default.SourceMapGenerator({
const map = this._cachedMap = new _sourceMap.SourceMapGenerator({
sourceRoot: this._opts.sourceRoot
});
const code = this._code;
......
{
"_from": "@babel/generator@^7.7.2",
"_id": "@babel/generator@7.7.2",
"_inBundle": false,
"_integrity": "sha512-WthSArvAjYLz4TcbKOi88me+KmDJdKSlfwwN8CnUYn9jBkzhq0ZEPuBfkAWIvjJ3AdEV1Cf/+eSQTnp3IDJKlQ==",
"_location": "/@babel/generator",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/generator@^7.7.2",
"name": "@babel/generator",
"escapedName": "@babel%2fgenerator",
"scope": "@babel",
"rawSpec": "^7.7.2",
"saveSpec": null,
"fetchSpec": "^7.7.2"
},
"_requiredBy": [
"/@babel/core",
"/@babel/traverse"
],
"_resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.2.tgz",
"_shasum": "2f4852d04131a5e17ea4f6645488b5da66ebf3af",
"_spec": "@babel/generator@^7.7.2",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\core",
"author": {
"name": "Sebastian McKenzie",
"email": "sebmck@gmail.com"
},
"bundleDependencies": false,
"dependencies": {
"@babel/types": "^7.7.2",
"jsesc": "^2.5.1",
"lodash": "^4.17.13",
"source-map": "^0.5.0"
},
"deprecated": false,
"name": "@babel/generator",
"version": "7.14.5",
"description": "Turns an AST into code.",
"devDependencies": {
"@babel/helper-fixtures": "^7.6.3",
"@babel/parser": "^7.7.2"
},
"files": [
"lib"
],
"gitHead": "35f4d1276310bac6fede4a6f86a5c76f951e179e",
"homepage": "https://babeljs.io/",
"author": "The Babel Team (https://babel.dev/team)",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/generator",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-generator"
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-generator"
},
"homepage": "https://babel.dev/docs/en/next/babel-generator",
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20generator%22+is%3Aopen",
"main": "./lib/index.js",
"files": [
"lib"
],
"dependencies": {
"@babel/types": "^7.14.5",
"jsesc": "^2.5.1",
"source-map": "^0.5.0"
},
"devDependencies": {
"@babel/helper-fixtures": "7.14.5",
"@babel/parser": "7.14.5",
"@types/jsesc": "^2.5.0",
"@types/source-map": "^0.5.0"
},
"version": "7.7.2"
}
"engines": {
"node": ">=6.9.0"
}
}
\ No newline at end of file
{
"_from": "@babel/helper-annotate-as-pure@^7.7.0",
"_id": "@babel/helper-annotate-as-pure@7.7.0",
"_inBundle": false,
"_integrity": "sha512-k50CQxMlYTYo+GGyUGFwpxKVtxVJi9yh61sXZji3zYHccK9RYliZGSTOgci85T+r+0VFN2nWbGM04PIqwfrpMg==",
"_location": "/@babel/helper-annotate-as-pure",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-annotate-as-pure@^7.7.0",
"name": "@babel/helper-annotate-as-pure",
"escapedName": "@babel%2fhelper-annotate-as-pure",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
},
"_requiredBy": [
"/@babel/helper-remap-async-to-generator",
"/@babel/plugin-transform-classes",
"/@babel/plugin-transform-template-literals"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.0.tgz",
"_shasum": "efc54032d43891fe267679e63f6860aa7dbf4a5e",
"_spec": "@babel/helper-annotate-as-pure@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\helper-remap-async-to-generator",
"bundleDependencies": false,
"dependencies": {
"@babel/types": "^7.7.0"
},
"deprecated": false,
"name": "@babel/helper-annotate-as-pure",
"version": "7.7.0",
"description": "Helper function to annotate paths and nodes with #__PURE__ comment",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-annotate-as-pure",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-annotate-as-pure",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-annotate-as-pure"
"main": "lib/index.js",
"dependencies": {
"@babel/types": "^7.7.0"
},
"version": "7.7.0"
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea"
}
{
"_from": "@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0",
"_id": "@babel/helper-builder-binary-assignment-operator-visitor@7.7.0",
"_inBundle": false,
"_integrity": "sha512-Cd8r8zs4RKDwMG/92lpZcnn5WPQ3LAMQbCw42oqUh4s7vsSN5ANUZjMel0OOnxDLq57hoDDbai+ryygYfCTOsw==",
"_location": "/@babel/helper-builder-binary-assignment-operator-visitor",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0",
"name": "@babel/helper-builder-binary-assignment-operator-visitor",
"escapedName": "@babel%2fhelper-builder-binary-assignment-operator-visitor",
"scope": "@babel",
"rawSpec": "^7.1.0",
"saveSpec": null,
"fetchSpec": "^7.1.0"
},
"_requiredBy": [
"/@babel/plugin-transform-exponentiation-operator"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.7.0.tgz",
"_shasum": "32dd9551d6ed3a5fc2edc50d6912852aa18274d9",
"_spec": "@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\plugin-transform-exponentiation-operator",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-explode-assignable-expression": "^7.7.0",
"@babel/types": "^7.7.0"
},
"deprecated": false,
"name": "@babel/helper-builder-binary-assignment-operator-visitor",
"version": "7.7.0",
"description": "Helper function to build binary assignment operator visitors",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-binary-assignment-operator-visitor",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-builder-binary-assignment-operator-visitor",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-binary-assignment-operator-visitor"
"main": "lib/index.js",
"dependencies": {
"@babel/helper-explode-assignable-expression": "^7.7.0",
"@babel/types": "^7.7.0"
},
"version": "7.7.0"
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea"
}
{
"_from": "@babel/helper-call-delegate@^7.4.4",
"_id": "@babel/helper-call-delegate@7.7.0",
"_inBundle": false,
"_integrity": "sha512-Su0Mdq7uSSWGZayGMMQ+z6lnL00mMCnGAbO/R0ZO9odIdB/WNU/VfQKqMQU0fdIsxQYbRjDM4BixIa93SQIpvw==",
"_location": "/@babel/helper-call-delegate",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-call-delegate@^7.4.4",
"name": "@babel/helper-call-delegate",
"escapedName": "@babel%2fhelper-call-delegate",
"scope": "@babel",
"rawSpec": "^7.4.4",
"saveSpec": null,
"fetchSpec": "^7.4.4"
},
"_requiredBy": [
"/@babel/plugin-transform-parameters"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.7.0.tgz",
"_shasum": "df8942452c2c1a217335ca7e393b9afc67f668dc",
"_spec": "@babel/helper-call-delegate@^7.4.4",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\plugin-transform-parameters",
"bundleDependencies": false,
"dependencies": {
"@babel/helper-hoist-variables": "^7.7.0",
"@babel/traverse": "^7.7.0",
"@babel/types": "^7.7.0"
},
"deprecated": false,
"name": "@babel/helper-call-delegate",
"version": "7.7.0",
"description": "Helper function to call delegate",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-call-delegate",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate"
"main": "lib/index.js",
"dependencies": {
"@babel/helper-hoist-variables": "^7.7.0",
"@babel/traverse": "^7.7.0",
"@babel/types": "^7.7.0"
},
"version": "7.7.0"
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea"
}
{
"_from": "@babel/helper-create-class-features-plugin@^7.7.0",
"_id": "@babel/helper-create-class-features-plugin@7.7.0",
"_inBundle": false,
"_integrity": "sha512-MZiB5qvTWoyiFOgootmRSDV1udjIqJW/8lmxgzKq6oDqxdmHUjeP2ZUOmgHdYjmUVNABqRrHjYAYRvj8Eox/UA==",
"_location": "/@babel/helper-create-class-features-plugin",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-create-class-features-plugin@^7.7.0",
"name": "@babel/helper-create-class-features-plugin",
"escapedName": "@babel%2fhelper-create-class-features-plugin",
"scope": "@babel",
"rawSpec": "^7.7.0",
"saveSpec": null,
"fetchSpec": "^7.7.0"
"name": "@babel/helper-create-class-features-plugin",
"version": "7.7.0",
"author": "The Babel Team (https://babeljs.io/team)",
"license": "MIT",
"description": "Compile class public and private fields, private methods and decorators to ES6",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-create-class-features-plugin",
"main": "lib/index.js",
"publishConfig": {
"access": "public"
},
"_requiredBy": [
"/@babel/plugin-proposal-class-properties",
"/@babel/plugin-proposal-decorators"
"keywords": [
"babel",
"babel-plugin"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.7.0.tgz",
"_shasum": "bcdc223abbfdd386f94196ae2544987f8df775e8",
"_spec": "@babel/helper-create-class-features-plugin@^7.7.0",
"_where": "C:\\Work\\OneDrive - bwstaff\\M4_Lab\\TV3\\NewVersion01\\LAFJLBmf939XYm5gj\\dev\\node_modules\\@babel\\plugin-proposal-class-properties",
"author": {
"name": "The Babel Team",
"url": "https://babeljs.io/team"
},
"bundleDependencies": false,
"dependencies": {
"@babel/helper-function-name": "^7.7.0",
"@babel/helper-member-expression-to-functions": "^7.7.0",
......@@ -37,29 +21,12 @@
"@babel/helper-replace-supers": "^7.7.0",
"@babel/helper-split-export-declaration": "^7.7.0"
},
"deprecated": false,
"description": "Compile class public and private fields, private methods and decorators to ES6",
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"keywords": [
"babel",
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-create-class-features-plugin",
"peerDependencies": {
"@babel/core": "^7.0.0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-create-class-features-plugin"
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"version": "7.7.0"
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea"
}
{
"_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,
"name": "@babel/helper-create-regexp-features-plugin",
"version": "7.7.2",
"author": "The Babel Team (https://babeljs.io/team)",
"license": "MIT",
"description": "Compile ESNext Regular Expressions to ES5",
"devDependencies": {
"@babel/core": "^7.7.2",
"@babel/helper-plugin-test-runner": "^7.0.0"
"repository": {
"type": "git",
"url": "https://github.com/babel/babel",
"directory": "packages/babel-helper-create-regexp-features-plugin"
},
"main": "lib/index.js",
"publishConfig": {
"access": "public"
},
"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",
"dependencies": {
"@babel/helper-regex": "^7.4.4",
"regexpu-core": "^4.6.0"
},
"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"
"devDependencies": {
"@babel/core": "^7.7.2",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"version": "7.7.2"
"gitHead": "35f4d1276310bac6fede4a6f86a5c76f951e179e"
}
{
"_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,
"name": "@babel/helper-define-map",
"version": "7.7.0",
"description": "Helper function to define a map",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map",
"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"
"main": "lib/index.js",
"dependencies": {
"@babel/helper-function-name": "^7.7.0",
"@babel/types": "^7.7.0",
"lodash": "^4.17.13"
},
"version": "7.7.0"
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea"
}
{
"_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,
"name": "@babel/helper-explode-assignable-expression",
"version": "7.7.0",
"description": "Helper function to explode an assignable expression",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-assignable-expression",
"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"
"main": "lib/index.js",
"dependencies": {
"@babel/traverse": "^7.7.0",
"@babel/types": "^7.7.0"
},
"version": "7.7.0"
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea"
}
......@@ -2,7 +2,7 @@
> 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.
See our website [@babel/helper-function-name](https://babeljs.io/docs/en/babel-helper-function-name) for more information.
## Install
......
......@@ -5,17 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = _default;
var _helperGetFunctionArity = _interopRequireDefault(require("@babel/helper-get-function-arity"));
var _helperGetFunctionArity = require("@babel/helper-get-function-arity");
var _template = _interopRequireDefault(require("@babel/template"));
var _template = 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 }; }
var t = require("@babel/types");
const buildPropertyMethodAssignmentWrapper = (0, _template.default)(`
(function (FUNCTION_KEY) {
......@@ -150,7 +144,9 @@ function _default({
return;
}
}
} else if (t.isAssignmentExpression(parent)) {
} else if (t.isAssignmentExpression(parent, {
operator: "="
})) {
id = parent.left;
} else if (!id) {
return;
......
{
"_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,
"name": "@babel/helper-function-name",
"version": "7.14.5",
"description": "Helper function to change the property 'name' of every function",
"gitHead": "97faa83953cb87e332554fa559a4956d202343ea",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-function-name"
},
"homepage": "https://babel.dev/docs/en/next/babel-helper-function-name",
"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"
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-get-function-arity": "^7.14.5",
"@babel/template": "^7.14.5",
"@babel/types": "^7.14.5"
},
"engines": {
"node": ">=6.9.0"
},
"version": "7.7.0"
}
"author": "The Babel Team (https://babel.dev/team)"
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
> 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.
See our website [@babel/helper-get-function-arity](https://babeljs.io/docs/en/babel-helper-get-function-arity) for more information.
## Install
......
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