mirror of
https://github.com/ragestudio/relic.git
synced 2025-06-09 02:24:18 +00:00
23 lines
773 B
JavaScript
23 lines
773 B
JavaScript
import PublicInternalLibraries from "./libs"
|
|
|
|
const isAClass = (x) => x && typeof x === "function" && x.prototype && typeof x.prototype.constructor === "function"
|
|
|
|
export default async (dependencies, bindCtx) => {
|
|
const libraries = {}
|
|
|
|
for await (const lib of dependencies) {
|
|
if (PublicInternalLibraries[lib]) {
|
|
if (typeof PublicInternalLibraries[lib] === "function" && isAClass(PublicInternalLibraries[lib])) {
|
|
libraries[lib] = new PublicInternalLibraries[lib](bindCtx)
|
|
|
|
if (libraries[lib].initialize) {
|
|
await libraries[lib].initialize()
|
|
}
|
|
} else {
|
|
libraries[lib] = PublicInternalLibraries[lib]
|
|
}
|
|
}
|
|
}
|
|
|
|
return libraries
|
|
} |