@terai/dev 0.0.0-dev-20251122135504 → 0.0.0-dev-20251208143016

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,7 +62,7 @@ GFS4: `),console.error(e)}),n[s]||(u(n,global[s]||[]),n.close=(function(e){funct
62
62
  Try running with %s or get access `,B.cyan(`sudo`))+`
63
63
  to the local update config store via
64
64
  `+B.cyan(h(` sudo chown -R $USER:$(id -gn $USER) %s `,At));o.on(`exit`,()=>{console.error(Ic(t,{textAlignment:`center`}))})}}check(){!this.config||this.config.get(`optOut`)||this.#r||(this.update=this.config.get(`update`),this.update&&(this.update.current=this.#t,this.config.delete(`update`)),!(Date.now()-this.config.get(`lastUpdateCheck`)<this.#n)&&l(o.execPath,[m.join(Kc,`check.js`),JSON.stringify(this.#e)],{detached:!0,stdio:`ignore`}).unref())}async fetchInfo(){let{distTag:e}=this.#e,t=await vs(this._packageName,{version:e});return{latest:t,current:this.#t,type:Nr(this.#t,t)||e,name:this._packageName}}notify(e){let t=!this._shouldNotifyInNpmScript&&Cs;if(!o.stdout.isTTY||t||!this.update||!Gc.default.gt(this.update.latest,this.update.current))return this;e={isGlobal:Ds.default,isYarnGlobal:Os(),...e};let n;n=e.isYarnGlobal?`yarn global add ${this._packageName}`:e.isGlobal?`npm i -g ${this._packageName}`:ks()?`yarn add ${this._packageName}`:`npm i ${this._packageName}`;let r=`Update available `+B.dim(`{currentVersion}`)+B.reset(` → `)+B.green(`{latestVersion}`)+`
65
- Run `+B.cyan(`{updateCommand}`)+` to update`,i=e.message||r;e.boxenOptions=e.boxenOptions||{padding:1,margin:1,textAlignment:`center`,borderColor:`yellow`,borderStyle:`round`};let a=Ic(Wc(i,{packageName:this._packageName,currentVersion:this.update.current,latestVersion:this.update.latest,updateCommand:n}),e.boxenOptions);return e.defer===!1?console.error(a):(o.on(`exit`,()=>{console.error(a)}),o.on(`SIGINT`,()=>{console.error(``),o.exit()})),this}};function Jc(e){let t=new qc(e);return t.check(),t}var Yc=`0.0.14`,Xc={name:`@terai/dev`,version:Yc,description:`The user-facing package for Terai`,main:`./dist/index.cjs`,module:`./dist/index.mjs`,types:`./dist/index.d.ts`,private:!1,author:`Hugo Corta <corta.hugo@gmail.com>`,bin:{terai:`bin.js`},scripts:{dev:`tsdown --format=esm --no-dts --watch`,build:`tsdown`},files:[`bin.js`,`dist`],sideEffects:!1,publishConfig:{access:`public`},exports:{".":{import:{types:`./dist/index.d.mts`,default:`./dist/index.mjs`},require:{types:`./dist/index.d.cts`,default:`./dist/index.cjs`}}},dependencies:{"@inquirer/prompts":`^3`,"@terai/extractor":`workspace:*`,"@terai/runtime":`workspace:*`,"@terai/translator":`workspace:*`,"@terai/utils":`workspace:*`,"@terai/types":`workspace:*`,cac:`^6`,dotenv:`^1`,inquirer:`^9`,kleur:`^4`,"perfect-debounce":`^1`,"preferred-pm":`^3`},devDependencies:{"@terai/generator":`workspace:*`,"@terai/logger":`workspace:*`,"@types/update-notifier":`^6`,"update-notifier":`^6`}},Zc=D(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.outdent=void 0;function n(){}function r(){return typeof WeakMap<`u`?new WeakMap:i()}function i(){return{add:n,delete:n,get:n,set:n,has:function(e){return!1}}}var a=Object.prototype.hasOwnProperty,o=function(e,t){return a.call(e,t)};function s(e,t){for(var n in t)o(t,n)&&(e[n]=t[n]);return e}var c=/^[ \t]*(?:\r\n|\r|\n)/,l=/(?:\r\n|\r|\n)[ \t]*$/,u=/^(?:[\r\n]|$)/,d=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,f=/^[ \t]*[\r\n][ \t\r\n]*$/;function p(e,t,n){var r=0,i=e[0].match(d);i&&(r=i[1].length);var a=`(\\r\\n|\\r|\\n).{0,`+r+`}`,o=new RegExp(a,`g`);t&&(e=e.slice(1));var s=n.newline,u=n.trimLeadingNewline,f=n.trimTrailingNewline,p=typeof s==`string`,m=e.length;return e.map(function(e,t){return e=e.replace(o,`$1`),t===0&&u&&(e=e.replace(c,``)),t===m-1&&f&&(e=e.replace(l,``)),p&&(e=e.replace(/\r\n|\n|\r/g,function(e){return s})),e})}function m(e,t){for(var n=``,r=0,i=e.length;r<i;r++)n+=e[r],r<i-1&&(n+=t[r]);return n}function h(e){return o(e,`raw`)&&o(e,`length`)}function g(e){var t=r(),n=r();function i(r){var a=[...arguments].slice(1);if(h(r)){var o=r,c=(a[0]===i||a[0]===_)&&f.test(o[0])&&u.test(o[1]),l=c?n:t,d=l.get(o);return d||(d=p(o,c,e),l.set(o,d)),a.length===0?d[0]:m(d,c?a.slice(1):a)}else return g(s(s({},e),r||{}))}return s(i,{string:function(t){return p([t],!1,e)[0]}})}var _=g({trimLeadingNewline:!0,trimTrailingNewline:!0});if(e.outdent=_,e.default=_,t!==void 0)try{t.exports=_,Object.defineProperty(_,`__esModule`,{value:!0}),_.default=_,_.outdent=_}catch{}}))();function Qc(e,t){return e.command(`init`,`Initialize config file`).option(`-f, --force`,`Force overwrite existing config files`).option(`--cwd <cwd>`,`Current working directory`,{default:t}).action($c)}async function $c({cwd:e,force:t}){F.heading(`init`,`Initialize config file`);let r=n({cwd:e}),i=(await ye(e))?.name??`npm`,o=i===`npm`?`npm run`:i;if(r&&!t)return F.log(Zc.outdent`
65
+ Run `+B.cyan(`{updateCommand}`)+` to update`,i=e.message||r;e.boxenOptions=e.boxenOptions||{padding:1,margin:1,textAlignment:`center`,borderColor:`yellow`,borderStyle:`round`};let a=Ic(Wc(i,{packageName:this._packageName,currentVersion:this.update.current,latestVersion:this.update.latest,updateCommand:n}),e.boxenOptions);return e.defer===!1?console.error(a):(o.on(`exit`,()=>{console.error(a)}),o.on(`SIGINT`,()=>{console.error(``),o.exit()})),this}};function Jc(e){let t=new qc(e);return t.check(),t}var Yc=`0.0.16`,Xc={name:`@terai/dev`,version:Yc,description:`The user-facing package for Terai`,main:`./dist/index.cjs`,module:`./dist/index.mjs`,types:`./dist/index.d.ts`,private:!1,author:`Hugo Corta <corta.hugo@gmail.com>`,bin:{terai:`bin.js`},scripts:{dev:`tsdown --format=esm --no-dts --watch`,build:`tsdown`},files:[`bin.js`,`dist`],sideEffects:!1,publishConfig:{access:`public`},exports:{".":{import:{types:`./dist/index.d.mts`,default:`./dist/index.mjs`},require:{types:`./dist/index.d.cts`,default:`./dist/index.cjs`}}},dependencies:{"@inquirer/prompts":`^3`,"@terai/extractor":`workspace:*`,"@terai/runtime":`workspace:*`,"@terai/translator":`workspace:*`,"@terai/utils":`workspace:*`,"@terai/types":`workspace:*`,cac:`^6`,dotenv:`^1`,inquirer:`^9`,kleur:`^4`,"perfect-debounce":`^1`,"preferred-pm":`^3`},devDependencies:{"@terai/generator":`workspace:*`,"@terai/logger":`workspace:*`,"@types/update-notifier":`^6`,"update-notifier":`^6`}},Zc=D(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.outdent=void 0;function n(){}function r(){return typeof WeakMap<`u`?new WeakMap:i()}function i(){return{add:n,delete:n,get:n,set:n,has:function(e){return!1}}}var a=Object.prototype.hasOwnProperty,o=function(e,t){return a.call(e,t)};function s(e,t){for(var n in t)o(t,n)&&(e[n]=t[n]);return e}var c=/^[ \t]*(?:\r\n|\r|\n)/,l=/(?:\r\n|\r|\n)[ \t]*$/,u=/^(?:[\r\n]|$)/,d=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,f=/^[ \t]*[\r\n][ \t\r\n]*$/;function p(e,t,n){var r=0,i=e[0].match(d);i&&(r=i[1].length);var a=`(\\r\\n|\\r|\\n).{0,`+r+`}`,o=new RegExp(a,`g`);t&&(e=e.slice(1));var s=n.newline,u=n.trimLeadingNewline,f=n.trimTrailingNewline,p=typeof s==`string`,m=e.length;return e.map(function(e,t){return e=e.replace(o,`$1`),t===0&&u&&(e=e.replace(c,``)),t===m-1&&f&&(e=e.replace(l,``)),p&&(e=e.replace(/\r\n|\n|\r/g,function(e){return s})),e})}function m(e,t){for(var n=``,r=0,i=e.length;r<i;r++)n+=e[r],r<i-1&&(n+=t[r]);return n}function h(e){return o(e,`raw`)&&o(e,`length`)}function g(e){var t=r(),n=r();function i(r){var a=[...arguments].slice(1);if(h(r)){var o=r,c=(a[0]===i||a[0]===_)&&f.test(o[0])&&u.test(o[1]),l=c?n:t,d=l.get(o);return d||(d=p(o,c,e),l.set(o,d)),a.length===0?d[0]:m(d,c?a.slice(1):a)}else return g(s(s({},e),r||{}))}return s(i,{string:function(t){return p([t],!1,e)[0]}})}var _=g({trimLeadingNewline:!0,trimTrailingNewline:!0});if(e.outdent=_,e.default=_,t!==void 0)try{t.exports=_,Object.defineProperty(_,`__esModule`,{value:!0}),_.default=_,_.outdent=_}catch{}}))();function Qc(e,t){return e.command(`init`,`Initialize config file`).option(`-f, --force`,`Force overwrite existing config files`).option(`--cwd <cwd>`,`Current working directory`,{default:t}).action($c)}async function $c({cwd:e,force:t}){F.heading(`init`,`Initialize config file`);let r=n({cwd:e}),i=(await ye(e))?.name??`npm`,o=i===`npm`?`npm run`:i;if(r&&!t)return F.log(Zc.outdent`
66
66
  It looks like you already have a config file created.
67
67
  You can now run ${F.colors.cyan(`'${o} terai extract --watch'`)}
68
68
  `);let s=await ve({message:`What locale do you use in your project messages?`,default:`en-US`,validate:e=>e.trim().length===0?`Please provide a valid locale`:!0}),c=await ve({message:`What locales do you want to support? (comma separated)`,default:`fr-FR,es-ES,de-DE`,validate:e=>e.trim().length===0?`Please provide at least one locale`:!0,transformer:e=>e.split(`,`).map(e=>e.trim()).join(`,`)}),l=await ve({message:`Where do you want to place your generated files?`,default:`./locale`}),u=F.time.success();await a({cwd:e,projectLocale:s,outDir:l,outLocales:c.split(`,`)}),u(`Config file created`),F.log(`🚀 You are set up to start using Terai! Thanks for choosing it.`)}async function el({dictionaries:e,locale:t,cwd:n,outDir:r}){let a=i.path.resolve(n,r,t),o=[];for(let t in e){let n=i.path.resolve(a,`${t}.json`),r=e[t],s=Te(r);i.fs.write(n,s),o.push(s)}return o}function tl(e,t){return e.command(`extract`,`Statically extract messages from your project`).option(`-w, --watch`,`Watch files and rebuild`).option(`--cwd <cwd>`,`Current working directory`,{default:t}).action(nl)}async function nl(e){F.heading(`extract`,`Statically extract messages from your project`);let t=F.time.success(),n=await r(e),a=i.fs.glob({...n,cwd:e.cwd}),o=i.path.resolve(e.cwd,n.outDir),s=i.path.resolve(o,n.projectLocale),c=i.path.resolve(o,`.terai`,`locale-manifest.json`);F.info(`Scan:`,`Processing files...`);async function l(t=a){let r=await xe({...n,filesPaths:t,cwd:e.cwd}),o=Se(r),l={messages:r},u=Ce(o,l,n.projectLocale);return i.fs.remove(i.path.resolve(s)),await el({...n,dictionaries:u,locale:n.projectLocale,cwd:e.cwd}),i.fs.write(c,Te(l)),Object.keys(o).length}F.info(`Extraction:`,`Extracting messages...`),t(`Extracted ${await l()} messages`),e.watch&&(F.log(``),F.info(`Watch:`,`Watching files for changes...