@powerlines/plugin-rspack 0.5.261 → 0.5.263

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +31 -0
  2. package/dist/_virtual/rolldown_runtime.mjs +32 -0
  3. package/dist/helpers/index.cjs +2 -3
  4. package/dist/helpers/index.d.cts +1 -3
  5. package/dist/helpers/index.d.mts +1 -3
  6. package/dist/helpers/index.mjs +1 -2
  7. package/dist/helpers/unplugin.cjs +10 -2
  8. package/dist/helpers/unplugin.d.cts +8 -3
  9. package/dist/helpers/unplugin.d.cts.map +1 -0
  10. package/dist/helpers/unplugin.d.mts +8 -3
  11. package/dist/helpers/unplugin.d.mts.map +1 -0
  12. package/dist/helpers/unplugin.mjs +10 -2
  13. package/dist/helpers/unplugin.mjs.map +1 -0
  14. package/dist/index.cjs +6 -7
  15. package/dist/index.d.cts +4 -4
  16. package/dist/index.d.mts +4 -4
  17. package/dist/index.mjs +2 -4
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/node_modules/.pnpm/@jridgewell_gen-mapping@0.3.13/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.cjs +2 -0
  20. package/dist/node_modules/.pnpm/@jridgewell_gen-mapping@0.3.13/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs +4 -0
  21. package/dist/node_modules/.pnpm/@jridgewell_remapping@2.3.5/node_modules/@jridgewell/remapping/dist/remapping.cjs +2 -0
  22. package/dist/node_modules/.pnpm/@jridgewell_remapping@2.3.5/node_modules/@jridgewell/remapping/dist/remapping.mjs +4 -0
  23. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +15 -0
  24. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +16 -0
  25. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +1 -0
  26. package/dist/node_modules/.pnpm/@jridgewell_trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.cjs +1 -0
  27. package/dist/node_modules/.pnpm/@jridgewell_trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +3 -0
  28. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.cjs +28 -0
  29. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.mjs +24 -0
  30. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.mjs.map +1 -0
  31. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.cjs +175 -0
  32. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.mjs +171 -0
  33. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.mjs.map +1 -0
  34. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.cjs +871 -0
  35. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.mjs +867 -0
  36. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.mjs.map +1 -0
  37. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.cjs +307 -0
  38. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.mjs +303 -0
  39. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.mjs.map +1 -0
  40. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.cjs +300 -0
  41. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.mjs +296 -0
  42. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.mjs.map +1 -0
  43. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.cjs +60 -0
  44. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.mjs +56 -0
  45. package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.mjs.map +1 -0
  46. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/context-CehLHpzV.cjs +46 -0
  47. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/context-CehLHpzV.mjs +45 -0
  48. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/context-CehLHpzV.mjs.map +1 -0
  49. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/index.cjs +142 -0
  50. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/index.mjs +141 -0
  51. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/index.mjs.map +1 -0
  52. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/parse-CRORloGP.cjs +114 -0
  53. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/parse-CRORloGP.mjs +113 -0
  54. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/parse-CRORloGP.mjs.map +1 -0
  55. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/utils-CuyC8gTr.cjs +59 -0
  56. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/utils-CuyC8gTr.mjs +55 -0
  57. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/utils-CuyC8gTr.mjs.map +1 -0
  58. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/webpack-like-BU9ULG6P.cjs +35 -0
  59. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/webpack-like-BU9ULG6P.mjs +34 -0
  60. package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/webpack-like-BU9ULG6P.mjs.map +1 -0
  61. package/dist/node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/index.cjs +236 -0
  62. package/dist/node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/index.mjs +232 -0
  63. package/dist/node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/index.mjs.map +1 -0
  64. package/dist/node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/virtual-stats.cjs +54 -0
  65. package/dist/node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/virtual-stats.mjs +50 -0
  66. package/dist/node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/virtual-stats.mjs.map +1 -0
  67. package/dist/types/index.cjs +0 -2
  68. package/dist/types/index.d.cts +1 -2
  69. package/dist/types/index.d.mts +1 -2
  70. package/dist/types/index.mjs +0 -3
  71. package/dist/types/plugin.cjs +0 -1
  72. package/dist/types/plugin.d.cts +14 -2
  73. package/dist/types/plugin.d.cts.map +1 -0
  74. package/dist/types/plugin.d.mts +14 -2
  75. package/dist/types/plugin.d.mts.map +1 -0
  76. package/dist/types/plugin.mjs +0 -2
  77. package/package.json +8 -8
  78. package/dist/helpers-B15z10jN.mjs +0 -1
  79. package/dist/helpers-LF26RHol.cjs +0 -0
  80. package/dist/index-9iG2qHLe.d.mts +0 -1
  81. package/dist/index-D4ELpJXS.d.cts +0 -1
  82. package/dist/index-D6CnpA_r.d.cts +0 -1
  83. package/dist/index-DL0uimUT.d.mts +0 -1
  84. package/dist/plugin-Bba7oDr4.d.cts +0 -14
  85. package/dist/plugin-Bba7oDr4.d.cts.map +0 -1
  86. package/dist/plugin-ifZVa20V.mjs +0 -1
  87. package/dist/plugin-pBKbb5K9.cjs +0 -0
  88. package/dist/plugin-wK3Y5uKl.d.mts +0 -14
  89. package/dist/plugin-wK3Y5uKl.d.mts.map +0 -1
  90. package/dist/types-U3zd8PTP.mjs +0 -1
  91. package/dist/types-o3zWarRp.cjs +0 -0
  92. package/dist/unplugin-BNXnCNtR.mjs +0 -2349
  93. package/dist/unplugin-BNXnCNtR.mjs.map +0 -1
  94. package/dist/unplugin-BxYrF3Ze.d.cts +0 -8
  95. package/dist/unplugin-BxYrF3Ze.d.cts.map +0 -1
  96. package/dist/unplugin-C-ffDFJ6.cjs +0 -2359
  97. package/dist/unplugin-Cxu6PlCY.d.mts +0 -8
  98. package/dist/unplugin-Cxu6PlCY.d.mts.map +0 -1
@@ -1,2359 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
- value: mod,
25
- enumerable: true
26
- }) : target, mod));
27
-
28
- //#endregion
29
- let powerlines_lib_unplugin = require("powerlines/lib/unplugin");
30
- let node_path = require("node:path");
31
- node_path = __toESM(node_path);
32
- let node_buffer = require("node:buffer");
33
- let node_fs = require("node:fs");
34
- node_fs = __toESM(node_fs);
35
- require("node:process");
36
- require("node:querystring");
37
-
38
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
39
- var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40
- const WIN_SLASH = "\\\\/";
41
- const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
42
- /**
43
- * Posix glob regex
44
- */
45
- const DOT_LITERAL = "\\.";
46
- const PLUS_LITERAL = "\\+";
47
- const QMARK_LITERAL = "\\?";
48
- const SLASH_LITERAL = "\\/";
49
- const ONE_CHAR = "(?=.)";
50
- const QMARK = "[^/]";
51
- const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
52
- const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
53
- const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
54
- const POSIX_CHARS = {
55
- DOT_LITERAL,
56
- PLUS_LITERAL,
57
- QMARK_LITERAL,
58
- SLASH_LITERAL,
59
- ONE_CHAR,
60
- QMARK,
61
- END_ANCHOR,
62
- DOTS_SLASH,
63
- NO_DOT: `(?!${DOT_LITERAL})`,
64
- NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
65
- NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
66
- NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
67
- QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
68
- STAR: `${QMARK}*?`,
69
- START_ANCHOR,
70
- SEP: "/"
71
- };
72
- /**
73
- * Windows glob regex
74
- */
75
- const WINDOWS_CHARS = {
76
- ...POSIX_CHARS,
77
- SLASH_LITERAL: `[${WIN_SLASH}]`,
78
- QMARK: WIN_NO_SLASH,
79
- STAR: `${WIN_NO_SLASH}*?`,
80
- DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
81
- NO_DOT: `(?!${DOT_LITERAL})`,
82
- NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
83
- NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
84
- NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
85
- QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
86
- START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
87
- END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
88
- SEP: "\\"
89
- };
90
- /**
91
- * POSIX Bracket Regex
92
- */
93
- const POSIX_REGEX_SOURCE$1 = {
94
- alnum: "a-zA-Z0-9",
95
- alpha: "a-zA-Z",
96
- ascii: "\\x00-\\x7F",
97
- blank: " \\t",
98
- cntrl: "\\x00-\\x1F\\x7F",
99
- digit: "0-9",
100
- graph: "\\x21-\\x7E",
101
- lower: "a-z",
102
- print: "\\x20-\\x7E ",
103
- punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
104
- space: " \\t\\r\\n\\v\\f",
105
- upper: "A-Z",
106
- word: "A-Za-z0-9_",
107
- xdigit: "A-Fa-f0-9"
108
- };
109
- module.exports = {
110
- MAX_LENGTH: 1024 * 64,
111
- POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
112
- REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
113
- REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
114
- REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
115
- REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
116
- REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
117
- REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
118
- REPLACEMENTS: {
119
- __proto__: null,
120
- "***": "*",
121
- "**/**": "**",
122
- "**/**/**": "**"
123
- },
124
- CHAR_0: 48,
125
- CHAR_9: 57,
126
- CHAR_UPPERCASE_A: 65,
127
- CHAR_LOWERCASE_A: 97,
128
- CHAR_UPPERCASE_Z: 90,
129
- CHAR_LOWERCASE_Z: 122,
130
- CHAR_LEFT_PARENTHESES: 40,
131
- CHAR_RIGHT_PARENTHESES: 41,
132
- CHAR_ASTERISK: 42,
133
- CHAR_AMPERSAND: 38,
134
- CHAR_AT: 64,
135
- CHAR_BACKWARD_SLASH: 92,
136
- CHAR_CARRIAGE_RETURN: 13,
137
- CHAR_CIRCUMFLEX_ACCENT: 94,
138
- CHAR_COLON: 58,
139
- CHAR_COMMA: 44,
140
- CHAR_DOT: 46,
141
- CHAR_DOUBLE_QUOTE: 34,
142
- CHAR_EQUAL: 61,
143
- CHAR_EXCLAMATION_MARK: 33,
144
- CHAR_FORM_FEED: 12,
145
- CHAR_FORWARD_SLASH: 47,
146
- CHAR_GRAVE_ACCENT: 96,
147
- CHAR_HASH: 35,
148
- CHAR_HYPHEN_MINUS: 45,
149
- CHAR_LEFT_ANGLE_BRACKET: 60,
150
- CHAR_LEFT_CURLY_BRACE: 123,
151
- CHAR_LEFT_SQUARE_BRACKET: 91,
152
- CHAR_LINE_FEED: 10,
153
- CHAR_NO_BREAK_SPACE: 160,
154
- CHAR_PERCENT: 37,
155
- CHAR_PLUS: 43,
156
- CHAR_QUESTION_MARK: 63,
157
- CHAR_RIGHT_ANGLE_BRACKET: 62,
158
- CHAR_RIGHT_CURLY_BRACE: 125,
159
- CHAR_RIGHT_SQUARE_BRACKET: 93,
160
- CHAR_SEMICOLON: 59,
161
- CHAR_SINGLE_QUOTE: 39,
162
- CHAR_SPACE: 32,
163
- CHAR_TAB: 9,
164
- CHAR_UNDERSCORE: 95,
165
- CHAR_VERTICAL_LINE: 124,
166
- CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
167
- extglobChars(chars$1) {
168
- return {
169
- "!": {
170
- type: "negate",
171
- open: "(?:(?!(?:",
172
- close: `))${chars$1.STAR})`
173
- },
174
- "?": {
175
- type: "qmark",
176
- open: "(?:",
177
- close: ")?"
178
- },
179
- "+": {
180
- type: "plus",
181
- open: "(?:",
182
- close: ")+"
183
- },
184
- "*": {
185
- type: "star",
186
- open: "(?:",
187
- close: ")*"
188
- },
189
- "@": {
190
- type: "at",
191
- open: "(?:",
192
- close: ")"
193
- }
194
- };
195
- },
196
- globChars(win32) {
197
- return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
198
- }
199
- };
200
- }));
201
-
202
- //#endregion
203
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
204
- var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
205
- const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
206
- exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
207
- exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
208
- exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
209
- exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
210
- exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
211
- exports.isWindows = () => {
212
- if (typeof navigator !== "undefined" && navigator.platform) {
213
- const platform = navigator.platform.toLowerCase();
214
- return platform === "win32" || platform === "windows";
215
- }
216
- if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
217
- return false;
218
- };
219
- exports.removeBackslashes = (str) => {
220
- return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
221
- return match === "\\" ? "" : match;
222
- });
223
- };
224
- exports.escapeLast = (input, char, lastIdx) => {
225
- const idx = input.lastIndexOf(char, lastIdx);
226
- if (idx === -1) return input;
227
- if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
228
- return `${input.slice(0, idx)}\\${input.slice(idx)}`;
229
- };
230
- exports.removePrefix = (input, state = {}) => {
231
- let output = input;
232
- if (output.startsWith("./")) {
233
- output = output.slice(2);
234
- state.prefix = "./";
235
- }
236
- return output;
237
- };
238
- exports.wrapOutput = (input, state = {}, options = {}) => {
239
- let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
240
- if (state.negated === true) output = `(?:^(?!${output}).*$)`;
241
- return output;
242
- };
243
- exports.basename = (path$1, { windows } = {}) => {
244
- const segs = path$1.split(windows ? /[\\/]/ : "/");
245
- const last = segs[segs.length - 1];
246
- if (last === "") return segs[segs.length - 2];
247
- return last;
248
- };
249
- }));
250
-
251
- //#endregion
252
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
253
- var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
254
- const utils$3 = require_utils();
255
- const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
256
- const isPathSeparator = (code) => {
257
- return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
258
- };
259
- const depth = (token) => {
260
- if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
261
- };
262
- /**
263
- * Quickly scans a glob pattern and returns an object with a handful of
264
- * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
265
- * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
266
- * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
267
- *
268
- * ```js
269
- * const pm = require('picomatch');
270
- * console.log(pm.scan('foo/bar/*.js'));
271
- * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
272
- * ```
273
- * @param {String} `str`
274
- * @param {Object} `options`
275
- * @return {Object} Returns an object with tokens and regex source string.
276
- * @api public
277
- */
278
- const scan$1 = (input, options) => {
279
- const opts = options || {};
280
- const length = input.length - 1;
281
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
282
- const slashes = [];
283
- const tokens = [];
284
- const parts = [];
285
- let str = input;
286
- let index = -1;
287
- let start = 0;
288
- let lastIndex = 0;
289
- let isBrace = false;
290
- let isBracket = false;
291
- let isGlob = false;
292
- let isExtglob = false;
293
- let isGlobstar = false;
294
- let braceEscaped = false;
295
- let backslashes = false;
296
- let negated = false;
297
- let negatedExtglob = false;
298
- let finished = false;
299
- let braces = 0;
300
- let prev;
301
- let code;
302
- let token = {
303
- value: "",
304
- depth: 0,
305
- isGlob: false
306
- };
307
- const eos = () => index >= length;
308
- const peek = () => str.charCodeAt(index + 1);
309
- const advance = () => {
310
- prev = code;
311
- return str.charCodeAt(++index);
312
- };
313
- while (index < length) {
314
- code = advance();
315
- let next;
316
- if (code === CHAR_BACKWARD_SLASH) {
317
- backslashes = token.backslashes = true;
318
- code = advance();
319
- if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
320
- continue;
321
- }
322
- if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
323
- braces++;
324
- while (eos() !== true && (code = advance())) {
325
- if (code === CHAR_BACKWARD_SLASH) {
326
- backslashes = token.backslashes = true;
327
- advance();
328
- continue;
329
- }
330
- if (code === CHAR_LEFT_CURLY_BRACE) {
331
- braces++;
332
- continue;
333
- }
334
- if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
335
- isBrace = token.isBrace = true;
336
- isGlob = token.isGlob = true;
337
- finished = true;
338
- if (scanToEnd === true) continue;
339
- break;
340
- }
341
- if (braceEscaped !== true && code === CHAR_COMMA) {
342
- isBrace = token.isBrace = true;
343
- isGlob = token.isGlob = true;
344
- finished = true;
345
- if (scanToEnd === true) continue;
346
- break;
347
- }
348
- if (code === CHAR_RIGHT_CURLY_BRACE) {
349
- braces--;
350
- if (braces === 0) {
351
- braceEscaped = false;
352
- isBrace = token.isBrace = true;
353
- finished = true;
354
- break;
355
- }
356
- }
357
- }
358
- if (scanToEnd === true) continue;
359
- break;
360
- }
361
- if (code === CHAR_FORWARD_SLASH) {
362
- slashes.push(index);
363
- tokens.push(token);
364
- token = {
365
- value: "",
366
- depth: 0,
367
- isGlob: false
368
- };
369
- if (finished === true) continue;
370
- if (prev === CHAR_DOT && index === start + 1) {
371
- start += 2;
372
- continue;
373
- }
374
- lastIndex = index + 1;
375
- continue;
376
- }
377
- if (opts.noext !== true) {
378
- if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
379
- isGlob = token.isGlob = true;
380
- isExtglob = token.isExtglob = true;
381
- finished = true;
382
- if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
383
- if (scanToEnd === true) {
384
- while (eos() !== true && (code = advance())) {
385
- if (code === CHAR_BACKWARD_SLASH) {
386
- backslashes = token.backslashes = true;
387
- code = advance();
388
- continue;
389
- }
390
- if (code === CHAR_RIGHT_PARENTHESES) {
391
- isGlob = token.isGlob = true;
392
- finished = true;
393
- break;
394
- }
395
- }
396
- continue;
397
- }
398
- break;
399
- }
400
- }
401
- if (code === CHAR_ASTERISK) {
402
- if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
403
- isGlob = token.isGlob = true;
404
- finished = true;
405
- if (scanToEnd === true) continue;
406
- break;
407
- }
408
- if (code === CHAR_QUESTION_MARK) {
409
- isGlob = token.isGlob = true;
410
- finished = true;
411
- if (scanToEnd === true) continue;
412
- break;
413
- }
414
- if (code === CHAR_LEFT_SQUARE_BRACKET) {
415
- while (eos() !== true && (next = advance())) {
416
- if (next === CHAR_BACKWARD_SLASH) {
417
- backslashes = token.backslashes = true;
418
- advance();
419
- continue;
420
- }
421
- if (next === CHAR_RIGHT_SQUARE_BRACKET) {
422
- isBracket = token.isBracket = true;
423
- isGlob = token.isGlob = true;
424
- finished = true;
425
- break;
426
- }
427
- }
428
- if (scanToEnd === true) continue;
429
- break;
430
- }
431
- if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
432
- negated = token.negated = true;
433
- start++;
434
- continue;
435
- }
436
- if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
437
- isGlob = token.isGlob = true;
438
- if (scanToEnd === true) {
439
- while (eos() !== true && (code = advance())) {
440
- if (code === CHAR_LEFT_PARENTHESES) {
441
- backslashes = token.backslashes = true;
442
- code = advance();
443
- continue;
444
- }
445
- if (code === CHAR_RIGHT_PARENTHESES) {
446
- finished = true;
447
- break;
448
- }
449
- }
450
- continue;
451
- }
452
- break;
453
- }
454
- if (isGlob === true) {
455
- finished = true;
456
- if (scanToEnd === true) continue;
457
- break;
458
- }
459
- }
460
- if (opts.noext === true) {
461
- isExtglob = false;
462
- isGlob = false;
463
- }
464
- let base = str;
465
- let prefix = "";
466
- let glob = "";
467
- if (start > 0) {
468
- prefix = str.slice(0, start);
469
- str = str.slice(start);
470
- lastIndex -= start;
471
- }
472
- if (base && isGlob === true && lastIndex > 0) {
473
- base = str.slice(0, lastIndex);
474
- glob = str.slice(lastIndex);
475
- } else if (isGlob === true) {
476
- base = "";
477
- glob = str;
478
- } else base = str;
479
- if (base && base !== "" && base !== "/" && base !== str) {
480
- if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
481
- }
482
- if (opts.unescape === true) {
483
- if (glob) glob = utils$3.removeBackslashes(glob);
484
- if (base && backslashes === true) base = utils$3.removeBackslashes(base);
485
- }
486
- const state = {
487
- prefix,
488
- input,
489
- start,
490
- base,
491
- glob,
492
- isBrace,
493
- isBracket,
494
- isGlob,
495
- isExtglob,
496
- isGlobstar,
497
- negated,
498
- negatedExtglob
499
- };
500
- if (opts.tokens === true) {
501
- state.maxDepth = 0;
502
- if (!isPathSeparator(code)) tokens.push(token);
503
- state.tokens = tokens;
504
- }
505
- if (opts.parts === true || opts.tokens === true) {
506
- let prevIndex;
507
- for (let idx = 0; idx < slashes.length; idx++) {
508
- const n = prevIndex ? prevIndex + 1 : start;
509
- const i = slashes[idx];
510
- const value = input.slice(n, i);
511
- if (opts.tokens) {
512
- if (idx === 0 && start !== 0) {
513
- tokens[idx].isPrefix = true;
514
- tokens[idx].value = prefix;
515
- } else tokens[idx].value = value;
516
- depth(tokens[idx]);
517
- state.maxDepth += tokens[idx].depth;
518
- }
519
- if (idx !== 0 || value !== "") parts.push(value);
520
- prevIndex = i;
521
- }
522
- if (prevIndex && prevIndex + 1 < input.length) {
523
- const value = input.slice(prevIndex + 1);
524
- parts.push(value);
525
- if (opts.tokens) {
526
- tokens[tokens.length - 1].value = value;
527
- depth(tokens[tokens.length - 1]);
528
- state.maxDepth += tokens[tokens.length - 1].depth;
529
- }
530
- }
531
- state.slashes = slashes;
532
- state.parts = parts;
533
- }
534
- return state;
535
- };
536
- module.exports = scan$1;
537
- }));
538
-
539
- //#endregion
540
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
541
- var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
542
- const constants$1 = require_constants();
543
- const utils$2 = require_utils();
544
- /**
545
- * Constants
546
- */
547
- const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1;
548
- /**
549
- * Helpers
550
- */
551
- const expandRange = (args, options) => {
552
- if (typeof options.expandRange === "function") return options.expandRange(...args, options);
553
- args.sort();
554
- const value = `[${args.join("-")}]`;
555
- try {
556
- new RegExp(value);
557
- } catch (ex) {
558
- return args.map((v) => utils$2.escapeRegex(v)).join("..");
559
- }
560
- return value;
561
- };
562
- /**
563
- * Create the message for a syntax error
564
- */
565
- const syntaxError = (type, char) => {
566
- return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
567
- };
568
- /**
569
- * Parse the given input string.
570
- * @param {String} input
571
- * @param {Object} options
572
- * @return {Object}
573
- */
574
- const parse$2 = (input, options) => {
575
- if (typeof input !== "string") throw new TypeError("Expected a string");
576
- input = REPLACEMENTS[input] || input;
577
- const opts = { ...options };
578
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
579
- let len = input.length;
580
- if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
581
- const bos = {
582
- type: "bos",
583
- value: "",
584
- output: opts.prepend || ""
585
- };
586
- const tokens = [bos];
587
- const capture = opts.capture ? "" : "?:";
588
- const PLATFORM_CHARS = constants$1.globChars(opts.windows);
589
- const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
590
- const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK: QMARK$1, QMARK_NO_DOT, STAR, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
591
- const globstar = (opts$1) => {
592
- return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
593
- };
594
- const nodot = opts.dot ? "" : NO_DOT;
595
- const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT;
596
- let star = opts.bash === true ? globstar(opts) : STAR;
597
- if (opts.capture) star = `(${star})`;
598
- if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
599
- const state = {
600
- input,
601
- index: -1,
602
- start: 0,
603
- dot: opts.dot === true,
604
- consumed: "",
605
- output: "",
606
- prefix: "",
607
- backtrack: false,
608
- negated: false,
609
- brackets: 0,
610
- braces: 0,
611
- parens: 0,
612
- quotes: 0,
613
- globstar: false,
614
- tokens
615
- };
616
- input = utils$2.removePrefix(input, state);
617
- len = input.length;
618
- const extglobs = [];
619
- const braces = [];
620
- const stack = [];
621
- let prev = bos;
622
- let value;
623
- /**
624
- * Tokenizing helpers
625
- */
626
- const eos = () => state.index === len - 1;
627
- const peek = state.peek = (n = 1) => input[state.index + n];
628
- const advance = state.advance = () => input[++state.index] || "";
629
- const remaining = () => input.slice(state.index + 1);
630
- const consume = (value$1 = "", num = 0) => {
631
- state.consumed += value$1;
632
- state.index += num;
633
- };
634
- const append = (token) => {
635
- state.output += token.output != null ? token.output : token.value;
636
- consume(token.value);
637
- };
638
- const negate = () => {
639
- let count = 1;
640
- while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
641
- advance();
642
- state.start++;
643
- count++;
644
- }
645
- if (count % 2 === 0) return false;
646
- state.negated = true;
647
- state.start++;
648
- return true;
649
- };
650
- const increment = (type) => {
651
- state[type]++;
652
- stack.push(type);
653
- };
654
- const decrement = (type) => {
655
- state[type]--;
656
- stack.pop();
657
- };
658
- /**
659
- * Push tokens onto the tokens array. This helper speeds up
660
- * tokenizing by 1) helping us avoid backtracking as much as possible,
661
- * and 2) helping us avoid creating extra tokens when consecutive
662
- * characters are plain text. This improves performance and simplifies
663
- * lookbehinds.
664
- */
665
- const push = (tok) => {
666
- if (prev.type === "globstar") {
667
- const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
668
- const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
669
- if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
670
- state.output = state.output.slice(0, -prev.output.length);
671
- prev.type = "star";
672
- prev.value = "*";
673
- prev.output = star;
674
- state.output += prev.output;
675
- }
676
- }
677
- if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
678
- if (tok.value || tok.output) append(tok);
679
- if (prev && prev.type === "text" && tok.type === "text") {
680
- prev.output = (prev.output || prev.value) + tok.value;
681
- prev.value += tok.value;
682
- return;
683
- }
684
- tok.prev = prev;
685
- tokens.push(tok);
686
- prev = tok;
687
- };
688
- const extglobOpen = (type, value$1) => {
689
- const token = {
690
- ...EXTGLOB_CHARS[value$1],
691
- conditions: 1,
692
- inner: ""
693
- };
694
- token.prev = prev;
695
- token.parens = state.parens;
696
- token.output = state.output;
697
- const output = (opts.capture ? "(" : "") + token.open;
698
- increment("parens");
699
- push({
700
- type,
701
- value: value$1,
702
- output: state.output ? "" : ONE_CHAR$1
703
- });
704
- push({
705
- type: "paren",
706
- extglob: true,
707
- value: advance(),
708
- output
709
- });
710
- extglobs.push(token);
711
- };
712
- const extglobClose = (token) => {
713
- let output = token.close + (opts.capture ? ")" : "");
714
- let rest;
715
- if (token.type === "negate") {
716
- let extglobStar = star;
717
- if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
718
- if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
719
- if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse$2(rest, {
720
- ...options,
721
- fastpaths: false
722
- }).output})${extglobStar})`;
723
- if (token.prev.type === "bos") state.negatedExtglob = true;
724
- }
725
- push({
726
- type: "paren",
727
- extglob: true,
728
- value,
729
- output
730
- });
731
- decrement("parens");
732
- };
733
- /**
734
- * Fast paths
735
- */
736
- if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
737
- let backslashes = false;
738
- let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars$1, first, rest, index) => {
739
- if (first === "\\") {
740
- backslashes = true;
741
- return m;
742
- }
743
- if (first === "?") {
744
- if (esc) return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
745
- if (index === 0) return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
746
- return QMARK$1.repeat(chars$1.length);
747
- }
748
- if (first === ".") return DOT_LITERAL$1.repeat(chars$1.length);
749
- if (first === "*") {
750
- if (esc) return esc + first + (rest ? star : "");
751
- return star;
752
- }
753
- return esc ? m : `\\${m}`;
754
- });
755
- if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
756
- else output = output.replace(/\\+/g, (m) => {
757
- return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
758
- });
759
- if (output === input && opts.contains === true) {
760
- state.output = input;
761
- return state;
762
- }
763
- state.output = utils$2.wrapOutput(output, state, options);
764
- return state;
765
- }
766
- /**
767
- * Tokenize input until we reach end-of-string
768
- */
769
- while (!eos()) {
770
- value = advance();
771
- if (value === "\0") continue;
772
- /**
773
- * Escaped characters
774
- */
775
- if (value === "\\") {
776
- const next = peek();
777
- if (next === "/" && opts.bash !== true) continue;
778
- if (next === "." || next === ";") continue;
779
- if (!next) {
780
- value += "\\";
781
- push({
782
- type: "text",
783
- value
784
- });
785
- continue;
786
- }
787
- const match = /^\\+/.exec(remaining());
788
- let slashes = 0;
789
- if (match && match[0].length > 2) {
790
- slashes = match[0].length;
791
- state.index += slashes;
792
- if (slashes % 2 !== 0) value += "\\";
793
- }
794
- if (opts.unescape === true) value = advance();
795
- else value += advance();
796
- if (state.brackets === 0) {
797
- push({
798
- type: "text",
799
- value
800
- });
801
- continue;
802
- }
803
- }
804
- /**
805
- * If we're inside a regex character class, continue
806
- * until we reach the closing bracket.
807
- */
808
- if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
809
- if (opts.posix !== false && value === ":") {
810
- const inner = prev.value.slice(1);
811
- if (inner.includes("[")) {
812
- prev.posix = true;
813
- if (inner.includes(":")) {
814
- const idx = prev.value.lastIndexOf("[");
815
- const pre = prev.value.slice(0, idx);
816
- const posix = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
817
- if (posix) {
818
- prev.value = pre + posix;
819
- state.backtrack = true;
820
- advance();
821
- if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR$1;
822
- continue;
823
- }
824
- }
825
- }
826
- }
827
- if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
828
- if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
829
- if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
830
- prev.value += value;
831
- append({ value });
832
- continue;
833
- }
834
- /**
835
- * If we're inside a quoted string, continue
836
- * until we reach the closing double quote.
837
- */
838
- if (state.quotes === 1 && value !== "\"") {
839
- value = utils$2.escapeRegex(value);
840
- prev.value += value;
841
- append({ value });
842
- continue;
843
- }
844
- /**
845
- * Double quotes
846
- */
847
- if (value === "\"") {
848
- state.quotes = state.quotes === 1 ? 0 : 1;
849
- if (opts.keepQuotes === true) push({
850
- type: "text",
851
- value
852
- });
853
- continue;
854
- }
855
- /**
856
- * Parentheses
857
- */
858
- if (value === "(") {
859
- increment("parens");
860
- push({
861
- type: "paren",
862
- value
863
- });
864
- continue;
865
- }
866
- if (value === ")") {
867
- if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
868
- const extglob = extglobs[extglobs.length - 1];
869
- if (extglob && state.parens === extglob.parens + 1) {
870
- extglobClose(extglobs.pop());
871
- continue;
872
- }
873
- push({
874
- type: "paren",
875
- value,
876
- output: state.parens ? ")" : "\\)"
877
- });
878
- decrement("parens");
879
- continue;
880
- }
881
- /**
882
- * Square brackets
883
- */
884
- if (value === "[") {
885
- if (opts.nobracket === true || !remaining().includes("]")) {
886
- if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
887
- value = `\\${value}`;
888
- } else increment("brackets");
889
- push({
890
- type: "bracket",
891
- value
892
- });
893
- continue;
894
- }
895
- if (value === "]") {
896
- if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
897
- push({
898
- type: "text",
899
- value,
900
- output: `\\${value}`
901
- });
902
- continue;
903
- }
904
- if (state.brackets === 0) {
905
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
906
- push({
907
- type: "text",
908
- value,
909
- output: `\\${value}`
910
- });
911
- continue;
912
- }
913
- decrement("brackets");
914
- const prevValue = prev.value.slice(1);
915
- if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
916
- prev.value += value;
917
- append({ value });
918
- if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) continue;
919
- const escaped = utils$2.escapeRegex(prev.value);
920
- state.output = state.output.slice(0, -prev.value.length);
921
- if (opts.literalBrackets === true) {
922
- state.output += escaped;
923
- prev.value = escaped;
924
- continue;
925
- }
926
- prev.value = `(${capture}${escaped}|${prev.value})`;
927
- state.output += prev.value;
928
- continue;
929
- }
930
- /**
931
- * Braces
932
- */
933
- if (value === "{" && opts.nobrace !== true) {
934
- increment("braces");
935
- const open = {
936
- type: "brace",
937
- value,
938
- output: "(",
939
- outputIndex: state.output.length,
940
- tokensIndex: state.tokens.length
941
- };
942
- braces.push(open);
943
- push(open);
944
- continue;
945
- }
946
- if (value === "}") {
947
- const brace = braces[braces.length - 1];
948
- if (opts.nobrace === true || !brace) {
949
- push({
950
- type: "text",
951
- value,
952
- output: value
953
- });
954
- continue;
955
- }
956
- let output = ")";
957
- if (brace.dots === true) {
958
- const arr = tokens.slice();
959
- const range = [];
960
- for (let i = arr.length - 1; i >= 0; i--) {
961
- tokens.pop();
962
- if (arr[i].type === "brace") break;
963
- if (arr[i].type !== "dots") range.unshift(arr[i].value);
964
- }
965
- output = expandRange(range, opts);
966
- state.backtrack = true;
967
- }
968
- if (brace.comma !== true && brace.dots !== true) {
969
- const out = state.output.slice(0, brace.outputIndex);
970
- const toks = state.tokens.slice(brace.tokensIndex);
971
- brace.value = brace.output = "\\{";
972
- value = output = "\\}";
973
- state.output = out;
974
- for (const t of toks) state.output += t.output || t.value;
975
- }
976
- push({
977
- type: "brace",
978
- value,
979
- output
980
- });
981
- decrement("braces");
982
- braces.pop();
983
- continue;
984
- }
985
- /**
986
- * Pipes
987
- */
988
- if (value === "|") {
989
- if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
990
- push({
991
- type: "text",
992
- value
993
- });
994
- continue;
995
- }
996
- /**
997
- * Commas
998
- */
999
- if (value === ",") {
1000
- let output = value;
1001
- const brace = braces[braces.length - 1];
1002
- if (brace && stack[stack.length - 1] === "braces") {
1003
- brace.comma = true;
1004
- output = "|";
1005
- }
1006
- push({
1007
- type: "comma",
1008
- value,
1009
- output
1010
- });
1011
- continue;
1012
- }
1013
- /**
1014
- * Slashes
1015
- */
1016
- if (value === "/") {
1017
- if (prev.type === "dot" && state.index === state.start + 1) {
1018
- state.start = state.index + 1;
1019
- state.consumed = "";
1020
- state.output = "";
1021
- tokens.pop();
1022
- prev = bos;
1023
- continue;
1024
- }
1025
- push({
1026
- type: "slash",
1027
- value,
1028
- output: SLASH_LITERAL$1
1029
- });
1030
- continue;
1031
- }
1032
- /**
1033
- * Dots
1034
- */
1035
- if (value === ".") {
1036
- if (state.braces > 0 && prev.type === "dot") {
1037
- if (prev.value === ".") prev.output = DOT_LITERAL$1;
1038
- const brace = braces[braces.length - 1];
1039
- prev.type = "dots";
1040
- prev.output += value;
1041
- prev.value += value;
1042
- brace.dots = true;
1043
- continue;
1044
- }
1045
- if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1046
- push({
1047
- type: "text",
1048
- value,
1049
- output: DOT_LITERAL$1
1050
- });
1051
- continue;
1052
- }
1053
- push({
1054
- type: "dot",
1055
- value,
1056
- output: DOT_LITERAL$1
1057
- });
1058
- continue;
1059
- }
1060
- /**
1061
- * Question marks
1062
- */
1063
- if (value === "?") {
1064
- if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1065
- extglobOpen("qmark", value);
1066
- continue;
1067
- }
1068
- if (prev && prev.type === "paren") {
1069
- const next = peek();
1070
- let output = value;
1071
- if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
1072
- push({
1073
- type: "text",
1074
- value,
1075
- output
1076
- });
1077
- continue;
1078
- }
1079
- if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1080
- push({
1081
- type: "qmark",
1082
- value,
1083
- output: QMARK_NO_DOT
1084
- });
1085
- continue;
1086
- }
1087
- push({
1088
- type: "qmark",
1089
- value,
1090
- output: QMARK$1
1091
- });
1092
- continue;
1093
- }
1094
- /**
1095
- * Exclamation
1096
- */
1097
- if (value === "!") {
1098
- if (opts.noextglob !== true && peek() === "(") {
1099
- if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
1100
- extglobOpen("negate", value);
1101
- continue;
1102
- }
1103
- }
1104
- if (opts.nonegate !== true && state.index === 0) {
1105
- negate();
1106
- continue;
1107
- }
1108
- }
1109
- /**
1110
- * Plus
1111
- */
1112
- if (value === "+") {
1113
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1114
- extglobOpen("plus", value);
1115
- continue;
1116
- }
1117
- if (prev && prev.value === "(" || opts.regex === false) {
1118
- push({
1119
- type: "plus",
1120
- value,
1121
- output: PLUS_LITERAL$1
1122
- });
1123
- continue;
1124
- }
1125
- if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
1126
- push({
1127
- type: "plus",
1128
- value
1129
- });
1130
- continue;
1131
- }
1132
- push({
1133
- type: "plus",
1134
- value: PLUS_LITERAL$1
1135
- });
1136
- continue;
1137
- }
1138
- /**
1139
- * Plain text
1140
- */
1141
- if (value === "@") {
1142
- if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1143
- push({
1144
- type: "at",
1145
- extglob: true,
1146
- value,
1147
- output: ""
1148
- });
1149
- continue;
1150
- }
1151
- push({
1152
- type: "text",
1153
- value
1154
- });
1155
- continue;
1156
- }
1157
- /**
1158
- * Plain text
1159
- */
1160
- if (value !== "*") {
1161
- if (value === "$" || value === "^") value = `\\${value}`;
1162
- const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1163
- if (match) {
1164
- value += match[0];
1165
- state.index += match[0].length;
1166
- }
1167
- push({
1168
- type: "text",
1169
- value
1170
- });
1171
- continue;
1172
- }
1173
- /**
1174
- * Stars
1175
- */
1176
- if (prev && (prev.type === "globstar" || prev.star === true)) {
1177
- prev.type = "star";
1178
- prev.star = true;
1179
- prev.value += value;
1180
- prev.output = star;
1181
- state.backtrack = true;
1182
- state.globstar = true;
1183
- consume(value);
1184
- continue;
1185
- }
1186
- let rest = remaining();
1187
- if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1188
- extglobOpen("star", value);
1189
- continue;
1190
- }
1191
- if (prev.type === "star") {
1192
- if (opts.noglobstar === true) {
1193
- consume(value);
1194
- continue;
1195
- }
1196
- const prior = prev.prev;
1197
- const before = prior.prev;
1198
- const isStart = prior.type === "slash" || prior.type === "bos";
1199
- const afterStar = before && (before.type === "star" || before.type === "globstar");
1200
- if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
1201
- push({
1202
- type: "star",
1203
- value,
1204
- output: ""
1205
- });
1206
- continue;
1207
- }
1208
- const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
1209
- const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1210
- if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
1211
- push({
1212
- type: "star",
1213
- value,
1214
- output: ""
1215
- });
1216
- continue;
1217
- }
1218
- while (rest.slice(0, 3) === "/**") {
1219
- const after = input[state.index + 4];
1220
- if (after && after !== "/") break;
1221
- rest = rest.slice(3);
1222
- consume("/**", 3);
1223
- }
1224
- if (prior.type === "bos" && eos()) {
1225
- prev.type = "globstar";
1226
- prev.value += value;
1227
- prev.output = globstar(opts);
1228
- state.output = prev.output;
1229
- state.globstar = true;
1230
- consume(value);
1231
- continue;
1232
- }
1233
- if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
1234
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
1235
- prior.output = `(?:${prior.output}`;
1236
- prev.type = "globstar";
1237
- prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
1238
- prev.value += value;
1239
- state.globstar = true;
1240
- state.output += prior.output + prev.output;
1241
- consume(value);
1242
- continue;
1243
- }
1244
- if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
1245
- const end = rest[1] !== void 0 ? "|$" : "";
1246
- state.output = state.output.slice(0, -(prior.output + prev.output).length);
1247
- prior.output = `(?:${prior.output}`;
1248
- prev.type = "globstar";
1249
- prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`;
1250
- prev.value += value;
1251
- state.output += prior.output + prev.output;
1252
- state.globstar = true;
1253
- consume(value + advance());
1254
- push({
1255
- type: "slash",
1256
- value: "/",
1257
- output: ""
1258
- });
1259
- continue;
1260
- }
1261
- if (prior.type === "bos" && rest[0] === "/") {
1262
- prev.type = "globstar";
1263
- prev.value += value;
1264
- prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
1265
- state.output = prev.output;
1266
- state.globstar = true;
1267
- consume(value + advance());
1268
- push({
1269
- type: "slash",
1270
- value: "/",
1271
- output: ""
1272
- });
1273
- continue;
1274
- }
1275
- state.output = state.output.slice(0, -prev.output.length);
1276
- prev.type = "globstar";
1277
- prev.output = globstar(opts);
1278
- prev.value += value;
1279
- state.output += prev.output;
1280
- state.globstar = true;
1281
- consume(value);
1282
- continue;
1283
- }
1284
- const token = {
1285
- type: "star",
1286
- value,
1287
- output: star
1288
- };
1289
- if (opts.bash === true) {
1290
- token.output = ".*?";
1291
- if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
1292
- push(token);
1293
- continue;
1294
- }
1295
- if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
1296
- token.output = value;
1297
- push(token);
1298
- continue;
1299
- }
1300
- if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
1301
- if (prev.type === "dot") {
1302
- state.output += NO_DOT_SLASH;
1303
- prev.output += NO_DOT_SLASH;
1304
- } else if (opts.dot === true) {
1305
- state.output += NO_DOTS_SLASH;
1306
- prev.output += NO_DOTS_SLASH;
1307
- } else {
1308
- state.output += nodot;
1309
- prev.output += nodot;
1310
- }
1311
- if (peek() !== "*") {
1312
- state.output += ONE_CHAR$1;
1313
- prev.output += ONE_CHAR$1;
1314
- }
1315
- }
1316
- push(token);
1317
- }
1318
- while (state.brackets > 0) {
1319
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1320
- state.output = utils$2.escapeLast(state.output, "[");
1321
- decrement("brackets");
1322
- }
1323
- while (state.parens > 0) {
1324
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
1325
- state.output = utils$2.escapeLast(state.output, "(");
1326
- decrement("parens");
1327
- }
1328
- while (state.braces > 0) {
1329
- if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
1330
- state.output = utils$2.escapeLast(state.output, "{");
1331
- decrement("braces");
1332
- }
1333
- if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
1334
- type: "maybe_slash",
1335
- value: "",
1336
- output: `${SLASH_LITERAL$1}?`
1337
- });
1338
- if (state.backtrack === true) {
1339
- state.output = "";
1340
- for (const token of state.tokens) {
1341
- state.output += token.output != null ? token.output : token.value;
1342
- if (token.suffix) state.output += token.suffix;
1343
- }
1344
- }
1345
- return state;
1346
- };
1347
- /**
1348
- * Fast paths for creating regular expressions for common glob patterns.
1349
- * This can significantly speed up processing and has very little downside
1350
- * impact when none of the fast paths match.
1351
- */
1352
- parse$2.fastpaths = (input, options) => {
1353
- const opts = { ...options };
1354
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1355
- const len = input.length;
1356
- if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1357
- input = REPLACEMENTS[input] || input;
1358
- const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
1359
- const nodot = opts.dot ? NO_DOTS : NO_DOT;
1360
- const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1361
- const capture = opts.capture ? "" : "?:";
1362
- const state = {
1363
- negated: false,
1364
- prefix: ""
1365
- };
1366
- let star = opts.bash === true ? ".*?" : STAR;
1367
- if (opts.capture) star = `(${star})`;
1368
- const globstar = (opts$1) => {
1369
- if (opts$1.noglobstar === true) return star;
1370
- return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
1371
- };
1372
- const create = (str) => {
1373
- switch (str) {
1374
- case "*": return `${nodot}${ONE_CHAR$1}${star}`;
1375
- case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
1376
- case "*.*": return `${nodot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
1377
- case "*/*": return `${nodot}${star}${SLASH_LITERAL$1}${ONE_CHAR$1}${slashDot}${star}`;
1378
- case "**": return nodot + globstar(opts);
1379
- case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${ONE_CHAR$1}${star}`;
1380
- case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
1381
- case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
1382
- default: {
1383
- const match = /^(.*?)\.(\w+)$/.exec(str);
1384
- if (!match) return;
1385
- const source$1 = create(match[1]);
1386
- if (!source$1) return;
1387
- return source$1 + DOT_LITERAL$1 + match[2];
1388
- }
1389
- }
1390
- };
1391
- let source = create(utils$2.removePrefix(input, state));
1392
- if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
1393
- return source;
1394
- };
1395
- module.exports = parse$2;
1396
- }));
1397
-
1398
- //#endregion
1399
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
1400
- var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1401
- const scan = require_scan();
1402
- const parse$1 = require_parse();
1403
- const utils$1 = require_utils();
1404
- const constants = require_constants();
1405
- const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
1406
- /**
1407
- * Creates a matcher function from one or more glob patterns. The
1408
- * returned function takes a string to match as its first argument,
1409
- * and returns true if the string is a match. The returned matcher
1410
- * function also takes a boolean as the second argument that, when true,
1411
- * returns an object with additional information.
1412
- *
1413
- * ```js
1414
- * const picomatch = require('picomatch');
1415
- * // picomatch(glob[, options]);
1416
- *
1417
- * const isMatch = picomatch('*.!(*a)');
1418
- * console.log(isMatch('a.a')); //=> false
1419
- * console.log(isMatch('a.b')); //=> true
1420
- * ```
1421
- * @name picomatch
1422
- * @param {String|Array} `globs` One or more glob patterns.
1423
- * @param {Object=} `options`
1424
- * @return {Function=} Returns a matcher function.
1425
- * @api public
1426
- */
1427
- const picomatch$2 = (glob, options, returnState = false) => {
1428
- if (Array.isArray(glob)) {
1429
- const fns = glob.map((input) => picomatch$2(input, options, returnState));
1430
- const arrayMatcher = (str) => {
1431
- for (const isMatch of fns) {
1432
- const state$1 = isMatch(str);
1433
- if (state$1) return state$1;
1434
- }
1435
- return false;
1436
- };
1437
- return arrayMatcher;
1438
- }
1439
- const isState = isObject(glob) && glob.tokens && glob.input;
1440
- if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
1441
- const opts = options || {};
1442
- const posix = opts.windows;
1443
- const regex = isState ? picomatch$2.compileRe(glob, options) : picomatch$2.makeRe(glob, options, false, true);
1444
- const state = regex.state;
1445
- delete regex.state;
1446
- let isIgnored = () => false;
1447
- if (opts.ignore) {
1448
- const ignoreOpts = {
1449
- ...options,
1450
- ignore: null,
1451
- onMatch: null,
1452
- onResult: null
1453
- };
1454
- isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
1455
- }
1456
- const matcher = (input, returnObject = false) => {
1457
- const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
1458
- glob,
1459
- posix
1460
- });
1461
- const result = {
1462
- glob,
1463
- state,
1464
- regex,
1465
- posix,
1466
- input,
1467
- output,
1468
- match,
1469
- isMatch
1470
- };
1471
- if (typeof opts.onResult === "function") opts.onResult(result);
1472
- if (isMatch === false) {
1473
- result.isMatch = false;
1474
- return returnObject ? result : false;
1475
- }
1476
- if (isIgnored(input)) {
1477
- if (typeof opts.onIgnore === "function") opts.onIgnore(result);
1478
- result.isMatch = false;
1479
- return returnObject ? result : false;
1480
- }
1481
- if (typeof opts.onMatch === "function") opts.onMatch(result);
1482
- return returnObject ? result : true;
1483
- };
1484
- if (returnState) matcher.state = state;
1485
- return matcher;
1486
- };
1487
- /**
1488
- * Test `input` with the given `regex`. This is used by the main
1489
- * `picomatch()` function to test the input string.
1490
- *
1491
- * ```js
1492
- * const picomatch = require('picomatch');
1493
- * // picomatch.test(input, regex[, options]);
1494
- *
1495
- * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
1496
- * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
1497
- * ```
1498
- * @param {String} `input` String to test.
1499
- * @param {RegExp} `regex`
1500
- * @return {Object} Returns an object with matching info.
1501
- * @api public
1502
- */
1503
- picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
1504
- if (typeof input !== "string") throw new TypeError("Expected input to be a string");
1505
- if (input === "") return {
1506
- isMatch: false,
1507
- output: ""
1508
- };
1509
- const opts = options || {};
1510
- const format = opts.format || (posix ? utils$1.toPosixSlashes : null);
1511
- let match = input === glob;
1512
- let output = match && format ? format(input) : input;
1513
- if (match === false) {
1514
- output = format ? format(input) : input;
1515
- match = output === glob;
1516
- }
1517
- if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex, options, posix);
1518
- else match = regex.exec(output);
1519
- return {
1520
- isMatch: Boolean(match),
1521
- match,
1522
- output
1523
- };
1524
- };
1525
- /**
1526
- * Match the basename of a filepath.
1527
- *
1528
- * ```js
1529
- * const picomatch = require('picomatch');
1530
- * // picomatch.matchBase(input, glob[, options]);
1531
- * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
1532
- * ```
1533
- * @param {String} `input` String to test.
1534
- * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
1535
- * @return {Boolean}
1536
- * @api public
1537
- */
1538
- picomatch$2.matchBase = (input, glob, options) => {
1539
- return (glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options)).test(utils$1.basename(input));
1540
- };
1541
- /**
1542
- * Returns true if **any** of the given glob `patterns` match the specified `string`.
1543
- *
1544
- * ```js
1545
- * const picomatch = require('picomatch');
1546
- * // picomatch.isMatch(string, patterns[, options]);
1547
- *
1548
- * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
1549
- * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
1550
- * ```
1551
- * @param {String|Array} str The string to test.
1552
- * @param {String|Array} patterns One or more glob patterns to use for matching.
1553
- * @param {Object} [options] See available [options](#options).
1554
- * @return {Boolean} Returns true if any patterns match `str`
1555
- * @api public
1556
- */
1557
- picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
1558
- /**
1559
- * Parse a glob pattern to create the source string for a regular
1560
- * expression.
1561
- *
1562
- * ```js
1563
- * const picomatch = require('picomatch');
1564
- * const result = picomatch.parse(pattern[, options]);
1565
- * ```
1566
- * @param {String} `pattern`
1567
- * @param {Object} `options`
1568
- * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
1569
- * @api public
1570
- */
1571
- picomatch$2.parse = (pattern, options) => {
1572
- if (Array.isArray(pattern)) return pattern.map((p) => picomatch$2.parse(p, options));
1573
- return parse$1(pattern, {
1574
- ...options,
1575
- fastpaths: false
1576
- });
1577
- };
1578
- /**
1579
- * Scan a glob pattern to separate the pattern into segments.
1580
- *
1581
- * ```js
1582
- * const picomatch = require('picomatch');
1583
- * // picomatch.scan(input[, options]);
1584
- *
1585
- * const result = picomatch.scan('!./foo/*.js');
1586
- * console.log(result);
1587
- * { prefix: '!./',
1588
- * input: '!./foo/*.js',
1589
- * start: 3,
1590
- * base: 'foo',
1591
- * glob: '*.js',
1592
- * isBrace: false,
1593
- * isBracket: false,
1594
- * isGlob: true,
1595
- * isExtglob: false,
1596
- * isGlobstar: false,
1597
- * negated: true }
1598
- * ```
1599
- * @param {String} `input` Glob pattern to scan.
1600
- * @param {Object} `options`
1601
- * @return {Object} Returns an object with
1602
- * @api public
1603
- */
1604
- picomatch$2.scan = (input, options) => scan(input, options);
1605
- /**
1606
- * Compile a regular expression from the `state` object returned by the
1607
- * [parse()](#parse) method.
1608
- *
1609
- * @param {Object} `state`
1610
- * @param {Object} `options`
1611
- * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
1612
- * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
1613
- * @return {RegExp}
1614
- * @api public
1615
- */
1616
- picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
1617
- if (returnOutput === true) return state.output;
1618
- const opts = options || {};
1619
- const prepend = opts.contains ? "" : "^";
1620
- const append = opts.contains ? "" : "$";
1621
- let source = `${prepend}(?:${state.output})${append}`;
1622
- if (state && state.negated === true) source = `^(?!${source}).*$`;
1623
- const regex = picomatch$2.toRegex(source, options);
1624
- if (returnState === true) regex.state = state;
1625
- return regex;
1626
- };
1627
- /**
1628
- * Create a regular expression from a parsed glob pattern.
1629
- *
1630
- * ```js
1631
- * const picomatch = require('picomatch');
1632
- * const state = picomatch.parse('*.js');
1633
- * // picomatch.compileRe(state[, options]);
1634
- *
1635
- * console.log(picomatch.compileRe(state));
1636
- * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
1637
- * ```
1638
- * @param {String} `state` The object returned from the `.parse` method.
1639
- * @param {Object} `options`
1640
- * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
1641
- * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
1642
- * @return {RegExp} Returns a regex created from the given pattern.
1643
- * @api public
1644
- */
1645
- picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
1646
- if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
1647
- let parsed = {
1648
- negated: false,
1649
- fastpaths: true
1650
- };
1651
- if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse$1.fastpaths(input, options);
1652
- if (!parsed.output) parsed = parse$1(input, options);
1653
- return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
1654
- };
1655
- /**
1656
- * Create a regular expression from the given regex source string.
1657
- *
1658
- * ```js
1659
- * const picomatch = require('picomatch');
1660
- * // picomatch.toRegex(source[, options]);
1661
- *
1662
- * const { output } = picomatch.parse('*.js');
1663
- * console.log(picomatch.toRegex(output));
1664
- * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
1665
- * ```
1666
- * @param {String} `source` Regular expression source string.
1667
- * @param {Object} `options`
1668
- * @return {RegExp}
1669
- * @api public
1670
- */
1671
- picomatch$2.toRegex = (source, options) => {
1672
- try {
1673
- const opts = options || {};
1674
- return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
1675
- } catch (err) {
1676
- if (options && options.debug === true) throw err;
1677
- return /$^/;
1678
- }
1679
- };
1680
- /**
1681
- * Picomatch constants.
1682
- * @return {Object}
1683
- */
1684
- picomatch$2.constants = constants;
1685
- /**
1686
- * Expose "picomatch"
1687
- */
1688
- module.exports = picomatch$2;
1689
- }));
1690
-
1691
- //#endregion
1692
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js
1693
- var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1694
- const pico = require_picomatch$1();
1695
- const utils = require_utils();
1696
- function picomatch$1(glob, options, returnState = false) {
1697
- if (options && (options.windows === null || options.windows === void 0)) options = {
1698
- ...options,
1699
- windows: utils.isWindows()
1700
- };
1701
- return pico(glob, options, returnState);
1702
- }
1703
- Object.assign(picomatch$1, pico);
1704
- module.exports = picomatch$1;
1705
- }));
1706
-
1707
- //#endregion
1708
- //#region ../../node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/parse-CRORloGP.mjs
1709
- var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
1710
- function toArray(array) {
1711
- array = array || [];
1712
- if (Array.isArray(array)) return array;
1713
- return [array];
1714
- }
1715
- const BACKSLASH_REGEX = /\\/g;
1716
- function normalize$1(path$1) {
1717
- return path$1.replace(BACKSLASH_REGEX, "/");
1718
- }
1719
- const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
1720
- function isAbsolute$1$1(path$1) {
1721
- return ABSOLUTE_PATH_REGEX.test(path$1);
1722
- }
1723
- function getMatcherString(glob, cwd) {
1724
- if (glob.startsWith("**") || isAbsolute$1$1(glob)) return normalize$1(glob);
1725
- return normalize$1((0, node_path.resolve)(cwd, glob));
1726
- }
1727
- function patternToIdFilter(pattern) {
1728
- if (pattern instanceof RegExp) return (id) => {
1729
- const normalizedId = normalize$1(id);
1730
- const result = pattern.test(normalizedId);
1731
- pattern.lastIndex = 0;
1732
- return result;
1733
- };
1734
- const matcher = (0, import_picomatch.default)(getMatcherString(pattern, process.cwd()), { dot: true });
1735
- return (id) => {
1736
- return matcher(normalize$1(id));
1737
- };
1738
- }
1739
- function patternToCodeFilter(pattern) {
1740
- if (pattern instanceof RegExp) return (code) => {
1741
- const result = pattern.test(code);
1742
- pattern.lastIndex = 0;
1743
- return result;
1744
- };
1745
- return (code) => code.includes(pattern);
1746
- }
1747
- function createFilter(exclude, include) {
1748
- if (!exclude && !include) return;
1749
- return (input) => {
1750
- if (exclude?.some((filter) => filter(input))) return false;
1751
- if (include?.some((filter) => filter(input))) return true;
1752
- return !(include && include.length > 0);
1753
- };
1754
- }
1755
- function normalizeFilter(filter) {
1756
- if (typeof filter === "string" || filter instanceof RegExp) return { include: [filter] };
1757
- if (Array.isArray(filter)) return { include: filter };
1758
- return {
1759
- exclude: filter.exclude ? toArray(filter.exclude) : void 0,
1760
- include: filter.include ? toArray(filter.include) : void 0
1761
- };
1762
- }
1763
- function createIdFilter(filter) {
1764
- if (!filter) return;
1765
- const { exclude, include } = normalizeFilter(filter);
1766
- const excludeFilter = exclude?.map(patternToIdFilter);
1767
- const includeFilter = include?.map(patternToIdFilter);
1768
- return createFilter(excludeFilter, includeFilter);
1769
- }
1770
- function createCodeFilter(filter) {
1771
- if (!filter) return;
1772
- const { exclude, include } = normalizeFilter(filter);
1773
- const excludeFilter = exclude?.map(patternToCodeFilter);
1774
- const includeFilter = include?.map(patternToCodeFilter);
1775
- return createFilter(excludeFilter, includeFilter);
1776
- }
1777
- function createFilterForId(filter) {
1778
- const filterFunction = createIdFilter(filter);
1779
- return filterFunction ? (id) => !!filterFunction(id) : void 0;
1780
- }
1781
- function createFilterForTransform(idFilter, codeFilter) {
1782
- if (!idFilter && !codeFilter) return;
1783
- const idFilterFunction = createIdFilter(idFilter);
1784
- const codeFilterFunction = createCodeFilter(codeFilter);
1785
- return (id, code) => {
1786
- let fallback = true;
1787
- if (idFilterFunction) fallback &&= idFilterFunction(id);
1788
- if (!fallback) return false;
1789
- if (codeFilterFunction) fallback &&= codeFilterFunction(code);
1790
- return fallback;
1791
- };
1792
- }
1793
- function normalizeObjectHook(name, hook) {
1794
- let handler;
1795
- let filter;
1796
- if (typeof hook === "function") handler = hook;
1797
- else {
1798
- handler = hook.handler;
1799
- const hookFilter = hook.filter;
1800
- if (name === "resolveId" || name === "load") filter = createFilterForId(hookFilter?.id);
1801
- else filter = createFilterForTransform(hookFilter?.id, hookFilter?.code);
1802
- }
1803
- return {
1804
- handler,
1805
- filter: filter || (() => true)
1806
- };
1807
- }
1808
- let parseImpl;
1809
- function parse(code, opts = {}) {
1810
- if (!parseImpl) throw new Error("Parse implementation is not set. Please call setParseImpl first.");
1811
- return parseImpl(code, opts);
1812
- }
1813
-
1814
- //#endregion
1815
- //#region ../../node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/webpack-like-BU9ULG6P.mjs
1816
- function transformUse(data, plugin, transformLoader) {
1817
- if (data.resource == null) return [];
1818
- const id = normalizeAbsolutePath(data.resource + (data.resourceQuery || ""));
1819
- if (plugin.transformInclude && !plugin.transformInclude(id)) return [];
1820
- const { filter } = normalizeObjectHook("load", plugin.transform);
1821
- if (!filter(id)) return [];
1822
- return [{
1823
- loader: transformLoader,
1824
- options: { plugin },
1825
- ident: plugin.name
1826
- }];
1827
- }
1828
- /**
1829
- * Normalizes a given path when it's absolute. Normalizing means returning a new path by converting
1830
- * the input path to the native os format. This is useful in cases where we want to normalize
1831
- * the `id` argument of a hook. Any absolute ids should be in the default format
1832
- * of the operating system. Any relative imports or node_module imports should remain
1833
- * untouched.
1834
- *
1835
- * @param path - Path to normalize.
1836
- * @returns a new normalized path.
1837
- */
1838
- function normalizeAbsolutePath(path$1) {
1839
- if ((0, node_path.isAbsolute)(path$1)) return (0, node_path.normalize)(path$1);
1840
- else return path$1;
1841
- }
1842
-
1843
- //#endregion
1844
- //#region ../../node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/context-CehLHpzV.mjs
1845
- function createBuildContext(compiler, compilation, loaderContext, inputSourceMap) {
1846
- return {
1847
- getNativeBuildContext() {
1848
- return {
1849
- framework: "rspack",
1850
- compiler,
1851
- compilation,
1852
- loaderContext,
1853
- inputSourceMap
1854
- };
1855
- },
1856
- addWatchFile(file) {
1857
- const cwd = process.cwd();
1858
- compilation.fileDependencies.add((0, node_path.resolve)(cwd, file));
1859
- },
1860
- getWatchFiles() {
1861
- return Array.from(compilation.fileDependencies);
1862
- },
1863
- parse,
1864
- emitFile(emittedFile) {
1865
- const outFileName = emittedFile.fileName || emittedFile.name;
1866
- if (emittedFile.source && outFileName) {
1867
- const { sources } = compilation.compiler.webpack;
1868
- compilation.emitAsset(outFileName, new sources.RawSource(typeof emittedFile.source === "string" ? emittedFile.source : node_buffer.Buffer.from(emittedFile.source)));
1869
- }
1870
- }
1871
- };
1872
- }
1873
- function normalizeMessage(error) {
1874
- const err = new Error(typeof error === "string" ? error : error.message);
1875
- if (typeof error === "object") {
1876
- err.stack = error.stack;
1877
- err.cause = error.meta;
1878
- }
1879
- return err;
1880
- }
1881
-
1882
- //#endregion
1883
- //#region ../../node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/utils-CuyC8gTr.mjs
1884
- function encodeVirtualModuleId(id, plugin) {
1885
- return (0, node_path.resolve)(plugin.__virtualModulePrefix, encodeURIComponent(id));
1886
- }
1887
- function decodeVirtualModuleId(encoded, _plugin) {
1888
- return decodeURIComponent((0, node_path.basename)(encoded));
1889
- }
1890
- function isVirtualModuleId(encoded, plugin) {
1891
- return (0, node_path.dirname)(encoded) === plugin.__virtualModulePrefix;
1892
- }
1893
- var FakeVirtualModulesPlugin = class FakeVirtualModulesPlugin$1 {
1894
- name = "FakeVirtualModulesPlugin";
1895
- static counters = /* @__PURE__ */ new Map();
1896
- static initCleanup = false;
1897
- constructor(plugin) {
1898
- this.plugin = plugin;
1899
- if (!FakeVirtualModulesPlugin$1.initCleanup) {
1900
- FakeVirtualModulesPlugin$1.initCleanup = true;
1901
- process.once("exit", () => {
1902
- FakeVirtualModulesPlugin$1.counters.forEach((_, dir) => {
1903
- node_fs.default.rmSync(dir, {
1904
- recursive: true,
1905
- force: true
1906
- });
1907
- });
1908
- });
1909
- }
1910
- }
1911
- apply(compiler) {
1912
- const dir = this.plugin.__virtualModulePrefix;
1913
- if (!node_fs.default.existsSync(dir)) node_fs.default.mkdirSync(dir, { recursive: true });
1914
- const counter = FakeVirtualModulesPlugin$1.counters.get(dir) ?? 0;
1915
- FakeVirtualModulesPlugin$1.counters.set(dir, counter + 1);
1916
- compiler.hooks.shutdown.tap(this.name, () => {
1917
- const counter$1 = (FakeVirtualModulesPlugin$1.counters.get(dir) ?? 1) - 1;
1918
- if (counter$1 === 0) {
1919
- FakeVirtualModulesPlugin$1.counters.delete(dir);
1920
- node_fs.default.rmSync(dir, {
1921
- recursive: true,
1922
- force: true
1923
- });
1924
- } else FakeVirtualModulesPlugin$1.counters.set(dir, counter$1);
1925
- });
1926
- }
1927
- async writeModule(file) {
1928
- return node_fs.default.promises.writeFile(file, "");
1929
- }
1930
- };
1931
-
1932
- //#endregion
1933
- //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
1934
- var comma = ",".charCodeAt(0);
1935
- var semicolon = ";".charCodeAt(0);
1936
- var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1937
- var intToChar = new Uint8Array(64);
1938
- var charToInt = new Uint8Array(128);
1939
- for (let i = 0; i < chars.length; i++) {
1940
- const c = chars.charCodeAt(i);
1941
- intToChar[i] = c;
1942
- charToInt[c] = i;
1943
- }
1944
- var bufLength = 1024 * 16;
1945
-
1946
- //#endregion
1947
- //#region ../../node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/virtual-stats.js
1948
- var require_virtual_stats = /* @__PURE__ */ __commonJSMin(((exports) => {
1949
- var __importDefault = exports && exports.__importDefault || function(mod) {
1950
- return mod && mod.__esModule ? mod : { "default": mod };
1951
- };
1952
- Object.defineProperty(exports, "__esModule", { value: true });
1953
- exports.VirtualStats = void 0;
1954
- const constants_1 = __importDefault(require("node:constants"));
1955
- var VirtualStats = class {
1956
- constructor(config) {
1957
- for (const key in config) {
1958
- if (!Object.prototype.hasOwnProperty.call(config, key)) continue;
1959
- this[key] = config[key];
1960
- }
1961
- }
1962
- _checkModeProperty(property) {
1963
- return (this.mode & constants_1.default.S_IFMT) === property;
1964
- }
1965
- isDirectory() {
1966
- return this._checkModeProperty(constants_1.default.S_IFDIR);
1967
- }
1968
- isFile() {
1969
- return this._checkModeProperty(constants_1.default.S_IFREG);
1970
- }
1971
- isBlockDevice() {
1972
- return this._checkModeProperty(constants_1.default.S_IFBLK);
1973
- }
1974
- isCharacterDevice() {
1975
- return this._checkModeProperty(constants_1.default.S_IFCHR);
1976
- }
1977
- isSymbolicLink() {
1978
- return this._checkModeProperty(constants_1.default.S_IFLNK);
1979
- }
1980
- isFIFO() {
1981
- return this._checkModeProperty(constants_1.default.S_IFIFO);
1982
- }
1983
- isSocket() {
1984
- return this._checkModeProperty(constants_1.default.S_IFSOCK);
1985
- }
1986
- };
1987
- exports.VirtualStats = VirtualStats;
1988
- }));
1989
-
1990
- //#endregion
1991
- //#region ../../node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/index.js
1992
- var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1993
- const path_1 = (exports && exports.__importDefault || function(mod) {
1994
- return mod && mod.__esModule ? mod : { "default": mod };
1995
- })(require("node:path"));
1996
- const virtual_stats_1 = require_virtual_stats();
1997
- let inode = 45e6;
1998
- const ALL = "all";
1999
- const STATIC = "static";
2000
- const DYNAMIC = "dynamic";
2001
- function checkActivation(instance) {
2002
- if (!instance._compiler) throw new Error("You must use this plugin only after creating webpack instance!");
2003
- }
2004
- function getModulePath(filePath, compiler) {
2005
- return path_1.default.isAbsolute(filePath) ? filePath : path_1.default.join(compiler.context, filePath);
2006
- }
2007
- function createWebpackData(result) {
2008
- return (backendOrStorage) => {
2009
- if (backendOrStorage._data) {
2010
- const curLevelIdx = backendOrStorage._currentLevel;
2011
- return {
2012
- result,
2013
- level: backendOrStorage._levels[curLevelIdx]
2014
- };
2015
- }
2016
- return [null, result];
2017
- };
2018
- }
2019
- function getData(storage, key) {
2020
- if (storage._data instanceof Map) return storage._data.get(key);
2021
- else if (storage._data) return storage.data[key];
2022
- else if (storage.data instanceof Map) return storage.data.get(key);
2023
- else return storage.data[key];
2024
- }
2025
- function setData(backendOrStorage, key, valueFactory) {
2026
- const value = valueFactory(backendOrStorage);
2027
- if (backendOrStorage._data instanceof Map) backendOrStorage._data.set(key, value);
2028
- else if (backendOrStorage._data) backendOrStorage.data[key] = value;
2029
- else if (backendOrStorage.data instanceof Map) backendOrStorage.data.set(key, value);
2030
- else backendOrStorage.data[key] = value;
2031
- }
2032
- function getStatStorage(fileSystem) {
2033
- if (fileSystem._statStorage) return fileSystem._statStorage;
2034
- else if (fileSystem._statBackend) return fileSystem._statBackend;
2035
- else throw new Error("Couldn't find a stat storage");
2036
- }
2037
- function getFileStorage(fileSystem) {
2038
- if (fileSystem._readFileStorage) return fileSystem._readFileStorage;
2039
- else if (fileSystem._readFileBackend) return fileSystem._readFileBackend;
2040
- else throw new Error("Couldn't find a readFileStorage");
2041
- }
2042
- function getReadDirBackend(fileSystem) {
2043
- if (fileSystem._readdirBackend) return fileSystem._readdirBackend;
2044
- else if (fileSystem._readdirStorage) return fileSystem._readdirStorage;
2045
- else throw new Error("Couldn't find a readDirStorage from Webpack Internals");
2046
- }
2047
- function getRealpathBackend(fileSystem) {
2048
- if (fileSystem._realpathBackend) return fileSystem._realpathBackend;
2049
- }
2050
- var VirtualModulesPlugin$1 = class {
2051
- constructor(modules) {
2052
- this._compiler = null;
2053
- this._watcher = null;
2054
- this._staticModules = modules || null;
2055
- }
2056
- getModuleList(filter = ALL) {
2057
- var _a, _b;
2058
- let modules = {};
2059
- const shouldGetStaticModules = filter === ALL || filter === STATIC;
2060
- const shouldGetDynamicModules = filter === ALL || filter === DYNAMIC;
2061
- if (shouldGetStaticModules) modules = Object.assign(Object.assign({}, modules), this._staticModules);
2062
- if (shouldGetDynamicModules) {
2063
- const finalInputFileSystem = (_a = this._compiler) === null || _a === void 0 ? void 0 : _a.inputFileSystem;
2064
- const virtualFiles = (_b = finalInputFileSystem === null || finalInputFileSystem === void 0 ? void 0 : finalInputFileSystem._virtualFiles) !== null && _b !== void 0 ? _b : {};
2065
- const dynamicModules = {};
2066
- Object.keys(virtualFiles).forEach((key) => {
2067
- dynamicModules[key] = virtualFiles[key].contents;
2068
- });
2069
- modules = Object.assign(Object.assign({}, modules), dynamicModules);
2070
- }
2071
- return modules;
2072
- }
2073
- writeModule(filePath, contents) {
2074
- if (!this._compiler) throw new Error(`Plugin has not been initialized`);
2075
- checkActivation(this);
2076
- const len = contents ? contents.length : 0;
2077
- const time = Date.now();
2078
- const date = new Date(time);
2079
- const stats = new virtual_stats_1.VirtualStats({
2080
- dev: 8675309,
2081
- nlink: 0,
2082
- uid: 1e3,
2083
- gid: 1e3,
2084
- rdev: 0,
2085
- blksize: 4096,
2086
- ino: inode++,
2087
- mode: 33188,
2088
- size: len,
2089
- blocks: Math.floor(len / 4096),
2090
- atime: date,
2091
- mtime: date,
2092
- ctime: date,
2093
- birthtime: date
2094
- });
2095
- const modulePath = getModulePath(filePath, this._compiler);
2096
- if (process.env.WVM_DEBUG) console.log(this._compiler.name, "Write virtual module:", modulePath, contents);
2097
- let finalWatchFileSystem = this._watcher && this._watcher.watchFileSystem;
2098
- while (finalWatchFileSystem && finalWatchFileSystem.wfs) finalWatchFileSystem = finalWatchFileSystem.wfs;
2099
- let finalInputFileSystem = this._compiler.inputFileSystem;
2100
- while (finalInputFileSystem && finalInputFileSystem._inputFileSystem) finalInputFileSystem = finalInputFileSystem._inputFileSystem;
2101
- finalInputFileSystem._writeVirtualFile(modulePath, stats, contents);
2102
- if (finalWatchFileSystem && finalWatchFileSystem.watcher && (finalWatchFileSystem.watcher.fileWatchers.size || finalWatchFileSystem.watcher.fileWatchers.length)) {
2103
- const fileWatchers = finalWatchFileSystem.watcher.fileWatchers instanceof Map ? Array.from(finalWatchFileSystem.watcher.fileWatchers.values()) : finalWatchFileSystem.watcher.fileWatchers;
2104
- for (let fileWatcher of fileWatchers) {
2105
- if ("watcher" in fileWatcher) fileWatcher = fileWatcher.watcher;
2106
- if (fileWatcher.path === modulePath) {
2107
- if (process.env.DEBUG) console.log(this._compiler.name, "Emit file change:", modulePath, time);
2108
- delete fileWatcher.directoryWatcher._cachedTimeInfoEntries;
2109
- fileWatcher.emit("change", time, null);
2110
- }
2111
- }
2112
- }
2113
- }
2114
- apply(compiler) {
2115
- this._compiler = compiler;
2116
- const afterEnvironmentHook = () => {
2117
- let finalInputFileSystem = compiler.inputFileSystem;
2118
- while (finalInputFileSystem && finalInputFileSystem._inputFileSystem) finalInputFileSystem = finalInputFileSystem._inputFileSystem;
2119
- if (!finalInputFileSystem._writeVirtualFile) {
2120
- const originalPurge = finalInputFileSystem.purge;
2121
- finalInputFileSystem.purge = () => {
2122
- originalPurge.apply(finalInputFileSystem, []);
2123
- if (finalInputFileSystem._virtualFiles) Object.keys(finalInputFileSystem._virtualFiles).forEach((file) => {
2124
- const data = finalInputFileSystem._virtualFiles[file];
2125
- finalInputFileSystem._writeVirtualFile(file, data.stats, data.contents);
2126
- });
2127
- };
2128
- finalInputFileSystem._writeVirtualFile = (file, stats, contents) => {
2129
- const statStorage = getStatStorage(finalInputFileSystem);
2130
- const fileStorage = getFileStorage(finalInputFileSystem);
2131
- const readDirStorage = getReadDirBackend(finalInputFileSystem);
2132
- const realPathStorage = getRealpathBackend(finalInputFileSystem);
2133
- finalInputFileSystem._virtualFiles = finalInputFileSystem._virtualFiles || {};
2134
- finalInputFileSystem._virtualFiles[file] = {
2135
- stats,
2136
- contents
2137
- };
2138
- setData(statStorage, file, createWebpackData(stats));
2139
- setData(fileStorage, file, createWebpackData(contents));
2140
- const segments = file.split(/[\\/]/);
2141
- let count = segments.length - 1;
2142
- const minCount = segments[0] ? 1 : 0;
2143
- while (count > minCount) {
2144
- const dir = segments.slice(0, count).join(path_1.default.sep) || path_1.default.sep;
2145
- try {
2146
- finalInputFileSystem.readdirSync(dir);
2147
- } catch (e) {
2148
- const time = Date.now();
2149
- const dirStats = new virtual_stats_1.VirtualStats({
2150
- dev: 8675309,
2151
- nlink: 0,
2152
- uid: 1e3,
2153
- gid: 1e3,
2154
- rdev: 0,
2155
- blksize: 4096,
2156
- ino: inode++,
2157
- mode: 16877,
2158
- size: stats.size,
2159
- blocks: Math.floor(stats.size / 4096),
2160
- atime: time,
2161
- mtime: time,
2162
- ctime: time,
2163
- birthtime: time
2164
- });
2165
- setData(readDirStorage, dir, createWebpackData([]));
2166
- if (realPathStorage) setData(realPathStorage, dir, createWebpackData(dir));
2167
- setData(statStorage, dir, createWebpackData(dirStats));
2168
- }
2169
- let dirData = getData(getReadDirBackend(finalInputFileSystem), dir);
2170
- dirData = dirData[1] || dirData.result;
2171
- const filename = segments[count];
2172
- if (dirData.indexOf(filename) < 0) {
2173
- const files = dirData.concat([filename]).sort();
2174
- setData(getReadDirBackend(finalInputFileSystem), dir, createWebpackData(files));
2175
- } else break;
2176
- count--;
2177
- }
2178
- };
2179
- }
2180
- };
2181
- const afterResolversHook = () => {
2182
- if (this._staticModules) {
2183
- for (const [filePath, contents] of Object.entries(this._staticModules)) this.writeModule(filePath, contents);
2184
- this._staticModules = null;
2185
- }
2186
- };
2187
- const version = typeof compiler.webpack === "undefined" ? 4 : 5;
2188
- const watchRunHook = (watcher, callback) => {
2189
- this._watcher = watcher.compiler || watcher;
2190
- const virtualFiles = compiler.inputFileSystem._virtualFiles;
2191
- const fts = compiler.fileTimestamps;
2192
- if (virtualFiles && fts && typeof fts.set === "function") Object.keys(virtualFiles).forEach((file) => {
2193
- const mtime = +virtualFiles[file].stats.mtime;
2194
- fts.set(file, version === 4 ? mtime : {
2195
- safeTime: mtime,
2196
- timestamp: mtime
2197
- });
2198
- });
2199
- callback();
2200
- };
2201
- if (compiler.hooks) {
2202
- compiler.hooks.afterEnvironment.tap("VirtualModulesPlugin", afterEnvironmentHook);
2203
- compiler.hooks.afterResolvers.tap("VirtualModulesPlugin", afterResolversHook);
2204
- compiler.hooks.watchRun.tapAsync("VirtualModulesPlugin", watchRunHook);
2205
- } else {
2206
- compiler.plugin("after-environment", afterEnvironmentHook);
2207
- compiler.plugin("after-resolvers", afterResolversHook);
2208
- compiler.plugin("watch-run", watchRunHook);
2209
- }
2210
- }
2211
- };
2212
- module.exports = VirtualModulesPlugin$1;
2213
- }));
2214
-
2215
- //#endregion
2216
- //#region ../../node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/index.mjs
2217
- var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
2218
- const TRANSFORM_LOADER$1 = (0, node_path.resolve)(__dirname, "rspack/loaders/transform.mjs");
2219
- const LOAD_LOADER$1 = (0, node_path.resolve)(__dirname, "rspack/loaders/load.mjs");
2220
- function getRspackPlugin(factory) {
2221
- return (userOptions) => {
2222
- return { apply(compiler) {
2223
- const VIRTUAL_MODULE_PREFIX = (0, node_path.resolve)(compiler.options.context ?? process.cwd(), "node_modules/.virtual", compiler.rspack.experiments.VirtualModulesPlugin ? "" : process.pid.toString());
2224
- const meta = {
2225
- framework: "rspack",
2226
- rspack: { compiler }
2227
- };
2228
- const rawPlugins = toArray(factory(userOptions, meta));
2229
- for (const rawPlugin of rawPlugins) {
2230
- const plugin = Object.assign(rawPlugin, {
2231
- __unpluginMeta: meta,
2232
- __virtualModulePrefix: VIRTUAL_MODULE_PREFIX
2233
- });
2234
- const externalModules = /* @__PURE__ */ new Set();
2235
- if (plugin.resolveId) {
2236
- const createPlugin = (plugin$1) => {
2237
- if (compiler.rspack.experiments.VirtualModulesPlugin) return new compiler.rspack.experiments.VirtualModulesPlugin();
2238
- return new FakeVirtualModulesPlugin(plugin$1);
2239
- };
2240
- const vfs = createPlugin(plugin);
2241
- vfs.apply(compiler);
2242
- const vfsModules = /* @__PURE__ */ new Map();
2243
- plugin.__vfsModules = vfsModules;
2244
- plugin.__vfs = vfs;
2245
- compiler.hooks.compilation.tap(plugin.name, (compilation, { normalModuleFactory }) => {
2246
- normalModuleFactory.hooks.resolve.tapPromise(plugin.name, async (resolveData) => {
2247
- const id = normalizeAbsolutePath(resolveData.request);
2248
- const requestContext = resolveData.contextInfo;
2249
- let importer = requestContext.issuer !== "" ? requestContext.issuer : void 0;
2250
- const isEntry = requestContext.issuer === "";
2251
- if (importer?.startsWith(plugin.__virtualModulePrefix)) importer = decodeURIComponent(importer.slice(plugin.__virtualModulePrefix.length));
2252
- const context = createBuildContext(compiler, compilation);
2253
- let error;
2254
- const pluginContext = {
2255
- error(msg) {
2256
- if (error == null) error = normalizeMessage(msg);
2257
- else console.error(`unplugin/rspack: multiple errors returned from resolveId hook: ${msg}`);
2258
- },
2259
- warn(msg) {
2260
- console.warn(`unplugin/rspack: warning from resolveId hook: ${msg}`);
2261
- }
2262
- };
2263
- const { handler, filter } = normalizeObjectHook("resolveId", plugin.resolveId);
2264
- if (!filter(id)) return;
2265
- const resolveIdResult = await handler.call({
2266
- ...context,
2267
- ...pluginContext
2268
- }, id, importer, { isEntry });
2269
- if (error != null) throw error;
2270
- if (resolveIdResult == null) return;
2271
- let resolved = typeof resolveIdResult === "string" ? resolveIdResult : resolveIdResult.id;
2272
- if (typeof resolveIdResult === "string" ? false : resolveIdResult.external === true) externalModules.add(resolved);
2273
- let isVirtual = true;
2274
- try {
2275
- (compiler.inputFileSystem?.statSync ?? node_fs.default.statSync)(resolved);
2276
- isVirtual = false;
2277
- } catch {
2278
- isVirtual = !isVirtualModuleId(resolved, plugin);
2279
- }
2280
- if (isVirtual) {
2281
- const encodedVirtualPath = encodeVirtualModuleId(resolved, plugin);
2282
- if (!vfsModules.has(resolved)) {
2283
- const fsPromise = Promise.resolve(vfs.writeModule(encodedVirtualPath, ""));
2284
- vfsModules.set(resolved, fsPromise);
2285
- await fsPromise;
2286
- } else await vfsModules.get(resolved);
2287
- resolved = encodedVirtualPath;
2288
- }
2289
- resolveData.request = resolved;
2290
- });
2291
- });
2292
- }
2293
- if (plugin.load) compiler.options.module.rules.unshift({
2294
- enforce: plugin.enforce,
2295
- include(id) {
2296
- if (isVirtualModuleId(id, plugin)) id = decodeVirtualModuleId(id, plugin);
2297
- if (plugin.loadInclude && !plugin.loadInclude(id)) return false;
2298
- const { filter } = normalizeObjectHook("load", plugin.load);
2299
- if (!filter(id)) return false;
2300
- return !externalModules.has(id);
2301
- },
2302
- use: [{
2303
- loader: LOAD_LOADER$1,
2304
- options: { plugin }
2305
- }],
2306
- type: "javascript/auto"
2307
- });
2308
- if (plugin.transform) compiler.options.module.rules.unshift({
2309
- enforce: plugin.enforce,
2310
- use(data) {
2311
- return transformUse(data, plugin, TRANSFORM_LOADER$1);
2312
- }
2313
- });
2314
- if (plugin.rspack) plugin.rspack(compiler);
2315
- if (plugin.watchChange || plugin.buildStart) compiler.hooks.make.tapPromise(plugin.name, async (compilation) => {
2316
- const context = createBuildContext(compiler, compilation);
2317
- if (plugin.watchChange && (compiler.modifiedFiles || compiler.removedFiles)) {
2318
- const promises = [];
2319
- if (compiler.modifiedFiles) compiler.modifiedFiles.forEach((file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "update" }))));
2320
- if (compiler.removedFiles) compiler.removedFiles.forEach((file) => promises.push(Promise.resolve(plugin.watchChange.call(context, file, { event: "delete" }))));
2321
- await Promise.all(promises);
2322
- }
2323
- if (plugin.buildStart) return await plugin.buildStart.call(context);
2324
- });
2325
- if (plugin.buildEnd) compiler.hooks.emit.tapPromise(plugin.name, async (compilation) => {
2326
- await plugin.buildEnd.call(createBuildContext(compiler, compilation));
2327
- });
2328
- if (plugin.writeBundle) compiler.hooks.afterEmit.tapPromise(plugin.name, async () => {
2329
- await plugin.writeBundle();
2330
- });
2331
- }
2332
- } };
2333
- };
2334
- }
2335
- const TRANSFORM_LOADER = (0, node_path.resolve)(__dirname, "webpack/loaders/transform.mjs");
2336
- const LOAD_LOADER = (0, node_path.resolve)(__dirname, "webpack/loaders/load.mjs");
2337
- function createRspackPlugin(factory) {
2338
- return getRspackPlugin(factory);
2339
- }
2340
-
2341
- //#endregion
2342
- //#region src/helpers/unplugin.ts
2343
- function createRspackPlugin$1(context) {
2344
- return createRspackPlugin((0, powerlines_lib_unplugin.createUnplugin)(context))({});
2345
- }
2346
-
2347
- //#endregion
2348
- Object.defineProperty(exports, '__toESM', {
2349
- enumerable: true,
2350
- get: function () {
2351
- return __toESM;
2352
- }
2353
- });
2354
- Object.defineProperty(exports, 'createRspackPlugin', {
2355
- enumerable: true,
2356
- get: function () {
2357
- return createRspackPlugin$1;
2358
- }
2359
- });