one
Version:
One is a React framework for web, iOS, and Android apps.
20 lines (17 loc) • 640 B
JavaScript
import { fileURLToPath, pathToFileURL } from "url";
import { dirname, resolve } from "path";
var cache = /* @__PURE__ */ new Map();
async function workerImport(relativePath, callerUrl) {
var callerDir = dirname(fileURLToPath(callerUrl));
var absolutePath = resolve(callerDir, relativePath);
var cacheKey = absolutePath;
if (cache.has(cacheKey)) {
return cache.get(cacheKey);
}
var mjsPath = absolutePath.endsWith(".mjs") ? absolutePath : `${absolutePath}.mjs`;
var mod = await import(pathToFileURL(mjsPath).href);
cache.set(cacheKey, mod);
return mod;
}
export { workerImport };
//# sourceMappingURL=workerImport.native.js.map