Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-docgen-api

Package Overview
Dependencies
Maintainers
3
Versions
271
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-docgen-api - npm Package Compare versions

Comparing version 4.38.3 to 4.39.0

dist/utils/resolveLocal.d.ts

4

dist/parse-script.d.ts
import * as bt from '@babel/types';
import { NodePath } from 'ast-types/lib/node-path';
import Map from 'ts-map';
import Documentation from './Documentation';
import { ParseOptions } from './parse';
export declare type Handler = (doc: Documentation, componentDefinition: NodePath, ast: bt.File, opt: ParseOptions) => Promise<void>;
export default function parseScript(source: string, preHandlers: Handler[], handlers: Handler[], options: ParseOptions, documentation?: Documentation, forceSingleExport?: boolean): Promise<Documentation[] | undefined>;
export default function parseScript(source: string, options: ParseOptions, documentation?: Documentation, forceSingleExport?: boolean): Promise<Documentation[] | undefined>;
export declare function addDefaultAndExecuteHandlers(componentDefinitions: Map<string, NodePath>, ast: bt.File, options: ParseOptions, documentation?: Documentation, forceSingleExport?: boolean): Promise<Documentation[] | undefined>;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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) {

@@ -38,2 +57,7 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -43,2 +67,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
exports.addDefaultAndExecuteHandlers = void 0;
var recast_1 = require("recast");

@@ -50,4 +75,5 @@ var babel_parser_1 = __importDefault(require("./babel-parser"));

var documentRequiredComponents_1 = __importDefault(require("./utils/documentRequiredComponents"));
var script_handlers_1 = __importStar(require("./script-handlers"));
var ERROR_MISSING_DEFINITION = 'No suitable component definition found';
function parseScript(source, preHandlers, handlers, options, documentation, forceSingleExport) {
function parseScript(source, options, documentation, forceSingleExport) {
if (forceSingleExport === void 0) { forceSingleExport = false; }

@@ -82,3 +108,3 @@ return __awaiter(this, void 0, void 0, function () {

_b.label = 2;
case 2: return [2 /*return*/, executeHandlers(preHandlers, handlers, componentDefinitions, documentation, ast, options, forceSingleExport)];
case 2: return [2 /*return*/, addDefaultAndExecuteHandlers(componentDefinitions, ast, options, documentation, forceSingleExport)];
}

@@ -89,3 +115,9 @@ });

exports.default = parseScript;
function executeHandlers(preHandlers, localHandlers, componentDefinitions, documentation, ast, opt, forceSingleExport) {
function addDefaultAndExecuteHandlers(componentDefinitions, ast, options, documentation, forceSingleExport) {
if (forceSingleExport === void 0) { forceSingleExport = false; }
var handlers = options.scriptHandlers || __spreadArray(__spreadArray([], script_handlers_1.default), (options.addScriptHandlers || []));
return executeHandlers(options.scriptPreHandlers || script_handlers_1.preHandlers, handlers, componentDefinitions, ast, options, forceSingleExport, documentation);
}
exports.addDefaultAndExecuteHandlers = addDefaultAndExecuteHandlers;
function executeHandlers(preHandlers, localHandlers, componentDefinitions, ast, opt, forceSingleExport, documentation) {
return __awaiter(this, void 0, void 0, function () {

@@ -119,4 +151,6 @@ var compDefs, docs;

_a.sent();
if (!(typeof handler === 'function')) return [3 /*break*/, 3];
return [4 /*yield*/, handler(doc, compDef, ast, opt)];
case 2: return [2 /*return*/, _a.sent()];
case 3: return [2 /*return*/];
}

@@ -123,0 +157,0 @@ });

@@ -57,7 +57,2 @@ "use strict";

};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -72,3 +67,2 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

var parse_script_1 = __importDefault(require("./parse-script"));
var script_handlers_1 = __importStar(require("./script-handlers"));
var parseSFC_1 = __importDefault(require("./parseSFC"));

@@ -113,3 +107,3 @@ var read = util_1.promisify(fs_1.readFile);

return __awaiter(this, void 0, void 0, function () {
var singleFileComponent, docs, scriptHandlers, displayName, dirName;
var singleFileComponent, docs, displayName, dirName;
return __generator(this, function (_a) {

@@ -134,8 +128,6 @@ switch (_a.label) {

case 2:
scriptHandlers = opt.scriptHandlers || __spreadArray(__spreadArray([], script_handlers_1.default), (opt.addScriptHandlers || []));
opt.lang = /\.tsx?$/i.test(path.extname(opt.filePath)) ? 'ts' : 'js';
return [4 /*yield*/, parse_script_1.default(source, opt.scriptPreHandlers || script_handlers_1.preHandlers, scriptHandlers, opt, documentation, documentation !== undefined)];
return [4 /*yield*/, parse_script_1.default(source, opt, documentation, documentation !== undefined)];
case 3:
docs =
(_a.sent()) || [];
docs = (_a.sent()) || [];
if (docs.length === 1 && !docs[0].get('displayName')) {

@@ -142,0 +134,0 @@ displayName = path.basename(opt.filePath).replace(/\.\w+$/, '');

@@ -75,3 +75,2 @@ "use strict";

var parse_script_1 = __importDefault(require("./parse-script"));
var script_handlers_1 = __importStar(require("./script-handlers"));
var makePathResolver_1 = __importDefault(require("./utils/makePathResolver"));

@@ -82,3 +81,3 @@ var read = util_1.promisify(fs_1.readFile);

return __awaiter(this, void 0, void 0, function () {
var documentation, pathResolver, parts, extTemplSrc, extTemplSrcAbs, extTemplSource, _c, addTemplateHandlers, scriptSource, extSrc, extSrcAbs, extSource, _d, docsBlocks, scriptHandlers, docs, _e, displayName, dirName;
var documentation, pathResolver, parts, extTemplSrc, extTemplSrcAbs, extTemplSource, _c, addTemplateHandlers, scriptSource, extSrc, extSrcAbs, extSource, _d, docsBlocks, docs, _e, displayName, dirName;
return __generator(this, function (_f) {

@@ -157,5 +156,4 @@ switch (_f.label) {

}
scriptHandlers = opt.scriptHandlers || __spreadArray(__spreadArray([], script_handlers_1.default), (opt.addScriptHandlers || []));
if (!scriptSource) return [3 /*break*/, 11];
return [4 /*yield*/, parse_script_1.default(scriptSource, opt.scriptPreHandlers || script_handlers_1.preHandlers, scriptHandlers, opt, documentation, initialDoc !== undefined)];
return [4 /*yield*/, parse_script_1.default(scriptSource, opt, documentation, initialDoc !== undefined)];
case 10:

@@ -162,0 +160,0 @@ _e = (_f.sent()) || [];

@@ -8,2 +8,2 @@ import { NodePath } from 'ast-types/lib/node-path';

*/
export default function propHandler(documentation: Documentation, path: NodePath): Promise<void>;
export default function componentHandler(documentation: Documentation, path: NodePath): Promise<void>;

@@ -35,3 +35,3 @@ "use strict";

*/
function propHandler(documentation, path) {
function componentHandler(documentation, path) {
// deal with functional flag

@@ -95,2 +95,2 @@ if (bt.isObjectExpression(path.node)) {

}
exports.default = propHandler;
exports.default = componentHandler;
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

@@ -64,2 +75,4 @@ if (k2 === undefined) k2 = k;

var documentRequiredComponents_1 = __importDefault(require("../utils/documentRequiredComponents"));
var resolveLocal_1 = __importDefault(require("../utils/resolveLocal"));
var parse_script_1 = require("../parse-script");
/**

@@ -73,3 +86,3 @@ * Returns documentation of the component referenced in the extends property of the component

return __awaiter(this, void 0, void 0, function () {
var extendsVariableName, extendsFilePath;
var extendsVariableName, variablesResolvedToCurrentFile, extendsFilePath;
return __generator(this, function (_a) {

@@ -83,7 +96,17 @@ switch (_a.label) {

}
variablesResolvedToCurrentFile = resolveLocal_1.default(astPath, [extendsVariableName]);
if (!variablesResolvedToCurrentFile.get(extendsVariableName)) return [3 /*break*/, 2];
return [4 /*yield*/, parse_script_1.addDefaultAndExecuteHandlers(variablesResolvedToCurrentFile, astPath, __assign(__assign({}, opt), { nameFilter: [extendsVariableName] }), documentation)];
case 1:
_a.sent();
return [3 /*break*/, 4];
case 2:
extendsFilePath = resolveRequired_1.default(astPath, [extendsVariableName]);
// get each doc for each mixin using parse
return [4 /*yield*/, documentRequiredComponents_1.default(documentation, extendsFilePath, 'extends', opt)];
case 1:
case 3:
// get each doc for each mixin using parse
_a.sent();
return [2 /*return*/];
_a.label = 4;
case 4: return [2 /*return*/];
}

@@ -90,0 +113,0 @@ });

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

@@ -65,2 +76,4 @@ if (k2 === undefined) k2 = k;

var getProperties_1 = __importDefault(require("./utils/getProperties"));
var resolveLocal_1 = __importDefault(require("../utils/resolveLocal"));
var parse_script_1 = require("../parse-script");
/**

@@ -78,3 +91,4 @@ * Look in the mixin section of a component.

return __awaiter(this, void 0, void 0, function () {
var mixinVariableNames, mixinVarToFilePath;
var mixinVariableNames, variablesResolvedToCurrentFile, mixinVarToFilePath;
var _this = this;
return __generator(this, function (_a) {

@@ -87,7 +101,27 @@ switch (_a.label) {

}
variablesResolvedToCurrentFile = resolveLocal_1.default(astPath, mixinVariableNames);
mixinVarToFilePath = resolveRequired_1.default(astPath, mixinVariableNames);
// get each doc for each mixin using parse
return [4 /*yield*/, documentRequiredComponents_1.default(documentation, mixinVarToFilePath, 'mixin', opt)];
return [4 /*yield*/, mixinVariableNames.reduce(function (_, varName) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, _];
case 1:
_a.sent();
if (!variablesResolvedToCurrentFile.get(varName)) return [3 /*break*/, 3];
return [4 /*yield*/, parse_script_1.addDefaultAndExecuteHandlers(variablesResolvedToCurrentFile, astPath, __assign(__assign({}, opt), { nameFilter: [varName] }), documentation)];
case 2:
_a.sent();
return [3 /*break*/, 5];
case 3:
// get each doc for each mixin using parse
return [4 /*yield*/, documentRequiredComponents_1.default(documentation, mixinVarToFilePath, 'mixin', __assign(__assign({}, opt), { nameFilter: [varName] }))];
case 4:
// get each doc for each mixin using parse
_a.sent();
_a.label = 5;
case 5: return [2 /*return*/];
}
});
}); }, Promise.resolve())];
case 1:
// get each doc for each mixin using parse
_a.sent();

@@ -94,0 +128,0 @@ return [2 /*return*/];

{
"name": "vue-docgen-api",
"version": "4.38.3",
"version": "4.39.0",
"description": "Toolbox to extract information from Vue component files for documentation generation purposes.",

@@ -41,3 +41,3 @@ "homepage": "https://vue-styleguidist.github.io",

"ts-map": "^1.0.3",
"vue-inbrowser-compiler-utils": "^4.38.3"
"vue-inbrowser-compiler-utils": "^4.39.0"
},

@@ -54,3 +54,3 @@ "devDependencies": {

},
"gitHead": "33025057d9e3dfd88f2ae17d6b51d4d4fc5ea5d2"
"gitHead": "7810971dde12f93a4d7909a4575afd0e621e2566"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc