@arcgis/lumina-compiler 5.0.0-next.6 → 5.0.0-next.61

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.
@@ -1,6 +1,6 @@
1
1
  import { ConfigEnv, Plugin, ResolvedConfig, ViteDevServer } from 'vite';
2
2
  import { default as ts } from 'typescript';
3
- import { ApiCssCustomProperty, ApiCustomElementDeclaration, ApiJson } from '@arcgis/api-extractor';
3
+ import { ApiCssCustomProperty, ApiCustomElementDeclaration, ApiJson, unsafeGetUndocumentedPrinter } from '@arcgis/api-extractor';
4
4
  import { LuminaOptions, AssetSpec, AssetTransformer, DeclarationTextTransformer, ProvideAssetsOptions, LintingOptions } from '../publicTypes';
5
5
  import { ComponentPathMapping } from '../entrypoints/pathMapping';
6
6
  import { DocsType } from '../docs/types';
@@ -9,7 +9,6 @@ import { makeLoaders, computeServeOnlyDependencies } from '../dependencies/loade
9
9
  import { parseStoryFiles } from '../extractor/parseStoryFiles';
10
10
  import { CustomElementInterdependencies } from '../entrypoints/config';
11
11
  import { getCompilerOptionsForPrinter } from '../transformers';
12
- import { getPrinter } from '../transformers/internalTypeScriptApis';
13
12
  import { getLocalDefinedComponentsFromApiJson } from '../entrypoints/resolveTagName';
14
13
  import { Deferred } from '@arcgis/toolkit/promise';
15
14
  export declare class CompilerContext {
@@ -316,7 +315,7 @@ export declare class CompilerContext {
316
315
  *
317
316
  * @private
318
317
  */
319
- _typeScriptPrinter: ReturnType<typeof getPrinter>;
318
+ _typeScriptPrinter: ReturnType<typeof unsafeGetUndocumentedPrinter>;
320
319
  /**
321
320
  * Cached RegExp for replacing occurrences of `ArcgisCounter["el"]` with
322
321
  * `HtmlElementArcgisCounter`.
@@ -333,8 +332,6 @@ export declare class CompilerContext {
333
332
  * @private
334
333
  */
335
334
  _updateLuminaTsPromise?: Promise<void>;
336
- normalizedDocumentationUrl: string;
337
- alternativeDocumentationUrl: string;
338
335
  private _didCallOptions;
339
336
  /** @private */
340
337
  _originalRollupInputOptions?: Record<string, string> | undefined;
@@ -1,7 +1,8 @@
1
1
  import { ResolvedDependencyComponents } from './discover';
2
- import { VitestBrowserModeProvider } from '../testing/vitestTypes';
3
- export declare function updateLuminaTs(dependencies: readonly ResolvedDependencyComponents[], srcDir: string, hasCore: boolean, browserProvider?: VitestBrowserModeProvider, packageJson?: import('@arcgis/components-build-utils').MiniPackageJson): Promise<boolean>;
4
- declare function produceLuminaTs(dependencies: readonly ResolvedDependencyComponents[], hasCore: boolean, browserProvider?: VitestBrowserModeProvider, packageJson?: import('@arcgis/components-build-utils').MiniPackageJson): string;
2
+ export declare function updateLuminaTs(dependencies: readonly ResolvedDependencyComponents[], srcDir: string, hasCore: boolean,
3
+ /** Preserved positional argument for compatibility because codemod was passing it */
4
+ _unused?: never, packageJson?: import('@arcgis/components-build-utils').MiniPackageJson): Promise<boolean>;
5
+ declare function produceLuminaTs(dependencies: readonly ResolvedDependencyComponents[], hasCore: boolean, packageJson?: import('@arcgis/components-build-utils').MiniPackageJson): string;
5
6
  export declare const exportsForTests: {
6
7
  produceLuminaTs: typeof produceLuminaTs;
7
8
  };
@@ -16,4 +16,3 @@ export type CustomElementInterdependencies = Record<string, {
16
16
  referencedDeferredTagNames: string[];
17
17
  readonly referencedBy: string[];
18
18
  }>;
19
- export declare const defaultBrowserTestProvider = "playwright";
@@ -1,19 +1,22 @@
1
1
  import { default as ts } from 'typescript';
2
- import { ApiExtractor, ApiAttribute, ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiCustomElementMember, ApiDeclaration, ApiEvent, ApiExport, ApiJson, ApiModule, ApiReference, CopyDocDefinitions } from '@arcgis/api-extractor';
2
+ import { ApiExtractor, ApiAttribute, ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiCustomElementMember, ApiDeclaration, ApiEvent, ApiJson, ApiModule, ApiReference, CopyDocDefinitions } from '@arcgis/api-extractor';
3
3
  import { CompilerContext } from '../context';
4
4
  export declare class LuminaApiExtractor extends ApiExtractor {
5
5
  context: CompilerContext;
6
- protected isPathOnly: boolean;
7
- constructor(context: CompilerContext, isPathOnly: boolean);
6
+ protected isPatchOnly: boolean;
7
+ constructor(context: CompilerContext, isPatchOnly: boolean);
8
8
  protected localCssImports?: Set<string>;
9
- protected localDeclaredComponents: Map<string, string>;
10
- protected indexedComponents: Map<string, ApiCustomElementDeclaration>;
11
- protected apiComponent: ApiCustomElementDeclaration;
9
+ protected localTagName: string | undefined;
10
+ protected localClassName: string | undefined;
12
11
  protected pairedSetter: ts.SetAccessorDeclaration | undefined;
13
- protected copyDocDefinitions: CopyDocDefinitions | undefined;
12
+ protected copyDocDefinitions: CopyDocDefinitions;
13
+ apiComponent: ApiCustomElementDeclaration;
14
+ indexedComponents: Map<string, ApiCustomElementDeclaration>;
15
+ moduleName: string;
16
+ resolveJsDocLink: (completeMatch: string, match: string) => string;
14
17
  extract(files: readonly ts.SourceFile[]): ApiJson;
15
- protected extractModules(files: readonly ts.SourceFile[]): ApiModule[];
16
- protected extractDeclarations(module: ts.SourceFile): ApiDeclaration[];
18
+ extractModules(files: readonly ts.SourceFile[]): ApiModule[];
19
+ extractModule(module: ts.SourceFile): ApiModule;
17
20
  protected extractDeclaration(statement: ts.Statement): ApiDeclaration | undefined;
18
21
  protected collectCssImports(node: ts.ImportDeclaration): void;
19
22
  protected extractComponentDeclaration(node: ts.ClassDeclaration): ApiCustomElementDeclaration | undefined;
@@ -38,17 +41,23 @@ export declare class LuminaApiExtractor extends ApiExtractor {
38
41
  * Infer attributes based on public component members.
39
42
  */
40
43
  protected inferAttributes(members: ApiCustomElementMember[]): ApiAttribute[];
41
- protected inferExport(declaration: ApiDeclaration): ApiExport | undefined;
42
- protected inferCustomElementExport(declaration: ApiCustomElementDeclaration): ApiExport;
44
+ protected resolveInheritance(superClassModule: string, modules: ApiModule[]): false | {
45
+ inheritanceData: ApiReference;
46
+ declaration: import('@arcgis/api-extractor').ApiClassDeclaration | import('@arcgis/api-extractor').ApiMixinDeclaration;
47
+ hasSettableField: boolean;
48
+ indexedMembers: Map<string, import('@arcgis/api-extractor').ApiClassMember | ApiCustomElementMember | undefined> | undefined;
49
+ indexedEvents: Record<string, ApiEvent> | undefined;
50
+ indexedAttributes: Record<string, ApiAttribute> | undefined;
51
+ indexedSlots: Record<string, import('@arcgis/api-extractor').ApiSlot> | undefined;
52
+ indexedCssParts: Record<string, import('@arcgis/api-extractor').ApiCssPart> | undefined;
53
+ indexedCssProperties: Record<string, import('@arcgis/api-extractor').ApiCssCustomProperty> | undefined;
54
+ indexedCssStates: Record<string, import('@arcgis/api-extractor').ApiCssCustomState> | undefined;
55
+ };
43
56
  /**
44
- * Inherit public members from a superclass. For this to work, the superclass
45
- * needs to be in a a file named like a component
46
- * (src/components/name/name.tsx), even if it is not a standalone component.
57
+ * Overwrite point
58
+ *
59
+ * FINAL: jsapi-extractor has a more efficient implementation because it
60
+ * has to deal with inheritance a lot. Unify it with Lumina.
47
61
  */
48
- protected inheritMembers(component: ApiCustomElementDeclaration, modules: ApiModule[], superClass?: ApiReference, existingMembers?: Set<string>, existingAttributes?: Set<string>, existingEvents?: Set<string>): void;
49
- private _resolvedInheritance;
50
- /**
51
- * Based on the superclass name, find the actual declaration in the modules.
52
- */
53
- protected resolveInheritance(superClassName: string, modules: ApiModule[]): ApiCustomElementDeclaration | undefined;
62
+ protected findSuperclassDeclaration(className: string, modules: ApiModule[]): readonly [string, ApiCustomElementDeclaration] | false;
54
63
  }
@@ -1,4 +1,5 @@
1
1
  import { default as ts } from 'typescript';
2
2
  import { ApiClassMethod, ApiCustomElementDeclaration, ApiCustomElementField, ApiJson, ApiModule } from '@arcgis/api-extractor';
3
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;
4
+ export declare function findApiModule(filePath: string, extractRootDir: string, apiJson: ApiJson): ApiModule | undefined;
5
+ export declare function apiMethodReturnsPromise(apiMethod: ApiClassMethod): boolean;
@@ -1,7 +1,7 @@
1
1
  import { FileTransformer, DeclarationTextTransformer } from '../publicTypes';
2
2
  export declare const removeDeclarationFromDts: DeclarationTextTransformer;
3
3
  export declare const addCustomElementDecoratorTransformer: FileTransformer;
4
- export declare function findDeclaredComponents(code: string): readonly (readonly [string, string])[] | undefined;
4
+ export declare function findDeclaredComponent(code: string): readonly [tagName: string, className: string] | undefined;
5
5
  export declare const exportsForTests: {
6
- findDeclaredComponents: typeof findDeclaredComponents;
6
+ findDeclaredComponent: typeof findDeclaredComponent;
7
7
  };
@@ -6,4 +6,3 @@ import { CompilerContext } from '../../context';
6
6
  * Even name is derived by converting property name to kebab-case.
7
7
  */
8
8
  export declare function extractComponentEvent(propertyDeclaration: ts.PropertyDeclaration, name: string, context: CompilerContext, sourceFile: ts.SourceFile): ApiEvent | undefined;
9
- export declare function extractBooleanInitializer(initializer: ts.Expression, sourceFile: ts.SourceFile): boolean;
@@ -2,10 +2,3 @@ import { default as ts } from 'typescript';
2
2
  import { ContextDirectories } from '../../context/types';
3
3
  import { ApiClassMethod } from '@arcgis/api-extractor';
4
4
  export declare function extractComponentMethodDetails(node: ts.MethodDeclaration, method: ApiClassMethod, checker: ts.TypeChecker, sourceFile: ts.SourceFile, dirs: ContextDirectories): void;
5
- /**
6
- * Inspired by https://github.com/bennypowers/cem-plugins/blob/main/plugins/cem-plugin-async-function/index.js
7
- *
8
- * That package works, but uses outdated peerDependency and the author doesn't
9
- * wish to update it. Refactoring it, and adding TypeScript typings
10
- */
11
- export declare const isAsync: (nodeDeclaration: ts.MethodDeclaration) => boolean;
@@ -1,9 +1,4 @@
1
1
  import { default as ts } from 'typescript';
2
- import { ApiType, ApiTypeReference } from '@arcgis/api-extractor';
2
+ import { ApiType } from '@arcgis/api-extractor';
3
3
  import { CompilerContext } from '../../context';
4
4
  export declare const getComplexPropertyType: (context: CompilerContext, typeContainerNode: ts.AccessorDeclaration | ts.PropertyDeclaration, isRequired: boolean, sourceFile: ts.SourceFile) => ApiType;
5
- /**
6
- * Associate a start and end index with each type reference. Drop unresolved
7
- * references.
8
- */
9
- export declare function findReferenceRanges(references: ApiTypeReference[], resolvedString: string): ApiTypeReference[] | undefined;
@@ -1,5 +1,6 @@
1
1
  import { CompilerContext } from '../context';
2
2
  import { ApiCustomElementDeclaration, ApiJson } from '@arcgis/api-extractor';
3
+ import { LuminaApiExtractor } from './LuminaApiExtractor';
3
4
  /**
4
5
  * Build the complete api.json, either once during build, or in serve mode if
5
6
  * full-reload is needed.
@@ -9,4 +10,5 @@ export declare function buildApiJson(context: CompilerContext, reFetchComponentE
9
10
  * Update the api.json for a single file on hot reload
10
11
  */
11
12
  export declare function patchApiJson(context: CompilerContext, fileName: string, code: string): ApiCustomElementDeclaration[] | undefined;
12
- export declare function postProcessComponent(component: ApiCustomElementDeclaration, context: CompilerContext, indexedComponents: Map<string, ApiCustomElementDeclaration>): void;
13
+ export declare function postProcessComponent(component: ApiCustomElementDeclaration, extractor: LuminaApiExtractor): void;
14
+ export declare const jsDocLinkToMarkdown: (extractor: LuminaApiExtractor) => (completeMatch: string, match: string) => string;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { initializeComponentDependencies } from './dependencies/discover';
2
2
  import { updateLuminaTs } from './dependencies/updateLumina';
3
- import { findDeclaredComponents } from './extractor/declaration';
3
+ import { findDeclaredComponent } from './extractor/declaration';
4
4
  export { useLumina } from './useLumina';
5
5
  export type * from './publicTypes';
6
6
  export { inferCdnUrl } from './defaultAssetsUrl';
7
7
  export type { CompilerContext } from './context';
8
- export { LuminaApiExtractor } from './extractor/extractor';
8
+ export { LuminaApiExtractor } from './extractor/LuminaApiExtractor';
9
9
  /**
10
10
  * These are exposed only for usage by the @arcgis/stencil-to-lumina codemod
11
11
  *
@@ -18,7 +18,7 @@ export declare const exportsForCodemod: {
18
18
  readonly common: Required<import('./jsxToLitHtml/config').ElementPropertyToAttributeMappings>;
19
19
  readonly perElement: Record<string, import('./jsxToLitHtml/config').ElementPropertyToAttributeMappings | undefined>;
20
20
  };
21
- findDeclaredComponents: typeof findDeclaredComponents;
21
+ findDeclaredComponent: typeof findDeclaredComponent;
22
22
  nativeEvents: Set<string>;
23
23
  svgElements: Set<string>;
24
24
  mathMlElements: Set<string>;