Socket
Socket
Sign inDemoInstall

@capacitor/docgen

Package Overview
Dependencies
Maintainers
7
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor/docgen - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

dist/formatting.d.ts

77

dist/output.js

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

const path_1 = __importDefault(require("path"));
const formatting_1 = require("./formatting");
const util_1 = require("util");

@@ -100,4 +101,2 @@ const markdown_1 = require("./markdown");

}
o.push(`## API`);
o.push(``);
data.api.methods.forEach(m => {

@@ -133,3 +132,3 @@ o.push(methodsTable(data, m));

if (m.docs) {
o.push(m.docs);
o.push(formatting_1.formatDescription(data, m.docs));
o.push(``);

@@ -141,4 +140,4 @@ }

}
const ret = cleanTypes(data, m.returns);
if (ret.type && ret.type !== 'void' && ret.type !== 'Promise<void>') {
const ret = formatting_1.formatType(data, m.returns);
if (ret.type !== 'void' && ret.type !== 'Promise<void>') {
o.push(`**Returns:** ${ret.formatted}`);

@@ -162,4 +161,5 @@ o.push(``);

const nm = `**\`${p.name}\`**`;
const ty = cleanTypes(data, p.type);
t.addRow([nm, ty.formatted, p.docs]);
const ty = formatting_1.formatType(data, p.type);
const docs = formatting_1.formatDescription(data, p.docs);
t.addRow([nm, ty.formatted, docs]);
});

@@ -169,49 +169,2 @@ t.removeEmptyColumns();

}
function cleanTypes(data, c) {
const rtn = { type: '', formatted: '' };
if (typeof c === 'string') {
c = c.replace(/\n/g, ' ').trim();
while (c.includes(' ')) {
c = c.replace(/ /g, ' ');
}
const isAsync = c.startsWith(`Promise<`) && c.endsWith(`>`);
if (isAsync) {
c = c.substring(`Promise<`.length);
c = c.substring(0, c.length - 1);
}
c = c
.split('|')
.map(c => c.trim())
.filter(c => c !== 'undefined')
.map(c => linkType(data, c))
.join(` | `);
if (c === '') {
return rtn;
}
if (isAsync) {
rtn.type = `Promise<${c}>`;
rtn.formatted = `Promise&lt;${c}&gt;`;
}
else {
rtn.type = c;
rtn.formatted = c;
}
rtn.formatted = `<code>${rtn.formatted}</code>`;
}
return rtn;
}
function linkType(data, s) {
if (s === '') {
return '';
}
const i = data.interfaces.find(i => i.name === s);
if (i) {
return `<a href="#${i.slug}">${s}</a>`;
}
const en = data.enums.find(en => en.name === s);
if (en) {
return `<a href="#${en.slug}">${s}</a>`;
}
return s;
}
function interfaceTable(data, i) {

@@ -223,3 +176,3 @@ const o = [];

if (i.docs) {
o.push(`${i.docs}`);
o.push(`${formatting_1.formatDescription(data, i.docs)}`);
o.push(``);

@@ -234,4 +187,4 @@ }

`**\`${m.name}\`**`,
cleanTypes(data, m.type).formatted,
m.docs,
formatting_1.formatType(data, m.type).formatted,
formatting_1.formatDescription(data, m.docs),
defaultValue ? `<code>${defaultValue}</code>` : '',

@@ -249,3 +202,7 @@ getTagText(m.tags, 'since'),

i.methods.forEach(m => {
t.addRow([`**${m.name}**`, m.signature, m.docs]);
t.addRow([
`**${m.name}**`,
formatting_1.formatDescription(data, m.signature),
formatting_1.formatDescription(data, m.docs)
]);
});

@@ -269,4 +226,4 @@ t.removeEmptyColumns();

`**\`${m.name}\`**`,
cleanTypes(data, m.value).formatted,
m.docs,
formatting_1.formatType(data, m.value).formatted,
formatting_1.formatDescription(data, m.docs),
getTagText(m.tags, 'since'),

@@ -273,0 +230,0 @@ ]);

{
"name": "@capacitor/docgen",
"version": "0.0.9",
"version": "0.0.10",
"description": "Docs Readme Markdown and JSON Generator for Capacitor Plugins",

@@ -5,0 +5,0 @@ "keywords": [

@@ -21,5 +21,5 @@ # @capacitor/docgen

The readme file can be formatted however you'd like. Just insert
the HTML placeholder comments where the index of the API
methods, and the API docs should go.
The readme file can be formatted however you'd like. Just insert
the docgen placeholder elements where the index of the API methods,
and the API docs should go.

@@ -32,5 +32,5 @@ Below is an index of all the methods available.

Manage your readme content however you'd like, and on every docgen
rebuild it will leave your original content as is, but update the
HTML placeholder comments with the updated generated docs.
Manage your readme content however, and on every `docgen` rebuild
it will leave the original content as is, but update the inner text
of the docgen placeholder elements with the updated generated docs.

@@ -37,0 +37,0 @@ <docgen-api></docgen-api>

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