@dan-uni/dan-any-plugin-detaolu 1.4.0 → 2.0.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/README.md +33 -14
- package/dist/index.d.mts +66 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +46 -23
- package/.babelrc.json +0 -12
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -2738
- package/dist/index.js.LICENSE.txt +0 -9
- package/dist/index.test.d.ts +0 -1
- package/dist/index.umd.min.js +0 -41392
- package/dist/index.umd.min.js.LICENSE.txt +0 -46
- package/dist/pakku.js/index.d.ts +0 -70
- package/dist/pakku.js/similarity_stub.d.ts +0 -9
- package/dist/pakku.js/types.d.ts +0 -76
- package/rslib.config.ts +0 -27
- package/src/index.test.ts +0 -39
- package/src/index.ts +0 -72
- package/src/pakku.js/index.ts +0 -615
- package/src/pakku.js/similarity-gen.js +0 -344
- package/src/pakku.js/similarity-gen.wasm +0 -0
- package/src/pakku.js/similarity_stub.ts +0 -113
- package/src/pakku.js/types.ts +0 -203
- package/tsconfig.json +0 -106
- package/tsconfig.tsbuildinfo +0 -1
- /package/dist/{static/wasm/21072e5de5.module.wasm → 73f7e7f2dd1a4caa.wasm} +0 -0
package/dist/index.js
DELETED
|
@@ -1,2738 +0,0 @@
|
|
|
1
|
-
/*! LICENSE: index.js.LICENSE.txt */
|
|
2
|
-
import { UniDM, UniDMTools, UniPool } from "@dan-uni/dan-any";
|
|
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
|
-
});
|
|
1937
|
-
var Module = function(moduleArg = {}) {
|
|
1938
|
-
var moduleRtn;
|
|
1939
|
-
var f = moduleArg, g, m = new Promise((a)=>{
|
|
1940
|
-
g = a;
|
|
1941
|
-
});
|
|
1942
|
-
'_begin_chunk _check_similar _begin_index_lock _malloc _memory ___indirect_function_table onRuntimeInitialized'.split(' ').forEach((a)=>{
|
|
1943
|
-
Object.getOwnPropertyDescriptor(m, a) || Object.defineProperty(m, a, {
|
|
1944
|
-
get: ()=>q('You are getting ' + a + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js'),
|
|
1945
|
-
set: ()=>q('You are setting ' + a + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js')
|
|
1946
|
-
});
|
|
1947
|
-
});
|
|
1948
|
-
var r = (a)=>console.log(a), t = (a)=>console.error(a);
|
|
1949
|
-
r = ()=>{};
|
|
1950
|
-
t = (a)=>{
|
|
1951
|
-
console.error(a);
|
|
1952
|
-
throw Error('wasm error: ' + a);
|
|
1953
|
-
};
|
|
1954
|
-
function v(a, b) {
|
|
1955
|
-
if (!a) throw b;
|
|
1956
|
-
}
|
|
1957
|
-
function q(a) {
|
|
1958
|
-
throw Error(a);
|
|
1959
|
-
}
|
|
1960
|
-
var B, C, D, E;
|
|
1961
|
-
function H() {
|
|
1962
|
-
var a = E.buffer;
|
|
1963
|
-
new Int8Array(a);
|
|
1964
|
-
B = new Int16Array(a);
|
|
1965
|
-
C = new Uint8Array(a);
|
|
1966
|
-
new Uint16Array(a);
|
|
1967
|
-
new Int32Array(a);
|
|
1968
|
-
D = new Uint32Array(a);
|
|
1969
|
-
new Float32Array(a);
|
|
1970
|
-
new Float64Array(a);
|
|
1971
|
-
new BigInt64Array(a);
|
|
1972
|
-
new BigUint64Array(a);
|
|
1973
|
-
}
|
|
1974
|
-
v(Math.imul, 'This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
|
|
1975
|
-
v(Math.fround, 'This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
|
|
1976
|
-
v(Math.clz32, 'This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
|
|
1977
|
-
v(Math.trunc, 'This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');
|
|
1978
|
-
var I = new Int16Array(1), J = new Int8Array(I.buffer);
|
|
1979
|
-
I[0] = 25459;
|
|
1980
|
-
if (115 !== J[0] || 99 !== J[1]) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)';
|
|
1981
|
-
if (f.ENVIRONMENT) throw Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');
|
|
1982
|
-
function K(a) {
|
|
1983
|
-
return 'FS_createPath' === a || 'FS_createDataFile' === a || 'FS_createPreloadedFile' === a || 'FS_unlink' === a || 'addRunDependency' === a || 'FS_createLazyFile' === a || 'FS_createDevice' === a || 'removeRunDependency' === a;
|
|
1984
|
-
}
|
|
1985
|
-
function L(a, b) {
|
|
1986
|
-
"u" < typeof globalThis || Object.getOwnPropertyDescriptor(globalThis, a) || Object.defineProperty(globalThis, a, {
|
|
1987
|
-
configurable: !0,
|
|
1988
|
-
get () {
|
|
1989
|
-
b();
|
|
1990
|
-
}
|
|
1991
|
-
});
|
|
1992
|
-
}
|
|
1993
|
-
function M(a, b) {
|
|
1994
|
-
L(a, ()=>{
|
|
1995
|
-
N(`\`${a}\` is not longer defined by emscripten. ${b}`);
|
|
1996
|
-
});
|
|
1997
|
-
}
|
|
1998
|
-
M('buffer', 'Please use HEAP8.buffer or wasmMemory.buffer');
|
|
1999
|
-
M('asm', 'Please use wasmExports instead');
|
|
2000
|
-
function O(a) {
|
|
2001
|
-
Object.getOwnPropertyDescriptor(f, a) || Object.defineProperty(f, a, {
|
|
2002
|
-
configurable: !0,
|
|
2003
|
-
get () {
|
|
2004
|
-
var b = `'${a}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
|
|
2005
|
-
K(a) && (b += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you');
|
|
2006
|
-
q(b);
|
|
2007
|
-
}
|
|
2008
|
-
});
|
|
2009
|
-
}
|
|
2010
|
-
var N = (a)=>{
|
|
2011
|
-
N.g || (N.g = {});
|
|
2012
|
-
N.g[a] || (N.g[a] = 1, t(a));
|
|
2013
|
-
}, P = "u" > typeof TextDecoder ? new TextDecoder() : void 0, R = [
|
|
2014
|
-
null,
|
|
2015
|
-
[],
|
|
2016
|
-
[]
|
|
2017
|
-
], S = {
|
|
2018
|
-
_abort_js: ()=>q('native code called abort()'),
|
|
2019
|
-
emscripten_resize_heap: (a)=>{
|
|
2020
|
-
var b = C.length;
|
|
2021
|
-
a >>>= 0;
|
|
2022
|
-
v(a > b);
|
|
2023
|
-
if (268435456 < a) return t(`Cannot enlarge memory, requested ${a} bytes, but the limit is 268435456 bytes!`), !1;
|
|
2024
|
-
for(var c = 1; 4 >= c; c *= 2){
|
|
2025
|
-
var h = b * (1 + 1 / c);
|
|
2026
|
-
h = Math.min(h, a + 100663296);
|
|
2027
|
-
var k = Math, n = k.min;
|
|
2028
|
-
h = Math.max(a, h);
|
|
2029
|
-
v(65536, 'alignment argument is required');
|
|
2030
|
-
k = n.call(k, 268435456, 65536 * Math.ceil(h / 65536));
|
|
2031
|
-
a: {
|
|
2032
|
-
n = k;
|
|
2033
|
-
h = E.buffer;
|
|
2034
|
-
var F = (n - h.byteLength + 65535) / 65536 | 0;
|
|
2035
|
-
try {
|
|
2036
|
-
E.grow(F);
|
|
2037
|
-
H();
|
|
2038
|
-
var w = 1;
|
|
2039
|
-
break a;
|
|
2040
|
-
} catch (x) {
|
|
2041
|
-
t(`growMemory: Attempted to grow heap from ${h.byteLength} bytes to ${n} bytes, but got error: ${x}`);
|
|
2042
|
-
}
|
|
2043
|
-
w = void 0;
|
|
2044
|
-
}
|
|
2045
|
-
if (w) return !0;
|
|
2046
|
-
}
|
|
2047
|
-
t(`Failed to grow the heap from ${b} bytes to ${k} bytes, not enough memory!`);
|
|
2048
|
-
return !1;
|
|
2049
|
-
},
|
|
2050
|
-
fd_close: ()=>{
|
|
2051
|
-
q('fd_close called without SYSCALLS_REQUIRE_FILESYSTEM');
|
|
2052
|
-
},
|
|
2053
|
-
fd_seek: function() {
|
|
2054
|
-
return 70;
|
|
2055
|
-
},
|
|
2056
|
-
fd_write: (a, b, c, h)=>{
|
|
2057
|
-
for(var k = 0, n = 0; n < c; n++){
|
|
2058
|
-
var F = D[b >> 2], w = D[b + 4 >> 2];
|
|
2059
|
-
b += 8;
|
|
2060
|
-
for(var x = 0; x < w; x++){
|
|
2061
|
-
var y = a, e = C[F + x], z = R[y];
|
|
2062
|
-
v(z);
|
|
2063
|
-
if (0 === e || 10 === e) {
|
|
2064
|
-
y = 1 === y ? r : t;
|
|
2065
|
-
e = z;
|
|
2066
|
-
for(var l = 0, p = l + NaN, u = l; e[u] && !(u >= p);)++u;
|
|
2067
|
-
if (16 < u - l && e.buffer && P) e = P.decode(e.subarray(l, u));
|
|
2068
|
-
else {
|
|
2069
|
-
for(p = ''; l < u;){
|
|
2070
|
-
var d = e[l++];
|
|
2071
|
-
if (128 & d) {
|
|
2072
|
-
var G = 63 & e[l++];
|
|
2073
|
-
if (192 == (224 & d)) p += String.fromCharCode((31 & d) << 6 | G);
|
|
2074
|
-
else {
|
|
2075
|
-
var Q = 63 & e[l++];
|
|
2076
|
-
if (224 == (240 & d)) d = (15 & d) << 12 | G << 6 | Q;
|
|
2077
|
-
else {
|
|
2078
|
-
if (240 != (248 & d)) {
|
|
2079
|
-
var V = N;
|
|
2080
|
-
var A = d;
|
|
2081
|
-
v('number' == typeof A);
|
|
2082
|
-
A = '0x' + (A >>> 0).toString(16).padStart(8, '0');
|
|
2083
|
-
V('Invalid UTF-8 leading byte ' + A + ' encountered when deserializing a UTF-8 string in wasm memory to a JS string!');
|
|
2084
|
-
}
|
|
2085
|
-
d = (7 & d) << 18 | G << 12 | Q << 6 | 63 & e[l++];
|
|
2086
|
-
}
|
|
2087
|
-
65536 > d ? p += String.fromCharCode(d) : (d -= 65536, p += String.fromCharCode(55296 | d >> 10, 56320 | 1023 & d));
|
|
2088
|
-
}
|
|
2089
|
-
} else p += String.fromCharCode(d);
|
|
2090
|
-
}
|
|
2091
|
-
e = p;
|
|
2092
|
-
}
|
|
2093
|
-
y(e);
|
|
2094
|
-
z.length = 0;
|
|
2095
|
-
} else z.push(e);
|
|
2096
|
-
}
|
|
2097
|
-
k += w;
|
|
2098
|
-
}
|
|
2099
|
-
D[h >> 2] = k;
|
|
2100
|
-
return 0;
|
|
2101
|
-
}
|
|
2102
|
-
};
|
|
2103
|
-
f.stringToUTF16 = (a, b, c)=>{
|
|
2104
|
-
v(0 == b % 2, 'Pointer passed to stringToUTF16 must be aligned to two bytes!');
|
|
2105
|
-
v('number' == typeof c, 'stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
|
|
2106
|
-
c ??= 2147483647;
|
|
2107
|
-
if (2 > c) return 0;
|
|
2108
|
-
c -= 2;
|
|
2109
|
-
var h = b;
|
|
2110
|
-
c = c < 2 * a.length ? c / 2 : a.length;
|
|
2111
|
-
for(var k = 0; k < c; ++k)B[b >> 1] = a.charCodeAt(k), b += 2;
|
|
2112
|
-
B[b >> 1] = 0;
|
|
2113
|
-
return b - h;
|
|
2114
|
-
};
|
|
2115
|
-
"writeI53ToI64 writeI53ToI64Clamped writeI53ToI64Signaling writeI53ToU64Clamped writeI53ToU64Signaling readI53FromI64 readI53FromU64 convertI32PairToI53 convertI32PairToI53Checked convertU32PairToI53 stackSave stackRestore stackAlloc getTempRet0 setTempRet0 zeroMemory strError inetPton4 inetNtop4 inetPton6 inetNtop6 readSockaddr writeSockaddr emscriptenLog readEmAsmArgs jstoi_q getExecutableName listenOnce autoResumeAudioContext getDynCaller dynCall callUserCallback asmjsMangle asyncLoad mmapAlloc HandleAllocator getNativeTypeSize STACK_SIZE STACK_ALIGN POINTER_SIZE ASSERTIONS getCFunc ccall cwrap uleb128Encode sigToWasmTypes generateFuncType convertJsFunctionToWasm getEmptyTableSlot updateTableMap getFunctionAddress addFunction removeFunction reallyNegative unSign strLen reSign formatString setValue getValue stringToUTF8Array stringToUTF8 lengthBytesUTF8 intArrayFromString intArrayToString AsciiToString stringToAscii UTF16ToString lengthBytesUTF16 UTF32ToString stringToUTF32 lengthBytesUTF32 stringToNewUTF8 stringToUTF8OnStack writeArrayToMemory registerKeyEventCallback maybeCStringToJsString findEventTarget getBoundingClientRect fillMouseEventData registerMouseEventCallback registerWheelEventCallback registerUiEventCallback registerFocusEventCallback fillDeviceOrientationEventData registerDeviceOrientationEventCallback fillDeviceMotionEventData registerDeviceMotionEventCallback screenOrientation fillOrientationChangeEventData registerOrientationChangeEventCallback fillFullscreenChangeEventData registerFullscreenChangeEventCallback JSEvents_requestFullscreen JSEvents_resizeCanvasForFullscreen registerRestoreOldStyle hideEverythingExceptGivenElement restoreHiddenElements setLetterbox softFullscreenResizeWebGLRenderTarget doRequestFullscreen fillPointerlockChangeEventData registerPointerlockChangeEventCallback registerPointerlockErrorEventCallback requestPointerLock fillVisibilityChangeEventData registerVisibilityChangeEventCallback registerTouchEventCallback fillGamepadEventData registerGamepadEventCallback registerBeforeUnloadEventCallback fillBatteryEventData battery registerBatteryEventCallback setCanvasElementSize getCanvasElementSize jsStackTrace getCallstack convertPCtoSourceLocation getEnvStrings checkWasiClock wasiRightsToMuslOFlags wasiOFlagsToMuslOFlags initRandomFill randomFill safeSetTimeout setImmediateWrapped safeRequestAnimationFrame clearImmediateWrapped polyfillSetImmediate registerPostMainLoop registerPreMainLoop getPromise makePromise idsToPromises makePromiseCallback isLeapYear ydayFromDate arraySum addDays getSocketFromFD getSocketAddress ALLOC_NORMAL ALLOC_STACK allocate writeStringToMemory writeAsciiToMemory setErrNo demangle stackTrace".split(' ').forEach(function(a) {
|
|
2116
|
-
L(a, ()=>{
|
|
2117
|
-
var b = `\`${a}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`, c = a;
|
|
2118
|
-
c.startsWith('_') || (c = '$' + a);
|
|
2119
|
-
b += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${c}')`;
|
|
2120
|
-
K(a) && (b += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you');
|
|
2121
|
-
N(b);
|
|
2122
|
-
});
|
|
2123
|
-
O(a);
|
|
2124
|
-
});
|
|
2125
|
-
'run addOnPreRun addOnInit addOnPreMain addOnExit addOnPostRun addRunDependency removeRunDependency out err callMain abort wasmMemory wasmExports HEAPF32 HEAPF64 HEAP_DATA_VIEW HEAP8 HEAPU8 HEAP16 HEAPU16 HEAP32 HEAPU32 HEAP64 HEAPU64 writeStackCookie checkStackCookie INT53_MAX INT53_MIN bigintToI53Checked ptrToString getHeapMax growMemory ENV ERRNO_CODES DNS Protocols Sockets timers warnOnce readEmAsmArgsArray jstoi_s alignMemory wasmTable noExitRuntime freeTableIndexes functionsInTableMap PATH PATH_FS UTF8Decoder UTF8ArrayToString UTF8ToString UTF16Decoder JSEvents specialHTMLTargets findCanvasEventTarget currentFullscreenStrategy restoreOldWindowedStyle UNWIND_CACHE promiseMap MONTH_DAYS_REGULAR MONTH_DAYS_LEAP MONTH_DAYS_REGULAR_CUMULATIVE MONTH_DAYS_LEAP_CUMULATIVE SYSCALLS allocateUTF8 allocateUTF8OnStack print printErr'.split(' ').forEach(O);
|
|
2126
|
-
var T, U, W = {
|
|
2127
|
-
env: S,
|
|
2128
|
-
wasi_snapshot_preview1: S
|
|
2129
|
-
};
|
|
2130
|
-
if (!f.wasm) throw "Must load WebAssembly Module in to variable Module.wasm before adding compiled output .js script to the DOM";
|
|
2131
|
-
WebAssembly.instantiate(f.wasm, W).then((a)=>{
|
|
2132
|
-
a = a.instance.exports;
|
|
2133
|
-
f._begin_chunk = a.begin_chunk;
|
|
2134
|
-
f._begin_index_lock = a.begin_index_lock;
|
|
2135
|
-
f._check_similar = a.check_similar;
|
|
2136
|
-
f._malloc = a.malloc;
|
|
2137
|
-
T = a.emscripten_stack_init;
|
|
2138
|
-
U = a.emscripten_stack_get_end;
|
|
2139
|
-
E = a.memory;
|
|
2140
|
-
v(E);
|
|
2141
|
-
H();
|
|
2142
|
-
T();
|
|
2143
|
-
var b = U();
|
|
2144
|
-
v(0 == (3 & b));
|
|
2145
|
-
0 == b && (b += 4);
|
|
2146
|
-
D[b >> 2] = 34821223;
|
|
2147
|
-
D[b + 4 >> 2] = 2310721022;
|
|
2148
|
-
a.__wasm_call_ctors();
|
|
2149
|
-
g(f);
|
|
2150
|
-
r('ready() called, and INVOKE_RUN=0. The runtime is now ready for you to call run() to invoke application _main(). You can also override ready() in a --pre-js file to get this signal as a callback');
|
|
2151
|
-
}, (a)=>{
|
|
2152
|
-
console.error(a);
|
|
2153
|
-
});
|
|
2154
|
-
moduleRtn = m;
|
|
2155
|
-
for (const a of Object.keys(f))a in moduleArg || Object.defineProperty(moduleArg, a, {
|
|
2156
|
-
configurable: !0,
|
|
2157
|
-
get () {
|
|
2158
|
-
q(`Access to module property ('${a}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`);
|
|
2159
|
-
}
|
|
2160
|
-
});
|
|
2161
|
-
return moduleRtn;
|
|
2162
|
-
};
|
|
2163
|
-
const similarity_gen = Module;
|
|
2164
|
-
let similarity_stub_module = null;
|
|
2165
|
-
let ptr_buf;
|
|
2166
|
-
const MAX_STRING_LEN = 16005;
|
|
2167
|
-
async function similarity_stub_init(wasm_module) {
|
|
2168
|
-
similarity_stub_module = await similarity_gen({
|
|
2169
|
-
wasm: wasm_module
|
|
2170
|
-
});
|
|
2171
|
-
ptr_buf = similarity_stub_module._malloc(2 * MAX_STRING_LEN + 7);
|
|
2172
|
-
if (ptr_buf % 2) ptr_buf++;
|
|
2173
|
-
}
|
|
2174
|
-
function begin_chunk(config) {
|
|
2175
|
-
try {
|
|
2176
|
-
similarity_stub_module._begin_chunk(ptr_buf, config.MAX_DIST, config.MAX_COSINE, config.TRIM_PINYIN, config.CROSS_MODE);
|
|
2177
|
-
} catch (error) {
|
|
2178
|
-
throw new Error(`wasm error (begin_chunk):\n${error}`, {
|
|
2179
|
-
cause: error
|
|
2180
|
-
});
|
|
2181
|
-
}
|
|
2182
|
-
}
|
|
2183
|
-
function begin_index_lock() {
|
|
2184
|
-
try {
|
|
2185
|
-
similarity_stub_module._begin_index_lock();
|
|
2186
|
-
} catch (error) {
|
|
2187
|
-
throw new Error(`wasm error (begin_index_lock):\n${error}`, {
|
|
2188
|
-
cause: error
|
|
2189
|
-
});
|
|
2190
|
-
}
|
|
2191
|
-
}
|
|
2192
|
-
function detect_similarity(str, mode, index_l, S) {
|
|
2193
|
-
try {
|
|
2194
|
-
similarity_stub_module.stringToUTF16(str, ptr_buf, 2 * MAX_STRING_LEN);
|
|
2195
|
-
} catch (error) {
|
|
2196
|
-
throw new Error(`wasm error (write str buf): ${str}\n${error}`, {
|
|
2197
|
-
cause: error
|
|
2198
|
-
});
|
|
2199
|
-
}
|
|
2200
|
-
let ret;
|
|
2201
|
-
try {
|
|
2202
|
-
ret = similarity_stub_module._check_similar(mode, index_l);
|
|
2203
|
-
} catch (error) {
|
|
2204
|
-
throw new Error(`wasm error (similar): ${str}\n${error}`, {
|
|
2205
|
-
cause: error
|
|
2206
|
-
});
|
|
2207
|
-
}
|
|
2208
|
-
if (0 === ret) return null;
|
|
2209
|
-
ret >>>= 0;
|
|
2210
|
-
const reason = ret >>> 30;
|
|
2211
|
-
const dist = ret >>> 19 & 2047;
|
|
2212
|
-
const idx_diff = 524287 & ret;
|
|
2213
|
-
let reason_str;
|
|
2214
|
-
switch(reason){
|
|
2215
|
-
case 0:
|
|
2216
|
-
S.combined_identical++;
|
|
2217
|
-
reason_str = '==';
|
|
2218
|
-
break;
|
|
2219
|
-
case 1:
|
|
2220
|
-
S.combined_edit_distance++;
|
|
2221
|
-
reason_str = `≤${dist}`;
|
|
2222
|
-
break;
|
|
2223
|
-
case 3:
|
|
2224
|
-
S.combined_cosine_distance++;
|
|
2225
|
-
reason_str = `${dist}%`;
|
|
2226
|
-
break;
|
|
2227
|
-
case 2:
|
|
2228
|
-
S.combined_pinyin_distance++;
|
|
2229
|
-
reason_str = `P≤${dist}`;
|
|
2230
|
-
break;
|
|
2231
|
-
default:
|
|
2232
|
-
throw new Error(`similarity wasm returned unknown reason: ${ret}`);
|
|
2233
|
-
}
|
|
2234
|
-
return {
|
|
2235
|
-
reason: reason_str,
|
|
2236
|
-
idx_diff
|
|
2237
|
-
};
|
|
2238
|
-
}
|
|
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;
|
|
2257
|
-
class Stats {
|
|
2258
|
-
combined_identical = 0;
|
|
2259
|
-
combined_edit_distance = 0;
|
|
2260
|
-
combined_pinyin_distance = 0;
|
|
2261
|
-
combined_cosine_distance = 0;
|
|
2262
|
-
deleted_blacklist = 0;
|
|
2263
|
-
deleted_blacklist_each = {};
|
|
2264
|
-
ignored_whitelist = 0;
|
|
2265
|
-
ignored_type = 0;
|
|
2266
|
-
num_taolu_matched = 0;
|
|
2267
|
-
}
|
|
2268
|
-
_computedKey = _to_property_key(Symbol.iterator);
|
|
2269
|
-
class Queue {
|
|
2270
|
-
storage;
|
|
2271
|
-
index_l;
|
|
2272
|
-
index_r;
|
|
2273
|
-
constructor(init = []){
|
|
2274
|
-
this.storage = {
|
|
2275
|
-
...init
|
|
2276
|
-
};
|
|
2277
|
-
this.index_l = 0;
|
|
2278
|
-
this.index_r = init.length;
|
|
2279
|
-
}
|
|
2280
|
-
push(item) {
|
|
2281
|
-
this.storage[this.index_r++] = item;
|
|
2282
|
-
}
|
|
2283
|
-
pop() {
|
|
2284
|
-
delete this.storage[this.index_l++];
|
|
2285
|
-
}
|
|
2286
|
-
peek() {
|
|
2287
|
-
if (this.index_l === this.index_r) return null;
|
|
2288
|
-
return this.storage[this.index_l];
|
|
2289
|
-
}
|
|
2290
|
-
size() {
|
|
2291
|
-
return this.index_r - this.index_l;
|
|
2292
|
-
}
|
|
2293
|
-
[_computedKey]() {
|
|
2294
|
-
const self = this;
|
|
2295
|
-
let index = self.index_l;
|
|
2296
|
-
return {
|
|
2297
|
-
next () {
|
|
2298
|
-
if (index >= self.index_r) return {
|
|
2299
|
-
done: true,
|
|
2300
|
-
value: void 0
|
|
2301
|
-
};
|
|
2302
|
-
return {
|
|
2303
|
-
done: false,
|
|
2304
|
-
value: self.storage[index++]
|
|
2305
|
-
};
|
|
2306
|
-
}
|
|
2307
|
-
};
|
|
2308
|
-
}
|
|
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);
|
|
2312
|
-
/**
|
|
2313
|
-
* @author: xmcp(代码主要逻辑来源)
|
|
2314
|
-
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/core/combine_worker.ts
|
|
2315
|
-
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/background/config.ts
|
|
2316
|
-
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/page/options.html
|
|
2317
|
-
* @see: https://github.com/xmcp/pakku.js/blob/master/pakkujs/page/options.ts
|
|
2318
|
-
* @license: GPL-3.0
|
|
2319
|
-
* 本文件内代码来源见上,经部分修改,并整合config注释
|
|
2320
|
-
*/ const DEFAULT_CONFIG = {
|
|
2321
|
-
THRESHOLD: 30,
|
|
2322
|
-
MAX_DIST: 5,
|
|
2323
|
-
MAX_COSINE: 45,
|
|
2324
|
-
TRIM_PINYIN: true,
|
|
2325
|
-
TRIM_ENDING: true,
|
|
2326
|
-
TRIM_SPACE: true,
|
|
2327
|
-
TRIM_WIDTH: true,
|
|
2328
|
-
FORCELIST: [
|
|
2329
|
-
[
|
|
2330
|
-
'^23{2,}$',
|
|
2331
|
-
'23333'
|
|
2332
|
-
],
|
|
2333
|
-
[
|
|
2334
|
-
'^6{3,}$',
|
|
2335
|
-
'66666'
|
|
2336
|
-
]
|
|
2337
|
-
],
|
|
2338
|
-
FORCELIST_CONTINUE_ON_MATCH: true,
|
|
2339
|
-
FORCELIST_APPLY_SINGULAR: false,
|
|
2340
|
-
WHITELIST: [],
|
|
2341
|
-
BLACKLIST: [],
|
|
2342
|
-
CROSS_MODE: true,
|
|
2343
|
-
PROC_TYPE7: true,
|
|
2344
|
-
PROC_TYPE4: true,
|
|
2345
|
-
PROC_POOL1: false
|
|
2346
|
-
};
|
|
2347
|
-
const ENDING_CHARS = new Set('.。,,/??!!…~~@^、+=-_♂♀ ');
|
|
2348
|
-
const WIDTH_TABLE = new Map(Object.entries({
|
|
2349
|
-
' ': ' ',
|
|
2350
|
-
'1': '1',
|
|
2351
|
-
'2': '2',
|
|
2352
|
-
'3': '3',
|
|
2353
|
-
'4': '4',
|
|
2354
|
-
'5': '5',
|
|
2355
|
-
'6': '6',
|
|
2356
|
-
'7': '7',
|
|
2357
|
-
'8': '8',
|
|
2358
|
-
'9': '9',
|
|
2359
|
-
'0': '0',
|
|
2360
|
-
'!': '!',
|
|
2361
|
-
'@': '@',
|
|
2362
|
-
'#': '#',
|
|
2363
|
-
'$': '$',
|
|
2364
|
-
'%': '%',
|
|
2365
|
-
'^': '^',
|
|
2366
|
-
'&': '&',
|
|
2367
|
-
'*': '*',
|
|
2368
|
-
'(': '(',
|
|
2369
|
-
')': ')',
|
|
2370
|
-
'-': '-',
|
|
2371
|
-
'=': '=',
|
|
2372
|
-
'_': '_',
|
|
2373
|
-
'+': '+',
|
|
2374
|
-
'[': '[',
|
|
2375
|
-
']': ']',
|
|
2376
|
-
'{': '{',
|
|
2377
|
-
'}': '}',
|
|
2378
|
-
';': ';',
|
|
2379
|
-
''': "'",
|
|
2380
|
-
':': ':',
|
|
2381
|
-
'"': '"',
|
|
2382
|
-
',': ',',
|
|
2383
|
-
'.': '.',
|
|
2384
|
-
'/': '/',
|
|
2385
|
-
'<': '<',
|
|
2386
|
-
'>': '>',
|
|
2387
|
-
'?': '?',
|
|
2388
|
-
'\': '\\',
|
|
2389
|
-
'|': '|',
|
|
2390
|
-
'`': '`',
|
|
2391
|
-
'~': '~',
|
|
2392
|
-
q: 'q',
|
|
2393
|
-
w: 'w',
|
|
2394
|
-
e: 'e',
|
|
2395
|
-
r: 'r',
|
|
2396
|
-
t: 't',
|
|
2397
|
-
y: 'y',
|
|
2398
|
-
u: 'u',
|
|
2399
|
-
i: 'i',
|
|
2400
|
-
o: 'o',
|
|
2401
|
-
p: 'p',
|
|
2402
|
-
a: 'a',
|
|
2403
|
-
s: 's',
|
|
2404
|
-
d: 'd',
|
|
2405
|
-
f: 'f',
|
|
2406
|
-
g: 'g',
|
|
2407
|
-
h: 'h',
|
|
2408
|
-
j: 'j',
|
|
2409
|
-
k: 'k',
|
|
2410
|
-
l: 'l',
|
|
2411
|
-
z: 'z',
|
|
2412
|
-
x: 'x',
|
|
2413
|
-
c: 'c',
|
|
2414
|
-
v: 'v',
|
|
2415
|
-
b: 'b',
|
|
2416
|
-
n: 'n',
|
|
2417
|
-
m: 'm',
|
|
2418
|
-
Q: 'Q',
|
|
2419
|
-
W: 'W',
|
|
2420
|
-
E: 'E',
|
|
2421
|
-
R: 'R',
|
|
2422
|
-
T: 'T',
|
|
2423
|
-
Y: 'Y',
|
|
2424
|
-
U: 'U',
|
|
2425
|
-
I: 'I',
|
|
2426
|
-
O: 'O',
|
|
2427
|
-
P: 'P',
|
|
2428
|
-
A: 'A',
|
|
2429
|
-
S: 'S',
|
|
2430
|
-
D: 'D',
|
|
2431
|
-
F: 'F',
|
|
2432
|
-
G: 'G',
|
|
2433
|
-
H: 'H',
|
|
2434
|
-
J: 'J',
|
|
2435
|
-
K: 'K',
|
|
2436
|
-
L: 'L',
|
|
2437
|
-
Z: 'Z',
|
|
2438
|
-
X: 'X',
|
|
2439
|
-
C: 'C',
|
|
2440
|
-
V: 'V',
|
|
2441
|
-
B: 'B',
|
|
2442
|
-
N: 'N',
|
|
2443
|
-
M: 'M'
|
|
2444
|
-
}));
|
|
2445
|
-
function detaolu_meta(config) {
|
|
2446
|
-
const TRIM_ENDING = config.TRIM_ENDING;
|
|
2447
|
-
const TRIM_SPACE = config.TRIM_SPACE;
|
|
2448
|
-
const TRIM_WIDTH = config.TRIM_WIDTH;
|
|
2449
|
-
const FORCELIST = config.FORCELIST.map(([pattern, repl])=>[
|
|
2450
|
-
new RegExp(pattern, 'giu'),
|
|
2451
|
-
repl
|
|
2452
|
-
]);
|
|
2453
|
-
const FORCELIST_BREAK_ON_MATCH = !config.FORCELIST_CONTINUE_ON_MATCH;
|
|
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)=>{
|
|
2488
|
-
const lower = text.toLowerCase();
|
|
2489
|
-
for (const pattern of BLACKLIST){
|
|
2490
|
-
const matched = 'string' == typeof pattern ? lower.includes(pattern) : pattern.test(text);
|
|
2491
|
-
if (matched) return 'string' == typeof pattern ? ` ${pattern}` : ` /${pattern.source}/`;
|
|
2492
|
-
}
|
|
2493
|
-
return null;
|
|
2494
|
-
};
|
|
2495
|
-
}
|
|
2496
|
-
function extract_special_danmu(text) {
|
|
2497
|
-
try {
|
|
2498
|
-
text = JSON.parse(text)[4];
|
|
2499
|
-
} catch {}
|
|
2500
|
-
return text;
|
|
2501
|
-
}
|
|
2502
|
-
function trim_dispstr(text) {
|
|
2503
|
-
return text.replaceAll(/([\r\n\t])/g, '').trim();
|
|
2504
|
-
}
|
|
2505
|
-
function select_median_length(strs) {
|
|
2506
|
-
if (1 === strs.length) return strs[0];
|
|
2507
|
-
const sorted = strs.toSorted((a, b)=>a.length - b.length);
|
|
2508
|
-
const mid = Math.floor(sorted.length / 2);
|
|
2509
|
-
return sorted[mid];
|
|
2510
|
-
}
|
|
2511
|
-
function u8array_to_arraybuffer(array) {
|
|
2512
|
-
return array.buffer.slice(array.byteOffset, array.byteOffset + array.byteLength);
|
|
2513
|
-
}
|
|
2514
|
-
async function load_wasm(wasm_mod) {
|
|
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));
|
|
2519
|
-
}
|
|
2520
|
-
function make_ptr_idx(idx, is_next_chunk) {
|
|
2521
|
-
return is_next_chunk ? -1 - idx : idx;
|
|
2522
|
-
}
|
|
2523
|
-
async function merge(chunk, config = DEFAULT_CONFIG) {
|
|
2524
|
-
const local_config = {
|
|
2525
|
-
...DEFAULT_CONFIG,
|
|
2526
|
-
...config
|
|
2527
|
-
};
|
|
2528
|
-
await load_wasm();
|
|
2529
|
-
begin_chunk(local_config);
|
|
2530
|
-
const ret = {
|
|
2531
|
-
clusters: [],
|
|
2532
|
-
stats: new Stats(),
|
|
2533
|
-
deleted_chunk: []
|
|
2534
|
-
};
|
|
2535
|
-
function apply_single_cluster(idx, obj, desc) {
|
|
2536
|
-
ret.clusters.push({
|
|
2537
|
-
peers_ptr: [
|
|
2538
|
-
[
|
|
2539
|
-
idx,
|
|
2540
|
-
'IGN'
|
|
2541
|
-
]
|
|
2542
|
-
],
|
|
2543
|
-
desc: [
|
|
2544
|
-
desc
|
|
2545
|
-
],
|
|
2546
|
-
chosen_str: obj.content,
|
|
2547
|
-
danuni_count: 1,
|
|
2548
|
-
danuni_dans: [
|
|
2549
|
-
obj
|
|
2550
|
-
]
|
|
2551
|
-
});
|
|
2552
|
-
}
|
|
2553
|
-
function apply_cluster(irs) {
|
|
2554
|
-
if (1 === irs.length) ret.clusters.push({
|
|
2555
|
-
peers_ptr: irs.map((ir)=>[
|
|
2556
|
-
ir.ptr_idx,
|
|
2557
|
-
ir.sim_reason
|
|
2558
|
-
]),
|
|
2559
|
-
desc: [],
|
|
2560
|
-
chosen_str: irs[0].obj.content,
|
|
2561
|
-
danuni_count: irs.length,
|
|
2562
|
-
danuni_dans: irs.map((ir)=>ir.obj)
|
|
2563
|
-
});
|
|
2564
|
-
else {
|
|
2565
|
-
const text_cnts = new Map();
|
|
2566
|
-
let most_texts = [];
|
|
2567
|
-
let most_cnt = 0;
|
|
2568
|
-
for (const ir of irs){
|
|
2569
|
-
const text = ir.str;
|
|
2570
|
-
const cnt = 1 + (text_cnts.get(text) || 0);
|
|
2571
|
-
text_cnts.set(text, cnt);
|
|
2572
|
-
if (cnt > most_cnt) {
|
|
2573
|
-
most_texts = [
|
|
2574
|
-
text
|
|
2575
|
-
];
|
|
2576
|
-
most_cnt = cnt;
|
|
2577
|
-
} else if (cnt === most_cnt) most_texts.push(text);
|
|
2578
|
-
}
|
|
2579
|
-
const most_text = select_median_length(most_texts);
|
|
2580
|
-
ret.clusters.push({
|
|
2581
|
-
peers_ptr: irs.map((ir)=>[
|
|
2582
|
-
ir.ptr_idx,
|
|
2583
|
-
ir.sim_reason
|
|
2584
|
-
]),
|
|
2585
|
-
desc: most_cnt > 1 ? [
|
|
2586
|
-
`采用了出现 ${most_cnt} 次的文本`
|
|
2587
|
-
] : [],
|
|
2588
|
-
chosen_str: most_text,
|
|
2589
|
-
danuni_count: most_cnt,
|
|
2590
|
-
danuni_dans: irs.map((ir)=>ir.obj)
|
|
2591
|
-
});
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
const detaolu = detaolu_meta(local_config);
|
|
2595
|
-
const whitelisted = whitelisted_meta(local_config);
|
|
2596
|
-
const blacklisted = blacklisted_meta(local_config);
|
|
2597
|
-
function obj_to_ir(objs, s, is_next_chunk) {
|
|
2598
|
-
return objs.map((obj, idx)=>{
|
|
2599
|
-
if (!local_config.PROC_POOL1 && 1 === obj.pool) {
|
|
2600
|
-
if (s) {
|
|
2601
|
-
s.ignored_type++;
|
|
2602
|
-
apply_single_cluster(idx, obj, '已忽略字幕弹幕,可以在选项中修改');
|
|
2603
|
-
}
|
|
2604
|
-
return null;
|
|
2605
|
-
}
|
|
2606
|
-
if (!local_config.PROC_TYPE7 && 4 === obj.mode) {
|
|
2607
|
-
if (s) {
|
|
2608
|
-
s.ignored_type++;
|
|
2609
|
-
apply_single_cluster(idx, obj, '已忽略特殊弹幕,可以在选项中修改');
|
|
2610
|
-
}
|
|
2611
|
-
return null;
|
|
2612
|
-
}
|
|
2613
|
-
if (!local_config.PROC_TYPE4 && 1 === obj.mode) {
|
|
2614
|
-
if (s) {
|
|
2615
|
-
s.ignored_type++;
|
|
2616
|
-
apply_single_cluster(idx, obj, '已忽略底部弹幕,可以在选项中修改');
|
|
2617
|
-
}
|
|
2618
|
-
return null;
|
|
2619
|
-
}
|
|
2620
|
-
const disp_str = trim_dispstr(4 === obj.mode && '[' === obj.content[0] ? extract_special_danmu(obj.content) : obj.content);
|
|
2621
|
-
if (4 !== obj.mode) {
|
|
2622
|
-
const matched = blacklisted(disp_str);
|
|
2623
|
-
if (matched) {
|
|
2624
|
-
if (s) {
|
|
2625
|
-
s.deleted_blacklist++;
|
|
2626
|
-
s.deleted_blacklist_each[matched] = (s.deleted_blacklist_each[matched] || 0) + 1;
|
|
2627
|
-
ret.deleted_chunk.push({
|
|
2628
|
-
...obj,
|
|
2629
|
-
pakku: {
|
|
2630
|
-
deleted_reason: `命中黑名单:${matched}`
|
|
2631
|
-
}
|
|
2632
|
-
});
|
|
2633
|
-
}
|
|
2634
|
-
return null;
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
|
-
if (whitelisted(disp_str)) {
|
|
2638
|
-
if (s) {
|
|
2639
|
-
s.ignored_whitelist++;
|
|
2640
|
-
apply_single_cluster(idx, obj, '命中白名单');
|
|
2641
|
-
}
|
|
2642
|
-
return null;
|
|
2643
|
-
}
|
|
2644
|
-
const [matched_taolu, detaolued] = detaolu(disp_str);
|
|
2645
|
-
if (matched_taolu) {
|
|
2646
|
-
if (s) s.num_taolu_matched++;
|
|
2647
|
-
if (local_config.FORCELIST_APPLY_SINGULAR) obj = {
|
|
2648
|
-
...obj,
|
|
2649
|
-
content: detaolued
|
|
2650
|
-
};
|
|
2651
|
-
}
|
|
2652
|
-
return {
|
|
2653
|
-
obj,
|
|
2654
|
-
str: detaolued,
|
|
2655
|
-
ptr_idx: make_ptr_idx(idx, is_next_chunk),
|
|
2656
|
-
sim_reason: 'ORIG'
|
|
2657
|
-
};
|
|
2658
|
-
}).filter((obj)=>null !== obj);
|
|
2659
|
-
}
|
|
2660
|
-
const danmus = obj_to_ir(chunk.objs, ret.stats, false);
|
|
2661
|
-
const nearby_danmus = new Queue();
|
|
2662
|
-
const THRESHOLD_MS = 1000 * local_config.THRESHOLD;
|
|
2663
|
-
for (const dm of danmus){
|
|
2664
|
-
while(true){
|
|
2665
|
-
const peeked = nearby_danmus.peek();
|
|
2666
|
-
if (null === peeked || dm.obj.time_ms - peeked[0].obj.time_ms <= THRESHOLD_MS) break;
|
|
2667
|
-
apply_cluster(peeked);
|
|
2668
|
-
nearby_danmus.pop();
|
|
2669
|
-
}
|
|
2670
|
-
const sim = detect_similarity(dm.str, dm.obj.mode, nearby_danmus.index_l, ret.stats);
|
|
2671
|
-
if (null === sim) nearby_danmus.push([
|
|
2672
|
-
dm
|
|
2673
|
-
]);
|
|
2674
|
-
else {
|
|
2675
|
-
const candidate = nearby_danmus.storage[nearby_danmus.index_r - sim.idx_diff];
|
|
2676
|
-
dm.sim_reason = sim.reason;
|
|
2677
|
-
candidate.push(dm);
|
|
2678
|
-
}
|
|
2679
|
-
}
|
|
2680
|
-
begin_index_lock();
|
|
2681
|
-
for (const candidate of nearby_danmus)apply_cluster(candidate);
|
|
2682
|
-
return ret;
|
|
2683
|
-
}
|
|
2684
|
-
const pakku_js = merge;
|
|
2685
|
-
async function src_detaolu(that, config) {
|
|
2686
|
-
const p = await pakku_js({
|
|
2687
|
-
objs: that.dans.map((d)=>({
|
|
2688
|
-
time_ms: 1000 * d.progress,
|
|
2689
|
-
mode: d.mode,
|
|
2690
|
-
content: d.content,
|
|
2691
|
-
pool: d.pool,
|
|
2692
|
-
danuni_dan: d
|
|
2693
|
-
}))
|
|
2694
|
-
}, config);
|
|
2695
|
-
const selected = p.clusters.map((p)=>{
|
|
2696
|
-
if (1 === p.danuni_dans.length) return p.danuni_dans[0].danuni_dan;
|
|
2697
|
-
{
|
|
2698
|
-
const dans = p.danuni_dans;
|
|
2699
|
-
const pool = new UniPool(dans.map((d)=>d.danuni_dan));
|
|
2700
|
-
function isAllBottomMode(p) {
|
|
2701
|
-
return p.dans.every((d)=>d.mode === UniDMTools.Modes.Bottom);
|
|
2702
|
-
}
|
|
2703
|
-
const progess = pool.dans.map((d)=>d.progress);
|
|
2704
|
-
return UniDM.create({
|
|
2705
|
-
SOID: pool.shared.SOID ?? pool.dans[0].SOID,
|
|
2706
|
-
progress: dans[0].danuni_dan.progress,
|
|
2707
|
-
mode: pool.shared.mode ?? (isAllBottomMode(pool) ? UniDMTools.Modes.Bottom : UniDMTools.Modes.Top),
|
|
2708
|
-
fontsize: dans.length > 0 ? 36 : 25,
|
|
2709
|
-
color: pool.shared.color ?? pool.most.color,
|
|
2710
|
-
senderID: 'detaolu[bot]@dan-any',
|
|
2711
|
-
content: p.chosen_str,
|
|
2712
|
-
weight: 10,
|
|
2713
|
-
pool: pool.shared.pool ?? pool.most.pool,
|
|
2714
|
-
attr: [
|
|
2715
|
-
UniDMTools.DMAttr.Protect
|
|
2716
|
-
],
|
|
2717
|
-
platform: pool.shared.platform ?? pool.most.platform,
|
|
2718
|
-
extra: {
|
|
2719
|
-
danuni: {
|
|
2720
|
-
merge: {
|
|
2721
|
-
count: p.danuni_count,
|
|
2722
|
-
duration: Number.parseFloat((Math.max(...progess) - Math.min(...progess)).toFixed(3)),
|
|
2723
|
-
senders: pool.dans.filter((d)=>d.content === p.chosen_str).map((d)=>d.senderID),
|
|
2724
|
-
taolu_count: pool.dans.length,
|
|
2725
|
-
taolu_senders: pool.dans.map((d)=>d.senderID)
|
|
2726
|
-
}
|
|
2727
|
-
}
|
|
2728
|
-
}
|
|
2729
|
-
});
|
|
2730
|
-
}
|
|
2731
|
-
});
|
|
2732
|
-
return new UniPool(selected);
|
|
2733
|
-
}
|
|
2734
|
-
function detaolu_constructor(config) {
|
|
2735
|
-
return (that)=>src_detaolu(that, config);
|
|
2736
|
-
}
|
|
2737
|
-
const src = detaolu_constructor;
|
|
2738
|
-
export default src;
|