版博士V2.0程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. interface ResolveOptions {
  2. url?: string | URL | (string | URL)[];
  3. extensions?: string[];
  4. conditions?: string[];
  5. }
  6. /**
  7. * @deprecated please use `resolve` instead of `resolveSync`
  8. */
  9. declare function resolveSync(id: string, options?: ResolveOptions): string;
  10. declare function resolve(id: string, options?: ResolveOptions): Promise<string>;
  11. /**
  12. * @deprecated please use `resolvePath` instead of `resolvePathSync`
  13. */
  14. declare function resolvePathSync(id: string, options?: ResolveOptions): string;
  15. declare function resolvePath(id: string, options?: ResolveOptions): Promise<any>;
  16. declare function createResolve(defaults?: ResolveOptions): (id: string, url?: ResolveOptions["url"]) => Promise<string>;
  17. interface ESMImport {
  18. type: "static" | "dynamic";
  19. code: string;
  20. start: number;
  21. end: number;
  22. }
  23. interface StaticImport extends ESMImport {
  24. type: "static";
  25. imports: string;
  26. specifier: string;
  27. }
  28. interface ParsedStaticImport extends StaticImport {
  29. defaultImport?: string;
  30. namespacedImport?: string;
  31. namedImports?: {
  32. [name: string]: string;
  33. };
  34. }
  35. interface DynamicImport extends ESMImport {
  36. type: "dynamic";
  37. expression: string;
  38. }
  39. interface ESMExport {
  40. _type?: "declaration" | "named" | "default" | "star";
  41. type: "declaration" | "named" | "default" | "star";
  42. code: string;
  43. start: number;
  44. end: number;
  45. name?: string;
  46. names: string[];
  47. specifier?: string;
  48. }
  49. interface DeclarationExport extends ESMExport {
  50. type: "declaration";
  51. declaration: string;
  52. name: string;
  53. }
  54. interface NamedExport extends ESMExport {
  55. type: "named";
  56. exports: string;
  57. names: string[];
  58. specifier?: string;
  59. }
  60. interface DefaultExport extends ESMExport {
  61. type: "default";
  62. }
  63. declare const ESM_STATIC_IMPORT_RE: RegExp;
  64. declare const DYNAMIC_IMPORT_RE: RegExp;
  65. declare const EXPORT_DECAL_RE: RegExp;
  66. declare const EXPORT_DECAL_TYPE_RE: RegExp;
  67. declare function findStaticImports(code: string): StaticImport[];
  68. declare function findDynamicImports(code: string): DynamicImport[];
  69. declare function parseStaticImport(matched: StaticImport): ParsedStaticImport;
  70. declare function findExports(code: string): ESMExport[];
  71. declare function findTypeExports(code: string): ESMExport[];
  72. declare function findExportNames(code: string): string[];
  73. declare function resolveModuleExportNames(id: string, options?: ResolveOptions): Promise<string[]>;
  74. interface CommonjsContext {
  75. __filename: string;
  76. __dirname: string;
  77. require: NodeRequire;
  78. }
  79. declare function createCommonJS(url: string): CommonjsContext;
  80. declare function interopDefault(sourceModule: any): any;
  81. interface EvaluateOptions extends ResolveOptions {
  82. url?: string;
  83. }
  84. declare function loadModule(id: string, options?: EvaluateOptions): Promise<any>;
  85. declare function evalModule(code: string, options?: EvaluateOptions): Promise<any>;
  86. declare function transformModule(code: string, options?: EvaluateOptions): Promise<string>;
  87. declare function resolveImports(code: string, options?: EvaluateOptions): Promise<string>;
  88. declare function hasESMSyntax(code: string): boolean;
  89. declare function hasCJSSyntax(code: string): boolean;
  90. declare function detectSyntax(code: string): {
  91. hasESM: boolean;
  92. hasCJS: boolean;
  93. isMixed: boolean;
  94. };
  95. interface ValidNodeImportOptions extends ResolveOptions {
  96. /**
  97. * The contents of the import, which may be analyzed to see if it contains
  98. * CJS or ESM syntax as a last step in checking whether it is a valid import.
  99. */
  100. code?: string;
  101. /**
  102. * Protocols that are allowed as valid node imports.
  103. *
  104. * Default: ['node', 'file', 'data']
  105. */
  106. allowedProtocols?: Array<string>;
  107. }
  108. declare function isValidNodeImport(id: string, _options?: ValidNodeImportOptions): Promise<boolean>;
  109. declare function fileURLToPath(id: string): string;
  110. declare function sanitizeURIComponent(name?: string, replacement?: string): string;
  111. declare function sanitizeFilePath(filePath?: string): string;
  112. declare function normalizeid(id: string): string;
  113. declare function loadURL(url: string): Promise<string>;
  114. declare function toDataURL(code: string): string;
  115. declare function isNodeBuiltin(id?: string): boolean;
  116. declare function getProtocol(id: string): string | undefined;
  117. export { CommonjsContext, DYNAMIC_IMPORT_RE, DeclarationExport, DefaultExport, DynamicImport, ESMExport, ESMImport, ESM_STATIC_IMPORT_RE, EXPORT_DECAL_RE, EXPORT_DECAL_TYPE_RE, EvaluateOptions, NamedExport, ParsedStaticImport, ResolveOptions, StaticImport, ValidNodeImportOptions, createCommonJS, createResolve, detectSyntax, evalModule, fileURLToPath, findDynamicImports, findExportNames, findExports, findStaticImports, findTypeExports, getProtocol, hasCJSSyntax, hasESMSyntax, interopDefault, isNodeBuiltin, isValidNodeImport, loadModule, loadURL, normalizeid, parseStaticImport, resolve, resolveImports, resolveModuleExportNames, resolvePath, resolvePathSync, resolveSync, sanitizeFilePath, sanitizeURIComponent, toDataURL, transformModule };