From 9bce51f651aad297ef9eb6df832bfdaf1de05d84 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 14:27:54 +0800
Subject: [PATCH] 青岛推送
---
node_modules/watchpack/lib/LinkResolver.js | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/node_modules/watchpack/lib/LinkResolver.js b/node_modules/watchpack/lib/LinkResolver.js
index daea90b..8133cbd 100644
--- a/node_modules/watchpack/lib/LinkResolver.js
+++ b/node_modules/watchpack/lib/LinkResolver.js
@@ -15,12 +15,13 @@
class LinkResolver {
constructor() {
+ /** @type {Map<string, readonly string[]>} */
this.cache = new Map();
}
/**
* @param {string} file path to file or directory
- * @returns {string[]} array of file and all symlinks contributed in the resolving process (first item is the resolved file)
+ * @returns {readonly string[]} array of file and all symlinks contributed in the resolving process (first item is the resolved file)
*/
resolve(file) {
const cacheEntry = this.cache.get(file);
@@ -65,17 +66,18 @@
for (let i = 1; i < parentResolved.length; i++) {
resultSet.add(parentResolved[i]);
}
- result = Object.freeze(Array.from(resultSet));
+ result = Object.freeze([...resultSet]);
} else if (parentResolved.length > 1) {
// we have links in the parent but not for the link content location
- result = parentResolved.slice();
+ result = [...parentResolved];
+ // eslint-disable-next-line prefer-destructuring
result[0] = linkResolved[0];
// add the link
result.push(realFile);
Object.freeze(result);
} else if (linkResolved.length > 1) {
// we can return the link content location result
- result = linkResolved.slice();
+ result = [...linkResolved];
// add the link
result.push(realFile);
Object.freeze(result);
@@ -86,17 +88,21 @@
// the resolve real location
linkResolved[0],
// add the link
- realFile
+ realFile,
]);
}
this.cache.set(file, result);
return result;
- } catch (e) {
- if (!EXPECTED_ERRORS.has(e.code)) {
- throw e;
+ } catch (err) {
+ if (
+ /** @type {NodeJS.ErrnoException} */
+ (err).code &&
+ !EXPECTED_ERRORS.has(/** @type {NodeJS.ErrnoException} */ (err).code)
+ ) {
+ throw err;
}
// no link
- const result = parentResolved.slice();
+ const result = [...parentResolved];
result[0] = realFile;
Object.freeze(result);
this.cache.set(file, result);
@@ -104,4 +110,5 @@
}
}
}
+
module.exports = LinkResolver;
--
Gitblit v1.9.3