38 lines
1.9 KiB
TypeScript
38 lines
1.9 KiB
TypeScript
import MagicString from 'magic-string';
|
|
import type { Plugin } from 'vite';
|
|
import { type UasmTransformOptions, type UasmWebLoadDescriptor } from '../uasm';
|
|
import type { UniViteCopyPluginTarget } from '../vite/plugins/copy';
|
|
export type UasmMiniProgramPlatform = 'mp-weixin' | 'mp-alipay';
|
|
export interface MiniProgramUasmTransformOptions {
|
|
webAssemblyGlobal: string;
|
|
wasmFile: string;
|
|
generateMap?: boolean;
|
|
}
|
|
export interface MiniProgramUasmTransformResult {
|
|
code: string;
|
|
map?: ReturnType<MagicString['generateMap']>;
|
|
}
|
|
declare const MINI_PROGRAM_UASM_CONFIG: {
|
|
readonly 'mp-weixin': {
|
|
readonly webAssemblyGlobal: "WXWebAssembly";
|
|
readonly entryPath: "uasm/mp-weixin";
|
|
readonly transformPath: "uasm/mp-weixin";
|
|
readonly wasmPath: "uasm/mp-weixin";
|
|
readonly workerOutputPath: undefined;
|
|
};
|
|
readonly 'mp-alipay': {
|
|
readonly webAssemblyGlobal: "MYWebAssembly";
|
|
readonly entryPath: "uasm/mp-alipay";
|
|
readonly transformPath: "workers/mp-alipay";
|
|
readonly wasmPath: "uasm/mp-alipay";
|
|
readonly workerOutputPath: "workers/mp-alipay";
|
|
};
|
|
};
|
|
export declare function initUasmMiniProgramTransformOptions(platform: UasmMiniProgramPlatform, inputDir?: string): UasmTransformOptions;
|
|
export declare function resolveUasmMiniProgramLoad(modulePath: string, platform: UasmMiniProgramPlatform, inputDir?: string): UasmWebLoadDescriptor | undefined;
|
|
export declare function uniMiniProgramUasmPlugin(platform: UasmMiniProgramPlatform, inputDir?: string): Plugin;
|
|
export declare function resolveMiniProgramUasmWorkerPaths(platform: UasmMiniProgramPlatform, inputDir?: string): string[];
|
|
export declare function createMiniProgramUasmCopyTarget(platform: keyof typeof MINI_PROGRAM_UASM_CONFIG): UniViteCopyPluginTarget;
|
|
export declare function transformMiniProgramUasmJs(source: string, options: MiniProgramUasmTransformOptions): MiniProgramUasmTransformResult;
|
|
export {};
|