@arcgis/lumina-compiler 4.32.0-next.7 → 4.32.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.
Files changed (98) hide show
  1. package/dist/context/index.d.ts +154 -40
  2. package/dist/context/typeScript.d.ts +19 -0
  3. package/dist/context/utils.d.ts +0 -19
  4. package/dist/dependencies/discover.d.ts +5 -5
  5. package/dist/dependencies/index.d.ts +1 -0
  6. package/dist/dependencies/updateLumina.d.ts +1 -1
  7. package/dist/docs/config.d.ts +2 -0
  8. package/dist/docs/stencilDocsJson.d.ts +125 -0
  9. package/dist/docs/types.d.ts +1 -0
  10. package/dist/{manifests → docs}/vsCodeCustomData/index.d.ts +4 -4
  11. package/dist/{manifests → docs}/vsCodeCustomData/types.d.ts +2 -4
  12. package/dist/docs/vsCodeCustomData/utils.d.ts +3 -0
  13. package/dist/docs/webTypes/description.d.ts +7 -0
  14. package/dist/{manifests → docs}/webTypes/index.d.ts +3 -3
  15. package/dist/{manifests → docs}/webTypes/types.d.ts +0 -3
  16. package/dist/docs/webTypes/utils.d.ts +6 -0
  17. package/dist/entrypoints/config.d.ts +0 -5
  18. package/dist/entrypoints/dtsUtils.d.ts +1 -1
  19. package/dist/entrypoints/pathMapping.d.ts +2 -3
  20. package/dist/entrypoints/resolveTagName.d.ts +2 -3
  21. package/dist/extractor/apiJsonUtils.d.ts +4 -0
  22. package/dist/{manifests/customElementDecoratorPlugins.d.ts → extractor/declaration.d.ts} +3 -17
  23. package/dist/extractor/extractor.d.ts +53 -0
  24. package/dist/extractor/helpers/cssDoc.d.ts +11 -0
  25. package/dist/extractor/helpers/event.d.ts +9 -0
  26. package/dist/extractor/helpers/jsDoc.d.ts +11 -0
  27. package/dist/extractor/helpers/method.d.ts +11 -0
  28. package/dist/extractor/helpers/property.d.ts +9 -0
  29. package/dist/extractor/helpers/resolveType.d.ts +47 -0
  30. package/dist/extractor/helpers/resolveType.spec.d.ts +1 -0
  31. package/dist/extractor/helpers/typeValue.d.ts +60 -0
  32. package/dist/extractor/helpers/typeValue.spec.d.ts +1 -0
  33. package/dist/extractor/index.d.ts +12 -0
  34. package/dist/frameworkTypes/lumina.d.ts +2 -2
  35. package/dist/frameworkTypes/preact.d.ts +2 -2
  36. package/dist/frameworkTypes/react.d.ts +2 -2
  37. package/dist/frameworkTypes/stencil.d.ts +2 -2
  38. package/dist/frameworkTypes/utils.d.ts +2 -3
  39. package/dist/frameworkTypes/vanilla.d.ts +2 -2
  40. package/dist/index.d.ts +4 -4
  41. package/dist/index.js +122 -142
  42. package/dist/jsxToLitHtml/config.d.ts +2 -1
  43. package/dist/jsxToLitHtml/convertProps.d.ts +1 -1
  44. package/dist/jsxToLitHtml/index.d.ts +3 -0
  45. package/dist/jsxToLitHtml/jsxVisitor.d.ts +1 -1
  46. package/dist/jsxToLitHtml/types.d.ts +1 -0
  47. package/dist/loader/index.d.ts +13 -0
  48. package/dist/{manifests → loader}/lazy.d.ts +4 -4
  49. package/dist/loader/lazy.spec.d.ts +1 -0
  50. package/dist/loader/storybookApiJson.d.ts +6 -0
  51. package/dist/plugins/loadLitCss.d.ts +1 -0
  52. package/dist/plugins/updatePackageJson.d.ts +1 -1
  53. package/dist/publicTypes.d.ts +79 -30
  54. package/dist/puppeteerTesting/globalSetup.js +2 -2
  55. package/dist/puppeteerTesting/index.js +4 -4
  56. package/dist/puppeteerTesting/puppeteer/element.d.ts +3 -2
  57. package/dist/puppeteerTesting/puppeteer/types.d.ts +8 -4
  58. package/dist/puppeteerTesting/vitest/runner.d.ts +4 -1
  59. package/dist/puppeteerTesting/vitest/runner.js +1 -1
  60. package/dist/testing/index.js +24 -1
  61. package/dist/testing/mount.d.ts +1 -1
  62. package/dist/tests/utils.d.ts +1 -1
  63. package/dist/transformers/index.d.ts +4 -0
  64. package/dist/transformers/internalTypeScriptApis.d.ts +1 -2
  65. package/dist/transformers/property.d.ts +1 -1
  66. package/dist/transformers/propertyOptions.d.ts +2 -2
  67. package/dist/types/failOnJsonImport.d.ts +2 -0
  68. package/dist/types/hideInternalLitElement.d.ts +2 -0
  69. package/dist/useLumina.d.ts +1 -1
  70. package/package.json +9 -10
  71. package/dist/manifests/complexTypes/addComponentMetadata.d.ts +0 -8
  72. package/dist/manifests/complexTypes/addMethodMetadata.d.ts +0 -6
  73. package/dist/manifests/complexTypes/addPropMetadata.d.ts +0 -8
  74. package/dist/manifests/complexTypes/docsUtils.d.ts +0 -18
  75. package/dist/manifests/complexTypes/event.d.ts +0 -9
  76. package/dist/manifests/complexTypes/getComplexPropertyType.d.ts +0 -11
  77. package/dist/manifests/complexTypes/transformUtils.d.ts +0 -112
  78. package/dist/manifests/complexTypes/typeToEnum.d.ts +0 -14
  79. package/dist/manifests/complexTypes/types.d.ts +0 -135
  80. package/dist/manifests/config.d.ts +0 -2
  81. package/dist/manifests/createManifest.d.ts +0 -39
  82. package/dist/manifests/index.d.ts +0 -12
  83. package/dist/manifests/kebabCaseAttributes.d.ts +0 -18
  84. package/dist/manifests/stencilManifest.d.ts +0 -17
  85. package/dist/manifests/storybookManifest.d.ts +0 -6
  86. package/dist/manifests/types.d.ts +0 -1
  87. package/dist/manifests/utils.d.ts +0 -17
  88. package/dist/manifests/vsCodeCustomData/utils.d.ts +0 -3
  89. package/dist/manifests/webTypes/description.d.ts +0 -8
  90. package/dist/manifests/webTypes/utils.d.ts +0 -6
  91. package/dist/transformers/guardAgainstInternalJsDoc.d.ts +0 -11
  92. package/dist/transformers/updateOriginalFile.d.ts +0 -20
  93. /package/dist/{manifests/complexTypes/transformUtils.spec.d.ts → context/typeScript.spec.d.ts} +0 -0
  94. /package/dist/{plugins/generateDocs.d.ts → docs/index.d.ts} +0 -0
  95. /package/dist/{manifests/complexTypes/typeToEnum.spec.d.ts → docs/steniclDocsJson.test.d.ts} +0 -0
  96. /package/dist/{manifests/customElementDecoratorPlugins.spec.d.ts → extractor/declaration.spec.d.ts} +0 -0
  97. /package/dist/{manifests/lazy.spec.d.ts → extractor/helpers/cssDoc.spec.d.ts} +0 -0
  98. /package/dist/{manifests → loader}/hideUntilHydrated.d.ts +0 -0
@@ -1,87 +1,136 @@
1
1
  import type { ConfigEnv, Plugin, ResolvedConfig, ViteDevServer } from "vite";
2
2
  import ts from "typescript";
3
- import type { LuminaOptions, AssetSpec, AssetTransformer, DeclarationTextTransformer, ProvideAssetsOptions } from "../publicTypes";
4
- import type { ExtendedComponentManifest } from "../manifests/complexTypes/types";
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 { ManifestType } from "../manifests/types";
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 a resolved TypeScript config file
16
+ * The path to the resolved TypeScript configuration
12
17
  */
13
- readonly typeScriptConfigPath: string;
18
+ typeScriptConfigPath: string;
14
19
  /**
15
- * The resolved TypeScript config file
20
+ * The parsed TypeScript configuration
16
21
  */
17
- readonly typeScriptConfig: ts.ParsedCommandLine;
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, not in serve
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, not in serve
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
51
+ */
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
37
59
  */
38
- private _typeScriptSourceFiles;
60
+ _typeScriptReload?: Deferred<void>;
39
61
  /**
40
62
  * Whether minification is enabled for transformed JSX (lit-html templates)
41
63
  * and generated component code.
42
64
  */
43
65
  shouldMinify: boolean;
44
66
  /**
45
- * Like this.shouldMinifyStrict, but true when in test mode. Reasons:
67
+ * Like this.shouldMinify, but true when in test mode. Reasons:
46
68
  * - If accessing .textContent, the whitespace amount differs between minified
47
69
  * and non-minified lit-html templates. In Stencil's JSX this was not the
48
70
  * case. To ease migration of tests, we minify lit-html in tests too.
49
71
  * - From the above, you can see that minification does change semantics in
50
72
  * some cases. To have tests be truer to the real world, we minify in tests.
73
+ *
74
+ * Also, true during build as per
75
+ * https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/2084
51
76
  */
52
- shouldMinifyStrict: boolean;
77
+ shouldMinifyJsx: boolean;
53
78
  /**
54
79
  *
55
80
  * A vite plugin that sets the initial context information based on Vite
56
81
  * environment
57
82
  *
58
- * @internal
83
+ * @private
59
84
  */
60
- readonly plugin: Plugin;
85
+ readonly _plugin: Plugin;
61
86
  /**
62
87
  * List of directories of common interest to the compiler
63
88
  */
64
89
  dir: ContextDirectories;
65
90
  /**
66
- * The custom-element-manifest, also known as custom-element.json
67
- *
68
- * Stores information about the structure of all components in the package
69
- * (their properties, methods, events, JSDoc and etc).
91
+ * The api.json stores information about the structure of all components in
92
+ * the package (their properties, methods, events, JSDoc and etc).
70
93
  *
71
- * You can augment the manifest generation using the `manifest` option on
94
+ * You can augment the api.json generation using the `apiJson` option in
72
95
  * `useLumina()`
96
+ */
97
+ apiJson: ApiJson;
98
+ /**
99
+ * A flattened api.json listing all components in this package.
100
+ */
101
+ apiJsonComponents: ApiCustomElementDeclaration[];
102
+ /**
103
+ * Like this.apiJson, but also contains members decorated with the `@private`
104
+ * JSDoc tag.
105
+ */
106
+ privateApiJson: ApiJson;
107
+ /**
108
+ * @private
109
+ */
110
+ _componentPathMapping: ComponentPathMapping;
111
+ /**
112
+ * Cached result of getLocalDefinedComponentsFromApiJson() call
73
113
  *
74
- * @see https://custom-elements-manifest.open-wc.org/analyzer/getting-started/
114
+ * @private
75
115
  */
76
- manifest: ExtendedComponentManifest;
116
+ _localDefinedComponents?: ReturnType<typeof getLocalDefinedComponentsFromApiJson>;
77
117
  /**
78
- * A flattened custom-element-manifest listing all components in this package.
118
+ * Mapping of css files and which components they are imported in.
119
+ *
120
+ * @private
79
121
  */
80
- manifestComponents: ComponentManifest[];
122
+ readonly _cssImports: Map<string, Set<string> | undefined>;
81
123
  /**
82
- * @internal
124
+ * Mapping of CSS file names to docs extracted from them.
125
+ *
126
+ * CSS files are read during the file transform stage, which is after the
127
+ * api.json is extracted. This unfortunately means that we have to mutate
128
+ * the api.json after the fact to add the CSS docs. Furthermore, when api.json
129
+ * is re-generated, we need to re-add the CSS docs previously extracted.
130
+ *
131
+ * @private
83
132
  */
84
- componentPathMapping: ComponentPathMapping;
133
+ _cssDocs?: Map<string, ApiCssCustomProperty[] | undefined>;
85
134
  /**
86
135
  * The environment that Vite is running in
87
136
  *
@@ -149,6 +198,14 @@ export declare class CompilerContext {
149
198
  * should not try to read this property before the `apply()` hook is called.
150
199
  */
151
200
  viteCommand: ConfigEnv["command"];
201
+ /**
202
+ * Whether to extract full API information, with type-checking. This is the
203
+ * case during build or when running under Storybook. Otherwise, the dev
204
+ * server keeps API extraction to bare minimum to reduce needless overhead.
205
+ * Only the information necessary for the dev server to lazy load is
206
+ * extracted.
207
+ */
208
+ isFullApiExtraction: boolean;
152
209
  readonly banner: string;
153
210
  /**
154
211
  * `@arcgis/lumina-compiler` plugins may register additional `.d.ts`
@@ -156,19 +213,19 @@ export declare class CompilerContext {
156
213
  * option, use the `types.declarationTextTransformers` option on the
157
214
  * `useLumina` Vite plugin.
158
215
  *
159
- * @internal
216
+ * @private
160
217
  */
161
- readonly declarationTextTransformers: DeclarationTextTransformer[];
218
+ readonly _declarationTextTransformers: DeclarationTextTransformer[];
162
219
  /**
163
220
  * Options passed to `useLumina()`
164
221
  */
165
- options: LuminaOptions;
222
+ readonly options: LuminaOptions;
166
223
  /**
167
224
  * Resolved file names for documentation files
168
225
  *
169
- * @internal
226
+ * @private
170
227
  */
171
- documentationFileNames: Record<ManifestType, string>;
228
+ readonly _documentationFileNames: Record<DocsType, string | undefined>;
172
229
  /**
173
230
  * Resolved Vite configuration
174
231
  */
@@ -180,13 +237,13 @@ export declare class CompilerContext {
180
237
  /**
181
238
  * Whether configServer() hook has already been called
182
239
  *
183
- * @internal
240
+ * @private
184
241
  */
185
- serverConfigured: boolean;
242
+ _serverConfigured: boolean;
186
243
  /**
187
244
  * Assets pending to be served
188
245
  *
189
- * @internal
246
+ * @private
190
247
  */
191
248
  assetsToProvide: ProvideAssetsOptions[] | undefined;
192
249
  /**
@@ -198,19 +255,75 @@ export declare class CompilerContext {
198
255
  * Style for hiding custom elements before they are loaded. This is appended
199
256
  * to the global stylesheet.
200
257
  *
201
- * @internal
258
+ * @private
202
259
  */
203
- globalHydratedCssString: string;
260
+ _globalHydratedCssString: string;
204
261
  /**
205
262
  * Contents of the bundled global CSS file
206
263
  *
207
- * @internal
264
+ * @private
208
265
  */
209
- globalCssString?: string;
266
+ _globalCssString?: string;
210
267
  /**
211
268
  * A list of file names that declare one or more components
212
269
  */
213
270
  componentFiles: string[];
271
+ /**
272
+ * Cached result of makeLoaders() call
273
+ *
274
+ * @private
275
+ */
276
+ _loadersCache?: ReturnType<typeof makeLoaders>;
277
+ /**
278
+ * Cached result of computeServeOnlyDependencies() call
279
+ *
280
+ * @private
281
+ */
282
+ _serveOnlyDependencies?: ReturnType<typeof computeServeOnlyDependencies>;
283
+ /**
284
+ * Data structure that stores references between class components and between
285
+ * functional components.
286
+ * This is used in build mode only.
287
+ *
288
+ * @private
289
+ */
290
+ readonly _customElementDependencies: CustomElementInterdependencies;
291
+ /**
292
+ * Result of getCompilerOptionsForPrinter() call.
293
+ *
294
+ * @private
295
+ */
296
+ _compilerOptionsForPrinter: ReturnType<typeof getCompilerOptionsForPrinter>;
297
+ /**
298
+ * Cached result of getPrinter() call. Cached to not needlessly create and
299
+ * throw away a printer instance for each transformed file.
300
+ *
301
+ * @private
302
+ */
303
+ _typeScriptPrinter: ReturnType<typeof getPrinter>;
304
+ /**
305
+ * Cached RegExp for replacing occurrences of `ArcgisCounter["el"]` with
306
+ * `HtmlElementArcgisCounter`.
307
+ *
308
+ * @private
309
+ */
310
+ _htmlElementReferencesReplacer?: {
311
+ regex: RegExp;
312
+ replacements: Record<string, string>;
313
+ };
314
+ /**
315
+ * Mapping between component tag name and public properties in that component
316
+ * whose type depends on another property.
317
+ *
318
+ * @private
319
+ */
320
+ _typeDependencies: Map<string, Set<string>>;
321
+ private _silencedRules;
322
+ /**
323
+ * Promise that resolves once src/lumina.ts is updated
324
+ * @private
325
+ */
326
+ _updateLuminaTsPromise?: Promise<void>;
214
327
  constructor(options: LuminaOptions);
215
328
  private _inferBuildSetup;
216
329
  /**
@@ -247,4 +360,5 @@ export declare class CompilerContext {
247
360
  * ```
248
361
  */
249
362
  provideAssets(assets: AssetSpec[], transformers?: AssetTransformer[], apply?: CompilerContext["viteCommand"]): void;
363
+ logLintError(rule: keyof LintingOptions["silence"], absoluteFilePath: string, error: string): void;
250
364
  }
@@ -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, withSourceMap: boolean): void;
@@ -1,23 +1,4 @@
1
- import ts from "typescript";
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
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 "../manifests/complexTypes/transformUtils";
3
- import type { WebTypes } from "../manifests/webTypes/types";
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.json, read from there (Lumina libraries
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 const manifestToDependencyComponents: (manifest: Package, dependency: Omit<ModulePath, "moduleName"> & {
55
+ export declare function manifestToDependencyComponents(manifest: Package, dependency: Omit<ModulePath, "moduleName"> & {
56
56
  readonly getImportPath: (tagName: string) => string;
57
- }) => ResolvedDependencyComponents["components"];
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;
@@ -10,3 +10,4 @@ export declare const doLoadersApply: (context: CompilerContext, htmlContext?: In
10
10
  *
11
11
  */
12
12
  export declare const provideDependencySupport: (context: CompilerContext) => Plugin;
13
+ export declare const luminaTsUpdatedMessage: string;
@@ -1,6 +1,6 @@
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("@arcgis/components-build-utils").MiniPackageJson): Promise<void>;
3
+ export declare function updateLuminaTs(dependencies: readonly ResolvedDependencyComponents[], srcDir: string, hasCore: boolean, browserProvider?: BrowserConfigOptions["provider"], packageJson?: import("@arcgis/components-build-utils").MiniPackageJson): Promise<boolean>;
4
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;
@@ -0,0 +1,2 @@
1
+ import type { DocsType } from "./types";
2
+ export declare const defaultDocsFileNames: Record<DocsType, string>;
@@ -0,0 +1,125 @@
1
+ import type { ComponentCompilerTypeReferences } from "@stencil/core/internal";
2
+ import type { CompilerContext } from "../context";
3
+ import { type ApiDocsTag } from "@arcgis/api-extractor";
4
+ /**
5
+ * To avoid having a dependency on Stencil, we inline Stencil types rather than
6
+ * importing them.
7
+ */
8
+ export interface JsonDocs {
9
+ components: JsonDocsComponent[];
10
+ timestamp: string;
11
+ compiler: {
12
+ name: string;
13
+ version: string;
14
+ typescriptVersion: string;
15
+ };
16
+ typeLibrary: Record<string, never>;
17
+ }
18
+ interface JsonDocsComponent {
19
+ filePath?: string;
20
+ encapsulation: "none" | "scoped" | "shadow";
21
+ tag: string;
22
+ readme: string;
23
+ docs: string;
24
+ docsTags: ApiDocsTag[];
25
+ overview?: string;
26
+ usage: Record<string, string>;
27
+ props: JsonDocsProp[];
28
+ methods: JsonDocsMethod[];
29
+ events: JsonDocsEvent[];
30
+ listeners: never[];
31
+ styles: {
32
+ name: string;
33
+ docs: string;
34
+ annotation: string;
35
+ mode: string | undefined;
36
+ }[];
37
+ slots: {
38
+ name: string;
39
+ docs: string;
40
+ }[];
41
+ parts: {
42
+ name: string;
43
+ docs: string;
44
+ }[];
45
+ dependents: string[];
46
+ dependencies: string[];
47
+ dependencyGraph: Record<string, never>;
48
+ deprecation?: string;
49
+ }
50
+ interface JsonDocsEvent {
51
+ event: string;
52
+ bubbles: boolean;
53
+ cancelable: boolean;
54
+ composed: boolean;
55
+ complexType: ComplexType;
56
+ docs: string;
57
+ docsTags: ApiDocsTag[];
58
+ deprecation?: string;
59
+ detail: string;
60
+ }
61
+ interface ComponentCompilerMethodComplexType {
62
+ signature: string;
63
+ parameters: {
64
+ name: string;
65
+ type: string;
66
+ docs: string;
67
+ }[];
68
+ references: ComponentCompilerTypeReferences;
69
+ return: string;
70
+ }
71
+ interface JsonDocsMethod {
72
+ name: string;
73
+ docs: string;
74
+ docsTags: ApiDocsTag[];
75
+ deprecation?: string;
76
+ signature: string;
77
+ returns: {
78
+ type: string;
79
+ docs: string;
80
+ };
81
+ parameters: ComponentCompilerMethodComplexType["parameters"];
82
+ complexType: ComponentCompilerMethodComplexType;
83
+ }
84
+ interface ComplexType {
85
+ original: string;
86
+ resolved: string;
87
+ references: ComponentCompilerTypeReferences;
88
+ }
89
+ export interface JsonDocsProp {
90
+ name: string;
91
+ complexType?: ComplexType;
92
+ type: string;
93
+ mutable: boolean;
94
+ attr?: string;
95
+ reflectToAttr: boolean;
96
+ docs: string;
97
+ docsTags: ApiDocsTag[];
98
+ default?: string;
99
+ deprecation?: string;
100
+ values: {
101
+ value?: string;
102
+ type: string;
103
+ }[];
104
+ optional: boolean;
105
+ required: boolean;
106
+ }
107
+ /**
108
+ * Create a stencil-compatible docs.json file describing the library components.
109
+ *
110
+ * While custom-elements-manifest is the most popular community standard and is
111
+ * natively supported by Storybook and other tools, Esri has several internal
112
+ * tools that expect the Stencil-style docs.json.
113
+ * Since they are similar in content, generating a Stencil-compatible docs.json
114
+ * will smooth the migration path.
115
+ *
116
+ * REFACTOR: drop support for stencil compatible docs.json at some point
117
+ *
118
+ * @remarks
119
+ * To make it easier for people to diff the docs.json before and after migration
120
+ * to Lit, we make sure that the order of properties matches what Stencil
121
+ * generates:
122
+ * https://github.com/ionic-team/stencil/blob/9f5f9cdd023b8c8dfb5417a1a970605ba724ae28/src/compiler/docs/generate-doc-data.ts#L98
123
+ */
124
+ export declare const generateStencilDocsJson: (context: CompilerContext) => JsonDocs;
125
+ export {};
@@ -0,0 +1 @@
1
+ export type DocsType = "apiJson" | "stencilLikeDocsJson" | "vsCodeCss" | "vsCodeHtml" | "webTypes";
@@ -1,5 +1,5 @@
1
- import type { VsCodeHtmlDocs, VsCodeCssDocs, VsCodeDocOptions } from "./types.js";
2
- import type { ComponentManifest } from "../utils.js";
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: ComponentManifest[], options: VsCodeDocOptions) => VsCodeHtmlDocs;
16
- export declare const generateVsCodeCssCustomData: (components: ComponentManifest[]) => VsCodeCssDocs;
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 | null;
3
+ htmlFileName?: string;
4
4
  /** @default "docs/vscode.css-custom-data.json" */
5
- cssFileName?: string | null;
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,3 @@
1
+ import type { VsCodeTag } from "./types";
2
+ import { type ApiCustomElementDeclaration } from "@arcgis/api-extractor";
3
+ export declare const getTagList: (components: ApiCustomElementDeclaration[]) => VsCodeTag[];
@@ -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: ComponentManifest[], options: WebTypesOptions): WebTypes;
20
- export declare const getTagList: (components: ComponentManifest[], options: WebTypesOptions) => WebTypesElement[];
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";
@@ -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, "componentPathMapping" | "dir">, cwd: string, originalCwd: string) => string;
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(component: ComponentManifest, context: CompilerContext): string;
24
- export declare function renameComponentFolder(filePath: string, pathBase: string, context: Pick<CompilerContext, "componentPathMapping">): string;
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 {};