@esmx/core
Version:
A high-performance microfrontend framework supporting Vue, React, Preact, Solid, and Svelte with SSR and Module Federation capabilities.
29 lines (28 loc) • 1.29 kB
TypeScript
import type fs from 'node:fs';
import type { ImportMap, SpecifierMap } from '@esmx/import';
import type { ParsedModuleConfig } from '../module-config';
/**
* Get the list of statically imported module names from JS code. Maybe cannot handle multiple concurrent calls, not tested.
* @param code JS code
* @returns `Promise<string[]>` List of statically imported module names
*/
export declare function getImportsFromJsCode(code: string): Promise<string[]>;
/**
* Get the list of statically imported module names from a JS file.
* @param filepath JS file path
* @returns `Promise<string[]>` List of statically imported module names
*/
export declare function getImportsFromJsFile(filepath: fs.PathLike | fs.promises.FileHandle): Promise<string[]>;
export type ImportPreloadInfo = SpecifierMap;
/**
* Get import preload information.
* @param specifier Module name
* @param importMap Import map object
* @param moduleConfig Module configuration
* @returns
* - `Promise<{ [specifier: string]: ImportPreloadPathString }>` Mapping object of module names to file paths
* - `null` specifier does not exist
*/
export declare function getImportPreloadInfo(specifier: string, importMap: ImportMap, moduleConfig: ParsedModuleConfig): Promise<{
[k: string]: string;
} | null>;