Skip to content

Commit 92537a2

Browse files
authored
chore(ast): use API Extractor for TypeScript rollup (#4504)
Refs #4382
1 parent 81b110a commit 92537a2

Some content is hidden

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

48 files changed

+345
-38
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"extends": "../../../../api-extractor.json"
4+
}

packages/apidom-ast/config/rollup/types.dist.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/apidom-ast/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"unpkg": "./dist/apidom.ast.min.js",
1212
"main": "./src/index.cjs",
1313
"exports": {
14-
"types": "./types/dist.d.ts",
14+
"types": "./types/apidom-ast.d.ts",
1515
"import": "./src/index.mjs",
1616
"require": "./src/index.cjs"
1717
},
18-
"types": "./types/dist.d.ts",
18+
"types": "./types/apidom-ast.d.ts",
1919
"scripts": {
2020
"build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser",
2121
"build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
@@ -26,7 +26,7 @@
2626
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
2727
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
2828
"typescript:check-types": "tsc --noEmit",
29-
"typescript:declaration": "tsc -p tsconfig.declaration.json && rollup -c config/rollup/types.dist.js",
29+
"typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json",
3030
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
3131
"postpack": "rimraf NOTICE LICENSES"
3232
},
@@ -52,7 +52,7 @@
5252
"src/**/*.mjs",
5353
"src/**/*.cjs",
5454
"dist/",
55-
"types/dist.d.ts",
55+
"types/apidom-ast.d.ts",
5656
"LICENSES",
5757
"NOTICE",
5858
"README.md",

packages/apidom-ast/src/Error.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import Node from './Node.ts';
22
import type { NodeOptions } from './Node.ts';
33

4+
/**
5+
* @public
6+
*/
47
export interface ErrorOptions extends NodeOptions {
58
readonly value?: unknown;
69
readonly isUnexpected?: boolean;
710
}
811

12+
/**
13+
* @public
14+
*/
915
class Error extends Node {
1016
public static readonly type: string = 'error';
1117

packages/apidom-ast/src/Literal.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import Node from './Node.ts';
22
import type { NodeOptions } from './Node.ts';
33

4+
/**
5+
* @public
6+
*/
47
export interface LiteralOptions extends NodeOptions {
58
readonly value?: unknown;
69
}
710

11+
/**
12+
* @public
13+
*/
814
class Literal extends Node {
915
public static readonly type: string = 'literal';
1016

packages/apidom-ast/src/Node.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import Position from './Position.ts';
22

3+
/**
4+
* @public
5+
*/
36
export interface NodeOptions {
47
readonly children?: unknown[];
58
readonly position?: Position;
69
readonly isMissing?: boolean;
710
}
811

12+
/**
13+
* @public
14+
*/
915
class Node {
1016
public static readonly type: string = 'node';
1117

packages/apidom-ast/src/ParseResult.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { head } from 'ramda';
22

33
import Node from './Node.ts';
44

5+
/**
6+
* @public
7+
*/
58
class ParseResult extends Node {
69
public static readonly type: string = 'parseResult';
710

packages/apidom-ast/src/Position.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
/* eslint-disable max-classes-per-file */
22

3-
interface PointOptions {
3+
/**
4+
* @public
5+
*/
6+
export interface PointOptions {
47
readonly row: number;
58
readonly column: number;
69
readonly char: number;
710
}
811

12+
/**
13+
* @public
14+
*/
915
export class Point {
1016
public static readonly type: string = 'point';
1117

@@ -24,11 +30,17 @@ export class Point {
2430
}
2531
}
2632

27-
interface PositionOptions {
33+
/**
34+
* @public
35+
*/
36+
export interface PositionOptions {
2837
readonly start: Point;
2938
readonly end: Point;
3039
}
3140

41+
/**
42+
* @public
43+
*/
3244
class Position {
3345
public static readonly type: string = 'position';
3446

packages/apidom-ast/src/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ export { default as JsonNode } from './json/nodes/JsonNode.ts';
33
export { default as JsonDocument } from './json/nodes/JsonDocument.ts';
44
export { default as JsonObject } from './json/nodes/JsonObject.ts';
55
export { default as JsonProperty } from './json/nodes/JsonProperty.ts';
6+
export type { JsonValue as JsonPropertyValue } from './json/nodes/JsonProperty.ts';
67
export { default as JsonArray } from './json/nodes/JsonArray.ts';
78
export { default as JsonValue } from './json/nodes/JsonValue.ts';
9+
export type { JsonValueOptions } from './json/nodes/JsonValue.ts';
810
export { default as JsonKey } from './json/nodes/JsonKey.ts';
911
export { default as JsonString } from './json/nodes/JsonString.ts';
1012
export { default as JsonStringContent } from './json/nodes/JsonStringContent.ts';
@@ -29,18 +31,26 @@ export {
2931
} from './json/nodes/predicates.ts';
3032
// YAML AST related exports
3133
export { default as YamlAlias } from './yaml/nodes/YamlAlias.ts';
34+
export type { YamlAliasOptions } from './yaml/nodes/YamlAlias.ts';
3235
export { default as YamlCollection } from './yaml/nodes/YamlCollection.ts';
3336
export { default as YamlComment } from './yaml/nodes/YamlComment.ts';
37+
export type { YamlCommentOptions } from './yaml/nodes/YamlComment.ts';
3438
export { default as YamlDirective } from './yaml/nodes/YamlDirective.ts';
39+
export type { YamlDirectiveOptions, YamlDirectiveParameters } from './yaml/nodes/YamlDirective.ts';
3540
export { default as YamlDocument } from './yaml/nodes/YamlDocument.ts';
3641
export { default as YamlKeyValuePair } from './yaml/nodes/YamlKeyValuePair.ts';
42+
export type { YamlKeyValuePairOptions } from './yaml/nodes/YamlKeyValuePair.ts';
3743
export { default as YamlMapping } from './yaml/nodes/YamlMapping.ts';
3844
export { default as YamlNode } from './yaml/nodes/YamlNode.ts';
45+
export type { YamlNodeOptions } from './yaml/nodes/YamlNode.ts';
3946
export { default as YamlScalar } from './yaml/nodes/YamlScalar.ts';
47+
export type { YamlScalarOptions } from './yaml/nodes/YamlScalar.ts';
4048
export { default as YamlSequence } from './yaml/nodes/YamlSequence.ts';
4149
export { default as YamlStream } from './yaml/nodes/YamlStream.ts';
4250
export { default as YamlTag, YamlNodeKind } from './yaml/nodes/YamlTag.ts';
51+
export type { YamlTagOptions } from './yaml/nodes/YamlTag.ts';
4352
export { default as YamlAnchor } from './yaml/nodes/YamlAnchor.ts';
53+
export type { YamlAnchorOptions } from './yaml/nodes/YamlAnchor.ts';
4454
export { YamlStyle, YamlStyleGroup } from './yaml/nodes/YamlStyle.ts';
4555
export { default as YamlFailsafeSchema } from './yaml/schemas/failsafe/index.ts';
4656
export { default as YamlJsonSchema } from './yaml/schemas/json/index.ts';
@@ -64,9 +74,13 @@ export { default as YamlSchemaError } from './yaml/errors/YamlSchemaError.ts';
6474
export { default as YamlTagError } from './yaml/errors/YamlTagError.ts';
6575
export type { YamlTagErrorOptions } from './yaml/errors/YamlTagError.ts';
6676
// generic AST related exports
77+
export type { default as Node, NodeOptions } from './Node.ts';
6778
export { default as Literal } from './Literal.ts';
79+
export type { LiteralOptions } from './Literal.ts';
6880
export { Point, default as Position } from './Position.ts';
81+
export type { PointOptions, PositionOptions } from './Position.ts';
6982
export { default as Error } from './Error.ts';
83+
export type { ErrorOptions } from './Error.ts';
7084
export { default as ParseResult } from './ParseResult.ts';
7185
export { isParseResult, isLiteral, isPoint, isPosition } from './predicates.ts';
7286
// AST traversal related exports

packages/apidom-ast/src/json/nodes/JsonArray.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import JsonNode from './JsonNode.ts';
22
import { isFalse, isTrue, isNull, isNumber, isString, isArray, isObject } from './predicates.ts';
33

4+
/**
5+
* @public
6+
*/
47
class JsonArray extends JsonNode {
58
public static readonly type = 'array';
69

packages/apidom-ast/src/json/nodes/JsonDocument.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { head } from 'ramda';
22

33
import JsonNode from './JsonNode.ts';
44

5+
/**
6+
* @public
7+
*/
58
class JsonDocument extends JsonNode {
69
public static readonly type = 'document';
710

packages/apidom-ast/src/json/nodes/JsonEscapeSequence.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import JsonValue from './JsonValue.ts';
22

3+
/**
4+
* @public
5+
*/
36
class JsonEscapeSequence extends JsonValue {
47
public static readonly type = 'escapeSequence';
58
}

packages/apidom-ast/src/json/nodes/JsonFalse.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import JsonValue from './JsonValue.ts';
22

3+
/**
4+
* @public
5+
*/
36
class JsonFalse extends JsonValue {
47
public static readonly type = 'false';
58
}

packages/apidom-ast/src/json/nodes/JsonKey.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import JsonString from './JsonString.ts';
22

3+
/**
4+
* @public
5+
*/
36
class JsonKey extends JsonString {
47
public static readonly type = 'key';
58
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import Node from '../../Node.ts';
22

3+
/**
4+
* @public
5+
*/
36
class JsonNode extends Node {}
47

58
export default JsonNode;

packages/apidom-ast/src/json/nodes/JsonNull.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import JsonValue from './JsonValue.ts';
22

3+
/**
4+
* @public
5+
*/
36
class JsonNull extends JsonValue {
47
public static readonly type = 'null';
58
}

packages/apidom-ast/src/json/nodes/JsonNumber.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import JsonValue from './JsonValue.ts';
22

3+
/**
4+
* @public
5+
*/
36
class JsonNumber extends JsonValue {
47
public static readonly type = 'number';
58
}

packages/apidom-ast/src/json/nodes/JsonObject.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import JsonNode from './JsonNode.ts';
22
import { isProperty } from './predicates.ts';
33
import type JsonProperty from './JsonProperty.ts';
44

5+
/**
6+
* @public
7+
*/
58
class JsonObject extends JsonNode {
69
public static readonly type = 'object';
710

packages/apidom-ast/src/json/nodes/JsonProperty.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,21 @@ import type JsonNumber from './JsonNumber.ts';
1818
import type JsonArray from './JsonArray.ts';
1919
import type JsonObject from './JsonObject.ts';
2020

21-
type JsonValue = JsonFalse | JsonTrue | JsonNull | JsonNumber | JsonString | JsonArray | JsonObject;
21+
/**
22+
* @public
23+
*/
24+
export type JsonValue =
25+
| JsonFalse
26+
| JsonTrue
27+
| JsonNull
28+
| JsonNumber
29+
| JsonString
30+
| JsonArray
31+
| JsonObject;
2232

33+
/**
34+
* @public
35+
*/
2336
class JsonProperty extends JsonNode {
2437
public static readonly type = 'property';
2538

packages/apidom-ast/src/json/nodes/JsonString.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { isEscapeSequence, isStringContent } from './predicates.ts';
55

66
type JsonStringLike = JsonStringContent | JsonEscapeSequence;
77

8+
/**
9+
* @public
10+
*/
811
class JsonString extends JsonNode {
912
public static readonly type: string = 'string';
1013

packages/apidom-ast/src/json/nodes/JsonStringContent.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import JsonValue from './JsonValue.ts';
22

3+
/**
4+
* @public
5+
*/
36
class JsonStringContent extends JsonValue {
47
public static readonly type = 'stringContent';
58
}

packages/apidom-ast/src/json/nodes/JsonTrue.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import JsonValue from './JsonValue.ts';
22

3+
/**
4+
* @public
5+
*/
36
class JsonTrue extends JsonValue {
47
public static readonly type = 'true';
58
}

packages/apidom-ast/src/json/nodes/JsonValue.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import JsonNode from './JsonNode.ts';
22
import type { NodeOptions } from '../../Node.ts';
33

4+
/**
5+
* @public
6+
*/
47
export interface JsonValueOptions extends NodeOptions {
58
value: string;
69
}
710

11+
/**
12+
* @public
13+
*/
814
class JsonValue extends JsonNode {
915
public static readonly type: string = 'value';
1016

0 commit comments

Comments
 (0)