utils.d.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import type { parse, bundle, UTSTarget } from '@dcloudio/uts';
  2. import { Module } from '../types/types';
  3. interface ToOptions {
  4. inputDir: string;
  5. outputDir: string;
  6. sourceMap: boolean;
  7. components: Record<string, string>;
  8. isX: boolean;
  9. isPlugin: boolean;
  10. extApis?: Record<string, [string, string]>;
  11. }
  12. export type ToKotlinOptions = ToOptions;
  13. export type ToSwiftOptions = ToOptions;
  14. export declare const ERR_MSG_PLACEHOLDER = "___ERR_MSG___";
  15. export declare function resolveUTSSourceMapPath(): string;
  16. export declare function getUTSCompiler(): {
  17. parse: typeof parse;
  18. bundle: typeof bundle;
  19. UTSTarget: typeof UTSTarget;
  20. };
  21. export declare function resolvePackage(filename: string): {
  22. id: string;
  23. name: string;
  24. namespace: string;
  25. is_uni_modules: boolean;
  26. extname: string;
  27. } | undefined;
  28. export interface UTSPlatformResourceOptions {
  29. inputDir: string;
  30. outputDir: string;
  31. platform: typeof process.env.UNI_UTS_PLATFORM;
  32. extname: '.kt' | '.swift';
  33. components: Record<string, string>;
  34. package: string;
  35. }
  36. export declare function genUTSPlatformResource(filename: string, options: UTSPlatformResourceOptions): void;
  37. export declare function moveRootIndexSourceMap(filename: string, { inputDir, platform, extname }: UTSPlatformResourceOptions): void;
  38. export declare function isRootIndex(filename: string, platform: typeof process.env.UNI_UTS_PLATFORM): boolean;
  39. export declare function resolveAndroidDir(filename: string): string;
  40. export declare function resolveIOSDir(filename: string): string;
  41. export declare function resolveUTSPlatformFile(filename: string, { inputDir, outputDir, platform, extname }: UTSPlatformResourceOptions): string;
  42. export declare function createResolveTypeReferenceName(namespace: string, ast: Module, interfaceTypes: string[]): (name: string) => string;
  43. export type CompilerServer = {};
  44. export declare function getCompilerServer<T extends CompilerServer>(pluginName: 'uts-development-ios' | 'uniapp-runextension'): T | undefined;
  45. export declare function resolveAndroidComponents(pluginDir: string, is_uni_modules: boolean): Record<string, string>;
  46. export declare function resolveIOSComponents(pluginDir: string, is_uni_modules: boolean): Record<string, string>;
  47. export declare function genComponentsCode(filename: string, components: Record<string, string>, isX: boolean): string;
  48. export declare function genConfigJson(platform: 'app-android' | 'app-ios', components: Record<string, string>, pluginRelativeDir: string, is_uni_modules: boolean, inputDir: string, outputDir: string): void;
  49. export declare function parseKotlinPackageWithPluginId(id: string, is_uni_modules: boolean): string;
  50. export declare function parseSwiftPackageWithPluginId(id: string, is_uni_modules: boolean): string;
  51. export declare function isColorSupported(): boolean;
  52. export declare function relative(filename: string, inputDir: string): string;
  53. export declare function resolveSourceMapFile(outputDir: string, kotlinFile: string): string;
  54. export {};