import type { PackageJson } from "@arcgis/node-toolkit/packageJson"; import type { LuminaOptions } from "../options.js"; /** @internal */ export interface ResolvedDependencyComponents { /** @internal */ readonly packageName: string; /** @internal */ readonly type: "@arcgis/lumina" | "stencil" | "unknown"; /** @internal */ readonly components: Readonly>; /** @internal */ readonly cdnUrl?: string; /** @internal */ readonly packageLocation: string; /** @internal */ readonly packageJson: PackageJson; } /** @internal */ export interface ResolvedDependencyComponent { /** @internal */ readonly modulePath: string; /** @internal */ readonly packageName?: string; /** * 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. * * @internal */ readonly propToAttribute: Readonly>; /** @internal */ requiredProperties?: ReadonlySet; } /** * 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(). * * @param cwd * @param options * @internal */ export function initializeComponentDependencies(cwd?: string, options?: LuminaOptions): Promise;