UNPKG

igir

Version:

🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.

42 lines (41 loc) • 1.66 kB
import module from "node:module"; import path from "node:path"; import util from "node:util"; const require2 = module.createRequire(import.meta.url); const yargsRoot = path.dirname(require2.resolve("yargs/package.json")); const { YargsFactory: YargsFactoryRaw } = require2(`${yargsRoot}/build/lib/yargs-factory.js`); const { default: esmShimRaw } = require2(`${yargsRoot}/lib/platform-shims/esm.mjs`); const enLocaleRaw = require2(`${yargsRoot}/locales/en.json`); const YargsFactory = YargsFactoryRaw; const esmShim = esmShimRaw; const enLocale = enLocaleRaw; const format = (template, ...args) => util.format(template, ...args.filter((arg) => typeof arg !== "function")); const makeY18n = () => { const translations = { ...enLocale }; return { __: (...args) => { const [key, ...rest] = args; if (typeof key !== "string") { return util.inspect(key); } const entry = translations[key]; return format(typeof entry === "string" ? entry : key, ...rest); }, __n: (singular, plural, count, ...args) => { const entry = translations[singular]; const template = typeof entry === "object" ? entry[count === 1 ? "one" : "other"] : count === 1 ? singular : plural; return format(template, ...template.includes("%d") ? [count, ...args] : args); }, setLocale: () => void 0, getLocale: () => "en", updateLocale: (obj) => { Object.assign(translations, obj); } }; }; const yargs = (processArgs, cwd) => YargsFactory({ ...esmShim, y18n: makeY18n() })(processArgs, cwd); var yargsShim_default = yargs; export { yargsShim_default as default }; //# sourceMappingURL=yargsShim.js.map