@ohos-ports/rsbuild-core 1.1.14-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.
- package/LICENSE +21 -0
- package/README.md +28 -0
- package/bin/rsbuild.js +20 -0
- package/compiled/chokidar/index.d.ts +345 -0
- package/compiled/chokidar/index.js +1778 -0
- package/compiled/chokidar/license +21 -0
- package/compiled/chokidar/package.json +1 -0
- package/compiled/connect/index.d.ts +90 -0
- package/compiled/connect/index.js +1240 -0
- package/compiled/connect/license +25 -0
- package/compiled/connect/package.json +1 -0
- package/compiled/connect-history-api-fallback/index.d.ts +1 -0
- package/compiled/connect-history-api-fallback/index.js +149 -0
- package/compiled/connect-history-api-fallback/license +21 -0
- package/compiled/connect-history-api-fallback/package.json +1 -0
- package/compiled/cors/index.d.ts +1 -0
- package/compiled/cors/index.js +371 -0
- package/compiled/cors/license +22 -0
- package/compiled/cors/package.json +1 -0
- package/compiled/css-loader/api.js +85 -0
- package/compiled/css-loader/getUrl.js +26 -0
- package/compiled/css-loader/index.d.ts +1 -0
- package/compiled/css-loader/index.js +8008 -0
- package/compiled/css-loader/license +20 -0
- package/compiled/css-loader/noSourceMaps.js +5 -0
- package/compiled/css-loader/package.json +1 -0
- package/compiled/css-loader/sourceMaps.js +16 -0
- package/compiled/html-rspack-plugin/default_index.ejs +9 -0
- package/compiled/html-rspack-plugin/index.d.ts +289 -0
- package/compiled/html-rspack-plugin/index.js +1583 -0
- package/compiled/html-rspack-plugin/license +20 -0
- package/compiled/html-rspack-plugin/loader.js +162 -0
- package/compiled/html-rspack-plugin/package.json +1 -0
- package/compiled/http-proxy-middleware/index.d.ts +318 -0
- package/compiled/http-proxy-middleware/index.js +5280 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/jiti/index.d.ts +1 -0
- package/compiled/jiti/index.js +416 -0
- package/compiled/jiti/license +21 -0
- package/compiled/jiti/package.json +1 -0
- package/compiled/launch-editor-middleware/index.d.ts +1 -0
- package/compiled/launch-editor-middleware/index.js +694 -0
- package/compiled/launch-editor-middleware/license +21 -0
- package/compiled/launch-editor-middleware/package.json +1 -0
- package/compiled/mrmime/index.d.ts +4 -0
- package/compiled/mrmime/index.js +452 -0
- package/compiled/mrmime/package.json +1 -0
- package/compiled/on-finished/index.d.ts +13 -0
- package/compiled/on-finished/index.js +197 -0
- package/compiled/on-finished/license +23 -0
- package/compiled/on-finished/package.json +1 -0
- package/compiled/open/index.d.ts +153 -0
- package/compiled/open/index.js +409 -0
- package/compiled/open/package.json +1 -0
- package/compiled/open/xdg-open +1066 -0
- package/compiled/picocolors/index.d.ts +55 -0
- package/compiled/picocolors/index.js +108 -0
- package/compiled/picocolors/license +15 -0
- package/compiled/picocolors/package.json +1 -0
- package/compiled/postcss/index.d.ts +1 -0
- package/compiled/postcss/index.js +5997 -0
- package/compiled/postcss/license +20 -0
- package/compiled/postcss/package.json +1 -0
- package/compiled/postcss-load-config/index.d.ts +1 -0
- package/compiled/postcss-load-config/index.js +739 -0
- package/compiled/postcss-load-config/license +20 -0
- package/compiled/postcss-load-config/package.json +1 -0
- package/compiled/postcss-loader/index.d.ts +1 -0
- package/compiled/postcss-loader/index.js +741 -0
- package/compiled/postcss-loader/license +20 -0
- package/compiled/postcss-loader/package.json +1 -0
- package/compiled/rsbuild-dev-middleware/index.d.ts +1 -0
- package/compiled/rsbuild-dev-middleware/index.js +6158 -0
- package/compiled/rsbuild-dev-middleware/license +20 -0
- package/compiled/rsbuild-dev-middleware/package.json +1 -0
- package/compiled/rslog/index.d.ts +66 -0
- package/compiled/rslog/index.js +334 -0
- package/compiled/rslog/license +21 -0
- package/compiled/rslog/package.json +1 -0
- package/compiled/rspack-chain/index.d.ts +611 -0
- package/compiled/rspack-chain/index.js +1740 -0
- package/compiled/rspack-chain/license +373 -0
- package/compiled/rspack-chain/package.json +1 -0
- package/compiled/rspack-manifest-plugin/index.d.ts +44 -0
- package/compiled/rspack-manifest-plugin/index.js +394 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/sirv/index.d.ts +1 -0
- package/compiled/sirv/index.js +709 -0
- package/compiled/sirv/package.json +1 -0
- package/compiled/style-loader/index.d.ts +1 -0
- package/compiled/style-loader/index.js +427 -0
- package/compiled/style-loader/license +20 -0
- package/compiled/style-loader/package.json +1 -0
- package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
- package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
- package/compiled/style-loader/runtime/insertBySelector.js +34 -0
- package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
- package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
- package/compiled/style-loader/runtime/isOldIE.js +17 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
- package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
- package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
- package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
- package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
- package/compiled/tinyglobby/index.d.ts +25 -0
- package/compiled/tinyglobby/index.js +2749 -0
- package/compiled/tinyglobby/index1.js +17 -0
- package/compiled/tinyglobby/license +21 -0
- package/compiled/tinyglobby/package.json +1 -0
- package/compiled/webpack-bundle-analyzer/index.d.ts +160 -0
- package/compiled/webpack-bundle-analyzer/index.js +13480 -0
- package/compiled/webpack-bundle-analyzer/license +20 -0
- package/compiled/webpack-bundle-analyzer/package.json +1 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
- package/compiled/webpack-merge/index.d.ts +31 -0
- package/compiled/webpack-merge/index.js +1200 -0
- package/compiled/webpack-merge/license +20 -0
- package/compiled/webpack-merge/package.json +1 -0
- package/compiled/ws/index.d.ts +401 -0
- package/compiled/ws/index.js +3153 -0
- package/compiled/ws/license +20 -0
- package/compiled/ws/package.json +1 -0
- package/dist/client/hmr.js +143 -0
- package/dist/client/overlay.js +210 -0
- package/dist/ignoreCssLoader.mjs +4 -0
- package/dist/index.cjs +7251 -0
- package/dist/index.js +7118 -0
- package/dist/transformLoader.mjs +22 -0
- package/dist/transformRawLoader.mjs +22 -0
- package/dist-types/cli/commands.d.ts +23 -0
- package/dist-types/cli/index.d.ts +1 -0
- package/dist-types/cli/init.d.ts +7 -0
- package/dist-types/cli/prepare.d.ts +1 -0
- package/dist-types/client/hmr.d.ts +1 -0
- package/dist-types/client/overlay.d.ts +1 -0
- package/dist-types/config.d.ts +90 -0
- package/dist-types/configChain.d.ts +139 -0
- package/dist-types/constants.d.ts +37 -0
- package/dist-types/createContext.d.ts +11 -0
- package/dist-types/createRsbuild.d.ts +2 -0
- package/dist-types/helpers/format.d.ts +5 -0
- package/dist-types/helpers/fs.d.ts +13 -0
- package/dist-types/helpers/index.d.ts +47 -0
- package/dist-types/helpers/path.d.ts +11 -0
- package/dist-types/helpers/stats.d.ts +9 -0
- package/dist-types/hooks.d.ts +48 -0
- package/dist-types/index.d.ts +26 -0
- package/dist-types/initPlugins.d.ts +6 -0
- package/dist-types/internal.d.ts +6 -0
- package/dist-types/loadEnv.d.ts +50 -0
- package/dist-types/loader/ignoreCssLoader.d.ts +2 -0
- package/dist-types/loader/transformLoader.d.ts +7 -0
- package/dist-types/loader/transformRawLoader.d.ts +3 -0
- package/dist-types/logger.d.ts +4 -0
- package/dist-types/mergeConfig.d.ts +2 -0
- package/dist-types/package.json +1 -0
- package/dist-types/pluginHelper.d.ts +12 -0
- package/dist-types/pluginManager.d.ts +9 -0
- package/dist-types/plugins/appIcon.d.ts +2 -0
- package/dist-types/plugins/asset.d.ts +3 -0
- package/dist-types/plugins/basic.d.ts +5 -0
- package/dist-types/plugins/bundleAnalyzer.d.ts +2 -0
- package/dist-types/plugins/cache.d.ts +2 -0
- package/dist-types/plugins/cleanOutput.d.ts +3 -0
- package/dist-types/plugins/css.d.ts +3 -0
- package/dist-types/plugins/define.d.ts +2 -0
- package/dist-types/plugins/entry.d.ts +2 -0
- package/dist-types/plugins/externals.d.ts +2 -0
- package/dist-types/plugins/fileSize.d.ts +4 -0
- package/dist-types/plugins/html.d.ts +9 -0
- package/dist-types/plugins/inlineChunk.d.ts +2 -0
- package/dist-types/plugins/lazyCompilation.d.ts +2 -0
- package/dist-types/plugins/manifest.d.ts +2 -0
- package/dist-types/plugins/minimize.d.ts +10 -0
- package/dist-types/plugins/moduleFederation.d.ts +2 -0
- package/dist-types/plugins/moment.d.ts +2 -0
- package/dist-types/plugins/nodeAddons.d.ts +2 -0
- package/dist-types/plugins/nonce.d.ts +2 -0
- package/dist-types/plugins/output.d.ts +2 -0
- package/dist-types/plugins/performance.d.ts +5 -0
- package/dist-types/plugins/progress.d.ts +2 -0
- package/dist-types/plugins/resolve.d.ts +2 -0
- package/dist-types/plugins/resourceHints.d.ts +2 -0
- package/dist-types/plugins/rsdoctor.d.ts +2 -0
- package/dist-types/plugins/rspackProfile.d.ts +2 -0
- package/dist-types/plugins/server.d.ts +2 -0
- package/dist-types/plugins/splitChunks.d.ts +4 -0
- package/dist-types/plugins/sri.d.ts +2 -0
- package/dist-types/plugins/swc.d.ts +7 -0
- package/dist-types/plugins/target.d.ts +2 -0
- package/dist-types/plugins/wasm.d.ts +2 -0
- package/dist-types/provider/build.d.ts +3 -0
- package/dist-types/provider/createCompiler.d.ts +27 -0
- package/dist-types/provider/helpers.d.ts +12 -0
- package/dist-types/provider/initConfigs.d.ts +10 -0
- package/dist-types/provider/inspectConfig.d.ts +6 -0
- package/dist-types/provider/provider.d.ts +2 -0
- package/dist-types/provider/rspackConfig.d.ts +8 -0
- package/dist-types/rspack/RsbuildHtmlPlugin.d.ts +37 -0
- package/dist-types/rspack/preload/HtmlPreloadOrPrefetchPlugin.d.ts +29 -0
- package/dist-types/rspack/preload/helpers/determineAsValue.d.ts +22 -0
- package/dist-types/rspack/preload/helpers/doesChunkBelongToHtml.d.ts +29 -0
- package/dist-types/rspack/preload/helpers/extractChunks.d.ts +28 -0
- package/dist-types/rspack/preload/helpers/index.d.ts +4 -0
- package/dist-types/rspack/preload/helpers/type.d.ts +13 -0
- package/dist-types/server/ansiHTML.d.ts +12 -0
- package/dist-types/server/cliShortcuts.d.ts +10 -0
- package/dist-types/server/compilerDevMiddleware.d.ts +31 -0
- package/dist-types/server/devMiddleware.d.ts +27 -0
- package/dist-types/server/devServer.d.ts +60 -0
- package/dist-types/server/environment.d.ts +8 -0
- package/dist-types/server/getDevMiddlewares.d.ts +25 -0
- package/dist-types/server/gzipMiddleware.d.ts +4 -0
- package/dist-types/server/helper.d.ts +71 -0
- package/dist-types/server/httpServer.d.ts +8 -0
- package/dist-types/server/middlewares.d.ts +34 -0
- package/dist-types/server/open.d.ts +10 -0
- package/dist-types/server/prodServer.d.ts +25 -0
- package/dist-types/server/proxy.d.ts +6 -0
- package/dist-types/server/restart.d.ts +14 -0
- package/dist-types/server/runner/asModule.d.ts +2 -0
- package/dist-types/server/runner/basic.d.ts +25 -0
- package/dist-types/server/runner/cjs.d.ts +10 -0
- package/dist-types/server/runner/esm.d.ts +6 -0
- package/dist-types/server/runner/index.d.ts +8 -0
- package/dist-types/server/runner/type.d.ts +36 -0
- package/dist-types/server/socketServer.d.ts +26 -0
- package/dist-types/server/watchFiles.d.ts +14 -0
- package/dist-types/types/config.d.ts +1309 -0
- package/dist-types/types/context.d.ts +52 -0
- package/dist-types/types/hooks.d.ts +146 -0
- package/dist-types/types/index.d.ts +8 -0
- package/dist-types/types/plugin.d.ts +329 -0
- package/dist-types/types/rsbuild.d.ts +156 -0
- package/dist-types/types/rspack.d.ts +16 -0
- package/dist-types/types/thirdParty.d.ts +176 -0
- package/dist-types/types/utils.d.ts +12 -0
- package/package.json +61 -0
- package/static/openChrome.applescript +95 -0
- package/types.d.ts +221 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present Bytedance, Inc. and its affiliates.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://rsbuild.dev" target="blank"><img src="https://github.com/web-infra-dev/rsbuild/assets/7237365/84abc13e-b620-468f-a90b-dbf28e7e9427" alt="Rsbuild Logo" /></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Rsbuild
|
|
6
|
+
|
|
7
|
+
The Rspack-based build tool. It's fast, out-of-the-box and extensible.
|
|
8
|
+
|
|
9
|
+
## Documentation
|
|
10
|
+
|
|
11
|
+
https://rsbuild.dev/
|
|
12
|
+
|
|
13
|
+
## Contributing
|
|
14
|
+
|
|
15
|
+
Please read the [Contributing Guide](https://github.com/web-infra-dev/rsbuild/blob/main/CONTRIBUTING.md).
|
|
16
|
+
|
|
17
|
+
## License
|
|
18
|
+
|
|
19
|
+
Rsbuild is [MIT licensed](https://github.com/web-infra-dev/rsbuild/blob/main/LICENSE).
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# OpenHarmony port note
|
|
25
|
+
|
|
26
|
+
This package is the OpenHarmony (openharmony/arm64) port of `@rsbuild/core`, published by the `@ohos-ports` organization as `@ohos-ports/rsbuild-core@1.1.14-beta.1`.
|
|
27
|
+
|
|
28
|
+
It is content-identical to the upstream package except for the `package.json` identity/dependency redirects needed to route the runtime dependency chain to OpenHarmony-patched `@ohos-ports` packages.
|
package/bin/rsbuild.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import nodeModule from 'node:module';
|
|
3
|
+
|
|
4
|
+
// enable on-disk code caching of all modules loaded by Node.js
|
|
5
|
+
// requires Nodejs >= 22.8.0
|
|
6
|
+
const { enableCompileCache } = nodeModule;
|
|
7
|
+
if (enableCompileCache) {
|
|
8
|
+
try {
|
|
9
|
+
enableCompileCache();
|
|
10
|
+
} catch {
|
|
11
|
+
// ignore errors
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function main() {
|
|
16
|
+
const { runCLI } = await import('../dist/index.js');
|
|
17
|
+
runCLI();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
main();
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { Stats, Dirent, WatchEventType } 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): Promise<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
|
+
interface WatchHandlers {
|
|
76
|
+
listener: (path: string) => void;
|
|
77
|
+
errHandler: (err: unknown) => void;
|
|
78
|
+
rawEmitter: (ev: WatchEventType, path: string, opts: unknown) => void;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @mixin
|
|
82
|
+
*/
|
|
83
|
+
declare class NodeFsHandler {
|
|
84
|
+
fsw: FSWatcher;
|
|
85
|
+
_boundHandleError: (error: unknown) => void;
|
|
86
|
+
constructor(fsW: FSWatcher);
|
|
87
|
+
/**
|
|
88
|
+
* Watch file for changes with fs_watchFile or fs_watch.
|
|
89
|
+
* @param path to file or dir
|
|
90
|
+
* @param listener on fs change
|
|
91
|
+
* @returns closer for the watcher instance
|
|
92
|
+
*/
|
|
93
|
+
_watchWithNodeFs(path: string, listener: (path: string, newStats?: any) => void | Promise<void>): (() => void) | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Watch a file and emit add event if warranted.
|
|
96
|
+
* @returns closer for the watcher instance
|
|
97
|
+
*/
|
|
98
|
+
_handleFile(file: Path, stats: Stats, initialAdd: boolean): (() => void) | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Handle symlinks encountered while reading a dir.
|
|
101
|
+
* @param entry returned by readdirp
|
|
102
|
+
* @param directory path of dir being read
|
|
103
|
+
* @param path of this item
|
|
104
|
+
* @param item basename of this item
|
|
105
|
+
* @returns true if no more processing is needed for this entry.
|
|
106
|
+
*/
|
|
107
|
+
_handleSymlink(entry: EntryInfo, directory: string, path: Path, item: string): Promise<boolean | undefined>;
|
|
108
|
+
_handleRead(directory: string, initialAdd: boolean, wh: WatchHelper, target: Path, dir: Path, depth: number, throttler: Throttler): Promise<unknown> | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Read directory to add / remove files from `@watched` list and re-read it on change.
|
|
111
|
+
* @param dir fs path
|
|
112
|
+
* @param stats
|
|
113
|
+
* @param initialAdd
|
|
114
|
+
* @param depth relative to user-supplied path
|
|
115
|
+
* @param target child path targeted for watch
|
|
116
|
+
* @param wh Common watch helpers for this path
|
|
117
|
+
* @param realpath
|
|
118
|
+
* @returns closer for the watcher instance.
|
|
119
|
+
*/
|
|
120
|
+
_handleDir(dir: string, stats: Stats, initialAdd: boolean, depth: number, target: string, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
|
|
121
|
+
/**
|
|
122
|
+
* Handle added file, directory, or glob pattern.
|
|
123
|
+
* Delegates call to _handleFile / _handleDir after checks.
|
|
124
|
+
* @param path to file or ir
|
|
125
|
+
* @param initialAdd was the file added at watch instantiation?
|
|
126
|
+
* @param priorWh depth relative to user-supplied path
|
|
127
|
+
* @param depth Child path actually targeted for watch
|
|
128
|
+
* @param target Child path actually targeted for watch
|
|
129
|
+
*/
|
|
130
|
+
_addToNodeFs(path: string, initialAdd: boolean, priorWh: WatchHelper | undefined, depth: number, target?: string): Promise<string | false | undefined>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
|
|
134
|
+
|
|
135
|
+
type AWF = {
|
|
136
|
+
stabilityThreshold: number;
|
|
137
|
+
pollInterval: number;
|
|
138
|
+
};
|
|
139
|
+
type BasicOpts = {
|
|
140
|
+
persistent: boolean;
|
|
141
|
+
ignoreInitial: boolean;
|
|
142
|
+
followSymlinks: boolean;
|
|
143
|
+
cwd?: string;
|
|
144
|
+
usePolling: boolean;
|
|
145
|
+
interval: number;
|
|
146
|
+
binaryInterval: number;
|
|
147
|
+
alwaysStat?: boolean;
|
|
148
|
+
depth?: number;
|
|
149
|
+
ignorePermissionErrors: boolean;
|
|
150
|
+
atomic: boolean | number;
|
|
151
|
+
};
|
|
152
|
+
type Throttler = {
|
|
153
|
+
timeoutObject: NodeJS.Timeout;
|
|
154
|
+
clear: () => void;
|
|
155
|
+
count: number;
|
|
156
|
+
};
|
|
157
|
+
type ChokidarOptions = Partial<BasicOpts & {
|
|
158
|
+
ignored: Matcher | Matcher[];
|
|
159
|
+
awaitWriteFinish: boolean | Partial<AWF>;
|
|
160
|
+
}>;
|
|
161
|
+
type FSWInstanceOptions = BasicOpts & {
|
|
162
|
+
ignored: Matcher[];
|
|
163
|
+
awaitWriteFinish: false | AWF;
|
|
164
|
+
};
|
|
165
|
+
type ThrottleType = 'readdir' | 'watch' | 'add' | 'remove' | 'change';
|
|
166
|
+
type EmitArgs = [path: Path, stats?: Stats];
|
|
167
|
+
type EmitErrorArgs = [error: Error, stats?: Stats];
|
|
168
|
+
type EmitArgsWithName = [event: EventName, ...EmitArgs];
|
|
169
|
+
type MatchFunction = (val: string, stats?: Stats) => boolean;
|
|
170
|
+
interface MatcherObject {
|
|
171
|
+
path: string;
|
|
172
|
+
recursive?: boolean;
|
|
173
|
+
}
|
|
174
|
+
type Matcher = string | RegExp | MatchFunction | MatcherObject;
|
|
175
|
+
/**
|
|
176
|
+
* Directory entry.
|
|
177
|
+
*/
|
|
178
|
+
declare class DirEntry {
|
|
179
|
+
path: Path;
|
|
180
|
+
_removeWatcher: (dir: string, base: string) => void;
|
|
181
|
+
items: Set<Path>;
|
|
182
|
+
constructor(dir: Path, removeWatcher: (dir: string, base: string) => void);
|
|
183
|
+
add(item: string): void;
|
|
184
|
+
remove(item: string): Promise<void>;
|
|
185
|
+
has(item: string): boolean | undefined;
|
|
186
|
+
getChildren(): string[];
|
|
187
|
+
dispose(): void;
|
|
188
|
+
}
|
|
189
|
+
declare class WatchHelper {
|
|
190
|
+
fsw: FSWatcher;
|
|
191
|
+
path: string;
|
|
192
|
+
watchPath: string;
|
|
193
|
+
fullWatchPath: string;
|
|
194
|
+
dirParts: string[][];
|
|
195
|
+
followSymlinks: boolean;
|
|
196
|
+
statMethod: 'stat' | 'lstat';
|
|
197
|
+
constructor(path: string, follow: boolean, fsw: FSWatcher);
|
|
198
|
+
entryPath(entry: EntryInfo): Path;
|
|
199
|
+
filterPath(entry: EntryInfo): boolean;
|
|
200
|
+
filterDir(entry: EntryInfo): boolean;
|
|
201
|
+
}
|
|
202
|
+
interface FSWatcherKnownEventMap {
|
|
203
|
+
[EVENTS.READY]: [];
|
|
204
|
+
[EVENTS.RAW]: Parameters<WatchHandlers['rawEmitter']>;
|
|
205
|
+
[EVENTS.ERROR]: Parameters<WatchHandlers['errHandler']>;
|
|
206
|
+
[EVENTS.ALL]: [event: EventName, ...EmitArgs];
|
|
207
|
+
}
|
|
208
|
+
type FSWatcherEventMap = FSWatcherKnownEventMap & {
|
|
209
|
+
[k in Exclude<EventName, keyof FSWatcherKnownEventMap>]: EmitArgs;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Watches files & directories for changes. Emitted events:
|
|
213
|
+
* `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
|
|
214
|
+
*
|
|
215
|
+
* new FSWatcher()
|
|
216
|
+
* .add(directories)
|
|
217
|
+
* .on('add', path => log('File', path, 'was added'))
|
|
218
|
+
*/
|
|
219
|
+
declare class FSWatcher extends EventEmitter<FSWatcherEventMap> {
|
|
220
|
+
closed: boolean;
|
|
221
|
+
options: FSWInstanceOptions;
|
|
222
|
+
_closers: Map<string, Array<any>>;
|
|
223
|
+
_ignoredPaths: Set<Matcher>;
|
|
224
|
+
_throttled: Map<ThrottleType, Map<any, any>>;
|
|
225
|
+
_streams: Set<ReaddirpStream>;
|
|
226
|
+
_symlinkPaths: Map<Path, string | boolean>;
|
|
227
|
+
_watched: Map<string, DirEntry>;
|
|
228
|
+
_pendingWrites: Map<string, any>;
|
|
229
|
+
_pendingUnlinks: Map<string, EmitArgsWithName>;
|
|
230
|
+
_readyCount: number;
|
|
231
|
+
_emitReady: () => void;
|
|
232
|
+
_closePromise?: Promise<void>;
|
|
233
|
+
_userIgnored?: MatchFunction;
|
|
234
|
+
_readyEmitted: boolean;
|
|
235
|
+
_emitRaw: WatchHandlers['rawEmitter'];
|
|
236
|
+
_boundRemove: (dir: string, item: string) => void;
|
|
237
|
+
_nodeFsHandler: NodeFsHandler;
|
|
238
|
+
constructor(_opts?: ChokidarOptions);
|
|
239
|
+
_addIgnoredPath(matcher: Matcher): void;
|
|
240
|
+
_removeIgnoredPath(matcher: Matcher): void;
|
|
241
|
+
/**
|
|
242
|
+
* Adds paths to be watched on an existing FSWatcher instance.
|
|
243
|
+
* @param paths_ file or file list. Other arguments are unused
|
|
244
|
+
*/
|
|
245
|
+
add(paths_: Path | Path[], _origAdd?: string, _internal?: boolean): FSWatcher;
|
|
246
|
+
/**
|
|
247
|
+
* Close watchers or start ignoring events from specified paths.
|
|
248
|
+
*/
|
|
249
|
+
unwatch(paths_: Path | Path[]): FSWatcher;
|
|
250
|
+
/**
|
|
251
|
+
* Close watchers and remove all listeners from watched paths.
|
|
252
|
+
*/
|
|
253
|
+
close(): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* Expose list of watched paths
|
|
256
|
+
* @returns for chaining
|
|
257
|
+
*/
|
|
258
|
+
getWatched(): Record<string, string[]>;
|
|
259
|
+
emitWithAll(event: EventName, args: EmitArgs): void;
|
|
260
|
+
/**
|
|
261
|
+
* Normalize and emit events.
|
|
262
|
+
* Calling _emit DOES NOT MEAN emit() would be called!
|
|
263
|
+
* @param event Type of event
|
|
264
|
+
* @param path File or directory path
|
|
265
|
+
* @param stats arguments to be passed with event
|
|
266
|
+
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
267
|
+
*/
|
|
268
|
+
_emit(event: EventName, path: Path, stats?: Stats): Promise<this | undefined>;
|
|
269
|
+
/**
|
|
270
|
+
* Common handler for errors
|
|
271
|
+
* @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
272
|
+
*/
|
|
273
|
+
_handleError(error: Error): Error | boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Helper utility for throttling
|
|
276
|
+
* @param actionType type being throttled
|
|
277
|
+
* @param path being acted upon
|
|
278
|
+
* @param timeout duration of time to suppress duplicate actions
|
|
279
|
+
* @returns tracking object or false if action should be suppressed
|
|
280
|
+
*/
|
|
281
|
+
_throttle(actionType: ThrottleType, path: Path, timeout: number): Throttler | false;
|
|
282
|
+
_incrReadyCount(): number;
|
|
283
|
+
/**
|
|
284
|
+
* Awaits write operation to finish.
|
|
285
|
+
* Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
|
|
286
|
+
* @param path being acted upon
|
|
287
|
+
* @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
|
|
288
|
+
* @param event
|
|
289
|
+
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
290
|
+
*/
|
|
291
|
+
_awaitWriteFinish(path: Path, threshold: number, event: EventName, awfEmit: (err?: Error, stat?: Stats) => void): void;
|
|
292
|
+
/**
|
|
293
|
+
* Determines whether user has asked to ignore this path.
|
|
294
|
+
*/
|
|
295
|
+
_isIgnored(path: Path, stats?: Stats): boolean;
|
|
296
|
+
_isntIgnored(path: Path, stat?: Stats): boolean;
|
|
297
|
+
/**
|
|
298
|
+
* Provides a set of common helpers and properties relating to symlink handling.
|
|
299
|
+
* @param path file or directory pattern being watched
|
|
300
|
+
*/
|
|
301
|
+
_getWatchHelpers(path: Path): WatchHelper;
|
|
302
|
+
/**
|
|
303
|
+
* Provides directory tracking objects
|
|
304
|
+
* @param directory path of the directory
|
|
305
|
+
*/
|
|
306
|
+
_getWatchedDir(directory: string): DirEntry;
|
|
307
|
+
/**
|
|
308
|
+
* Check for read permissions: https://stackoverflow.com/a/11781404/1358405
|
|
309
|
+
*/
|
|
310
|
+
_hasReadPermissions(stats: Stats): boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Handles emitting unlink events for
|
|
313
|
+
* files and directories, and via recursion, for
|
|
314
|
+
* files and directories within directories that are unlinked
|
|
315
|
+
* @param directory within which the following item is located
|
|
316
|
+
* @param item base path of item/directory
|
|
317
|
+
*/
|
|
318
|
+
_remove(directory: string, item: string, isDirectory?: boolean): void;
|
|
319
|
+
/**
|
|
320
|
+
* Closes all watchers for a path
|
|
321
|
+
*/
|
|
322
|
+
_closePath(path: Path): void;
|
|
323
|
+
/**
|
|
324
|
+
* Closes only file-specific watchers
|
|
325
|
+
*/
|
|
326
|
+
_closeFile(path: Path): void;
|
|
327
|
+
_addPathCloser(path: Path, closer: () => void): void;
|
|
328
|
+
_readdirp(root: Path, opts?: Partial<ReaddirpOptions>): ReaddirpStream | undefined;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Instantiates watcher with paths to be tracked.
|
|
332
|
+
* @param paths file / directory paths
|
|
333
|
+
* @param options opts, such as `atomic`, `awaitWriteFinish`, `ignored`, and others
|
|
334
|
+
* @returns an instance of FSWatcher for chaining.
|
|
335
|
+
* @example
|
|
336
|
+
* const watcher = watch('.').on('all', (event, path) => { console.log(event, path); });
|
|
337
|
+
* watch('.', { atomic: true, awaitWriteFinish: true, ignored: (f, stats) => stats?.isFile() && !f.endsWith('.js') })
|
|
338
|
+
*/
|
|
339
|
+
declare function watch(paths: string | string[], options?: ChokidarOptions): FSWatcher;
|
|
340
|
+
declare const _default: {
|
|
341
|
+
watch: typeof watch;
|
|
342
|
+
FSWatcher: typeof FSWatcher;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
export { type ChokidarOptions, type EmitArgs, type EmitArgsWithName, type EmitErrorArgs, type FSWInstanceOptions, FSWatcher, type FSWatcherEventMap, type FSWatcherKnownEventMap, type MatchFunction, type Matcher, type MatcherObject, type ThrottleType, type Throttler, WatchHelper, _default as default, watch };
|