Skip to content

Commit a7fdcae

Browse files
authored
Merge pull request #42 from highcharts/v0.6.0
v0.6.0
2 parents 3c85d77 + e5ddb72 commit a7fdcae

File tree

272 files changed

+8627
-4743
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+8627
-4743
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*.tsbuildinfo
12
._*
23
.DS_Store
34
/npm-debug.log

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib"
3+
}

README.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,23 @@ gulp.src(sourceFiles, { read: false })
5353
```
5454

5555

56+
57+
Parser
58+
======
59+
60+
This new parser creates an AST of source files. The AST containes classes and
61+
options. Every source file ending on `Options` is treated as part of the option
62+
tree. Every source file ending on `Defaults` is treated as a complementary to
63+
options.
64+
65+
66+
5667
TypeDoc
5768
=======
5869

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

api-docs/lib/index.js

+4-67
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,6 @@ function mergeObj(a, b, ignoreEmpty, excludeMap, noOverwrite) {
128128
return a;
129129
}
130130

131-
function getExcludeMap(node) {
132-
var map = {};
133-
134-
((node && node.doclet && node.doclet.tags) || []).forEach(function (tag) {
135-
if (tag.title === 'excluding' || tag.title === 'exclude') {
136-
tag.value.split(',').forEach(function (p) {
137-
map[p.trim()] = true;
138-
});
139-
}
140-
});
141-
142-
return map;
143-
}
144-
145131
function getSearchBoost(optionPath) {
146132

147133
if (!optionPath) {
@@ -691,22 +677,6 @@ module.exports = function (input, outputPath, selectedProducts, fn) {
691677
}
692678
}
693679

694-
// Extract array type
695-
function extractArrayType(def) {
696-
var s = def.indexOf('<'),
697-
s2 = def.indexOf('>'),
698-
res
699-
;
700-
701-
if (s >= 0 && s2 >= 0) {
702-
res = def.substr(s + 1, s2 - s - 1);
703-
704-
return res;
705-
}
706-
707-
return 'object';
708-
}
709-
710680
// Do some transformations
711681
function transform(name, node, parentName, parent) {
712682
var s, v = false;
@@ -799,7 +769,10 @@ module.exports = function (input, outputPath, selectedProducts, fn) {
799769
!node.doclet.type
800770
) {
801771
let defaultvalueForType = node.doclet.defaultvalue;
802-
if (typeof node.meta.default !== 'undefined' && typeof node.doclet.defaultvalue === 'undefined') {
772+
if (
773+
typeof node.meta.default !== 'undefined' &&
774+
typeof node.doclet.defaultvalue === 'undefined'
775+
) {
803776
defaultvalueForType = node.meta.default;
804777
}
805778

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

999972
}
1000973

1001-
function templateize(name) {
1002-
// Enable this to use e.g. series<type> rather than series.type
1003-
return name;
1004-
1005-
name = name || '';
1006-
1007-
if (name.indexOf('<') > 0) {
1008-
return name;
1009-
}
1010-
1011-
if (
1012-
name.indexOf('series') === 0 &&
1013-
name.indexOf('.') >= 0
1014-
) {
1015-
1016-
name = name.replace(/\./, '<');
1017-
1018-
if (name.indexOf('.') > 0) {
1019-
name = name.replace(/\./, '>.');
1020-
} else {
1021-
name += '>';
1022-
}
1023-
}
1024-
1025-
return name;
1026-
}
1027-
1028974
function dumpNav(node, opath, product, version) {
1029975
opath += 'nav/';
1030976

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

1035-
if (node.meta && node.meta.fullname) {
1036-
node.meta.fullname = templateize(node.meta.fullname);
1037-
}
1038-
1039981
fs.writeFileSync(
1040982
opath + (node.meta.fullname || 'index') + '.json',
1041983
JSON.stringify({
@@ -1073,18 +1015,13 @@ module.exports = function (input, outputPath, selectedProducts, fn) {
10731015
}
10741016

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

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

1084-
if (node.meta && node.meta.fullname) {
1085-
node.meta.fullname = templateize(node.meta.fullname);
1086-
}
1087-
10881025
// merge(node, node.meta.fullname);
10891026

10901027
if (!node.children) {

generator/build/JSON.d.ts

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*!*
2+
*
3+
* Copyright (C) Highsoft AS
4+
*
5+
* */
6+
export declare namespace JSON {
7+
type Array = globalThis.Array<(Collection | Primitive)>;
8+
type Collection = (Array | Object);
9+
interface Object extends Record<string, (Collection | Primitive)> {
10+
[key: string]: (Collection | Primitive);
11+
}
12+
type Primitive = (bigint | boolean | null | number | string | undefined);
13+
interface PrimitiveMap {
14+
bigint: bigint;
15+
boolean: boolean;
16+
null: null;
17+
number: number;
18+
string: string;
19+
undefined: undefined;
20+
}
21+
const parse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
22+
/**
23+
* Retrieves a value as a specific primitive type and falls back to a
24+
* default value, if not successfull.
25+
*/
26+
function get<T extends keyof PrimitiveMap>(type: T, value: unknown, defaultValue: PrimitiveMap[T]): PrimitiveMap[T];
27+
/**
28+
* Converts a JavaScript object to JSON notation and filters circular
29+
* references by removing them.
30+
*/
31+
function stringify(obj: unknown): string;
32+
}
33+
export default JSON;

generator/build/JSON.js

+74
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator/build/JSON.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator/build/Project.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*!*
2+
*
3+
* Copyright (C) Highsoft AS
4+
*
5+
* */
6+
import * as Parser from '../../parser/build/';
7+
export declare class Project {
8+
static load(path: string): Promise<Project>;
9+
private constructor();
10+
readonly ast: Parser.Project.JSON;
11+
readonly path: string;
12+
}
13+
export default Project;

generator/build/Project.js

+58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator/build/Project.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator/build/Template.d.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*!*
2+
*
3+
* Copyright (C) Highsoft AS
4+
*
5+
* */
6+
import JSON from './JSON';
7+
export declare class Template {
8+
static readonly types: Record<string, Template>;
9+
static load(path: string, relativeTo?: string): Promise<Template>;
10+
static loadFolder(path: string, recursive?: boolean): Promise<Array<Template>>;
11+
private constructor();
12+
readonly name: string;
13+
readonly path: string;
14+
private readonly compile;
15+
write(path: string, data: JSON.Object): Promise<void>;
16+
}
17+
export default Template;

0 commit comments

Comments
 (0)