@rsbuild/core 1.2.11 → 1.2.13
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/compiled/chokidar/index.d.ts +61 -23
- package/compiled/chokidar/index.js +71 -56
- package/compiled/css-loader/index.js +309 -195
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/http-proxy-middleware/index.d.ts +1 -1
- package/compiled/launch-editor-middleware/index.js +9 -6
- package/compiled/mrmime/index.js +4 -0
- package/compiled/mrmime/package.json +1 -1
- package/compiled/postcss/index.js +194 -194
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-load-config/index.js +11 -11
- package/compiled/postcss-loader/index.js +9 -9
- package/compiled/rsbuild-dev-middleware/index.js +56 -46
- package/compiled/rsbuild-dev-middleware/package.json +1 -1
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/sirv/index.js +8 -4
- package/compiled/sirv/package.json +1 -1
- package/compiled/style-loader/index.js +10 -10
- package/compiled/tinyglobby/index.d.ts +1 -0
- package/compiled/tinyglobby/index.js +266 -142
- package/compiled/tinyglobby/package.json +1 -1
- package/compiled/webpack-bundle-analyzer/index.js +6 -2
- package/compiled/ws/index.js +50 -49
- package/compiled/ws/package.json +1 -1
- package/dist/client/hmr.js +2 -2
- package/dist/index.cjs +146 -93
- package/dist/index.js +142 -89
- package/dist-types/helpers/index.d.ts +4 -3
- package/dist-types/index.d.ts +1 -1
- package/dist-types/loadEnv.d.ts +16 -4
- package/dist-types/logger.d.ts +14 -0
- package/dist-types/server/devServer.d.ts +2 -1
- package/dist-types/server/socketServer.d.ts +4 -2
- package/dist-types/types/config.d.ts +79 -43
- package/dist-types/types/rspack.d.ts +1 -1
- package/package.json +12 -12
- package/compiled/jiti/index.d.ts +0 -1
- package/compiled/jiti/index.js +0 -416
- package/compiled/jiti/license +0 -21
- package/compiled/jiti/package.json +0 -1
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WatchEventType, Stats as Stats$1 } from 'fs';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import {
|
|
3
|
+
import { Dirent, Stats } from 'node:fs';
|
|
4
|
+
import { Readable } from 'node:stream';
|
|
4
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. */
|
|
5
23
|
type Path$1 = string;
|
|
24
|
+
/** Emitted entry. Contains relative & absolute path, basename, and either stats or dirent. */
|
|
6
25
|
interface EntryInfo {
|
|
7
26
|
path: string;
|
|
8
27
|
fullPath: string;
|
|
@@ -10,24 +29,43 @@ interface EntryInfo {
|
|
|
10
29
|
dirent?: Dirent;
|
|
11
30
|
basename: string;
|
|
12
31
|
}
|
|
32
|
+
/** Path or dir entries (files) */
|
|
13
33
|
type PathOrDirent = Dirent | Path$1;
|
|
14
|
-
|
|
15
|
-
|
|
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 = {
|
|
16
53
|
root: string;
|
|
17
|
-
fileFilter
|
|
18
|
-
directoryFilter
|
|
19
|
-
type
|
|
20
|
-
lstat
|
|
21
|
-
depth
|
|
22
|
-
alwaysStat
|
|
23
|
-
highWaterMark
|
|
54
|
+
fileFilter?: Predicate;
|
|
55
|
+
directoryFilter?: Predicate;
|
|
56
|
+
type?: EntryType;
|
|
57
|
+
lstat?: boolean;
|
|
58
|
+
depth?: number;
|
|
59
|
+
alwaysStat?: boolean;
|
|
60
|
+
highWaterMark?: number;
|
|
24
61
|
};
|
|
25
|
-
|
|
62
|
+
/** Directory entry. Contains path, depth count, and files. */
|
|
26
63
|
interface DirEntry$1 {
|
|
27
64
|
files: PathOrDirent[];
|
|
28
65
|
depth: number;
|
|
29
66
|
path: Path$1;
|
|
30
67
|
}
|
|
68
|
+
/** Readable readdir stream, emitting new files as they're being listed. */
|
|
31
69
|
declare class ReaddirpStream extends Readable {
|
|
32
70
|
parents: any[];
|
|
33
71
|
reading: boolean;
|
|
@@ -55,7 +93,7 @@ declare class ReaddirpStream extends Readable {
|
|
|
55
93
|
}>;
|
|
56
94
|
_formatEntry(dirent: PathOrDirent, path: Path$1): Promise<EntryInfo | undefined>;
|
|
57
95
|
_onError(err: Error): void;
|
|
58
|
-
_getEntryType(entry: EntryInfo): Promise<void |
|
|
96
|
+
_getEntryType(entry: EntryInfo): Promise<void | '' | 'file' | 'directory'>;
|
|
59
97
|
_includeAsFile(entry: EntryInfo): boolean | undefined;
|
|
60
98
|
}
|
|
61
99
|
|
|
@@ -95,7 +133,7 @@ declare class NodeFsHandler {
|
|
|
95
133
|
* Watch a file and emit add event if warranted.
|
|
96
134
|
* @returns closer for the watcher instance
|
|
97
135
|
*/
|
|
98
|
-
_handleFile(file: Path, stats: Stats, initialAdd: boolean): (() => void) | undefined;
|
|
136
|
+
_handleFile(file: Path, stats: Stats$1, initialAdd: boolean): (() => void) | undefined;
|
|
99
137
|
/**
|
|
100
138
|
* Handle symlinks encountered while reading a dir.
|
|
101
139
|
* @param entry returned by readdirp
|
|
@@ -117,7 +155,7 @@ declare class NodeFsHandler {
|
|
|
117
155
|
* @param realpath
|
|
118
156
|
* @returns closer for the watcher instance.
|
|
119
157
|
*/
|
|
120
|
-
_handleDir(dir: string, stats: Stats, initialAdd: boolean, depth: number, target: string, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
|
|
158
|
+
_handleDir(dir: string, stats: Stats$1, initialAdd: boolean, depth: number, target: string, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
|
|
121
159
|
/**
|
|
122
160
|
* Handle added file, directory, or glob pattern.
|
|
123
161
|
* Delegates call to _handleFile / _handleDir after checks.
|
|
@@ -163,10 +201,10 @@ type FSWInstanceOptions = BasicOpts & {
|
|
|
163
201
|
awaitWriteFinish: false | AWF;
|
|
164
202
|
};
|
|
165
203
|
type ThrottleType = 'readdir' | 'watch' | 'add' | 'remove' | 'change';
|
|
166
|
-
type EmitArgs = [path: Path, stats?: Stats];
|
|
167
|
-
type EmitErrorArgs = [error: Error, stats?: Stats];
|
|
204
|
+
type EmitArgs = [path: Path, stats?: Stats$1];
|
|
205
|
+
type EmitErrorArgs = [error: Error, stats?: Stats$1];
|
|
168
206
|
type EmitArgsWithName = [event: EventName, ...EmitArgs];
|
|
169
|
-
type MatchFunction = (val: string, stats?: Stats) => boolean;
|
|
207
|
+
type MatchFunction = (val: string, stats?: Stats$1) => boolean;
|
|
170
208
|
interface MatcherObject {
|
|
171
209
|
path: string;
|
|
172
210
|
recursive?: boolean;
|
|
@@ -265,7 +303,7 @@ declare class FSWatcher extends EventEmitter<FSWatcherEventMap> {
|
|
|
265
303
|
* @param stats arguments to be passed with event
|
|
266
304
|
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
267
305
|
*/
|
|
268
|
-
_emit(event: EventName, path: Path, stats?: Stats): Promise<this | undefined>;
|
|
306
|
+
_emit(event: EventName, path: Path, stats?: Stats$1): Promise<this | undefined>;
|
|
269
307
|
/**
|
|
270
308
|
* Common handler for errors
|
|
271
309
|
* @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
@@ -288,12 +326,12 @@ declare class FSWatcher extends EventEmitter<FSWatcherEventMap> {
|
|
|
288
326
|
* @param event
|
|
289
327
|
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
290
328
|
*/
|
|
291
|
-
_awaitWriteFinish(path: Path, threshold: number, event: EventName, awfEmit: (err?: Error, stat?: Stats) => void): void;
|
|
329
|
+
_awaitWriteFinish(path: Path, threshold: number, event: EventName, awfEmit: (err?: Error, stat?: Stats$1) => void): void;
|
|
292
330
|
/**
|
|
293
331
|
* Determines whether user has asked to ignore this path.
|
|
294
332
|
*/
|
|
295
|
-
_isIgnored(path: Path, stats?: Stats): boolean;
|
|
296
|
-
_isntIgnored(path: Path, stat?: Stats): boolean;
|
|
333
|
+
_isIgnored(path: Path, stats?: Stats$1): boolean;
|
|
334
|
+
_isntIgnored(path: Path, stat?: Stats$1): boolean;
|
|
297
335
|
/**
|
|
298
336
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
299
337
|
* @param path file or directory pattern being watched
|
|
@@ -307,7 +345,7 @@ declare class FSWatcher extends EventEmitter<FSWatcherEventMap> {
|
|
|
307
345
|
/**
|
|
308
346
|
* Check for read permissions: https://stackoverflow.com/a/11781404/1358405
|
|
309
347
|
*/
|
|
310
|
-
_hasReadPermissions(stats: Stats): boolean;
|
|
348
|
+
_hasReadPermissions(stats: Stats$1): boolean;
|
|
311
349
|
/**
|
|
312
350
|
* Handles emitting unlink events for
|
|
313
351
|
* files and directories, and via recursion, for
|
|
@@ -803,27 +803,31 @@
|
|
|
803
803
|
}
|
|
804
804
|
exports.NodeFsHandler = NodeFsHandler;
|
|
805
805
|
},
|
|
806
|
-
|
|
806
|
+
275: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
807
807
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
808
|
-
exports.
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
const
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
808
|
+
exports.ReaddirpStream = exports.EntryTypes = void 0;
|
|
809
|
+
exports.readdirp = readdirp;
|
|
810
|
+
exports.readdirpPromise = readdirpPromise;
|
|
811
|
+
const promises_1 = __nccwpck_require__(455);
|
|
812
|
+
const node_stream_1 = __nccwpck_require__(75);
|
|
813
|
+
const node_path_1 = __nccwpck_require__(760);
|
|
814
|
+
exports.EntryTypes = {
|
|
815
|
+
FILE_TYPE: "files",
|
|
816
|
+
DIR_TYPE: "directories",
|
|
817
|
+
FILE_DIR_TYPE: "files_directories",
|
|
818
|
+
EVERYTHING_TYPE: "all",
|
|
819
|
+
};
|
|
820
|
+
const defaultOptions = {
|
|
821
|
+
root: ".",
|
|
822
|
+
fileFilter: (_entryInfo) => true,
|
|
823
|
+
directoryFilter: (_entryInfo) => true,
|
|
824
|
+
type: exports.EntryTypes.FILE_TYPE,
|
|
825
|
+
lstat: false,
|
|
826
|
+
depth: 2147483648,
|
|
827
|
+
alwaysStat: false,
|
|
828
|
+
highWaterMark: 4096,
|
|
829
|
+
};
|
|
830
|
+
Object.freeze(defaultOptions);
|
|
827
831
|
const RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR";
|
|
828
832
|
const NORMAL_FLOW_ERRORS = new Set([
|
|
829
833
|
"ENOENT",
|
|
@@ -832,16 +836,25 @@
|
|
|
832
836
|
"ELOOP",
|
|
833
837
|
RECURSIVE_ERROR_CODE,
|
|
834
838
|
]);
|
|
835
|
-
const
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
const
|
|
839
|
+
const ALL_TYPES = [
|
|
840
|
+
exports.EntryTypes.DIR_TYPE,
|
|
841
|
+
exports.EntryTypes.EVERYTHING_TYPE,
|
|
842
|
+
exports.EntryTypes.FILE_DIR_TYPE,
|
|
843
|
+
exports.EntryTypes.FILE_TYPE,
|
|
844
|
+
];
|
|
845
|
+
const DIR_TYPES = new Set([
|
|
846
|
+
exports.EntryTypes.DIR_TYPE,
|
|
847
|
+
exports.EntryTypes.EVERYTHING_TYPE,
|
|
848
|
+
exports.EntryTypes.FILE_DIR_TYPE,
|
|
849
|
+
]);
|
|
850
|
+
const FILE_TYPES = new Set([
|
|
851
|
+
exports.EntryTypes.EVERYTHING_TYPE,
|
|
852
|
+
exports.EntryTypes.FILE_DIR_TYPE,
|
|
853
|
+
exports.EntryTypes.FILE_TYPE,
|
|
854
|
+
]);
|
|
842
855
|
const isNormalFlowError = (error) => NORMAL_FLOW_ERRORS.has(error.code);
|
|
843
856
|
const wantBigintFsStats = process.platform === "win32";
|
|
844
|
-
const emptyFn = (
|
|
857
|
+
const emptyFn = (_entryInfo) => true;
|
|
845
858
|
const normalizeFilter = (filter) => {
|
|
846
859
|
if (filter === undefined) return emptyFn;
|
|
847
860
|
if (typeof filter === "function") return filter;
|
|
@@ -855,14 +868,14 @@
|
|
|
855
868
|
}
|
|
856
869
|
return emptyFn;
|
|
857
870
|
};
|
|
858
|
-
class ReaddirpStream extends
|
|
871
|
+
class ReaddirpStream extends node_stream_1.Readable {
|
|
859
872
|
constructor(options = {}) {
|
|
860
873
|
super({
|
|
861
874
|
objectMode: true,
|
|
862
875
|
autoDestroy: true,
|
|
863
876
|
highWaterMark: options.highWaterMark,
|
|
864
877
|
});
|
|
865
|
-
const opts = { ...defaultOptions
|
|
878
|
+
const opts = { ...defaultOptions, ...options };
|
|
866
879
|
const { root, type } = opts;
|
|
867
880
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
868
881
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
@@ -872,11 +885,11 @@
|
|
|
872
885
|
} else {
|
|
873
886
|
this._stat = statMethod;
|
|
874
887
|
}
|
|
875
|
-
this._maxDepth = opts.depth;
|
|
876
|
-
this._wantsDir = DIR_TYPES.has(type);
|
|
877
|
-
this._wantsFile = FILE_TYPES.has(type);
|
|
878
|
-
this._wantsEverything = type === EVERYTHING_TYPE;
|
|
879
|
-
this._root = (0,
|
|
888
|
+
this._maxDepth = opts.depth ?? defaultOptions.depth;
|
|
889
|
+
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
890
|
+
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
891
|
+
this._wantsEverything = type === exports.EntryTypes.EVERYTHING_TYPE;
|
|
892
|
+
this._root = (0, node_path_1.resolve)(root);
|
|
880
893
|
this._isDirent = !opts.alwaysStat;
|
|
881
894
|
this._statsProp = this._isDirent ? "dirent" : "stats";
|
|
882
895
|
this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
|
|
@@ -898,10 +911,7 @@
|
|
|
898
911
|
.map((dirent) => this._formatEntry(dirent, path));
|
|
899
912
|
const awaited = await Promise.all(slice);
|
|
900
913
|
for (const entry of awaited) {
|
|
901
|
-
if (!entry)
|
|
902
|
-
batch--;
|
|
903
|
-
return;
|
|
904
|
-
}
|
|
914
|
+
if (!entry) continue;
|
|
905
915
|
if (this.destroyed) return;
|
|
906
916
|
const entryType = await this._getEntryType(entry);
|
|
907
917
|
if (
|
|
@@ -956,11 +966,11 @@
|
|
|
956
966
|
let entry;
|
|
957
967
|
const basename = this._isDirent ? dirent.name : dirent;
|
|
958
968
|
try {
|
|
959
|
-
const fullPath = (0,
|
|
960
|
-
(0,
|
|
969
|
+
const fullPath = (0, node_path_1.resolve)(
|
|
970
|
+
(0, node_path_1.join)(path, basename),
|
|
961
971
|
);
|
|
962
972
|
entry = {
|
|
963
|
-
path: (0,
|
|
973
|
+
path: (0, node_path_1.relative)(this._root, fullPath),
|
|
964
974
|
fullPath,
|
|
965
975
|
basename,
|
|
966
976
|
};
|
|
@@ -1001,7 +1011,7 @@
|
|
|
1001
1011
|
const len = entryRealPath.length;
|
|
1002
1012
|
if (
|
|
1003
1013
|
full.startsWith(entryRealPath) &&
|
|
1004
|
-
full.substr(len, 1) ===
|
|
1014
|
+
full.substr(len, 1) === node_path_1.sep
|
|
1005
1015
|
) {
|
|
1006
1016
|
const recursiveError = new Error(
|
|
1007
1017
|
`Circular symlink detected: "${full}" points to "${entryRealPath}"`,
|
|
@@ -1023,9 +1033,9 @@
|
|
|
1023
1033
|
}
|
|
1024
1034
|
}
|
|
1025
1035
|
exports.ReaddirpStream = ReaddirpStream;
|
|
1026
|
-
|
|
1036
|
+
function readdirp(root, options = {}) {
|
|
1027
1037
|
let type = options.entryType || options.type;
|
|
1028
|
-
if (type === "both") type = FILE_DIR_TYPE;
|
|
1038
|
+
if (type === "both") type = exports.EntryTypes.FILE_DIR_TYPE;
|
|
1029
1039
|
if (type) options.type = type;
|
|
1030
1040
|
if (!root) {
|
|
1031
1041
|
throw new Error(
|
|
@@ -1042,18 +1052,17 @@
|
|
|
1042
1052
|
}
|
|
1043
1053
|
options.root = root;
|
|
1044
1054
|
return new ReaddirpStream(options);
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
new Promise((resolve, reject) => {
|
|
1055
|
+
}
|
|
1056
|
+
function readdirpPromise(root, options = {}) {
|
|
1057
|
+
return new Promise((resolve, reject) => {
|
|
1049
1058
|
const files = [];
|
|
1050
|
-
|
|
1059
|
+
readdirp(root, options)
|
|
1051
1060
|
.on("data", (entry) => files.push(entry))
|
|
1052
1061
|
.on("end", () => resolve(files))
|
|
1053
1062
|
.on("error", (error) => reject(error));
|
|
1054
1063
|
});
|
|
1055
|
-
|
|
1056
|
-
exports["default"] =
|
|
1064
|
+
}
|
|
1065
|
+
exports["default"] = readdirp;
|
|
1057
1066
|
},
|
|
1058
1067
|
434: (module) => {
|
|
1059
1068
|
module.exports = require("events");
|
|
@@ -1064,15 +1073,21 @@
|
|
|
1064
1073
|
943: (module) => {
|
|
1065
1074
|
module.exports = require("fs/promises");
|
|
1066
1075
|
},
|
|
1076
|
+
455: (module) => {
|
|
1077
|
+
module.exports = require("node:fs/promises");
|
|
1078
|
+
},
|
|
1079
|
+
760: (module) => {
|
|
1080
|
+
module.exports = require("node:path");
|
|
1081
|
+
},
|
|
1082
|
+
75: (module) => {
|
|
1083
|
+
module.exports = require("node:stream");
|
|
1084
|
+
},
|
|
1067
1085
|
857: (module) => {
|
|
1068
1086
|
module.exports = require("os");
|
|
1069
1087
|
},
|
|
1070
1088
|
928: (module) => {
|
|
1071
1089
|
module.exports = require("path");
|
|
1072
1090
|
},
|
|
1073
|
-
203: (module) => {
|
|
1074
|
-
module.exports = require("stream");
|
|
1075
|
-
},
|
|
1076
1091
|
};
|
|
1077
1092
|
var __webpack_module_cache__ = {};
|
|
1078
1093
|
function __nccwpck_require__(moduleId) {
|
|
@@ -1107,7 +1122,7 @@
|
|
|
1107
1122
|
const promises_1 = __nccwpck_require__(943);
|
|
1108
1123
|
const events_1 = __nccwpck_require__(434);
|
|
1109
1124
|
const sysPath = __nccwpck_require__(928);
|
|
1110
|
-
const readdirp_1 = __nccwpck_require__(
|
|
1125
|
+
const readdirp_1 = __nccwpck_require__(275);
|
|
1111
1126
|
const handler_js_1 = __nccwpck_require__(187);
|
|
1112
1127
|
const SLASH = "/";
|
|
1113
1128
|
const SLASH_SLASH = "//";
|