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.43.0 to 4.43.1

4

dist/parse-script.js

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

if (!ast) {
throw new Error("Unable to parse empty file \"" + options.filePath + "\"");
throw new Error("Unable to parse empty file \"".concat(options.filePath, "\""));
}

@@ -104,3 +104,3 @@ _a = (0, resolveExportedComponent_1.default)(ast), componentDefinitions = _a[0], ievSet = _a[1];

if (!docs.length) {
throw new Error(ERROR_MISSING_DEFINITION + " on \"" + options.filePath + "\"");
throw new Error("".concat(ERROR_MISSING_DEFINITION, " on \"").concat(options.filePath, "\""));
}

@@ -107,0 +107,0 @@ else {

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

e_1 = _a.sent();
throw Error("Could not read file " + opt.filePath);
throw Error("Could not read file ".concat(opt.filePath));
case 3: return [2 /*return*/];

@@ -93,0 +93,0 @@ }

@@ -84,5 +84,5 @@ "use strict";

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

@@ -101,3 +101,3 @@ documentation = initialDoc;

case 1:
_c = _f.sent();
_c = _d.sent();
return [3 /*break*/, 3];

@@ -107,3 +107,3 @@ case 2:

_c = false;
_f.label = 3;
_d.label = 3;
case 3:

@@ -114,3 +114,3 @@ extTemplSource = _c;

}
_f.label = 4;
_d.label = 4;
case 4:

@@ -120,24 +120,60 @@ addTemplateHandlers = opt.addTemplateHandlers || [];

(0, parse_template_1.default)(parts.template, documentation, __spreadArray(__spreadArray([], template_handlers_1.default, true), addTemplateHandlers, true), opt);
_f.label = 5;
_d.label = 5;
case 5:
scriptSource = parts.script ? parts.script.content : undefined;
extSrc = parts && parts.script && parts.script.attrs ? parts.script.attrs.src : false;
if (!(extSrc && typeof extSrc === 'string')) return [3 /*break*/, 9];
if (parts.customBlocks) {
documentation = documentation || new Documentation_1.default(opt.filePath);
docsBlocks = parts.customBlocks
.filter(function (block) { return block.type === 'docs' && block.content && block.content.length; })
.map(function (block) { return block.content.trim(); });
if (docsBlocks.length) {
documentation.setDocsBlocks(docsBlocks);
}
}
docs = documentation ? [documentation] : [];
if (!parts.scriptSetup) return [3 /*break*/, 6];
return [3 /*break*/, 8];
case 6:
if (!parts.script) return [3 /*break*/, 8];
return [4 /*yield*/, parseScriptTag(parts.script, pathResolver, opt, documentation, initialDoc !== undefined)];
case 7:
docs = _d.sent();
_d.label = 8;
case 8:
if (documentation && !documentation.get('displayName')) {
displayName = path.basename(opt.filePath).replace(/\.\w+$/, '');
dirName = path.basename(path.dirname(opt.filePath));
documentation.set('displayName', displayName.toLowerCase() === 'index' ? dirName : displayName);
}
return [2 /*return*/, docs];
}
});
});
}
exports.default = parseSFC;
function parseScriptTag(scriptTag, pathResolver, opt, documentation, forceSingleExport) {
return __awaiter(this, void 0, void 0, function () {
var scriptSource, extSrc, extSrcAbs, extSource, _a, docs, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
scriptSource = scriptTag ? scriptTag.content : undefined;
extSrc = scriptTag && scriptTag.attrs ? scriptTag.attrs.src : false;
if (!(extSrc && typeof extSrc === 'string')) return [3 /*break*/, 4];
extSrcAbs = pathResolver(extSrc);
if (!extSrcAbs) return [3 /*break*/, 7];
if (!extSrcAbs) return [3 /*break*/, 2];
return [4 /*yield*/, read(extSrcAbs, {
encoding: 'utf-8'
})];
case 6:
_d = _f.sent();
return [3 /*break*/, 8];
case 7:
_d = '';
_f.label = 8;
case 8:
extSource = _d;
case 1:
_a = _c.sent();
return [3 /*break*/, 3];
case 2:
_a = '';
_c.label = 3;
case 3:
extSource = _a;
if (extSource.length) {
scriptSource = extSource;
opt.lang =
(parts.script && parts.script.attrs && /^tsx?$/.test(parts.script.attrs.lang)) ||
(scriptTag && scriptTag.attrs && /^tsx?$/.test(scriptTag.attrs.lang)) ||
/\.tsx?$/i.test(extSrc)

@@ -147,35 +183,21 @@ ? 'ts'

}
_f.label = 9;
case 9:
_c.label = 4;
case 4:
opt.lang =
(parts.script && parts.script.attrs && /^tsx?$/.test(parts.script.attrs.lang)) ||
(scriptTag && scriptTag.attrs && /^tsx?$/.test(scriptTag.attrs.lang)) ||
(typeof extSrc === 'string' && /\.tsx?$/i.test(extSrc))
? 'ts'
: 'js';
if (parts.customBlocks) {
documentation = documentation || new Documentation_1.default(opt.filePath);
docsBlocks = parts.customBlocks
.filter(function (block) { return block.type === 'docs' && block.content && block.content.length; })
.map(function (block) { return block.content.trim(); });
if (docsBlocks.length) {
documentation.setDocsBlocks(docsBlocks);
}
}
if (!scriptSource) return [3 /*break*/, 11];
return [4 /*yield*/, (0, parse_script_1.default)(scriptSource, opt, documentation, initialDoc !== undefined)];
case 10:
_e = (_f.sent()) || [];
return [3 /*break*/, 12];
case 11:
_e = documentation
if (!scriptSource) return [3 /*break*/, 6];
return [4 /*yield*/, (0, parse_script_1.default)(scriptSource, opt, documentation, forceSingleExport)];
case 5:
_b = (_c.sent()) || [];
return [3 /*break*/, 7];
case 6:
_b = documentation
? [documentation]
: [];
_f.label = 12;
case 12:
docs = _e;
if (documentation && !documentation.get('displayName')) {
displayName = path.basename(opt.filePath).replace(/\.\w+$/, '');
dirName = path.basename(path.dirname(opt.filePath));
documentation.set('displayName', displayName.toLowerCase() === 'index' ? dirName : displayName);
}
_c.label = 7;
case 7:
docs = _b;
return [2 /*return*/, docs];

@@ -186,2 +208,1 @@ }

}
exports.default = parseSFC;

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

type: { names: ['undefined'] },
name: "<anonymous" + (args.length - i - 2) + ">"
name: "<anonymous".concat(args.length - i - 2, ">")
});

@@ -99,0 +99,0 @@ }

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

if (ret.name && ret.description) {
ret.description = ret.name + " " + ret.description;
ret.description = "".concat(ret.name, " ").concat(ret.description);
}

@@ -150,0 +150,0 @@ methodDescriptor.returns = ret;

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

if (typeDesc) {
var typedAST = (0, getTemplateExpressionAST_1.default)("const a:" + typeDesc.name);
var typedAST = (0, getTemplateExpressionAST_1.default)("const a:".concat(typeDesc.name));
var typeValues_1;

@@ -441,3 +441,3 @@ (0, recast_1.visit)(typedAST.program, {

// the function should be reconstructed as "old-school" function, because they have the same handling of "this", whereas arrow functions do not.
var rawValueParsed = "function(" + params + ") " + rawValue.trim();
var rawValueParsed = "function(".concat(params, ") ").concat(rawValue.trim());
propDescriptor.defaultValue = {

@@ -444,0 +444,0 @@ func: true,

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

if (simpleVBind && (0, guards_1.isSimpleExpressionNode)(simpleVBind.exp)) {
var ast = parser.parse("() => (" + simpleVBind.exp.content + ")");
var ast = parser.parse("() => (".concat(simpleVBind.exp.content, ")"));
(0, recast_1.visit)(ast.program, {

@@ -93,3 +93,3 @@ visitObjectExpression: function (path) {

? b.arg.content
: "" + ((0, guards_1.isDirectiveNode)(b) ? 'v-' : '') + b.name;
: "".concat((0, guards_1.isDirectiveNode)(b) ? 'v-' : '').concat(b.name);
var bindingDesc = bindingDescriptors_1.filter(function (t) { return t.name === name; })[0];

@@ -96,0 +96,0 @@ acc.push(bindingDesc ? bindingDesc : { name: name, title: 'binding' });

@@ -23,5 +23,5 @@ "use strict";

var param = hasName || typeSlice.length ? { type: getTypeObjectFromTypeString(typeSlice) } : {};
content = content.replace("{" + typeSlice + "}", '');
content = content.replace("{".concat(typeSlice, "}"), '');
if (hasName) {
var nameSliceArray = /^ *(\w+)?/.exec(content);
var nameSliceArray = /^ *(\w[\w-]+)?/.exec(content);
if (nameSliceArray) {

@@ -31,3 +31,3 @@ param.name = nameSliceArray[1];

if (param.name) {
content = content.replace(new RegExp("^ *" + param.name), '');
content = content.replace(new RegExp("^ *".concat(param.name)), '');
}

@@ -34,0 +34,0 @@ }

@@ -11,10 +11,10 @@ "use strict";

// this allows for weird expressions like {[t]:val} to be parsed properly
return parser.parse(/^\{/.test(expression.trim()) ? "(() => (" + expression + "))()" : expression);
return parser.parse(/^\{/.test(expression.trim()) ? "(() => (".concat(expression, "))()") : expression);
}
catch (e) {
throw Error("Could not parse template expression:\n" + //
(expression + "\n") + //
("Err: " + e.message));
"".concat(expression, "\n") + //
"Err: ".concat(e.message));
}
}
exports.default = getTemplateExpressionAST;

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

f = f.replace('g', '');
var x = new RegExp(left + "|" + right, "g" + f);
var x = new RegExp("".concat(left, "|").concat(right), "g".concat(f));
var l = new RegExp(left, f.replace(/g/g, ''));

@@ -22,0 +22,0 @@ var a = [];

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

try {
finalPath = require.resolve("" + path + s, {
finalPath = require.resolve("".concat(path).concat(s), {
paths: from

@@ -25,3 +25,3 @@ });

try {
finalPath = require.resolve((0, path_1.join)(path, "index" + s), {
finalPath = require.resolve((0, path_1.join)(path, "index".concat(s)), {
paths: from

@@ -37,3 +37,3 @@ });

try {
finalPath = require.resolve((0, path_1.join)(from[i], "" + path + s));
finalPath = require.resolve((0, path_1.join)(from[i], "".concat(path).concat(s)));
if (finalPath.length) {

@@ -64,3 +64,3 @@ break;

// eslint-disable-next-line no-console
console.warn("Neither '" + path + ".vue' nor '" + path + ".js(x)' or '" + path + "/index.js(x)' or '" + path + "/index.ts(x)' could be found in '" + from + "'");
console.warn("Neither '".concat(path, ".vue' nor '").concat(path, ".js(x)' or '").concat(path, "/index.js(x)' or '").concat(path, "/index.ts(x)' could be found in '").concat(from, "'"));
missing_files_cache_1.default[path] = true;

@@ -67,0 +67,0 @@ }

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

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

"ts-map": "^1.0.3",
"vue-inbrowser-compiler-utils": "^4.43.0"
"vue-inbrowser-compiler-utils": "^4.43.1"
},

@@ -53,5 +53,5 @@ "devDependencies": {

"vue-property-decorator": "7.3.0",
"vuetify": "2.5.8"
"vuetify": "2.6.1"
},
"gitHead": "8cc3f87b40979e539f1b44bcf7e2bd268b6548ae"
"gitHead": "7397cd17fc0ebaebaafce8d117b5738b241f228e"
}
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