@unpackjs/core 1.5.3 → 1.6.0

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 (238) hide show
  1. package/bin/openChrome.applescript +94 -0
  2. package/compiled/chokidar/index.d.ts +327 -0
  3. package/compiled/chokidar/index.js +1773 -0
  4. package/compiled/chokidar/license +21 -0
  5. package/compiled/chokidar/package.json +1 -0
  6. package/compiled/commander/index.d.ts +971 -0
  7. package/compiled/commander/index.js +2190 -0
  8. package/compiled/commander/license +22 -0
  9. package/compiled/commander/package.json +1 -0
  10. package/compiled/css-loader/api.js +85 -0
  11. package/compiled/css-loader/getUrl.js +26 -0
  12. package/compiled/css-loader/index.d.ts +1 -0
  13. package/compiled/css-loader/index.js +8004 -0
  14. package/compiled/css-loader/license +20 -0
  15. package/compiled/css-loader/noSourceMaps.js +5 -0
  16. package/compiled/css-loader/package.json +1 -0
  17. package/compiled/css-loader/sourceMaps.js +16 -0
  18. package/compiled/fast-glob/index.d.ts +237 -0
  19. package/compiled/fast-glob/index.js +5726 -0
  20. package/compiled/fast-glob/license +21 -0
  21. package/compiled/fast-glob/package.json +1 -0
  22. package/compiled/less-loader/index.d.ts +1 -0
  23. package/compiled/less-loader/index.js +340 -0
  24. package/compiled/less-loader/license +20 -0
  25. package/compiled/less-loader/package.json +1 -0
  26. package/compiled/line-diff/index.d.ts +1 -0
  27. package/compiled/line-diff/index.js +160 -0
  28. package/compiled/line-diff/license +21 -0
  29. package/compiled/line-diff/package.json +1 -0
  30. package/compiled/log-update/index.d.ts +1 -0
  31. package/compiled/log-update/index.js +1970 -0
  32. package/compiled/log-update/package.json +1 -0
  33. package/compiled/portfinder/index.d.ts +64 -0
  34. package/compiled/portfinder/index.js +3401 -0
  35. package/compiled/portfinder/license +22 -0
  36. package/compiled/portfinder/package.json +1 -0
  37. package/compiled/postcss-loader/index.d.ts +1 -0
  38. package/compiled/postcss-loader/index.js +94945 -0
  39. package/compiled/postcss-loader/license +20 -0
  40. package/compiled/postcss-loader/package.json +1 -0
  41. package/compiled/sass-loader/index.d.ts +961 -0
  42. package/compiled/sass-loader/index.js +5610 -0
  43. package/compiled/sass-loader/index1.js +65 -0
  44. package/compiled/sass-loader/license +20 -0
  45. package/compiled/sass-loader/package.json +1 -0
  46. package/compiled/sass-loader/sass.node.js +12 -0
  47. package/compiled/semver/index.d.ts +1 -0
  48. package/compiled/semver/index.js +1940 -0
  49. package/compiled/semver/license +15 -0
  50. package/compiled/semver/package.json +1 -0
  51. package/compiled/style-loader/index.d.ts +1 -0
  52. package/compiled/style-loader/index.js +370 -0
  53. package/compiled/style-loader/license +20 -0
  54. package/compiled/style-loader/package.json +1 -0
  55. package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
  56. package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
  57. package/compiled/style-loader/runtime/insertBySelector.js +34 -0
  58. package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
  59. package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
  60. package/compiled/style-loader/runtime/isOldIE.js +17 -0
  61. package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
  62. package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
  63. package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
  64. package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
  65. package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
  66. package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
  67. package/compiled/webpack-bundle-analyzer/index.d.ts +1 -0
  68. package/compiled/webpack-bundle-analyzer/index.js +13276 -0
  69. package/compiled/webpack-bundle-analyzer/license +20 -0
  70. package/compiled/webpack-bundle-analyzer/package.json +1 -0
  71. package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
  72. package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
  73. package/compiled/webpack-merge/index.d.ts +31 -0
  74. package/compiled/webpack-merge/index.js +1200 -0
  75. package/compiled/webpack-merge/license +20 -0
  76. package/compiled/webpack-merge/package.json +1 -0
  77. package/dist/bundleRequire.cjs +200 -0
  78. package/dist/bundleRequire.d.ts +5 -0
  79. package/dist/bundleRequire.d.ts.map +1 -0
  80. package/dist/bundleRequire.js +173 -0
  81. package/dist/bundler-config/chunkSplit.cjs +151 -0
  82. package/dist/bundler-config/chunkSplit.d.ts +6 -0
  83. package/dist/bundler-config/chunkSplit.d.ts.map +1 -0
  84. package/dist/bundler-config/chunkSplit.js +127 -0
  85. package/dist/bundler-config/css.cjs +168 -0
  86. package/dist/bundler-config/css.d.ts +6 -0
  87. package/dist/bundler-config/css.d.ts.map +1 -0
  88. package/dist/bundler-config/css.js +158 -0
  89. package/dist/bundler-config/experimentCss.cjs +167 -0
  90. package/dist/bundler-config/experimentCss.d.ts +6 -0
  91. package/dist/bundler-config/experimentCss.d.ts.map +1 -0
  92. package/dist/bundler-config/experimentCss.js +157 -0
  93. package/dist/bundler-config/helper.cjs +81 -0
  94. package/dist/bundler-config/helper.d.ts +8 -0
  95. package/dist/bundler-config/helper.d.ts.map +1 -0
  96. package/dist/bundler-config/helper.js +56 -0
  97. package/dist/bundler-config/index.cjs +206 -0
  98. package/dist/bundler-config/index.d.ts +3 -0
  99. package/dist/bundler-config/index.d.ts.map +1 -0
  100. package/dist/bundler-config/index.js +190 -0
  101. package/dist/colors.cjs +60 -0
  102. package/dist/colors.d.ts +6 -0
  103. package/dist/colors.d.ts.map +1 -0
  104. package/dist/colors.js +40 -0
  105. package/dist/{config/index.cjs → config.cjs} +28 -21
  106. package/dist/{config/index.d.ts → config.d.ts} +4 -3
  107. package/dist/config.d.ts.map +1 -0
  108. package/dist/{config/index.js → config.js} +22 -23
  109. package/dist/constants.cjs +86 -0
  110. package/dist/constants.d.ts +25 -0
  111. package/dist/constants.d.ts.map +1 -0
  112. package/dist/constants.js +61 -0
  113. package/dist/createService.cjs +65 -0
  114. package/dist/createService.d.ts +8 -0
  115. package/dist/createService.d.ts.map +1 -0
  116. package/dist/createService.js +41 -0
  117. package/dist/index.cjs +27 -48
  118. package/dist/index.d.ts +7 -7
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +8 -51
  121. package/dist/lightningcss/cache.cjs +36 -0
  122. package/dist/lightningcss/cache.d.ts +2 -0
  123. package/dist/lightningcss/cache.d.ts.map +1 -0
  124. package/dist/lightningcss/cache.js +22 -0
  125. package/dist/lightningcss/index.cjs +21 -0
  126. package/dist/lightningcss/index.d.ts +2 -0
  127. package/dist/lightningcss/index.d.ts.map +1 -0
  128. package/dist/lightningcss/index.js +10 -0
  129. package/dist/lightningcss/loader.cjs +56 -0
  130. package/dist/lightningcss/loader.d.ts +5 -0
  131. package/dist/lightningcss/loader.d.ts.map +1 -0
  132. package/dist/lightningcss/loader.js +36 -0
  133. package/dist/lightningcss/minimizer.cjs +114 -0
  134. package/dist/lightningcss/minimizer.d.ts +11 -0
  135. package/dist/lightningcss/minimizer.d.ts.map +1 -0
  136. package/dist/lightningcss/minimizer.js +90 -0
  137. package/dist/logger.cjs +103 -0
  138. package/dist/logger.d.ts +3 -0
  139. package/dist/logger.d.ts.map +1 -0
  140. package/dist/logger.js +79 -0
  141. package/dist/openBrowser.cjs +85 -0
  142. package/dist/openBrowser.d.ts +2 -0
  143. package/dist/openBrowser.d.ts.map +1 -0
  144. package/dist/openBrowser.js +61 -0
  145. package/dist/plugin-progress/rspack.cjs +74 -0
  146. package/dist/plugin-progress/rspack.d.ts +9 -0
  147. package/dist/plugin-progress/rspack.d.ts.map +1 -0
  148. package/dist/plugin-progress/rspack.js +50 -0
  149. package/dist/plugin-progress/webpack.cjs +84 -0
  150. package/dist/plugin-progress/webpack.d.ts +9 -0
  151. package/dist/plugin-progress/webpack.d.ts.map +1 -0
  152. package/dist/plugin-progress/webpack.js +60 -0
  153. package/dist/plugin.cjs +33 -0
  154. package/dist/plugin.d.ts +3 -0
  155. package/dist/plugin.d.ts.map +1 -0
  156. package/dist/plugin.js +19 -0
  157. package/dist/progressBar.cjs +70 -0
  158. package/dist/progressBar.d.ts +14 -0
  159. package/dist/progressBar.d.ts.map +1 -0
  160. package/dist/progressBar.js +46 -0
  161. package/dist/reporter.cjs +133 -0
  162. package/dist/reporter.d.ts +8 -0
  163. package/dist/reporter.d.ts.map +1 -0
  164. package/dist/reporter.js +109 -0
  165. package/dist/run/build.cjs +77 -0
  166. package/dist/run/build.d.ts +3 -0
  167. package/dist/run/build.d.ts.map +1 -0
  168. package/dist/run/build.js +53 -0
  169. package/dist/run/dev.cjs +107 -0
  170. package/dist/run/dev.d.ts +3 -0
  171. package/dist/run/dev.d.ts.map +1 -0
  172. package/dist/run/dev.js +83 -0
  173. package/dist/run/index.cjs +23 -0
  174. package/dist/run/index.d.ts +3 -0
  175. package/dist/run/index.d.ts.map +1 -0
  176. package/dist/run/index.js +11 -0
  177. package/dist/thread-loader/WorkerError.cjs +41 -0
  178. package/dist/thread-loader/WorkerError.js +31 -0
  179. package/dist/thread-loader/WorkerPool.cjs +407 -0
  180. package/dist/thread-loader/WorkerPool.js +387 -0
  181. package/dist/thread-loader/index.cjs +100 -0
  182. package/dist/thread-loader/index.js +85 -0
  183. package/dist/thread-loader/readBuffer.cjs +55 -0
  184. package/dist/thread-loader/readBuffer.js +45 -0
  185. package/dist/thread-loader/serializer.cjs +46 -0
  186. package/dist/thread-loader/serializer.js +31 -0
  187. package/dist/thread-loader/utils.cjs +84 -0
  188. package/dist/thread-loader/utils.js +60 -0
  189. package/dist/thread-loader/worker.cjs +377 -0
  190. package/dist/thread-loader/worker.js +382 -0
  191. package/dist/thread-loader/workerPools.cjs +57 -0
  192. package/dist/thread-loader/workerPools.js +33 -0
  193. package/dist/typed-css-modules/index.cjs +21 -0
  194. package/dist/typed-css-modules/index.d.ts +2 -0
  195. package/dist/typed-css-modules/index.d.ts.map +1 -0
  196. package/dist/typed-css-modules/index.js +10 -0
  197. package/dist/typed-css-modules/loader.cjs +195 -0
  198. package/dist/typed-css-modules/loader.d.ts +10 -0
  199. package/dist/typed-css-modules/loader.d.ts.map +1 -0
  200. package/dist/typed-css-modules/loader.js +170 -0
  201. package/dist/typed-css-modules/plugin.cjs +96 -0
  202. package/dist/typed-css-modules/plugin.d.ts +16 -0
  203. package/dist/typed-css-modules/plugin.d.ts.map +1 -0
  204. package/dist/typed-css-modules/plugin.js +72 -0
  205. package/dist/typed-css-modules/utils.cjs +45 -0
  206. package/dist/typed-css-modules/utils.d.ts +6 -0
  207. package/dist/typed-css-modules/utils.d.ts.map +1 -0
  208. package/dist/typed-css-modules/utils.js +31 -0
  209. package/dist/types/chunkSplit.cjs +15 -0
  210. package/dist/types/chunkSplit.d.ts +35 -0
  211. package/dist/types/chunkSplit.d.ts.map +1 -0
  212. package/dist/types/chunkSplit.js +9 -0
  213. package/dist/types/config.cjs +15 -0
  214. package/dist/types/config.d.ts +176 -0
  215. package/dist/types/config.d.ts.map +1 -0
  216. package/dist/types/config.js +9 -0
  217. package/dist/types/index.cjs +29 -0
  218. package/dist/types/index.d.ts +16 -0
  219. package/dist/types/index.d.ts.map +1 -0
  220. package/dist/types/index.js +14 -0
  221. package/dist/types/lightningcss.cjs +15 -0
  222. package/dist/types/lightningcss.d.ts +11 -0
  223. package/dist/types/lightningcss.d.ts.map +1 -0
  224. package/dist/types/lightningcss.js +9 -0
  225. package/dist/types/logger.cjs +35 -0
  226. package/dist/types/logger.d.ts +16 -0
  227. package/dist/types/logger.d.ts.map +1 -0
  228. package/dist/types/logger.js +21 -0
  229. package/dist/types/plugin.cjs +15 -0
  230. package/dist/types/plugin.d.ts +18 -0
  231. package/dist/types/plugin.d.ts.map +1 -0
  232. package/dist/types/plugin.js +9 -0
  233. package/dist/utils.cjs +293 -0
  234. package/dist/utils.d.ts +39 -0
  235. package/dist/utils.d.ts.map +1 -0
  236. package/dist/utils.js +242 -0
  237. package/package.json +95 -6
  238. package/dist/config/index.d.ts.map +0 -1
@@ -0,0 +1,94 @@
1
+ (*
2
+ Copyright (c) 2015-present, Facebook, Inc.
3
+ This source code is licensed under the MIT license found in the
4
+ LICENSE file at
5
+ https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
6
+ *)
7
+
8
+ property targetTab: null
9
+ property targetTabIndex: -1
10
+ property targetWindow: null
11
+ property theProgram: "Google Chrome"
12
+
13
+ on run argv
14
+ set theURL to item 1 of argv
15
+
16
+ -- Allow requested program to be optional,
17
+ -- default to Google Chrome
18
+ if (count of argv) > 1 then
19
+ set theProgram to item 2 of argv
20
+ end if
21
+
22
+ using terms from application "Google Chrome"
23
+ tell application theProgram
24
+
25
+ if (count every window) = 0 then
26
+ make new window
27
+ end if
28
+
29
+ -- 1: Looking for tab running debugger
30
+ -- then, Reload debugging tab if found
31
+ -- then return
32
+ set found to my lookupTabWithUrl(theURL)
33
+ if found then
34
+ set targetWindow's active tab index to targetTabIndex
35
+ tell targetTab to reload
36
+ tell targetWindow to activate
37
+ set index of targetWindow to 1
38
+ return
39
+ end if
40
+
41
+ -- 2: Looking for Empty tab
42
+ -- In case debugging tab was not found
43
+ -- We try to find an empty tab instead
44
+ set found to my lookupTabWithUrl("chrome://newtab/")
45
+ if found then
46
+ set targetWindow's active tab index to targetTabIndex
47
+ set URL of targetTab to theURL
48
+ tell targetWindow to activate
49
+ return
50
+ end if
51
+
52
+ -- 3: Create new tab
53
+ -- both debugging and empty tab were not found
54
+ -- make a new tab with url
55
+ tell window 1
56
+ activate
57
+ make new tab with properties {URL:theURL}
58
+ end tell
59
+ end tell
60
+ end using terms from
61
+ end run
62
+
63
+ -- Function:
64
+ -- Lookup tab with given url
65
+ -- if found, store tab, index, and window in properties
66
+ -- (properties were declared on top of file)
67
+ on lookupTabWithUrl(lookupUrl)
68
+ using terms from application "Google Chrome"
69
+ tell application theProgram
70
+ -- Find a tab with the given url
71
+ set found to false
72
+ set theTabIndex to -1
73
+ repeat with theWindow in every window
74
+ set theTabIndex to 0
75
+ repeat with theTab in every tab of theWindow
76
+ set theTabIndex to theTabIndex + 1
77
+ if (theTab's URL as string) contains lookupUrl then
78
+ -- assign tab, tab index, and window to properties
79
+ set targetTab to theTab
80
+ set targetTabIndex to theTabIndex
81
+ set targetWindow to theWindow
82
+ set found to true
83
+ exit repeat
84
+ end if
85
+ end repeat
86
+
87
+ if found then
88
+ exit repeat
89
+ end if
90
+ end repeat
91
+ end tell
92
+ end using terms from
93
+ return found
94
+ end lookupTabWithUrl
@@ -0,0 +1,327 @@
1
+ import { Stats, Dirent } from 'fs';
2
+ import { EventEmitter } from 'events';
3
+ import { Readable } from 'stream';
4
+
5
+ type Path$1 = string;
6
+ interface EntryInfo {
7
+ path: string;
8
+ fullPath: string;
9
+ stats?: Stats;
10
+ dirent?: Dirent;
11
+ basename: string;
12
+ }
13
+ type PathOrDirent = Dirent | Path$1;
14
+ type Tester = (path: EntryInfo) => boolean;
15
+ declare function defaultOptions(): {
16
+ root: string;
17
+ fileFilter: (_path: EntryInfo) => boolean;
18
+ directoryFilter: (_path: EntryInfo) => boolean;
19
+ type: string;
20
+ lstat: boolean;
21
+ depth: number;
22
+ alwaysStat: boolean;
23
+ highWaterMark: number;
24
+ };
25
+ type ReaddirpOptions = ReturnType<typeof defaultOptions>;
26
+ interface DirEntry$1 {
27
+ files: PathOrDirent[];
28
+ depth: number;
29
+ path: Path$1;
30
+ }
31
+ declare class ReaddirpStream extends Readable {
32
+ parents: any[];
33
+ reading: boolean;
34
+ parent?: DirEntry$1;
35
+ _stat: Function;
36
+ _maxDepth: number;
37
+ _wantsDir: boolean;
38
+ _wantsFile: boolean;
39
+ _wantsEverything: boolean;
40
+ _root: Path$1;
41
+ _isDirent: boolean;
42
+ _statsProp: 'dirent' | 'stats';
43
+ _rdOptions: {
44
+ encoding: 'utf8';
45
+ withFileTypes: boolean;
46
+ };
47
+ _fileFilter: Tester;
48
+ _directoryFilter: Tester;
49
+ constructor(options?: Partial<ReaddirpOptions>);
50
+ _read(batch: number): Promise<void>;
51
+ _exploreDir(path: Path$1, depth: number): Promise<{
52
+ files: string[] | undefined;
53
+ depth: number;
54
+ path: string;
55
+ }>;
56
+ _formatEntry(dirent: PathOrDirent, path: Path$1): EntryInfo | undefined;
57
+ _onError(err: Error): void;
58
+ _getEntryType(entry: EntryInfo): Promise<void | "" | "file" | "directory">;
59
+ _includeAsFile(entry: EntryInfo): boolean | undefined;
60
+ }
61
+
62
+ type Path = string;
63
+ declare const EVENTS: {
64
+ readonly ALL: "all";
65
+ readonly READY: "ready";
66
+ readonly ADD: "add";
67
+ readonly CHANGE: "change";
68
+ readonly ADD_DIR: "addDir";
69
+ readonly UNLINK: "unlink";
70
+ readonly UNLINK_DIR: "unlinkDir";
71
+ readonly RAW: "raw";
72
+ readonly ERROR: "error";
73
+ };
74
+ type EventName = (typeof EVENTS)[keyof typeof EVENTS];
75
+ /**
76
+ * @mixin
77
+ */
78
+ declare class NodeFsHandler {
79
+ fsw: FSWatcher;
80
+ _boundHandleError: (error: unknown) => void;
81
+ constructor(fsW: FSWatcher);
82
+ /**
83
+ * Watch file for changes with fs_watchFile or fs_watch.
84
+ * @param path to file or dir
85
+ * @param listener on fs change
86
+ * @returns closer for the watcher instance
87
+ */
88
+ _watchWithNodeFs(path: string, listener: (path: string, newStats?: any) => void | Promise<void>): (() => void) | undefined;
89
+ /**
90
+ * Watch a file and emit add event if warranted.
91
+ * @returns closer for the watcher instance
92
+ */
93
+ _handleFile(file: Path, stats: Stats, initialAdd: boolean): (() => void) | undefined;
94
+ /**
95
+ * Handle symlinks encountered while reading a dir.
96
+ * @param entry returned by readdirp
97
+ * @param directory path of dir being read
98
+ * @param path of this item
99
+ * @param item basename of this item
100
+ * @returns true if no more processing is needed for this entry.
101
+ */
102
+ _handleSymlink(entry: EntryInfo, directory: string, path: Path, item: string): Promise<boolean | undefined>;
103
+ _handleRead(directory: string, initialAdd: boolean, wh: WatchHelper, target: Path, dir: Path, depth: number, throttler: Throttler): Promise<unknown> | undefined;
104
+ /**
105
+ * Read directory to add / remove files from `@watched` list and re-read it on change.
106
+ * @param dir fs path
107
+ * @param stats
108
+ * @param initialAdd
109
+ * @param depth relative to user-supplied path
110
+ * @param target child path targeted for watch
111
+ * @param wh Common watch helpers for this path
112
+ * @param realpath
113
+ * @returns closer for the watcher instance.
114
+ */
115
+ _handleDir(dir: string, stats: Stats, initialAdd: boolean, depth: number, target: string, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
116
+ /**
117
+ * Handle added file, directory, or glob pattern.
118
+ * Delegates call to _handleFile / _handleDir after checks.
119
+ * @param path to file or ir
120
+ * @param initialAdd was the file added at watch instantiation?
121
+ * @param priorWh depth relative to user-supplied path
122
+ * @param depth Child path actually targeted for watch
123
+ * @param target Child path actually targeted for watch
124
+ */
125
+ _addToNodeFs(path: string, initialAdd: boolean, priorWh: WatchHelper | undefined, depth: number, target?: string): Promise<string | false | undefined>;
126
+ }
127
+
128
+ type AWF = {
129
+ stabilityThreshold: number;
130
+ pollInterval: number;
131
+ };
132
+ type BasicOpts = {
133
+ persistent: boolean;
134
+ ignoreInitial: boolean;
135
+ followSymlinks: boolean;
136
+ cwd?: string;
137
+ usePolling: boolean;
138
+ interval: number;
139
+ binaryInterval: number;
140
+ alwaysStat?: boolean;
141
+ depth?: number;
142
+ ignorePermissionErrors: boolean;
143
+ atomic: boolean | number;
144
+ };
145
+ type Throttler = {
146
+ timeoutObject: NodeJS.Timeout;
147
+ clear: () => void;
148
+ count: number;
149
+ };
150
+ type ChokidarOptions = Partial<BasicOpts & {
151
+ ignored: Matcher | Matcher[];
152
+ awaitWriteFinish: boolean | Partial<AWF>;
153
+ }>;
154
+ type FSWInstanceOptions = BasicOpts & {
155
+ ignored: Matcher[];
156
+ awaitWriteFinish: false | AWF;
157
+ };
158
+ type ThrottleType = 'readdir' | 'watch' | 'add' | 'remove' | 'change';
159
+ type EmitArgs = [EventName, Path | Error, any?, any?, any?];
160
+ type MatchFunction = (val: string, stats?: Stats) => boolean;
161
+ interface MatcherObject {
162
+ path: string;
163
+ recursive?: boolean;
164
+ }
165
+ type Matcher = string | RegExp | MatchFunction | MatcherObject;
166
+ /**
167
+ * Directory entry.
168
+ */
169
+ declare class DirEntry {
170
+ path: Path;
171
+ _removeWatcher: (dir: string, base: string) => void;
172
+ items: Set<Path>;
173
+ constructor(dir: Path, removeWatcher: (dir: string, base: string) => void);
174
+ add(item: string): void;
175
+ remove(item: string): Promise<void>;
176
+ has(item: string): boolean | undefined;
177
+ getChildren(): string[];
178
+ dispose(): void;
179
+ }
180
+ declare class WatchHelper {
181
+ fsw: FSWatcher;
182
+ path: string;
183
+ watchPath: string;
184
+ fullWatchPath: string;
185
+ dirParts: string[][];
186
+ followSymlinks: boolean;
187
+ statMethod: 'stat' | 'lstat';
188
+ constructor(path: string, follow: boolean, fsw: FSWatcher);
189
+ entryPath(entry: EntryInfo): Path;
190
+ filterPath(entry: EntryInfo): boolean;
191
+ filterDir(entry: EntryInfo): boolean;
192
+ }
193
+ /**
194
+ * Watches files & directories for changes. Emitted events:
195
+ * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
196
+ *
197
+ * new FSWatcher()
198
+ * .add(directories)
199
+ * .on('add', path => log('File', path, 'was added'))
200
+ */
201
+ declare class FSWatcher extends EventEmitter {
202
+ closed: boolean;
203
+ options: FSWInstanceOptions;
204
+ _closers: Map<string, Array<any>>;
205
+ _ignoredPaths: Set<Matcher>;
206
+ _throttled: Map<ThrottleType, Map<any, any>>;
207
+ _streams: Set<ReaddirpStream>;
208
+ _symlinkPaths: Map<Path, string | boolean>;
209
+ _watched: Map<string, DirEntry>;
210
+ _pendingWrites: Map<string, any>;
211
+ _pendingUnlinks: Map<string, EmitArgs>;
212
+ _readyCount: number;
213
+ _emitReady: () => void;
214
+ _closePromise?: Promise<void>;
215
+ _userIgnored?: MatchFunction;
216
+ _readyEmitted: boolean;
217
+ _emitRaw: () => void;
218
+ _boundRemove: (dir: string, item: string) => void;
219
+ _nodeFsHandler: NodeFsHandler;
220
+ constructor(_opts?: ChokidarOptions);
221
+ _addIgnoredPath(matcher: Matcher): void;
222
+ _removeIgnoredPath(matcher: Matcher): void;
223
+ /**
224
+ * Adds paths to be watched on an existing FSWatcher instance.
225
+ * @param paths_ file or file list. Other arguments are unused
226
+ */
227
+ add(paths_: Path | Path[], _origAdd?: string, _internal?: boolean): FSWatcher;
228
+ /**
229
+ * Close watchers or start ignoring events from specified paths.
230
+ */
231
+ unwatch(paths_: Path | Path[]): FSWatcher;
232
+ /**
233
+ * Close watchers and remove all listeners from watched paths.
234
+ */
235
+ close(): Promise<void>;
236
+ /**
237
+ * Expose list of watched paths
238
+ * @returns for chaining
239
+ */
240
+ getWatched(): Record<string, string[]>;
241
+ emitWithAll(event: EventName, args: EmitArgs): void;
242
+ /**
243
+ * Normalize and emit events.
244
+ * Calling _emit DOES NOT MEAN emit() would be called!
245
+ * @param event Type of event
246
+ * @param path File or directory path
247
+ * @param stats arguments to be passed with event
248
+ * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
249
+ */
250
+ _emit(event: EventName, path: Path, stats?: Stats): Promise<this | undefined>;
251
+ /**
252
+ * Common handler for errors
253
+ * @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
254
+ */
255
+ _handleError(error: Error): Error | boolean;
256
+ /**
257
+ * Helper utility for throttling
258
+ * @param actionType type being throttled
259
+ * @param path being acted upon
260
+ * @param timeout duration of time to suppress duplicate actions
261
+ * @returns tracking object or false if action should be suppressed
262
+ */
263
+ _throttle(actionType: ThrottleType, path: Path, timeout: number): Throttler | false;
264
+ _incrReadyCount(): number;
265
+ /**
266
+ * Awaits write operation to finish.
267
+ * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
268
+ * @param path being acted upon
269
+ * @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
270
+ * @param event
271
+ * @param awfEmit Callback to be called when ready for event to be emitted.
272
+ */
273
+ _awaitWriteFinish(path: Path, threshold: number, event: EventName, awfEmit: (err?: Error, stat?: Stats) => void): void;
274
+ /**
275
+ * Determines whether user has asked to ignore this path.
276
+ */
277
+ _isIgnored(path: Path, stats?: Stats): boolean;
278
+ _isntIgnored(path: Path, stat?: Stats): boolean;
279
+ /**
280
+ * Provides a set of common helpers and properties relating to symlink handling.
281
+ * @param path file or directory pattern being watched
282
+ */
283
+ _getWatchHelpers(path: Path): WatchHelper;
284
+ /**
285
+ * Provides directory tracking objects
286
+ * @param directory path of the directory
287
+ */
288
+ _getWatchedDir(directory: string): DirEntry;
289
+ /**
290
+ * Check for read permissions: https://stackoverflow.com/a/11781404/1358405
291
+ */
292
+ _hasReadPermissions(stats: Stats): boolean;
293
+ /**
294
+ * Handles emitting unlink events for
295
+ * files and directories, and via recursion, for
296
+ * files and directories within directories that are unlinked
297
+ * @param directory within which the following item is located
298
+ * @param item base path of item/directory
299
+ */
300
+ _remove(directory: string, item: string, isDirectory?: boolean): void;
301
+ /**
302
+ * Closes all watchers for a path
303
+ */
304
+ _closePath(path: Path): void;
305
+ /**
306
+ * Closes only file-specific watchers
307
+ */
308
+ _closeFile(path: Path): void;
309
+ _addPathCloser(path: Path, closer: () => void): void;
310
+ _readdirp(root: Path, opts?: Partial<ReaddirpOptions>): ReaddirpStream | undefined;
311
+ }
312
+ /**
313
+ * Instantiates watcher with paths to be tracked.
314
+ * @param paths file / directory paths
315
+ * @param options opts, such as `atomic`, `awaitWriteFinish`, `ignored`, and others
316
+ * @returns an instance of FSWatcher for chaining.
317
+ * @example
318
+ * const watcher = watch('.').on('all', (event, path) => { console.log(event, path); });
319
+ * watch('.', { atomic: true, awaitWriteFinish: true, ignored: (f, stats) => stats?.isFile() && !f.endsWith('.js') })
320
+ */
321
+ declare function watch(paths: string | string[], options?: ChokidarOptions): FSWatcher;
322
+ declare const _default: {
323
+ watch: typeof watch;
324
+ FSWatcher: typeof FSWatcher;
325
+ };
326
+
327
+ export { type ChokidarOptions, type EmitArgs, type FSWInstanceOptions, FSWatcher, type MatchFunction, type Matcher, type MatcherObject, type ThrottleType, type Throttler, WatchHelper, _default as default, watch };