@arcgis/lumina-compiler 4.32.0-next.2 → 4.32.0-next.20
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/context/index.d.ts +144 -38
- package/dist/context/typeScript.d.ts +19 -0
- package/dist/context/utils.d.ts +1 -20
- package/dist/dependencies/discover.d.ts +5 -5
- package/dist/dependencies/updateLumina.d.ts +2 -2
- package/dist/docs/config.d.ts +2 -0
- package/dist/{manifests/stencilManifest.d.ts → docs/stencilDocsJson.d.ts} +5 -4
- package/dist/docs/types.d.ts +1 -0
- package/dist/{manifests → docs}/vsCodeCustomData/index.d.ts +4 -4
- package/dist/{manifests → docs}/vsCodeCustomData/types.d.ts +2 -4
- package/dist/docs/vsCodeCustomData/utils.d.ts +3 -0
- package/dist/docs/webTypes/description.d.ts +7 -0
- package/dist/{manifests → docs}/webTypes/index.d.ts +3 -3
- package/dist/{manifests → docs}/webTypes/types.d.ts +0 -3
- package/dist/docs/webTypes/utils.d.ts +6 -0
- package/dist/entrypoints/config.d.ts +0 -5
- package/dist/entrypoints/dtsUtils.d.ts +2 -2
- package/dist/entrypoints/pathMapping.d.ts +2 -3
- package/dist/entrypoints/resolveTagName.d.ts +2 -3
- package/dist/extractor/apiJsonUtils.d.ts +4 -0
- package/dist/{manifests/customElementDecoratorPlugins.d.ts → extractor/declaration.d.ts} +8 -17
- package/dist/extractor/extractor.d.ts +53 -0
- package/dist/extractor/helpers/cssDoc.d.ts +11 -0
- package/dist/extractor/helpers/event.d.ts +9 -0
- package/dist/extractor/helpers/jsDoc.d.ts +11 -0
- package/dist/extractor/helpers/method.d.ts +11 -0
- package/dist/extractor/helpers/property.d.ts +9 -0
- package/dist/extractor/helpers/resolveType.d.ts +50 -0
- package/dist/extractor/helpers/typeValue.d.ts +60 -0
- package/dist/extractor/index.d.ts +12 -0
- package/dist/frameworkTypes/lumina.d.ts +2 -2
- package/dist/frameworkTypes/preact.d.ts +2 -2
- package/dist/frameworkTypes/react.d.ts +2 -2
- package/dist/frameworkTypes/stencil.d.ts +2 -2
- package/dist/frameworkTypes/utils.d.ts +2 -3
- package/dist/frameworkTypes/vanilla.d.ts +2 -2
- package/dist/index.d.ts +4 -5
- package/dist/index.js +101 -105
- package/dist/jsxToLitHtml/autoAddNothing.d.ts +1 -1
- package/dist/jsxToLitHtml/config.d.ts +18 -40
- package/dist/jsxToLitHtml/convertProps.d.ts +3 -2
- package/dist/jsxToLitHtml/index.d.ts +3 -0
- package/dist/jsxToLitHtml/inferPropType.d.ts +1 -1
- package/dist/jsxToLitHtml/insertRepeatCall.d.ts +1 -0
- package/dist/jsxToLitHtml/jsxVisitor.d.ts +8 -2
- package/dist/jsxToLitHtml/types.d.ts +2 -1
- package/dist/loader/index.d.ts +13 -0
- package/dist/{manifests → loader}/lazy.d.ts +3 -3
- package/dist/loader/lazy.spec.d.ts +1 -0
- package/dist/loader/storybookApiJson.d.ts +6 -0
- package/dist/plugins/loadLitCss.d.ts +1 -0
- package/dist/plugins/updatePackageJson.d.ts +2 -2
- package/dist/publicTypes.d.ts +79 -30
- package/dist/puppeteerTesting/globalSetup.js +2 -2
- package/dist/puppeteerTesting/index.js +4 -4
- package/dist/puppeteerTesting/puppeteer/element.d.ts +1 -0
- package/dist/puppeteerTesting/puppeteer/types.d.ts +8 -4
- package/dist/puppeteerTesting/vitest/runner.d.ts +4 -1
- package/dist/puppeteerTesting/vitest/runner.js +1 -1
- package/dist/testing/index.js +24 -1
- package/dist/testing/mount.d.ts +1 -1
- package/dist/tests/utils.d.ts +1 -1
- package/dist/transformers/index.d.ts +4 -0
- package/dist/transformers/internalTypeScriptApis.d.ts +1 -2
- package/dist/transformers/propertyOptions.d.ts +2 -2
- package/dist/useLumina.d.ts +1 -1
- package/package.json +10 -49
- package/dist/chunk-BQ4U6HQL.js +0 -1
- package/dist/manifests/complexTypes/addComponentMetadata.d.ts +0 -8
- package/dist/manifests/complexTypes/addMethodMetadata.d.ts +0 -6
- package/dist/manifests/complexTypes/addPropMetadata.d.ts +0 -8
- package/dist/manifests/complexTypes/docsUtils.d.ts +0 -18
- package/dist/manifests/complexTypes/event.d.ts +0 -9
- package/dist/manifests/complexTypes/getComplexPropertyType.d.ts +0 -11
- package/dist/manifests/complexTypes/transformUtils.d.ts +0 -112
- package/dist/manifests/complexTypes/typeToEnum.d.ts +0 -14
- package/dist/manifests/complexTypes/types.d.ts +0 -135
- package/dist/manifests/config.d.ts +0 -2
- package/dist/manifests/createManifest.d.ts +0 -39
- package/dist/manifests/index.d.ts +0 -12
- package/dist/manifests/kebabCaseAttributes.d.ts +0 -18
- package/dist/manifests/storybookManifest.d.ts +0 -6
- package/dist/manifests/types.d.ts +0 -1
- package/dist/manifests/utils.d.ts +0 -17
- package/dist/manifests/vsCodeCustomData/utils.d.ts +0 -3
- package/dist/manifests/webTypes/description.d.ts +0 -8
- package/dist/manifests/webTypes/utils.d.ts +0 -6
- package/dist/transformers/guardAgainstInternalJsDoc.d.ts +0 -11
- package/dist/utils/packageJson.d.ts +0 -24
- package/dist/utils/path.d.ts +0 -25
- /package/dist/{manifests/complexTypes/transformUtils.spec.d.ts → context/typeScript.spec.d.ts} +0 -0
- /package/dist/{plugins/generateDocs.d.ts → docs/index.d.ts} +0 -0
- /package/dist/{manifests/complexTypes/typeToEnum.spec.d.ts → extractor/declaration.spec.d.ts} +0 -0
- /package/dist/{manifests/customElementDecoratorPlugins.spec.d.ts → extractor/helpers/cssDoc.spec.d.ts} +0 -0
- /package/dist/{manifests/lazy.spec.d.ts → extractor/helpers/resolveType.spec.d.ts} +0 -0
- /package/dist/{utils/path.spec.d.ts → extractor/helpers/typeValue.spec.d.ts} +0 -0
- /package/dist/{manifests → loader}/hideUntilHydrated.d.ts +0 -0
package/dist/context/index.d.ts
CHANGED
|
@@ -1,41 +1,63 @@
|
|
|
1
1
|
import type { ConfigEnv, Plugin, ResolvedConfig, ViteDevServer } from "vite";
|
|
2
2
|
import ts from "typescript";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { ApiCssCustomProperty, ApiCustomElementDeclaration, ApiJson } from "@arcgis/api-extractor";
|
|
4
|
+
import type { LuminaOptions, AssetSpec, AssetTransformer, DeclarationTextTransformer, ProvideAssetsOptions, LintingOptions } from "../publicTypes";
|
|
5
5
|
import type { ComponentPathMapping } from "../entrypoints/pathMapping";
|
|
6
|
-
import type {
|
|
7
|
-
import type { ComponentManifest } from "../manifests/utils";
|
|
6
|
+
import type { DocsType } from "../docs/types";
|
|
8
7
|
import type { ContextDirectories } from "./types";
|
|
8
|
+
import { makeLoaders, type computeServeOnlyDependencies } from "../dependencies/loaders";
|
|
9
|
+
import type { CustomElementInterdependencies } from "../entrypoints/config";
|
|
10
|
+
import type { getCompilerOptionsForPrinter } from "../transformers";
|
|
11
|
+
import type { getPrinter } from "../transformers/internalTypeScriptApis";
|
|
12
|
+
import type { getLocalDefinedComponentsFromApiJson } from "../entrypoints/resolveTagName";
|
|
13
|
+
import type { Deferred } from "@arcgis/components-utils";
|
|
9
14
|
export declare class CompilerContext {
|
|
10
15
|
/**
|
|
11
|
-
* The path to
|
|
16
|
+
* The path to the resolved TypeScript configuration
|
|
12
17
|
*/
|
|
13
|
-
|
|
18
|
+
typeScriptConfigPath: string;
|
|
14
19
|
/**
|
|
15
|
-
* The
|
|
20
|
+
* The parsed TypeScript configuration
|
|
16
21
|
*/
|
|
17
|
-
|
|
22
|
+
typeScriptConfig: ts.CompilerOptions;
|
|
18
23
|
/**
|
|
19
24
|
* An instance of TypeScript program. Contains all .tsx source files present
|
|
20
|
-
* in the project
|
|
25
|
+
* in the project.
|
|
21
26
|
*
|
|
22
|
-
* TypeScript program is created only in build mode
|
|
27
|
+
* TypeScript program is created only in build mode and in storybook. It
|
|
28
|
+
* is not created in serve.
|
|
23
29
|
*/
|
|
24
30
|
typeScriptProgram?: ts.Program;
|
|
25
31
|
/**
|
|
26
|
-
* An instance of TypeScript type checker
|
|
32
|
+
* An instance of TypeScript type checker.
|
|
27
33
|
*
|
|
28
|
-
* TypeScript type checker is created only in build mode
|
|
34
|
+
* TypeScript type checker is created only in build mode and in storybook. It
|
|
35
|
+
* is not created in serve.
|
|
29
36
|
*/
|
|
30
37
|
typeScriptTypeChecker?: ts.TypeChecker;
|
|
38
|
+
/**
|
|
39
|
+
* A TypeScript watcher program. Created only when running under Storybook in
|
|
40
|
+
* serve mode.
|
|
41
|
+
*/
|
|
42
|
+
typeScriptWatchProgram?: ts.WatchOfConfigFile<ts.BuilderProgram>;
|
|
31
43
|
/**
|
|
32
44
|
* An instance of TypeScript compiler host
|
|
33
45
|
*/
|
|
34
46
|
typeScriptHost: ts.CompilerHost;
|
|
35
47
|
/**
|
|
36
48
|
* TypeScript source file instances created in serve mode
|
|
49
|
+
*
|
|
50
|
+
* @private
|
|
37
51
|
*/
|
|
38
|
-
private _typeScriptSourceFiles;
|
|
52
|
+
private readonly _typeScriptSourceFiles;
|
|
53
|
+
/**
|
|
54
|
+
* Used in Storybook watch mode. Resolves once TypeScript program is
|
|
55
|
+
* re-created in response to a file change. This is used to halt the Vite from
|
|
56
|
+
* doing hot-module-reload until the TypeScript program is re-created.
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
_typeScriptReload?: Deferred<void>;
|
|
39
61
|
/**
|
|
40
62
|
* Whether minification is enabled for transformed JSX (lit-html templates)
|
|
41
63
|
* and generated component code.
|
|
@@ -55,33 +77,57 @@ export declare class CompilerContext {
|
|
|
55
77
|
* A vite plugin that sets the initial context information based on Vite
|
|
56
78
|
* environment
|
|
57
79
|
*
|
|
58
|
-
* @
|
|
80
|
+
* @private
|
|
59
81
|
*/
|
|
60
|
-
readonly
|
|
82
|
+
readonly _plugin: Plugin;
|
|
61
83
|
/**
|
|
62
84
|
* List of directories of common interest to the compiler
|
|
63
85
|
*/
|
|
64
86
|
dir: ContextDirectories;
|
|
65
87
|
/**
|
|
66
|
-
* The
|
|
88
|
+
* The api.json stores information about the structure of all components in
|
|
89
|
+
* the package (their properties, methods, events, JSDoc and etc).
|
|
67
90
|
*
|
|
68
|
-
*
|
|
69
|
-
* (their properties, methods, events, JSDoc and etc).
|
|
70
|
-
*
|
|
71
|
-
* You can augment the manifest generation using the `manifest` option on
|
|
91
|
+
* You can augment the api.json generation using the `apiJson` option in
|
|
72
92
|
* `useLumina()`
|
|
93
|
+
*/
|
|
94
|
+
apiJson: ApiJson;
|
|
95
|
+
/**
|
|
96
|
+
* A flattened api.json listing all components in this package.
|
|
97
|
+
*/
|
|
98
|
+
apiJsonComponents: ApiCustomElementDeclaration[];
|
|
99
|
+
/**
|
|
100
|
+
* Like this.apiJson, but also contains members decorated with the `@private`
|
|
101
|
+
* JSDoc tag.
|
|
102
|
+
*/
|
|
103
|
+
privateApiJson: ApiJson;
|
|
104
|
+
/**
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
_componentPathMapping: ComponentPathMapping;
|
|
108
|
+
/**
|
|
109
|
+
* Cached result of getLocalDefinedComponentsFromApiJson() call
|
|
73
110
|
*
|
|
74
|
-
* @
|
|
111
|
+
* @private
|
|
75
112
|
*/
|
|
76
|
-
|
|
113
|
+
_localDefinedComponents?: ReturnType<typeof getLocalDefinedComponentsFromApiJson>;
|
|
77
114
|
/**
|
|
78
|
-
*
|
|
115
|
+
* Mapping of css files and which components they are imported in.
|
|
116
|
+
*
|
|
117
|
+
* @private
|
|
79
118
|
*/
|
|
80
|
-
|
|
119
|
+
readonly _cssImports: Map<string, Set<string> | undefined>;
|
|
81
120
|
/**
|
|
82
|
-
*
|
|
121
|
+
* Mapping of CSS file names to docs extracted from them.
|
|
122
|
+
*
|
|
123
|
+
* CSS files are read during the file transform stage, which is after the
|
|
124
|
+
* api.json is extracted. This unfortunately means that we have to mutate
|
|
125
|
+
* the api.json after the fact to add the CSS docs. Furthermore, when api.json
|
|
126
|
+
* is re-generated, we need to re-add the CSS docs previously extracted.
|
|
127
|
+
*
|
|
128
|
+
* @private
|
|
83
129
|
*/
|
|
84
|
-
|
|
130
|
+
_cssDocs?: Map<string, ApiCssCustomProperty[] | undefined>;
|
|
85
131
|
/**
|
|
86
132
|
* The environment that Vite is running in
|
|
87
133
|
*
|
|
@@ -149,6 +195,14 @@ export declare class CompilerContext {
|
|
|
149
195
|
* should not try to read this property before the `apply()` hook is called.
|
|
150
196
|
*/
|
|
151
197
|
viteCommand: ConfigEnv["command"];
|
|
198
|
+
/**
|
|
199
|
+
* Whether to extract full API information, with type-checking. This is the
|
|
200
|
+
* case during build or when running under Storybook. Otherwise, the dev
|
|
201
|
+
* server keeps API extraction to bare minimum to reduce needless overhead.
|
|
202
|
+
* Only the information necessary for the dev server to lazy load is
|
|
203
|
+
* extracted.
|
|
204
|
+
*/
|
|
205
|
+
isFullApiExtraction: boolean;
|
|
152
206
|
readonly banner: string;
|
|
153
207
|
/**
|
|
154
208
|
* `@arcgis/lumina-compiler` plugins may register additional `.d.ts`
|
|
@@ -156,19 +210,19 @@ export declare class CompilerContext {
|
|
|
156
210
|
* option, use the `types.declarationTextTransformers` option on the
|
|
157
211
|
* `useLumina` Vite plugin.
|
|
158
212
|
*
|
|
159
|
-
* @
|
|
213
|
+
* @private
|
|
160
214
|
*/
|
|
161
|
-
readonly
|
|
215
|
+
readonly _declarationTextTransformers: DeclarationTextTransformer[];
|
|
162
216
|
/**
|
|
163
217
|
* Options passed to `useLumina()`
|
|
164
218
|
*/
|
|
165
|
-
options: LuminaOptions;
|
|
219
|
+
readonly options: LuminaOptions;
|
|
166
220
|
/**
|
|
167
221
|
* Resolved file names for documentation files
|
|
168
222
|
*
|
|
169
|
-
* @
|
|
223
|
+
* @private
|
|
170
224
|
*/
|
|
171
|
-
|
|
225
|
+
readonly _documentationFileNames: Record<DocsType, string | undefined>;
|
|
172
226
|
/**
|
|
173
227
|
* Resolved Vite configuration
|
|
174
228
|
*/
|
|
@@ -180,13 +234,13 @@ export declare class CompilerContext {
|
|
|
180
234
|
/**
|
|
181
235
|
* Whether configServer() hook has already been called
|
|
182
236
|
*
|
|
183
|
-
* @
|
|
237
|
+
* @private
|
|
184
238
|
*/
|
|
185
|
-
|
|
239
|
+
_serverConfigured: boolean;
|
|
186
240
|
/**
|
|
187
241
|
* Assets pending to be served
|
|
188
242
|
*
|
|
189
|
-
* @
|
|
243
|
+
* @private
|
|
190
244
|
*/
|
|
191
245
|
assetsToProvide: ProvideAssetsOptions[] | undefined;
|
|
192
246
|
/**
|
|
@@ -198,19 +252,70 @@ export declare class CompilerContext {
|
|
|
198
252
|
* Style for hiding custom elements before they are loaded. This is appended
|
|
199
253
|
* to the global stylesheet.
|
|
200
254
|
*
|
|
201
|
-
* @
|
|
255
|
+
* @private
|
|
202
256
|
*/
|
|
203
|
-
|
|
257
|
+
_globalHydratedCssString: string;
|
|
204
258
|
/**
|
|
205
259
|
* Contents of the bundled global CSS file
|
|
206
260
|
*
|
|
207
|
-
* @
|
|
261
|
+
* @private
|
|
208
262
|
*/
|
|
209
|
-
|
|
263
|
+
_globalCssString?: string;
|
|
210
264
|
/**
|
|
211
265
|
* A list of file names that declare one or more components
|
|
212
266
|
*/
|
|
213
267
|
componentFiles: string[];
|
|
268
|
+
/**
|
|
269
|
+
* Cached result of makeLoaders() call
|
|
270
|
+
*
|
|
271
|
+
* @private
|
|
272
|
+
*/
|
|
273
|
+
_loadersCache?: ReturnType<typeof makeLoaders>;
|
|
274
|
+
/**
|
|
275
|
+
* Cached result of computeServeOnlyDependencies() call
|
|
276
|
+
*
|
|
277
|
+
* @private
|
|
278
|
+
*/
|
|
279
|
+
_serveOnlyDependencies?: ReturnType<typeof computeServeOnlyDependencies>;
|
|
280
|
+
/**
|
|
281
|
+
* Data structure that stores references between class components and between
|
|
282
|
+
* functional components.
|
|
283
|
+
* This is used in build mode only.
|
|
284
|
+
*
|
|
285
|
+
* @private
|
|
286
|
+
*/
|
|
287
|
+
readonly _customElementDependencies: CustomElementInterdependencies;
|
|
288
|
+
/**
|
|
289
|
+
* Result of getCompilerOptionsForPrinter() call.
|
|
290
|
+
*
|
|
291
|
+
* @internal
|
|
292
|
+
*/
|
|
293
|
+
_compilerOptionsForPrinter: ReturnType<typeof getCompilerOptionsForPrinter>;
|
|
294
|
+
/**
|
|
295
|
+
* Cached result of getPrinter() call. Cached to not needlessly create and
|
|
296
|
+
* throw away a printer instance for each transformed file.
|
|
297
|
+
*
|
|
298
|
+
* @internal
|
|
299
|
+
*/
|
|
300
|
+
_typeScriptPrinter: ReturnType<typeof getPrinter>;
|
|
301
|
+
/**
|
|
302
|
+
* Cached RegExp for replacing occurrences of `ArcgisCounter["el"]` with
|
|
303
|
+
* `HtmlElementArcgisCounter`.
|
|
304
|
+
*
|
|
305
|
+
* @internal
|
|
306
|
+
*/
|
|
307
|
+
_htmlElementReferencesReplacer?: {
|
|
308
|
+
regex: RegExp;
|
|
309
|
+
replacements: Record<string, string>;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Mapping between component tag name and public properties in that component
|
|
313
|
+
* whose type depends on another property.
|
|
314
|
+
*
|
|
315
|
+
* @internal
|
|
316
|
+
*/
|
|
317
|
+
_typeDependencies: Map<string, Set<string>>;
|
|
318
|
+
private _silencedRules;
|
|
214
319
|
constructor(options: LuminaOptions);
|
|
215
320
|
private _inferBuildSetup;
|
|
216
321
|
/**
|
|
@@ -247,4 +352,5 @@ export declare class CompilerContext {
|
|
|
247
352
|
* ```
|
|
248
353
|
*/
|
|
249
354
|
provideAssets(assets: AssetSpec[], transformers?: AssetTransformer[], apply?: CompilerContext["viteCommand"]): void;
|
|
355
|
+
logLintError(rule: keyof LintingOptions["silence"], absoluteFilePath: string, error: string): void;
|
|
250
356
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { CompilerContext } from ".";
|
|
3
|
+
/**
|
|
4
|
+
* In build mode, vite-plugin-dts already parses tsconfig. However, it
|
|
5
|
+
* overwrites the resolved tsconfig.target with ESNext, which is not what we
|
|
6
|
+
* want (we need the real tsconfig.target for the CDN build). Thus, we have
|
|
7
|
+
* to resolve the tsconfig ahead of time manually.
|
|
8
|
+
*
|
|
9
|
+
* In dev server, practically the only use for a TypeScript config is the
|
|
10
|
+
* getPrinter() call. It's also used in ts.createSourceFile(), but looks
|
|
11
|
+
* like that can be safely called with the latest target.
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadTypeScriptConfig(context: CompilerContext): void;
|
|
14
|
+
/**
|
|
15
|
+
* Convert TypeScript ECMA target version number into an ESBuild target version
|
|
16
|
+
* string
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveTargetVersion(typeScriptConfig: Pick<ts.CompilerOptions, "target">): string;
|
|
19
|
+
export declare function loadTypeScript(context: CompilerContext): void;
|
package/dist/context/utils.d.ts
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* While vite-plugin-dts already parses tsconfig, it overwrites the resolved
|
|
4
|
-
* tsconfig.target with ESNext, which is not what we want (we need the real
|
|
5
|
-
* tsconfig.target for the CDN build). Thus, have to resolve the tsconfig
|
|
6
|
-
* ahead of time manually. This is partially redundant and slows down the
|
|
7
|
-
* build a bit
|
|
8
|
-
*/
|
|
9
|
-
export declare function loadTypeScriptConfig(tsConfigPath?: string): {
|
|
10
|
-
readonly path: string;
|
|
11
|
-
readonly config: ts.ParsedCommandLine;
|
|
12
|
-
};
|
|
13
|
-
export declare function inferPreamble(packageJson?: import("../utils/packageJson").MiniPackageJson): string;
|
|
1
|
+
export declare function inferPreamble(packageJson?: import("@arcgis/components-build-utils").MiniPackageJson): string;
|
|
14
2
|
export declare const preambleToComment: (preamble: string) => string;
|
|
15
3
|
export declare const throwOnReadBeforeSet: (createdDuring: string) => PropertyDecorator;
|
|
16
|
-
/**
|
|
17
|
-
* Convert TypeScript ECMA target version number into an ESBuild target version
|
|
18
|
-
* string
|
|
19
|
-
*/
|
|
20
|
-
export declare function resolveTargetVersion(typeScriptConfig: {
|
|
21
|
-
options: Pick<ts.CompilerOptions, "target">;
|
|
22
|
-
}): string;
|
|
23
4
|
export declare function normalizeDocumentationFileName(fileName: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Package } from "custom-elements-manifest/schema";
|
|
2
|
-
import type { ModulePath } from "../
|
|
3
|
-
import type { WebTypes } from "../
|
|
2
|
+
import type { ModulePath } from "../extractor/helpers/resolveType";
|
|
3
|
+
import type { WebTypes } from "../docs/webTypes/types";
|
|
4
4
|
export type ResolvedDependencyComponents = {
|
|
5
5
|
readonly packageName: string;
|
|
6
6
|
readonly type: "@arcgis/lumina" | "stencil" | "unknown";
|
|
@@ -34,7 +34,7 @@ export type ResolvedDependencyComponent = ModulePath & {
|
|
|
34
34
|
*
|
|
35
35
|
* Process:
|
|
36
36
|
* - For each peer and dev dependency:
|
|
37
|
-
* - If it has manifest
|
|
37
|
+
* - If it has custom-elements-manifest, read from there (Lumina libraries
|
|
38
38
|
* and popular community libraries)
|
|
39
39
|
* - Else if has web-types.json, read from there (Vaadin and others)
|
|
40
40
|
* - Else, if it has dist/esm/loader.js (Stencil), read from there
|
|
@@ -52,9 +52,9 @@ export declare function findPackageComponents(packageName: string, cwd?: string)
|
|
|
52
52
|
/**
|
|
53
53
|
* Given the custom element manifest, find custom elements defined in it
|
|
54
54
|
*/
|
|
55
|
-
export declare
|
|
55
|
+
export declare function manifestToDependencyComponents(manifest: Package, dependency: Omit<ModulePath, "moduleName"> & {
|
|
56
56
|
readonly getImportPath: (tagName: string) => string;
|
|
57
|
-
})
|
|
57
|
+
}): ResolvedDependencyComponents["components"];
|
|
58
58
|
export declare const webTypesToDependencyComponents: (webTypes: Partial<WebTypes>, dependency: Omit<ModulePath, "moduleName"> & {
|
|
59
59
|
readonly packageRoot: string | undefined;
|
|
60
60
|
readonly getImportPath: (tagName: string) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ResolvedDependencyComponents } from "./discover";
|
|
2
2
|
import type { BrowserConfigOptions } from "vitest/node";
|
|
3
|
-
export declare function updateLuminaTs(dependencies: readonly ResolvedDependencyComponents[], srcDir: string, hasCore: boolean, browserProvider?: BrowserConfigOptions["provider"], packageJson?: import("
|
|
4
|
-
declare function produceLuminaTs(dependencies: readonly ResolvedDependencyComponents[], hasCore: boolean, browserProvider?: BrowserConfigOptions["provider"], packageJson?: import("
|
|
3
|
+
export declare function updateLuminaTs(dependencies: readonly ResolvedDependencyComponents[], srcDir: string, hasCore: boolean, browserProvider?: BrowserConfigOptions["provider"], packageJson?: import("@arcgis/components-build-utils").MiniPackageJson): Promise<void>;
|
|
4
|
+
declare function produceLuminaTs(dependencies: readonly ResolvedDependencyComponents[], hasCore: boolean, browserProvider?: BrowserConfigOptions["provider"], packageJson?: import("@arcgis/components-build-utils").MiniPackageJson): string;
|
|
5
5
|
export declare const exportsForTests: {
|
|
6
6
|
produceLuminaTs: typeof produceLuminaTs;
|
|
7
7
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { JsonDocs } from "@stencil/core/internal";
|
|
2
2
|
import type { CompilerContext } from "../context";
|
|
3
3
|
/**
|
|
4
|
-
* Create a stencil-compatible docs.json
|
|
4
|
+
* Create a stencil-compatible docs.json file describing the library components.
|
|
5
|
+
*
|
|
5
6
|
* While custom-elements-manifest is the most popular community standard and is
|
|
6
7
|
* natively supported by Storybook and other tools, Esri has several internal
|
|
7
|
-
* tools that expect the Stencil-style docs.json
|
|
8
|
-
* Since they are similar in content, generating a Stencil-compatible
|
|
8
|
+
* tools that expect the Stencil-style docs.json.
|
|
9
|
+
* Since they are similar in content, generating a Stencil-compatible docs.json
|
|
9
10
|
* will smooth the migration path.
|
|
10
11
|
*
|
|
11
12
|
* @remarks
|
|
@@ -14,4 +15,4 @@ import type { CompilerContext } from "../context";
|
|
|
14
15
|
* generates:
|
|
15
16
|
* https://github.com/ionic-team/stencil/blob/9f5f9cdd023b8c8dfb5417a1a970605ba724ae28/src/compiler/docs/generate-doc-data.ts#L98
|
|
16
17
|
*/
|
|
17
|
-
export declare const
|
|
18
|
+
export declare const generateStencilDocsJson: (context: CompilerContext) => JsonDocs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DocsType = "apiJson" | "stencilLikeDocsJson" | "vsCodeCss" | "vsCodeHtml" | "webTypes";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { VsCodeHtmlDocs, VsCodeCssDocs
|
|
2
|
-
import type {
|
|
1
|
+
import type { VsCodeHtmlDocs, VsCodeCssDocs } from "./types.js";
|
|
2
|
+
import type { ApiCustomElementDeclaration } from "@arcgis/api-extractor";
|
|
3
3
|
/**
|
|
4
4
|
* Originally based on
|
|
5
5
|
* https://github.com/break-stuff/cem-tools/tree/main/packages/vs-code-integration
|
|
@@ -12,5 +12,5 @@ import type { ComponentManifest } from "../utils.js";
|
|
|
12
12
|
*
|
|
13
13
|
* But also there are several other quality issues with the original plugin.
|
|
14
14
|
*/
|
|
15
|
-
export declare const generateVsCodeHtmlCustomData: (components:
|
|
16
|
-
export declare const generateVsCodeCssCustomData: (components:
|
|
15
|
+
export declare const generateVsCodeHtmlCustomData: (components: ApiCustomElementDeclaration[]) => VsCodeHtmlDocs;
|
|
16
|
+
export declare const generateVsCodeCssCustomData: (components: ApiCustomElementDeclaration[]) => VsCodeCssDocs;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
export type VsCodeDocOptions = {
|
|
2
2
|
/** @default "docs/vscode.html-custom-data.json" */
|
|
3
|
-
htmlFileName?: string
|
|
3
|
+
htmlFileName?: string;
|
|
4
4
|
/** @default "docs/vscode.css-custom-data.json" */
|
|
5
|
-
cssFileName?: string
|
|
6
|
-
/** Used to create an array of links within the component info bubble */
|
|
7
|
-
referencesTemplate?: (name: string, tag: string) => VsCodeReference[];
|
|
5
|
+
cssFileName?: string;
|
|
8
6
|
};
|
|
9
7
|
export type VsCodeHtmlDocs = {
|
|
10
8
|
$schema: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ApiClassMember, type ApiCssCustomProperty, type ApiCssPart, type ApiCustomElementDeclaration, type ApiEvent, type ApiSlot } from "@arcgis/api-extractor";
|
|
2
|
+
export declare function getComponentDetailsTemplate(component: ApiCustomElementDeclaration): string;
|
|
3
|
+
export declare const getSlotsTemplate: (slots?: ApiSlot[]) => string;
|
|
4
|
+
export declare const getEventsTemplate: (events?: ApiEvent[]) => string;
|
|
5
|
+
export declare const getCssPropsTemplate: (cssProperties?: ApiCssCustomProperty[]) => string;
|
|
6
|
+
export declare const getPartsTemplate: (cssParts?: ApiCssPart[]) => string;
|
|
7
|
+
export declare const getMethodsTemplate: (methods: ApiClassMember[]) => string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentManifest } from "../utils";
|
|
2
1
|
import type { WebTypesOptions, WebTypesElement, WebTypes } from "./types";
|
|
2
|
+
import { type ApiCustomElementDeclaration } from "@arcgis/api-extractor";
|
|
3
3
|
/**
|
|
4
4
|
* Originally based on
|
|
5
5
|
* https://github.com/break-stuff/cem-tools/tree/main/packages/jet-brains-integration
|
|
@@ -16,5 +16,5 @@ import type { WebTypesOptions, WebTypesElement, WebTypes } from "./types";
|
|
|
16
16
|
* - https://github.com/break-stuff/cem-tools/issues/141
|
|
17
17
|
* - https://github.com/break-stuff/cem-tools/issues/112
|
|
18
18
|
*/
|
|
19
|
-
export declare function generateWebTypes(components:
|
|
20
|
-
export declare const getTagList: (components:
|
|
19
|
+
export declare function generateWebTypes(components: ApiCustomElementDeclaration[], options: WebTypesOptions): WebTypes;
|
|
20
|
+
export declare const getTagList: (components: ApiCustomElementDeclaration[]) => WebTypesElement[];
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type { VsCodeReference } from "../vsCodeCustomData/types";
|
|
2
1
|
export type WebTypesOptions = {
|
|
3
2
|
/** @default "docs/web-types.json" */
|
|
4
3
|
webTypesFileName?: string;
|
|
5
|
-
/** Used to create a link within the component info bubble */
|
|
6
|
-
referenceTemplate?: (name: string, tag: string) => Pick<VsCodeReference, "url">;
|
|
7
4
|
/** Adds an icon link to the web-types.json **/
|
|
8
5
|
defaultIcon?: string;
|
|
9
6
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ApiCustomElementDeclaration } from "@arcgis/api-extractor";
|
|
2
|
+
import type { WebTypesAttribute, WebTypesCssProperty, WebTypesPseudoElement } from "./types";
|
|
3
|
+
export declare const getCssPropertyList: (components: ApiCustomElementDeclaration[]) => WebTypesCssProperty[];
|
|
4
|
+
export declare const getCssPartList: (components: ApiCustomElementDeclaration[]) => WebTypesPseudoElement[];
|
|
5
|
+
export declare const getComponentAttributes: (component: ApiCustomElementDeclaration) => WebTypesAttribute[];
|
|
6
|
+
export declare const formatDescription: (description?: string, deprecated?: boolean | string) => string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { CompilerContext } from "../context";
|
|
2
1
|
export declare const customElementEntrypointName = "customElement.js";
|
|
3
2
|
export declare const customElementDtsFileName = "customElement.d.ts";
|
|
4
3
|
export type CustomElementInterdependencies = Record<string, {
|
|
@@ -16,8 +15,4 @@ export type CustomElementInterdependencies = Record<string, {
|
|
|
16
15
|
referencedTagNames: string[];
|
|
17
16
|
readonly referencedBy: string[];
|
|
18
17
|
}>;
|
|
19
|
-
/**
|
|
20
|
-
* This is used in build mode only.
|
|
21
|
-
*/
|
|
22
|
-
export declare const customElementDependencies: WeakMap<CompilerContext, CustomElementInterdependencies>;
|
|
23
18
|
export declare const defaultBrowserTestProvider = "playwright";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DeclarationTextTransformer } from "../publicTypes";
|
|
2
|
-
import { path } from "
|
|
2
|
+
import { path } from "@arcgis/components-build-utils";
|
|
3
3
|
import type { CompilerContext } from "../context";
|
|
4
4
|
export declare const rewriteDtsComponentFileNames: DeclarationTextTransformer;
|
|
5
5
|
export declare const rePath: RegExp;
|
|
@@ -11,7 +11,7 @@ export declare const rePath: RegExp;
|
|
|
11
11
|
* Assuming content includes POSIX paths only (as that's what import specifiers
|
|
12
12
|
* in ECMAScript use)
|
|
13
13
|
*/
|
|
14
|
-
export declare const rewriteComponentImportSpecifiers: (code: string, context: Pick<CompilerContext, "
|
|
14
|
+
export declare const rewriteComponentImportSpecifiers: (code: string, context: Pick<CompilerContext, "_componentPathMapping" | "dir">, cwd: string, originalCwd: string) => string;
|
|
15
15
|
/**
|
|
16
16
|
* The result of relative() is a path that does not start with `./`.
|
|
17
17
|
* In import statements the path must begin with ../ or ./ to be interpreted as
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CompilerContext } from "../context";
|
|
2
|
-
import type { ComponentManifest } from "../manifests/utils";
|
|
3
2
|
/**
|
|
4
3
|
* A mapping between a path to a component folder in src/components and it's
|
|
5
4
|
* tag name.
|
|
@@ -20,6 +19,6 @@ import type { ComponentManifest } from "../manifests/utils";
|
|
|
20
19
|
export type ComponentPathMapping = Record<string, PathMappingInterface | string>;
|
|
21
20
|
interface PathMappingInterface extends ComponentPathMapping {
|
|
22
21
|
}
|
|
23
|
-
export declare function addComponentPathMapping(
|
|
24
|
-
export declare function renameComponentFolder(filePath: string, pathBase: string, context: Pick<CompilerContext, "
|
|
22
|
+
export declare function addComponentPathMapping(tagName: string, context: CompilerContext, sourcePath: string): string;
|
|
23
|
+
export declare function renameComponentFolder(filePath: string, pathBase: string, context: Pick<CompilerContext, "_componentPathMapping">): string;
|
|
25
24
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ResolvedDependencyComponent } from "../dependencies/discover";
|
|
2
|
-
import type { ModulePath } from "../
|
|
3
|
-
import type { ExtendedComponentManifest } from "../manifests/complexTypes/types";
|
|
2
|
+
import type { ModulePath } from "../extractor/helpers/resolveType";
|
|
4
3
|
import type { CompilerContext } from "../context";
|
|
5
4
|
/**
|
|
6
5
|
* Automatically add imports as appropriate for all referenced internally defined
|
|
@@ -8,7 +7,7 @@ import type { CompilerContext } from "../context";
|
|
|
8
7
|
*/
|
|
9
8
|
export declare function resolveTagName(context: CompilerContext, tagName: string, fileName: string): ModulePath;
|
|
10
9
|
export declare function modulePathToString(resolvedPath: ModulePath, distRelativeCwd: string): string;
|
|
11
|
-
export declare function
|
|
10
|
+
export declare function getLocalDefinedComponentsFromApiJson(context: Pick<CompilerContext, "_localDefinedComponents" | "privateApiJson">): Readonly<Record<string, ResolvedDependencyComponent>>;
|
|
12
11
|
export declare const exportsForTests: {
|
|
13
12
|
modulePathToString: typeof modulePathToString;
|
|
14
13
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type ts from "typescript";
|
|
2
|
+
import type { ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiJson, ApiModule } from "@arcgis/api-extractor";
|
|
3
|
+
export declare function findMember(component: Pick<ApiCustomElementDeclaration, "members" | "name">, memberNode: ts.AccessorDeclaration | ts.MethodDeclaration | ts.PropertyDeclaration): ApiClassMethod | ApiCustomElementField | undefined;
|
|
4
|
+
export declare function findApiModule(filePath: string, rootDir: string, apiJson: ApiJson): ApiModule | undefined;
|
|
@@ -34,25 +34,16 @@
|
|
|
34
34
|
*
|
|
35
35
|
* FEATURE: for usages in tests, allow `static override tagName = "te-st";` to define a component? and adapt transformers and plugins to look for nested components too when context.isInTest
|
|
36
36
|
*/
|
|
37
|
-
import
|
|
37
|
+
import ts from "typescript";
|
|
38
38
|
import type { FileTransformer } from "../publicTypes";
|
|
39
|
-
import type {
|
|
40
|
-
|
|
41
|
-
* The manifest creation process is using ts.SourceFile instances created
|
|
42
|
-
* by generateTypes() plugin rather than the transform() hooks (to have
|
|
43
|
-
* access to the AST and types).
|
|
44
|
-
* And, to make sure plugins can get access to the final manifest as soon as
|
|
45
|
-
* possible, the manifest generation process is running before any file
|
|
46
|
-
* transform().
|
|
47
|
-
* At the same time, the manifest generation is not aware of our web
|
|
48
|
-
* components because `@customElement()` decorators are not present yet
|
|
49
|
-
* (will be added in transform() hook in vite plugin below). So we have to
|
|
50
|
-
* manually augment "moduleDoc.exports" in this plugin, and later on add the
|
|
51
|
-
* `@customElement()` decorator in the vite plugin.
|
|
52
|
-
*/
|
|
53
|
-
export declare const addCustomElementDecoratorManifestPlugin: (context: CompilerContext) => ManifestPlugin;
|
|
39
|
+
import type { DeclarationTextTransformer } from "../publicTypes";
|
|
40
|
+
export declare const removeDeclarationFromDts: DeclarationTextTransformer;
|
|
54
41
|
export declare const addCustomElementDecoratorTransformer: FileTransformer;
|
|
55
|
-
export declare function
|
|
42
|
+
export declare function findDeclaredComponentsInFile(file: ts.SourceFile): Map<string, string>;
|
|
43
|
+
type DeclaredComponents = readonly (readonly [string, string])[];
|
|
44
|
+
export declare function findDeclaredComponents(code: string): DeclaredComponents | undefined;
|
|
45
|
+
export declare function validateTagName(tagName: string, className: string): void;
|
|
56
46
|
export declare const exportsForTests: {
|
|
57
47
|
findDeclaredComponents: typeof findDeclaredComponents;
|
|
58
48
|
};
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { ApiExtractor } from "@arcgis/api-extractor";
|
|
3
|
+
import type { ApiAttribute, ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiCustomElementMember, ApiDeclaration, ApiEvent, ApiExport, ApiJson, ApiModule } from "@arcgis/api-extractor";
|
|
4
|
+
import type { CompilerContext } from "../context";
|
|
5
|
+
export declare class LuminaApiExtractor extends ApiExtractor {
|
|
6
|
+
context: CompilerContext;
|
|
7
|
+
protected isPathOnly: boolean;
|
|
8
|
+
constructor(context: CompilerContext, isPathOnly: boolean);
|
|
9
|
+
protected localCssImports?: Set<string>;
|
|
10
|
+
protected localDeclaredComponents: Map<string, string>;
|
|
11
|
+
protected componentHtmlTypes: Map<string, string>;
|
|
12
|
+
protected apiComponent: ApiCustomElementDeclaration;
|
|
13
|
+
protected pairedSetter: ts.SetAccessorDeclaration | undefined;
|
|
14
|
+
extract(files: readonly ts.SourceFile[]): ApiJson;
|
|
15
|
+
protected extractModules(files: readonly ts.SourceFile[]): ApiModule[];
|
|
16
|
+
protected extractDeclarations(module: ts.SourceFile): ApiDeclaration[];
|
|
17
|
+
protected extractDeclaration(statement: ts.Statement): ApiDeclaration | undefined;
|
|
18
|
+
protected collectCssImports(node: ts.ImportDeclaration): void;
|
|
19
|
+
protected extractComponentDeclaration(node: ts.ClassDeclaration): ApiCustomElementDeclaration | undefined;
|
|
20
|
+
protected extractComponentMembers(node: ts.ClassDeclaration): ApiCustomElementMember[];
|
|
21
|
+
protected extractComponentMember(node: ts.ClassElement, name: string | undefined): ApiCustomElementMember | undefined;
|
|
22
|
+
protected extractComponentField(node: ts.AccessorDeclaration | ts.PropertyDeclaration, name: string): ApiCustomElementField | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Based on a `non-@property()` property, extract a public event if it is one.
|
|
25
|
+
*/
|
|
26
|
+
protected extractComponentEvent(node: ts.PropertyDeclaration, name: string): ApiEvent | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* When doing full API extraction, extract additional details for a field.
|
|
29
|
+
*/
|
|
30
|
+
protected extractComponentFieldDetails(node: ts.AccessorDeclaration | ts.PropertyDeclaration, property: ApiCustomElementField): void;
|
|
31
|
+
/**
|
|
32
|
+
* Find the properties given to the `@property()` decorator.
|
|
33
|
+
*/
|
|
34
|
+
protected findPropertyOptions(member: ts.AccessorDeclaration | ts.PropertyDeclaration): readonly ts.ObjectLiteralElementLike[] | undefined;
|
|
35
|
+
protected extractComponentMethod(node: ts.MethodDeclaration, name: string): ApiClassMethod | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Infer attributes based on public component members.
|
|
38
|
+
*/
|
|
39
|
+
protected inferAttributes(members: ApiCustomElementMember[]): ApiAttribute[];
|
|
40
|
+
protected inferExport(declaration: ApiDeclaration): ApiExport | undefined;
|
|
41
|
+
protected inferCustomElementExport(declaration: ApiCustomElementDeclaration): ApiExport;
|
|
42
|
+
/**
|
|
43
|
+
* Inherit public members from a superclass. For this to work, the superclass
|
|
44
|
+
* needs to be in a a file named like a component
|
|
45
|
+
* (src/components/name/name.tsx), even if it is not a standalone component.
|
|
46
|
+
*/
|
|
47
|
+
protected inheritMembers(component: ApiCustomElementDeclaration, modules: ApiModule[], existingMembers?: Set<string>, existingAttributes?: Set<string>, existingEvents?: Set<string>): void;
|
|
48
|
+
private _resolvedInheritance;
|
|
49
|
+
/**
|
|
50
|
+
* Based on the superclass name, find the actual declaration in the modules.
|
|
51
|
+
*/
|
|
52
|
+
protected resolveInheritance(superClassName: string, modules: ApiModule[]): ApiCustomElementDeclaration | undefined;
|
|
53
|
+
}
|