@dan-uni/dan-any-plugin-detaolu 1.0.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,1939 @@
1
- /*! For license information please see index.js.LICENSE.txt */
1
+ /*! LICENSE: index.js.LICENSE.txt */
2
2
  import { UniDM, UniDMTools, UniPool } from "@dan-uni/dan-any";
3
- import fs_extra from "fs-extra";
3
+ import { createRequire as __rspack_createRequire } from "node:module";
4
+ const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
5
+ var __webpack_modules__ = {};
6
+ var __webpack_module_cache__ = {};
7
+ function __webpack_require__(moduleId) {
8
+ var cachedModule = __webpack_module_cache__[moduleId];
9
+ if (void 0 !== cachedModule) return cachedModule.exports;
10
+ var module = __webpack_module_cache__[moduleId] = {
11
+ exports: {}
12
+ };
13
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
14
+ return module.exports;
15
+ }
16
+ __webpack_require__.m = __webpack_modules__;
17
+ (()=>{
18
+ __webpack_require__.n = (module)=>{
19
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
20
+ __webpack_require__.d(getter, {
21
+ a: getter
22
+ });
23
+ return getter;
24
+ };
25
+ })();
26
+ (()=>{
27
+ __webpack_require__.d = (exports, definition)=>{
28
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
29
+ enumerable: true,
30
+ get: definition[key]
31
+ });
32
+ };
33
+ })();
34
+ (()=>{
35
+ __webpack_require__.add = function(modules) {
36
+ Object.assign(__webpack_require__.m, modules);
37
+ };
38
+ })();
39
+ (()=>{
40
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
41
+ })();
42
+ __webpack_require__.add({
43
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy-sync.js" (module, __unused_rspack_exports, __webpack_require__) {
44
+ const fs = __webpack_require__("../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js");
45
+ const path = __webpack_require__("path");
46
+ const mkdirsSync = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js").mkdirsSync;
47
+ const utimesMillisSync = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/utimes.js").utimesMillisSync;
48
+ const stat = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js");
49
+ function copySync(src, dest, opts) {
50
+ if ('function' == typeof opts) opts = {
51
+ filter: opts
52
+ };
53
+ opts = opts || {};
54
+ opts.clobber = 'clobber' in opts ? !!opts.clobber : true;
55
+ opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber;
56
+ if (opts.preserveTimestamps && 'ia32' === process.arch) process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", 'Warning', 'fs-extra-WARN0002');
57
+ const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts);
58
+ stat.checkParentPathsSync(src, srcStat, dest, 'copy');
59
+ if (opts.filter && !opts.filter(src, dest)) return;
60
+ const destParent = path.dirname(dest);
61
+ if (!fs.existsSync(destParent)) mkdirsSync(destParent);
62
+ return getStats(destStat, src, dest, opts);
63
+ }
64
+ function getStats(destStat, src, dest, opts) {
65
+ const statSync = opts.dereference ? fs.statSync : fs.lstatSync;
66
+ const srcStat = statSync(src);
67
+ if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
68
+ if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
69
+ if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
70
+ if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
71
+ if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
72
+ throw new Error(`Unknown file: ${src}`);
73
+ }
74
+ function onFile(srcStat, destStat, src, dest, opts) {
75
+ if (!destStat) return copyFile(srcStat, src, dest, opts);
76
+ return mayCopyFile(srcStat, src, dest, opts);
77
+ }
78
+ function mayCopyFile(srcStat, src, dest, opts) {
79
+ if (opts.overwrite) {
80
+ fs.unlinkSync(dest);
81
+ return copyFile(srcStat, src, dest, opts);
82
+ }
83
+ if (opts.errorOnExist) throw new Error(`'${dest}' already exists`);
84
+ }
85
+ function copyFile(srcStat, src, dest, opts) {
86
+ fs.copyFileSync(src, dest);
87
+ if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
88
+ return setDestMode(dest, srcStat.mode);
89
+ }
90
+ function handleTimestamps(srcMode, src, dest) {
91
+ if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
92
+ return setDestTimestamps(src, dest);
93
+ }
94
+ function fileIsNotWritable(srcMode) {
95
+ return (128 & srcMode) === 0;
96
+ }
97
+ function makeFileWritable(dest, srcMode) {
98
+ return setDestMode(dest, 128 | srcMode);
99
+ }
100
+ function setDestMode(dest, srcMode) {
101
+ return fs.chmodSync(dest, srcMode);
102
+ }
103
+ function setDestTimestamps(src, dest) {
104
+ const updatedSrcStat = fs.statSync(src);
105
+ return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
106
+ }
107
+ function onDir(srcStat, destStat, src, dest, opts) {
108
+ if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
109
+ return copyDir(src, dest, opts);
110
+ }
111
+ function mkDirAndCopy(srcMode, src, dest, opts) {
112
+ fs.mkdirSync(dest);
113
+ copyDir(src, dest, opts);
114
+ return setDestMode(dest, srcMode);
115
+ }
116
+ function copyDir(src, dest, opts) {
117
+ const dir = fs.opendirSync(src);
118
+ try {
119
+ let dirent;
120
+ while(null !== (dirent = dir.readSync()))copyDirItem(dirent.name, src, dest, opts);
121
+ } finally{
122
+ dir.closeSync();
123
+ }
124
+ }
125
+ function copyDirItem(item, src, dest, opts) {
126
+ const srcItem = path.join(src, item);
127
+ const destItem = path.join(dest, item);
128
+ if (opts.filter && !opts.filter(srcItem, destItem)) return;
129
+ const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts);
130
+ return getStats(destStat, srcItem, destItem, opts);
131
+ }
132
+ function onLink(destStat, src, dest, opts) {
133
+ let resolvedSrc = fs.readlinkSync(src);
134
+ if (opts.dereference) resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
135
+ if (!destStat) return fs.symlinkSync(resolvedSrc, dest);
136
+ {
137
+ let resolvedDest;
138
+ try {
139
+ resolvedDest = fs.readlinkSync(dest);
140
+ } catch (err) {
141
+ if ('EINVAL' === err.code || 'UNKNOWN' === err.code) return fs.symlinkSync(resolvedSrc, dest);
142
+ throw err;
143
+ }
144
+ if (opts.dereference) resolvedDest = path.resolve(process.cwd(), resolvedDest);
145
+ if (resolvedSrc !== resolvedDest) {
146
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
147
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
148
+ }
149
+ return copyLink(resolvedSrc, dest);
150
+ }
151
+ }
152
+ function copyLink(resolvedSrc, dest) {
153
+ fs.unlinkSync(dest);
154
+ return fs.symlinkSync(resolvedSrc, dest);
155
+ }
156
+ module.exports = copySync;
157
+ },
158
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy.js" (module, __unused_rspack_exports, __webpack_require__) {
159
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
160
+ const path = __webpack_require__("path");
161
+ const { mkdirs } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js");
162
+ const { pathExists } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js");
163
+ const { utimesMillis } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/utimes.js");
164
+ const stat = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js");
165
+ const { asyncIteratorConcurrentProcess } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/async.js");
166
+ async function copy(src, dest, opts = {}) {
167
+ if ('function' == typeof opts) opts = {
168
+ filter: opts
169
+ };
170
+ opts.clobber = 'clobber' in opts ? !!opts.clobber : true;
171
+ opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber;
172
+ if (opts.preserveTimestamps && 'ia32' === process.arch) process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", 'Warning', 'fs-extra-WARN0001');
173
+ const { srcStat, destStat } = await stat.checkPaths(src, dest, 'copy', opts);
174
+ await stat.checkParentPaths(src, srcStat, dest, 'copy');
175
+ const include = await runFilter(src, dest, opts);
176
+ if (!include) return;
177
+ const destParent = path.dirname(dest);
178
+ const dirExists = await pathExists(destParent);
179
+ if (!dirExists) await mkdirs(destParent);
180
+ await getStatsAndPerformCopy(destStat, src, dest, opts);
181
+ }
182
+ async function runFilter(src, dest, opts) {
183
+ if (!opts.filter) return true;
184
+ return opts.filter(src, dest);
185
+ }
186
+ async function getStatsAndPerformCopy(destStat, src, dest, opts) {
187
+ const statFn = opts.dereference ? fs.stat : fs.lstat;
188
+ const srcStat = await statFn(src);
189
+ if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
190
+ if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
191
+ if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
192
+ if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
193
+ if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
194
+ throw new Error(`Unknown file: ${src}`);
195
+ }
196
+ async function onFile(srcStat, destStat, src, dest, opts) {
197
+ if (!destStat) return copyFile(srcStat, src, dest, opts);
198
+ if (opts.overwrite) {
199
+ await fs.unlink(dest);
200
+ return copyFile(srcStat, src, dest, opts);
201
+ }
202
+ if (opts.errorOnExist) throw new Error(`'${dest}' already exists`);
203
+ }
204
+ async function copyFile(srcStat, src, dest, opts) {
205
+ await fs.copyFile(src, dest);
206
+ if (opts.preserveTimestamps) {
207
+ if (fileIsNotWritable(srcStat.mode)) await makeFileWritable(dest, srcStat.mode);
208
+ const updatedSrcStat = await fs.stat(src);
209
+ await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
210
+ }
211
+ return fs.chmod(dest, srcStat.mode);
212
+ }
213
+ function fileIsNotWritable(srcMode) {
214
+ return (128 & srcMode) === 0;
215
+ }
216
+ function makeFileWritable(dest, srcMode) {
217
+ return fs.chmod(dest, 128 | srcMode);
218
+ }
219
+ async function onDir(srcStat, destStat, src, dest, opts) {
220
+ if (!destStat) await fs.mkdir(dest);
221
+ await asyncIteratorConcurrentProcess(await fs.opendir(src), async (item)=>{
222
+ const srcItem = path.join(src, item.name);
223
+ const destItem = path.join(dest, item.name);
224
+ const include = await runFilter(srcItem, destItem, opts);
225
+ if (include) {
226
+ const { destStat } = await stat.checkPaths(srcItem, destItem, 'copy', opts);
227
+ await getStatsAndPerformCopy(destStat, srcItem, destItem, opts);
228
+ }
229
+ });
230
+ if (!destStat) await fs.chmod(dest, srcStat.mode);
231
+ }
232
+ async function onLink(destStat, src, dest, opts) {
233
+ let resolvedSrc = await fs.readlink(src);
234
+ if (opts.dereference) resolvedSrc = path.resolve(process.cwd(), resolvedSrc);
235
+ if (!destStat) return fs.symlink(resolvedSrc, dest);
236
+ let resolvedDest = null;
237
+ try {
238
+ resolvedDest = await fs.readlink(dest);
239
+ } catch (e) {
240
+ if ('EINVAL' === e.code || 'UNKNOWN' === e.code) return fs.symlink(resolvedSrc, dest);
241
+ throw e;
242
+ }
243
+ if (opts.dereference) resolvedDest = path.resolve(process.cwd(), resolvedDest);
244
+ if (resolvedSrc !== resolvedDest) {
245
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
246
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
247
+ }
248
+ await fs.unlink(dest);
249
+ return fs.symlink(resolvedSrc, dest);
250
+ }
251
+ module.exports = copy;
252
+ },
253
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/index.js" (module, __unused_rspack_exports, __webpack_require__) {
254
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
255
+ module.exports = {
256
+ copy: u(__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy.js")),
257
+ copySync: __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy-sync.js")
258
+ };
259
+ },
260
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/empty/index.js" (module, __unused_rspack_exports, __webpack_require__) {
261
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
262
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
263
+ const path = __webpack_require__("path");
264
+ const mkdir = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js");
265
+ const remove = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js");
266
+ const emptyDir = u(async function(dir) {
267
+ let items;
268
+ try {
269
+ items = await fs.readdir(dir);
270
+ } catch {
271
+ return mkdir.mkdirs(dir);
272
+ }
273
+ return Promise.all(items.map((item)=>remove.remove(path.join(dir, item))));
274
+ });
275
+ function emptyDirSync(dir) {
276
+ let items;
277
+ try {
278
+ items = fs.readdirSync(dir);
279
+ } catch {
280
+ return mkdir.mkdirsSync(dir);
281
+ }
282
+ items.forEach((item)=>{
283
+ item = path.join(dir, item);
284
+ remove.removeSync(item);
285
+ });
286
+ }
287
+ module.exports = {
288
+ emptyDirSync,
289
+ emptydirSync: emptyDirSync,
290
+ emptyDir,
291
+ emptydir: emptyDir
292
+ };
293
+ },
294
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/file.js" (module, __unused_rspack_exports, __webpack_require__) {
295
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
296
+ const path = __webpack_require__("path");
297
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
298
+ const mkdir = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js");
299
+ async function createFile(file) {
300
+ let stats;
301
+ try {
302
+ stats = await fs.stat(file);
303
+ } catch {}
304
+ if (stats && stats.isFile()) return;
305
+ const dir = path.dirname(file);
306
+ let dirStats = null;
307
+ try {
308
+ dirStats = await fs.stat(dir);
309
+ } catch (err) {
310
+ if ('ENOENT' === err.code) {
311
+ await mkdir.mkdirs(dir);
312
+ await fs.writeFile(file, '');
313
+ return;
314
+ }
315
+ throw err;
316
+ }
317
+ if (dirStats.isDirectory()) await fs.writeFile(file, '');
318
+ else await fs.readdir(dir);
319
+ }
320
+ function createFileSync(file) {
321
+ let stats;
322
+ try {
323
+ stats = fs.statSync(file);
324
+ } catch {}
325
+ if (stats && stats.isFile()) return;
326
+ const dir = path.dirname(file);
327
+ try {
328
+ if (!fs.statSync(dir).isDirectory()) fs.readdirSync(dir);
329
+ } catch (err) {
330
+ if (err && 'ENOENT' === err.code) mkdir.mkdirsSync(dir);
331
+ else throw err;
332
+ }
333
+ fs.writeFileSync(file, '');
334
+ }
335
+ module.exports = {
336
+ createFile: u(createFile),
337
+ createFileSync
338
+ };
339
+ },
340
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/index.js" (module, __unused_rspack_exports, __webpack_require__) {
341
+ const { createFile, createFileSync } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/file.js");
342
+ const { createLink, createLinkSync } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/link.js");
343
+ const { createSymlink, createSymlinkSync } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink.js");
344
+ module.exports = {
345
+ createFile,
346
+ createFileSync,
347
+ ensureFile: createFile,
348
+ ensureFileSync: createFileSync,
349
+ createLink,
350
+ createLinkSync,
351
+ ensureLink: createLink,
352
+ ensureLinkSync: createLinkSync,
353
+ createSymlink,
354
+ createSymlinkSync,
355
+ ensureSymlink: createSymlink,
356
+ ensureSymlinkSync: createSymlinkSync
357
+ };
358
+ },
359
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/link.js" (module, __unused_rspack_exports, __webpack_require__) {
360
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
361
+ const path = __webpack_require__("path");
362
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
363
+ const mkdir = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js");
364
+ const { pathExists } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js");
365
+ const { areIdentical } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js");
366
+ async function createLink(srcpath, dstpath) {
367
+ let dstStat;
368
+ try {
369
+ dstStat = await fs.lstat(dstpath);
370
+ } catch {}
371
+ let srcStat;
372
+ try {
373
+ srcStat = await fs.lstat(srcpath);
374
+ } catch (err) {
375
+ err.message = err.message.replace('lstat', 'ensureLink');
376
+ throw err;
377
+ }
378
+ if (dstStat && areIdentical(srcStat, dstStat)) return;
379
+ const dir = path.dirname(dstpath);
380
+ const dirExists = await pathExists(dir);
381
+ if (!dirExists) await mkdir.mkdirs(dir);
382
+ await fs.link(srcpath, dstpath);
383
+ }
384
+ function createLinkSync(srcpath, dstpath) {
385
+ let dstStat;
386
+ try {
387
+ dstStat = fs.lstatSync(dstpath);
388
+ } catch {}
389
+ try {
390
+ const srcStat = fs.lstatSync(srcpath);
391
+ if (dstStat && areIdentical(srcStat, dstStat)) return;
392
+ } catch (err) {
393
+ err.message = err.message.replace('lstat', 'ensureLink');
394
+ throw err;
395
+ }
396
+ const dir = path.dirname(dstpath);
397
+ const dirExists = fs.existsSync(dir);
398
+ if (dirExists) return fs.linkSync(srcpath, dstpath);
399
+ mkdir.mkdirsSync(dir);
400
+ return fs.linkSync(srcpath, dstpath);
401
+ }
402
+ module.exports = {
403
+ createLink: u(createLink),
404
+ createLinkSync
405
+ };
406
+ },
407
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-paths.js" (module, __unused_rspack_exports, __webpack_require__) {
408
+ const path = __webpack_require__("path");
409
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
410
+ const { pathExists } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js");
411
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
412
+ async function symlinkPaths(srcpath, dstpath) {
413
+ if (path.isAbsolute(srcpath)) {
414
+ try {
415
+ await fs.lstat(srcpath);
416
+ } catch (err) {
417
+ err.message = err.message.replace('lstat', 'ensureSymlink');
418
+ throw err;
419
+ }
420
+ return {
421
+ toCwd: srcpath,
422
+ toDst: srcpath
423
+ };
424
+ }
425
+ const dstdir = path.dirname(dstpath);
426
+ const relativeToDst = path.join(dstdir, srcpath);
427
+ const exists = await pathExists(relativeToDst);
428
+ if (exists) return {
429
+ toCwd: relativeToDst,
430
+ toDst: srcpath
431
+ };
432
+ try {
433
+ await fs.lstat(srcpath);
434
+ } catch (err) {
435
+ err.message = err.message.replace('lstat', 'ensureSymlink');
436
+ throw err;
437
+ }
438
+ return {
439
+ toCwd: srcpath,
440
+ toDst: path.relative(dstdir, srcpath)
441
+ };
442
+ }
443
+ function symlinkPathsSync(srcpath, dstpath) {
444
+ if (path.isAbsolute(srcpath)) {
445
+ const exists = fs.existsSync(srcpath);
446
+ if (!exists) throw new Error('absolute srcpath does not exist');
447
+ return {
448
+ toCwd: srcpath,
449
+ toDst: srcpath
450
+ };
451
+ }
452
+ const dstdir = path.dirname(dstpath);
453
+ const relativeToDst = path.join(dstdir, srcpath);
454
+ const exists = fs.existsSync(relativeToDst);
455
+ if (exists) return {
456
+ toCwd: relativeToDst,
457
+ toDst: srcpath
458
+ };
459
+ const srcExists = fs.existsSync(srcpath);
460
+ if (!srcExists) throw new Error('relative srcpath does not exist');
461
+ return {
462
+ toCwd: srcpath,
463
+ toDst: path.relative(dstdir, srcpath)
464
+ };
465
+ }
466
+ module.exports = {
467
+ symlinkPaths: u(symlinkPaths),
468
+ symlinkPathsSync
469
+ };
470
+ },
471
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-type.js" (module, __unused_rspack_exports, __webpack_require__) {
472
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
473
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
474
+ async function symlinkType(srcpath, type) {
475
+ if (type) return type;
476
+ let stats;
477
+ try {
478
+ stats = await fs.lstat(srcpath);
479
+ } catch {
480
+ return 'file';
481
+ }
482
+ return stats && stats.isDirectory() ? 'dir' : 'file';
483
+ }
484
+ function symlinkTypeSync(srcpath, type) {
485
+ if (type) return type;
486
+ let stats;
487
+ try {
488
+ stats = fs.lstatSync(srcpath);
489
+ } catch {
490
+ return 'file';
491
+ }
492
+ return stats && stats.isDirectory() ? 'dir' : 'file';
493
+ }
494
+ module.exports = {
495
+ symlinkType: u(symlinkType),
496
+ symlinkTypeSync
497
+ };
498
+ },
499
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink.js" (module, __unused_rspack_exports, __webpack_require__) {
500
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
501
+ const path = __webpack_require__("path");
502
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
503
+ const { mkdirs, mkdirsSync } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js");
504
+ const { symlinkPaths, symlinkPathsSync } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-paths.js");
505
+ const { symlinkType, symlinkTypeSync } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-type.js");
506
+ const { pathExists } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js");
507
+ const { areIdentical } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js");
508
+ async function createSymlink(srcpath, dstpath, type) {
509
+ let stats;
510
+ try {
511
+ stats = await fs.lstat(dstpath);
512
+ } catch {}
513
+ if (stats && stats.isSymbolicLink()) {
514
+ let srcStat;
515
+ if (path.isAbsolute(srcpath)) srcStat = await fs.stat(srcpath);
516
+ else {
517
+ const dstdir = path.dirname(dstpath);
518
+ const relativeToDst = path.join(dstdir, srcpath);
519
+ try {
520
+ srcStat = await fs.stat(relativeToDst);
521
+ } catch {
522
+ srcStat = await fs.stat(srcpath);
523
+ }
524
+ }
525
+ const dstStat = await fs.stat(dstpath);
526
+ if (areIdentical(srcStat, dstStat)) return;
527
+ }
528
+ const relative = await symlinkPaths(srcpath, dstpath);
529
+ srcpath = relative.toDst;
530
+ const toType = await symlinkType(relative.toCwd, type);
531
+ const dir = path.dirname(dstpath);
532
+ if (!await pathExists(dir)) await mkdirs(dir);
533
+ return fs.symlink(srcpath, dstpath, toType);
534
+ }
535
+ function createSymlinkSync(srcpath, dstpath, type) {
536
+ let stats;
537
+ try {
538
+ stats = fs.lstatSync(dstpath);
539
+ } catch {}
540
+ if (stats && stats.isSymbolicLink()) {
541
+ let srcStat;
542
+ if (path.isAbsolute(srcpath)) srcStat = fs.statSync(srcpath);
543
+ else {
544
+ const dstdir = path.dirname(dstpath);
545
+ const relativeToDst = path.join(dstdir, srcpath);
546
+ try {
547
+ srcStat = fs.statSync(relativeToDst);
548
+ } catch {
549
+ srcStat = fs.statSync(srcpath);
550
+ }
551
+ }
552
+ const dstStat = fs.statSync(dstpath);
553
+ if (areIdentical(srcStat, dstStat)) return;
554
+ }
555
+ const relative = symlinkPathsSync(srcpath, dstpath);
556
+ srcpath = relative.toDst;
557
+ type = symlinkTypeSync(relative.toCwd, type);
558
+ const dir = path.dirname(dstpath);
559
+ const exists = fs.existsSync(dir);
560
+ if (exists) return fs.symlinkSync(srcpath, dstpath, type);
561
+ mkdirsSync(dir);
562
+ return fs.symlinkSync(srcpath, dstpath, type);
563
+ }
564
+ module.exports = {
565
+ createSymlink: u(createSymlink),
566
+ createSymlinkSync
567
+ };
568
+ },
569
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js" (__unused_rspack_module, exports, __webpack_require__) {
570
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromCallback;
571
+ const fs = __webpack_require__("../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js");
572
+ const api = [
573
+ 'access',
574
+ 'appendFile',
575
+ 'chmod',
576
+ 'chown',
577
+ 'close',
578
+ 'copyFile',
579
+ 'cp',
580
+ 'fchmod',
581
+ 'fchown',
582
+ 'fdatasync',
583
+ 'fstat',
584
+ 'fsync',
585
+ 'ftruncate',
586
+ 'futimes',
587
+ 'glob',
588
+ 'lchmod',
589
+ 'lchown',
590
+ 'lutimes',
591
+ 'link',
592
+ 'lstat',
593
+ 'mkdir',
594
+ 'mkdtemp',
595
+ 'open',
596
+ 'opendir',
597
+ 'readdir',
598
+ 'readFile',
599
+ 'readlink',
600
+ 'realpath',
601
+ 'rename',
602
+ 'rm',
603
+ 'rmdir',
604
+ 'stat',
605
+ 'statfs',
606
+ 'symlink',
607
+ 'truncate',
608
+ 'unlink',
609
+ 'utimes',
610
+ 'writeFile'
611
+ ].filter((key)=>'function' == typeof fs[key]);
612
+ Object.assign(exports, fs);
613
+ api.forEach((method)=>{
614
+ exports[method] = u(fs[method]);
615
+ });
616
+ exports.exists = function(filename, callback) {
617
+ if ('function' == typeof callback) return fs.exists(filename, callback);
618
+ return new Promise((resolve)=>fs.exists(filename, resolve));
619
+ };
620
+ exports.read = function(fd, buffer, offset, length, position, callback) {
621
+ if ('function' == typeof callback) return fs.read(fd, buffer, offset, length, position, callback);
622
+ return new Promise((resolve, reject)=>{
623
+ fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer)=>{
624
+ if (err) return reject(err);
625
+ resolve({
626
+ bytesRead,
627
+ buffer
628
+ });
629
+ });
630
+ });
631
+ };
632
+ exports.write = function(fd, buffer, ...args) {
633
+ if ('function' == typeof args[args.length - 1]) return fs.write(fd, buffer, ...args);
634
+ return new Promise((resolve, reject)=>{
635
+ fs.write(fd, buffer, ...args, (err, bytesWritten, buffer)=>{
636
+ if (err) return reject(err);
637
+ resolve({
638
+ bytesWritten,
639
+ buffer
640
+ });
641
+ });
642
+ });
643
+ };
644
+ exports.readv = function(fd, buffers, ...args) {
645
+ if ('function' == typeof args[args.length - 1]) return fs.readv(fd, buffers, ...args);
646
+ return new Promise((resolve, reject)=>{
647
+ fs.readv(fd, buffers, ...args, (err, bytesRead, buffers)=>{
648
+ if (err) return reject(err);
649
+ resolve({
650
+ bytesRead,
651
+ buffers
652
+ });
653
+ });
654
+ });
655
+ };
656
+ exports.writev = function(fd, buffers, ...args) {
657
+ if ('function' == typeof args[args.length - 1]) return fs.writev(fd, buffers, ...args);
658
+ return new Promise((resolve, reject)=>{
659
+ fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers)=>{
660
+ if (err) return reject(err);
661
+ resolve({
662
+ bytesWritten,
663
+ buffers
664
+ });
665
+ });
666
+ });
667
+ };
668
+ if ('function' == typeof fs.realpath.native) exports.realpath.native = u(fs.realpath.native);
669
+ else process.emitWarning('fs.realpath.native is not a function. Is fs being monkey-patched?', 'Warning', 'fs-extra-WARN0003');
670
+ },
671
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/index.js" (module, __unused_rspack_exports, __webpack_require__) {
672
+ module.exports = {
673
+ ...__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js"),
674
+ ...__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/index.js"),
675
+ ...__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/empty/index.js"),
676
+ ...__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/index.js"),
677
+ ...__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/index.js"),
678
+ ...__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js"),
679
+ ...__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/index.js"),
680
+ ...__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/output-file/index.js"),
681
+ ...__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js"),
682
+ ...__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js")
683
+ };
684
+ },
685
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/index.js" (module, __unused_rspack_exports, __webpack_require__) {
686
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
687
+ const jsonFile = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/jsonfile.js");
688
+ jsonFile.outputJson = u(__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json.js"));
689
+ jsonFile.outputJsonSync = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json-sync.js");
690
+ jsonFile.outputJSON = jsonFile.outputJson;
691
+ jsonFile.outputJSONSync = jsonFile.outputJsonSync;
692
+ jsonFile.writeJSON = jsonFile.writeJson;
693
+ jsonFile.writeJSONSync = jsonFile.writeJsonSync;
694
+ jsonFile.readJSON = jsonFile.readJson;
695
+ jsonFile.readJSONSync = jsonFile.readJsonSync;
696
+ module.exports = jsonFile;
697
+ },
698
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/jsonfile.js" (module, __unused_rspack_exports, __webpack_require__) {
699
+ const jsonFile = __webpack_require__("../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/index.js");
700
+ module.exports = {
701
+ readJson: jsonFile.readFile,
702
+ readJsonSync: jsonFile.readFileSync,
703
+ writeJson: jsonFile.writeFile,
704
+ writeJsonSync: jsonFile.writeFileSync
705
+ };
706
+ },
707
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json-sync.js" (module, __unused_rspack_exports, __webpack_require__) {
708
+ const { stringify } = __webpack_require__("../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js");
709
+ const { outputFileSync } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/output-file/index.js");
710
+ function outputJsonSync(file, data, options) {
711
+ const str = stringify(data, options);
712
+ outputFileSync(file, str, options);
713
+ }
714
+ module.exports = outputJsonSync;
715
+ },
716
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json.js" (module, __unused_rspack_exports, __webpack_require__) {
717
+ const { stringify } = __webpack_require__("../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js");
718
+ const { outputFile } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/output-file/index.js");
719
+ async function outputJson(file, data, options = {}) {
720
+ const str = stringify(data, options);
721
+ await outputFile(file, str, options);
722
+ }
723
+ module.exports = outputJson;
724
+ },
725
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js" (module, __unused_rspack_exports, __webpack_require__) {
726
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
727
+ const { makeDir: _makeDir, makeDirSync } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/make-dir.js");
728
+ const makeDir = u(_makeDir);
729
+ module.exports = {
730
+ mkdirs: makeDir,
731
+ mkdirsSync: makeDirSync,
732
+ mkdirp: makeDir,
733
+ mkdirpSync: makeDirSync,
734
+ ensureDir: makeDir,
735
+ ensureDirSync: makeDirSync
736
+ };
737
+ },
738
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/make-dir.js" (module, __unused_rspack_exports, __webpack_require__) {
739
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
740
+ const { checkPath } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/utils.js");
741
+ const getMode = (options)=>{
742
+ const defaults = {
743
+ mode: 511
744
+ };
745
+ if ('number' == typeof options) return options;
746
+ return ({
747
+ ...defaults,
748
+ ...options
749
+ }).mode;
750
+ };
751
+ module.exports.makeDir = async (dir, options)=>{
752
+ checkPath(dir);
753
+ return fs.mkdir(dir, {
754
+ mode: getMode(options),
755
+ recursive: true
756
+ });
757
+ };
758
+ module.exports.makeDirSync = (dir, options)=>{
759
+ checkPath(dir);
760
+ return fs.mkdirSync(dir, {
761
+ mode: getMode(options),
762
+ recursive: true
763
+ });
764
+ };
765
+ },
766
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/utils.js" (module, __unused_rspack_exports, __webpack_require__) {
767
+ const path = __webpack_require__("path");
768
+ module.exports.checkPath = function(pth) {
769
+ if ('win32' === process.platform) {
770
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''));
771
+ if (pathHasInvalidWinCharacters) {
772
+ const error = new Error(`Path contains invalid characters: ${pth}`);
773
+ error.code = 'EINVAL';
774
+ throw error;
775
+ }
776
+ }
777
+ };
778
+ },
779
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/index.js" (module, __unused_rspack_exports, __webpack_require__) {
780
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
781
+ module.exports = {
782
+ move: u(__webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move.js")),
783
+ moveSync: __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move-sync.js")
784
+ };
785
+ },
786
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move-sync.js" (module, __unused_rspack_exports, __webpack_require__) {
787
+ const fs = __webpack_require__("../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js");
788
+ const path = __webpack_require__("path");
789
+ const copySync = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/index.js").copySync;
790
+ const removeSync = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js").removeSync;
791
+ const mkdirpSync = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js").mkdirpSync;
792
+ const stat = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js");
793
+ function moveSync(src, dest, opts) {
794
+ opts = opts || {};
795
+ const overwrite = opts.overwrite || opts.clobber || false;
796
+ const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts);
797
+ stat.checkParentPathsSync(src, srcStat, dest, 'move');
798
+ if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest));
799
+ return doRename(src, dest, overwrite, isChangingCase);
800
+ }
801
+ function isParentRoot(dest) {
802
+ const parent = path.dirname(dest);
803
+ const parsedPath = path.parse(parent);
804
+ return parsedPath.root === parent;
805
+ }
806
+ function doRename(src, dest, overwrite, isChangingCase) {
807
+ if (isChangingCase) return rename(src, dest, overwrite);
808
+ if (overwrite) {
809
+ removeSync(dest);
810
+ return rename(src, dest, overwrite);
811
+ }
812
+ if (fs.existsSync(dest)) throw new Error('dest already exists.');
813
+ return rename(src, dest, overwrite);
814
+ }
815
+ function rename(src, dest, overwrite) {
816
+ try {
817
+ fs.renameSync(src, dest);
818
+ } catch (err) {
819
+ if ('EXDEV' !== err.code) throw err;
820
+ return moveAcrossDevice(src, dest, overwrite);
821
+ }
822
+ }
823
+ function moveAcrossDevice(src, dest, overwrite) {
824
+ const opts = {
825
+ overwrite,
826
+ errorOnExist: true,
827
+ preserveTimestamps: true
828
+ };
829
+ copySync(src, dest, opts);
830
+ return removeSync(src);
831
+ }
832
+ module.exports = moveSync;
833
+ },
834
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move.js" (module, __unused_rspack_exports, __webpack_require__) {
835
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
836
+ const path = __webpack_require__("path");
837
+ const { copy } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/index.js");
838
+ const { remove } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js");
839
+ const { mkdirp } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js");
840
+ const { pathExists } = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js");
841
+ const stat = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js");
842
+ async function move(src, dest, opts = {}) {
843
+ const overwrite = opts.overwrite || opts.clobber || false;
844
+ const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, 'move', opts);
845
+ await stat.checkParentPaths(src, srcStat, dest, 'move');
846
+ const destParent = path.dirname(dest);
847
+ const parsedParentPath = path.parse(destParent);
848
+ if (parsedParentPath.root !== destParent) await mkdirp(destParent);
849
+ return doRename(src, dest, overwrite, isChangingCase);
850
+ }
851
+ async function doRename(src, dest, overwrite, isChangingCase) {
852
+ if (!isChangingCase) {
853
+ if (overwrite) await remove(dest);
854
+ else if (await pathExists(dest)) throw new Error('dest already exists.');
855
+ }
856
+ try {
857
+ await fs.rename(src, dest);
858
+ } catch (err) {
859
+ if ('EXDEV' !== err.code) throw err;
860
+ await moveAcrossDevice(src, dest, overwrite);
861
+ }
862
+ }
863
+ async function moveAcrossDevice(src, dest, overwrite) {
864
+ const opts = {
865
+ overwrite,
866
+ errorOnExist: true,
867
+ preserveTimestamps: true
868
+ };
869
+ await copy(src, dest, opts);
870
+ return remove(src);
871
+ }
872
+ module.exports = move;
873
+ },
874
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/output-file/index.js" (module, __unused_rspack_exports, __webpack_require__) {
875
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
876
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
877
+ const path = __webpack_require__("path");
878
+ const mkdir = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js");
879
+ const pathExists = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js").pathExists;
880
+ async function outputFile(file, data, encoding = 'utf-8') {
881
+ const dir = path.dirname(file);
882
+ if (!await pathExists(dir)) await mkdir.mkdirs(dir);
883
+ return fs.writeFile(file, data, encoding);
884
+ }
885
+ function outputFileSync(file, ...args) {
886
+ const dir = path.dirname(file);
887
+ if (!fs.existsSync(dir)) mkdir.mkdirsSync(dir);
888
+ fs.writeFileSync(file, ...args);
889
+ }
890
+ module.exports = {
891
+ outputFile: u(outputFile),
892
+ outputFileSync
893
+ };
894
+ },
895
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js" (module, __unused_rspack_exports, __webpack_require__) {
896
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
897
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
898
+ function pathExists(path) {
899
+ return fs.access(path).then(()=>true).catch(()=>false);
900
+ }
901
+ module.exports = {
902
+ pathExists: u(pathExists),
903
+ pathExistsSync: fs.existsSync
904
+ };
905
+ },
906
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js" (module, __unused_rspack_exports, __webpack_require__) {
907
+ const fs = __webpack_require__("../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js");
908
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromCallback;
909
+ function remove(path, callback) {
910
+ fs.rm(path, {
911
+ recursive: true,
912
+ force: true
913
+ }, callback);
914
+ }
915
+ function removeSync(path) {
916
+ fs.rmSync(path, {
917
+ recursive: true,
918
+ force: true
919
+ });
920
+ }
921
+ module.exports = {
922
+ remove: u(remove),
923
+ removeSync
924
+ };
925
+ },
926
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/async.js" (module) {
927
+ async function asyncIteratorConcurrentProcess(iterator, fn) {
928
+ const promises = [];
929
+ for await (const item of iterator)promises.push(fn(item).then(()=>null, (err)=>err ?? new Error('unknown error')));
930
+ await Promise.all(promises.map((promise)=>promise.then((possibleErr)=>{
931
+ if (null !== possibleErr) throw possibleErr;
932
+ })));
933
+ }
934
+ module.exports = {
935
+ asyncIteratorConcurrentProcess
936
+ };
937
+ },
938
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js" (module, __unused_rspack_exports, __webpack_require__) {
939
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
940
+ const path = __webpack_require__("path");
941
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
942
+ function getStats(src, dest, opts) {
943
+ const statFunc = opts.dereference ? (file)=>fs.stat(file, {
944
+ bigint: true
945
+ }) : (file)=>fs.lstat(file, {
946
+ bigint: true
947
+ });
948
+ return Promise.all([
949
+ statFunc(src),
950
+ statFunc(dest).catch((err)=>{
951
+ if ('ENOENT' === err.code) return null;
952
+ throw err;
953
+ })
954
+ ]).then(([srcStat, destStat])=>({
955
+ srcStat,
956
+ destStat
957
+ }));
958
+ }
959
+ function getStatsSync(src, dest, opts) {
960
+ let destStat;
961
+ const statFunc = opts.dereference ? (file)=>fs.statSync(file, {
962
+ bigint: true
963
+ }) : (file)=>fs.lstatSync(file, {
964
+ bigint: true
965
+ });
966
+ const srcStat = statFunc(src);
967
+ try {
968
+ destStat = statFunc(dest);
969
+ } catch (err) {
970
+ if ('ENOENT' === err.code) return {
971
+ srcStat,
972
+ destStat: null
973
+ };
974
+ throw err;
975
+ }
976
+ return {
977
+ srcStat,
978
+ destStat
979
+ };
980
+ }
981
+ async function checkPaths(src, dest, funcName, opts) {
982
+ const { srcStat, destStat } = await getStats(src, dest, opts);
983
+ if (destStat) {
984
+ if (areIdentical(srcStat, destStat)) {
985
+ const srcBaseName = path.basename(src);
986
+ const destBaseName = path.basename(dest);
987
+ if ('move' === funcName && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) return {
988
+ srcStat,
989
+ destStat,
990
+ isChangingCase: true
991
+ };
992
+ throw new Error('Source and destination must not be the same.');
993
+ }
994
+ if (srcStat.isDirectory() && !destStat.isDirectory()) throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
995
+ if (!srcStat.isDirectory() && destStat.isDirectory()) throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
996
+ }
997
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) throw new Error(errMsg(src, dest, funcName));
998
+ return {
999
+ srcStat,
1000
+ destStat
1001
+ };
1002
+ }
1003
+ function checkPathsSync(src, dest, funcName, opts) {
1004
+ const { srcStat, destStat } = getStatsSync(src, dest, opts);
1005
+ if (destStat) {
1006
+ if (areIdentical(srcStat, destStat)) {
1007
+ const srcBaseName = path.basename(src);
1008
+ const destBaseName = path.basename(dest);
1009
+ if ('move' === funcName && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) return {
1010
+ srcStat,
1011
+ destStat,
1012
+ isChangingCase: true
1013
+ };
1014
+ throw new Error('Source and destination must not be the same.');
1015
+ }
1016
+ if (srcStat.isDirectory() && !destStat.isDirectory()) throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1017
+ if (!srcStat.isDirectory() && destStat.isDirectory()) throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1018
+ }
1019
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) throw new Error(errMsg(src, dest, funcName));
1020
+ return {
1021
+ srcStat,
1022
+ destStat
1023
+ };
1024
+ }
1025
+ async function checkParentPaths(src, srcStat, dest, funcName) {
1026
+ const srcParent = path.resolve(path.dirname(src));
1027
+ const destParent = path.resolve(path.dirname(dest));
1028
+ if (destParent === srcParent || destParent === path.parse(destParent).root) return;
1029
+ let destStat;
1030
+ try {
1031
+ destStat = await fs.stat(destParent, {
1032
+ bigint: true
1033
+ });
1034
+ } catch (err) {
1035
+ if ('ENOENT' === err.code) return;
1036
+ throw err;
1037
+ }
1038
+ if (areIdentical(srcStat, destStat)) throw new Error(errMsg(src, dest, funcName));
1039
+ return checkParentPaths(src, srcStat, destParent, funcName);
1040
+ }
1041
+ function checkParentPathsSync(src, srcStat, dest, funcName) {
1042
+ const srcParent = path.resolve(path.dirname(src));
1043
+ const destParent = path.resolve(path.dirname(dest));
1044
+ if (destParent === srcParent || destParent === path.parse(destParent).root) return;
1045
+ let destStat;
1046
+ try {
1047
+ destStat = fs.statSync(destParent, {
1048
+ bigint: true
1049
+ });
1050
+ } catch (err) {
1051
+ if ('ENOENT' === err.code) return;
1052
+ throw err;
1053
+ }
1054
+ if (areIdentical(srcStat, destStat)) throw new Error(errMsg(src, dest, funcName));
1055
+ return checkParentPathsSync(src, srcStat, destParent, funcName);
1056
+ }
1057
+ function areIdentical(srcStat, destStat) {
1058
+ return void 0 !== destStat.ino && void 0 !== destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
1059
+ }
1060
+ function isSrcSubdir(src, dest) {
1061
+ const srcArr = path.resolve(src).split(path.sep).filter((i)=>i);
1062
+ const destArr = path.resolve(dest).split(path.sep).filter((i)=>i);
1063
+ return srcArr.every((cur, i)=>destArr[i] === cur);
1064
+ }
1065
+ function errMsg(src, dest, funcName) {
1066
+ return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
1067
+ }
1068
+ module.exports = {
1069
+ checkPaths: u(checkPaths),
1070
+ checkPathsSync,
1071
+ checkParentPaths: u(checkParentPaths),
1072
+ checkParentPathsSync,
1073
+ isSrcSubdir,
1074
+ areIdentical
1075
+ };
1076
+ },
1077
+ "../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/util/utimes.js" (module, __unused_rspack_exports, __webpack_require__) {
1078
+ const fs = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js");
1079
+ const u = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js").fromPromise;
1080
+ async function utimesMillis(path, atime, mtime) {
1081
+ const fd = await fs.open(path, 'r+');
1082
+ let closeErr = null;
1083
+ try {
1084
+ await fs.futimes(fd, atime, mtime);
1085
+ } finally{
1086
+ try {
1087
+ await fs.close(fd);
1088
+ } catch (e) {
1089
+ closeErr = e;
1090
+ }
1091
+ }
1092
+ if (closeErr) throw closeErr;
1093
+ }
1094
+ function utimesMillisSync(path, atime, mtime) {
1095
+ const fd = fs.openSync(path, 'r+');
1096
+ fs.futimesSync(fd, atime, mtime);
1097
+ return fs.closeSync(fd);
1098
+ }
1099
+ module.exports = {
1100
+ utimesMillis: u(utimesMillis),
1101
+ utimesMillisSync
1102
+ };
1103
+ },
1104
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js" (module) {
1105
+ module.exports = clone;
1106
+ var getPrototypeOf = Object.getPrototypeOf || function(obj) {
1107
+ return obj.__proto__;
1108
+ };
1109
+ function clone(obj) {
1110
+ if (null === obj || 'object' != typeof obj) return obj;
1111
+ if (obj instanceof Object) var copy = {
1112
+ __proto__: getPrototypeOf(obj)
1113
+ };
1114
+ else var copy = Object.create(null);
1115
+ Object.getOwnPropertyNames(obj).forEach(function(key) {
1116
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
1117
+ });
1118
+ return copy;
1119
+ }
1120
+ },
1121
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js" (module, __unused_rspack_exports, __webpack_require__) {
1122
+ var fs = __webpack_require__("fs");
1123
+ var polyfills = __webpack_require__("../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js");
1124
+ var legacy = __webpack_require__("../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js");
1125
+ var clone = __webpack_require__("../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js");
1126
+ var util = __webpack_require__("util");
1127
+ var gracefulQueue;
1128
+ var previousSymbol;
1129
+ if ('function' == typeof Symbol && 'function' == typeof Symbol.for) {
1130
+ gracefulQueue = Symbol.for('graceful-fs.queue');
1131
+ previousSymbol = Symbol.for('graceful-fs.previous');
1132
+ } else {
1133
+ gracefulQueue = '___graceful-fs.queue';
1134
+ previousSymbol = '___graceful-fs.previous';
1135
+ }
1136
+ function noop() {}
1137
+ function publishQueue(context, queue) {
1138
+ Object.defineProperty(context, gracefulQueue, {
1139
+ get: function() {
1140
+ return queue;
1141
+ }
1142
+ });
1143
+ }
1144
+ var debug = noop;
1145
+ if (util.debuglog) debug = util.debuglog('gfs4');
1146
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) debug = function() {
1147
+ var m = util.format.apply(util, arguments);
1148
+ m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ');
1149
+ console.error(m);
1150
+ };
1151
+ if (!fs[gracefulQueue]) {
1152
+ var queue = global[gracefulQueue] || [];
1153
+ publishQueue(fs, queue);
1154
+ fs.close = function(fs$close) {
1155
+ function close(fd, cb) {
1156
+ return fs$close.call(fs, fd, function(err) {
1157
+ if (!err) resetQueue();
1158
+ if ('function' == typeof cb) cb.apply(this, arguments);
1159
+ });
1160
+ }
1161
+ Object.defineProperty(close, previousSymbol, {
1162
+ value: fs$close
1163
+ });
1164
+ return close;
1165
+ }(fs.close);
1166
+ fs.closeSync = function(fs$closeSync) {
1167
+ function closeSync(fd) {
1168
+ fs$closeSync.apply(fs, arguments);
1169
+ resetQueue();
1170
+ }
1171
+ Object.defineProperty(closeSync, previousSymbol, {
1172
+ value: fs$closeSync
1173
+ });
1174
+ return closeSync;
1175
+ }(fs.closeSync);
1176
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) process.on('exit', function() {
1177
+ debug(fs[gracefulQueue]);
1178
+ __webpack_require__("assert").equal(fs[gracefulQueue].length, 0);
1179
+ });
1180
+ }
1181
+ if (!global[gracefulQueue]) publishQueue(global, fs[gracefulQueue]);
1182
+ module.exports = patch(clone(fs));
1183
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
1184
+ module.exports = patch(fs);
1185
+ fs.__patched = true;
1186
+ }
1187
+ function patch(fs) {
1188
+ polyfills(fs);
1189
+ fs.gracefulify = patch;
1190
+ fs.createReadStream = createReadStream;
1191
+ fs.createWriteStream = createWriteStream;
1192
+ var fs$readFile = fs.readFile;
1193
+ fs.readFile = readFile;
1194
+ function readFile(path, options, cb) {
1195
+ if ('function' == typeof options) cb = options, options = null;
1196
+ return go$readFile(path, options, cb);
1197
+ function go$readFile(path, options, cb, startTime) {
1198
+ return fs$readFile(path, options, function(err) {
1199
+ if (err && ('EMFILE' === err.code || 'ENFILE' === err.code)) enqueue([
1200
+ go$readFile,
1201
+ [
1202
+ path,
1203
+ options,
1204
+ cb
1205
+ ],
1206
+ err,
1207
+ startTime || Date.now(),
1208
+ Date.now()
1209
+ ]);
1210
+ else if ('function' == typeof cb) cb.apply(this, arguments);
1211
+ });
1212
+ }
1213
+ }
1214
+ var fs$writeFile = fs.writeFile;
1215
+ fs.writeFile = writeFile;
1216
+ function writeFile(path, data, options, cb) {
1217
+ if ('function' == typeof options) cb = options, options = null;
1218
+ return go$writeFile(path, data, options, cb);
1219
+ function go$writeFile(path, data, options, cb, startTime) {
1220
+ return fs$writeFile(path, data, options, function(err) {
1221
+ if (err && ('EMFILE' === err.code || 'ENFILE' === err.code)) enqueue([
1222
+ go$writeFile,
1223
+ [
1224
+ path,
1225
+ data,
1226
+ options,
1227
+ cb
1228
+ ],
1229
+ err,
1230
+ startTime || Date.now(),
1231
+ Date.now()
1232
+ ]);
1233
+ else if ('function' == typeof cb) cb.apply(this, arguments);
1234
+ });
1235
+ }
1236
+ }
1237
+ var fs$appendFile = fs.appendFile;
1238
+ if (fs$appendFile) fs.appendFile = appendFile;
1239
+ function appendFile(path, data, options, cb) {
1240
+ if ('function' == typeof options) cb = options, options = null;
1241
+ return go$appendFile(path, data, options, cb);
1242
+ function go$appendFile(path, data, options, cb, startTime) {
1243
+ return fs$appendFile(path, data, options, function(err) {
1244
+ if (err && ('EMFILE' === err.code || 'ENFILE' === err.code)) enqueue([
1245
+ go$appendFile,
1246
+ [
1247
+ path,
1248
+ data,
1249
+ options,
1250
+ cb
1251
+ ],
1252
+ err,
1253
+ startTime || Date.now(),
1254
+ Date.now()
1255
+ ]);
1256
+ else if ('function' == typeof cb) cb.apply(this, arguments);
1257
+ });
1258
+ }
1259
+ }
1260
+ var fs$copyFile = fs.copyFile;
1261
+ if (fs$copyFile) fs.copyFile = copyFile;
1262
+ function copyFile(src, dest, flags, cb) {
1263
+ if ('function' == typeof flags) {
1264
+ cb = flags;
1265
+ flags = 0;
1266
+ }
1267
+ return go$copyFile(src, dest, flags, cb);
1268
+ function go$copyFile(src, dest, flags, cb, startTime) {
1269
+ return fs$copyFile(src, dest, flags, function(err) {
1270
+ if (err && ('EMFILE' === err.code || 'ENFILE' === err.code)) enqueue([
1271
+ go$copyFile,
1272
+ [
1273
+ src,
1274
+ dest,
1275
+ flags,
1276
+ cb
1277
+ ],
1278
+ err,
1279
+ startTime || Date.now(),
1280
+ Date.now()
1281
+ ]);
1282
+ else if ('function' == typeof cb) cb.apply(this, arguments);
1283
+ });
1284
+ }
1285
+ }
1286
+ var fs$readdir = fs.readdir;
1287
+ fs.readdir = readdir;
1288
+ var noReaddirOptionVersions = /^v[0-5]\./;
1289
+ function readdir(path, options, cb) {
1290
+ if ('function' == typeof options) cb = options, options = null;
1291
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function(path, options, cb, startTime) {
1292
+ return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
1293
+ } : function(path, options, cb, startTime) {
1294
+ return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
1295
+ };
1296
+ return go$readdir(path, options, cb);
1297
+ function fs$readdirCallback(path, options, cb, startTime) {
1298
+ return function(err, files) {
1299
+ if (err && ('EMFILE' === err.code || 'ENFILE' === err.code)) enqueue([
1300
+ go$readdir,
1301
+ [
1302
+ path,
1303
+ options,
1304
+ cb
1305
+ ],
1306
+ err,
1307
+ startTime || Date.now(),
1308
+ Date.now()
1309
+ ]);
1310
+ else {
1311
+ if (files && files.sort) files.sort();
1312
+ if ('function' == typeof cb) cb.call(this, err, files);
1313
+ }
1314
+ };
1315
+ }
1316
+ }
1317
+ if ('v0.8' === process.version.substr(0, 4)) {
1318
+ var legStreams = legacy(fs);
1319
+ ReadStream = legStreams.ReadStream;
1320
+ WriteStream = legStreams.WriteStream;
1321
+ }
1322
+ var fs$ReadStream = fs.ReadStream;
1323
+ if (fs$ReadStream) {
1324
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype);
1325
+ ReadStream.prototype.open = ReadStream$open;
1326
+ }
1327
+ var fs$WriteStream = fs.WriteStream;
1328
+ if (fs$WriteStream) {
1329
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
1330
+ WriteStream.prototype.open = WriteStream$open;
1331
+ }
1332
+ Object.defineProperty(fs, 'ReadStream', {
1333
+ get: function() {
1334
+ return ReadStream;
1335
+ },
1336
+ set: function(val) {
1337
+ ReadStream = val;
1338
+ },
1339
+ enumerable: true,
1340
+ configurable: true
1341
+ });
1342
+ Object.defineProperty(fs, 'WriteStream', {
1343
+ get: function() {
1344
+ return WriteStream;
1345
+ },
1346
+ set: function(val) {
1347
+ WriteStream = val;
1348
+ },
1349
+ enumerable: true,
1350
+ configurable: true
1351
+ });
1352
+ var FileReadStream = ReadStream;
1353
+ Object.defineProperty(fs, 'FileReadStream', {
1354
+ get: function() {
1355
+ return FileReadStream;
1356
+ },
1357
+ set: function(val) {
1358
+ FileReadStream = val;
1359
+ },
1360
+ enumerable: true,
1361
+ configurable: true
1362
+ });
1363
+ var FileWriteStream = WriteStream;
1364
+ Object.defineProperty(fs, 'FileWriteStream', {
1365
+ get: function() {
1366
+ return FileWriteStream;
1367
+ },
1368
+ set: function(val) {
1369
+ FileWriteStream = val;
1370
+ },
1371
+ enumerable: true,
1372
+ configurable: true
1373
+ });
1374
+ function ReadStream(path, options) {
1375
+ if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
1376
+ return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
1377
+ }
1378
+ function ReadStream$open() {
1379
+ var that = this;
1380
+ open(that.path, that.flags, that.mode, function(err, fd) {
1381
+ if (err) {
1382
+ if (that.autoClose) that.destroy();
1383
+ that.emit('error', err);
1384
+ } else {
1385
+ that.fd = fd;
1386
+ that.emit('open', fd);
1387
+ that.read();
1388
+ }
1389
+ });
1390
+ }
1391
+ function WriteStream(path, options) {
1392
+ if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
1393
+ return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
1394
+ }
1395
+ function WriteStream$open() {
1396
+ var that = this;
1397
+ open(that.path, that.flags, that.mode, function(err, fd) {
1398
+ if (err) {
1399
+ that.destroy();
1400
+ that.emit('error', err);
1401
+ } else {
1402
+ that.fd = fd;
1403
+ that.emit('open', fd);
1404
+ }
1405
+ });
1406
+ }
1407
+ function createReadStream(path, options) {
1408
+ return new fs.ReadStream(path, options);
1409
+ }
1410
+ function createWriteStream(path, options) {
1411
+ return new fs.WriteStream(path, options);
1412
+ }
1413
+ var fs$open = fs.open;
1414
+ fs.open = open;
1415
+ function open(path, flags, mode, cb) {
1416
+ if ('function' == typeof mode) cb = mode, mode = null;
1417
+ return go$open(path, flags, mode, cb);
1418
+ function go$open(path, flags, mode, cb, startTime) {
1419
+ return fs$open(path, flags, mode, function(err, fd) {
1420
+ if (err && ('EMFILE' === err.code || 'ENFILE' === err.code)) enqueue([
1421
+ go$open,
1422
+ [
1423
+ path,
1424
+ flags,
1425
+ mode,
1426
+ cb
1427
+ ],
1428
+ err,
1429
+ startTime || Date.now(),
1430
+ Date.now()
1431
+ ]);
1432
+ else if ('function' == typeof cb) cb.apply(this, arguments);
1433
+ });
1434
+ }
1435
+ }
1436
+ return fs;
1437
+ }
1438
+ function enqueue(elem) {
1439
+ debug('ENQUEUE', elem[0].name, elem[1]);
1440
+ fs[gracefulQueue].push(elem);
1441
+ retry();
1442
+ }
1443
+ var retryTimer;
1444
+ function resetQueue() {
1445
+ var now = Date.now();
1446
+ for(var i = 0; i < fs[gracefulQueue].length; ++i)if (fs[gracefulQueue][i].length > 2) {
1447
+ fs[gracefulQueue][i][3] = now;
1448
+ fs[gracefulQueue][i][4] = now;
1449
+ }
1450
+ retry();
1451
+ }
1452
+ function retry() {
1453
+ clearTimeout(retryTimer);
1454
+ retryTimer = void 0;
1455
+ if (0 === fs[gracefulQueue].length) return;
1456
+ var elem = fs[gracefulQueue].shift();
1457
+ var fn = elem[0];
1458
+ var args = elem[1];
1459
+ var err = elem[2];
1460
+ var startTime = elem[3];
1461
+ var lastTime = elem[4];
1462
+ if (void 0 === startTime) {
1463
+ debug('RETRY', fn.name, args);
1464
+ fn.apply(null, args);
1465
+ } else if (Date.now() - startTime >= 60000) {
1466
+ debug('TIMEOUT', fn.name, args);
1467
+ var cb = args.pop();
1468
+ if ('function' == typeof cb) cb.call(null, err);
1469
+ } else {
1470
+ var sinceAttempt = Date.now() - lastTime;
1471
+ var sinceStart = Math.max(lastTime - startTime, 1);
1472
+ var desiredDelay = Math.min(1.2 * sinceStart, 100);
1473
+ if (sinceAttempt >= desiredDelay) {
1474
+ debug('RETRY', fn.name, args);
1475
+ fn.apply(null, args.concat([
1476
+ startTime
1477
+ ]));
1478
+ } else fs[gracefulQueue].push(elem);
1479
+ }
1480
+ if (void 0 === retryTimer) retryTimer = setTimeout(retry, 0);
1481
+ }
1482
+ },
1483
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js" (module, __unused_rspack_exports, __webpack_require__) {
1484
+ var Stream = __webpack_require__("stream").Stream;
1485
+ module.exports = legacy;
1486
+ function legacy(fs) {
1487
+ return {
1488
+ ReadStream: ReadStream,
1489
+ WriteStream: WriteStream
1490
+ };
1491
+ function ReadStream(path, options) {
1492
+ if (!(this instanceof ReadStream)) return new ReadStream(path, options);
1493
+ Stream.call(this);
1494
+ var self = this;
1495
+ this.path = path;
1496
+ this.fd = null;
1497
+ this.readable = true;
1498
+ this.paused = false;
1499
+ this.flags = 'r';
1500
+ this.mode = 438;
1501
+ this.bufferSize = 65536;
1502
+ options = options || {};
1503
+ var keys = Object.keys(options);
1504
+ for(var index = 0, length = keys.length; index < length; index++){
1505
+ var key = keys[index];
1506
+ this[key] = options[key];
1507
+ }
1508
+ if (this.encoding) this.setEncoding(this.encoding);
1509
+ if (void 0 !== this.start) {
1510
+ if ('number' != typeof this.start) throw TypeError('start must be a Number');
1511
+ if (void 0 === this.end) this.end = 1 / 0;
1512
+ else if ('number' != typeof this.end) throw TypeError('end must be a Number');
1513
+ if (this.start > this.end) throw new Error('start must be <= end');
1514
+ this.pos = this.start;
1515
+ }
1516
+ if (null !== this.fd) return void process.nextTick(function() {
1517
+ self._read();
1518
+ });
1519
+ fs.open(this.path, this.flags, this.mode, function(err, fd) {
1520
+ if (err) {
1521
+ self.emit('error', err);
1522
+ self.readable = false;
1523
+ return;
1524
+ }
1525
+ self.fd = fd;
1526
+ self.emit('open', fd);
1527
+ self._read();
1528
+ });
1529
+ }
1530
+ function WriteStream(path, options) {
1531
+ if (!(this instanceof WriteStream)) return new WriteStream(path, options);
1532
+ Stream.call(this);
1533
+ this.path = path;
1534
+ this.fd = null;
1535
+ this.writable = true;
1536
+ this.flags = 'w';
1537
+ this.encoding = 'binary';
1538
+ this.mode = 438;
1539
+ this.bytesWritten = 0;
1540
+ options = options || {};
1541
+ var keys = Object.keys(options);
1542
+ for(var index = 0, length = keys.length; index < length; index++){
1543
+ var key = keys[index];
1544
+ this[key] = options[key];
1545
+ }
1546
+ if (void 0 !== this.start) {
1547
+ if ('number' != typeof this.start) throw TypeError('start must be a Number');
1548
+ if (this.start < 0) throw new Error('start must be >= zero');
1549
+ this.pos = this.start;
1550
+ }
1551
+ this.busy = false;
1552
+ this._queue = [];
1553
+ if (null === this.fd) {
1554
+ this._open = fs.open;
1555
+ this._queue.push([
1556
+ this._open,
1557
+ this.path,
1558
+ this.flags,
1559
+ this.mode,
1560
+ void 0
1561
+ ]);
1562
+ this.flush();
1563
+ }
1564
+ }
1565
+ }
1566
+ },
1567
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js" (module, __unused_rspack_exports, __webpack_require__) {
1568
+ var constants = __webpack_require__("constants");
1569
+ var origCwd = process.cwd;
1570
+ var cwd = null;
1571
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
1572
+ process.cwd = function() {
1573
+ if (!cwd) cwd = origCwd.call(process);
1574
+ return cwd;
1575
+ };
1576
+ try {
1577
+ process.cwd();
1578
+ } catch (er) {}
1579
+ if ('function' == typeof process.chdir) {
1580
+ var chdir = process.chdir;
1581
+ process.chdir = function(d) {
1582
+ cwd = null;
1583
+ chdir.call(process, d);
1584
+ };
1585
+ if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
1586
+ }
1587
+ module.exports = patch;
1588
+ function patch(fs) {
1589
+ if (constants.hasOwnProperty('O_SYMLINK') && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
1590
+ if (!fs.lutimes) patchLutimes(fs);
1591
+ fs.chown = chownFix(fs.chown);
1592
+ fs.fchown = chownFix(fs.fchown);
1593
+ fs.lchown = chownFix(fs.lchown);
1594
+ fs.chmod = chmodFix(fs.chmod);
1595
+ fs.fchmod = chmodFix(fs.fchmod);
1596
+ fs.lchmod = chmodFix(fs.lchmod);
1597
+ fs.chownSync = chownFixSync(fs.chownSync);
1598
+ fs.fchownSync = chownFixSync(fs.fchownSync);
1599
+ fs.lchownSync = chownFixSync(fs.lchownSync);
1600
+ fs.chmodSync = chmodFixSync(fs.chmodSync);
1601
+ fs.fchmodSync = chmodFixSync(fs.fchmodSync);
1602
+ fs.lchmodSync = chmodFixSync(fs.lchmodSync);
1603
+ fs.stat = statFix(fs.stat);
1604
+ fs.fstat = statFix(fs.fstat);
1605
+ fs.lstat = statFix(fs.lstat);
1606
+ fs.statSync = statFixSync(fs.statSync);
1607
+ fs.fstatSync = statFixSync(fs.fstatSync);
1608
+ fs.lstatSync = statFixSync(fs.lstatSync);
1609
+ if (fs.chmod && !fs.lchmod) {
1610
+ fs.lchmod = function(path, mode, cb) {
1611
+ if (cb) process.nextTick(cb);
1612
+ };
1613
+ fs.lchmodSync = function() {};
1614
+ }
1615
+ if (fs.chown && !fs.lchown) {
1616
+ fs.lchown = function(path, uid, gid, cb) {
1617
+ if (cb) process.nextTick(cb);
1618
+ };
1619
+ fs.lchownSync = function() {};
1620
+ }
1621
+ if ("win32" === platform) fs.rename = 'function' != typeof fs.rename ? fs.rename : function(fs$rename) {
1622
+ function rename(from, to, cb) {
1623
+ var start = Date.now();
1624
+ var backoff = 0;
1625
+ fs$rename(from, to, function CB(er) {
1626
+ if (er && ("EACCES" === er.code || "EPERM" === er.code || "EBUSY" === er.code) && Date.now() - start < 60000) {
1627
+ setTimeout(function() {
1628
+ fs.stat(to, function(stater, st) {
1629
+ if (stater && "ENOENT" === stater.code) fs$rename(from, to, CB);
1630
+ else cb(er);
1631
+ });
1632
+ }, backoff);
1633
+ if (backoff < 100) backoff += 10;
1634
+ return;
1635
+ }
1636
+ if (cb) cb(er);
1637
+ });
1638
+ }
1639
+ if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
1640
+ return rename;
1641
+ }(fs.rename);
1642
+ fs.read = 'function' != typeof fs.read ? fs.read : function(fs$read) {
1643
+ function read(fd, buffer, offset, length, position, callback_) {
1644
+ var callback;
1645
+ if (callback_ && 'function' == typeof callback_) {
1646
+ var eagCounter = 0;
1647
+ callback = function(er, _, __) {
1648
+ if (er && 'EAGAIN' === er.code && eagCounter < 10) {
1649
+ eagCounter++;
1650
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback);
1651
+ }
1652
+ callback_.apply(this, arguments);
1653
+ };
1654
+ }
1655
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback);
1656
+ }
1657
+ if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
1658
+ return read;
1659
+ }(fs.read);
1660
+ fs.readSync = 'function' != typeof fs.readSync ? fs.readSync : function(fs$readSync) {
1661
+ return function(fd, buffer, offset, length, position) {
1662
+ var eagCounter = 0;
1663
+ while(true)try {
1664
+ return fs$readSync.call(fs, fd, buffer, offset, length, position);
1665
+ } catch (er) {
1666
+ if ('EAGAIN' === er.code && eagCounter < 10) {
1667
+ eagCounter++;
1668
+ continue;
1669
+ }
1670
+ throw er;
1671
+ }
1672
+ };
1673
+ }(fs.readSync);
1674
+ function patchLchmod(fs) {
1675
+ fs.lchmod = function(path, mode, callback) {
1676
+ fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
1677
+ if (err) {
1678
+ if (callback) callback(err);
1679
+ return;
1680
+ }
1681
+ fs.fchmod(fd, mode, function(err) {
1682
+ fs.close(fd, function(err2) {
1683
+ if (callback) callback(err || err2);
1684
+ });
1685
+ });
1686
+ });
1687
+ };
1688
+ fs.lchmodSync = function(path, mode) {
1689
+ var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
1690
+ var threw = true;
1691
+ var ret;
1692
+ try {
1693
+ ret = fs.fchmodSync(fd, mode);
1694
+ threw = false;
1695
+ } finally{
1696
+ if (threw) try {
1697
+ fs.closeSync(fd);
1698
+ } catch (er) {}
1699
+ else fs.closeSync(fd);
1700
+ }
1701
+ return ret;
1702
+ };
1703
+ }
1704
+ function patchLutimes(fs) {
1705
+ if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
1706
+ fs.lutimes = function(path, at, mt, cb) {
1707
+ fs.open(path, constants.O_SYMLINK, function(er, fd) {
1708
+ if (er) {
1709
+ if (cb) cb(er);
1710
+ return;
1711
+ }
1712
+ fs.futimes(fd, at, mt, function(er) {
1713
+ fs.close(fd, function(er2) {
1714
+ if (cb) cb(er || er2);
1715
+ });
1716
+ });
1717
+ });
1718
+ };
1719
+ fs.lutimesSync = function(path, at, mt) {
1720
+ var fd = fs.openSync(path, constants.O_SYMLINK);
1721
+ var ret;
1722
+ var threw = true;
1723
+ try {
1724
+ ret = fs.futimesSync(fd, at, mt);
1725
+ threw = false;
1726
+ } finally{
1727
+ if (threw) try {
1728
+ fs.closeSync(fd);
1729
+ } catch (er) {}
1730
+ else fs.closeSync(fd);
1731
+ }
1732
+ return ret;
1733
+ };
1734
+ } else if (fs.futimes) {
1735
+ fs.lutimes = function(_a, _b, _c, cb) {
1736
+ if (cb) process.nextTick(cb);
1737
+ };
1738
+ fs.lutimesSync = function() {};
1739
+ }
1740
+ }
1741
+ function chmodFix(orig) {
1742
+ if (!orig) return orig;
1743
+ return function(target, mode, cb) {
1744
+ return orig.call(fs, target, mode, function(er) {
1745
+ if (chownErOk(er)) er = null;
1746
+ if (cb) cb.apply(this, arguments);
1747
+ });
1748
+ };
1749
+ }
1750
+ function chmodFixSync(orig) {
1751
+ if (!orig) return orig;
1752
+ return function(target, mode) {
1753
+ try {
1754
+ return orig.call(fs, target, mode);
1755
+ } catch (er) {
1756
+ if (!chownErOk(er)) throw er;
1757
+ }
1758
+ };
1759
+ }
1760
+ function chownFix(orig) {
1761
+ if (!orig) return orig;
1762
+ return function(target, uid, gid, cb) {
1763
+ return orig.call(fs, target, uid, gid, function(er) {
1764
+ if (chownErOk(er)) er = null;
1765
+ if (cb) cb.apply(this, arguments);
1766
+ });
1767
+ };
1768
+ }
1769
+ function chownFixSync(orig) {
1770
+ if (!orig) return orig;
1771
+ return function(target, uid, gid) {
1772
+ try {
1773
+ return orig.call(fs, target, uid, gid);
1774
+ } catch (er) {
1775
+ if (!chownErOk(er)) throw er;
1776
+ }
1777
+ };
1778
+ }
1779
+ function statFix(orig) {
1780
+ if (!orig) return orig;
1781
+ return function(target, options, cb) {
1782
+ if ('function' == typeof options) {
1783
+ cb = options;
1784
+ options = null;
1785
+ }
1786
+ function callback(er, stats) {
1787
+ if (stats) {
1788
+ if (stats.uid < 0) stats.uid += 0x100000000;
1789
+ if (stats.gid < 0) stats.gid += 0x100000000;
1790
+ }
1791
+ if (cb) cb.apply(this, arguments);
1792
+ }
1793
+ return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
1794
+ };
1795
+ }
1796
+ function statFixSync(orig) {
1797
+ if (!orig) return orig;
1798
+ return function(target, options) {
1799
+ var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
1800
+ if (stats) {
1801
+ if (stats.uid < 0) stats.uid += 0x100000000;
1802
+ if (stats.gid < 0) stats.gid += 0x100000000;
1803
+ }
1804
+ return stats;
1805
+ };
1806
+ }
1807
+ function chownErOk(er) {
1808
+ if (!er) return true;
1809
+ if ("ENOSYS" === er.code) return true;
1810
+ var nonroot = !process.getuid || 0 !== process.getuid();
1811
+ if (nonroot) {
1812
+ if ("EINVAL" === er.code || "EPERM" === er.code) return true;
1813
+ }
1814
+ return false;
1815
+ }
1816
+ }
1817
+ },
1818
+ "../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/index.js" (module, __unused_rspack_exports, __webpack_require__) {
1819
+ let _fs;
1820
+ try {
1821
+ _fs = __webpack_require__("../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js");
1822
+ } catch (_) {
1823
+ _fs = __webpack_require__("fs");
1824
+ }
1825
+ const universalify = __webpack_require__("../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js");
1826
+ const { stringify, stripBom } = __webpack_require__("../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js");
1827
+ async function _readFile(file, options = {}) {
1828
+ if ('string' == typeof options) options = {
1829
+ encoding: options
1830
+ };
1831
+ const fs = options.fs || _fs;
1832
+ const shouldThrow = 'throws' in options ? options.throws : true;
1833
+ let data = await universalify.fromCallback(fs.readFile)(file, options);
1834
+ data = stripBom(data);
1835
+ let obj;
1836
+ try {
1837
+ obj = JSON.parse(data, options ? options.reviver : null);
1838
+ } catch (err) {
1839
+ if (!shouldThrow) return null;
1840
+ err.message = `${file}: ${err.message}`;
1841
+ throw err;
1842
+ }
1843
+ return obj;
1844
+ }
1845
+ const readFile = universalify.fromPromise(_readFile);
1846
+ function readFileSync(file, options = {}) {
1847
+ if ('string' == typeof options) options = {
1848
+ encoding: options
1849
+ };
1850
+ const fs = options.fs || _fs;
1851
+ const shouldThrow = 'throws' in options ? options.throws : true;
1852
+ try {
1853
+ let content = fs.readFileSync(file, options);
1854
+ content = stripBom(content);
1855
+ return JSON.parse(content, options.reviver);
1856
+ } catch (err) {
1857
+ if (!shouldThrow) return null;
1858
+ err.message = `${file}: ${err.message}`;
1859
+ throw err;
1860
+ }
1861
+ }
1862
+ async function _writeFile(file, obj, options = {}) {
1863
+ const fs = options.fs || _fs;
1864
+ const str = stringify(obj, options);
1865
+ await universalify.fromCallback(fs.writeFile)(file, str, options);
1866
+ }
1867
+ const writeFile = universalify.fromPromise(_writeFile);
1868
+ function writeFileSync(file, obj, options = {}) {
1869
+ const fs = options.fs || _fs;
1870
+ const str = stringify(obj, options);
1871
+ return fs.writeFileSync(file, str, options);
1872
+ }
1873
+ module.exports = {
1874
+ readFile,
1875
+ readFileSync,
1876
+ writeFile,
1877
+ writeFileSync
1878
+ };
1879
+ },
1880
+ "../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js" (module) {
1881
+ function stringify(obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) {
1882
+ const EOF = finalEOL ? EOL : '';
1883
+ const str = JSON.stringify(obj, replacer, spaces);
1884
+ return str.replace(/\n/g, EOL) + EOF;
1885
+ }
1886
+ function stripBom(content) {
1887
+ if (Buffer.isBuffer(content)) content = content.toString('utf8');
1888
+ return content.replace(/^\uFEFF/, '');
1889
+ }
1890
+ module.exports = {
1891
+ stringify,
1892
+ stripBom
1893
+ };
1894
+ },
1895
+ "../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js" (__unused_rspack_module, exports) {
1896
+ exports.fromCallback = function(fn) {
1897
+ return Object.defineProperty(function(...args) {
1898
+ if ('function' != typeof args[args.length - 1]) return new Promise((resolve, reject)=>{
1899
+ args.push((err, res)=>null != err ? reject(err) : resolve(res));
1900
+ fn.apply(this, args);
1901
+ });
1902
+ fn.apply(this, args);
1903
+ }, 'name', {
1904
+ value: fn.name
1905
+ });
1906
+ };
1907
+ exports.fromPromise = function(fn) {
1908
+ return Object.defineProperty(function(...args) {
1909
+ const cb = args[args.length - 1];
1910
+ if ('function' != typeof cb) return fn.apply(this, args);
1911
+ args.pop();
1912
+ fn.apply(this, args).then((r)=>cb(null, r), cb);
1913
+ }, 'name', {
1914
+ value: fn.name
1915
+ });
1916
+ };
1917
+ },
1918
+ assert (module) {
1919
+ module.exports = __rspack_createRequire_require("assert");
1920
+ },
1921
+ constants (module) {
1922
+ module.exports = __rspack_createRequire_require("constants");
1923
+ },
1924
+ fs (module) {
1925
+ module.exports = __rspack_createRequire_require("fs");
1926
+ },
1927
+ path (module) {
1928
+ module.exports = __rspack_createRequire_require("path");
1929
+ },
1930
+ stream (module) {
1931
+ module.exports = __rspack_createRequire_require("stream");
1932
+ },
1933
+ util (module) {
1934
+ module.exports = __rspack_createRequire_require("util");
1935
+ }
1936
+ });
4
1937
  var Module = function(moduleArg = {}) {
5
1938
  var moduleRtn;
6
1939
  var f = moduleArg, g, m = new Promise((a)=>{
@@ -242,27 +2175,35 @@ function begin_chunk(config) {
242
2175
  try {
243
2176
  similarity_stub_module._begin_chunk(ptr_buf, config.MAX_DIST, config.MAX_COSINE, config.TRIM_PINYIN, config.CROSS_MODE);
244
2177
  } catch (error) {
245
- throw new Error(`wasm error (begin_chunk):\n${error}`);
2178
+ throw new Error(`wasm error (begin_chunk):\n${error}`, {
2179
+ cause: error
2180
+ });
246
2181
  }
247
2182
  }
248
2183
  function begin_index_lock() {
249
2184
  try {
250
2185
  similarity_stub_module._begin_index_lock();
251
2186
  } catch (error) {
252
- throw new Error(`wasm error (begin_index_lock):\n${error}`);
2187
+ throw new Error(`wasm error (begin_index_lock):\n${error}`, {
2188
+ cause: error
2189
+ });
253
2190
  }
254
2191
  }
255
2192
  function detect_similarity(str, mode, index_l, S) {
256
2193
  try {
257
2194
  similarity_stub_module.stringToUTF16(str, ptr_buf, 2 * MAX_STRING_LEN);
258
2195
  } catch (error) {
259
- throw new Error(`wasm error (write str buf): ${str}\n${error}`);
2196
+ throw new Error(`wasm error (write str buf): ${str}\n${error}`, {
2197
+ cause: error
2198
+ });
260
2199
  }
261
2200
  let ret;
262
2201
  try {
263
2202
  ret = similarity_stub_module._check_similar(mode, index_l);
264
2203
  } catch (error) {
265
- throw new Error(`wasm error (similar): ${str}\n${error}`);
2204
+ throw new Error(`wasm error (similar): ${str}\n${error}`, {
2205
+ cause: error
2206
+ });
266
2207
  }
267
2208
  if (0 === ret) return null;
268
2209
  ret >>>= 0;
@@ -295,7 +2236,24 @@ function detect_similarity(str, mode, index_l, S) {
295
2236
  idx_diff
296
2237
  };
297
2238
  }
298
- var _computedKey;
2239
+ function _to_primitive(input, hint) {
2240
+ if ("object" !== _type_of(input) || null === input) return input;
2241
+ var prim = input[Symbol.toPrimitive];
2242
+ if (void 0 !== prim) {
2243
+ var res = prim.call(input, hint || "default");
2244
+ if ("object" !== _type_of(res)) return res;
2245
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2246
+ }
2247
+ return ("string" === hint ? String : Number)(input);
2248
+ }
2249
+ function _to_property_key(arg) {
2250
+ var key = _to_primitive(arg, "string");
2251
+ return "symbol" === _type_of(key) ? key : String(key);
2252
+ }
2253
+ function _type_of(obj) {
2254
+ return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
2255
+ }
2256
+ let _computedKey;
299
2257
  class Stats {
300
2258
  combined_identical = 0;
301
2259
  combined_edit_distance = 0;
@@ -307,7 +2265,7 @@ class Stats {
307
2265
  ignored_type = 0;
308
2266
  num_taolu_matched = 0;
309
2267
  }
310
- _computedKey = Symbol.iterator;
2268
+ _computedKey = _to_property_key(Symbol.iterator);
311
2269
  class Queue {
312
2270
  storage;
313
2271
  index_l;
@@ -349,6 +2307,8 @@ class Queue {
349
2307
  };
350
2308
  }
351
2309
  }
2310
+ const lib = __webpack_require__("../../node_modules/.pnpm/fs-extra@11.3.4/node_modules/fs-extra/lib/index.js");
2311
+ var lib_default = /*#__PURE__*/ __webpack_require__.n(lib);
352
2312
  /**
353
2313
  * @author: xmcp(代码主要逻辑来源)
354
2314
  * @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/core/combine_worker.ts
@@ -482,55 +2442,57 @@ const WIDTH_TABLE = new Map(Object.entries({
482
2442
  N: 'N',
483
2443
  M: 'M'
484
2444
  }));
485
- const detaolu = (inp, config)=>{
2445
+ function detaolu_meta(config) {
486
2446
  const TRIM_ENDING = config.TRIM_ENDING;
487
2447
  const TRIM_SPACE = config.TRIM_SPACE;
488
2448
  const TRIM_WIDTH = config.TRIM_WIDTH;
489
- const FORCELIST = (config?.FORCELIST ?? DEFAULT_CONFIG.FORCELIST).map(([pattern, repl])=>[
2449
+ const FORCELIST = config.FORCELIST.map(([pattern, repl])=>[
490
2450
  new RegExp(pattern, 'giu'),
491
2451
  repl
492
2452
  ]);
493
2453
  const FORCELIST_BREAK_ON_MATCH = !config.FORCELIST_CONTINUE_ON_MATCH;
494
- let len = inp.length;
495
- let text = '';
496
- if (TRIM_ENDING) {
497
- while(ENDING_CHARS.has(inp.charAt(len - 1)))len--;
498
- if (0 === len) len = inp.length;
499
- }
500
- if (TRIM_WIDTH) for(let i = 0; i < len; i++){
501
- const c = inp.charAt(i);
502
- text += WIDTH_TABLE.get(c) || c;
503
- }
504
- else text = inp.slice(0, len);
505
- if (TRIM_SPACE) text = text.replaceAll(/[ \u3000]+/g, ' ').replaceAll(/([\u3000-\u9FFF\uFF00-\uFFEF]) (?=[\u3000-\u9FFF\uFF00-\uFFEF])/g, '$1');
506
- let taolu_matched = false;
507
- for (const taolu of FORCELIST)if (taolu[0].test(text)) {
508
- text = text.replace(taolu[0], taolu[1]);
509
- taolu_matched = true;
510
- if (FORCELIST_BREAK_ON_MATCH) break;
511
- }
512
- return [
513
- taolu_matched,
514
- text
515
- ];
516
- };
517
- const whitelisted = (text, config)=>{
518
- const WHITELIST = (config?.WHITELIST ?? DEFAULT_CONFIG.WHITELIST).map((x)=>new RegExp(x[0], 'iu'));
519
- if (0 === WHITELIST.length) return false;
520
- return WHITELIST.some((re)=>re.test(text));
521
- };
522
- const blacklisted = (text, config)=>{
523
- const BLACKLIST = (config?.BLACKLIST ?? DEFAULT_CONFIG.BLACKLIST).map((x)=>x[0] ? new RegExp(x[1]) : x[1].toLowerCase());
524
- if (0 === BLACKLIST.length) return null;
525
- {
2454
+ return (inp)=>{
2455
+ let len = inp.length;
2456
+ let text = '';
2457
+ if (TRIM_ENDING) {
2458
+ while(ENDING_CHARS.has(inp.charAt(len - 1)))len--;
2459
+ if (0 === len) len = inp.length;
2460
+ }
2461
+ if (TRIM_WIDTH) for(let i = 0; i < len; i++){
2462
+ const c = inp.charAt(i);
2463
+ text += WIDTH_TABLE.get(c) || c;
2464
+ }
2465
+ else text = inp.slice(0, len);
2466
+ if (TRIM_SPACE) text = text.replaceAll(/[ \u3000]+/g, ' ').replaceAll(/([\u3000-\u9FFF\uFF00-\uFFEF]) (?=[\u3000-\u9FFF\uFF00-\uFFEF])/g, '$1');
2467
+ let taolu_matched = false;
2468
+ for (const taolu of FORCELIST)if (taolu[0].test(text)) {
2469
+ text = text.replace(taolu[0], taolu[1]);
2470
+ taolu_matched = true;
2471
+ if (FORCELIST_BREAK_ON_MATCH) break;
2472
+ }
2473
+ return [
2474
+ taolu_matched,
2475
+ text
2476
+ ];
2477
+ };
2478
+ }
2479
+ function whitelisted_meta(config) {
2480
+ const WHITELIST = config.WHITELIST.map((x)=>new RegExp(x[0], 'iu'));
2481
+ if (0 === WHITELIST.length) return ()=>false;
2482
+ return (text)=>WHITELIST.some((re)=>re.test(text));
2483
+ }
2484
+ function blacklisted_meta(config) {
2485
+ const BLACKLIST = config.BLACKLIST.map((x)=>x[0] ? new RegExp(x[1]) : x[1].toLowerCase());
2486
+ if (0 === BLACKLIST.length) return ()=>null;
2487
+ return (text)=>{
526
2488
  const lower = text.toLowerCase();
527
2489
  for (const pattern of BLACKLIST){
528
2490
  const matched = 'string' == typeof pattern ? lower.includes(pattern) : pattern.test(text);
529
2491
  if (matched) return 'string' == typeof pattern ? ` ${pattern}` : ` /${pattern.source}/`;
530
2492
  }
531
2493
  return null;
532
- }
533
- };
2494
+ };
2495
+ }
534
2496
  function extract_special_danmu(text) {
535
2497
  try {
536
2498
  text = JSON.parse(text)[4];
@@ -546,15 +2508,25 @@ function select_median_length(strs) {
546
2508
  const mid = Math.floor(sorted.length / 2);
547
2509
  return sorted[mid];
548
2510
  }
2511
+ function u8array_to_arraybuffer(array) {
2512
+ return array.buffer.slice(array.byteOffset, array.byteOffset + array.byteLength);
2513
+ }
549
2514
  async function load_wasm(wasm_mod) {
550
- await similarity_stub_init(wasm_mod ?? await fs_extra.readFile(new URL('similarity-gen.wasm', import.meta.url)));
2515
+ if (wasm_mod) return void await similarity_stub_init(wasm_mod);
2516
+ const wasm_path = new URL('similarity-gen.wasm', import.meta.url).pathname;
2517
+ const wasm_u8 = await lib_default().readFile(wasm_path);
2518
+ await similarity_stub_init(u8array_to_arraybuffer(wasm_u8));
551
2519
  }
552
2520
  function make_ptr_idx(idx, is_next_chunk) {
553
2521
  return is_next_chunk ? -1 - idx : idx;
554
2522
  }
555
2523
  async function merge(chunk, config = DEFAULT_CONFIG) {
2524
+ const local_config = {
2525
+ ...DEFAULT_CONFIG,
2526
+ ...config
2527
+ };
556
2528
  await load_wasm();
557
- begin_chunk(config);
2529
+ begin_chunk(local_config);
558
2530
  const ret = {
559
2531
  clusters: [],
560
2532
  stats: new Stats(),
@@ -619,23 +2591,26 @@ async function merge(chunk, config = DEFAULT_CONFIG) {
619
2591
  });
620
2592
  }
621
2593
  }
2594
+ const detaolu = detaolu_meta(local_config);
2595
+ const whitelisted = whitelisted_meta(local_config);
2596
+ const blacklisted = blacklisted_meta(local_config);
622
2597
  function obj_to_ir(objs, s, is_next_chunk) {
623
2598
  return objs.map((obj, idx)=>{
624
- if (!config.PROC_POOL1 && 1 === obj.pool) {
2599
+ if (!local_config.PROC_POOL1 && 1 === obj.pool) {
625
2600
  if (s) {
626
2601
  s.ignored_type++;
627
2602
  apply_single_cluster(idx, obj, '已忽略字幕弹幕,可以在选项中修改');
628
2603
  }
629
2604
  return null;
630
2605
  }
631
- if (!config.PROC_TYPE7 && 4 === obj.mode) {
2606
+ if (!local_config.PROC_TYPE7 && 4 === obj.mode) {
632
2607
  if (s) {
633
2608
  s.ignored_type++;
634
2609
  apply_single_cluster(idx, obj, '已忽略特殊弹幕,可以在选项中修改');
635
2610
  }
636
2611
  return null;
637
2612
  }
638
- if (!config.PROC_TYPE4 && 1 === obj.mode) {
2613
+ if (!local_config.PROC_TYPE4 && 1 === obj.mode) {
639
2614
  if (s) {
640
2615
  s.ignored_type++;
641
2616
  apply_single_cluster(idx, obj, '已忽略底部弹幕,可以在选项中修改');
@@ -644,7 +2619,7 @@ async function merge(chunk, config = DEFAULT_CONFIG) {
644
2619
  }
645
2620
  const disp_str = trim_dispstr(4 === obj.mode && '[' === obj.content[0] ? extract_special_danmu(obj.content) : obj.content);
646
2621
  if (4 !== obj.mode) {
647
- const matched = blacklisted(disp_str, config);
2622
+ const matched = blacklisted(disp_str);
648
2623
  if (matched) {
649
2624
  if (s) {
650
2625
  s.deleted_blacklist++;
@@ -659,17 +2634,17 @@ async function merge(chunk, config = DEFAULT_CONFIG) {
659
2634
  return null;
660
2635
  }
661
2636
  }
662
- if (whitelisted(disp_str, config)) {
2637
+ if (whitelisted(disp_str)) {
663
2638
  if (s) {
664
2639
  s.ignored_whitelist++;
665
2640
  apply_single_cluster(idx, obj, '命中白名单');
666
2641
  }
667
2642
  return null;
668
2643
  }
669
- const [matched_taolu, detaolued] = detaolu(disp_str, config);
2644
+ const [matched_taolu, detaolued] = detaolu(disp_str);
670
2645
  if (matched_taolu) {
671
2646
  if (s) s.num_taolu_matched++;
672
- if (config.FORCELIST_APPLY_SINGULAR) obj = {
2647
+ if (local_config.FORCELIST_APPLY_SINGULAR) obj = {
673
2648
  ...obj,
674
2649
  content: detaolued
675
2650
  };
@@ -684,7 +2659,7 @@ async function merge(chunk, config = DEFAULT_CONFIG) {
684
2659
  }
685
2660
  const danmus = obj_to_ir(chunk.objs, ret.stats, false);
686
2661
  const nearby_danmus = new Queue();
687
- const THRESHOLD_MS = (config?.THRESHOLD ?? DEFAULT_CONFIG.THRESHOLD) * 1000;
2662
+ const THRESHOLD_MS = 1000 * local_config.THRESHOLD;
688
2663
  for (const dm of danmus){
689
2664
  while(true){
690
2665
  const peeked = nearby_danmus.peek();