@arcgis/lumina-compiler 4.32.0-next.13 → 4.32.0-next.131

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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Licensing
2
2
 
3
- COPYRIGHT © 2024 Esri
3
+ COPYRIGHT © 2025 Esri
4
4
 
5
5
  All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.
6
6
 
package/README.md CHANGED
@@ -8,7 +8,7 @@ It is not intended to be used directly, but rather used as a dependency by other
8
8
 
9
9
  ## License
10
10
 
11
- COPYRIGHT © 2024 Esri
11
+ COPYRIGHT © 2025 Esri
12
12
 
13
13
  All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.
14
14
 
@@ -1,7 +1,7 @@
1
1
  import type { ConfigEnv, Plugin, ResolvedConfig, ViteDevServer } from "vite";
2
2
  import ts from "typescript";
3
3
  import type { ApiCssCustomProperty, ApiCustomElementDeclaration, ApiJson } from "@arcgis/api-extractor";
4
- import type { LuminaOptions, AssetSpec, AssetTransformer, DeclarationTextTransformer, ProvideAssetsOptions } from "../publicTypes";
4
+ import type { LuminaOptions, AssetSpec, AssetTransformer, DeclarationTextTransformer, ProvideAssetsOptions, LintingOptions } from "../publicTypes";
5
5
  import type { ComponentPathMapping } from "../entrypoints/pathMapping";
6
6
  import type { DocsType } from "../docs/types";
7
7
  import type { ContextDirectories } from "./types";
@@ -64,14 +64,17 @@ export declare class CompilerContext {
64
64
  */
65
65
  shouldMinify: boolean;
66
66
  /**
67
- * Like this.shouldMinifyStrict, but true when in test mode. Reasons:
67
+ * Like this.shouldMinify, but true when in test mode. Reasons:
68
68
  * - If accessing .textContent, the whitespace amount differs between minified
69
69
  * and non-minified lit-html templates. In Stencil's JSX this was not the
70
70
  * case. To ease migration of tests, we minify lit-html in tests too.
71
71
  * - From the above, you can see that minification does change semantics in
72
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
73
76
  */
74
- shouldMinifyStrict: boolean;
77
+ shouldMinifyJsx: boolean;
75
78
  /**
76
79
  *
77
80
  * A vite plugin that sets the initial context information based on Vite
@@ -288,21 +291,21 @@ export declare class CompilerContext {
288
291
  /**
289
292
  * Result of getCompilerOptionsForPrinter() call.
290
293
  *
291
- * @internal
294
+ * @private
292
295
  */
293
296
  _compilerOptionsForPrinter: ReturnType<typeof getCompilerOptionsForPrinter>;
294
297
  /**
295
298
  * Cached result of getPrinter() call. Cached to not needlessly create and
296
299
  * throw away a printer instance for each transformed file.
297
300
  *
298
- * @internal
301
+ * @private
299
302
  */
300
303
  _typeScriptPrinter: ReturnType<typeof getPrinter>;
301
304
  /**
302
305
  * Cached RegExp for replacing occurrences of `ArcgisCounter["el"]` with
303
306
  * `HtmlElementArcgisCounter`.
304
307
  *
305
- * @internal
308
+ * @private
306
309
  */
307
310
  _htmlElementReferencesReplacer?: {
308
311
  regex: RegExp;
@@ -312,9 +315,15 @@ export declare class CompilerContext {
312
315
  * Mapping between component tag name and public properties in that component
313
316
  * whose type depends on another property.
314
317
  *
315
- * @internal
318
+ * @private
316
319
  */
317
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>;
318
327
  constructor(options: LuminaOptions);
319
328
  private _inferBuildSetup;
320
329
  /**
@@ -351,4 +360,5 @@ export declare class CompilerContext {
351
360
  * ```
352
361
  */
353
362
  provideAssets(assets: AssetSpec[], transformers?: AssetTransformer[], apply?: CompilerContext["viteCommand"]): void;
363
+ logLintError(rule: keyof LintingOptions["silence"], absoluteFilePath: string, error: string): void;
354
364
  }
@@ -16,4 +16,4 @@ export declare function loadTypeScriptConfig(context: CompilerContext): void;
16
16
  * string
17
17
  */
18
18
  export declare function resolveTargetVersion(typeScriptConfig: Pick<ts.CompilerOptions, "target">): string;
19
- export declare function loadTypeScript(context: CompilerContext): void;
19
+ export declare function loadTypeScript(context: CompilerContext, withSourceMap: boolean): void;
@@ -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;
@@ -1,5 +1,109 @@
1
- import type { JsonDocs } from "@stencil/core/internal";
1
+ import type { ComponentCompilerTypeReferences } from "@stencil/core/internal";
2
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
+ }
3
107
  /**
4
108
  * Create a stencil-compatible docs.json file describing the library components.
5
109
  *
@@ -9,6 +113,8 @@ import type { CompilerContext } from "../context";
9
113
  * Since they are similar in content, generating a Stencil-compatible docs.json
10
114
  * will smooth the migration path.
11
115
  *
116
+ * REFACTOR: drop support for stencil compatible docs.json at some point
117
+ *
12
118
  * @remarks
13
119
  * To make it easier for people to diff the docs.json before and after migration
14
120
  * to Lit, we make sure that the order of properties matches what Stencil
@@ -16,3 +122,4 @@ import type { CompilerContext } from "../context";
16
122
  * https://github.com/ionic-team/stencil/blob/9f5f9cdd023b8c8dfb5417a1a970605ba724ae28/src/compiler/docs/generate-doc-data.ts#L98
17
123
  */
18
124
  export declare const generateStencilDocsJson: (context: CompilerContext) => JsonDocs;
125
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -34,16 +34,11 @@
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 ts from "typescript";
38
37
  import type { FileTransformer } from "../publicTypes";
39
38
  import type { DeclarationTextTransformer } from "../publicTypes";
40
39
  export declare const removeDeclarationFromDts: DeclarationTextTransformer;
41
40
  export declare const addCustomElementDecoratorTransformer: FileTransformer;
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;
41
+ export declare function findDeclaredComponents(code: string): readonly (readonly [string, string])[] | undefined;
46
42
  export declare const exportsForTests: {
47
43
  findDeclaredComponents: typeof findDeclaredComponents;
48
44
  };
49
- export {};
@@ -1,6 +1,6 @@
1
1
  import ts from "typescript";
2
2
  import { ApiExtractor } from "@arcgis/api-extractor";
3
- import type { ApiAttribute, ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiCustomElementMember, ApiDeclaration, ApiEvent, ApiExport, ApiJson, ApiModule } from "@arcgis/api-extractor";
3
+ import type { ApiAttribute, ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiCustomElementMember, ApiDeclaration, ApiEvent, ApiExport, ApiJson, ApiModule, ApiReference } from "@arcgis/api-extractor";
4
4
  import type { CompilerContext } from "../context";
5
5
  export declare class LuminaApiExtractor extends ApiExtractor {
6
6
  context: CompilerContext;
@@ -44,7 +44,7 @@ export declare class LuminaApiExtractor extends ApiExtractor {
44
44
  * needs to be in a a file named like a component
45
45
  * (src/components/name/name.tsx), even if it is not a standalone component.
46
46
  */
47
- protected inheritMembers(component: ApiCustomElementDeclaration, modules: ApiModule[], existingMembers?: Set<string>, existingAttributes?: Set<string>, existingEvents?: Set<string>): void;
47
+ protected inheritMembers(component: ApiCustomElementDeclaration, modules: ApiModule[], superClass?: ApiReference, existingMembers?: Set<string>, existingAttributes?: Set<string>, existingEvents?: Set<string>): void;
48
48
  private _resolvedInheritance;
49
49
  /**
50
50
  * Based on the superclass name, find the actual declaration in the modules.
@@ -1,7 +1,8 @@
1
1
  import ts from "typescript";
2
2
  import type { ContextDirectories } from "../../context/types";
3
- import { type ApiReference } from "@arcgis/api-extractor";
3
+ import { type ApiType } from "@arcgis/api-extractor";
4
4
  export declare const addPropMetadataPluginName = "@arcgis/lumina:addPropMetadata";
5
+ export declare function resolveType(checker: ts.TypeChecker, type: ts.Type, sourceFile: ts.SourceFile, dirs: ContextDirectories, stripNullish?: boolean): ApiType;
5
6
  /**
6
7
  * Formats a TypeScript `TypeNode` entity as a string
7
8
  *
@@ -21,10 +22,6 @@ export declare const addPropMetadataPluginName = "@arcgis/lumina:addPropMetadata
21
22
  */
22
23
  export declare function typeNodeToString(typeNode: ts.TypeNode): string;
23
24
  export declare const typeFormatFlags: number;
24
- export declare function typeToResolvedTypeNodeWithReferences(checker: ts.TypeChecker, type: ts.Type, sourceFile: ts.SourceFile, dirs: ContextDirectories): {
25
- typeNode: ts.TypeNode;
26
- references: ApiReference[];
27
- };
28
25
  /**
29
26
  * Given an absolute path to a module, parse the package name and module name
30
27
  * in case of external module reference, or return relative path in case of
@@ -38,7 +38,7 @@ import ts from "typescript";
38
38
  * Based on Stencil's resolveType function:
39
39
  * https://github.com/ionic-team/stencil/blob/b40ebb937869aa16f9adc672129639167406cd07/src/compiler/transformers/transform-utils.ts#L616
40
40
  */
41
- export declare function typeNodeToTypeValues(typeNode: ts.TypeNode): ApiValue[];
41
+ export declare function typeNodeToTypeValues(typeNode: ts.TypeNode): ApiValue[] | undefined;
42
42
  export declare const hasLiteralTypeValue: (typeValues: ApiValue[] | undefined) => boolean;
43
43
  /**
44
44
  * If there is only a single type value, and it is of non-literal type, then
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { useLumina } from "./useLumina";
2
- export * from "./publicTypes";
2
+ export type * from "./publicTypes";
3
3
  export { inferCdnUrl } from "./defaultAssetsUrl";
4
4
  export type { CompilerContext } from "./context";
5
5
  export { LuminaApiExtractor } from "./extractor/extractor";