types.d.ts 24 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135
  1. /*
  2. * This file was automatically generated.
  3. * DO NOT MODIFY BY HAND.
  4. * Run `yarn special-lint-fix` to update
  5. */
  6. import { Buffer } from "buffer";
  7. import { AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } from "tapable";
  8. import { URL as URL_Import } from "url";
  9. declare interface Abortable {
  10. /**
  11. * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
  12. */
  13. signal?: AbortSignal;
  14. }
  15. type Alias = string | false | string[];
  16. declare interface AliasOption {
  17. alias: Alias;
  18. name: string;
  19. onlyModule?: boolean;
  20. }
  21. type AliasOptionNewRequest = string | false | string[];
  22. declare interface AliasOptions {
  23. [index: string]: AliasOptionNewRequest;
  24. }
  25. type BaseFileSystem = FileSystem & SyncFileSystem;
  26. declare interface BaseResolveRequest {
  27. path: string | false;
  28. context?: object;
  29. descriptionFilePath?: string;
  30. descriptionFileRoot?: string;
  31. descriptionFileData?: JsonObject;
  32. relativePath?: string;
  33. ignoreSymlinks?: boolean;
  34. fullySpecified?: boolean;
  35. __innerRequest?: string;
  36. __innerRequest_request?: string;
  37. __innerRequest_relativePath?: string;
  38. }
  39. type BufferEncoding =
  40. | "ascii"
  41. | "utf8"
  42. | "utf-8"
  43. | "utf16le"
  44. | "utf-16le"
  45. | "ucs2"
  46. | "ucs-2"
  47. | "base64"
  48. | "base64url"
  49. | "latin1"
  50. | "binary"
  51. | "hex";
  52. type BufferEncodingOption = "buffer" | { encoding: "buffer" };
  53. declare class CachedInputFileSystem {
  54. constructor(fileSystem: BaseFileSystem, duration: number);
  55. fileSystem: BaseFileSystem;
  56. lstat?: LStat;
  57. lstatSync?: LStatSync;
  58. stat: Stat;
  59. statSync: StatSync;
  60. readdir: Readdir;
  61. readdirSync: ReaddirSync;
  62. readFile: ReadFile;
  63. readFileSync: ReadFileSync;
  64. readJson?: (
  65. arg0: PathOrFileDescriptor,
  66. arg1: (
  67. arg0: null | Error | NodeJS.ErrnoException,
  68. arg1?: JsonObject
  69. ) => void
  70. ) => void;
  71. readJsonSync?: (arg0: PathOrFileDescriptor) => JsonObject;
  72. readlink: Readlink;
  73. readlinkSync: ReadlinkSync;
  74. realpath?: RealPath;
  75. realpathSync?: RealPathSync;
  76. purge(
  77. what?:
  78. | string
  79. | number
  80. | Buffer
  81. | URL_url
  82. | (string | number | Buffer | URL_url)[]
  83. | Set<string | number | Buffer | URL_url>
  84. ): void;
  85. }
  86. declare class CloneBasenamePlugin {
  87. constructor(
  88. source:
  89. | string
  90. | AsyncSeriesBailHook<
  91. [ResolveRequest, ResolveContext],
  92. null | ResolveRequest
  93. >,
  94. target:
  95. | string
  96. | AsyncSeriesBailHook<
  97. [ResolveRequest, ResolveContext],
  98. null | ResolveRequest
  99. >
  100. );
  101. source:
  102. | string
  103. | AsyncSeriesBailHook<
  104. [ResolveRequest, ResolveContext],
  105. null | ResolveRequest
  106. >;
  107. target:
  108. | string
  109. | AsyncSeriesBailHook<
  110. [ResolveRequest, ResolveContext],
  111. null | ResolveRequest
  112. >;
  113. apply(resolver: Resolver): void;
  114. }
  115. declare interface Dirent {
  116. isFile: () => boolean;
  117. isDirectory: () => boolean;
  118. isBlockDevice: () => boolean;
  119. isCharacterDevice: () => boolean;
  120. isSymbolicLink: () => boolean;
  121. isFIFO: () => boolean;
  122. isSocket: () => boolean;
  123. name: string;
  124. path: string;
  125. }
  126. type EncodingOption =
  127. | undefined
  128. | null
  129. | "ascii"
  130. | "utf8"
  131. | "utf-8"
  132. | "utf16le"
  133. | "utf-16le"
  134. | "ucs2"
  135. | "ucs-2"
  136. | "base64"
  137. | "base64url"
  138. | "latin1"
  139. | "binary"
  140. | "hex"
  141. | ObjectEncodingOptions;
  142. type ErrorWithDetail = Error & { details?: string };
  143. declare interface ExtensionAliasOption {
  144. alias: string | string[];
  145. extension: string;
  146. }
  147. declare interface ExtensionAliasOptions {
  148. [index: string]: string | string[];
  149. }
  150. declare interface FileSystem {
  151. readFile: ReadFile;
  152. readdir: Readdir;
  153. readJson?: (
  154. arg0: PathOrFileDescriptor,
  155. arg1: (
  156. arg0: null | Error | NodeJS.ErrnoException,
  157. arg1?: JsonObject
  158. ) => void
  159. ) => void;
  160. readlink: Readlink;
  161. lstat?: LStat;
  162. stat: Stat;
  163. realpath?: RealPath;
  164. }
  165. type IBigIntStats = IStatsBase<bigint> & {
  166. atimeNs: bigint;
  167. mtimeNs: bigint;
  168. ctimeNs: bigint;
  169. birthtimeNs: bigint;
  170. };
  171. declare interface IStats {
  172. isFile: () => boolean;
  173. isDirectory: () => boolean;
  174. isBlockDevice: () => boolean;
  175. isCharacterDevice: () => boolean;
  176. isSymbolicLink: () => boolean;
  177. isFIFO: () => boolean;
  178. isSocket: () => boolean;
  179. dev: number;
  180. ino: number;
  181. mode: number;
  182. nlink: number;
  183. uid: number;
  184. gid: number;
  185. rdev: number;
  186. size: number;
  187. blksize: number;
  188. blocks: number;
  189. atimeMs: number;
  190. mtimeMs: number;
  191. ctimeMs: number;
  192. birthtimeMs: number;
  193. atime: Date;
  194. mtime: Date;
  195. ctime: Date;
  196. birthtime: Date;
  197. }
  198. declare interface IStatsBase<T> {
  199. isFile: () => boolean;
  200. isDirectory: () => boolean;
  201. isBlockDevice: () => boolean;
  202. isCharacterDevice: () => boolean;
  203. isSymbolicLink: () => boolean;
  204. isFIFO: () => boolean;
  205. isSocket: () => boolean;
  206. dev: T;
  207. ino: T;
  208. mode: T;
  209. nlink: T;
  210. uid: T;
  211. gid: T;
  212. rdev: T;
  213. size: T;
  214. blksize: T;
  215. blocks: T;
  216. atimeMs: T;
  217. mtimeMs: T;
  218. ctimeMs: T;
  219. birthtimeMs: T;
  220. atime: Date;
  221. mtime: Date;
  222. ctime: Date;
  223. birthtime: Date;
  224. }
  225. declare interface Iterator<T, Z> {
  226. (
  227. item: T,
  228. callback: (err?: null | Error, result?: null | Z) => void,
  229. i: number
  230. ): void;
  231. }
  232. type JsonObject = { [index: string]: JsonValue } & {
  233. [index: string]:
  234. | undefined
  235. | null
  236. | string
  237. | number
  238. | boolean
  239. | JsonObject
  240. | JsonValue[];
  241. };
  242. type JsonValue = null | string | number | boolean | JsonObject | JsonValue[];
  243. declare interface KnownHooks {
  244. resolveStep: SyncHook<
  245. [
  246. AsyncSeriesBailHook<
  247. [ResolveRequest, ResolveContext],
  248. null | ResolveRequest
  249. >,
  250. ResolveRequest
  251. ]
  252. >;
  253. noResolve: SyncHook<[ResolveRequest, Error]>;
  254. resolve: AsyncSeriesBailHook<
  255. [ResolveRequest, ResolveContext],
  256. null | ResolveRequest
  257. >;
  258. result: AsyncSeriesHook<[ResolveRequest, ResolveContext]>;
  259. }
  260. declare interface LStat {
  261. (
  262. path: PathLike,
  263. callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
  264. ): void;
  265. (
  266. path: PathLike,
  267. options: undefined | (StatOptions & { bigint?: false }),
  268. callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
  269. ): void;
  270. (
  271. path: PathLike,
  272. options: StatOptions & { bigint: true },
  273. callback: (arg0: null | NodeJS.ErrnoException, arg1?: IBigIntStats) => void
  274. ): void;
  275. (
  276. path: PathLike,
  277. options: undefined | StatOptions,
  278. callback: (
  279. arg0: null | NodeJS.ErrnoException,
  280. arg1?: IStats | IBigIntStats
  281. ) => void
  282. ): void;
  283. }
  284. declare interface LStatSync {
  285. (path: PathLike, options?: undefined): IStats;
  286. (
  287. path: PathLike,
  288. options?: StatSyncOptions & { bigint?: false; throwIfNoEntry: false }
  289. ): undefined | IStats;
  290. (
  291. path: PathLike,
  292. options: StatSyncOptions & { bigint: true; throwIfNoEntry: false }
  293. ): undefined | IBigIntStats;
  294. (path: PathLike, options?: StatSyncOptions & { bigint?: false }): IStats;
  295. (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats;
  296. (
  297. path: PathLike,
  298. options: StatSyncOptions & { bigint: boolean; throwIfNoEntry?: false }
  299. ): IStats | IBigIntStats;
  300. (path: PathLike, options?: StatSyncOptions):
  301. | undefined
  302. | IStats
  303. | IBigIntStats;
  304. }
  305. declare class LogInfoPlugin {
  306. constructor(
  307. source:
  308. | string
  309. | AsyncSeriesBailHook<
  310. [ResolveRequest, ResolveContext],
  311. null | ResolveRequest
  312. >
  313. );
  314. source:
  315. | string
  316. | AsyncSeriesBailHook<
  317. [ResolveRequest, ResolveContext],
  318. null | ResolveRequest
  319. >;
  320. apply(resolver: Resolver): void;
  321. }
  322. declare interface ObjectEncodingOptions {
  323. encoding?:
  324. | null
  325. | "ascii"
  326. | "utf8"
  327. | "utf-8"
  328. | "utf16le"
  329. | "utf-16le"
  330. | "ucs2"
  331. | "ucs-2"
  332. | "base64"
  333. | "base64url"
  334. | "latin1"
  335. | "binary"
  336. | "hex";
  337. }
  338. declare interface ParsedIdentifier {
  339. request: string;
  340. query: string;
  341. fragment: string;
  342. directory: boolean;
  343. module: boolean;
  344. file: boolean;
  345. internal: boolean;
  346. }
  347. type PathLike = string | Buffer | URL_url;
  348. type PathOrFileDescriptor = string | number | Buffer | URL_url;
  349. type Plugin =
  350. | undefined
  351. | null
  352. | false
  353. | ""
  354. | 0
  355. | { apply: (arg0: Resolver) => void }
  356. | ((this: Resolver, arg1: Resolver) => void);
  357. declare interface PnpApi {
  358. resolveToUnqualified: (
  359. arg0: string,
  360. arg1: string,
  361. arg2: object
  362. ) => null | string;
  363. }
  364. declare interface ReadFile {
  365. (
  366. path: PathOrFileDescriptor,
  367. options:
  368. | undefined
  369. | null
  370. | ({ encoding?: null; flag?: string } & Abortable),
  371. callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
  372. ): void;
  373. (
  374. path: PathOrFileDescriptor,
  375. options:
  376. | ({ encoding: BufferEncoding; flag?: string } & Abortable)
  377. | "ascii"
  378. | "utf8"
  379. | "utf-8"
  380. | "utf16le"
  381. | "utf-16le"
  382. | "ucs2"
  383. | "ucs-2"
  384. | "base64"
  385. | "base64url"
  386. | "latin1"
  387. | "binary"
  388. | "hex",
  389. callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
  390. ): void;
  391. (
  392. path: PathOrFileDescriptor,
  393. options:
  394. | undefined
  395. | null
  396. | "ascii"
  397. | "utf8"
  398. | "utf-8"
  399. | "utf16le"
  400. | "utf-16le"
  401. | "ucs2"
  402. | "ucs-2"
  403. | "base64"
  404. | "base64url"
  405. | "latin1"
  406. | "binary"
  407. | "hex"
  408. | (ObjectEncodingOptions & { flag?: string } & Abortable),
  409. callback: (
  410. arg0: null | NodeJS.ErrnoException,
  411. arg1?: string | Buffer
  412. ) => void
  413. ): void;
  414. (
  415. path: PathOrFileDescriptor,
  416. callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
  417. ): void;
  418. }
  419. declare interface ReadFileSync {
  420. (
  421. path: PathOrFileDescriptor,
  422. options?: null | { encoding?: null; flag?: string }
  423. ): Buffer;
  424. (
  425. path: PathOrFileDescriptor,
  426. options:
  427. | "ascii"
  428. | "utf8"
  429. | "utf-8"
  430. | "utf16le"
  431. | "utf-16le"
  432. | "ucs2"
  433. | "ucs-2"
  434. | "base64"
  435. | "base64url"
  436. | "latin1"
  437. | "binary"
  438. | "hex"
  439. | { encoding: BufferEncoding; flag?: string }
  440. ): string;
  441. (
  442. path: PathOrFileDescriptor,
  443. options?:
  444. | null
  445. | "ascii"
  446. | "utf8"
  447. | "utf-8"
  448. | "utf16le"
  449. | "utf-16le"
  450. | "ucs2"
  451. | "ucs-2"
  452. | "base64"
  453. | "base64url"
  454. | "latin1"
  455. | "binary"
  456. | "hex"
  457. | (ObjectEncodingOptions & { flag?: string })
  458. ): string | Buffer;
  459. }
  460. declare interface Readdir {
  461. (
  462. path: PathLike,
  463. options:
  464. | undefined
  465. | null
  466. | "ascii"
  467. | "utf8"
  468. | "utf-8"
  469. | "utf16le"
  470. | "utf-16le"
  471. | "ucs2"
  472. | "ucs-2"
  473. | "base64"
  474. | "base64url"
  475. | "latin1"
  476. | "binary"
  477. | "hex"
  478. | {
  479. encoding:
  480. | null
  481. | "ascii"
  482. | "utf8"
  483. | "utf-8"
  484. | "utf16le"
  485. | "utf-16le"
  486. | "ucs2"
  487. | "ucs-2"
  488. | "base64"
  489. | "base64url"
  490. | "latin1"
  491. | "binary"
  492. | "hex";
  493. withFileTypes?: false;
  494. recursive?: boolean;
  495. },
  496. callback: (arg0: null | NodeJS.ErrnoException, arg1?: string[]) => void
  497. ): void;
  498. (
  499. path: PathLike,
  500. options:
  501. | { encoding: "buffer"; withFileTypes?: false; recursive?: boolean }
  502. | "buffer",
  503. callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer[]) => void
  504. ): void;
  505. (
  506. path: PathLike,
  507. callback: (arg0: null | NodeJS.ErrnoException, arg1?: string[]) => void
  508. ): void;
  509. (
  510. path: PathLike,
  511. options:
  512. | undefined
  513. | null
  514. | "ascii"
  515. | "utf8"
  516. | "utf-8"
  517. | "utf16le"
  518. | "utf-16le"
  519. | "ucs2"
  520. | "ucs-2"
  521. | "base64"
  522. | "base64url"
  523. | "latin1"
  524. | "binary"
  525. | "hex"
  526. | (ObjectEncodingOptions & {
  527. withFileTypes?: false;
  528. recursive?: boolean;
  529. }),
  530. callback: (
  531. arg0: null | NodeJS.ErrnoException,
  532. arg1?: string[] | Buffer[]
  533. ) => void
  534. ): void;
  535. (
  536. path: PathLike,
  537. options: ObjectEncodingOptions & {
  538. withFileTypes: true;
  539. recursive?: boolean;
  540. },
  541. callback: (arg0: null | NodeJS.ErrnoException, arg1?: Dirent[]) => void
  542. ): void;
  543. }
  544. declare interface ReaddirSync {
  545. (
  546. path: PathLike,
  547. options?:
  548. | null
  549. | "ascii"
  550. | "utf8"
  551. | "utf-8"
  552. | "utf16le"
  553. | "utf-16le"
  554. | "ucs2"
  555. | "ucs-2"
  556. | "base64"
  557. | "base64url"
  558. | "latin1"
  559. | "binary"
  560. | "hex"
  561. | {
  562. encoding:
  563. | null
  564. | "ascii"
  565. | "utf8"
  566. | "utf-8"
  567. | "utf16le"
  568. | "utf-16le"
  569. | "ucs2"
  570. | "ucs-2"
  571. | "base64"
  572. | "base64url"
  573. | "latin1"
  574. | "binary"
  575. | "hex";
  576. withFileTypes?: false;
  577. recursive?: boolean;
  578. }
  579. ): string[];
  580. (
  581. path: PathLike,
  582. options:
  583. | "buffer"
  584. | { encoding: "buffer"; withFileTypes?: false; recursive?: boolean }
  585. ): Buffer[];
  586. (
  587. path: PathLike,
  588. options?:
  589. | null
  590. | "ascii"
  591. | "utf8"
  592. | "utf-8"
  593. | "utf16le"
  594. | "utf-16le"
  595. | "ucs2"
  596. | "ucs-2"
  597. | "base64"
  598. | "base64url"
  599. | "latin1"
  600. | "binary"
  601. | "hex"
  602. | (ObjectEncodingOptions & { withFileTypes?: false; recursive?: boolean })
  603. ): string[] | Buffer[];
  604. (
  605. path: PathLike,
  606. options: ObjectEncodingOptions & {
  607. withFileTypes: true;
  608. recursive?: boolean;
  609. }
  610. ): Dirent[];
  611. }
  612. declare interface Readlink {
  613. (
  614. path: PathLike,
  615. options: EncodingOption,
  616. callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
  617. ): void;
  618. (
  619. path: PathLike,
  620. options: BufferEncodingOption,
  621. callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
  622. ): void;
  623. (
  624. path: PathLike,
  625. options: EncodingOption,
  626. callback: (
  627. arg0: null | NodeJS.ErrnoException,
  628. arg1?: string | Buffer
  629. ) => void
  630. ): void;
  631. (
  632. path: PathLike,
  633. callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
  634. ): void;
  635. }
  636. declare interface ReadlinkSync {
  637. (path: PathLike, options?: EncodingOption): string;
  638. (path: PathLike, options: BufferEncodingOption): Buffer;
  639. (path: PathLike, options?: EncodingOption): string | Buffer;
  640. }
  641. declare interface RealPath {
  642. (
  643. path: PathLike,
  644. options: EncodingOption,
  645. callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
  646. ): void;
  647. (
  648. path: PathLike,
  649. options: BufferEncodingOption,
  650. callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
  651. ): void;
  652. (
  653. path: PathLike,
  654. options: EncodingOption,
  655. callback: (
  656. arg0: null | NodeJS.ErrnoException,
  657. arg1?: string | Buffer
  658. ) => void
  659. ): void;
  660. (
  661. path: PathLike,
  662. callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
  663. ): void;
  664. }
  665. declare interface RealPathSync {
  666. (path: PathLike, options?: EncodingOption): string;
  667. (path: PathLike, options: BufferEncodingOption): Buffer;
  668. (path: PathLike, options?: EncodingOption): string | Buffer;
  669. }
  670. declare interface ResolveContext {
  671. contextDependencies?: WriteOnlySet<string>;
  672. /**
  673. * files that was found on file system
  674. */
  675. fileDependencies?: WriteOnlySet<string>;
  676. /**
  677. * dependencies that was not found on file system
  678. */
  679. missingDependencies?: WriteOnlySet<string>;
  680. /**
  681. * set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`,
  682. */
  683. stack?: Set<string>;
  684. /**
  685. * log function
  686. */
  687. log?: (arg0: string) => void;
  688. /**
  689. * yield result, if provided plugins can return several results
  690. */
  691. yield?: (arg0: ResolveRequest) => void;
  692. }
  693. declare interface ResolveFunction {
  694. (context: object, path: string, request: string): string | false;
  695. (path: string, request: string): string | false;
  696. }
  697. declare interface ResolveFunctionAsync {
  698. (
  699. context: object,
  700. path: string,
  701. request: string,
  702. resolveContext: ResolveContext,
  703. callback: (
  704. err: null | ErrorWithDetail,
  705. res?: string | false,
  706. req?: ResolveRequest
  707. ) => void
  708. ): void;
  709. (
  710. context: object,
  711. path: string,
  712. request: string,
  713. callback: (
  714. err: null | ErrorWithDetail,
  715. res?: string | false,
  716. req?: ResolveRequest
  717. ) => void
  718. ): void;
  719. (
  720. path: string,
  721. request: string,
  722. resolveContext: ResolveContext,
  723. callback: (
  724. err: null | ErrorWithDetail,
  725. res?: string | false,
  726. req?: ResolveRequest
  727. ) => void
  728. ): void;
  729. (
  730. path: string,
  731. request: string,
  732. callback: (
  733. err: null | ErrorWithDetail,
  734. res?: string | false,
  735. req?: ResolveRequest
  736. ) => void
  737. ): void;
  738. }
  739. type ResolveOptionsOptionalFS = Omit<
  740. ResolveOptionsResolverFactoryObject_2,
  741. "fileSystem"
  742. > &
  743. Partial<Pick<ResolveOptionsResolverFactoryObject_2, "fileSystem">>;
  744. declare interface ResolveOptionsResolverFactoryObject_1 {
  745. alias: AliasOption[];
  746. fallback: AliasOption[];
  747. aliasFields: Set<string | string[]>;
  748. extensionAlias: ExtensionAliasOption[];
  749. cachePredicate: (arg0: ResolveRequest) => boolean;
  750. cacheWithContext: boolean;
  751. /**
  752. * A list of exports field condition names.
  753. */
  754. conditionNames: Set<string>;
  755. descriptionFiles: string[];
  756. enforceExtension: boolean;
  757. exportsFields: Set<string | string[]>;
  758. importsFields: Set<string | string[]>;
  759. extensions: Set<string>;
  760. fileSystem: FileSystem;
  761. unsafeCache: false | object;
  762. symlinks: boolean;
  763. resolver?: Resolver;
  764. modules: (string | string[])[];
  765. mainFields: { name: string[]; forceRelative: boolean }[];
  766. mainFiles: Set<string>;
  767. plugins: Plugin[];
  768. pnpApi: null | PnpApi;
  769. roots: Set<string>;
  770. fullySpecified: boolean;
  771. resolveToContext: boolean;
  772. restrictions: Set<string | RegExp>;
  773. preferRelative: boolean;
  774. preferAbsolute: boolean;
  775. }
  776. declare interface ResolveOptionsResolverFactoryObject_2 {
  777. /**
  778. * A list of module alias configurations or an object which maps key to value
  779. */
  780. alias?: AliasOptions | AliasOption[];
  781. /**
  782. * A list of module alias configurations or an object which maps key to value, applied only after modules option
  783. */
  784. fallback?: AliasOptions | AliasOption[];
  785. /**
  786. * An object which maps extension to extension aliases
  787. */
  788. extensionAlias?: ExtensionAliasOptions;
  789. /**
  790. * A list of alias fields in description files
  791. */
  792. aliasFields?: (string | string[])[];
  793. /**
  794. * A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties.
  795. */
  796. cachePredicate?: (arg0: ResolveRequest) => boolean;
  797. /**
  798. * Whether or not the unsafeCache should include request context as part of the cache key.
  799. */
  800. cacheWithContext?: boolean;
  801. /**
  802. * A list of description files to read from
  803. */
  804. descriptionFiles?: string[];
  805. /**
  806. * A list of exports field condition names.
  807. */
  808. conditionNames?: string[];
  809. /**
  810. * Enforce that a extension from extensions must be used
  811. */
  812. enforceExtension?: boolean;
  813. /**
  814. * A list of exports fields in description files
  815. */
  816. exportsFields?: (string | string[])[];
  817. /**
  818. * A list of imports fields in description files
  819. */
  820. importsFields?: (string | string[])[];
  821. /**
  822. * A list of extensions which should be tried for files
  823. */
  824. extensions?: string[];
  825. /**
  826. * The file system which should be used
  827. */
  828. fileSystem: FileSystem;
  829. /**
  830. * Use this cache object to unsafely cache the successful requests
  831. */
  832. unsafeCache?: boolean | object;
  833. /**
  834. * Resolve symlinks to their symlinked location
  835. */
  836. symlinks?: boolean;
  837. /**
  838. * A prepared Resolver to which the plugins are attached
  839. */
  840. resolver?: Resolver;
  841. /**
  842. * A list of directories to resolve modules from, can be absolute path or folder name
  843. */
  844. modules?: string | string[];
  845. /**
  846. * A list of main fields in description files
  847. */
  848. mainFields?: (
  849. | string
  850. | string[]
  851. | { name: string | string[]; forceRelative: boolean }
  852. )[];
  853. /**
  854. * A list of main files in directories
  855. */
  856. mainFiles?: string[];
  857. /**
  858. * A list of additional resolve plugins which should be applied
  859. */
  860. plugins?: Plugin[];
  861. /**
  862. * A PnP API that should be used - null is "never", undefined is "auto"
  863. */
  864. pnpApi?: null | PnpApi;
  865. /**
  866. * A list of root paths
  867. */
  868. roots?: string[];
  869. /**
  870. * The request is already fully specified and no extensions or directories are resolved for it
  871. */
  872. fullySpecified?: boolean;
  873. /**
  874. * Resolve to a context instead of a file
  875. */
  876. resolveToContext?: boolean;
  877. /**
  878. * A list of resolve restrictions
  879. */
  880. restrictions?: (string | RegExp)[];
  881. /**
  882. * Use only the sync constraints of the file system calls
  883. */
  884. useSyncFileSystemCalls?: boolean;
  885. /**
  886. * Prefer to resolve module requests as relative requests before falling back to modules
  887. */
  888. preferRelative?: boolean;
  889. /**
  890. * Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots
  891. */
  892. preferAbsolute?: boolean;
  893. }
  894. type ResolveRequest = BaseResolveRequest & Partial<ParsedIdentifier>;
  895. declare abstract class Resolver {
  896. fileSystem: FileSystem;
  897. options: ResolveOptionsResolverFactoryObject_1;
  898. hooks: KnownHooks;
  899. ensureHook(
  900. name:
  901. | string
  902. | AsyncSeriesBailHook<
  903. [ResolveRequest, ResolveContext],
  904. null | ResolveRequest
  905. >
  906. ): AsyncSeriesBailHook<
  907. [ResolveRequest, ResolveContext],
  908. null | ResolveRequest
  909. >;
  910. getHook(
  911. name:
  912. | string
  913. | AsyncSeriesBailHook<
  914. [ResolveRequest, ResolveContext],
  915. null | ResolveRequest
  916. >
  917. ): AsyncSeriesBailHook<
  918. [ResolveRequest, ResolveContext],
  919. null | ResolveRequest
  920. >;
  921. resolveSync(context: object, path: string, request: string): string | false;
  922. resolve(
  923. context: object,
  924. path: string,
  925. request: string,
  926. resolveContext: ResolveContext,
  927. callback: (
  928. err: null | ErrorWithDetail,
  929. res?: string | false,
  930. req?: ResolveRequest
  931. ) => void
  932. ): void;
  933. doResolve(
  934. hook: AsyncSeriesBailHook<
  935. [ResolveRequest, ResolveContext],
  936. null | ResolveRequest
  937. >,
  938. request: ResolveRequest,
  939. message: null | string,
  940. resolveContext: ResolveContext,
  941. callback: (err?: null | Error, result?: ResolveRequest) => void
  942. ): void;
  943. parse(identifier: string): ParsedIdentifier;
  944. isModule(path: string): boolean;
  945. isPrivate(path: string): boolean;
  946. isDirectory(path: string): boolean;
  947. join(path: string, request: string): string;
  948. normalize(path: string): string;
  949. }
  950. declare interface Stat {
  951. (
  952. path: PathLike,
  953. callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
  954. ): void;
  955. (
  956. path: PathLike,
  957. options: undefined | (StatOptions & { bigint?: false }),
  958. callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
  959. ): void;
  960. (
  961. path: PathLike,
  962. options: StatOptions & { bigint: true },
  963. callback: (arg0: null | NodeJS.ErrnoException, arg1?: IBigIntStats) => void
  964. ): void;
  965. (
  966. path: PathLike,
  967. options: undefined | StatOptions,
  968. callback: (
  969. arg0: null | NodeJS.ErrnoException,
  970. arg1?: IStats | IBigIntStats
  971. ) => void
  972. ): void;
  973. }
  974. declare interface StatOptions {
  975. bigint?: boolean;
  976. }
  977. declare interface StatSync {
  978. (path: PathLike, options?: undefined): IStats;
  979. (
  980. path: PathLike,
  981. options?: StatSyncOptions & { bigint?: false; throwIfNoEntry: false }
  982. ): undefined | IStats;
  983. (
  984. path: PathLike,
  985. options: StatSyncOptions & { bigint: true; throwIfNoEntry: false }
  986. ): undefined | IBigIntStats;
  987. (path: PathLike, options?: StatSyncOptions & { bigint?: false }): IStats;
  988. (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats;
  989. (
  990. path: PathLike,
  991. options: StatSyncOptions & { bigint: boolean; throwIfNoEntry?: false }
  992. ): IStats | IBigIntStats;
  993. (path: PathLike, options?: StatSyncOptions):
  994. | undefined
  995. | IStats
  996. | IBigIntStats;
  997. }
  998. declare interface StatSyncOptions {
  999. bigint?: boolean;
  1000. throwIfNoEntry?: boolean;
  1001. }
  1002. declare interface SyncFileSystem {
  1003. readFileSync: ReadFileSync;
  1004. readdirSync: ReaddirSync;
  1005. readJsonSync?: (arg0: PathOrFileDescriptor) => JsonObject;
  1006. readlinkSync: ReadlinkSync;
  1007. lstatSync?: LStatSync;
  1008. statSync: StatSync;
  1009. realpathSync?: RealPathSync;
  1010. }
  1011. /**
  1012. * `URL` class is a global reference for `require('url').URL`
  1013. * https://nodejs.org/api/url.html#the-whatwg-url-api
  1014. */
  1015. declare interface URL_url extends URL_Import {}
  1016. declare interface WriteOnlySet<T> {
  1017. add: (item: T) => void;
  1018. }
  1019. declare function exports(
  1020. context: object,
  1021. path: string,
  1022. request: string,
  1023. resolveContext: ResolveContext,
  1024. callback: (
  1025. err: null | ErrorWithDetail,
  1026. res?: string | false,
  1027. req?: ResolveRequest
  1028. ) => void
  1029. ): void;
  1030. declare function exports(
  1031. context: object,
  1032. path: string,
  1033. request: string,
  1034. callback: (
  1035. err: null | ErrorWithDetail,
  1036. res?: string | false,
  1037. req?: ResolveRequest
  1038. ) => void
  1039. ): void;
  1040. declare function exports(
  1041. path: string,
  1042. request: string,
  1043. resolveContext: ResolveContext,
  1044. callback: (
  1045. err: null | ErrorWithDetail,
  1046. res?: string | false,
  1047. req?: ResolveRequest
  1048. ) => void
  1049. ): void;
  1050. declare function exports(
  1051. path: string,
  1052. request: string,
  1053. callback: (
  1054. err: null | ErrorWithDetail,
  1055. res?: string | false,
  1056. req?: ResolveRequest
  1057. ) => void
  1058. ): void;
  1059. declare namespace exports {
  1060. export const sync: ResolveFunction;
  1061. export function create(
  1062. options: ResolveOptionsOptionalFS
  1063. ): ResolveFunctionAsync;
  1064. export namespace create {
  1065. export const sync: (options: ResolveOptionsOptionalFS) => ResolveFunction;
  1066. }
  1067. export namespace ResolverFactory {
  1068. export let createResolver: (
  1069. options: ResolveOptionsResolverFactoryObject_2
  1070. ) => Resolver;
  1071. }
  1072. export const forEachBail: <T, Z>(
  1073. array: T[],
  1074. iterator: Iterator<T, Z>,
  1075. callback: (err?: null | Error, result?: null | Z, i?: number) => void
  1076. ) => void;
  1077. export type ResolveCallback = (
  1078. err: null | ErrorWithDetail,
  1079. res?: string | false,
  1080. req?: ResolveRequest
  1081. ) => void;
  1082. export {
  1083. CachedInputFileSystem,
  1084. CloneBasenamePlugin,
  1085. LogInfoPlugin,
  1086. ResolveOptionsOptionalFS,
  1087. PnpApi,
  1088. Resolver,
  1089. FileSystem,
  1090. ResolveContext,
  1091. ResolveRequest,
  1092. Plugin,
  1093. ResolveOptionsResolverFactoryObject_2 as ResolveOptions,
  1094. ResolveFunctionAsync,
  1095. ResolveFunction
  1096. };
  1097. }
  1098. export = exports;