You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

declarations.d.ts 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. declare module "*.json";
  2. // Deprecated NodeJS API usages in Webpack
  3. declare namespace NodeJS {
  4. interface Process {
  5. binding(internalModule: string): any;
  6. }
  7. }
  8. declare module "neo-async" {
  9. export interface Dictionary<T> {
  10. [key: string]: T;
  11. }
  12. export type IterableCollection<T> = T[] | IterableIterator<T> | Dictionary<T>;
  13. export interface ErrorCallback<T> {
  14. (err?: T): void;
  15. }
  16. export interface AsyncBooleanResultCallback<E> {
  17. (err?: E, truthValue?: boolean): void;
  18. }
  19. export interface AsyncResultCallback<T, E> {
  20. (err?: E, result?: T): void;
  21. }
  22. export interface AsyncResultArrayCallback<T, E> {
  23. (err?: E, results?: Array<T | undefined>): void;
  24. }
  25. export interface AsyncResultObjectCallback<T, E> {
  26. (err: E | undefined, results: Dictionary<T | undefined>): void;
  27. }
  28. export interface AsyncFunction<T, E> {
  29. (callback: (err?: E, result?: T) => void): void;
  30. }
  31. export interface AsyncFunctionEx<T, E> {
  32. (callback: (err?: E, ...results: T[]) => void): void;
  33. }
  34. export interface AsyncIterator<T, E> {
  35. (item: T, callback: ErrorCallback<E>): void;
  36. }
  37. export interface AsyncForEachOfIterator<T, E> {
  38. (item: T, key: number | string, callback: ErrorCallback<E>): void;
  39. }
  40. export interface AsyncResultIterator<T, R, E> {
  41. (item: T, callback: AsyncResultCallback<R, E>): void;
  42. }
  43. export interface AsyncMemoIterator<T, R, E> {
  44. (memo: R | undefined, item: T, callback: AsyncResultCallback<R, E>): void;
  45. }
  46. export interface AsyncBooleanIterator<T, E> {
  47. (item: T, callback: AsyncBooleanResultCallback<E>): void;
  48. }
  49. export interface AsyncWorker<T, E> {
  50. (task: T, callback: ErrorCallback<E>): void;
  51. }
  52. export interface AsyncVoidFunction<E> {
  53. (callback: ErrorCallback<E>): void;
  54. }
  55. export type AsyncAutoTasks<R extends Dictionary<any>, E> = {
  56. [K in keyof R]: AsyncAutoTask<R[K], R, E>;
  57. };
  58. export type AsyncAutoTask<R1, R extends Dictionary<any>, E> =
  59. | AsyncAutoTaskFunctionWithoutDependencies<R1, E>
  60. | (keyof R | AsyncAutoTaskFunction<R1, R, E>)[];
  61. export interface AsyncAutoTaskFunctionWithoutDependencies<R1, E> {
  62. (cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void;
  63. }
  64. export interface AsyncAutoTaskFunction<R1, R extends Dictionary<any>, E> {
  65. (results: R, cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void;
  66. }
  67. export function each<T, E>(
  68. arr: IterableCollection<T>,
  69. iterator: AsyncIterator<T, E>,
  70. callback?: ErrorCallback<E>
  71. ): void;
  72. export function eachLimit<T, E>(
  73. arr: IterableCollection<T>,
  74. limit: number,
  75. iterator: AsyncIterator<T, E>,
  76. callback?: ErrorCallback<E>
  77. ): void;
  78. export function map<T, R, E>(
  79. arr: T[] | IterableIterator<T>,
  80. iterator: AsyncResultIterator<T, R, E>,
  81. callback?: AsyncResultArrayCallback<R, E>
  82. ): void;
  83. export function map<T, R, E>(
  84. arr: Dictionary<T>,
  85. iterator: AsyncResultIterator<T, R, E>,
  86. callback?: AsyncResultArrayCallback<R, E>
  87. ): void;
  88. export function parallel<T, E>(
  89. tasks: Array<AsyncFunction<T, E>>,
  90. callback?: AsyncResultArrayCallback<T, E>
  91. ): void;
  92. export function parallel<T, E>(
  93. tasks: Dictionary<AsyncFunction<T, E>>,
  94. callback?: AsyncResultObjectCallback<T, E>
  95. ): void;
  96. export const forEach: typeof each;
  97. export const forEachLimit: typeof eachLimit;
  98. }
  99. // There are no typings for @webassemblyjs/ast
  100. declare module "@webassemblyjs/ast" {
  101. export function traverse(
  102. ast: any,
  103. visitor: {
  104. ModuleImport?: (p: NodePath<ModuleImport>) => void;
  105. ModuleExport?: (p: NodePath<ModuleExport>) => void;
  106. Start?: (p: NodePath<Start>) => void;
  107. Global?: (p: NodePath<Global>) => void;
  108. }
  109. ): void;
  110. export class NodePath<T> {
  111. node: T;
  112. }
  113. export class Node {}
  114. export class Identifier extends Node {
  115. value: string;
  116. }
  117. export class Start extends Node {
  118. index: Identifier;
  119. }
  120. export class ModuleImportDescription {
  121. type: string;
  122. valtype?: string;
  123. id?: Identifier;
  124. signature?: Signature;
  125. }
  126. export class ModuleImport extends Node {
  127. module: string;
  128. descr: ModuleImportDescription;
  129. name: string;
  130. }
  131. export class ModuleExport extends Node {
  132. name: string;
  133. descr: ModuleExportDescr;
  134. }
  135. type Index = Identifier | NumberLiteral;
  136. export class ModuleExportDescr extends Node {
  137. type: string;
  138. exportType: string;
  139. id: Index;
  140. }
  141. export class NumberLiteral extends Node {
  142. value: number;
  143. raw: string;
  144. }
  145. export class FloatLiteral extends Node {}
  146. export class GlobalType extends Node {
  147. valtype: string;
  148. }
  149. export class Global extends Node {
  150. init: Instruction[];
  151. globalType: GlobalType;
  152. }
  153. export class FuncParam extends Node {
  154. valtype: string;
  155. }
  156. export class Instruction extends Node {
  157. id: string;
  158. args: NumberLiteral[];
  159. }
  160. export class CallInstruction extends Instruction {}
  161. export class ObjectInstruction extends Instruction {}
  162. export class Func extends Node {
  163. signature: Signature;
  164. }
  165. export class Signature {
  166. type: "Signature";
  167. params: FuncParam[];
  168. results: string[];
  169. }
  170. export class TypeInstruction extends Node {}
  171. export class IndexInFuncSection extends Node {}
  172. export function indexLiteral(index: number): Index;
  173. export function numberLiteralFromRaw(num: number): NumberLiteral;
  174. export function floatLiteral(
  175. value: number,
  176. nan?: boolean,
  177. inf?: boolean,
  178. raw?: string
  179. ): FloatLiteral;
  180. export function global(globalType: string, nodes: Node[]): Global;
  181. export function identifier(indentifier: string): Identifier;
  182. export function funcParam(valType: string, id: Identifier): FuncParam;
  183. export function instruction(inst: string, args?: Node[]): Instruction;
  184. export function callInstruction(funcIndex: Index): CallInstruction;
  185. export function objectInstruction(
  186. kind: string,
  187. type: string,
  188. init: Node[]
  189. ): ObjectInstruction;
  190. export function signature(params: FuncParam[], results: string[]): Signature;
  191. export function func(initFuncId, signature: Signature, funcBody): Func;
  192. export function typeInstruction(
  193. id: Identifier,
  194. functype: Signature
  195. ): TypeInstruction;
  196. export function indexInFuncSection(index: Index): IndexInFuncSection;
  197. export function moduleExport(
  198. identifier: string,
  199. descr: ModuleExportDescr
  200. ): ModuleExport;
  201. export function moduleExportDescr(
  202. type: string,
  203. index: Index
  204. ): ModuleExportDescr;
  205. export function getSectionMetadata(ast: any, section: string);
  206. export class FuncSignature {
  207. args: string[];
  208. result: string[];
  209. }
  210. // Node matcher
  211. export function isGlobalType(n: Node): boolean;
  212. export function isTable(n: Node): boolean;
  213. export function isMemory(n: Node): boolean;
  214. export function isFuncImportDescr(n: Node): boolean;
  215. }
  216. // This "hack" is needed because typescript doesn't support recursive type definitions
  217. // It's referenced from "ruleSet-conditions" in schemas/WebpackOptions.json
  218. interface RuleSetConditionsRecursive
  219. extends Array<import("./declarations/WebpackOptions").RuleSetCondition> {}
  220. interface RuleSetConditionsAbsoluteRecursive
  221. extends Array<
  222. import("./declarations/WebpackOptions").RuleSetConditionAbsolute
  223. > {}
  224. /**
  225. * Global variable declarations
  226. * @todo Once this issue is resolved, remove these globals and add JSDoc onsite instead
  227. * https://github.com/Microsoft/TypeScript/issues/15626
  228. */
  229. declare const $hash$;
  230. declare const $requestTimeout$;
  231. declare const installedModules;
  232. declare const $require$;
  233. declare const hotDownloadManifest;
  234. declare const hotDownloadUpdateChunk;
  235. declare const hotDisposeChunk;
  236. declare const modules;
  237. declare const installedChunks;
  238. declare const hotAddUpdateChunk;
  239. declare const parentHotUpdateCallback;
  240. declare const $hotChunkFilename$;
  241. declare const $hotMainFilename$;
  242. declare namespace WebAssembly {}
  243. declare const importScripts;
  244. declare const $crossOriginLoading$;
  245. declare const chunkId;
  246. type TODO = any;