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

@tinymce/moxiedoc

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinymce/moxiedoc - npm Package Compare versions

Comparing version 0.2.2-feature.20220613064048311.shaeb474e8 to 0.2.2-feature.20220708015625385.sha44d977d

3

dist/lib/api.d.ts

@@ -8,3 +8,6 @@ import { Namespace } from './namespace';

private _rootNamespaces;
private _structure;
static getNamespaceFromFullName(fullName: string): string;
setStructure(legacy: string): void;
getStructure(): string;
getRootTypes(): Type[];

@@ -11,0 +14,0 @@ addNamespace(namespace: Namespace): Namespace;

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

this._rootNamespaces = [];
this._structure = 'flat';
}

@@ -18,2 +19,8 @@ static getNamespaceFromFullName(fullName) {

}
setStructure(legacy) {
this._structure = legacy;
}
getStructure() {
return this._structure;
}
getRootTypes() {

@@ -20,0 +27,0 @@ return this._rootTypes;

@@ -17,2 +17,3 @@ #! /usr/bin/env node

.option('--fail-on-warning', 'fail if warnings are produced')
.option('-l, <name>/--legacy', 'output file structure, default: flat')
.parse(process.argv);

@@ -19,0 +20,0 @@ commander_1.program.on('--help', () => {

@@ -9,2 +9,3 @@ export interface MoxiedocSettings {

failOnWarning?: boolean;
legacy?: string;
}

@@ -11,0 +12,0 @@ export interface MoxiedocResult {

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

settings.template = settings.template || 'cli';
settings.legacy = settings.legacy || 'flat';
if (settings.verbose) {

@@ -76,2 +77,3 @@ Reporter.setLevel(2 /* INFO */);

});
builder.api.setStructure(settings.legacy);
builder.api.removePrivates();

@@ -78,0 +80,0 @@ if (!settings.dry) {

6

dist/templates/antora/antora.converter.d.ts

@@ -6,4 +6,6 @@ export interface PageOutput {

}
declare const convert: (pages: PageOutput[][]) => PageOutput[][];
export { convert };
declare const getFilePath: (structure: string) => Function;
declare const generateXref: (name: string, structure: string) => string;
declare const convert: (pages: PageOutput[][], structure: string) => PageOutput[][];
export { getFilePath, generateXref, convert };
//# sourceMappingURL=antora.converter.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convert = void 0;
// TODO: we can pass this through later
const basePath = 'apis/';
exports.convert = exports.generateXref = exports.getFilePath = void 0;
const hasValue = (x) => {

@@ -65,6 +63,23 @@ // empty helper for strings, objects, arrays

const filename = name.toLowerCase() === 'tinymce' ? 'tinymce.root' : name.toLowerCase();
return basePath + filename + '.adoc';
return 'apis/' + filename + '.adoc';
};
const generateTypeXref = (type) => type.includes('tinymce', 0) ? 'xref:' + getFilePathFromFullName(type) + '[' + getNameFromFullName(type) + ']' : type;
const generateDefinedByXref = (definedBy) => 'xref:' + getFilePathFromFullName(definedBy) + '[' + getNameFromFullName(definedBy) + ']';
const getFilePathFromFullNameLegacy = (name) => {
const folder = getNameFromFullName(name) + '/';
const filename = name.toLowerCase() === 'tinymce' ? 'root_tinymce' : name.toLowerCase();
return 'api/' + folder + filename + '.adoc';
};
const getFilePath = (structure) => {
switch (structure) {
case 'flat':
return getFilePathFromFullName;
case 'legacy':
return getFilePathFromFullNameLegacy;
default:
return getFilePathFromFullName;
}
};
exports.getFilePath = getFilePath;
const generateXref = (name, structure) => 'xref:' + getFilePath(structure)(name) + '[' + getNameFromFullName(name) + ']';
exports.generateXref = generateXref;
const generateTypeXref = (type, structure) => type.includes('tinymce', 0) ? generateXref(type, structure) : type;
const generateExamples = (examples) => {

@@ -80,18 +95,17 @@ let tmp = '\n==== Examples\n';

};
const generateParameters = (params) => {
const generateParameters = (params, structure) => {
let tmp = '\n==== Parameters\n';
params.forEach((param) => {
tmp += '\n* `' + param.name + ' (' + param.types.map(generateTypeXref).join(' | ') + ')` - ' + cleanup(param.desc);
tmp += '\n* `' + param.name + ' (' + param.types.map((type) => generateTypeXref(type, structure)).join(' | ') + ')` - ' + cleanup(param.desc);
});
return tmp + '\n';
};
const generateReturn = (ret) => {
const generateReturn = (ret, structure) => {
let tmp = '\n==== Return value\n';
ret.types.forEach((type) => {
tmp += '\n* `' + generateTypeXref(type) + '` - ' + cleanup(ret.desc);
tmp += '\n* `' + generateTypeXref(type, structure) + '` - ' + cleanup(ret.desc);
});
tmp += '\n';
return tmp;
return tmp += '\n';
};
const buildSummary = (data) => {
const buildSummary = (data, structure) => {
let tmp = '';

@@ -108,5 +122,5 @@ // settings

tmp += '|' + item.name;
tmp += '|`' + generateTypeXref(item.dataTypes[0]) + '`';
tmp += '|`' + generateTypeXref(item.dataTypes[0], structure) + '`';
tmp += '|' + cleanup(item.desc);
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n';
tmp += '|`' + generateXref(item.definedBy, structure) + '`\n';
});

@@ -124,5 +138,5 @@ tmp += '|===\n';

tmp += '|' + item.name;
tmp += '|`' + generateTypeXref(item.dataTypes[0]) + '`';
tmp += '|`' + generateTypeXref(item.dataTypes[0], structure) + '`';
tmp += '|' + cleanup(item.desc);
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n';
tmp += '|`' + generateXref(item.definedBy, structure) + '`\n';
});

@@ -141,3 +155,3 @@ tmp += '|===\n';

tmp += '|' + cleanup(item.desc);
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n';
tmp += '|`' + generateXref(item.definedBy, structure) + '`\n';
});

@@ -154,3 +168,3 @@ tmp += '|===\n';

data.methods.forEach((item) => {
tmp += '|xref:#' + item.name + '[' + item.name + '()]|' + cleanup(item.desc) + '|`' + generateDefinedByXref(item.definedBy) + '`\n';
tmp += '|xref:#' + item.name + '[' + item.name + '()]|' + cleanup(item.desc) + '|`' + generateXref(item.definedBy, structure) + '`\n';
});

@@ -170,3 +184,3 @@ tmp += '|===\n';

tmp += '|' + cleanup(item.desc);
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n';
tmp += '|`' + generateXref(item.definedBy, structure) + '`\n';
});

@@ -177,3 +191,3 @@ tmp += '|===\n';

};
const buildConstructor = (data) => {
const buildConstructor = (data, structure) => {
let tmp = '';

@@ -195,6 +209,6 @@ if (hasValue(data.constructors)) {

if (hasValue(constructor.params)) {
tmp += generateParameters(constructor.params);
tmp += generateParameters(constructor.params, structure);
}
if (hasValue(constructor.return) && hasValue(constructor.return.types)) {
tmp += generateReturn(constructor.return);
tmp += generateReturn(constructor.return, structure);
}

@@ -205,3 +219,3 @@ });

};
const buildMethods = (data) => {
const buildMethods = (data, structure) => {
let tmp = '';

@@ -223,6 +237,6 @@ if (hasValue(data.methods)) {

if (hasValue(method.params)) {
tmp += generateParameters(method.params);
tmp += generateParameters(method.params, structure);
}
if (hasValue(method.return) && hasValue(method.return.types)) {
tmp += generateReturn(method.return);
tmp += generateReturn(method.return, structure);
}

@@ -234,3 +248,3 @@ tmp += `\n'''\n`;

};
const buildEvents = (data) => {
const buildEvents = (data, structure) => {
let tmp = '';

@@ -246,3 +260,3 @@ // untested snippet, no events data

if (hasValue(event.params)) {
tmp += generateParameters(event.params);
tmp += generateParameters(event.params, structure);
}

@@ -253,3 +267,3 @@ });

};
const convert = (pages) => pages.map((page) => {
const convert = (pages, structure) => pages.map((page) => {
// page[0] is json

@@ -284,3 +298,3 @@ // page[1] is adoc

data.borrows.forEach((item) => {
tmp += '\n * xref:' + basePath + item.toLowerCase() + '.adoc[' + item + ']\n';
tmp += '\n * ' + generateXref(item, structure) + '\n';
});

@@ -299,6 +313,6 @@ }

}
tmp += buildSummary(data);
tmp += buildConstructor(data);
tmp += buildMethods(data);
tmp += buildEvents(data);
tmp += buildSummary(data, structure);
tmp += buildConstructor(data, structure);
tmp += buildMethods(data, structure);
tmp += buildEvents(data, structure);
// return the applied antora page mutation

@@ -305,0 +319,0 @@ page[1] = Object.assign(Object.assign({}, page[1]), { content: tmp });

@@ -11,16 +11,12 @@ "use strict";

const BASE_PATH = process.env.BASE_PATH || '/_data/antora';
// correlates to tinymce-docs antora path
const AntoraNavBaseDir = 'apis/';
const navToAdoc = (navyml) => {
// Api index page
const indexPage = navyml[0];
let adoc = '* ' + indexPage.title + '\n';
// generate API namespaces
const navLine = (name, level) => '*'.repeat(level) + ' ' + name + '\n';
const navToAdoc = (indexPage, structure, depth, level) => {
level = level || 1;
// Api index page top level or blank
let adoc = level === 1 ? navLine(indexPage.title, level) : '';
indexPage.pages.forEach((namespace) => {
// main namespace level navigation (namespace index)
adoc += '** ' + namespace.path + '\n';
namespace.pages.forEach((page) => {
// namespace level pages
adoc += '*** xref:' + AntoraNavBaseDir + page.path + '.adoc' + '[' + page.title + ']\n';
});
adoc += navLine(AntoraTemplate.generateXref(namespace.path, structure), level + 1);
if (level < depth) {
adoc += navToAdoc(namespace, structure, depth, level + 1);
}
});

@@ -44,3 +40,3 @@ return adoc;

*/
const getNavFile = (types) => {
const getNavFile = (types, structure) => {
const namespaces = getNamespacesFromTypes(types);

@@ -55,5 +51,6 @@ const pages = Object.entries(namespaces).map(([url, title]) => {

if (url === 'tinymce') {
const rootPath = structure === 'legacy' ? 'root_tinymce' : 'tinymce.root';
innerPages.unshift({
title: 'tinymce',
path: 'tinymce.root'
path: rootPath
});

@@ -104,24 +101,21 @@ }

memberData.definedBy = parentType.fullName;
if ('property' === memberData.type) {
data.properties.push(memberData);
return;
switch (memberData.type) {
case 'property':
data.properties.push(memberData);
return;
case 'setting':
data.settings.push(memberData);
return;
case 'constructor':
data.constructors.push(memberData);
memberData.signature = getSyntaxString(memberData);
return;
case 'method':
data.methods.push(memberData);
memberData.signature = getSyntaxString(memberData);
return;
case 'event':
data.events.push(memberData);
return;
}
if ('setting' === memberData.type) {
data.settings.push(memberData);
return;
}
if ('constructor' === memberData.type) {
data.constructors.push(memberData);
memberData.signature = getSyntaxString(memberData);
return;
}
if ('method' === memberData.type) {
data.methods.push(memberData);
memberData.signature = getSyntaxString(memberData);
return;
}
if ('event' === memberData.type) {
data.events.push(memberData);
return;
}
});

@@ -137,7 +131,7 @@ data.constructors = sortMembers(data.constructors);

type: 'json',
filename: createFileName(data, 'json'),
filename: ('_data/api/' + data.type + '_' + data.fullName.replace(/\./g, '_') + '.json').toLowerCase(),
content: JSON.stringify(data, null, ' ')
}, {
type: 'adoc',
filename: createFileName(data, 'adoc'),
filename: AntoraTemplate.getFilePath(root.getStructure())(data.fullName),
content: templateDelegate(data)

@@ -181,19 +175,2 @@ }];

/**
* [createFileName description]
* @param {[type]} data [description]
* @param {[type]} ext [description]
* @return {[type]} [description]
*/
const createFileName = (data, ext) => {
if ('adoc' === ext) {
if (data.fullName === 'tinymce') {
return (BASE_PATH + '/tinymce.root.adoc').toLowerCase();
}
return (BASE_PATH + '/' + data.fullName + '.adoc').toLowerCase();
}
else if ('json' === ext) {
return ('_data/api/' + data.type + '_' + data.fullName.replace(/\./g, '_') + '.json').toLowerCase();
}
};
/**
* [addPageToArchive description]

@@ -237,2 +214,3 @@ * @param {[type]} page [description]

const memberTemplate = compileTemplate('member.handlebars');
const structure = root.getStructure();
// bind new archive to function

@@ -252,4 +230,5 @@ const addPage = addPageToArchive.bind(archive);

});
const nav = getNavFile(sortedTypes);
const adocNav = navToAdoc(nav);
const nav = getNavFile(sortedTypes, structure);
const indexPage = nav[0];
const adocNav = navToAdoc(indexPage, structure, 3);
addPage({

@@ -263,5 +242,14 @@ filename: '_data/nav.yml',

});
if (structure === 'legacy') {
indexPage.pages.forEach((namespace) => {
const indexNav = navToAdoc(namespace, structure, 2);
addPage({
filename: '_data/' + namespace.title + '_nav.adoc',
content: indexNav
});
});
}
// create all json and adoc for each item
const pages = sortedTypes.map(getMemberPages.bind(null, root, memberTemplate));
const convertedPages = AntoraTemplate.convert(pages);
const convertedPages = AntoraTemplate.convert(pages, structure);
flatten(convertedPages).forEach(addPage);

@@ -268,0 +256,0 @@ archive.saveAs(toPath, (err) => {

{
"name": "@tinymce/moxiedoc",
"version": "0.2.2-feature.20220613064048311.shaeb474e8",
"version": "0.2.2-feature.20220708015625385.sha44d977d",
"description": "A tool for generating API documentation",

@@ -5,0 +5,0 @@ "author": "Tiny Technologies, Inc",

@@ -10,2 +10,4 @@ import { Namespace } from './namespace';

private _structure: string = 'flat';
public static getNamespaceFromFullName(fullName: string): string {

@@ -17,2 +19,10 @@ const chunks = fullName.split('.');

public setStructure(legacy: string): void {
this._structure = legacy;
}
public getStructure(): string {
return this._structure;
}
public getRootTypes(): Type[] {

@@ -19,0 +29,0 @@ return this._rootTypes;

@@ -19,2 +19,3 @@ #! /usr/bin/env node

.option('--fail-on-warning', 'fail if warnings are produced')
.option('-l, <name>/--legacy', 'output file structure, default: flat')
.parse(process.argv);

@@ -21,0 +22,0 @@

@@ -20,2 +20,3 @@ import * as fs from 'fs';

failOnWarning?: boolean;
legacy?: string;
}

@@ -48,2 +49,3 @@

settings.template = settings.template || 'cli';
settings.legacy = settings.legacy || 'flat';

@@ -100,2 +102,4 @@ if (settings.verbose) {

builder.api.setStructure(settings.legacy);
builder.api.removePrivates();

@@ -116,2 +120,2 @@

process
};
};

@@ -10,5 +10,2 @@ import { Return } from '../../lib/member';

// TODO: we can pass this through later
const basePath = 'apis/';
const hasValue = <T>(x: T): x is NonNullable<T> => {

@@ -88,11 +85,30 @@ // empty helper for strings, objects, arrays

const filename = name.toLowerCase() === 'tinymce' ? 'tinymce.root' : name.toLowerCase();
return basePath + filename + '.adoc';
return 'apis/' + filename + '.adoc';
};
const generateTypeXref = (type: string): string =>
type.includes('tinymce', 0) ? 'xref:' + getFilePathFromFullName(type) + '[' + getNameFromFullName(type) + ']' : type;
const getFilePathFromFullNameLegacy = (name: string): string => {
const folder = getNameFromFullName(name) + '/';
const filename = name.toLowerCase() === 'tinymce' ? 'root_tinymce' : name.toLowerCase();
return 'api/' + folder + filename + '.adoc';
};
const generateDefinedByXref = (definedBy: string): string =>
'xref:' + getFilePathFromFullName(definedBy) + '[' + getNameFromFullName(definedBy) + ']';
const getFilePath = (structure: string): Function => {
switch (structure) {
case 'flat':
return getFilePathFromFullName;
case 'legacy':
return getFilePathFromFullNameLegacy;
default:
return getFilePathFromFullName;
}
};
const generateXref = (name: string, structure: string): string =>
'xref:' + getFilePath(structure)(name) + '[' + getNameFromFullName(name) + ']';
const generateTypeXref = (type: string, structure: string): string =>
type.includes('tinymce', 0) ? generateXref(type, structure) : type;
const generateExamples = (examples: Array<{ content: string }>): string => {

@@ -109,6 +125,6 @@ let tmp = '\n==== Examples\n';

const generateParameters = (params: Param[]): string => {
const generateParameters = (params: Param[], structure: string): string => {
let tmp = '\n==== Parameters\n';
params.forEach((param) => {
tmp += '\n* `' + param.name + ' (' + param.types.map(generateTypeXref).join(' | ') + ')` - ' + cleanup(param.desc);
tmp += '\n* `' + param.name + ' (' + param.types.map((type) => generateTypeXref(type, structure)).join(' | ') + ')` - ' + cleanup(param.desc);
});

@@ -118,12 +134,11 @@ return tmp + '\n';

const generateReturn = (ret: Return): string => {
const generateReturn = (ret: Return, structure: string): string => {
let tmp = '\n==== Return value\n';
ret.types.forEach((type) => {
tmp += '\n* `' + generateTypeXref(type) + '` - ' + cleanup(ret.desc);
tmp += '\n* `' + generateTypeXref(type, structure) + '` - ' + cleanup(ret.desc);
});
tmp += '\n';
return tmp;
return tmp += '\n';
};
const buildSummary = (data: Record<string, any>): string => {
const buildSummary = (data: Record<string, any>, structure: string): string => {
let tmp = '';

@@ -143,5 +158,5 @@

tmp += '|' + item.name;
tmp += '|`' + generateTypeXref(item.dataTypes[0]) + '`';
tmp += '|`' + generateTypeXref(item.dataTypes[0], structure) + '`';
tmp += '|' + cleanup(item.desc);
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n';
tmp += '|`' + generateXref(item.definedBy, structure) + '`\n';
});

@@ -162,5 +177,5 @@ tmp += '|===\n';

tmp += '|' + item.name;
tmp += '|`' + generateTypeXref(item.dataTypes[0]) + '`';
tmp += '|`' + generateTypeXref(item.dataTypes[0], structure) + '`';
tmp += '|' + cleanup(item.desc);
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n';
tmp += '|`' + generateXref(item.definedBy, structure) + '`\n';
});

@@ -182,3 +197,3 @@ tmp += '|===\n';

tmp += '|' + cleanup(item.desc);
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n';
tmp += '|`' + generateXref(item.definedBy, structure) + '`\n';
});

@@ -196,3 +211,3 @@ tmp += '|===\n';

data.methods.forEach((item) => {
tmp += '|xref:#' + item.name + '[' + item.name + '()]|' + cleanup(item.desc) + '|`' + generateDefinedByXref(item.definedBy) + '`\n';
tmp += '|xref:#' + item.name + '[' + item.name + '()]|' + cleanup(item.desc) + '|`' + generateXref(item.definedBy, structure) + '`\n';
});

@@ -215,3 +230,3 @@ tmp += '|===\n';

tmp += '|' + cleanup(item.desc);
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n';
tmp += '|`' + generateXref(item.definedBy, structure) + '`\n';
});

@@ -224,3 +239,3 @@ tmp += '|===\n';

const buildConstructor = (data: Record<string, any>): string => {
const buildConstructor = (data: Record<string, any>, structure: string): string => {
let tmp = '';

@@ -246,7 +261,7 @@

if (hasValue(constructor.params)) {
tmp += generateParameters(constructor.params);
tmp += generateParameters(constructor.params, structure);
}
if (hasValue(constructor.return) && hasValue(constructor.return.types)) {
tmp += generateReturn(constructor.return);
tmp += generateReturn(constructor.return, structure);
}

@@ -259,3 +274,3 @@ });

const buildMethods = (data: Record<string, any>): string => {
const buildMethods = (data: Record<string, any>, structure: string): string => {
let tmp = '';

@@ -280,7 +295,7 @@

if (hasValue(method.params)) {
tmp += generateParameters(method.params);
tmp += generateParameters(method.params, structure);
}
if (hasValue(method.return) && hasValue(method.return.types)) {
tmp += generateReturn(method.return);
tmp += generateReturn(method.return, structure);
}

@@ -295,3 +310,3 @@

const buildEvents = (data: Record<string, any>): string => {
const buildEvents = (data: Record<string, any>, structure: string): string => {
let tmp = '';

@@ -309,3 +324,3 @@

if (hasValue(event.params)) {
tmp += generateParameters(event.params);
tmp += generateParameters(event.params, structure);
}

@@ -318,3 +333,3 @@ });

const convert = (pages: PageOutput[][]): PageOutput[][] => pages.map((page) => {
const convert = (pages: PageOutput[][], structure: string): PageOutput[][] => pages.map((page) => {
// page[0] is json

@@ -353,3 +368,3 @@ // page[1] is adoc

data.borrows.forEach((item) => {
tmp += '\n * xref:' + basePath + item.toLowerCase() + '.adoc[' + item + ']\n';
tmp += '\n * ' + generateXref(item, structure) + '\n';
});

@@ -370,6 +385,6 @@ }

tmp += buildSummary(data);
tmp += buildConstructor(data);
tmp += buildMethods(data);
tmp += buildEvents(data);
tmp += buildSummary(data, structure);
tmp += buildConstructor(data, structure);
tmp += buildMethods(data, structure);
tmp += buildEvents(data, structure);

@@ -385,3 +400,5 @@ // return the applied antora page mutation

export {
getFilePath,
generateXref,
convert
};

@@ -21,20 +21,16 @@ import * as fs from 'fs';

// correlates to tinymce-docs antora path
const AntoraNavBaseDir = 'apis/';
const navLine = (name: string, level: number): string =>
'*'.repeat(level) + ' ' + name + '\n';
const navToAdoc = (navyml: NavFile[]): string => {
// Api index page
const indexPage = navyml[0];
let adoc = '* ' + indexPage.title + '\n';
const navToAdoc = (indexPage: NavFile, structure: string, depth: number, level?: number): string => {
level = level || 1;
// Api index page top level or blank
let adoc = level === 1 ? navLine(indexPage.title, level) : '';
// generate API namespaces
indexPage.pages.forEach((namespace) => {
// main namespace level navigation (namespace index)
adoc += '** ' + namespace.path + '\n';
namespace.pages.forEach((page) => {
// namespace level pages
adoc += '*** xref:' + AntoraNavBaseDir + page.path + '.adoc' + '[' + page.title + ']\n';
});
adoc += navLine(AntoraTemplate.generateXref(namespace.path, structure), level + 1);
if (level < depth) {
adoc += navToAdoc(namespace, structure, depth, level + 1);
}
});
return adoc;

@@ -61,3 +57,3 @@ };

*/
const getNavFile = (types: Type[]): NavFile[] => {
const getNavFile = (types: Type[], structure: string): NavFile[] => {
const namespaces = getNamespacesFromTypes(types);

@@ -73,5 +69,6 @@ const pages = Object.entries(namespaces).map(([ url, title ]): NavFile => {

if (url === 'tinymce') {
const rootPath = structure === 'legacy' ? 'root_tinymce' : 'tinymce.root';
innerPages.unshift({
title: 'tinymce',
path: 'tinymce.root'
path: rootPath
});

@@ -125,3 +122,2 @@ }

const parentType = member.getParentType();
const memberData = member.toJSON();

@@ -131,27 +127,24 @@ data.keywords.push(memberData.name);

if ('property' === memberData.type) {
data.properties.push(memberData);
return;
}
switch (memberData.type) {
case 'property':
data.properties.push(memberData);
return;
if ('setting' === memberData.type) {
data.settings.push(memberData);
return;
}
case 'setting':
data.settings.push(memberData);
return;
if ('constructor' === memberData.type) {
data.constructors.push(memberData);
memberData.signature = getSyntaxString(memberData);
return;
}
case 'constructor':
data.constructors.push(memberData);
memberData.signature = getSyntaxString(memberData);
return;
if ('method' === memberData.type) {
data.methods.push(memberData);
memberData.signature = getSyntaxString(memberData);
return;
}
case 'method':
data.methods.push(memberData);
memberData.signature = getSyntaxString(memberData);
return;
if ('event' === memberData.type) {
data.events.push(memberData);
return;
case 'event':
data.events.push(memberData);
return;
}

@@ -170,7 +163,7 @@ });

type: 'json',
filename: createFileName(data, 'json'),
filename: ('_data/api/' + data.type + '_' + data.fullName.replace(/\./g, '_') + '.json').toLowerCase(),
content: JSON.stringify(data, null, ' ')
}, {
type: 'adoc',
filename: createFileName(data, 'adoc'),
filename: AntoraTemplate.getFilePath(root.getStructure())(data.fullName),
content: templateDelegate(data)

@@ -216,20 +209,2 @@ }];

/**
* [createFileName description]
* @param {[type]} data [description]
* @param {[type]} ext [description]
* @return {[type]} [description]
*/
const createFileName = (data: Record<string, any>, ext: 'adoc' | 'json'): string => {
if ('adoc' === ext) {
if (data.fullName === 'tinymce') {
return (BASE_PATH + '/tinymce.root.adoc').toLowerCase();
}
return (BASE_PATH + '/' + data.fullName + '.adoc').toLowerCase();
} else if ('json' === ext) {
return ('_data/api/' + data.type + '_' + data.fullName.replace(/\./g, '_') + '.json').toLowerCase();
}
};
/**
* [addPageToArchive description]

@@ -281,2 +256,3 @@ * @param {[type]} page [description]

const memberTemplate = compileTemplate('member.handlebars');
const structure = root.getStructure();

@@ -297,4 +273,5 @@ // bind new archive to function

const nav = getNavFile(sortedTypes);
const adocNav = navToAdoc(nav);
const nav = getNavFile(sortedTypes, structure);
const indexPage = nav[0];
const adocNav = navToAdoc(indexPage, structure, 3);

@@ -311,5 +288,16 @@ addPage({

if (structure === 'legacy') {
indexPage.pages.forEach((namespace) => {
const indexNav = navToAdoc(namespace, structure, 2);
addPage({
filename: '_data/' + namespace.title + '_nav.adoc',
content: indexNav
});
});
}
// create all json and adoc for each item
const pages: PageOutput[][] = sortedTypes.map(getMemberPages.bind(null, root, memberTemplate));
const convertedPages = AntoraTemplate.convert(pages);
const convertedPages = AntoraTemplate.convert(pages, structure);
flatten(convertedPages).forEach(addPage);

@@ -316,0 +304,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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