-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thanks to @batje, documentation.js now supports Vue! .vue files are parsed for their JavaScript contents by default.
- Loading branch information
Showing
9 changed files
with
355 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<template> | ||
<div>not relevant</div> | ||
</template> | ||
|
||
<script> | ||
/** | ||
* This Vue Component is a test | ||
* @returns {vue-tested} vue-tested component | ||
*/ | ||
export default { | ||
props: { | ||
/** | ||
* This is a number | ||
*/ | ||
myNumber: { | ||
default: 42, | ||
type: Number | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const _ = require('lodash'); | ||
const sort = require('./sort'); | ||
const nest = require('./nest'); | ||
const filterAccess = require('./filter_access'); | ||
const dependency = require('./input/dependency'); | ||
const shallow = require('./input/shallow'); | ||
const parseJavaScript = require('./parsers/javascript'); | ||
const parseVueScript = require('./parsers/vue'); | ||
const github = require('./github'); | ||
const hierarchy = require('./hierarchy'); | ||
const inferName = require('./infer/name'); | ||
|
@@ -103,6 +105,9 @@ function buildInternal(inputsAndConfig) { | |
sourceFile.source = fs.readFileSync(sourceFile.file, 'utf8'); | ||
} | ||
|
||
if (path.extname(sourceFile.file) === '.vue') { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
batje
Contributor
|
||
return parseVueScript(sourceFile, config).map(buildPipeline); | ||
} | ||
return parseJavaScript(sourceFile, config).map(buildPipeline); | ||
}).filter(Boolean); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* @flow */ | ||
|
||
const parseJavaScript = require('./javascript'); | ||
const vuecompiler = require('vue-template-compiler'); | ||
|
||
/** | ||
* Receives a module-dep item, | ||
* reads the file, parses the VueScript, and parses the JSDoc. | ||
* | ||
* @param {Object} data a chunk of data provided by module-deps | ||
* @param {Object} config config | ||
* @returns {Array<Object>} an array of parsed comments | ||
*/ | ||
function parseVueScript(data: Object, config: DocumentationConfig) { | ||
data.source = vuecompiler.parseComponent(data.source).script.content; | ||
return parseJavaScript(data, config); | ||
} | ||
|
||
module.exports = parseVueScript; |
Oops, something went wrong.
We use
documentation
withsource
option, not withfile
.This commit breaks this ability.