@arcgis/api-extractor 5.0.0-next.136 → 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.
- package/dist/ApiExtractor-BwOcUvPV.js +2644 -0
- package/dist/apiJson.d.ts +706 -760
- package/dist/cli.js +26 -2
- package/dist/compilerHints.d.ts +62 -0
- package/dist/diff/diffApiJson.d.ts +6 -3
- package/dist/diff/diffApiJson.js +142 -0
- package/dist/diff/fetchApiJsonFromNpm.d.ts +5 -2
- package/dist/diff/fetchApiJsonFromNpm.js +9 -0
- package/dist/diff/types.d.ts +70 -56
- package/dist/diffTypes/index.d.ts +20 -23
- package/dist/diffTypes/index.js +4 -2
- package/dist/extractor/ApiExtractor.d.ts +72 -137
- package/dist/extractor/ApiExtractor.js +9 -0
- package/dist/extractor/config.d.ts +425 -39
- package/dist/extractor/config.js +17 -0
- package/dist/extractor/extractors/copyDoc.d.ts +25 -0
- package/dist/extractor/privateContext.d.ts +19 -0
- package/dist/extractor/privateContext.js +84 -0
- package/dist/extractor/processing/links.d.ts +12 -0
- package/dist/extractor/processing/links.js +177 -0
- package/dist/extractor/types.d.ts +40 -0
- package/dist/extractor/webComponent/findComponents.d.ts +19 -0
- package/dist/extractor/webComponent/findComponents.js +36 -0
- package/dist/extractor/webComponent/pathMapping.d.ts +11 -0
- package/dist/extractor/webComponent/pathMapping.js +44 -0
- package/dist/index.d.ts +164 -12
- package/dist/index.js +3 -841
- package/dist/typeScript-CzUTFiYO.js +64 -0
- package/dist/uiUtils/index.d.ts +10 -19
- package/dist/uiUtils/index.js +3 -55
- package/dist/utils/apiHelpers.d.ts +28 -61
- package/dist/utils/apiHelpers.js +80 -0
- package/dist/utils/astHelpers.d.ts +22 -21
- package/dist/utils/astHelpers.js +67 -0
- package/dist/utils/hydrateApiType.d.ts +26 -0
- package/dist/utils/hydrateApiType.js +62 -0
- package/dist/utils/inferEntrypoints.d.ts +17 -0
- package/dist/utils/inferEntrypoints.js +26 -0
- package/dist/utils/internalTypeScriptApis.d.ts +92 -0
- package/dist/utils/internalTypeScriptApis.js +58 -0
- package/dist/utils/partPrinter.d.ts +25 -19
- package/dist/utils/partPrinter.js +82 -0
- package/dist/vite/plugin.d.ts +53 -0
- package/dist/vite/plugin.js +107 -0
- package/dist/vite/typeScript.d.ts +16 -0
- package/dist/vite/typeScript.js +6 -0
- package/dist/worker-CULPfolw.js +3599 -0
- package/package.json +40 -9
- package/dist/cli.d.ts +0 -2
- package/dist/config/typeReferences/docLinkAdditions.d.ts +0 -51
- package/dist/config/typeReferences/globals.d.ts +0 -11
- package/dist/config/typeReferences/stringDocLinkAdditions.d.ts +0 -17
- package/dist/config/typeReferences/typeScriptGlobals.json.d.ts +0 -3
- package/dist/diff/index.d.ts +0 -3
- package/dist/diff/index.js +0 -149
- package/dist/ensureCemCompatibility.d.ts +0 -1
- package/dist/internalTypeScriptApis.d.ts +0 -31
- package/dist/types.d.ts +0 -22
- package/dist/utils/error.d.ts +0 -17
- package/dist/utils/jsDocHelpers.d.ts +0 -2
- package/dist/utils/jsDocParser.d.ts +0 -46
- package/dist/utils/jsDocPrinter.d.ts +0 -13
- package/dist/utils/print.d.ts +0 -6
|
@@ -1,41 +1,254 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type ts from "typescript";
|
|
2
|
+
import type { MiniPackageJson } from "@arcgis/components-build-utils";
|
|
3
|
+
import type { CopyDocDefinitions } from "./extractors/copyDoc.js";
|
|
4
|
+
import type { ApiExtractor } from "./ApiExtractor.js";
|
|
5
|
+
import type { TypeScriptConfigResult } from "../vite/typeScript.js";
|
|
6
|
+
import type { ApiModule } from "../apiJson.js";
|
|
7
|
+
import type { ApiExtractorResult } from "./types.js";
|
|
8
|
+
|
|
2
9
|
export interface ApiExtractorConfig {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*/
|
|
35
|
-
readonly excludedDirectories?: Set<string>;
|
|
36
|
-
/** @public */
|
|
37
|
-
readonly noInheritMembers?: NoInheritMembers;
|
|
10
|
+
readonly context?: ApiExtractorContextConfig;
|
|
11
|
+
readonly types?: ApiExtractorTypesConfig;
|
|
12
|
+
readonly documentation?: ApiExtractorDocumentationConfig;
|
|
13
|
+
readonly verify?: ApiExtractorVerifyConfig;
|
|
14
|
+
readonly watch?: ApiExtractorWatchConfig;
|
|
15
|
+
/**
|
|
16
|
+
* API Extractor is strict about ensuring public APIs only reference types
|
|
17
|
+
* that were in turn explicitly marked as public. This avoids unintentionally
|
|
18
|
+
* exposing private details. For packages in the process of transition to this
|
|
19
|
+
* stricter syntax, you can temporarily disable the strictness.
|
|
20
|
+
*
|
|
21
|
+
* Under strict:false, the following checks are relaxed:
|
|
22
|
+
* - Web components, and their `@property()`, `@method()`, and events are
|
|
23
|
+
* implicitly public. The types referenced by them are also implicitly
|
|
24
|
+
* public. This behavior is suppressed if `@private` JSDoc tag is present.
|
|
25
|
+
* - If public function/method doesn't have explicit `@param` for each
|
|
26
|
+
* parameter, an error is suppressed.
|
|
27
|
+
*
|
|
28
|
+
* @default // false in Lumina web component projects (temporary). true otherwise.
|
|
29
|
+
*/
|
|
30
|
+
readonly strict?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* This function will be called after the api.json is created but before it is
|
|
33
|
+
* used to generate any output files.
|
|
34
|
+
*
|
|
35
|
+
* You can mutate the api.json to affect the types, lazy component metadata
|
|
36
|
+
* and documentation.
|
|
37
|
+
*
|
|
38
|
+
* @param result
|
|
39
|
+
*/
|
|
40
|
+
afterApiJsonCreate?(result: Pick<ApiExtractorResult, "apiJson">): void;
|
|
38
41
|
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Extraction context. Tells what to do and how. If running inside Vite, most
|
|
45
|
+
* of these options will be set automatically.
|
|
46
|
+
*/
|
|
47
|
+
export interface ApiExtractorContextConfig {
|
|
48
|
+
/**
|
|
49
|
+
* The path for emitting .d.ts files
|
|
50
|
+
*
|
|
51
|
+
* @default // "" (do not emit) if running standalone. "dist/" if running in Vite.
|
|
52
|
+
* @example "dist/"
|
|
53
|
+
*/
|
|
54
|
+
readonly dtsEmitPath?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to delete any existing .d.ts files in dtsEmitPath before emitting
|
|
57
|
+
* new ones.
|
|
58
|
+
*
|
|
59
|
+
* @default config.dtsEmitPath !== undefined && config.environment === "production"
|
|
60
|
+
*/
|
|
61
|
+
readonly emptyDtsEmitPath?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The path for emitting api.json.
|
|
64
|
+
*
|
|
65
|
+
* @default "" // (do not emit)
|
|
66
|
+
* @example "dist/docs/api.json"
|
|
67
|
+
*/
|
|
68
|
+
readonly apiJsonEmitPath?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The environment in which the extractor is running.
|
|
71
|
+
*
|
|
72
|
+
* @default // "production" if running standalone. Inherits Vite environment if running in Vite.
|
|
73
|
+
*/
|
|
74
|
+
readonly environment?: "development" | "production";
|
|
75
|
+
/**
|
|
76
|
+
* The path to the root of the project to extract.
|
|
77
|
+
*
|
|
78
|
+
* @default // process.cwd() if running standalone. Vite's root if running in Vite.
|
|
79
|
+
*/
|
|
80
|
+
readonly cwd?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The cwd-relative folder inside which all public API lives. Extractor will
|
|
83
|
+
* look at public declarations only inside this folder. All JSDoc links should
|
|
84
|
+
* be relative to this folder. The path must not start with ./ and must use
|
|
85
|
+
* / over \ as path separators.
|
|
86
|
+
*
|
|
87
|
+
* @default "src/"
|
|
88
|
+
*/
|
|
89
|
+
readonly basePath?: string;
|
|
90
|
+
/**
|
|
91
|
+
* The project's package.json dependencies.
|
|
92
|
+
* This will be used to verify that public declarations only depend on
|
|
93
|
+
* packages that are declared as runtime dependencies in the package.json.
|
|
94
|
+
*
|
|
95
|
+
* @default // Will be retrieved from the nearest package.json
|
|
96
|
+
*/
|
|
97
|
+
readonly packageJson?: Pick<MiniPackageJson, "dependencies" | "exports" | "name" | "peerDependencies">;
|
|
98
|
+
/**
|
|
99
|
+
* Customize where the log messages are sent.
|
|
100
|
+
* Defaults to console.log and console.error.
|
|
101
|
+
*
|
|
102
|
+
* @default // If running in Vite, will use Vite's configured logger. Otherwise, uses console.
|
|
103
|
+
*/
|
|
104
|
+
readonly logger?: {
|
|
105
|
+
info: (message: string) => void;
|
|
106
|
+
error: (message: string) => void;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* API Extractor automatically discovers files that contain `@public`. Not
|
|
110
|
+
* having to manually maintain a list of entries saves labor.
|
|
111
|
+
*
|
|
112
|
+
* As a performance optimization, you can exclude some directories from
|
|
113
|
+
* `@public` file discovery. This should be a flat list of folders inside
|
|
114
|
+
* basePath without slashes or nested paths.
|
|
115
|
+
*
|
|
116
|
+
* @example ["tests"]
|
|
117
|
+
*/
|
|
118
|
+
readonly excludedDirectories?: Set<string>;
|
|
119
|
+
/**
|
|
120
|
+
* A flag to enable the bare minimal extraction in a Lumina web component
|
|
121
|
+
* project. This powers lazy-loading in the Lumina development server.
|
|
122
|
+
* It skips resolving types, does not use type checker, and only extracts
|
|
123
|
+
* web components.
|
|
124
|
+
*
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
readonly isLuminaMinimalExtraction?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* To produce lazy-loading metadata, Lumina sets this flag to make api.json
|
|
130
|
+
* include private components as well. Such private components are filtered
|
|
131
|
+
* out before the api.json is written, and never appear in .d.ts files.
|
|
132
|
+
*
|
|
133
|
+
* @default false
|
|
134
|
+
*/
|
|
135
|
+
readonly includeLuminaPrivateComponents?: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Options that primarily impact type checking and the types output. */
|
|
139
|
+
export interface ApiExtractorTypesConfig {
|
|
140
|
+
/**
|
|
141
|
+
* If type checker is used for extraction, fewer type annotations will be
|
|
142
|
+
* required.
|
|
143
|
+
* For example, given `property = myHelper()`, without type checking, the
|
|
144
|
+
* public type will look like `property: ReturnType<typeof myHelper>`. However,
|
|
145
|
+
* this is not very pretty in the docs, and extractor will error if `myHelper`
|
|
146
|
+
* is not public. For such cases, you either need to provide an explicit type
|
|
147
|
+
* annotation (`property: MyType = myHelper()`) or enable type checked
|
|
148
|
+
* extraction, and the type will be inferred by the type checker.
|
|
149
|
+
*
|
|
150
|
+
* Type checked extraction is slower. However, if you are type checking your
|
|
151
|
+
* project anyway as part of build, you can deduplicate that work by enabling
|
|
152
|
+
* type checked extraction and the ApiExtractorTypesConfig.fullTypeCheck
|
|
153
|
+
* option.
|
|
154
|
+
*
|
|
155
|
+
* Example performance impact:
|
|
156
|
+
* If doing full type check, typed extraction is practically free:
|
|
157
|
+
*
|
|
158
|
+
* ```log
|
|
159
|
+
* [@arcgis/api-extractor] Type checked in 0.911s
|
|
160
|
+
* [@arcgis/api-extractor] Extracted 5 \@public files in 0.008s
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* Otherwise, on-the-fly type checking adds some overhead, but still cheaper
|
|
164
|
+
* than full type check:
|
|
165
|
+
*
|
|
166
|
+
* ```log
|
|
167
|
+
* [@arcgis/api-extractor] Extracted 5 \@public files in 0.248s
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* The impact of typed extraction is negligible on most projects. However, on
|
|
171
|
+
* larger codebases, especially with many non-public files it can make a 10x
|
|
172
|
+
* difference.
|
|
173
|
+
*
|
|
174
|
+
* @default // false if running standalone. true if running in Vite.
|
|
175
|
+
*/
|
|
176
|
+
readonly typeCheckedExtraction?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Do a full type check of the codebase. This is equivalent of running
|
|
179
|
+
* `npx tsc`. It type checks even non-public APIs, thus is slower than
|
|
180
|
+
* `typeCheckedExtraction`, but if you are type checking as part of build
|
|
181
|
+
* anyway, this option deduplicates work by removing the need for you to run
|
|
182
|
+
* type checking separately.
|
|
183
|
+
*
|
|
184
|
+
* @default // false if running standalone. true if running in Vite.
|
|
185
|
+
*/
|
|
186
|
+
readonly fullTypeCheck?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* If ApiExtractorTypesConfig.fullTypeCheck is enabled, this callback will
|
|
189
|
+
* be invoked if any errors were console logged by TypeScript.
|
|
190
|
+
*
|
|
191
|
+
* @param diagnostics
|
|
192
|
+
*/
|
|
193
|
+
afterDiagnostic?(diagnostics: readonly ts.Diagnostic[]): void;
|
|
194
|
+
/**
|
|
195
|
+
* A callback for getting reference to the TypeScript Program and TypeScript
|
|
196
|
+
* host instances created by the compiler.
|
|
197
|
+
*
|
|
198
|
+
* When running in Vite, this will only be called during build or Storybook
|
|
199
|
+
* dev server, as TypeScript program is not created when running in serve mode.
|
|
200
|
+
*
|
|
201
|
+
* @param program
|
|
202
|
+
* @param host
|
|
203
|
+
*/
|
|
204
|
+
typeScriptInstanceCreated?(program: ts.Program, host: ts.CompilerHost): void;
|
|
205
|
+
/**
|
|
206
|
+
* Path to the tsconfig.json file.
|
|
207
|
+
* This is used if ApiExtractorTypesConfig.typeScriptConfig is not provided.
|
|
208
|
+
*
|
|
209
|
+
* @default "tsconfig.json"
|
|
210
|
+
*/
|
|
211
|
+
readonly typeScriptConfigPath?: string;
|
|
212
|
+
/**
|
|
213
|
+
* A resolved config returned by [loadTypeScriptConfig()](https://developers.arcgis.com/javascript/latest/api-reference/esri-vite-typeScript.html#loadTypeScriptConfig).
|
|
214
|
+
* Useful if you already resolved the config for other purposes and wish to
|
|
215
|
+
* deduplicate the work.
|
|
216
|
+
*/
|
|
217
|
+
readonly typeScriptConfig?: TypeScriptConfigResult;
|
|
218
|
+
/**
|
|
219
|
+
* TypeScript compiler options to override the tsconfig.json settings.
|
|
220
|
+
* Keep these minimal to ensure extractor reports same errors as your IDE and
|
|
221
|
+
* standalone `npx tsc`
|
|
222
|
+
*/
|
|
223
|
+
readonly compilerOptions?: ts.CompilerOptions;
|
|
224
|
+
/** Allows to modify the content of .d.ts files before they are emitted. */
|
|
225
|
+
readonly declarationTextTransformers?: DeclarationTextTransformer[];
|
|
226
|
+
readonly typeReplacements?: TypeReplacements;
|
|
227
|
+
/**
|
|
228
|
+
* Produce .d.ts files even if dtsEmitPath is not set. If dtsEmitPath is not
|
|
229
|
+
* set, the produced .d.ts will not be written to disk but will be accessible
|
|
230
|
+
* inside [ApiExtractorResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-extractor-types.html#ApiExtractorResult).
|
|
231
|
+
*
|
|
232
|
+
* This is useful if you need in-memory access to the .d.ts files or wish to
|
|
233
|
+
* write them yourself.
|
|
234
|
+
*/
|
|
235
|
+
readonly forceProduceDts?: boolean;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @param original - The original declaration file.
|
|
240
|
+
* @param apiModule - The ApiModule corresponding to the declaration file.
|
|
241
|
+
* @param extractor - The ApiExtractor instance.
|
|
242
|
+
* @returns The transformed declaration file, or false to skip emitting this file.
|
|
243
|
+
*/
|
|
244
|
+
export type DeclarationTextTransformer = (original: DeclarationFile, apiModule: ApiModule, extractor: ApiExtractor) => DeclarationFile | false;
|
|
245
|
+
|
|
246
|
+
export interface DeclarationFile {
|
|
247
|
+
/** Absolute file path */
|
|
248
|
+
filePath: string;
|
|
249
|
+
content: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
39
252
|
/**
|
|
40
253
|
* Privately, arcgis-js-api has interfaces that mirror some of the most widely
|
|
41
254
|
* used types. They are in the process of refactoring out many of them. Until
|
|
@@ -51,16 +264,189 @@ export interface ApiExtractorConfig {
|
|
|
51
264
|
* there will be a collision. Detecting such collisions is tricky - extractor
|
|
52
265
|
* does it minimally.
|
|
53
266
|
*
|
|
54
|
-
* @public
|
|
55
267
|
* @see https://devtopia.esri.com/WebGIS/arcgis-js-api/discussions/60843
|
|
56
268
|
* @see https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/69911
|
|
57
269
|
* @see https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/73395
|
|
58
270
|
*/
|
|
59
271
|
export type TypeReplacements = Record<string, Record<string, readonly [modulePath: string, name: string, type: "default" | "named"] | undefined> | undefined>;
|
|
272
|
+
|
|
273
|
+
/** Options that primarily impact the api.json and the JSDocs in .d.ts files. */
|
|
274
|
+
export interface ApiExtractorDocumentationConfig {
|
|
275
|
+
readonly copyDocDefinitions?: CopyDocDefinitions;
|
|
276
|
+
readonly noInheritMembers?: NoInheritMembers;
|
|
277
|
+
/**
|
|
278
|
+
* Get a prefix for a public-facing URL for each component story.
|
|
279
|
+
*
|
|
280
|
+
* @see https://webgis.esri.com/references/support-packages/storybook
|
|
281
|
+
* @example
|
|
282
|
+
* Set this to "https://developers.arcgis.com/javascript/latest/storybook/map-components/".
|
|
283
|
+
* This will produce URLs like
|
|
284
|
+
* "https://developers.arcgis.com/javascript/latest/storybook/map-components/?path=/story/arcgis-area-measurement-2d--demo&singleStory=true"
|
|
285
|
+
*/
|
|
286
|
+
readonly publicStoryUrlPrefix?: string | false;
|
|
287
|
+
/**
|
|
288
|
+
* Provide a URL to a page that documents the component.
|
|
289
|
+
* This URL will be visible in VS Code and IntelliJ when hovering over a
|
|
290
|
+
* component tag in an .html file
|
|
291
|
+
*
|
|
292
|
+
* @example (tagName) => `https://developers.arcgis.com/javascript/latest/references/map-components/${tagName}/`
|
|
293
|
+
*/
|
|
294
|
+
readonly getComponentDocsUrl?: false | ((tagName: string, className: string) => string | undefined);
|
|
295
|
+
/**
|
|
296
|
+
* Provide a URL to a page that documents the component.
|
|
297
|
+
* This URL will be visible in VS Code and IntelliJ when hovering over a
|
|
298
|
+
* component tag in an .html file
|
|
299
|
+
*
|
|
300
|
+
* If you wish to provide multiple URLs, use "getPublicStoryUrl" instead.
|
|
301
|
+
*
|
|
302
|
+
* @example (tagName) => `https://developers.arcgis.com/javascript/latest/storybook/map-components/?path=/story/${tagName}--demo&singleStory=true`
|
|
303
|
+
*/
|
|
304
|
+
readonly getComponentDemoUrl?: false | ((tagName: string, className: string) => string | undefined);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface ApiExtractorVerifyConfig {
|
|
308
|
+
/**
|
|
309
|
+
* Run a type checker on the emitted types to verify correctness.
|
|
310
|
+
*
|
|
311
|
+
* This is slower, but it catches many kinds of issues.
|
|
312
|
+
* Because emitted types strip non-public APIs, this option catches when
|
|
313
|
+
* public type accesses non-public properties (in this["test"], or
|
|
314
|
+
* Pick<this, "test">). It also catches if a class or interface is extended
|
|
315
|
+
* incorrectly.
|
|
316
|
+
*
|
|
317
|
+
* If your users don't have skipLibCheck:true enabled, they will see the same
|
|
318
|
+
* errors as what this option catches, thus this check is valuable.
|
|
319
|
+
*
|
|
320
|
+
* It is recommended to run this as part of CI or as a manual pre-release check.
|
|
321
|
+
*
|
|
322
|
+
* @default false
|
|
323
|
+
*/
|
|
324
|
+
readonly typeCheckTypes?: boolean;
|
|
325
|
+
/**
|
|
326
|
+
* If there are type errors in types of dependencies you do not control,
|
|
327
|
+
* you can silence such errors by returning false. Ideally, you should also
|
|
328
|
+
* report such errors to the upstream dependency so that these errors don't
|
|
329
|
+
* affect your users.
|
|
330
|
+
*
|
|
331
|
+
* @param diagnostic
|
|
332
|
+
* @example
|
|
333
|
+
* ```ts
|
|
334
|
+
* filterTypeCheckDiagnostic: (diagnostic) =>
|
|
335
|
+
* !diagnostic.file?.fileName?.endsWith("node_modules/vite/dist/node/index.d.ts"),
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
filterTypeCheckDiagnostic?(diagnostic: ts.Diagnostic): boolean;
|
|
339
|
+
/**
|
|
340
|
+
* @deprecated REFACTOR: Drop this flag in 5.1
|
|
341
|
+
* @default false
|
|
342
|
+
*/
|
|
343
|
+
readonly detectBrokenLinks?: boolean;
|
|
344
|
+
}
|
|
345
|
+
|
|
60
346
|
/**
|
|
61
347
|
* Don't include these members in each subclass to keep api reference pages cleaner.
|
|
62
|
-
* These has no
|
|
348
|
+
* These has no types impact since their inheritance is still done by TypeScript.
|
|
63
349
|
*
|
|
64
|
-
*
|
|
350
|
+
* The structure maps module path to the list of class members inside that module.
|
|
65
351
|
*/
|
|
66
352
|
export type NoInheritMembers = Readonly<Record<string, readonly string[]>>;
|
|
353
|
+
|
|
354
|
+
export interface ApiExtractorWatchConfig {
|
|
355
|
+
/**
|
|
356
|
+
* A callback that is invoked when any file change is detected.
|
|
357
|
+
* This schedules an extractor rerun. The callback is called with a promise
|
|
358
|
+
* that resolves with the result of the rerun. If the change that triggered
|
|
359
|
+
* the rerun didn't impact api.json, the promise resolves with `undefined`.
|
|
360
|
+
*
|
|
361
|
+
* @param promise
|
|
362
|
+
*/
|
|
363
|
+
onUpdate?(promise: Promise<ApiExtractorWatchResult | undefined>): Promise<void> | void;
|
|
364
|
+
/**
|
|
365
|
+
* When saving multiple files in VSCode or doing Git operations, many file
|
|
366
|
+
* changes may trigger in a short time. To avoid excessive re-runs, we
|
|
367
|
+
* wait a few milliseconds before starting the re-run. If another file is
|
|
368
|
+
* changed during the wait, the wait restarts.
|
|
369
|
+
*
|
|
370
|
+
* @default // 50 if using type-checked extraction or full-type-check, 20 otherwise
|
|
371
|
+
*/
|
|
372
|
+
readonly debounceTime?: number;
|
|
373
|
+
/**
|
|
374
|
+
* Whether to clear the console output between re-runs.
|
|
375
|
+
*
|
|
376
|
+
* @default // true if running standalone. false if running in Vite
|
|
377
|
+
*/
|
|
378
|
+
readonly clearScreen?: boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Whether it is safe to skip writing .d.ts for unchanged files between re-runs.
|
|
381
|
+
*
|
|
382
|
+
* @default
|
|
383
|
+
* // true if ApiExtractorContextConfig.emptyDtsEmitPath is false
|
|
384
|
+
* // and not running inside Vite or Vite's build.emptyOutDir is false.
|
|
385
|
+
*/
|
|
386
|
+
readonly skipWritingUnchanged?: boolean;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* On each re-run in watch mode, a new api.json is produced. Unchanged
|
|
391
|
+
* ApiModules are copied as is by reference. Changed modules are re-created,
|
|
392
|
+
* without mutating the old api.json.
|
|
393
|
+
*/
|
|
394
|
+
export interface ApiExtractorWatchResult extends ApiExtractorResult {
|
|
395
|
+
/**
|
|
396
|
+
* The names of modules that were directly or indirectly affected by the
|
|
397
|
+
* changes to any watched files.
|
|
398
|
+
*/
|
|
399
|
+
readonly changedModules: readonly {
|
|
400
|
+
readonly old: ApiModule;
|
|
401
|
+
readonly new: ApiModule;
|
|
402
|
+
}[];
|
|
403
|
+
/** This is empty on the first watch run. */
|
|
404
|
+
readonly addedModules: readonly ApiModule[];
|
|
405
|
+
/** > Rename is treated as removed + added. */
|
|
406
|
+
readonly removedModules: readonly ApiModule[];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/** An ApiExtractor config with all default values filled in. */
|
|
410
|
+
export interface ResolvedApiExtractorConfig extends MarkPropertiesNonNullable<ApiExtractorConfig> {
|
|
411
|
+
readonly isResolvedConfig: true;
|
|
412
|
+
readonly context: MarkPropertiesNonNullable<ApiExtractorContextConfig>;
|
|
413
|
+
readonly documentation: MarkPropertiesNonNullable<ApiExtractorDocumentationConfig>;
|
|
414
|
+
readonly types: MarkPropertiesNonNullable<ApiExtractorTypesConfig>;
|
|
415
|
+
readonly verify: MarkPropertiesNonNullable<ApiExtractorVerifyConfig>;
|
|
416
|
+
readonly watch: MarkPropertiesNonNullable<ApiExtractorWatchConfig>;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/** @experimental */
|
|
420
|
+
export type MarkPropertiesNonNullable<T> = {
|
|
421
|
+
readonly [K in keyof T]-?: NonNullable<T[K]>;
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Find and load an ApiExtractor config file.
|
|
426
|
+
*
|
|
427
|
+
* @param cwd - If configFilePath was not provided, will load
|
|
428
|
+
* `api-extractor.config.ts` from this folder.
|
|
429
|
+
* @param configFilePath - Relative or absolute path to the config file.
|
|
430
|
+
* By default, will load `api-extractor.config.ts` from the cwd
|
|
431
|
+
* @returns The loaded config file. If configFilePath is provided but does not
|
|
432
|
+
* exist, throws. Otherwise, if no config exists, returns an empty config.
|
|
433
|
+
*/
|
|
434
|
+
export function loadApiExtractorConfig(cwd?: string, configFilePath?: string): Promise<ApiExtractorConfig>;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* @param baseConfig
|
|
438
|
+
* @param overrideConfig
|
|
439
|
+
*/
|
|
440
|
+
export function mergeApiExtractorConfigs(baseConfig: ResolvedApiExtractorConfig, overrideConfig: ApiExtractorConfig): ResolvedApiExtractorConfig;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* @param baseConfig
|
|
444
|
+
* @param overrideConfig
|
|
445
|
+
*/
|
|
446
|
+
export function mergeApiExtractorConfigs(baseConfig: ApiExtractorConfig, overrideConfig: ResolvedApiExtractorConfig): ResolvedApiExtractorConfig;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* @param baseConfig
|
|
450
|
+
* @param overrideConfig
|
|
451
|
+
*/
|
|
452
|
+
export function mergeApiExtractorConfigs(baseConfig: ApiExtractorConfig, overrideConfig: ApiExtractorConfig): ApiExtractorConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "@arcgis/components-build-utils";
|
|
2
|
+
import "../typeScript-CzUTFiYO.js";
|
|
3
|
+
import { l, m as n, r as A } from "../worker-CULPfolw.js";
|
|
4
|
+
import "chalk";
|
|
5
|
+
import "../utils/apiHelpers.js";
|
|
6
|
+
import "@arcgis/toolkit/string";
|
|
7
|
+
import "typescript";
|
|
8
|
+
import "fs/promises";
|
|
9
|
+
import "util";
|
|
10
|
+
import "@arcgis/toolkit/function";
|
|
11
|
+
import "node:fs";
|
|
12
|
+
import "node:url";
|
|
13
|
+
export {
|
|
14
|
+
l as loadApiExtractorConfig,
|
|
15
|
+
n as mergeApiExtractorConfigs,
|
|
16
|
+
A as resolveApiExtractorConfig
|
|
17
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ApiClassDeclaration, ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiEvent, ApiFunctionDeclaration, ApiInterfaceDeclaration, ApiModule, ApiVariableDeclaration } from "../../apiJson.js";
|
|
2
|
+
|
|
3
|
+
/** [Documentation](https://webgis.esri.com/webgis/core/core/documenting-api#copydoc) */
|
|
4
|
+
export interface CopyDocDefinitions {
|
|
5
|
+
properties?: CopyDocMemberDeclarations<ApiCustomElementField>;
|
|
6
|
+
methods?: CopyDocMemberDeclarations<ApiClassMethod>;
|
|
7
|
+
/**
|
|
8
|
+
* This is only called for web component events.
|
|
9
|
+
* Non-web component classes define events using the `@eventTypes` property,
|
|
10
|
+
* and can copy doc by creating and extending common interfaces.
|
|
11
|
+
*/
|
|
12
|
+
events?: CopyDocMemberDeclarations<ApiEvent>;
|
|
13
|
+
classes?: CopyDocDeclarations<ApiClassDeclaration>;
|
|
14
|
+
customElements?: CopyDocDeclarations<ApiCustomElementDeclaration>;
|
|
15
|
+
functions?: CopyDocDeclarations<ApiFunctionDeclaration>;
|
|
16
|
+
variables?: CopyDocDeclarations<ApiVariableDeclaration>;
|
|
17
|
+
/** This includes both type aliases and interfaces */
|
|
18
|
+
interfaces?: CopyDocDeclarations<ApiInterfaceDeclaration>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CopiableFields = "deprecated" | "description" | "docsTags" | "readonly" | "return";
|
|
22
|
+
|
|
23
|
+
export type CopyDocDeclarations<ApiType extends Partial<Record<CopiableFields, unknown>>> = Record<string, Partial<Pick<ApiType, CopiableFields>> | ((apiDeclaration: ApiType, module: ApiModule) => Partial<Pick<ApiType, CopiableFields>>) | undefined>;
|
|
24
|
+
|
|
25
|
+
export 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>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ApiModule } from "../apiJson.js";
|
|
2
|
+
import type { IndexedModuleDeclarations } from "./types.js";
|
|
3
|
+
|
|
4
|
+
/** @experimental */
|
|
5
|
+
export interface ModuleContext {
|
|
6
|
+
/** @experimental */
|
|
7
|
+
readonly index: IndexedModuleDeclarations;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get metadata about ApiModule that is not stored in api.json. This exposes
|
|
12
|
+
* internal extractor details.
|
|
13
|
+
*
|
|
14
|
+
* Separate function for each node kind to improve typing and V8 inlining.
|
|
15
|
+
*
|
|
16
|
+
* @param node
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export function getModuleContext(node: ApiModule): ModuleContext;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const e = Symbol("privateContext");
|
|
2
|
+
function s(t, o, i, n) {
|
|
3
|
+
return {
|
|
4
|
+
isStale: !0,
|
|
5
|
+
file: t,
|
|
6
|
+
dtsPath: o,
|
|
7
|
+
importsMap: i,
|
|
8
|
+
importsText: void 0,
|
|
9
|
+
constructorPropertiesInterface: void 0,
|
|
10
|
+
constructorOnlySetters: void 0,
|
|
11
|
+
constructorAutoCastType: void 0,
|
|
12
|
+
typeName: void 0,
|
|
13
|
+
inheritance: void 0,
|
|
14
|
+
index: n,
|
|
15
|
+
reExports: void 0,
|
|
16
|
+
namespaces: void 0
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function c() {
|
|
20
|
+
return {
|
|
21
|
+
hasExplicitAbstract: void 0,
|
|
22
|
+
isDefaultExported: void 0,
|
|
23
|
+
superClassText: void 0,
|
|
24
|
+
superTypesText: void 0,
|
|
25
|
+
eventTypesProperty: void 0,
|
|
26
|
+
isMixinBaseClass: void 0,
|
|
27
|
+
emitAsTypeAlias: void 0,
|
|
28
|
+
esriCompatibilityNames: void 0
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function a() {
|
|
32
|
+
return {
|
|
33
|
+
isAbstract: void 0,
|
|
34
|
+
isAccessor: void 0,
|
|
35
|
+
hasAutoCasting: void 0,
|
|
36
|
+
autoCastingRequiresType: void 0,
|
|
37
|
+
autoCastingDefaultType: void 0,
|
|
38
|
+
isConstructorOnly: void 0,
|
|
39
|
+
isOverride: void 0,
|
|
40
|
+
dtsTypeOverride: void 0
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function u() {
|
|
44
|
+
return {
|
|
45
|
+
isAbstract: void 0,
|
|
46
|
+
isDefaultExported: void 0,
|
|
47
|
+
hasQuestionToken: void 0,
|
|
48
|
+
esriCompatibilityNames: void 0
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function d() {
|
|
52
|
+
return {
|
|
53
|
+
isDefaultExported: void 0,
|
|
54
|
+
esriCompatibilityNames: void 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function v(t) {
|
|
58
|
+
return t[e];
|
|
59
|
+
}
|
|
60
|
+
function x(t) {
|
|
61
|
+
return t[e];
|
|
62
|
+
}
|
|
63
|
+
function p(t) {
|
|
64
|
+
return t[e];
|
|
65
|
+
}
|
|
66
|
+
function C(t) {
|
|
67
|
+
return t[e];
|
|
68
|
+
}
|
|
69
|
+
function l(t) {
|
|
70
|
+
return t[e];
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
u as createFunctionLikeContext,
|
|
74
|
+
s as createModuleContext,
|
|
75
|
+
c as createObjectLikeContext,
|
|
76
|
+
a as createPropertyContext,
|
|
77
|
+
d as createVariableContext,
|
|
78
|
+
C as getFunctionLikeContext,
|
|
79
|
+
v as getModuleContext,
|
|
80
|
+
x as getObjectLikeContext,
|
|
81
|
+
p as getPropertyContext,
|
|
82
|
+
l as getVariableContext,
|
|
83
|
+
e as privateContextSymbol
|
|
84
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ApiExtractor } from "../ApiExtractor.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a documentation view URL for a module, declaration, or member.
|
|
5
|
+
*
|
|
6
|
+
* @param modulePath
|
|
7
|
+
* @param apiName - Name of a declaration inside the module.
|
|
8
|
+
* @param memberName - Name of a member inside the declaration.
|
|
9
|
+
* @param extractor
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
|
+
export function getViewUrl(modulePath: string, apiName: string | undefined, memberName: string | undefined, extractor: Pick<ApiExtractor & { isComponentProject: boolean; }, "config" | "isComponentProject" | "normalizedApiReferencePrefix">): string;
|