"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveHBuilderXPluginPath = void 0; const path_1 = __importDefault(require("path")); const uni_shared_1 = require("@dcloudio/uni-shared"); const getHBuilderXPluginPaths = (0, uni_shared_1.once)(() => { const raw = process.env.HX_PLUGIN_PATHS; if (!raw) { return; } const pluginPaths = JSON.parse(raw); if (!pluginPaths || typeof pluginPaths !== 'object' || Array.isArray(pluginPaths)) { throw new Error('Invalid HX_PLUGIN_PATHS'); } return pluginPaths; }); function resolveHBuilderXPluginPath(pluginName, ...subpaths) { const pluginPaths = getHBuilderXPluginPaths(); const mappedPath = pluginPaths?.[pluginName]; // 缺少 key 时使用旧目录;空字符串表示显式未配置,不回退。 const pluginPath = mappedPath !== undefined ? mappedPath : process.env.UNI_HBUILDERX_PLUGINS ? path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, pluginName) : undefined; return pluginPath ? path_1.default.resolve(pluginPath, ...subpaths) : undefined; } exports.resolveHBuilderXPluginPath = resolveHBuilderXPluginPath;