@sidekick-coder/db
Version:
Cli Tool to manipulate data from diferent sources
20 lines (16 loc) • 774 B
JavaScript
;
var path = require('path');
var url = require('url');
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
// src/utils/usePath.ts
var usePath = (url$1) => {
const __filename = url.fileURLToPath(url$1);
const __dirname = path.dirname(__filename);
return { __filename, __dirname };
};
function rootPath(...paths) {
const { __dirname } = usePath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('usePath.cjs', document.baseURI).href)));
return path.resolve(__dirname, "..", ...paths);
}
exports.rootPath = rootPath;
exports.usePath = usePath;