@intlayer/chokidar 8.2.2 → 8.2.4

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.
Files changed (45) hide show
  1. package/dist/assets/installSkills/skills/astro.md +1 -1
  2. package/dist/assets/installSkills/skills/cli.md +3 -3
  3. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +1 -1
  4. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
  5. package/dist/cjs/cleanOutputDir.cjs +1 -1
  6. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  7. package/dist/cjs/cleanRemovedContentDeclaration.cjs +1 -1
  8. package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -1
  9. package/dist/cjs/cli.cjs +1 -1
  10. package/dist/cjs/filterInvalidDictionaries.cjs +1 -1
  11. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  12. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +1 -1
  13. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
  14. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
  15. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  16. package/dist/cjs/loadDictionaries/log.cjs +2 -2
  17. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  18. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +1 -1
  19. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
  20. package/dist/cjs/logConfigDetails.cjs +2 -0
  21. package/dist/cjs/logConfigDetails.cjs.map +1 -0
  22. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs +1 -1
  23. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -1
  24. package/dist/esm/cleanOutputDir.mjs +1 -1
  25. package/dist/esm/cleanOutputDir.mjs.map +1 -1
  26. package/dist/esm/cleanRemovedContentDeclaration.mjs +1 -1
  27. package/dist/esm/cleanRemovedContentDeclaration.mjs.map +1 -1
  28. package/dist/esm/cli.mjs +1 -1
  29. package/dist/esm/filterInvalidDictionaries.mjs +1 -1
  30. package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
  31. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +1 -1
  32. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
  33. package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
  34. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  35. package/dist/esm/loadDictionaries/log.mjs +1 -1
  36. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  37. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs +1 -1
  38. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs.map +1 -1
  39. package/dist/esm/logConfigDetails.mjs +2 -0
  40. package/dist/esm/logConfigDetails.mjs.map +1 -0
  41. package/dist/types/cli.d.ts +2 -1
  42. package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts.map +1 -1
  43. package/dist/types/logConfigDetails.d.ts +7 -0
  44. package/dist/types/logConfigDetails.d.ts.map +1 -0
  45. package/package.json +10 -10
@@ -33,7 +33,7 @@ const content = await getIntlayer("my-dictionary-key");
33
33
  ## References
34
34
 
35
35
  - [Website](https://intlayer.org)
36
- - [Doc](https://intlayer.org/doc/concept/cli/index.md)
36
+ - [Doc](https://intlayer.org/doc/concept/cli.md)
37
37
 
38
38
  - [Astro](https://intlayer.org/doc/environment/astro.md)
39
39
  - [Intlayer Exports](https://intlayer.org/doc/packages/intlayer/exports.md)
@@ -39,8 +39,8 @@ npm install intlayer-cli
39
39
  ### Concepts
40
40
 
41
41
  - [Build](https://intlayer.org/doc/concept/cli/build.md)
42
- - [CI](https://intlayer.org/doc/concept/cli/ci.md)
43
- - [CLI Overview](https://intlayer.org/doc/concept/cli/index.md)
42
+ - [CI](https://intlayer.org/doc/concept/cli.md)
43
+ - [CLI Overview](https://intlayer.org/doc/concept/cli/export.md)
44
44
  - [Configuration](https://intlayer.org/doc/concept/cli/configuration.md)
45
45
  - [Debug](https://intlayer.org/doc/concept/cli/debug.md)
46
46
  - [Doc Review](https://intlayer.org/doc/concept/cli/doc-review.md)
@@ -63,7 +63,7 @@ npm install intlayer-cli
63
63
  ### Packages
64
64
 
65
65
  - [Website](https://intlayer.org)
66
- - [Doc](https://intlayer.org/doc/concept/cli/index.md)
66
+ - [Doc](https://intlayer.org/doc/concept/cli.md)
67
67
 
68
68
  - [Intlayer CLI](https://intlayer.org/doc/packages/intlayer-cli/exports.md)
69
69
  - [Intlayer CLI Exports](https://intlayer.org/doc/packages/intlayer-cli/exports.md)
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/autoDecorateContent.cjs`),t=require(`../utils/resolveObjectPromises.cjs`);let n=require(`@intlayer/config/client`);const r=async(r,i)=>{try{let n=await t.resolveObjectPromises(r.content),a=r.contentAutoTransformation??i.dictionary?.contentAutoTransformation??!1,o=a?e.autoDecorateContent(n,a):n;return{...r,content:o}}catch(e){(0,n.logger)(e,{level:`error`})}};exports.processContentDeclaration=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/autoDecorateContent.cjs`),t=require(`../utils/resolveObjectPromises.cjs`);let n=require(`@intlayer/config/logger`);const r=async(r,i)=>{try{let n=await t.resolveObjectPromises(r.content),a=r.contentAutoTransformation??i.dictionary?.contentAutoTransformation??!1,o=a?e.autoDecorateContent(n,a):n;return{...r,content:o}}catch(e){(0,n.logger)(e,{level:`error`})}};exports.processContentDeclaration=r;
2
2
  //# sourceMappingURL=processContentDeclaration.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"processContentDeclaration.cjs","names":["resolveObjectPromises","autoDecorateContent"],"sources":["../../../src/buildIntlayerDictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { autoDecorateContent } from '../utils/autoDecorateContent';\nimport { resolveObjectPromises } from '../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary,\n configuration: IntlayerConfig\n): Promise<Dictionary | undefined> => {\n try {\n const resolvedContent = (await resolveObjectPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n const isAutoDecorateContentEnabled =\n contentDeclaration.contentAutoTransformation ??\n configuration.dictionary?.contentAutoTransformation ??\n false;\n\n const decoratedContent = isAutoDecorateContentEnabled\n ? autoDecorateContent(resolvedContent, isAutoDecorateContentEnabled)\n : resolvedContent;\n\n return {\n ...contentDeclaration,\n content: decoratedContent,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":"6PAQA,MAAa,EAA4B,MACvC,EACA,IACoC,CACpC,GAAI,CACF,IAAM,EAAmB,MAAMA,EAAAA,sBAC7B,EAAmB,QACpB,CAEK,EACJ,EAAmB,2BACnB,EAAc,YAAY,2BAC1B,GAEI,EAAmB,EACrBC,EAAAA,oBAAoB,EAAiB,EAA6B,CAClE,EAEJ,MAAO,CACL,GAAG,EACH,QAAS,EACV,OACM,EAAO,EACd,EAAA,EAAA,QAAO,EAAO,CACZ,MAAO,QACR,CAAC"}
1
+ {"version":3,"file":"processContentDeclaration.cjs","names":["resolveObjectPromises","autoDecorateContent"],"sources":["../../../src/buildIntlayerDictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/logger';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { autoDecorateContent } from '../utils/autoDecorateContent';\nimport { resolveObjectPromises } from '../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary,\n configuration: IntlayerConfig\n): Promise<Dictionary | undefined> => {\n try {\n const resolvedContent = (await resolveObjectPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n const isAutoDecorateContentEnabled =\n contentDeclaration.contentAutoTransformation ??\n configuration.dictionary?.contentAutoTransformation ??\n false;\n\n const decoratedContent = isAutoDecorateContentEnabled\n ? autoDecorateContent(resolvedContent, isAutoDecorateContentEnabled)\n : resolvedContent;\n\n return {\n ...contentDeclaration,\n content: decoratedContent,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":"6PAQA,MAAa,EAA4B,MACvC,EACA,IACoC,CACpC,GAAI,CACF,IAAM,EAAmB,MAAMA,EAAAA,sBAC7B,EAAmB,QACpB,CAEK,EACJ,EAAmB,2BACnB,EAAc,YAAY,2BAC1B,GAEI,EAAmB,EACrBC,EAAAA,oBAAoB,EAAiB,EAA6B,CAClE,EAEJ,MAAO,CACL,GAAG,EACH,QAAS,EACV,OACM,EAAO,EACd,EAAA,EAAA,QAAO,EAAO,CACZ,MAAO,QACR,CAAC"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/config/client`),t=require(`node:fs/promises`),n=require(`node:fs`);const r=async r=>{let{dictionariesDir:i,unmergedDictionariesDir:a,dynamicDictionariesDir:o,remoteDictionariesDir:s,fetchDictionariesDir:c,mainDir:l,typesDir:u,configDir:d,cacheDir:f}=r.system,p=(0,e.getAppLogger)(r),m=[i,a,o,s,c,l,u,d,f];await Promise.all(m.filter(e=>(0,n.existsSync)(e)).map(e=>(0,t.rm)(e,{recursive:!0,force:!0}))),p(`Output directory cleaned`,{isVerbose:!0})};exports.cleanOutputDir=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);let e=require(`node:fs/promises`),t=require(`@intlayer/config/logger`),n=require(`node:fs`);const r=async r=>{let{dictionariesDir:i,unmergedDictionariesDir:a,dynamicDictionariesDir:o,remoteDictionariesDir:s,fetchDictionariesDir:c,mainDir:l,typesDir:u,configDir:d,cacheDir:f}=r.system,p=(0,t.getAppLogger)(r),m=[i,a,o,s,c,l,u,d,f];await Promise.all(m.filter(e=>(0,n.existsSync)(e)).map(t=>(0,e.rm)(t,{recursive:!0,force:!0}))),p(`Output directory cleaned`,{isVerbose:!0})};exports.cleanOutputDir=r;
2
2
  //# sourceMappingURL=cleanOutputDir.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanOutputDir.cjs","names":[],"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { rm } from 'node:fs/promises';\nimport { getAppLogger } from '@intlayer/config/client';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const cleanOutputDir = async (configuration: IntlayerConfig) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n remoteDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n cacheDir,\n } = configuration.system;\n\n const appLogger = getAppLogger(configuration);\n\n const directoriesToClean: string[] = [\n dictionariesDir, // Merged dictionaries\n unmergedDictionariesDir, // Unmerged dictionaries\n dynamicDictionariesDir, // Dynamic dictionaries\n remoteDictionariesDir, // Remote dictionaries\n fetchDictionariesDir, // Fetch dictionaries\n mainDir, // Main files\n typesDir, // Types\n configDir, // Configuration\n cacheDir, // Cache\n ];\n\n // Execute all deletions in parallel\n await Promise.all(\n directoriesToClean\n .filter((dir) => existsSync(dir))\n .map((dir) => rm(dir, { recursive: true, force: true }))\n );\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":"2MAKA,MAAa,EAAiB,KAAO,IAAkC,CACrE,GAAM,CACJ,kBACA,0BACA,yBACA,wBACA,uBACA,UACA,WACA,YACA,YACE,EAAc,OAEZ,GAAA,EAAA,EAAA,cAAyB,EAAc,CAEvC,EAA+B,CACnC,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACD,CAGD,MAAM,QAAQ,IACZ,EACG,OAAQ,IAAA,EAAA,EAAA,YAAmB,EAAI,CAAC,CAChC,IAAK,IAAA,EAAA,EAAA,IAAW,EAAK,CAAE,UAAW,GAAM,MAAO,GAAM,CAAC,CAAC,CAC3D,CAED,EAAU,2BAA4B,CACpC,UAAW,GACZ,CAAC"}
1
+ {"version":3,"file":"cleanOutputDir.cjs","names":[],"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { rm } from 'node:fs/promises';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const cleanOutputDir = async (configuration: IntlayerConfig) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n remoteDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n cacheDir,\n } = configuration.system;\n\n const appLogger = getAppLogger(configuration);\n\n const directoriesToClean: string[] = [\n dictionariesDir, // Merged dictionaries\n unmergedDictionariesDir, // Unmerged dictionaries\n dynamicDictionariesDir, // Dynamic dictionaries\n remoteDictionariesDir, // Remote dictionaries\n fetchDictionariesDir, // Fetch dictionaries\n mainDir, // Main files\n typesDir, // Types\n configDir, // Configuration\n cacheDir, // Cache\n ];\n\n // Execute all deletions in parallel\n await Promise.all(\n directoriesToClean\n .filter((dir) => existsSync(dir))\n .map((dir) => rm(dir, { recursive: true, force: true }))\n );\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":"2MAKA,MAAa,EAAiB,KAAO,IAAkC,CACrE,GAAM,CACJ,kBACA,0BACA,yBACA,wBACA,uBACA,UACA,WACA,YACA,YACE,EAAc,OAEZ,GAAA,EAAA,EAAA,cAAyB,EAAc,CAEvC,EAA+B,CACnC,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACD,CAGD,MAAM,QAAQ,IACZ,EACG,OAAQ,IAAA,EAAA,EAAA,YAAmB,EAAI,CAAC,CAChC,IAAK,IAAA,EAAA,EAAA,IAAW,EAAK,CAAE,UAAW,GAAM,MAAO,GAAM,CAAC,CAAC,CAC3D,CAED,EAAU,2BAA4B,CACpC,UAAW,GACZ,CAAC"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./writeJsonIfChanged.cjs`),n=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`);let r=require(`@intlayer/config/client`),i=require(`@intlayer/unmerged-dictionaries-entry`),a=require(`node:fs/promises`),o=require(`node:path`),s=require(`fast-glob`);s=e.__toESM(s);let c=require(`@intlayer/dictionaries-entry`);const l=async(e,l,u)=>{let d=(0,r.getAppLogger)(u),f=(0,i.getUnmergedDictionaries)(u),p=u.content.baseDir,m=(0,o.relative)(p,e),h=Object.values(f).flat().filter(e=>e.filePath===m&&!l.includes(e.key)).filter((e,t,n)=>t===n.findIndex(t=>t.key===e.key)),g=[],_=[],v=[];await Promise.all(h.map(async e=>{let n=(0,o.normalize)((0,o.join)(u.system.unmergedDictionariesDir,`${e.key}.json`));try{let i=await(0,a.readFile)(n,`utf8`),o=JSON.parse(i);o.length===1?o[0].filePath===m&&(d(`Removing outdated dictionary ${(0,r.colorizeKey)(e.key)}`,{isVerbose:!0}),_.push(n),v.push(e.key)):(await t.writeJsonIfChanged(n,o.filter(e=>e.filePath!==m)),g.push(e.localId))}catch(t){t.code===`ENOENT`&&(v.includes(e.key)||v.push(e.key))}}));let y=(0,c.getDictionaries)(u),b=(Object.values(y)?.filter(e=>!l.includes(e.key)&&e.localIds?.length===1&&e.localIds[0].endsWith(`::local::${m}`))).filter((e,t,n)=>t===n.findIndex(t=>t.key===e.key));return await Promise.all(b.map(async e=>{let n=(0,o.normalize)((0,o.join)(u.system.dictionariesDir,`${e.key}.json`));try{let i=await(0,a.readFile)(n,`utf8`),c=JSON.parse(i);if(c.localIds?.length===1){if(c.localIds[0].endsWith(`::local::${m}`)){d(`Removing outdated unmerged dictionary ${(0,r.colorizeKey)(e.key)}`,{isVerbose:!0}),_.push(n);let t=(0,o.normalize)((0,o.join)(u.system.typesDir,`${e.key}.ts`));_.push(t);let i=await(0,s.default)((0,r.normalizePath)((0,o.join)(u.system.dynamicDictionariesDir,`${e.key}.*`)),{absolute:!0});_.push(...i),v.includes(e.key)||v.push(e.key)}}else{let e=c.localIds?.filter(e=>!e.endsWith(`::local::${m}`));await t.writeJsonIfChanged(n,{...c,localIds:e})}}catch(t){if(t.code===`ENOENT`){v.includes(e.key)||v.push(e.key);let t=(0,o.normalize)((0,o.join)(u.system.typesDir,`${e.key}.ts`));_.push(t)}}})),(_.length>0||v.length>0)&&(await n.createDictionaryEntryPoint(u,{excludeKeys:v}),_.length>0&&await Promise.all(_.map(async e=>{let t=(0,o.relative)(p,e);try{await(0,a.rm)(e,{force:!0}),d(`Deleted artifact: ${(0,r.colorizePath)(t)}`,{isVerbose:!0})}catch{d(`Error while removing file ${(0,r.colorizePath)(t)}`,{isVerbose:!0})}}))),{changedDictionariesLocalIds:g,excludeKeys:v,hasRebuilt:_.length>0||v.length>0}};exports.cleanRemovedContentDeclaration=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./writeJsonIfChanged.cjs`),n=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`);let r=require(`@intlayer/config/client`),i=require(`@intlayer/unmerged-dictionaries-entry`),a=require(`node:fs/promises`),o=require(`node:path`),s=require(`@intlayer/config/logger`),c=require(`fast-glob`);c=e.__toESM(c);let l=require(`@intlayer/dictionaries-entry`);const u=async(e,u,d)=>{let f=(0,s.getAppLogger)(d),p=(0,i.getUnmergedDictionaries)(d),m=d.content.baseDir,h=(0,o.relative)(m,e),g=Object.values(p).flat().filter(e=>e.filePath===h&&!u.includes(e.key)).filter((e,t,n)=>t===n.findIndex(t=>t.key===e.key)),_=[],v=[],y=[];await Promise.all(g.map(async e=>{let n=(0,o.normalize)((0,o.join)(d.system.unmergedDictionariesDir,`${e.key}.json`));try{let r=await(0,a.readFile)(n,`utf8`),i=JSON.parse(r);i.length===1?i[0].filePath===h&&(f(`Removing outdated dictionary ${(0,s.colorizeKey)(e.key)}`,{isVerbose:!0}),v.push(n),y.push(e.key)):(await t.writeJsonIfChanged(n,i.filter(e=>e.filePath!==h)),_.push(e.localId))}catch(t){t.code===`ENOENT`&&(y.includes(e.key)||y.push(e.key))}}));let b=(0,l.getDictionaries)(d),x=(Object.values(b)?.filter(e=>!u.includes(e.key)&&e.localIds?.length===1&&e.localIds[0].endsWith(`::local::${h}`))).filter((e,t,n)=>t===n.findIndex(t=>t.key===e.key));return await Promise.all(x.map(async e=>{let n=(0,o.normalize)((0,o.join)(d.system.dictionariesDir,`${e.key}.json`));try{let i=await(0,a.readFile)(n,`utf8`),l=JSON.parse(i);if(l.localIds?.length===1){if(l.localIds[0].endsWith(`::local::${h}`)){f(`Removing outdated unmerged dictionary ${(0,s.colorizeKey)(e.key)}`,{isVerbose:!0}),v.push(n);let t=(0,o.normalize)((0,o.join)(d.system.typesDir,`${e.key}.ts`));v.push(t);let i=await(0,c.default)((0,r.normalizePath)((0,o.join)(d.system.dynamicDictionariesDir,`${e.key}.*`)),{absolute:!0});v.push(...i),y.includes(e.key)||y.push(e.key)}}else{let e=l.localIds?.filter(e=>!e.endsWith(`::local::${h}`));await t.writeJsonIfChanged(n,{...l,localIds:e})}}catch(t){if(t.code===`ENOENT`){y.includes(e.key)||y.push(e.key);let t=(0,o.normalize)((0,o.join)(d.system.typesDir,`${e.key}.ts`));v.push(t)}}})),(v.length>0||y.length>0)&&(await n.createDictionaryEntryPoint(d,{excludeKeys:y}),v.length>0&&await Promise.all(v.map(async e=>{let t=(0,o.relative)(m,e);try{await(0,a.rm)(e,{force:!0}),f(`Deleted artifact: ${(0,s.colorizePath)(t)}`,{isVerbose:!0})}catch{f(`Error while removing file ${(0,s.colorizePath)(t)}`,{isVerbose:!0})}}))),{changedDictionariesLocalIds:_,excludeKeys:y,hasRebuilt:v.length>0||y.length>0}};exports.cleanRemovedContentDeclaration=u;
2
2
  //# sourceMappingURL=cleanRemovedContentDeclaration.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanRemovedContentDeclaration.cjs","names":["writeJsonIfChanged","createDictionaryEntryPoint"],"sources":["../../src/cleanRemovedContentDeclaration.ts"],"sourcesContent":["import { readFile, rm } from 'node:fs/promises';\nimport { join, normalize, relative } from 'node:path';\nimport {\n colorizeKey,\n colorizePath,\n getAppLogger,\n normalizePath,\n} from '@intlayer/config/client';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport fg from 'fast-glob';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint';\nimport { writeJsonIfChanged } from './writeJsonIfChanged';\n\nexport const cleanRemovedContentDeclaration = async (\n filePath: string,\n keysToKeep: string[],\n configuration: IntlayerConfig\n): Promise<{\n changedDictionariesLocalIds: string[];\n excludeKeys: string[];\n hasRebuilt: boolean;\n}> => {\n const appLogger = getAppLogger(configuration);\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n const baseDir = configuration.content.baseDir;\n\n const relativeFilePath = relative(baseDir, filePath);\n const flatUnmergedDictionaries = Object.values(unmergedDictionaries).flat();\n\n const filteredUnmergedDictionaries = flatUnmergedDictionaries.filter(\n (dictionary) =>\n dictionary.filePath === relativeFilePath &&\n !keysToKeep.includes(dictionary.key)\n );\n\n // Deduplicate dictionaries by key\n const uniqueUnmergedDictionaries = filteredUnmergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n const changedDictionariesLocalIds: string[] = [];\n const filesToRemove: string[] = [];\n const excludeKeys: string[] = [];\n\n // Identify Unmerged Dictionaries to remove or clean\n await Promise.all(\n uniqueUnmergedDictionaries.map(async (dictionary) => {\n const unmergedFilePath = normalize(\n join(\n configuration.system.unmergedDictionariesDir,\n `${dictionary.key}.json`\n )\n );\n\n try {\n const jsonContent = await readFile(unmergedFilePath, 'utf8');\n const parsedContent = JSON.parse(jsonContent);\n\n if (parsedContent.length === 1) {\n if (parsedContent[0].filePath === relativeFilePath) {\n appLogger(\n `Removing outdated dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n filesToRemove.push(unmergedFilePath);\n excludeKeys.push(dictionary.key);\n }\n } else {\n const filteredContent = parsedContent.filter(\n (content: any) => content.filePath !== relativeFilePath\n );\n await writeJsonIfChanged(unmergedFilePath, filteredContent);\n changedDictionariesLocalIds.push(dictionary.localId!);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n }\n })\n );\n\n const dictionaries = getDictionaries(configuration);\n const flatDictionaries = Object.values(dictionaries) as Dictionary[];\n\n const filteredMergedDictionaries = flatDictionaries?.filter(\n (dictionary) =>\n !keysToKeep.includes(dictionary.key) &&\n dictionary.localIds?.length === 1 &&\n (dictionary.localIds[0] as string).endsWith(\n `::local::${relativeFilePath}`\n )\n );\n\n const uniqueMergedDictionaries = filteredMergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n // Identify Merged Dictionaries, Types, and Dynamic Dictionaries to remove\n await Promise.all(\n uniqueMergedDictionaries.map(async (dictionary) => {\n const mergedFilePath = normalize(\n join(configuration.system.dictionariesDir, `${dictionary.key}.json`)\n );\n\n try {\n const fileContent = await readFile(mergedFilePath, 'utf8');\n const parsedContent = JSON.parse(fileContent) as Dictionary;\n\n if (parsedContent.localIds?.length === 1) {\n if (\n parsedContent.localIds[0].endsWith(`::local::${relativeFilePath}`)\n ) {\n appLogger(\n `Removing outdated unmerged dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n\n // Mark JSON for removal\n filesToRemove.push(mergedFilePath);\n\n // Mark TS Types for removal\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n\n // Mark Dynamic Dictionaries for removal\n // We use glob to catch the loader files (.cjs, .mjs) AND the split locale files (.en.json, etc.)\n const dynamicFilesGlob = join(\n configuration.system.dynamicDictionariesDir,\n `${dictionary.key}.*`\n );\n const dynamicFiles = await fg(normalizePath(dynamicFilesGlob), {\n absolute: true,\n });\n filesToRemove.push(...dynamicFiles);\n\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n } else {\n const localIds = parsedContent.localIds?.filter(\n (localeId) => !localeId.endsWith(`::local::${relativeFilePath}`)\n ) as string[];\n const newContent = { ...parsedContent, localIds };\n await writeJsonIfChanged(mergedFilePath, newContent);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n }\n }\n })\n );\n\n // Execute Cleanup\n if (filesToRemove.length > 0 || excludeKeys.length > 0) {\n // Update entry points (indexes) first so the app doesn't import dead files\n await createDictionaryEntryPoint(configuration, { excludeKeys });\n\n // Remove the files synchronously (awaited) immediately after.\n if (filesToRemove.length > 0) {\n await Promise.all(\n filesToRemove.map(async (path) => {\n const relativePath = relative(baseDir, path);\n try {\n await rm(path, { force: true });\n\n appLogger(`Deleted artifact: ${colorizePath(relativePath)}`, {\n isVerbose: true,\n });\n } catch {\n appLogger(\n `Error while removing file ${colorizePath(relativePath)}`,\n {\n isVerbose: true,\n }\n );\n }\n })\n );\n }\n }\n\n return {\n changedDictionariesLocalIds,\n excludeKeys,\n hasRebuilt: filesToRemove.length > 0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AAI,EACvC,EAAY,KAAK,EAAW,IAAI,CAElC,IAAM,GAAA,EAAA,EAAA,YAAA,EAAA,EAAA,MACC,EAAc,OAAO,SAAU,GAAG,EAAW,IAAI,KAAK,CAC5D,CACD,EAAc,KAAK,EAAc,IAGrC,CACH,EAGG,EAAc,OAAS,GAAK,EAAY,OAAS,KAEnD,MAAMC,EAAAA,2BAA2B,EAAe,CAAE,cAAa,CAAC,CAG5D,EAAc,OAAS,GACzB,MAAM,QAAQ,IACZ,EAAc,IAAI,KAAO,IAAS,CAChC,IAAM,GAAA,EAAA,EAAA,UAAwB,EAAS,EAAK,CAC5C,GAAI,CACF,MAAA,EAAA,EAAA,IAAS,EAAM,CAAE,MAAO,GAAM,CAAC,CAE/B,EAAU,sBAAA,EAAA,EAAA,cAAkC,EAAa,GAAI,CAC3D,UAAW,GACZ,CAAC,MACI,CACN,EACE,8BAAA,EAAA,EAAA,cAA0C,EAAa,GACvD,CACE,UAAW,GACZ,CACF,GAEH,CACH,EAIE,CACL,8BACA,cACA,WAAY,EAAc,OAAS,GAAK,EAAY,OAAS,EAC9D"}
1
+ {"version":3,"file":"cleanRemovedContentDeclaration.cjs","names":["writeJsonIfChanged","createDictionaryEntryPoint"],"sources":["../../src/cleanRemovedContentDeclaration.ts"],"sourcesContent":["import { readFile, rm } from 'node:fs/promises';\nimport { join, normalize, relative } from 'node:path';\nimport { normalizePath } from '@intlayer/config/client';\nimport {\n colorizeKey,\n colorizePath,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport fg from 'fast-glob';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint';\nimport { writeJsonIfChanged } from './writeJsonIfChanged';\n\nexport const cleanRemovedContentDeclaration = async (\n filePath: string,\n keysToKeep: string[],\n configuration: IntlayerConfig\n): Promise<{\n changedDictionariesLocalIds: string[];\n excludeKeys: string[];\n hasRebuilt: boolean;\n}> => {\n const appLogger = getAppLogger(configuration);\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n const baseDir = configuration.content.baseDir;\n\n const relativeFilePath = relative(baseDir, filePath);\n const flatUnmergedDictionaries = Object.values(unmergedDictionaries).flat();\n\n const filteredUnmergedDictionaries = flatUnmergedDictionaries.filter(\n (dictionary) =>\n dictionary.filePath === relativeFilePath &&\n !keysToKeep.includes(dictionary.key)\n );\n\n // Deduplicate dictionaries by key\n const uniqueUnmergedDictionaries = filteredUnmergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n const changedDictionariesLocalIds: string[] = [];\n const filesToRemove: string[] = [];\n const excludeKeys: string[] = [];\n\n // Identify Unmerged Dictionaries to remove or clean\n await Promise.all(\n uniqueUnmergedDictionaries.map(async (dictionary) => {\n const unmergedFilePath = normalize(\n join(\n configuration.system.unmergedDictionariesDir,\n `${dictionary.key}.json`\n )\n );\n\n try {\n const jsonContent = await readFile(unmergedFilePath, 'utf8');\n const parsedContent = JSON.parse(jsonContent);\n\n if (parsedContent.length === 1) {\n if (parsedContent[0].filePath === relativeFilePath) {\n appLogger(\n `Removing outdated dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n filesToRemove.push(unmergedFilePath);\n excludeKeys.push(dictionary.key);\n }\n } else {\n const filteredContent = parsedContent.filter(\n (content: any) => content.filePath !== relativeFilePath\n );\n await writeJsonIfChanged(unmergedFilePath, filteredContent);\n changedDictionariesLocalIds.push(dictionary.localId!);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n }\n })\n );\n\n const dictionaries = getDictionaries(configuration);\n const flatDictionaries = Object.values(dictionaries) as Dictionary[];\n\n const filteredMergedDictionaries = flatDictionaries?.filter(\n (dictionary) =>\n !keysToKeep.includes(dictionary.key) &&\n dictionary.localIds?.length === 1 &&\n (dictionary.localIds[0] as string).endsWith(\n `::local::${relativeFilePath}`\n )\n );\n\n const uniqueMergedDictionaries = filteredMergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n // Identify Merged Dictionaries, Types, and Dynamic Dictionaries to remove\n await Promise.all(\n uniqueMergedDictionaries.map(async (dictionary) => {\n const mergedFilePath = normalize(\n join(configuration.system.dictionariesDir, `${dictionary.key}.json`)\n );\n\n try {\n const fileContent = await readFile(mergedFilePath, 'utf8');\n const parsedContent = JSON.parse(fileContent) as Dictionary;\n\n if (parsedContent.localIds?.length === 1) {\n if (\n parsedContent.localIds[0].endsWith(`::local::${relativeFilePath}`)\n ) {\n appLogger(\n `Removing outdated unmerged dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n\n // Mark JSON for removal\n filesToRemove.push(mergedFilePath);\n\n // Mark TS Types for removal\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n\n // Mark Dynamic Dictionaries for removal\n // We use glob to catch the loader files (.cjs, .mjs) AND the split locale files (.en.json, etc.)\n const dynamicFilesGlob = join(\n configuration.system.dynamicDictionariesDir,\n `${dictionary.key}.*`\n );\n const dynamicFiles = await fg(normalizePath(dynamicFilesGlob), {\n absolute: true,\n });\n filesToRemove.push(...dynamicFiles);\n\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n } else {\n const localIds = parsedContent.localIds?.filter(\n (localeId) => !localeId.endsWith(`::local::${relativeFilePath}`)\n ) as string[];\n const newContent = { ...parsedContent, localIds };\n await writeJsonIfChanged(mergedFilePath, newContent);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n }\n }\n })\n );\n\n // Execute Cleanup\n if (filesToRemove.length > 0 || excludeKeys.length > 0) {\n // Update entry points (indexes) first so the app doesn't import dead files\n await createDictionaryEntryPoint(configuration, { excludeKeys });\n\n // Remove the files synchronously (awaited) immediately after.\n if (filesToRemove.length > 0) {\n await Promise.all(\n filesToRemove.map(async (path) => {\n const relativePath = relative(baseDir, path);\n try {\n await rm(path, { force: true });\n\n appLogger(`Deleted artifact: ${colorizePath(relativePath)}`, {\n isVerbose: true,\n });\n } catch {\n appLogger(\n `Error while removing file ${colorizePath(relativePath)}`,\n {\n isVerbose: true,\n }\n );\n }\n })\n );\n }\n }\n\n return {\n changedDictionariesLocalIds,\n excludeKeys,\n hasRebuilt: filesToRemove.length > 0 || excludeKeys.length > 0,\n };\n};\n"],"mappings":"gfAeA,MAAa,EAAiC,MAC5C,EACA,EACA,IAKI,CACJ,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAEvC,GAAA,EAAA,EAAA,yBAA+C,EAAc,CAE7D,EAAU,EAAc,QAAQ,QAEhC,GAAA,EAAA,EAAA,UAA4B,EAAS,EAAS,CAU9C,EAT2B,OAAO,OAAO,EAAqB,CAAC,MAAM,CAEb,OAC3D,GACC,EAAW,WAAa,GACxB,CAAC,EAAW,SAAS,EAAW,IAAI,CACvC,CAG+D,QAC7D,EAAY,EAAO,IAClB,IAAU,EAAK,UAAW,GAAM,EAAE,MAAQ,EAAW,IAAI,CAC5D,CAEK,EAAwC,EAAE,CAC1C,EAA0B,EAAE,CAC5B,EAAwB,EAAE,CAGhC,MAAM,QAAQ,IACZ,EAA2B,IAAI,KAAO,IAAe,CACnD,IAAM,GAAA,EAAA,EAAA,YAAA,EAAA,EAAA,MAEF,EAAc,OAAO,wBACrB,GAAG,EAAW,IAAI,OACnB,CACF,CAED,GAAI,CACF,IAAM,EAAc,MAAA,EAAA,EAAA,UAAe,EAAkB,OAAO,CACtD,EAAgB,KAAK,MAAM,E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toStringTag,{value:`Module`});const e=require(`./listDictionariesPath.cjs`),t=require(`./writeContentDeclaration/detectExportedComponentName.cjs`),n=require(`./writeContentDeclaration/transformJSFile.cjs`),r=require(`./detectFormatCommand.cjs`),i=require(`./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs`),a=require(`./writeContentDeclaration/writeJSFile.cjs`),o=require(`./writeContentDeclaration/writeContentDeclaration.cjs`),s=require(`./init/index.cjs`),c=require(`./installSkills/index.cjs`),l=require(`./installMCP/installMCP.cjs`),u=require(`./listGitFiles.cjs`),d=require(`./listProjects.cjs`);exports.PLATFORMS=c.PLATFORMS,exports.PLATFORMS_METADATA=c.PLATFORMS_METADATA,exports.SKILLS=c.SKILLS,exports.SKILLS_METADATA=c.SKILLS_METADATA,exports.detectExportedComponentName=t.detectExportedComponentName,exports.detectFormatCommand=r.detectFormatCommand,exports.getContentDeclarationFileTemplate=i.getContentDeclarationFileTemplate,exports.getInitialSkills=c.getInitialSkills,exports.initIntlayer=s.initIntlayer,exports.installMCP=l.installMCP,exports.installSkills=c.installSkills,exports.listDictionaries=e.listDictionaries,exports.listDictionariesWithStats=e.listDictionariesWithStats,exports.listGitFiles=u.listGitFiles,exports.listGitLines=u.listGitLines,exports.listProjects=d.listProjects,exports.transformJSFile=n.transformJSFile,exports.writeContentDeclaration=o.writeContentDeclaration,exports.writeJSFile=a.writeJSFile;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./listDictionariesPath.cjs`),t=require(`./writeContentDeclaration/detectExportedComponentName.cjs`),n=require(`./writeContentDeclaration/transformJSFile.cjs`),r=require(`./detectFormatCommand.cjs`),i=require(`./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs`),a=require(`./writeContentDeclaration/writeJSFile.cjs`),o=require(`./writeContentDeclaration/writeContentDeclaration.cjs`),s=require(`./init/index.cjs`),c=require(`./installSkills/index.cjs`),l=require(`./installMCP/installMCP.cjs`),u=require(`./listGitFiles.cjs`),d=require(`./listProjects.cjs`),f=require(`./logConfigDetails.cjs`);exports.PLATFORMS=c.PLATFORMS,exports.PLATFORMS_METADATA=c.PLATFORMS_METADATA,exports.SKILLS=c.SKILLS,exports.SKILLS_METADATA=c.SKILLS_METADATA,exports.detectExportedComponentName=t.detectExportedComponentName,exports.detectFormatCommand=r.detectFormatCommand,exports.getContentDeclarationFileTemplate=i.getContentDeclarationFileTemplate,exports.getInitialSkills=c.getInitialSkills,exports.initIntlayer=s.initIntlayer,exports.installMCP=l.installMCP,exports.installSkills=c.installSkills,exports.listDictionaries=e.listDictionaries,exports.listDictionariesWithStats=e.listDictionariesWithStats,exports.listGitFiles=u.listGitFiles,exports.listGitLines=u.listGitLines,exports.listProjects=d.listProjects,exports.logConfigDetails=f.logConfigDetails,exports.transformJSFile=n.transformJSFile,exports.writeContentDeclaration=o.writeContentDeclaration,exports.writeJSFile=a.writeJSFile;
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/formatter.cjs`);let t=require(`@intlayer/config/client`),n=require(`@intlayer/core/interpreter`);const r=(r,i,a)=>{let o=(0,t.getAppLogger)(i);if(!r)return!1;let s=r.location===`local`||typeof r.filePath==`string`?`Local`:`Remote`,c=!!r.key,l=!!r.content;if(!c)return o(`${s} dictionary has no key`,{level:`error`}),!1;if(!l)return o(`${s} dictionary ${(0,t.colorizeKey)(r.key)} has no content - ${r.filePath?e.formatPath(r.filePath):(0,t.colorizePath)(`Remote`)}`,{level:`error`}),!1;if(r.schema&&a?.checkSchema&&!(typeof r.content==`function`||typeof r.content==`object`&&r.content!==null&&typeof r.content.then==`function`)){let a=i?.internationalization?.locales??[],c=i?.internationalization.strictMode===`strict`,l=typeof r.schema==`string`?i?.schemas?.[r.schema]:void 0;if(l&&typeof l.safeParse==`function`)for(let i of a){let a=(0,n.getContent)(r.content,{dictionaryKey:r.key,keyPath:[]},i,!c),u=l.safeParse(a);if(!u.success)return o(`${s} dictionary ${(0,t.colorizeKey)(r.key)} has invalid content according to schema ${(0,t.colorize)(r.schema,t.ANSIColors.ORANGE)} for locale ${e.formatLocale(i)} - ${r.filePath?e.formatPath(r.filePath):(0,t.colorizePath)(`Remote`)}`,{level:`error`}),u.error.issues.forEach(n=>{o(`${t.x} Error: ${(0,t.colorizeKey)(r.key)} - ${e.formatLocale(i)} - ${(0,t.colorize)(`${n.path.join(`.`)}:`,t.ANSIColors.BLUE)} ${(0,t.colorize)(n.message,t.ANSIColors.GREY)}`,{level:`error`})}),!1}}return!0},i=(e,t,n)=>(e??[])?.filter(e=>r(e,t,n));exports.filterInvalidDictionaries=i,exports.isInvalidDictionary=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/formatter.cjs`);let t=require(`@intlayer/config/logger`),n=require(`@intlayer/core/interpreter`);const r=(r,i,a)=>{let o=(0,t.getAppLogger)(i);if(!r)return!1;let s=r.location===`local`||typeof r.filePath==`string`?`Local`:`Remote`,c=!!r.key,l=!!r.content;if(!c)return o(`${s} dictionary has no key`,{level:`error`}),!1;if(!l)return o(`${s} dictionary ${(0,t.colorizeKey)(r.key)} has no content - ${r.filePath?e.formatPath(r.filePath):(0,t.colorizePath)(`Remote`)}`,{level:`error`}),!1;if(r.schema&&a?.checkSchema&&!(typeof r.content==`function`||typeof r.content==`object`&&r.content!==null&&typeof r.content.then==`function`)){let a=i?.internationalization?.locales??[],c=i?.internationalization.strictMode===`strict`,l=typeof r.schema==`string`?i?.schemas?.[r.schema]:void 0;if(l&&typeof l.safeParse==`function`)for(let i of a){let a=(0,n.getContent)(r.content,{dictionaryKey:r.key,keyPath:[]},i,!c),u=l.safeParse(a);if(!u.success)return o(`${s} dictionary ${(0,t.colorizeKey)(r.key)} has invalid content according to schema ${(0,t.colorize)(r.schema,t.ANSIColors.ORANGE)} for locale ${e.formatLocale(i)} - ${r.filePath?e.formatPath(r.filePath):(0,t.colorizePath)(`Remote`)}`,{level:`error`}),u.error.issues.forEach(n=>{o(`${t.x} Error: ${(0,t.colorizeKey)(r.key)} - ${e.formatLocale(i)} - ${(0,t.colorize)(`${n.path.join(`.`)}:`,t.ANSIColors.BLUE)} ${(0,t.colorize)(n.message,t.ANSIColors.GREY)}`,{level:`error`})}),!1}}return!0},i=(e,t,n)=>(e??[])?.filter(e=>r(e,t,n));exports.filterInvalidDictionaries=i,exports.isInvalidDictionary=r;
2
2
  //# sourceMappingURL=filterInvalidDictionaries.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterInvalidDictionaries.cjs","names":["formatPath","ANSIColors","formatLocale","x"],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/client';\nimport { getContent } from '@intlayer/core/interpreter';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n },\n locale,\n !isStrict\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":"yOAcA,MAAa,GACX,EACA,EACA,IACY,CACZ,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAE7C,GAAI,CAAC,EAAY,MAAO,GAKxB,IAAM,EAFJ,EAAW,WAAa,SAAW,OAAO,EAAW,UAAa,SAEzC,QAAU,SAC/B,EAAS,EAAQ,EAAW,IAC5B,EAAa,EAAQ,EAAW,QAEtC,GAAI,CAAC,EAKH,OAJA,EAAU,GAAG,EAAS,wBAAyB,CA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,EAAAA,WAAW,KAAK,CAAC,IAAA,EAAA,EAAA,UAAY,EAAM,QAASA,EAAAA,WAAW,KAAK,GAC3K,CACE,MAAO,QACR,CACF,EACD,CAEK,IAOjB,MAAO,IAGI,GACX,EACA,EACA,KAEC,GAAgB,EAAE,GAAG,OAAQ,GAC5B,EAAoB,EAAY,EAAe,EAAQ,CACxD"}
1
+ {"version":3,"file":"filterInvalidDictionaries.cjs","names":["formatPath","ANSIColors","formatLocale","x"],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getContent } from '@intlayer/core/interpreter';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n },\n locale,\n !isStrict\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":"yOAcA,MAAa,GACX,EACA,EACA,IACY,CACZ,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAE7C,GAAI,CAAC,EAAY,MAAO,GAKxB,IAAM,EAFJ,EAAW,WAAa,SAAW,OAAO,EAAW,UAAa,SAEzC,QAAU,SAC/B,EAAS,EAAQ,EAAW,IAC5B,EAAa,EAAQ,EAAW,QAEtC,GAAI,CAAC,EAKH,OAJA,EAAU,GAAG,EAAS,wBAAyB,CAC7C,MAAO,QACR,CAAC,CAEK,GAGT,GAAI,CAAC,EAOH,OANA,EACE,GAAG,EAAS,eAAA,EAAA,EAAA,aAA0B,EAAW,IAAI,CAAC,oBAAoB,E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,MAAO,IAGI,GACX,EACA,EACA,KAEC,GAAgB,EAAE,GAAG,OAAQ,GAC5B,EAAoB,EAAY,EAAe,EAAQ,CACxD"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`node:fs/promises`),t=require(`node:path`),n=require(`@intlayer/config/utils`),r=require(`@intlayer/config/file`),i=require(`node:module`);const a=(e,t)=>({name:`rewrite-paths`,setup(n){n.onResolve({filter:/.*/},n=>{let r=e[n.path];if(t?.includes(n.path))return null;if(r)return{path:r,namespace:`intlayer-replace-modules`,external:!0};for(let t of Object.keys(e))if(n.path===t||n.path.startsWith(`${t}/`)){let r=n.path.slice(t.length);return{path:e[t]+r,namespace:`intlayer-replace-modules`,external:!0}}})}}),o=async o=>{let s=(0,n.getProjectRequire)(o.content.baseDir),c=n.configESMxCJSRequire,l=n.isESModule?(0,i.createRequire)(require(`url`).pathToFileURL(__filename).href):require,u=(0,t.join)(o.system.configDir,`configuration.json`),d={defu:c.resolve(`defu`),esbuild:c.resolve(`esbuild`),"@intlayer/config/built":u,"@intlayer/config/utils":l.resolve(`@intlayer/config/utils`),"@intlayer/config/client":l.resolve(`@intlayer/config/client`),"@intlayer/core/file":l.resolve(`@intlayer/core/file`)},f=s.resolve(`intlayer`);return await(0,r.bundleFile)(await(0,e.readFile)(f,`utf-8`),f,{external:[...i.builtinModules,...i.builtinModules.map(e=>`node:${e}`)],minify:!0,plugins:[a(d)]})??``};exports.getIntlayerBundle=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`node:fs/promises`),t=require(`node:path`),n=require(`@intlayer/config/utils`),r=require(`@intlayer/config/file`),i=require(`node:module`);const a=(e,t)=>({name:`rewrite-paths`,setup(n){n.onResolve({filter:/.*/},n=>{let r=e[n.path];if(t?.includes(n.path))return null;if(r)return{path:r,namespace:`intlayer-replace-modules`,external:!0};for(let t of Object.keys(e))if(n.path===t||n.path.startsWith(`${t}/`)){let r=n.path.slice(t.length);return{path:e[t]+r,namespace:`intlayer-replace-modules`,external:!0}}})}}),o=async o=>{let s=(0,n.getProjectRequire)(o.content.baseDir),c=n.configESMxCJSRequire,l=n.isESModule?(0,i.createRequire)(require(`url`).pathToFileURL(__filename).href):require,u=(0,t.join)(o.system.configDir,`configuration.json`),d={defu:c.resolve(`defu`),esbuild:c.resolve(`esbuild`),"@intlayer/config/built":u,"@intlayer/config/utils":l.resolve(`@intlayer/config/utils`),"@intlayer/config/client":l.resolve(`@intlayer/config/client`),"@intlayer/config/logger":l.resolve(`@intlayer/config/logger`),"@intlayer/core/file":l.resolve(`@intlayer/core/file`)},f=s.resolve(`intlayer`);return await(0,r.bundleFile)(await(0,e.readFile)(f,`utf-8`),f,{external:[...i.builtinModules,...i.builtinModules.map(e=>`node:${e}`)],minify:!0,plugins:[a(d)]})??``};exports.getIntlayerBundle=o;
2
2
  //# sourceMappingURL=getIntlayerBundle.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayerBundle.cjs","names":["configESMxCJSRequire","isESModule","builtinModules"],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport { bundleFile, type ESBuildPlugin } from '@intlayer/config/file';\nimport {\n configESMxCJSRequire,\n getProjectRequire,\n isESModule,\n} from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = getProjectRequire(configuration.content.baseDir);\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.system.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n defu: configPackageRequire.resolve('defu'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config/utils': localRequire.resolve('@intlayer/config/utils'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":"yQAmBA,MAAM,GACJ,EACA,KAEO,CACL,KAAM,gBACN,MAAM,EAAO,CACX,EAAM,UAAU,CAAE,OAAQ,KAAM,CAAG,GAAS,CAC1C,IAAM,EAAQ,EAAe,EAAK,MAElC,GAAI,GAAgB,SAAS,EAAK,KAAK,CACrC,OAAO,KAGT,GAAI,EACF,MAAO,CACL,KAAM,EACN,UAAW,2BACX,SAAU,GACX,CAIH,IAAK,IAAM,KAAO,OAAO,KAAK,EAAe,CAC3C,GAAI,EAAK,OAAS,GAAO,EAAK,KAAK,WAAW,GAAG,EAAI,GAAG,CAAE,CACxD,IAAM,EAAM,EAAK,KAAK,MAAM,EAAI,OAAO,CACvC,MAAO,CACL,KAAM,EAAe,GAAO,EAC5B,UAAW,2BACX,SAAU,GACX,GAGL,EAEL,EAMU,EAAoB,KAAO,IAAkC,CACxE,IAAM,GAAA,EAAA,EAAA,mBAAgC,EAAc,QAAQ,QAAQ,CAC9D,EAAuBA,EAAAA,qBACvB,EAAeC,EAAAA,YAAAA,EAAAA,EAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KAA2C,CAAG,QAE7D,GAAA,EAAA,EAAA,MACJ,EAAc,OAAO,UACrB,qBACD,CAEK,EAAiB,CACrB,KAAM,EAAqB,QAAQ,OAAO,CAC1C,QAAS,EAAqB,QAAQ,UAAU,CAChD,yBAA0B,EAC1B,yBAA0B,EAAa,QAAQ,yBAAyB,CACxE,0BAA2B,EAAa,QAAQ,0BAA0B,CAC1E,sBAAuB,EAAa,QAAQ,sBAAsB,CACnE,CAEK,EAAW,EAAY,QAAQ,WAAW,CAYhD,OATe,MAAA,EAAA,EAAA,YAFF,MAAA,EAAA,EAAA,UAAe,EAAU,QAAQ,CAER,EAAU,CAC9C,SAAU,CACR,GAAGC,EAAAA,eACH,GAAGA,EAAAA,eAAe,IAAK,GAAQ,QAAQ,IAAM,CAC9C,CACD,OAAQ,GACR,QAAS,CAAC,EAAmB,EAAe,CAAC,CAC9C,CAAC,EAEe"}
1
+ {"version":3,"file":"getIntlayerBundle.cjs","names":["configESMxCJSRequire","isESModule","builtinModules"],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport { bundleFile, type ESBuildPlugin } from '@intlayer/config/file';\nimport {\n configESMxCJSRequire,\n getProjectRequire,\n isESModule,\n} from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = getProjectRequire(configuration.content.baseDir);\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.system.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n defu: configPackageRequire.resolve('defu'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config/utils': localRequire.resolve('@intlayer/config/utils'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/config/logger': localRequire.resolve('@intlayer/config/logger'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":"yQAmBA,MAAM,GACJ,EACA,KAEO,CACL,KAAM,gBACN,MAAM,EAAO,CACX,EAAM,UAAU,CAAE,OAAQ,KAAM,CAAG,GAAS,CAC1C,IAAM,EAAQ,EAAe,EAAK,MAElC,GAAI,GAAgB,SAAS,EAAK,KAAK,CACrC,OAAO,KAGT,GAAI,EACF,MAAO,CACL,KAAM,EACN,UAAW,2BACX,SAAU,GACX,CAIH,IAAK,IAAM,KAAO,OAAO,KAAK,EAAe,CAC3C,GAAI,EAAK,OAAS,GAAO,EAAK,KAAK,WAAW,GAAG,EAAI,GAAG,CAAE,CACxD,IAAM,EAAM,EAAK,KAAK,MAAM,EAAI,OAAO,CACvC,MAAO,CACL,KAAM,EAAe,GAAO,EAC5B,UAAW,2BACX,SAAU,GACX,GAGL,EAEL,EAMU,EAAoB,KAAO,IAAkC,CACxE,IAAM,GAAA,EAAA,EAAA,mBAAgC,EAAc,QAAQ,QAAQ,CAC9D,EAAuBA,EAAAA,qBACvB,EAAeC,EAAAA,YAAAA,EAAAA,EAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KAA2C,CAAG,QAE7D,GAAA,EAAA,EAAA,MACJ,EAAc,OAAO,UACrB,qBACD,CAEK,EAAiB,CACrB,KAAM,EAAqB,QAAQ,OAAO,CAC1C,QAAS,EAAqB,QAAQ,UAAU,CAChD,yBAA0B,EAC1B,yBAA0B,EAAa,QAAQ,yBAAyB,CACxE,0BAA2B,EAAa,QAAQ,0BAA0B,CAC1E,0BAA2B,EAAa,QAAQ,0BAA0B,CAC1E,sBAAuB,EAAa,QAAQ,sBAAsB,CACnE,CAEK,EAAW,EAAY,QAAQ,WAAW,CAYhD,OATe,MAAA,EAAA,EAAA,YAFF,MAAA,EAAA,EAAA,UAAe,EAAU,QAAQ,CAER,EAAU,CAC9C,SAAU,CACR,GAAGC,EAAAA,eACH,GAAGA,EAAAA,eAAe,IAAK,GAAQ,QAAQ,IAAM,CAC9C,CACD,OAAQ,GACR,QAAS,CAAC,EAAmB,EAAe,CAAC,CAC9C,CAAC,EAEe"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../filterInvalidDictionaries.cjs`),t=require(`../formatDictionary.cjs`),n=require(`./loadContentDeclaration.cjs`),r=require(`./loadRemoteDictionaries.cjs`),i=require(`./log.cjs`);let a=require(`@intlayer/config/client`),o=[];const s=new i.DictionariesLogger,c=e=>{let t=[...o];for(let n of e){let e=t.findIndex(e=>e.dictionaryKey===n.dictionaryKey&&e.type===n.type);e>=0?t[e]=n:t.push(n)}return o=t,s.update(e),t},l=e=>{switch(e){case`built`:case`imported`:case`fetched`:return`✔`;case`error`:return`✖`;default:return`⏲`}},u=e=>{switch(e){case`built`:case`imported`:case`fetched`:return a.ANSIColors.GREEN;case`error`:return a.ANSIColors.RED;default:return a.ANSIColors.BLUE}},d=e=>{if(e.log.mode!==`verbose`)return;let t=(0,a.getAppLogger)(e),n=new Map;for(let e of o){let t=n.get(e.dictionaryKey)??{};e.type===`local`&&(t.local=e.status),e.type===`remote`&&(t.remote=e.status),n.set(e.dictionaryKey,t)}let r=Array.from(n.keys()).sort((e,t)=>e.localeCompare(t)),i=0;for(let e of r){let t=n.get(e);if(t.local){let e=`[local: ${l(t.local)} ${t.local}]`;e.length>i&&(i=e.length)}}for(let e of r){let o=n.get(e),s=[];if(o.local){let e=(0,a.colorize)(`${l(o.local)} ${o.local}`,u(o.local)),t=`${a.ANSIColors.GREY}[`+(0,a.colorize)(`local: `,a.ANSIColors.GREY)+e+`${a.ANSIColors.GREY}]${a.ANSIColors.RESET}`,n=`[local: ${l(o.local)} ${o.local}]`,r=Math.max(0,i-n.length);s.push(t+` `.repeat(r))}else s.push(` `.repeat(i));if(o.remote){let e=(0,a.colorize)(`${l(o.remote)} ${o.remote}`,u(o.remote));s.push(`${a.ANSIColors.GREY}[`+(0,a.colorize)(`distant: `,a.ANSIColors.GREY)+e+`${a.ANSIColors.GREY}]${a.ANSIColors.RESET}`)}t(` - ${(0,a.colon)((0,a.colorizeKey)(e),{colSize:r})} ${s.join(` `)}`)}},f=async(i,o)=>{let{plugins:l}=o,u=Date.now();(0,a.getAppLogger)(o)(`Dictionaries:`,{isVerbose:!0});let f=(l??[]).filter(e=>e.loadDictionaries).map(async e=>{try{return await e.loadDictionaries?.({configuration:o})??[]}catch(e){return s.setPluginError(e),[]}}),p=await Promise.all(f).then(e=>e.flat()).then(t=>e.filterInvalidDictionaries(t,o)).then(e=>t.formatDictionaries(e));s.setPluginTotal(p.length),s.setPluginDone(p.length);let m=Date.now(),h=await n.loadContentDeclarations(Array.isArray(i)?i:[i],o,c).then(t=>e.filterInvalidDictionaries(t,o)).then(e=>t.formatDictionaries(e)),g=Date.now();c(h.map(e=>({dictionaryKey:e.key,type:`local`,status:`built`})));let _=!!(o.editor.clientId&&o.editor.clientSecret);_&&s.setExpectRemote(!0);let v=[];_&&(v=await r.loadRemoteDictionaries(o,c,{onStartRemoteCheck:()=>s.startRemoteCheck(),onStopRemoteCheck:()=>s.stopRemoteCheck(),onError:e=>s.setRemoteError(e)}).then(t=>e.filterInvalidDictionaries(t,o)).then(e=>t.formatDictionaries(e)));let y=Date.now();return s.finish(),d(o),{localDictionaries:h,remoteDictionaries:v,pluginDictionaries:p,time:{localDictionaries:g-m,remoteDictionaries:y-g,pluginDictionaries:m-u}}};exports.loadDictionaries=f;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../filterInvalidDictionaries.cjs`),t=require(`../formatDictionary.cjs`),n=require(`./loadContentDeclaration.cjs`),r=require(`./loadRemoteDictionaries.cjs`),i=require(`./log.cjs`);let a=require(`@intlayer/config/logger`),o=[];const s=new i.DictionariesLogger,c=e=>{let t=[...o];for(let n of e){let e=t.findIndex(e=>e.dictionaryKey===n.dictionaryKey&&e.type===n.type);e>=0?t[e]=n:t.push(n)}return o=t,s.update(e),t},l=e=>{switch(e){case`built`:case`imported`:case`fetched`:return`✔`;case`error`:return`✖`;default:return`⏲`}},u=e=>{switch(e){case`built`:case`imported`:case`fetched`:return a.ANSIColors.GREEN;case`error`:return a.ANSIColors.RED;default:return a.ANSIColors.BLUE}},d=e=>{if(e.log.mode!==`verbose`)return;let t=(0,a.getAppLogger)(e),n=new Map;for(let e of o){let t=n.get(e.dictionaryKey)??{};e.type===`local`&&(t.local=e.status),e.type===`remote`&&(t.remote=e.status),n.set(e.dictionaryKey,t)}let r=Array.from(n.keys()).sort((e,t)=>e.localeCompare(t)),i=0;for(let e of r){let t=n.get(e);if(t.local){let e=`[local: ${l(t.local)} ${t.local}]`;e.length>i&&(i=e.length)}}for(let e of r){let o=n.get(e),s=[];if(o.local){let e=(0,a.colorize)(`${l(o.local)} ${o.local}`,u(o.local)),t=`${a.ANSIColors.GREY}[`+(0,a.colorize)(`local: `,a.ANSIColors.GREY)+e+`${a.ANSIColors.GREY}]${a.ANSIColors.RESET}`,n=`[local: ${l(o.local)} ${o.local}]`,r=Math.max(0,i-n.length);s.push(t+` `.repeat(r))}else s.push(` `.repeat(i));if(o.remote){let e=(0,a.colorize)(`${l(o.remote)} ${o.remote}`,u(o.remote));s.push(`${a.ANSIColors.GREY}[`+(0,a.colorize)(`distant: `,a.ANSIColors.GREY)+e+`${a.ANSIColors.GREY}]${a.ANSIColors.RESET}`)}t(` - ${(0,a.colon)((0,a.colorizeKey)(e),{colSize:r})} ${s.join(` `)}`)}},f=async(i,o)=>{let{plugins:l}=o,u=Date.now();(0,a.getAppLogger)(o)(`Dictionaries:`,{isVerbose:!0});let f=(l??[]).filter(e=>e.loadDictionaries).map(async e=>{try{return await e.loadDictionaries?.({configuration:o})??[]}catch(e){return s.setPluginError(e),[]}}),p=await Promise.all(f).then(e=>e.flat()).then(t=>e.filterInvalidDictionaries(t,o)).then(e=>t.formatDictionaries(e));s.setPluginTotal(p.length),s.setPluginDone(p.length);let m=Date.now(),h=await n.loadContentDeclarations(Array.isArray(i)?i:[i],o,c).then(t=>e.filterInvalidDictionaries(t,o)).then(e=>t.formatDictionaries(e)),g=Date.now();c(h.map(e=>({dictionaryKey:e.key,type:`local`,status:`built`})));let _=!!(o.editor.clientId&&o.editor.clientSecret);_&&s.setExpectRemote(!0);let v=[];_&&(v=await r.loadRemoteDictionaries(o,c,{onStartRemoteCheck:()=>s.startRemoteCheck(),onStopRemoteCheck:()=>s.stopRemoteCheck(),onError:e=>s.setRemoteError(e)}).then(t=>e.filterInvalidDictionaries(t,o)).then(e=>t.formatDictionaries(e)));let y=Date.now();return s.finish(),d(o),{localDictionaries:h,remoteDictionaries:v,pluginDictionaries:p,time:{localDictionaries:g-m,remoteDictionaries:y-g,pluginDictionaries:m-u}}};exports.loadDictionaries=f;
2
2
  //# sourceMappingURL=loadDictionaries.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadDictionaries.cjs","names":["DictionariesLogger","ANSIColors","filterInvalidDictionaries","formatDictionaries","loadContentDeclarations","loadRemoteDictionaries"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/client';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { formatDictionaries } from '../formatDictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const status of loadDictionariesStatus) {\n const rec = byKey.get(status.dictionaryKey) ?? {};\n if (status.type === 'local') rec.local = status.status;\n if (status.type === 'remote') rec.remote = status.status;\n byKey.set(status.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n pluginDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const pluginsWithLoadDictionaries = (plugins ?? []).filter(\n (plugin) => plugin.loadDictionaries\n );\n\n const loadPluginDictionariesPromise = pluginsWithLoadDictionaries.map(\n async (plugin) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n\n return (res as Dictionary[] | undefined) ?? [];\n } catch (error) {\n logger.setPluginError(error as Error);\n\n return [];\n }\n }\n );\n\n const pluginDictionaries: Dictionary[] = await Promise.all(\n loadPluginDictionariesPromise as Promise<Dictionary[]>[]\n )\n .then((dictionaries) => dictionaries.flat())\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n logger.setPluginTotal(pluginDictionaries.length);\n logger.setPluginDone(pluginDictionaries.length);\n\n const pluginDictionariesTime = Date.now();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n const localDictionariesTime = Date.now();\n\n const localDictionariesStatus = localDictionaries.map(\n (dictionary) =>\n ({\n dictionaryKey: dictionary.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n }\n\n const remoteDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - pluginDictionariesTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n pluginDictionaries: pluginDictionariesTime - loadDictionariesStartTime,\n },\n };\n};\n"],"mappings":"6VA6BI,EAA+C,EAAE,CACrD,MAAM,EAAS,IAAIA,EAAAA,mBAEb,EAA6B,GAAmC,CACpE,IAAM,EAAgC,CAAC,GAAG,EAAuB,CAEjE,IAAK,IAAM,KAAY,EAAU,CAC/B,IAAM,EAAQ,EAAQ,UACnB,GACC,EAAE,gBAAkB,EAAS,eAAiB,EAAE,OAAS,EAAS,KACrE,CACG,GAAS,EACX,EAAQ,GAAS,EAEjB,EAAQ,KAAK,EAAS,CAO1B,MAHA,GAAyB,EACzB,EAAO,OAAO,EAAS,CAEhB,GAQH,EAAW,GAAyC,CACxD,OAAQ,EAAR,CACE,IAAK,QACL,IAAK,WACL,IAAK,UACH,MAAO,IACT,IAAK,QACH,MAAO,IACT,QACE,MAAO,MAIP,EAAY,GAAyC,CACzD,OAAQ,EAAR,CACE,IAAK,QACL,IAAK,WACL,IAAK,UACH,OAAOC,EAAAA,WAAW,MACpB,IAAK,QACH,OAAOA,EAAAA,WAAW,IACpB,QACE,OAAOA,EAAAA,WAAW,OAIlB,EAAgB,GAAkC,CACtD,GAAI,EAAc,IAAI,OAAS,UAAW,OAE1C,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAGvC,EAAQ,IAAI,IAClB,IAAK,IAAM,KAAU,EAAwB,CAC3C,IAAM,EAAM,EAAM,IAAI,EAAO,cAAc,EAAI,EAAE,CAC7C,EAAO,OAAS,UAAS,EAAI,MAAQ,E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CAErC,IACF,EAAqB,MAAME,EAAAA,uBACzB,EACA,EACA,CACE,uBAA0B,EAAO,kBAAkB,CACnD,sBAAyB,EAAO,iBAAiB,CACjD,QAAU,GAAM,EAAO,eAAe,EAAE,CACzC,CACF,CACE,KAAM,GACLH,EAAAA,0BAA0B,EAAc,EAAc,CACvD,CACA,KAAM,GAAiBC,EAAAA,mBAAmB,EAAa,CAAC,EAG7D,IAAM,EAAyB,KAAK,KAAK,CAOzC,OAJA,EAAO,QAAQ,CAEf,EAAa,EAAc,CAEpB,CACL,oBACA,qBACA,qBACA,KAAM,CACJ,kBAAmB,EAAwB,EAC3C,mBAAoB,EAAyB,EAC7C,mBAAoB,EAAyB,EAC9C,CACF"}
1
+ {"version":3,"file":"loadDictionaries.cjs","names":["DictionariesLogger","ANSIColors","filterInvalidDictionaries","formatDictionaries","loadContentDeclarations","loadRemoteDictionaries"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { formatDictionaries } from '../formatDictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const status of loadDictionariesStatus) {\n const rec = byKey.get(status.dictionaryKey) ?? {};\n if (status.type === 'local') rec.local = status.status;\n if (status.type === 'remote') rec.remote = status.status;\n byKey.set(status.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n pluginDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const pluginsWithLoadDictionaries = (plugins ?? []).filter(\n (plugin) => plugin.loadDictionaries\n );\n\n const loadPluginDictionariesPromise = pluginsWithLoadDictionaries.map(\n async (plugin) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n\n return (res as Dictionary[] | undefined) ?? [];\n } catch (error) {\n logger.setPluginError(error as Error);\n\n return [];\n }\n }\n );\n\n const pluginDictionaries: Dictionary[] = await Promise.all(\n loadPluginDictionariesPromise as Promise<Dictionary[]>[]\n )\n .then((dictionaries) => dictionaries.flat())\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n logger.setPluginTotal(pluginDictionaries.length);\n logger.setPluginDone(pluginDictionaries.length);\n\n const pluginDictionariesTime = Date.now();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n const localDictionariesTime = Date.now();\n\n const localDictionariesStatus = localDictionaries.map(\n (dictionary) =>\n ({\n dictionaryKey: dictionary.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n }\n\n const remoteDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - pluginDictionariesTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n pluginDictionaries: pluginDictionariesTime - loadDictionariesStartTime,\n },\n };\n};\n"],"mappings":"6VA6BI,EAA+C,EAAE,CACrD,MAAM,EAAS,IAAIA,EA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,EAC7C,mBAAoB,EAAyB,EAC9C,CACF"}
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`@intlayer/config/client`),n=require(`@intlayer/config/built`);n=e.__toESM(n);var r=class{statuses=[];spinnerTimer=null;spinnerIndex=0;renderedLines=0;spinnerFrames=t.spinnerFrames;isFinished=!1;prefix;lastRenderedState=``;remoteCheckInProgress=!1;expectRemote=!1;remoteError;pluginTotal=0;pluginDone=0;pluginError;constructor(){this.prefix=(0,t.getPrefix)(n.default?.log?.prefix)??``}setExpectRemote(e){this.expectRemote=e}startRemoteCheck(){this.isFinished||(this.remoteCheckInProgress=!0,this.startSpinner(),this.render())}stopRemoteCheck(){this.remoteCheckInProgress=!1}update(e){if(this.isFinished)return;for(let t of e){let e=this.statuses.findIndex(e=>e.dictionaryKey===t.dictionaryKey&&e.type===t.type);e>=0?this.statuses[e]=t:this.statuses.push(t)}let{remoteTotal:t}=this.computeProgress();this.expectRemote&&!this.remoteCheckInProgress&&t===0||(this.startSpinner(),this.render())}finish(){this.isFinished=!0,this.stopSpinner(),this.render()}startSpinner(){this.spinnerTimer||this.isFinished||(this.spinnerTimer=setInterval(()=>{this.spinnerIndex=(this.spinnerIndex+1)%this.spinnerFrames.length,this.render()},100))}stopSpinner(){this.spinnerTimer&&=(clearInterval(this.spinnerTimer),null)}setRemoteError=e=>{this.remoteError=(0,t.extractErrorMessage)(e),this.stopRemoteCheck(),this.render()};setPluginTotal(e){this.isFinished||(this.pluginTotal=e,e>0&&this.startSpinner(),this.render())}setPluginDone(e){this.isFinished||(this.pluginDone=e,this.render())}setPluginError(e){this.isFinished||(this.pluginError=(0,t.extractErrorMessage)(e),this.render())}render(){let{localTotal:e,localDone:n,remoteTotal:r,remoteDone:i,pluginTotal:a,pluginDone:o}=this.computeProgress(),s=this.spinnerFrames[this.spinnerIndex],c=(0,t.colorize)(s,t.ANSIColors.BLUE),l=[],u=n===e,d=i===r,f=o===a;this.expectRemote&&this.remoteCheckInProgress&&r===0||(u?l.push(`${this.prefix} ${t.v} Local content: ${(0,t.colorize)(`${n}`,t.ANSIColors.GREEN)}${(0,t.colorize)(`/${e}`,t.ANSIColors.GREY)}`):l.push(`${this.prefix} ${c} Local content: ${(0,t.colorize)(`${n}`,t.ANSIColors.BLUE)}${(0,t.colorize)(`/${e}`,t.ANSIColors.GREY)}`)),(r>0||this.remoteCheckInProgress||this.remoteError)&&(this.remoteError?l.push(`${this.prefix} ${t.x} Remote content: ${(0,t.colorize)(this.remoteError,t.ANSIColors.RED)}`):r===0?l.push(`${this.prefix} ${c} Remote content: ${(0,t.colorize)(`Check server`,t.ANSIColors.BLUE)}`):d?l.push(`${this.prefix} ${t.v} Remote content: ${(0,t.colorize)(`${i}`,t.ANSIColors.GREEN)}${(0,t.colorize)(`/${r}`,t.ANSIColors.GREY)}`):l.push(`${this.prefix} ${c} Remote content: ${(0,t.colorize)(`${i}`,t.ANSIColors.BLUE)}${(0,t.colorize)(`/${r}`,t.ANSIColors.GREY)}`)),(a>0||this.pluginError)&&(this.pluginError?l.push(`${this.prefix} ${t.x} Plugin content: ${(0,t.colorize)(this.pluginError,t.ANSIColors.RED)}`):f?l.push(`${this.prefix} ${t.v} Plugin content: ${(0,t.colorize)(`${o}`,t.ANSIColors.GREEN)}${(0,t.colorize)(`/${a}`,t.ANSIColors.GREY)}`):l.push(`${this.prefix} ${c} Plugin content: ${(0,t.colorize)(`${o}`,t.ANSIColors.BLUE)}${(0,t.colorize)(`/${a}`,t.ANSIColors.GREY)}`));let p=l.join(`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`@intlayer/config/logger`),n=require(`@intlayer/config/utils`),r=require(`@intlayer/config/built`);r=e.__toESM(r);var i=class{statuses=[];spinnerTimer=null;spinnerIndex=0;renderedLines=0;spinnerFrames=t.spinnerFrames;isFinished=!1;prefix;lastRenderedState=``;remoteCheckInProgress=!1;expectRemote=!1;remoteError;pluginTotal=0;pluginDone=0;pluginError;constructor(){this.prefix=(0,t.getPrefix)(r.default?.log?.prefix)??``}setExpectRemote(e){this.expectRemote=e}startRemoteCheck(){this.isFinished||(this.remoteCheckInProgress=!0,this.startSpinner(),this.render())}stopRemoteCheck(){this.remoteCheckInProgress=!1}update(e){if(this.isFinished)return;for(let t of e){let e=this.statuses.findIndex(e=>e.dictionaryKey===t.dictionaryKey&&e.type===t.type);e>=0?this.statuses[e]=t:this.statuses.push(t)}let{remoteTotal:t}=this.computeProgress();this.expectRemote&&!this.remoteCheckInProgress&&t===0||(this.startSpinner(),this.render())}finish(){this.isFinished=!0,this.stopSpinner(),this.render()}startSpinner(){this.spinnerTimer||this.isFinished||(this.spinnerTimer=setInterval(()=>{this.spinnerIndex=(this.spinnerIndex+1)%this.spinnerFrames.length,this.render()},100))}stopSpinner(){this.spinnerTimer&&=(clearInterval(this.spinnerTimer),null)}setRemoteError=e=>{this.remoteError=(0,n.extractErrorMessage)(e),this.stopRemoteCheck(),this.render()};setPluginTotal(e){this.isFinished||(this.pluginTotal=e,e>0&&this.startSpinner(),this.render())}setPluginDone(e){this.isFinished||(this.pluginDone=e,this.render())}setPluginError(e){this.isFinished||(this.pluginError=(0,n.extractErrorMessage)(e),this.render())}render(){let{localTotal:e,localDone:n,remoteTotal:r,remoteDone:i,pluginTotal:a,pluginDone:o}=this.computeProgress(),s=this.spinnerFrames[this.spinnerIndex],c=(0,t.colorize)(s,t.ANSIColors.BLUE),l=[],u=n===e,d=i===r,f=o===a;this.expectRemote&&this.remoteCheckInProgress&&r===0||(u?l.push(`${this.prefix} ${t.v} Local content: ${(0,t.colorize)(`${n}`,t.ANSIColors.GREEN)}${(0,t.colorize)(`/${e}`,t.ANSIColors.GREY)}`):l.push(`${this.prefix} ${c} Local content: ${(0,t.colorize)(`${n}`,t.ANSIColors.BLUE)}${(0,t.colorize)(`/${e}`,t.ANSIColors.GREY)}`)),(r>0||this.remoteCheckInProgress||this.remoteError)&&(this.remoteError?l.push(`${this.prefix} ${t.x} Remote content: ${(0,t.colorize)(this.remoteError,t.ANSIColors.RED)}`):r===0?l.push(`${this.prefix} ${c} Remote content: ${(0,t.colorize)(`Check server`,t.ANSIColors.BLUE)}`):d?l.push(`${this.prefix} ${t.v} Remote content: ${(0,t.colorize)(`${i}`,t.ANSIColors.GREEN)}${(0,t.colorize)(`/${r}`,t.ANSIColors.GREY)}`):l.push(`${this.prefix} ${c} Remote content: ${(0,t.colorize)(`${i}`,t.ANSIColors.BLUE)}${(0,t.colorize)(`/${r}`,t.ANSIColors.GREY)}`)),(a>0||this.pluginError)&&(this.pluginError?l.push(`${this.prefix} ${t.x} Plugin content: ${(0,t.colorize)(this.pluginError,t.ANSIColors.RED)}`):f?l.push(`${this.prefix} ${t.v} Plugin content: ${(0,t.colorize)(`${o}`,t.ANSIColors.GREEN)}${(0,t.colorize)(`/${a}`,t.ANSIColors.GREY)}`):l.push(`${this.prefix} ${c} Plugin content: ${(0,t.colorize)(`${o}`,t.ANSIColors.BLUE)}${(0,t.colorize)(`/${a}`,t.ANSIColors.GREY)}`));let p=l.join(`
2
2
  `);if(p===this.lastRenderedState)return;this.lastRenderedState=p,this.renderedLines>0&&process.stdout.write(`\x1b[${this.renderedLines}F`);let m=Math.max(this.renderedLines,l.length);for(let e=0;e<m;e++){process.stdout.write(`\x1B[2K`);let t=l[e];t!==void 0&&process.stdout.write(t),process.stdout.write(`
3
- `)}this.renderedLines=l.length}computeProgress(){let e=new Set(this.statuses.filter(e=>e.type===`local`).map(e=>e.dictionaryKey)),t=new Set(this.statuses.filter(e=>e.type===`local`&&(e.status===`built`||e.status===`error`)).map(e=>e.dictionaryKey)),n=new Set(this.statuses.filter(e=>e.type===`remote`).map(e=>e.dictionaryKey)),r=new Set(this.statuses.filter(e=>e.type===`remote`&&(e.status===`fetched`||e.status===`imported`||e.status===`error`)).map(e=>e.dictionaryKey));return{localTotal:e.size,localDone:t.size,remoteTotal:n.size,remoteDone:r.size,pluginTotal:this.pluginTotal,pluginDone:this.pluginDone}}};exports.DictionariesLogger=r;
3
+ `)}this.renderedLines=l.length}computeProgress(){let e=new Set(this.statuses.filter(e=>e.type===`local`).map(e=>e.dictionaryKey)),t=new Set(this.statuses.filter(e=>e.type===`local`&&(e.status===`built`||e.status===`error`)).map(e=>e.dictionaryKey)),n=new Set(this.statuses.filter(e=>e.type===`remote`).map(e=>e.dictionaryKey)),r=new Set(this.statuses.filter(e=>e.type===`remote`&&(e.status===`fetched`||e.status===`imported`||e.status===`error`)).map(e=>e.dictionaryKey));return{localTotal:e.size,localDone:t.size,remoteTotal:n.size,remoteDone:r.size,pluginTotal:this.pluginTotal,pluginDone:this.pluginDone}}};exports.DictionariesLogger=i;
4
4
  //# sourceMappingURL=log.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.cjs","names":["spinnerFrames","configuration","ANSIColors","v","x"],"sources":["../../../src/loadDictionaries/log.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n ANSIColors,\n colorize,\n extractErrorMessage,\n getPrefix,\n spinnerFrames,\n v,\n x,\n} from '@intlayer/config/client';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport class DictionariesLogger {\n private statuses: DictionariesStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n private remoteCheckInProgress = false;\n private expectRemote = false;\n private remoteError: string | undefined;\n private pluginTotal = 0;\n private pluginDone = 0;\n private pluginError: string | undefined;\n\n constructor() {\n this.prefix = getPrefix(configuration?.log?.prefix) ?? '';\n }\n\n setExpectRemote(expect: boolean) {\n this.expectRemote = expect;\n }\n\n startRemoteCheck() {\n if (this.isFinished) return;\n this.remoteCheckInProgress = true;\n this.startSpinner();\n this.render();\n }\n\n stopRemoteCheck() {\n this.remoteCheckInProgress = false;\n }\n\n update(newStatuses: DictionariesStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) =>\n s.dictionaryKey === status.dictionaryKey && s.type === status.type\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n // If we expect remote fetch later, avoid rendering a local-only line first\n const { remoteTotal } = this.computeProgress();\n if (this.expectRemote && !this.remoteCheckInProgress && remoteTotal === 0) {\n // Do not start spinner or render yet; wait until remote check starts\n return;\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n // Render final state and keep it visible\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n public setRemoteError = (error?: Error) => {\n this.remoteError = extractErrorMessage(error);\n // Avoid rendering a transient remote-only line while the remote check flag is still true\n // Ensure local + remote are rendered together after a failure\n this.stopRemoteCheck();\n this.render();\n };\n\n setPluginTotal(total: number) {\n if (this.isFinished) return;\n this.pluginTotal = total;\n if (total > 0) {\n this.startSpinner();\n }\n this.render();\n }\n\n setPluginDone(done: number) {\n if (this.isFinished) return;\n this.pluginDone = done;\n this.render();\n }\n\n setPluginError(error?: Error) {\n if (this.isFinished) return;\n this.pluginError = extractErrorMessage(error);\n this.render();\n }\n\n private render() {\n const {\n localTotal,\n localDone,\n remoteTotal,\n remoteDone,\n pluginTotal,\n pluginDone,\n } = this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const clock = colorize(frame, ANSIColors.BLUE);\n const lines: string[] = [];\n\n const isLocalDone = localDone === localTotal;\n const isRemoteDone = remoteDone === remoteTotal;\n const isPluginDone = pluginDone === pluginTotal;\n\n const suppressLocalWhileCheckingRemote =\n this.expectRemote && this.remoteCheckInProgress && remoteTotal === 0;\n\n if (!suppressLocalWhileCheckingRemote) {\n if (isLocalDone) {\n lines.push(\n `${this.prefix} ${v} Local content: ${colorize(`${localDone}`, ANSIColors.GREEN)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Local content: ${colorize(`${localDone}`, ANSIColors.BLUE)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Single remote line: show error, check, or progress counts\n if (remoteTotal > 0 || this.remoteCheckInProgress || this.remoteError) {\n if (this.remoteError) {\n lines.push(\n `${this.prefix} ${x} Remote content: ${colorize(\n this.remoteError,\n ANSIColors.RED\n )}`\n );\n } else if (remoteTotal === 0) {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize('Check server', ANSIColors.BLUE)}`\n );\n } else if (isRemoteDone) {\n lines.push(\n `${this.prefix} ${v} Remote content: ${colorize(`${remoteDone}`, ANSIColors.GREEN)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize(`${remoteDone}`, ANSIColors.BLUE)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Plugin line: show error or progress counts\n if (pluginTotal > 0 || this.pluginError) {\n if (this.pluginError) {\n lines.push(\n `${this.prefix} ${x} Plugin content: ${colorize(\n this.pluginError,\n ANSIColors.RED\n )}`\n );\n } else if (isPluginDone) {\n lines.push(\n `${this.prefix} ${v} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.GREEN)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.BLUE)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Check if the state has changed to avoid duplicate rendering\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const localKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'local')\n .map((s) => s.dictionaryKey)\n );\n\n const localDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'local' && (s.status === 'built' || s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n const remoteKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'remote')\n .map((s) => s.dictionaryKey)\n );\n\n const remoteDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'remote' &&\n (s.status === 'fetched' ||\n s.status === 'imported' ||\n s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n return {\n localTotal: localKeys.size,\n localDone: localDoneKeys.size,\n remoteTotal: remoteKeys.size,\n remoteDone: remoteDoneKeys.size,\n pluginTotal: this.pluginTotal,\n pluginDone: this.pluginDone,\n } as const;\n }\n}\n"],"mappings":"oNAYA,IAAa,EAAb,KAAgC,CAC9B,SAAyC,EAAE,CAC3C,aAA8C,KAC9C,aAAuB,EACvB,cAAwB,EACxB,cAAiCA,EAAAA,cACjC,WAAqB,GACrB,OACA,kBAAoC,GACpC,sBAAgC,GAChC,aAAuB,GACvB,YACA,YAAsB,EACtB,WAAqB,EACrB,YAEA,aAAc,CACZ,KAAK,QAAA,EAAA,EAAA,WAAmBC,EAAAA,SAAe,KAAK,OAAO,EAAI,GAGzD,gBAAgB,EAAiB,CAC/B,KAAK,aAAe,EAGtB,kBAAmB,CACb,KAAK,aACT,KAAK,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ACC,EAAE,OAAS,WACV,EAAE,SAAW,WACZ,EAAE,SAAW,YACb,EAAE,SAAW,SAClB,CACA,IAAK,GAAM,EAAE,cAAc,CAC/B,CAED,MAAO,CACL,WAAY,EAAU,KACtB,UAAW,EAAc,KACzB,YAAa,EAAW,KACxB,WAAY,EAAe,KAC3B,YAAa,KAAK,YAClB,WAAY,KAAK,WAClB"}
1
+ {"version":3,"file":"log.cjs","names":["spinnerFrames","configuration","ANSIColors","v","x"],"sources":["../../../src/loadDictionaries/log.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n ANSIColors,\n colorize,\n getPrefix,\n spinnerFrames,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { extractErrorMessage } from '@intlayer/config/utils';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport class DictionariesLogger {\n private statuses: DictionariesStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n private remoteCheckInProgress = false;\n private expectRemote = false;\n private remoteError: string | undefined;\n private pluginTotal = 0;\n private pluginDone = 0;\n private pluginError: string | undefined;\n\n constructor() {\n this.prefix = getPrefix(configuration?.log?.prefix) ?? '';\n }\n\n setExpectRemote(expect: boolean) {\n this.expectRemote = expect;\n }\n\n startRemoteCheck() {\n if (this.isFinished) return;\n this.remoteCheckInProgress = true;\n this.startSpinner();\n this.render();\n }\n\n stopRemoteCheck() {\n this.remoteCheckInProgress = false;\n }\n\n update(newStatuses: DictionariesStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) =>\n s.dictionaryKey === status.dictionaryKey && s.type === status.type\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n // If we expect remote fetch later, avoid rendering a local-only line first\n const { remoteTotal } = this.computeProgress();\n if (this.expectRemote && !this.remoteCheckInProgress && remoteTotal === 0) {\n // Do not start spinner or render yet; wait until remote check starts\n return;\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n // Render final state and keep it visible\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n public setRemoteError = (error?: Error) => {\n this.remoteError = extractErrorMessage(error);\n // Avoid rendering a transient remote-only line while the remote check flag is still true\n // Ensure local + remote are rendered together after a failure\n this.stopRemoteCheck();\n this.render();\n };\n\n setPluginTotal(total: number) {\n if (this.isFinished) return;\n this.pluginTotal = total;\n if (total > 0) {\n this.startSpinner();\n }\n this.render();\n }\n\n setPluginDone(done: number) {\n if (this.isFinished) return;\n this.pluginDone = done;\n this.render();\n }\n\n setPluginError(error?: Error) {\n if (this.isFinished) return;\n this.pluginError = extractErrorMessage(error);\n this.render();\n }\n\n private render() {\n const {\n localTotal,\n localDone,\n remoteTotal,\n remoteDone,\n pluginTotal,\n pluginDone,\n } = this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const clock = colorize(frame, ANSIColors.BLUE);\n const lines: string[] = [];\n\n const isLocalDone = localDone === localTotal;\n const isRemoteDone = remoteDone === remoteTotal;\n const isPluginDone = pluginDone === pluginTotal;\n\n const suppressLocalWhileCheckingRemote =\n this.expectRemote && this.remoteCheckInProgress && remoteTotal === 0;\n\n if (!suppressLocalWhileCheckingRemote) {\n if (isLocalDone) {\n lines.push(\n `${this.prefix} ${v} Local content: ${colorize(`${localDone}`, ANSIColors.GREEN)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Local content: ${colorize(`${localDone}`, ANSIColors.BLUE)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Single remote line: show error, check, or progress counts\n if (remoteTotal > 0 || this.remoteCheckInProgress || this.remoteError) {\n if (this.remoteError) {\n lines.push(\n `${this.prefix} ${x} Remote content: ${colorize(\n this.remoteError,\n ANSIColors.RED\n )}`\n );\n } else if (remoteTotal === 0) {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize('Check server', ANSIColors.BLUE)}`\n );\n } else if (isRemoteDone) {\n lines.push(\n `${this.prefix} ${v} Remote content: ${colorize(`${remoteDone}`, ANSIColors.GREEN)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize(`${remoteDone}`, ANSIColors.BLUE)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Plugin line: show error or progress counts\n if (pluginTotal > 0 || this.pluginError) {\n if (this.pluginError) {\n lines.push(\n `${this.prefix} ${x} Plugin content: ${colorize(\n this.pluginError,\n ANSIColors.RED\n )}`\n );\n } else if (isPluginDone) {\n lines.push(\n `${this.prefix} ${v} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.GREEN)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.BLUE)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Check if the state has changed to avoid duplicate rendering\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const localKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'local')\n .map((s) => s.dictionaryKey)\n );\n\n const localDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'local' && (s.status === 'built' || s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n const remoteKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'remote')\n .map((s) => s.dictionaryKey)\n );\n\n const remoteDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'remote' &&\n (s.status === 'fetched' ||\n s.status === 'imported' ||\n s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n return {\n localTotal: localKeys.size,\n localDone: localDoneKeys.size,\n remoteTotal: remoteKeys.size,\n remoteDone: remoteDoneKeys.size,\n pluginTotal: this.pluginTotal,\n pluginDone: this.pluginDone,\n } as const;\n }\n}\n"],"mappings":"wPAYA,IAAa,EAAb,KAAgC,CAC9B,SAAyC,EAAE,CAC3C,aAA8C,KAC9C,aAAuB,EACvB,cAAwB,EACxB,cAAiCA,EAAAA,cACjC,WAAqB,GACrB,OACA,kBAAoC,GACpC,sBAAgC,GAChC,aAAuB,GACvB,YACA,YAAsB,EACtB,WAAqB,EACrB,YAEA,aAAc,CACZ,KAAK,QAAA,EAAA,EAAA,WAAmBC,EAAAA,SAAe,KAAK,OAAO,EAAI,GAGzD,gBAAgB,EAAiB,CAC/B,KAAK,aAAe,EAGtB,kBAAmB,CACb,KAAK,aACT,KAAK,sBAAwB,GAC7B,KAAK,cAAc,CACnB,KAAK,QAAQ,EAGf,iBAAkB,CAChB,KAAK,sBAAwB,GAG/B,OAAO,EAAmC,CACxC,GAAI,KAAK,WAAY,OACrB,IAAK,IAAM,KAAU,EAAa,CAChC,IAAM,EAAQ,KAAK,SAAS,UACzB,GACC,EAAE,gBAAkB,EAAO,eAAiB,EAAE,OAAS,EAAO,KACjE,CACG,GAAS,EACX,KAA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(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`node:path`),t=require(`@intlayer/config`);const n=async(n,r)=>{let i=(0,t.getAppLogger)(r),a=n.filter(t=>{let n=(0,e.extname)(t);return[`.ts`,`.tsx`,`.js`,`.jsx`,`.cjs`,`.mjs`,`.json`].includes(n)});if(a.length===0)return;let o;try{o=(await import(`typescript`)).default||await import(`typescript`)}catch{return}let s=o.findConfigFile(r.content?.baseDir??process.cwd(),o.sys.fileExists,`tsconfig.json`),c={noEmit:!0,allowJs:!0,resolveJsonModule:!0};if(s){let t=o.sys.readFile(s);if(t){let n=o.parseConfigFileTextToJson(s,t);if(!n.error){let{incremental:t,tsBuildInfoFile:r,...i}=o.parseJsonConfigFileContent(n.config,o.sys,(0,e.dirname)(s)).options;c={...c,...i,noEmit:!0}}}}let l=o.createProgram(a,c);a.forEach(e=>{let t=l.getSourceFile(e);t&&o.getPreEmitDiagnostics(l,t).forEach(e=>{let t=o.flattenDiagnosticMessageText(e.messageText,`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`node:path`),t=require(`@intlayer/config/logger`);const n=async(n,r)=>{let i=(0,t.getAppLogger)(r),a=n.filter(t=>{let n=(0,e.extname)(t);return[`.ts`,`.tsx`,`.js`,`.jsx`,`.cjs`,`.mjs`,`.json`].includes(n)});if(a.length===0)return;let o;try{o=(await import(`typescript`)).default||await import(`typescript`)}catch{return}let s=o.findConfigFile(r.content?.baseDir??process.cwd(),o.sys.fileExists,`tsconfig.json`),c={noEmit:!0,allowJs:!0,resolveJsonModule:!0};if(s){let t=o.sys.readFile(s);if(t){let n=o.parseConfigFileTextToJson(s,t);if(!n.error){let{incremental:t,tsBuildInfoFile:r,...i}=o.parseJsonConfigFileContent(n.config,o.sys,(0,e.dirname)(s)).options;c={...c,...i,noEmit:!0}}}}let l=o.createProgram(a,c);a.forEach(e=>{let t=l.getSourceFile(e);t&&o.getPreEmitDiagnostics(l,t).forEach(e=>{let t=o.flattenDiagnosticMessageText(e.messageText,`
2
2
  `);if(e.file&&e.start!==void 0){let{line:n,character:r}=e.file.getLineAndCharacterOfPosition(e.start);i(`TS Error in ${e.file.fileName} (${n+1},${r+1}): ${t}`,{level:`warn`})}})})};exports.logTypeScriptErrors=n;
3
3
  //# sourceMappingURL=logTypeScriptErrors.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logTypeScriptErrors.cjs","names":[],"sources":["../../../src/loadDictionaries/logTypeScriptErrors.ts"],"sourcesContent":["import { dirname, extname } from 'node:path';\n\nimport { getAppLogger } from '@intlayer/config';\n\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const logTypeScriptErrors = async (\n filePaths: string[],\n\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n\n const filesToCheck = filePaths.filter((path) => {\n const ext = extname(path);\n\n return ['.ts', '.tsx', '.js', '.jsx', '.cjs', '.mjs', '.json'].includes(\n ext\n );\n });\n\n if (filesToCheck.length === 0) return;\n\n let ts: typeof import('typescript');\n\n try {\n ts = (await import('typescript')).default || (await import('typescript'));\n } catch {\n // TypeScript not installed, skip type checking\n\n return;\n }\n\n const configFileName = ts.findConfigFile(\n configuration.content?.baseDir ?? process.cwd(),\n\n ts.sys.fileExists,\n\n 'tsconfig.json'\n );\n\n let compilerOptions: any = {\n noEmit: true,\n\n allowJs: true,\n\n resolveJsonModule: true,\n };\n\n if (configFileName) {\n const configFileText = ts.sys.readFile(configFileName);\n\n if (configFileText) {\n const configJson = ts.parseConfigFileTextToJson(\n configFileName,\n\n configFileText\n );\n\n if (!configJson.error) {\n const parsedConfig = ts.parseJsonConfigFileContent(\n configJson.config,\n\n ts.sys,\n\n dirname(configFileName)\n );\n\n const { incremental, tsBuildInfoFile, ...restOptions } =\n parsedConfig.options;\n\n compilerOptions = { ...compilerOptions, ...restOptions, noEmit: true };\n }\n }\n }\n\n const program = ts.createProgram(filesToCheck, compilerOptions);\n\n filesToCheck.forEach((filePath) => {\n const sourceFile = program.getSourceFile(filePath);\n\n if (!sourceFile) return;\n\n const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);\n\n diagnostics.forEach((diagnostic) => {\n const message = ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n\n '\\n'\n );\n\n if (diagnostic.file && diagnostic.start !== undefined) {\n const { line, character } =\n diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n\n appLogger(\n `TS Error in ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`,\n\n { level: 'warn' }\n );\n }\n });\n });\n};\n"],"mappings":"yKAMA,MAAa,EAAsB,MACjC,EAEA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAEvC,EAAe,EAAU,OAAQ,GAAS,CAC9C,IAAM,GAAA,EAAA,EAAA,SAAc,EAAK,CAEzB,MAAO,CAAC,MAAO,OAAQ,MAAO,OAAQ,OAAQ,OAAQ,QAAQ,CAAC,SAC7D,EACD,EACD,CAEF,GAAI,EAAa,SAAW,EAAG,OAE/B,IAAI,EAEJ,GAAI,CACF,GAAM,MAAM,OAAO,eAAe,SAAY,MAAM,OAAO,mBACrD,CAGN,OAGF,IAAM,EAAiB,EAAG,eACxB,EAAc,SAAS,SAAW,QAAQ,KAAK,CAE/C,EAAG,IAAI,WAEP,gBACD,CAEG,EAAuB,CACzB,OAAQ,GAER,QAAS,GAET,kBAAmB,GACpB,CAED,GAAI,EAAgB,CAClB,IAAM,EAAiB,EAAG,IAAI,SAAS,EAAe,CAEtD,GAAI,EAAgB,CAClB,IAAM,EAAa,EAAG,0BACpB,EAEA,EACD,CAED,GAAI,CAAC,EAAW,MAAO,CASrB,GAAM,CAAE,cAAa,kBAAiB,GAAG,GARpB,EAAG,2BACtB,EAAW,OAEX,EAAG,KAAA,EAAA,EAAA,SAEK,EAAe,CACxB,CAGc,QAEf,EAAkB,CAAE,GAAG,EAAiB,GAAG,EAAa,OAAQ,GAAM,GAK5E,IAAM,EAAU,EAAG,cAAc,EAAc,EAAgB,CAE/D,EAAa,QAAS,GAAa,CACjC,IAAM,EAAa,EAAQ,cAAc,EAAS,CAE7C,GAEe,EAAG,sBAAsB,EAAS,EAAW,CAErD,QAAS,GAAe,CAClC,IAAM,EAAU,EAAG,6BACjB,EAAW,YAEX;EACD,CAED,GAAI,EAAW,MAAQ,EAAW,QAAU,IAAA,GAAW,CACrD,GAAM,CAAE,OAAM,aACZ,EAAW,KAAK,8BAA8B,EAAW,MAAM,CAEjE,EACE,eAAe,EAAW,KAAK,SAAS,IAAI,EAAO,EAAE,GAAG,EAAY,EAAE,KAAK,IAE3E,CAAE,MAAO,OAAQ,CAClB,GAEH,EACF"}
1
+ {"version":3,"file":"logTypeScriptErrors.cjs","names":[],"sources":["../../../src/loadDictionaries/logTypeScriptErrors.ts"],"sourcesContent":["import { dirname, extname } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const logTypeScriptErrors = async (\n filePaths: string[],\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n\n const filesToCheck = filePaths.filter((path) => {\n const ext = extname(path);\n\n return ['.ts', '.tsx', '.js', '.jsx', '.cjs', '.mjs', '.json'].includes(\n ext\n );\n });\n\n if (filesToCheck.length === 0) return;\n\n let ts: typeof import('typescript');\n\n try {\n ts = (await import('typescript')).default || (await import('typescript'));\n } catch {\n // TypeScript not installed, skip type checking\n\n return;\n }\n\n const configFileName = ts.findConfigFile(\n configuration.content?.baseDir ?? process.cwd(),\n ts.sys.fileExists,\n 'tsconfig.json'\n );\n\n let compilerOptions: any = {\n noEmit: true,\n\n allowJs: true,\n\n resolveJsonModule: true,\n };\n\n if (configFileName) {\n const configFileText = ts.sys.readFile(configFileName);\n\n if (configFileText) {\n const configJson = ts.parseConfigFileTextToJson(\n configFileName,\n\n configFileText\n );\n\n if (!configJson.error) {\n const parsedConfig = ts.parseJsonConfigFileContent(\n configJson.config,\n\n ts.sys,\n\n dirname(configFileName)\n );\n\n const { incremental, tsBuildInfoFile, ...restOptions } =\n parsedConfig.options;\n\n compilerOptions = { ...compilerOptions, ...restOptions, noEmit: true };\n }\n }\n }\n\n const program = ts.createProgram(filesToCheck, compilerOptions);\n\n filesToCheck.forEach((filePath) => {\n const sourceFile = program.getSourceFile(filePath);\n\n if (!sourceFile) return;\n\n const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);\n\n diagnostics.forEach((diagnostic) => {\n const message = ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n\n '\\n'\n );\n\n if (diagnostic.file && diagnostic.start !== undefined) {\n const { line, character } =\n diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n\n appLogger(\n `TS Error in ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`,\n\n { level: 'warn' }\n );\n }\n });\n });\n};\n"],"mappings":"gLAIA,MAAa,EAAsB,MACjC,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAEvC,EAAe,EAAU,OAAQ,GAAS,CAC9C,IAAM,GAAA,EAAA,EAAA,SAAc,EAAK,CAEzB,MAAO,CAAC,MAAO,OAAQ,MAAO,OAAQ,OAAQ,OAAQ,QAAQ,CAAC,SAC7D,EACD,EACD,CAEF,GAAI,EAAa,SAAW,EAAG,OAE/B,IAAI,EAEJ,GAAI,CACF,GAAM,MAAM,OAAO,eAAe,SAAY,MAAM,OAAO,mBACrD,CAGN,OAGF,IAAM,EAAiB,EAAG,eACxB,EAAc,SAAS,SAAW,QAAQ,KAAK,CAC/C,EAAG,IAAI,WACP,gBACD,CAEG,EAAuB,CACzB,OAAQ,GAER,QAAS,GAET,kBAAmB,GACpB,CAED,GAAI,EAAgB,CAClB,IAAM,EAAiB,EAAG,IAAI,SAAS,EAAe,CAEtD,GAAI,EAAgB,CAClB,IAAM,EAAa,EAAG,0BACpB,EAEA,EACD,CAED,GAAI,CAAC,EAAW,MAAO,CASrB,GAAM,CAAE,cAAa,kBAAiB,GAAG,GARpB,EAAG,2BACtB,EAAW,OAEX,EAAG,KAAA,EAAA,EAAA,SAEK,EAAe,CACxB,CAGc,QAEf,EAAkB,CAAE,GAAG,EAAiB,GAAG,EAAa,OAAQ,GAAM,GAK5E,IAAM,EAAU,EAAG,cAAc,EAAc,EAAgB,CAE/D,EAAa,QAAS,GAAa,CACjC,IAAM,EAAa,EAAQ,cAAc,EAAS,CAE7C,GAEe,EAAG,sBAAsB,EAAS,EAAW,CAErD,QAAS,GAAe,CAClC,IAAM,EAAU,EAAG,6BACjB,EAAW,YAEX;EACD,CAED,GAAI,EAAW,MAAQ,EAAW,QAAU,IAAA,GAAW,CACrD,GAAM,CAAE,OAAM,aACZ,EAAW,KAAK,8BAA8B,EAAW,MAAM,CAEjE,EACE,eAAe,EAAW,KAAK,SAAS,IAAI,EAAO,EAAE,GAAG,EAAY,EAAE,KAAK,IAE3E,CAAE,MAAO,OAAQ,CAClB,GAEH,EACF"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/formatter.cjs`),t=require(`./utils/runOnce.cjs`);let n=require(`@intlayer/config/node`),r=require(`node:path`),i=require(`@intlayer/config/logger`),a=require(`@intlayer/config/env`);const o=o=>{let{configuration:s,numCustomConfiguration:c,configurationFilePath:l}=(0,n.getConfigurationAndFilePath)(o),u=(0,i.getAppLogger)(s);t.runOnce((0,r.join)(s.content.baseDir,`.intlayer`,`cache`,`intlayer-config-locaded.lock`),()=>{if(c===0)u(`Configuration file not found, using default configuration.`,{isVerbose:!0});else{let t=s.content.baseDir,n=(0,r.relative)(t,l);if(c===1){let t=(0,a.getEnvFilePath)(o?.env,o?.envFile);u(`Configuration loaded ${e.formatPath(n)}${t?` - Env: ${e.formatPath(t)}`:``}`,{isVerbose:!0})}else u(`Multiple configuration files found, using ${e.formatPath(n)}.`,{isVerbose:!0})}},{cacheTimeoutMs:1e3*30})};exports.logConfigDetails=o;
2
+ //# sourceMappingURL=logConfigDetails.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logConfigDetails.cjs","names":["formatPath"],"sources":["../../src/logConfigDetails.ts"],"sourcesContent":["import { join, relative } from 'node:path';\nimport { getEnvFilePath } from '@intlayer/config/env';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfigurationAndFilePath,\n} from '@intlayer/config/node';\nimport { formatPath, runOnce } from './utils';\n\nexport const logConfigDetails = (options?: GetConfigurationOptions) => {\n const { configuration, numCustomConfiguration, configurationFilePath } =\n getConfigurationAndFilePath(options);\n const appLogger = getAppLogger(configuration);\n\n runOnce(\n join(\n configuration.content.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-config-locaded.lock'\n ),\n () => {\n if (numCustomConfiguration === 0) {\n appLogger(\n 'Configuration file not found, using default configuration.',\n {\n isVerbose: true,\n }\n );\n } else {\n const baseDir = configuration.content.baseDir;\n const relativeOutputPath = relative(baseDir, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n const dotEnvFilePath = getEnvFilePath(options?.env, options?.envFile);\n\n appLogger(\n `Configuration loaded ${formatPath(relativeOutputPath)}${dotEnvFilePath ? ` - Env: ${formatPath(dotEnvFilePath)}` : ''}`,\n {\n isVerbose: true,\n }\n );\n } else {\n appLogger(\n `Multiple configuration files found, using ${formatPath(relativeOutputPath)}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n },\n {\n cacheTimeoutMs: 1000 * 30, // 30 seconds\n }\n );\n};\n"],"mappings":"8TASA,MAAa,EAAoB,GAAsC,CACrE,GAAM,CAAE,gBAAe,yBAAwB,0BAAA,EAAA,EAAA,6BACjB,EAAQ,CAChC,GAAA,EAAA,EAAA,cAAyB,EAAc,CAE7C,EAAA,SAAA,EAAA,EAAA,MAEI,EAAc,QAAQ,QACtB,YACA,QACA,+BACD,KACK,CACJ,GAAI,IAA2B,EAC7B,EACE,6DACA,CACE,UAAW,GACZ,CACF,KACI,CACL,IAAM,EAAU,EAAc,QAAQ,QAChC,GAAA,EAAA,EAAA,UAA8B,EAAS,EAAuB,CAEpE,GAAI,IAA2B,EAAG,CAChC,IAAM,GAAA,EAAA,EAAA,gBAAgC,GAAS,IAAK,GAAS,QAAQ,CAErE,EACE,wBAAwBA,EAAAA,WAAW,EAAmB,GAAG,EAAiB,WAAWA,EAAAA,WAAW,EAAe,GAAK,KACpH,CACE,UAAW,GACZ,CACF,MAED,EACE,6CAA6CA,EAAAA,WAAW,EAAmB,CAAC,GAC5E,CACE,UAAW,GACZ,CACF,GAIP,CACE,eAAgB,IAAO,GACxB,CACF"}
@@ -1,2 +1,2 @@
1
- import{autoDecorateContent as e}from"../utils/autoDecorateContent.mjs";import{resolveObjectPromises as t}from"../utils/resolveObjectPromises.mjs";import{logger as n}from"@intlayer/config/client";const r=async(r,i)=>{try{let n=await t(r.content),a=r.contentAutoTransformation??i.dictionary?.contentAutoTransformation??!1,o=a?e(n,a):n;return{...r,content:o}}catch(e){n(e,{level:`error`})}};export{r as processContentDeclaration};
1
+ import{autoDecorateContent as e}from"../utils/autoDecorateContent.mjs";import{resolveObjectPromises as t}from"../utils/resolveObjectPromises.mjs";import{logger as n}from"@intlayer/config/logger";const r=async(r,i)=>{try{let n=await t(r.content),a=r.contentAutoTransformation??i.dictionary?.contentAutoTransformation??!1,o=a?e(n,a):n;return{...r,content:o}}catch(e){n(e,{level:`error`})}};export{r as processContentDeclaration};
2
2
  //# sourceMappingURL=processContentDeclaration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"processContentDeclaration.mjs","names":[],"sources":["../../../src/buildIntlayerDictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { autoDecorateContent } from '../utils/autoDecorateContent';\nimport { resolveObjectPromises } from '../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary,\n configuration: IntlayerConfig\n): Promise<Dictionary | undefined> => {\n try {\n const resolvedContent = (await resolveObjectPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n const isAutoDecorateContentEnabled =\n contentDeclaration.contentAutoTransformation ??\n configuration.dictionary?.contentAutoTransformation ??\n false;\n\n const decoratedContent = isAutoDecorateContentEnabled\n ? autoDecorateContent(resolvedContent, isAutoDecorateContentEnabled)\n : resolvedContent;\n\n return {\n ...contentDeclaration,\n content: decoratedContent,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":"mMAQA,MAAa,EAA4B,MACvC,EACA,IACoC,CACpC,GAAI,CACF,IAAM,EAAmB,MAAM,EAC7B,EAAmB,QACpB,CAEK,EACJ,EAAmB,2BACnB,EAAc,YAAY,2BAC1B,GAEI,EAAmB,EACrB,EAAoB,EAAiB,EAA6B,CAClE,EAEJ,MAAO,CACL,GAAG,EACH,QAAS,EACV,OACM,EAAO,CACd,EAAO,EAAO,CACZ,MAAO,QACR,CAAC"}
1
+ {"version":3,"file":"processContentDeclaration.mjs","names":[],"sources":["../../../src/buildIntlayerDictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/logger';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { autoDecorateContent } from '../utils/autoDecorateContent';\nimport { resolveObjectPromises } from '../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary,\n configuration: IntlayerConfig\n): Promise<Dictionary | undefined> => {\n try {\n const resolvedContent = (await resolveObjectPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n const isAutoDecorateContentEnabled =\n contentDeclaration.contentAutoTransformation ??\n configuration.dictionary?.contentAutoTransformation ??\n false;\n\n const decoratedContent = isAutoDecorateContentEnabled\n ? autoDecorateContent(resolvedContent, isAutoDecorateContentEnabled)\n : resolvedContent;\n\n return {\n ...contentDeclaration,\n content: decoratedContent,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":"mMAQA,MAAa,EAA4B,MACvC,EACA,IACoC,CACpC,GAAI,CACF,IAAM,EAAmB,MAAM,EAC7B,EAAmB,QACpB,CAEK,EACJ,EAAmB,2BACnB,EAAc,YAAY,2BAC1B,GAEI,EAAmB,EACrB,EAAoB,EAAiB,EAA6B,CAClE,EAEJ,MAAO,CACL,GAAG,EACH,QAAS,EACV,OACM,EAAO,CACd,EAAO,EAAO,CACZ,MAAO,QACR,CAAC"}
@@ -1,2 +1,2 @@
1
- import{getAppLogger as e}from"@intlayer/config/client";import{rm as t}from"node:fs/promises";import{existsSync as n}from"node:fs";const r=async r=>{let{dictionariesDir:i,unmergedDictionariesDir:a,dynamicDictionariesDir:o,remoteDictionariesDir:s,fetchDictionariesDir:c,mainDir:l,typesDir:u,configDir:d,cacheDir:f}=r.system,p=e(r),m=[i,a,o,s,c,l,u,d,f];await Promise.all(m.filter(e=>n(e)).map(e=>t(e,{recursive:!0,force:!0}))),p(`Output directory cleaned`,{isVerbose:!0})};export{r as cleanOutputDir};
1
+ import{rm as e}from"node:fs/promises";import{getAppLogger as t}from"@intlayer/config/logger";import{existsSync as n}from"node:fs";const r=async r=>{let{dictionariesDir:i,unmergedDictionariesDir:a,dynamicDictionariesDir:o,remoteDictionariesDir:s,fetchDictionariesDir:c,mainDir:l,typesDir:u,configDir:d,cacheDir:f}=r.system,p=t(r),m=[i,a,o,s,c,l,u,d,f];await Promise.all(m.filter(e=>n(e)).map(t=>e(t,{recursive:!0,force:!0}))),p(`Output directory cleaned`,{isVerbose:!0})};export{r as cleanOutputDir};
2
2
  //# sourceMappingURL=cleanOutputDir.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanOutputDir.mjs","names":[],"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { rm } from 'node:fs/promises';\nimport { getAppLogger } from '@intlayer/config/client';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const cleanOutputDir = async (configuration: IntlayerConfig) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n remoteDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n cacheDir,\n } = configuration.system;\n\n const appLogger = getAppLogger(configuration);\n\n const directoriesToClean: string[] = [\n dictionariesDir, // Merged dictionaries\n unmergedDictionariesDir, // Unmerged dictionaries\n dynamicDictionariesDir, // Dynamic dictionaries\n remoteDictionariesDir, // Remote dictionaries\n fetchDictionariesDir, // Fetch dictionaries\n mainDir, // Main files\n typesDir, // Types\n configDir, // Configuration\n cacheDir, // Cache\n ];\n\n // Execute all deletions in parallel\n await Promise.all(\n directoriesToClean\n .filter((dir) => existsSync(dir))\n .map((dir) => rm(dir, { recursive: true, force: true }))\n );\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":"kIAKA,MAAa,EAAiB,KAAO,IAAkC,CACrE,GAAM,CACJ,kBACA,0BACA,yBACA,wBACA,uBACA,UACA,WACA,YACA,YACE,EAAc,OAEZ,EAAY,EAAa,EAAc,CAEvC,EAA+B,CACnC,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACD,CAGD,MAAM,QAAQ,IACZ,EACG,OAAQ,GAAQ,EAAW,EAAI,CAAC,CAChC,IAAK,GAAQ,EAAG,EAAK,CAAE,UAAW,GAAM,MAAO,GAAM,CAAC,CAAC,CAC3D,CAED,EAAU,2BAA4B,CACpC,UAAW,GACZ,CAAC"}
1
+ {"version":3,"file":"cleanOutputDir.mjs","names":[],"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { rm } from 'node:fs/promises';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const cleanOutputDir = async (configuration: IntlayerConfig) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n remoteDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n cacheDir,\n } = configuration.system;\n\n const appLogger = getAppLogger(configuration);\n\n const directoriesToClean: string[] = [\n dictionariesDir, // Merged dictionaries\n unmergedDictionariesDir, // Unmerged dictionaries\n dynamicDictionariesDir, // Dynamic dictionaries\n remoteDictionariesDir, // Remote dictionaries\n fetchDictionariesDir, // Fetch dictionaries\n mainDir, // Main files\n typesDir, // Types\n configDir, // Configuration\n cacheDir, // Cache\n ];\n\n // Execute all deletions in parallel\n await Promise.all(\n directoriesToClean\n .filter((dir) => existsSync(dir))\n .map((dir) => rm(dir, { recursive: true, force: true }))\n );\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":"kIAKA,MAAa,EAAiB,KAAO,IAAkC,CACrE,GAAM,CACJ,kBACA,0BACA,yBACA,wBACA,uBACA,UACA,WACA,YACA,YACE,EAAc,OAEZ,EAAY,EAAa,EAAc,CAEvC,EAA+B,CACnC,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACD,CAGD,MAAM,QAAQ,IACZ,EACG,OAAQ,GAAQ,EAAW,EAAI,CAAC,CAChC,IAAK,GAAQ,EAAG,EAAK,CAAE,UAAW,GAAM,MAAO,GAAM,CAAC,CAAC,CAC3D,CAED,EAAU,2BAA4B,CACpC,UAAW,GACZ,CAAC"}
@@ -1,2 +1,2 @@
1
- import{writeJsonIfChanged as e}from"./writeJsonIfChanged.mjs";import{createDictionaryEntryPoint as t}from"./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";import{colorizeKey as n,colorizePath as r,getAppLogger as i,normalizePath as a}from"@intlayer/config/client";import{getUnmergedDictionaries as o}from"@intlayer/unmerged-dictionaries-entry";import{readFile as s,rm as c}from"node:fs/promises";import{join as l,normalize as u,relative as d}from"node:path";import f from"fast-glob";import{getDictionaries as p}from"@intlayer/dictionaries-entry";const m=async(m,h,g)=>{let _=i(g),v=o(g),y=g.content.baseDir,b=d(y,m),x=Object.values(v).flat().filter(e=>e.filePath===b&&!h.includes(e.key)).filter((e,t,n)=>t===n.findIndex(t=>t.key===e.key)),S=[],C=[],w=[];await Promise.all(x.map(async t=>{let r=u(l(g.system.unmergedDictionariesDir,`${t.key}.json`));try{let i=await s(r,`utf8`),a=JSON.parse(i);a.length===1?a[0].filePath===b&&(_(`Removing outdated dictionary ${n(t.key)}`,{isVerbose:!0}),C.push(r),w.push(t.key)):(await e(r,a.filter(e=>e.filePath!==b)),S.push(t.localId))}catch(e){e.code===`ENOENT`&&(w.includes(t.key)||w.push(t.key))}}));let T=p(g),E=(Object.values(T)?.filter(e=>!h.includes(e.key)&&e.localIds?.length===1&&e.localIds[0].endsWith(`::local::${b}`))).filter((e,t,n)=>t===n.findIndex(t=>t.key===e.key));return await Promise.all(E.map(async t=>{let r=u(l(g.system.dictionariesDir,`${t.key}.json`));try{let i=await s(r,`utf8`),o=JSON.parse(i);if(o.localIds?.length===1){if(o.localIds[0].endsWith(`::local::${b}`)){_(`Removing outdated unmerged dictionary ${n(t.key)}`,{isVerbose:!0}),C.push(r);let e=u(l(g.system.typesDir,`${t.key}.ts`));C.push(e);let i=await f(a(l(g.system.dynamicDictionariesDir,`${t.key}.*`)),{absolute:!0});C.push(...i),w.includes(t.key)||w.push(t.key)}}else{let t=o.localIds?.filter(e=>!e.endsWith(`::local::${b}`));await e(r,{...o,localIds:t})}}catch(e){if(e.code===`ENOENT`){w.includes(t.key)||w.push(t.key);let e=u(l(g.system.typesDir,`${t.key}.ts`));C.push(e)}}})),(C.length>0||w.length>0)&&(await t(g,{excludeKeys:w}),C.length>0&&await Promise.all(C.map(async e=>{let t=d(y,e);try{await c(e,{force:!0}),_(`Deleted artifact: ${r(t)}`,{isVerbose:!0})}catch{_(`Error while removing file ${r(t)}`,{isVerbose:!0})}}))),{changedDictionariesLocalIds:S,excludeKeys:w,hasRebuilt:C.length>0||w.length>0}};export{m as cleanRemovedContentDeclaration};
1
+ import{writeJsonIfChanged as e}from"./writeJsonIfChanged.mjs";import{createDictionaryEntryPoint as t}from"./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";import{normalizePath as n}from"@intlayer/config/client";import{getUnmergedDictionaries as r}from"@intlayer/unmerged-dictionaries-entry";import{readFile as i,rm as a}from"node:fs/promises";import{join as o,normalize as s,relative as c}from"node:path";import{colorizeKey as l,colorizePath as u,getAppLogger as d}from"@intlayer/config/logger";import f from"fast-glob";import{getDictionaries as p}from"@intlayer/dictionaries-entry";const m=async(m,h,g)=>{let _=d(g),v=r(g),y=g.content.baseDir,b=c(y,m),x=Object.values(v).flat().filter(e=>e.filePath===b&&!h.includes(e.key)).filter((e,t,n)=>t===n.findIndex(t=>t.key===e.key)),S=[],C=[],w=[];await Promise.all(x.map(async t=>{let n=s(o(g.system.unmergedDictionariesDir,`${t.key}.json`));try{let r=await i(n,`utf8`),a=JSON.parse(r);a.length===1?a[0].filePath===b&&(_(`Removing outdated dictionary ${l(t.key)}`,{isVerbose:!0}),C.push(n),w.push(t.key)):(await e(n,a.filter(e=>e.filePath!==b)),S.push(t.localId))}catch(e){e.code===`ENOENT`&&(w.includes(t.key)||w.push(t.key))}}));let T=p(g),E=(Object.values(T)?.filter(e=>!h.includes(e.key)&&e.localIds?.length===1&&e.localIds[0].endsWith(`::local::${b}`))).filter((e,t,n)=>t===n.findIndex(t=>t.key===e.key));return await Promise.all(E.map(async t=>{let r=s(o(g.system.dictionariesDir,`${t.key}.json`));try{let a=await i(r,`utf8`),c=JSON.parse(a);if(c.localIds?.length===1){if(c.localIds[0].endsWith(`::local::${b}`)){_(`Removing outdated unmerged dictionary ${l(t.key)}`,{isVerbose:!0}),C.push(r);let e=s(o(g.system.typesDir,`${t.key}.ts`));C.push(e);let i=await f(n(o(g.system.dynamicDictionariesDir,`${t.key}.*`)),{absolute:!0});C.push(...i),w.includes(t.key)||w.push(t.key)}}else{let t=c.localIds?.filter(e=>!e.endsWith(`::local::${b}`));await e(r,{...c,localIds:t})}}catch(e){if(e.code===`ENOENT`){w.includes(t.key)||w.push(t.key);let e=s(o(g.system.typesDir,`${t.key}.ts`));C.push(e)}}})),(C.length>0||w.length>0)&&(await t(g,{excludeKeys:w}),C.length>0&&await Promise.all(C.map(async e=>{let t=c(y,e);try{await a(e,{force:!0}),_(`Deleted artifact: ${u(t)}`,{isVerbose:!0})}catch{_(`Error while removing file ${u(t)}`,{isVerbose:!0})}}))),{changedDictionariesLocalIds:S,excludeKeys:w,hasRebuilt:C.length>0||w.length>0}};export{m as cleanRemovedContentDeclaration};
2
2
  //# sourceMappingURL=cleanRemovedContentDeclaration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanRemovedContentDeclaration.mjs","names":[],"sources":["../../src/cleanRemovedContentDeclaration.ts"],"sourcesContent":["import { readFile, rm } from 'node:fs/promises';\nimport { join, normalize, relative } from 'node:path';\nimport {\n colorizeKey,\n colorizePath,\n getAppLogger,\n normalizePath,\n} from '@intlayer/config/client';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport fg from 'fast-glob';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint';\nimport { writeJsonIfChanged } from './writeJsonIfChanged';\n\nexport const cleanRemovedContentDeclaration = async (\n filePath: string,\n keysToKeep: string[],\n configuration: IntlayerConfig\n): Promise<{\n changedDictionariesLocalIds: string[];\n excludeKeys: string[];\n hasRebuilt: boolean;\n}> => {\n const appLogger = getAppLogger(configuration);\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n const baseDir = configuration.content.baseDir;\n\n const relativeFilePath = relative(baseDir, filePath);\n const flatUnmergedDictionaries = Object.values(unmergedDictionaries).flat();\n\n const filteredUnmergedDictionaries = flatUnmergedDictionaries.filter(\n (dictionary) =>\n dictionary.filePath === relativeFilePath &&\n !keysToKeep.includes(dictionary.key)\n );\n\n // Deduplicate dictionaries by key\n const uniqueUnmergedDictionaries = filteredUnmergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n const changedDictionariesLocalIds: string[] = [];\n const filesToRemove: string[] = [];\n const excludeKeys: string[] = [];\n\n // Identify Unmerged Dictionaries to remove or clean\n await Promise.all(\n uniqueUnmergedDictionaries.map(async (dictionary) => {\n const unmergedFilePath = normalize(\n join(\n configuration.system.unmergedDictionariesDir,\n `${dictionary.key}.json`\n )\n );\n\n try {\n const jsonContent = await readFile(unmergedFilePath, 'utf8');\n const parsedContent = JSON.parse(jsonContent);\n\n if (parsedContent.length === 1) {\n if (parsedContent[0].filePath === relativeFilePath) {\n appLogger(\n `Removing outdated dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n filesToRemove.push(unmergedFilePath);\n excludeKeys.push(dictionary.key);\n }\n } else {\n const filteredContent = parsedContent.filter(\n (content: any) => content.filePath !== relativeFilePath\n );\n await writeJsonIfChanged(unmergedFilePath, filteredContent);\n changedDictionariesLocalIds.push(dictionary.localId!);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n }\n })\n );\n\n const dictionaries = getDictionaries(configuration);\n const flatDictionaries = Object.values(dictionaries) as Dictionary[];\n\n const filteredMergedDictionaries = flatDictionaries?.filter(\n (dictionary) =>\n !keysToKeep.includes(dictionary.key) &&\n dictionary.localIds?.length === 1 &&\n (dictionary.localIds[0] as string).endsWith(\n `::local::${relativeFilePath}`\n )\n );\n\n const uniqueMergedDictionaries = filteredMergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n // Identify Merged Dictionaries, Types, and Dynamic Dictionaries to remove\n await Promise.all(\n uniqueMergedDictionaries.map(async (dictionary) => {\n const mergedFilePath = normalize(\n join(configuration.system.dictionariesDir, `${dictionary.key}.json`)\n );\n\n try {\n const fileContent = await readFile(mergedFilePath, 'utf8');\n const parsedContent = JSON.parse(fileContent) as Dictionary;\n\n if (parsedContent.localIds?.length === 1) {\n if (\n parsedContent.localIds[0].endsWith(`::local::${relativeFilePath}`)\n ) {\n appLogger(\n `Removing outdated unmerged dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n\n // Mark JSON for removal\n filesToRemove.push(mergedFilePath);\n\n // Mark TS Types for removal\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n\n // Mark Dynamic Dictionaries for removal\n // We use glob to catch the loader files (.cjs, .mjs) AND the split locale files (.en.json, etc.)\n const dynamicFilesGlob = join(\n configuration.system.dynamicDictionariesDir,\n `${dictionary.key}.*`\n );\n const dynamicFiles = await fg(normalizePath(dynamicFilesGlob), {\n absolute: true,\n });\n filesToRemove.push(...dynamicFiles);\n\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n } else {\n const localIds = parsedContent.localIds?.filter(\n (localeId) => !localeId.endsWith(`::local::${relativeFilePath}`)\n ) as string[];\n const newContent = { ...parsedContent, localIds };\n await writeJsonIfChanged(mergedFilePath, newContent);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n }\n }\n })\n );\n\n // Execute Cleanup\n if (filesToRemove.length > 0 || excludeKeys.length > 0) {\n // Update entry points (indexes) first so the app doesn't import dead files\n await createDictionaryEntryPoint(configuration, { excludeKeys });\n\n // Remove the files synchronously (awaited) immediately after.\n if (filesToRemove.length > 0) {\n await Promise.all(\n filesToRemove.map(async (path) => {\n const relativePath = relative(baseDir, path);\n try {\n await rm(path, { force: true });\n\n appLogger(`Deleted artifact: ${colorizePath(relativePath)}`, {\n isVerbose: true,\n });\n } catch {\n appLogger(\n `Error while removing file ${colorizePath(relativePath)}`,\n {\n isVerbose: true,\n }\n );\n }\n })\n );\n }\n }\n\n return {\n changedDictionariesLocalIds,\n excludeKeys,\n hasRebuilt: filesToRemove.length > 0 || excludeKeys.length > 0,\n };\n};\n"],"mappings":"8iBAeA,MAAa,EAAiC,MAC5C,EACA,EACA,IAKI,CACJ,IAAM,EAAY,EAAa,EAAc,CAEvC,EAAuB,EAAwB,EAAc,CAE7D,EAAU,EAAc,QAAQ,QAEhC,EAAmB,EAAS,EAAS,EAAS,CAU9C,EAT2B,OAAO,OAAO,EAAqB,CAAC,MAAM,CAEb,OAC3D,GACC,EAAW,WAAa,GACxB,CAAC,EAAW,SAAS,EAAW,IAAI,CACvC,CAG+D,QAC7D,EAAY,EAAO,IAClB,IAAU,EAAK,UAAW,GAAM,EAAE,MAAQ,EAAW,IAAI,CAC5D,CAEK,EAAwC,EAAE,CAC1C,EAA0B,EAAE,CAC5B,EAAwB,EAAE,CAGhC,MAAM,QAAQ,IACZ,EAA2B,IAAI,KAAO,IAAe,CACnD,IAAM,EAAmB,EACvB,EACE,EAAc,OAAO,wBACrB,GAAG,EAAW,IAAI,OACnB,CACF,CAED,GAAI,CACF,IAAM,EAAc,MAAM,EAAS,EAAkB,OAAO,CACtD,EAAgB,KAAK,MAAM,EAAY,CAEzC,EAAc,SAAW,EACvB,EAAc,GAAG,WAAa,IAChC,EACE,gCAAgC,EAAY,EAAW,IAAI,GAC3D,CAAE,UAAW,GAAM,CACpB,CACD,EAAc,KAAK,EAAiB,CACpC,EAAY,KAAK,EAAW,IAAI,GAMlC,MAAM,EAAmB,EAHD,EAAc,OACnC,GAAiB,EAAQ,WAAa,EACxC,CAC0D,CAC3D,EAA4B,KAAK,EAAW,QAAS,QAEhD,EAAY,CACf,EAAM,OAAS,WACZ,EAAY,SAAS,EAAW,IA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W,IAAI,EACvC,EAAY,KAAK,EAAW,IAAI,CAElC,IAAM,EAAgB,EACpB,EAAK,EAAc,OAAO,SAAU,GAAG,EAAW,IAAI,KAAK,CAC5D,CACD,EAAc,KAAK,EAAc,IAGrC,CACH,EAGG,EAAc,OAAS,GAAK,EAAY,OAAS,KAEnD,MAAM,EAA2B,EAAe,CAAE,cAAa,CAAC,CAG5D,EAAc,OAAS,GACzB,MAAM,QAAQ,IACZ,EAAc,IAAI,KAAO,IAAS,CAChC,IAAM,EAAe,EAAS,EAAS,EAAK,CAC5C,GAAI,CACF,MAAM,EAAG,EAAM,CAAE,MAAO,GAAM,CAAC,CAE/B,EAAU,qBAAqB,EAAa,EAAa,GAAI,CAC3D,UAAW,GACZ,CAAC,MACI,CACN,EACE,6BAA6B,EAAa,EAAa,GACvD,CACE,UAAW,GACZ,CACF,GAEH,CACH,EAIE,CACL,8BACA,cACA,WAAY,EAAc,OAAS,GAAK,EAAY,OAAS,EAC9D"}
1
+ {"version":3,"file":"cleanRemovedContentDeclaration.mjs","names":[],"sources":["../../src/cleanRemovedContentDeclaration.ts"],"sourcesContent":["import { readFile, rm } from 'node:fs/promises';\nimport { join, normalize, relative } from 'node:path';\nimport { normalizePath } from '@intlayer/config/client';\nimport {\n colorizeKey,\n colorizePath,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport fg from 'fast-glob';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint';\nimport { writeJsonIfChanged } from './writeJsonIfChanged';\n\nexport const cleanRemovedContentDeclaration = async (\n filePath: string,\n keysToKeep: string[],\n configuration: IntlayerConfig\n): Promise<{\n changedDictionariesLocalIds: string[];\n excludeKeys: string[];\n hasRebuilt: boolean;\n}> => {\n const appLogger = getAppLogger(configuration);\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n const baseDir = configuration.content.baseDir;\n\n const relativeFilePath = relative(baseDir, filePath);\n const flatUnmergedDictionaries = Object.values(unmergedDictionaries).flat();\n\n const filteredUnmergedDictionaries = flatUnmergedDictionaries.filter(\n (dictionary) =>\n dictionary.filePath === relativeFilePath &&\n !keysToKeep.includes(dictionary.key)\n );\n\n // Deduplicate dictionaries by key\n const uniqueUnmergedDictionaries = filteredUnmergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n const changedDictionariesLocalIds: string[] = [];\n const filesToRemove: string[] = [];\n const excludeKeys: string[] = [];\n\n // Identify Unmerged Dictionaries to remove or clean\n await Promise.all(\n uniqueUnmergedDictionaries.map(async (dictionary) => {\n const unmergedFilePath = normalize(\n join(\n configuration.system.unmergedDictionariesDir,\n `${dictionary.key}.json`\n )\n );\n\n try {\n const jsonContent = await readFile(unmergedFilePath, 'utf8');\n const parsedContent = JSON.parse(jsonContent);\n\n if (parsedContent.length === 1) {\n if (parsedContent[0].filePath === relativeFilePath) {\n appLogger(\n `Removing outdated dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n filesToRemove.push(unmergedFilePath);\n excludeKeys.push(dictionary.key);\n }\n } else {\n const filteredContent = parsedContent.filter(\n (content: any) => content.filePath !== relativeFilePath\n );\n await writeJsonIfChanged(unmergedFilePath, filteredContent);\n changedDictionariesLocalIds.push(dictionary.localId!);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n }\n })\n );\n\n const dictionaries = getDictionaries(configuration);\n const flatDictionaries = Object.values(dictionaries) as Dictionary[];\n\n const filteredMergedDictionaries = flatDictionaries?.filter(\n (dictionary) =>\n !keysToKeep.includes(dictionary.key) &&\n dictionary.localIds?.length === 1 &&\n (dictionary.localIds[0] as string).endsWith(\n `::local::${relativeFilePath}`\n )\n );\n\n const uniqueMergedDictionaries = filteredMergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n // Identify Merged Dictionaries, Types, and Dynamic Dictionaries to remove\n await Promise.all(\n uniqueMergedDictionaries.map(async (dictionary) => {\n const mergedFilePath = normalize(\n join(configuration.system.dictionariesDir, `${dictionary.key}.json`)\n );\n\n try {\n const fileContent = await readFile(mergedFilePath, 'utf8');\n const parsedContent = JSON.parse(fileContent) as Dictionary;\n\n if (parsedContent.localIds?.length === 1) {\n if (\n parsedContent.localIds[0].endsWith(`::local::${relativeFilePath}`)\n ) {\n appLogger(\n `Removing outdated unmerged dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n\n // Mark JSON for removal\n filesToRemove.push(mergedFilePath);\n\n // Mark TS Types for removal\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n\n // Mark Dynamic Dictionaries for removal\n // We use glob to catch the loader files (.cjs, .mjs) AND the split locale files (.en.json, etc.)\n const dynamicFilesGlob = join(\n configuration.system.dynamicDictionariesDir,\n `${dictionary.key}.*`\n );\n const dynamicFiles = await fg(normalizePath(dynamicFilesGlob), {\n absolute: true,\n });\n filesToRemove.push(...dynamicFiles);\n\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n } else {\n const localIds = parsedContent.localIds?.filter(\n (localeId) => !localeId.endsWith(`::local::${relativeFilePath}`)\n ) as string[];\n const newContent = { ...parsedContent, localIds };\n await writeJsonIfChanged(mergedFilePath, newContent);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n }\n }\n })\n );\n\n // Execute Cleanup\n if (filesToRemove.length > 0 || excludeKeys.length > 0) {\n // Update entry points (indexes) first so the app doesn't import dead files\n await createDictionaryEntryPoint(configuration, { excludeKeys });\n\n // Remove the files synchronously (awaited) immediately after.\n if (filesToRemove.length > 0) {\n await Promise.all(\n filesToRemove.map(async (path) => {\n const relativePath = relative(baseDir, path);\n try {\n await rm(path, { force: true });\n\n appLogger(`Deleted artifact: ${colorizePath(relativePath)}`, {\n isVerbose: true,\n });\n } catch {\n appLogger(\n `Error while removing file ${colorizePath(relativePath)}`,\n {\n isVerbose: true,\n }\n );\n }\n })\n );\n }\n }\n\n return {\n changedDictionariesLocalIds,\n excludeKeys,\n hasRebuilt: filesToRemove.length > 0 || excludeKeys.length > 0,\n };\n};\n"],"mappings":"mlBAeA,MAAa,EAAiC,MAC5C,EACA,EACA,IAKI,CACJ,IAAM,EAAY,EAAa,EAAc,CAEvC,EAAuB,EAAwB,EAAc,CAE7D,EAAU,EAAc,QAAQ,QAEhC,EAAmB,EAAS,EAAS,EAAS,CAU9C,EAT2B,OAAO,OAAO,EAAqB,CAAC,MAAM,CAEb,OAC3D,GACC,EAAW,WAAa,GACxB,CAAC,EAAW,SAAS,EAAW,IAAI,CACvC,CAG+D,QAC7D,EAAY,EAAO,IAClB,IAAU,EAAK,UAAW,GAAM,EAAE,MAAQ,EAAW,IAAI,CAC5D,CAEK,EAAwC,EAAE,CAC1C,EAA0B,EAAE,CAC5B,EAAwB,EAAE,CAGhC,MAAM,QAAQ,IACZ,EAA2B,IAAI,KAAO,IAAe,CACnD,IAAM,EAAmB,EACvB,EACE,EAAc,OAAO,wBACrB,GAAG,EAAW,IAAI,OACnB,CACF,CAED,GAAI,CACF,IAAM,EAAc,MAAM,EAAS,EAAkB,OAAO,CACtD,EAAgB,KAAK,MAAM,EAAY,CAEzC,EAAc,SAAW,EACvB,EAAc,GAAG,WAAa,IAChC,EACE,gCAAgC,EAAY,EAAW,IAAI,GAC3D,CAAE,UAAW,GAAM,CACpB,CACD,EAAc,KAAK,EAAiB,CACpC,EAAY,KAAK,EAAW,IAAI,GAMlC,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CAAC,EAAS,SAAS,YAAY,IAAmB,CACjE,CAED,MAAM,EAAmB,EADN,CAAE,GAAG,EAAe,WAAU,CACG,QAE/C,EAAY,CACnB,GAAI,EAAM,OAAS,SAAU,CACtB,EAAY,SAAS,EAAW,IAAI,EACvC,EAAY,KAAK,EAAW,IAAI,CAElC,IAAM,EAAgB,EACpB,EAAK,EAAc,OAAO,SAAU,GAAG,EAAW,IAAI,KAAK,CAC5D,CACD,EAAc,KAAK,EAAc,IAGrC,CACH,EAGG,EAAc,OAAS,GAAK,EAAY,OAAS,KAEnD,MAAM,EAA2B,EAAe,CAAE,cAAa,CAAC,CAG5D,EAAc,OAAS,GACzB,MAAM,QAAQ,IACZ,EAAc,IAAI,KAAO,IAAS,CAChC,IAAM,EAAe,EAAS,EAAS,EAAK,CAC5C,GAAI,CACF,MAAM,EAAG,EAAM,CAAE,MAAO,GAAM,CAAC,CAE/B,EAAU,qBAAqB,EAAa,EAAa,GAAI,CAC3D,UAAW,GACZ,CAAC,MACI,CACN,EACE,6BAA6B,EAAa,EAAa,GACvD,CACE,UAAW,GACZ,CACF,GAEH,CACH,EAIE,CACL,8BACA,cACA,WAAY,EAAc,OAAS,GAAK,EAAY,OAAS,EAC9D"}
package/dist/esm/cli.mjs CHANGED
@@ -1 +1 @@
1
- import{listDictionaries as e,listDictionariesWithStats as t}from"./listDictionariesPath.mjs";import{detectExportedComponentName as n}from"./writeContentDeclaration/detectExportedComponentName.mjs";import{transformJSFile as r}from"./writeContentDeclaration/transformJSFile.mjs";import{detectFormatCommand as i}from"./detectFormatCommand.mjs";import{getContentDeclarationFileTemplate as a}from"./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs";import{writeJSFile as o}from"./writeContentDeclaration/writeJSFile.mjs";import{writeContentDeclaration as s}from"./writeContentDeclaration/writeContentDeclaration.mjs";import{initIntlayer as c}from"./init/index.mjs";import{PLATFORMS as l,PLATFORMS_METADATA as u,SKILLS as d,SKILLS_METADATA as f,getInitialSkills as p,installSkills as m}from"./installSkills/index.mjs";import{installMCP as h}from"./installMCP/installMCP.mjs";import{listGitFiles as g,listGitLines as _}from"./listGitFiles.mjs";import{listProjects as v}from"./listProjects.mjs";export{l as PLATFORMS,u as PLATFORMS_METADATA,d as SKILLS,f as SKILLS_METADATA,n as detectExportedComponentName,i as detectFormatCommand,a as getContentDeclarationFileTemplate,p as getInitialSkills,c as initIntlayer,h as installMCP,m as installSkills,e as listDictionaries,t as listDictionariesWithStats,g as listGitFiles,_ as listGitLines,v as listProjects,r as transformJSFile,s as writeContentDeclaration,o as writeJSFile};
1
+ import{listDictionaries as e,listDictionariesWithStats as t}from"./listDictionariesPath.mjs";import{detectExportedComponentName as n}from"./writeContentDeclaration/detectExportedComponentName.mjs";import{transformJSFile as r}from"./writeContentDeclaration/transformJSFile.mjs";import{detectFormatCommand as i}from"./detectFormatCommand.mjs";import{getContentDeclarationFileTemplate as a}from"./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs";import{writeJSFile as o}from"./writeContentDeclaration/writeJSFile.mjs";import{writeContentDeclaration as s}from"./writeContentDeclaration/writeContentDeclaration.mjs";import{initIntlayer as c}from"./init/index.mjs";import{PLATFORMS as l,PLATFORMS_METADATA as u,SKILLS as d,SKILLS_METADATA as f,getInitialSkills as p,installSkills as m}from"./installSkills/index.mjs";import{installMCP as h}from"./installMCP/installMCP.mjs";import{listGitFiles as g,listGitLines as _}from"./listGitFiles.mjs";import{listProjects as v}from"./listProjects.mjs";import{logConfigDetails as y}from"./logConfigDetails.mjs";export{l as PLATFORMS,u as PLATFORMS_METADATA,d as SKILLS,f as SKILLS_METADATA,n as detectExportedComponentName,i as detectFormatCommand,a as getContentDeclarationFileTemplate,p as getInitialSkills,c as initIntlayer,h as installMCP,m as installSkills,e as listDictionaries,t as listDictionariesWithStats,g as listGitFiles,_ as listGitLines,v as listProjects,y as logConfigDetails,r as transformJSFile,s as writeContentDeclaration,o as writeJSFile};
@@ -1,2 +1,2 @@
1
- import{formatLocale as e,formatPath as t}from"./utils/formatter.mjs";import{ANSIColors as n,colorize as r,colorizeKey as i,colorizePath as a,getAppLogger as o,x as s}from"@intlayer/config/client";import{getContent as c}from"@intlayer/core/interpreter";const l=(l,u,d)=>{let f=o(u);if(!l)return!1;let p=l.location===`local`||typeof l.filePath==`string`?`Local`:`Remote`,m=!!l.key,h=!!l.content;if(!m)return f(`${p} dictionary has no key`,{level:`error`}),!1;if(!h)return f(`${p} dictionary ${i(l.key)} has no content - ${l.filePath?t(l.filePath):a(`Remote`)}`,{level:`error`}),!1;if(l.schema&&d?.checkSchema&&!(typeof l.content==`function`||typeof l.content==`object`&&l.content!==null&&typeof l.content.then==`function`)){let o=u?.internationalization?.locales??[],d=u?.internationalization.strictMode===`strict`,m=typeof l.schema==`string`?u?.schemas?.[l.schema]:void 0;if(m&&typeof m.safeParse==`function`)for(let u of o){let o=c(l.content,{dictionaryKey:l.key,keyPath:[]},u,!d),h=m.safeParse(o);if(!h.success)return f(`${p} dictionary ${i(l.key)} has invalid content according to schema ${r(l.schema,n.ORANGE)} for locale ${e(u)} - ${l.filePath?t(l.filePath):a(`Remote`)}`,{level:`error`}),h.error.issues.forEach(t=>{f(`${s} Error: ${i(l.key)} - ${e(u)} - ${r(`${t.path.join(`.`)}:`,n.BLUE)} ${r(t.message,n.GREY)}`,{level:`error`})}),!1}}return!0},u=(e,t,n)=>(e??[])?.filter(e=>l(e,t,n));export{u as filterInvalidDictionaries,l as isInvalidDictionary};
1
+ import{formatLocale as e,formatPath as t}from"./utils/formatter.mjs";import{ANSIColors as n,colorize as r,colorizeKey as i,colorizePath as a,getAppLogger as o,x as s}from"@intlayer/config/logger";import{getContent as c}from"@intlayer/core/interpreter";const l=(l,u,d)=>{let f=o(u);if(!l)return!1;let p=l.location===`local`||typeof l.filePath==`string`?`Local`:`Remote`,m=!!l.key,h=!!l.content;if(!m)return f(`${p} dictionary has no key`,{level:`error`}),!1;if(!h)return f(`${p} dictionary ${i(l.key)} has no content - ${l.filePath?t(l.filePath):a(`Remote`)}`,{level:`error`}),!1;if(l.schema&&d?.checkSchema&&!(typeof l.content==`function`||typeof l.content==`object`&&l.content!==null&&typeof l.content.then==`function`)){let o=u?.internationalization?.locales??[],d=u?.internationalization.strictMode===`strict`,m=typeof l.schema==`string`?u?.schemas?.[l.schema]:void 0;if(m&&typeof m.safeParse==`function`)for(let u of o){let o=c(l.content,{dictionaryKey:l.key,keyPath:[]},u,!d),h=m.safeParse(o);if(!h.success)return f(`${p} dictionary ${i(l.key)} has invalid content according to schema ${r(l.schema,n.ORANGE)} for locale ${e(u)} - ${l.filePath?t(l.filePath):a(`Remote`)}`,{level:`error`}),h.error.issues.forEach(t=>{f(`${s} Error: ${i(l.key)} - ${e(u)} - ${r(`${t.path.join(`.`)}:`,n.BLUE)} ${r(t.message,n.GREY)}`,{level:`error`})}),!1}}return!0},u=(e,t,n)=>(e??[])?.filter(e=>l(e,t,n));export{u as filterInvalidDictionaries,l as isInvalidDictionary};
2
2
  //# sourceMappingURL=filterInvalidDictionaries.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterInvalidDictionaries.mjs","names":[],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/client';\nimport { getContent } from '@intlayer/core/interpreter';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n },\n locale,\n !isStrict\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":"4PAcA,MAAa,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AAE,UAAU,EAAY,EAAW,IAAI,CAAC,KAAK,EAAa,EAAO,CAAC,KAAK,EAAS,GAAG,EAAM,KAAK,KAAK,IAAI,CAAC,GAAI,EAAW,KAAK,CAAC,GAAG,EAAS,EAAM,QAAS,EAAW,KAAK,GAC3K,CACE,MAAO,QACR,CACF,EACD,CAEK,IAOjB,MAAO,IAGI,GACX,EACA,EACA,KAEC,GAAgB,EAAE,GAAG,OAAQ,GAC5B,EAAoB,EAAY,EAAe,EAAQ,CACxD"}
1
+ {"version":3,"file":"filterInvalidDictionaries.mjs","names":[],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getContent } from '@intlayer/core/interpreter';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n },\n locale,\n !isStrict\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":"4PAcA,MAAa,GACX,EACA,EACA,IACY,CACZ,IAAM,EAAY,EAAa,EAAc,CAE7C,GAAI,CAAC,EAAY,MAAO,GAKxB,IAAM,EAFJ,EAAW,WAAa,SAAW,OAAO,EAAW,UAAa,SAEzC,QAAU,SAC/B,EAAS,EAAQ,EAAW,IAC5B,EAAa,EAAQ,EAAW,QAEtC,GAAI,CAAC,EAKH,OAJA,EAAU,GAAG,EAAS,wBAAyB,CAC7C,MAAO,QACR,CAAC,CAEK,GAGT,GAAI,CAAC,EAOH,OANA,EACE,GAAG,EAAS,cAAc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as e}from"../_virtual/_rolldown/runtime.mjs";import{readFile as t}from"node:fs/promises";import{join as n}from"node:path";import{configESMxCJSRequire as r,getProjectRequire as i,isESModule as a}from"@intlayer/config/utils";import{bundleFile as o}from"@intlayer/config/file";import{builtinModules as s,createRequire as c}from"node:module";const l=(e,t)=>({name:`rewrite-paths`,setup(n){n.onResolve({filter:/.*/},n=>{let r=e[n.path];if(t?.includes(n.path))return null;if(r)return{path:r,namespace:`intlayer-replace-modules`,external:!0};for(let t of Object.keys(e))if(n.path===t||n.path.startsWith(`${t}/`)){let r=n.path.slice(t.length);return{path:e[t]+r,namespace:`intlayer-replace-modules`,external:!0}}})}}),u=async u=>{let d=i(u.content.baseDir),f=r,p=a?c(import.meta.url):e,m=n(u.system.configDir,`configuration.json`),h={defu:f.resolve(`defu`),esbuild:f.resolve(`esbuild`),"@intlayer/config/built":m,"@intlayer/config/utils":p.resolve(`@intlayer/config/utils`),"@intlayer/config/client":p.resolve(`@intlayer/config/client`),"@intlayer/core/file":p.resolve(`@intlayer/core/file`)},g=d.resolve(`intlayer`);return await o(await t(g,`utf-8`),g,{external:[...s,...s.map(e=>`node:${e}`)],minify:!0,plugins:[l(h)]})??``};export{u as getIntlayerBundle};
1
+ import{__require as e}from"../_virtual/_rolldown/runtime.mjs";import{readFile as t}from"node:fs/promises";import{join as n}from"node:path";import{configESMxCJSRequire as r,getProjectRequire as i,isESModule as a}from"@intlayer/config/utils";import{bundleFile as o}from"@intlayer/config/file";import{builtinModules as s,createRequire as c}from"node:module";const l=(e,t)=>({name:`rewrite-paths`,setup(n){n.onResolve({filter:/.*/},n=>{let r=e[n.path];if(t?.includes(n.path))return null;if(r)return{path:r,namespace:`intlayer-replace-modules`,external:!0};for(let t of Object.keys(e))if(n.path===t||n.path.startsWith(`${t}/`)){let r=n.path.slice(t.length);return{path:e[t]+r,namespace:`intlayer-replace-modules`,external:!0}}})}}),u=async u=>{let d=i(u.content.baseDir),f=r,p=a?c(import.meta.url):e,m=n(u.system.configDir,`configuration.json`),h={defu:f.resolve(`defu`),esbuild:f.resolve(`esbuild`),"@intlayer/config/built":m,"@intlayer/config/utils":p.resolve(`@intlayer/config/utils`),"@intlayer/config/client":p.resolve(`@intlayer/config/client`),"@intlayer/config/logger":p.resolve(`@intlayer/config/logger`),"@intlayer/core/file":p.resolve(`@intlayer/core/file`)},g=d.resolve(`intlayer`);return await o(await t(g,`utf-8`),g,{external:[...s,...s.map(e=>`node:${e}`)],minify:!0,plugins:[l(h)]})??``};export{u as getIntlayerBundle};
2
2
  //# sourceMappingURL=getIntlayerBundle.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayerBundle.mjs","names":[],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport { bundleFile, type ESBuildPlugin } from '@intlayer/config/file';\nimport {\n configESMxCJSRequire,\n getProjectRequire,\n isESModule,\n} from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = getProjectRequire(configuration.content.baseDir);\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.system.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n defu: configPackageRequire.resolve('defu'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config/utils': localRequire.resolve('@intlayer/config/utils'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":"mWAmBA,MAAM,GACJ,EACA,KAEO,CACL,KAAM,gBACN,MAAM,EAAO,CACX,EAAM,UAAU,CAAE,OAAQ,KAAM,CAAG,GAAS,CAC1C,IAAM,EAAQ,EAAe,EAAK,MAElC,GAAI,GAAgB,SAAS,EAAK,KAAK,CACrC,OAAO,KAGT,GAAI,EACF,MAAO,CACL,KAAM,EACN,UAAW,2BACX,SAAU,GACX,CAIH,IAAK,IAAM,KAAO,OAAO,KAAK,EAAe,CAC3C,GAAI,EAAK,OAAS,GAAO,EAAK,KAAK,WAAW,GAAG,EAAI,GAAG,CAAE,CACxD,IAAM,EAAM,EAAK,KAAK,MAAM,EAAI,OAAO,CACvC,MAAO,CACL,KAAM,EAAe,GAAO,EAC5B,UAAW,2BACX,SAAU,GACX,GAGL,EAEL,EAMU,EAAoB,KAAO,IAAkC,CACxE,IAAM,EAAc,EAAkB,EAAc,QAAQ,QAAQ,CAC9D,EAAuB,EACvB,EAAe,EAAa,EAAc,OAAO,KAAK,IAAI,CAAA,EAE1D,EAAoB,EACxB,EAAc,OAAO,UACrB,qBACD,CAEK,EAAiB,CACrB,KAAM,EAAqB,QAAQ,OAAO,CAC1C,QAAS,EAAqB,QAAQ,UAAU,CAChD,yBAA0B,EAC1B,yBAA0B,EAAa,QAAQ,yBAAyB,CACxE,0BAA2B,EAAa,QAAQ,0BAA0B,CAC1E,sBAAuB,EAAa,QAAQ,sBAAsB,CACnE,CAEK,EAAW,EAAY,QAAQ,WAAW,CAYhD,OATe,MAAM,EAFR,MAAM,EAAS,EAAU,QAAQ,CAER,EAAU,CAC9C,SAAU,CACR,GAAG,EACH,GAAG,EAAe,IAAK,GAAQ,QAAQ,IAAM,CAC9C,CACD,OAAQ,GACR,QAAS,CAAC,EAAmB,EAAe,CAAC,CAC9C,CAAC,EAEe"}
1
+ {"version":3,"file":"getIntlayerBundle.mjs","names":[],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport { bundleFile, type ESBuildPlugin } from '@intlayer/config/file';\nimport {\n configESMxCJSRequire,\n getProjectRequire,\n isESModule,\n} from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = getProjectRequire(configuration.content.baseDir);\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.system.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n defu: configPackageRequire.resolve('defu'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config/utils': localRequire.resolve('@intlayer/config/utils'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/config/logger': localRequire.resolve('@intlayer/config/logger'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":"mWAmBA,MAAM,GACJ,EACA,KAEO,CACL,KAAM,gBACN,MAAM,EAAO,CACX,EAAM,UAAU,CAAE,OAAQ,KAAM,CAAG,GAAS,CAC1C,IAAM,EAAQ,EAAe,EAAK,MAElC,GAAI,GAAgB,SAAS,EAAK,KAAK,CACrC,OAAO,KAGT,GAAI,EACF,MAAO,CACL,KAAM,EACN,UAAW,2BACX,SAAU,GACX,CAIH,IAAK,IAAM,KAAO,OAAO,KAAK,EAAe,CAC3C,GAAI,EAAK,OAAS,GAAO,EAAK,KAAK,WAAW,GAAG,EAAI,GAAG,CAAE,CACxD,IAAM,EAAM,EAAK,KAAK,MAAM,EAAI,OAAO,CACvC,MAAO,CACL,KAAM,EAAe,GAAO,EAC5B,UAAW,2BACX,SAAU,GACX,GAGL,EAEL,EAMU,EAAoB,KAAO,IAAkC,CACxE,IAAM,EAAc,EAAkB,EAAc,QAAQ,QAAQ,CAC9D,EAAuB,EACvB,EAAe,EAAa,EAAc,OAAO,KAAK,IAAI,CAAA,EAE1D,EAAoB,EACxB,EAAc,OAAO,UACrB,qBACD,CAEK,EAAiB,CACrB,KAAM,EAAqB,QAAQ,OAAO,CAC1C,QAAS,EAAqB,QAAQ,UAAU,CAChD,yBAA0B,EAC1B,yBAA0B,EAAa,QAAQ,yBAAyB,CACxE,0BAA2B,EAAa,QAAQ,0BAA0B,CAC1E,0BAA2B,EAAa,QAAQ,0BAA0B,CAC1E,sBAAuB,EAAa,QAAQ,sBAAsB,CACnE,CAEK,EAAW,EAAY,QAAQ,WAAW,CAYhD,OATe,MAAM,EAFR,MAAM,EAAS,EAAU,QAAQ,CAER,EAAU,CAC9C,SAAU,CACR,GAAG,EACH,GAAG,EAAe,IAAK,GAAQ,QAAQ,IAAM,CAC9C,CACD,OAAQ,GACR,QAAS,CAAC,EAAmB,EAAe,CAAC,CAC9C,CAAC,EAEe"}
@@ -1,2 +1,2 @@
1
- import{filterInvalidDictionaries as e}from"../filterInvalidDictionaries.mjs";import{formatDictionaries as t}from"../formatDictionary.mjs";import{loadContentDeclarations as n}from"./loadContentDeclaration.mjs";import{loadRemoteDictionaries as r}from"./loadRemoteDictionaries.mjs";import{DictionariesLogger as i}from"./log.mjs";import{ANSIColors as a,colon as o,colorize as s,colorizeKey as c,getAppLogger as l}from"@intlayer/config/client";let u=[];const d=new i,f=e=>{let t=[...u];for(let n of e){let e=t.findIndex(e=>e.dictionaryKey===n.dictionaryKey&&e.type===n.type);e>=0?t[e]=n:t.push(n)}return u=t,d.update(e),t},p=e=>{switch(e){case`built`:case`imported`:case`fetched`:return`✔`;case`error`:return`✖`;default:return`⏲`}},m=e=>{switch(e){case`built`:case`imported`:case`fetched`:return a.GREEN;case`error`:return a.RED;default:return a.BLUE}},h=e=>{if(e.log.mode!==`verbose`)return;let t=l(e),n=new Map;for(let e of u){let t=n.get(e.dictionaryKey)??{};e.type===`local`&&(t.local=e.status),e.type===`remote`&&(t.remote=e.status),n.set(e.dictionaryKey,t)}let r=Array.from(n.keys()).sort((e,t)=>e.localeCompare(t)),i=0;for(let e of r){let t=n.get(e);if(t.local){let e=`[local: ${p(t.local)} ${t.local}]`;e.length>i&&(i=e.length)}}for(let e of r){let l=n.get(e),u=[];if(l.local){let e=s(`${p(l.local)} ${l.local}`,m(l.local)),t=`${a.GREY}[`+s(`local: `,a.GREY)+e+`${a.GREY}]${a.RESET}`,n=`[local: ${p(l.local)} ${l.local}]`,r=Math.max(0,i-n.length);u.push(t+` `.repeat(r))}else u.push(` `.repeat(i));if(l.remote){let e=s(`${p(l.remote)} ${l.remote}`,m(l.remote));u.push(`${a.GREY}[`+s(`distant: `,a.GREY)+e+`${a.GREY}]${a.RESET}`)}t(` - ${o(c(e),{colSize:r})} ${u.join(` `)}`)}},g=async(i,a)=>{let{plugins:o}=a,s=Date.now();l(a)(`Dictionaries:`,{isVerbose:!0});let c=(o??[]).filter(e=>e.loadDictionaries).map(async e=>{try{return await e.loadDictionaries?.({configuration:a})??[]}catch(e){return d.setPluginError(e),[]}}),u=await Promise.all(c).then(e=>e.flat()).then(t=>e(t,a)).then(e=>t(e));d.setPluginTotal(u.length),d.setPluginDone(u.length);let p=Date.now(),m=await n(Array.isArray(i)?i:[i],a,f).then(t=>e(t,a)).then(e=>t(e)),g=Date.now();f(m.map(e=>({dictionaryKey:e.key,type:`local`,status:`built`})));let _=!!(a.editor.clientId&&a.editor.clientSecret);_&&d.setExpectRemote(!0);let v=[];_&&(v=await r(a,f,{onStartRemoteCheck:()=>d.startRemoteCheck(),onStopRemoteCheck:()=>d.stopRemoteCheck(),onError:e=>d.setRemoteError(e)}).then(t=>e(t,a)).then(e=>t(e)));let y=Date.now();return d.finish(),h(a),{localDictionaries:m,remoteDictionaries:v,pluginDictionaries:u,time:{localDictionaries:g-p,remoteDictionaries:y-g,pluginDictionaries:p-s}}};export{g as loadDictionaries};
1
+ import{filterInvalidDictionaries as e}from"../filterInvalidDictionaries.mjs";import{formatDictionaries as t}from"../formatDictionary.mjs";import{loadContentDeclarations as n}from"./loadContentDeclaration.mjs";import{loadRemoteDictionaries as r}from"./loadRemoteDictionaries.mjs";import{DictionariesLogger as i}from"./log.mjs";import{ANSIColors as a,colon as o,colorize as s,colorizeKey as c,getAppLogger as l}from"@intlayer/config/logger";let u=[];const d=new i,f=e=>{let t=[...u];for(let n of e){let e=t.findIndex(e=>e.dictionaryKey===n.dictionaryKey&&e.type===n.type);e>=0?t[e]=n:t.push(n)}return u=t,d.update(e),t},p=e=>{switch(e){case`built`:case`imported`:case`fetched`:return`✔`;case`error`:return`✖`;default:return`⏲`}},m=e=>{switch(e){case`built`:case`imported`:case`fetched`:return a.GREEN;case`error`:return a.RED;default:return a.BLUE}},h=e=>{if(e.log.mode!==`verbose`)return;let t=l(e),n=new Map;for(let e of u){let t=n.get(e.dictionaryKey)??{};e.type===`local`&&(t.local=e.status),e.type===`remote`&&(t.remote=e.status),n.set(e.dictionaryKey,t)}let r=Array.from(n.keys()).sort((e,t)=>e.localeCompare(t)),i=0;for(let e of r){let t=n.get(e);if(t.local){let e=`[local: ${p(t.local)} ${t.local}]`;e.length>i&&(i=e.length)}}for(let e of r){let l=n.get(e),u=[];if(l.local){let e=s(`${p(l.local)} ${l.local}`,m(l.local)),t=`${a.GREY}[`+s(`local: `,a.GREY)+e+`${a.GREY}]${a.RESET}`,n=`[local: ${p(l.local)} ${l.local}]`,r=Math.max(0,i-n.length);u.push(t+` `.repeat(r))}else u.push(` `.repeat(i));if(l.remote){let e=s(`${p(l.remote)} ${l.remote}`,m(l.remote));u.push(`${a.GREY}[`+s(`distant: `,a.GREY)+e+`${a.GREY}]${a.RESET}`)}t(` - ${o(c(e),{colSize:r})} ${u.join(` `)}`)}},g=async(i,a)=>{let{plugins:o}=a,s=Date.now();l(a)(`Dictionaries:`,{isVerbose:!0});let c=(o??[]).filter(e=>e.loadDictionaries).map(async e=>{try{return await e.loadDictionaries?.({configuration:a})??[]}catch(e){return d.setPluginError(e),[]}}),u=await Promise.all(c).then(e=>e.flat()).then(t=>e(t,a)).then(e=>t(e));d.setPluginTotal(u.length),d.setPluginDone(u.length);let p=Date.now(),m=await n(Array.isArray(i)?i:[i],a,f).then(t=>e(t,a)).then(e=>t(e)),g=Date.now();f(m.map(e=>({dictionaryKey:e.key,type:`local`,status:`built`})));let _=!!(a.editor.clientId&&a.editor.clientSecret);_&&d.setExpectRemote(!0);let v=[];_&&(v=await r(a,f,{onStartRemoteCheck:()=>d.startRemoteCheck(),onStopRemoteCheck:()=>d.stopRemoteCheck(),onError:e=>d.setRemoteError(e)}).then(t=>e(t,a)).then(e=>t(e)));let y=Date.now();return d.finish(),h(a),{localDictionaries:m,remoteDictionaries:v,pluginDictionaries:u,time:{localDictionaries:g-p,remoteDictionaries:y-g,pluginDictionaries:p-s}}};export{g as loadDictionaries};
2
2
  //# sourceMappingURL=loadDictionaries.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadDictionaries.mjs","names":["logger"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/client';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { formatDictionaries } from '../formatDictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const status of loadDictionariesStatus) {\n const rec = byKey.get(status.dictionaryKey) ?? {};\n if (status.type === 'local') rec.local = status.status;\n if (status.type === 'remote') rec.remote = status.status;\n byKey.set(status.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n pluginDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const pluginsWithLoadDictionaries = (plugins ?? []).filter(\n (plugin) => plugin.loadDictionaries\n );\n\n const loadPluginDictionariesPromise = pluginsWithLoadDictionaries.map(\n async (plugin) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n\n return (res as Dictionary[] | undefined) ?? [];\n } catch (error) {\n logger.setPluginError(error as Error);\n\n return [];\n }\n }\n );\n\n const pluginDictionaries: Dictionary[] = await Promise.all(\n loadPluginDictionariesPromise as Promise<Dictionary[]>[]\n )\n .then((dictionaries) => dictionaries.flat())\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n logger.setPluginTotal(pluginDictionaries.length);\n logger.setPluginDone(pluginDictionaries.length);\n\n const pluginDictionariesTime = Date.now();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n const localDictionariesTime = Date.now();\n\n const localDictionariesStatus = localDictionaries.map(\n (dictionary) =>\n ({\n dictionaryKey: dictionary.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n }\n\n const remoteDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - pluginDictionariesTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n pluginDictionaries: pluginDictionariesTime - loadDictionariesStartTime,\n },\n };\n};\n"],"mappings":"ubA6BA,IAAI,EAA+C,EAAE,CACrD,MAAMA,EAAS,IAAI,EAEb,EAA6B,GAAmC,CACpE,IAAM,EAAgC,CAAC,GAAG,EAAuB,CAEjE,IAAK,IAAM,KAAY,EAAU,CAC/B,IAAM,EAAQ,EAAQ,UACnB,GACC,EAAE,gBAAkB,EAAS,eAAiB,EAAE,OAAS,EAAS,KACrE,CACG,GAAS,EACX,EAAQ,GAAS,EAEjB,EAAQ,KAAK,EAAS,CAO1B,MAHA,GAAyB,EACzB,EAAO,OAAO,EAAS,CAEhB,GAQH,EAAW,GAAyC,CACxD,OAAQ,EAAR,CACE,IAAK,QACL,IAAK,WACL,IAAK,UACH,MAAO,IACT,IAAK,QACH,MAAO,IACT,QACE,MAAO,MAIP,EAAY,GAAyC,CACzD,OAAQ,EAAR,CACE,IAAK,QACL,IAAK,WACL,IAAK,UACH,OAAO,EAAW,MACpB,IAAK,QACH,OAAO,EAAW,IACpB,QACE,OAAO,EAAW,OAIlB,EAAgB,GAAkC,CACtD,GAAI,EAAc,IAAI,OAAS,UAAW,OAE1C,IAAM,EAAY,EAAa,EAAc,CAGvC,EAAQ,IAAI,IAClB,IAAK,IAAM,KAAU,EAAwB,CAC3C,IAAM,EAAM,EAAM,IAAI,EAAO,cAAc,EAAI,EAAE,CAC7C,EAAO,OAA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,EAAc,CACvD,CACA,KAAM,GAAiB,EAAmB,EAAa,CAAC,EAG7D,IAAM,EAAyB,KAAK,KAAK,CAOzC,OAJA,EAAO,QAAQ,CAEf,EAAa,EAAc,CAEpB,CACL,oBACA,qBACA,qBACA,KAAM,CACJ,kBAAmB,EAAwB,EAC3C,mBAAoB,EAAyB,EAC7C,mBAAoB,EAAyB,EAC9C,CACF"}
1
+ {"version":3,"file":"loadDictionaries.mjs","names":["logger"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { formatDictionaries } from '../formatDictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const status of loadDictionariesStatus) {\n const rec = byKey.get(status.dictionaryKey) ?? {};\n if (status.type === 'local') rec.local = status.status;\n if (status.type === 'remote') rec.remote = status.status;\n byKey.set(status.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n pluginDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const pluginsWithLoadDictionaries = (plugins ?? []).filter(\n (plugin) => plugin.loadDictionaries\n );\n\n const loadPluginDictionariesPromise = pluginsWithLoadDictionaries.map(\n async (plugin) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n\n return (res as Dictionary[] | undefined) ?? [];\n } catch (error) {\n logger.setPluginError(error as Error);\n\n return [];\n }\n }\n );\n\n const pluginDictionaries: Dictionary[] = await Promise.all(\n loadPluginDictionariesPromise as Promise<Dictionary[]>[]\n )\n .then((dictionaries) => dictionaries.flat())\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n logger.setPluginTotal(pluginDictionaries.length);\n logger.setPluginDone(pluginDictionaries.length);\n\n const pluginDictionariesTime = Date.now();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n const localDictionariesTime = Date.now();\n\n const localDictionariesStatus = localDictionaries.map(\n (dictionary) =>\n ({\n dictionaryKey: dictionary.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n }\n\n const remoteDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - pluginDictionariesTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n pluginDictionaries: pluginDictionariesTime - loadDictionariesStartTime,\n },\n };\n};\n"],"mappings":"ubA6BA,IAAI,EAA+C,EAAE,CACrD,MAAMA,EAAS,IAAI,EAEb,EAA6B,GAAmC,CACpE,IAAM,EAAgC,CAAC,GAAG,EAAuB,CAEjE,IAAK,IAAM,KAAY,EAAU,CAC/B,IAAM,EAAQ,EAAQ,UACnB,GACC,EAAE,gBAAkB,EAAS,eAAiB,EAAE,OAAS,EAAS,KACrE,CACG,GAAS,EACX,EAAQ,GAAS,EAEjB,EAAQ,KAAK,EAAS,CAO1B,MAHA,GAAyB,EACzB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,EACA,EACD,CACE,KAAM,GACL,EAA0B,EAAc,EAAc,CACvD,CACA,KAAM,GAAiB,EAAmB,EAAa,CAAC,CAErD,EAAwB,KAAK,KAAK,CAWxC,EATgC,EAAkB,IAC/C,IACE,CACC,cAAe,EAAW,IAC1B,KAAM,QACN,OAAQ,QACT,EACJ,CAEiD,CAElD,IAAM,EAAwB,GAC5B,EAAc,OAAO,UAAY,EAAc,OAAO,cAGpD,GAEF,EAAO,gBAAgB,GAAK,CAG9B,IAAI,EAAmC,EAAE,CAErC,IACF,EAAqB,MAAM,EACzB,EACA,EACA,CACE,uBAA0BA,EAAO,kBAAkB,CACnD,sBAAyBA,EAAO,iBAAiB,CACjD,QAAU,GAAMA,EAAO,eAAe,EAAE,CACzC,CACF,CACE,KAAM,GACL,EAA0B,EAAc,EAAc,CACvD,CACA,KAAM,GAAiB,EAAmB,EAAa,CAAC,EAG7D,IAAM,EAAyB,KAAK,KAAK,CAOzC,OAJA,EAAO,QAAQ,CAEf,EAAa,EAAc,CAEpB,CACL,oBACA,qBACA,qBACA,KAAM,CACJ,kBAAmB,EAAwB,EAC3C,mBAAoB,EAAyB,EAC7C,mBAAoB,EAAyB,EAC9C,CACF"}
@@ -1,4 +1,4 @@
1
- import{ANSIColors as e,colorize as t,extractErrorMessage as n,getPrefix as r,spinnerFrames as i,v as a,x as o}from"@intlayer/config/client";import s from"@intlayer/config/built";var c=class{statuses=[];spinnerTimer=null;spinnerIndex=0;renderedLines=0;spinnerFrames=i;isFinished=!1;prefix;lastRenderedState=``;remoteCheckInProgress=!1;expectRemote=!1;remoteError;pluginTotal=0;pluginDone=0;pluginError;constructor(){this.prefix=r(s?.log?.prefix)??``}setExpectRemote(e){this.expectRemote=e}startRemoteCheck(){this.isFinished||(this.remoteCheckInProgress=!0,this.startSpinner(),this.render())}stopRemoteCheck(){this.remoteCheckInProgress=!1}update(e){if(this.isFinished)return;for(let t of e){let e=this.statuses.findIndex(e=>e.dictionaryKey===t.dictionaryKey&&e.type===t.type);e>=0?this.statuses[e]=t:this.statuses.push(t)}let{remoteTotal:t}=this.computeProgress();this.expectRemote&&!this.remoteCheckInProgress&&t===0||(this.startSpinner(),this.render())}finish(){this.isFinished=!0,this.stopSpinner(),this.render()}startSpinner(){this.spinnerTimer||this.isFinished||(this.spinnerTimer=setInterval(()=>{this.spinnerIndex=(this.spinnerIndex+1)%this.spinnerFrames.length,this.render()},100))}stopSpinner(){this.spinnerTimer&&=(clearInterval(this.spinnerTimer),null)}setRemoteError=e=>{this.remoteError=n(e),this.stopRemoteCheck(),this.render()};setPluginTotal(e){this.isFinished||(this.pluginTotal=e,e>0&&this.startSpinner(),this.render())}setPluginDone(e){this.isFinished||(this.pluginDone=e,this.render())}setPluginError(e){this.isFinished||(this.pluginError=n(e),this.render())}render(){let{localTotal:n,localDone:r,remoteTotal:i,remoteDone:s,pluginTotal:c,pluginDone:l}=this.computeProgress(),u=this.spinnerFrames[this.spinnerIndex],d=t(u,e.BLUE),f=[],p=r===n,m=s===i,h=l===c;this.expectRemote&&this.remoteCheckInProgress&&i===0||(p?f.push(`${this.prefix} ${a} Local content: ${t(`${r}`,e.GREEN)}${t(`/${n}`,e.GREY)}`):f.push(`${this.prefix} ${d} Local content: ${t(`${r}`,e.BLUE)}${t(`/${n}`,e.GREY)}`)),(i>0||this.remoteCheckInProgress||this.remoteError)&&(this.remoteError?f.push(`${this.prefix} ${o} Remote content: ${t(this.remoteError,e.RED)}`):i===0?f.push(`${this.prefix} ${d} Remote content: ${t(`Check server`,e.BLUE)}`):m?f.push(`${this.prefix} ${a} Remote content: ${t(`${s}`,e.GREEN)}${t(`/${i}`,e.GREY)}`):f.push(`${this.prefix} ${d} Remote content: ${t(`${s}`,e.BLUE)}${t(`/${i}`,e.GREY)}`)),(c>0||this.pluginError)&&(this.pluginError?f.push(`${this.prefix} ${o} Plugin content: ${t(this.pluginError,e.RED)}`):h?f.push(`${this.prefix} ${a} Plugin content: ${t(`${l}`,e.GREEN)}${t(`/${c}`,e.GREY)}`):f.push(`${this.prefix} ${d} Plugin content: ${t(`${l}`,e.BLUE)}${t(`/${c}`,e.GREY)}`));let g=f.join(`
1
+ import{ANSIColors as e,colorize as t,getPrefix as n,spinnerFrames as r,v as i,x as a}from"@intlayer/config/logger";import{extractErrorMessage as o}from"@intlayer/config/utils";import s from"@intlayer/config/built";var c=class{statuses=[];spinnerTimer=null;spinnerIndex=0;renderedLines=0;spinnerFrames=r;isFinished=!1;prefix;lastRenderedState=``;remoteCheckInProgress=!1;expectRemote=!1;remoteError;pluginTotal=0;pluginDone=0;pluginError;constructor(){this.prefix=n(s?.log?.prefix)??``}setExpectRemote(e){this.expectRemote=e}startRemoteCheck(){this.isFinished||(this.remoteCheckInProgress=!0,this.startSpinner(),this.render())}stopRemoteCheck(){this.remoteCheckInProgress=!1}update(e){if(this.isFinished)return;for(let t of e){let e=this.statuses.findIndex(e=>e.dictionaryKey===t.dictionaryKey&&e.type===t.type);e>=0?this.statuses[e]=t:this.statuses.push(t)}let{remoteTotal:t}=this.computeProgress();this.expectRemote&&!this.remoteCheckInProgress&&t===0||(this.startSpinner(),this.render())}finish(){this.isFinished=!0,this.stopSpinner(),this.render()}startSpinner(){this.spinnerTimer||this.isFinished||(this.spinnerTimer=setInterval(()=>{this.spinnerIndex=(this.spinnerIndex+1)%this.spinnerFrames.length,this.render()},100))}stopSpinner(){this.spinnerTimer&&=(clearInterval(this.spinnerTimer),null)}setRemoteError=e=>{this.remoteError=o(e),this.stopRemoteCheck(),this.render()};setPluginTotal(e){this.isFinished||(this.pluginTotal=e,e>0&&this.startSpinner(),this.render())}setPluginDone(e){this.isFinished||(this.pluginDone=e,this.render())}setPluginError(e){this.isFinished||(this.pluginError=o(e),this.render())}render(){let{localTotal:n,localDone:r,remoteTotal:o,remoteDone:s,pluginTotal:c,pluginDone:l}=this.computeProgress(),u=this.spinnerFrames[this.spinnerIndex],d=t(u,e.BLUE),f=[],p=r===n,m=s===o,h=l===c;this.expectRemote&&this.remoteCheckInProgress&&o===0||(p?f.push(`${this.prefix} ${i} Local content: ${t(`${r}`,e.GREEN)}${t(`/${n}`,e.GREY)}`):f.push(`${this.prefix} ${d} Local content: ${t(`${r}`,e.BLUE)}${t(`/${n}`,e.GREY)}`)),(o>0||this.remoteCheckInProgress||this.remoteError)&&(this.remoteError?f.push(`${this.prefix} ${a} Remote content: ${t(this.remoteError,e.RED)}`):o===0?f.push(`${this.prefix} ${d} Remote content: ${t(`Check server`,e.BLUE)}`):m?f.push(`${this.prefix} ${i} Remote content: ${t(`${s}`,e.GREEN)}${t(`/${o}`,e.GREY)}`):f.push(`${this.prefix} ${d} Remote content: ${t(`${s}`,e.BLUE)}${t(`/${o}`,e.GREY)}`)),(c>0||this.pluginError)&&(this.pluginError?f.push(`${this.prefix} ${a} Plugin content: ${t(this.pluginError,e.RED)}`):h?f.push(`${this.prefix} ${i} Plugin content: ${t(`${l}`,e.GREEN)}${t(`/${c}`,e.GREY)}`):f.push(`${this.prefix} ${d} Plugin content: ${t(`${l}`,e.BLUE)}${t(`/${c}`,e.GREY)}`));let g=f.join(`
2
2
  `);if(g===this.lastRenderedState)return;this.lastRenderedState=g,this.renderedLines>0&&process.stdout.write(`\x1b[${this.renderedLines}F`);let _=Math.max(this.renderedLines,f.length);for(let e=0;e<_;e++){process.stdout.write(`\x1B[2K`);let t=f[e];t!==void 0&&process.stdout.write(t),process.stdout.write(`
3
3
  `)}this.renderedLines=f.length}computeProgress(){let e=new Set(this.statuses.filter(e=>e.type===`local`).map(e=>e.dictionaryKey)),t=new Set(this.statuses.filter(e=>e.type===`local`&&(e.status===`built`||e.status===`error`)).map(e=>e.dictionaryKey)),n=new Set(this.statuses.filter(e=>e.type===`remote`).map(e=>e.dictionaryKey)),r=new Set(this.statuses.filter(e=>e.type===`remote`&&(e.status===`fetched`||e.status===`imported`||e.status===`error`)).map(e=>e.dictionaryKey));return{localTotal:e.size,localDone:t.size,remoteTotal:n.size,remoteDone:r.size,pluginTotal:this.pluginTotal,pluginDone:this.pluginDone}}};export{c as DictionariesLogger};
4
4
  //# sourceMappingURL=log.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.mjs","names":[],"sources":["../../../src/loadDictionaries/log.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n ANSIColors,\n colorize,\n extractErrorMessage,\n getPrefix,\n spinnerFrames,\n v,\n x,\n} from '@intlayer/config/client';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport class DictionariesLogger {\n private statuses: DictionariesStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n private remoteCheckInProgress = false;\n private expectRemote = false;\n private remoteError: string | undefined;\n private pluginTotal = 0;\n private pluginDone = 0;\n private pluginError: string | undefined;\n\n constructor() {\n this.prefix = getPrefix(configuration?.log?.prefix) ?? '';\n }\n\n setExpectRemote(expect: boolean) {\n this.expectRemote = expect;\n }\n\n startRemoteCheck() {\n if (this.isFinished) return;\n this.remoteCheckInProgress = true;\n this.startSpinner();\n this.render();\n }\n\n stopRemoteCheck() {\n this.remoteCheckInProgress = false;\n }\n\n update(newStatuses: DictionariesStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) =>\n s.dictionaryKey === status.dictionaryKey && s.type === status.type\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n // If we expect remote fetch later, avoid rendering a local-only line first\n const { remoteTotal } = this.computeProgress();\n if (this.expectRemote && !this.remoteCheckInProgress && remoteTotal === 0) {\n // Do not start spinner or render yet; wait until remote check starts\n return;\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n // Render final state and keep it visible\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n public setRemoteError = (error?: Error) => {\n this.remoteError = extractErrorMessage(error);\n // Avoid rendering a transient remote-only line while the remote check flag is still true\n // Ensure local + remote are rendered together after a failure\n this.stopRemoteCheck();\n this.render();\n };\n\n setPluginTotal(total: number) {\n if (this.isFinished) return;\n this.pluginTotal = total;\n if (total > 0) {\n this.startSpinner();\n }\n this.render();\n }\n\n setPluginDone(done: number) {\n if (this.isFinished) return;\n this.pluginDone = done;\n this.render();\n }\n\n setPluginError(error?: Error) {\n if (this.isFinished) return;\n this.pluginError = extractErrorMessage(error);\n this.render();\n }\n\n private render() {\n const {\n localTotal,\n localDone,\n remoteTotal,\n remoteDone,\n pluginTotal,\n pluginDone,\n } = this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const clock = colorize(frame, ANSIColors.BLUE);\n const lines: string[] = [];\n\n const isLocalDone = localDone === localTotal;\n const isRemoteDone = remoteDone === remoteTotal;\n const isPluginDone = pluginDone === pluginTotal;\n\n const suppressLocalWhileCheckingRemote =\n this.expectRemote && this.remoteCheckInProgress && remoteTotal === 0;\n\n if (!suppressLocalWhileCheckingRemote) {\n if (isLocalDone) {\n lines.push(\n `${this.prefix} ${v} Local content: ${colorize(`${localDone}`, ANSIColors.GREEN)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Local content: ${colorize(`${localDone}`, ANSIColors.BLUE)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Single remote line: show error, check, or progress counts\n if (remoteTotal > 0 || this.remoteCheckInProgress || this.remoteError) {\n if (this.remoteError) {\n lines.push(\n `${this.prefix} ${x} Remote content: ${colorize(\n this.remoteError,\n ANSIColors.RED\n )}`\n );\n } else if (remoteTotal === 0) {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize('Check server', ANSIColors.BLUE)}`\n );\n } else if (isRemoteDone) {\n lines.push(\n `${this.prefix} ${v} Remote content: ${colorize(`${remoteDone}`, ANSIColors.GREEN)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize(`${remoteDone}`, ANSIColors.BLUE)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Plugin line: show error or progress counts\n if (pluginTotal > 0 || this.pluginError) {\n if (this.pluginError) {\n lines.push(\n `${this.prefix} ${x} Plugin content: ${colorize(\n this.pluginError,\n ANSIColors.RED\n )}`\n );\n } else if (isPluginDone) {\n lines.push(\n `${this.prefix} ${v} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.GREEN)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.BLUE)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Check if the state has changed to avoid duplicate rendering\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const localKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'local')\n .map((s) => s.dictionaryKey)\n );\n\n const localDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'local' && (s.status === 'built' || s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n const remoteKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'remote')\n .map((s) => s.dictionaryKey)\n );\n\n const remoteDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'remote' &&\n (s.status === 'fetched' ||\n s.status === 'imported' ||\n s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n return {\n localTotal: localKeys.size,\n localDone: localDoneKeys.size,\n remoteTotal: remoteKeys.size,\n remoteDone: remoteDoneKeys.size,\n pluginTotal: this.pluginTotal,\n pluginDone: this.pluginDone,\n } as const;\n }\n}\n"],"mappings":"kLAYA,IAAa,EAAb,KAAgC,CAC9B,SAAyC,EAAE,CAC3C,aAA8C,KAC9C,aAAuB,EACvB,cAAwB,EACxB,cAAiC,EACjC,WAAqB,GACrB,OACA,kBAAoC,GACpC,sBAAgC,GAChC,aAAuB,GACvB,YACA,YAAsB,EACtB,WAAqB,EACrB,YAEA,aAAc,CACZ,KAAK,OAAS,EAAU,GAAe,KAAK,OAAO,EAAI,GAGzD,gBAAgB,EAAiB,CAC/B,KAAK,aAAe,EAGtB,kBAAmB,CACb,KAAK,aACT,KAAK,sBAAwB,GAC7B,KAAK,cAAc,CACnB,KAAK,QAAQ,EAGf,iBAAkB,CAChB,KAAK,sBAAwB,GAG/B,OAAO,EAAmC,CACxC,GAAI,KAAK,WAAY,OACrB,IAAK,IAAM,KAAU,EAAa,CAChC,IAAM,EAAQ,KAAK,SAAS,UACzB,GACC,EAAE,gBAAkB,EAAO,eAAiB,EAAE,OAAS,EAAO,KACjE,CACG,GAAS,EACX,KAAK,SAAS,GAAS,EAEvB,KAAK,SAAS,KAAK,EAAO,CAK9B,GAAM,CAAE,eAAgB,KAAK,iBAAiB,CAC1C,KAAK,cAAgB,CAAC,KAAK,uBAAyB,IAAgB,IAKxE,KAAK,cAAc,CACnB,KAAK,QAAQ,EAGf,QAAS,CACP,KAAK,WAAa,GAClB,KAAK,aAAa,CAElB,KAAK,QAAQ,CAGf,cAA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CACjC,IAAK,GAAM,EAAE,cAAc,CAC/B,CAEK,EAAgB,IAAI,IACxB,KAAK,SACF,OACE,GACC,EAAE,OAAS,UAAY,EAAE,SAAW,SAAW,EAAE,SAAW,SAC/D,CACA,IAAK,GAAM,EAAE,cAAc,CAC/B,CAEK,EAAa,IAAI,IACrB,KAAK,SACF,OAAQ,GAAM,EAAE,OAAS,SAAS,CAClC,IAAK,GAAM,EAAE,cAAc,CAC/B,CAEK,EAAiB,IAAI,IACzB,KAAK,SACF,OACE,GACC,EAAE,OAAS,WACV,EAAE,SAAW,WACZ,EAAE,SAAW,YACb,EAAE,SAAW,SAClB,CACA,IAAK,GAAM,EAAE,cAAc,CAC/B,CAED,MAAO,CACL,WAAY,EAAU,KACtB,UAAW,EAAc,KACzB,YAAa,EAAW,KACxB,WAAY,EAAe,KAC3B,YAAa,KAAK,YAClB,WAAY,KAAK,WAClB"}
1
+ {"version":3,"file":"log.mjs","names":[],"sources":["../../../src/loadDictionaries/log.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n ANSIColors,\n colorize,\n getPrefix,\n spinnerFrames,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { extractErrorMessage } from '@intlayer/config/utils';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport class DictionariesLogger {\n private statuses: DictionariesStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n private remoteCheckInProgress = false;\n private expectRemote = false;\n private remoteError: string | undefined;\n private pluginTotal = 0;\n private pluginDone = 0;\n private pluginError: string | undefined;\n\n constructor() {\n this.prefix = getPrefix(configuration?.log?.prefix) ?? '';\n }\n\n setExpectRemote(expect: boolean) {\n this.expectRemote = expect;\n }\n\n startRemoteCheck() {\n if (this.isFinished) return;\n this.remoteCheckInProgress = true;\n this.startSpinner();\n this.render();\n }\n\n stopRemoteCheck() {\n this.remoteCheckInProgress = false;\n }\n\n update(newStatuses: DictionariesStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) =>\n s.dictionaryKey === status.dictionaryKey && s.type === status.type\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n // If we expect remote fetch later, avoid rendering a local-only line first\n const { remoteTotal } = this.computeProgress();\n if (this.expectRemote && !this.remoteCheckInProgress && remoteTotal === 0) {\n // Do not start spinner or render yet; wait until remote check starts\n return;\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n // Render final state and keep it visible\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n public setRemoteError = (error?: Error) => {\n this.remoteError = extractErrorMessage(error);\n // Avoid rendering a transient remote-only line while the remote check flag is still true\n // Ensure local + remote are rendered together after a failure\n this.stopRemoteCheck();\n this.render();\n };\n\n setPluginTotal(total: number) {\n if (this.isFinished) return;\n this.pluginTotal = total;\n if (total > 0) {\n this.startSpinner();\n }\n this.render();\n }\n\n setPluginDone(done: number) {\n if (this.isFinished) return;\n this.pluginDone = done;\n this.render();\n }\n\n setPluginError(error?: Error) {\n if (this.isFinished) return;\n this.pluginError = extractErrorMessage(error);\n this.render();\n }\n\n private render() {\n const {\n localTotal,\n localDone,\n remoteTotal,\n remoteDone,\n pluginTotal,\n pluginDone,\n } = this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const clock = colorize(frame, ANSIColors.BLUE);\n const lines: string[] = [];\n\n const isLocalDone = localDone === localTotal;\n const isRemoteDone = remoteDone === remoteTotal;\n const isPluginDone = pluginDone === pluginTotal;\n\n const suppressLocalWhileCheckingRemote =\n this.expectRemote && this.remoteCheckInProgress && remoteTotal === 0;\n\n if (!suppressLocalWhileCheckingRemote) {\n if (isLocalDone) {\n lines.push(\n `${this.prefix} ${v} Local content: ${colorize(`${localDone}`, ANSIColors.GREEN)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Local content: ${colorize(`${localDone}`, ANSIColors.BLUE)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Single remote line: show error, check, or progress counts\n if (remoteTotal > 0 || this.remoteCheckInProgress || this.remoteError) {\n if (this.remoteError) {\n lines.push(\n `${this.prefix} ${x} Remote content: ${colorize(\n this.remoteError,\n ANSIColors.RED\n )}`\n );\n } else if (remoteTotal === 0) {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize('Check server', ANSIColors.BLUE)}`\n );\n } else if (isRemoteDone) {\n lines.push(\n `${this.prefix} ${v} Remote content: ${colorize(`${remoteDone}`, ANSIColors.GREEN)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize(`${remoteDone}`, ANSIColors.BLUE)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Plugin line: show error or progress counts\n if (pluginTotal > 0 || this.pluginError) {\n if (this.pluginError) {\n lines.push(\n `${this.prefix} ${x} Plugin content: ${colorize(\n this.pluginError,\n ANSIColors.RED\n )}`\n );\n } else if (isPluginDone) {\n lines.push(\n `${this.prefix} ${v} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.GREEN)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.BLUE)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Check if the state has changed to avoid duplicate rendering\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const localKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'local')\n .map((s) => s.dictionaryKey)\n );\n\n const localDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'local' && (s.status === 'built' || s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n const remoteKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'remote')\n .map((s) => s.dictionaryKey)\n );\n\n const remoteDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'remote' &&\n (s.status === 'fetched' ||\n s.status === 'imported' ||\n s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n return {\n localTotal: localKeys.size,\n localDone: localDoneKeys.size,\n remoteTotal: remoteKeys.size,\n remoteDone: remoteDoneKeys.size,\n pluginTotal: this.pluginTotal,\n pluginDone: this.pluginDone,\n } as const;\n }\n}\n"],"mappings":"sNAYA,IAAa,EAAb,KAAgC,CAC9B,SAAyC,EAAE,CAC3C,aAA8C,KAC9C,aAAuB,EACvB,cAAwB,EACxB,cAAiC,EACjC,WAAqB,GACrB,OACA,kBAAoC,GACpC,sBAAgC,GAChC,aAAuB,GACvB,YACA,YAAsB,EACtB,WAAqB,EACrB,YAEA,aAAc,CACZ,KAAK,OAAS,EAAU,GAAe,KAAK,OAAO,EAAI,GAGzD,gBAAgB,EAAiB,CAC/B,KAAK,aAAe,EAGtB,kBAAmB,CACb,KAAK,aACT,KAAK,sBAAwB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IAAM,EAAe,EAAM,KAAK;EAAK,CACrC,GAAI,IAAiB,KAAK,kBACxB,OAEF,KAAK,kBAAoB,EAErB,KAAK,cAAgB,GACvB,QAAQ,OAAO,MAAM,QAAQ,KAAK,cAAc,GAAG,CAGrD,IAAM,EAAoB,KAAK,IAAI,KAAK,cAAe,EAAM,OAAO,CACpE,IAAK,IAAI,EAAI,EAAG,EAAI,EAAmB,IAAK,CAC1C,QAAQ,OAAO,MAAM,UAAU,CAC/B,IAAM,EAAO,EAAM,GACf,IAAS,IAAA,IACX,QAAQ,OAAO,MAAM,EAAK,CAE5B,QAAQ,OAAO,MAAM;EAAK,CAG5B,KAAK,cAAgB,EAAM,OAG7B,iBAA0B,CACxB,IAAM,EAAY,IAAI,IACpB,KAAK,SACF,OAAQ,GAAM,EAAE,OAAS,QAAQ,CACjC,IAAK,GAAM,EAAE,cAAc,CAC/B,CAEK,EAAgB,IAAI,IACxB,KAAK,SACF,OACE,GACC,EAAE,OAAS,UAAY,EAAE,SAAW,SAAW,EAAE,SAAW,SAC/D,CACA,IAAK,GAAM,EAAE,cAAc,CAC/B,CAEK,EAAa,IAAI,IACrB,KAAK,SACF,OAAQ,GAAM,EAAE,OAAS,SAAS,CAClC,IAAK,GAAM,EAAE,cAAc,CAC/B,CAEK,EAAiB,IAAI,IACzB,KAAK,SACF,OACE,GACC,EAAE,OAAS,WACV,EAAE,SAAW,WACZ,EAAE,SAAW,YACb,EAAE,SAAW,SAClB,CACA,IAAK,GAAM,EAAE,cAAc,CAC/B,CAED,MAAO,CACL,WAAY,EAAU,KACtB,UAAW,EAAc,KACzB,YAAa,EAAW,KACxB,WAAY,EAAe,KAC3B,YAAa,KAAK,YAClB,WAAY,KAAK,WAClB"}
@@ -1,3 +1,3 @@
1
- import{dirname as e,extname as t}from"node:path";import{getAppLogger as n}from"@intlayer/config";const r=async(r,i)=>{let a=n(i),o=r.filter(e=>{let n=t(e);return[`.ts`,`.tsx`,`.js`,`.jsx`,`.cjs`,`.mjs`,`.json`].includes(n)});if(o.length===0)return;let s;try{s=(await import(`typescript`)).default||await import(`typescript`)}catch{return}let c=s.findConfigFile(i.content?.baseDir??process.cwd(),s.sys.fileExists,`tsconfig.json`),l={noEmit:!0,allowJs:!0,resolveJsonModule:!0};if(c){let t=s.sys.readFile(c);if(t){let n=s.parseConfigFileTextToJson(c,t);if(!n.error){let{incremental:t,tsBuildInfoFile:r,...i}=s.parseJsonConfigFileContent(n.config,s.sys,e(c)).options;l={...l,...i,noEmit:!0}}}}let u=s.createProgram(o,l);o.forEach(e=>{let t=u.getSourceFile(e);t&&s.getPreEmitDiagnostics(u,t).forEach(e=>{let t=s.flattenDiagnosticMessageText(e.messageText,`
1
+ import{dirname as e,extname as t}from"node:path";import{getAppLogger as n}from"@intlayer/config/logger";const r=async(r,i)=>{let a=n(i),o=r.filter(e=>{let n=t(e);return[`.ts`,`.tsx`,`.js`,`.jsx`,`.cjs`,`.mjs`,`.json`].includes(n)});if(o.length===0)return;let s;try{s=(await import(`typescript`)).default||await import(`typescript`)}catch{return}let c=s.findConfigFile(i.content?.baseDir??process.cwd(),s.sys.fileExists,`tsconfig.json`),l={noEmit:!0,allowJs:!0,resolveJsonModule:!0};if(c){let t=s.sys.readFile(c);if(t){let n=s.parseConfigFileTextToJson(c,t);if(!n.error){let{incremental:t,tsBuildInfoFile:r,...i}=s.parseJsonConfigFileContent(n.config,s.sys,e(c)).options;l={...l,...i,noEmit:!0}}}}let u=s.createProgram(o,l);o.forEach(e=>{let t=u.getSourceFile(e);t&&s.getPreEmitDiagnostics(u,t).forEach(e=>{let t=s.flattenDiagnosticMessageText(e.messageText,`
2
2
  `);if(e.file&&e.start!==void 0){let{line:n,character:r}=e.file.getLineAndCharacterOfPosition(e.start);a(`TS Error in ${e.file.fileName} (${n+1},${r+1}): ${t}`,{level:`warn`})}})})};export{r as logTypeScriptErrors};
3
3
  //# sourceMappingURL=logTypeScriptErrors.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logTypeScriptErrors.mjs","names":[],"sources":["../../../src/loadDictionaries/logTypeScriptErrors.ts"],"sourcesContent":["import { dirname, extname } from 'node:path';\n\nimport { getAppLogger } from '@intlayer/config';\n\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const logTypeScriptErrors = async (\n filePaths: string[],\n\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n\n const filesToCheck = filePaths.filter((path) => {\n const ext = extname(path);\n\n return ['.ts', '.tsx', '.js', '.jsx', '.cjs', '.mjs', '.json'].includes(\n ext\n );\n });\n\n if (filesToCheck.length === 0) return;\n\n let ts: typeof import('typescript');\n\n try {\n ts = (await import('typescript')).default || (await import('typescript'));\n } catch {\n // TypeScript not installed, skip type checking\n\n return;\n }\n\n const configFileName = ts.findConfigFile(\n configuration.content?.baseDir ?? process.cwd(),\n\n ts.sys.fileExists,\n\n 'tsconfig.json'\n );\n\n let compilerOptions: any = {\n noEmit: true,\n\n allowJs: true,\n\n resolveJsonModule: true,\n };\n\n if (configFileName) {\n const configFileText = ts.sys.readFile(configFileName);\n\n if (configFileText) {\n const configJson = ts.parseConfigFileTextToJson(\n configFileName,\n\n configFileText\n );\n\n if (!configJson.error) {\n const parsedConfig = ts.parseJsonConfigFileContent(\n configJson.config,\n\n ts.sys,\n\n dirname(configFileName)\n );\n\n const { incremental, tsBuildInfoFile, ...restOptions } =\n parsedConfig.options;\n\n compilerOptions = { ...compilerOptions, ...restOptions, noEmit: true };\n }\n }\n }\n\n const program = ts.createProgram(filesToCheck, compilerOptions);\n\n filesToCheck.forEach((filePath) => {\n const sourceFile = program.getSourceFile(filePath);\n\n if (!sourceFile) return;\n\n const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);\n\n diagnostics.forEach((diagnostic) => {\n const message = ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n\n '\\n'\n );\n\n if (diagnostic.file && diagnostic.start !== undefined) {\n const { line, character } =\n diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n\n appLog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jE,EACE,eAAe,EAAW,KAAK,SAAS,IAAI,EAAO,EAAE,GAAG,EAAY,EAAE,KAAK,IAE3E,CAAE,MAAO,OAAQ,CAClB,GAEH,EACF"}
1
+ {"version":3,"file":"logTypeScriptErrors.mjs","names":[],"sources":["../../../src/loadDictionaries/logTypeScriptErrors.ts"],"sourcesContent":["import { dirname, extname } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const logTypeScriptErrors = async (\n filePaths: string[],\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n\n const filesToCheck = filePaths.filter((path) => {\n const ext = extname(path);\n\n return ['.ts', '.tsx', '.js', '.jsx', '.cjs', '.mjs', '.json'].includes(\n ext\n );\n });\n\n if (filesToCheck.length === 0) return;\n\n let ts: typeof import('typescript');\n\n try {\n ts = (await import('typescript')).default || (await import('typescript'));\n } catch {\n // TypeScript not installed, skip type checking\n\n return;\n }\n\n const configFileName = ts.findConfigFile(\n configuration.content?.baseDir ?? process.cwd(),\n ts.sys.fileExists,\n 'tsconfig.json'\n );\n\n let compilerOptions: any = {\n noEmit: true,\n\n allowJs: true,\n\n resolveJsonModule: true,\n };\n\n if (configFileName) {\n const configFileText = ts.sys.readFile(configFileName);\n\n if (configFileText) {\n const configJson = ts.parseConfigFileTextToJson(\n configFileName,\n\n configFileText\n );\n\n if (!configJson.error) {\n const parsedConfig = ts.parseJsonConfigFileContent(\n configJson.config,\n\n ts.sys,\n\n dirname(configFileName)\n );\n\n const { incremental, tsBuildInfoFile, ...restOptions } =\n parsedConfig.options;\n\n compilerOptions = { ...compilerOptions, ...restOptions, noEmit: true };\n }\n }\n }\n\n const program = ts.createProgram(filesToCheck, compilerOptions);\n\n filesToCheck.forEach((filePath) => {\n const sourceFile = program.getSourceFile(filePath);\n\n if (!sourceFile) return;\n\n const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);\n\n diagnostics.forEach((diagnostic) => {\n const message = ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n\n '\\n'\n );\n\n if (diagnostic.file && diagnostic.start !== undefined) {\n const { line, character } =\n diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n\n appLogger(\n `TS Error in ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`,\n\n { level: 'warn' }\n );\n }\n });\n });\n};\n"],"mappings":"wGAIA,MAAa,EAAsB,MACjC,EACA,IACG,CACH,IAAM,EAAY,EAAa,EAAc,CAEvC,EAAe,EAAU,OAAQ,GAAS,CAC9C,IAAM,EAAM,EAAQ,EAAK,CAEzB,MAAO,CAAC,MAAO,OAAQ,MAAO,OAAQ,OAAQ,OAAQ,QAAQ,CAAC,SAC7D,EACD,EACD,CAEF,GAAI,EAAa,SAAW,EAAG,OAE/B,IAAI,EAEJ,GAAI,CACF,GAAM,MAAM,OAAO,eAAe,SAAY,MAAM,OAAO,mBACrD,CAGN,OAGF,IAAM,EAAiB,EAAG,eACxB,EAAc,SAAS,SAAW,QAAQ,KAAK,CAC/C,EAAG,IAAI,WACP,gBACD,CAEG,EAAuB,CACzB,OAAQ,GAER,QAAS,GAET,kBAAmB,GACpB,CAED,GAAI,EAAgB,CAClB,IAAM,EAAiB,EAAG,IAAI,SAAS,EAAe,CAEtD,GAAI,EAAgB,CAClB,IAAM,EAAa,EAAG,0BACpB,EAEA,EACD,CAED,GAAI,CAAC,EAAW,MAAO,CASrB,GAAM,CAAE,cAAa,kBAAiB,GAAG,GARpB,EAAG,2BACtB,EAAW,OAEX,EAAG,IAEH,EAAQ,EAAe,CACxB,CAGc,QAEf,EAAkB,CAAE,GAAG,EAAiB,GAAG,EAAa,OAAQ,GAAM,GAK5E,IAAM,EAAU,EAAG,cAAc,EAAc,EAAgB,CAE/D,EAAa,QAAS,GAAa,CACjC,IAAM,EAAa,EAAQ,cAAc,EAAS,CAE7C,GAEe,EAAG,sBAAsB,EAAS,EAAW,CAErD,QAAS,GAAe,CAClC,IAAM,EAAU,EAAG,6BACjB,EAAW,YAEX;EACD,CAED,GAAI,EAAW,MAAQ,EAAW,QAAU,IAAA,GAAW,CACrD,GAAM,CAAE,OAAM,aACZ,EAAW,KAAK,8BAA8B,EAAW,MAAM,CAEjE,EACE,eAAe,EAAW,KAAK,SAAS,IAAI,EAAO,EAAE,GAAG,EAAY,EAAE,KAAK,IAE3E,CAAE,MAAO,OAAQ,CAClB,GAEH,EACF"}
@@ -0,0 +1,2 @@
1
+ import{formatPath as e}from"./utils/formatter.mjs";import{runOnce as t}from"./utils/runOnce.mjs";import{getConfigurationAndFilePath as n}from"@intlayer/config/node";import{join as r,relative as i}from"node:path";import{getAppLogger as a}from"@intlayer/config/logger";import{getEnvFilePath as o}from"@intlayer/config/env";const s=s=>{let{configuration:c,numCustomConfiguration:l,configurationFilePath:u}=n(s),d=a(c);t(r(c.content.baseDir,`.intlayer`,`cache`,`intlayer-config-locaded.lock`),()=>{if(l===0)d(`Configuration file not found, using default configuration.`,{isVerbose:!0});else{let t=c.content.baseDir,n=i(t,u);if(l===1){let t=o(s?.env,s?.envFile);d(`Configuration loaded ${e(n)}${t?` - Env: ${e(t)}`:``}`,{isVerbose:!0})}else d(`Multiple configuration files found, using ${e(n)}.`,{isVerbose:!0})}},{cacheTimeoutMs:1e3*30})};export{s as logConfigDetails};
2
+ //# sourceMappingURL=logConfigDetails.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logConfigDetails.mjs","names":[],"sources":["../../src/logConfigDetails.ts"],"sourcesContent":["import { join, relative } from 'node:path';\nimport { getEnvFilePath } from '@intlayer/config/env';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfigurationAndFilePath,\n} from '@intlayer/config/node';\nimport { formatPath, runOnce } from './utils';\n\nexport const logConfigDetails = (options?: GetConfigurationOptions) => {\n const { configuration, numCustomConfiguration, configurationFilePath } =\n getConfigurationAndFilePath(options);\n const appLogger = getAppLogger(configuration);\n\n runOnce(\n join(\n configuration.content.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-config-locaded.lock'\n ),\n () => {\n if (numCustomConfiguration === 0) {\n appLogger(\n 'Configuration file not found, using default configuration.',\n {\n isVerbose: true,\n }\n );\n } else {\n const baseDir = configuration.content.baseDir;\n const relativeOutputPath = relative(baseDir, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n const dotEnvFilePath = getEnvFilePath(options?.env, options?.envFile);\n\n appLogger(\n `Configuration loaded ${formatPath(relativeOutputPath)}${dotEnvFilePath ? ` - Env: ${formatPath(dotEnvFilePath)}` : ''}`,\n {\n isVerbose: true,\n }\n );\n } else {\n appLogger(\n `Multiple configuration files found, using ${formatPath(relativeOutputPath)}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n },\n {\n cacheTimeoutMs: 1000 * 30, // 30 seconds\n }\n );\n};\n"],"mappings":"iUASA,MAAa,EAAoB,GAAsC,CACrE,GAAM,CAAE,gBAAe,yBAAwB,yBAC7C,EAA4B,EAAQ,CAChC,EAAY,EAAa,EAAc,CAE7C,EACE,EACE,EAAc,QAAQ,QACtB,YACA,QACA,+BACD,KACK,CACJ,GAAI,IAA2B,EAC7B,EACE,6DACA,CACE,UAAW,GACZ,CACF,KACI,CACL,IAAM,EAAU,EAAc,QAAQ,QAChC,EAAqB,EAAS,EAAS,EAAuB,CAEpE,GAAI,IAA2B,EAAG,CAChC,IAAM,EAAiB,EAAe,GAAS,IAAK,GAAS,QAAQ,CAErE,EACE,wBAAwB,EAAW,EAAmB,GAAG,EAAiB,WAAW,EAAW,EAAe,GAAK,KACpH,CACE,UAAW,GACZ,CACF,MAED,EACE,6CAA6C,EAAW,EAAmB,CAAC,GAC5E,CACE,UAAW,GACZ,CACF,GAIP,CACE,eAAgB,IAAO,GACxB,CACF"}
@@ -11,4 +11,5 @@ import { MCPTransport, installMCP } from "./installMCP/installMCP.js";
11
11
  import { listDictionaries, listDictionariesWithStats } from "./listDictionariesPath.js";
12
12
  import { DiffMode, ListGitFilesOptions, ListGitLinesOptions, listGitFiles, listGitLines } from "./listGitFiles.js";
13
13
  import { ListProjectsOptions, listProjects } from "./listProjects.js";
14
- export { DictionaryStatus, DiffMode, ListGitFilesOptions, ListGitLinesOptions, ListProjectsOptions, MCPTransport, PLATFORMS, PLATFORMS_METADATA, Platform, PlatformMetadata, SKILLS, SKILLS_METADATA, Skill, detectExportedComponentName, detectFormatCommand, getContentDeclarationFileTemplate, getInitialSkills, initIntlayer, installMCP, installSkills, listDictionaries, listDictionariesWithStats, listGitFiles, listGitLines, listProjects, transformJSFile, writeContentDeclaration, writeJSFile };
14
+ import { logConfigDetails } from "./logConfigDetails.js";
15
+ export { DictionaryStatus, DiffMode, ListGitFilesOptions, ListGitLinesOptions, ListProjectsOptions, MCPTransport, PLATFORMS, PLATFORMS_METADATA, Platform, PlatformMetadata, SKILLS, SKILLS_METADATA, Skill, detectExportedComponentName, detectFormatCommand, getContentDeclarationFileTemplate, getInitialSkills, initIntlayer, installMCP, installSkills, listDictionaries, listDictionariesWithStats, listGitFiles, listGitLines, listProjects, logConfigDetails, transformJSFile, writeContentDeclaration, writeJSFile };
@@ -1 +1 @@
1
- {"version":3,"file":"logTypeScriptErrors.d.ts","names":[],"sources":["../../../src/loadDictionaries/logTypeScriptErrors.ts"],"mappings":";;;cAMa,mBAAA,GACX,SAAA,YAEA,aAAA,EAAe,cAAA,KAAc,OAAA"}
1
+ {"version":3,"file":"logTypeScriptErrors.d.ts","names":[],"sources":["../../../src/loadDictionaries/logTypeScriptErrors.ts"],"mappings":";;;cAIa,mBAAA,GACX,SAAA,YACA,aAAA,EAAe,cAAA,KAAc,OAAA"}
@@ -0,0 +1,7 @@
1
+ import { GetConfigurationOptions } from "@intlayer/config/node";
2
+
3
+ //#region src/logConfigDetails.d.ts
4
+ declare const logConfigDetails: (options?: GetConfigurationOptions) => void;
5
+ //#endregion
6
+ export { logConfigDetails };
7
+ //# sourceMappingURL=logConfigDetails.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logConfigDetails.d.ts","names":[],"sources":["../../src/logConfigDetails.ts"],"mappings":";;;cASa,gBAAA,GAAoB,OAAA,GAAU,uBAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/chokidar",
3
- "version": "8.2.2",
3
+ "version": "8.2.4",
4
4
  "private": false,
5
5
  "description": "Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.",
6
6
  "keywords": [
@@ -101,13 +101,13 @@
101
101
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
102
102
  },
103
103
  "dependencies": {
104
- "@intlayer/api": "8.2.2",
105
- "@intlayer/config": "8.2.2",
106
- "@intlayer/core": "8.2.2",
107
- "@intlayer/dictionaries-entry": "8.2.2",
108
- "@intlayer/remote-dictionaries-entry": "8.2.2",
109
- "@intlayer/types": "8.2.2",
110
- "@intlayer/unmerged-dictionaries-entry": "8.2.2",
104
+ "@intlayer/api": "8.2.3",
105
+ "@intlayer/config": "8.2.3",
106
+ "@intlayer/core": "8.2.3",
107
+ "@intlayer/dictionaries-entry": "8.2.3",
108
+ "@intlayer/remote-dictionaries-entry": "8.2.3",
109
+ "@intlayer/types": "8.2.3",
110
+ "@intlayer/unmerged-dictionaries-entry": "8.2.3",
111
111
  "chokidar": "3.6.0",
112
112
  "defu": "6.1.4",
113
113
  "fast-glob": "3.3.3",
@@ -116,12 +116,12 @@
116
116
  "zod-to-ts": "2.0.0"
117
117
  },
118
118
  "devDependencies": {
119
- "@types/node": "25.3.3",
119
+ "@types/node": "25.3.5",
120
120
  "@utils/ts-config": "1.0.4",
121
121
  "@utils/ts-config-types": "1.0.4",
122
122
  "@utils/tsdown-config": "1.0.4",
123
123
  "rimraf": "6.1.3",
124
- "tsdown": "0.20.3",
124
+ "tsdown": "0.21.0",
125
125
  "typescript": "5.9.3",
126
126
  "vitest": "4.0.18",
127
127
  "zod": "4.3.6"