vue-docgen-api
Advanced tools
Comparing version 4.56.0 to 4.56.2
@@ -1,3 +0,3 @@ | ||
import { Descriptor, PropDescriptor, MethodDescriptor, SlotDescriptor, EventDescriptor, ExposedDescriptor, ComponentDoc, DocBlockTags, BlockTag, Param, UnnamedParam, Tag, ParamTag, ParamType } from 'vue-inbrowser-compiler-independent-utils'; | ||
export { Descriptor, PropDescriptor, MethodDescriptor, SlotDescriptor, EventDescriptor, ExposedDescriptor, ComponentDoc, DocBlockTags, BlockTag, Param, UnnamedParam, Tag, ParamTag, ParamType }; | ||
import { Descriptor, PropDescriptor, MethodDescriptor, SlotDescriptor, EventDescriptor, ExposeDescriptor, ComponentDoc, DocBlockTags, BlockTag, Param, UnnamedParam, Tag, ParamTag, ParamType } from 'vue-inbrowser-compiler-independent-utils'; | ||
export { Descriptor, PropDescriptor, MethodDescriptor, SlotDescriptor, EventDescriptor, ExposeDescriptor, ComponentDoc, DocBlockTags, BlockTag, Param, UnnamedParam, Tag, ParamTag, ParamType }; | ||
export default class Documentation { | ||
@@ -22,3 +22,3 @@ private propsMap; | ||
getMethodDescriptor(methodName: string): MethodDescriptor; | ||
getExposedDescriptor(exposedName: string): ExposedDescriptor; | ||
getExposeDescriptor(exposedName: string): ExposeDescriptor; | ||
toObject(): ComponentDoc; | ||
@@ -25,0 +25,0 @@ private getDescriptor; |
@@ -55,3 +55,3 @@ "use strict"; | ||
} | ||
getExposedDescriptor(exposedName) { | ||
getExposeDescriptor(exposedName) { | ||
return this.getDescriptor(exposedName, this.exposedMap, () => ({ | ||
@@ -58,0 +58,0 @@ name: exposedName |
@@ -1,2 +0,2 @@ | ||
import Documentation, { ComponentDoc, PropDescriptor, SlotDescriptor, EventDescriptor, MethodDescriptor, BlockTag, Param, Tag, ParamTag, ParamType } from './Documentation'; | ||
import Documentation, { ComponentDoc, PropDescriptor, SlotDescriptor, EventDescriptor, MethodDescriptor, ExposeDescriptor, BlockTag, Param, Tag, ParamTag, ParamType } from './Documentation'; | ||
import { DocGenOptions, ParseOptions } from './parse'; | ||
@@ -9,3 +9,3 @@ import * as ScriptHandlers from './script-handlers'; | ||
export { ScriptHandler, TemplateHandler } from './parse'; | ||
export { ComponentDoc, DocGenOptions, ParseOptions, Documentation, BlockTag, PropDescriptor, SlotDescriptor, EventDescriptor, MethodDescriptor, Param, Tag, ParamTag, ParamType }; | ||
export { ComponentDoc, DocGenOptions, ParseOptions, Documentation, BlockTag, PropDescriptor, SlotDescriptor, EventDescriptor, MethodDescriptor, ExposeDescriptor, Param, Tag, ParamTag, ParamType }; | ||
export { cleanName, getDefaultExample } from 'vue-inbrowser-compiler-independent-utils'; | ||
@@ -12,0 +12,0 @@ /** |
@@ -8,3 +8,3 @@ "use strict"; | ||
const setupPropHandler_1 = __importDefault(require("./setupPropHandler")); | ||
const setupExposedHandler_1 = __importDefault(require("./setupExposedHandler")); | ||
exports.default = [setupEventHandler_1.default, setupPropHandler_1.default, setupExposedHandler_1.default]; | ||
const setupExposeHandler_1 = __importDefault(require("./setupExposeHandler")); | ||
exports.default = [setupEventHandler_1.default, setupPropHandler_1.default, setupExposeHandler_1.default]; |
@@ -97,4 +97,9 @@ "use strict"; | ||
nodePath.get('arguments', 0, 'properties').each((element) => { | ||
if (bt.isObjectProperty(element.node) && bt.isIdentifier(element.node.key)) { | ||
buildEventDescriptor(element.node.key.name, element); | ||
if (bt.isObjectProperty(element.node)) { | ||
if (bt.isIdentifier(element.node.key)) { | ||
buildEventDescriptor(element.node.key.name, element); | ||
} | ||
else if (bt.isStringLiteral(element.node.key)) { | ||
buildEventDescriptor(element.node.key.value, element); | ||
} | ||
} | ||
@@ -101,0 +106,0 @@ }); |
@@ -15,2 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const vitest_1 = require("vitest"); | ||
const babel_parser_1 = __importDefault(require("../babel-parser")); | ||
@@ -60,4 +61,4 @@ const resolveExportedComponent_1 = __importDefault(require("../utils/resolveExportedComponent")); | ||
const event = yield parserTest(src); | ||
expect(documentation.getEventDescriptor).toHaveBeenCalledWith('test'); | ||
expect(event).toMatchObject({ | ||
(0, vitest_1.expect)(documentation.getEventDescriptor).toHaveBeenCalledWith('test'); | ||
(0, vitest_1.expect)(event).toMatchObject({ | ||
description: 'this is a test event', | ||
@@ -77,4 +78,4 @@ name: 'mockEvent' | ||
const event = yield parserTest(src); | ||
expect(documentation.getEventDescriptor).toHaveBeenCalledWith('test'); | ||
expect(event).toMatchObject({ | ||
(0, vitest_1.expect)(documentation.getEventDescriptor).toHaveBeenCalledWith('test'); | ||
(0, vitest_1.expect)(event).toMatchObject({ | ||
description: 'no validation', | ||
@@ -101,4 +102,4 @@ name: 'mockEvent' | ||
const event = yield parserTest(src); | ||
expect(documentation.getEventDescriptor).toHaveBeenCalledWith('submit'); | ||
expect(event).toMatchObject({ | ||
(0, vitest_1.expect)(documentation.getEventDescriptor).toHaveBeenCalledWith('submit'); | ||
(0, vitest_1.expect)(event).toMatchObject({ | ||
description: 'with validation', | ||
@@ -124,5 +125,5 @@ name: 'mockEvent' | ||
const event = yield parserTest(src); | ||
expect(documentation.getEventDescriptor).toHaveBeenCalledWith('cancel'); | ||
expect(documentation.getEventDescriptor).toHaveBeenCalledWith('save'); | ||
expect(event).toMatchObject({ | ||
(0, vitest_1.expect)(documentation.getEventDescriptor).toHaveBeenCalledWith('cancel'); | ||
(0, vitest_1.expect)(documentation.getEventDescriptor).toHaveBeenCalledWith('save'); | ||
(0, vitest_1.expect)(event).toMatchObject({ | ||
description: 'Save the world', | ||
@@ -144,4 +145,4 @@ name: 'mockEvent' | ||
const event = yield parserTest(src); | ||
expect(documentation.getEventDescriptor).toHaveBeenCalledWith('save'); | ||
expect(event).toMatchObject({ | ||
(0, vitest_1.expect)(documentation.getEventDescriptor).toHaveBeenCalledWith('save'); | ||
(0, vitest_1.expect)(event).toMatchObject({ | ||
description: 'Save the world', | ||
@@ -158,4 +159,4 @@ name: 'mockEvent' | ||
const event = yield parserTest(src); | ||
expect(documentation.getEventDescriptor).toHaveBeenCalledWith('save'); | ||
expect(event).toMatchObject({ | ||
(0, vitest_1.expect)(documentation.getEventDescriptor).toHaveBeenCalledWith('save'); | ||
(0, vitest_1.expect)(event).toMatchObject({ | ||
type: { names: ['number'] } | ||
@@ -179,4 +180,4 @@ }); | ||
const event = yield parserTest(src); | ||
expect(documentation.getEventDescriptor).toHaveBeenCalledWith('save'); | ||
expect(event).toMatchObject({ | ||
(0, vitest_1.expect)(documentation.getEventDescriptor).toHaveBeenCalledWith('save'); | ||
(0, vitest_1.expect)(event).toMatchObject({ | ||
properties: [ | ||
@@ -193,3 +194,14 @@ { | ||
})); | ||
it('should handle event definitions wrapped in double quotes', () => __awaiter(void 0, void 0, void 0, function* () { | ||
const src = ` | ||
const emit = defineEmits({ | ||
native: null, | ||
"double-quotes": null, | ||
}); | ||
`; | ||
yield parserTest(src); | ||
(0, vitest_1.expect)(documentation.getEventDescriptor).toHaveBeenCalledWith('native'); | ||
(0, vitest_1.expect)(documentation.getEventDescriptor).toHaveBeenCalledWith('double-quotes'); | ||
})); | ||
}); | ||
}); |
{ | ||
"name": "vue-docgen-api", | ||
"version": "4.56.0", | ||
"version": "4.56.2", | ||
"description": "Toolbox to extract information from Vue component files for documentation generation purposes.", | ||
@@ -38,3 +38,3 @@ "homepage": "https://vue-styleguidist.github.io", | ||
"ts-map": "^1.0.3", | ||
"vue-inbrowser-compiler-independent-utils": "^4.52.0" | ||
"vue-inbrowser-compiler-independent-utils": "^4.56.2" | ||
}, | ||
@@ -41,0 +41,0 @@ "devDependencies": { |
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
493752
11603