@foxpage/foxpage-manager
Version:
foxpage resource manager
25 lines (24 loc) • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolvePackageJSONPath = exports.resolvePackageJSPath = exports.resolvePackageDir = exports.PACKAGE_JSON_FILENAME = exports.FOXPAGE_PACKAGE = void 0;
const path_1 = require("path");
const common_1 = require("../common");
exports.FOXPAGE_PACKAGE = 'modules';
exports.PACKAGE_JSON_FILENAME = 'package';
function resolvePackageDir(appId, packageName = '', version) {
return version
? (0, path_1.join)(common_1.FOXPAGE_ROOT, appId, exports.FOXPAGE_PACKAGE, packageName, version)
: (0, path_1.join)(common_1.FOXPAGE_ROOT, appId, exports.FOXPAGE_PACKAGE, packageName);
}
exports.resolvePackageDir = resolvePackageDir;
function resolvePackageJSPath(appId, packageName, version, hash) {
const dir = resolvePackageDir(appId, packageName, version);
const fileName = `index${hash ? '.' + hash : ''}.js`;
const filePath = (0, path_1.join)(dir, fileName);
return filePath;
}
exports.resolvePackageJSPath = resolvePackageJSPath;
function resolvePackageJSONPath(appId, packageName, ver, salt) {
return (0, path_1.join)(resolvePackageDir(appId, packageName, ver), `${exports.PACKAGE_JSON_FILENAME}${salt ? `.${salt}` : ''}.json`);
}
exports.resolvePackageJSONPath = resolvePackageJSONPath;