UNPKG

@gensx/storage

Version:

Cloud storage, blobs, sqlite, and vector database providers/hooks for GenSX.

40 lines (35 loc) 1.64 kB
'use strict'; /** * Check out the docs at https://www.gensx.com/docs * Find us on Github https://github.com/gensx-inc/gensx * Find us on Discord https://discord.gg/F5BSU8Kc */ var node_fs = require('node:fs'); var path = require('node:path'); var node_url = require('node:url'); var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; let version = ""; const dirname = path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('utils/user-agent.cjs', document.baseURI).href)))); let rootDir = path.resolve(dirname, "..", "..", ".."); let packageJsonPath = path.join(rootDir, "package.json"); if (node_fs.existsSync(packageJsonPath)) { const localPackageJson = JSON.parse(node_fs.readFileSync(packageJsonPath, "utf8")); version = localPackageJson.version; } else { // if the first check fails, try two levels up instead of three rootDir = path.resolve(dirname, "..", ".."); packageJsonPath = path.join(rootDir, "package.json"); if (node_fs.existsSync(packageJsonPath)) { const localPackageJson = JSON.parse(node_fs.readFileSync(packageJsonPath, "utf8")); version = localPackageJson.version; } else { console.error("Error trying to get version from package.json"); } } const VERSION = version; const USER_AGENT = `@gensx/storage v${VERSION}`; exports.USER_AGENT = USER_AGENT; exports.VERSION = VERSION; //# sourceMappingURL=user-agent.cjs.map