first commit

This commit is contained in:
monjack
2025-06-20 18:01:48 +08:00
commit 6daa6d65c1
24611 changed files with 2512443 additions and 0 deletions

122
app_vue/node_modules/@babel/generator/lib/node/index.js generated vendored Normal file
View File

@ -0,0 +1,122 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TokenContext = void 0;
exports.isLastChild = isLastChild;
exports.needsParens = needsParens;
exports.needsWhitespace = needsWhitespace;
exports.needsWhitespaceAfter = needsWhitespaceAfter;
exports.needsWhitespaceBefore = needsWhitespaceBefore;
var whitespace = require("./whitespace.js");
var parens = require("./parentheses.js");
var _t = require("@babel/types");
const {
FLIPPED_ALIAS_KEYS,
VISITOR_KEYS,
isCallExpression,
isDecorator,
isExpressionStatement,
isMemberExpression,
isNewExpression,
isParenthesizedExpression
} = _t;
const TokenContext = exports.TokenContext = {
normal: 0,
expressionStatement: 1,
arrowBody: 2,
exportDefault: 4,
arrowFlowReturnType: 8,
forInitHead: 16,
forInHead: 32,
forOfHead: 64,
forInOrInitHeadAccumulate: 128,
forInOrInitHeadAccumulatePassThroughMask: 128
};
function expandAliases(obj) {
const map = new Map();
function add(type, func) {
const fn = map.get(type);
map.set(type, fn ? function (node, parent, stack, getRawIdentifier) {
var _fn;
return (_fn = fn(node, parent, stack, getRawIdentifier)) != null ? _fn : func(node, parent, stack, getRawIdentifier);
} : func);
}
for (const type of Object.keys(obj)) {
const aliases = FLIPPED_ALIAS_KEYS[type];
if (aliases) {
for (const alias of aliases) {
add(alias, obj[type]);
}
} else {
add(type, obj[type]);
}
}
return map;
}
const expandedParens = expandAliases(parens);
const expandedWhitespaceNodes = expandAliases(whitespace.nodes);
function isOrHasCallExpression(node) {
if (isCallExpression(node)) {
return true;
}
return isMemberExpression(node) && isOrHasCallExpression(node.object);
}
function needsWhitespace(node, parent, type) {
var _expandedWhitespaceNo;
if (!node) return false;
if (isExpressionStatement(node)) {
node = node.expression;
}
const flag = (_expandedWhitespaceNo = expandedWhitespaceNodes.get(node.type)) == null ? void 0 : _expandedWhitespaceNo(node, parent);
if (typeof flag === "number") {
return (flag & type) !== 0;
}
return false;
}
function needsWhitespaceBefore(node, parent) {
return needsWhitespace(node, parent, 1);
}
function needsWhitespaceAfter(node, parent) {
return needsWhitespace(node, parent, 2);
}
function needsParens(node, parent, tokenContext, getRawIdentifier) {
var _expandedParens$get;
if (!parent) return false;
if (isNewExpression(parent) && parent.callee === node) {
if (isOrHasCallExpression(node)) return true;
}
if (isDecorator(parent)) {
return !isDecoratorMemberExpression(node) && !(isCallExpression(node) && isDecoratorMemberExpression(node.callee)) && !isParenthesizedExpression(node);
}
return (_expandedParens$get = expandedParens.get(node.type)) == null ? void 0 : _expandedParens$get(node, parent, tokenContext, getRawIdentifier);
}
function isDecoratorMemberExpression(node) {
switch (node.type) {
case "Identifier":
return true;
case "MemberExpression":
return !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object);
default:
return false;
}
}
function isLastChild(parent, child) {
const visitorKeys = VISITOR_KEYS[parent.type];
for (let i = visitorKeys.length - 1; i >= 0; i--) {
const val = parent[visitorKeys[i]];
if (val === child) {
return true;
} else if (Array.isArray(val)) {
let j = val.length - 1;
while (j >= 0 && val[j] === null) j--;
return j >= 0 && val[j] === child;
} else if (val) {
return false;
}
}
return false;
}
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,262 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AssignmentExpression = AssignmentExpression;
exports.Binary = Binary;
exports.BinaryExpression = BinaryExpression;
exports.ClassExpression = ClassExpression;
exports.ArrowFunctionExpression = exports.ConditionalExpression = ConditionalExpression;
exports.DoExpression = DoExpression;
exports.FunctionExpression = FunctionExpression;
exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
exports.Identifier = Identifier;
exports.LogicalExpression = LogicalExpression;
exports.NullableTypeAnnotation = NullableTypeAnnotation;
exports.ObjectExpression = ObjectExpression;
exports.OptionalIndexedAccessType = OptionalIndexedAccessType;
exports.OptionalCallExpression = exports.OptionalMemberExpression = OptionalMemberExpression;
exports.SequenceExpression = SequenceExpression;
exports.TSSatisfiesExpression = exports.TSAsExpression = TSAsExpression;
exports.TSConditionalType = TSConditionalType;
exports.TSConstructorType = exports.TSFunctionType = TSFunctionType;
exports.TSInferType = TSInferType;
exports.TSInstantiationExpression = TSInstantiationExpression;
exports.TSIntersectionType = TSIntersectionType;
exports.UnaryLike = exports.TSTypeAssertion = UnaryLike;
exports.TSTypeOperator = TSTypeOperator;
exports.TSUnionType = TSUnionType;
exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation;
exports.UpdateExpression = UpdateExpression;
exports.AwaitExpression = exports.YieldExpression = YieldExpression;
var _t = require("@babel/types");
var _index = require("./index.js");
const {
isArrayTypeAnnotation,
isBinaryExpression,
isCallExpression,
isForOfStatement,
isIndexedAccessType,
isMemberExpression,
isObjectPattern,
isOptionalMemberExpression,
isYieldExpression,
isStatement
} = _t;
const PRECEDENCE = new Map([["||", 0], ["??", 0], ["|>", 0], ["&&", 1], ["|", 2], ["^", 3], ["&", 4], ["==", 5], ["===", 5], ["!=", 5], ["!==", 5], ["<", 6], [">", 6], ["<=", 6], [">=", 6], ["in", 6], ["instanceof", 6], [">>", 7], ["<<", 7], [">>>", 7], ["+", 8], ["-", 8], ["*", 9], ["/", 9], ["%", 9], ["**", 10]]);
function getBinaryPrecedence(node, nodeType) {
if (nodeType === "BinaryExpression" || nodeType === "LogicalExpression") {
return PRECEDENCE.get(node.operator);
}
if (nodeType === "TSAsExpression" || nodeType === "TSSatisfiesExpression") {
return PRECEDENCE.get("in");
}
}
function isTSTypeExpression(nodeType) {
return nodeType === "TSAsExpression" || nodeType === "TSSatisfiesExpression" || nodeType === "TSTypeAssertion";
}
const isClassExtendsClause = (node, parent) => {
const parentType = parent.type;
return (parentType === "ClassDeclaration" || parentType === "ClassExpression") && parent.superClass === node;
};
const hasPostfixPart = (node, parent) => {
const parentType = parent.type;
return (parentType === "MemberExpression" || parentType === "OptionalMemberExpression") && parent.object === node || (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression") && parent.callee === node || parentType === "TaggedTemplateExpression" && parent.tag === node || parentType === "TSNonNullExpression";
};
function NullableTypeAnnotation(node, parent) {
return isArrayTypeAnnotation(parent);
}
function FunctionTypeAnnotation(node, parent, tokenContext) {
const parentType = parent.type;
return (parentType === "UnionTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "ArrayTypeAnnotation" || Boolean(tokenContext & _index.TokenContext.arrowFlowReturnType)
);
}
function UpdateExpression(node, parent) {
return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent);
}
function needsParenBeforeExpressionBrace(tokenContext) {
return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.arrowBody));
}
function ObjectExpression(node, parent, tokenContext) {
return needsParenBeforeExpressionBrace(tokenContext);
}
function DoExpression(node, parent, tokenContext) {
return !node.async && Boolean(tokenContext & _index.TokenContext.expressionStatement);
}
function Binary(node, parent) {
const parentType = parent.type;
if (node.type === "BinaryExpression" && node.operator === "**" && parentType === "BinaryExpression" && parent.operator === "**") {
return parent.left === node;
}
if (isClassExtendsClause(node, parent)) {
return true;
}
if (hasPostfixPart(node, parent) || parentType === "UnaryExpression" || parentType === "SpreadElement" || parentType === "AwaitExpression") {
return true;
}
const parentPos = getBinaryPrecedence(parent, parentType);
if (parentPos != null) {
const nodePos = getBinaryPrecedence(node, node.type);
if (parentPos === nodePos && parentType === "BinaryExpression" && parent.right === node || parentPos > nodePos) {
return true;
}
}
return undefined;
}
function UnionTypeAnnotation(node, parent) {
const parentType = parent.type;
return parentType === "ArrayTypeAnnotation" || parentType === "NullableTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "UnionTypeAnnotation";
}
function OptionalIndexedAccessType(node, parent) {
return isIndexedAccessType(parent) && parent.objectType === node;
}
function TSAsExpression(node, parent) {
if ((parent.type === "AssignmentExpression" || parent.type === "AssignmentPattern") && parent.left === node) {
return true;
}
if (parent.type === "BinaryExpression" && (parent.operator === "|" || parent.operator === "&") && node === parent.left) {
return true;
}
return Binary(node, parent);
}
function TSConditionalType(node, parent) {
const parentType = parent.type;
if (parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType" || parentType === "TSTypeOperator" || parentType === "TSTypeParameter") {
return true;
}
if ((parentType === "TSIntersectionType" || parentType === "TSUnionType") && parent.types[0] === node) {
return true;
}
if (parentType === "TSConditionalType" && (parent.checkType === node || parent.extendsType === node)) {
return true;
}
return false;
}
function TSUnionType(node, parent) {
const parentType = parent.type;
return parentType === "TSIntersectionType" || parentType === "TSTypeOperator" || parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType";
}
function TSIntersectionType(node, parent) {
const parentType = parent.type;
return parentType === "TSTypeOperator" || parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType";
}
function TSInferType(node, parent) {
const parentType = parent.type;
if (parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType") {
return true;
}
if (node.typeParameter.constraint) {
if ((parentType === "TSIntersectionType" || parentType === "TSUnionType") && parent.types[0] === node) {
return true;
}
}
return false;
}
function TSTypeOperator(node, parent) {
const parentType = parent.type;
return parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType";
}
function TSInstantiationExpression(node, parent) {
const parentType = parent.type;
return (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression" || parentType === "TSInstantiationExpression") && !!parent.typeParameters;
}
function TSFunctionType(node, parent) {
const parentType = parent.type;
return parentType === "TSIntersectionType" || parentType === "TSUnionType" || parentType === "TSTypeOperator" || parentType === "TSOptionalType" || parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSConditionalType" && (parent.checkType === node || parent.extendsType === node);
}
function BinaryExpression(node, parent, tokenContext) {
return node.operator === "in" && Boolean(tokenContext & _index.TokenContext.forInOrInitHeadAccumulate);
}
function SequenceExpression(node, parent) {
const parentType = parent.type;
if (parentType === "SequenceExpression" || parentType === "ParenthesizedExpression" || parentType === "MemberExpression" && parent.property === node || parentType === "OptionalMemberExpression" && parent.property === node || parentType === "TemplateLiteral") {
return false;
}
if (parentType === "ClassDeclaration") {
return true;
}
if (parentType === "ForOfStatement") {
return parent.right === node;
}
if (parentType === "ExportDefaultDeclaration") {
return true;
}
return !isStatement(parent);
}
function YieldExpression(node, parent) {
const parentType = parent.type;
return parentType === "BinaryExpression" || parentType === "LogicalExpression" || parentType === "UnaryExpression" || parentType === "SpreadElement" || hasPostfixPart(node, parent) || parentType === "AwaitExpression" && isYieldExpression(node) || parentType === "ConditionalExpression" && node === parent.test || isClassExtendsClause(node, parent) || isTSTypeExpression(parentType);
}
function ClassExpression(node, parent, tokenContext) {
return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault));
}
function UnaryLike(node, parent) {
return hasPostfixPart(node, parent) || isBinaryExpression(parent) && parent.operator === "**" && parent.left === node || isClassExtendsClause(node, parent);
}
function FunctionExpression(node, parent, tokenContext) {
return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault));
}
function ConditionalExpression(node, parent) {
const parentType = parent.type;
if (parentType === "UnaryExpression" || parentType === "SpreadElement" || parentType === "BinaryExpression" || parentType === "LogicalExpression" || parentType === "ConditionalExpression" && parent.test === node || parentType === "AwaitExpression" || isTSTypeExpression(parentType)) {
return true;
}
return UnaryLike(node, parent);
}
function OptionalMemberExpression(node, parent) {
return isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node;
}
function AssignmentExpression(node, parent, tokenContext) {
if (needsParenBeforeExpressionBrace(tokenContext) && isObjectPattern(node.left)) {
return true;
} else {
return ConditionalExpression(node, parent);
}
}
function LogicalExpression(node, parent) {
const parentType = parent.type;
if (isTSTypeExpression(parentType)) return true;
if (parentType !== "LogicalExpression") return false;
switch (node.operator) {
case "||":
return parent.operator === "??" || parent.operator === "&&";
case "&&":
return parent.operator === "??";
case "??":
return parent.operator !== "??";
}
}
function Identifier(node, parent, tokenContext, getRawIdentifier) {
var _node$extra;
const parentType = parent.type;
if ((_node$extra = node.extra) != null && _node$extra.parenthesized && parentType === "AssignmentExpression" && parent.left === node) {
const rightType = parent.right.type;
if ((rightType === "FunctionExpression" || rightType === "ClassExpression") && parent.right.id == null) {
return true;
}
}
if (getRawIdentifier && getRawIdentifier(node) !== node.name) {
return false;
}
if (node.name === "let") {
const isFollowedByBracket = isMemberExpression(parent, {
object: node,
computed: true
}) || isOptionalMemberExpression(parent, {
object: node,
computed: true,
optional: false
});
if (isFollowedByBracket && tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.forInitHead | _index.TokenContext.forInHead)) {
return true;
}
return Boolean(tokenContext & _index.TokenContext.forOfHead);
}
return node.name === "async" && isForOfStatement(parent, {
left: node,
await: false
});
}
//# sourceMappingURL=parentheses.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,145 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.nodes = void 0;
var _t = require("@babel/types");
const {
FLIPPED_ALIAS_KEYS,
isArrayExpression,
isAssignmentExpression,
isBinary,
isBlockStatement,
isCallExpression,
isFunction,
isIdentifier,
isLiteral,
isMemberExpression,
isObjectExpression,
isOptionalCallExpression,
isOptionalMemberExpression,
isStringLiteral
} = _t;
function crawlInternal(node, state) {
if (!node) return state;
if (isMemberExpression(node) || isOptionalMemberExpression(node)) {
crawlInternal(node.object, state);
if (node.computed) crawlInternal(node.property, state);
} else if (isBinary(node) || isAssignmentExpression(node)) {
crawlInternal(node.left, state);
crawlInternal(node.right, state);
} else if (isCallExpression(node) || isOptionalCallExpression(node)) {
state.hasCall = true;
crawlInternal(node.callee, state);
} else if (isFunction(node)) {
state.hasFunction = true;
} else if (isIdentifier(node)) {
state.hasHelper = state.hasHelper || node.callee && isHelper(node.callee);
}
return state;
}
function crawl(node) {
return crawlInternal(node, {
hasCall: false,
hasFunction: false,
hasHelper: false
});
}
function isHelper(node) {
if (!node) return false;
if (isMemberExpression(node)) {
return isHelper(node.object) || isHelper(node.property);
} else if (isIdentifier(node)) {
return node.name === "require" || node.name.charCodeAt(0) === 95;
} else if (isCallExpression(node)) {
return isHelper(node.callee);
} else if (isBinary(node) || isAssignmentExpression(node)) {
return isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
} else {
return false;
}
}
function isType(node) {
return isLiteral(node) || isObjectExpression(node) || isArrayExpression(node) || isIdentifier(node) || isMemberExpression(node);
}
const nodes = exports.nodes = {
AssignmentExpression(node) {
const state = crawl(node.right);
if (state.hasCall && state.hasHelper || state.hasFunction) {
return state.hasFunction ? 1 | 2 : 2;
}
},
SwitchCase(node, parent) {
return (!!node.consequent.length || parent.cases[0] === node ? 1 : 0) | (!node.consequent.length && parent.cases[parent.cases.length - 1] === node ? 2 : 0);
},
LogicalExpression(node) {
if (isFunction(node.left) || isFunction(node.right)) {
return 2;
}
},
Literal(node) {
if (isStringLiteral(node) && node.value === "use strict") {
return 2;
}
},
CallExpression(node) {
if (isFunction(node.callee) || isHelper(node)) {
return 1 | 2;
}
},
OptionalCallExpression(node) {
if (isFunction(node.callee)) {
return 1 | 2;
}
},
VariableDeclaration(node) {
for (let i = 0; i < node.declarations.length; i++) {
const declar = node.declarations[i];
let enabled = isHelper(declar.id) && !isType(declar.init);
if (!enabled && declar.init) {
const state = crawl(declar.init);
enabled = isHelper(declar.init) && state.hasCall || state.hasFunction;
}
if (enabled) {
return 1 | 2;
}
}
},
IfStatement(node) {
if (isBlockStatement(node.consequent)) {
return 1 | 2;
}
}
};
nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function (node, parent) {
if (parent.properties[0] === node) {
return 1;
}
};
nodes.ObjectTypeCallProperty = function (node, parent) {
var _parent$properties;
if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) != null && _parent$properties.length)) {
return 1;
}
};
nodes.ObjectTypeIndexer = function (node, parent) {
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 1;
}
};
nodes.ObjectTypeInternalSlot = function (node, parent) {
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 1;
}
};
[["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function ([type, amounts]) {
[type].concat(FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
const ret = amounts ? 1 | 2 : 0;
nodes[type] = () => ret;
});
});
//# sourceMappingURL=whitespace.js.map

File diff suppressed because one or more lines are too long