UNPKG

@sebastianwessel/quickjs

Version:

A typescript package to execute JavaScript and TypeScript code in a WebAssembly QuickJS sandbox

17 lines (16 loc) 656 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.modulePathNormalizerAsync = void 0; const node_path_1 = require("node:path"); const modulePathNormalizerAsync = async (baseName, requestedName) => { // relative import if (requestedName.startsWith('.')) { const parts = baseName.split('/'); parts.pop(); return (0, node_path_1.resolve)(`/${parts.join('/')}`, requestedName); } // module import const moduleName = requestedName.replace('node:', ''); return (0, node_path_1.join)('/node_modules', moduleName); }; exports.modulePathNormalizerAsync = modulePathNormalizerAsync;