Add <%br= %> jqhtml syntax docs, class override detection, npm update

Document event handler placement and model fetch clarification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-01-15 10:16:06 +00:00
parent 61f8f058f2
commit 1594502cb2
791 changed files with 7044 additions and 6089 deletions

View File

@@ -29,7 +29,6 @@ function getCachedPaths(path) {
return pathsCache.get(parent);
}
function getOrCreateCachedPaths(node, parentPath) {
;
let paths = pathsCache.get(node);
if (!paths) pathsCache.set(node, paths = new Map());
return paths;

View File

@@ -1 +1 @@
{"version":3,"names":["pathsCache","exports","path","WeakMap","scope","clear","clearPath","clearScope","getCachedPaths","parent","parentPath","get","getOrCreateCachedPaths","node","paths","set","Map"],"sources":["../src/cache.ts"],"sourcesContent":["import type { Node } from \"@babel/types\";\nimport type NodePath from \"./path/index.ts\";\nimport type Scope from \"./scope/index.ts\";\n\nlet pathsCache: WeakMap<Node, Map<Node, NodePath>> = new WeakMap();\nexport { pathsCache as path };\nexport let scope: WeakMap<Node, Scope> = new WeakMap();\n\nexport function clear() {\n clearPath();\n clearScope();\n}\n\nexport function clearPath() {\n pathsCache = new WeakMap();\n}\n\nexport function clearScope() {\n scope = new WeakMap();\n}\n\nexport function getCachedPaths(path: NodePath) {\n const { parent, parentPath } = path;\n return process.env.BABEL_8_BREAKING && parentPath\n ? parentPath._store\n : pathsCache.get(parent);\n}\n\nexport function getOrCreateCachedPaths(\n node: Node,\n parentPath?: NodePath | null,\n) {\n if (process.env.BABEL_8_BREAKING && parentPath) {\n return (parentPath._store ||= new Map());\n }\n\n let paths = pathsCache.get(node);\n if (!paths) pathsCache.set(node, (paths = new Map()));\n\n return paths;\n}\n"],"mappings":";;;;;;;;;;;AAIA,IAAIA,UAA8C,GAAAC,OAAA,CAAAC,IAAA,GAAG,IAAIC,OAAO,CAAC,CAAC;AAE3D,IAAIC,KAA2B,GAAAH,OAAA,CAAAG,KAAA,GAAG,IAAID,OAAO,CAAC,CAAC;AAE/C,SAASE,KAAKA,CAAA,EAAG;EACtBC,SAAS,CAAC,CAAC;EACXC,UAAU,CAAC,CAAC;AACd;AAEO,SAASD,SAASA,CAAA,EAAG;EAC1BL,OAAA,CAAAC,IAAA,GAAAF,UAAU,GAAG,IAAIG,OAAO,CAAC,CAAC;AAC5B;AAEO,SAASI,UAAUA,CAAA,EAAG;EAC3BN,OAAA,CAAAG,KAAA,GAAAA,KAAK,GAAG,IAAID,OAAO,CAAC,CAAC;AACvB;AAEO,SAASK,cAAcA,CAACN,IAAc,EAAE;EAC7C,MAAM;IAAEO,MAAM;IAAEC;EAAW,CAAC,GAAGR,IAAI;EACnC,OAEIF,UAAU,CAACW,GAAG,CAACF,MAAM,CAAC;AAC5B;AAEO,SAASG,sBAAsBA,CACpCC,IAAU,EACVH,UAA4B,EAC5B;EAAA;EAKA,IAAII,KAAK,GAAGd,UAAU,CAACW,GAAG,CAACE,IAAI,CAAC;EAChC,IAAI,CAACC,KAAK,EAAEd,UAAU,CAACe,GAAG,CAACF,IAAI,EAAGC,KAAK,GAAG,IAAIE,GAAG,CAAC,CAAE,CAAC;EAErD,OAAOF,KAAK;AACd","ignoreList":[]}
{"version":3,"names":["pathsCache","exports","path","WeakMap","scope","clear","clearPath","clearScope","getCachedPaths","parent","parentPath","get","getOrCreateCachedPaths","node","paths","set","Map"],"sources":["../src/cache.ts"],"sourcesContent":["import type { Node } from \"@babel/types\";\nimport type NodePath from \"./path/index.ts\";\nimport type Scope from \"./scope/index.ts\";\n\nlet pathsCache = new WeakMap<Node, Map<Node, NodePath>>();\nexport { pathsCache as path };\nexport let scope = new WeakMap<Node, Scope>();\n\nexport function clear() {\n clearPath();\n clearScope();\n}\n\nexport function clearPath() {\n pathsCache = new WeakMap();\n}\n\nexport function clearScope() {\n scope = new WeakMap();\n}\n\nexport function getCachedPaths(path: NodePath) {\n const { parent, parentPath } = path;\n return process.env.BABEL_8_BREAKING && parentPath\n ? parentPath._store\n : pathsCache.get(parent);\n}\n\nexport function getOrCreateCachedPaths(\n node: Node,\n parentPath?: NodePath | null,\n) {\n if (process.env.BABEL_8_BREAKING && parentPath) {\n return (parentPath._store ||= new Map());\n }\n\n let paths = pathsCache.get(node);\n if (!paths) pathsCache.set(node, (paths = new Map()));\n\n return paths;\n}\n"],"mappings":";;;;;;;;;;;AAIA,IAAIA,UAAU,GAAAC,OAAA,CAAAC,IAAA,GAAG,IAAIC,OAAO,CAA4B,CAAC;AAElD,IAAIC,KAAK,GAAAH,OAAA,CAAAG,KAAA,GAAG,IAAID,OAAO,CAAc,CAAC;AAEtC,SAASE,KAAKA,CAAA,EAAG;EACtBC,SAAS,CAAC,CAAC;EACXC,UAAU,CAAC,CAAC;AACd;AAEO,SAASD,SAASA,CAAA,EAAG;EAC1BL,OAAA,CAAAC,IAAA,GAAAF,UAAU,GAAG,IAAIG,OAAO,CAAC,CAAC;AAC5B;AAEO,SAASI,UAAUA,CAAA,EAAG;EAC3BN,OAAA,CAAAG,KAAA,GAAAA,KAAK,GAAG,IAAID,OAAO,CAAC,CAAC;AACvB;AAEO,SAASK,cAAcA,CAACN,IAAc,EAAE;EAC7C,MAAM;IAAEO,MAAM;IAAEC;EAAW,CAAC,GAAGR,IAAI;EACnC,OAEIF,UAAU,CAACW,GAAG,CAACF,MAAM,CAAC;AAC5B;AAEO,SAASG,sBAAsBA,CACpCC,IAAU,EACVH,UAA4B,EAC5B;EAKA,IAAII,KAAK,GAAGd,UAAU,CAACW,GAAG,CAACE,IAAI,CAAC;EAChC,IAAI,CAACC,KAAK,EAAEd,UAAU,CAACe,GAAG,CAACF,IAAI,EAAGC,KAAK,GAAG,IAAIE,GAAG,CAAC,CAAE,CAAC;EAErD,OAAOF,KAAK;AACd","ignoreList":[]}

View File

@@ -78,7 +78,6 @@ class TraversalContext {
const path = queue[visitIndex];
visitIndex++;
_context.resync.call(path);
;
if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) {
_context.pushContext.call(path, this);
}
@@ -100,7 +99,6 @@ class TraversalContext {
}
}
for (let i = 0; i < visitIndex; i++) {
;
_context.popContext.call(queue[i]);
}
this.queue = null;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports._call = _call;
exports._forceSetScope = _forceSetScope;
exports._getQueueContexts = _getQueueContexts;
exports._resyncKey = _resyncKey;
exports._resyncList = _resyncList;
@@ -63,9 +64,7 @@ function isDenylisted() {
const denylist = (_this$opts$denylist = this.opts.denylist) != null ? _this$opts$denylist : this.opts.blacklist;
return denylist == null ? void 0 : denylist.includes(this.node.type);
}
{
exports.isBlacklisted = isDenylisted;
}
exports.isBlacklisted = isDenylisted;
function restoreContext(path, context) {
if (path.context !== context) {
path.context = context;
@@ -108,8 +107,22 @@ function skipKey(key) {
function stop() {
this._traverseFlags |= _index.SHOULD_SKIP | _index.SHOULD_STOP;
}
function _forceSetScope() {
var _this$scope;
let path = this.parentPath;
if ((this.key === "key" || this.listKey === "decorators") && path.isMethod() || this.key === "discriminant" && path.isSwitchStatement()) {
path = path.parentPath;
}
let target;
while (path && !target) {
target = path.scope;
path = path.parentPath;
}
this.scope = this.getScope(target);
(_this$scope = this.scope) == null || _this$scope.init();
}
function setScope() {
var _this$opts2, _this$scope;
var _this$opts2, _this$scope2;
if ((_this$opts2 = this.opts) != null && _this$opts2.noScope) return;
let path = this.parentPath;
if ((this.key === "key" || this.listKey === "decorators") && path.isMethod() || this.key === "discriminant" && path.isSwitchStatement()) {
@@ -123,7 +136,7 @@ function setScope() {
path = path.parentPath;
}
this.scope = this.getScope(target);
(_this$scope = this.scope) == null || _this$scope.init();
(_this$scope2 = this.scope) == null || _this$scope2.init();
}
function setContext(context) {
if (this.skipKeys != null) {
@@ -208,7 +221,6 @@ function setKey(key) {
}
function requeue(pathToQueue = this) {
if (pathToQueue.removed) return;
;
const contexts = this.contexts;
for (const context of contexts) {
context.maybeQueue(pathToQueue);

File diff suppressed because one or more lines are too long

View File

@@ -100,12 +100,10 @@ function ensureBlock() {
_context.setup.call(body, parentPath, listKey ? parentPath.node[listKey] : parentPath.node, listKey, key);
return this.node;
}
{
exports.arrowFunctionToShadowed = function () {
if (!this.isArrowFunctionExpression()) return;
this.arrowFunctionToExpression();
};
}
exports.arrowFunctionToShadowed = function () {
if (!this.isArrowFunctionExpression()) return;
this.arrowFunctionToExpression();
};
function unwrapFunctionEnvironment() {
if (!this.isArrowFunctionExpression() && !this.isFunctionExpression() && !this.isFunctionDeclaration()) {
throw this.buildCodeFrameError("Can only unwrap the environment of a function.");
@@ -572,17 +570,13 @@ function ensureFunctionName(supportUnicodeId) {
}
if (!state.needsRename) {
this.node.id = id;
{
scope.getProgramParent().references[id.name] = true;
}
scope.getProgramParent().references[id.name] = true;
return this;
}
if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
scope.rename(id.name);
this.node.id = id;
{
scope.getProgramParent().references[id.name] = true;
}
scope.getProgramParent().references[id.name] = true;
return this;
}
if (!isFunction(this.node)) return null;

File diff suppressed because one or more lines are too long

View File

@@ -150,14 +150,19 @@ function _evaluate(path, state) {
deopt(binding.path, state);
return;
}
const resolved = path.resolve();
if (resolved === path) {
if (!binding) {
deopt(path, state);
return;
}
const value = evaluateCached(resolved, state);
const bindingPath = binding.path;
if (!bindingPath.isVariableDeclarator()) {
deopt(bindingPath, state);
return;
}
const initPath = bindingPath.get("init");
const value = evaluateCached(initPath, state);
if (typeof value === "object" && value !== null && binding.references > 1) {
deopt(resolved, state);
deopt(initPath, state);
return;
}
return value;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -226,51 +226,47 @@ const methods = {
addComments: NodePath_comments.addComments
};
Object.assign(NodePath_Final.prototype, methods);
{
NodePath_Final.prototype.arrowFunctionToShadowed = NodePath_conversion[String("arrowFunctionToShadowed")];
Object.assign(NodePath_Final.prototype, {
has: NodePath_introspection[String("has")],
is: NodePath_introspection[String("is")],
isnt: NodePath_introspection[String("isnt")],
equals: NodePath_introspection[String("equals")],
hoist: NodePath_modification[String("hoist")],
updateSiblingKeys: NodePath_modification.updateSiblingKeys,
call: NodePath_context.call,
isBlacklisted: NodePath_context[String("isBlacklisted")],
setScope: NodePath_context.setScope,
resync: NodePath_context.resync,
popContext: NodePath_context.popContext,
pushContext: NodePath_context.pushContext,
setup: NodePath_context.setup,
setKey: NodePath_context.setKey
});
}
{
NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo;
NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo;
Object.assign(NodePath_Final.prototype, {
_getTypeAnnotation: NodePath_inference._getTypeAnnotation,
_replaceWith: NodePath_replacement._replaceWith,
_resolve: NodePath_introspection._resolve,
_call: NodePath_context._call,
_resyncParent: NodePath_context._resyncParent,
_resyncKey: NodePath_context._resyncKey,
_resyncList: NodePath_context._resyncList,
_resyncRemoved: NodePath_context._resyncRemoved,
_getQueueContexts: NodePath_context._getQueueContexts,
_removeFromScope: NodePath_removal._removeFromScope,
_callRemovalHooks: NodePath_removal._callRemovalHooks,
_remove: NodePath_removal._remove,
_markRemoved: NodePath_removal._markRemoved,
_assertUnremoved: NodePath_removal._assertUnremoved,
_containerInsert: NodePath_modification._containerInsert,
_containerInsertBefore: NodePath_modification._containerInsertBefore,
_containerInsertAfter: NodePath_modification._containerInsertAfter,
_verifyNodeList: NodePath_modification._verifyNodeList,
_getKey: NodePath_family._getKey,
_getPattern: NodePath_family._getPattern
});
}
NodePath_Final.prototype.arrowFunctionToShadowed = NodePath_conversion[String("arrowFunctionToShadowed")];
Object.assign(NodePath_Final.prototype, {
has: NodePath_introspection[String("has")],
is: NodePath_introspection[String("is")],
isnt: NodePath_introspection[String("isnt")],
equals: NodePath_introspection[String("equals")],
hoist: NodePath_modification[String("hoist")],
updateSiblingKeys: NodePath_modification.updateSiblingKeys,
call: NodePath_context.call,
isBlacklisted: NodePath_context[String("isBlacklisted")],
setScope: NodePath_context.setScope,
resync: NodePath_context.resync,
popContext: NodePath_context.popContext,
pushContext: NodePath_context.pushContext,
setup: NodePath_context.setup,
setKey: NodePath_context.setKey
});
NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo;
NodePath_Final.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo;
Object.assign(NodePath_Final.prototype, {
_getTypeAnnotation: NodePath_inference._getTypeAnnotation,
_replaceWith: NodePath_replacement._replaceWith,
_resolve: NodePath_introspection._resolve,
_call: NodePath_context._call,
_resyncParent: NodePath_context._resyncParent,
_resyncKey: NodePath_context._resyncKey,
_resyncList: NodePath_context._resyncList,
_resyncRemoved: NodePath_context._resyncRemoved,
_getQueueContexts: NodePath_context._getQueueContexts,
_removeFromScope: NodePath_removal._removeFromScope,
_callRemovalHooks: NodePath_removal._callRemovalHooks,
_remove: NodePath_removal._remove,
_markRemoved: NodePath_removal._markRemoved,
_assertUnremoved: NodePath_removal._assertUnremoved,
_containerInsert: NodePath_modification._containerInsert,
_containerInsertBefore: NodePath_modification._containerInsertBefore,
_containerInsertAfter: NodePath_modification._containerInsertAfter,
_verifyNodeList: NodePath_modification._verifyNodeList,
_getKey: NodePath_family._getKey,
_getPattern: NodePath_family._getPattern
});
for (const type of t.TYPES) {
const typeKey = `is${type}`;
const fn = t[typeKey];
@@ -285,7 +281,7 @@ for (const type of t.TYPES) {
}
Object.assign(NodePath_Final.prototype, NodePath_virtual_types_validator);
for (const type of Object.keys(virtualTypes)) {
if (type[0] === "_") continue;
if (type.startsWith("_")) continue;
if (!t.TYPES.includes(type)) t.TYPES.push(type);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -13,16 +13,14 @@ const {
isTSType
} = _t;
function createUnionType(types) {
{
if (types.every(v => isFlowType(v))) {
if (createFlowUnionType) {
return createFlowUnionType(types);
}
return createUnionTypeAnnotation(types);
} else if (types.every(v => isTSType(v))) {
if (createTSUnionType) {
return createTSUnionType(types);
}
if (types.every(v => isFlowType(v))) {
if (createFlowUnionType) {
return createFlowUnionType(types);
}
return createUnionTypeAnnotation(types);
} else if (types.every(v => isTSType(v))) {
if (createTSUnionType) {
return createTSUnionType(types);
}
}
}

View File

@@ -1 +1 @@
{"version":3,"names":["_t","require","createFlowUnionType","createTSUnionType","createUnionTypeAnnotation","isFlowType","isTSType","createUnionType","types","every","v"],"sources":["../../../src/path/inference/util.ts"],"sourcesContent":["import {\n createFlowUnionType,\n createTSUnionType,\n createUnionTypeAnnotation,\n isFlowType,\n isTSType,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nexport function createUnionType(\n types: (t.FlowType | t.TSType)[],\n): t.FlowType | t.TSType | undefined {\n if (process.env.BABEL_8_BREAKING) {\n if (types.every(v => isFlowType(v))) {\n return createFlowUnionType(types);\n }\n if (types.every(v => isTSType(v))) {\n return createTSUnionType(types);\n }\n } else {\n if (types.every(v => isFlowType(v))) {\n if (createFlowUnionType) {\n return createFlowUnionType(types);\n }\n\n return createUnionTypeAnnotation(types);\n } else if (types.every(v => isTSType(v))) {\n if (createTSUnionType) {\n return createTSUnionType(types);\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAMsB;EALpBC,mBAAmB;EACnBC,iBAAiB;EACjBC,yBAAyB;EACzBC,UAAU;EACVC;AAAQ,IAAAN,EAAA;AAIH,SAASO,eAAeA,CAC7BC,KAAgC,EACG;EAQ5B;IACL,IAAIA,KAAK,CAACC,KAAK,CAACC,CAAC,IAAIL,UAAU,CAACK,CAAC,CAAC,CAAC,EAAE;MACnC,IAAIR,mBAAmB,EAAE;QACvB,OAAOA,mBAAmB,CAACM,KAAK,CAAC;MACnC;MAEA,OAAOJ,yBAAyB,CAACI,KAAK,CAAC;IACzC,CAAC,MAAM,IAAIA,KAAK,CAACC,KAAK,CAACC,CAAC,IAAIJ,QAAQ,CAACI,CAAC,CAAC,CAAC,EAAE;MACxC,IAAIP,iBAAiB,EAAE;QACrB,OAAOA,iBAAiB,CAACK,KAAK,CAAC;MACjC;IACF;EACF;AACF","ignoreList":[]}
{"version":3,"names":["_t","require","createFlowUnionType","createTSUnionType","createUnionTypeAnnotation","isFlowType","isTSType","createUnionType","types","every","v"],"sources":["../../../src/path/inference/util.ts"],"sourcesContent":["import {\n createFlowUnionType,\n createTSUnionType,\n createUnionTypeAnnotation,\n isFlowType,\n isTSType,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nexport function createUnionType(\n types: (t.FlowType | t.TSType)[],\n): t.FlowType | t.TSType | undefined {\n if (process.env.BABEL_8_BREAKING) {\n if (types.every(v => isFlowType(v))) {\n return createFlowUnionType(types);\n }\n if (types.every(v => isTSType(v))) {\n return createTSUnionType(types);\n }\n } else {\n if (types.every(v => isFlowType(v))) {\n if (createFlowUnionType) {\n return createFlowUnionType(types);\n }\n\n return createUnionTypeAnnotation(types);\n } else if (types.every(v => isTSType(v))) {\n if (createTSUnionType) {\n return createTSUnionType(types);\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAMsB;EALpBC,mBAAmB;EACnBC,iBAAiB;EACjBC,yBAAyB;EACzBC,UAAU;EACVC;AAAQ,IAAAN,EAAA;AAIH,SAASO,eAAeA,CAC7BC,KAAgC,EACG;EASjC,IAAIA,KAAK,CAACC,KAAK,CAACC,CAAC,IAAIL,UAAU,CAACK,CAAC,CAAC,CAAC,EAAE;IACnC,IAAIR,mBAAmB,EAAE;MACvB,OAAOA,mBAAmB,CAACM,KAAK,CAAC;IACnC;IAEA,OAAOJ,yBAAyB,CAACI,KAAK,CAAC;EACzC,CAAC,MAAM,IAAIA,KAAK,CAACC,KAAK,CAACC,CAAC,IAAIJ,QAAQ,CAACI,CAAC,CAAC,CAAC,EAAE;IACxC,IAAIP,iBAAiB,EAAE;MACrB,OAAOA,iBAAiB,CAACK,KAAK,CAAC;IACjC;EACF;AAEJ","ignoreList":[]}

View File

@@ -33,29 +33,25 @@ const {
function matchesPattern(pattern, allowPartial) {
return _matchesPattern(this.node, pattern, allowPartial);
}
{
exports.has = function has(key) {
var _this$node;
const val = (_this$node = this.node) == null ? void 0 : _this$node[key];
if (val && Array.isArray(val)) {
return !!val.length;
} else {
return !!val;
}
};
}
exports.has = function has(key) {
var _this$node;
const val = (_this$node = this.node) == null ? void 0 : _this$node[key];
if (val && Array.isArray(val)) {
return !!val.length;
} else {
return !!val;
}
};
function isStatic() {
return this.scope.isStatic(this.node);
}
{
exports.is = exports.has;
exports.isnt = function isnt(key) {
return !this.has(key);
};
exports.equals = function equals(key, value) {
return this.node[key] === value;
};
}
exports.is = exports.has;
exports.isnt = function isnt(key) {
return !this.has(key);
};
exports.equals = function equals(key, value) {
return this.node[key] === value;
};
function isNodeType(type) {
return isType(this.type, type);
}
@@ -109,7 +105,7 @@ function referencesImport(moduleSource, importName) {
return false;
}
const binding = this.scope.getBinding(this.node.name);
if (!binding || binding.kind !== "module") return false;
if ((binding == null ? void 0 : binding.kind) !== "module") return false;
const path = binding.path;
const parent = path.parentPath;
if (!parent.isImportDeclaration()) return false;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -152,13 +152,11 @@ function isForAwaitStatement() {
await: true
});
}
{
exports.isExistentialTypeParam = function isExistentialTypeParam() {
throw new Error("`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7.");
};
exports.isNumericLiteralTypeAnnotation = function isNumericLiteralTypeAnnotation() {
throw new Error("`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7.");
};
}
exports.isExistentialTypeParam = function isExistentialTypeParam() {
throw new Error("`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7.");
};
exports.isNumericLiteralTypeAnnotation = function isNumericLiteralTypeAnnotation() {
throw new Error("`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7.");
};
//# sourceMappingURL=virtual-types-validator.js.map

File diff suppressed because one or more lines are too long

View File

@@ -221,11 +221,9 @@ function pushContainer(listKey, nodes) {
}).setContext(this.context);
return path.replaceWithMultiple(verifiedNodes);
}
{
exports.hoist = function hoist(scope = this.scope) {
const hoister = new _hoister.default(this, scope);
return hoister.run();
};
}
exports.hoist = function hoist(scope = this.scope) {
const hoister = new _hoister.default(this, scope);
return hoister.run();
};
//# sourceMappingURL=modification.js.map

File diff suppressed because one or more lines are too long

View File

@@ -184,8 +184,8 @@ function replaceExpressionWithStatements(nodes) {
}
callee.arrowFunctionToExpression();
const newCallee = callee;
const needToAwaitFunction = isParentAsync && _index.default.hasType(this.get("callee.body").node, "AwaitExpression", FUNCTION_TYPES);
const needToYieldFunction = isParentGenerator && _index.default.hasType(this.get("callee.body").node, "YieldExpression", FUNCTION_TYPES);
const needToAwaitFunction = isParentAsync && _index.default.hasType(newCallee.node.body, "AwaitExpression", FUNCTION_TYPES);
const needToYieldFunction = isParentGenerator && _index.default.hasType(newCallee.node.body, "YieldExpression", FUNCTION_TYPES);
if (needToAwaitFunction) {
newCallee.set("async", true);
if (!needToYieldFunction) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -53,8 +53,6 @@ const {
toIdentifier,
variableDeclaration,
variableDeclarator,
isRecordExpression,
isTupleExpression,
isObjectProperty,
isTopicReference,
isMetaProperty,
@@ -180,19 +178,15 @@ function gatherNodeParts(node, parts) {
}
}
function resetScope(scope) {
{
scope.references = Object.create(null);
scope.uids = Object.create(null);
}
scope.references = Object.create(null);
scope.uids = Object.create(null);
scope.bindings = Object.create(null);
scope.globals = Object.create(null);
}
function isAnonymousFunctionExpression(path) {
return path.isFunctionExpression() && !path.node.id || path.isArrowFunctionExpression();
}
{
var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
}
var NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
const collectorVisitor = {
ForStatement(path) {
const declar = path.get("init");
@@ -335,22 +329,20 @@ class Scope {
this.path = path;
this.labels = new Map();
this.inited = false;
{
Object.defineProperties(this, {
references: {
enumerable: true,
configurable: true,
writable: true,
value: Object.create(null)
},
uids: {
enumerable: true,
configurable: true,
writable: true,
value: Object.create(null)
}
});
}
Object.defineProperties(this, {
references: {
enumerable: true,
configurable: true,
writable: true,
value: Object.create(null)
},
uids: {
enumerable: true,
configurable: true,
writable: true,
value: Object.create(null)
}
});
}
get parent() {
var _parent;
@@ -391,10 +383,8 @@ class Scope {
i++;
} while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid));
const program = this.getProgramParent();
{
program.references[uid] = true;
program.uids[uid] = true;
}
program.references[uid] = true;
program.uids[uid] = true;
return uid;
}
generateUidBasedOnNode(node, defaultName) {
@@ -448,9 +438,7 @@ class Scope {
if (binding) {
newName || (newName = this.generateUidIdentifier(oldName).name);
const renamer = new _renamer.default(binding, oldName, newName);
{
renamer.rename(arguments[2]);
}
renamer.rename(arguments[2]);
}
}
dump() {
@@ -534,9 +522,7 @@ class Scope {
const parent = this.getProgramParent();
const ids = path.getOuterBindingIdentifiers(true);
for (const name of Object.keys(ids)) {
{
parent.references[name] = true;
}
parent.references[name] = true;
for (const id of ids[name]) {
const local = this.getOwnBinding(name);
if (local) {
@@ -560,13 +546,11 @@ class Scope {
this.globals[node.name] = node;
}
hasUid(name) {
{
let scope = this;
do {
if (scope.uids[name]) return true;
} while (scope = scope.parent);
return false;
}
let scope = this;
do {
if (scope.uids[name]) return true;
} while (scope = scope.parent);
return false;
}
hasGlobal(name) {
let scope = this;
@@ -576,9 +560,7 @@ class Scope {
return false;
}
hasReference(name) {
{
return !!this.getProgramParent().references[name];
}
return !!this.getProgramParent().references[name];
}
isPure(node, constantsOnly) {
if (isIdentifier(node)) {
@@ -604,12 +586,12 @@ class Scope {
return true;
} else if (isBinary(node)) {
return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
} else if (isArrayExpression(node) || isTupleExpression(node)) {
} else if (isArrayExpression(node) || (node == null ? void 0 : node.type) === "TupleExpression") {
for (const elem of node.elements) {
if (elem !== null && !this.isPure(elem, constantsOnly)) return false;
}
return true;
} else if (isObjectExpression(node) || isRecordExpression(node)) {
} else if (isObjectExpression(node) || (node == null ? void 0 : node.type) === "RecordExpression") {
for (const prop of node.properties) {
if (!this.isPure(prop, constantsOnly)) return false;
}
@@ -681,7 +663,6 @@ class Scope {
}
crawl() {
const path = this.path;
;
resetScope(this);
this.data = Object.create(null);
let scope = this;
@@ -711,9 +692,7 @@ class Scope {
}
}
}
{
path.traverse(scopeVisitor, state);
}
path.traverse(scopeVisitor, state);
this.crawling = false;
for (const path of state.assignments) {
const ids = path.getAssignmentIdentifiers();
@@ -901,14 +880,12 @@ class Scope {
removeBinding(name) {
var _this$getBinding3;
(_this$getBinding3 = this.getBinding(name)) == null || _this$getBinding3.scope.removeOwnBinding(name);
{
let scope = this;
do {
if (scope.uids[name]) {
scope.uids[name] = false;
}
} while (scope = scope.parent);
}
let scope = this;
do {
if (scope.uids[name]) {
scope.uids[name] = false;
}
} while (scope = scope.parent);
}
hoistVariables(emit = id => this.push({
id
@@ -962,82 +939,80 @@ class Scope {
exports.default = Scope;
Scope.globals = [...globalsBuiltinLower, ...globalsBuiltinUpper];
Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];
{
Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) {
if (map[oldName]) {
map[newName] = value;
map[oldName] = null;
}
};
Scope.prototype.traverse = function (node, opts, state) {
(0, _index.default)(node, opts, this, state, this.path);
};
Scope.prototype._generateUid = function _generateUid(name, i) {
let id = name;
if (i > 1) id += i;
return `_${id}`;
};
Scope.prototype.toArray = function toArray(node, i, arrayLikeIsIterable) {
if (isIdentifier(node)) {
const binding = this.getBinding(node.name);
if (binding != null && binding.constant && binding.path.isGenericType("Array")) {
return node;
}
}
if (isArrayExpression(node)) {
Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) {
if (map[oldName]) {
map[newName] = value;
map[oldName] = null;
}
};
Scope.prototype.traverse = function (node, opts, state) {
(0, _index.default)(node, opts, this, state, this.path);
};
Scope.prototype._generateUid = function _generateUid(name, i) {
let id = name;
if (i > 1) id += i;
return `_${id}`;
};
Scope.prototype.toArray = function toArray(node, i, arrayLikeIsIterable) {
if (isIdentifier(node)) {
const binding = this.getBinding(node.name);
if (binding != null && binding.constant && binding.path.isGenericType("Array")) {
return node;
}
if (isIdentifier(node, {
name: "arguments"
})) {
return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]);
}
let helperName;
const args = [node];
if (i === true) {
helperName = "toConsumableArray";
} else if (typeof i === "number") {
args.push(numericLiteral(i));
helperName = "slicedToArray";
} else {
helperName = "toArray";
}
if (arrayLikeIsIterable) {
args.unshift(this.path.hub.addHelper(helperName));
helperName = "maybeArrayLike";
}
return callExpression(this.path.hub.addHelper(helperName), args);
};
Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(...kinds) {
const ids = Object.create(null);
for (const kind of kinds) {
let scope = this;
do {
for (const name of Object.keys(scope.bindings)) {
const binding = scope.bindings[name];
if (binding.kind === kind) ids[name] = binding;
}
scope = scope.parent;
} while (scope);
}
return ids;
};
Object.defineProperties(Scope.prototype, {
parentBlock: {
configurable: true,
enumerable: true,
get() {
return this.path.parent;
}
},
hub: {
configurable: true,
enumerable: true,
get() {
return this.path.hub;
}
if (isArrayExpression(node)) {
return node;
}
if (isIdentifier(node, {
name: "arguments"
})) {
return callExpression(memberExpression(memberExpression(memberExpression(identifier("Array"), identifier("prototype")), identifier("slice")), identifier("call")), [node]);
}
let helperName;
const args = [node];
if (i === true) {
helperName = "toConsumableArray";
} else if (typeof i === "number") {
args.push(numericLiteral(i));
helperName = "slicedToArray";
} else {
helperName = "toArray";
}
if (arrayLikeIsIterable) {
args.unshift(this.path.hub.addHelper(helperName));
helperName = "maybeArrayLike";
}
return callExpression(this.path.hub.addHelper(helperName), args);
};
Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind(...kinds) {
const ids = Object.create(null);
for (const kind of kinds) {
let scope = this;
do {
for (const name of Object.keys(scope.bindings)) {
const binding = scope.bindings[name];
if (binding.kind === kind) ids[name] = binding;
}
scope = scope.parent;
} while (scope);
}
return ids;
};
Object.defineProperties(Scope.prototype, {
parentBlock: {
configurable: true,
enumerable: true,
get() {
return this.path.parent;
}
});
}
},
hub: {
configurable: true,
enumerable: true,
get() {
return this.path.hub;
}
}
});
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -40,11 +40,9 @@ const renameVisitor = {
name
} = node.key;
if (node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier) {
var _node$extra;
node.shorthand = false;
{
var _node$extra;
if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false;
}
if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false;
}
},
"AssignmentExpression|Declaration|VariableDeclarator"(path, state) {

File diff suppressed because one or more lines are too long

View File

@@ -29,18 +29,11 @@ function traverseForScope(path, visitors, state) {
listKey,
key
});
_context.setScope.call(path);
_context._forceSetScope.call(path);
const visitor = exploded[node.type];
if (visitor) {
if (visitor.enter) {
for (const visit of visitor.enter) {
visit.call(state, path, state);
}
}
if (visitor.exit) {
for (const visit of visitor.exit) {
visit.call(state, path, state);
}
if (visitor != null && visitor.enter) {
for (const visit of visitor.enter) {
visit.call(state, path, state);
}
}
if (path.shouldSkip) {
@@ -62,6 +55,11 @@ function traverseForScope(path, visitors, state) {
_traverse(path, node, prop, node, key, null);
}
}
if (visitor != null && visitor.exit) {
for (const visit of visitor.exit) {
visit.call(state, path, state);
}
}
}
}

View File

@@ -1 +1 @@
{"version":3,"names":["_t","require","_index","_visitors","_context","VISITOR_KEYS","traverseForScope","path","visitors","state","exploded","explode","enter","exit","Error","_traverse","parentPath","parent","node","container","key","listKey","hub","inPath","NodePath","get","setScope","call","visitor","type","visit","shouldSkip","keys","length","prop","Array","isArray","i","value"],"sources":["../../src/scope/traverseForScope.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { HubInterface, Visitor } from \"../index.ts\";\nimport { NodePath } from \"../index.ts\";\nimport { explode } from \"../visitors.ts\";\nimport { setScope } from \"../path/context.ts\";\n\nexport default function traverseForScope(\n path: NodePath,\n visitors: Visitor,\n state: any,\n) {\n const exploded = explode(visitors);\n\n if (exploded.enter || exploded.exit) {\n throw new Error(\"Should not be used with enter/exit visitors.\");\n }\n\n _traverse(\n path.parentPath,\n path.parent,\n path.node,\n path.container!,\n path.key!,\n path.listKey,\n path.hub,\n path,\n );\n\n function _traverse(\n parentPath: NodePath,\n parent: t.Node,\n node: t.Node,\n container: t.Node | t.Node[],\n key: string | number,\n listKey: string | null | undefined,\n hub?: HubInterface,\n inPath?: NodePath,\n ) {\n if (!node) {\n return;\n }\n\n const path =\n inPath ||\n NodePath.get({\n hub,\n parentPath,\n parent,\n container,\n listKey,\n key,\n });\n\n setScope.call(path);\n\n const visitor = exploded[node.type];\n if (visitor) {\n if (visitor.enter) {\n for (const visit of visitor.enter) {\n visit.call(state, path, state);\n }\n }\n if (visitor.exit) {\n for (const visit of visitor.exit) {\n visit.call(state, path, state);\n }\n }\n }\n if (path.shouldSkip) {\n return;\n }\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys?.length) {\n return;\n }\n\n for (const key of keys) {\n // @ts-expect-error key must present in node\n const prop = node[key];\n if (!prop) continue;\n if (Array.isArray(prop)) {\n for (let i = 0; i < prop.length; i++) {\n const value = prop[i];\n _traverse(path, node, value, prop, i, key);\n }\n } else {\n _traverse(path, node, prop, node, key, null);\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAA8C;EALrCI;AAAY,IAAAL,EAAA;AAON,SAASM,gBAAgBA,CACtCC,IAAc,EACdC,QAAiB,EACjBC,KAAU,EACV;EACA,MAAMC,QAAQ,GAAG,IAAAC,iBAAO,EAACH,QAAQ,CAAC;EAElC,IAAIE,QAAQ,CAACE,KAAK,IAAIF,QAAQ,CAACG,IAAI,EAAE;IACnC,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;EACjE;EAEAC,SAAS,CACPR,IAAI,CAACS,UAAU,EACfT,IAAI,CAACU,MAAM,EACXV,IAAI,CAACW,IAAI,EACTX,IAAI,CAACY,SAAS,EACdZ,IAAI,CAACa,GAAG,EACRb,IAAI,CAACc,OAAO,EACZd,IAAI,CAACe,GAAG,EACRf,IACF,CAAC;EAED,SAASQ,SAASA,CAChBC,UAAoB,EACpBC,MAAc,EACdC,IAAY,EACZC,SAA4B,EAC5BC,GAAoB,EACpBC,OAAkC,EAClCC,GAAkB,EAClBC,MAAiB,EACjB;IACA,IAAI,CAACL,IAAI,EAAE;MACT;IACF;IAEA,MAAMX,IAAI,GACRgB,MAAM,IACNC,eAAQ,CAACC,GAAG,CAAC;MACXH,GAAG;MACHN,UAAU;MACVC,MAAM;MACNE,SAAS;MACTE,OAAO;MACPD;IACF,CAAC,CAAC;IAEJM,iBAAQ,CAACC,IAAI,CAACpB,IAAI,CAAC;IAEnB,MAAMqB,OAAO,GAAGlB,QAAQ,CAACQ,IAAI,CAACW,IAAI,CAAC;IACnC,IAAID,OAAO,EAAE;MACX,IAAIA,OAAO,CAAChB,KAAK,EAAE;QACjB,KAAK,MAAMkB,KAAK,IAAIF,OAAO,CAAChB,KAAK,EAAE;UACjCkB,KAAK,CAACH,IAAI,CAAClB,KAAK,EAAEF,IAAI,EAAEE,KAAK,CAAC;QAChC;MACF;MACA,IAAImB,OAAO,CAACf,IAAI,EAAE;QAChB,KAAK,MAAMiB,KAAK,IAAIF,OAAO,CAACf,IAAI,EAAE;UAChCiB,KAAK,CAACH,IAAI,CAAClB,KAAK,EAAEF,IAAI,EAAEE,KAAK,CAAC;QAChC;MACF;IACF;IACA,IAAIF,IAAI,CAACwB,UAAU,EAAE;MACnB;IACF;IAEA,MAAMC,IAAI,GAAG3B,YAAY,CAACa,IAAI,CAACW,IAAI,CAAC;IACpC,IAAI,EAACG,IAAI,YAAJA,IAAI,CAAEC,MAAM,GAAE;MACjB;IACF;IAEA,KAAK,MAAMb,GAAG,IAAIY,IAAI,EAAE;MAEtB,MAAME,IAAI,GAAGhB,IAAI,CAACE,GAAG,CAAC;MACtB,IAAI,CAACc,IAAI,EAAE;MACX,IAAIC,KAAK,CAACC,OAAO,CAACF,IAAI,CAAC,EAAE;QACvB,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,IAAI,CAACD,MAAM,EAAEI,CAAC,EAAE,EAAE;UACpC,MAAMC,KAAK,GAAGJ,IAAI,CAACG,CAAC,CAAC;UACrBtB,SAAS,CAACR,IAAI,EAAEW,IAAI,EAAEoB,KAAK,EAAEJ,IAAI,EAAEG,CAAC,EAAEjB,GAAG,CAAC;QAC5C;MACF,CAAC,MAAM;QACLL,SAAS,CAACR,IAAI,EAAEW,IAAI,EAAEgB,IAAI,EAAEhB,IAAI,EAAEE,GAAG,EAAE,IAAI,CAAC;MAC9C;IACF;EACF;AACF","ignoreList":[]}
{"version":3,"names":["_t","require","_index","_visitors","_context","VISITOR_KEYS","traverseForScope","path","visitors","state","exploded","explode","enter","exit","Error","_traverse","parentPath","parent","node","container","key","listKey","hub","inPath","NodePath","get","_forceSetScope","call","visitor","type","visit","shouldSkip","keys","length","prop","Array","isArray","i","value"],"sources":["../../src/scope/traverseForScope.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { HubInterface, Visitor } from \"../index.ts\";\nimport { NodePath } from \"../index.ts\";\nimport { explode } from \"../visitors.ts\";\nimport { _forceSetScope } from \"../path/context.ts\";\n\nexport default function traverseForScope(\n path: NodePath,\n visitors: Visitor,\n state: any,\n) {\n const exploded = explode(visitors);\n\n if (exploded.enter || exploded.exit) {\n throw new Error(\"Should not be used with enter/exit visitors.\");\n }\n\n _traverse(\n path.parentPath,\n path.parent,\n path.node,\n path.container!,\n path.key!,\n path.listKey,\n path.hub,\n path,\n );\n\n function _traverse(\n parentPath: NodePath,\n parent: t.Node,\n node: t.Node,\n container: t.Node | t.Node[],\n key: string | number,\n listKey: string | null | undefined,\n hub?: HubInterface,\n inPath?: NodePath,\n ) {\n if (!node) {\n return;\n }\n\n const path =\n inPath ||\n NodePath.get({\n hub,\n parentPath,\n parent,\n container,\n listKey,\n key,\n });\n\n _forceSetScope.call(path);\n\n const visitor = exploded[node.type];\n if (visitor?.enter) {\n for (const visit of visitor.enter) {\n visit.call(state, path, state);\n }\n }\n\n if (path.shouldSkip) {\n return;\n }\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys?.length) {\n return;\n }\n\n for (const key of keys) {\n // @ts-expect-error key must present in node\n const prop = node[key];\n if (!prop) continue;\n if (Array.isArray(prop)) {\n for (let i = 0; i < prop.length; i++) {\n const value = prop[i];\n _traverse(path, node, value, prop, i, key);\n }\n } else {\n _traverse(path, node, prop, node, key, null);\n }\n }\n\n if (visitor?.exit) {\n for (const visit of visitor.exit) {\n visit.call(state, path, state);\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAAoD;EAL3CI;AAAY,IAAAL,EAAA;AAON,SAASM,gBAAgBA,CACtCC,IAAc,EACdC,QAAiB,EACjBC,KAAU,EACV;EACA,MAAMC,QAAQ,GAAG,IAAAC,iBAAO,EAACH,QAAQ,CAAC;EAElC,IAAIE,QAAQ,CAACE,KAAK,IAAIF,QAAQ,CAACG,IAAI,EAAE;IACnC,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;EACjE;EAEAC,SAAS,CACPR,IAAI,CAACS,UAAU,EACfT,IAAI,CAACU,MAAM,EACXV,IAAI,CAACW,IAAI,EACTX,IAAI,CAACY,SAAS,EACdZ,IAAI,CAACa,GAAG,EACRb,IAAI,CAACc,OAAO,EACZd,IAAI,CAACe,GAAG,EACRf,IACF,CAAC;EAED,SAASQ,SAASA,CAChBC,UAAoB,EACpBC,MAAc,EACdC,IAAY,EACZC,SAA4B,EAC5BC,GAAoB,EACpBC,OAAkC,EAClCC,GAAkB,EAClBC,MAAiB,EACjB;IACA,IAAI,CAACL,IAAI,EAAE;MACT;IACF;IAEA,MAAMX,IAAI,GACRgB,MAAM,IACNC,eAAQ,CAACC,GAAG,CAAC;MACXH,GAAG;MACHN,UAAU;MACVC,MAAM;MACNE,SAAS;MACTE,OAAO;MACPD;IACF,CAAC,CAAC;IAEJM,uBAAc,CAACC,IAAI,CAACpB,IAAI,CAAC;IAEzB,MAAMqB,OAAO,GAAGlB,QAAQ,CAACQ,IAAI,CAACW,IAAI,CAAC;IACnC,IAAID,OAAO,YAAPA,OAAO,CAAEhB,KAAK,EAAE;MAClB,KAAK,MAAMkB,KAAK,IAAIF,OAAO,CAAChB,KAAK,EAAE;QACjCkB,KAAK,CAACH,IAAI,CAAClB,KAAK,EAAEF,IAAI,EAAEE,KAAK,CAAC;MAChC;IACF;IAEA,IAAIF,IAAI,CAACwB,UAAU,EAAE;MACnB;IACF;IAEA,MAAMC,IAAI,GAAG3B,YAAY,CAACa,IAAI,CAACW,IAAI,CAAC;IACpC,IAAI,EAACG,IAAI,YAAJA,IAAI,CAAEC,MAAM,GAAE;MACjB;IACF;IAEA,KAAK,MAAMb,GAAG,IAAIY,IAAI,EAAE;MAEtB,MAAME,IAAI,GAAGhB,IAAI,CAACE,GAAG,CAAC;MACtB,IAAI,CAACc,IAAI,EAAE;MACX,IAAIC,KAAK,CAACC,OAAO,CAACF,IAAI,CAAC,EAAE;QACvB,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,IAAI,CAACD,MAAM,EAAEI,CAAC,EAAE,EAAE;UACpC,MAAMC,KAAK,GAAGJ,IAAI,CAACG,CAAC,CAAC;UACrBtB,SAAS,CAACR,IAAI,EAAEW,IAAI,EAAEoB,KAAK,EAAEJ,IAAI,EAAEG,CAAC,EAAEjB,GAAG,CAAC;QAC5C;MACF,CAAC,MAAM;QACLL,SAAS,CAACR,IAAI,EAAEW,IAAI,EAAEgB,IAAI,EAAEhB,IAAI,EAAEE,GAAG,EAAE,IAAI,CAAC;MAC9C;IACF;IAEA,IAAIQ,OAAO,YAAPA,OAAO,CAAEf,IAAI,EAAE;MACjB,KAAK,MAAMiB,KAAK,IAAIF,OAAO,CAACf,IAAI,EAAE;QAChCiB,KAAK,CAACH,IAAI,CAAClB,KAAK,EAAEF,IAAI,EAAEE,KAAK,CAAC;MAChC;IACF;EACF;AACF","ignoreList":[]}

View File

@@ -118,7 +118,6 @@ function _traverse(node, opts, scope, state, path, skipKeys, visitSelf) {
return false;
}
function traverseNode(node, opts, scope, state, path, skipKeys, visitSelf) {
;
const keys = VISITOR_KEYS[node.type];
if (!keys) return false;
const context = new _context.default(scope, opts, state, path);

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"names":[],"sources":["../src/types.ts"],"sourcesContent":["import type * as t from \"@babel/types\";\nimport type { NodePath } from \"./index.ts\";\nimport type { VirtualTypeAliases } from \"./path/lib/virtual-types.ts\";\nimport type {\n ExplVisitorBase,\n VisitorBaseNodes,\n VisitorBaseAliases,\n} from \"./generated/visitor-types.d.ts\";\n\nexport type VisitPhase = \"enter\" | \"exit\";\n\ninterface VisitNodeObject<S, P extends t.Node> {\n enter?: VisitNodeFunction<S, P>;\n exit?: VisitNodeFunction<S, P>;\n}\n\nexport interface ExplVisitNode<S, P extends t.Node> {\n enter?: VisitNodeFunction<S, P>[];\n exit?: VisitNodeFunction<S, P>[];\n}\n\nexport interface ExplodedVisitor<S = unknown>\n extends ExplVisitorBase<S>,\n ExplVisitNode<S, t.Node> {\n _exploded: true;\n _verified: true;\n}\n\n// TODO: Assert that the keys of this are the keys of VirtualTypeAliases without\n// the keys of VisitorBaseNodes and VisitorBaseAliases\n// prettier-ignore\ninterface VisitorVirtualAliases<S> {\n BindingIdentifier?: VisitNode<S, VirtualTypeAliases[\"BindingIdentifier\"]>;\n BlockScoped?: VisitNode<S, VirtualTypeAliases[\"BlockScoped\"]>;\n ExistentialTypeParam?: VisitNode<S, VirtualTypeAliases[\"ExistentialTypeParam\"]>;\n Expression?: VisitNode<S, VirtualTypeAliases[\"Expression\"]>;\n //Flow?: VisitNode<S, VirtualTypeAliases[\"Flow\"]>;\n ForAwaitStatement?: VisitNode<S, VirtualTypeAliases[\"ForAwaitStatement\"]>;\n Generated?: VisitNode<S, VirtualTypeAliases[\"Generated\"]>;\n NumericLiteralTypeAnnotation?: VisitNode<S, VirtualTypeAliases[\"NumericLiteralTypeAnnotation\"]>;\n Pure?: VisitNode<S, VirtualTypeAliases[\"Pure\"]>;\n Referenced?: VisitNode<S, VirtualTypeAliases[\"Referenced\"]>;\n ReferencedIdentifier?: VisitNode<S, VirtualTypeAliases[\"ReferencedIdentifier\"]>;\n ReferencedMemberExpression?: VisitNode<S, VirtualTypeAliases[\"ReferencedMemberExpression\"]>;\n //RestProperty?: VisitNode<S, VirtualTypeAliases[\"RestProperty\"]>;\n Scope?: VisitNode<S, VirtualTypeAliases[\"Scope\"]>;\n //SpreadProperty?: VisitNode<S, VirtualTypeAliases[\"SpreadProperty\"]>;\n Statement?: VisitNode<S, VirtualTypeAliases[\"Statement\"]>;\n User?: VisitNode<S, VirtualTypeAliases[\"User\"]>;\n Var?: VisitNode<S, VirtualTypeAliases[\"Var\"]>;\n}\n\n// TODO: Do not export this? Or give it a better name?\nexport interface VisitorBase<S>\n extends VisitNodeObject<S, t.Node>,\n VisitorBaseNodes<S>,\n VisitorBaseAliases<S>,\n VisitorVirtualAliases<S> {\n // Babel supports `NodeTypesWithoutComment | NodeTypesWithoutComment | ... ` but it is\n // too complex for TS. So we type it as a general visitor only if the key contains `|`\n // this is good enough for non-visitor traverse options e.g. `noScope`\n [k: `${string}|${string}`]: VisitNode<S, t.Node>;\n}\n\nexport type Visitor<S = unknown> = VisitorBase<S> | ExplodedVisitor<S>;\n\nexport type VisitNode<S, P extends t.Node> =\n | VisitNodeFunction<S, P>\n | VisitNodeObject<S, P>;\n\nexport type VisitNodeFunction<S, P extends t.Node> = (\n this: S,\n path: NodePath<P>,\n state: S,\n) => void;\n"],"mappings":"","ignoreList":[]}
{"version":3,"names":[],"sources":["../src/types.ts"],"sourcesContent":["import type * as t from \"@babel/types\";\nimport type { NodePath } from \"./index.ts\";\nimport type { VirtualTypeAliases } from \"./path/lib/virtual-types.ts\";\nimport type {\n ExplVisitorBase,\n VisitorBaseNodes,\n VisitorBaseAliases,\n} from \"./generated/visitor-types.d.ts\";\n\nexport type VisitPhase = \"enter\" | \"exit\";\n\ninterface VisitNodeObject<S, P extends t.Node> {\n enter?: VisitNodeFunction<S, P>;\n exit?: VisitNodeFunction<S, P>;\n}\n\nexport interface ExplVisitNode<S, P extends t.Node> {\n enter?: VisitNodeFunction<S, P>[];\n exit?: VisitNodeFunction<S, P>[];\n}\n\nexport interface ExplodedVisitor<S = unknown>\n extends ExplVisitorBase<S>,\n ExplVisitNode<S, t.Node> {\n _exploded: true;\n _verified: true;\n}\n\n// TODO: Assert that the keys of this are the keys of VirtualTypeAliases without\n// the keys of VisitorBaseNodes and VisitorBaseAliases\n// prettier-ignore\ninterface VisitorVirtualAliases<S> {\n BindingIdentifier?: VisitNode<S, VirtualTypeAliases[\"BindingIdentifier\"]>;\n BlockScoped?: VisitNode<S, VirtualTypeAliases[\"BlockScoped\"]>;\n ExistentialTypeParam?: VisitNode<S, VirtualTypeAliases[\"ExistentialTypeParam\"]>;\n Expression?: VisitNode<S, VirtualTypeAliases[\"Expression\"]>;\n //Flow?: VisitNode<S, VirtualTypeAliases[\"Flow\"]>;\n ForAwaitStatement?: VisitNode<S, VirtualTypeAliases[\"ForAwaitStatement\"]>;\n Generated?: VisitNode<S, VirtualTypeAliases[\"Generated\"]>;\n NumericLiteralTypeAnnotation?: VisitNode<S, VirtualTypeAliases[\"NumericLiteralTypeAnnotation\"]>;\n Pure?: VisitNode<S, VirtualTypeAliases[\"Pure\"]>;\n Referenced?: VisitNode<S, VirtualTypeAliases[\"Referenced\"]>;\n ReferencedIdentifier?: VisitNode<S, VirtualTypeAliases[\"ReferencedIdentifier\"]>;\n ReferencedMemberExpression?: VisitNode<S, VirtualTypeAliases[\"ReferencedMemberExpression\"]>;\n //RestProperty?: VisitNode<S, VirtualTypeAliases[\"RestProperty\"]>;\n Scope?: VisitNode<S, VirtualTypeAliases[\"Scope\"]>;\n //SpreadProperty?: VisitNode<S, VirtualTypeAliases[\"SpreadProperty\"]>;\n Statement?: VisitNode<S, VirtualTypeAliases[\"Statement\"]>;\n User?: VisitNode<S, VirtualTypeAliases[\"User\"]>;\n Var?: VisitNode<S, VirtualTypeAliases[\"Var\"]>;\n}\n\n// TODO: Do not export this? Or give it a better name?\nexport interface VisitorBase<S>\n extends VisitNodeObject<S, t.Node>,\n VisitorBaseNodes<S>,\n VisitorBaseAliases<S>,\n VisitorVirtualAliases<S>,\n // Babel supports `NodeTypesWithoutComment | NodeTypesWithoutComment | ... ` but it is\n // too complex for TS. So we type it as a general visitor only if the key contains `|`\n // this is good enough for non-visitor traverse options e.g. `noScope`\n Record<`${string}|${string}`, VisitNode<S, t.Node>> {}\n\nexport type Visitor<S = unknown> = VisitorBase<S> | ExplodedVisitor<S>;\n\nexport type VisitNode<S, P extends t.Node> =\n | VisitNodeFunction<S, P>\n | VisitNodeObject<S, P>;\n\nexport type VisitNodeFunction<S, P extends t.Node> = (\n this: S,\n path: NodePath<P>,\n state: S,\n) => void;\n"],"mappings":"","ignoreList":[]}

View File

@@ -102,7 +102,7 @@ function verify$1(visitor) {
}
if (shouldIgnoreKey(nodeType)) continue;
if (!TYPES.includes(nodeType)) {
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.28.5"}`);
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.28.6"}`);
}
const visitors = visitor[nodeType];
if (typeof visitors === "object") {
@@ -130,14 +130,12 @@ function merge(visitors, states = [], wrapper) {
_verified: true,
_exploded: true
};
{
Object.defineProperty(mergedVisitor, "_exploded", {
enumerable: false
});
Object.defineProperty(mergedVisitor, "_verified", {
enumerable: false
});
}
Object.defineProperty(mergedVisitor, "_exploded", {
enumerable: false
});
Object.defineProperty(mergedVisitor, "_verified", {
enumerable: false
});
for (let i = 0; i < visitors.length; i++) {
const visitor = explode$1(visitors[i]);
const state = states[i];
@@ -209,15 +207,13 @@ function wrapCheck(nodeType, fn) {
return newFn;
}
function shouldIgnoreKey(key) {
if (key[0] === "_") return true;
if (key.startsWith("_")) return true;
if (key === "enter" || key === "exit" || key === "shouldSkip") return true;
if (key === "denylist" || key === "noScope" || key === "skipKeys") {
return true;
}
{
if (key === "blacklist") {
return true;
}
if (key === "blacklist") {
return true;
}
return false;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/traverse",
"version": "7.28.5",
"version": "7.28.6",
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-traverse",
@@ -16,16 +16,16 @@
},
"main": "./lib/index.js",
"dependencies": {
"@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.5",
"@babel/code-frame": "^7.28.6",
"@babel/generator": "^7.28.6",
"@babel/helper-globals": "^7.28.0",
"@babel/parser": "^7.28.5",
"@babel/template": "^7.27.2",
"@babel/types": "^7.28.5",
"@babel/parser": "^7.28.6",
"@babel/template": "^7.28.6",
"@babel/types": "^7.28.6",
"debug": "^4.3.1"
},
"devDependencies": {
"@babel/core": "^7.28.5",
"@babel/core": "^7.28.6",
"@babel/helper-plugin-test-runner": "^7.27.1"
},
"engines": {