vue-docgen-api
Advanced tools
Comparing version 4.78.0 to 4.79.1
@@ -46,4 +46,4 @@ "use strict"; | ||
if (nodePath.node.decorators && | ||
bt.isCallExpression(nodePath.node.decorators[0].expression) && | ||
bt.isIdentifier(nodePath.node.decorators[0].expression.callee) && | ||
nodePath.node.decorators[0].expression.type === 'CallExpression' && | ||
nodePath.node.decorators[0].expression.callee.type === 'Identifier' && | ||
nodePath.node.decorators[0].expression.callee.name === 'Emit') { | ||
@@ -70,3 +70,3 @@ // fetch the leading comments on the wrapping expression | ||
} | ||
else if (bt.isIdentifier(nodePath.node.key)) { | ||
else if (nodePath.node.key.type === 'Identifier') { | ||
eventName = nodePath.node.key.name; | ||
@@ -73,0 +73,0 @@ } |
@@ -57,5 +57,5 @@ "use strict"; | ||
visitCallExpression: function (pathExpression) { | ||
if (bt.isMemberExpression(pathExpression.node.callee) && | ||
bt.isThisExpression(pathExpression.node.callee.object) && | ||
bt.isIdentifier(pathExpression.node.callee.property) && | ||
if (pathExpression.node.callee.type === 'MemberExpression' && | ||
pathExpression.node.callee.object.type === 'ThisExpression' && | ||
pathExpression.node.callee.property.type === 'Identifier' && | ||
pathExpression.node.callee.property.name === '$emit') { | ||
@@ -62,0 +62,0 @@ var args = pathExpression.node.arguments; |
@@ -54,7 +54,7 @@ "use strict"; | ||
visitCallExpression: function (pathCall) { | ||
if (bt.isMemberExpression(pathCall.node.callee) && | ||
bt.isMemberExpression(pathCall.node.callee.object) && | ||
bt.isThisExpression(pathCall.node.callee.object.object) && | ||
bt.isIdentifier(pathCall.node.callee.property) && | ||
bt.isIdentifier(pathCall.node.callee.object.property) && | ||
if (pathCall.node.callee.type === 'MemberExpression' && | ||
pathCall.node.callee.object.type === 'MemberExpression' && | ||
pathCall.node.callee.object.object.type === 'ThisExpression' && | ||
pathCall.node.callee.property.type === 'Identifier' && | ||
pathCall.node.callee.object.property.type === 'Identifier' && | ||
(pathCall.node.callee.object.property.name === '$slots' || | ||
@@ -65,3 +65,3 @@ pathCall.node.callee.object.property.name === '$scopedSlots')) { | ||
var bindings = pathCall.node.arguments[0]; | ||
if (bt.isObjectExpression(bindings) && bindings.properties.length) { | ||
if ((bindings === null || bindings === void 0 ? void 0 : bindings.type) === 'ObjectExpression' && bindings.properties.length) { | ||
doc.bindings = getBindings(bindings, comment ? comment.bindings : undefined); | ||
@@ -76,8 +76,8 @@ } | ||
visitMemberExpression: function (pathMember) { | ||
if (bt.isMemberExpression(pathMember.node.object) && | ||
bt.isThisExpression(pathMember.node.object.object) && | ||
bt.isIdentifier(pathMember.node.object.property) && | ||
if (pathMember.node.object.type === 'MemberExpression' && | ||
pathMember.node.object.object.type === 'ThisExpression' && | ||
pathMember.node.object.property.type === 'Identifier' && | ||
(pathMember.node.object.property.name === '$slots' || | ||
pathMember.node.object.property.name === '$scopedSlots') && | ||
bt.isIdentifier(pathMember.node.property)) { | ||
pathMember.node.property.type === 'Identifier') { | ||
var doc = documentation.getSlotDescriptor(pathMember.node.property.name); | ||
@@ -93,3 +93,3 @@ getSlotComment(pathMember, doc); | ||
var nodeJSX = pathJSX.node; | ||
if (bt.isJSXIdentifier(tagName) && tagName.name === 'slot') { | ||
if (tagName.type === 'JSXIdentifier' && tagName.name === 'slot') { | ||
var doc = documentation.getSlotDescriptor(getName(nodeJSX)); | ||
@@ -96,0 +96,0 @@ var parentNode = pathJSX.parentPath.node; |
@@ -60,5 +60,5 @@ "use strict"; | ||
visitMemberExpression: function (pathMember) { | ||
if (bt.isIdentifier(pathMember.node.object) && | ||
if (pathMember.node.object.type === 'Identifier' && | ||
pathMember.node.object.name === contextVariableName_1 && | ||
bt.isIdentifier(pathMember.node.property) && | ||
pathMember.node.property.type === 'Identifier' && | ||
pathMember.node.property.name === 'children') { | ||
@@ -65,0 +65,0 @@ var doc = documentation.getSlotDescriptor('default'); |
@@ -97,4 +97,4 @@ "use strict"; | ||
p.node.declarations.forEach(function (decl, i) { | ||
if (bt.isVariableDeclarator(decl) && | ||
bt.isIdentifier(decl.id) && | ||
if (decl.type === 'VariableDeclarator' && | ||
decl.id.type === 'Identifier' && | ||
decl.id.name === identifierName) { | ||
@@ -101,0 +101,0 @@ varPath = p.get('declarations', i, 'init'); |
@@ -136,3 +136,4 @@ "use strict"; | ||
visitCallExpression: function (nodePath) { | ||
if (bt.isIdentifier(nodePath.node.callee) && nodePath.node.callee.name === 'defineEmits') { | ||
if (nodePath.node.callee.type === 'Identifier' && | ||
nodePath.node.callee.name === 'defineEmits') { | ||
// Array of string where no type is specified | ||
@@ -139,0 +140,0 @@ if (bt.isArrayExpression(nodePath.get('arguments', 0).node)) { |
@@ -98,3 +98,4 @@ "use strict"; | ||
visitCallExpression: function (nodePath) { | ||
if (bt.isIdentifier(nodePath.node.callee) && nodePath.node.callee.name === 'defineExpose') { | ||
if (nodePath.node.callee.type === 'Identifier' && | ||
nodePath.node.callee.name === 'defineExpose') { | ||
if (bt.isObjectExpression(nodePath.get('arguments', 0).node)) { | ||
@@ -101,0 +102,0 @@ nodePath.get('arguments', 0, 'properties').each(function (prop) { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -65,3 +42,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var bt = __importStar(require("@babel/types")); | ||
var recast_1 = require("recast"); | ||
@@ -81,10 +57,10 @@ var handleComponentJSDoc_1 = __importDefault(require("../utils/handleComponentJSDoc")); | ||
visitCallExpression: function (nodePath) { | ||
if (bt.isIdentifier(nodePath.node.callee) && | ||
if (nodePath.node.callee.type === 'Identifier' && | ||
nodePath.node.callee.name === 'defineOptions' && | ||
bt.isObjectExpression(nodePath.node.arguments[0])) { | ||
nodePath.node.arguments[0].type === 'ObjectExpression') { | ||
var options = nodePath.node.arguments[0]; | ||
options.properties.forEach(function (property) { | ||
if (bt.isObjectProperty(property) && bt.isIdentifier(property.key)) { | ||
if (property.type === 'ObjectProperty' && property.key.type === 'Identifier') { | ||
var key = property.key.name; | ||
if (key === 'name' && bt.isStringLiteral(property.value)) { | ||
if (key === 'name' && property.value.type === 'StringLiteral') { | ||
documentation.set('name', property.value.value); | ||
@@ -91,0 +67,0 @@ } |
@@ -83,3 +83,3 @@ "use strict"; | ||
visitCallExpression: function (nodePath) { | ||
var hasDefaults = bt.isIdentifier(nodePath.node.callee) && nodePath.node.callee.name === 'withDefaults'; | ||
var hasDefaults = nodePath.node.callee.type === 'Identifier' && nodePath.node.callee.name === 'withDefaults'; | ||
var normalizedNodePath = hasDefaults ? nodePath.get('arguments', 0) : nodePath; | ||
@@ -86,0 +86,0 @@ if (bt.isIdentifier(normalizedNodePath.node.callee) && |
@@ -83,3 +83,3 @@ "use strict"; | ||
visitCallExpression: function (nodePath) { | ||
if (bt.isIdentifier(nodePath.node.callee) && | ||
if (nodePath.node.callee.type === 'Identifier' && | ||
nodePath.node.callee.name === 'defineSlots' && | ||
@@ -86,0 +86,0 @@ nodePath.node.typeParameters) { |
@@ -54,3 +54,3 @@ "use strict"; | ||
var filePath = pathResolver(module); | ||
if (!filePath) { | ||
if (!filePath || !opt.validExtends(filePath)) { | ||
return undefined; | ||
@@ -90,3 +90,3 @@ } | ||
visitTSInterfaceDeclaration: function (nodePath) { | ||
if (bt.isIdentifier(nodePath.node.id) && nodePath.node.id.name === typeName) { | ||
if (nodePath.node.id.type === 'Identifier' && nodePath.node.id.name === typeName) { | ||
var interfaceBody_1 = nodePath.get('body', 'body'); | ||
@@ -102,3 +102,3 @@ if (!interfaceBody_1) { | ||
parentInterfaces.forEach(function (parentInterface) { | ||
if (!bt.isIdentifier(parentInterface.expression)) { | ||
if (parentInterface.expression.type !== 'Identifier') { | ||
return; | ||
@@ -109,4 +109,4 @@ } | ||
if (!interfaceBody_1.value.find(function (prop) { | ||
return bt.isIdentifier(prop.key) && | ||
bt.isIdentifier(parentInterfaceProp.key) && | ||
return prop.key.type === 'Identifier' && | ||
parentInterfaceProp.key.type === 'Identifier' && | ||
prop.key.name === parentInterfaceProp.key.name; | ||
@@ -124,3 +124,3 @@ })) { | ||
visitTSTypeAliasDeclaration: function (nodePath) { | ||
if (bt.isIdentifier(nodePath.node.id) && nodePath.node.id.name === typeName) { | ||
if (nodePath.node.id.type === 'Identifier' && nodePath.node.id.name === typeName) { | ||
var typeAnnotation = nodePath.get('typeAnnotation'); | ||
@@ -127,0 +127,0 @@ if (bt.isTSTypeLiteral(typeAnnotation.node)) { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -29,3 +6,2 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var bt = __importStar(require("@babel/types")); | ||
var recast_1 = require("recast"); | ||
@@ -60,4 +36,4 @@ var extractLeadingComment_1 = __importDefault(require("../utils/extractLeadingComment")); | ||
var args = path.node ? path.node.arguments : undefined; | ||
if (obj && args && bt.isIdentifier(obj) && obj.name === '$emit' && args.length) { | ||
var evtName = bt.isStringLiteral(args[0]) ? args[0].value : '<undefined>'; | ||
if (obj && args && obj.type === 'Identifier' && obj.name === '$emit' && args.length) { | ||
var evtName = args[0].type === 'StringLiteral' ? args[0].value : '<undefined>'; | ||
documentation.getEventDescriptor(evtName); | ||
@@ -64,0 +40,0 @@ eventsFound.push(evtName); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -29,3 +6,2 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var bt = __importStar(require("@babel/types")); | ||
var recast_1 = require("recast"); | ||
@@ -65,7 +41,3 @@ var extractLeadingComment_1 = __importDefault(require("../utils/extractLeadingComment")); | ||
var propName = path.node ? path.node.property : undefined; | ||
if (obj && | ||
propName && | ||
bt.isIdentifier(obj) && | ||
obj.name === 'props' && | ||
bt.isIdentifier(propName)) { | ||
if ((obj === null || obj === void 0 ? void 0 : obj.type) === 'Identifier' && obj.name === 'props' && (propName === null || propName === void 0 ? void 0 : propName.type) === 'Identifier') { | ||
var pName = propName.name; | ||
@@ -72,0 +44,0 @@ var p = documentation.getPropDescriptor(pName); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -67,3 +44,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
var util_1 = require("util"); | ||
var bt = __importStar(require("@babel/types")); | ||
var recast_1 = require("recast"); | ||
@@ -97,3 +73,3 @@ var babel_parser_1 = __importDefault(require("../babel-parser")); | ||
if (/.tsx?$/.test(currentFilePath)) { | ||
filePlugins = filePlugins.map(function (plugin) { return plugin === 'flow' ? 'typescript' : plugin; }); | ||
filePlugins = filePlugins.map(function (plugin) { return (plugin === 'flow' ? 'typescript' : plugin); }); | ||
} | ||
@@ -109,6 +85,6 @@ return [4 /*yield*/, read(currentFilePath, { | ||
var masterDeclaration = p.node.declaration; | ||
if (masterDeclaration && bt.isVariableDeclaration(masterDeclaration)) { | ||
if ((masterDeclaration === null || masterDeclaration === void 0 ? void 0 : masterDeclaration.type) === 'VariableDeclaration') { | ||
masterDeclaration.declarations.forEach(function (declaration, i) { | ||
if (bt.isVariableDeclarator(declaration) && | ||
bt.isIdentifier(declaration.id) && | ||
if (declaration.type === 'VariableDeclarator' && | ||
declaration.id.type === 'Identifier' && | ||
declaration.id.name === exportName) { | ||
@@ -115,0 +91,0 @@ exportedPath = p.get('declaration', 'declarations', i, 'init'); |
@@ -50,7 +50,8 @@ "use strict"; | ||
visitVariableDeclaration: function (variablePath) { | ||
if (!bt.isVariableDeclaration(variablePath.node)) { | ||
if (variablePath.node.type !== 'VariableDeclaration') { | ||
return false; | ||
} | ||
var varID = variablePath.node.declarations[0].id; | ||
if (!varID || !bt.isIdentifier(varID) || varID.name !== varName) { | ||
var firstDeclaration = variablePath.node.declarations[0]; | ||
var varID = firstDeclaration.type === 'VariableDeclarator' ? firstDeclaration.id : firstDeclaration; | ||
if (!varID || varID.type !== 'Identifier' || varID.name !== varName) { | ||
return false; | ||
@@ -63,3 +64,3 @@ } | ||
var classID = classPath.node.id; | ||
if (!classID || !bt.isIdentifier(classID) || classID.name !== varName) { | ||
if (!classID || classID.type !== 'Identifier' || classID.name !== varName) { | ||
return false; | ||
@@ -66,0 +67,0 @@ } |
@@ -88,3 +88,3 @@ "use strict"; | ||
var middleNameDeclaration = astPath.node.declaration; | ||
if (bt.isIdentifier(middleNameDeclaration)) { | ||
if (middleNameDeclaration.type === 'Identifier') { | ||
var middleName = middleNameDeclaration.name; | ||
@@ -91,0 +91,0 @@ var importedVar = importedVariablePaths[middleName]; |
{ | ||
"name": "vue-docgen-api", | ||
"version": "4.78.0", | ||
"version": "4.79.1", | ||
"description": "Toolbox to extract information from Vue component files for documentation generation purposes.", | ||
@@ -35,4 +35,4 @@ "homepage": "https://vue-styleguidist.github.io", | ||
"dependencies": { | ||
"@babel/parser": "^7.21.4", | ||
"@babel/types": "^7.21.4", | ||
"@babel/parser": "^7.24.7", | ||
"@babel/types": "^7.24.7", | ||
"@vue/compiler-dom": "^3.2.0", | ||
@@ -39,0 +39,0 @@ "@vue/compiler-sfc": "^3.2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
808482
12558
Updated@babel/parser@^7.24.7
Updated@babel/types@^7.24.7