@arcgis/api-extractor 5.0.0-next.8 → 5.0.0-next.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apiJson.d.ts +349 -517
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +14 -0
- package/dist/config/typeReferences/docLinkAdditions.d.ts +51 -0
- package/dist/config/typeReferences/globals.d.ts +11 -0
- package/dist/config/typeReferences/stringDocLinkAdditions.d.ts +17 -0
- package/dist/config/typeReferences/typeScriptGlobals.json.d.ts +3 -0
- package/dist/diff/diffApiJson.d.ts +23 -0
- package/dist/diff/fetchApiJsonFromNpm.d.ts +7 -0
- package/dist/diff/index.d.ts +3 -0
- package/dist/diff/index.js +149 -0
- package/dist/diff/types.d.ts +83 -0
- package/dist/diffTypes/index.d.ts +24 -0
- package/dist/diffTypes/index.js +69 -0
- package/dist/extractor/ApiExtractor.d.ts +138 -0
- package/dist/extractor/config.d.ts +66 -0
- package/dist/index.d.ts +12 -8
- package/dist/index.js +781 -228
- package/dist/internalTypeScriptApis.d.ts +31 -0
- package/dist/types.d.ts +18 -21
- package/dist/uiUtils/index.d.ts +21 -0
- package/dist/uiUtils/index.js +57 -0
- package/dist/utils/apiHelpers.d.ts +61 -2
- package/dist/utils/astHelpers.d.ts +14 -2
- package/dist/utils/error.d.ts +6 -1
- package/dist/utils/jsDocHelpers.d.ts +2 -0
- package/dist/utils/jsDocParser.d.ts +46 -0
- package/dist/utils/jsDocPrinter.d.ts +13 -0
- package/dist/utils/partPrinter.d.ts +23 -0
- package/dist/utils/print.d.ts +0 -1
- package/package.json +16 -5
- package/dist/extractor/index.d.ts +0 -46
- package/dist/utils/docHelpers.d.ts +0 -9
- /package/dist/{ensureValidType.d.ts → ensureCemCompatibility.d.ts} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { TransformResult } from 'vite';
|
|
3
|
+
type SourceMap = Extract<NonNullable<TransformResult["map"]>, {
|
|
4
|
+
file: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const unsafeUndocumentedTs: Required<UndocumentedTypeScript>;
|
|
7
|
+
type UndocumentedTypeScript = {
|
|
8
|
+
readonly createSourceMapGenerator?: (host: ts.CompilerHost, basename: string, sourceRoot: string, dirname: string, compilerOptions: ts.CompilerOptions) => SourceMapGenerator;
|
|
9
|
+
readonly createTextWriter?: (newLine: string) => EmitTextWriter;
|
|
10
|
+
readonly getNewLineCharacter?: (options: ts.CompilerOptions) => string;
|
|
11
|
+
readonly createPrinter: (
|
|
12
|
+
/**
|
|
13
|
+
* Printer has undocumented options for printing source maps:
|
|
14
|
+
* https://github.com/microsoft/TypeScript/blob/7319968e90600102892a79142fb804bcbe384160/src/compiler/types.ts#L9689C18-L9707
|
|
15
|
+
*/
|
|
16
|
+
options: ts.CompilerOptions & ts.PrinterOptions, handlers?: ts.PrintHandlers) => ReturnType<typeof ts.createPrinter> & UndocumentedPrinter;
|
|
17
|
+
};
|
|
18
|
+
type SourceMapGenerator = {
|
|
19
|
+
readonly toJSON: () => SourceMap;
|
|
20
|
+
};
|
|
21
|
+
type UndocumentedPrinter = {
|
|
22
|
+
readonly writeFile?: (writeFile: ts.SourceFile, writer: EmitTextWriter, sourceMapGenerator: SourceMapGenerator | undefined) => void;
|
|
23
|
+
writeNode?: (hint: ts.EmitHint, node: ts.Node, sourceFile: ts.SourceFile | undefined, output: EmitTextWriter) => void;
|
|
24
|
+
};
|
|
25
|
+
type EmitTextWriter = {
|
|
26
|
+
readonly getText: () => string;
|
|
27
|
+
readonly getTextPos: () => number;
|
|
28
|
+
readonly clear: () => void;
|
|
29
|
+
};
|
|
30
|
+
export declare function unsafeGetUndocumentedPrinter(compilerOptions: ts.CompilerOptions, handlers?: ts.PrintHandlers): ReturnType<typeof ts.createPrinter> & UndocumentedPrinter;
|
|
31
|
+
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiCustomElementDeclaration, ApiClassMethod, ApiEvent, ApiClassDeclaration, ApiFunctionDeclaration, ApiModule, ApiVariableDeclaration, ApiInterfaceDeclaration, ApiDocsTag, ApiCustomElementField, ApiWithDescription } from './apiJson.ts';
|
|
2
|
+
export interface NodeDoc extends ApiWithDescription {
|
|
3
|
+
docsTags: ApiDocsTag[];
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
|
-
*
|
|
4
|
-
* ```ts
|
|
5
|
-
* {
|
|
6
|
-
* properties: {
|
|
7
|
-
* // You only need to return the fields you wish to modify.
|
|
8
|
-
* autoDestroyDisabled: () => ({
|
|
9
|
-
* description: `If true, the component will not be destroyed automatically when it is
|
|
10
|
-
* disconnected from the document. This is useful when you want to move the
|
|
11
|
-
* component to a different place on the page, or temporarily hide it. If this
|
|
12
|
-
* is set, make sure to call the {@link #destroy} method when you are done to
|
|
13
|
-
* prevent memory leaks.`,
|
|
14
|
-
* }),
|
|
15
|
-
* },
|
|
16
|
-
* }
|
|
6
|
+
* [Documentation](https://webgis.esri.cm/arcgis-components/docs/max-jsapi-typings/webgis-project-docs/core/core/documenting-api#copydoc)
|
|
17
7
|
*/
|
|
18
8
|
export type CopyDocDefinitions = {
|
|
19
|
-
properties?:
|
|
20
|
-
methods?:
|
|
21
|
-
events?:
|
|
9
|
+
properties?: CopyDocMemberDeclarations<ApiCustomElementField>;
|
|
10
|
+
methods?: CopyDocMemberDeclarations<ApiClassMethod>;
|
|
11
|
+
events?: CopyDocMemberDeclarations<ApiEvent>;
|
|
12
|
+
classes?: CopyDocDeclarations<ApiClassDeclaration>;
|
|
13
|
+
customElements?: CopyDocDeclarations<ApiCustomElementDeclaration>;
|
|
14
|
+
functions?: CopyDocDeclarations<ApiFunctionDeclaration>;
|
|
15
|
+
variables?: CopyDocDeclarations<ApiVariableDeclaration>;
|
|
16
|
+
/** This includes both type aliases and interfaces */
|
|
17
|
+
interfaces?: CopyDocDeclarations<ApiInterfaceDeclaration>;
|
|
22
18
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
type CopiableFields = "deprecated" | "description" | "docsTags" | "readonly" | "return";
|
|
20
|
+
type CopyDocDeclarations<ApiType extends Partial<Record<CopiableFields, unknown>>> = Record<string, Partial<Pick<ApiType, CopiableFields>> | ((apiDeclaration: ApiType, module: ApiModule) => Partial<Pick<ApiType, CopiableFields>>) | undefined>;
|
|
21
|
+
type CopyDocMemberDeclarations<ApiType extends Partial<Record<CopiableFields, unknown>>> = Record<string, Partial<Pick<ApiType, CopiableFields>> | ((apiDeclaration: ApiType, classOrComponent: ApiClassDeclaration | ApiCustomElementDeclaration, module: ApiModule) => Partial<Pick<ApiType, CopiableFields>>) | undefined>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ApiType, ApiTypeReference } from '../apiJson.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Traverse through ApiType text string, turning type references into links.
|
|
4
|
+
*
|
|
5
|
+
* Also hydrates well-known JS "global" keywords (e.g. `string`, `number`), even
|
|
6
|
+
* if they don't appear in ApiType.references.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const markdownTypeString = hydrateApiType(
|
|
11
|
+
* apiProperty.type,
|
|
12
|
+
* (text, reference) => `[${text}](${reference.viewUrl})`
|
|
13
|
+
* ).join("");
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @see [Type References](../config/typeReferences/README.md)
|
|
17
|
+
*/
|
|
18
|
+
export declare function hydrateApiType<T>(apiType: Pick<ApiType, "references" | "text">, hydratePart: HydrateApiTypeCallback<T>): (T | string)[];
|
|
19
|
+
export type HydrateApiTypeCallback<T> = (referenceText: string, reference: ApiTypeReference & {
|
|
20
|
+
viewUrl: NonNullable<ApiTypeReference["viewUrl"]>;
|
|
21
|
+
}) => T;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const d = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
2
|
+
undefined: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined",
|
|
3
|
+
string: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String",
|
|
4
|
+
boolean: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
|
|
5
|
+
null: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/null",
|
|
6
|
+
number: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number",
|
|
7
|
+
object: "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object",
|
|
8
|
+
void: "https://www.typescriptlang.org/docs/handbook/2/functions.html#void",
|
|
9
|
+
unknown: "https://www.typescriptlang.org/docs/handbook/2/functions.html#unknown",
|
|
10
|
+
never: "https://www.typescriptlang.org/docs/handbook/2/functions.html#never",
|
|
11
|
+
any: "https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any",
|
|
12
|
+
this: "#"
|
|
13
|
+
}), h = Object.keys(d).join("|"), g = new RegExp(`\\b(?:${h})\\b`, "u");
|
|
14
|
+
function p(e, l) {
|
|
15
|
+
const n = [];
|
|
16
|
+
let o = e.text.length;
|
|
17
|
+
if (e.references !== void 0)
|
|
18
|
+
for (let c = e.references.length - 1; c >= 0; c--) {
|
|
19
|
+
const t = e.references[c];
|
|
20
|
+
if (t.start === void 0 || t.end === void 0)
|
|
21
|
+
continue;
|
|
22
|
+
const r = e.text.slice(t.end, o);
|
|
23
|
+
r.length > 0 && i(r, l, n);
|
|
24
|
+
const s = e.text.slice(t.start, t.end);
|
|
25
|
+
o = t.start, t.viewUrl === void 0 ? n.push(s) : n.push(
|
|
26
|
+
l(s, t)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
if (o > 0) {
|
|
30
|
+
const c = e.text.slice(0, o);
|
|
31
|
+
i(c, l, n);
|
|
32
|
+
}
|
|
33
|
+
return n.reverse();
|
|
34
|
+
}
|
|
35
|
+
function i(e, l, n) {
|
|
36
|
+
const o = n.length;
|
|
37
|
+
for (let c = 0; c < e.length; ) {
|
|
38
|
+
const t = e.match(g);
|
|
39
|
+
if (t?.index === void 0)
|
|
40
|
+
break;
|
|
41
|
+
const r = e.slice(0, t.index);
|
|
42
|
+
r.length > 0 && n.splice(o, 0, r);
|
|
43
|
+
const s = t[0];
|
|
44
|
+
e = e.slice(t.index + s.length);
|
|
45
|
+
const a = d[s], b = l(s, {
|
|
46
|
+
name: s,
|
|
47
|
+
module: void 0,
|
|
48
|
+
package: s === "this" ? void 0 : "global:",
|
|
49
|
+
viewUrl: a
|
|
50
|
+
});
|
|
51
|
+
n.splice(o, 0, b);
|
|
52
|
+
}
|
|
53
|
+
e.length > 0 && n.splice(o, 0, e);
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
p as hydrateApiType
|
|
57
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { ApiAttribute, ApiClassDeclaration, ApiClassMember, ApiClassMethod, ApiCssCustomProperty, ApiCssCustomState, ApiCssPart, ApiCustomElementDeclaration, ApiCustomElementField, ApiCustomElementMember, ApiDeclaration, ApiEvent, ApiFunctionDeclaration, ApiInterfaceDeclaration, ApiModule, ApiSlot, ApiTypeReference, ApiVariableDeclaration } from '../apiJson.ts';
|
|
2
3
|
export declare const isApiMethod: (member: ApiClassMember) => member is ApiClassMethod;
|
|
3
4
|
export declare const isApiProperty: (member: ApiClassMember) => member is ApiCustomElementField;
|
|
4
5
|
/**
|
|
@@ -15,9 +16,67 @@ export declare const isApiProperty: (member: ApiClassMember) => member is ApiCus
|
|
|
15
16
|
* ]
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
export declare function naturalSortModules(left: ApiModule, right: ApiModule): number;
|
|
19
|
+
export declare function naturalSortModules(left: Pick<ApiModule, "sourcePath">, right: Pick<ApiModule, "sourcePath">): number;
|
|
19
20
|
/**
|
|
20
21
|
* This is not made up by us - defined in the custom-elements-manifest spec
|
|
21
22
|
*/
|
|
22
23
|
export declare const globalPackageIdentifier = "global:";
|
|
23
24
|
export declare const multipleJsDocTags: Set<string>;
|
|
25
|
+
interface PostProcessLinkContext {
|
|
26
|
+
alternativeDocumentationHost: string;
|
|
27
|
+
normalizedDocumentationHost: string;
|
|
28
|
+
resolveJsDocLink: (text: string, match: string) => string;
|
|
29
|
+
moduleName: string;
|
|
30
|
+
file?: ts.SourceFile;
|
|
31
|
+
}
|
|
32
|
+
export declare function postProcessLinks(apiPart: Partial<Pick<ApiCustomElementField, "deprecated" | "description" | "docsTags">>, context: PostProcessLinkContext): void;
|
|
33
|
+
/**
|
|
34
|
+
* @privateRemarks
|
|
35
|
+
* Link validation runs during post-processing, at which point we don't have easy
|
|
36
|
+
* AST access.
|
|
37
|
+
*/
|
|
38
|
+
export declare function apiExtractorJsDocError(message: string, text: string, context: PostProcessLinkContext): void;
|
|
39
|
+
export declare const compareStrings: (x: string, y: string) => number;
|
|
40
|
+
export declare const compareNamedNodes: (left: {
|
|
41
|
+
name: string;
|
|
42
|
+
}, right: {
|
|
43
|
+
name: string;
|
|
44
|
+
}) => number;
|
|
45
|
+
/**
|
|
46
|
+
* 1. Static members
|
|
47
|
+
* 2. Constructors and call signatures
|
|
48
|
+
* 3. Properties before methods
|
|
49
|
+
* 4. Alphabetical
|
|
50
|
+
*/
|
|
51
|
+
export declare const compareClassMembers: (left: ApiClassMember, right: ApiClassMember) => number;
|
|
52
|
+
/**
|
|
53
|
+
* Associate a start and end index with each type reference. Drop unresolved
|
|
54
|
+
* references.
|
|
55
|
+
*/
|
|
56
|
+
export declare function findReferenceRanges(references: ApiTypeReference[], resolvedString: string): ApiTypeReference[] | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Get a name from a class member.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* - method named "test" => "test"
|
|
62
|
+
* - property named "test" => "test"
|
|
63
|
+
* - constructor => "constructor"
|
|
64
|
+
* - call-signature => "call-signature"
|
|
65
|
+
*/
|
|
66
|
+
export declare const getApiMemberName: (member: ApiClassMember | ApiCustomElementMember) => string;
|
|
67
|
+
/**
|
|
68
|
+
* Like `getApiMemberName`, but prefixes with `static ` if the member is static.
|
|
69
|
+
*/
|
|
70
|
+
export declare const getMaybeStaticApiMemberName: (member: ApiClassMember | ApiCustomElementMember) => string;
|
|
71
|
+
/**
|
|
72
|
+
* Get a UI label from a class member.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* - method named "test" => "test()"
|
|
76
|
+
* - property named "test" => "test"
|
|
77
|
+
* - constructor => "constructor()"
|
|
78
|
+
* - call-signature => "()"
|
|
79
|
+
*/
|
|
80
|
+
export declare const getApiNodeLabel: (member: ApiClassMember | ApiCssCustomProperty | ApiCustomElementMember | ApiDeclaration | ApiEvent) => string;
|
|
81
|
+
export declare function mergeApiNodes<T extends ApiAttribute | ApiClassDeclaration | ApiClassMember | ApiCssCustomProperty | ApiCssCustomState | ApiCssPart | ApiCustomElementDeclaration | ApiCustomElementMember | ApiEvent | ApiFunctionDeclaration | ApiInterfaceDeclaration | ApiSlot | ApiVariableDeclaration>(source: Partial<T>, destination: T, copyDocTagIndex?: number): void;
|
|
82
|
+
export {};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { default as ts } from 'typescript';
|
|
2
|
-
import { ApiPropertyLike } from '../apiJson';
|
|
2
|
+
import { ApiPropertyLike } from '../apiJson.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Check if a member has a static, private, or protected modifier.
|
|
5
5
|
*/
|
|
6
6
|
export declare const hasIgnoredModifier: (member: ts.ClassElement) => boolean;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Include default value only if:
|
|
9
|
+
* - it's a literal value
|
|
10
|
+
* - we have `@default` tag in the JSDoc (handled in setApiDocFromJsDoc)
|
|
11
|
+
* - default value is a variable or property access expression whose
|
|
12
|
+
* declaration has a JSDoc (handled further down in this file)
|
|
13
|
+
*/
|
|
14
|
+
export declare function setDefaultFromInitializer(node: Pick<ts.PropertyDeclaration, "initializer">, property: Pick<ApiPropertyLike, "default">, sourceFile: ts.SourceFile): void;
|
|
8
15
|
/**
|
|
9
16
|
* Convert property name node into a string. Converts Identifier and
|
|
10
17
|
* StringLiteralLike nodes. The rest return undefined.
|
|
@@ -13,3 +20,8 @@ export declare function getMemberName(name?: ts.PropertyName): string | undefine
|
|
|
13
20
|
export declare const findDecorator: ({ modifiers }: {
|
|
14
21
|
modifiers?: readonly ts.ModifierLike[];
|
|
15
22
|
}, name: string) => ts.CallExpression | undefined;
|
|
23
|
+
export declare function extractBooleanInitializer(initializer: ts.Expression, sourceFile: ts.SourceFile): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Remove the first dot after the last slash. Thus, `.d.ts` is removed.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getBasename(path: string): string;
|
package/dist/utils/error.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as ts } from 'typescript';
|
|
2
2
|
export declare let apiExtractorErrorCount: number;
|
|
3
|
-
export declare
|
|
3
|
+
export declare function resetApiExtractorErrorCount(newCount?: number): void;
|
|
4
4
|
export declare function setApiExtractorErrorLogger(logger: (msg: string) => void): void;
|
|
5
5
|
export interface ApiExtractorErrorContext {
|
|
6
6
|
file: ts.SourceFile | undefined;
|
|
@@ -9,4 +9,9 @@ export interface ApiExtractorErrorContext {
|
|
|
9
9
|
start?: number;
|
|
10
10
|
length?: number;
|
|
11
11
|
}
|
|
12
|
+
export declare const apiExtractorDiagnosticContext: ts.FormatDiagnosticsHost;
|
|
13
|
+
/**
|
|
14
|
+
* Produce an error message in the style of TypeScript compiler errors.
|
|
15
|
+
* Error message includes code snippet when possible.
|
|
16
|
+
*/
|
|
12
17
|
export declare function apiExtractorError(message: string, { file, node, scope, start, length }: ApiExtractorErrorContext): void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { ApiCustomElementDeclaration, ApiCustomElementField } from '../apiJson.ts';
|
|
3
|
+
import { NodeDoc } from '../types.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Find node's JSDoc comment and parse it into a NodeDoc
|
|
6
|
+
*
|
|
7
|
+
* @param node AST node that has leading JSDoc comment
|
|
8
|
+
* @param sourceFile Source file that contains the `node`
|
|
9
|
+
* @param ensureIsPublic If true (default), will return undefined if JSDoc does
|
|
10
|
+
* not contain a `@public` tag. In such cases, `@public` is not included in
|
|
11
|
+
* `NodeDoc` as it is assumed.
|
|
12
|
+
* @privateRemarks
|
|
13
|
+
* FINAL: adopt in Lumina
|
|
14
|
+
*/
|
|
15
|
+
export declare function getNodeDoc(node: ts.Node, sourceFile: ts.SourceFile,
|
|
16
|
+
/** @default true */
|
|
17
|
+
ensureIsPublic?: boolean): NodeDoc | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* TypeScript parses too much around \@param, \@property and \@deprecated tags
|
|
20
|
+
* It also parses out inline tags. We have to put them back together
|
|
21
|
+
* (overhead and complexity). Plus, it is a bit too tolerant - we want
|
|
22
|
+
* to disallow some ambiguous behavior to improve consistency.
|
|
23
|
+
* And TypeScript incorrectly parses decorators as tags when used inside code
|
|
24
|
+
* snippets.
|
|
25
|
+
*
|
|
26
|
+
* Given all of the above, we implement a tiny, but strict JSDoc parser
|
|
27
|
+
*
|
|
28
|
+
* @param jsDocText JSDoc string that starts with /** and ends with *\/
|
|
29
|
+
* @param sourceFile Used for error reporting
|
|
30
|
+
* @param ensureIsPublic If true, will return undefined if JSDoc does not contain a \@public tag
|
|
31
|
+
*/
|
|
32
|
+
declare function parseJsDoc(jsDocText: string, sourceFile: ts.SourceFile, ensureIsPublic?: false): NodeDoc;
|
|
33
|
+
declare function parseJsDoc(jsDocText: string, sourceFile: ts.SourceFile, ensureIsPublic: boolean): NodeDoc | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated migrate to getNodeDoc
|
|
36
|
+
*/
|
|
37
|
+
export declare function symbolToDocs(checker: ts.TypeChecker, symbol: ts.Signature | ts.Symbol): NodeDoc;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated migrate to getNodeDoc
|
|
40
|
+
*/
|
|
41
|
+
export declare function setApiDocFromSymbol(node: ts.PropertyName, checker: ts.TypeChecker, api: Partial<Pick<ApiCustomElementDeclaration, "cssParts" | "cssProperties" | "cssStates" | "slots"> & Pick<ApiCustomElementField, "default" | "deprecated" | "description" | "docsTags" | "privacy" | "readonly">>): void;
|
|
42
|
+
export declare function setApiDocFromJsDoc(api: Partial<Pick<ApiCustomElementDeclaration, "cssParts" | "cssProperties" | "cssStates" | "slots"> & Pick<ApiCustomElementField, "default" | "deprecated" | "description" | "docsTags" | "privacy" | "readonly">>, docs: ReturnType<typeof symbolToDocs>): void;
|
|
43
|
+
export declare const exportsForTests: {
|
|
44
|
+
parseJsDoc: typeof parseJsDoc;
|
|
45
|
+
};
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
import { ApiEvent, ApiCustomElementMember, ApiDeclaration, ApiModule, ApiClassMember } from '../apiJson.ts';
|
|
3
|
+
import { NodeDoc } from '../types.ts';
|
|
4
|
+
export declare function apiMemberToNodeDoc(apiMember: ApiClassMember | ApiCustomElementMember | ApiDeclaration | ApiEvent | ApiModule): NodeDoc | undefined;
|
|
5
|
+
export declare function nodeDocToSynthesizedComment(nodeDoc: NodeDoc | undefined): ts.SynthesizedComment[];
|
|
6
|
+
/**
|
|
7
|
+
* Omitting leading /* and trailing *\/ as those will be inserted by TypeScript.
|
|
8
|
+
*
|
|
9
|
+
* @privateRemarks
|
|
10
|
+
* This function is in the hot path - called for every API item. To reduce memory
|
|
11
|
+
* churn, we avoid creating intermediate arrays inside.
|
|
12
|
+
*/
|
|
13
|
+
export declare function nodeDocToString(nodeDoc: NodeDoc): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ApiFunctionLike, ApiParameter, ApiTypeParameter } from '../apiJson.ts';
|
|
2
|
+
export declare function printClass(isAbstract: boolean,
|
|
3
|
+
/**
|
|
4
|
+
* For consistency and to simplify the docs messaging, everything that appears
|
|
5
|
+
* in our .d.ts files is exported - non-public things don't appear in the .d.ts
|
|
6
|
+
* files.
|
|
7
|
+
*/
|
|
8
|
+
isDefaultExported: boolean, name: string, typeParameters: ApiTypeParameter[] | undefined, extendsClause: string | undefined, membersText: string): string;
|
|
9
|
+
export declare function printTypeParameters(typeParameters: ApiTypeParameter[] | undefined): string;
|
|
10
|
+
export declare function printInterface(
|
|
11
|
+
/**
|
|
12
|
+
* For consistency and to simplify the docs messaging, everything that appears
|
|
13
|
+
* in our .d.ts files is exported - non-public things don't appear in the .d.ts
|
|
14
|
+
* files.
|
|
15
|
+
*/
|
|
16
|
+
isDefaultExported: boolean, name: string, typeParameters: ApiTypeParameter[] | undefined, extendsClause: string[] | undefined, membersText: string): string;
|
|
17
|
+
export declare function printMethod(isProtected: boolean, isAbstract: boolean, isStatic: boolean, isOptional: boolean, name: string, typeParameters: ApiTypeParameter[] | undefined, parameters: ApiParameter[] | undefined, returnType: string | undefined): string;
|
|
18
|
+
export declare function printFunction(isDefaultExported: boolean, name: string, typeParameters: ApiTypeParameter[] | undefined, parameters: ApiParameter[] | undefined, returnType: string): string;
|
|
19
|
+
export declare function printSignature(functionLike: Pick<ApiFunctionLike, "parameters" | "return" | "typeParameters">): string;
|
|
20
|
+
export declare function printProperty(isProtected: boolean, isAbstract: boolean, isStatic: boolean, isReadOnly: boolean, isAccessor: boolean, isOptional: boolean, name: string, type: string): string;
|
|
21
|
+
export declare function printGetterSetter(isProtected: boolean, isAbstract: boolean, isStatic: boolean, name: string, getterType: string, setterType: string | undefined): string;
|
|
22
|
+
export declare function printVariable(isDefaultExported: boolean, name: string, type: string): string;
|
|
23
|
+
export declare function printTypeAlias(name: string, typeParameters: ApiTypeParameter[] | undefined, superTypes: string[] | undefined, type: string | undefined): string;
|
package/dist/utils/print.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/api-extractor",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.81",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./dist/index.js",
|
|
10
|
+
"./diff": "./dist/diff/index.js",
|
|
11
|
+
"./diffTypes": "./dist/diffTypes/index.js",
|
|
12
|
+
"./uiUtils": "./dist/uiUtils/index.js",
|
|
13
|
+
"./extractor/config": {
|
|
14
|
+
"types": "./dist/extractor/config.d.ts"
|
|
15
|
+
},
|
|
10
16
|
"./package.json": "./package.json"
|
|
11
17
|
},
|
|
12
18
|
"files": [
|
|
13
19
|
"dist/"
|
|
14
20
|
],
|
|
21
|
+
"bin": "./dist/cli.js",
|
|
15
22
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
16
23
|
"dependencies": {
|
|
17
|
-
"@arcgis/components-build-utils": "5.0.0-next.
|
|
18
|
-
"@arcgis/toolkit": "5.0.0-next.
|
|
24
|
+
"@arcgis/components-build-utils": "5.0.0-next.81",
|
|
25
|
+
"@arcgis/toolkit": "5.0.0-next.81",
|
|
26
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
19
27
|
"chalk": "^5.4.1",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
28
|
+
"commander": "^14.0.0",
|
|
29
|
+
"tslib": "^2.8.1"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"typescript": "~5.9.3"
|
|
22
33
|
}
|
|
23
34
|
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiDeclaration, ApiEvent, ApiExport, ApiJson, ApiModule } from '../apiJson';
|
|
2
|
-
import { default as ts } from 'typescript';
|
|
3
|
-
import { CopyPropertyDoc, CopyMethodDoc, CopyEventDoc } from '../types';
|
|
4
|
-
export type ApiExtractorOptions = {
|
|
5
|
-
/**
|
|
6
|
-
* Whether to extract full API information, with type-checking. This should be
|
|
7
|
-
* the case during build or when running under Storybook. Otherwise, the dev
|
|
8
|
-
* server should keep API extraction to bare minimum to reduce needless
|
|
9
|
-
* overhead. Only the information necessary for the dev server is extracted.
|
|
10
|
-
*/
|
|
11
|
-
isFullApiExtraction: boolean;
|
|
12
|
-
cwd: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* This is a base abstract class. It should be subclassed to implement the
|
|
16
|
-
* specific extraction logic.
|
|
17
|
-
*/
|
|
18
|
-
export declare abstract class ApiExtractor {
|
|
19
|
-
options: ApiExtractorOptions;
|
|
20
|
-
constructor(options: ApiExtractorOptions);
|
|
21
|
-
protected file: ts.SourceFile;
|
|
22
|
-
protected apiModule: ApiModule;
|
|
23
|
-
/** Given an array of TypeScript source files, generate an api.json file */
|
|
24
|
-
extract(files: readonly ts.SourceFile[]): ApiJson;
|
|
25
|
-
protected extractModules(files: readonly ts.SourceFile[]): ApiModule[];
|
|
26
|
-
protected extractModule(module: ts.SourceFile): ApiModule;
|
|
27
|
-
/**
|
|
28
|
-
* For a given module, extract all public declarations.
|
|
29
|
-
*/
|
|
30
|
-
protected extractDeclarations(module: ts.SourceFile): ApiDeclaration[];
|
|
31
|
-
/**
|
|
32
|
-
* For each statement in a module, extract a declaration if it is a public API
|
|
33
|
-
*/
|
|
34
|
-
protected abstract extractDeclaration(statement: ts.Statement): ApiDeclaration | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Infer ApiModule.exports based on ApiModule.declarations.
|
|
37
|
-
*/
|
|
38
|
-
protected inferExports(declarations: ApiDeclaration[]): ApiExport[];
|
|
39
|
-
/**
|
|
40
|
-
* Infer ApiExport based on ApiDeclaration
|
|
41
|
-
*/
|
|
42
|
-
protected abstract inferExport(declaration: ApiDeclaration): ApiExport | undefined;
|
|
43
|
-
copyDoc(errorReportingNode: ts.Node, copyDocDefinition: CopyPropertyDoc | undefined, property: ApiCustomElementField, component: ApiCustomElementDeclaration): void;
|
|
44
|
-
copyDoc(errorReportingNode: ts.Node, copyDocDefinition: CopyMethodDoc | undefined, method: ApiClassMethod, component: ApiCustomElementDeclaration): void;
|
|
45
|
-
copyDoc(errorReportingNode: ts.Node, copyDocDefinition: CopyEventDoc | undefined, event: ApiEvent, component: ApiCustomElementDeclaration): void;
|
|
46
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { default as ts } from 'typescript';
|
|
2
|
-
import { ApiCustomElementField, ApiCustomElementDeclaration, ApiEvent, ApiDocsTag, ApiCustomElementMember } from '../apiJson';
|
|
3
|
-
export declare function symbolToDocs(checker: ts.TypeChecker, symbol: ts.Signature | ts.Symbol): {
|
|
4
|
-
description: ApiCustomElementField["description"];
|
|
5
|
-
docsTags: ApiDocsTag[];
|
|
6
|
-
};
|
|
7
|
-
export declare const internalJsDocTag = "internal";
|
|
8
|
-
export declare function apiMemberToSynthesizedComments(apiMember: ApiCustomElementDeclaration | ApiCustomElementMember | ApiEvent): ts.SynthesizedComment[];
|
|
9
|
-
export declare function setApiDocFromJsDoc(node: ts.PropertyName, checker: ts.TypeChecker, api: Partial<Pick<ApiCustomElementDeclaration, "cssParts" | "cssProperties" | "cssStates" | "slots"> & Pick<ApiCustomElementField, "default" | "deprecated" | "description" | "docsTags" | "privacy" | "readonly">>, docs?: ReturnType<typeof symbolToDocs>): void;
|
|
File without changes
|