@arcgis/api-extractor 5.0.0-next.135 → 5.0.0-next.137

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.
Files changed (63) hide show
  1. package/dist/ApiExtractor-BwOcUvPV.js +2644 -0
  2. package/dist/apiJson.d.ts +706 -760
  3. package/dist/cli.js +26 -2
  4. package/dist/compilerHints.d.ts +62 -0
  5. package/dist/diff/diffApiJson.d.ts +6 -3
  6. package/dist/diff/diffApiJson.js +142 -0
  7. package/dist/diff/fetchApiJsonFromNpm.d.ts +5 -2
  8. package/dist/diff/fetchApiJsonFromNpm.js +9 -0
  9. package/dist/diff/types.d.ts +70 -56
  10. package/dist/diffTypes/index.d.ts +20 -23
  11. package/dist/diffTypes/index.js +4 -2
  12. package/dist/extractor/ApiExtractor.d.ts +72 -137
  13. package/dist/extractor/ApiExtractor.js +9 -0
  14. package/dist/extractor/config.d.ts +425 -39
  15. package/dist/extractor/config.js +17 -0
  16. package/dist/extractor/extractors/copyDoc.d.ts +25 -0
  17. package/dist/extractor/privateContext.d.ts +19 -0
  18. package/dist/extractor/privateContext.js +84 -0
  19. package/dist/extractor/processing/links.d.ts +12 -0
  20. package/dist/extractor/processing/links.js +177 -0
  21. package/dist/extractor/types.d.ts +40 -0
  22. package/dist/extractor/webComponent/findComponents.d.ts +19 -0
  23. package/dist/extractor/webComponent/findComponents.js +36 -0
  24. package/dist/extractor/webComponent/pathMapping.d.ts +11 -0
  25. package/dist/extractor/webComponent/pathMapping.js +44 -0
  26. package/dist/index.d.ts +164 -12
  27. package/dist/index.js +3 -841
  28. package/dist/typeScript-CzUTFiYO.js +64 -0
  29. package/dist/uiUtils/index.d.ts +10 -19
  30. package/dist/uiUtils/index.js +3 -55
  31. package/dist/utils/apiHelpers.d.ts +28 -61
  32. package/dist/utils/apiHelpers.js +80 -0
  33. package/dist/utils/astHelpers.d.ts +22 -21
  34. package/dist/utils/astHelpers.js +67 -0
  35. package/dist/utils/hydrateApiType.d.ts +26 -0
  36. package/dist/utils/hydrateApiType.js +62 -0
  37. package/dist/utils/inferEntrypoints.d.ts +17 -0
  38. package/dist/utils/inferEntrypoints.js +26 -0
  39. package/dist/utils/internalTypeScriptApis.d.ts +92 -0
  40. package/dist/utils/internalTypeScriptApis.js +58 -0
  41. package/dist/utils/partPrinter.d.ts +25 -19
  42. package/dist/utils/partPrinter.js +82 -0
  43. package/dist/vite/plugin.d.ts +53 -0
  44. package/dist/vite/plugin.js +107 -0
  45. package/dist/vite/typeScript.d.ts +16 -0
  46. package/dist/vite/typeScript.js +6 -0
  47. package/dist/worker-CULPfolw.js +3599 -0
  48. package/package.json +40 -9
  49. package/dist/cli.d.ts +0 -2
  50. package/dist/config/typeReferences/docLinkAdditions.d.ts +0 -51
  51. package/dist/config/typeReferences/globals.d.ts +0 -11
  52. package/dist/config/typeReferences/stringDocLinkAdditions.d.ts +0 -17
  53. package/dist/config/typeReferences/typeScriptGlobals.json.d.ts +0 -3
  54. package/dist/diff/index.d.ts +0 -3
  55. package/dist/diff/index.js +0 -149
  56. package/dist/ensureCemCompatibility.d.ts +0 -1
  57. package/dist/internalTypeScriptApis.d.ts +0 -31
  58. package/dist/types.d.ts +0 -22
  59. package/dist/utils/error.d.ts +0 -17
  60. package/dist/utils/jsDocHelpers.d.ts +0 -2
  61. package/dist/utils/jsDocParser.d.ts +0 -46
  62. package/dist/utils/jsDocPrinter.d.ts +0 -13
  63. package/dist/utils/print.d.ts +0 -6
@@ -1,139 +1,74 @@
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
- };
1
+ import type ts from "typescript";
2
+ import type { ApiModule } from "../apiJson.js";
3
+ import type { ApiExtractorConfig, ResolvedApiExtractorConfig } from "./config.js";
4
+ import type { ApiExtractorResult, ApiExtractorWatcher } from "./types.js";
5
+
10
6
  /**
11
- * This is a base abstract class. It should be subclassed to implement the
12
- * specific extraction logic.
7
+ * ApiExtractor's main JavaScript entrypoint.
8
+ *
9
+ * @example
10
+ * ```js
11
+ *
12
+ * import { loadApiExtractorConfig, mergeApiExtractorConfigs } from "@arcgis/api-extractor/extractor/config";
13
+ * import { ApiExtractor } from "@arcgis/api-extractor/extractor/ApiExtractor";
14
+ *
15
+ * const baseConfig = await loadApiExtractorConfig(process.cwd(), "api-extractor.config.ts");
16
+ *
17
+ * // Optionally override parts of the config
18
+ * const mergedConfig = mergeApiExtractorConfigs(baseConfig, {
19
+ * types: {
20
+ * fullTypeCheck: true,
21
+ * },
22
+ * });
23
+ *
24
+ * const extractor = new ApiExtractor(mergedConfig);
25
+ *
26
+ * const { apiJson, dtsFiles } = await extractor.run();
27
+ * // OR, start a watcher:
28
+ * const watcher = await extractor.watch();
29
+ * ```
13
30
  */
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, eventsWereExplicitlyInherited: boolean): 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: Readonly<Record<string, readonly string[]>>;
94
- /**
95
- * Based on the superclass name, find the actual declaration in the modules.
96
- */
97
- protected resolveInheritance(superClassModule: string, modules: ApiModule[], isMixin: boolean): 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[], _isMixin: boolean): readonly [string, ApiClassDeclaration | ApiMixinDeclaration] | false;
105
- protected handleEventTypesProperty(_apiMember: ApiClassMember, _apiComponent: ApiClassDeclaration | ApiMixinDeclaration, _moduleName: string): void;
106
- protected resolvePropertyAutoCastingType(_apiMember: ApiClassMember, _moduleName: string): void;
107
- /**
108
- * This method should check if the super property is an accessor, then the
109
- * override property should be promoted to an accessor too.
110
- * This is necessary until we migrate to standard decorators since - after
111
- * that internal accessor status will match the status in the public typings.
112
- */
113
- protected maybePromotePropertyToAutoAccessor(_apiProperty: ApiClassField, _superApiProperty: ApiClassField): void;
114
- protected maybeResolveMixinBaseClass(_apiReference: ApiReferenceWithTypeArguments, _currentModule: string): ApiInterfaceDeclaration | undefined;
115
- }
116
- type ApiExtractorInheritanceData = {
117
- inheritanceData: ApiReference;
118
- declaration: ApiClassDeclaration | ApiMixinDeclaration;
119
- /**
120
- * Used for validation only. If class has any settable fields, and class is
121
- * extended by another one, require that the class module exports the
122
- * `<className>Properties` interface. It will be extended by the superclass'
123
- * properties interface.
124
- */
125
- hasSettableField: boolean;
126
- /**
127
- * Indexed by name for quick lookup of "overridden" status.
128
- * Using a map because we do .get() during constructor of the Map, and because
129
- * there are often 10+ items with random access.
130
- */
131
- indexedMembers: Map<string, ApiClassMember | ApiCustomElementMember | undefined> | undefined;
132
- indexedEvents: Record<string, ApiEvent> | undefined;
133
- indexedAttributes: Record<string, ApiAttribute> | undefined;
134
- indexedSlots: Record<string, ApiSlot> | undefined;
135
- indexedCssParts: Record<string, ApiCssPart> | undefined;
136
- indexedCssProperties: Record<string, ApiCssCustomProperty> | undefined;
137
- indexedCssStates: Record<string, ApiCssCustomState> | undefined;
138
- };
139
- export {};
31
+ export class ApiExtractor {
32
+ constructor(rawConfig?: ApiExtractorConfig);
33
+ readonly config: ResolvedApiExtractorConfig;
34
+ /**
35
+ * Number of errors logged during the extraction process.
36
+ * Errors will be logged using the `config.logger.error` callback if provided.
37
+ * Otherwise, they will be logged using `console.error`.
38
+ *
39
+ * @default 0
40
+ */
41
+ errorCount: number;
42
+ /** @experimental */
43
+ moduleMap: Map<string, ApiModule>;
44
+ /**
45
+ * @experimental
46
+ * @example "https://developers.arcgis.com/javascript/latest/api-reference/esri-"
47
+ */
48
+ readonly normalizedApiReferencePrefix: string;
49
+ /**
50
+ * If doing typed extraction or full type check, this will be the ts.Program.
51
+ * If doing untyped watch, this will be a minimal Program-like object to reuse
52
+ * SourceFiles for unchanged files.
53
+ * Otherwise, undefined.
54
+ */
55
+ program?: {
56
+ getSourceFile: ts.Program["getSourceFile"];
57
+ getSourceFiles: ts.Program["getSourceFiles"];
58
+ getTypeChecker?: ts.Program["getTypeChecker"];
59
+ };
60
+ /**
61
+ * @deprecated
62
+ * @default 0
63
+ */
64
+ silencedBrokenLinkCount: number;
65
+ /** The high-level API for running the extractor on the current project. */
66
+ run(): Promise<ApiExtractorResult>;
67
+ /**
68
+ * The high-level API for starting a watch-mode extraction on the current project.
69
+ * When watching, double check that the configuration options the ApiExtractor
70
+ * was created with are appropriate for watch mode (disable full type check
71
+ * and type verifier if not necessary).
72
+ */
73
+ watch(): Promise<ApiExtractorWatcher>;
74
+ }
@@ -0,0 +1,9 @@
1
+ import "../typeScript-CzUTFiYO.js";
2
+ import { A as x } from "../ApiExtractor-BwOcUvPV.js";
3
+ import "../worker-CULPfolw.js";
4
+ import "./processing/links.js";
5
+ import "typescript";
6
+ import "@arcgis/toolkit/function";
7
+ export {
8
+ x as ApiExtractor
9
+ };