@arcgis/api-extractor 5.0.0-next.7 → 5.0.0-next.71
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 +65 -0
- package/dist/extractor/ApiExtractor.d.ts +138 -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 +13 -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,65 @@
|
|
|
1
|
+
import { path as s, sh as c } from "@arcgis/components-build-utils";
|
|
2
|
+
import { mkdir as d, writeFile as m } from "node:fs/promises";
|
|
3
|
+
const a = "diff --unified=2 --new-file --recursive";
|
|
4
|
+
async function I({
|
|
5
|
+
originalDtsPath: t,
|
|
6
|
+
newDtsPath: n,
|
|
7
|
+
outputMdPath: e = "types-diff.md",
|
|
8
|
+
truncate: i = !0
|
|
9
|
+
}) {
|
|
10
|
+
n = s.join(s.resolve(n), "/");
|
|
11
|
+
const l = c(`${a} ${t} ${n} || true`);
|
|
12
|
+
let o = "";
|
|
13
|
+
if (l.length === 0)
|
|
14
|
+
console.log("Public types did not change.");
|
|
15
|
+
else {
|
|
16
|
+
o = `### Public types changes
|
|
17
|
+
|
|
18
|
+
🧐 please verify that the changes to the public API/doc below are intentional.
|
|
19
|
+
🟥 If removing/changing APIs, remember the semver promise.
|
|
20
|
+
🟩 If adding APIs, add to release notes.`;
|
|
21
|
+
let r = u(l.split(`
|
|
22
|
+
`), n);
|
|
23
|
+
i && r.length > f && (o += `> [!WARNING]
|
|
24
|
+
> Too many changes. Only displaying the first ${f} lines (total ${r.length}) of the diff. If you need to see complete diff, re-run this command with --no-truncate.
|
|
25
|
+
|
|
26
|
+
`, r = r.slice(0, f)), o += `${h(r)}
|
|
27
|
+
|
|
28
|
+
`, console.log(`Wrote diff to ${e}`);
|
|
29
|
+
}
|
|
30
|
+
await d(s.dirname(e), { recursive: !0 }), await m(e, o);
|
|
31
|
+
}
|
|
32
|
+
function u(t, n) {
|
|
33
|
+
for (let e = 0; e < t.length; e++) {
|
|
34
|
+
const i = t[e];
|
|
35
|
+
if (
|
|
36
|
+
// Make diff smaller by excluding the `diff ...` lines
|
|
37
|
+
(i.startsWith(a) || // Redundant line - make file header smaller
|
|
38
|
+
i.startsWith("---") || // Not important
|
|
39
|
+
i === "\") && (t.splice(e, 1), e--), i.startsWith("+++")
|
|
40
|
+
) {
|
|
41
|
+
const l = i.indexOf(" ");
|
|
42
|
+
let o = i.slice(4, l === -1 ? i.length : l);
|
|
43
|
+
o.startsWith(n) && (o = o.slice(n.length)), t[e] = `🟦 ${o}`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return t;
|
|
47
|
+
}
|
|
48
|
+
const f = 1e3;
|
|
49
|
+
function h(t) {
|
|
50
|
+
const n = t.length, e = g(t.join(`
|
|
51
|
+
`));
|
|
52
|
+
return n <= 10 ? e : `<details><summary>See diff</summary>
|
|
53
|
+
|
|
54
|
+
${e}
|
|
55
|
+
|
|
56
|
+
</details>`;
|
|
57
|
+
}
|
|
58
|
+
function g(t) {
|
|
59
|
+
return `\`\`\`diff
|
|
60
|
+
${t}
|
|
61
|
+
\`\`\``;
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
I as diffTypes
|
|
65
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ApiClassMethod, ApiClassDeclaration, ApiCustomElementField, ApiDeclaration, ApiEvent, ApiJson, ApiModule, ApiCustomElementDeclaration, ApiFunctionDeclaration, ApiVariableDeclaration, ApiInterfaceDeclaration, ApiObjectLikeDeclaration, ApiCustomElementMember, ApiReference, ApiClassMember, ApiAttribute, ApiSlot, ApiCssPart, ApiCssCustomProperty, ApiCssCustomState, ApiMixinDeclaration, ApiClassField, ApiReferenceWithTypeArguments } from '../apiJson.ts';
|
|
2
|
+
import { default as ts } from 'typescript';
|
|
3
|
+
import { CopyDocDefinitions } from '../types.ts';
|
|
4
|
+
export type ApiExtractorOptions = {
|
|
5
|
+
sortModules: boolean;
|
|
6
|
+
/** The path relative to which module.path will be resolved */
|
|
7
|
+
cwd: string;
|
|
8
|
+
environment: "development" | "production";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* This is a base abstract class. It should be subclassed to implement the
|
|
12
|
+
* specific extraction logic.
|
|
13
|
+
*/
|
|
14
|
+
export declare abstract class ApiExtractor {
|
|
15
|
+
constructor(options: ApiExtractorOptions);
|
|
16
|
+
options: ApiExtractorOptions;
|
|
17
|
+
/** File that is currently being extracted */
|
|
18
|
+
file: ts.SourceFile;
|
|
19
|
+
/** The module that is currently being produced */
|
|
20
|
+
apiModule: ApiModule;
|
|
21
|
+
/** Given an array of TypeScript source files, generate an api.json file */
|
|
22
|
+
extract(files: readonly ts.SourceFile[]): ApiJson;
|
|
23
|
+
/**
|
|
24
|
+
* Hostname of the documentation site for the current environment.
|
|
25
|
+
*/
|
|
26
|
+
normalizedDocumentationHost: string;
|
|
27
|
+
/**
|
|
28
|
+
* Hostname of the documentation site that is not for the current environment.
|
|
29
|
+
* These references will be replaced by the extractor to point to the
|
|
30
|
+
* normalizedDocumentationHost instead.
|
|
31
|
+
*
|
|
32
|
+
* Use case:
|
|
33
|
+
* - In source code, link to internal docs only. This gives more up to date
|
|
34
|
+
* docs and avoids 404 errors for pages that are not yet part of public
|
|
35
|
+
* release.
|
|
36
|
+
* - In production builds, the URLs are replaced with the public docs hostname.
|
|
37
|
+
*/
|
|
38
|
+
alternativeDocumentationHost: string;
|
|
39
|
+
extractModules(files: readonly ts.SourceFile[]): ApiModule[];
|
|
40
|
+
/**
|
|
41
|
+
* @param module
|
|
42
|
+
* @param sourcePath cwd-relative path to the source file (esri/core/Accessor.ts)
|
|
43
|
+
* @param importPath public import path of the module without package name or file extension (core/Accessor)
|
|
44
|
+
*/
|
|
45
|
+
extractModule(module: ts.SourceFile, sourcePath?: string, importPath?: string): ApiModule;
|
|
46
|
+
/**
|
|
47
|
+
* For a given module, extract all public declarations.
|
|
48
|
+
*/
|
|
49
|
+
protected extractDeclarations(module: ts.SourceFile): void;
|
|
50
|
+
/**
|
|
51
|
+
* For each statement in a module, extract a declaration if it is a public API
|
|
52
|
+
*/
|
|
53
|
+
protected abstract extractDeclaration(statement: ts.Statement, index: number): ApiDeclaration | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Add ApiModule.exports entry based on ApiDeclaration
|
|
56
|
+
*
|
|
57
|
+
* To reduce the size of the api.json, we only add exports entries for web
|
|
58
|
+
* components or default exports.
|
|
59
|
+
*/
|
|
60
|
+
addExport(declaration: ApiDeclaration, isDefault: boolean): void;
|
|
61
|
+
copyDoc(errorReportingNode: ts.Node, copyDocDefinitions: CopyDocDefinitions["properties"], apiProperty: ApiCustomElementField, apiComponent: ApiObjectLikeDeclaration, apiModule: ApiModule): void;
|
|
62
|
+
copyDoc(errorReportingNode: ts.Node, copyDocDefinitions: CopyDocDefinitions["methods"], method: ApiClassMethod, component: ApiObjectLikeDeclaration, apiModule: ApiModule): void;
|
|
63
|
+
copyDoc(errorReportingNode: ts.Node, copyDocDefinitions: CopyDocDefinitions["events"], event: ApiEvent, component: ApiObjectLikeDeclaration, apiModule: ApiModule): void;
|
|
64
|
+
copyDoc(errorReportingNode: ts.Node, copyDocDefinitions: CopyDocDefinitions["functions"], apiFunction: ApiFunctionDeclaration, apiModule: ApiModule): void;
|
|
65
|
+
copyDoc(errorReportingNode: ts.Node, copyDocDefinitions: CopyDocDefinitions["variables"], variable: ApiVariableDeclaration, apiModule: ApiModule): void;
|
|
66
|
+
copyDoc(errorReportingNode: ts.Node, copyDocDefinitions: CopyDocDefinitions["classes"], classDeclaration: ApiClassDeclaration, apiModule: ApiModule): void;
|
|
67
|
+
copyDoc(errorReportingNode: ts.Node, copyDocDefinitions: CopyDocDefinitions["customElements"], componentDeclaration: ApiCustomElementDeclaration, apiModule: ApiModule): void;
|
|
68
|
+
copyDoc(errorReportingNode: ts.Node, copyDocDefinitions: CopyDocDefinitions["interfaces"], interfaceDeclaration: ApiInterfaceDeclaration, apiModule: ApiModule): void;
|
|
69
|
+
/**
|
|
70
|
+
* Inherit public members from mixins and superclass.
|
|
71
|
+
*
|
|
72
|
+
* In cast of Lumina, for this to work, the superclass needs to be in a file
|
|
73
|
+
* named like a component (src/components/name/name.tsx), even if it is not a
|
|
74
|
+
* standalone component. See
|
|
75
|
+
* https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/3212
|
|
76
|
+
*/
|
|
77
|
+
inheritMembers(moduleName: string, component: ApiClassDeclaration | ApiMixinDeclaration, modules: ApiModule[]): void;
|
|
78
|
+
/**
|
|
79
|
+
* Inherit members from a superclass or mixin.
|
|
80
|
+
*/
|
|
81
|
+
protected inheritMembersFrom(parent: ApiExtractorInheritanceData, destination: ApiClassDeclaration | ApiMixinDeclaration, destinationModuleName: string): void;
|
|
82
|
+
protected inheritMembersOfKind<T extends ApiAttribute | ApiCssCustomProperty | ApiCssCustomState | ApiCssPart | ApiEvent | ApiSlot>(members: T[] | undefined, parentMembers: T[], parentIndexedMembers: Record<string, T>, inheritedFrom?: ApiReference): T[];
|
|
83
|
+
resolvedInheritance: Record<string,
|
|
84
|
+
/**
|
|
85
|
+
* `false` means don't inherit (or resolution failed).
|
|
86
|
+
*
|
|
87
|
+
* `undefined` means we already inherited the members, but have not yet
|
|
88
|
+
* computed the inheritance data for this module (almost every class
|
|
89
|
+
* inherits some class, but only a few are inherited by other classes, so
|
|
90
|
+
* we compute inheritance data lazily).
|
|
91
|
+
*/
|
|
92
|
+
ApiExtractorInheritanceData | false | undefined>;
|
|
93
|
+
noInheritMembers: Record<string, string[] | undefined>;
|
|
94
|
+
/**
|
|
95
|
+
* Based on the superclass name, find the actual declaration in the modules.
|
|
96
|
+
*/
|
|
97
|
+
protected resolveInheritance(superClassModule: string, modules: ApiModule[]): ApiExtractorInheritanceData | false;
|
|
98
|
+
/**
|
|
99
|
+
* Overwrite point
|
|
100
|
+
*
|
|
101
|
+
* FINAL: jsapi-extractor has a more efficient implementation because it
|
|
102
|
+
* has to deal with inheritance a lot. Unify it with Lumina.
|
|
103
|
+
*/
|
|
104
|
+
protected findSuperclassDeclaration(moduleName: string, modules: ApiModule[]): readonly [string, ApiClassDeclaration | ApiMixinDeclaration] | false;
|
|
105
|
+
protected handleEventTypesProperty(_apiMember: ApiClassMember, _apiComponent: ApiClassDeclaration | ApiMixinDeclaration, _moduleName: string): void;
|
|
106
|
+
/**
|
|
107
|
+
* This method should check if the super property is an accessor, then the
|
|
108
|
+
* override property should be promoted to an accessor too.
|
|
109
|
+
* This is necessary until we migrate to standard decorators since - after
|
|
110
|
+
* that internal accessor status will match the status in the public typings.
|
|
111
|
+
*/
|
|
112
|
+
protected maybePromotePropertyToAutoAccessor(_apiProperty: ApiClassField, _superApiProperty: ApiClassField): void;
|
|
113
|
+
protected maybeResolveMixinBaseClass(_apiReference: ApiReferenceWithTypeArguments, _currentModule: string): ApiInterfaceDeclaration | undefined;
|
|
114
|
+
}
|
|
115
|
+
type ApiExtractorInheritanceData = {
|
|
116
|
+
inheritanceData: ApiReference;
|
|
117
|
+
declaration: ApiClassDeclaration | ApiMixinDeclaration;
|
|
118
|
+
/**
|
|
119
|
+
* Used for validation only. If class has any settable fields, and class is
|
|
120
|
+
* extended by another one, require that the class module exports the
|
|
121
|
+
* `<className>Properties` interface. It will be extended by the superclass'
|
|
122
|
+
* properties interface.
|
|
123
|
+
*/
|
|
124
|
+
hasSettableField: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Indexed by name for quick lookup of "overridden" status.
|
|
127
|
+
* Using a map because we do .get() during constructor of the Map, and because
|
|
128
|
+
* there are often 10+ items with random access.
|
|
129
|
+
*/
|
|
130
|
+
indexedMembers: Map<string, ApiClassMember | ApiCustomElementMember | undefined> | undefined;
|
|
131
|
+
indexedEvents: Record<string, ApiEvent> | undefined;
|
|
132
|
+
indexedAttributes: Record<string, ApiAttribute> | undefined;
|
|
133
|
+
indexedSlots: Record<string, ApiSlot> | undefined;
|
|
134
|
+
indexedCssParts: Record<string, ApiCssPart> | undefined;
|
|
135
|
+
indexedCssProperties: Record<string, ApiCssCustomProperty> | undefined;
|
|
136
|
+
indexedCssStates: Record<string, ApiCssCustomState> | undefined;
|
|
137
|
+
};
|
|
138
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
1
|
+
export type * from './apiJson.ts';
|
|
2
|
+
export { ApiExtractor, type ApiExtractorOptions } from './extractor/ApiExtractor.ts';
|
|
3
|
+
export { unsafeGetUndocumentedPrinter, unsafeUndocumentedTs } from './internalTypeScriptApis.ts';
|
|
4
|
+
export type { CopyDocDefinitions, NodeDoc } from './types.ts';
|
|
5
|
+
export { findReferenceRanges, getApiMemberName, getMaybeStaticApiMemberName, getApiNodeLabel, globalPackageIdentifier, isApiMethod, isApiProperty, multipleJsDocTags, naturalSortModules, postProcessLinks, apiExtractorJsDocError, compareClassMembers, compareNamedNodes, compareStrings, } from './utils/apiHelpers.ts';
|
|
6
|
+
export { extractBooleanInitializer, findDecorator, getMemberName, hasIgnoredModifier, setDefaultFromInitializer, getBasename, } from './utils/astHelpers.ts';
|
|
7
|
+
export { alternativeDocumentationHost, normalizedDocumentationHost } from './utils/jsDocHelpers.ts';
|
|
8
|
+
export { apiMemberToNodeDoc, nodeDocToString, nodeDocToSynthesizedComment } from './utils/jsDocPrinter.ts';
|
|
9
|
+
export { setApiDocFromJsDoc, setApiDocFromSymbol, symbolToDocs, getNodeDoc } from './utils/jsDocParser.ts';
|
|
10
|
+
export { typeScriptGlobals, typeScriptGlobalsViewUrlCommonPrefix } from './config/typeReferences/globals.ts';
|
|
11
|
+
export { printClass, printInterface, printMethod, printFunction, printSignature, printProperty, printGetterSetter, printVariable, printTypeAlias, printTypeParameters, } from './utils/partPrinter.ts';
|
|
12
|
+
export { apiExtractorError, apiExtractorErrorCount, resetApiExtractorErrorCount, setApiExtractorErrorLogger, apiExtractorDiagnosticContext, type ApiExtractorErrorContext, } from './utils/error.ts';
|