@ohos-ports/rsbuild-core 1.7.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/bin/rsbuild.js +20 -0
  4. package/compiled/@jridgewell/remapping/index.d.ts +1 -0
  5. package/compiled/@jridgewell/remapping/index.js +1222 -0
  6. package/compiled/@jridgewell/remapping/license +19 -0
  7. package/compiled/@jridgewell/remapping/package.json +1 -0
  8. package/compiled/@jridgewell/trace-mapping/index.d.ts +194 -0
  9. package/compiled/@jridgewell/trace-mapping/index.js +1408 -0
  10. package/compiled/@jridgewell/trace-mapping/license +19 -0
  11. package/compiled/@jridgewell/trace-mapping/package.json +1 -0
  12. package/compiled/chokidar/index.d.ts +384 -0
  13. package/compiled/chokidar/index.js +1793 -0
  14. package/compiled/chokidar/license +21 -0
  15. package/compiled/chokidar/package.json +1 -0
  16. package/compiled/connect/index.d.ts +90 -0
  17. package/compiled/connect/index.js +1240 -0
  18. package/compiled/connect/license +25 -0
  19. package/compiled/connect/package.json +1 -0
  20. package/compiled/cors/index.d.ts +56 -0
  21. package/compiled/cors/index.js +371 -0
  22. package/compiled/cors/license +22 -0
  23. package/compiled/cors/package.json +1 -0
  24. package/compiled/css-loader/api.js +85 -0
  25. package/compiled/css-loader/getUrl.js +26 -0
  26. package/compiled/css-loader/index.d.ts +1 -0
  27. package/compiled/css-loader/index.js +2 -0
  28. package/compiled/css-loader/license +20 -0
  29. package/compiled/css-loader/noSourceMaps.js +5 -0
  30. package/compiled/css-loader/package.json +1 -0
  31. package/compiled/css-loader/sourceMaps.js +16 -0
  32. package/compiled/html-rspack-plugin/default_index.ejs +9 -0
  33. package/compiled/html-rspack-plugin/index.d.ts +290 -0
  34. package/compiled/html-rspack-plugin/index.js +1602 -0
  35. package/compiled/html-rspack-plugin/license +20 -0
  36. package/compiled/html-rspack-plugin/loader.js +166 -0
  37. package/compiled/html-rspack-plugin/package.json +1 -0
  38. package/compiled/http-proxy-middleware/index.d.ts +319 -0
  39. package/compiled/http-proxy-middleware/index.js +5284 -0
  40. package/compiled/http-proxy-middleware/license +22 -0
  41. package/compiled/http-proxy-middleware/package.json +1 -0
  42. package/compiled/launch-editor-middleware/index.d.ts +1 -0
  43. package/compiled/launch-editor-middleware/index.js +719 -0
  44. package/compiled/launch-editor-middleware/license +21 -0
  45. package/compiled/launch-editor-middleware/package.json +1 -0
  46. package/compiled/memfs/index.d.ts +1462 -0
  47. package/compiled/memfs/index.js +1 -0
  48. package/compiled/memfs/license +201 -0
  49. package/compiled/memfs/package.json +1 -0
  50. package/compiled/mrmime/index.d.ts +4 -0
  51. package/compiled/mrmime/index.js +456 -0
  52. package/compiled/mrmime/package.json +1 -0
  53. package/compiled/picocolors/index.d.ts +55 -0
  54. package/compiled/picocolors/index.js +108 -0
  55. package/compiled/picocolors/license +15 -0
  56. package/compiled/picocolors/package.json +1 -0
  57. package/compiled/postcss/index.js +1 -0
  58. package/compiled/postcss/lib/at-rule.d.ts +140 -0
  59. package/compiled/postcss/lib/comment.d.ts +68 -0
  60. package/compiled/postcss/lib/container.d.ts +483 -0
  61. package/compiled/postcss/lib/css-syntax-error.d.ts +248 -0
  62. package/compiled/postcss/lib/declaration.d.ts +151 -0
  63. package/compiled/postcss/lib/document.d.ts +69 -0
  64. package/compiled/postcss/lib/fromJSON.d.ts +9 -0
  65. package/compiled/postcss/lib/input.d.ts +227 -0
  66. package/compiled/postcss/lib/lazy-result.d.ts +190 -0
  67. package/compiled/postcss/lib/list.d.ts +60 -0
  68. package/compiled/postcss/lib/no-work-result.d.ts +46 -0
  69. package/compiled/postcss/lib/node.d.ts +556 -0
  70. package/compiled/postcss/lib/parse.d.ts +9 -0
  71. package/compiled/postcss/lib/postcss.d.ts +458 -0
  72. package/compiled/postcss/lib/previous-map.d.ts +81 -0
  73. package/compiled/postcss/lib/processor.d.ts +115 -0
  74. package/compiled/postcss/lib/result.d.ts +205 -0
  75. package/compiled/postcss/lib/root.d.ts +87 -0
  76. package/compiled/postcss/lib/rule.d.ts +126 -0
  77. package/compiled/postcss/lib/source-map-js.d.ts +4 -0
  78. package/compiled/postcss/lib/stringifier.d.ts +46 -0
  79. package/compiled/postcss/lib/stringify.d.ts +9 -0
  80. package/compiled/postcss/lib/warning.d.ts +147 -0
  81. package/compiled/postcss/license +20 -0
  82. package/compiled/postcss/package.json +1 -0
  83. package/compiled/postcss-loader/index.d.ts +1 -0
  84. package/compiled/postcss-loader/index.js +720 -0
  85. package/compiled/postcss-loader/license +20 -0
  86. package/compiled/postcss-loader/package.json +1 -0
  87. package/compiled/rslog/index.d.ts +67 -0
  88. package/compiled/rslog/license +21 -0
  89. package/compiled/rslog/package.json +1 -0
  90. package/compiled/rspack-chain/license +22 -0
  91. package/compiled/rspack-chain/package.json +1 -0
  92. package/compiled/rspack-chain/types/index.d.ts +545 -0
  93. package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
  94. package/compiled/rspack-manifest-plugin/index.js +409 -0
  95. package/compiled/rspack-manifest-plugin/license +21 -0
  96. package/compiled/rspack-manifest-plugin/package.json +1 -0
  97. package/compiled/sirv/index.d.ts +1 -0
  98. package/compiled/sirv/index.js +274 -0
  99. package/compiled/sirv/package.json +1 -0
  100. package/compiled/style-loader/index.d.ts +1 -0
  101. package/compiled/style-loader/index.js +427 -0
  102. package/compiled/style-loader/license +20 -0
  103. package/compiled/style-loader/package.json +1 -0
  104. package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
  105. package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
  106. package/compiled/style-loader/runtime/insertBySelector.js +34 -0
  107. package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
  108. package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
  109. package/compiled/style-loader/runtime/isOldIE.js +17 -0
  110. package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
  111. package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
  112. package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
  113. package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
  114. package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
  115. package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
  116. package/compiled/tinyglobby/index.d.ts +46 -0
  117. package/compiled/tinyglobby/index.js +2664 -0
  118. package/compiled/tinyglobby/license +21 -0
  119. package/compiled/tinyglobby/package.json +1 -0
  120. package/compiled/webpack-bundle-analyzer/index.d.ts +160 -0
  121. package/compiled/webpack-bundle-analyzer/index.js +23 -0
  122. package/compiled/webpack-bundle-analyzer/license +20 -0
  123. package/compiled/webpack-bundle-analyzer/package.json +1 -0
  124. package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
  125. package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
  126. package/compiled/webpack-merge/index.d.ts +31 -0
  127. package/compiled/webpack-merge/index.js +1200 -0
  128. package/compiled/webpack-merge/license +20 -0
  129. package/compiled/webpack-merge/package.json +1 -0
  130. package/compiled/ws/index.d.ts +437 -0
  131. package/compiled/ws/index.js +3161 -0
  132. package/compiled/ws/license +20 -0
  133. package/compiled/ws/package.json +1 -0
  134. package/dist/0~open.js +427 -0
  135. package/dist/0~range-parser.js +49 -0
  136. package/dist/0~range-parser.js.LICENSE.txt +6 -0
  137. package/dist/131.js +9305 -0
  138. package/dist/131.js.LICENSE.txt +26 -0
  139. package/dist/136.mjs +42 -0
  140. package/dist/2~open.cjs +436 -0
  141. package/dist/2~range-parser.cjs +52 -0
  142. package/dist/2~range-parser.cjs.LICENSE.txt +6 -0
  143. package/dist/client/59.js +22 -0
  144. package/dist/client/hmr.js +206 -0
  145. package/dist/client/overlay.js +203 -0
  146. package/dist/ignoreCssLoader.mjs +3 -0
  147. package/dist/index.cjs +9456 -0
  148. package/dist/index.cjs.LICENSE.txt +26 -0
  149. package/dist/index.js +1 -0
  150. package/dist/rslib-runtime.js +44 -0
  151. package/dist/transformLoader.mjs +1 -0
  152. package/dist/transformRawLoader.mjs +4 -0
  153. package/dist-types/cli/commands.d.ts +28 -0
  154. package/dist-types/cli/index.d.ts +1 -0
  155. package/dist-types/cli/init.d.ts +7 -0
  156. package/dist-types/client/hmr.d.ts +3 -0
  157. package/dist-types/client/log.d.ts +13 -0
  158. package/dist-types/client/overlay.d.ts +1 -0
  159. package/dist-types/configChain.d.ts +154 -0
  160. package/dist-types/constants.d.ts +52 -0
  161. package/dist-types/createContext.d.ts +11 -0
  162. package/dist-types/createRsbuild.d.ts +5 -0
  163. package/dist-types/defaultConfig.d.ts +25 -0
  164. package/dist-types/helpers/compiler.d.ts +5 -0
  165. package/dist-types/helpers/exitHook.d.ts +3 -0
  166. package/dist-types/helpers/format.d.ts +2 -0
  167. package/dist-types/helpers/fs.d.ts +17 -0
  168. package/dist-types/helpers/index.d.ts +29 -0
  169. package/dist-types/helpers/path.d.ts +26 -0
  170. package/dist-types/helpers/stats.d.ts +18 -0
  171. package/dist-types/helpers/url.d.ts +11 -0
  172. package/dist-types/helpers/vendors.d.ts +29 -0
  173. package/dist-types/helpers/version.d.ts +7 -0
  174. package/dist-types/hooks.d.ts +44 -0
  175. package/dist-types/index.d.ts +22 -0
  176. package/dist-types/initPlugins.d.ts +6 -0
  177. package/dist-types/inspectConfig.d.ts +35 -0
  178. package/dist-types/loadConfig.d.ts +60 -0
  179. package/dist-types/loadEnv.d.ts +63 -0
  180. package/dist-types/loader/ignoreCssLoader.d.ts +3 -0
  181. package/dist-types/loader/transformLoader.d.ts +8 -0
  182. package/dist-types/loader/transformRawLoader.d.ts +3 -0
  183. package/dist-types/logger.d.ts +19 -0
  184. package/dist-types/mergeConfig.d.ts +2 -0
  185. package/dist-types/package.json +1 -0
  186. package/dist-types/pluginHelper.d.ts +12 -0
  187. package/dist-types/pluginManager.d.ts +21 -0
  188. package/dist-types/plugins/appIcon.d.ts +2 -0
  189. package/dist-types/plugins/asset.d.ts +3 -0
  190. package/dist-types/plugins/basic.d.ts +5 -0
  191. package/dist-types/plugins/bundleAnalyzer.d.ts +2 -0
  192. package/dist-types/plugins/cache.d.ts +2 -0
  193. package/dist-types/plugins/cleanOutput.d.ts +2 -0
  194. package/dist-types/plugins/css.d.ts +4 -0
  195. package/dist-types/plugins/define.d.ts +2 -0
  196. package/dist-types/plugins/entry.d.ts +2 -0
  197. package/dist-types/plugins/esm.d.ts +2 -0
  198. package/dist-types/plugins/externals.d.ts +2 -0
  199. package/dist-types/plugins/fileSize.d.ts +6 -0
  200. package/dist-types/plugins/html.d.ts +9 -0
  201. package/dist-types/plugins/inlineChunk.d.ts +6 -0
  202. package/dist-types/plugins/lazyCompilation.d.ts +2 -0
  203. package/dist-types/plugins/manifest.d.ts +2 -0
  204. package/dist-types/plugins/minimize.d.ts +10 -0
  205. package/dist-types/plugins/moduleFederation.d.ts +2 -0
  206. package/dist-types/plugins/moment.d.ts +2 -0
  207. package/dist-types/plugins/nodeAddons.d.ts +2 -0
  208. package/dist-types/plugins/nonce.d.ts +2 -0
  209. package/dist-types/plugins/output.d.ts +2 -0
  210. package/dist-types/plugins/performance.d.ts +5 -0
  211. package/dist-types/plugins/progress.d.ts +2 -0
  212. package/dist-types/plugins/resolve.d.ts +2 -0
  213. package/dist-types/plugins/resourceHints.d.ts +2 -0
  214. package/dist-types/plugins/rsdoctor.d.ts +2 -0
  215. package/dist-types/plugins/rspackProfile.d.ts +2 -0
  216. package/dist-types/plugins/server.d.ts +2 -0
  217. package/dist-types/plugins/sourceMap.d.ts +2 -0
  218. package/dist-types/plugins/splitChunks.d.ts +4 -0
  219. package/dist-types/plugins/sri.d.ts +2 -0
  220. package/dist-types/plugins/swc.d.ts +5 -0
  221. package/dist-types/plugins/target.d.ts +2 -0
  222. package/dist-types/plugins/wasm.d.ts +2 -0
  223. package/dist-types/provider/build.d.ts +4 -0
  224. package/dist-types/provider/createCompiler.d.ts +6 -0
  225. package/dist-types/provider/helpers.d.ts +12 -0
  226. package/dist-types/provider/initConfigs.d.ts +19 -0
  227. package/dist-types/provider/provider.d.ts +2 -0
  228. package/dist-types/provider/rspackConfig.d.ts +8 -0
  229. package/dist-types/restart.d.ts +18 -0
  230. package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +38 -0
  231. package/dist-types/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +32 -0
  232. package/dist-types/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +28 -0
  233. package/dist-types/rspack-plugins/resource-hints/extractChunks.d.ts +23 -0
  234. package/dist-types/rspack-plugins/resource-hints/getResourceType.d.ts +22 -0
  235. package/dist-types/rspack.d.ts +2 -0
  236. package/dist-types/server/ansiHTML.d.ts +4 -0
  237. package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +12 -0
  238. package/dist-types/server/assets-middleware/index.d.ts +37 -0
  239. package/dist-types/server/assets-middleware/middleware.d.ts +2 -0
  240. package/dist-types/server/assets-middleware/parseTokenList.d.ts +1 -0
  241. package/dist-types/server/assets-middleware/setupOutputFileSystem.d.ts +3 -0
  242. package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +15 -0
  243. package/dist-types/server/browserLogs.d.ts +9 -0
  244. package/dist-types/server/buildManager.d.ts +33 -0
  245. package/dist-types/server/cliShortcuts.d.ts +10 -0
  246. package/dist-types/server/devMiddlewares.d.ts +21 -0
  247. package/dist-types/server/devServer.d.ts +79 -0
  248. package/dist-types/server/environment.d.ts +8 -0
  249. package/dist-types/server/gracefulShutdown.d.ts +10 -0
  250. package/dist-types/server/gzipMiddleware.d.ts +2 -0
  251. package/dist-types/server/helper.d.ts +91 -0
  252. package/dist-types/server/historyApiFallback.d.ts +2 -0
  253. package/dist-types/server/hmrFallback.d.ts +1 -0
  254. package/dist-types/server/httpServer.d.ts +7 -0
  255. package/dist-types/server/middlewares.d.ts +33 -0
  256. package/dist-types/server/open.d.ts +10 -0
  257. package/dist-types/server/overlay.d.ts +3 -0
  258. package/dist-types/server/prodServer.d.ts +24 -0
  259. package/dist-types/server/proxy.d.ts +6 -0
  260. package/dist-types/server/runner/asModule.d.ts +2 -0
  261. package/dist-types/server/runner/basic.d.ts +29 -0
  262. package/dist-types/server/runner/cjs.d.ts +10 -0
  263. package/dist-types/server/runner/esm.d.ts +6 -0
  264. package/dist-types/server/runner/index.d.ts +4 -0
  265. package/dist-types/server/runner/type.d.ts +42 -0
  266. package/dist-types/server/socketServer.d.ts +81 -0
  267. package/dist-types/server/watchFiles.d.ts +14 -0
  268. package/dist-types/types/config.d.ts +1882 -0
  269. package/dist-types/types/context.d.ts +110 -0
  270. package/dist-types/types/hooks.d.ts +275 -0
  271. package/dist-types/types/index.d.ts +8 -0
  272. package/dist-types/types/plugin.d.ts +585 -0
  273. package/dist-types/types/rsbuild.d.ts +286 -0
  274. package/dist-types/types/rspack.d.ts +16 -0
  275. package/dist-types/types/thirdParty.d.ts +186 -0
  276. package/dist-types/types/utils.d.ts +19 -0
  277. package/package.json +114 -0
  278. package/static/openChrome.applescript +95 -0
  279. package/types.d.ts +349 -0
@@ -0,0 +1,19 @@
1
+ Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ {"name":"@jridgewell/trace-mapping","author":"Justin Ridgewell <justin@ridgewell.name>","version":"0.3.31","license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -0,0 +1,384 @@
1
+ import { WatchEventType, Stats as Stats$1 } from 'fs';
2
+ import { EventEmitter } from 'events';
3
+ import { Dirent, Stats } from 'node:fs';
4
+ import { Readable } from 'node:stream';
5
+
6
+ /**
7
+ * Recursive version of readdir. Exposes a streaming API and promise API.
8
+ * Streaming API allows to use a small amount of RAM.
9
+ *
10
+ * @module
11
+ * @example
12
+ ```js
13
+ import readdirp from 'readdirp';
14
+ for await (const entry of readdirp('.')) {
15
+ const {path} = entry;
16
+ console.log(`${JSON.stringify({path})}`);
17
+ }
18
+ ```
19
+ */
20
+ /*! readdirp - MIT License (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com) */
21
+
22
+ /** Path in file system. */
23
+ type Path$1 = string;
24
+ /** Emitted entry. Contains relative & absolute path, basename, and either stats or dirent. */
25
+ interface EntryInfo {
26
+ path: string;
27
+ fullPath: string;
28
+ stats?: Stats;
29
+ dirent?: Dirent;
30
+ basename: string;
31
+ }
32
+ /** Path or dir entries (files) */
33
+ type PathOrDirent = Dirent | Path$1;
34
+ /** Filterer for files */
35
+ type Tester = (entryInfo: EntryInfo) => boolean;
36
+ type Predicate = string[] | string | Tester;
37
+ declare const EntryTypes: {
38
+ readonly FILE_TYPE: "files";
39
+ readonly DIR_TYPE: "directories";
40
+ readonly FILE_DIR_TYPE: "files_directories";
41
+ readonly EVERYTHING_TYPE: "all";
42
+ };
43
+ type EntryType = (typeof EntryTypes)[keyof typeof EntryTypes];
44
+ /**
45
+ * Options for readdirp.
46
+ * * type: files, directories, or both
47
+ * * lstat: whether to use symlink-friendly stat
48
+ * * depth: max depth
49
+ * * alwaysStat: whether to use stat (more resources) or dirent
50
+ * * highWaterMark: streaming param, specifies max amount of resources per entry
51
+ */
52
+ type ReaddirpOptions = {
53
+ root: string;
54
+ fileFilter?: Predicate;
55
+ directoryFilter?: Predicate;
56
+ type?: EntryType;
57
+ lstat?: boolean;
58
+ depth?: number;
59
+ alwaysStat?: boolean;
60
+ highWaterMark?: number;
61
+ };
62
+ /** Directory entry. Contains path, depth count, and files. */
63
+ interface DirEntry$1 {
64
+ files: PathOrDirent[];
65
+ depth: number;
66
+ path: Path$1;
67
+ }
68
+ /** Readable readdir stream, emitting new files as they're being listed. */
69
+ declare class ReaddirpStream extends Readable {
70
+ parents: any[];
71
+ reading: boolean;
72
+ parent?: DirEntry$1;
73
+ _stat: Function;
74
+ _maxDepth: number;
75
+ _wantsDir: boolean;
76
+ _wantsFile: boolean;
77
+ _wantsEverything: boolean;
78
+ _root: Path$1;
79
+ _isDirent: boolean;
80
+ _statsProp: 'dirent' | 'stats';
81
+ _rdOptions: {
82
+ encoding: 'utf8';
83
+ withFileTypes: boolean;
84
+ };
85
+ _fileFilter: Tester;
86
+ _directoryFilter: Tester;
87
+ constructor(options?: Partial<ReaddirpOptions>);
88
+ _read(batch: number): Promise<void>;
89
+ _exploreDir(path: Path$1, depth: number): Promise<{
90
+ files: string[] | undefined;
91
+ depth: number;
92
+ path: string;
93
+ }>;
94
+ _formatEntry(dirent: PathOrDirent, path: Path$1): Promise<EntryInfo | undefined>;
95
+ _onError(err: Error): void;
96
+ _getEntryType(entry: EntryInfo): Promise<void | '' | 'file' | 'directory'>;
97
+ _includeAsFile(entry: EntryInfo): boolean | undefined;
98
+ }
99
+
100
+ type Path = string;
101
+ declare const EVENTS: {
102
+ readonly ALL: "all";
103
+ readonly READY: "ready";
104
+ readonly ADD: "add";
105
+ readonly CHANGE: "change";
106
+ readonly ADD_DIR: "addDir";
107
+ readonly UNLINK: "unlink";
108
+ readonly UNLINK_DIR: "unlinkDir";
109
+ readonly RAW: "raw";
110
+ readonly ERROR: "error";
111
+ };
112
+ type EventName = (typeof EVENTS)[keyof typeof EVENTS];
113
+ interface WatchHandlers {
114
+ listener: (path: string) => void;
115
+ errHandler: (err: unknown) => void;
116
+ rawEmitter: (ev: WatchEventType, path: string, opts: unknown) => void;
117
+ }
118
+ /**
119
+ * @mixin
120
+ */
121
+ declare class NodeFsHandler {
122
+ fsw: FSWatcher;
123
+ _boundHandleError: (error: unknown) => void;
124
+ constructor(fsW: FSWatcher);
125
+ /**
126
+ * Watch file for changes with fs_watchFile or fs_watch.
127
+ * @param path to file or dir
128
+ * @param listener on fs change
129
+ * @returns closer for the watcher instance
130
+ */
131
+ _watchWithNodeFs(path: string, listener: (path: string, newStats?: any) => void | Promise<void>): (() => void) | undefined;
132
+ /**
133
+ * Watch a file and emit add event if warranted.
134
+ * @returns closer for the watcher instance
135
+ */
136
+ _handleFile(file: Path, stats: Stats$1, initialAdd: boolean): (() => void) | undefined;
137
+ /**
138
+ * Handle symlinks encountered while reading a dir.
139
+ * @param entry returned by readdirp
140
+ * @param directory path of dir being read
141
+ * @param path of this item
142
+ * @param item basename of this item
143
+ * @returns true if no more processing is needed for this entry.
144
+ */
145
+ _handleSymlink(entry: EntryInfo, directory: string, path: Path, item: string): Promise<boolean | undefined>;
146
+ _handleRead(directory: string, initialAdd: boolean, wh: WatchHelper, target: Path, dir: Path, depth: number, throttler: Throttler): Promise<unknown> | undefined;
147
+ /**
148
+ * Read directory to add / remove files from `@watched` list and re-read it on change.
149
+ * @param dir fs path
150
+ * @param stats
151
+ * @param initialAdd
152
+ * @param depth relative to user-supplied path
153
+ * @param target child path targeted for watch
154
+ * @param wh Common watch helpers for this path
155
+ * @param realpath
156
+ * @returns closer for the watcher instance.
157
+ */
158
+ _handleDir(dir: string, stats: Stats$1, initialAdd: boolean, depth: number, target: string, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
159
+ /**
160
+ * Handle added file, directory, or glob pattern.
161
+ * Delegates call to _handleFile / _handleDir after checks.
162
+ * @param path to file or ir
163
+ * @param initialAdd was the file added at watch instantiation?
164
+ * @param priorWh depth relative to user-supplied path
165
+ * @param depth Child path actually targeted for watch
166
+ * @param target Child path actually targeted for watch
167
+ */
168
+ _addToNodeFs(path: string, initialAdd: boolean, priorWh: WatchHelper | undefined, depth: number, target?: string): Promise<string | false | undefined>;
169
+ }
170
+
171
+ /*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
172
+
173
+ type AWF = {
174
+ stabilityThreshold: number;
175
+ pollInterval: number;
176
+ };
177
+ type BasicOpts = {
178
+ persistent: boolean;
179
+ ignoreInitial: boolean;
180
+ followSymlinks: boolean;
181
+ cwd?: string;
182
+ usePolling: boolean;
183
+ interval: number;
184
+ binaryInterval: number;
185
+ alwaysStat?: boolean;
186
+ depth?: number;
187
+ ignorePermissionErrors: boolean;
188
+ atomic: boolean | number;
189
+ };
190
+ type Throttler = {
191
+ timeoutObject: NodeJS.Timeout;
192
+ clear: () => void;
193
+ count: number;
194
+ };
195
+ type ChokidarOptions = Partial<BasicOpts & {
196
+ ignored: Matcher | Matcher[];
197
+ awaitWriteFinish: boolean | Partial<AWF>;
198
+ }>;
199
+ type FSWInstanceOptions = BasicOpts & {
200
+ ignored: Matcher[];
201
+ awaitWriteFinish: false | AWF;
202
+ };
203
+ type ThrottleType = 'readdir' | 'watch' | 'add' | 'remove' | 'change';
204
+ type EmitArgs = [path: Path, stats?: Stats$1];
205
+ type EmitErrorArgs = [error: Error, stats?: Stats$1];
206
+ type EmitArgsWithName = [event: EventName, ...EmitArgs];
207
+ type MatchFunction = (val: string, stats?: Stats$1) => boolean;
208
+ interface MatcherObject {
209
+ path: string;
210
+ recursive?: boolean;
211
+ }
212
+ type Matcher = string | RegExp | MatchFunction | MatcherObject;
213
+ /**
214
+ * Directory entry.
215
+ */
216
+ declare class DirEntry {
217
+ path: Path;
218
+ _removeWatcher: (dir: string, base: string) => void;
219
+ items: Set<Path>;
220
+ constructor(dir: Path, removeWatcher: (dir: string, base: string) => void);
221
+ add(item: string): void;
222
+ remove(item: string): Promise<void>;
223
+ has(item: string): boolean | undefined;
224
+ getChildren(): string[];
225
+ dispose(): void;
226
+ }
227
+ declare class WatchHelper {
228
+ fsw: FSWatcher;
229
+ path: string;
230
+ watchPath: string;
231
+ fullWatchPath: string;
232
+ dirParts: string[][];
233
+ followSymlinks: boolean;
234
+ statMethod: 'stat' | 'lstat';
235
+ constructor(path: string, follow: boolean, fsw: FSWatcher);
236
+ entryPath(entry: EntryInfo): Path;
237
+ filterPath(entry: EntryInfo): boolean;
238
+ filterDir(entry: EntryInfo): boolean;
239
+ }
240
+ interface FSWatcherKnownEventMap {
241
+ [EVENTS.READY]: [];
242
+ [EVENTS.RAW]: Parameters<WatchHandlers['rawEmitter']>;
243
+ [EVENTS.ERROR]: Parameters<WatchHandlers['errHandler']>;
244
+ [EVENTS.ALL]: [event: EventName, ...EmitArgs];
245
+ }
246
+ type FSWatcherEventMap = FSWatcherKnownEventMap & {
247
+ [k in Exclude<EventName, keyof FSWatcherKnownEventMap>]: EmitArgs;
248
+ };
249
+ /**
250
+ * Watches files & directories for changes. Emitted events:
251
+ * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
252
+ *
253
+ * new FSWatcher()
254
+ * .add(directories)
255
+ * .on('add', path => log('File', path, 'was added'))
256
+ */
257
+ declare class FSWatcher extends EventEmitter<FSWatcherEventMap> {
258
+ closed: boolean;
259
+ options: FSWInstanceOptions;
260
+ _closers: Map<string, Array<any>>;
261
+ _ignoredPaths: Set<Matcher>;
262
+ _throttled: Map<ThrottleType, Map<any, any>>;
263
+ _streams: Set<ReaddirpStream>;
264
+ _symlinkPaths: Map<Path, string | boolean>;
265
+ _watched: Map<string, DirEntry>;
266
+ _pendingWrites: Map<string, any>;
267
+ _pendingUnlinks: Map<string, EmitArgsWithName>;
268
+ _readyCount: number;
269
+ _emitReady: () => void;
270
+ _closePromise?: Promise<void>;
271
+ _userIgnored?: MatchFunction;
272
+ _readyEmitted: boolean;
273
+ _emitRaw: WatchHandlers['rawEmitter'];
274
+ _boundRemove: (dir: string, item: string) => void;
275
+ _nodeFsHandler: NodeFsHandler;
276
+ constructor(_opts?: ChokidarOptions);
277
+ _addIgnoredPath(matcher: Matcher): void;
278
+ _removeIgnoredPath(matcher: Matcher): void;
279
+ /**
280
+ * Adds paths to be watched on an existing FSWatcher instance.
281
+ * @param paths_ file or file list. Other arguments are unused
282
+ */
283
+ add(paths_: Path | Path[], _origAdd?: string, _internal?: boolean): FSWatcher;
284
+ /**
285
+ * Close watchers or start ignoring events from specified paths.
286
+ */
287
+ unwatch(paths_: Path | Path[]): FSWatcher;
288
+ /**
289
+ * Close watchers and remove all listeners from watched paths.
290
+ */
291
+ close(): Promise<void>;
292
+ /**
293
+ * Expose list of watched paths
294
+ * @returns for chaining
295
+ */
296
+ getWatched(): Record<string, string[]>;
297
+ emitWithAll(event: EventName, args: EmitArgs): void;
298
+ /**
299
+ * Normalize and emit events.
300
+ * Calling _emit DOES NOT MEAN emit() would be called!
301
+ * @param event Type of event
302
+ * @param path File or directory path
303
+ * @param stats arguments to be passed with event
304
+ * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
305
+ */
306
+ _emit(event: EventName, path: Path, stats?: Stats$1): Promise<this | undefined>;
307
+ /**
308
+ * Common handler for errors
309
+ * @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
310
+ */
311
+ _handleError(error: Error): Error | boolean;
312
+ /**
313
+ * Helper utility for throttling
314
+ * @param actionType type being throttled
315
+ * @param path being acted upon
316
+ * @param timeout duration of time to suppress duplicate actions
317
+ * @returns tracking object or false if action should be suppressed
318
+ */
319
+ _throttle(actionType: ThrottleType, path: Path, timeout: number): Throttler | false;
320
+ _incrReadyCount(): number;
321
+ /**
322
+ * Awaits write operation to finish.
323
+ * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
324
+ * @param path being acted upon
325
+ * @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
326
+ * @param event
327
+ * @param awfEmit Callback to be called when ready for event to be emitted.
328
+ */
329
+ _awaitWriteFinish(path: Path, threshold: number, event: EventName, awfEmit: (err?: Error, stat?: Stats$1) => void): void;
330
+ /**
331
+ * Determines whether user has asked to ignore this path.
332
+ */
333
+ _isIgnored(path: Path, stats?: Stats$1): boolean;
334
+ _isntIgnored(path: Path, stat?: Stats$1): boolean;
335
+ /**
336
+ * Provides a set of common helpers and properties relating to symlink handling.
337
+ * @param path file or directory pattern being watched
338
+ */
339
+ _getWatchHelpers(path: Path): WatchHelper;
340
+ /**
341
+ * Provides directory tracking objects
342
+ * @param directory path of the directory
343
+ */
344
+ _getWatchedDir(directory: string): DirEntry;
345
+ /**
346
+ * Check for read permissions: https://stackoverflow.com/a/11781404/1358405
347
+ */
348
+ _hasReadPermissions(stats: Stats$1): boolean;
349
+ /**
350
+ * Handles emitting unlink events for
351
+ * files and directories, and via recursion, for
352
+ * files and directories within directories that are unlinked
353
+ * @param directory within which the following item is located
354
+ * @param item base path of item/directory
355
+ */
356
+ _remove(directory: string, item: string, isDirectory?: boolean): void;
357
+ /**
358
+ * Closes all watchers for a path
359
+ */
360
+ _closePath(path: Path): void;
361
+ /**
362
+ * Closes only file-specific watchers
363
+ */
364
+ _closeFile(path: Path): void;
365
+ _addPathCloser(path: Path, closer: () => void): void;
366
+ _readdirp(root: Path, opts?: Partial<ReaddirpOptions>): ReaddirpStream | undefined;
367
+ }
368
+ /**
369
+ * Instantiates watcher with paths to be tracked.
370
+ * @param paths file / directory paths
371
+ * @param options opts, such as `atomic`, `awaitWriteFinish`, `ignored`, and others
372
+ * @returns an instance of FSWatcher for chaining.
373
+ * @example
374
+ * const watcher = watch('.').on('all', (event, path) => { console.log(event, path); });
375
+ * watch('.', { atomic: true, awaitWriteFinish: true, ignored: (f, stats) => stats?.isFile() && !f.endsWith('.js') })
376
+ */
377
+ declare function watch(paths: string | string[], options?: ChokidarOptions): FSWatcher;
378
+ declare const _default: {
379
+ watch: typeof watch;
380
+ FSWatcher: typeof FSWatcher;
381
+ };
382
+
383
+ export { FSWatcher, WatchHelper, _default as default, watch };
384
+ export type { ChokidarOptions, EmitArgs, EmitArgsWithName, EmitErrorArgs, FSWInstanceOptions, FSWatcherEventMap, FSWatcherKnownEventMap, MatchFunction, Matcher, MatcherObject, ThrottleType, Throttler };