Files
OpenMaopaoya/frontend-uni/node_modules/@dcloudio/uni-cli-shared/dist/uasm.d.ts
T

83 lines
3.6 KiB
TypeScript

import type { DiagnosticWithLocation, SourceFile, TransformationContext, TransformerFactory } from 'typescript';
import type { Plugin } from 'vite';
type TypeScriptCompiler = typeof import('typescript');
export interface UasmSourceEdit {
start: number;
end: number;
content: string;
}
export interface LoadUasmTransformOptions {
targetArchs?: string[];
resolve(modulePath: string): ResolvedUasmLoad | undefined;
}
export interface LoadUasmTransformerOptions extends LoadUasmTransformOptions {
typescript: TypeScriptCompiler;
methodNames?: readonly string[];
resolveLoader?: (modulePath: string) => ResolvedUasmLoader | undefined;
resolveType?: (modulePath: string) => UasmTypeDescriptor | undefined;
onSourceEdit?: (edit: UasmSourceEdit) => void;
resolveError?: (modulePath: string) => string;
reportDiagnostic(context: TransformationContext, diagnostic: DiagnosticWithLocation): void;
}
export interface UasmTransformOptions extends LoadUasmTransformOptions {
createLoadUasmTransformer: typeof createLoadUasmTransformer;
}
export type UasmTransformerFactoryCreator = (typescript: TypeScriptCompiler) => {
before: TransformerFactory<SourceFile>;
};
export type UasmPlatform = 'app-android' | 'app-ios' | 'app-harmony';
export interface UasmArchResources {
dir: string;
file: string;
}
export interface UasmPlatformResources {
dir: string;
archs: Record<string, UasmArchResources>;
}
export interface UasmModule {
name: string;
platforms: Partial<Record<UasmPlatform, UasmPlatformResources>>;
web?: UasmWebResources;
}
export interface UasmWebResources {
entry: string;
}
export interface UasmWebLoadDescriptor {
id: string;
entry: string;
import?: 'static';
}
export type ResolvedUasmLoad = string | UasmWebLoadDescriptor;
export interface UasmLoaderDescriptor {
type: string;
value: string;
imports?: string[];
}
export interface UasmTypeDescriptor {
name: string;
source: string;
}
export type ResolvedUasmLoader = string | UasmLoaderDescriptor;
export interface ResolvedUasmModule {
name: string;
platform: UasmPlatform;
arch?: string;
dir: string;
file?: string;
}
export declare function parseUniAppXTargetArchs(value?: string | undefined): string[];
export declare function initUasmTransformOptions(platform: UasmPlatform): UasmTransformOptions;
export declare function initUasmTransformerCreator(platform: UasmPlatform): UasmTransformerFactoryCreator | undefined;
export declare function initUasmWebTransformOptions(): UasmTransformOptions;
export declare function createLoadUasmTransformer(options: LoadUasmTransformerOptions): TransformerFactory<SourceFile>;
export declare function initUasmModules(inputDir: string): Record<string, UasmModule>;
export declare function uniUasmPlugin(inputDir?: string): Plugin;
export declare function getUasmModules(): Record<string, UasmModule>;
export declare function resolveUasmTargetArch(moduleName: string, platform: UasmPlatform, targetArchs?: string[]): string | undefined;
export declare function resolveUasmModule(moduleName: string, platform: UasmPlatform, targetArchs?: string[]): ResolvedUasmModule | undefined;
export declare function parseUasmModuleName(modulePath: string): string | undefined;
export declare function resolveUasmWebLoad(modulePath: string): UasmWebLoadDescriptor | undefined;
export declare function resolveUasmLoadPath(modulePath: string, platform: UasmPlatform, isProduction?: boolean, targetArchs?: string[]): string | undefined;
export declare function resolveUasmCopyAssets(platform: UasmPlatform, isProduction: boolean, targetArchs?: string[]): string[];
export {};