Skip to content

v0.6.0 #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
da8b9e2
Added initial generator for TypeScript v4 API.
bre1470 Jan 6, 2021
5fb062c
Added support for doclets of classes and interfaces.
bre1470 Jan 7, 2021
4ba3c94
Added support for comment, function, namespace.
bre1470 Jan 8, 2021
37a2a59
Added meta information.
bre1470 Jan 8, 2021
446bc1b
Improved API of new documentation generator.
bre1470 Jan 13, 2021
dd13b32
Added merge logic for options.
bre1470 Jan 18, 2021
fcc778d
Moved common option functions into utilities.
bre1470 Jan 20, 2021
cd183b1
Added support for dynamic tags.
bre1470 Jan 22, 2021
a5a71fe
Merge branch 'master' into v0.6.0
bre1470 Feb 11, 2021
be24a22
Made api-docs backend compatible to node v12.
bre1470 May 3, 2021
9690efb
Merge branch 'master' into v0.6.0
bre1470 Jun 24, 2021
eacbebb
Fixed support for latest TypeScript version.
bre1470 Aug 3, 2021
fa62722
Merge branch 'master' into v0.6.0
bre1470 Oct 7, 2022
806a424
Added parser as merge of typescript and typescript4.
bre1470 Oct 7, 2022
f62116d
Improved TS 4.x debugging.
bre1470 Oct 11, 2022
fa216d2
Added abstract member with type reflection.
bre1470 Oct 11, 2022
31487c0
Added member system for file, function, interface, property.
bre1470 Oct 11, 2022
5dc9bab
Fixed project parsing.
bre1470 Oct 11, 2022
cfbc03a
Improved extraction of comments and types.
bre1470 Oct 12, 2022
0b640f2
Added debug mode.
bre1470 Oct 12, 2022
da9c09f
Added generator stump and connected parser.
bre1470 Oct 12, 2022
968dd72
Added parsing of comment tags.
bre1470 Oct 13, 2022
0b221dd
Fixed generator templating.
bre1470 Oct 13, 2022
939e4a9
Removed typedoc.
bre1470 Oct 20, 2022
561f21e
Fixed old TypeScript API.
bre1470 Oct 20, 2022
380c957
Fixed building scripts.
bre1470 Oct 20, 2022
66da39a
Added member system for class, module, namespace.
bre1470 Oct 21, 2022
c223a2f
Removed unused code.
bre1470 Oct 24, 2022
78f3132
Added inheritance for classes and interfaces.
bre1470 Oct 24, 2022
e5ddb72
Added template placeholders.
bre1470 Oct 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.tsbuildinfo
._*
.DS_Store
/npm-debug.log
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,23 @@ gulp.src(sourceFiles, { read: false })
```



Parser
======

This new parser creates an AST of source files. The AST containes classes and
options. Every source file ending on `Options` is treated as part of the option
tree. Every source file ending on `Defaults` is treated as a complementary to
options.



TypeDoc
=======

The generator is not ready yet. It contains a handlebars template system and
library scripts to generate future documentation out of TypeScript source code.
The generator is used for internal documentation of Highcharts. It contains a
handlebars template system and library scripts to generate documentation out of
TypeScript source code.
See the included [readme](https://github.com/highcharts/highcharts-documentation-generators/blob/master/typedoc/README.md)
for development information.

Expand Down
71 changes: 4 additions & 67 deletions api-docs/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,6 @@ function mergeObj(a, b, ignoreEmpty, excludeMap, noOverwrite) {
return a;
}

function getExcludeMap(node) {
var map = {};

((node && node.doclet && node.doclet.tags) || []).forEach(function (tag) {
if (tag.title === 'excluding' || tag.title === 'exclude') {
tag.value.split(',').forEach(function (p) {
map[p.trim()] = true;
});
}
});

return map;
}

function getSearchBoost(optionPath) {

if (!optionPath) {
Expand Down Expand Up @@ -691,22 +677,6 @@ module.exports = function (input, outputPath, selectedProducts, fn) {
}
}

// Extract array type
function extractArrayType(def) {
var s = def.indexOf('<'),
s2 = def.indexOf('>'),
res
;

if (s >= 0 && s2 >= 0) {
res = def.substr(s + 1, s2 - s - 1);

return res;
}

return 'object';
}

// Do some transformations
function transform(name, node, parentName, parent) {
var s, v = false;
Expand Down Expand Up @@ -799,7 +769,10 @@ module.exports = function (input, outputPath, selectedProducts, fn) {
!node.doclet.type
) {
let defaultvalueForType = node.doclet.defaultvalue;
if (typeof node.meta.default !== 'undefined' && typeof node.doclet.defaultvalue === 'undefined') {
if (
typeof node.meta.default !== 'undefined' &&
typeof node.doclet.defaultvalue === 'undefined'
) {
defaultvalueForType = node.meta.default;
}

Expand Down Expand Up @@ -998,44 +971,13 @@ module.exports = function (input, outputPath, selectedProducts, fn) {

}

function templateize(name) {
// Enable this to use e.g. series<type> rather than series.type
return name;

name = name || '';

if (name.indexOf('<') > 0) {
return name;
}

if (
name.indexOf('series') === 0 &&
name.indexOf('.') >= 0
) {

name = name.replace(/\./, '<');

if (name.indexOf('.') > 0) {
name = name.replace(/\./, '>.');
} else {
name += '>';
}
}

return name;
}

function dumpNav(node, opath, product, version) {
opath += 'nav/';

if ((node.children || []).length === 0) {
return;
}

if (node.meta && node.meta.fullname) {
node.meta.fullname = templateize(node.meta.fullname);
}

fs.writeFileSync(
opath + (node.meta.fullname || 'index') + '.json',
JSON.stringify({
Expand Down Expand Up @@ -1073,18 +1015,13 @@ module.exports = function (input, outputPath, selectedProducts, fn) {
}

function generateDetails(name, node, opath, product, version, toc, constr) {
name = templateize(name);
version = (version === 'current' ? versionProps.version : version);

// work around #8260:
if (name.indexOf('undefined') > 0) {
return;
}

if (node.meta && node.meta.fullname) {
node.meta.fullname = templateize(node.meta.fullname);
}

// merge(node, node.meta.fullname);

if (!node.children) {
Expand Down
33 changes: 33 additions & 0 deletions generator/build/JSON.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*!*
*
* Copyright (C) Highsoft AS
*
* */
export declare namespace JSON {
type Array = globalThis.Array<(Collection | Primitive)>;
type Collection = (Array | Object);
interface Object extends Record<string, (Collection | Primitive)> {
[key: string]: (Collection | Primitive);
}
type Primitive = (bigint | boolean | null | number | string | undefined);
interface PrimitiveMap {
bigint: bigint;
boolean: boolean;
null: null;
number: number;
string: string;
undefined: undefined;
}
const parse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
/**
* Retrieves a value as a specific primitive type and falls back to a
* default value, if not successfull.
*/
function get<T extends keyof PrimitiveMap>(type: T, value: unknown, defaultValue: PrimitiveMap[T]): PrimitiveMap[T];
/**
* Converts a JavaScript object to JSON notation and filters circular
* references by removing them.
*/
function stringify(obj: unknown): string;
}
export default JSON;
74 changes: 74 additions & 0 deletions generator/build/JSON.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions generator/build/JSON.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions generator/build/Project.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*!*
*
* Copyright (C) Highsoft AS
*
* */
import * as Parser from '../../parser/build/';
export declare class Project {
static load(path: string): Promise<Project>;
private constructor();
readonly ast: Parser.Project.JSON;
readonly path: string;
}
export default Project;
58 changes: 58 additions & 0 deletions generator/build/Project.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions generator/build/Project.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions generator/build/Template.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*!*
*
* Copyright (C) Highsoft AS
*
* */
import JSON from './JSON';
export declare class Template {
static readonly types: Record<string, Template>;
static load(path: string, relativeTo?: string): Promise<Template>;
static loadFolder(path: string, recursive?: boolean): Promise<Array<Template>>;
private constructor();
readonly name: string;
readonly path: string;
private readonly compile;
write(path: string, data: JSON.Object): Promise<void>;
}
export default Template;
Loading