import { PackageJson } from '@arcgis/components-build-utils'; import { WebTypes } from '../docs/webTypes/types.ts'; import { ApiJson } from '@arcgis/api-extractor/apiJson'; import { LuminaOptions } from '../publicTypes.ts'; export type ResolvedDependencyComponents = { readonly packageName: string; readonly type: "@arcgis/lumina" | "stencil" | "unknown"; readonly components: Readonly>; readonly cdnUrl?: string; readonly packageLocation: string; readonly packageJson: PackageJson; }; export type ResolvedDependencyComponent = { modulePath: string; packageName: string | undefined; /** * If jsx property has a static value, and we see that an equivalent attribute * exists, jsx property will be converted to an attribute rather than * property. If we failed to read all attributes from a package, it's not a * big deal as we will then play safe and leave jsx properties as properties. */ readonly propToAttribute: Readonly>; requiredProperties?: Set; }; /** * Read information about our web component dependencies. This will be used to: * - know where to auto-import a component from * - detect usages of unknown components * - convert properties to attributes (JSX is authored using property names, not * attribute names, but if property is assigned a static value, setting it as * an attribute is better for performance) * - I was hoping lit-html would allow this syntax to set a property: * .property="staticValue", but no, static values are only allowed for * attributes. For static parts of the template, Lit would just copy them * from the compiled template without any processing, keeping initial render * and re-render fast. * - Benchmark: setting static attributes: 3.7s (dev), 3.2s (production) * setting properties that don't change: 5.1s (dev) and 3.3s (production) * - negligible difference in production * - Seeing the attribute in HTML would make for easier debugging * * Process: * - For each peer and dev dependency: * - If it has custom-elements-manifest, read from there (Lumina libraries * and popular community libraries) * - Else if has web-types.json, read from there (Vaadin and others) * - Else, if it has dist/esm/loader.js (Stencil), read from there * - Else, if has dist/components/*.d.ts, read from there (Stencil in dev * mode and many non-Stencil libraries) * * If this does not work for one of your dependencies, provide a custom resolver * to autoAddImports() or useLumina(). */ export declare function initializeComponentDependencies(cwd?: string, options?: LuminaOptions): Promise; export declare function retrieveComponentDependencies(): readonly ResolvedDependencyComponents[]; export declare function retrieveFlatComponentDependencies(): ResolvedDependencyComponents["components"]; export declare let componentDependenciesPromise: Promise | undefined; export declare function findPackageComponents(packageName: string, cwd?: string): Promise; /** * Given the custom element manifest, find custom elements defined in it */ export declare function manifestToDependencyComponents(manifest: Partial, dependency: { readonly packageName: string | undefined; readonly getImportPath: (tagName: string) => string; }, computeRequiredProperties?: boolean): ResolvedDependencyComponents["components"]; export declare const webTypesToDependencyComponents: (webTypes: Partial, dependency: { readonly packageName: string; readonly getImportPath: (tagName: string) => string; }) => ResolvedDependencyComponents["components"]; export declare const inferDependencyComponentModuleName: (usesExports: boolean, tagName: string) => string;