UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

1 lines • 1.16 kB
{"version":3,"file":"workerImport.js","names":[],"sources":["esm/utils/workerImport.js"],"sourcesContent":["import { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { dirname, resolve } from \"node:path\";\nconst cache = /* @__PURE__ */ new Map();\nasync function workerImport(relativePath, callerUrl) {\n const callerDir = dirname(fileURLToPath(callerUrl));\n const absolutePath = resolve(callerDir, relativePath);\n const cacheKey = absolutePath;\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey);\n }\n const mjsPath = absolutePath.endsWith(\".mjs\") ? absolutePath : `${absolutePath}.mjs`;\n const mod = await import(pathToFileURL(mjsPath).href);\n cache.set(cacheKey, mod);\n return mod;\n}\nexport {\n workerImport\n};\n//# sourceMappingURL=workerImport.js.map\n"],"mappings":";;;;AAEA,MAAM,wBAAwB,IAAI,IAAI;AACtC,eAAe,aAAa,cAAc,WAAW;CACnD,MAAM,YAAY,QAAQ,cAAc,SAAS,CAAC;CAClD,MAAM,eAAe,QAAQ,WAAW,YAAY;CACpD,MAAM,WAAW;CACjB,IAAI,MAAM,IAAI,QAAQ,GAAG;EACvB,OAAO,MAAM,IAAI,QAAQ;CAC3B;CACA,MAAM,UAAU,aAAa,SAAS,MAAM,IAAI,eAAe,GAAG,aAAa;CAC/E,MAAM,MAAM,MAAM,OAAO,cAAc,OAAO,CAAC,CAAC;CAChD,MAAM,IAAI,UAAU,GAAG;CACvB,OAAO;AACT"}