@ycmd/creds
Version:
LSK.js CLI Creds is the easiest way to manage GitHub / Gitlab secrets and credentials
33 lines (31 loc) • 1.11 kB
JavaScript
import { __name, __require } from './chunk-U2DZE3DI.js';
import { Err } from '@lsk4/err';
async function importRequire(path, { removeCache } = {}) {
try {
const res = __require(path);
if (removeCache)
delete __require.cache[__require.resolve(path)];
return res;
} catch (requireErr) {
if (Err.getCode(requireErr) === "MODULE_NOT_FOUND") {
throw new Err(`${path} not found`, requireErr);
}
const isTryImport = Err.getCode(requireErr).startsWith("Dynamic require of") || Err.getCode(requireErr).startsWith("ReferenceError: module is not defined in ES module scope");
if (isTryImport) {
try {
const res = await import(path);
return res;
} catch (importErr) {
if (Err.getCode(importErr) === "ERR_MODULE_NOT_FOUND") {
throw new Err(`${path} not found`, importErr);
}
throw new Err("importErr", importErr);
}
}
throw new Err("requireErr", requireErr);
}
}
__name(importRequire, "importRequire");
export { importRequire };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-XPIAUU4D.js.map