Skip to content

@arcmantle/lit-jsx / compiler/import-discovery

compiler/import-discovery

Classes

ImportDiscovery

Defined in: compiler/import-discovery.ts:10

Constructors

Constructor

new ImportDiscovery(): ImportDiscovery

Returns

ImportDiscovery

Properties

programCache

readonly static programCache: Map<string, NodePath<Program>>

Defined in: compiler/import-discovery.ts:12

resolvedCache

readonly static resolvedCache: Map<string, Map<string, boolean>>

Defined in: compiler/import-discovery.ts:13

Methods

followExportChain()

protected followExportChain(programPath, importedName): { binding: Binding; programPath: NodePath<Program>; } | undefined

Defined in: compiler/import-discovery.ts:249

Parameters
programPath

NodePath<Program>

importedName

string

Returns

{ binding: Binding; programPath: NodePath<Program>; } | undefined

getProgramPathFromFile()

protected getProgramPathFromFile(filePath): NodePath<Program> | undefined

Defined in: compiler/import-discovery.ts:336

Parameters
filePath

string

Returns

NodePath<Program> | undefined

isClass()

protected isClass(programPath, binding): boolean

Defined in: compiler/import-discovery.ts:88

Recursively follows a binding to determine if it resolves to a class (not a string literal).

Parameters
programPath

NodePath<Program>

binding

Binding

Returns

boolean

isClassByImportDiscovery()

isClassByImportDiscovery(path): boolean

Defined in: compiler/import-discovery.ts:64

Checks if a JSX element is specifically a class (not a string literal). Returns true only for class declarations/expressions, false otherwise. Used to determine if .tagName accessor should be used.

Parameters
path

NodePath

Returns

boolean

isClassOrStringLiteral()

protected isClassOrStringLiteral(programPath, binding): boolean

Defined in: compiler/import-discovery.ts:164

Recursively follows a binding to determine if it resolves to a class or string literal.

Parameters
programPath

NodePath<Program>

binding

Binding

Returns

boolean

isDynamicOrCustomELement()

isDynamicOrCustomELement(path): boolean

Defined in: compiler/import-discovery.ts:24

Checks if a JSX element is a class (custom element) or string literal (static element). Returns true if it's a custom element (class) or static element (string literal).

Parameters
path

NodePath

Returns

boolean

resolveSourcePath()

protected resolveSourcePath(programPath, source): string

Defined in: compiler/import-discovery.ts:350

Parameters
programPath

NodePath<Program>

source

string

Returns

string

clearCacheForFile()

static clearCacheForFile(filePath): void

Defined in: compiler/import-discovery.ts:15

Parameters
filePath

string

Returns

void

Functions

isClassByImportDiscovery()

isClassByImportDiscovery(...args): boolean

Defined in: compiler/import-discovery.ts:372

Parameters

args

...[NodePath<Node>]

Returns

boolean


isDynamicOrCustomElement()

isDynamicOrCustomElement(...args): boolean

Defined in: compiler/import-discovery.ts:364

Parameters

args

...[NodePath<Node>]

Returns

boolean

Released under the Apache-2.0 License.