ts-checker-rspack-plugin 1.2.5 → 1.3.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.
package/lib/index.js CHANGED
@@ -1,5 +1,1471 @@
1
- "use strict";
2
- var __webpack_require__ = {};
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ var __webpack_modules__ = {
3
+ "./node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js" (module) {
4
+ /*!
5
+ * is-extglob <https://github.com/jonschlinkert/is-extglob>
6
+ *
7
+ * Copyright (c) 2014-2016, Jon Schlinkert.
8
+ * Licensed under the MIT License.
9
+ */ module.exports = function(str) {
10
+ if ('string' != typeof str || '' === str) return false;
11
+ var match;
12
+ while(match = /(\\).|([@?!+*]\(.*\))/g.exec(str)){
13
+ if (match[2]) return true;
14
+ str = str.slice(match.index + match[0].length);
15
+ }
16
+ return false;
17
+ };
18
+ },
19
+ "./node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js" (module, __unused_rspack_exports, __webpack_require__) {
20
+ /*!
21
+ * is-glob <https://github.com/jonschlinkert/is-glob>
22
+ *
23
+ * Copyright (c) 2014-2017, Jon Schlinkert.
24
+ * Released under the MIT License.
25
+ */ var isExtglob = __webpack_require__("./node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js");
26
+ var chars = {
27
+ '{': '}',
28
+ '(': ')',
29
+ '[': ']'
30
+ };
31
+ var strictCheck = function(str) {
32
+ if ('!' === str[0]) return true;
33
+ var index = 0;
34
+ var pipeIndex = -2;
35
+ var closeSquareIndex = -2;
36
+ var closeCurlyIndex = -2;
37
+ var closeParenIndex = -2;
38
+ var backSlashIndex = -2;
39
+ while(index < str.length){
40
+ if ('*' === str[index]) return true;
41
+ if ('?' === str[index + 1] && /[\].+)]/.test(str[index])) return true;
42
+ if (-1 !== closeSquareIndex && '[' === str[index] && ']' !== str[index + 1]) {
43
+ if (closeSquareIndex < index) closeSquareIndex = str.indexOf(']', index);
44
+ if (closeSquareIndex > index) {
45
+ if (-1 === backSlashIndex || backSlashIndex > closeSquareIndex) return true;
46
+ backSlashIndex = str.indexOf('\\', index);
47
+ if (-1 === backSlashIndex || backSlashIndex > closeSquareIndex) return true;
48
+ }
49
+ }
50
+ if (-1 !== closeCurlyIndex && '{' === str[index] && '}' !== str[index + 1]) {
51
+ closeCurlyIndex = str.indexOf('}', index);
52
+ if (closeCurlyIndex > index) {
53
+ backSlashIndex = str.indexOf('\\', index);
54
+ if (-1 === backSlashIndex || backSlashIndex > closeCurlyIndex) return true;
55
+ }
56
+ }
57
+ if (-1 !== closeParenIndex && '(' === str[index] && '?' === str[index + 1] && /[:!=]/.test(str[index + 2]) && ')' !== str[index + 3]) {
58
+ closeParenIndex = str.indexOf(')', index);
59
+ if (closeParenIndex > index) {
60
+ backSlashIndex = str.indexOf('\\', index);
61
+ if (-1 === backSlashIndex || backSlashIndex > closeParenIndex) return true;
62
+ }
63
+ }
64
+ if (-1 !== pipeIndex && '(' === str[index] && '|' !== str[index + 1]) {
65
+ if (pipeIndex < index) pipeIndex = str.indexOf('|', index);
66
+ if (-1 !== pipeIndex && ')' !== str[pipeIndex + 1]) {
67
+ closeParenIndex = str.indexOf(')', pipeIndex);
68
+ if (closeParenIndex > pipeIndex) {
69
+ backSlashIndex = str.indexOf('\\', pipeIndex);
70
+ if (-1 === backSlashIndex || backSlashIndex > closeParenIndex) return true;
71
+ }
72
+ }
73
+ }
74
+ if ('\\' === str[index]) {
75
+ var open = str[index + 1];
76
+ index += 2;
77
+ var close = chars[open];
78
+ if (close) {
79
+ var n = str.indexOf(close, index);
80
+ if (-1 !== n) index = n + 1;
81
+ }
82
+ if ('!' === str[index]) return true;
83
+ } else index++;
84
+ }
85
+ return false;
86
+ };
87
+ var relaxedCheck = function(str) {
88
+ if ('!' === str[0]) return true;
89
+ var index = 0;
90
+ while(index < str.length){
91
+ if (/[*?{}()[\]]/.test(str[index])) return true;
92
+ if ('\\' === str[index]) {
93
+ var open = str[index + 1];
94
+ index += 2;
95
+ var close = chars[open];
96
+ if (close) {
97
+ var n = str.indexOf(close, index);
98
+ if (-1 !== n) index = n + 1;
99
+ }
100
+ if ('!' === str[index]) return true;
101
+ } else index++;
102
+ }
103
+ return false;
104
+ };
105
+ module.exports = function(str, options) {
106
+ if ('string' != typeof str || '' === str) return false;
107
+ if (isExtglob(str)) return true;
108
+ var check = strictCheck;
109
+ if (options && false === options.strict) check = relaxedCheck;
110
+ return check(str);
111
+ };
112
+ },
113
+ "./node_modules/.pnpm/js-tokens@4.0.0/node_modules/js-tokens/index.js" (__unused_rspack_module, exports1) {
114
+ Object.defineProperty(exports1, "__esModule", {
115
+ value: true
116
+ });
117
+ exports1["default"] = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
118
+ exports1.matchToToken = function(match) {
119
+ var token = {
120
+ type: "invalid",
121
+ value: match[0],
122
+ closed: void 0
123
+ };
124
+ if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);
125
+ else if (match[5]) token.type = "comment";
126
+ else if (match[6]) token.type = "comment", token.closed = !!match[7];
127
+ else if (match[8]) token.type = "regex";
128
+ else if (match[9]) token.type = "number";
129
+ else if (match[10]) token.type = "name";
130
+ else if (match[11]) token.type = "punctuator";
131
+ else if (match[12]) token.type = "whitespace";
132
+ return token;
133
+ };
134
+ },
135
+ picocolors (module) {
136
+ "use strict";
137
+ module.exports = require("picocolors");
138
+ },
139
+ "./node_modules/.pnpm/@babel+code-frame@7.29.0/node_modules/@babel/code-frame/lib/index.js" (__unused_rspack_module, exports1, __webpack_require__) {
140
+ "use strict";
141
+ var picocolors = __webpack_require__("picocolors");
142
+ var jsTokens = __webpack_require__("./node_modules/.pnpm/js-tokens@4.0.0/node_modules/js-tokens/index.js");
143
+ var helperValidatorIdentifier = __webpack_require__("./node_modules/.pnpm/@babel+helper-validator-identifier@7.28.5/node_modules/@babel/helper-validator-identifier/lib/index.js");
144
+ function isColorSupported() {
145
+ return "object" == typeof process && ("0" === process.env.FORCE_COLOR || "false" === process.env.FORCE_COLOR) ? false : picocolors.isColorSupported;
146
+ }
147
+ const compose = (f, g)=>(v)=>f(g(v));
148
+ function buildDefs(colors) {
149
+ return {
150
+ keyword: colors.cyan,
151
+ capitalized: colors.yellow,
152
+ jsxIdentifier: colors.yellow,
153
+ punctuator: colors.yellow,
154
+ number: colors.magenta,
155
+ string: colors.green,
156
+ regex: colors.magenta,
157
+ comment: colors.gray,
158
+ invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
159
+ gutter: colors.gray,
160
+ marker: compose(colors.red, colors.bold),
161
+ message: compose(colors.red, colors.bold),
162
+ reset: colors.reset
163
+ };
164
+ }
165
+ const defsOn = buildDefs(picocolors.createColors(true));
166
+ const defsOff = buildDefs(picocolors.createColors(false));
167
+ function getDefs(enabled) {
168
+ return enabled ? defsOn : defsOff;
169
+ }
170
+ const sometimesKeywords = new Set([
171
+ "as",
172
+ "async",
173
+ "from",
174
+ "get",
175
+ "of",
176
+ "set"
177
+ ]);
178
+ const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
179
+ const BRACKET = /^[()[\]{}]$/;
180
+ let tokenize;
181
+ const JSX_TAG = /^[a-z][\w-]*$/i;
182
+ const getTokenType = function(token, offset, text) {
183
+ if ("name" === token.type) {
184
+ const tokenValue = token.value;
185
+ if (helperValidatorIdentifier.isKeyword(tokenValue) || helperValidatorIdentifier.isStrictReservedWord(tokenValue, true) || sometimesKeywords.has(tokenValue)) return "keyword";
186
+ if (JSX_TAG.test(tokenValue) && ("<" === text[offset - 1] || "</" === text.slice(offset - 2, offset))) return "jsxIdentifier";
187
+ const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));
188
+ if (firstChar !== firstChar.toLowerCase()) return "capitalized";
189
+ }
190
+ if ("punctuator" === token.type && BRACKET.test(token.value)) return "bracket";
191
+ if ("invalid" === token.type && ("@" === token.value || "#" === token.value)) return "punctuator";
192
+ return token.type;
193
+ };
194
+ tokenize = function*(text) {
195
+ let match;
196
+ while(match = jsTokens.default.exec(text)){
197
+ const token = jsTokens.matchToToken(match);
198
+ yield {
199
+ type: getTokenType(token, match.index, text),
200
+ value: token.value
201
+ };
202
+ }
203
+ };
204
+ function highlight(text) {
205
+ if ("" === text) return "";
206
+ const defs = getDefs(true);
207
+ let highlighted = "";
208
+ for (const { type, value } of tokenize(text))if (type in defs) highlighted += value.split(NEWLINE$1).map((str)=>defs[type](str)).join("\n");
209
+ else highlighted += value;
210
+ return highlighted;
211
+ }
212
+ const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
213
+ function getMarkerLines(loc, source, opts, startLineBaseZero) {
214
+ const startLoc = Object.assign({
215
+ column: 0,
216
+ line: -1
217
+ }, loc.start);
218
+ const endLoc = Object.assign({}, startLoc, loc.end);
219
+ const { linesAbove = 2, linesBelow = 3 } = opts || {};
220
+ const startLine = startLoc.line - startLineBaseZero;
221
+ const startColumn = startLoc.column;
222
+ const endLine = endLoc.line - startLineBaseZero;
223
+ const endColumn = endLoc.column;
224
+ let start = Math.max(startLine - (linesAbove + 1), 0);
225
+ let end = Math.min(source.length, endLine + linesBelow);
226
+ if (-1 === startLine) start = 0;
227
+ if (-1 === endLine) end = source.length;
228
+ const lineDiff = endLine - startLine;
229
+ const markerLines = {};
230
+ if (lineDiff) for(let i = 0; i <= lineDiff; i++){
231
+ const lineNumber = i + startLine;
232
+ if (startColumn) if (0 === i) {
233
+ const sourceLength = source[lineNumber - 1].length;
234
+ markerLines[lineNumber] = [
235
+ startColumn,
236
+ sourceLength - startColumn + 1
237
+ ];
238
+ } else if (i === lineDiff) markerLines[lineNumber] = [
239
+ 0,
240
+ endColumn
241
+ ];
242
+ else {
243
+ const sourceLength = source[lineNumber - i].length;
244
+ markerLines[lineNumber] = [
245
+ 0,
246
+ sourceLength
247
+ ];
248
+ }
249
+ else markerLines[lineNumber] = true;
250
+ }
251
+ else if (startColumn === endColumn) if (startColumn) markerLines[startLine] = [
252
+ startColumn,
253
+ 0
254
+ ];
255
+ else markerLines[startLine] = true;
256
+ else markerLines[startLine] = [
257
+ startColumn,
258
+ endColumn - startColumn
259
+ ];
260
+ return {
261
+ start,
262
+ end,
263
+ markerLines
264
+ };
265
+ }
266
+ function codeFrameColumns(rawLines, loc, opts = {}) {
267
+ const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
268
+ const startLineBaseZero = (opts.startLine || 1) - 1;
269
+ const defs = getDefs(shouldHighlight);
270
+ const lines = rawLines.split(NEWLINE);
271
+ const { start, end, markerLines } = getMarkerLines(loc, lines, opts, startLineBaseZero);
272
+ const hasColumns = loc.start && "number" == typeof loc.start.column;
273
+ const numberMaxWidth = String(end + startLineBaseZero).length;
274
+ const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
275
+ let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index)=>{
276
+ const number = start + 1 + index;
277
+ const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
278
+ const gutter = ` ${paddedNumber} |`;
279
+ const hasMarker = markerLines[number];
280
+ const lastMarkerLine = !markerLines[number + 1];
281
+ if (!hasMarker) return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
282
+ {
283
+ let markerLine = "";
284
+ if (Array.isArray(hasMarker)) {
285
+ const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
286
+ const numberOfMarkers = hasMarker[1] || 1;
287
+ markerLine = [
288
+ "\n ",
289
+ defs.gutter(gutter.replace(/\d/g, " ")),
290
+ " ",
291
+ markerSpacing,
292
+ defs.marker("^").repeat(numberOfMarkers)
293
+ ].join("");
294
+ if (lastMarkerLine && opts.message) markerLine += " " + defs.message(opts.message);
295
+ }
296
+ return [
297
+ defs.marker(">"),
298
+ defs.gutter(gutter),
299
+ line.length > 0 ? ` ${line}` : "",
300
+ markerLine
301
+ ].join("");
302
+ }
303
+ }).join("\n");
304
+ if (opts.message && !hasColumns) frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
305
+ if (shouldHighlight) return defs.reset(frame);
306
+ return frame;
307
+ }
308
+ exports1.codeFrameColumns = codeFrameColumns;
309
+ },
310
+ "./node_modules/.pnpm/@babel+helper-validator-identifier@7.28.5/node_modules/@babel/helper-validator-identifier/lib/identifier.js" (__unused_rspack_module, exports1) {
311
+ "use strict";
312
+ Object.defineProperty(exports1, "__esModule", {
313
+ value: true
314
+ });
315
+ exports1.isIdentifierChar = isIdentifierChar;
316
+ exports1.isIdentifierName = isIdentifierName;
317
+ exports1.isIdentifierStart = isIdentifierStart;
318
+ let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
319
+ let nonASCIIidentifierChars = "\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
320
+ const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
321
+ const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
322
+ nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
323
+ const astralIdentifierStartCodes = [
324
+ 0,
325
+ 11,
326
+ 2,
327
+ 25,
328
+ 2,
329
+ 18,
330
+ 2,
331
+ 1,
332
+ 2,
333
+ 14,
334
+ 3,
335
+ 13,
336
+ 35,
337
+ 122,
338
+ 70,
339
+ 52,
340
+ 268,
341
+ 28,
342
+ 4,
343
+ 48,
344
+ 48,
345
+ 31,
346
+ 14,
347
+ 29,
348
+ 6,
349
+ 37,
350
+ 11,
351
+ 29,
352
+ 3,
353
+ 35,
354
+ 5,
355
+ 7,
356
+ 2,
357
+ 4,
358
+ 43,
359
+ 157,
360
+ 19,
361
+ 35,
362
+ 5,
363
+ 35,
364
+ 5,
365
+ 39,
366
+ 9,
367
+ 51,
368
+ 13,
369
+ 10,
370
+ 2,
371
+ 14,
372
+ 2,
373
+ 6,
374
+ 2,
375
+ 1,
376
+ 2,
377
+ 10,
378
+ 2,
379
+ 14,
380
+ 2,
381
+ 6,
382
+ 2,
383
+ 1,
384
+ 4,
385
+ 51,
386
+ 13,
387
+ 310,
388
+ 10,
389
+ 21,
390
+ 11,
391
+ 7,
392
+ 25,
393
+ 5,
394
+ 2,
395
+ 41,
396
+ 2,
397
+ 8,
398
+ 70,
399
+ 5,
400
+ 3,
401
+ 0,
402
+ 2,
403
+ 43,
404
+ 2,
405
+ 1,
406
+ 4,
407
+ 0,
408
+ 3,
409
+ 22,
410
+ 11,
411
+ 22,
412
+ 10,
413
+ 30,
414
+ 66,
415
+ 18,
416
+ 2,
417
+ 1,
418
+ 11,
419
+ 21,
420
+ 11,
421
+ 25,
422
+ 7,
423
+ 25,
424
+ 39,
425
+ 55,
426
+ 7,
427
+ 1,
428
+ 65,
429
+ 0,
430
+ 16,
431
+ 3,
432
+ 2,
433
+ 2,
434
+ 2,
435
+ 28,
436
+ 43,
437
+ 28,
438
+ 4,
439
+ 28,
440
+ 36,
441
+ 7,
442
+ 2,
443
+ 27,
444
+ 28,
445
+ 53,
446
+ 11,
447
+ 21,
448
+ 11,
449
+ 18,
450
+ 14,
451
+ 17,
452
+ 111,
453
+ 72,
454
+ 56,
455
+ 50,
456
+ 14,
457
+ 50,
458
+ 14,
459
+ 35,
460
+ 39,
461
+ 27,
462
+ 10,
463
+ 22,
464
+ 251,
465
+ 41,
466
+ 7,
467
+ 1,
468
+ 17,
469
+ 5,
470
+ 57,
471
+ 28,
472
+ 11,
473
+ 0,
474
+ 9,
475
+ 21,
476
+ 43,
477
+ 17,
478
+ 47,
479
+ 20,
480
+ 28,
481
+ 22,
482
+ 13,
483
+ 52,
484
+ 58,
485
+ 1,
486
+ 3,
487
+ 0,
488
+ 14,
489
+ 44,
490
+ 33,
491
+ 24,
492
+ 27,
493
+ 35,
494
+ 30,
495
+ 0,
496
+ 3,
497
+ 0,
498
+ 9,
499
+ 34,
500
+ 4,
501
+ 0,
502
+ 13,
503
+ 47,
504
+ 15,
505
+ 3,
506
+ 22,
507
+ 0,
508
+ 2,
509
+ 0,
510
+ 36,
511
+ 17,
512
+ 2,
513
+ 24,
514
+ 20,
515
+ 1,
516
+ 64,
517
+ 6,
518
+ 2,
519
+ 0,
520
+ 2,
521
+ 3,
522
+ 2,
523
+ 14,
524
+ 2,
525
+ 9,
526
+ 8,
527
+ 46,
528
+ 39,
529
+ 7,
530
+ 3,
531
+ 1,
532
+ 3,
533
+ 21,
534
+ 2,
535
+ 6,
536
+ 2,
537
+ 1,
538
+ 2,
539
+ 4,
540
+ 4,
541
+ 0,
542
+ 19,
543
+ 0,
544
+ 13,
545
+ 4,
546
+ 31,
547
+ 9,
548
+ 2,
549
+ 0,
550
+ 3,
551
+ 0,
552
+ 2,
553
+ 37,
554
+ 2,
555
+ 0,
556
+ 26,
557
+ 0,
558
+ 2,
559
+ 0,
560
+ 45,
561
+ 52,
562
+ 19,
563
+ 3,
564
+ 21,
565
+ 2,
566
+ 31,
567
+ 47,
568
+ 21,
569
+ 1,
570
+ 2,
571
+ 0,
572
+ 185,
573
+ 46,
574
+ 42,
575
+ 3,
576
+ 37,
577
+ 47,
578
+ 21,
579
+ 0,
580
+ 60,
581
+ 42,
582
+ 14,
583
+ 0,
584
+ 72,
585
+ 26,
586
+ 38,
587
+ 6,
588
+ 186,
589
+ 43,
590
+ 117,
591
+ 63,
592
+ 32,
593
+ 7,
594
+ 3,
595
+ 0,
596
+ 3,
597
+ 7,
598
+ 2,
599
+ 1,
600
+ 2,
601
+ 23,
602
+ 16,
603
+ 0,
604
+ 2,
605
+ 0,
606
+ 95,
607
+ 7,
608
+ 3,
609
+ 38,
610
+ 17,
611
+ 0,
612
+ 2,
613
+ 0,
614
+ 29,
615
+ 0,
616
+ 11,
617
+ 39,
618
+ 8,
619
+ 0,
620
+ 22,
621
+ 0,
622
+ 12,
623
+ 45,
624
+ 20,
625
+ 0,
626
+ 19,
627
+ 72,
628
+ 200,
629
+ 32,
630
+ 32,
631
+ 8,
632
+ 2,
633
+ 36,
634
+ 18,
635
+ 0,
636
+ 50,
637
+ 29,
638
+ 113,
639
+ 6,
640
+ 2,
641
+ 1,
642
+ 2,
643
+ 37,
644
+ 22,
645
+ 0,
646
+ 26,
647
+ 5,
648
+ 2,
649
+ 1,
650
+ 2,
651
+ 31,
652
+ 15,
653
+ 0,
654
+ 24,
655
+ 43,
656
+ 261,
657
+ 18,
658
+ 16,
659
+ 0,
660
+ 2,
661
+ 12,
662
+ 2,
663
+ 33,
664
+ 125,
665
+ 0,
666
+ 80,
667
+ 921,
668
+ 103,
669
+ 110,
670
+ 18,
671
+ 195,
672
+ 2637,
673
+ 96,
674
+ 16,
675
+ 1071,
676
+ 18,
677
+ 5,
678
+ 26,
679
+ 3994,
680
+ 6,
681
+ 582,
682
+ 6842,
683
+ 29,
684
+ 1763,
685
+ 568,
686
+ 8,
687
+ 30,
688
+ 18,
689
+ 78,
690
+ 18,
691
+ 29,
692
+ 19,
693
+ 47,
694
+ 17,
695
+ 3,
696
+ 32,
697
+ 20,
698
+ 6,
699
+ 18,
700
+ 433,
701
+ 44,
702
+ 212,
703
+ 63,
704
+ 33,
705
+ 24,
706
+ 3,
707
+ 24,
708
+ 45,
709
+ 74,
710
+ 6,
711
+ 0,
712
+ 67,
713
+ 12,
714
+ 65,
715
+ 1,
716
+ 2,
717
+ 0,
718
+ 15,
719
+ 4,
720
+ 10,
721
+ 7381,
722
+ 42,
723
+ 31,
724
+ 98,
725
+ 114,
726
+ 8702,
727
+ 3,
728
+ 2,
729
+ 6,
730
+ 2,
731
+ 1,
732
+ 2,
733
+ 290,
734
+ 16,
735
+ 0,
736
+ 30,
737
+ 2,
738
+ 3,
739
+ 0,
740
+ 15,
741
+ 3,
742
+ 9,
743
+ 395,
744
+ 2309,
745
+ 106,
746
+ 6,
747
+ 12,
748
+ 4,
749
+ 8,
750
+ 8,
751
+ 9,
752
+ 5991,
753
+ 84,
754
+ 2,
755
+ 70,
756
+ 2,
757
+ 1,
758
+ 3,
759
+ 0,
760
+ 3,
761
+ 1,
762
+ 3,
763
+ 3,
764
+ 2,
765
+ 11,
766
+ 2,
767
+ 0,
768
+ 2,
769
+ 6,
770
+ 2,
771
+ 64,
772
+ 2,
773
+ 3,
774
+ 3,
775
+ 7,
776
+ 2,
777
+ 6,
778
+ 2,
779
+ 27,
780
+ 2,
781
+ 3,
782
+ 2,
783
+ 4,
784
+ 2,
785
+ 0,
786
+ 4,
787
+ 6,
788
+ 2,
789
+ 339,
790
+ 3,
791
+ 24,
792
+ 2,
793
+ 24,
794
+ 2,
795
+ 30,
796
+ 2,
797
+ 24,
798
+ 2,
799
+ 30,
800
+ 2,
801
+ 24,
802
+ 2,
803
+ 30,
804
+ 2,
805
+ 24,
806
+ 2,
807
+ 30,
808
+ 2,
809
+ 24,
810
+ 2,
811
+ 7,
812
+ 1845,
813
+ 30,
814
+ 7,
815
+ 5,
816
+ 262,
817
+ 61,
818
+ 147,
819
+ 44,
820
+ 11,
821
+ 6,
822
+ 17,
823
+ 0,
824
+ 322,
825
+ 29,
826
+ 19,
827
+ 43,
828
+ 485,
829
+ 27,
830
+ 229,
831
+ 29,
832
+ 3,
833
+ 0,
834
+ 208,
835
+ 30,
836
+ 2,
837
+ 2,
838
+ 2,
839
+ 1,
840
+ 2,
841
+ 6,
842
+ 3,
843
+ 4,
844
+ 10,
845
+ 1,
846
+ 225,
847
+ 6,
848
+ 2,
849
+ 3,
850
+ 2,
851
+ 1,
852
+ 2,
853
+ 14,
854
+ 2,
855
+ 196,
856
+ 60,
857
+ 67,
858
+ 8,
859
+ 0,
860
+ 1205,
861
+ 3,
862
+ 2,
863
+ 26,
864
+ 2,
865
+ 1,
866
+ 2,
867
+ 0,
868
+ 3,
869
+ 0,
870
+ 2,
871
+ 9,
872
+ 2,
873
+ 3,
874
+ 2,
875
+ 0,
876
+ 2,
877
+ 0,
878
+ 7,
879
+ 0,
880
+ 5,
881
+ 0,
882
+ 2,
883
+ 0,
884
+ 2,
885
+ 0,
886
+ 2,
887
+ 2,
888
+ 2,
889
+ 1,
890
+ 2,
891
+ 0,
892
+ 3,
893
+ 0,
894
+ 2,
895
+ 0,
896
+ 2,
897
+ 0,
898
+ 2,
899
+ 0,
900
+ 2,
901
+ 0,
902
+ 2,
903
+ 1,
904
+ 2,
905
+ 0,
906
+ 3,
907
+ 3,
908
+ 2,
909
+ 6,
910
+ 2,
911
+ 3,
912
+ 2,
913
+ 3,
914
+ 2,
915
+ 0,
916
+ 2,
917
+ 9,
918
+ 2,
919
+ 16,
920
+ 6,
921
+ 2,
922
+ 2,
923
+ 4,
924
+ 2,
925
+ 16,
926
+ 4421,
927
+ 42719,
928
+ 33,
929
+ 4381,
930
+ 3,
931
+ 5773,
932
+ 3,
933
+ 7472,
934
+ 16,
935
+ 621,
936
+ 2467,
937
+ 541,
938
+ 1507,
939
+ 4938,
940
+ 6,
941
+ 8489
942
+ ];
943
+ const astralIdentifierCodes = [
944
+ 509,
945
+ 0,
946
+ 227,
947
+ 0,
948
+ 150,
949
+ 4,
950
+ 294,
951
+ 9,
952
+ 1368,
953
+ 2,
954
+ 2,
955
+ 1,
956
+ 6,
957
+ 3,
958
+ 41,
959
+ 2,
960
+ 5,
961
+ 0,
962
+ 166,
963
+ 1,
964
+ 574,
965
+ 3,
966
+ 9,
967
+ 9,
968
+ 7,
969
+ 9,
970
+ 32,
971
+ 4,
972
+ 318,
973
+ 1,
974
+ 78,
975
+ 5,
976
+ 71,
977
+ 10,
978
+ 50,
979
+ 3,
980
+ 123,
981
+ 2,
982
+ 54,
983
+ 14,
984
+ 32,
985
+ 10,
986
+ 3,
987
+ 1,
988
+ 11,
989
+ 3,
990
+ 46,
991
+ 10,
992
+ 8,
993
+ 0,
994
+ 46,
995
+ 9,
996
+ 7,
997
+ 2,
998
+ 37,
999
+ 13,
1000
+ 2,
1001
+ 9,
1002
+ 6,
1003
+ 1,
1004
+ 45,
1005
+ 0,
1006
+ 13,
1007
+ 2,
1008
+ 49,
1009
+ 13,
1010
+ 9,
1011
+ 3,
1012
+ 2,
1013
+ 11,
1014
+ 83,
1015
+ 11,
1016
+ 7,
1017
+ 0,
1018
+ 3,
1019
+ 0,
1020
+ 158,
1021
+ 11,
1022
+ 6,
1023
+ 9,
1024
+ 7,
1025
+ 3,
1026
+ 56,
1027
+ 1,
1028
+ 2,
1029
+ 6,
1030
+ 3,
1031
+ 1,
1032
+ 3,
1033
+ 2,
1034
+ 10,
1035
+ 0,
1036
+ 11,
1037
+ 1,
1038
+ 3,
1039
+ 6,
1040
+ 4,
1041
+ 4,
1042
+ 68,
1043
+ 8,
1044
+ 2,
1045
+ 0,
1046
+ 3,
1047
+ 0,
1048
+ 2,
1049
+ 3,
1050
+ 2,
1051
+ 4,
1052
+ 2,
1053
+ 0,
1054
+ 15,
1055
+ 1,
1056
+ 83,
1057
+ 17,
1058
+ 10,
1059
+ 9,
1060
+ 5,
1061
+ 0,
1062
+ 82,
1063
+ 19,
1064
+ 13,
1065
+ 9,
1066
+ 214,
1067
+ 6,
1068
+ 3,
1069
+ 8,
1070
+ 28,
1071
+ 1,
1072
+ 83,
1073
+ 16,
1074
+ 16,
1075
+ 9,
1076
+ 82,
1077
+ 12,
1078
+ 9,
1079
+ 9,
1080
+ 7,
1081
+ 19,
1082
+ 58,
1083
+ 14,
1084
+ 5,
1085
+ 9,
1086
+ 243,
1087
+ 14,
1088
+ 166,
1089
+ 9,
1090
+ 71,
1091
+ 5,
1092
+ 2,
1093
+ 1,
1094
+ 3,
1095
+ 3,
1096
+ 2,
1097
+ 0,
1098
+ 2,
1099
+ 1,
1100
+ 13,
1101
+ 9,
1102
+ 120,
1103
+ 6,
1104
+ 3,
1105
+ 6,
1106
+ 4,
1107
+ 0,
1108
+ 29,
1109
+ 9,
1110
+ 41,
1111
+ 6,
1112
+ 2,
1113
+ 3,
1114
+ 9,
1115
+ 0,
1116
+ 10,
1117
+ 10,
1118
+ 47,
1119
+ 15,
1120
+ 199,
1121
+ 7,
1122
+ 137,
1123
+ 9,
1124
+ 54,
1125
+ 7,
1126
+ 2,
1127
+ 7,
1128
+ 17,
1129
+ 9,
1130
+ 57,
1131
+ 21,
1132
+ 2,
1133
+ 13,
1134
+ 123,
1135
+ 5,
1136
+ 4,
1137
+ 0,
1138
+ 2,
1139
+ 1,
1140
+ 2,
1141
+ 6,
1142
+ 2,
1143
+ 0,
1144
+ 9,
1145
+ 9,
1146
+ 49,
1147
+ 4,
1148
+ 2,
1149
+ 1,
1150
+ 2,
1151
+ 4,
1152
+ 9,
1153
+ 9,
1154
+ 55,
1155
+ 9,
1156
+ 266,
1157
+ 3,
1158
+ 10,
1159
+ 1,
1160
+ 2,
1161
+ 0,
1162
+ 49,
1163
+ 6,
1164
+ 4,
1165
+ 4,
1166
+ 14,
1167
+ 10,
1168
+ 5350,
1169
+ 0,
1170
+ 7,
1171
+ 14,
1172
+ 11465,
1173
+ 27,
1174
+ 2343,
1175
+ 9,
1176
+ 87,
1177
+ 9,
1178
+ 39,
1179
+ 4,
1180
+ 60,
1181
+ 6,
1182
+ 26,
1183
+ 9,
1184
+ 535,
1185
+ 9,
1186
+ 470,
1187
+ 0,
1188
+ 2,
1189
+ 54,
1190
+ 8,
1191
+ 3,
1192
+ 82,
1193
+ 0,
1194
+ 12,
1195
+ 1,
1196
+ 19628,
1197
+ 1,
1198
+ 4178,
1199
+ 9,
1200
+ 519,
1201
+ 45,
1202
+ 3,
1203
+ 22,
1204
+ 543,
1205
+ 4,
1206
+ 4,
1207
+ 5,
1208
+ 9,
1209
+ 7,
1210
+ 3,
1211
+ 6,
1212
+ 31,
1213
+ 3,
1214
+ 149,
1215
+ 2,
1216
+ 1418,
1217
+ 49,
1218
+ 513,
1219
+ 54,
1220
+ 5,
1221
+ 49,
1222
+ 9,
1223
+ 0,
1224
+ 15,
1225
+ 0,
1226
+ 23,
1227
+ 4,
1228
+ 2,
1229
+ 14,
1230
+ 1361,
1231
+ 6,
1232
+ 2,
1233
+ 16,
1234
+ 3,
1235
+ 6,
1236
+ 2,
1237
+ 1,
1238
+ 2,
1239
+ 4,
1240
+ 101,
1241
+ 0,
1242
+ 161,
1243
+ 6,
1244
+ 10,
1245
+ 9,
1246
+ 357,
1247
+ 0,
1248
+ 62,
1249
+ 13,
1250
+ 499,
1251
+ 13,
1252
+ 245,
1253
+ 1,
1254
+ 2,
1255
+ 9,
1256
+ 233,
1257
+ 0,
1258
+ 3,
1259
+ 0,
1260
+ 8,
1261
+ 1,
1262
+ 6,
1263
+ 0,
1264
+ 475,
1265
+ 6,
1266
+ 110,
1267
+ 6,
1268
+ 6,
1269
+ 9,
1270
+ 4759,
1271
+ 9,
1272
+ 787719,
1273
+ 239
1274
+ ];
1275
+ function isInAstralSet(code, set) {
1276
+ let pos = 0x10000;
1277
+ for(let i = 0, length = set.length; i < length; i += 2){
1278
+ pos += set[i];
1279
+ if (pos > code) break;
1280
+ pos += set[i + 1];
1281
+ if (pos >= code) return true;
1282
+ }
1283
+ return false;
1284
+ }
1285
+ function isIdentifierStart(code) {
1286
+ if (code < 65) return 36 === code;
1287
+ if (code <= 90) return true;
1288
+ if (code < 97) return 95 === code;
1289
+ if (code <= 122) return true;
1290
+ if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
1291
+ return isInAstralSet(code, astralIdentifierStartCodes);
1292
+ }
1293
+ function isIdentifierChar(code) {
1294
+ if (code < 48) return 36 === code;
1295
+ if (code < 58) return true;
1296
+ if (code < 65) return false;
1297
+ if (code <= 90) return true;
1298
+ if (code < 97) return 95 === code;
1299
+ if (code <= 122) return true;
1300
+ if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
1301
+ return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
1302
+ }
1303
+ function isIdentifierName(name) {
1304
+ let isFirst = true;
1305
+ for(let i = 0; i < name.length; i++){
1306
+ let cp = name.charCodeAt(i);
1307
+ if ((0xfc00 & cp) === 0xd800 && i + 1 < name.length) {
1308
+ const trail = name.charCodeAt(++i);
1309
+ if ((0xfc00 & trail) === 0xdc00) cp = 0x10000 + ((0x3ff & cp) << 10) + (0x3ff & trail);
1310
+ }
1311
+ if (isFirst) {
1312
+ isFirst = false;
1313
+ if (!isIdentifierStart(cp)) return false;
1314
+ } else if (!isIdentifierChar(cp)) return false;
1315
+ }
1316
+ return !isFirst;
1317
+ }
1318
+ },
1319
+ "./node_modules/.pnpm/@babel+helper-validator-identifier@7.28.5/node_modules/@babel/helper-validator-identifier/lib/index.js" (__unused_rspack_module, exports1, __webpack_require__) {
1320
+ "use strict";
1321
+ Object.defineProperty(exports1, "__esModule", {
1322
+ value: true
1323
+ });
1324
+ Object.defineProperty(exports1, "isIdentifierChar", {
1325
+ enumerable: true,
1326
+ get: function() {
1327
+ return _identifier.isIdentifierChar;
1328
+ }
1329
+ });
1330
+ Object.defineProperty(exports1, "isIdentifierName", {
1331
+ enumerable: true,
1332
+ get: function() {
1333
+ return _identifier.isIdentifierName;
1334
+ }
1335
+ });
1336
+ Object.defineProperty(exports1, "isIdentifierStart", {
1337
+ enumerable: true,
1338
+ get: function() {
1339
+ return _identifier.isIdentifierStart;
1340
+ }
1341
+ });
1342
+ Object.defineProperty(exports1, "isKeyword", {
1343
+ enumerable: true,
1344
+ get: function() {
1345
+ return _keyword.isKeyword;
1346
+ }
1347
+ });
1348
+ Object.defineProperty(exports1, "isReservedWord", {
1349
+ enumerable: true,
1350
+ get: function() {
1351
+ return _keyword.isReservedWord;
1352
+ }
1353
+ });
1354
+ Object.defineProperty(exports1, "isStrictBindOnlyReservedWord", {
1355
+ enumerable: true,
1356
+ get: function() {
1357
+ return _keyword.isStrictBindOnlyReservedWord;
1358
+ }
1359
+ });
1360
+ Object.defineProperty(exports1, "isStrictBindReservedWord", {
1361
+ enumerable: true,
1362
+ get: function() {
1363
+ return _keyword.isStrictBindReservedWord;
1364
+ }
1365
+ });
1366
+ Object.defineProperty(exports1, "isStrictReservedWord", {
1367
+ enumerable: true,
1368
+ get: function() {
1369
+ return _keyword.isStrictReservedWord;
1370
+ }
1371
+ });
1372
+ var _identifier = __webpack_require__("./node_modules/.pnpm/@babel+helper-validator-identifier@7.28.5/node_modules/@babel/helper-validator-identifier/lib/identifier.js");
1373
+ var _keyword = __webpack_require__("./node_modules/.pnpm/@babel+helper-validator-identifier@7.28.5/node_modules/@babel/helper-validator-identifier/lib/keyword.js");
1374
+ },
1375
+ "./node_modules/.pnpm/@babel+helper-validator-identifier@7.28.5/node_modules/@babel/helper-validator-identifier/lib/keyword.js" (__unused_rspack_module, exports1) {
1376
+ "use strict";
1377
+ Object.defineProperty(exports1, "__esModule", {
1378
+ value: true
1379
+ });
1380
+ exports1.isKeyword = isKeyword;
1381
+ exports1.isReservedWord = isReservedWord;
1382
+ exports1.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
1383
+ exports1.isStrictBindReservedWord = isStrictBindReservedWord;
1384
+ exports1.isStrictReservedWord = isStrictReservedWord;
1385
+ const reservedWords = {
1386
+ keyword: [
1387
+ "break",
1388
+ "case",
1389
+ "catch",
1390
+ "continue",
1391
+ "debugger",
1392
+ "default",
1393
+ "do",
1394
+ "else",
1395
+ "finally",
1396
+ "for",
1397
+ "function",
1398
+ "if",
1399
+ "return",
1400
+ "switch",
1401
+ "throw",
1402
+ "try",
1403
+ "var",
1404
+ "const",
1405
+ "while",
1406
+ "with",
1407
+ "new",
1408
+ "this",
1409
+ "super",
1410
+ "class",
1411
+ "extends",
1412
+ "export",
1413
+ "import",
1414
+ "null",
1415
+ "true",
1416
+ "false",
1417
+ "in",
1418
+ "instanceof",
1419
+ "typeof",
1420
+ "void",
1421
+ "delete"
1422
+ ],
1423
+ strict: [
1424
+ "implements",
1425
+ "interface",
1426
+ "let",
1427
+ "package",
1428
+ "private",
1429
+ "protected",
1430
+ "public",
1431
+ "static",
1432
+ "yield"
1433
+ ],
1434
+ strictBind: [
1435
+ "eval",
1436
+ "arguments"
1437
+ ]
1438
+ };
1439
+ const keywords = new Set(reservedWords.keyword);
1440
+ const reservedWordsStrictSet = new Set(reservedWords.strict);
1441
+ const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
1442
+ function isReservedWord(word, inModule) {
1443
+ return inModule && "await" === word || "enum" === word;
1444
+ }
1445
+ function isStrictReservedWord(word, inModule) {
1446
+ return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
1447
+ }
1448
+ function isStrictBindOnlyReservedWord(word) {
1449
+ return reservedWordsStrictBindSet.has(word);
1450
+ }
1451
+ function isStrictBindReservedWord(word, inModule) {
1452
+ return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
1453
+ }
1454
+ function isKeyword(word) {
1455
+ return keywords.has(word);
1456
+ }
1457
+ }
1458
+ };
1459
+ var __webpack_module_cache__ = {};
1460
+ function __webpack_require__(moduleId) {
1461
+ var cachedModule = __webpack_module_cache__[moduleId];
1462
+ if (void 0 !== cachedModule) return cachedModule.exports;
1463
+ var module = __webpack_module_cache__[moduleId] = {
1464
+ exports: {}
1465
+ };
1466
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1467
+ return module.exports;
1468
+ }
3
1469
  (()=>{
4
1470
  __webpack_require__.n = (module)=>{
5
1471
  var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
@@ -22,7 +1488,7 @@ var __webpack_require__ = {};
22
1488
  })();
23
1489
  (()=>{
24
1490
  __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
1491
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
1492
  value: 'Module'
27
1493
  });
28
1494
  Object.defineProperty(exports1, '__esModule', {
@@ -31,942 +1497,2291 @@ var __webpack_require__ = {};
31
1497
  };
32
1498
  })();
33
1499
  var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- TsCheckerRspackPlugin: ()=>TsCheckerRspackPlugin
37
- });
38
- const external_node_path_namespaceObject = require("node:path");
39
- var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
40
- function getInfrastructureLogger(compiler) {
41
- const logger = compiler.getInfrastructureLogger('TsCheckerRspackPlugin');
42
- return {
43
- log: logger.log.bind(logger),
44
- debug: logger.debug.bind(logger),
45
- error: logger.error.bind(logger),
46
- warn: logger.warn.bind(logger),
47
- info: logger.info.bind(logger)
48
- };
49
- }
50
- const addTrailingSep = (dir)=>dir.endsWith(external_node_path_namespaceObject.sep) ? dir : dir + external_node_path_namespaceObject.sep;
51
- const isStrictSubdir = (parent, child)=>{
52
- const parentDir = addTrailingSep(parent);
53
- const childDir = addTrailingSep(child);
54
- return parentDir !== childDir && childDir.startsWith(parentDir);
55
- };
56
- function excludeOutputPath(dependencies, compiler) {
57
- const isContextIncluded = dependencies.dirs.includes(compiler.context);
58
- if (!isContextIncluded) return dependencies;
59
- const outputPath = 'string' == typeof compiler.options.output?.path ? compiler.options.output.path : compiler.outputPath;
60
- if (!outputPath || !isStrictSubdir(compiler.context, outputPath) || dependencies.dirs.includes(outputPath)) return dependencies;
61
- const excluded = new Set(dependencies.excluded);
62
- excluded.add(outputPath);
63
- return {
64
- ...dependencies,
65
- excluded: Array.from(excluded)
66
- };
67
- }
68
- function tapAfterCompileToAddDependencies(compiler, config, state) {
69
- const { debug } = getInfrastructureLogger(compiler);
70
- compiler.hooks.afterCompile.tapPromise('TsCheckerRspackPlugin', async (compilation)=>{
71
- if (compilation.compiler !== compiler) return;
72
- const dependencies = await state.dependenciesPromise;
73
- debug("Got dependencies from the getDependenciesWorker.", dependencies);
74
- if (dependencies) {
75
- const sanitizedDependencies = excludeOutputPath(dependencies, compiler);
76
- state.lastDependencies = sanitizedDependencies;
77
- sanitizedDependencies.files.forEach((file)=>{
78
- compilation.fileDependencies.add(file);
79
- });
80
- }
1500
+ (()=>{
1501
+ "use strict";
1502
+ __webpack_require__.r(__webpack_exports__);
1503
+ __webpack_require__.d(__webpack_exports__, {
1504
+ TsCheckerRspackPlugin: ()=>TsCheckerRspackPlugin
81
1505
  });
82
- }
83
- const external_chokidar_namespaceObject = require("chokidar");
84
- var external_chokidar_default = /*#__PURE__*/ __webpack_require__.n(external_chokidar_namespaceObject);
85
- const external_minimatch_namespaceObject = require("minimatch");
86
- const external_is_glob_namespaceObject = require("is-glob");
87
- var external_is_glob_default = /*#__PURE__*/ __webpack_require__.n(external_is_glob_namespaceObject);
88
- const IGNORED_FILES = [
89
- 'package.json'
90
- ];
91
- const isIgnoredFile = (file)=>IGNORED_FILES.some((ignoredFile)=>file.endsWith(`/${ignoredFile}`) || file.endsWith(`\\${ignoredFile}`));
92
- const compilerFilesChangeMap = new WeakMap();
93
- function getFilesChange(compiler) {
94
- const { changedFiles = [], deletedFiles = [] } = compilerFilesChangeMap.get(compiler) || {
95
- changedFiles: [],
96
- deletedFiles: []
1506
+ const external_node_path_namespaceObject = require("node:path");
1507
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
1508
+ function getInfrastructureLogger(compiler) {
1509
+ const logger = compiler.getInfrastructureLogger('TsCheckerRspackPlugin');
1510
+ return {
1511
+ log: logger.log.bind(logger),
1512
+ debug: logger.debug.bind(logger),
1513
+ error: logger.error.bind(logger),
1514
+ warn: logger.warn.bind(logger),
1515
+ info: logger.info.bind(logger)
1516
+ };
1517
+ }
1518
+ const addTrailingSep = (dir)=>dir.endsWith(external_node_path_namespaceObject.sep) ? dir : dir + external_node_path_namespaceObject.sep;
1519
+ const isStrictSubdir = (parent, child)=>{
1520
+ const parentDir = addTrailingSep(parent);
1521
+ const childDir = addTrailingSep(child);
1522
+ return parentDir !== childDir && childDir.startsWith(parentDir);
97
1523
  };
98
- return {
99
- changedFiles: changedFiles.filter((changedFile)=>!isIgnoredFile(changedFile)),
100
- deletedFiles: deletedFiles.filter((deletedFile)=>!isIgnoredFile(deletedFile))
1524
+ function excludeOutputPath(dependencies, compiler) {
1525
+ const isContextIncluded = dependencies.dirs.includes(compiler.context);
1526
+ if (!isContextIncluded) return dependencies;
1527
+ const outputPath = 'string' == typeof compiler.options.output?.path ? compiler.options.output.path : compiler.outputPath;
1528
+ if (!outputPath || !isStrictSubdir(compiler.context, outputPath) || dependencies.dirs.includes(outputPath)) return dependencies;
1529
+ const excluded = new Set(dependencies.excluded);
1530
+ excluded.add(outputPath);
1531
+ return {
1532
+ ...dependencies,
1533
+ excluded: Array.from(excluded)
1534
+ };
1535
+ }
1536
+ function tapAfterCompileToAddDependencies(compiler, config, state) {
1537
+ const { debug } = getInfrastructureLogger(compiler);
1538
+ compiler.hooks.afterCompile.tapPromise('TsCheckerRspackPlugin', async (compilation)=>{
1539
+ if (compilation.compiler !== compiler) return;
1540
+ const dependencies = await state.dependenciesPromise;
1541
+ debug("Got dependencies from the getDependenciesWorker.", dependencies);
1542
+ if (dependencies) {
1543
+ const sanitizedDependencies = excludeOutputPath(dependencies, compiler);
1544
+ state.lastDependencies = sanitizedDependencies;
1545
+ sanitizedDependencies.files.forEach((file)=>{
1546
+ compilation.fileDependencies.add(file);
1547
+ });
1548
+ }
1549
+ });
1550
+ }
1551
+ const external_chokidar_namespaceObject = require("chokidar");
1552
+ var external_chokidar_default = /*#__PURE__*/ __webpack_require__.n(external_chokidar_namespaceObject);
1553
+ const balanced = (a, b, str)=>{
1554
+ const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
1555
+ const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
1556
+ const r = null !== ma && null != mb && range(ma, mb, str);
1557
+ return r && {
1558
+ start: r[0],
1559
+ end: r[1],
1560
+ pre: str.slice(0, r[0]),
1561
+ body: str.slice(r[0] + ma.length, r[1]),
1562
+ post: str.slice(r[1] + mb.length)
1563
+ };
101
1564
  };
102
- }
103
- function consumeFilesChange(compiler) {
104
- const change = getFilesChange(compiler);
105
- clearFilesChange(compiler);
106
- return change;
107
- }
108
- function updateFilesChange(compiler, change) {
109
- compilerFilesChangeMap.set(compiler, aggregateFilesChanges([
110
- getFilesChange(compiler),
111
- change
112
- ]));
113
- }
114
- function clearFilesChange(compiler) {
115
- compilerFilesChangeMap.delete(compiler);
116
- }
117
- function aggregateFilesChanges(changes) {
118
- const changedFilesSet = new Set();
119
- const deletedFilesSet = new Set();
120
- for (const { changedFiles = [], deletedFiles = [] } of changes){
121
- for (const changedFile of changedFiles){
122
- changedFilesSet.add(changedFile);
123
- deletedFilesSet.delete(changedFile);
124
- }
125
- for (const deletedFile of deletedFiles){
126
- changedFilesSet.delete(deletedFile);
127
- deletedFilesSet.add(deletedFile);
128
- }
129
- }
130
- return {
131
- changedFiles: Array.from(changedFilesSet),
132
- deletedFiles: Array.from(deletedFilesSet)
1565
+ const maybeMatch = (reg, str)=>{
1566
+ const m = str.match(reg);
1567
+ return m ? m[0] : null;
133
1568
  };
134
- }
135
- function isInsideAnotherPath(parent, directory) {
136
- const relativePart = (0, external_node_path_namespaceObject.relative)(parent, directory);
137
- if (relativePart.startsWith('..')) return false;
138
- if (0 === relativePart.length) return false;
139
- if ((0, external_node_path_namespaceObject.isAbsolute)(relativePart)) return false;
140
- return true;
141
- }
142
- function _define_property(obj, key, value) {
143
- if (key in obj) Object.defineProperty(obj, key, {
144
- value: value,
145
- enumerable: true,
146
- configurable: true,
147
- writable: true
148
- });
149
- else obj[key] = value;
150
- return obj;
151
- }
152
- const BUILTIN_IGNORED_DIRS = [
153
- '.git'
154
- ];
155
- function createIsIgnored(ignored, excluded) {
156
- const ignoredPatterns = ignored ? Array.isArray(ignored) ? [
157
- ...ignored
158
- ] : [
159
- ignored
160
- ] : [];
161
- const filteredExcluded = excluded.filter((pattern)=>{
162
- if (external_is_glob_default()(pattern)) {
163
- const shouldAppendStar = pattern.includes('**') && !pattern.endsWith('*');
164
- if (shouldAppendStar) ignoredPatterns.push(pattern.endsWith('/') ? `${pattern}**` : `${pattern}/**`);
165
- else ignoredPatterns.push(pattern);
166
- return false;
1569
+ const range = (a, b, str)=>{
1570
+ let begs, beg, left, right, result;
1571
+ let ai = str.indexOf(a);
1572
+ let bi = str.indexOf(b, ai + 1);
1573
+ let i = ai;
1574
+ if (ai >= 0 && bi > 0) {
1575
+ if (a === b) return [
1576
+ ai,
1577
+ bi
1578
+ ];
1579
+ begs = [];
1580
+ left = str.length;
1581
+ while(i >= 0 && !result){
1582
+ if (i === ai) {
1583
+ begs.push(i);
1584
+ ai = str.indexOf(a, i + 1);
1585
+ } else if (1 === begs.length) {
1586
+ const r = begs.pop();
1587
+ if (void 0 !== r) result = [
1588
+ r,
1589
+ bi
1590
+ ];
1591
+ } else {
1592
+ beg = begs.pop();
1593
+ if (void 0 !== beg && beg < left) {
1594
+ left = beg;
1595
+ right = bi;
1596
+ }
1597
+ bi = str.indexOf(b, i + 1);
1598
+ }
1599
+ i = ai < bi && ai >= 0 ? ai : bi;
1600
+ }
1601
+ if (begs.length && void 0 !== right) result = [
1602
+ left,
1603
+ right
1604
+ ];
167
1605
  }
168
- return true;
169
- });
170
- const ignoredFunctions = ignoredPatterns.map((pattern)=>{
171
- if ('string' == typeof pattern) return (path)=>(0, external_minimatch_namespaceObject.minimatch)(path, pattern);
172
- if (pattern instanceof RegExp) return (path)=>pattern.test(path);
173
- return ()=>false;
174
- });
175
- ignoredFunctions.push((path)=>filteredExcluded.some((excludedPath)=>isInsideAnotherPath(excludedPath, path)));
176
- ignoredFunctions.push((path)=>BUILTIN_IGNORED_DIRS.some((ignoredDir)=>path.includes(`/${ignoredDir}/`) || path.includes(`\\${ignoredDir}\\`)));
177
- return function(path) {
178
- return ignoredFunctions.some((ignoredFunction)=>ignoredFunction(path));
1606
+ return result;
179
1607
  };
180
- }
181
- class InclusiveNodeWatchFileSystem {
182
- get watcher() {
183
- return this.watchFileSystem.watcher || this.watchFileSystem.wfs?.watcher;
184
- }
185
- constructor(watchFileSystem, compiler, pluginState){
186
- _define_property(this, "watchFileSystem", void 0);
187
- _define_property(this, "compiler", void 0);
188
- _define_property(this, "pluginState", void 0);
189
- _define_property(this, "dirsWatchers", void 0);
190
- _define_property(this, "paused", void 0);
191
- _define_property(this, "deletedFiles", void 0);
192
- _define_property(this, "watch", void 0);
193
- this.watchFileSystem = watchFileSystem;
194
- this.compiler = compiler;
195
- this.pluginState = pluginState;
196
- this.paused = true;
197
- this.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed)=>{
198
- const { debug } = getInfrastructureLogger(this.compiler);
199
- clearFilesChange(this.compiler);
200
- const isIgnored = createIsIgnored(options?.ignored, this.pluginState.lastDependencies?.excluded || []);
201
- const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
202
- this.watcher?.on('change', (file)=>{
203
- if ('string' != typeof file) return;
204
- if (isIgnored(file)) debug("Detected file change but it's ignored", file);
205
- else {
206
- debug('Detected file change', file);
207
- this.deletedFiles.delete(file);
208
- updateFilesChange(this.compiler, {
209
- changedFiles: [
210
- file
211
- ]
212
- });
213
- }
214
- });
215
- this.watcher?.on('remove', (file)=>{
216
- if ('string' != typeof file) return;
217
- if (this.deletedFiles.has(file)) return void debug('Skipping duplicated remove event.');
218
- if (isIgnored(file)) debug("Detected file remove but it's ignored", file);
219
- else {
220
- debug('Detected file remove', file);
221
- this.deletedFiles.add(file);
222
- updateFilesChange(this.compiler, {
223
- deletedFiles: [
224
- file
225
- ]
226
- });
227
- }
228
- });
229
- const prevDirs = Array.from(this.dirsWatchers.keys());
230
- const nextDirs = Array.from(this.pluginState.lastDependencies?.dirs || []);
231
- const dirsToUnwatch = prevDirs.filter((prevDir)=>!nextDirs.includes(prevDir));
232
- const dirsToWatch = nextDirs.filter((nextDir)=>!prevDirs.includes(nextDir) && !isIgnored(nextDir));
233
- dirsToUnwatch.forEach((dirToUnwatch)=>{
234
- this.dirsWatchers.get(dirToUnwatch)?.close();
235
- this.dirsWatchers.delete(dirToUnwatch);
236
- });
237
- dirsToWatch.forEach((dirToWatch)=>{
238
- const interval = 'number' == typeof options?.poll ? options.poll : void 0;
239
- const dirWatcher = external_chokidar_default().watch(dirToWatch, {
240
- ignoreInitial: true,
241
- ignorePermissionErrors: true,
242
- ignored: (path)=>isIgnored(path),
243
- usePolling: options?.poll ? true : void 0,
244
- interval: interval,
245
- binaryInterval: interval,
246
- alwaysStat: true,
247
- atomic: true,
248
- awaitWriteFinish: true
249
- });
250
- dirWatcher.on('add', (file, stats)=>{
251
- if (this.paused) return;
252
- const extension = (0, external_node_path_namespaceObject.extname)(file);
253
- const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
254
- if (!supportedExtensions.includes(extension)) return void debug('Detected new file add but extension is not supported', file);
255
- debug('Detected new file add', file);
256
- this.deletedFiles.delete(file);
257
- updateFilesChange(this.compiler, {
258
- changedFiles: [
259
- file
260
- ]
261
- });
262
- this.watcher?._onChange(file, stats?.mtimeMs || stats?.ctimeMs || 1, file, 'rename');
263
- });
264
- dirWatcher.on('unlink', (file)=>{
265
- if (this.paused) return;
266
- const extension = (0, external_node_path_namespaceObject.extname)(file);
267
- const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
268
- if (!supportedExtensions.includes(extension)) return void debug('Detected new file remove but extension is not supported', file);
269
- if (this.deletedFiles.has(file)) return void debug('Skipping duplicated unlink event.');
270
- debug('Detected new file remove', file);
271
- this.deletedFiles.add(file);
272
- updateFilesChange(this.compiler, {
273
- deletedFiles: [
274
- file
275
- ]
276
- });
277
- this.watcher?._onRemove(dirToWatch, file, 'rename');
278
- });
279
- this.dirsWatchers.set(dirToWatch, dirWatcher);
280
- });
281
- this.paused = false;
282
- return {
283
- ...standardWatcher,
284
- close: ()=>{
285
- clearFilesChange(this.compiler);
286
- if (standardWatcher) standardWatcher.close();
287
- this.dirsWatchers.forEach((dirWatcher)=>{
288
- dirWatcher?.close();
289
- });
290
- this.dirsWatchers.clear();
291
- this.paused = true;
292
- },
293
- pause: ()=>{
294
- if (standardWatcher) standardWatcher.pause();
295
- this.paused = true;
296
- }
297
- };
298
- };
299
- this.dirsWatchers = new Map();
300
- this.deletedFiles = new Set();
1608
+ const escSlash = '\0SLASH' + Math.random() + '\0';
1609
+ const escOpen = '\0OPEN' + Math.random() + '\0';
1610
+ const escClose = '\0CLOSE' + Math.random() + '\0';
1611
+ const escComma = '\0COMMA' + Math.random() + '\0';
1612
+ const escPeriod = '\0PERIOD' + Math.random() + '\0';
1613
+ const escSlashPattern = new RegExp(escSlash, 'g');
1614
+ const escOpenPattern = new RegExp(escOpen, 'g');
1615
+ const escClosePattern = new RegExp(escClose, 'g');
1616
+ const escCommaPattern = new RegExp(escComma, 'g');
1617
+ const escPeriodPattern = new RegExp(escPeriod, 'g');
1618
+ const slashPattern = /\\\\/g;
1619
+ const openPattern = /\\{/g;
1620
+ const closePattern = /\\}/g;
1621
+ const commaPattern = /\\,/g;
1622
+ const periodPattern = /\\./g;
1623
+ const EXPANSION_MAX = 100000;
1624
+ function numeric(str) {
1625
+ return isNaN(str) ? str.charCodeAt(0) : parseInt(str, 10);
301
1626
  }
302
- }
303
- function tapAfterEnvironmentToPatchWatching(compiler, state) {
304
- const { debug } = getInfrastructureLogger(compiler);
305
- compiler.hooks.afterEnvironment.tap('TsCheckerRspackPlugin', ()=>{
306
- const watchFileSystem = compiler.watchFileSystem;
307
- if (watchFileSystem) {
308
- debug("Overwriting Rspack's watch file system.");
309
- compiler.watchFileSystem = new InclusiveNodeWatchFileSystem(watchFileSystem, compiler, state);
310
- } else debug('No watch file system found - plugin may not work correctly.');
311
- });
312
- }
313
- const external_picocolors_namespaceObject = require("picocolors");
314
- var external_picocolors_default = /*#__PURE__*/ __webpack_require__.n(external_picocolors_namespaceObject);
315
- const lite_tapable_namespaceObject = require("@rspack/lite-tapable");
316
- const compilerHookMap = new WeakMap();
317
- function createPluginHooks() {
318
- return {
319
- start: new lite_tapable_namespaceObject.AsyncSeriesWaterfallHook([
320
- 'change',
321
- 'compilation'
322
- ]),
323
- waiting: new lite_tapable_namespaceObject.SyncHook([
324
- 'compilation'
325
- ]),
326
- canceled: new lite_tapable_namespaceObject.SyncHook([
327
- 'compilation'
328
- ]),
329
- error: new lite_tapable_namespaceObject.SyncHook([
330
- 'error',
331
- 'compilation'
332
- ]),
333
- issues: new lite_tapable_namespaceObject.SyncWaterfallHook([
334
- 'issues',
335
- 'compilation'
336
- ])
337
- };
338
- }
339
- function forwardPluginHooks(source, target) {
340
- source.start.tapPromise('TsCheckerRspackPlugin', target.start.promise);
341
- source.waiting.tap('TsCheckerRspackPlugin', target.waiting.call);
342
- source.canceled.tap('TsCheckerRspackPlugin', target.canceled.call);
343
- source.error.tap('TsCheckerRspackPlugin', target.error.call);
344
- source.issues.tap('TsCheckerRspackPlugin', target.issues.call);
345
- }
346
- function getPluginHooks(compiler) {
347
- let hooks = compilerHookMap.get(compiler);
348
- if (void 0 === hooks) {
349
- hooks = createPluginHooks();
350
- compilerHookMap.set(compiler, hooks);
351
- if ('compilers' in compiler) compiler.compilers.forEach((childCompiler)=>{
352
- const childHooks = getPluginHooks(childCompiler);
353
- if (hooks) forwardPluginHooks(childHooks, hooks);
354
- });
1627
+ function escapeBraces(str) {
1628
+ return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
355
1629
  }
356
- return hooks;
357
- }
358
- const external_node_process_namespaceObject = require("node:process");
359
- function createControlledPromise() {
360
- let resolve = ()=>void 0;
361
- let reject = ()=>void 0;
362
- const promise = new Promise((aResolve, aReject)=>{
363
- resolve = aResolve;
364
- reject = aReject;
365
- });
366
- return {
367
- promise,
368
- resolve,
369
- reject
370
- };
371
- }
372
- function rpc_error_define_property(obj, key, value) {
373
- if (key in obj) Object.defineProperty(obj, key, {
374
- value: value,
375
- enumerable: true,
376
- configurable: true,
377
- writable: true
378
- });
379
- else obj[key] = value;
380
- return obj;
381
- }
382
- class RpcExitError extends Error {
383
- constructor(message, code, signal){
384
- super(message), rpc_error_define_property(this, "code", void 0), rpc_error_define_property(this, "signal", void 0), this.code = code, this.signal = signal;
385
- this.name = 'RpcExitError';
1630
+ function unescapeBraces(str) {
1631
+ return str.replace(escSlashPattern, '\\').replace(escOpenPattern, '{').replace(escClosePattern, '}').replace(escCommaPattern, ',').replace(escPeriodPattern, '.');
386
1632
  }
387
- }
388
- function wrapRpc(childProcess) {
389
- return async (...args)=>{
390
- if (childProcess.send) {
391
- if (!childProcess.connected) throw new Error(`Process ${childProcess.pid} doesn't have open IPC channels`);
392
- } else throw new Error(`Process ${childProcess.pid} doesn't have IPC channels`);
393
- const id = uuid();
394
- const { promise: resultPromise, resolve: resolveResult, reject: rejectResult } = createControlledPromise();
395
- const { promise: sendPromise, resolve: resolveSend, reject: rejectSend } = createControlledPromise();
396
- const handleMessage = (message)=>{
397
- if (message?.id === id) {
398
- if ('resolve' === message.type) {
399
- resolveResult(message.value);
400
- removeHandlers();
401
- } else if ('reject' === message.type) {
402
- rejectResult(message.error);
403
- removeHandlers();
1633
+ function parseCommaParts(str) {
1634
+ if (!str) return [
1635
+ ''
1636
+ ];
1637
+ const parts = [];
1638
+ const m = balanced('{', '}', str);
1639
+ if (!m) return str.split(',');
1640
+ const { pre, body, post } = m;
1641
+ const p = pre.split(',');
1642
+ p[p.length - 1] += '{' + body + '}';
1643
+ const postParts = parseCommaParts(post);
1644
+ if (post.length) {
1645
+ p[p.length - 1] += postParts.shift();
1646
+ p.push.apply(p, postParts);
1647
+ }
1648
+ parts.push.apply(parts, p);
1649
+ return parts;
1650
+ }
1651
+ function expand(str, options = {}) {
1652
+ if (!str) return [];
1653
+ const { max = EXPANSION_MAX } = options;
1654
+ if ('{}' === str.slice(0, 2)) str = '\\{\\}' + str.slice(2);
1655
+ return expand_(escapeBraces(str), max, true).map(unescapeBraces);
1656
+ }
1657
+ function embrace(str) {
1658
+ return '{' + str + '}';
1659
+ }
1660
+ function isPadded(el) {
1661
+ return /^-?0\d/.test(el);
1662
+ }
1663
+ function lte(i, y) {
1664
+ return i <= y;
1665
+ }
1666
+ function gte(i, y) {
1667
+ return i >= y;
1668
+ }
1669
+ function expand_(str, max, isTop) {
1670
+ const expansions = [];
1671
+ const m = balanced('{', '}', str);
1672
+ if (!m) return [
1673
+ str
1674
+ ];
1675
+ const pre = m.pre;
1676
+ const post = m.post.length ? expand_(m.post, max, false) : [
1677
+ ''
1678
+ ];
1679
+ if (/\$$/.test(m.pre)) for(let k = 0; k < post.length && k < max; k++){
1680
+ const expansion = pre + '{' + m.body + '}' + post[k];
1681
+ expansions.push(expansion);
1682
+ }
1683
+ else {
1684
+ const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
1685
+ const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
1686
+ const isSequence = isNumericSequence || isAlphaSequence;
1687
+ const isOptions = m.body.indexOf(',') >= 0;
1688
+ if (!isSequence && !isOptions) {
1689
+ if (m.post.match(/,(?!,).*\}/)) {
1690
+ str = m.pre + '{' + m.body + escClose + m.post;
1691
+ return expand_(str, max, true);
404
1692
  }
1693
+ return [
1694
+ str
1695
+ ];
405
1696
  }
406
- };
407
- const handleClose = (code, signal)=>{
408
- rejectResult(new RpcExitError(code ? `Process ${childProcess.pid} exited with code ${code}` + (signal ? ` [${signal}]` : '') : `Process ${childProcess.pid} exited` + (signal ? ` [${signal}]` : ''), code, signal));
409
- removeHandlers();
410
- };
411
- const removeHandlers = ()=>{
412
- childProcess.off('message', handleMessage);
413
- childProcess.off('close', handleClose);
414
- };
415
- childProcess.on('message', handleMessage);
416
- childProcess.on('close', handleClose);
417
- childProcess.send({
418
- type: 'call',
419
- id,
420
- args
421
- }, (error)=>{
422
- if (error) {
423
- rejectSend(error);
424
- removeHandlers();
425
- } else resolveSend(void 0);
426
- });
427
- return sendPromise.then(()=>resultPromise);
1697
+ let n;
1698
+ if (isSequence) n = m.body.split(/\.\./);
1699
+ else {
1700
+ n = parseCommaParts(m.body);
1701
+ if (1 === n.length && void 0 !== n[0]) {
1702
+ n = expand_(n[0], max, false).map(embrace);
1703
+ if (1 === n.length) return post.map((p)=>m.pre + n[0] + p);
1704
+ }
1705
+ }
1706
+ let N;
1707
+ if (isSequence && void 0 !== n[0] && void 0 !== n[1]) {
1708
+ const x = numeric(n[0]);
1709
+ const y = numeric(n[1]);
1710
+ const width = Math.max(n[0].length, n[1].length);
1711
+ let incr = 3 === n.length && void 0 !== n[2] ? Math.abs(numeric(n[2])) : 1;
1712
+ let test = lte;
1713
+ const reverse = y < x;
1714
+ if (reverse) {
1715
+ incr *= -1;
1716
+ test = gte;
1717
+ }
1718
+ const pad = n.some(isPadded);
1719
+ N = [];
1720
+ for(let i = x; test(i, y); i += incr){
1721
+ let c;
1722
+ if (isAlphaSequence) {
1723
+ c = String.fromCharCode(i);
1724
+ if ('\\' === c) c = '';
1725
+ } else {
1726
+ c = String(i);
1727
+ if (pad) {
1728
+ const need = width - c.length;
1729
+ if (need > 0) {
1730
+ const z = new Array(need + 1).join('0');
1731
+ c = i < 0 ? '-' + z + c.slice(1) : z + c;
1732
+ }
1733
+ }
1734
+ }
1735
+ N.push(c);
1736
+ }
1737
+ } else {
1738
+ N = [];
1739
+ for(let j = 0; j < n.length; j++)N.push.apply(N, expand_(n[j], max, false));
1740
+ }
1741
+ for(let j = 0; j < N.length; j++)for(let k = 0; k < post.length && expansions.length < max; k++){
1742
+ const expansion = pre + N[j] + post[k];
1743
+ if (!isTop || isSequence || expansion) expansions.push(expansion);
1744
+ }
1745
+ }
1746
+ return expansions;
1747
+ }
1748
+ const MAX_PATTERN_LENGTH = 65536;
1749
+ const assertValidPattern = (pattern)=>{
1750
+ if ('string' != typeof pattern) throw new TypeError('invalid pattern');
1751
+ if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError('pattern is too long');
428
1752
  };
429
- }
430
- function uuid() {
431
- return new Array(4).fill(0).map(()=>Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join('-');
432
- }
433
- const external_node_child_process_namespaceObject = require("node:child_process");
434
- const WORKER_DATA_ENV_KEY = 'WORKER_DATA';
435
- function createRpcWorker(modulePath, data, memoryLimit) {
436
- const options = {
437
- env: {
438
- ...external_node_process_namespaceObject.env,
439
- [WORKER_DATA_ENV_KEY]: JSON.stringify(data || {})
440
- },
441
- stdio: [
442
- 'inherit',
443
- 'inherit',
444
- 'inherit',
445
- 'ipc'
1753
+ const posixClasses = {
1754
+ '[:alnum:]': [
1755
+ '\\p{L}\\p{Nl}\\p{Nd}',
1756
+ true
1757
+ ],
1758
+ '[:alpha:]': [
1759
+ '\\p{L}\\p{Nl}',
1760
+ true
1761
+ ],
1762
+ '[:ascii:]': [
1763
+ "\\x00-\\x7f",
1764
+ false
1765
+ ],
1766
+ '[:blank:]': [
1767
+ '\\p{Zs}\\t',
1768
+ true
446
1769
  ],
447
- serialization: 'advanced'
1770
+ '[:cntrl:]': [
1771
+ '\\p{Cc}',
1772
+ true
1773
+ ],
1774
+ '[:digit:]': [
1775
+ '\\p{Nd}',
1776
+ true
1777
+ ],
1778
+ '[:graph:]': [
1779
+ '\\p{Z}\\p{C}',
1780
+ true,
1781
+ true
1782
+ ],
1783
+ '[:lower:]': [
1784
+ '\\p{Ll}',
1785
+ true
1786
+ ],
1787
+ '[:print:]': [
1788
+ '\\p{C}',
1789
+ true
1790
+ ],
1791
+ '[:punct:]': [
1792
+ '\\p{P}',
1793
+ true
1794
+ ],
1795
+ '[:space:]': [
1796
+ '\\p{Z}\\t\\r\\n\\v\\f',
1797
+ true
1798
+ ],
1799
+ '[:upper:]': [
1800
+ '\\p{Lu}',
1801
+ true
1802
+ ],
1803
+ '[:word:]': [
1804
+ '\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}',
1805
+ true
1806
+ ],
1807
+ '[:xdigit:]': [
1808
+ 'A-Fa-f0-9',
1809
+ false
1810
+ ]
448
1811
  };
449
- if (memoryLimit) options.execArgv = [
450
- `--max-old-space-size=${memoryLimit}`
451
- ];
452
- let childProcess;
453
- let remoteMethod;
454
- const worker = {
455
- connect () {
456
- if (childProcess && !childProcess.connected) {
457
- childProcess.kill('SIGTERM');
458
- childProcess = void 0;
459
- remoteMethod = void 0;
460
- }
461
- if (!childProcess?.connected) {
462
- childProcess = external_node_child_process_namespaceObject.fork(modulePath, options);
463
- remoteMethod = wrapRpc(childProcess);
1812
+ const braceEscape = (s)=>s.replace(/[[\]\\-]/g, '\\$&');
1813
+ const regexpEscape = (s)=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
1814
+ const rangesToString = (ranges)=>ranges.join('');
1815
+ const parseClass = (glob, position)=>{
1816
+ const pos = position;
1817
+ if ('[' !== glob.charAt(pos)) throw new Error('not in a brace expression');
1818
+ const ranges = [];
1819
+ const negs = [];
1820
+ let i = pos + 1;
1821
+ let sawStart = false;
1822
+ let uflag = false;
1823
+ let escaping = false;
1824
+ let negate = false;
1825
+ let endPos = pos;
1826
+ let rangeStart = '';
1827
+ WHILE: while(i < glob.length){
1828
+ const c = glob.charAt(i);
1829
+ if (('!' === c || '^' === c) && i === pos + 1) {
1830
+ negate = true;
1831
+ i++;
1832
+ continue;
464
1833
  }
465
- },
466
- terminate () {
467
- if (childProcess) {
468
- childProcess.kill('SIGTERM');
469
- childProcess = void 0;
470
- remoteMethod = void 0;
1834
+ if (']' === c && sawStart && !escaping) {
1835
+ endPos = i + 1;
1836
+ break;
471
1837
  }
472
- },
473
- get connected () {
474
- return Boolean(childProcess?.connected);
475
- },
476
- get process () {
477
- return childProcess;
1838
+ sawStart = true;
1839
+ if ('\\' === c) {
1840
+ if (!escaping) {
1841
+ escaping = true;
1842
+ i++;
1843
+ continue;
1844
+ }
1845
+ }
1846
+ if ('[' === c && !escaping) {
1847
+ for (const [cls, [unip, u, neg]] of Object.entries(posixClasses))if (glob.startsWith(cls, i)) {
1848
+ if (rangeStart) return [
1849
+ '$.',
1850
+ false,
1851
+ glob.length - pos,
1852
+ true
1853
+ ];
1854
+ i += cls.length;
1855
+ if (neg) negs.push(unip);
1856
+ else ranges.push(unip);
1857
+ uflag = uflag || u;
1858
+ continue WHILE;
1859
+ }
1860
+ }
1861
+ escaping = false;
1862
+ if (rangeStart) {
1863
+ if (c > rangeStart) ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c));
1864
+ else if (c === rangeStart) ranges.push(braceEscape(c));
1865
+ rangeStart = '';
1866
+ i++;
1867
+ continue;
1868
+ }
1869
+ if (glob.startsWith('-]', i + 1)) {
1870
+ ranges.push(braceEscape(c + '-'));
1871
+ i += 2;
1872
+ continue;
1873
+ }
1874
+ if (glob.startsWith('-', i + 1)) {
1875
+ rangeStart = c;
1876
+ i += 2;
1877
+ continue;
1878
+ }
1879
+ ranges.push(braceEscape(c));
1880
+ i++;
1881
+ }
1882
+ if (endPos < i) return [
1883
+ '',
1884
+ false,
1885
+ 0,
1886
+ false
1887
+ ];
1888
+ if (!ranges.length && !negs.length) return [
1889
+ '$.',
1890
+ false,
1891
+ glob.length - pos,
1892
+ true
1893
+ ];
1894
+ if (0 === negs.length && 1 === ranges.length && /^\\?.$/.test(ranges[0]) && !negate) {
1895
+ const r = 2 === ranges[0].length ? ranges[0].slice(-1) : ranges[0];
1896
+ return [
1897
+ regexpEscape(r),
1898
+ false,
1899
+ endPos - pos,
1900
+ false
1901
+ ];
478
1902
  }
1903
+ const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
1904
+ const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
1905
+ const comb = ranges.length && negs.length ? '(' + sranges + '|' + snegs + ')' : ranges.length ? sranges : snegs;
1906
+ return [
1907
+ comb,
1908
+ uflag,
1909
+ endPos - pos,
1910
+ true
1911
+ ];
479
1912
  };
480
- return Object.assign((...args)=>{
481
- if (!worker.connected) worker.connect();
482
- if (!remoteMethod) return Promise.reject('Worker is not connected - cannot perform RPC.');
483
- return remoteMethod(...args);
484
- }, worker);
485
- }
486
- class AbortError extends Error {
487
- static throwIfAborted(signal) {
488
- if (signal?.aborted) throw new AbortError();
489
- }
490
- constructor(message = 'Task aborted.'){
491
- super(message);
492
- this.name = 'AbortError';
493
- }
494
- }
495
- function tapErrorToLogMessage(compiler, config) {
496
- const hooks = getPluginHooks(compiler);
497
- hooks.error.tap('TsCheckerRspackPlugin', (error)=>{
498
- if (error instanceof AbortError) return;
499
- config.logger.error(String(error));
500
- if (error instanceof RpcExitError) if ('SIGINT' === error.signal) config.logger.error(external_picocolors_default().red("[type-check] Issues checking service interrupted - If running in a docker container, this may be caused by the container running out of memory. If so, try increasing the container's memory limit or lowering the `memoryLimit` value in the TsCheckerRspackPlugin configuration."));
501
- else config.logger.error(external_picocolors_default().red("[type-check] Issues checking service aborted - probably out of memory. Check the `memoryLimit` option in the TsCheckerRspackPlugin configuration.\nIf increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript."));
502
- });
503
- }
504
- const external_node_os_namespaceObject = require("node:os");
505
- var external_node_os_default = /*#__PURE__*/ __webpack_require__.n(external_node_os_namespaceObject);
506
- function createPool(size) {
507
- let pendingPromises = [];
508
- const pool = {
509
- async submit (task, signal) {
510
- while(pendingPromises.length >= pool.size){
511
- AbortError.throwIfAborted(signal);
512
- await Promise.race(pendingPromises).catch(()=>void 0);
1913
+ const unescape_unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {})=>{
1914
+ if (magicalBraces) return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, '$1') : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2').replace(/\\([^\/])/g, '$1');
1915
+ return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, '$1') : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, '$1$2').replace(/\\([^\/{}])/g, '$1');
1916
+ };
1917
+ const types = new Set([
1918
+ '!',
1919
+ '?',
1920
+ '+',
1921
+ '*',
1922
+ '@'
1923
+ ]);
1924
+ const isExtglobType = (c)=>types.has(c);
1925
+ const startNoTraversal = '(?!(?:^|/)\\.\\.?(?:$|/))';
1926
+ const startNoDot = '(?!\\.)';
1927
+ const addPatternStart = new Set([
1928
+ '[',
1929
+ '.'
1930
+ ]);
1931
+ const justDots = new Set([
1932
+ '..',
1933
+ '.'
1934
+ ]);
1935
+ const reSpecials = new Set('().*{}+?[]^$\\!');
1936
+ const regExpEscape = (s)=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
1937
+ const qmark = '[^/]';
1938
+ const star = qmark + '*?';
1939
+ const starNoEmpty = qmark + '+?';
1940
+ class ast_AST {
1941
+ type;
1942
+ #root;
1943
+ #hasMagic;
1944
+ #uflag = false;
1945
+ #parts = [];
1946
+ #parent;
1947
+ #parentIndex;
1948
+ #negs;
1949
+ #filledNegs = false;
1950
+ #options;
1951
+ #toString;
1952
+ #emptyExt = false;
1953
+ constructor(type, parent, options = {}){
1954
+ this.type = type;
1955
+ if (type) this.#hasMagic = true;
1956
+ this.#parent = parent;
1957
+ this.#root = this.#parent ? this.#parent.#root : this;
1958
+ this.#options = this.#root === this ? options : this.#root.#options;
1959
+ this.#negs = this.#root === this ? [] : this.#root.#negs;
1960
+ if ('!' === type && !this.#root.#filledNegs) this.#negs.push(this);
1961
+ this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
1962
+ }
1963
+ get hasMagic() {
1964
+ if (void 0 !== this.#hasMagic) return this.#hasMagic;
1965
+ for (const p of this.#parts)if ('string' != typeof p) {
1966
+ if (p.type || p.hasMagic) return this.#hasMagic = true;
513
1967
  }
514
- AbortError.throwIfAborted(signal);
515
- const taskPromise = task(signal).finally(()=>{
516
- pendingPromises = pendingPromises.filter((pendingPromise)=>pendingPromise !== taskPromise);
517
- });
518
- pendingPromises.push(taskPromise);
519
- return taskPromise;
520
- },
521
- size,
522
- get pending () {
523
- return pendingPromises.length;
524
- },
525
- get drained () {
526
- return new Promise(async (resolve)=>{
527
- while(pendingPromises.length > 0)await Promise.race(pendingPromises).catch(()=>void 0);
528
- resolve(void 0);
529
- });
1968
+ return this.#hasMagic;
530
1969
  }
531
- };
532
- return pool;
533
- }
534
- const issuesPool = createPool(Math.max(1, external_node_os_namespaceObject.cpus().length));
535
- const dependenciesPool = createPool(Math.max(1, external_node_os_namespaceObject.cpus().length));
536
- function interceptDoneToGetDevServerTap(compiler, config, state) {
537
- const { debug } = getInfrastructureLogger(compiler);
538
- compiler.hooks.done.intercept({
539
- register: (tap)=>{
540
- if ([
541
- 'webpack-dev-server',
542
- 'rsbuild-dev-server'
543
- ].includes(tap.name) && 'sync' === tap.type && config.devServer) {
544
- debug('Intercepting dev-server tap.');
545
- state.DevServerDoneTap = tap;
546
- }
547
- return tap;
1970
+ toString() {
1971
+ if (void 0 !== this.#toString) return this.#toString;
1972
+ if (!this.type) return this.#toString = this.#parts.map((p)=>String(p)).join('');
1973
+ return this.#toString = this.type + '(' + this.#parts.map((p)=>String(p)).join('|') + ')';
548
1974
  }
549
- });
550
- }
551
- function forwardSlash(input) {
552
- return external_node_path_default().normalize(input).replace(/\\+/g, '/');
553
- }
554
- function relativeToContext(file, context) {
555
- let fileInContext = forwardSlash(external_node_path_default().relative(context, file));
556
- if (!fileInContext.startsWith('../')) fileInContext = './' + fileInContext;
557
- return fileInContext;
558
- }
559
- function formatIssueLocation(location) {
560
- return `${location.start.line}:${location.start.column}`;
561
- }
562
- function issue_rspack_error_define_property(obj, key, value) {
563
- if (key in obj) Object.defineProperty(obj, key, {
564
- value: value,
565
- enumerable: true,
566
- configurable: true,
567
- writable: true
568
- });
569
- else obj[key] = value;
570
- return obj;
571
- }
572
- class IssueRspackError extends Error {
573
- constructor(message, pathType, issue){
574
- super(message), issue_rspack_error_define_property(this, "issue", void 0), issue_rspack_error_define_property(this, "hideStack", void 0), issue_rspack_error_define_property(this, "file", void 0), this.issue = issue, this.hideStack = true;
575
- if (issue.file) {
576
- this.file = 'absolute' === pathType ? forwardSlash(external_node_path_default().resolve(issue.file)) : relativeToContext(issue.file, process.cwd());
577
- if (issue.location) this.file += `:${formatIssueLocation(issue.location)}`;
1975
+ #fillNegs() {
1976
+ if (this !== this.#root) throw new Error('should only call on root');
1977
+ if (this.#filledNegs) return this;
1978
+ this.toString();
1979
+ this.#filledNegs = true;
1980
+ let n;
1981
+ while(n = this.#negs.pop()){
1982
+ if ('!' !== n.type) continue;
1983
+ let p = n;
1984
+ let pp = p.#parent;
1985
+ while(pp){
1986
+ for(let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++)for (const part of n.#parts){
1987
+ if ('string' == typeof part) throw new Error('string part in extglob AST??');
1988
+ part.copyIn(pp.#parts[i]);
1989
+ }
1990
+ p = pp;
1991
+ pp = p.#parent;
1992
+ }
1993
+ }
1994
+ return this;
578
1995
  }
579
- Error.captureStackTrace(this, this.constructor);
580
- }
581
- }
582
- function tapAfterCompileToGetIssues(compiler, config, state) {
583
- const hooks = getPluginHooks(compiler);
584
- const { debug } = getInfrastructureLogger(compiler);
585
- compiler.hooks.afterCompile.tapPromise('TsCheckerRspackPlugin', async (compilation)=>{
586
- if (compilation.compiler !== compiler) return;
587
- let issues = [];
588
- try {
589
- issues = await state.issuesPromise;
590
- } catch (error) {
591
- hooks.error.call(error, compilation);
592
- return;
593
- }
594
- debug('Got issues from getIssuesWorker.', issues?.length);
595
- if (!issues) return;
596
- issues = issues.filter(config.issue.predicate);
597
- issues = hooks.issues.call(issues, compilation);
598
- issues.forEach((issue)=>{
599
- const error = new IssueRspackError(config.formatter.format(issue), config.formatter.pathType, issue);
600
- if ('warning' === issue.severity) compilation.warnings.push(error);
601
- else compilation.errors.push(error);
602
- });
603
- });
604
- }
605
- function statsFormatter(issues, stats) {
606
- const errorsNumber = issues.filter((issue)=>'error' === issue.severity).length;
607
- const warningsNumber = issues.filter((issue)=>'warning' === issue.severity).length;
608
- const errorsFormatted = errorsNumber ? external_picocolors_default().bold(external_picocolors_default().red(`${errorsNumber} ${1 === errorsNumber ? 'error' : 'errors'}`)) : '';
609
- const warningsFormatted = warningsNumber ? external_picocolors_default().bold(external_picocolors_default().yellow(`${warningsNumber} ${1 === warningsNumber ? 'warning' : 'warnings'}`)) : '';
610
- const timeFormatted = stats.startTime ? Math.round(Date.now() - stats.startTime) : 0;
611
- if (!errorsFormatted && !warningsFormatted) return external_picocolors_default().green(`[type-check] no errors found in ${timeFormatted} ms`);
612
- return [
613
- '[type-check] found ',
614
- errorsFormatted,
615
- errorsFormatted && warningsFormatted ? ' and ' : '',
616
- warningsFormatted,
617
- timeFormatted ? ` in ${timeFormatted} ms` : ''
618
- ].join('');
619
- }
620
- function createRspackFormatter(formatter, pathType) {
621
- return function(issue) {
622
- const color = 'warning' === issue.severity ? external_picocolors_default().yellow : external_picocolors_default().red;
623
- const severity = issue.severity.toUpperCase();
624
- if (!issue.file) return [
625
- `${external_picocolors_default().bold(color(severity))} in ` + formatter(issue),
626
- ''
627
- ].join(external_node_os_default().EOL);
628
- {
629
- let location = external_picocolors_default().bold('absolute' === pathType ? forwardSlash(external_node_path_default().resolve(issue.file)) : relativeToContext(issue.file, process.cwd()));
630
- if (issue.location) location += `:${external_picocolors_default().bold(external_picocolors_default().green(formatIssueLocation(issue.location)))}`;
631
- return [
632
- `${external_picocolors_default().bold(color(severity))} in ${location}`,
633
- formatter(issue),
634
- ''
635
- ].join(external_node_os_default().EOL);
1996
+ push(...parts) {
1997
+ for (const p of parts)if ('' !== p) {
1998
+ if ('string' != typeof p && !(p instanceof ast_AST && p.#parent === this)) throw new Error('invalid part: ' + p);
1999
+ this.#parts.push(p);
2000
+ }
636
2001
  }
2002
+ toJSON() {
2003
+ const ret = null === this.type ? this.#parts.slice().map((p)=>'string' == typeof p ? p : p.toJSON()) : [
2004
+ this.type,
2005
+ ...this.#parts.map((p)=>p.toJSON())
2006
+ ];
2007
+ if (this.isStart() && !this.type) ret.unshift([]);
2008
+ if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === '!')) ret.push({});
2009
+ return ret;
2010
+ }
2011
+ isStart() {
2012
+ if (this.#root === this) return true;
2013
+ if (!this.#parent?.isStart()) return false;
2014
+ if (0 === this.#parentIndex) return true;
2015
+ const p = this.#parent;
2016
+ for(let i = 0; i < this.#parentIndex; i++){
2017
+ const pp = p.#parts[i];
2018
+ if (!(pp instanceof ast_AST && '!' === pp.type)) return false;
2019
+ }
2020
+ return true;
2021
+ }
2022
+ isEnd() {
2023
+ if (this.#root === this) return true;
2024
+ if (this.#parent?.type === '!') return true;
2025
+ if (!this.#parent?.isEnd()) return false;
2026
+ if (!this.type) return this.#parent?.isEnd();
2027
+ const pl = this.#parent ? this.#parent.#parts.length : 0;
2028
+ return this.#parentIndex === pl - 1;
2029
+ }
2030
+ copyIn(part) {
2031
+ if ('string' == typeof part) this.push(part);
2032
+ else this.push(part.clone(this));
2033
+ }
2034
+ clone(parent) {
2035
+ const c = new ast_AST(this.type, parent);
2036
+ for (const p of this.#parts)c.copyIn(p);
2037
+ return c;
2038
+ }
2039
+ static #parseAST(str, ast, pos, opt) {
2040
+ let escaping = false;
2041
+ let inBrace = false;
2042
+ let braceStart = -1;
2043
+ let braceNeg = false;
2044
+ if (null === ast.type) {
2045
+ let i = pos;
2046
+ let acc = '';
2047
+ while(i < str.length){
2048
+ const c = str.charAt(i++);
2049
+ if (escaping || '\\' === c) {
2050
+ escaping = !escaping;
2051
+ acc += c;
2052
+ continue;
2053
+ }
2054
+ if (inBrace) {
2055
+ if (i === braceStart + 1) {
2056
+ if ('^' === c || '!' === c) braceNeg = true;
2057
+ } else if (']' === c && !(i === braceStart + 2 && braceNeg)) inBrace = false;
2058
+ acc += c;
2059
+ continue;
2060
+ }
2061
+ if ('[' === c) {
2062
+ inBrace = true;
2063
+ braceStart = i;
2064
+ braceNeg = false;
2065
+ acc += c;
2066
+ continue;
2067
+ }
2068
+ if (!opt.noext && isExtglobType(c) && '(' === str.charAt(i)) {
2069
+ ast.push(acc);
2070
+ acc = '';
2071
+ const ext = new ast_AST(c, ast);
2072
+ i = ast_AST.#parseAST(str, ext, i, opt);
2073
+ ast.push(ext);
2074
+ continue;
2075
+ }
2076
+ acc += c;
2077
+ }
2078
+ ast.push(acc);
2079
+ return i;
2080
+ }
2081
+ let i = pos + 1;
2082
+ let part = new ast_AST(null, ast);
2083
+ const parts = [];
2084
+ let acc = '';
2085
+ while(i < str.length){
2086
+ const c = str.charAt(i++);
2087
+ if (escaping || '\\' === c) {
2088
+ escaping = !escaping;
2089
+ acc += c;
2090
+ continue;
2091
+ }
2092
+ if (inBrace) {
2093
+ if (i === braceStart + 1) {
2094
+ if ('^' === c || '!' === c) braceNeg = true;
2095
+ } else if (']' === c && !(i === braceStart + 2 && braceNeg)) inBrace = false;
2096
+ acc += c;
2097
+ continue;
2098
+ }
2099
+ if ('[' === c) {
2100
+ inBrace = true;
2101
+ braceStart = i;
2102
+ braceNeg = false;
2103
+ acc += c;
2104
+ continue;
2105
+ }
2106
+ if (isExtglobType(c) && '(' === str.charAt(i)) {
2107
+ part.push(acc);
2108
+ acc = '';
2109
+ const ext = new ast_AST(c, part);
2110
+ part.push(ext);
2111
+ i = ast_AST.#parseAST(str, ext, i, opt);
2112
+ continue;
2113
+ }
2114
+ if ('|' === c) {
2115
+ part.push(acc);
2116
+ acc = '';
2117
+ parts.push(part);
2118
+ part = new ast_AST(null, ast);
2119
+ continue;
2120
+ }
2121
+ if (')' === c) {
2122
+ if ('' === acc && 0 === ast.#parts.length) ast.#emptyExt = true;
2123
+ part.push(acc);
2124
+ acc = '';
2125
+ ast.push(...parts, part);
2126
+ return i;
2127
+ }
2128
+ acc += c;
2129
+ }
2130
+ ast.type = null;
2131
+ ast.#hasMagic = void 0;
2132
+ ast.#parts = [
2133
+ str.substring(pos - 1)
2134
+ ];
2135
+ return i;
2136
+ }
2137
+ static fromGlob(pattern, options = {}) {
2138
+ const ast = new ast_AST(null, void 0, options);
2139
+ ast_AST.#parseAST(pattern, ast, 0, options);
2140
+ return ast;
2141
+ }
2142
+ toMMPattern() {
2143
+ if (this !== this.#root) return this.#root.toMMPattern();
2144
+ const glob = this.toString();
2145
+ const [re, body, hasMagic, uflag] = this.toRegExpSource();
2146
+ const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
2147
+ if (!anyMagic) return body;
2148
+ const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '');
2149
+ return Object.assign(new RegExp(`^${re}$`, flags), {
2150
+ _src: re,
2151
+ _glob: glob
2152
+ });
2153
+ }
2154
+ get options() {
2155
+ return this.#options;
2156
+ }
2157
+ toRegExpSource(allowDot) {
2158
+ const dot = allowDot ?? !!this.#options.dot;
2159
+ if (this.#root === this) this.#fillNegs();
2160
+ if (!this.type) {
2161
+ const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s)=>'string' != typeof s);
2162
+ const src = this.#parts.map((p)=>{
2163
+ const [re, _, hasMagic, uflag] = 'string' == typeof p ? ast_AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
2164
+ this.#hasMagic = this.#hasMagic || hasMagic;
2165
+ this.#uflag = this.#uflag || uflag;
2166
+ return re;
2167
+ }).join('');
2168
+ let start = '';
2169
+ if (this.isStart()) {
2170
+ if ('string' == typeof this.#parts[0]) {
2171
+ const dotTravAllowed = 1 === this.#parts.length && justDots.has(this.#parts[0]);
2172
+ if (!dotTravAllowed) {
2173
+ const aps = addPatternStart;
2174
+ const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith('\\.') && aps.has(src.charAt(2)) || src.startsWith('\\.\\.') && aps.has(src.charAt(4));
2175
+ const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
2176
+ start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : '';
2177
+ }
2178
+ }
2179
+ }
2180
+ let end = '';
2181
+ if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === '!') end = '(?:$|\\/)';
2182
+ const final = start + src + end;
2183
+ return [
2184
+ final,
2185
+ unescape_unescape(src),
2186
+ this.#hasMagic = !!this.#hasMagic,
2187
+ this.#uflag
2188
+ ];
2189
+ }
2190
+ const repeated = '*' === this.type || '+' === this.type;
2191
+ const start = '!' === this.type ? '(?:(?!(?:' : '(?:';
2192
+ let body = this.#partsToRegExp(dot);
2193
+ if (this.isStart() && this.isEnd() && !body && '!' !== this.type) {
2194
+ const s = this.toString();
2195
+ this.#parts = [
2196
+ s
2197
+ ];
2198
+ this.type = null;
2199
+ this.#hasMagic = void 0;
2200
+ return [
2201
+ s,
2202
+ unescape_unescape(this.toString()),
2203
+ false,
2204
+ false
2205
+ ];
2206
+ }
2207
+ let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? '' : this.#partsToRegExp(true);
2208
+ if (bodyDotAllowed === body) bodyDotAllowed = '';
2209
+ if (bodyDotAllowed) body = `(?:${body})(?:${bodyDotAllowed})*?`;
2210
+ let final = '';
2211
+ if ('!' === this.type && this.#emptyExt) final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
2212
+ else {
2213
+ const close = '!' === this.type ? '))' + (!this.isStart() || dot || allowDot ? '' : startNoDot) + star + ')' : '@' === this.type ? ')' : '?' === this.type ? ')?' : '+' === this.type && bodyDotAllowed ? ')' : '*' === this.type && bodyDotAllowed ? ")?" : `)${this.type}`;
2214
+ final = start + body + close;
2215
+ }
2216
+ return [
2217
+ final,
2218
+ unescape_unescape(body),
2219
+ this.#hasMagic = !!this.#hasMagic,
2220
+ this.#uflag
2221
+ ];
2222
+ }
2223
+ #partsToRegExp(dot) {
2224
+ return this.#parts.map((p)=>{
2225
+ if ('string' == typeof p) throw new Error('string type in extglob ast??');
2226
+ const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
2227
+ this.#uflag = this.#uflag || uflag;
2228
+ return re;
2229
+ }).filter((p)=>!(this.isStart() && this.isEnd()) || !!p).join('|');
2230
+ }
2231
+ static #parseGlob(glob, hasMagic, noEmpty = false) {
2232
+ let escaping = false;
2233
+ let re = '';
2234
+ let uflag = false;
2235
+ let inStar = false;
2236
+ for(let i = 0; i < glob.length; i++){
2237
+ const c = glob.charAt(i);
2238
+ if (escaping) {
2239
+ escaping = false;
2240
+ re += (reSpecials.has(c) ? '\\' : '') + c;
2241
+ continue;
2242
+ }
2243
+ if ('*' === c) {
2244
+ if (inStar) continue;
2245
+ inStar = true;
2246
+ re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
2247
+ hasMagic = true;
2248
+ continue;
2249
+ }
2250
+ inStar = false;
2251
+ if ('\\' === c) {
2252
+ if (i === glob.length - 1) re += '\\\\';
2253
+ else escaping = true;
2254
+ continue;
2255
+ }
2256
+ if ('[' === c) {
2257
+ const [src, needUflag, consumed, magic] = parseClass(glob, i);
2258
+ if (consumed) {
2259
+ re += src;
2260
+ uflag = uflag || needUflag;
2261
+ i += consumed - 1;
2262
+ hasMagic = hasMagic || magic;
2263
+ continue;
2264
+ }
2265
+ }
2266
+ if ('?' === c) {
2267
+ re += qmark;
2268
+ hasMagic = true;
2269
+ continue;
2270
+ }
2271
+ re += regExpEscape(c);
2272
+ }
2273
+ return [
2274
+ re,
2275
+ unescape_unescape(glob),
2276
+ !!hasMagic,
2277
+ uflag
2278
+ ];
2279
+ }
2280
+ }
2281
+ const escape_escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {})=>{
2282
+ if (magicalBraces) return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, '[$&]') : s.replace(/[?*()[\]\\{}]/g, '\\$&');
2283
+ return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, '[$&]') : s.replace(/[?*()[\]\\]/g, '\\$&');
637
2284
  };
638
- }
639
- function isPending(promise, timeout = 100) {
640
- return Promise.race([
641
- promise.then(()=>false).catch(()=>false),
642
- new Promise((resolve)=>setTimeout(()=>resolve(true), timeout))
643
- ]);
644
- }
645
- function wait(timeout) {
646
- return new Promise((resolve)=>setTimeout(resolve, timeout));
647
- }
648
- function tapDoneToAsyncGetIssues(compiler, config, state) {
649
- const hooks = getPluginHooks(compiler);
650
- const { debug } = getInfrastructureLogger(compiler);
651
- compiler.hooks.done.tap('TsCheckerRspackPlugin', async (stats)=>{
652
- if (stats.compilation.compiler !== compiler) return;
653
- const issuesPromise = state.issuesPromise;
654
- let issues;
655
- try {
656
- if (await isPending(issuesPromise)) {
657
- hooks.waiting.call(stats.compilation);
658
- config.logger.log(external_picocolors_default().cyan('[type-check] in progress...'));
659
- } else await wait(10);
660
- issues = await issuesPromise;
661
- } catch (error) {
662
- hooks.error.call(error, stats.compilation);
663
- return;
664
- }
665
- if (!issues || state.issuesPromise !== issuesPromise) return;
666
- debug(`Got ${issues?.length || 0} issues from getIssuesWorker.`);
667
- issues = issues.filter(config.issue.predicate);
668
- issues = hooks.issues.call(issues, stats.compilation);
669
- const formatter = createRspackFormatter(config.formatter.format, config.formatter.pathType);
670
- if (issues.length) config.logger.error(issues.map((issue)=>formatter(issue)).join('\n'));
671
- config.logger.log(statsFormatter(issues, stats));
672
- if (issues.length && state.DevServerDoneTap) {
673
- issues.forEach((issue)=>{
674
- const error = new IssueRspackError(config.formatter.format(issue), config.formatter.pathType, issue);
675
- if ('warning' === issue.severity) stats.compilation.warnings.push(error);
676
- else stats.compilation.errors.push(error);
2285
+ const minimatch = (p, pattern, options = {})=>{
2286
+ assertValidPattern(pattern);
2287
+ if (!options.nocomment && '#' === pattern.charAt(0)) return false;
2288
+ return new esm_Minimatch(pattern, options).match(p);
2289
+ };
2290
+ const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
2291
+ const starDotExtTest = (ext)=>(f)=>!f.startsWith('.') && f.endsWith(ext);
2292
+ const starDotExtTestDot = (ext)=>(f)=>f.endsWith(ext);
2293
+ const starDotExtTestNocase = (ext)=>{
2294
+ ext = ext.toLowerCase();
2295
+ return (f)=>!f.startsWith('.') && f.toLowerCase().endsWith(ext);
2296
+ };
2297
+ const starDotExtTestNocaseDot = (ext)=>{
2298
+ ext = ext.toLowerCase();
2299
+ return (f)=>f.toLowerCase().endsWith(ext);
2300
+ };
2301
+ const starDotStarRE = /^\*+\.\*+$/;
2302
+ const starDotStarTest = (f)=>!f.startsWith('.') && f.includes('.');
2303
+ const starDotStarTestDot = (f)=>'.' !== f && '..' !== f && f.includes('.');
2304
+ const dotStarRE = /^\.\*+$/;
2305
+ const dotStarTest = (f)=>'.' !== f && '..' !== f && f.startsWith('.');
2306
+ const starRE = /^\*+$/;
2307
+ const starTest = (f)=>0 !== f.length && !f.startsWith('.');
2308
+ const starTestDot = (f)=>0 !== f.length && '.' !== f && '..' !== f;
2309
+ const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
2310
+ const qmarksTestNocase = ([$0, ext = ''])=>{
2311
+ const noext = qmarksTestNoExt([
2312
+ $0
2313
+ ]);
2314
+ if (!ext) return noext;
2315
+ ext = ext.toLowerCase();
2316
+ return (f)=>noext(f) && f.toLowerCase().endsWith(ext);
2317
+ };
2318
+ const qmarksTestNocaseDot = ([$0, ext = ''])=>{
2319
+ const noext = qmarksTestNoExtDot([
2320
+ $0
2321
+ ]);
2322
+ if (!ext) return noext;
2323
+ ext = ext.toLowerCase();
2324
+ return (f)=>noext(f) && f.toLowerCase().endsWith(ext);
2325
+ };
2326
+ const qmarksTestDot = ([$0, ext = ''])=>{
2327
+ const noext = qmarksTestNoExtDot([
2328
+ $0
2329
+ ]);
2330
+ return ext ? (f)=>noext(f) && f.endsWith(ext) : noext;
2331
+ };
2332
+ const qmarksTest = ([$0, ext = ''])=>{
2333
+ const noext = qmarksTestNoExt([
2334
+ $0
2335
+ ]);
2336
+ return ext ? (f)=>noext(f) && f.endsWith(ext) : noext;
2337
+ };
2338
+ const qmarksTestNoExt = ([$0])=>{
2339
+ const len = $0.length;
2340
+ return (f)=>f.length === len && !f.startsWith('.');
2341
+ };
2342
+ const qmarksTestNoExtDot = ([$0])=>{
2343
+ const len = $0.length;
2344
+ return (f)=>f.length === len && '.' !== f && '..' !== f;
2345
+ };
2346
+ const defaultPlatform = 'object' == typeof process && process ? 'object' == typeof process.env && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : 'posix';
2347
+ const esm_path = {
2348
+ win32: {
2349
+ sep: '\\'
2350
+ },
2351
+ posix: {
2352
+ sep: '/'
2353
+ }
2354
+ };
2355
+ const sep = 'win32' === defaultPlatform ? esm_path.win32.sep : esm_path.posix.sep;
2356
+ minimatch.sep = sep;
2357
+ const GLOBSTAR = Symbol('globstar **');
2358
+ minimatch.GLOBSTAR = GLOBSTAR;
2359
+ const esm_qmark = '[^/]';
2360
+ const esm_star = esm_qmark + '*?';
2361
+ const twoStarDot = '(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?';
2362
+ const twoStarNoDot = '(?:(?!(?:\\/|^)\\.).)*?';
2363
+ const filter = (pattern, options = {})=>(p)=>minimatch(p, pattern, options);
2364
+ minimatch.filter = filter;
2365
+ const esm_ext = (a, b = {})=>Object.assign({}, a, b);
2366
+ const defaults = (def)=>{
2367
+ if (!def || 'object' != typeof def || !Object.keys(def).length) return minimatch;
2368
+ const orig = minimatch;
2369
+ const m = (p, pattern, options = {})=>orig(p, pattern, esm_ext(def, options));
2370
+ return Object.assign(m, {
2371
+ Minimatch: class extends orig.Minimatch {
2372
+ constructor(pattern, options = {}){
2373
+ super(pattern, esm_ext(def, options));
2374
+ }
2375
+ static defaults(options) {
2376
+ return orig.defaults(esm_ext(def, options)).Minimatch;
2377
+ }
2378
+ },
2379
+ AST: class extends orig.AST {
2380
+ constructor(type, parent, options = {}){
2381
+ super(type, parent, esm_ext(def, options));
2382
+ }
2383
+ static fromGlob(pattern, options = {}) {
2384
+ return orig.AST.fromGlob(pattern, esm_ext(def, options));
2385
+ }
2386
+ },
2387
+ unescape: (s, options = {})=>orig.unescape(s, esm_ext(def, options)),
2388
+ escape: (s, options = {})=>orig.escape(s, esm_ext(def, options)),
2389
+ filter: (pattern, options = {})=>orig.filter(pattern, esm_ext(def, options)),
2390
+ defaults: (options)=>orig.defaults(esm_ext(def, options)),
2391
+ makeRe: (pattern, options = {})=>orig.makeRe(pattern, esm_ext(def, options)),
2392
+ braceExpand: (pattern, options = {})=>orig.braceExpand(pattern, esm_ext(def, options)),
2393
+ match: (list, pattern, options = {})=>orig.match(list, pattern, esm_ext(def, options)),
2394
+ sep: orig.sep,
2395
+ GLOBSTAR: GLOBSTAR
2396
+ });
2397
+ };
2398
+ minimatch.defaults = defaults;
2399
+ const braceExpand = (pattern, options = {})=>{
2400
+ assertValidPattern(pattern);
2401
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [
2402
+ pattern
2403
+ ];
2404
+ return expand(pattern, {
2405
+ max: options.braceExpandMax
2406
+ });
2407
+ };
2408
+ minimatch.braceExpand = braceExpand;
2409
+ const makeRe = (pattern, options = {})=>new esm_Minimatch(pattern, options).makeRe();
2410
+ minimatch.makeRe = makeRe;
2411
+ const esm_match = (list, pattern, options = {})=>{
2412
+ const mm = new esm_Minimatch(pattern, options);
2413
+ list = list.filter((f)=>mm.match(f));
2414
+ if (mm.options.nonull && !list.length) list.push(pattern);
2415
+ return list;
2416
+ };
2417
+ minimatch.match = esm_match;
2418
+ const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
2419
+ const esm_regExpEscape = (s)=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
2420
+ class esm_Minimatch {
2421
+ options;
2422
+ set;
2423
+ pattern;
2424
+ windowsPathsNoEscape;
2425
+ nonegate;
2426
+ negate;
2427
+ comment;
2428
+ empty;
2429
+ preserveMultipleSlashes;
2430
+ partial;
2431
+ globSet;
2432
+ globParts;
2433
+ nocase;
2434
+ isWindows;
2435
+ platform;
2436
+ windowsNoMagicRoot;
2437
+ regexp;
2438
+ constructor(pattern, options = {}){
2439
+ assertValidPattern(pattern);
2440
+ options = options || {};
2441
+ this.options = options;
2442
+ this.pattern = pattern;
2443
+ this.platform = options.platform || defaultPlatform;
2444
+ this.isWindows = 'win32' === this.platform;
2445
+ const awe = "allowWindowsEscape";
2446
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || false === options[awe];
2447
+ if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, '/');
2448
+ this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
2449
+ this.regexp = null;
2450
+ this.negate = false;
2451
+ this.nonegate = !!options.nonegate;
2452
+ this.comment = false;
2453
+ this.empty = false;
2454
+ this.partial = !!options.partial;
2455
+ this.nocase = !!this.options.nocase;
2456
+ this.windowsNoMagicRoot = void 0 !== options.windowsNoMagicRoot ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
2457
+ this.globSet = [];
2458
+ this.globParts = [];
2459
+ this.set = [];
2460
+ this.make();
2461
+ }
2462
+ hasMagic() {
2463
+ if (this.options.magicalBraces && this.set.length > 1) return true;
2464
+ for (const pattern of this.set)for (const part of pattern)if ('string' != typeof part) return true;
2465
+ return false;
2466
+ }
2467
+ debug() {}
2468
+ make() {
2469
+ const pattern = this.pattern;
2470
+ const options = this.options;
2471
+ if (!options.nocomment && '#' === pattern.charAt(0)) {
2472
+ this.comment = true;
2473
+ return;
2474
+ }
2475
+ if (!pattern) {
2476
+ this.empty = true;
2477
+ return;
2478
+ }
2479
+ this.parseNegate();
2480
+ this.globSet = [
2481
+ ...new Set(this.braceExpand())
2482
+ ];
2483
+ if (options.debug) this.debug = (...args)=>console.error(...args);
2484
+ this.debug(this.pattern, this.globSet);
2485
+ const rawGlobParts = this.globSet.map((s)=>this.slashSplit(s));
2486
+ this.globParts = this.preprocess(rawGlobParts);
2487
+ this.debug(this.pattern, this.globParts);
2488
+ let set = this.globParts.map((s, _, __)=>{
2489
+ if (this.isWindows && this.windowsNoMagicRoot) {
2490
+ const isUNC = '' === s[0] && '' === s[1] && ('?' === s[2] || !globMagic.test(s[2])) && !globMagic.test(s[3]);
2491
+ const isDrive = /^[a-z]:/i.test(s[0]);
2492
+ if (isUNC) return [
2493
+ ...s.slice(0, 4),
2494
+ ...s.slice(4).map((ss)=>this.parse(ss))
2495
+ ];
2496
+ if (isDrive) return [
2497
+ s[0],
2498
+ ...s.slice(1).map((ss)=>this.parse(ss))
2499
+ ];
2500
+ }
2501
+ return s.map((ss)=>this.parse(ss));
677
2502
  });
678
- debug('Sending issues to the dev-server.');
679
- state.DevServerDoneTap.fn(stats);
2503
+ this.debug(this.pattern, set);
2504
+ this.set = set.filter((s)=>-1 === s.indexOf(false));
2505
+ if (this.isWindows) for(let i = 0; i < this.set.length; i++){
2506
+ const p = this.set[i];
2507
+ if ('' === p[0] && '' === p[1] && '?' === this.globParts[i][2] && 'string' == typeof p[3] && /^[a-z]:$/i.test(p[3])) p[2] = '?';
2508
+ }
2509
+ this.debug(this.pattern, this.set);
680
2510
  }
681
- });
682
- }
683
- function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker, config, state) {
684
- const hooks = getPluginHooks(compiler);
685
- const { log, debug } = getInfrastructureLogger(compiler);
686
- compiler.hooks.run.tap('TsCheckerRspackPlugin', ()=>{
687
- if (!state.initialized) {
688
- debug('Initializing plugin for single run (not async).');
689
- state.initialized = true;
690
- state.watching = false;
691
- tapAfterCompileToGetIssues(compiler, config, state);
2511
+ preprocess(globParts) {
2512
+ if (this.options.noglobstar) {
2513
+ for(let i = 0; i < globParts.length; i++)for(let j = 0; j < globParts[i].length; j++)if ('**' === globParts[i][j]) globParts[i][j] = '*';
2514
+ }
2515
+ const { optimizationLevel = 1 } = this.options;
2516
+ if (optimizationLevel >= 2) {
2517
+ globParts = this.firstPhasePreProcess(globParts);
2518
+ globParts = this.secondPhasePreProcess(globParts);
2519
+ } else globParts = optimizationLevel >= 1 ? this.levelOneOptimize(globParts) : this.adjascentGlobstarOptimize(globParts);
2520
+ return globParts;
692
2521
  }
693
- });
694
- compiler.hooks.watchRun.tap('TsCheckerRspackPlugin', async ()=>{
695
- if (!state.initialized) {
696
- state.initialized = true;
697
- state.watching = true;
698
- if (config.async) {
699
- debug('Initializing plugin for watch run (async).');
700
- tapDoneToAsyncGetIssues(compiler, config, state);
701
- interceptDoneToGetDevServerTap(compiler, config, state);
2522
+ adjascentGlobstarOptimize(globParts) {
2523
+ return globParts.map((parts)=>{
2524
+ let gs = -1;
2525
+ while(-1 !== (gs = parts.indexOf('**', gs + 1))){
2526
+ let i = gs;
2527
+ while('**' === parts[i + 1])i++;
2528
+ if (i !== gs) parts.splice(gs, i - gs);
2529
+ }
2530
+ return parts;
2531
+ });
2532
+ }
2533
+ levelOneOptimize(globParts) {
2534
+ return globParts.map((parts)=>{
2535
+ parts = parts.reduce((set, part)=>{
2536
+ const prev = set[set.length - 1];
2537
+ if ('**' === part && '**' === prev) return set;
2538
+ if ('..' === part) {
2539
+ if (prev && '..' !== prev && '.' !== prev && '**' !== prev) {
2540
+ set.pop();
2541
+ return set;
2542
+ }
2543
+ }
2544
+ set.push(part);
2545
+ return set;
2546
+ }, []);
2547
+ return 0 === parts.length ? [
2548
+ ''
2549
+ ] : parts;
2550
+ });
2551
+ }
2552
+ levelTwoFileOptimize(parts) {
2553
+ if (!Array.isArray(parts)) parts = this.slashSplit(parts);
2554
+ let didSomething = false;
2555
+ do {
2556
+ didSomething = false;
2557
+ if (!this.preserveMultipleSlashes) {
2558
+ for(let i = 1; i < parts.length - 1; i++){
2559
+ const p = parts[i];
2560
+ if (1 !== i || '' !== p || '' !== parts[0]) {
2561
+ if ('.' === p || '' === p) {
2562
+ didSomething = true;
2563
+ parts.splice(i, 1);
2564
+ i--;
2565
+ }
2566
+ }
2567
+ }
2568
+ if ('.' === parts[0] && 2 === parts.length && ('.' === parts[1] || '' === parts[1])) {
2569
+ didSomething = true;
2570
+ parts.pop();
2571
+ }
2572
+ }
2573
+ let dd = 0;
2574
+ while(-1 !== (dd = parts.indexOf('..', dd + 1))){
2575
+ const p = parts[dd - 1];
2576
+ if (p && '.' !== p && '..' !== p && '**' !== p) {
2577
+ didSomething = true;
2578
+ parts.splice(dd - 1, 2);
2579
+ dd -= 2;
2580
+ }
2581
+ }
2582
+ }while (didSomething);
2583
+ return 0 === parts.length ? [
2584
+ ''
2585
+ ] : parts;
2586
+ }
2587
+ firstPhasePreProcess(globParts) {
2588
+ let didSomething = false;
2589
+ do {
2590
+ didSomething = false;
2591
+ for (let parts of globParts){
2592
+ let gs = -1;
2593
+ while(-1 !== (gs = parts.indexOf('**', gs + 1))){
2594
+ let gss = gs;
2595
+ while('**' === parts[gss + 1])gss++;
2596
+ if (gss > gs) parts.splice(gs + 1, gss - gs);
2597
+ let next = parts[gs + 1];
2598
+ const p = parts[gs + 2];
2599
+ const p2 = parts[gs + 3];
2600
+ if ('..' !== next) continue;
2601
+ if (!p || '.' === p || '..' === p || !p2 || '.' === p2 || '..' === p2) continue;
2602
+ didSomething = true;
2603
+ parts.splice(gs, 1);
2604
+ const other = parts.slice(0);
2605
+ other[gs] = '**';
2606
+ globParts.push(other);
2607
+ gs--;
2608
+ }
2609
+ if (!this.preserveMultipleSlashes) {
2610
+ for(let i = 1; i < parts.length - 1; i++){
2611
+ const p = parts[i];
2612
+ if (1 !== i || '' !== p || '' !== parts[0]) {
2613
+ if ('.' === p || '' === p) {
2614
+ didSomething = true;
2615
+ parts.splice(i, 1);
2616
+ i--;
2617
+ }
2618
+ }
2619
+ }
2620
+ if ('.' === parts[0] && 2 === parts.length && ('.' === parts[1] || '' === parts[1])) {
2621
+ didSomething = true;
2622
+ parts.pop();
2623
+ }
2624
+ }
2625
+ let dd = 0;
2626
+ while(-1 !== (dd = parts.indexOf('..', dd + 1))){
2627
+ const p = parts[dd - 1];
2628
+ if (p && '.' !== p && '..' !== p && '**' !== p) {
2629
+ didSomething = true;
2630
+ const needDot = 1 === dd && '**' === parts[dd + 1];
2631
+ const splin = needDot ? [
2632
+ '.'
2633
+ ] : [];
2634
+ parts.splice(dd - 1, 2, ...splin);
2635
+ if (0 === parts.length) parts.push('');
2636
+ dd -= 2;
2637
+ }
2638
+ }
2639
+ }
2640
+ }while (didSomething);
2641
+ return globParts;
2642
+ }
2643
+ secondPhasePreProcess(globParts) {
2644
+ for(let i = 0; i < globParts.length - 1; i++)for(let j = i + 1; j < globParts.length; j++){
2645
+ const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
2646
+ if (matched) {
2647
+ globParts[i] = [];
2648
+ globParts[j] = matched;
2649
+ break;
2650
+ }
2651
+ }
2652
+ return globParts.filter((gs)=>gs.length);
2653
+ }
2654
+ partsMatch(a, b, emptyGSMatch = false) {
2655
+ let ai = 0;
2656
+ let bi = 0;
2657
+ let result = [];
2658
+ let which = '';
2659
+ while(ai < a.length && bi < b.length)if (a[ai] === b[bi]) {
2660
+ result.push('b' === which ? b[bi] : a[ai]);
2661
+ ai++;
2662
+ bi++;
2663
+ } else if (emptyGSMatch && '**' === a[ai] && b[bi] === a[ai + 1]) {
2664
+ result.push(a[ai]);
2665
+ ai++;
2666
+ } else if (emptyGSMatch && '**' === b[bi] && a[ai] === b[bi + 1]) {
2667
+ result.push(b[bi]);
2668
+ bi++;
2669
+ } else if ('*' === a[ai] && b[bi] && (this.options.dot || !b[bi].startsWith('.')) && '**' !== b[bi]) {
2670
+ if ('b' === which) return false;
2671
+ which = 'a';
2672
+ result.push(a[ai]);
2673
+ ai++;
2674
+ bi++;
702
2675
  } else {
703
- debug('Initializing plugin for watch run (not async).');
704
- tapAfterCompileToGetIssues(compiler, config, state);
2676
+ if ('*' !== b[bi] || !a[ai] || !this.options.dot && !!a[ai].startsWith('.') || '**' === a[ai]) return false;
2677
+ if ('a' === which) return false;
2678
+ which = 'b';
2679
+ result.push(b[bi]);
2680
+ ai++;
2681
+ bi++;
705
2682
  }
2683
+ return a.length === b.length && result;
706
2684
  }
707
- });
708
- compiler.hooks.compilation.tap('TsCheckerRspackPlugin', async (compilation)=>{
709
- if (compilation.compiler !== compiler) return;
710
- const iteration = ++state.iteration;
711
- if (state.abortController) {
712
- debug(`Aborting iteration ${iteration - 1}.`);
713
- state.abortController.abort();
714
- }
715
- const abortController = new AbortController();
716
- state.abortController = abortController;
717
- let filesChange = {};
718
- if (state.watching) {
719
- filesChange = consumeFilesChange(compiler);
720
- log([
721
- 'Calling reporter service for incremental check.',
722
- ` Changed files: ${JSON.stringify(filesChange.changedFiles)}`,
723
- ` Deleted files: ${JSON.stringify(filesChange.deletedFiles)}`
724
- ].join('\n'));
725
- } else log('Calling reporter service for single check.');
726
- filesChange = await hooks.start.promise(filesChange, compilation);
727
- let aggregatedFilesChange = filesChange;
728
- if (state.aggregatedFilesChange) {
729
- aggregatedFilesChange = aggregateFilesChanges([
730
- aggregatedFilesChange,
731
- filesChange
732
- ]);
733
- debug([
734
- `Aggregating with previous files change, iteration ${iteration}.`,
735
- ` Changed files: ${JSON.stringify(aggregatedFilesChange.changedFiles)}`,
736
- ` Deleted files: ${JSON.stringify(aggregatedFilesChange.deletedFiles)}`
737
- ].join('\n'));
738
- }
739
- state.aggregatedFilesChange = aggregatedFilesChange;
740
- state.issuesPromise = (state.issuesPromise || Promise.resolve()).catch(()=>void 0).then(()=>{
741
- if (abortController.signal.aborted) return;
742
- debug(`Submitting the getIssuesWorker to the pool, iteration ${iteration}.`);
743
- return issuesPool.submit(async ()=>{
744
- try {
745
- debug(`Running the getIssuesWorker, iteration ${iteration}.`);
746
- const issues = await getIssuesWorker(aggregatedFilesChange, state.watching, config.issue.defaultSeverity);
747
- if (state.aggregatedFilesChange === aggregatedFilesChange) state.aggregatedFilesChange = void 0;
748
- if (state.abortController === abortController) state.abortController = void 0;
749
- return issues;
750
- } catch (error) {
751
- hooks.error.call(error, compilation);
752
- return;
753
- } finally{
754
- debug(`The getIssuesWorker finished its job, iteration ${iteration}.`);
2685
+ parseNegate() {
2686
+ if (this.nonegate) return;
2687
+ const pattern = this.pattern;
2688
+ let negate = false;
2689
+ let negateOffset = 0;
2690
+ for(let i = 0; i < pattern.length && '!' === pattern.charAt(i); i++){
2691
+ negate = !negate;
2692
+ negateOffset++;
2693
+ }
2694
+ if (negateOffset) this.pattern = pattern.slice(negateOffset);
2695
+ this.negate = negate;
2696
+ }
2697
+ matchOne(file, pattern, partial = false) {
2698
+ const options = this.options;
2699
+ if (this.isWindows) {
2700
+ const fileDrive = 'string' == typeof file[0] && /^[a-z]:$/i.test(file[0]);
2701
+ const fileUNC = !fileDrive && '' === file[0] && '' === file[1] && '?' === file[2] && /^[a-z]:$/i.test(file[3]);
2702
+ const patternDrive = 'string' == typeof pattern[0] && /^[a-z]:$/i.test(pattern[0]);
2703
+ const patternUNC = !patternDrive && '' === pattern[0] && '' === pattern[1] && '?' === pattern[2] && 'string' == typeof pattern[3] && /^[a-z]:$/i.test(pattern[3]);
2704
+ const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
2705
+ const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
2706
+ if ('number' == typeof fdi && 'number' == typeof pdi) {
2707
+ const [fd, pd] = [
2708
+ file[fdi],
2709
+ pattern[pdi]
2710
+ ];
2711
+ if (fd.toLowerCase() === pd.toLowerCase()) {
2712
+ pattern[pdi] = fd;
2713
+ if (pdi > fdi) pattern = pattern.slice(pdi);
2714
+ else if (fdi > pdi) file = file.slice(fdi);
2715
+ }
2716
+ }
2717
+ }
2718
+ const { optimizationLevel = 1 } = this.options;
2719
+ if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
2720
+ this.debug('matchOne', this, {
2721
+ file,
2722
+ pattern
2723
+ });
2724
+ this.debug('matchOne', file.length, pattern.length);
2725
+ for(var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++){
2726
+ this.debug('matchOne loop');
2727
+ var p = pattern[pi];
2728
+ var f = file[fi];
2729
+ this.debug(pattern, p, f);
2730
+ if (false === p) return false;
2731
+ if (p === GLOBSTAR) {
2732
+ this.debug('GLOBSTAR', [
2733
+ pattern,
2734
+ p,
2735
+ f
2736
+ ]);
2737
+ var fr = fi;
2738
+ var pr = pi + 1;
2739
+ if (pr === pl) {
2740
+ this.debug('** at the end');
2741
+ for(; fi < fl; fi++)if ('.' === file[fi] || '..' === file[fi] || !options.dot && '.' === file[fi].charAt(0)) return false;
2742
+ return true;
2743
+ }
2744
+ while(fr < fl){
2745
+ var swallowee = file[fr];
2746
+ this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
2747
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
2748
+ this.debug('globstar found match!', fr, fl, swallowee);
2749
+ return true;
2750
+ }
2751
+ if ('.' === swallowee || '..' === swallowee || !options.dot && '.' === swallowee.charAt(0)) {
2752
+ this.debug('dot detected!', file, fr, pattern, pr);
2753
+ break;
2754
+ }
2755
+ this.debug('globstar swallow a segment, and continue');
2756
+ fr++;
2757
+ }
2758
+ if (partial) {
2759
+ this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
2760
+ if (fr === fl) return true;
2761
+ }
2762
+ return false;
755
2763
  }
756
- }, abortController.signal);
2764
+ let hit;
2765
+ if ('string' == typeof p) {
2766
+ hit = f === p;
2767
+ this.debug('string match', p, f, hit);
2768
+ } else {
2769
+ hit = p.test(f);
2770
+ this.debug('pattern match', p, f, hit);
2771
+ }
2772
+ if (!hit) return false;
2773
+ }
2774
+ if (fi === fl && pi === pl) return true;
2775
+ if (fi === fl) return partial;
2776
+ if (pi === pl) return fi === fl - 1 && '' === file[fi];
2777
+ throw new Error('wtf?');
2778
+ }
2779
+ braceExpand() {
2780
+ return braceExpand(this.pattern, this.options);
2781
+ }
2782
+ parse(pattern) {
2783
+ assertValidPattern(pattern);
2784
+ const options = this.options;
2785
+ if ('**' === pattern) return GLOBSTAR;
2786
+ if ('' === pattern) return '';
2787
+ let m;
2788
+ let fastTest = null;
2789
+ if (m = pattern.match(starRE)) fastTest = options.dot ? starTestDot : starTest;
2790
+ else if (m = pattern.match(starDotExtRE)) fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
2791
+ else if (m = pattern.match(qmarksRE)) fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
2792
+ else if (m = pattern.match(starDotStarRE)) fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
2793
+ else if (m = pattern.match(dotStarRE)) fastTest = dotStarTest;
2794
+ const re = ast_AST.fromGlob(pattern, this.options).toMMPattern();
2795
+ if (fastTest && 'object' == typeof re) Reflect.defineProperty(re, 'test', {
2796
+ value: fastTest
2797
+ });
2798
+ return re;
2799
+ }
2800
+ makeRe() {
2801
+ if (this.regexp || false === this.regexp) return this.regexp;
2802
+ const set = this.set;
2803
+ if (!set.length) {
2804
+ this.regexp = false;
2805
+ return this.regexp;
2806
+ }
2807
+ const options = this.options;
2808
+ const twoStar = options.noglobstar ? esm_star : options.dot ? twoStarDot : twoStarNoDot;
2809
+ const flags = new Set(options.nocase ? [
2810
+ 'i'
2811
+ ] : []);
2812
+ let re = set.map((pattern)=>{
2813
+ const pp = pattern.map((p)=>{
2814
+ if (p instanceof RegExp) for (const f of p.flags.split(''))flags.add(f);
2815
+ return 'string' == typeof p ? esm_regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
2816
+ });
2817
+ pp.forEach((p, i)=>{
2818
+ const next = pp[i + 1];
2819
+ const prev = pp[i - 1];
2820
+ if (p !== GLOBSTAR || prev === GLOBSTAR) return;
2821
+ if (void 0 === prev) if (void 0 !== next && next !== GLOBSTAR) pp[i + 1] = '(?:\\/|' + twoStar + '\\/)?' + next;
2822
+ else pp[i] = twoStar;
2823
+ else if (void 0 === next) pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + ')?';
2824
+ else if (next !== GLOBSTAR) {
2825
+ pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
2826
+ pp[i + 1] = GLOBSTAR;
2827
+ }
2828
+ });
2829
+ const filtered = pp.filter((p)=>p !== GLOBSTAR);
2830
+ if (this.partial && filtered.length >= 1) {
2831
+ const prefixes = [];
2832
+ for(let i = 1; i <= filtered.length; i++)prefixes.push(filtered.slice(0, i).join('/'));
2833
+ return '(?:' + prefixes.join('|') + ')';
2834
+ }
2835
+ return filtered.join('/');
2836
+ }).join('|');
2837
+ const [open, close] = set.length > 1 ? [
2838
+ '(?:',
2839
+ ')'
2840
+ ] : [
2841
+ '',
2842
+ ''
2843
+ ];
2844
+ re = '^' + open + re + close + '$';
2845
+ if (this.partial) re = '^(?:\\/|' + open + re.slice(1, -1) + close + ')$';
2846
+ if (this.negate) re = '^(?!' + re + ').+$';
2847
+ try {
2848
+ this.regexp = new RegExp(re, [
2849
+ ...flags
2850
+ ].join(''));
2851
+ } catch (ex) {
2852
+ this.regexp = false;
2853
+ }
2854
+ return this.regexp;
2855
+ }
2856
+ slashSplit(p) {
2857
+ if (this.preserveMultipleSlashes) return p.split('/');
2858
+ if (this.isWindows && /^\/\/[^\/]+/.test(p)) return [
2859
+ '',
2860
+ ...p.split(/\/+/)
2861
+ ];
2862
+ return p.split(/\/+/);
2863
+ }
2864
+ match(f, partial = this.partial) {
2865
+ this.debug('match', f, this.pattern);
2866
+ if (this.comment) return false;
2867
+ if (this.empty) return '' === f;
2868
+ if ('/' === f && partial) return true;
2869
+ const options = this.options;
2870
+ if (this.isWindows) f = f.split('\\').join('/');
2871
+ const ff = this.slashSplit(f);
2872
+ this.debug(this.pattern, 'split', ff);
2873
+ const set = this.set;
2874
+ this.debug(this.pattern, 'set', set);
2875
+ let filename = ff[ff.length - 1];
2876
+ if (!filename) for(let i = ff.length - 2; !filename && i >= 0; i--)filename = ff[i];
2877
+ for(let i = 0; i < set.length; i++){
2878
+ const pattern = set[i];
2879
+ let file = ff;
2880
+ if (options.matchBase && 1 === pattern.length) file = [
2881
+ filename
2882
+ ];
2883
+ const hit = this.matchOne(file, pattern, partial);
2884
+ if (hit) {
2885
+ if (options.flipNegate) return true;
2886
+ return !this.negate;
2887
+ }
2888
+ }
2889
+ if (options.flipNegate) return false;
2890
+ return this.negate;
2891
+ }
2892
+ static defaults(def) {
2893
+ return minimatch.defaults(def).Minimatch;
2894
+ }
2895
+ }
2896
+ minimatch.AST = ast_AST;
2897
+ minimatch.Minimatch = esm_Minimatch;
2898
+ minimatch.escape = escape_escape;
2899
+ minimatch.unescape = unescape_unescape;
2900
+ var is_glob = __webpack_require__("./node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js");
2901
+ var is_glob_default = /*#__PURE__*/ __webpack_require__.n(is_glob);
2902
+ const IGNORED_FILES = [
2903
+ 'package.json'
2904
+ ];
2905
+ const isIgnoredFile = (file)=>IGNORED_FILES.some((ignoredFile)=>file.endsWith(`/${ignoredFile}`) || file.endsWith(`\\${ignoredFile}`));
2906
+ const compilerFilesChangeMap = new WeakMap();
2907
+ function getFilesChange(compiler) {
2908
+ const { changedFiles = [], deletedFiles = [] } = compilerFilesChangeMap.get(compiler) || {
2909
+ changedFiles: [],
2910
+ deletedFiles: []
2911
+ };
2912
+ return {
2913
+ changedFiles: changedFiles.filter((changedFile)=>!isIgnoredFile(changedFile)),
2914
+ deletedFiles: deletedFiles.filter((deletedFile)=>!isIgnoredFile(deletedFile))
2915
+ };
2916
+ }
2917
+ function consumeFilesChange(compiler) {
2918
+ const change = getFilesChange(compiler);
2919
+ clearFilesChange(compiler);
2920
+ return change;
2921
+ }
2922
+ function updateFilesChange(compiler, change) {
2923
+ compilerFilesChangeMap.set(compiler, aggregateFilesChanges([
2924
+ getFilesChange(compiler),
2925
+ change
2926
+ ]));
2927
+ }
2928
+ function clearFilesChange(compiler) {
2929
+ compilerFilesChangeMap.delete(compiler);
2930
+ }
2931
+ function aggregateFilesChanges(changes) {
2932
+ const changedFilesSet = new Set();
2933
+ const deletedFilesSet = new Set();
2934
+ for (const { changedFiles = [], deletedFiles = [] } of changes){
2935
+ for (const changedFile of changedFiles){
2936
+ changedFilesSet.add(changedFile);
2937
+ deletedFilesSet.delete(changedFile);
2938
+ }
2939
+ for (const deletedFile of deletedFiles){
2940
+ changedFilesSet.delete(deletedFile);
2941
+ deletedFilesSet.add(deletedFile);
2942
+ }
2943
+ }
2944
+ return {
2945
+ changedFiles: Array.from(changedFilesSet),
2946
+ deletedFiles: Array.from(deletedFilesSet)
2947
+ };
2948
+ }
2949
+ function isInsideAnotherPath(parent, directory) {
2950
+ const relativePart = (0, external_node_path_namespaceObject.relative)(parent, directory);
2951
+ if (relativePart.startsWith('..')) return false;
2952
+ if (0 === relativePart.length) return false;
2953
+ if ((0, external_node_path_namespaceObject.isAbsolute)(relativePart)) return false;
2954
+ return true;
2955
+ }
2956
+ function _define_property(obj, key, value) {
2957
+ if (key in obj) Object.defineProperty(obj, key, {
2958
+ value: value,
2959
+ enumerable: true,
2960
+ configurable: true,
2961
+ writable: true
2962
+ });
2963
+ else obj[key] = value;
2964
+ return obj;
2965
+ }
2966
+ const BUILTIN_IGNORED_DIRS = [
2967
+ '.git'
2968
+ ];
2969
+ function createIsIgnored(ignored, excluded) {
2970
+ const ignoredPatterns = ignored ? Array.isArray(ignored) ? [
2971
+ ...ignored
2972
+ ] : [
2973
+ ignored
2974
+ ] : [];
2975
+ const filteredExcluded = excluded.filter((pattern)=>{
2976
+ if (is_glob_default()(pattern)) {
2977
+ const shouldAppendStar = pattern.includes('**') && !pattern.endsWith('*');
2978
+ if (shouldAppendStar) ignoredPatterns.push(pattern.endsWith('/') ? `${pattern}**` : `${pattern}/**`);
2979
+ else ignoredPatterns.push(pattern);
2980
+ return false;
2981
+ }
2982
+ return true;
2983
+ });
2984
+ const ignoredFunctions = ignoredPatterns.map((pattern)=>{
2985
+ if ('string' == typeof pattern) return (path)=>minimatch(path, pattern);
2986
+ if (pattern instanceof RegExp) return (path)=>pattern.test(path);
2987
+ return ()=>false;
757
2988
  });
758
- debug(`Submitting the getDependenciesWorker to the pool, iteration ${iteration}.`);
759
- state.dependenciesPromise = dependenciesPool.submit(async ()=>{
2989
+ ignoredFunctions.push((path)=>filteredExcluded.some((excludedPath)=>isInsideAnotherPath(excludedPath, path)));
2990
+ ignoredFunctions.push((path)=>BUILTIN_IGNORED_DIRS.some((ignoredDir)=>path.includes(`/${ignoredDir}/`) || path.includes(`\\${ignoredDir}\\`)));
2991
+ return function(path) {
2992
+ return ignoredFunctions.some((ignoredFunction)=>ignoredFunction(path));
2993
+ };
2994
+ }
2995
+ class InclusiveNodeWatchFileSystem {
2996
+ get watcher() {
2997
+ return this.watchFileSystem.watcher || this.watchFileSystem.wfs?.watcher;
2998
+ }
2999
+ constructor(watchFileSystem, compiler, pluginState){
3000
+ _define_property(this, "watchFileSystem", void 0);
3001
+ _define_property(this, "compiler", void 0);
3002
+ _define_property(this, "pluginState", void 0);
3003
+ _define_property(this, "dirsWatchers", void 0);
3004
+ _define_property(this, "paused", void 0);
3005
+ _define_property(this, "deletedFiles", void 0);
3006
+ _define_property(this, "watch", void 0);
3007
+ this.watchFileSystem = watchFileSystem;
3008
+ this.compiler = compiler;
3009
+ this.pluginState = pluginState;
3010
+ this.paused = true;
3011
+ this.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed)=>{
3012
+ const { debug } = getInfrastructureLogger(this.compiler);
3013
+ clearFilesChange(this.compiler);
3014
+ const isIgnored = createIsIgnored(options?.ignored, this.pluginState.lastDependencies?.excluded || []);
3015
+ const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
3016
+ this.watcher?.on('change', (file)=>{
3017
+ if ('string' != typeof file) return;
3018
+ if (isIgnored(file)) debug("Detected file change but it's ignored", file);
3019
+ else {
3020
+ debug('Detected file change', file);
3021
+ this.deletedFiles.delete(file);
3022
+ updateFilesChange(this.compiler, {
3023
+ changedFiles: [
3024
+ file
3025
+ ]
3026
+ });
3027
+ }
3028
+ });
3029
+ this.watcher?.on('remove', (file)=>{
3030
+ if ('string' != typeof file) return;
3031
+ if (this.deletedFiles.has(file)) return void debug('Skipping duplicated remove event.');
3032
+ if (isIgnored(file)) debug("Detected file remove but it's ignored", file);
3033
+ else {
3034
+ debug('Detected file remove', file);
3035
+ this.deletedFiles.add(file);
3036
+ updateFilesChange(this.compiler, {
3037
+ deletedFiles: [
3038
+ file
3039
+ ]
3040
+ });
3041
+ }
3042
+ });
3043
+ const prevDirs = Array.from(this.dirsWatchers.keys());
3044
+ const nextDirs = Array.from(this.pluginState.lastDependencies?.dirs || []);
3045
+ const dirsToUnwatch = prevDirs.filter((prevDir)=>!nextDirs.includes(prevDir));
3046
+ const dirsToWatch = nextDirs.filter((nextDir)=>!prevDirs.includes(nextDir) && !isIgnored(nextDir));
3047
+ dirsToUnwatch.forEach((dirToUnwatch)=>{
3048
+ this.dirsWatchers.get(dirToUnwatch)?.close();
3049
+ this.dirsWatchers.delete(dirToUnwatch);
3050
+ });
3051
+ dirsToWatch.forEach((dirToWatch)=>{
3052
+ const interval = 'number' == typeof options?.poll ? options.poll : void 0;
3053
+ const dirWatcher = external_chokidar_default().watch(dirToWatch, {
3054
+ ignoreInitial: true,
3055
+ ignorePermissionErrors: true,
3056
+ ignored: (path)=>isIgnored(path),
3057
+ usePolling: options?.poll ? true : void 0,
3058
+ interval: interval,
3059
+ binaryInterval: interval,
3060
+ alwaysStat: true,
3061
+ atomic: true,
3062
+ awaitWriteFinish: true
3063
+ });
3064
+ dirWatcher.on('add', (file, stats)=>{
3065
+ if (this.paused) return;
3066
+ const extension = (0, external_node_path_namespaceObject.extname)(file);
3067
+ const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
3068
+ if (!supportedExtensions.includes(extension)) return void debug('Detected new file add but extension is not supported', file);
3069
+ debug('Detected new file add', file);
3070
+ this.deletedFiles.delete(file);
3071
+ updateFilesChange(this.compiler, {
3072
+ changedFiles: [
3073
+ file
3074
+ ]
3075
+ });
3076
+ this.watcher?._onChange(file, stats?.mtimeMs || stats?.ctimeMs || 1, file, 'rename');
3077
+ });
3078
+ dirWatcher.on('unlink', (file)=>{
3079
+ if (this.paused) return;
3080
+ const extension = (0, external_node_path_namespaceObject.extname)(file);
3081
+ const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
3082
+ if (!supportedExtensions.includes(extension)) return void debug('Detected new file remove but extension is not supported', file);
3083
+ if (this.deletedFiles.has(file)) return void debug('Skipping duplicated unlink event.');
3084
+ debug('Detected new file remove', file);
3085
+ this.deletedFiles.add(file);
3086
+ updateFilesChange(this.compiler, {
3087
+ deletedFiles: [
3088
+ file
3089
+ ]
3090
+ });
3091
+ this.watcher?._onRemove(dirToWatch, file, 'rename');
3092
+ });
3093
+ this.dirsWatchers.set(dirToWatch, dirWatcher);
3094
+ });
3095
+ this.paused = false;
3096
+ return {
3097
+ ...standardWatcher,
3098
+ close: ()=>{
3099
+ clearFilesChange(this.compiler);
3100
+ if (standardWatcher) standardWatcher.close();
3101
+ this.dirsWatchers.forEach((dirWatcher)=>{
3102
+ dirWatcher?.close();
3103
+ });
3104
+ this.dirsWatchers.clear();
3105
+ this.paused = true;
3106
+ },
3107
+ pause: ()=>{
3108
+ if (standardWatcher) standardWatcher.pause();
3109
+ this.paused = true;
3110
+ }
3111
+ };
3112
+ };
3113
+ this.dirsWatchers = new Map();
3114
+ this.deletedFiles = new Set();
3115
+ }
3116
+ }
3117
+ function tapAfterEnvironmentToPatchWatching(compiler, state) {
3118
+ const { debug } = getInfrastructureLogger(compiler);
3119
+ compiler.hooks.afterEnvironment.tap('TsCheckerRspackPlugin', ()=>{
3120
+ const watchFileSystem = compiler.watchFileSystem;
3121
+ if (watchFileSystem) {
3122
+ debug("Overwriting Rspack's watch file system.");
3123
+ compiler.watchFileSystem = new InclusiveNodeWatchFileSystem(watchFileSystem, compiler, state);
3124
+ } else debug('No watch file system found - plugin may not work correctly.');
3125
+ });
3126
+ }
3127
+ var external_picocolors_ = __webpack_require__("picocolors");
3128
+ var external_picocolors_default = /*#__PURE__*/ __webpack_require__.n(external_picocolors_);
3129
+ const lite_tapable_namespaceObject = require("@rspack/lite-tapable");
3130
+ const compilerHookMap = new WeakMap();
3131
+ function createPluginHooks() {
3132
+ return {
3133
+ start: new lite_tapable_namespaceObject.AsyncSeriesWaterfallHook([
3134
+ 'change',
3135
+ 'compilation'
3136
+ ]),
3137
+ waiting: new lite_tapable_namespaceObject.SyncHook([
3138
+ 'compilation'
3139
+ ]),
3140
+ canceled: new lite_tapable_namespaceObject.SyncHook([
3141
+ 'compilation'
3142
+ ]),
3143
+ error: new lite_tapable_namespaceObject.SyncHook([
3144
+ 'error',
3145
+ 'compilation'
3146
+ ]),
3147
+ issues: new lite_tapable_namespaceObject.SyncWaterfallHook([
3148
+ 'issues',
3149
+ 'compilation'
3150
+ ])
3151
+ };
3152
+ }
3153
+ function forwardPluginHooks(source, target) {
3154
+ source.start.tapPromise('TsCheckerRspackPlugin', target.start.promise);
3155
+ source.waiting.tap('TsCheckerRspackPlugin', target.waiting.call);
3156
+ source.canceled.tap('TsCheckerRspackPlugin', target.canceled.call);
3157
+ source.error.tap('TsCheckerRspackPlugin', target.error.call);
3158
+ source.issues.tap('TsCheckerRspackPlugin', target.issues.call);
3159
+ }
3160
+ function getPluginHooks(compiler) {
3161
+ let hooks = compilerHookMap.get(compiler);
3162
+ if (void 0 === hooks) {
3163
+ hooks = createPluginHooks();
3164
+ compilerHookMap.set(compiler, hooks);
3165
+ if ('compilers' in compiler) compiler.compilers.forEach((childCompiler)=>{
3166
+ const childHooks = getPluginHooks(childCompiler);
3167
+ if (hooks) forwardPluginHooks(childHooks, hooks);
3168
+ });
3169
+ }
3170
+ return hooks;
3171
+ }
3172
+ const external_node_process_namespaceObject = require("node:process");
3173
+ function createControlledPromise() {
3174
+ let resolve = ()=>void 0;
3175
+ let reject = ()=>void 0;
3176
+ const promise = new Promise((aResolve, aReject)=>{
3177
+ resolve = aResolve;
3178
+ reject = aReject;
3179
+ });
3180
+ return {
3181
+ promise,
3182
+ resolve,
3183
+ reject
3184
+ };
3185
+ }
3186
+ function rpc_error_define_property(obj, key, value) {
3187
+ if (key in obj) Object.defineProperty(obj, key, {
3188
+ value: value,
3189
+ enumerable: true,
3190
+ configurable: true,
3191
+ writable: true
3192
+ });
3193
+ else obj[key] = value;
3194
+ return obj;
3195
+ }
3196
+ class RpcExitError extends Error {
3197
+ constructor(message, code, signal){
3198
+ super(message), rpc_error_define_property(this, "code", void 0), rpc_error_define_property(this, "signal", void 0), this.code = code, this.signal = signal;
3199
+ this.name = 'RpcExitError';
3200
+ }
3201
+ }
3202
+ function wrapRpc(childProcess) {
3203
+ return async (...args)=>{
3204
+ if (childProcess.send) {
3205
+ if (!childProcess.connected) throw new Error(`Process ${childProcess.pid} doesn't have open IPC channels`);
3206
+ } else throw new Error(`Process ${childProcess.pid} doesn't have IPC channels`);
3207
+ const id = uuid();
3208
+ const { promise: resultPromise, resolve: resolveResult, reject: rejectResult } = createControlledPromise();
3209
+ const { promise: sendPromise, resolve: resolveSend, reject: rejectSend } = createControlledPromise();
3210
+ const handleMessage = (message)=>{
3211
+ if (message?.id === id) {
3212
+ if ('resolve' === message.type) {
3213
+ resolveResult(message.value);
3214
+ removeHandlers();
3215
+ } else if ('reject' === message.type) {
3216
+ rejectResult(message.error);
3217
+ removeHandlers();
3218
+ }
3219
+ }
3220
+ };
3221
+ const handleClose = (code, signal)=>{
3222
+ rejectResult(new RpcExitError(code ? `Process ${childProcess.pid} exited with code ${code}` + (signal ? ` [${signal}]` : '') : `Process ${childProcess.pid} exited` + (signal ? ` [${signal}]` : ''), code, signal));
3223
+ removeHandlers();
3224
+ };
3225
+ const removeHandlers = ()=>{
3226
+ childProcess.off('message', handleMessage);
3227
+ childProcess.off('close', handleClose);
3228
+ };
3229
+ childProcess.on('message', handleMessage);
3230
+ childProcess.on('close', handleClose);
3231
+ childProcess.send({
3232
+ type: 'call',
3233
+ id,
3234
+ args
3235
+ }, (error)=>{
3236
+ if (error) {
3237
+ rejectSend(error);
3238
+ removeHandlers();
3239
+ } else resolveSend(void 0);
3240
+ });
3241
+ return sendPromise.then(()=>resultPromise);
3242
+ };
3243
+ }
3244
+ function uuid() {
3245
+ return new Array(4).fill(0).map(()=>Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join('-');
3246
+ }
3247
+ const external_node_child_process_namespaceObject = require("node:child_process");
3248
+ const WORKER_DATA_ENV_KEY = 'WORKER_DATA';
3249
+ function createRpcWorker(modulePath, data, memoryLimit) {
3250
+ const options = {
3251
+ env: {
3252
+ ...external_node_process_namespaceObject.env,
3253
+ [WORKER_DATA_ENV_KEY]: JSON.stringify(data || {})
3254
+ },
3255
+ stdio: [
3256
+ 'inherit',
3257
+ 'inherit',
3258
+ 'inherit',
3259
+ 'ipc'
3260
+ ],
3261
+ serialization: 'advanced'
3262
+ };
3263
+ if (memoryLimit) options.execArgv = [
3264
+ `--max-old-space-size=${memoryLimit}`
3265
+ ];
3266
+ let childProcess;
3267
+ let remoteMethod;
3268
+ const worker = {
3269
+ connect () {
3270
+ if (childProcess && !childProcess.connected) {
3271
+ childProcess.kill('SIGTERM');
3272
+ childProcess = void 0;
3273
+ remoteMethod = void 0;
3274
+ }
3275
+ if (!childProcess?.connected) {
3276
+ childProcess = external_node_child_process_namespaceObject.fork(modulePath, options);
3277
+ remoteMethod = wrapRpc(childProcess);
3278
+ }
3279
+ },
3280
+ terminate () {
3281
+ if (childProcess) {
3282
+ childProcess.kill('SIGTERM');
3283
+ childProcess = void 0;
3284
+ remoteMethod = void 0;
3285
+ }
3286
+ },
3287
+ get connected () {
3288
+ return Boolean(childProcess?.connected);
3289
+ },
3290
+ get process () {
3291
+ return childProcess;
3292
+ }
3293
+ };
3294
+ return Object.assign((...args)=>{
3295
+ if (!worker.connected) worker.connect();
3296
+ if (!remoteMethod) return Promise.reject('Worker is not connected - cannot perform RPC.');
3297
+ return remoteMethod(...args);
3298
+ }, worker);
3299
+ }
3300
+ class AbortError extends Error {
3301
+ static throwIfAborted(signal) {
3302
+ if (signal?.aborted) throw new AbortError();
3303
+ }
3304
+ constructor(message = 'Task aborted.'){
3305
+ super(message);
3306
+ this.name = 'AbortError';
3307
+ }
3308
+ }
3309
+ function tapErrorToLogMessage(compiler, config) {
3310
+ const hooks = getPluginHooks(compiler);
3311
+ hooks.error.tap('TsCheckerRspackPlugin', (error)=>{
3312
+ if (error instanceof AbortError) return;
3313
+ config.logger.error(String(error));
3314
+ if (error instanceof RpcExitError) if ('SIGINT' === error.signal) config.logger.error(external_picocolors_default().red("[type-check] Issues checking service interrupted - If running in a docker container, this may be caused by the container running out of memory. If so, try increasing the container's memory limit or lowering the `memoryLimit` value in the TsCheckerRspackPlugin configuration."));
3315
+ else config.logger.error(external_picocolors_default().red("[type-check] Issues checking service aborted - probably out of memory. Check the `memoryLimit` option in the TsCheckerRspackPlugin configuration.\nIf increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript."));
3316
+ });
3317
+ }
3318
+ const external_node_os_namespaceObject = require("node:os");
3319
+ var external_node_os_default = /*#__PURE__*/ __webpack_require__.n(external_node_os_namespaceObject);
3320
+ function createPool(size) {
3321
+ let pendingPromises = [];
3322
+ const pool = {
3323
+ async submit (task, signal) {
3324
+ while(pendingPromises.length >= pool.size){
3325
+ AbortError.throwIfAborted(signal);
3326
+ await Promise.race(pendingPromises).catch(()=>void 0);
3327
+ }
3328
+ AbortError.throwIfAborted(signal);
3329
+ const taskPromise = task(signal).finally(()=>{
3330
+ pendingPromises = pendingPromises.filter((pendingPromise)=>pendingPromise !== taskPromise);
3331
+ });
3332
+ pendingPromises.push(taskPromise);
3333
+ return taskPromise;
3334
+ },
3335
+ size,
3336
+ get pending () {
3337
+ return pendingPromises.length;
3338
+ },
3339
+ get drained () {
3340
+ return new Promise(async (resolve)=>{
3341
+ while(pendingPromises.length > 0)await Promise.race(pendingPromises).catch(()=>void 0);
3342
+ resolve(void 0);
3343
+ });
3344
+ }
3345
+ };
3346
+ return pool;
3347
+ }
3348
+ const issuesPool = createPool(Math.max(1, external_node_os_namespaceObject.cpus().length));
3349
+ const dependenciesPool = createPool(Math.max(1, external_node_os_namespaceObject.cpus().length));
3350
+ function interceptDoneToGetDevServerTap(compiler, config, state) {
3351
+ const { debug } = getInfrastructureLogger(compiler);
3352
+ compiler.hooks.done.intercept({
3353
+ register: (tap)=>{
3354
+ if ([
3355
+ 'webpack-dev-server',
3356
+ 'rsbuild-dev-server'
3357
+ ].includes(tap.name) && 'sync' === tap.type && config.devServer) {
3358
+ debug('Intercepting dev-server tap.');
3359
+ state.DevServerDoneTap = tap;
3360
+ }
3361
+ return tap;
3362
+ }
3363
+ });
3364
+ }
3365
+ function forwardSlash(input) {
3366
+ return external_node_path_default().normalize(input).replace(/\\+/g, '/');
3367
+ }
3368
+ function relativeToContext(file, context) {
3369
+ let fileInContext = forwardSlash(external_node_path_default().relative(context, file));
3370
+ if (!fileInContext.startsWith('../')) fileInContext = './' + fileInContext;
3371
+ return fileInContext;
3372
+ }
3373
+ function formatIssueLocation(location) {
3374
+ return `${location.start.line}:${location.start.column}`;
3375
+ }
3376
+ function issue_rspack_error_define_property(obj, key, value) {
3377
+ if (key in obj) Object.defineProperty(obj, key, {
3378
+ value: value,
3379
+ enumerable: true,
3380
+ configurable: true,
3381
+ writable: true
3382
+ });
3383
+ else obj[key] = value;
3384
+ return obj;
3385
+ }
3386
+ class IssueRspackError extends Error {
3387
+ constructor(message, pathType, issue){
3388
+ super(message), issue_rspack_error_define_property(this, "issue", void 0), issue_rspack_error_define_property(this, "hideStack", void 0), issue_rspack_error_define_property(this, "file", void 0), this.issue = issue, this.hideStack = true;
3389
+ if (issue.file) {
3390
+ this.file = 'absolute' === pathType ? forwardSlash(external_node_path_default().resolve(issue.file)) : relativeToContext(issue.file, process.cwd());
3391
+ if (issue.location) this.file += `:${formatIssueLocation(issue.location)}`;
3392
+ }
3393
+ Error.captureStackTrace(this, this.constructor);
3394
+ }
3395
+ }
3396
+ function tapAfterCompileToGetIssues(compiler, config, state) {
3397
+ const hooks = getPluginHooks(compiler);
3398
+ const { debug } = getInfrastructureLogger(compiler);
3399
+ compiler.hooks.afterCompile.tapPromise('TsCheckerRspackPlugin', async (compilation)=>{
3400
+ if (compilation.compiler !== compiler) return;
3401
+ let issues = [];
760
3402
  try {
761
- debug(`Running the getDependenciesWorker, iteration ${iteration}.`);
762
- return await getDependenciesWorker(filesChange);
3403
+ issues = await state.issuesPromise;
763
3404
  } catch (error) {
764
3405
  hooks.error.call(error, compilation);
765
3406
  return;
766
- } finally{
767
- debug(`The getDependenciesWorker finished its job, iteration ${iteration}.`);
768
3407
  }
3408
+ debug('Got issues from getIssuesWorker.', issues?.length);
3409
+ if (!issues) return;
3410
+ issues = issues.filter(config.issue.predicate);
3411
+ issues = hooks.issues.call(issues, compilation);
3412
+ issues.forEach((issue)=>{
3413
+ const error = new IssueRspackError(config.formatter.format(issue), config.formatter.pathType, issue);
3414
+ if ('warning' === issue.severity) compilation.warnings.push(error);
3415
+ else compilation.errors.push(error);
3416
+ });
769
3417
  });
770
- });
771
- }
772
- function tapStopToTerminateWorkers(compiler, getIssuesWorker, getDependenciesWorker, state) {
773
- const { debug } = getInfrastructureLogger(compiler);
774
- const terminateWorkers = ()=>{
775
- debug('Compiler is going to close - terminating workers...');
776
- getIssuesWorker.terminate();
777
- getDependenciesWorker.terminate();
778
- };
779
- compiler.hooks.watchClose.tap('TsCheckerRspackPlugin', ()=>{
780
- terminateWorkers();
781
- });
782
- compiler.hooks.done.tap('TsCheckerRspackPlugin', ()=>{
783
- if (!state.watching) terminateWorkers();
784
- });
785
- compiler.hooks.failed.tap('TsCheckerRspackPlugin', ()=>{
786
- if (!state.watching) terminateWorkers();
787
- });
788
- }
789
- function createBasicFormatter() {
790
- return function(issue) {
791
- return external_picocolors_default().gray(issue.code + ': ') + issue.message;
792
- };
793
- }
794
- const code_frame_namespaceObject = require("@babel/code-frame");
795
- const external_node_fs_namespaceObject = require("node:fs");
796
- var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
797
- function createCodeFrameFormatter(options) {
798
- const basicFormatter = createBasicFormatter();
799
- return function(issue) {
800
- const source = issue.file && external_node_fs_default().existsSync(issue.file) && external_node_fs_default().readFileSync(issue.file, 'utf-8');
801
- let frame = '';
802
- if (source && issue.location) frame = (0, code_frame_namespaceObject.codeFrameColumns)(source, issue.location, {
803
- highlightCode: true,
804
- ...options || {}
805
- }).split('\n').map((line)=>' ' + line).join(external_node_os_default().EOL);
806
- const lines = [
807
- basicFormatter(issue)
808
- ];
809
- if (frame) lines.push(frame);
810
- return lines.join(external_node_os_default().EOL);
811
- };
812
- }
813
- function createFormatterConfig(options) {
814
- if ('function' == typeof options) return {
815
- format: options,
816
- pathType: 'relative'
817
- };
818
- const type = options ? 'object' == typeof options ? options.type || 'codeframe' : options : 'codeframe';
819
- const pathType = options && 'object' == typeof options ? options.pathType || 'relative' : 'relative';
820
- if (!type || 'basic' === type) return {
821
- format: createBasicFormatter(),
822
- pathType
823
- };
824
- if ('codeframe' === type) {
825
- const config = options && 'object' == typeof options ? options.options || {} : {};
826
- return {
827
- format: createCodeFrameFormatter(config),
828
- pathType
3418
+ }
3419
+ function statsFormatter(issues, stats) {
3420
+ const errorsNumber = issues.filter((issue)=>'error' === issue.severity).length;
3421
+ const warningsNumber = issues.filter((issue)=>'warning' === issue.severity).length;
3422
+ const errorsFormatted = errorsNumber ? external_picocolors_default().bold(external_picocolors_default().red(`${errorsNumber} ${1 === errorsNumber ? 'error' : 'errors'}`)) : '';
3423
+ const warningsFormatted = warningsNumber ? external_picocolors_default().bold(external_picocolors_default().yellow(`${warningsNumber} ${1 === warningsNumber ? 'warning' : 'warnings'}`)) : '';
3424
+ const timeFormatted = stats.startTime ? Math.round(Date.now() - stats.startTime) : 0;
3425
+ if (!errorsFormatted && !warningsFormatted) return external_picocolors_default().green(`[type-check] no errors found in ${timeFormatted} ms`);
3426
+ return [
3427
+ '[type-check] found ',
3428
+ errorsFormatted,
3429
+ errorsFormatted && warningsFormatted ? ' and ' : '',
3430
+ warningsFormatted,
3431
+ timeFormatted ? ` in ${timeFormatted} ms` : ''
3432
+ ].join('');
3433
+ }
3434
+ function createRspackFormatter(formatter, pathType) {
3435
+ return function(issue) {
3436
+ const color = 'warning' === issue.severity ? external_picocolors_default().yellow : external_picocolors_default().red;
3437
+ const severity = issue.severity.toUpperCase();
3438
+ if (!issue.file) return [
3439
+ `${external_picocolors_default().bold(color(severity))} in ` + formatter(issue),
3440
+ ''
3441
+ ].join(external_node_os_default().EOL);
3442
+ {
3443
+ let location = external_picocolors_default().bold('absolute' === pathType ? forwardSlash(external_node_path_default().resolve(issue.file)) : relativeToContext(issue.file, process.cwd()));
3444
+ if (issue.location) location += `:${external_picocolors_default().bold(external_picocolors_default().green(formatIssueLocation(issue.location)))}`;
3445
+ return [
3446
+ `${external_picocolors_default().bold(color(severity))} in ${location}`,
3447
+ formatter(issue),
3448
+ ''
3449
+ ].join(external_node_os_default().EOL);
3450
+ }
829
3451
  };
830
3452
  }
831
- throw new Error(`Unknown "${type}" formatter. Available types are: "basic", "codeframe" or a custom function.`);
832
- }
833
- function createIssuePredicateFromIssueMatch(context, match) {
834
- return (issue)=>{
835
- const matchesSeverity = !match.severity || match.severity === issue.severity;
836
- const matchesCode = !match.code || match.code === issue.code;
837
- const matchesFile = !issue.file || !!issue.file && (!match.file || (0, external_minimatch_namespaceObject.minimatch)(forwardSlash(external_node_path_default().relative(context, issue.file)), match.file));
838
- return matchesSeverity && matchesCode && matchesFile;
839
- };
840
- }
841
- function createTrivialIssuePredicate(result) {
842
- return ()=>result;
843
- }
844
- function composeIssuePredicates(predicates) {
845
- return (issue)=>predicates.some((predicate)=>predicate(issue));
846
- }
847
- function createIssuePredicateFromOption(context, option) {
848
- if (Array.isArray(option)) return composeIssuePredicates(option.map((option)=>'function' == typeof option ? option : createIssuePredicateFromIssueMatch(context, option)));
849
- return 'function' == typeof option ? option : createIssuePredicateFromIssueMatch(context, option);
850
- }
851
- function createIssueConfig(compiler, options) {
852
- const context = compiler.options.context || process.cwd();
853
- if (!options) options = {};
854
- const include = options.include ? createIssuePredicateFromOption(context, options.include) : createTrivialIssuePredicate(true);
855
- const exclude = options.exclude ? createIssuePredicateFromOption(context, options.exclude) : createTrivialIssuePredicate(false);
856
- const defaultSeverity = options.defaultSeverity ?? 'auto';
857
- return {
858
- predicate: (issue)=>include(issue) && !exclude(issue),
859
- defaultSeverity
860
- };
861
- }
862
- function createTypeScriptWorkerConfig(compiler, options) {
863
- let configFile = 'object' == typeof options ? options.configFile || 'tsconfig.json' : 'tsconfig.json';
864
- configFile = external_node_path_default().normalize(external_node_path_default().isAbsolute(configFile) ? configFile : external_node_path_default().resolve(compiler.options.context || process.cwd(), configFile));
865
- const optionsAsObject = 'object' == typeof options ? options : {};
866
- const typescriptPath = optionsAsObject.typescriptPath || require.resolve("typescript");
867
- return {
868
- enabled: Boolean(options) || void 0 === options,
869
- memoryLimit: 8192,
870
- build: false,
871
- mode: optionsAsObject.build ? 'write-tsbuildinfo' : 'readonly',
872
- profile: false,
873
- ...optionsAsObject,
874
- configFile: configFile,
875
- configOverwrite: optionsAsObject.configOverwrite || {},
876
- context: optionsAsObject.context || external_node_path_default().dirname(configFile),
877
- diagnosticOptions: {
878
- syntactic: false,
879
- semantic: true,
880
- declaration: false,
881
- global: false,
882
- ...optionsAsObject.diagnosticOptions || {}
883
- },
884
- typescriptPath: typescriptPath
885
- };
886
- }
887
- function createPluginConfig(compiler, options = {}) {
888
- return {
889
- async: void 0 === options.async ? 'development' === compiler.options.mode : options.async,
890
- typescript: createTypeScriptWorkerConfig(compiler, options.typescript),
891
- issue: createIssueConfig(compiler, options.issue),
892
- formatter: createFormatterConfig(options.formatter),
893
- logger: 'webpack-infrastructure' === options.logger ? (()=>{
894
- const { info, error } = getInfrastructureLogger(compiler);
3453
+ function isPending(promise, timeout = 100) {
3454
+ return Promise.race([
3455
+ promise.then(()=>false).catch(()=>false),
3456
+ new Promise((resolve)=>setTimeout(()=>resolve(true), timeout))
3457
+ ]);
3458
+ }
3459
+ function wait(timeout) {
3460
+ return new Promise((resolve)=>setTimeout(resolve, timeout));
3461
+ }
3462
+ function tapDoneToAsyncGetIssues(compiler, config, state) {
3463
+ const hooks = getPluginHooks(compiler);
3464
+ const { debug } = getInfrastructureLogger(compiler);
3465
+ compiler.hooks.done.tap('TsCheckerRspackPlugin', async (stats)=>{
3466
+ if (stats.compilation.compiler !== compiler) return;
3467
+ const issuesPromise = state.issuesPromise;
3468
+ let issues;
3469
+ try {
3470
+ if (await isPending(issuesPromise)) {
3471
+ hooks.waiting.call(stats.compilation);
3472
+ config.logger.log(external_picocolors_default().cyan('[type-check] in progress...'));
3473
+ } else await wait(10);
3474
+ issues = await issuesPromise;
3475
+ } catch (error) {
3476
+ hooks.error.call(error, stats.compilation);
3477
+ return;
3478
+ }
3479
+ if (!issues || state.issuesPromise !== issuesPromise) return;
3480
+ debug(`Got ${issues?.length || 0} issues from getIssuesWorker.`);
3481
+ issues = issues.filter(config.issue.predicate);
3482
+ issues = hooks.issues.call(issues, stats.compilation);
3483
+ const formatter = createRspackFormatter(config.formatter.format, config.formatter.pathType);
3484
+ if (issues.length) config.logger.error(issues.map((issue)=>formatter(issue)).join('\n'));
3485
+ config.logger.log(statsFormatter(issues, stats));
3486
+ if (issues.length && state.DevServerDoneTap) {
3487
+ issues.forEach((issue)=>{
3488
+ const error = new IssueRspackError(config.formatter.format(issue), config.formatter.pathType, issue);
3489
+ if ('warning' === issue.severity) stats.compilation.warnings.push(error);
3490
+ else stats.compilation.errors.push(error);
3491
+ });
3492
+ debug('Sending issues to the dev-server.');
3493
+ state.DevServerDoneTap.fn(stats);
3494
+ }
3495
+ });
3496
+ }
3497
+ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker, config, state) {
3498
+ const hooks = getPluginHooks(compiler);
3499
+ const { log, debug } = getInfrastructureLogger(compiler);
3500
+ compiler.hooks.run.tap('TsCheckerRspackPlugin', ()=>{
3501
+ if (!state.initialized) {
3502
+ debug('Initializing plugin for single run (not async).');
3503
+ state.initialized = true;
3504
+ state.watching = false;
3505
+ tapAfterCompileToGetIssues(compiler, config, state);
3506
+ }
3507
+ });
3508
+ compiler.hooks.watchRun.tap('TsCheckerRspackPlugin', async ()=>{
3509
+ if (!state.initialized) {
3510
+ state.initialized = true;
3511
+ state.watching = true;
3512
+ if (config.async) {
3513
+ debug('Initializing plugin for watch run (async).');
3514
+ tapDoneToAsyncGetIssues(compiler, config, state);
3515
+ interceptDoneToGetDevServerTap(compiler, config, state);
3516
+ } else {
3517
+ debug('Initializing plugin for watch run (not async).');
3518
+ tapAfterCompileToGetIssues(compiler, config, state);
3519
+ }
3520
+ }
3521
+ });
3522
+ compiler.hooks.compilation.tap('TsCheckerRspackPlugin', async (compilation)=>{
3523
+ if (compilation.compiler !== compiler) return;
3524
+ const iteration = ++state.iteration;
3525
+ if (state.abortController) {
3526
+ debug(`Aborting iteration ${iteration - 1}.`);
3527
+ state.abortController.abort();
3528
+ }
3529
+ const abortController = new AbortController();
3530
+ state.abortController = abortController;
3531
+ let filesChange = {};
3532
+ if (state.watching) {
3533
+ filesChange = consumeFilesChange(compiler);
3534
+ log([
3535
+ 'Calling reporter service for incremental check.',
3536
+ ` Changed files: ${JSON.stringify(filesChange.changedFiles)}`,
3537
+ ` Deleted files: ${JSON.stringify(filesChange.deletedFiles)}`
3538
+ ].join('\n'));
3539
+ } else log('Calling reporter service for single check.');
3540
+ filesChange = await hooks.start.promise(filesChange, compilation);
3541
+ let aggregatedFilesChange = filesChange;
3542
+ if (state.aggregatedFilesChange) {
3543
+ aggregatedFilesChange = aggregateFilesChanges([
3544
+ aggregatedFilesChange,
3545
+ filesChange
3546
+ ]);
3547
+ debug([
3548
+ `Aggregating with previous files change, iteration ${iteration}.`,
3549
+ ` Changed files: ${JSON.stringify(aggregatedFilesChange.changedFiles)}`,
3550
+ ` Deleted files: ${JSON.stringify(aggregatedFilesChange.deletedFiles)}`
3551
+ ].join('\n'));
3552
+ }
3553
+ state.aggregatedFilesChange = aggregatedFilesChange;
3554
+ state.issuesPromise = (state.issuesPromise || Promise.resolve()).catch(()=>void 0).then(()=>{
3555
+ if (abortController.signal.aborted) return;
3556
+ debug(`Submitting the getIssuesWorker to the pool, iteration ${iteration}.`);
3557
+ return issuesPool.submit(async ()=>{
3558
+ try {
3559
+ debug(`Running the getIssuesWorker, iteration ${iteration}.`);
3560
+ const issues = await getIssuesWorker(aggregatedFilesChange, state.watching, config.issue.defaultSeverity);
3561
+ if (state.aggregatedFilesChange === aggregatedFilesChange) state.aggregatedFilesChange = void 0;
3562
+ if (state.abortController === abortController) state.abortController = void 0;
3563
+ return issues;
3564
+ } catch (error) {
3565
+ hooks.error.call(error, compilation);
3566
+ return;
3567
+ } finally{
3568
+ debug(`The getIssuesWorker finished its job, iteration ${iteration}.`);
3569
+ }
3570
+ }, abortController.signal);
3571
+ });
3572
+ debug(`Submitting the getDependenciesWorker to the pool, iteration ${iteration}.`);
3573
+ state.dependenciesPromise = dependenciesPool.submit(async ()=>{
3574
+ try {
3575
+ debug(`Running the getDependenciesWorker, iteration ${iteration}.`);
3576
+ return await getDependenciesWorker(filesChange);
3577
+ } catch (error) {
3578
+ hooks.error.call(error, compilation);
3579
+ return;
3580
+ } finally{
3581
+ debug(`The getDependenciesWorker finished its job, iteration ${iteration}.`);
3582
+ }
3583
+ });
3584
+ });
3585
+ }
3586
+ function tapStopToTerminateWorkers(compiler, getIssuesWorker, getDependenciesWorker, state) {
3587
+ const { debug } = getInfrastructureLogger(compiler);
3588
+ const terminateWorkers = ()=>{
3589
+ debug('Compiler is going to close - terminating workers...');
3590
+ getIssuesWorker.terminate();
3591
+ getDependenciesWorker.terminate();
3592
+ };
3593
+ compiler.hooks.watchClose.tap('TsCheckerRspackPlugin', ()=>{
3594
+ terminateWorkers();
3595
+ });
3596
+ compiler.hooks.done.tap('TsCheckerRspackPlugin', ()=>{
3597
+ if (!state.watching) terminateWorkers();
3598
+ });
3599
+ compiler.hooks.failed.tap('TsCheckerRspackPlugin', ()=>{
3600
+ if (!state.watching) terminateWorkers();
3601
+ });
3602
+ }
3603
+ function createBasicFormatter() {
3604
+ return function(issue) {
3605
+ return external_picocolors_default().gray(issue.code + ': ') + issue.message;
3606
+ };
3607
+ }
3608
+ var lib = __webpack_require__("./node_modules/.pnpm/@babel+code-frame@7.29.0/node_modules/@babel/code-frame/lib/index.js");
3609
+ const external_node_fs_namespaceObject = require("node:fs");
3610
+ var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
3611
+ function createCodeFrameFormatter(options) {
3612
+ const basicFormatter = createBasicFormatter();
3613
+ return function(issue) {
3614
+ const source = issue.file && external_node_fs_default().existsSync(issue.file) && external_node_fs_default().readFileSync(issue.file, 'utf-8');
3615
+ let frame = '';
3616
+ if (source && issue.location) frame = (0, lib.codeFrameColumns)(source, issue.location, {
3617
+ highlightCode: true,
3618
+ ...options || {}
3619
+ }).split('\n').map((line)=>' ' + line).join(external_node_os_default().EOL);
3620
+ const lines = [
3621
+ basicFormatter(issue)
3622
+ ];
3623
+ if (frame) lines.push(frame);
3624
+ return lines.join(external_node_os_default().EOL);
3625
+ };
3626
+ }
3627
+ function createFormatterConfig(options) {
3628
+ if ('function' == typeof options) return {
3629
+ format: options,
3630
+ pathType: 'relative'
3631
+ };
3632
+ const type = options ? 'object' == typeof options ? options.type || 'codeframe' : options : 'codeframe';
3633
+ const pathType = options && 'object' == typeof options ? options.pathType || 'relative' : 'relative';
3634
+ if (!type || 'basic' === type) return {
3635
+ format: createBasicFormatter(),
3636
+ pathType
3637
+ };
3638
+ if ('codeframe' === type) {
3639
+ const config = options && 'object' == typeof options ? options.options || {} : {};
895
3640
  return {
896
- log: info,
897
- error
3641
+ format: createCodeFrameFormatter(config),
3642
+ pathType
898
3643
  };
899
- })() : options.logger || console,
900
- devServer: false !== options.devServer
901
- };
902
- }
903
- function createPluginState() {
904
- return {
905
- issuesPromise: Promise.resolve(void 0),
906
- dependenciesPromise: Promise.resolve(void 0),
907
- abortController: void 0,
908
- aggregatedFilesChange: void 0,
909
- lastDependencies: void 0,
910
- watching: false,
911
- initialized: false,
912
- iteration: 0,
913
- DevServerDoneTap: void 0
914
- };
915
- }
916
- function assertTypeScriptSupport(config) {
917
- let typescriptVersion;
918
- try {
919
- typescriptVersion = require(config.typescriptPath).version;
920
- } catch {}
921
- if (!typescriptVersion) throw new Error("When you use TsCheckerRspackPlugin with typescript reporter enabled, you must install `typescript` package.");
922
- if (!external_node_fs_default().existsSync(config.configFile)) throw new Error([
923
- `Cannot find the "${config.configFile}" file.`,
924
- "Please check Rspack and TsCheckerRspackPlugin configuration.",
925
- "Possible errors:",
926
- ' - wrong `context` directory in Rspack configuration (if `configFile` is not set or is a relative path in the fork plugin configuration)',
927
- " - wrong `typescript.configFile` path in the plugin configuration (should be a relative or absolute path)"
928
- ].join(external_node_os_default().EOL));
929
- }
930
- function plugin_define_property(obj, key, value) {
931
- if (key in obj) Object.defineProperty(obj, key, {
932
- value: value,
933
- enumerable: true,
934
- configurable: true,
935
- writable: true
936
- });
937
- else obj[key] = value;
938
- return obj;
939
- }
940
- const pkgJson = JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(external_node_path_namespaceObject.join(__dirname, '../package.json'), 'utf-8'));
941
- class TsCheckerRspackPlugin {
942
- static getCompilerHooks(compiler) {
943
- return getPluginHooks(compiler);
944
- }
945
- apply(compiler) {
946
- const config = createPluginConfig(compiler, this.options);
947
- const state = createPluginState();
948
- assertTypeScriptSupport(config.typescript);
949
- const getIssuesWorker = createRpcWorker(external_node_path_namespaceObject.resolve(__dirname, './getIssuesWorker.js'), config.typescript, config.typescript.memoryLimit);
950
- const getDependenciesWorker = createRpcWorker(external_node_path_namespaceObject.resolve(__dirname, './getDependenciesWorker.js'), config.typescript);
951
- tapAfterEnvironmentToPatchWatching(compiler, state);
952
- tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker, config, state);
953
- tapAfterCompileToAddDependencies(compiler, config, state);
954
- tapStopToTerminateWorkers(compiler, getIssuesWorker, getDependenciesWorker, state);
955
- tapErrorToLogMessage(compiler, config);
956
- }
957
- constructor(options = {}){
958
- plugin_define_property(this, "options", void 0);
959
- this.options = options;
3644
+ }
3645
+ throw new Error(`Unknown "${type}" formatter. Available types are: "basic", "codeframe" or a custom function.`);
960
3646
  }
961
- }
962
- plugin_define_property(TsCheckerRspackPlugin, "version", pkgJson.version);
963
- plugin_define_property(TsCheckerRspackPlugin, "issuesPool", issuesPool);
964
- plugin_define_property(TsCheckerRspackPlugin, "dependenciesPool", dependenciesPool);
965
- plugin_define_property(TsCheckerRspackPlugin, "pool", issuesPool);
3647
+ function createIssuePredicateFromIssueMatch(context, match) {
3648
+ return (issue)=>{
3649
+ const matchesSeverity = !match.severity || match.severity === issue.severity;
3650
+ const matchesCode = !match.code || match.code === issue.code;
3651
+ const matchesFile = !issue.file || !!issue.file && (!match.file || minimatch(forwardSlash(external_node_path_default().relative(context, issue.file)), match.file));
3652
+ return matchesSeverity && matchesCode && matchesFile;
3653
+ };
3654
+ }
3655
+ function createTrivialIssuePredicate(result) {
3656
+ return ()=>result;
3657
+ }
3658
+ function composeIssuePredicates(predicates) {
3659
+ return (issue)=>predicates.some((predicate)=>predicate(issue));
3660
+ }
3661
+ function createIssuePredicateFromOption(context, option) {
3662
+ if (Array.isArray(option)) return composeIssuePredicates(option.map((option)=>'function' == typeof option ? option : createIssuePredicateFromIssueMatch(context, option)));
3663
+ return 'function' == typeof option ? option : createIssuePredicateFromIssueMatch(context, option);
3664
+ }
3665
+ function createIssueConfig(compiler, options) {
3666
+ const context = compiler.options.context || process.cwd();
3667
+ if (!options) options = {};
3668
+ const include = options.include ? createIssuePredicateFromOption(context, options.include) : createTrivialIssuePredicate(true);
3669
+ const exclude = options.exclude ? createIssuePredicateFromOption(context, options.exclude) : createTrivialIssuePredicate(false);
3670
+ const defaultSeverity = options.defaultSeverity ?? 'auto';
3671
+ return {
3672
+ predicate: (issue)=>include(issue) && !exclude(issue),
3673
+ defaultSeverity
3674
+ };
3675
+ }
3676
+ function createTypeScriptWorkerConfig(compiler, options) {
3677
+ let configFile = 'object' == typeof options ? options.configFile || 'tsconfig.json' : 'tsconfig.json';
3678
+ configFile = external_node_path_default().normalize(external_node_path_default().isAbsolute(configFile) ? configFile : external_node_path_default().resolve(compiler.options.context || process.cwd(), configFile));
3679
+ const optionsAsObject = 'object' == typeof options ? options : {};
3680
+ const typescriptPath = optionsAsObject.typescriptPath || require.resolve("typescript");
3681
+ return {
3682
+ enabled: Boolean(options) || void 0 === options,
3683
+ memoryLimit: 8192,
3684
+ build: false,
3685
+ mode: optionsAsObject.build ? 'write-tsbuildinfo' : 'readonly',
3686
+ profile: false,
3687
+ ...optionsAsObject,
3688
+ configFile: configFile,
3689
+ configOverwrite: optionsAsObject.configOverwrite || {},
3690
+ context: optionsAsObject.context || external_node_path_default().dirname(configFile),
3691
+ diagnosticOptions: {
3692
+ syntactic: false,
3693
+ semantic: true,
3694
+ declaration: false,
3695
+ global: false,
3696
+ ...optionsAsObject.diagnosticOptions || {}
3697
+ },
3698
+ typescriptPath: typescriptPath
3699
+ };
3700
+ }
3701
+ function createPluginConfig(compiler, options = {}) {
3702
+ return {
3703
+ async: void 0 === options.async ? 'development' === compiler.options.mode : options.async,
3704
+ typescript: createTypeScriptWorkerConfig(compiler, options.typescript),
3705
+ issue: createIssueConfig(compiler, options.issue),
3706
+ formatter: createFormatterConfig(options.formatter),
3707
+ logger: 'webpack-infrastructure' === options.logger ? (()=>{
3708
+ const { info, error } = getInfrastructureLogger(compiler);
3709
+ return {
3710
+ log: info,
3711
+ error
3712
+ };
3713
+ })() : options.logger || console,
3714
+ devServer: false !== options.devServer
3715
+ };
3716
+ }
3717
+ function createPluginState() {
3718
+ return {
3719
+ issuesPromise: Promise.resolve(void 0),
3720
+ dependenciesPromise: Promise.resolve(void 0),
3721
+ abortController: void 0,
3722
+ aggregatedFilesChange: void 0,
3723
+ lastDependencies: void 0,
3724
+ watching: false,
3725
+ initialized: false,
3726
+ iteration: 0,
3727
+ DevServerDoneTap: void 0
3728
+ };
3729
+ }
3730
+ function assertTypeScriptSupport(config) {
3731
+ let typescriptVersion;
3732
+ try {
3733
+ typescriptVersion = require(config.typescriptPath).version;
3734
+ } catch {}
3735
+ if (!typescriptVersion) throw new Error("When you use TsCheckerRspackPlugin with typescript reporter enabled, you must install `typescript` package.");
3736
+ if (!external_node_fs_default().existsSync(config.configFile)) throw new Error([
3737
+ `Cannot find the "${config.configFile}" file.`,
3738
+ "Please check Rspack and TsCheckerRspackPlugin configuration.",
3739
+ "Possible errors:",
3740
+ ' - wrong `context` directory in Rspack configuration (if `configFile` is not set or is a relative path in the fork plugin configuration)',
3741
+ " - wrong `typescript.configFile` path in the plugin configuration (should be a relative or absolute path)"
3742
+ ].join(external_node_os_default().EOL));
3743
+ }
3744
+ function plugin_define_property(obj, key, value) {
3745
+ if (key in obj) Object.defineProperty(obj, key, {
3746
+ value: value,
3747
+ enumerable: true,
3748
+ configurable: true,
3749
+ writable: true
3750
+ });
3751
+ else obj[key] = value;
3752
+ return obj;
3753
+ }
3754
+ const pkgJson = JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(external_node_path_namespaceObject.join(__dirname, '../package.json'), 'utf-8'));
3755
+ class TsCheckerRspackPlugin {
3756
+ static getCompilerHooks(compiler) {
3757
+ return getPluginHooks(compiler);
3758
+ }
3759
+ apply(compiler) {
3760
+ const config = createPluginConfig(compiler, this.options);
3761
+ const state = createPluginState();
3762
+ assertTypeScriptSupport(config.typescript);
3763
+ const getIssuesWorker = createRpcWorker(external_node_path_namespaceObject.resolve(__dirname, './getIssuesWorker.js'), config.typescript, config.typescript.memoryLimit);
3764
+ const getDependenciesWorker = createRpcWorker(external_node_path_namespaceObject.resolve(__dirname, './getDependenciesWorker.js'), config.typescript);
3765
+ tapAfterEnvironmentToPatchWatching(compiler, state);
3766
+ tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker, config, state);
3767
+ tapAfterCompileToAddDependencies(compiler, config, state);
3768
+ tapStopToTerminateWorkers(compiler, getIssuesWorker, getDependenciesWorker, state);
3769
+ tapErrorToLogMessage(compiler, config);
3770
+ }
3771
+ constructor(options = {}){
3772
+ plugin_define_property(this, "options", void 0);
3773
+ this.options = options;
3774
+ }
3775
+ }
3776
+ plugin_define_property(TsCheckerRspackPlugin, "version", pkgJson.version);
3777
+ plugin_define_property(TsCheckerRspackPlugin, "issuesPool", issuesPool);
3778
+ plugin_define_property(TsCheckerRspackPlugin, "dependenciesPool", dependenciesPool);
3779
+ plugin_define_property(TsCheckerRspackPlugin, "pool", issuesPool);
3780
+ })();
966
3781
  exports.TsCheckerRspackPlugin = __webpack_exports__.TsCheckerRspackPlugin;
967
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
3782
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
968
3783
  "TsCheckerRspackPlugin"
969
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
3784
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
970
3785
  Object.defineProperty(exports, '__esModule', {
971
3786
  value: true
972
3787
  });