Skip to content

Commit

Permalink
fix: make sure node_module resolved path ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart committed May 15, 2019
1 parent a4eed84 commit 7a1092a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions packages/vue-docgen-api/src/script-handlers/extendsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ export default function extendsHandler(
resolveImmediatelyExportedRequire(pathResolver, extendsFilePath)

// only look for documentation in the current project not in node_modules
if (/^\./.test(extendsFilePath[extendsVariableName].filePath)) {
const fullFilePath = pathResolver(extendsFilePath[extendsVariableName].filePath)

const fullFilePath = pathResolver(extendsFilePath[extendsVariableName].filePath)
if (!/[\\/]node_modules[\\/]/.test(fullFilePath)) {
parseFile(documentation, {
...opt,
filePath: fullFilePath,
nameFilter: [extendsFilePath[extendsVariableName].exportName]
})
// make sure that the parent name does not bleed on the new doc
documentation.set('displayName', null)
}
// make sure that the parent name does not bleed on the new doc
documentation.set('displayName', null)
}

function getExtendsVariableName(compDef: NodePath): string | undefined {
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-docgen-api/src/script-handlers/mixinsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export default function mixinsHandler(
const files = new Map<string, string[]>()
for (const varName of Object.keys(mixinVarToFilePath)) {
const { filePath, exportName } = mixinVarToFilePath[varName]
if (/^\./.test(filePath)) {
const fullFilePath = pathResolver(filePath)
const fullFilePath = pathResolver(filePath)
if (!/[\\/]node_modules[\\/]/.test(fullFilePath)) {
const vars = files.get(fullFilePath) || []
vars.push(exportName)
files.set(fullFilePath, vars)
Expand Down

0 comments on commit 7a1092a

Please sign in to comment.