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:
239
node_modules/@babel/traverse/lib/scope/index.js
generated
vendored
239
node_modules/@babel/traverse/lib/scope/index.js
generated
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user