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AQ,MAAQ,EAAQ,KAAK,WAAW,OAC3G,GAAI,EAAY,CACZ,MAAM,UAAE,EAAS,aAAE,EAAY,WAAE,GAAe,EAC1C,EAAiB,EAAQ,KAC/B,EAAQ,KAAO,EAAe,QAAQ,OAAO,QAAQ,KAAK,EAAY,EAAa,EAAc,gBAAiB,EACtH,CACA,GACJ,CACA,MAAO,GACH,EAAS,EAAK,EAClB,CACJ,GACJ,EAEJ,QAAQ,+BAAiC,+BACzC,QAAQ,QAAU","file":"/npm/hoist-peers-webpack-resolve-plugin@1.0.3/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/hoist-peers-webpack-resolve-plugin@1.0.3/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HoistPeersWebpackResolvePlugin = void 0;\nconst path_1 = __importDefault(require(\"path\"));\nclass HoistPeersWebpackResolvePlugin {\n    constructor(options) {\n        this.options = options;\n        this.name = 'HoistPeersWebpackResolvePlugin';\n    }\n    apply(resolver) {\n        // webpack v4 polyfill options.\n        const resolveOptions = resolver.options || this.options.options;\n        const { symlinks, modules, roots } = resolveOptions;\n        const { deps = [] } = this.options;\n        const projectRoot = Array.from(roots)[0];\n        const nodeModulesBasePath = modules.find(module => typeof module === 'string' && path_1.default.isAbsolute(module) && module.endsWith('node_modules'));\n        if (!nodeModulesBasePath || !nodeModulesBasePath.startsWith(projectRoot))\n            throw new Error(`valid node_modules not found !`);\n        const ignoreList = deps.map(depName => {\n            var _a;\n            const expectPkgJsonPath = path_1.default.join(nodeModulesBasePath, `${depName}/package.json`);\n            const expectPkgDir = path_1.default.dirname(expectPkgJsonPath);\n            const realPkgDir = path_1.default.dirname(require.resolve(expectPkgJsonPath));\n            const isSymlink = symlinks && expectPkgDir !== realPkgDir;\n            return {\n                depName,\n                isSymlink,\n                expectPkgDir,\n                realPkgDir,\n                peers: Object\n                    .keys(((_a = require(expectPkgJsonPath)) === null || _a === void 0 ? void 0 : _a.peerDependencies) || {})\n                    .map(peerName => path_1.default.join(isSymlink ? realPkgDir : expectPkgDir, `node_modules/${peerName}`))\n            };\n        });\n        resolver.getHook('existingFile').tapAsync(this.name, function (request, _resolveContext, callback) {\n            try {\n                const matchedDep = ignoreList.find(item => item.peers.some(peer => request.path && request.path.startsWith(peer)));\n                if (matchedDep) {\n                    const { isSymlink, expectPkgDir, realPkgDir } = matchedDep;\n                    const rawRequestPath = request.path;\n                    request.path = rawRequestPath.replace(path_1.default.join(isSymlink ? realPkgDir : expectPkgDir, 'node_modules'), nodeModulesBasePath);\n                }\n                callback();\n            }\n            catch (err) {\n                callback(err, request);\n            }\n        });\n    }\n}\nexports.HoistPeersWebpackResolvePlugin = HoistPeersWebpackResolvePlugin;\nexports.default = HoistPeersWebpackResolvePlugin;\n"]}