@fluenti/cli 0.6.1 → 0.6.2
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.
- package/dist/cli/src/ai-provider.d.ts +0 -1
- package/dist/cli/src/catalog.d.ts +0 -1
- package/dist/cli/src/check.d.ts +0 -1
- package/dist/cli/src/cli.d.ts +0 -1
- package/dist/cli/src/codemod.d.ts +0 -1
- package/dist/cli/src/compile-cache.d.ts +0 -1
- package/dist/cli/src/compile-runner.d.ts +0 -1
- package/dist/cli/src/compile-worker.d.ts +0 -1
- package/dist/cli/src/compile.d.ts +0 -1
- package/dist/cli/src/config-loader.d.ts +0 -1
- package/dist/cli/src/config.d.ts +0 -1
- package/dist/cli/src/doctor.d.ts +0 -1
- package/dist/cli/src/extract-cache.d.ts +0 -1
- package/dist/cli/src/extract-runner.d.ts +0 -1
- package/dist/cli/src/glossary.d.ts +0 -1
- package/dist/cli/src/index.d.ts +0 -1
- package/dist/cli/src/init.d.ts +0 -1
- package/dist/cli/src/json-format.d.ts +0 -1
- package/dist/cli/src/lint.d.ts +0 -1
- package/dist/cli/src/migrate.d.ts +0 -1
- package/dist/cli/src/parallel-compile.d.ts +0 -1
- package/dist/cli/src/po-format.d.ts +0 -1
- package/dist/cli/src/stats-format.d.ts +0 -1
- package/dist/cli/src/translate-parse.d.ts +0 -1
- package/dist/cli/src/translate-prompt.d.ts +0 -1
- package/dist/cli/src/translate.d.ts +0 -1
- package/dist/cli/src/tsx-extractor.d.ts +0 -1
- package/dist/cli/src/validation.d.ts +0 -1
- package/dist/cli/src/vue-extractor.d.ts +0 -1
- package/dist/cli.cjs +1 -2
- package/dist/cli.js +0 -2
- package/dist/compile-C3VLvhUf.cjs +1 -2
- package/dist/compile-CZVpE5Md.js +0 -2
- package/dist/compile-worker.cjs +1 -2
- package/dist/compile-worker.js +0 -2
- package/dist/doctor-BqXXxyST.js +0 -2
- package/dist/doctor-xp8WS8sr.cjs +1 -2
- package/dist/index.cjs +1 -2
- package/dist/index.js +28 -13
- package/dist/tsx-extractor-AOjsbOmp.cjs +1 -2
- package/dist/tsx-extractor-C-HZNobu.js +0 -2
- package/dist/vue-extractor.cjs +1 -2
- package/dist/vue-extractor.js +0 -2
- package/package.json +2 -2
- package/dist/cli/src/ai-provider.d.ts.map +0 -1
- package/dist/cli/src/catalog.d.ts.map +0 -1
- package/dist/cli/src/check.d.ts.map +0 -1
- package/dist/cli/src/cli.d.ts.map +0 -1
- package/dist/cli/src/codemod.d.ts.map +0 -1
- package/dist/cli/src/compile-cache.d.ts.map +0 -1
- package/dist/cli/src/compile-runner.d.ts.map +0 -1
- package/dist/cli/src/compile-worker.d.ts.map +0 -1
- package/dist/cli/src/compile.d.ts.map +0 -1
- package/dist/cli/src/config-loader.d.ts.map +0 -1
- package/dist/cli/src/config.d.ts.map +0 -1
- package/dist/cli/src/doctor.d.ts.map +0 -1
- package/dist/cli/src/extract-cache.d.ts.map +0 -1
- package/dist/cli/src/extract-runner.d.ts.map +0 -1
- package/dist/cli/src/glossary.d.ts.map +0 -1
- package/dist/cli/src/index.d.ts.map +0 -1
- package/dist/cli/src/init.d.ts.map +0 -1
- package/dist/cli/src/json-format.d.ts.map +0 -1
- package/dist/cli/src/lint.d.ts.map +0 -1
- package/dist/cli/src/migrate.d.ts.map +0 -1
- package/dist/cli/src/parallel-compile.d.ts.map +0 -1
- package/dist/cli/src/po-format.d.ts.map +0 -1
- package/dist/cli/src/stats-format.d.ts.map +0 -1
- package/dist/cli/src/translate-parse.d.ts.map +0 -1
- package/dist/cli/src/translate-prompt.d.ts.map +0 -1
- package/dist/cli/src/translate.d.ts.map +0 -1
- package/dist/cli/src/tsx-extractor.d.ts.map +0 -1
- package/dist/cli/src/validation.d.ts.map +0 -1
- package/dist/cli/src/vue-extractor.d.ts.map +0 -1
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/compile-C3VLvhUf.cjs.map +0 -1
- package/dist/compile-CZVpE5Md.js.map +0 -1
- package/dist/compile-worker.cjs.map +0 -1
- package/dist/compile-worker.js.map +0 -1
- package/dist/doctor-BqXXxyST.js.map +0 -1
- package/dist/doctor-xp8WS8sr.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/tsx-extractor-AOjsbOmp.cjs.map +0 -1
- package/dist/tsx-extractor-C-HZNobu.js.map +0 -1
- package/dist/vue-extractor.cjs.map +0 -1
- package/dist/vue-extractor.js.map +0 -1
package/dist/cli/src/check.d.ts
CHANGED
package/dist/cli/src/cli.d.ts
CHANGED
|
@@ -38,4 +38,3 @@ export declare function extractMessageVariables(message: string): MessageVariabl
|
|
|
38
38
|
* Generate a TypeScript declaration file with MessageId union and MessageValues interface.
|
|
39
39
|
*/
|
|
40
40
|
export declare function compileTypeDeclaration(allIds: string[], catalogs: Record<string, CatalogData>, sourceLocale: string): string;
|
|
41
|
-
//# sourceMappingURL=compile.d.ts.map
|
package/dist/cli/src/config.d.ts
CHANGED
package/dist/cli/src/doctor.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ export type GlossaryData = Record<string, Record<string, string>>;
|
|
|
2
2
|
export declare function loadGlossary(glossaryPath: string): GlossaryData;
|
|
3
3
|
export declare function getGlossaryForLocale(glossary: GlossaryData, locale: string): Record<string, string>;
|
|
4
4
|
export declare function buildGlossaryPromptSection(terms: Record<string, string>): string;
|
|
5
|
-
//# sourceMappingURL=glossary.d.ts.map
|
package/dist/cli/src/index.d.ts
CHANGED
|
@@ -18,4 +18,3 @@ export { rewriteFluentiImports, runCodemod } from './codemod';
|
|
|
18
18
|
export type { CodemodOptions, CodemodResult } from './codemod';
|
|
19
19
|
export { runDoctor, formatDoctorReport } from './doctor';
|
|
20
20
|
export type { DoctorOptions, DoctorReport, DoctorFinding } from './doctor';
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/cli/src/init.d.ts
CHANGED
package/dist/cli/src/lint.d.ts
CHANGED
|
@@ -23,4 +23,3 @@ export interface ParallelCompileResult {
|
|
|
23
23
|
* (e.g. when running from TypeScript source in development/tests).
|
|
24
24
|
*/
|
|
25
25
|
export declare function parallelCompile(tasks: ParallelCompileTask[], concurrency?: number): Promise<ParallelCompileResult[]>;
|
|
26
|
-
//# sourceMappingURL=parallel-compile.d.ts.map
|
|
@@ -17,4 +17,3 @@ export declare function extractHtmlTags(message: string): string[];
|
|
|
17
17
|
export declare function validateTranslation(source: string, translation: string): ValidationResult;
|
|
18
18
|
/** Validate a batch of translations, returning only invalid entries */
|
|
19
19
|
export declare function validateBatch(sources: Record<string, string>, translations: Record<string, string>): Record<string, ValidationResult>;
|
|
20
|
-
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { ExtractedMessage } from '@fluenti/core/compiler';
|
|
2
2
|
/** Extract messages from Vue SFC files */
|
|
3
3
|
export declare function extractFromVue(code: string, filename: string, idGenerator?: (message: string, context?: string) => string): ExtractedMessage[];
|
|
4
|
-
//# sourceMappingURL=vue-extractor.d.ts.map
|
package/dist/cli.cjs
CHANGED
|
@@ -9,5 +9,4 @@ const e=require(`./doctor-xp8WS8sr.cjs`),t=require(`./tsx-extractor-AOjsbOmp.cjs
|
|
|
9
9
|
... (truncated)`:n})}return t}function ce(e){let t=typeof __dirname<`u`?__dirname:(0,a.dirname)((0,o.fileURLToPath)({}.url)),n=[(0,a.resolve)(`node_modules`,`@fluenti`,`cli`,`..`,`..`,e),(0,a.join)(t,`..`,`..`,`..`,e),(0,a.join)(t,`..`,`..`,e)];for(let e of n)if((0,i.existsSync)(e))return(0,i.readFileSync)(e,`utf-8`);return``}function le(e,t,n){let r=[];if(r.push(`You are a migration tool converting a ${e.framework} project from "${e.name}" to Fluenti (@fluenti).`,``,`Tasks:`,"1. Generate a `fluenti.config.ts` based on the existing i18n configuration",`2. Convert each locale/translation file to standard gettext PO format`,`3. Generate unified diff patches for every source file that needs changes`,`4. Generate install/uninstall commands`,``,`=== TRANSLATION API RULES ===`,"Fluenti provides a compile-time `t` tagged template that does NOT require useI18n():",``,` import { t } from '@fluenti/react' // or @fluenti/vue, @fluenti/solid`,` const name = "World"`," t`Hello, ${name}!`",``,"Use `import { t }` for ALL translation calls. Only use `useI18n()` when you need:","- `d()` / `n()` for date/number formatting","- `setLocale()` for locale switching","- `locale` for reading the current locale reactively",``,`=== SOURCE CODE REWRITING RULES ===`,`Imports:`,`- ${e.name}: remove all imports from "${e.name}" (and related packages)`,`- Add: import { t } from '@fluenti/${e.framework===`Vue`?`vue`:e.framework===`Next.js`?`react`:e.framework.toLowerCase()}'`,`- Only add useI18n import if d()/n()/setLocale is needed in that file`,``,`Translation calls:`,"- t('key') → t`Source text` (tagged template with the actual source text, not the key)","- t('key', { name }) → t`Hello, ${name}` (interpolate directly in template)","- $t('key') → t`Source text` (Vue template)",`- Remove useI18n()/useTranslation()/useTranslations() destructuring if only t was used`,``,`Components:`,`- <i18n-t keypath="key"> → <Trans>Source text</Trans>`,`- <Trans i18nKey="key"> → <Trans>Source text</Trans>`,``,`ICU syntax conversion:`,`- {{variable}} (double braces) → {variable} (single braces)`,`- _one/_other suffixes → ICU {count, plural, one {...} other {...}}`,`- @:key references → inline the referenced text directly`,`- Pipe-separated plurals → ICU plural`,``,`=== PO FORMAT RULES ===`,`Each PO file must have a standard header:`,` msgid ""`,` msgstr ""`,` "Content-Type: text/plain; charset=UTF-8\\n"`,` "Content-Transfer-Encoding: 8bit\\n"`,` "Language: {locale}\\n"`,``,`Message entries: msgid is the source text (English), msgstr is the translation.`,`Flatten nested JSON keys: "home.title" → use the actual source text as msgid.`,``),n&&r.push(`=== MIGRATION GUIDE ===`,n,``),t.packageJson&&r.push(`=== package.json ===`,t.packageJson,``),t.configFiles.length>0){r.push(`=== EXISTING CONFIG FILES ===`);for(let e of t.configFiles)r.push(`--- ${e.path} ---`,e.content,``)}if(t.localeFiles.length>0){r.push(`=== EXISTING LOCALE FILES ===`);for(let e of t.localeFiles)r.push(`--- ${e.path} ---`,e.content,``)}if(t.sampleSources.length>0){r.push(`=== SAMPLE SOURCE FILES ===`);for(let e of t.sampleSources)r.push(`--- ${e.path} ---`,e.content,``)}return r.push(``,`=== OUTPUT FORMAT ===`,`Output ONLY the following sections. No explanations, no commentary.`,``,`### FLUENTI_CONFIG`,"```ts",`// Complete fluenti.config.ts`,"```",``,`### LOCALE_FILES`,`#### LOCALE: {locale_code}`,"```po",`// Complete PO file with standard header`,"```",`(repeat for each locale)`,``,`### SOURCE_PATCHES`,`#### FILE: {relative_file_path}`,"```diff",`--- a/{file_path}`,`+++ b/{file_path}`,`@@ ... @@`,` context line`,`-removed line`,`+added line`,"```",`(repeat for each file that needs changes)`,``,`### INSTALL_COMMANDS`,"```bash",`// install + uninstall commands`,"```"),r.join(`
|
|
10
10
|
`)}async function ue(e,t){let n=10*1024*1024;try{if(e===`claude`){let{stdout:e}=await K(`claude`,[`-p`,t],{maxBuffer:n});return e}else{let{stdout:e}=await K(`codex`,[`-p`,t,`--full-auto`],{maxBuffer:n});return e}}catch(t){let n=t;throw n.code===`ENOENT`||n.code===`EPERM`||n.code===`EACCES`?Error(`"${e}" CLI not found or not executable. Please install it first:\n`+(e===`claude`?` npm install -g @anthropic-ai/claude-code`:` npm install -g @openai/codex`)):t}}function de(e){let t=5e5,n=e.length>t?e.slice(0,t):e,r={config:void 0,localeFiles:[],sourcePatches:[],steps:void 0,installCommands:void 0},i=n.match(/### FLUENTI_CONFIG[\s\S]*?```(?:ts|typescript)?\n([\s\S]*?)```/);i&&(r.config=i[1].trim());let a=n.match(/### LOCALE_FILES([\s\S]*?)(?=### SOURCE_PATCHES|### MIGRATION_STEPS|### INSTALL_COMMANDS|$)/);if(a){let e=/#### LOCALE:\s*(\S+)\s*\n```(?:po)?\n([\s\S]*?)```/g,t;for(;(t=e.exec(a[1]))!==null;)r.localeFiles.push({locale:t[1],content:t[2].trim()})}let o=n.match(/### SOURCE_PATCHES([\s\S]*?)(?=### INSTALL_COMMANDS|$)/);if(o){let e=/#### FILE:\s*(\S+)\s*\n```(?:diff)?\n([\s\S]*?)```/g,t;for(;(t=e.exec(o[1]))!==null;)r.sourcePatches.push({file:t[1],patch:t[2].trim()})}let s=n.match(/### MIGRATION_STEPS\s*\n([\s\S]*?)(?=### INSTALL_COMMANDS|$)/);s&&(r.steps=s[1].trim());let c=n.match(/### INSTALL_COMMANDS[\s\S]*?```(?:bash|sh)?\n([\s\S]*?)```/);return c&&(r.installCommands=c[1].trim()),r}async function fe(e){let{from:t,provider:n,write:r}=e,i=oe(t);if(!i){l.default.error(`Unsupported library "${t}". Supported libraries:`);for(let e of J)l.default.log(` - ${e}`);return}let o=q[i];l.default.info(`Migrating from ${o.name} (${o.framework}) to Fluenti`),l.default.info(`Scanning project for existing i18n files...`);let s=await se(o);if(s.configFiles.length===0&&s.localeFiles.length===0){l.default.warn(`No ${o.name} configuration or locale files found.`),l.default.info(`Make sure you are running this command from the project root directory.`);return}l.default.info(`Found: ${s.configFiles.length} config file(s), ${s.localeFiles.length} locale file(s), ${s.sampleSources.length} source file(s)`);let c=ce(o.migrationGuide);l.default.info(`Generating migration plan with ${n}...`);let u=de(await ue(n,le(o,s,c)));if(u.installCommands&&(l.default.log(``),l.default.box({title:`Install Commands`,message:u.installCommands})),u.config)if(r){let{writeFileSync:e}=await import(`node:fs`),t=(0,a.resolve)(`fluenti.config.ts`);e(t,u.config,`utf-8`),l.default.success(`Written: ${t}`)}else l.default.log(``),l.default.box({title:`fluenti.config.ts`,message:u.config});if(u.localeFiles.length>0)if(r){let{writeFileSync:e,mkdirSync:t}=await import(`node:fs`),n=`./locales`;t((0,a.resolve)(n),{recursive:!0});for(let t of u.localeFiles){let r=(0,a.resolve)(n,`${t.locale}.po`);e(r,t.content,`utf-8`),l.default.success(`Written: ${r}`)}}else for(let e of u.localeFiles)l.default.log(``),l.default.box({title:`locales/${e.locale}.po`,message:e.content.length>500?e.content.slice(0,500)+`
|
|
11
11
|
... (use --write to save full file)`:e.content});if(u.sourcePatches.length>0)if(r){l.default.log(``),l.default.info(`Generated ${u.sourcePatches.length} source patch(es). Apply with:`);for(let e of u.sourcePatches){let t=(0,a.resolve)(`.fluenti-migrate-${e.file.replace(/[/\\]/g,`-`)}.patch`),{writeFileSync:n}=await import(`node:fs`);n(t,e.patch,`utf-8`),l.default.success(`Patch written: ${t}`),l.default.log(` patch -p1 < ${t}`)}}else for(let e of u.sourcePatches)l.default.log(``),l.default.box({title:`Patch: ${e.file}`,message:e.patch.length>800?e.patch.slice(0,800)+`
|
|
12
|
-
... (use --write to save full patch)`:e.patch});u.steps&&u.sourcePatches.length===0&&(l.default.log(``),l.default.box({title:`Migration Steps`,message:u.steps})),!r&&(u.config||u.localeFiles.length>0||u.sourcePatches.length>0)&&(l.default.log(``),l.default.info(`Run with --write to save generated files and patches to disk:`),l.default.log(` fluenti migrate --from ${t} --write`))}function Y(e){return(0,c.createHash)(`md5`).update(e).digest(`hex`).slice(0,8)}function X(t,n){if(!(0,i.existsSync)(t))return{};let r=(0,i.readFileSync)(t,`utf-8`);return n===`json`?e.u(r):e.c(r)}function Z(t,n,r){(0,i.mkdirSync)((0,a.dirname)(t),{recursive:!0}),(0,i.writeFileSync)(t,r===`json`?e.d(n):e.l(n),`utf-8`)}async function pe(e,n,r){if((0,a.extname)(e)===`.vue`)try{let{extractFromVue:t}=await Promise.resolve().then(()=>require(`./vue-extractor.cjs`));return t(n,e,r)}catch{return l.default.warn(`Skipping ${e}: install @vue/compiler-sfc to extract from .vue files`),[]}return t.t(n,e,r)}var me=(0,u.defineCommand)({meta:{name:`extract`,description:`Extract messages from source files`},args:{config:{type:`string`,description:`Path to config file`},clean:{type:`boolean`,description:`Remove obsolete entries instead of marking them`,default:!1},"no-fuzzy":{type:`boolean`,description:`Strip fuzzy flags from all entries`,default:!1},"no-cache":{type:`boolean`,description:`Disable incremental extraction cache`,default:!1}},async run({args:t}){let n=await(0,m.loadConfig)(t.config),o=(0,r.resolveLocaleCodes)(n.locales);l.default.info(`Extracting messages from ${n.include.join(`, `)}`);let c=await(0,s.default)(n.include,{ignore:n.exclude??[],absolute:!1}),u=[],d=t[`no-cache`]??!1?null:new e.o(n.catalogDir,Y(process.cwd())),f=0;for(let e of c){if(d){let t=d.get(e);if(t){u.push(...t),f++;continue}}let t=await pe(e,(0,i.readFileSync)(e,`utf-8`),n.idGenerator);u.push(...t),d&&d.set(e,t)}d&&(d.prune(new Set(c)),d.save()),f>0?l.default.info(`Found ${u.length} messages in ${c.length} files (${f} cached)`):l.default.info(`Found ${u.length} messages in ${c.length} files`);let p=n.format===`json`?`.json`:`.po`,h=t.clean??!1,g=t[`no-fuzzy`]??!1;for(let t of o){let r=(0,a.resolve)(n.catalogDir,`${t}${p}`),{catalog:i,result:o}=e.f(X(r,n.format),u,{stripFuzzy:g});Z(r,h?Object.fromEntries(Object.entries(i).filter(([,e])=>!e.obsolete)):i,n.format);let s=h?`${o.obsolete} removed`:`${o.obsolete} obsolete`;l.default.success(`${t}: ${o.added} added, ${o.unchanged} unchanged, ${s}`)}for(let e of n.plugins??[])await e.onAfterExtract?.({messages:new Map(u.map(e=>[e.id,e])),sourceLocale:n.sourceLocale,targetLocales:o.filter(e=>e!==n.sourceLocale),config:n})}});function he(e){let t={};for(let[n,r]of Object.entries(e))r.translation&&r.translation.length>0?t[n]=r.translation:r.message&&(t[n]=r.message);return t}async function Q(e,t,n){let r=he(e);for(let e of n)e.transformMessages&&(r=await e.transformMessages(r,t));let i={};for(let[t,n]of Object.entries(e)){let e=r[t];i[t]=e===void 0?{...n}:{...n,translation:e}}return i}function $(e,t,n,r){let i={};for(let[e,n]of Object.entries(t))n.translation&&n.translation.length>0?i[e]=n.translation:n.message&&(i[e]=n.message);return{locale:e,messages:i,outDir:n,config:r}}var ge=(0,u.defineCommand)({meta:{name:`compile`,description:`Compile message catalogs to JS modules`},args:{config:{type:`string`,description:`Path to config file`},"skip-fuzzy":{type:`boolean`,description:`Exclude fuzzy entries from compilation`,default:!1},"no-cache":{type:`boolean`,description:`Disable compilation cache`,default:!1},parallel:{type:`boolean`,description:`Enable parallel compilation using worker threads`,default:!1},concurrency:{type:`string`,description:`Max number of worker threads (default: auto)`}},async run({args:t}){let o=await(0,m.loadConfig)(t.config),s=(0,r.resolveLocaleCodes)(o.locales),c=o.format===`json`?`.json`:`.po`;(0,i.mkdirSync)(o.compileOutDir,{recursive:!0});let u={},d={};for(let t of s){let n=(0,a.resolve)(o.catalogDir,`${t}${c}`);if((0,i.existsSync)(n)){let r=(0,i.readFileSync)(n,`utf-8`);d[t]=r,u[t]=o.format===`json`?e.u(r):e.c(r)}else d[t]=``,u[t]={}}let f=n.t(u);l.default.info(`Compiling ${f.length} messages across ${s.length} locales`);let p=t[`skip-fuzzy`]??!1,h=t[`no-cache`]??!1?null:new j(o.catalogDir,Y(process.cwd())),g=t.parallel??!1,_=t.concurrency?parseInt(t.concurrency,10):void 0;if(_!==void 0&&(isNaN(_)||_<1)){l.default.error(`Invalid --concurrency. Must be a positive integer.`),process.exitCode=1;return}let v=0,y=!1,b=[];for(let e of s){if(h&&h.isUpToDate(e,d[e])&&(0,i.existsSync)((0,a.resolve)(o.compileOutDir,`${e}.js`))){v++;continue}b.push(e)}if(b.length>0&&(y=!0),g&&b.length>1){let t=o.plugins??[],n={};for(let e of b){for(let n of t)await n.onBeforeCompile?.($(e,u[e],o.compileOutDir,o));n[e]=t.length>0?await Q(u[e],e,t):u[e]}let r=await e.s(b.map(e=>({locale:e,catalog:n[e],allIds:f,sourceLocale:o.sourceLocale,options:{skipFuzzy:p}})),_);for(let e of r){let t=(0,a.resolve)(o.compileOutDir,`${e.locale}.js`);if((0,i.writeFileSync)(t,e.code,`utf-8`),h&&h.set(e.locale,d[e.locale]),e.stats.missing.length>0){l.default.warn(`${e.locale}: ${e.stats.compiled} compiled, ${e.stats.missing.length} missing translations`);for(let t of e.stats.missing)l.default.warn(` ⤷ ${t}`)}else l.default.success(`Compiled ${e.locale}: ${e.stats.compiled} messages → ${t}`)}for(let e of b)for(let r of t)await r.onAfterCompile?.($(e,n[e],o.compileOutDir,o))}else{let e=o.plugins??[];for(let t of b){let r=(0,a.resolve)(o.compileOutDir,`${t}.js`);for(let n of e)await n.onBeforeCompile?.($(t,u[t],o.compileOutDir,o));let s=e.length>0?await Q(u[t],t,e):u[t],{code:c,stats:m}=n.n(s,t,f,o.sourceLocale,{skipFuzzy:p});if((0,i.writeFileSync)(r,c,`utf-8`),h&&h.set(t,d[t]),m.missing.length>0){l.default.warn(`${t}: ${m.compiled} compiled, ${m.missing.length} missing translations`);for(let e of m.missing)l.default.warn(` ⤷ ${e}`)}else l.default.success(`Compiled ${t}: ${m.compiled} messages → ${r}`);for(let n of e)await n.onAfterCompile?.($(t,s,o.compileOutDir,o))}}v>0&&l.default.info(`${v} locale(s) unchanged — skipped`),h&&h.save();let x=(0,a.resolve)(o.compileOutDir,`index.js`),S=(0,a.resolve)(o.compileOutDir,`messages.d.ts`);(y||!(0,i.existsSync)(x))&&((0,i.writeFileSync)(x,n.r(s,o.compileOutDir),`utf-8`),l.default.success(`Generated index → ${x}`)),(y||!(0,i.existsSync)(S))&&((0,i.writeFileSync)(S,n.i(f,u,o.sourceLocale),`utf-8`),l.default.success(`Generated types → ${S}`))}}),_e=(0,u.defineCommand)({meta:{name:`stats`,description:`Show translation progress`},args:{config:{type:`string`,description:`Path to config file`}},async run({args:e}){let t=await(0,m.loadConfig)(e.config),n=(0,r.resolveLocaleCodes)(t.locales),i=t.format===`json`?`.json`:`.po`,o=[];for(let e of n){let n=X((0,a.resolve)(t.catalogDir,`${e}${i}`),t.format),r=Object.values(n).filter(e=>!e.obsolete),s=r.length,c=r.filter(e=>e.translation&&e.translation.length>0).length,l=s>0?(c/s*100).toFixed(1)+`%`:`—`;o.push({locale:e,total:s,translated:c,pct:l})}l.default.log(``),l.default.log(` Locale │ Total │ Translated │ Progress`),l.default.log(` ────────┼───────┼────────────┼─────────────────────────────`);for(let e of o)l.default.log(y(e.locale,e.total,e.translated));l.default.log(``)}}),ve=(0,u.defineCommand)({meta:{name:`lint`,description:`Check translation quality (missing, inconsistent placeholders, fuzzy)`},args:{config:{type:`string`,description:`Path to config file`},strict:{type:`boolean`,description:`Treat warnings as errors`,default:!1},locale:{type:`string`,description:`Lint a specific locale only`}},async run({args:e}){let t=await(0,m.loadConfig)(e.config),n=(0,r.resolveLocaleCodes)(t.locales),i=t.format===`json`?`.json`:`.po`,o={};for(let e of n)o[e]=X((0,a.resolve)(t.catalogDir,`${e}${i}`),t.format);let s=e.locale?[e.locale]:void 0;l.default.info(`Linting ${s?s.join(`, `):`all locales`} (source: ${t.sourceLocale})`);let c={sourceLocale:t.sourceLocale,strict:e.strict??!1};s&&(c.locales=s);let u=w(o,c);l.default.log(``),l.default.log(T(u)),l.default.log(``);let d=u.filter(e=>e.severity===`error`),f=u.filter(e=>e.severity===`warning`);(d.length>0||e.strict&&f.length>0)&&(process.exitCode=1)}}),ye=(0,u.defineCommand)({meta:{name:`check`,description:`Check translation coverage for CI`},args:{config:{type:`string`,description:`Path to config file`},ci:{type:`boolean`,description:`Alias for --format github`,default:!1},"min-coverage":{type:`string`,description:`Minimum coverage percentage (0-100)`,default:`100`},format:{type:`string`,description:`Output format: text | json | github`},locale:{type:`string`,description:`Check a specific locale only`}},async run({args:e}){let t=await(0,m.loadConfig)(e.config),n=(0,r.resolveLocaleCodes)(t.locales),i=t.format===`json`?`.json`:`.po`,o={};for(let e of n)o[e]=X((0,a.resolve)(t.catalogDir,`${e}${i}`),t.format);let s=parseFloat(e[`min-coverage`]??`100`);if(isNaN(s)||s<0||s>100){l.default.error(`Invalid --min-coverage. Must be a number between 0 and 100.`),process.exitCode=1;return}let c=e.format??(e.ci?`github`:`text`),u={sourceLocale:t.sourceLocale,minCoverage:s,format:c};e.locale&&(u.locale=e.locale);let d=D(o,u);switch(c){case`json`:l.default.log(k(d));break;case`github`:l.default.log(O(d,t.catalogDir,t.format));break;default:l.default.log(``),l.default.log(te(d)),l.default.log(``);break}d.passed||(process.exitCode=1)}});async function be(e,t,n){let r=Array(e.length),i=0,a=Array.from({length:Math.min(n,e.length)},async()=>{for(;i<e.length;){let n=i++;r[n]=await t(e[n])}});return await Promise.all(a),r}var xe=(0,u.defineCommand)({meta:{name:`translate`,description:`Translate messages using AI (Claude Code or Codex CLI)`},args:{config:{type:`string`,description:`Path to config file`},provider:{type:`string`,description:`AI provider: claude or codex`,default:`claude`},locale:{type:`string`,description:`Translate a specific locale only`},"batch-size":{type:`string`,description:`Messages per batch`,default:`50`},"dry-run":{type:`boolean`,description:`Preview translation results without writing files`,default:!1},context:{type:`string`,description:`Project context description to improve translation quality`},glossary:{type:`string`,description:`Path to glossary JSON file`},concurrency:{type:`string`,description:`Max parallel locale translations (default: 3)`},timeout:{type:`string`,description:`AI call timeout in seconds (default: 120)`}},async run({args:e}){let t=await(0,m.loadConfig)(e.config),n=(0,r.resolveLocaleCodes)(t.locales),i=e.provider;if(i!==`claude`&&i!==`codex`){l.default.error(`Invalid provider "${i}". Use "claude" or "codex".`);return}let o=parseInt(e[`batch-size`]??`50`,10);if(isNaN(o)||o<1){l.default.error(`Invalid batch-size. Must be a positive integer.`);return}let s=e.glossary?F((0,a.resolve)(e.glossary)):void 0,c=e.concurrency?parseInt(e.concurrency,10):3;if(isNaN(c)||c<1){l.default.error(`Invalid concurrency. Must be a positive integer.`);return}let u=e.timeout?parseInt(e.timeout,10):120;if(isNaN(u)||u<1){l.default.error(`Invalid timeout. Must be a positive integer (seconds).`);return}let d=u*1e3,f=e.locale?[e.locale]:n.filter(e=>e!==t.sourceLocale);if(f.length===0){l.default.warn(`No target locales to translate.`);return}l.default.info(`Translating with ${i} (batch size: ${o})`);let p=t.format===`json`?`.json`:`.po`;await be(f,async n=>{l.default.info(`\n[${n}]`);let r=(0,a.resolve)(t.catalogDir,`${n}${p}`),c=X(r,t.format);if(e[`dry-run`]){let e=Object.entries(c).filter(([,e])=>!e.obsolete&&(!e.translation||e.translation.length===0));if(e.length>0){for(let[t,n]of e)l.default.log(` ${t}: ${n.message??t}`);l.default.success(` ${n}: ${e.length} messages would be translated (dry-run)`)}else l.default.success(` ${n}: already fully translated`);return}let u=s?I(s,n):void 0,{catalog:f,translated:m,warnings:h}=await G({provider:i,sourceLocale:t.sourceLocale,targetLocale:n,catalog:c,batchSize:o,glossary:u,timeoutMs:d,...e.context?{context:e.context}:{}});m>0?(Z(r,f,t.format),l.default.success(` ${n}: ${m} messages translated`)):l.default.success(` ${n}: already fully translated`),h.length>0&&l.default.warn(` ${n}: ${h.length} QA warnings`)},c)}}),Se=(0,u.defineCommand)({meta:{name:`migrate`,description:`Migrate from another i18n library using AI`},args:{from:{type:`string`,description:`Source library: vue-i18n, nuxt-i18n, react-i18next, next-intl, next-i18next, lingui`,required:!0},provider:{type:`string`,description:`AI provider: claude or codex`,default:`claude`},write:{type:`boolean`,description:`Write generated files to disk`,default:!1}},async run({args:e}){let t=e.provider;if(t!==`claude`&&t!==`codex`){l.default.error(`Invalid provider "${t}". Use "claude" or "codex".`);return}await fe({from:e.from,provider:t,write:e.write??!1})}});(0,u.runMain)((0,u.defineCommand)({meta:{name:`fluenti`,version:`0.0.1`,description:`Compile-time i18n for modern frameworks`},subCommands:{init:(0,u.defineCommand)({meta:{name:`init`,description:`Initialize Fluenti in your project`},args:{},async run(){await e.r({cwd:process.cwd()})}}),doctor:(0,u.defineCommand)({meta:{name:`doctor`,description:`Diagnose Fluenti setup and vNext import issues`},args:{config:{type:`string`,description:`Optional path to fluenti config file`},strict:{type:`boolean`,description:`Treat warnings as errors`,default:!1}},async run({args:t}){let n=await e.n({cwd:process.cwd(),...t.config?{config:t.config}:{}}),r=e.t(n);l.default.log(r);let i=n.findings.some(e=>e.severity===`error`),a=n.findings.some(e=>e.severity===`warning`);(i||(t.strict??!1)&&a)&&(process.exitCode=1)}}),codemod:(0,u.defineCommand)({meta:{name:`codemod`,description:`Rewrite imports to the vNext Fluenti entry layout`},args:{write:{type:`boolean`,description:`Write modified files to disk`,default:!1},include:{type:`string`,description:`Comma-separated glob list to scan`}},async run({args:t}){let n=t.include?t.include.split(`,`).map(e=>e.trim()).filter(Boolean):void 0,r=await e.a({cwd:process.cwd(),...n?{include:n}:{},write:t.write??!1});if(r.changedCount===0){l.default.success(`No files need import rewrites.`);return}for(let e of r.changedFiles)l.default.log(`${t.write?`updated`:`would update`} ${e.file}`);l.default.success(`${t.write?`Updated`:`Detected`} ${r.changedCount} file(s) with Fluenti import rewrites.`)}}),extract:me,compile:ge,stats:_e,lint:ve,check:ye,translate:xe,migrate:Se}}));
|
|
13
|
-
//# sourceMappingURL=cli.cjs.map
|
|
12
|
+
... (use --write to save full patch)`:e.patch});u.steps&&u.sourcePatches.length===0&&(l.default.log(``),l.default.box({title:`Migration Steps`,message:u.steps})),!r&&(u.config||u.localeFiles.length>0||u.sourcePatches.length>0)&&(l.default.log(``),l.default.info(`Run with --write to save generated files and patches to disk:`),l.default.log(` fluenti migrate --from ${t} --write`))}function Y(e){return(0,c.createHash)(`md5`).update(e).digest(`hex`).slice(0,8)}function X(t,n){if(!(0,i.existsSync)(t))return{};let r=(0,i.readFileSync)(t,`utf-8`);return n===`json`?e.u(r):e.c(r)}function Z(t,n,r){(0,i.mkdirSync)((0,a.dirname)(t),{recursive:!0}),(0,i.writeFileSync)(t,r===`json`?e.d(n):e.l(n),`utf-8`)}async function pe(e,n,r){if((0,a.extname)(e)===`.vue`)try{let{extractFromVue:t}=await Promise.resolve().then(()=>require(`./vue-extractor.cjs`));return t(n,e,r)}catch{return l.default.warn(`Skipping ${e}: install @vue/compiler-sfc to extract from .vue files`),[]}return t.t(n,e,r)}var me=(0,u.defineCommand)({meta:{name:`extract`,description:`Extract messages from source files`},args:{config:{type:`string`,description:`Path to config file`},clean:{type:`boolean`,description:`Remove obsolete entries instead of marking them`,default:!1},"no-fuzzy":{type:`boolean`,description:`Strip fuzzy flags from all entries`,default:!1},"no-cache":{type:`boolean`,description:`Disable incremental extraction cache`,default:!1}},async run({args:t}){let n=await(0,m.loadConfig)(t.config),o=(0,r.resolveLocaleCodes)(n.locales);l.default.info(`Extracting messages from ${n.include.join(`, `)}`);let c=await(0,s.default)(n.include,{ignore:n.exclude??[],absolute:!1}),u=[],d=t[`no-cache`]??!1?null:new e.o(n.catalogDir,Y(process.cwd())),f=0;for(let e of c){if(d){let t=d.get(e);if(t){u.push(...t),f++;continue}}let t=await pe(e,(0,i.readFileSync)(e,`utf-8`),n.idGenerator);u.push(...t),d&&d.set(e,t)}d&&(d.prune(new Set(c)),d.save()),f>0?l.default.info(`Found ${u.length} messages in ${c.length} files (${f} cached)`):l.default.info(`Found ${u.length} messages in ${c.length} files`);let p=n.format===`json`?`.json`:`.po`,h=t.clean??!1,g=t[`no-fuzzy`]??!1;for(let t of o){let r=(0,a.resolve)(n.catalogDir,`${t}${p}`),{catalog:i,result:o}=e.f(X(r,n.format),u,{stripFuzzy:g});Z(r,h?Object.fromEntries(Object.entries(i).filter(([,e])=>!e.obsolete)):i,n.format);let s=h?`${o.obsolete} removed`:`${o.obsolete} obsolete`;l.default.success(`${t}: ${o.added} added, ${o.unchanged} unchanged, ${s}`)}for(let e of n.plugins??[])await e.onAfterExtract?.({messages:new Map(u.map(e=>[e.id,e])),sourceLocale:n.sourceLocale,targetLocales:o.filter(e=>e!==n.sourceLocale),config:n})}});function he(e){let t={};for(let[n,r]of Object.entries(e))r.translation&&r.translation.length>0?t[n]=r.translation:r.message&&(t[n]=r.message);return t}async function Q(e,t,n){let r=he(e);for(let e of n)e.transformMessages&&(r=await e.transformMessages(r,t));let i={};for(let[t,n]of Object.entries(e)){let e=r[t];i[t]=e===void 0?{...n}:{...n,translation:e}}return i}function $(e,t,n,r){let i={};for(let[e,n]of Object.entries(t))n.translation&&n.translation.length>0?i[e]=n.translation:n.message&&(i[e]=n.message);return{locale:e,messages:i,outDir:n,config:r}}var ge=(0,u.defineCommand)({meta:{name:`compile`,description:`Compile message catalogs to JS modules`},args:{config:{type:`string`,description:`Path to config file`},"skip-fuzzy":{type:`boolean`,description:`Exclude fuzzy entries from compilation`,default:!1},"no-cache":{type:`boolean`,description:`Disable compilation cache`,default:!1},parallel:{type:`boolean`,description:`Enable parallel compilation using worker threads`,default:!1},concurrency:{type:`string`,description:`Max number of worker threads (default: auto)`}},async run({args:t}){let o=await(0,m.loadConfig)(t.config),s=(0,r.resolveLocaleCodes)(o.locales),c=o.format===`json`?`.json`:`.po`;(0,i.mkdirSync)(o.compileOutDir,{recursive:!0});let u={},d={};for(let t of s){let n=(0,a.resolve)(o.catalogDir,`${t}${c}`);if((0,i.existsSync)(n)){let r=(0,i.readFileSync)(n,`utf-8`);d[t]=r,u[t]=o.format===`json`?e.u(r):e.c(r)}else d[t]=``,u[t]={}}let f=n.t(u);l.default.info(`Compiling ${f.length} messages across ${s.length} locales`);let p=t[`skip-fuzzy`]??!1,h=t[`no-cache`]??!1?null:new j(o.catalogDir,Y(process.cwd())),g=t.parallel??!1,_=t.concurrency?parseInt(t.concurrency,10):void 0;if(_!==void 0&&(isNaN(_)||_<1)){l.default.error(`Invalid --concurrency. Must be a positive integer.`),process.exitCode=1;return}let v=0,y=!1,b=[];for(let e of s){if(h&&h.isUpToDate(e,d[e])&&(0,i.existsSync)((0,a.resolve)(o.compileOutDir,`${e}.js`))){v++;continue}b.push(e)}if(b.length>0&&(y=!0),g&&b.length>1){let t=o.plugins??[],n={};for(let e of b){for(let n of t)await n.onBeforeCompile?.($(e,u[e],o.compileOutDir,o));n[e]=t.length>0?await Q(u[e],e,t):u[e]}let r=await e.s(b.map(e=>({locale:e,catalog:n[e],allIds:f,sourceLocale:o.sourceLocale,options:{skipFuzzy:p}})),_);for(let e of r){let t=(0,a.resolve)(o.compileOutDir,`${e.locale}.js`);if((0,i.writeFileSync)(t,e.code,`utf-8`),h&&h.set(e.locale,d[e.locale]),e.stats.missing.length>0){l.default.warn(`${e.locale}: ${e.stats.compiled} compiled, ${e.stats.missing.length} missing translations`);for(let t of e.stats.missing)l.default.warn(` ⤷ ${t}`)}else l.default.success(`Compiled ${e.locale}: ${e.stats.compiled} messages → ${t}`)}for(let e of b)for(let r of t)await r.onAfterCompile?.($(e,n[e],o.compileOutDir,o))}else{let e=o.plugins??[];for(let t of b){let r=(0,a.resolve)(o.compileOutDir,`${t}.js`);for(let n of e)await n.onBeforeCompile?.($(t,u[t],o.compileOutDir,o));let s=e.length>0?await Q(u[t],t,e):u[t],{code:c,stats:m}=n.n(s,t,f,o.sourceLocale,{skipFuzzy:p});if((0,i.writeFileSync)(r,c,`utf-8`),h&&h.set(t,d[t]),m.missing.length>0){l.default.warn(`${t}: ${m.compiled} compiled, ${m.missing.length} missing translations`);for(let e of m.missing)l.default.warn(` ⤷ ${e}`)}else l.default.success(`Compiled ${t}: ${m.compiled} messages → ${r}`);for(let n of e)await n.onAfterCompile?.($(t,s,o.compileOutDir,o))}}v>0&&l.default.info(`${v} locale(s) unchanged — skipped`),h&&h.save();let x=(0,a.resolve)(o.compileOutDir,`index.js`),S=(0,a.resolve)(o.compileOutDir,`messages.d.ts`);(y||!(0,i.existsSync)(x))&&((0,i.writeFileSync)(x,n.r(s,o.compileOutDir),`utf-8`),l.default.success(`Generated index → ${x}`)),(y||!(0,i.existsSync)(S))&&((0,i.writeFileSync)(S,n.i(f,u,o.sourceLocale),`utf-8`),l.default.success(`Generated types → ${S}`))}}),_e=(0,u.defineCommand)({meta:{name:`stats`,description:`Show translation progress`},args:{config:{type:`string`,description:`Path to config file`}},async run({args:e}){let t=await(0,m.loadConfig)(e.config),n=(0,r.resolveLocaleCodes)(t.locales),i=t.format===`json`?`.json`:`.po`,o=[];for(let e of n){let n=X((0,a.resolve)(t.catalogDir,`${e}${i}`),t.format),r=Object.values(n).filter(e=>!e.obsolete),s=r.length,c=r.filter(e=>e.translation&&e.translation.length>0).length,l=s>0?(c/s*100).toFixed(1)+`%`:`—`;o.push({locale:e,total:s,translated:c,pct:l})}l.default.log(``),l.default.log(` Locale │ Total │ Translated │ Progress`),l.default.log(` ────────┼───────┼────────────┼─────────────────────────────`);for(let e of o)l.default.log(y(e.locale,e.total,e.translated));l.default.log(``)}}),ve=(0,u.defineCommand)({meta:{name:`lint`,description:`Check translation quality (missing, inconsistent placeholders, fuzzy)`},args:{config:{type:`string`,description:`Path to config file`},strict:{type:`boolean`,description:`Treat warnings as errors`,default:!1},locale:{type:`string`,description:`Lint a specific locale only`}},async run({args:e}){let t=await(0,m.loadConfig)(e.config),n=(0,r.resolveLocaleCodes)(t.locales),i=t.format===`json`?`.json`:`.po`,o={};for(let e of n)o[e]=X((0,a.resolve)(t.catalogDir,`${e}${i}`),t.format);let s=e.locale?[e.locale]:void 0;l.default.info(`Linting ${s?s.join(`, `):`all locales`} (source: ${t.sourceLocale})`);let c={sourceLocale:t.sourceLocale,strict:e.strict??!1};s&&(c.locales=s);let u=w(o,c);l.default.log(``),l.default.log(T(u)),l.default.log(``);let d=u.filter(e=>e.severity===`error`),f=u.filter(e=>e.severity===`warning`);(d.length>0||e.strict&&f.length>0)&&(process.exitCode=1)}}),ye=(0,u.defineCommand)({meta:{name:`check`,description:`Check translation coverage for CI`},args:{config:{type:`string`,description:`Path to config file`},ci:{type:`boolean`,description:`Alias for --format github`,default:!1},"min-coverage":{type:`string`,description:`Minimum coverage percentage (0-100)`,default:`100`},format:{type:`string`,description:`Output format: text | json | github`},locale:{type:`string`,description:`Check a specific locale only`}},async run({args:e}){let t=await(0,m.loadConfig)(e.config),n=(0,r.resolveLocaleCodes)(t.locales),i=t.format===`json`?`.json`:`.po`,o={};for(let e of n)o[e]=X((0,a.resolve)(t.catalogDir,`${e}${i}`),t.format);let s=parseFloat(e[`min-coverage`]??`100`);if(isNaN(s)||s<0||s>100){l.default.error(`Invalid --min-coverage. Must be a number between 0 and 100.`),process.exitCode=1;return}let c=e.format??(e.ci?`github`:`text`),u={sourceLocale:t.sourceLocale,minCoverage:s,format:c};e.locale&&(u.locale=e.locale);let d=D(o,u);switch(c){case`json`:l.default.log(k(d));break;case`github`:l.default.log(O(d,t.catalogDir,t.format));break;default:l.default.log(``),l.default.log(te(d)),l.default.log(``);break}d.passed||(process.exitCode=1)}});async function be(e,t,n){let r=Array(e.length),i=0,a=Array.from({length:Math.min(n,e.length)},async()=>{for(;i<e.length;){let n=i++;r[n]=await t(e[n])}});return await Promise.all(a),r}var xe=(0,u.defineCommand)({meta:{name:`translate`,description:`Translate messages using AI (Claude Code or Codex CLI)`},args:{config:{type:`string`,description:`Path to config file`},provider:{type:`string`,description:`AI provider: claude or codex`,default:`claude`},locale:{type:`string`,description:`Translate a specific locale only`},"batch-size":{type:`string`,description:`Messages per batch`,default:`50`},"dry-run":{type:`boolean`,description:`Preview translation results without writing files`,default:!1},context:{type:`string`,description:`Project context description to improve translation quality`},glossary:{type:`string`,description:`Path to glossary JSON file`},concurrency:{type:`string`,description:`Max parallel locale translations (default: 3)`},timeout:{type:`string`,description:`AI call timeout in seconds (default: 120)`}},async run({args:e}){let t=await(0,m.loadConfig)(e.config),n=(0,r.resolveLocaleCodes)(t.locales),i=e.provider;if(i!==`claude`&&i!==`codex`){l.default.error(`Invalid provider "${i}". Use "claude" or "codex".`);return}let o=parseInt(e[`batch-size`]??`50`,10);if(isNaN(o)||o<1){l.default.error(`Invalid batch-size. Must be a positive integer.`);return}let s=e.glossary?F((0,a.resolve)(e.glossary)):void 0,c=e.concurrency?parseInt(e.concurrency,10):3;if(isNaN(c)||c<1){l.default.error(`Invalid concurrency. Must be a positive integer.`);return}let u=e.timeout?parseInt(e.timeout,10):120;if(isNaN(u)||u<1){l.default.error(`Invalid timeout. Must be a positive integer (seconds).`);return}let d=u*1e3,f=e.locale?[e.locale]:n.filter(e=>e!==t.sourceLocale);if(f.length===0){l.default.warn(`No target locales to translate.`);return}l.default.info(`Translating with ${i} (batch size: ${o})`);let p=t.format===`json`?`.json`:`.po`;await be(f,async n=>{l.default.info(`\n[${n}]`);let r=(0,a.resolve)(t.catalogDir,`${n}${p}`),c=X(r,t.format);if(e[`dry-run`]){let e=Object.entries(c).filter(([,e])=>!e.obsolete&&(!e.translation||e.translation.length===0));if(e.length>0){for(let[t,n]of e)l.default.log(` ${t}: ${n.message??t}`);l.default.success(` ${n}: ${e.length} messages would be translated (dry-run)`)}else l.default.success(` ${n}: already fully translated`);return}let u=s?I(s,n):void 0,{catalog:f,translated:m,warnings:h}=await G({provider:i,sourceLocale:t.sourceLocale,targetLocale:n,catalog:c,batchSize:o,glossary:u,timeoutMs:d,...e.context?{context:e.context}:{}});m>0?(Z(r,f,t.format),l.default.success(` ${n}: ${m} messages translated`)):l.default.success(` ${n}: already fully translated`),h.length>0&&l.default.warn(` ${n}: ${h.length} QA warnings`)},c)}}),Se=(0,u.defineCommand)({meta:{name:`migrate`,description:`Migrate from another i18n library using AI`},args:{from:{type:`string`,description:`Source library: vue-i18n, nuxt-i18n, react-i18next, next-intl, next-i18next, lingui`,required:!0},provider:{type:`string`,description:`AI provider: claude or codex`,default:`claude`},write:{type:`boolean`,description:`Write generated files to disk`,default:!1}},async run({args:e}){let t=e.provider;if(t!==`claude`&&t!==`codex`){l.default.error(`Invalid provider "${t}". Use "claude" or "codex".`);return}await fe({from:e.from,provider:t,write:e.write??!1})}});(0,u.runMain)((0,u.defineCommand)({meta:{name:`fluenti`,version:`0.0.1`,description:`Compile-time i18n for modern frameworks`},subCommands:{init:(0,u.defineCommand)({meta:{name:`init`,description:`Initialize Fluenti in your project`},args:{},async run(){await e.r({cwd:process.cwd()})}}),doctor:(0,u.defineCommand)({meta:{name:`doctor`,description:`Diagnose Fluenti setup and vNext import issues`},args:{config:{type:`string`,description:`Optional path to fluenti config file`},strict:{type:`boolean`,description:`Treat warnings as errors`,default:!1}},async run({args:t}){let n=await e.n({cwd:process.cwd(),...t.config?{config:t.config}:{}}),r=e.t(n);l.default.log(r);let i=n.findings.some(e=>e.severity===`error`),a=n.findings.some(e=>e.severity===`warning`);(i||(t.strict??!1)&&a)&&(process.exitCode=1)}}),codemod:(0,u.defineCommand)({meta:{name:`codemod`,description:`Rewrite imports to the vNext Fluenti entry layout`},args:{write:{type:`boolean`,description:`Write modified files to disk`,default:!1},include:{type:`string`,description:`Comma-separated glob list to scan`}},async run({args:t}){let n=t.include?t.include.split(`,`).map(e=>e.trim()).filter(Boolean):void 0,r=await e.a({cwd:process.cwd(),...n?{include:n}:{},write:t.write??!1});if(r.changedCount===0){l.default.success(`No files need import rewrites.`);return}for(let e of r.changedFiles)l.default.log(`${t.write?`updated`:`would update`} ${e.file}`);l.default.success(`${t.write?`Updated`:`Detected`} ${r.changedCount} file(s) with Fluenti import rewrites.`)}}),extract:me,compile:ge,stats:_e,lint:ve,check:ye,translate:xe,migrate:Se}}));
|
package/dist/cli.js
CHANGED
|
@@ -4,5 +4,4 @@ export default {}
|
|
|
4
4
|
`,stats:{compiled:0,missing:[]}};c.push(``),c.push(`export default {`);for(let{id:e,exportName:t}of u)c.push(` '${o(e)}': ${t},`);return c.push(`}`),c.push(``),{code:c.join(`
|
|
5
5
|
`),stats:{compiled:p,missing:m}}}function _(e,t,n,r,i){let a=r??n;if(e&&!(i&&e.fuzzy)){if(e.translation!==void 0&&e.translation.length>0)return e.translation;if(n===a)return e.message??t}}function v(e,t){let n=[];n.push(`export const locales = ${JSON.stringify(e)}`),n.push(``),n.push(`export const loaders = {`);for(let t of e)n.push(` '${o(t)}': () => import('./${o(t)}.js'),`);return n.push(`}`),n.push(``),n.join(`
|
|
6
6
|
`)}function y(e){let t=new Set;for(let n of Object.values(e))for(let[e,r]of Object.entries(n))r.obsolete||t.add(e);return[...t].sort()}function b(e){let n=(0,t.parse)(e),r=new Map;return x(n,r),[...r.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({name:e,type:t}))}function x(e,t){for(let n of e)switch(n.type){case`variable`:n.name!==`#`&&!t.has(n.name)&&t.set(n.name,`string | number`);break;case`plural`:{let e=n;t.set(e.variable,`number`);for(let n of Object.values(e.options))x(n,t);break}case`select`:{let e=n,r=Object.keys(e.options).filter(e=>e!==`other`),i=`other`in e.options,a=r.map(e=>`'${e}'`).join(` | `),o=i?r.length>0?`${a} | string`:`string`:r.length>0?a:`string`;t.set(e.variable,o);for(let n of Object.values(e.options))x(n,t);break}case`function`:t.has(n.variable)||t.set(n.variable,`string | number`);break;case`text`:break}}function S(e,t,n){let r=[];if(r.push(`// Auto-generated by @fluenti/cli — do not edit`),r.push(``),r.push(`export type { LocalizedString } from '@fluenti/core'`),r.push(``),e.length===0)r.push(`export type MessageId = never`);else{r.push(`export type MessageId =`);for(let t of e)r.push(` | '${o(t)}'`)}r.push(``),r.push(`export interface MessageValues {`);for(let i of e){let e=b(t[n]?.[i]?.message??i),a=o(i);if(e.length===0)r.push(` '${a}': Record<string, never>`);else{let t=e.map(e=>`${e.name}: ${e.type}`).join(`; `);r.push(` '${a}': { ${t} }`)}}r.push(`}`),r.push(``);let i=Object.keys(t).map(e=>`'${o(e)}'`).join(` | `);return r.push(`// Auto-wiring: narrows t() and setLocale() to compiled types`),r.push(`declare module '@fluenti/core' {`),r.push(` interface FluentiTypeConfig {`),r.push(` locale: ${i||`string`}`),r.push(` messageIds: MessageId`),r.push(` messageValues: MessageValues`),r.push(` }`),r.push(`}`),r.push(``),r.join(`
|
|
7
|
-
`)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return y}});
|
|
8
|
-
//# sourceMappingURL=compile-C3VLvhUf.cjs.map
|
|
7
|
+
`)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return y}});
|
package/dist/compile-CZVpE5Md.js
CHANGED
package/dist/compile-worker.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
require(`./doctor-xp8WS8sr.cjs`);const e=require(`./compile-C3VLvhUf.cjs`);let t=require(`node:worker_threads`);t.parentPort.on(`message`,n=>{try{let{code:r,stats:i}=e.n(n.catalog,n.locale,n.allIds,n.sourceLocale,n.options);t.parentPort.postMessage({locale:n.locale,code:r,stats:i})}catch(e){t.parentPort.postMessage({locale:n.locale,code:``,stats:{compiled:0,missing:[]},error:e instanceof Error?e.message:String(e)})}});
|
|
2
|
-
//# sourceMappingURL=compile-worker.cjs.map
|
|
1
|
+
require(`./doctor-xp8WS8sr.cjs`);const e=require(`./compile-C3VLvhUf.cjs`);let t=require(`node:worker_threads`);t.parentPort.on(`message`,n=>{try{let{code:r,stats:i}=e.n(n.catalog,n.locale,n.allIds,n.sourceLocale,n.options);t.parentPort.postMessage({locale:n.locale,code:r,stats:i})}catch(e){t.parentPort.postMessage({locale:n.locale,code:``,stats:{compiled:0,missing:[]},error:e instanceof Error?e.message:String(e)})}});
|
package/dist/compile-worker.js
CHANGED
package/dist/doctor-BqXXxyST.js
CHANGED
package/dist/doctor-xp8WS8sr.cjs
CHANGED
|
@@ -20,5 +20,4 @@ export default defineConfig({
|
|
|
20
20
|
`}async function J(e){let t=(0,p.resolve)(e.cwd,`package.json`);if(!(0,f.existsSync)(t)){v.default.error(`No package.json found in current directory.`);return}let n=JSON.parse((0,f.readFileSync)(t,`utf-8`)),r=K({...n.dependencies,...n.devDependencies});v.default.info(`Detected framework: ${r.name}`),r.pluginPackage&&v.default.info(`Recommended plugin: ${r.pluginPackage}`);let i=(0,p.resolve)(e.cwd,`fluenti.config.ts`);if((0,f.existsSync)(i)){v.default.warn(`fluenti.config.ts already exists. Skipping config generation.`);return}let a=await v.default.prompt(`Source locale?`,{type:`text`,default:`en`,placeholder:`en`});if(typeof a==`symbol`)return;let o=await v.default.prompt(`Target locales (comma-separated)?`,{type:`text`,default:`ja,zh-CN`,placeholder:`ja,zh-CN`});if(typeof o==`symbol`)return;let s=await v.default.prompt(`Catalog format?`,{type:`select`,options:[`po`,`json`],initial:`po`});if(typeof s==`symbol`)return;let c=o.split(`,`).map(e=>e.trim()).filter(Boolean);W(a);for(let e of c)W(e);(0,f.writeFileSync)(i,q({sourceLocale:a,locales:[a,...c.filter(e=>e!==a)],format:s}),`utf-8`),v.default.success(`Created fluenti.config.ts`);let l=(0,p.resolve)(e.cwd,`.gitignore`),u=`src/locales/compiled/`;(0,f.existsSync)(l)?(0,f.readFileSync)(l,`utf-8`).includes(u)||((0,f.appendFileSync)(l,`\n# Fluenti compiled catalogs\n${u}\n`),v.default.success(`Updated .gitignore`)):((0,f.writeFileSync)(l,`# Fluenti compiled catalogs\n${u}\n`),v.default.success(`Created .gitignore`));let d=n.scripts??{},m={},h=!1;if(d[`i18n:extract`]||(m[`i18n:extract`]=`fluenti extract`,h=!0),d[`i18n:compile`]||(m[`i18n:compile`]=`fluenti compile`,h=!0),h){let e={...n,scripts:{...d,...m}};(0,f.writeFileSync)(t,JSON.stringify(e,null,2)+`
|
|
21
21
|
`,`utf-8`),v.default.success(`Added i18n:extract and i18n:compile scripts to package.json`)}v.default.log(``),v.default.box({title:`Next steps`,message:[r.pluginPackage?`1. Install: pnpm add -D ${r.pluginPackage} @fluenti/cli`:`1. Install: pnpm add -D @fluenti/cli`,r.name===`nextjs`?`2. Add withFluenti() to your next.config.ts`:r.name===`unknown`?`2. Configure your build tool with the framework Vite plugin or @fluenti/next`:`2. Add the Vite plugin to your vite.config.ts (e.g. fluentiVue() from @fluenti/vue/vite-plugin)`,`3. Run: npx fluenti extract`,`4. Translate your messages`,`5. Run: npx fluenti compile`].join(`
|
|
22
22
|
`)})}var Y=[`src/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs,vue,mdx}`,`app/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs,vue,mdx}`,`pages/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs,vue,mdx}`,`components/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs,vue,mdx}`,`layouts/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs,vue,mdx}`],ie=/import\s*\{[\s\S]*?\binterpolate\b[\s\S]*?\}\s*from\s*['"]@fluenti\/(react|vue|solid)(?:\/components)?['"]/g,ae=/from\s*['"]@fluenti\/core\/internal['"]/g;function X(e){return(0,f.existsSync)(e)?(0,f.readFileSync)(e,`utf-8`):void 0}function oe(e,t){if(t)return(0,p.resolve)(e,t);for(let t of[`fluenti.config.ts`,`fluenti.config.mts`,`fluenti.config.js`,`fluenti.config.mjs`]){let n=(0,p.resolve)(e,t);if((0,f.existsSync)(n))return n}}async function se(e){return(0,_.default)(Y,{cwd:e,absolute:!1,ignore:[`**/node_modules/**`,`**/dist/**`,`**/.fluenti/**`]})}function Z(e,t,n,r){e.push({severity:t,code:n,message:r})}function ce(e){let t=X((0,p.resolve)(e,`package.json`));if(t)return JSON.parse(t)}function le(e){return e?e.includes(`@fluenti/`)&&e.includes(`vite-plugin`):!1}function Q(e,t){return[...e.matchAll(t)].length}async function $(e){let t=[],n=ce(e.cwd);if(!n)return{framework:`unknown`,findings:[{severity:`error`,code:`missing-package-json`,message:`No package.json found in the current directory.`}]};let r=K({...n.dependencies,...n.devDependencies}),i=oe(e.cwd,e.config),a=await se(e.cwd),o=0,s=0,c=!1,l=!1;for(let t of a){let n=(0,f.readFileSync)((0,p.resolve)(e.cwd,t),`utf-8`);o+=Q(n,ie),s+=Q(n,ae),c||=n.includes(`@fluenti/`),l||=n.includes(`from '@fluenti/`)&&n.includes(" t`")}if(o>0&&Z(t,`warning`,`main-entry-interpolate`,`Found ${o} import(s) of interpolate from framework packages. Import interpolate from @fluenti/core/runtime instead.`),s>0&&Z(t,`warning`,`core-internal-imports`,`Found ${s} import(s) from @fluenti/core/internal. Use @fluenti/core/runtime or @fluenti/core/compiler.`),i||Z(t,`warning`,`missing-config`,`No fluenti.config.* file found.`),r.name===`nextjs`){let n=[`next.config.ts`,`next.config.mjs`,`next.config.js`].map(t=>(0,p.resolve)(e.cwd,t)).find(e=>(0,f.existsSync)(e)),r=n?X(n):void 0;c&&!r?.includes(`withFluenti(`)&&Z(t,`error`,`missing-with-fluenti`,`Next.js project imports Fluenti but next.config does not call withFluenti().`)}if(r.name===`react`||r.name===`vue`||r.name===`solid`){let n=[`vite.config.ts`,`vite.config.mts`,`vite.config.js`,`vite.config.mjs`].map(t=>(0,p.resolve)(e.cwd,t)).find(e=>(0,f.existsSync)(e)),r=n?X(n):void 0;(c||l)&&!le(r)&&Z(t,`warning`,`missing-vite-plugin`,`Project imports Fluenti but vite.config does not appear to include a Fluenti Vite plugin.`)}if(i&&(0,f.existsSync)(i))try{let n=await(0,d.loadConfig)(i),r=n.format===`json`?`.json`:`.po`,a=(0,p.resolve)(e.cwd,n.catalogDir,`${n.sourceLocale}${r}`);(0,f.existsSync)(a)||Z(t,`warning`,`missing-source-catalog`,`Source catalog not found: ${a}`);let o=(0,p.resolve)(e.cwd,n.compileOutDir,`index.js`);(0,f.existsSync)(o)||Z(t,`warning`,`missing-compiled-catalogs`,`Compiled catalogs not found at ${o}. Run "fluenti compile".`)}catch(e){Z(t,`error`,`invalid-config`,`Failed to load Fluenti config: ${e instanceof Error?e.message:String(e)}`)}return t.length===0&&Z(t,`info`,`ok`,`No Fluenti migration or configuration issues detected.`),{framework:r.name,findings:t,...i?{configPath:i}:{}}}function ue(e){let t=[`Framework: ${e.framework}`];e.configPath&&t.push(`Config: ${e.configPath}`),t.push(``);for(let n of e.findings){let e=n.severity===`error`?`✖`:n.severity===`warning`?`⚠`:`•`;t.push(`${e} [${n.code}] ${n.message}`)}return t.join(`
|
|
23
|
-
`)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return C}});
|
|
24
|
-
//# sourceMappingURL=doctor-xp8WS8sr.cjs.map
|
|
23
|
+
`)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return C}});
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./doctor-xp8WS8sr.cjs`),t=require(`./tsx-extractor-AOjsbOmp.cjs`),n=require(`./compile-C3VLvhUf.cjs`);let r=require(`@fluenti/core/compiler`),i=require(`node:fs`),a=require(`node:path`),o=require(`fast-glob`);o=e.m(o);let s=require(`node:crypto`),c=require(`@fluenti/core/config`);function l(e){return e}function u(t,n){if(!(0,i.existsSync)(t))return{};let r=(0,i.readFileSync)(t,`utf-8`);return n===`json`?e.u(r):e.c(r)}function d(e){let t={};for(let[n,r]of Object.entries(e))r.obsolete||(t[n]=r.translation??r.message??n);return t}async function f(t,o){let s=await(0,c.loadConfig)(void 0,t),l=(0,r.resolveLocaleCodes)(s.locales),f=s.format===`json`?`.json`:`.po`,p=(0,a.resolve)(t,s.compileOutDir);(0,i.mkdirSync)(p,{recursive:!0});let m=s.plugins?.length?(0,r.createPluginRunner)(s.plugins):void 0,h={};for(let e of l)h[e]=u((0,a.resolve)(t,s.catalogDir,`${e}${f}`),s.format);let g=n.t(h);for(let e of l)if(m){let t={locale:e,messages:d(h[e]),outDir:p,config:s};await m.runBeforeCompile(t)}if(o?.parallel&&l.length>1){let t=await e.s(l.map(e=>({locale:e,catalog:h[e],allIds:g,sourceLocale:s.sourceLocale})));for(let e of t)(0,i.writeFileSync)((0,a.resolve)(p,`${e.locale}.js`),e.code,`utf-8`)}else for(let e of l){let{code:t}=n.n(h[e],e,g,s.sourceLocale);(0,i.writeFileSync)((0,a.resolve)(p,`${e}.js`),t,`utf-8`)}let _=n.r(l,s.compileOutDir);(0,i.writeFileSync)((0,a.resolve)(p,`index.js`),_,`utf-8`);let v=n.i(g,h,s.sourceLocale);(0,i.writeFileSync)((0,a.resolve)(p,`messages.d.ts`),v,`utf-8`);for(let e of l)if(m){let t={locale:e,messages:d(h[e]),outDir:p,config:s};await m.runAfterCompile(t)}}function p(e){return(0,s.createHash)(`md5`).update(e).digest(`hex`).slice(0,8)}function m(t,n){if(!(0,i.existsSync)(t))return{};let r=(0,i.readFileSync)(t,`utf-8`);return n===`json`?e.u(r):e.c(r)}function
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./doctor-xp8WS8sr.cjs`),t=require(`./tsx-extractor-AOjsbOmp.cjs`),n=require(`./compile-C3VLvhUf.cjs`);let r=require(`@fluenti/core/compiler`),i=require(`node:fs`),a=require(`node:path`),o=require(`fast-glob`);o=e.m(o);let s=require(`node:crypto`),c=require(`@fluenti/core/config`);function l(e){return e}function u(t,n){if(!(0,i.existsSync)(t))return{};let r=(0,i.readFileSync)(t,`utf-8`);return n===`json`?e.u(r):e.c(r)}function d(e){let t={};for(let[n,r]of Object.entries(e))r.obsolete||(t[n]=r.translation??r.message??n);return t}async function f(t,o){let s=await(0,c.loadConfig)(void 0,t),l=(0,r.resolveLocaleCodes)(s.locales),f=s.format===`json`?`.json`:`.po`,p=(0,a.resolve)(t,s.compileOutDir);(0,i.mkdirSync)(p,{recursive:!0});let m=s.plugins?.length?(0,r.createPluginRunner)(s.plugins):void 0,h={};for(let e of l)h[e]=u((0,a.resolve)(t,s.catalogDir,`${e}${f}`),s.format);let g=n.t(h);for(let e of l)if(m){let t={locale:e,messages:d(h[e]),outDir:p,config:s};await m.runBeforeCompile(t)}if(o?.parallel&&l.length>1){let t=await e.s(l.map(e=>({locale:e,catalog:h[e],allIds:g,sourceLocale:s.sourceLocale})));for(let e of t)(0,i.writeFileSync)((0,a.resolve)(p,`${e.locale}.js`),e.code,`utf-8`)}else for(let e of l){let{code:t}=n.n(h[e],e,g,s.sourceLocale);(0,i.writeFileSync)((0,a.resolve)(p,`${e}.js`),t,`utf-8`)}let _=n.r(l,s.compileOutDir);(0,i.writeFileSync)((0,a.resolve)(p,`index.js`),_,`utf-8`);let v=n.i(g,h,s.sourceLocale);(0,i.writeFileSync)((0,a.resolve)(p,`messages.d.ts`),v,`utf-8`);for(let e of l)if(m){let t={locale:e,messages:d(h[e]),outDir:p,config:s};await m.runAfterCompile(t)}}function p(e){return(0,s.createHash)(`md5`).update(e).digest(`hex`).slice(0,8)}function m(e){return e.split(`\\`).join(`/`)}function h(e,t){let n=m(t),r=!1,i=e.map(e=>m(e.origin.file)===n?e:(r=!0,{...e,origin:{...e.origin,file:n}}));return{messages:r?i:[...e],changed:r}}function g(t,n){if(!(0,i.existsSync)(t))return{};let r=(0,i.readFileSync)(t,`utf-8`);return n===`json`?e.u(r):e.c(r)}function _(t,n,r){let o=r===`json`?e.d(n):e.l(n);try{(0,i.mkdirSync)((0,a.dirname)(t),{recursive:!0}),(0,i.writeFileSync)(t,o,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);throw Error(`Failed to write catalog "${t}": ${n}`)}}async function v(e,n){if((0,a.extname)(e)===`.vue`)try{let{extractFromVue:t}=await Promise.resolve().then(()=>require(`./vue-extractor.cjs`));return t(n,e)}catch{return[]}return t.t(n,e)}async function y(t,n){let s=await(0,c.loadConfig)(void 0,t),l=(0,r.resolveLocaleCodes)(s.locales),u=await(0,o.default)(s.include,{cwd:t,ignore:s.exclude??[],absolute:!1}),d=[],f=n?.useCache===!1?null:new e.o((0,a.resolve)(t,s.catalogDir),p(t));for(let e of u){let n=(0,a.resolve)(t,e),r=m(e);if(f){let e=f.get(n);if(e){let t=h(e,r);d.push(...t.messages),t.changed&&f.set(n,t.messages);continue}}let o=h(await v(r,(0,i.readFileSync)(n,`utf-8`)),r).messages;d.push(...o),f&&f.set(n,o)}f&&(f.prune(new Set(u.map(e=>(0,a.resolve)(t,e)))),f.save());let y=s.plugins?.length?(0,r.createPluginRunner)(s.plugins):void 0;if(y){let e=new Map;for(let t of d)e.set(t.id,t);let t={messages:e,sourceLocale:s.sourceLocale,targetLocales:l.filter(e=>e!==s.sourceLocale),config:s};await y.runAfterExtract(t)}let b=s.format===`json`?`.json`:`.po`,x=n?.clean??!1,S=n?.stripFuzzy??!1;for(let n of l){let r=(0,a.resolve)(t,s.catalogDir,`${n}${b}`),{catalog:i}=e.f(g(r,s.format),d,{stripFuzzy:S});_(r,x?Object.fromEntries(Object.entries(i).filter(([,e])=>!e.obsolete)):i,s.format)}}exports.collectAllIds=n.t,exports.compileCatalog=n.n,exports.compileIndex=n.r,exports.defineConfig=l,exports.extractFromTsx=t.t,exports.formatDoctorReport=e.t,Object.defineProperty(exports,`hashMessage`,{enumerable:!0,get:function(){return r.hashMessage}}),Object.defineProperty(exports,`loadConfig`,{enumerable:!0,get:function(){return c.loadConfig}}),exports.readJsonCatalog=e.u,exports.readPoCatalog=e.c,exports.rewriteFluentiImports=e.i,exports.runCodemod=e.a,exports.runCompile=f,exports.runDoctor=e.n,exports.runExtract=y,exports.updateCatalog=e.f,exports.writeJsonCatalog=e.d,exports.writePoCatalog=e.l;
|
package/dist/index.js
CHANGED
|
@@ -68,12 +68,28 @@ async function M(i, a) {
|
|
|
68
68
|
function N(e) {
|
|
69
69
|
return O("md5").update(e).digest("hex").slice(0, 8);
|
|
70
70
|
}
|
|
71
|
-
function P(e
|
|
71
|
+
function P(e) {
|
|
72
|
+
return e.split("\\").join("/");
|
|
73
|
+
}
|
|
74
|
+
function F(e, t) {
|
|
75
|
+
let n = P(t), r = !1, i = e.map((e) => P(e.origin.file) === n ? e : (r = !0, {
|
|
76
|
+
...e,
|
|
77
|
+
origin: {
|
|
78
|
+
...e.origin,
|
|
79
|
+
file: n
|
|
80
|
+
}
|
|
81
|
+
}));
|
|
82
|
+
return {
|
|
83
|
+
messages: r ? i : [...e],
|
|
84
|
+
changed: r
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function I(e, t) {
|
|
72
88
|
if (!b(e)) return {};
|
|
73
89
|
let n = S(e, "utf-8");
|
|
74
90
|
return t === "json" ? s(n) : u(n);
|
|
75
91
|
}
|
|
76
|
-
function
|
|
92
|
+
function L(e, t, n) {
|
|
77
93
|
let r = n === "json" ? c(t) : g(t);
|
|
78
94
|
try {
|
|
79
95
|
x(w(e), { recursive: !0 }), C(e, r, "utf-8");
|
|
@@ -82,7 +98,7 @@ function F(e, t, n) {
|
|
|
82
98
|
throw Error(`Failed to write catalog "${e}": ${n}`);
|
|
83
99
|
}
|
|
84
100
|
}
|
|
85
|
-
async function
|
|
101
|
+
async function R(e, t) {
|
|
86
102
|
if (T(e) === ".vue") try {
|
|
87
103
|
let { extractFromVue: n } = await import("./vue-extractor.js");
|
|
88
104
|
return n(t, e);
|
|
@@ -91,23 +107,24 @@ async function I(e, t) {
|
|
|
91
107
|
}
|
|
92
108
|
return i(t, e);
|
|
93
109
|
}
|
|
94
|
-
async function
|
|
110
|
+
async function z(e, t) {
|
|
95
111
|
let n = await o(void 0, e), r = y(n.locales), i = await D(n.include, {
|
|
96
112
|
cwd: e,
|
|
97
113
|
ignore: n.exclude ?? [],
|
|
98
114
|
absolute: !1
|
|
99
115
|
}), a = [], s = t?.useCache === !1 ? null : new f(E(e, n.catalogDir), N(e));
|
|
100
116
|
for (let t of i) {
|
|
101
|
-
let n = E(e, t);
|
|
117
|
+
let n = E(e, t), r = P(t);
|
|
102
118
|
if (s) {
|
|
103
119
|
let e = s.get(n);
|
|
104
120
|
if (e) {
|
|
105
|
-
|
|
121
|
+
let t = F(e, r);
|
|
122
|
+
a.push(...t.messages), t.changed && s.set(n, t.messages);
|
|
106
123
|
continue;
|
|
107
124
|
}
|
|
108
125
|
}
|
|
109
|
-
let
|
|
110
|
-
a.push(...
|
|
126
|
+
let i = F(await R(r, S(n, "utf-8")), r).messages;
|
|
127
|
+
a.push(...i), s && s.set(n, i);
|
|
111
128
|
}
|
|
112
129
|
s && (s.prune(new Set(i.map((t) => E(e, t)))), s.save());
|
|
113
130
|
let c = n.plugins?.length ? _(n.plugins) : void 0;
|
|
@@ -124,11 +141,9 @@ async function L(e, t) {
|
|
|
124
141
|
}
|
|
125
142
|
let l = n.format === "json" ? ".json" : ".po", u = t?.clean ?? !1, d = t?.stripFuzzy ?? !1;
|
|
126
143
|
for (let t of r) {
|
|
127
|
-
let r = E(e, n.catalogDir, `${t}${l}`), { catalog: i } = p(
|
|
128
|
-
|
|
144
|
+
let r = E(e, n.catalogDir, `${t}${l}`), { catalog: i } = p(I(r, n.format), a, { stripFuzzy: d });
|
|
145
|
+
L(r, u ? Object.fromEntries(Object.entries(i).filter(([, e]) => !e.obsolete)) : i, n.format);
|
|
129
146
|
}
|
|
130
147
|
}
|
|
131
148
|
//#endregion
|
|
132
|
-
export { r as collectAllIds, t as compileCatalog, n as compileIndex, k as defineConfig, i as extractFromTsx, h as formatDoctorReport, v as hashMessage, o as loadConfig, s as readJsonCatalog, u as readPoCatalog, l as rewriteFluentiImports, a as runCodemod, M as runCompile, d as runDoctor,
|
|
133
|
-
|
|
134
|
-
//# sourceMappingURL=index.js.map
|
|
149
|
+
export { r as collectAllIds, t as compileCatalog, n as compileIndex, k as defineConfig, i as extractFromTsx, h as formatDoctorReport, v as hashMessage, o as loadConfig, s as readJsonCatalog, u as readPoCatalog, l as rewriteFluentiImports, a as runCodemod, M as runCompile, d as runDoctor, z as runExtract, p as updateCatalog, c as writeJsonCatalog, g as writePoCatalog };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
require(`./doctor-xp8WS8sr.cjs`);let e=require(`@fluenti/core/transform`);var t=new Set([`@fluenti/core`,`@fluenti/react`,`@fluenti/vue`,`@fluenti/solid`,`@fluenti/next`]);function n(e){let t=e.trim();if(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))return t;if(/^[a-zA-Z_$][a-zA-Z0-9_$.]*$/.test(t)&&!t.endsWith(`.`)){let e=t.split(`.`);return e[e.length-1]}let n=t.match(/^([a-zA-Z_$][a-zA-Z0-9_$.]*)\s*\(/);return n?n[1].replace(/\./g,`_`):``}function r(e,t){let r=``,i=0;for(let a=0;a<e.length;a++){if(r+=e[a],a>=t.length)continue;let o=n(t[a]);if(o===``){r+=`{arg${i}}`,i++;continue}r+=`{${o}}`}return r}function i(e,t,n){if(!e.message)return;let r=n.loc?.start.line??1,i=(n.loc?.start.column??0)+1;return{id:e.id,message:e.message,...e.context===void 0?{}:{context:e.context},...e.comment===void 0?{}:{comment:e.comment},origin:{file:t,line:r,column:i}}}function a(t,n){if(!t.message)return;let r=n??e.createMessageId;return{id:t.id??r(t.message,t.context),message:t.message,...t.context===void 0?{}:{context:t.context},...t.comment===void 0?{}:{comment:t.comment}}}function o(e,t){if(e.type===`StringLiteral`)return a({message:e.value},t);if(e.type===`TemplateLiteral`){let n=e;return n.expressions.length===0?a({message:n.quasis.map(e=>e.value.cooked??e.value.raw).join(``)},t):void 0}if(e.type!==`ObjectExpression`)return;let n={};for(let t of e.properties){if(t.type!==`ObjectProperty`)continue;let e=t;if(e.computed||!T(e.key))continue;let r=e.key.name;if(![`id`,`message`,`context`,`comment`].includes(r))continue;let i=p(e.value);i!==void 0&&(n[r]=i)}if(n.message)return a(n,t)}var s=new Set([`id`,`value`,`context`,`comment`,`options`,`other`,`tag`]);function c(e,t,n){let r=[];for(let[e,n]of Object.entries(t))r.push(`${e} {${n}}`);return r.push(`other {${n}}`),`{${e}, select, ${r.join(` `)}}`}function l(e,t){let r,i,a,o,c,l={};for(let u of e.attributes){if(u.type!==`JSXAttribute`)continue;let e=u;if(e.name.type!==`JSXIdentifier`)continue;let d=String(e.name.name);if(d===`id`){i=e.value?p(e.value):void 0;continue}if(d===`value`){let i=e.value?p(e.value)??m(e.value,t):void 0;r=i?n(i)||i:void 0;continue}if(d===`context`){a=e.value?p(e.value):void 0;continue}if(d===`comment`){o=e.value?p(e.value):void 0;continue}if(d===`other`){c=e.value?p(e.value):void 0;continue}if(s.has(d))continue;let f=e.value?p(e.value):void 0;f!==void 0&&(l[d]=f)}return{varName:r,id:i,context:a,comment:o,cases:l,other:c}}function u(e){let t=[`zero`,`one`,`two`,`few`,`many`,`other`],n=e.value??e.count??`count`,r=[],i=e.offset;for(let n of t){let t=e[n];if(t===void 0)continue;let i=n===`zero`?`=0`:n;r.push(`${i} {${t}}`)}return r.length===0?``:`{${n}, plural, ${i?`offset:${i} `:``}${r.join(` `)}}`}function d(e){let t=0;function n(e){let r=``;for(let i of e){if(i.type===`JSXText`){r+=f(i.value);continue}if(i.type===`JSXElement`){let e=t++,a=n(i.children);if(a===void 0)return;r+=`<${e}>${a}</${e}>`;continue}if(i.type===`JSXFragment`){let e=n(i.children);if(e===void 0)return;r+=e;continue}if(i.type===`JSXExpressionContainer`){let e=i.expression;if(e.type===`StringLiteral`){r+=e.value;continue}if(e.type===`NumericLiteral`){r+=String(e.value);continue}return}}return r}let r=n(e);if(r!==void 0)return r.replace(/\s+/g,` `).trim()||void 0}function f(e){return e.replace(/\s+/g,` `)}function p(e){if(e.type===`StringLiteral`)return e.value;if(e.type===`NumericLiteral`)return String(e.value);if(e.type===`JSXExpressionContainer`)return p(e.expression);if(e.type===`TemplateLiteral`){let t=e;if(t.expressions.length===0)return t.quasis.map(e=>e.value.cooked??e.value.raw).join(``)}}function m(e,t){if(!(e.start==null||e.end==null))return e.type===`JSXExpressionContainer`?m(e.expression,t):t.slice(e.start,e.end).trim()}function h(e,t){for(let n of e.attributes){if(n.type!==`JSXAttribute`)continue;let e=n;if(e.name.type===`JSXIdentifier`&&e.name.name===t)return e}}function g(e,t){let n={};for(let r of[`id`,`value`,`count`,`offset`,`zero`,`one`,`two`,`few`,`many`,`other`]){let i=h(e,r);if(!i?.value)continue;let a=p(i.value);if(a!==void 0){n[r]=a;continue}let o=m(i.value,t);o!==void 0&&(r===`value`||r===`count`||r===`offset`)&&(n[r]=o)}return n}function _(t,n,i){let a=r(n.quasi.quasis.map(e=>e.value.cooked??e.value.raw),n.quasi.expressions.map(e=>e.start==null||e.end==null?``:t.slice(e.start,e.end)));return{id:(i??e.createMessageId)(a),message:a}}function v(e){let n=new Map,r=Array.isArray(e.body)?e.body:[];for(let e of r)if(b(e)&&t.has(e.source.value))for(let t of e.specifiers){if(!x(t))continue;let e=S(t);(e===`t`||e===`msg`)&&n.set(t.local.name,e)}return n}function y(t,n,r){let a=(0,e.parseSourceModule)(t);if(!a)return console.warn(`[fluenti] Failed to parse ${n} — skipping message extraction`),[];let s=[],f=v(a);return(0,e.walkSourceAst)(a,a=>{if(a.type===`TaggedTemplateExpression`){let e=a;if(T(e.tag)&&(e.tag.name===`t`||f.has(e.tag.name))){let a=_(t,e,r);f.get(e.tag.name)===`msg`&&(a.comment=`msg tagged template`);let o=i(a,n,e);o&&s.push(o)}return}if(a.type===`CallExpression`){let e=a,t=f.get(e.callee&&T(e.callee)?e.callee.name:``);if(T(e.callee)&&(e.callee.name===`t`||f.has(e.callee.name)&&t===`t`)){if(f.has(e.callee.name)&&e.arguments[0]?.type!==`ObjectExpression`)return;let t=e.arguments[0]?o(e.arguments[0],r):void 0,a=t?i(t,n,e):void 0;a&&s.push(a)}else if(e.callee.type===`MemberExpression`&&T(e.callee.object)&&f.get(e.callee.object.name)===`msg`&&T(e.callee.property)&&e.callee.property.name===`descriptor`&&e.arguments[0]){let t=o(e.arguments[0],r),a=t?i(t,n,e):void 0;a&&s.push(a)}return}if(a.type!==`JSXElement`)return;let m=a,v=m.openingElement,y=C(v.name);if(y===`Trans`){let e=h(v,`message`),t=h(v,`id`),a=h(v,`context`),o=h(v,`comment`),c=e?.value?w({id:t?.value?p(t.value):void 0,message:p(e.value),context:a?.value?p(a.value):void 0,comment:o?.value?p(o.value):void 0},r):w({id:t?.value?p(t.value):void 0,message:d(m.children),context:a?.value?p(a.value):void 0,comment:o?.value?p(o.value):void 0},r),l=c?i(c,n,m):void 0;l&&s.push(l);return}if(y===`Plural`){let a=g(v,t),o=u(a);if(!o)return;let c=r??e.createMessageId,l=i({id:a.id??c(o),message:o},n,m);l&&s.push(l);return}if(y===`Select`){let{varName:a,id:o,context:u,comment:d,cases:f,other:p}=l(v,t);if(!a||!p||Object.keys(f).length===0)return;let h=c(a,f,p),g=i({id:o??(r??e.createMessageId)(h,u),message:h,...u===void 0?{}:{context:u},...d===void 0?{}:{comment:d}},n,m);g&&s.push(g)}}),s}function b(t){return(0,e.isSourceNode)(t)&&t.type===`ImportDeclaration`}function x(t){return(0,e.isSourceNode)(t)&&t.type===`ImportSpecifier`}function S(e){if(e.imported.type===`Identifier`)return e.imported.name;if(e.imported.type===`StringLiteral`)return e.imported.value}function C(e){if(e.type===`JSXIdentifier`)return String(e.name)}function w(e,t){let n={};return e.id!==void 0&&(n.id=e.id),e.message!==void 0&&(n.message=e.message),e.context!==void 0&&(n.context=e.context),e.comment!==void 0&&(n.comment=e.comment),a(n,t)}function T(t){return(0,e.isSourceNode)(t)&&t.type===`Identifier`}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return y}});
|
|
2
|
-
//# sourceMappingURL=tsx-extractor-AOjsbOmp.cjs.map
|
|
1
|
+
require(`./doctor-xp8WS8sr.cjs`);let e=require(`@fluenti/core/transform`);var t=new Set([`@fluenti/core`,`@fluenti/react`,`@fluenti/vue`,`@fluenti/solid`,`@fluenti/next`]);function n(e){let t=e.trim();if(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))return t;if(/^[a-zA-Z_$][a-zA-Z0-9_$.]*$/.test(t)&&!t.endsWith(`.`)){let e=t.split(`.`);return e[e.length-1]}let n=t.match(/^([a-zA-Z_$][a-zA-Z0-9_$.]*)\s*\(/);return n?n[1].replace(/\./g,`_`):``}function r(e,t){let r=``,i=0;for(let a=0;a<e.length;a++){if(r+=e[a],a>=t.length)continue;let o=n(t[a]);if(o===``){r+=`{arg${i}}`,i++;continue}r+=`{${o}}`}return r}function i(e,t,n){if(!e.message)return;let r=n.loc?.start.line??1,i=(n.loc?.start.column??0)+1;return{id:e.id,message:e.message,...e.context===void 0?{}:{context:e.context},...e.comment===void 0?{}:{comment:e.comment},origin:{file:t,line:r,column:i}}}function a(t,n){if(!t.message)return;let r=n??e.createMessageId;return{id:t.id??r(t.message,t.context),message:t.message,...t.context===void 0?{}:{context:t.context},...t.comment===void 0?{}:{comment:t.comment}}}function o(e,t){if(e.type===`StringLiteral`)return a({message:e.value},t);if(e.type===`TemplateLiteral`){let n=e;return n.expressions.length===0?a({message:n.quasis.map(e=>e.value.cooked??e.value.raw).join(``)},t):void 0}if(e.type!==`ObjectExpression`)return;let n={};for(let t of e.properties){if(t.type!==`ObjectProperty`)continue;let e=t;if(e.computed||!T(e.key))continue;let r=e.key.name;if(![`id`,`message`,`context`,`comment`].includes(r))continue;let i=p(e.value);i!==void 0&&(n[r]=i)}if(n.message)return a(n,t)}var s=new Set([`id`,`value`,`context`,`comment`,`options`,`other`,`tag`]);function c(e,t,n){let r=[];for(let[e,n]of Object.entries(t))r.push(`${e} {${n}}`);return r.push(`other {${n}}`),`{${e}, select, ${r.join(` `)}}`}function l(e,t){let r,i,a,o,c,l={};for(let u of e.attributes){if(u.type!==`JSXAttribute`)continue;let e=u;if(e.name.type!==`JSXIdentifier`)continue;let d=String(e.name.name);if(d===`id`){i=e.value?p(e.value):void 0;continue}if(d===`value`){let i=e.value?p(e.value)??m(e.value,t):void 0;r=i?n(i)||i:void 0;continue}if(d===`context`){a=e.value?p(e.value):void 0;continue}if(d===`comment`){o=e.value?p(e.value):void 0;continue}if(d===`other`){c=e.value?p(e.value):void 0;continue}if(s.has(d))continue;let f=e.value?p(e.value):void 0;f!==void 0&&(l[d]=f)}return{varName:r,id:i,context:a,comment:o,cases:l,other:c}}function u(e){let t=[`zero`,`one`,`two`,`few`,`many`,`other`],n=e.value??e.count??`count`,r=[],i=e.offset;for(let n of t){let t=e[n];if(t===void 0)continue;let i=n===`zero`?`=0`:n;r.push(`${i} {${t}}`)}return r.length===0?``:`{${n}, plural, ${i?`offset:${i} `:``}${r.join(` `)}}`}function d(e){let t=0;function n(e){let r=``;for(let i of e){if(i.type===`JSXText`){r+=f(i.value);continue}if(i.type===`JSXElement`){let e=t++,a=n(i.children);if(a===void 0)return;r+=`<${e}>${a}</${e}>`;continue}if(i.type===`JSXFragment`){let e=n(i.children);if(e===void 0)return;r+=e;continue}if(i.type===`JSXExpressionContainer`){let e=i.expression;if(e.type===`StringLiteral`){r+=e.value;continue}if(e.type===`NumericLiteral`){r+=String(e.value);continue}return}}return r}let r=n(e);if(r!==void 0)return r.replace(/\s+/g,` `).trim()||void 0}function f(e){return e.replace(/\s+/g,` `)}function p(e){if(e.type===`StringLiteral`)return e.value;if(e.type===`NumericLiteral`)return String(e.value);if(e.type===`JSXExpressionContainer`)return p(e.expression);if(e.type===`TemplateLiteral`){let t=e;if(t.expressions.length===0)return t.quasis.map(e=>e.value.cooked??e.value.raw).join(``)}}function m(e,t){if(!(e.start==null||e.end==null))return e.type===`JSXExpressionContainer`?m(e.expression,t):t.slice(e.start,e.end).trim()}function h(e,t){for(let n of e.attributes){if(n.type!==`JSXAttribute`)continue;let e=n;if(e.name.type===`JSXIdentifier`&&e.name.name===t)return e}}function g(e,t){let n={};for(let r of[`id`,`value`,`count`,`offset`,`zero`,`one`,`two`,`few`,`many`,`other`]){let i=h(e,r);if(!i?.value)continue;let a=p(i.value);if(a!==void 0){n[r]=a;continue}let o=m(i.value,t);o!==void 0&&(r===`value`||r===`count`||r===`offset`)&&(n[r]=o)}return n}function _(t,n,i){let a=r(n.quasi.quasis.map(e=>e.value.cooked??e.value.raw),n.quasi.expressions.map(e=>e.start==null||e.end==null?``:t.slice(e.start,e.end)));return{id:(i??e.createMessageId)(a),message:a}}function v(e){let n=new Map,r=Array.isArray(e.body)?e.body:[];for(let e of r)if(b(e)&&t.has(e.source.value))for(let t of e.specifiers){if(!x(t))continue;let e=S(t);(e===`t`||e===`msg`)&&n.set(t.local.name,e)}return n}function y(t,n,r){let a=(0,e.parseSourceModule)(t);if(!a)return console.warn(`[fluenti] Failed to parse ${n} — skipping message extraction`),[];let s=[],f=v(a);return(0,e.walkSourceAst)(a,a=>{if(a.type===`TaggedTemplateExpression`){let e=a;if(T(e.tag)&&(e.tag.name===`t`||f.has(e.tag.name))){let a=_(t,e,r);f.get(e.tag.name)===`msg`&&(a.comment=`msg tagged template`);let o=i(a,n,e);o&&s.push(o)}return}if(a.type===`CallExpression`){let e=a,t=f.get(e.callee&&T(e.callee)?e.callee.name:``);if(T(e.callee)&&(e.callee.name===`t`||f.has(e.callee.name)&&t===`t`)){if(f.has(e.callee.name)&&e.arguments[0]?.type!==`ObjectExpression`)return;let t=e.arguments[0]?o(e.arguments[0],r):void 0,a=t?i(t,n,e):void 0;a&&s.push(a)}else if(e.callee.type===`MemberExpression`&&T(e.callee.object)&&f.get(e.callee.object.name)===`msg`&&T(e.callee.property)&&e.callee.property.name===`descriptor`&&e.arguments[0]){let t=o(e.arguments[0],r),a=t?i(t,n,e):void 0;a&&s.push(a)}return}if(a.type!==`JSXElement`)return;let m=a,v=m.openingElement,y=C(v.name);if(y===`Trans`){let e=h(v,`message`),t=h(v,`id`),a=h(v,`context`),o=h(v,`comment`),c=e?.value?w({id:t?.value?p(t.value):void 0,message:p(e.value),context:a?.value?p(a.value):void 0,comment:o?.value?p(o.value):void 0},r):w({id:t?.value?p(t.value):void 0,message:d(m.children),context:a?.value?p(a.value):void 0,comment:o?.value?p(o.value):void 0},r),l=c?i(c,n,m):void 0;l&&s.push(l);return}if(y===`Plural`){let a=g(v,t),o=u(a);if(!o)return;let c=r??e.createMessageId,l=i({id:a.id??c(o),message:o},n,m);l&&s.push(l);return}if(y===`Select`){let{varName:a,id:o,context:u,comment:d,cases:f,other:p}=l(v,t);if(!a||!p||Object.keys(f).length===0)return;let h=c(a,f,p),g=i({id:o??(r??e.createMessageId)(h,u),message:h,...u===void 0?{}:{context:u},...d===void 0?{}:{comment:d}},n,m);g&&s.push(g)}}),s}function b(t){return(0,e.isSourceNode)(t)&&t.type===`ImportDeclaration`}function x(t){return(0,e.isSourceNode)(t)&&t.type===`ImportSpecifier`}function S(e){if(e.imported.type===`Identifier`)return e.imported.name;if(e.imported.type===`StringLiteral`)return e.imported.value}function C(e){if(e.type===`JSXIdentifier`)return String(e.name)}function w(e,t){let n={};return e.id!==void 0&&(n.id=e.id),e.message!==void 0&&(n.message=e.message),e.context!==void 0&&(n.context=e.context),e.comment!==void 0&&(n.comment=e.comment),a(n,t)}function T(t){return(0,e.isSourceNode)(t)&&t.type===`Identifier`}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return y}});
|
package/dist/vue-extractor.cjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./doctor-xp8WS8sr.cjs`);const e=require(`./tsx-extractor-AOjsbOmp.cjs`);let t=require(`@fluenti/core/transform`),n=require(`@vue/compiler-sfc`);var r=1,i=2,a=7,o=6;function s(e){return e.filter(e=>e.type===i).map(e=>(e.content??``).trim()).join(``)}function c(e,t){let n=e.split(`|`).map(e=>e.trim()),r=[`one`,`other`,`zero`,`few`,`many`],i=[];if(n.length===2)i.push(`one {${n[0]}}`),i.push(`other {${n[1]}}`);else for(let e=0;e<n.length&&e<r.length;e++)i.push(`${r[e]} {${n[e]}}`);return`{${t}, plural, ${i.join(` `)}}`}var l=new Set([`id`,`value`,`context`,`comment`,`options`,`other`,`tag`]);function u(e,t,n){let r=[];for(let[e,n]of Object.entries(t))r.push(`${e} {${n}}`);return r.push(`other {${n}}`),`{${e}, select, ${r.join(` `)}}`}function d(e){let t=e.count??`count`,n=[`zero`,`one`,`two`,`few`,`many`,`other`],r=[],i=e.offset;for(let t of n)if(e[t]!==void 0){let n=t===`zero`?`=0`:t;r.push(`${n} {${e[t]}}`)}return r.length===0?``:`{${t}, plural, ${i?`offset:${i} `:``}${r.join(` `)}}`}function f(e,n,i,h){if(e.type===r){let r=e.props?.find(e=>e.type===a&&m(e)===`t`);if(r){let a=new Set([`plural`]),o=(r.modifiers??[]).map(e=>typeof e==`string`?e:e.content),l=o.includes(`plural`),u=o.filter(e=>!a.has(e)),d=r.arg?.content,f=d?[d,...u].join(`.`):void 0,p=s(e.children??[]);if(l){let e=c(p,r.exp?.content??`count`),a=f??(h??t.createMessageId)(e);i.push({id:a,message:e,origin:{file:n,line:r.loc.start.line,column:r.loc.start.column}})}else if(p){let e=f??(h??t.createMessageId)(p);i.push({id:e,message:p,origin:{file:n,line:r.loc.start.line,column:r.loc.start.column}})}}if(e.tag===`Trans`){let r=e.props?.find(e=>e.type===o&&m(e)===`message`),a=e.props?.find(e=>e.type===o&&m(e)===`id`),s=e.props?.find(e=>e.type===o&&m(e)===`context`),c=e.props?.find(e=>e.type===o&&m(e)===`comment`),l=s?.value?.content,u=c?.value?.content;if(r?.value){let o=r.value.content,s=h??t.createMessageId,c=a?.value?.content??s(o,l);i.push({id:c,message:o,...l===void 0?{}:{context:l},...u===void 0?{}:{comment:u},origin:{file:n,line:e.loc.start.line,column:e.loc.start.column}})}else if(e.children&&e.children.length>0){let r=p(e.children);if(r.message){let o=h??t.createMessageId,s=a?.value?.content??o(r.message,l);i.push({id:s,message:r.message,...l===void 0?{}:{context:l},...u===void 0?{}:{comment:u},origin:{file:n,line:e.loc.start.line,column:e.loc.start.column}})}}}if(e.tag===`Plural`){let r={},s,c;for(let t of e.props??[])t.type===o&&t.value&&(r[m(t)]=t.value.content),t.type===a&&m(t)===`bind`&&t.arg?.content===`value`&&t.exp&&(s=t.exp.content),t.type===a&&m(t)===`bind`&&t.arg?.content===`offset`&&t.exp&&(c=t.exp.content);let l=s??r.count??`count`,u=c??r.offset,f=d({...r,count:l,...u===void 0?{}:{offset:u}});if(f){let a=r.id??(h??t.createMessageId)(f);i.push({id:a,message:f,origin:{file:n,line:e.loc.start.line,column:e.loc.start.column}})}}if(e.tag===`Select`){let r,s,c,d,f,p={};for(let t of e.props??[]){if(t.type===o&&t.value){let e=m(t);if(e===`id`){s=t.value.content;continue}if(e===`context`){c=t.value.content;continue}if(e===`comment`){d=t.value.content;continue}if(e===`other`){f=t.value.content;continue}if(l.has(e))continue;p[e]=t.value.content}t.type===a&&m(t)===`bind`&&t.arg?.content===`value`&&t.exp&&(r=t.exp.content)}if(r&&f&&Object.keys(p).length>0){let a=u(r,p,f),o=s??(h??t.createMessageId)(a,c);i.push({id:o,message:a,...c===void 0?{}:{context:c},...d===void 0?{}:{comment:d},origin:{file:n,line:e.loc.start.line,column:e.loc.start.column}})}}}if(e.children)for(let t of e.children)f(t,n,i,h)}function p(e){let t=0,n=!1;return{message:e.map(e=>{if(e.type===i)return(e.content??``).trim()?e.content??``:``;if(e.type===r&&e.tag){n=!0;let r=t++;return`<${r}>${p(e.children??[]).message}</${r}>`}return``}).join(``).trim(),hasElements:n}}function m(e){return typeof e.name==`string`?e.name:e.name.content}function h(t,n,r){let i=[],a=/\{\{([\s\S]*?)\}\}/g,o;for(;(o=a.exec(t))!==null;){let a=o[1]?.trim();if(!a)continue;let s=e.t(a,n,r);if(s.length===0)continue;let c=t.slice(0,o.index).split(`
|
|
2
|
-
`).length-1;for(let e of s)i.push({...e,origin:{...e.origin,line:e.origin.line+c}})}return i}function g(t,r,i){let a=[],{descriptor:o}=(0,n.parse)(t,{filename:r});if(o.template?.ast&&f(o.template.ast,r,a,i),o.template?.content){let t=e.t(o.template.content,r,i),n=o.template.loc.start.line-1,s=new Set(a.map(e=>e.id));for(let e of t)s.has(e.id)||a.push({...e,origin:{...e.origin,line:e.origin.line+n}});let c=new Set(a.map(e=>e.id)),l=h(o.template.content,r,i);for(let e of l)c.has(e.id)||a.push({...e,origin:{...e.origin,line:e.origin.line+n}})}if(o.scriptSetup?.content){let t=e.t(o.scriptSetup.content,r,i),n=o.scriptSetup.loc.start.line-1;for(let e of t)a.push({...e,origin:{...e.origin,line:e.origin.line+n}})}if(o.script?.content){let t=e.t(o.script.content,r,i),n=o.script.loc.start.line-1;for(let e of t)a.push({...e,origin:{...e.origin,line:e.origin.line+n}})}return a}exports.extractFromVue=g;
|
|
3
|
-
//# sourceMappingURL=vue-extractor.cjs.map
|
|
2
|
+
`).length-1;for(let e of s)i.push({...e,origin:{...e.origin,line:e.origin.line+c}})}return i}function g(t,r,i){let a=[],{descriptor:o}=(0,n.parse)(t,{filename:r});if(o.template?.ast&&f(o.template.ast,r,a,i),o.template?.content){let t=e.t(o.template.content,r,i),n=o.template.loc.start.line-1,s=new Set(a.map(e=>e.id));for(let e of t)s.has(e.id)||a.push({...e,origin:{...e.origin,line:e.origin.line+n}});let c=new Set(a.map(e=>e.id)),l=h(o.template.content,r,i);for(let e of l)c.has(e.id)||a.push({...e,origin:{...e.origin,line:e.origin.line+n}})}if(o.scriptSetup?.content){let t=e.t(o.scriptSetup.content,r,i),n=o.scriptSetup.loc.start.line-1;for(let e of t)a.push({...e,origin:{...e.origin,line:e.origin.line+n}})}if(o.script?.content){let t=e.t(o.script.content,r,i),n=o.script.loc.start.line-1;for(let e of t)a.push({...e,origin:{...e.origin,line:e.origin.line+n}})}return a}exports.extractFromVue=g;
|
package/dist/vue-extractor.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluenti/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Fluenti CLI — message extraction from Vue SFC & TSX, PO/JSON catalog compilation",
|
|
6
6
|
"homepage": "https://fluenti.dev",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"fast-glob": "^3",
|
|
73
73
|
"gettext-parser": "^9",
|
|
74
74
|
"jiti": "^2",
|
|
75
|
-
"@fluenti/core": "0.6.
|
|
75
|
+
"@fluenti/core": "0.6.2"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@vue/compiler-sfc": "^3.5"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-provider.d.ts","sourceRoot":"","sources":["../../../src/ai-provider.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE3C,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACxC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAiBD,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA0ChF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;IACtC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9B,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC5B;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;AAEtD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,mDAAmD;AACnD,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,oBAAoB,GAC7B;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,CAiEhD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAE5C,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,YAAY,EAAE,MAAM,CAAA;IACpB,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAA;IACnB,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oBAAoB;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;CACnC;AAED,wBAAwB;AACxB,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,MAAM,EAAE,OAAO,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,cAAc,EAAE,CAAA;CAC9B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACrC,OAAO,EAAE,YAAY,GACpB,WAAW,CAoFb;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAiB3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,MAAM,CAuBR;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAO3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cli.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codemod.d.ts","sourceRoot":"","sources":["../../../src/codemod.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,iBAAiB,EAAE,CAAA;IACjC,YAAY,EAAE,MAAM,CAAA;CACrB;AAsED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAuFxF;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CA2BhF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-cache.d.ts","sourceRoot":"","sources":["../../../src/compile-cache.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAkB;IAC9B,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,KAAK,CAAQ;gBAET,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAQlD;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO;IAQ3D;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;IAOjD;;OAEG;IACH,IAAI,IAAI,IAAI;IAYZ,OAAO,CAAC,IAAI;CAeb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-runner.d.ts","sourceRoot":"","sources":["../../../src/compile-runner.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuExF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-worker.d.ts","sourceRoot":"","sources":["../../../src/compile-worker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,WAAW,CAAA;IACpB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;CACrC;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AA4J5C;;;;GAIG;AACH,4EAA4E;AAC5E,eAAO,MAAM,eAAe,IAAI,CAAA;AAEhC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EAAE,EAChB,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,cAAc,GACvB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,CA0EvC;AA8BD;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAW3E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,EAAE,CAU7E;AAID,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,CAO1E;AA8CD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EAAE,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACrC,YAAY,EAAE,MAAM,GACnB,MAAM,CAsDR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../src/config-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAEhE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE7F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/doctor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAGhE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAEzD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,cAAc,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAA;IACpC,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAwDD,wBAAsB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAsG7E;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAiB/D"}
|