@mrgrain/jsii-struct-builder
Advanced tools
Comparing version 0.5.14 to 0.5.15
@@ -7,12 +7,33 @@ "use strict"; | ||
exports.findInterface = void 0; | ||
const path_1 = __importDefault(require("path")); | ||
const node_path_1 = require("node:path"); | ||
const spec_1 = require("@jsii/spec"); | ||
const structured_clone_1 = __importDefault(require("@ungap/structured-clone")); | ||
const DOT_JSII = '.jsii'; | ||
const assemblies = {}; | ||
function assemblyPath(asm) { | ||
return path_1.default.dirname(require.resolve(`${asm}/.jsii`)); | ||
return (0, node_path_1.dirname)(require.resolve((0, node_path_1.join)(asm, DOT_JSII))); | ||
} | ||
function loadAssemblyByName(asm) { | ||
return loadAssemblyFromDirectory(asm, assemblyPath(asm)); | ||
} | ||
function loadAssemblyFromDirectory(asm, dir) { | ||
const assembly = (0, spec_1.loadAssemblyFromPath)(dir, false); | ||
if (assembly.name !== asm) { | ||
throw `jsii assembly ${asm} not found in ${(0, node_path_1.join)(dir, DOT_JSII)}, got: ${assembly.name}`; | ||
} | ||
return assembly; | ||
} | ||
function loadAssembly(asm) { | ||
if (!assemblies[asm]) { | ||
assemblies[asm] = (0, spec_1.loadAssemblyFromPath)(assemblyPath(asm), false); | ||
try { | ||
assemblies[asm] = loadAssemblyByName(asm); | ||
} | ||
catch (error) { | ||
try { | ||
assemblies[asm] = loadAssemblyFromDirectory(asm, process.cwd()); | ||
} | ||
catch (errorLocal) { | ||
throw new AggregateError([error, errorLocal], `jsii assembly ${asm} not found`); | ||
} | ||
} | ||
} | ||
@@ -26,3 +47,3 @@ return assemblies[asm]; | ||
if (!candidate) { | ||
throw `Type ${fqn} not found`; | ||
throw `Type ${fqn} not found in jsii assembly ${asm}`; | ||
} | ||
@@ -64,2 +85,2 @@ if ((candidate === null || candidate === void 0 ? void 0 : candidate.kind) !== spec_1.TypeKind.Interface) { | ||
exports.findInterface = findInterface; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZW1ibHkuanMiLCJzb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AgfSk7XG4gICAgcGFyZW50U3BlYy5tZXRob2RzPy5mb3JFYWNoKChtKSA9PiB7XG4gICAgICBtZXRob2RzLnNldChtLm5hbWUsIG0pO1xuICAgIH0pO1xuICB9XG5cbiAgc3BlYy5wcm9wZXJ0aWVzPy5mb3JFYWNoKChwKSA9PiB7XG4gICAgcHJvcHMuc2V0KHAubmFtZSwgcCk7XG4gIH0pO1xuICBzcGVjLm1ldGhvZHM/LmZvckVhY2goKG0pID0+IHtcbiAgICBtZXRob2RzLnNldChtLm5hbWUsIG0pO1xuICB9KTtcblxuICByZXR1cm4ge1xuICAgIC4uLnNwZWMsXG4gICAgbWV0aG9kczogQXJyYXkuZnJvbShtZXRob2RzLnZhbHVlcygpKSxcbiAgICBwcm9wZXJ0aWVzOiBBcnJheS5mcm9tKHByb3BzLnZhbHVlcygpKSxcbiAgfTtcbn1cbiJdfQ== |
@@ -68,3 +68,3 @@ { | ||
}, | ||
"version": "0.5.14", | ||
"version": "0.5.15", | ||
"jest": { | ||
@@ -71,0 +71,0 @@ "testMatch": [ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
118429
999