From 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 18:09:58 +0800
Subject: [PATCH] 上报转运调试

---
 node_modules/enhanced-resolve/lib/util/path.js |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/node_modules/enhanced-resolve/lib/util/path.js b/node_modules/enhanced-resolve/lib/util/path.js
index af34046..b07d736 100644
--- a/node_modules/enhanced-resolve/lib/util/path.js
+++ b/node_modules/enhanced-resolve/lib/util/path.js
@@ -171,6 +171,18 @@
 	return posixNormalize(rootPath);
 };
 
+/**
+ * @param {string} maybePath a path
+ * @returns {string} the directory name
+ */
+const dirname = (maybePath) => {
+	switch (getType(maybePath)) {
+		case PathType.AbsoluteWin:
+			return path.win32.dirname(maybePath);
+	}
+	return path.posix.dirname(maybePath);
+};
+
 /** @type {Map<string, Map<string, string | undefined>>} */
 const joinCache = new Map();
 
@@ -194,10 +206,45 @@
 	return cacheEntry;
 };
 
+/** @type {Map<string, string>} */
+const dirnameCache = new Map();
+
+/**
+ * @param {string} maybePath a path
+ * @returns {string} the directory name
+ */
+const cachedDirname = (maybePath) => {
+	const cacheEntry = dirnameCache.get(maybePath);
+	if (cacheEntry !== undefined) return cacheEntry;
+	const result = dirname(maybePath);
+	dirnameCache.set(maybePath, result);
+	return result;
+};
+
+/**
+ * Check if childPath is a subdirectory of parentPath
+ * @param {string} parentPath parent directory path
+ * @param {string} childPath child path to check
+ * @returns {boolean} true if childPath is under parentPath
+ */
+const isSubPath = (parentPath, childPath) => {
+	// Ensure parentPath ends with a separator to avoid false matches
+	// e.g., "/app" shouldn't match "/app-other"
+	const parentWithSlash =
+		parentPath.endsWith("/") || parentPath.endsWith("\\")
+			? parentPath
+			: normalize(`${parentPath}/`);
+
+	return childPath.startsWith(parentWithSlash);
+};
+
 module.exports.PathType = PathType;
+module.exports.cachedDirname = cachedDirname;
 module.exports.cachedJoin = cachedJoin;
 module.exports.deprecatedInvalidSegmentRegEx = deprecatedInvalidSegmentRegEx;
+module.exports.dirname = dirname;
 module.exports.getType = getType;
 module.exports.invalidSegmentRegEx = invalidSegmentRegEx;
+module.exports.isSubPath = isSubPath;
 module.exports.join = join;
 module.exports.normalize = normalize;

--
Gitblit v1.9.3