@intlayer/config 8.4.2 → 8.4.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 (173) hide show
  1. package/dist/cjs/chunk-Bmb41Sf3.cjs +1 -0
  2. package/dist/cjs/client.cjs +1 -1
  3. package/dist/cjs/colors.cjs +2 -0
  4. package/dist/cjs/colors.cjs.map +1 -0
  5. package/dist/cjs/configFile/buildConfigurationFields.cjs +1 -1
  6. package/dist/cjs/configFile/configurationSchema.cjs +1 -1
  7. package/dist/cjs/configFile/getConfiguration.cjs +1 -1
  8. package/dist/cjs/configFile/searchConfigurationFile.cjs +1 -1
  9. package/dist/cjs/defaultValues/build.cjs +1 -1
  10. package/dist/cjs/defaultValues/build.cjs.map +1 -1
  11. package/dist/cjs/defaultValues/compiler.cjs +1 -1
  12. package/dist/cjs/defaultValues/content.cjs +1 -1
  13. package/dist/cjs/defaultValues/content.cjs.map +1 -1
  14. package/dist/cjs/defaultValues/dictionary.cjs +1 -1
  15. package/dist/cjs/defaultValues/dictionary.cjs.map +1 -1
  16. package/dist/cjs/defaultValues/editor.cjs +1 -1
  17. package/dist/cjs/defaultValues/editor.cjs.map +1 -1
  18. package/dist/cjs/defaultValues/index.cjs +1 -2
  19. package/dist/cjs/defaultValues/internationalization.cjs +1 -1
  20. package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
  21. package/dist/cjs/defaultValues/log.cjs +1 -1
  22. package/dist/cjs/defaultValues/log.cjs.map +1 -1
  23. package/dist/cjs/defaultValues/routing.cjs +1 -1
  24. package/dist/cjs/defaultValues/routing.cjs.map +1 -1
  25. package/dist/cjs/defaultValues/system.cjs +1 -1
  26. package/dist/cjs/defaultValues/system.cjs.map +1 -1
  27. package/dist/cjs/loadEnvFile.cjs +1 -1
  28. package/dist/cjs/loadExternalFile/bundleFile.cjs +1 -1
  29. package/dist/cjs/loadExternalFile/bundleJSFile.cjs +1 -1
  30. package/dist/cjs/loadExternalFile/loadExternalFile.cjs +1 -1
  31. package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -1
  32. package/dist/cjs/loadExternalFile/parseFileContent.cjs +1 -1
  33. package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs +1 -1
  34. package/dist/cjs/logger.cjs +1 -1
  35. package/dist/cjs/logger.cjs.map +1 -1
  36. package/dist/cjs/node.cjs +1 -1
  37. package/dist/cjs/utils/ESMxCJSHelpers.cjs +1 -1
  38. package/dist/cjs/utils/alias.cjs +1 -1
  39. package/dist/cjs/utils/cacheDisk.cjs +1 -1
  40. package/dist/cjs/utils/cacheMemory.cjs +1 -1
  41. package/dist/cjs/utils/getPackageJsonPath.cjs +1 -1
  42. package/dist/cjs/utils/logStack.cjs +1 -1
  43. package/dist/cjs/utils/logStack.cjs.map +1 -1
  44. package/dist/cjs/utils/retryManager.cjs +1 -1
  45. package/dist/esm/ESMxCJSHelpers-BAuqwNXV.mjs +2 -0
  46. package/dist/esm/ESMxCJSHelpers-BAuqwNXV.mjs.map +1 -0
  47. package/dist/esm/client.mjs +1 -1
  48. package/dist/esm/colors.mjs +2 -0
  49. package/dist/esm/colors.mjs.map +1 -0
  50. package/dist/esm/configFile/buildConfigurationFields.mjs +1 -1
  51. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  52. package/dist/esm/configFile/loadConfigurationFile.mjs +1 -1
  53. package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
  54. package/dist/esm/configFile/searchConfigurationFile.mjs +1 -1
  55. package/dist/esm/defaultValues/build.mjs +1 -1
  56. package/dist/esm/defaultValues/build.mjs.map +1 -1
  57. package/dist/esm/defaultValues/compiler.mjs +1 -1
  58. package/dist/esm/defaultValues/compiler.mjs.map +1 -1
  59. package/dist/esm/defaultValues/content.mjs +1 -1
  60. package/dist/esm/defaultValues/content.mjs.map +1 -1
  61. package/dist/esm/defaultValues/dictionary.mjs +1 -1
  62. package/dist/esm/defaultValues/dictionary.mjs.map +1 -1
  63. package/dist/esm/defaultValues/editor.mjs +1 -1
  64. package/dist/esm/defaultValues/editor.mjs.map +1 -1
  65. package/dist/esm/defaultValues/index.mjs +1 -2
  66. package/dist/esm/defaultValues/internationalization.mjs +1 -1
  67. package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
  68. package/dist/esm/defaultValues/log.mjs +1 -1
  69. package/dist/esm/defaultValues/log.mjs.map +1 -1
  70. package/dist/esm/defaultValues/routing.mjs +1 -1
  71. package/dist/esm/defaultValues/routing.mjs.map +1 -1
  72. package/dist/esm/defaultValues/system.mjs +1 -1
  73. package/dist/esm/defaultValues/system.mjs.map +1 -1
  74. package/dist/esm/loadExternalFile/loadExternalFile.mjs +1 -1
  75. package/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -1
  76. package/dist/esm/loadExternalFile/parseFileContent.mjs +1 -1
  77. package/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -1
  78. package/dist/esm/logger.mjs +1 -1
  79. package/dist/esm/logger.mjs.map +1 -1
  80. package/dist/esm/node.mjs +1 -1
  81. package/dist/esm/utils/ESMxCJSHelpers.mjs +1 -2
  82. package/dist/esm/utils/clearModuleCache.mjs +1 -1
  83. package/dist/esm/utils/clearModuleCache.mjs.map +1 -1
  84. package/dist/esm/utils/index.mjs +1 -1
  85. package/dist/esm/utils/logStack.mjs +1 -1
  86. package/dist/esm/utils/logStack.mjs.map +1 -1
  87. package/dist/esm/utils/retryManager.mjs +1 -1
  88. package/dist/types/{camelCaseToKebabCase-91HKVxf2.d.ts → camelCaseToKebabCase-BV_lLJHR.d.ts} +1 -1
  89. package/dist/types/camelCaseToKebabCase-BV_lLJHR.d.ts.map +1 -0
  90. package/dist/types/{camelCaseToSentence-LKuKkD3M.d.ts → camelCaseToSentence-DAbbkwe6.d.ts} +1 -1
  91. package/dist/types/camelCaseToSentence-DAbbkwe6.d.ts.map +1 -0
  92. package/dist/types/client.d.ts +5 -6
  93. package/dist/types/colors-BbZeGWYU.d.ts +20 -0
  94. package/dist/types/colors-BbZeGWYU.d.ts.map +1 -0
  95. package/dist/types/colors.d.ts +2 -0
  96. package/dist/types/configFile/configurationSchema.d.ts +2 -2
  97. package/dist/types/configFile/getConfiguration.d.ts +2 -2
  98. package/dist/types/configFile/loadConfigurationFile.d.ts +1 -1
  99. package/dist/types/defaultValues/build.d.ts +10 -2
  100. package/dist/types/defaultValues/build.d.ts.map +1 -0
  101. package/dist/types/defaultValues/compiler.d.ts +8 -2
  102. package/dist/types/defaultValues/compiler.d.ts.map +1 -0
  103. package/dist/types/defaultValues/content.d.ts +11 -2
  104. package/dist/types/defaultValues/content.d.ts.map +1 -0
  105. package/dist/types/defaultValues/dictionary.d.ts +10 -2
  106. package/dist/types/defaultValues/dictionary.d.ts.map +1 -0
  107. package/dist/types/defaultValues/editor.d.ts +13 -2
  108. package/dist/types/defaultValues/editor.d.ts.map +1 -0
  109. package/dist/types/defaultValues/index.d.ts +10 -17
  110. package/dist/types/defaultValues/internationalization.d.ts +11 -2
  111. package/dist/types/defaultValues/internationalization.d.ts.map +1 -0
  112. package/dist/types/defaultValues/log.d.ts +6 -2
  113. package/dist/types/defaultValues/log.d.ts.map +1 -0
  114. package/dist/types/defaultValues/routing.d.ts +13 -2
  115. package/dist/types/defaultValues/routing.d.ts.map +1 -0
  116. package/dist/types/defaultValues/system.d.ts +16 -2
  117. package/dist/types/defaultValues/system.d.ts.map +1 -0
  118. package/dist/types/{kebabCaseToCamelCase-BR4yfbUC.d.ts → kebabCaseToCamelCase-h9PkNVuO.d.ts} +1 -1
  119. package/dist/types/kebabCaseToCamelCase-h9PkNVuO.d.ts.map +1 -0
  120. package/dist/types/{loadEnvFile-Dk80Swa9.d.ts → loadEnvFile-BiTBX4fe.d.ts} +1 -1
  121. package/dist/types/{loadEnvFile-Dk80Swa9.d.ts.map → loadEnvFile-BiTBX4fe.d.ts.map} +1 -1
  122. package/dist/types/loadEnvFile.d.ts +1 -1
  123. package/dist/types/loadExternalFile/index.d.ts +3 -3
  124. package/dist/types/loadExternalFile/loadExternalFile.d.ts +1 -1
  125. package/dist/types/loadExternalFile/parseFileContent.d.ts +1 -1
  126. package/dist/types/loadExternalFile/transpileTSToCJS.d.ts +1 -1
  127. package/dist/types/{loadExternalFile-CJIPA_rP.d.ts → loadExternalFile-DmM_TGcA.d.ts} +3 -3
  128. package/dist/types/{loadExternalFile-CJIPA_rP.d.ts.map → loadExternalFile-DmM_TGcA.d.ts.map} +1 -1
  129. package/dist/types/logger.d.ts +8 -22
  130. package/dist/types/logger.d.ts.map +1 -1
  131. package/dist/types/node.d.ts +1 -2
  132. package/dist/types/{parseFileContent-CriV5Luv.d.ts → parseFileContent--o_QlW5j.d.ts} +2 -2
  133. package/dist/types/{parseFileContent-CriV5Luv.d.ts.map → parseFileContent--o_QlW5j.d.ts.map} +1 -1
  134. package/dist/types/{toLowerCamelCase-CfYCuChC.d.ts → toLowerCamelCase-DUdT00I1.d.ts} +1 -1
  135. package/dist/types/toLowerCamelCase-DUdT00I1.d.ts.map +1 -0
  136. package/dist/types/{transpileTSToCJS-DxeK5fRY.d.ts → transpileTSToCJS-OifpV3zk.d.ts} +1 -1
  137. package/dist/types/{transpileTSToCJS-DxeK5fRY.d.ts.map → transpileTSToCJS-OifpV3zk.d.ts.map} +1 -1
  138. package/dist/types/utils/index.d.ts +4 -4
  139. package/dist/types/utils/logStack.d.ts.map +1 -1
  140. package/dist/types/utils/stringFormatter/camelCaseToKebabCase.d.ts +1 -1
  141. package/dist/types/utils/stringFormatter/camelCaseToSentence.d.ts +1 -1
  142. package/dist/types/utils/stringFormatter/index.d.ts +4 -4
  143. package/dist/types/utils/stringFormatter/kebabCaseToCamelCase.d.ts +1 -1
  144. package/dist/types/utils/stringFormatter/toLowerCamelCase.d.ts +1 -1
  145. package/package.json +18 -2
  146. package/dist/cjs/chunk-D-qHiVGv.cjs +0 -1
  147. package/dist/cjs/defaultValues/index.cjs.map +0 -1
  148. package/dist/esm/chunk-DXQkyQJp.mjs +0 -1
  149. package/dist/esm/defaultValues/index.mjs.map +0 -1
  150. package/dist/esm/utils/ESMxCJSHelpers.mjs.map +0 -1
  151. package/dist/types/build-BGWWxAP2.d.ts +0 -12
  152. package/dist/types/build-BGWWxAP2.d.ts.map +0 -1
  153. package/dist/types/camelCaseToKebabCase-91HKVxf2.d.ts.map +0 -1
  154. package/dist/types/camelCaseToSentence-LKuKkD3M.d.ts.map +0 -1
  155. package/dist/types/compiler-BKn6YjPf.d.ts +0 -10
  156. package/dist/types/compiler-BKn6YjPf.d.ts.map +0 -1
  157. package/dist/types/content-CEqOvNcs.d.ts +0 -13
  158. package/dist/types/content-CEqOvNcs.d.ts.map +0 -1
  159. package/dist/types/defaultValues/index.d.ts.map +0 -1
  160. package/dist/types/dictionary-n4jBpRU_.d.ts +0 -13
  161. package/dist/types/dictionary-n4jBpRU_.d.ts.map +0 -1
  162. package/dist/types/editor-Bhh3J_sb.d.ts +0 -15
  163. package/dist/types/editor-Bhh3J_sb.d.ts.map +0 -1
  164. package/dist/types/internationalization-0cqNGQ-O.d.ts +0 -14
  165. package/dist/types/internationalization-0cqNGQ-O.d.ts.map +0 -1
  166. package/dist/types/kebabCaseToCamelCase-BR4yfbUC.d.ts.map +0 -1
  167. package/dist/types/log-C5gSYuVB.d.ts +0 -8
  168. package/dist/types/log-C5gSYuVB.d.ts.map +0 -1
  169. package/dist/types/routing-DlVdUHPZ.d.ts +0 -16
  170. package/dist/types/routing-DlVdUHPZ.d.ts.map +0 -1
  171. package/dist/types/system-BFYob741.d.ts +0 -18
  172. package/dist/types/system-BFYob741.d.ts.map +0 -1
  173. package/dist/types/toLowerCamelCase-CfYCuChC.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- import{n as e}from"../chunk-DXQkyQJp.mjs";import{OUTPUT_FORMAT as t,TRAVERSE_PATTERN as n}from"../defaultValues/build.mjs";import"../defaultValues/compiler.mjs";import{CODE_DIR as r,CONTENT_DIR as i,EXCLUDED_PATHS as a,FILE_EXTENSIONS as o}from"../defaultValues/content.mjs";import"../defaultValues/dictionary.mjs";import"../defaultValues/editor.mjs";import{DEFAULT_LOCALE as s,LOCALES as c,REQUIRED_LOCALES as l}from"../defaultValues/internationalization.mjs";import{PREFIX as u}from"../defaultValues/log.mjs";import{STORAGE as d}from"../defaultValues/routing.mjs";import"../defaultValues/system.mjs";import{getProjectRequire as f}from"../utils/ESMxCJSHelpers.mjs";import{statSync as p}from"node:fs";import{dirname as m,isAbsolute as h,join as g}from"node:path";import _ from"@intlayer/types/package.json"with{type:"json"};let v;const y=e=>({locales:e?.locales??c,requiredLocales:e?.requiredLocales??e?.locales??l,strictMode:e?.strictMode??`inclusive`,defaultLocale:e?.defaultLocale??s}),b=e=>({mode:e?.mode??`prefix-no-default`,storage:e?.storage??d,basePath:e?.basePath??``,rewrite:e?.rewrite}),x=(e,t)=>{let n=e??process.cwd(),r=e=>{let t;try{t=f(n).resolve(e,{paths:[n]})}catch{t=h(e)?e:g(n,e)}try{if(p(t).isFile())return m(t)}catch{if(/\.[a-z0-9]+$/i.test(t))return m(t)}return t},i=r(t?.dictionariesDir??`.intlayer/dictionary`);return{baseDir:n,moduleAugmentationDir:r(t?.moduleAugmentationDir??`.intlayer/types`),unmergedDictionariesDir:r(t?.unmergedDictionariesDir??`.intlayer/unmerged_dictionary`),remoteDictionariesDir:r(t?.remoteDictionariesDir??`.intlayer/remote_dictionary`),dictionariesDir:i,dynamicDictionariesDir:r(t?.dynamicDictionariesDir??`.intlayer/dynamic_dictionary`),fetchDictionariesDir:r(t?.fetchDictionariesDir??`.intlayer/fetch_dictionary`),typesDir:r(t?.typesDir??`.intlayer/types`),mainDir:r(t?.mainDir??`.intlayer/main`),configDir:r(t?.configDir??`.intlayer/config`),cacheDir:r(t?.cacheDir??`.intlayer/cache`),tempDir:r(t?.tempDir??`.intlayer/tmp`)}},S=(t,n)=>{let s=n?.fileExtensions??o,c=n=>{let r;try{r=f(t.baseDir).resolve(n,{paths:[t.baseDir]})}catch{try{r=e.resolve(n,{paths:[t.baseDir]})}catch{r=h(n)?n:g(t.baseDir,n)}}try{if(p(r).isFile())return m(r)}catch{if(/\.[a-z0-9]+$/i.test(r))return m(r)}return r};return{fileExtensions:s,contentDir:(n?.contentDir??i).map(c),codeDir:(n?.codeDir??r).map(c),excludedPath:n?.excludedPath??a,watch:n?.watch??!0,formatCommand:n?.formatCommand}},C=e=>({applicationURL:e?.applicationURL||void 0,editorURL:e?.editorURL||`http://localhost:8000`,cmsURL:e?.cmsURL||`https://app.intlayer.org`,backendURL:e?.backendURL||`https://back.intlayer.org`,port:e?.port??8e3,enabled:e?.enabled??!1,clientId:e?.clientId??void 0,clientSecret:e?.clientSecret??void 0,dictionaryPriorityStrategy:e?.dictionaryPriorityStrategy??`local_first`,liveSync:e?.liveSync??!0,liveSyncPort:e?.liveSyncPort??4e3,liveSyncURL:e?.liveSyncURL??`http://localhost:${e?.liveSyncPort??4e3}`}),w=(e,t)=>({mode:e?.mode??`default`,prefix:e?.prefix??u,error:t?.error,log:t?.log,info:t?.info,warn:t?.warn}),T=e=>({provider:e?.provider,apiKey:e?.apiKey,model:e?.model,temperature:e?.temperature,applicationContext:e?.applicationContext,baseURL:e?.baseURL,dataSerialization:e?.dataSerialization}),E=e=>({mode:e?.mode??`auto`,optimize:e?.optimize,importMode:e?.importMode,traversePattern:e?.traversePattern??n,outputFormat:e?.outputFormat??t,cache:e?.cache??!0,require:e?.require,checkTypes:e?.checkTypes??!1}),D=e=>({enabled:e?.enabled??!0,dictionaryKeyPrefix:e?.dictionaryKeyPrefix??``,transformPattern:e?.transformPattern,excludePattern:e?.excludePattern,output:e?.output,noMetadata:e?.noMetadata??!1,saveComponents:e?.saveComponents??!1}),O=e=>{let t=e?.contentAutoTransformation??!1;return{fill:e?.fill??!0,contentAutoTransformation:typeof t==`object`?{markdown:t.markdown??!1,html:t.html??!1,insertion:t.insertion??!1}:t,location:e?.location??`local`,locale:e?.locale,title:e?.title,description:e?.description,tags:e?.tags,priority:e?.priority,importMode:e?.importMode??`static`}},k=(e,t,n)=>{let r=y(e?.internationalization),i=b(e?.routing),a=x(t,e?.system);return v={internationalization:r,routing:i,content:S(a,e?.content),system:a,editor:C(e?.editor),log:w(e?.log,n),ai:T(e?.ai),build:E(e?.build),compiler:D(e?.compiler),dictionary:O(e?.dictionary),plugins:e?.plugins,schemas:e?.schemas,metadata:{name:`Intlayer`,version:_.version,doc:`https://intlayer.org/docs`}},v};export{k as buildConfigurationFields};
1
+ import{i as e,n as t}from"../ESMxCJSHelpers-BAuqwNXV.mjs";import{OUTPUT_FORMAT as n,TRAVERSE_PATTERN as r}from"../defaultValues/build.mjs";import"../defaultValues/compiler.mjs";import{CODE_DIR as i,CONTENT_DIR as a,EXCLUDED_PATHS as o,FILE_EXTENSIONS as s}from"../defaultValues/content.mjs";import"../defaultValues/dictionary.mjs";import"../defaultValues/editor.mjs";import{DEFAULT_LOCALE as c,LOCALES as l,REQUIRED_LOCALES as u}from"../defaultValues/internationalization.mjs";import{PREFIX as d}from"../defaultValues/log.mjs";import{STORAGE as f}from"../defaultValues/routing.mjs";import"../defaultValues/system.mjs";import{statSync as p}from"node:fs";import{dirname as m,isAbsolute as h,join as g}from"node:path";import _ from"@intlayer/types/package.json"with{type:"json"};let v;const y=e=>({locales:e?.locales??l,requiredLocales:e?.requiredLocales??e?.locales??u,strictMode:e?.strictMode??`inclusive`,defaultLocale:e?.defaultLocale??c}),b=e=>({mode:e?.mode??`prefix-no-default`,storage:e?.storage??f,basePath:e?.basePath??``,rewrite:e?.rewrite}),x=(e,n)=>{let r=e??process.cwd(),i=e=>{let n;try{n=t(r).resolve(e,{paths:[r]})}catch{n=h(e)?e:g(r,e)}try{if(p(n).isFile())return m(n)}catch{if(/\.[a-z0-9]+$/i.test(n))return m(n)}return n},a=i(n?.dictionariesDir??`.intlayer/dictionary`);return{baseDir:r,moduleAugmentationDir:i(n?.moduleAugmentationDir??`.intlayer/types`),unmergedDictionariesDir:i(n?.unmergedDictionariesDir??`.intlayer/unmerged_dictionary`),remoteDictionariesDir:i(n?.remoteDictionariesDir??`.intlayer/remote_dictionary`),dictionariesDir:a,dynamicDictionariesDir:i(n?.dynamicDictionariesDir??`.intlayer/dynamic_dictionary`),fetchDictionariesDir:i(n?.fetchDictionariesDir??`.intlayer/fetch_dictionary`),typesDir:i(n?.typesDir??`.intlayer/types`),mainDir:i(n?.mainDir??`.intlayer/main`),configDir:i(n?.configDir??`.intlayer/config`),cacheDir:i(n?.cacheDir??`.intlayer/cache`),tempDir:i(n?.tempDir??`.intlayer/tmp`)}},S=(n,r)=>{let c=r?.fileExtensions??s,l=r=>{let i;try{i=t(n.baseDir).resolve(r,{paths:[n.baseDir]})}catch{try{i=e.resolve(r,{paths:[n.baseDir]})}catch{i=h(r)?r:g(n.baseDir,r)}}try{if(p(i).isFile())return m(i)}catch{if(/\.[a-z0-9]+$/i.test(i))return m(i)}return i};return{fileExtensions:c,contentDir:(r?.contentDir??a).map(l),codeDir:(r?.codeDir??i).map(l),excludedPath:r?.excludedPath??o,watch:r?.watch??!0,formatCommand:r?.formatCommand}},C=e=>({applicationURL:e?.applicationURL||void 0,editorURL:e?.editorURL||`http://localhost:8000`,cmsURL:e?.cmsURL||`https://app.intlayer.org`,backendURL:e?.backendURL||`https://back.intlayer.org`,port:e?.port??8e3,enabled:e?.enabled??!1,clientId:e?.clientId??void 0,clientSecret:e?.clientSecret??void 0,dictionaryPriorityStrategy:e?.dictionaryPriorityStrategy??`local_first`,liveSync:e?.liveSync??!0,liveSyncPort:e?.liveSyncPort??4e3,liveSyncURL:e?.liveSyncURL??`http://localhost:${e?.liveSyncPort??4e3}`}),w=(e,t)=>({mode:e?.mode??`default`,prefix:e?.prefix??d,error:t?.error,log:t?.log,info:t?.info,warn:t?.warn}),T=e=>({provider:e?.provider,apiKey:e?.apiKey,model:e?.model,temperature:e?.temperature,applicationContext:e?.applicationContext,baseURL:e?.baseURL,dataSerialization:e?.dataSerialization}),E=e=>({mode:e?.mode??`auto`,optimize:e?.optimize,importMode:e?.importMode,traversePattern:e?.traversePattern??r,outputFormat:e?.outputFormat??n,cache:e?.cache??!0,require:e?.require,checkTypes:e?.checkTypes??!1}),D=e=>({enabled:e?.enabled??!0,dictionaryKeyPrefix:e?.dictionaryKeyPrefix??``,transformPattern:e?.transformPattern,excludePattern:e?.excludePattern,output:e?.output,noMetadata:e?.noMetadata??!1,saveComponents:e?.saveComponents??!1}),O=e=>{let t=e?.contentAutoTransformation??!1;return{fill:e?.fill??!0,contentAutoTransformation:typeof t==`object`?{markdown:t.markdown??!1,html:t.html??!1,insertion:t.insertion??!1}:t,location:e?.location??`local`,locale:e?.locale,title:e?.title,description:e?.description,tags:e?.tags,priority:e?.priority,importMode:e?.importMode??`static`}},k=(e,t,n)=>{let r=y(e?.internationalization),i=b(e?.routing),a=x(t,e?.system);return v={internationalization:r,routing:i,content:S(a,e?.content),system:a,editor:C(e?.editor),log:w(e?.log,n),ai:T(e?.ai),build:E(e?.build),compiler:D(e?.compiler),dictionary:O(e?.dictionary),plugins:e?.plugins,schemas:e?.schemas,metadata:{name:`Intlayer`,version:_.version,doc:`https://intlayer.org/docs`}},v};export{k as buildConfigurationFields};
2
2
  //# sourceMappingURL=buildConfigurationFields.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildConfigurationFields.mjs","names":[],"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { statSync } from 'node:fs';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport type {\n AiConfig,\n BuildConfig,\n CompilerConfig,\n ContentConfig,\n CustomIntlayerConfig,\n DictionaryConfig,\n EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n LogFunctions,\n RoutingConfig,\n SystemConfig,\n} from '@intlayer/types/config';\nimport packageJson from '@intlayer/types/package.json' with { type: 'json' };\nimport {\n BUILD_MODE,\n CACHE,\n OUTPUT_FORMAT,\n TRAVERSE_PATTERN,\n TYPE_CHECKING,\n} from '../defaultValues/build';\nimport {\n COMPILER_DICTIONARY_KEY_PREFIX,\n COMPILER_ENABLED,\n COMPILER_NO_METADATA,\n COMPILER_SAVE_COMPONENTS,\n} from '../defaultValues/compiler';\nimport {\n CODE_DIR,\n CONTENT_DIR,\n EXCLUDED_PATHS,\n FILE_EXTENSIONS,\n WATCH,\n} from '../defaultValues/content';\nimport {\n CONTENT_AUTO_TRANSFORMATION,\n FILL,\n IMPORT_MODE,\n LOCATION,\n} from '../defaultValues/dictionary';\nimport {\n APPLICATION_URL,\n BACKEND_URL,\n CMS_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n EDITOR_URL,\n IS_ENABLED,\n LIVE_SYNC,\n LIVE_SYNC_PORT,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n REQUIRED_LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport { BASE_PATH, ROUTING_MODE, STORAGE } from '../defaultValues/routing';\nimport {\n CACHE_DIR,\n CONFIG_DIR,\n DICTIONARIES_DIR,\n DYNAMIC_DICTIONARIES_DIR,\n FETCH_DICTIONARIES_DIR,\n MAIN_DIR,\n MODULE_AUGMENTATION_DIR,\n REMOTE_DICTIONARIES_DIR,\n TEMP_DIR,\n TYPES_DIR,\n UNMERGED_DICTIONARIES_DIR,\n} from '../defaultValues/system';\nimport { getProjectRequire } from '../utils';\n\nlet storedConfiguration: IntlayerConfig;\n\nconst buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Locales available in the application\n *\n * Default: ['en']\n *\n */\n locales: customConfiguration?.locales ?? LOCALES,\n\n /**\n * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.\n *\n * Default: []\n *\n * If empty, all locales are required in `strict` mode.\n *\n * Ensure required locales are also defined in the `locales` field.\n */\n requiredLocales:\n customConfiguration?.requiredLocales ??\n customConfiguration?.locales ??\n REQUIRED_LOCALES,\n\n /**\n * Ensure strong implementations of internationalized content using typescript.\n * - If set to \"strict\", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.\n * - If set to \"inclusive\", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.\n * - If set to \"loose\", the translation `t` function will accept any existing locale.\n *\n * Default: \"inclusive\"\n */\n strictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\n /**\n * Default locale of the application for fallback\n *\n * Default: 'en'\n */\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\nconst buildRoutingFields = (\n customConfiguration?: Partial<RoutingConfig>\n): RoutingConfig => ({\n /**\n * URL routing mode for locale handling\n *\n * Controls how locales are represented in application URLs:\n * - 'prefix-no-default': Prefix all locales except the default locale (default)\n * - en → /dashboard\n * - fr → /fr/dashboard\n *\n * - 'prefix-all': Prefix all locales including the default locale\n * - en → /en/dashboard\n * - fr → /fr/dashboard\n *\n * - 'search-params': Use search parameters for locale handling\n * - en → /dashboard?locale=en\n * - fr → /fr/dashboard?locale=fr\n *\n * - 'no-prefix': No locale prefixing in URLs\n * - en → /dashboard\n * - fr → /dashboard\n *\n * Default: 'prefix-no-default'\n */\n mode: customConfiguration?.mode ?? ROUTING_MODE,\n\n /**\n * Configuration for storing the locale in the client (localStorage or sessionStorage)\n *\n * If false, the locale will not be stored by the middleware.\n * If true, the locale storage will consider all default values. (cookie and header)\n *\n * Default: ['cookie', 'header']\n *\n */\n storage: customConfiguration?.storage ?? STORAGE,\n\n /**\n * Base path of the application URL\n *\n * Default: ''\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n */\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n /**\n * Custom URL rewriting rules that override the default routing mode for specific paths.\n * Allows you to define locale-specific paths that differ from the standard routing behavior.\n * Supports dynamic route parameters using `[param]` syntax.\n *\n * Default: undefined\n *\n * Example:\n * ```typescript\n * rewrite: {\n * \"/about\": {\n * en: \"/about\",\n * fr: \"/a-propos\",\n * },\n * \"/product/[slug]\": {\n * en: \"/product/[slug]\",\n * fr: \"/produit/[slug]\",\n * },\n * }\n * ```\n *\n * Note:\n * - The rewrite rules take precedence over the default `mode` behavior.\n * - If a path matches a rewrite rule, the localized path from the rewrite configuration will be used.\n * - Dynamic route parameters are supported using bracket notation (e.g., `[slug]`, `[id]`).\n * - Works with both Next.js and Vite applications.\n */\n rewrite: customConfiguration?.rewrite,\n});\n\nconst buildSystemFields = (\n baseDir?: string,\n customConfiguration?: Partial<SystemConfig>\n): SystemConfig => {\n const projectBaseDir = baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n const requireFunction = getProjectRequire(projectBaseDir);\n\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n const stats = statSync(absolutePath);\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n return absolutePath;\n };\n\n const dictionariesDir = optionalJoinBaseDir(\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n );\n\n return {\n baseDir: projectBaseDir,\n moduleAugmentationDir: optionalJoinBaseDir(\n customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR\n ),\n unmergedDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR\n ),\n remoteDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR\n ),\n dictionariesDir,\n dynamicDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR\n ),\n fetchDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR\n ),\n typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n configDir: optionalJoinBaseDir(\n customConfiguration?.configDir ?? CONFIG_DIR\n ),\n cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR),\n tempDir: optionalJoinBaseDir(customConfiguration?.tempDir ?? TEMP_DIR),\n };\n};\n\nconst buildContentFields = (\n systemConfig: SystemConfig,\n customConfiguration?: Partial<ContentConfig>\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n // Try resolving as a Node module first\n const requireFunction = getProjectRequire(systemConfig.baseDir);\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch {\n try {\n // Fall back to native require.resolve if the custom require fails\n absolutePath = require.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch {\n // If all resolution fails, fall back to standard path joining\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(systemConfig.baseDir, pathInput);\n }\n }\n\n try {\n // Smart Detection: File vs Directory\n const stats = statSync(absolutePath);\n\n // If it resolved to a file (like package.json \"main\" or index.js),\n // we want the FOLDER containing that file.\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n // Safety Fallback:\n // If statSync fails but it looks like a file (has an extension), strip it.\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n // Return the calculated path (usually a directory)\n return absolutePath;\n };\n\n const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n optionalJoinBaseDir\n );\n\n const codeDirInput = customConfiguration?.codeDir;\n\n const codeDir = (codeDirInput ?? CODE_DIR).map(optionalJoinBaseDir);\n\n return {\n fileExtensions,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL || APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL || EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL || CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL || BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: false;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientId: customConfiguration?.clientId ?? undefined,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientSecret: customConfiguration?.clientSecret ?? undefined,\n\n /**\n * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.\n * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.\n *\n * Default: 'local_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.\n * - 'local_first': The first dictionary found in the locale is used.\n * - 'distant_first': The first dictionary found in the distant locales is used.\n */\n dictionaryPriorityStrategy:\n customConfiguration?.dictionaryPriorityStrategy ??\n DICTIONARY_PRIORITY_STRATEGY,\n\n /**\n * Indicates if the application should hot reload the locale configurations when a change is detected.\n * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.\n *\n * The hot reload is only available for clients of the `enterprise` plan.\n *\n * Default: false\n */\n liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\n /**\n * Port of the live sync server\n *\n * Default: 4000\n */\n liveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\n /**\n * URL of the live sync server in case of remote live sync server\n *\n * Default: `http://localhost:${LIVE_SYNC_PORT}`\n */\n liveSyncURL:\n customConfiguration?.liveSyncURL ??\n `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`,\n});\n\nconst buildLogFields = (\n customConfiguration?: Partial<LogConfig>,\n logFunctions?: LogFunctions\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'prefix-no-default'\n *\n * If 'default', the logger is enabled and can be used.\n * If 'verbose', the logger will be enabled and can be used, but will log more information.\n * If 'disabled', the logger is disabled and cannot be used.\n */\n mode: customConfiguration?.mode ?? MODE,\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: customConfiguration?.prefix ?? PREFIX,\n\n /**\n * Functions to log\n */\n error: logFunctions?.error,\n log: logFunctions?.log,\n info: logFunctions?.info,\n warn: logFunctions?.warn,\n});\n\nconst buildAiFields = (customConfiguration?: Partial<AiConfig>): AiConfig => ({\n /**\n * AI configuration\n */\n provider: customConfiguration?.provider,\n\n /**\n * API key\n */\n apiKey: customConfiguration?.apiKey,\n\n /**\n * API model\n */\n model: customConfiguration?.model,\n\n /**\n * Temperature\n */\n temperature: customConfiguration?.temperature,\n\n /**\n * Application context\n *\n * Default: undefined\n *\n * The application context.\n *\n * Example: `'My application context'`\n *\n * Note: Can be used to provide additional context about the application to the AI model. You can add more rules (e.g. \"You should not transform urls\").\n */\n applicationContext: customConfiguration?.applicationContext,\n\n /**\n * Base URL for the AI API\n *\n * Default: undefined\n *\n * The base URL for the AI API.\n *\n * Example: `'http://localhost:5000'`\n *\n * Note: Can be used to point to a local, or custom AI API endpoint.\n */\n baseURL: customConfiguration?.baseURL,\n\n /**\n * Data serialization\n *\n * Options:\n * - \"json\": The industry standard. Highly reliable and structured, but consumes more tokens.\n * - \"toon\": An optimized format designed to reduce token consumption (cost-effective). However, it may slightly increase the risk of output inconsistency compared to standard JSON\n *\n * Default: \"json\"\n */\n dataSerialization: customConfiguration?.dataSerialization,\n});\n\nconst buildBuildFields = (\n customConfiguration?: Partial<BuildConfig>\n): BuildConfig => ({\n /**\n * Indicates the mode of the build\n *\n * Default: 'auto'\n *\n * If 'auto', the build will be enabled automatically when the application is built.\n * If 'manual', the build will be set only when the build command is executed.\n *\n * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.\n */\n mode: customConfiguration?.mode ?? BUILD_MODE,\n\n /**\n * Indicates if the build should be optimized\n *\n * Default: process.env.NODE_ENV === 'production'\n *\n * If true, the build will be optimized.\n * If false, the build will not be optimized.\n *\n * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.\n * All imports will stay as static import to avoid async processing when loading the dictionaries.\n *\n * Note:\n * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.\n * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - In most cases, \"dynamic\" will be used for React applications, \"async\" for Vue.js applications.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n */\n optimize: customConfiguration?.optimize,\n\n /**\n * Indicates the mode of import to use for the dictionaries.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * Live mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as \"dynamic\" mode.\n *\n * Default: \"static\"\n *\n * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.\n *\n * Note:\n * - Dynamic imports rely on Suspense and may slightly impact rendering performance.\n * - If disabled all locales will be loaded at once, even if they are not used.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n * - This option will be ignored if `optimize` is disabled.\n * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.\n * - The \"live\" allows to sync the dictionaries to the live sync server.\n *\n * @deprecated Use `dictionary.importMode` instead.\n */\n importMode: customConfiguration?.importMode,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * Allows to avoid to traverse the code that is not relevant to the optimization.\n * Improve build performance.\n *\n * Default: ['**\\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\\/node_modules/**']\n *\n * Example: `['src/**\\/*.{ts,tsx}', '../ui-library/**\\/*.{ts,tsx}']`\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - Use glob pattern.\n */\n traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\n /**\n * Output format of the dictionaries\n *\n * Can be set on large projects to improve build performance.\n *\n * Default: ['cjs', 'esm']\n *\n * The output format of the dictionaries. It can be either 'cjs' or 'esm'.\n * - 'cjs': The dictionaries are outputted as CommonJS modules.\n * - 'esm': The dictionaries are outputted as ES modules.\n */\n outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\n /**\n * Cache\n */\n cache: customConfiguration?.cache ?? CACHE,\n\n /**\n * Require function\n */\n require: customConfiguration?.require,\n\n /**\n * Indicates if the build should check TypeScript types\n *\n * Default: false\n *\n * If true, the build will check TypeScript types and log errors.\n * Note: This can slow down the build.\n */\n checkTypes: customConfiguration?.checkTypes ?? TYPE_CHECKING,\n});\n\nconst buildCompilerFields = (\n customConfiguration?: Partial<CompilerConfig>\n): CompilerConfig => ({\n /**\n * Indicates if the compiler should be enabled\n */\n enabled: customConfiguration?.enabled ?? COMPILER_ENABLED,\n\n /**\n * Prefix for the extracted dictionary keys\n */\n dictionaryKeyPrefix:\n customConfiguration?.dictionaryKeyPrefix ?? COMPILER_DICTIONARY_KEY_PREFIX,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * @deprecated use build.traversePattern instead\n */\n transformPattern: customConfiguration?.transformPattern,\n\n /**\n * Pattern to exclude from the optimization.\n *\n * @deprecated use build.traversePattern instead\n */\n excludePattern: customConfiguration?.excludePattern,\n\n /**\n * Defines the output files path. Replaces `outputDir`.\n *\n * - `./` paths are resolved relative to the component directory.\n * - `/` paths are resolved relative to the project root (`baseDir`).\n *\n * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.\n *\n * Example:\n * ```ts\n * {\n * // Create Multilingual .content.ts files close to the component\n * output: ({ fileName, extension }) => `./${fileName}${extension}`,\n *\n * // output: './{{fileName}}{{extension}}', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create centralize per-locale JSON at the root of the project\n * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,\n *\n * // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string\n * }\n * ```\n *\n * Variable list:\n * - `fileName`: The name of the file.\n * - `key`: The key of the content.\n * - `locale`: The locale of the content.\n * - `extension`: The extension of the file.\n * - `componentFileName`: The name of the component file.\n * - `componentExtension`: The extension of the component file.\n * - `format`: The format of the dictionary.\n * - `componentFormat`: The format of the component dictionary.\n * - `componentDirPath`: The directory path of the component.\n */\n output: customConfiguration?.output,\n\n /**\n * Indicates if the metadata should be saved in the file.\n *\n * If true, the compiler will not save the metadata of the dictionaries.\n *\n * If true:\n *\n * ```json\n * {\n * \"key\": \"value\"\n * }\n * ```\n *\n * If false:\n *\n * ```json\n * {\n * \"key\": \"value\",\n * \"content\": {\n * \"key\": \"value\"\n * }\n * }\n * ```\n *\n * Default: false\n *\n * Note: Useful if used with loadJSON plugin\n */\n noMetadata: customConfiguration?.noMetadata ?? COMPILER_NO_METADATA,\n\n /**\n * Indicates if the components should be saved after being transformed.\n */\n saveComponents:\n customConfiguration?.saveComponents ?? COMPILER_SAVE_COMPONENTS,\n});\n\nconst buildDictionaryFields = (\n customConfiguration?: Partial<DictionaryConfig>\n): DictionaryConfig => {\n const contentAutoTransformation =\n customConfiguration?.contentAutoTransformation ??\n CONTENT_AUTO_TRANSFORMATION;\n\n return {\n /**\n * Indicate how the dictionary should be filled using AI.\n *\n * Default: `true`\n *\n * - If `true`, will consider the `compiler.output` field.\n * - If `false`, will skip the fill process.\n *\n * - `./` paths are resolved relative to the component directory.\n * - `/` paths are resolved relative to the project root (`baseDir`).\n *\n * - If includes `{{locale}}` variable in the path, will trigger the generation of separate dictionaries per locale.\n *\n * Example:\n * ```ts\n * {\n * // Create Multilingual .content.ts files close to the component\n * fill: ({ fileName, extension }) => `./${fileName}${extension}`,\n *\n * // fill: './{{fileName}}{{extension}}', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create centralize per-locale JSON at the root of the project\n * fill: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,\n *\n * // fill: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create custom output based on the locale\n * fill: {\n * en: ({ key }) => `/locales/en/${key}.content.json`,\n * fr: '/locales/fr/{{key}}.content.json',\n * es: false,\n * de: true,\n * },\n * }\n * ```\n *\n *\n * Variable list:\n * - `fileName`: The name of the file.\n * - `key`: The key of the content.\n * - `locale`: The locale of the content.\n * - `extension`: The extension of the file.\n * - `componentFileName`: The name of the component file.\n * - `componentExtension`: The extension of the component file.\n * - `format`: The format of the dictionary.\n * - `componentFormat`: The format of the component dictionary.\n * - `componentDirPath`: The directory path of the component.\n */\n fill: customConfiguration?.fill ?? FILL,\n\n /**\n * Indicates if the content of the dictionary should be automatically transformed.\n *\n * Default: false\n */\n contentAutoTransformation:\n typeof contentAutoTransformation === 'object'\n ? {\n markdown: contentAutoTransformation.markdown ?? false,\n html: contentAutoTransformation.html ?? false,\n insertion: contentAutoTransformation.insertion ?? false,\n }\n : contentAutoTransformation,\n\n /**\n * The location of the dictionary.\n *\n * Default: 'local'\n */\n location: customConfiguration?.location ?? LOCATION,\n\n /**\n * Transform the dictionary in a per-locale dictionary.\n * Each field declared in a per-locale dictionary will be transformed in a translation node.\n * If missing, the dictionary will be treated as a multilingual dictionary.\n */\n locale: customConfiguration?.locale,\n\n /**\n * The title of the dictionary.\n */\n title: customConfiguration?.title,\n\n /**\n * The description of the dictionary.\n */\n description: customConfiguration?.description,\n\n /**\n * Tags to categorize the dictionaries.\n */\n tags: customConfiguration?.tags,\n\n /**\n * The priority of the dictionary.\n */\n priority: customConfiguration?.priority,\n\n /**\n * Indicates the mode of import to use for the dictionary.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n *\n * Default: 'static'\n */\n importMode: customConfiguration?.importMode ?? IMPORT_MODE,\n };\n};\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string,\n logFunctions?: LogFunctions\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const routingConfig = buildRoutingFields(customConfiguration?.routing);\n\n const systemConfig = buildSystemFields(baseDir, customConfiguration?.system);\n\n const contentConfig = buildContentFields(\n systemConfig,\n customConfiguration?.content\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log, logFunctions);\n\n const aiConfig = buildAiFields(customConfiguration?.ai);\n\n const buildConfig = buildBuildFields(customConfiguration?.build);\n\n const compilerConfig = buildCompilerFields(customConfiguration?.compiler);\n\n const dictionaryConfig = buildDictionaryFields(\n customConfiguration?.dictionary\n );\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n routing: routingConfig,\n content: contentConfig,\n system: systemConfig,\n editor: editorConfig,\n log: logConfig,\n ai: aiConfig,\n build: buildConfig,\n compiler: compilerConfig,\n dictionary: dictionaryConfig,\n plugins: customConfiguration?.plugins,\n schemas: customConfiguration?.schemas,\n metadata: {\n name: 'Intlayer',\n version: packageJson.version,\n doc: `https://intlayer.org/docs`,\n },\n } as IntlayerConfig;\n\n return storedConfiguration;\n};\n"],"mappings":"wzBA8EA,IAAI,EAEJ,MAAM,EACJ,IACgC,CAOhC,QAAS,GAAqB,SAAW,EAWzC,gBACE,GAAqB,iBACrB,GAAqB,SACrB,EAUF,WAAY,GAAqB,YAAA,YAOjC,cAAe,GAAqB,eAAiB,EACtD,EAEK,EACJ,IACmB,CAuBnB,KAAM,GAAqB,MAAA,oBAW3B,QAAS,GAAqB,SAAW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BACN,CACF,CAEM"}
1
+ {"version":3,"file":"buildConfigurationFields.mjs","names":[],"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { statSync } from 'node:fs';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport type {\n AiConfig,\n BuildConfig,\n CompilerConfig,\n ContentConfig,\n CustomIntlayerConfig,\n DictionaryConfig,\n EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n LogFunctions,\n RoutingConfig,\n SystemConfig,\n} from '@intlayer/types/config';\nimport packageJson from '@intlayer/types/package.json' with { type: 'json' };\nimport {\n BUILD_MODE,\n CACHE,\n OUTPUT_FORMAT,\n TRAVERSE_PATTERN,\n TYPE_CHECKING,\n} from '../defaultValues/build';\nimport {\n COMPILER_DICTIONARY_KEY_PREFIX,\n COMPILER_ENABLED,\n COMPILER_NO_METADATA,\n COMPILER_SAVE_COMPONENTS,\n} from '../defaultValues/compiler';\nimport {\n CODE_DIR,\n CONTENT_DIR,\n EXCLUDED_PATHS,\n FILE_EXTENSIONS,\n WATCH,\n} from '../defaultValues/content';\nimport {\n CONTENT_AUTO_TRANSFORMATION,\n FILL,\n IMPORT_MODE,\n LOCATION,\n} from '../defaultValues/dictionary';\nimport {\n APPLICATION_URL,\n BACKEND_URL,\n CMS_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n EDITOR_URL,\n IS_ENABLED,\n LIVE_SYNC,\n LIVE_SYNC_PORT,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n REQUIRED_LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport { BASE_PATH, ROUTING_MODE, STORAGE } from '../defaultValues/routing';\nimport {\n CACHE_DIR,\n CONFIG_DIR,\n DICTIONARIES_DIR,\n DYNAMIC_DICTIONARIES_DIR,\n FETCH_DICTIONARIES_DIR,\n MAIN_DIR,\n MODULE_AUGMENTATION_DIR,\n REMOTE_DICTIONARIES_DIR,\n TEMP_DIR,\n TYPES_DIR,\n UNMERGED_DICTIONARIES_DIR,\n} from '../defaultValues/system';\nimport { getProjectRequire } from '../utils';\n\nlet storedConfiguration: IntlayerConfig;\n\nconst buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Locales available in the application\n *\n * Default: ['en']\n *\n */\n locales: customConfiguration?.locales ?? LOCALES,\n\n /**\n * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.\n *\n * Default: []\n *\n * If empty, all locales are required in `strict` mode.\n *\n * Ensure required locales are also defined in the `locales` field.\n */\n requiredLocales:\n customConfiguration?.requiredLocales ??\n customConfiguration?.locales ??\n REQUIRED_LOCALES,\n\n /**\n * Ensure strong implementations of internationalized content using typescript.\n * - If set to \"strict\", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.\n * - If set to \"inclusive\", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.\n * - If set to \"loose\", the translation `t` function will accept any existing locale.\n *\n * Default: \"inclusive\"\n */\n strictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\n /**\n * Default locale of the application for fallback\n *\n * Default: 'en'\n */\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\nconst buildRoutingFields = (\n customConfiguration?: Partial<RoutingConfig>\n): RoutingConfig => ({\n /**\n * URL routing mode for locale handling\n *\n * Controls how locales are represented in application URLs:\n * - 'prefix-no-default': Prefix all locales except the default locale (default)\n * - en → /dashboard\n * - fr → /fr/dashboard\n *\n * - 'prefix-all': Prefix all locales including the default locale\n * - en → /en/dashboard\n * - fr → /fr/dashboard\n *\n * - 'search-params': Use search parameters for locale handling\n * - en → /dashboard?locale=en\n * - fr → /fr/dashboard?locale=fr\n *\n * - 'no-prefix': No locale prefixing in URLs\n * - en → /dashboard\n * - fr → /dashboard\n *\n * Default: 'prefix-no-default'\n */\n mode: customConfiguration?.mode ?? ROUTING_MODE,\n\n /**\n * Configuration for storing the locale in the client (localStorage or sessionStorage)\n *\n * If false, the locale will not be stored by the middleware.\n * If true, the locale storage will consider all default values. (cookie and header)\n *\n * Default: ['cookie', 'header']\n *\n */\n storage: customConfiguration?.storage ?? STORAGE,\n\n /**\n * Base path of the application URL\n *\n * Default: ''\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n */\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n /**\n * Custom URL rewriting rules that override the default routing mode for specific paths.\n * Allows you to define locale-specific paths that differ from the standard routing behavior.\n * Supports dynamic route parameters using `[param]` syntax.\n *\n * Default: undefined\n *\n * Example:\n * ```typescript\n * rewrite: {\n * \"/about\": {\n * en: \"/about\",\n * fr: \"/a-propos\",\n * },\n * \"/product/[slug]\": {\n * en: \"/product/[slug]\",\n * fr: \"/produit/[slug]\",\n * },\n * }\n * ```\n *\n * Note:\n * - The rewrite rules take precedence over the default `mode` behavior.\n * - If a path matches a rewrite rule, the localized path from the rewrite configuration will be used.\n * - Dynamic route parameters are supported using bracket notation (e.g., `[slug]`, `[id]`).\n * - Works with both Next.js and Vite applications.\n */\n rewrite: customConfiguration?.rewrite,\n});\n\nconst buildSystemFields = (\n baseDir?: string,\n customConfiguration?: Partial<SystemConfig>\n): SystemConfig => {\n const projectBaseDir = baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n const requireFunction = getProjectRequire(projectBaseDir);\n\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n const stats = statSync(absolutePath);\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n return absolutePath;\n };\n\n const dictionariesDir = optionalJoinBaseDir(\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n );\n\n return {\n baseDir: projectBaseDir,\n moduleAugmentationDir: optionalJoinBaseDir(\n customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR\n ),\n unmergedDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR\n ),\n remoteDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR\n ),\n dictionariesDir,\n dynamicDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR\n ),\n fetchDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR\n ),\n typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n configDir: optionalJoinBaseDir(\n customConfiguration?.configDir ?? CONFIG_DIR\n ),\n cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR),\n tempDir: optionalJoinBaseDir(customConfiguration?.tempDir ?? TEMP_DIR),\n };\n};\n\nconst buildContentFields = (\n systemConfig: SystemConfig,\n customConfiguration?: Partial<ContentConfig>\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n // Try resolving as a Node module first\n const requireFunction = getProjectRequire(systemConfig.baseDir);\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch {\n try {\n // Fall back to native require.resolve if the custom require fails\n absolutePath = require.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch {\n // If all resolution fails, fall back to standard path joining\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(systemConfig.baseDir, pathInput);\n }\n }\n\n try {\n // Smart Detection: File vs Directory\n const stats = statSync(absolutePath);\n\n // If it resolved to a file (like package.json \"main\" or index.js),\n // we want the FOLDER containing that file.\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n // Safety Fallback:\n // If statSync fails but it looks like a file (has an extension), strip it.\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n // Return the calculated path (usually a directory)\n return absolutePath;\n };\n\n const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n optionalJoinBaseDir\n );\n\n const codeDirInput = customConfiguration?.codeDir;\n\n const codeDir = (codeDirInput ?? CODE_DIR).map(optionalJoinBaseDir);\n\n return {\n fileExtensions,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL || APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL || EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL || CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL || BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: false;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientId: customConfiguration?.clientId ?? undefined,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientSecret: customConfiguration?.clientSecret ?? undefined,\n\n /**\n * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.\n * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.\n *\n * Default: 'local_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.\n * - 'local_first': The first dictionary found in the locale is used.\n * - 'distant_first': The first dictionary found in the distant locales is used.\n */\n dictionaryPriorityStrategy:\n customConfiguration?.dictionaryPriorityStrategy ??\n DICTIONARY_PRIORITY_STRATEGY,\n\n /**\n * Indicates if the application should hot reload the locale configurations when a change is detected.\n * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.\n *\n * The hot reload is only available for clients of the `enterprise` plan.\n *\n * Default: false\n */\n liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\n /**\n * Port of the live sync server\n *\n * Default: 4000\n */\n liveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\n /**\n * URL of the live sync server in case of remote live sync server\n *\n * Default: `http://localhost:${LIVE_SYNC_PORT}`\n */\n liveSyncURL:\n customConfiguration?.liveSyncURL ??\n `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`,\n});\n\nconst buildLogFields = (\n customConfiguration?: Partial<LogConfig>,\n logFunctions?: LogFunctions\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'prefix-no-default'\n *\n * If 'default', the logger is enabled and can be used.\n * If 'verbose', the logger will be enabled and can be used, but will log more information.\n * If 'disabled', the logger is disabled and cannot be used.\n */\n mode: customConfiguration?.mode ?? MODE,\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: customConfiguration?.prefix ?? PREFIX,\n\n /**\n * Functions to log\n */\n error: logFunctions?.error,\n log: logFunctions?.log,\n info: logFunctions?.info,\n warn: logFunctions?.warn,\n});\n\nconst buildAiFields = (customConfiguration?: Partial<AiConfig>): AiConfig => ({\n /**\n * AI configuration\n */\n provider: customConfiguration?.provider,\n\n /**\n * API key\n */\n apiKey: customConfiguration?.apiKey,\n\n /**\n * API model\n */\n model: customConfiguration?.model,\n\n /**\n * Temperature\n */\n temperature: customConfiguration?.temperature,\n\n /**\n * Application context\n *\n * Default: undefined\n *\n * The application context.\n *\n * Example: `'My application context'`\n *\n * Note: Can be used to provide additional context about the application to the AI model. You can add more rules (e.g. \"You should not transform urls\").\n */\n applicationContext: customConfiguration?.applicationContext,\n\n /**\n * Base URL for the AI API\n *\n * Default: undefined\n *\n * The base URL for the AI API.\n *\n * Example: `'http://localhost:5000'`\n *\n * Note: Can be used to point to a local, or custom AI API endpoint.\n */\n baseURL: customConfiguration?.baseURL,\n\n /**\n * Data serialization\n *\n * Options:\n * - \"json\": The industry standard. Highly reliable and structured, but consumes more tokens.\n * - \"toon\": An optimized format designed to reduce token consumption (cost-effective). However, it may slightly increase the risk of output inconsistency compared to standard JSON\n *\n * Default: \"json\"\n */\n dataSerialization: customConfiguration?.dataSerialization,\n});\n\nconst buildBuildFields = (\n customConfiguration?: Partial<BuildConfig>\n): BuildConfig => ({\n /**\n * Indicates the mode of the build\n *\n * Default: 'auto'\n *\n * If 'auto', the build will be enabled automatically when the application is built.\n * If 'manual', the build will be set only when the build command is executed.\n *\n * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.\n */\n mode: customConfiguration?.mode ?? BUILD_MODE,\n\n /**\n * Indicates if the build should be optimized\n *\n * Default: process.env.NODE_ENV === 'production'\n *\n * If true, the build will be optimized.\n * If false, the build will not be optimized.\n *\n * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.\n * All imports will stay as static import to avoid async processing when loading the dictionaries.\n *\n * Note:\n * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.\n * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - In most cases, \"dynamic\" will be used for React applications, \"async\" for Vue.js applications.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n */\n optimize: customConfiguration?.optimize,\n\n /**\n * Indicates the mode of import to use for the dictionaries.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * Live mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as \"dynamic\" mode.\n *\n * Default: \"static\"\n *\n * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.\n *\n * Note:\n * - Dynamic imports rely on Suspense and may slightly impact rendering performance.\n * - If disabled all locales will be loaded at once, even if they are not used.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n * - This option will be ignored if `optimize` is disabled.\n * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.\n * - The \"live\" allows to sync the dictionaries to the live sync server.\n *\n * @deprecated Use `dictionary.importMode` instead.\n */\n importMode: customConfiguration?.importMode,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * Allows to avoid to traverse the code that is not relevant to the optimization.\n * Improve build performance.\n *\n * Default: ['**\\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\\/node_modules/**']\n *\n * Example: `['src/**\\/*.{ts,tsx}', '../ui-library/**\\/*.{ts,tsx}']`\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - Use glob pattern.\n */\n traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\n /**\n * Output format of the dictionaries\n *\n * Can be set on large projects to improve build performance.\n *\n * Default: ['cjs', 'esm']\n *\n * The output format of the dictionaries. It can be either 'cjs' or 'esm'.\n * - 'cjs': The dictionaries are outputted as CommonJS modules.\n * - 'esm': The dictionaries are outputted as ES modules.\n */\n outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\n /**\n * Cache\n */\n cache: customConfiguration?.cache ?? CACHE,\n\n /**\n * Require function\n */\n require: customConfiguration?.require,\n\n /**\n * Indicates if the build should check TypeScript types\n *\n * Default: false\n *\n * If true, the build will check TypeScript types and log errors.\n * Note: This can slow down the build.\n */\n checkTypes: customConfiguration?.checkTypes ?? TYPE_CHECKING,\n});\n\nconst buildCompilerFields = (\n customConfiguration?: Partial<CompilerConfig>\n): CompilerConfig => ({\n /**\n * Indicates if the compiler should be enabled\n */\n enabled: customConfiguration?.enabled ?? COMPILER_ENABLED,\n\n /**\n * Prefix for the extracted dictionary keys\n */\n dictionaryKeyPrefix:\n customConfiguration?.dictionaryKeyPrefix ?? COMPILER_DICTIONARY_KEY_PREFIX,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * @deprecated use build.traversePattern instead\n */\n transformPattern: customConfiguration?.transformPattern,\n\n /**\n * Pattern to exclude from the optimization.\n *\n * @deprecated use build.traversePattern instead\n */\n excludePattern: customConfiguration?.excludePattern,\n\n /**\n * Defines the output files path. Replaces `outputDir`.\n *\n * - `./` paths are resolved relative to the component directory.\n * - `/` paths are resolved relative to the project root (`baseDir`).\n *\n * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.\n *\n * Example:\n * ```ts\n * {\n * // Create Multilingual .content.ts files close to the component\n * output: ({ fileName, extension }) => `./${fileName}${extension}`,\n *\n * // output: './{{fileName}}{{extension}}', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create centralize per-locale JSON at the root of the project\n * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,\n *\n * // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string\n * }\n * ```\n *\n * Variable list:\n * - `fileName`: The name of the file.\n * - `key`: The key of the content.\n * - `locale`: The locale of the content.\n * - `extension`: The extension of the file.\n * - `componentFileName`: The name of the component file.\n * - `componentExtension`: The extension of the component file.\n * - `format`: The format of the dictionary.\n * - `componentFormat`: The format of the component dictionary.\n * - `componentDirPath`: The directory path of the component.\n */\n output: customConfiguration?.output,\n\n /**\n * Indicates if the metadata should be saved in the file.\n *\n * If true, the compiler will not save the metadata of the dictionaries.\n *\n * If true:\n *\n * ```json\n * {\n * \"key\": \"value\"\n * }\n * ```\n *\n * If false:\n *\n * ```json\n * {\n * \"key\": \"value\",\n * \"content\": {\n * \"key\": \"value\"\n * }\n * }\n * ```\n *\n * Default: false\n *\n * Note: Useful if used with loadJSON plugin\n */\n noMetadata: customConfiguration?.noMetadata ?? COMPILER_NO_METADATA,\n\n /**\n * Indicates if the components should be saved after being transformed.\n */\n saveComponents:\n customConfiguration?.saveComponents ?? COMPILER_SAVE_COMPONENTS,\n});\n\nconst buildDictionaryFields = (\n customConfiguration?: Partial<DictionaryConfig>\n): DictionaryConfig => {\n const contentAutoTransformation =\n customConfiguration?.contentAutoTransformation ??\n CONTENT_AUTO_TRANSFORMATION;\n\n return {\n /**\n * Indicate how the dictionary should be filled using AI.\n *\n * Default: `true`\n *\n * - If `true`, will consider the `compiler.output` field.\n * - If `false`, will skip the fill process.\n *\n * - `./` paths are resolved relative to the component directory.\n * - `/` paths are resolved relative to the project root (`baseDir`).\n *\n * - If includes `{{locale}}` variable in the path, will trigger the generation of separate dictionaries per locale.\n *\n * Example:\n * ```ts\n * {\n * // Create Multilingual .content.ts files close to the component\n * fill: ({ fileName, extension }) => `./${fileName}${extension}`,\n *\n * // fill: './{{fileName}}{{extension}}', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create centralize per-locale JSON at the root of the project\n * fill: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,\n *\n * // fill: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create custom output based on the locale\n * fill: {\n * en: ({ key }) => `/locales/en/${key}.content.json`,\n * fr: '/locales/fr/{{key}}.content.json',\n * es: false,\n * de: true,\n * },\n * }\n * ```\n *\n *\n * Variable list:\n * - `fileName`: The name of the file.\n * - `key`: The key of the content.\n * - `locale`: The locale of the content.\n * - `extension`: The extension of the file.\n * - `componentFileName`: The name of the component file.\n * - `componentExtension`: The extension of the component file.\n * - `format`: The format of the dictionary.\n * - `componentFormat`: The format of the component dictionary.\n * - `componentDirPath`: The directory path of the component.\n */\n fill: customConfiguration?.fill ?? FILL,\n\n /**\n * Indicates if the content of the dictionary should be automatically transformed.\n *\n * Default: false\n */\n contentAutoTransformation:\n typeof contentAutoTransformation === 'object'\n ? {\n markdown: contentAutoTransformation.markdown ?? false,\n html: contentAutoTransformation.html ?? false,\n insertion: contentAutoTransformation.insertion ?? false,\n }\n : contentAutoTransformation,\n\n /**\n * The location of the dictionary.\n *\n * Default: 'local'\n */\n location: customConfiguration?.location ?? LOCATION,\n\n /**\n * Transform the dictionary in a per-locale dictionary.\n * Each field declared in a per-locale dictionary will be transformed in a translation node.\n * If missing, the dictionary will be treated as a multilingual dictionary.\n */\n locale: customConfiguration?.locale,\n\n /**\n * The title of the dictionary.\n */\n title: customConfiguration?.title,\n\n /**\n * The description of the dictionary.\n */\n description: customConfiguration?.description,\n\n /**\n * Tags to categorize the dictionaries.\n */\n tags: customConfiguration?.tags,\n\n /**\n * The priority of the dictionary.\n */\n priority: customConfiguration?.priority,\n\n /**\n * Indicates the mode of import to use for the dictionary.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n *\n * Default: 'static'\n */\n importMode: customConfiguration?.importMode ?? IMPORT_MODE,\n };\n};\n\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string,\n logFunctions?: LogFunctions\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const routingConfig = buildRoutingFields(customConfiguration?.routing);\n\n const systemConfig = buildSystemFields(baseDir, customConfiguration?.system);\n\n const contentConfig = buildContentFields(\n systemConfig,\n customConfiguration?.content\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log, logFunctions);\n\n const aiConfig = buildAiFields(customConfiguration?.ai);\n\n const buildConfig = buildBuildFields(customConfiguration?.build);\n\n const compilerConfig = buildCompilerFields(customConfiguration?.compiler);\n\n const dictionaryConfig = buildDictionaryFields(\n customConfiguration?.dictionary\n );\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n routing: routingConfig,\n content: contentConfig,\n system: systemConfig,\n editor: editorConfig,\n log: logConfig,\n ai: aiConfig,\n build: buildConfig,\n compiler: compilerConfig,\n dictionary: dictionaryConfig,\n plugins: customConfiguration?.plugins,\n schemas: customConfiguration?.schemas,\n metadata: {\n name: 'Intlayer',\n version: packageJson.version,\n doc: `https://intlayer.org/docs`,\n },\n } as IntlayerConfig;\n\n return storedConfiguration;\n};\n"],"mappings":"wwBA8EA,IAAI,EAEJ,MAAM,EACJ,IACgC,CAOhC,QAAS,GAAqB,SAAW,EAWzC,gBACE,GAAqB,iBACrB,GAAqB,SACrB,EAUF,WAAY,GAAqB,YAAA,YAOjC,cAAe,GAAqB,eAAiB,EACtD,EAEK,EACJ,IACmB,CAuBnB,KAAM,GAAqB,MAAA,oBAW3B,QAAS,GAAqB,SAAW,EAazC,SAAU,GAAqB,UAAA,GA6B/B,QAAS,GAAqB,QAC/B,EAEK,GACJ,EACA,IACiB,CACjB,IAAM,EAAiB,GAAW,QAAQ,KAAK,CAEzC,EAAuB,GAAsB,CACjD,IAAI,EAEJ,GAAI,CAGF,EAFwB,EAAkB,EAAe,CAE1B,QAAQ,EAAW,CAChD,MAAO,CAAC,EAAe,CACxB,CAAC,MACI,CACN,EAAe,EAAW,EAAU,CAChC,EACA,EAAK,EAAgB,EAAU,CAGrC,GAAI,CAEF,GADc,EAAS,EAAa,CAC1B,QAAQ,CAChB,OAAO,EAAQ,EAAa,MAExB,CACN,GAAI,gBAAgB,KAAK,EAAa,CACpC,OAAO,EAAQ,EAAa,CAIhC,OAAO,GAGH,EAAkB,EACtB,GAAqB,iBAAA,uBACtB,CAED,MAAO,CACL,QAAS,EACT,sBAAuB,EACrB,GAAqB,uBAAA,kBACtB,CACD,wBAAyB,EACvB,GAAqB,yBAAA,gCACtB,CACD,sBAAuB,EACrB,GAAqB,uBAAA,8BACtB,CACD,kBACA,uBAAwB,EACtB,GAAqB,wBAAA,+BACtB,CACD,qBAAsB,EACpB,GAAqB,sBAAA,6BACtB,CACD,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AqB,qBACtB,CAEK,EAAgB,EAAmB,GAAqB,QAAQ,CAEhE,EAAe,EAAkB,EAAS,GAAqB,OAAO,CAyC5E,MApBA,GAAsB,CACpB,qBAAsB,EACtB,QAAS,EACT,QAtBoB,EACpB,EACA,GAAqB,QACtB,CAoBC,OAAQ,EACR,OAnBmB,EAAkB,GAAqB,OAAO,CAoBjE,IAlBgB,EAAe,GAAqB,IAAK,EAAa,CAmBtE,GAjBe,EAAc,GAAqB,GAAG,CAkBrD,MAhBkB,EAAiB,GAAqB,MAAM,CAiB9D,SAfqB,EAAoB,GAAqB,SAAS,CAgBvE,WAduB,EACvB,GAAqB,WACtB,CAaC,QAAS,GAAqB,QAC9B,QAAS,GAAqB,QAC9B,SAAU,CACR,KAAM,WACN,QAAS,EAAY,QACrB,IAAK,4BACN,CACF,CAEM"}
@@ -1,2 +1,2 @@
1
- import{configESMxCJSRequire as e}from"../utils/ESMxCJSHelpers.mjs";import{loadExternalFileSync as t}from"../loadExternalFile/loadExternalFile.mjs";const n=t=>{try{return{...t?.aliases,intlayer:e.resolve(`@intlayer/types`)}}catch{return t?.aliases}},r=(e,r)=>t(e,{...r,aliases:n(r)});export{r as loadConfigurationFile};
1
+ import{t as e}from"../ESMxCJSHelpers-BAuqwNXV.mjs";import{loadExternalFileSync as t}from"../loadExternalFile/loadExternalFile.mjs";const n=t=>{try{return{...t?.aliases,intlayer:e.resolve(`@intlayer/types`)}}catch{return t?.aliases}},r=(e,r)=>t(e,{...r,aliases:n(r)});export{r as loadConfigurationFile};
2
2
  //# sourceMappingURL=loadConfigurationFile.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadConfigurationFile.mjs","names":[],"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport {\n type LoadExternalFileOptions,\n loadExternalFileSync,\n} from '../loadExternalFile/loadExternalFile';\nimport { configESMxCJSRequire } from '../utils/ESMxCJSHelpers';\n\nconst getAliases = (\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n) => {\n // Can fail if CJS hot removed from the module (e.g. in Tanstack Start + Nitro)\n try {\n return {\n ...options?.aliases,\n // Replace intlayer with @intlayer/types to avoid circular dependency intlayer -> @intlayer/config -> intlayer\n intlayer: configESMxCJSRequire.resolve('@intlayer/types'),\n };\n } catch {\n return options?.aliases;\n }\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n configFilePath: string,\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n): CustomIntlayerConfig | undefined => {\n const fileContent = loadExternalFileSync(configFilePath, {\n ...options,\n aliases: getAliases(options),\n });\n\n return fileContent;\n};\n"],"mappings":"mJAOA,MAAM,EACJ,GACG,CAEH,GAAI,CACF,MAAO,CACL,GAAG,GAAS,QAEZ,SAAU,EAAqB,QAAQ,kBAAkB,CAC1D,MACK,CACN,OAAO,GAAS,UAUP,GACX,EACA,IAEoB,EAAqB,EAAgB,CACvD,GAAG,EACH,QAAS,EAAW,EAAQ,CAC7B,CAAC"}
1
+ {"version":3,"file":"loadConfigurationFile.mjs","names":[],"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport {\n type LoadExternalFileOptions,\n loadExternalFileSync,\n} from '../loadExternalFile/loadExternalFile';\nimport { configESMxCJSRequire } from '../utils/ESMxCJSHelpers';\n\nconst getAliases = (\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n) => {\n // Can fail if CJS hot removed from the module (e.g. in Tanstack Start + Nitro)\n try {\n return {\n ...options?.aliases,\n // Replace intlayer with @intlayer/types to avoid circular dependency intlayer -> @intlayer/config -> intlayer\n intlayer: configESMxCJSRequire.resolve('@intlayer/types'),\n };\n } catch {\n return options?.aliases;\n }\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n configFilePath: string,\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n): CustomIntlayerConfig | undefined => {\n const fileContent = loadExternalFileSync(configFilePath, {\n ...options,\n aliases: getAliases(options),\n });\n\n return fileContent;\n};\n"],"mappings":"mIAOA,MAAM,EACJ,GACG,CAEH,GAAI,CACF,MAAO,CACL,GAAG,GAAS,QAEZ,SAAU,EAAqB,QAAQ,kBAAkB,CAC1D,MACK,CACN,OAAO,GAAS,UAUP,GACX,EACA,IAEoB,EAAqB,EAAgB,CACvD,GAAG,EACH,QAAS,EAAW,EAAQ,CAC7B,CAAC"}
@@ -1,2 +1,2 @@
1
- import{logger as e}from"../logger.mjs";import{getPackageJsonPath as t}from"../utils/getPackageJsonPath.mjs";import{existsSync as n}from"node:fs";import{resolve as r}from"node:path";const i=[`intlayer.config.ts`,`intlayer.config.js`,`intlayer.config.json`,`intlayer.config.json5`,`intlayer.config.jsonc`,`intlayer.config.cjs`,`intlayer.config.mjs`,`.intlayerrc`],a=new Map,o=o=>{let s,c=0;if(a.has(o))return a.get(o);let{baseDir:l}=t(o);for(let t of i)try{let e=r(l,t);n(e)&&(c+=1,s||=e)}catch(n){e(`${t}: ${n}`,{level:`error`})}return{configurationFilePath:s,numCustomConfiguration:c}};export{i as configurationFilesCandidates,o as searchConfigurationFile};
1
+ import{getPackageJsonPath as e}from"../utils/getPackageJsonPath.mjs";import{logger as t}from"../logger.mjs";import{existsSync as n}from"node:fs";import{resolve as r}from"node:path";const i=[`intlayer.config.ts`,`intlayer.config.js`,`intlayer.config.json`,`intlayer.config.json5`,`intlayer.config.jsonc`,`intlayer.config.cjs`,`intlayer.config.mjs`,`.intlayerrc`],a=new Map,o=o=>{let s,c=0;if(a.has(o))return a.get(o);let{baseDir:l}=e(o);for(let e of i)try{let t=r(l,e);n(t)&&(c+=1,s||=t)}catch(n){t(`${e}: ${n}`,{level:`error`})}return{configurationFilePath:s,numCustomConfiguration:c}};export{i as configurationFilesCandidates,o as searchConfigurationFile};
2
2
  //# sourceMappingURL=searchConfigurationFile.mjs.map
@@ -1,2 +1,2 @@
1
- import{t as e}from"../chunk-DXQkyQJp.mjs";var t=e({BUILD_MODE:()=>n,CACHE:()=>!0,OPTIMIZE:()=>void 0,OUTPUT_FORMAT:()=>a,TRAVERSE_PATTERN:()=>i,TYPE_CHECKING:()=>!1});const n=`auto`,r=void 0,i=[`**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}`,`!**/node_modules/**`,`!**/dist/**`,`!**/build/**`,`!**/.intlayer/**`,`!**/.next/**`,`!**/.nuxt/**`,`!**/.expo/**`,`!**/.vercel/**`,`!**/.turbo/**`,`!**/.tanstack/**`,`!**/*.config.*`,`!**/*.test.*`,`!**/*.spec.*`,`!**/*.stories.*`,`!**/*.d.ts`,`!**/*.d.ts.map`],a=[`esm`,`cjs`],o=!0,s=!1;export{n as BUILD_MODE,o as CACHE,r as OPTIMIZE,a as OUTPUT_FORMAT,i as TRAVERSE_PATTERN,s as TYPE_CHECKING,t};
1
+ const e=`auto`,t=void 0,n=[`**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}`,`!**/node_modules/**`,`!**/dist/**`,`!**/build/**`,`!**/.intlayer/**`,`!**/.next/**`,`!**/.nuxt/**`,`!**/.expo/**`,`!**/.vercel/**`,`!**/.turbo/**`,`!**/.tanstack/**`,`!**/*.config.*`,`!**/*.test.*`,`!**/*.spec.*`,`!**/*.stories.*`,`!**/*.d.ts`,`!**/*.d.ts.map`],r=[`esm`,`cjs`],i=!0,a=!1;export{e as BUILD_MODE,i as CACHE,t as OPTIMIZE,r as OUTPUT_FORMAT,n as TRAVERSE_PATTERN,a as TYPE_CHECKING};
2
2
  //# sourceMappingURL=build.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.mjs","names":[],"sources":["../../../src/defaultValues/build.ts"],"sourcesContent":["export const BUILD_MODE = 'auto';\n\nexport const OPTIMIZE = undefined;\n\nexport const TRAVERSE_PATTERN = [\n '**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}',\n\n '!**/node_modules/**',\n '!**/dist/**',\n '!**/build/**',\n '!**/.intlayer/**',\n '!**/.next/**',\n '!**/.nuxt/**',\n '!**/.expo/**',\n '!**/.vercel/**',\n '!**/.turbo/**',\n '!**/.tanstack/**',\n\n '!**/*.config.*',\n '!**/*.test.*',\n '!**/*.spec.*',\n '!**/*.stories.*',\n '!**/*.d.ts',\n '!**/*.d.ts.map',\n];\n\nexport const OUTPUT_FORMAT: ('cjs' | 'esm')[] = ['esm', 'cjs'];\n\nexport const CACHE = true;\n\nexport const TYPE_CHECKING = false;\n"],"mappings":"uKAAA,MAAa,EAAa,OAEb,EAAW,IAAA,GAEX,EAAmB,CAC9B,+CAEA,sBACA,cACA,eACA,mBACA,eACA,eACA,eACA,iBACA,gBACA,mBAEA,iBACA,eACA,eACA,kBACA,aACA,iBACD,CAEY,EAAmC,CAAC,MAAO,MAAM,CAEjD,EAAQ,GAER,EAAgB"}
1
+ {"version":3,"file":"build.mjs","names":[],"sources":["../../../src/defaultValues/build.ts"],"sourcesContent":["export const BUILD_MODE = 'auto';\n\nexport const OPTIMIZE = undefined;\n\nexport const TRAVERSE_PATTERN = [\n '**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}',\n\n '!**/node_modules/**',\n '!**/dist/**',\n '!**/build/**',\n '!**/.intlayer/**',\n '!**/.next/**',\n '!**/.nuxt/**',\n '!**/.expo/**',\n '!**/.vercel/**',\n '!**/.turbo/**',\n '!**/.tanstack/**',\n\n '!**/*.config.*',\n '!**/*.test.*',\n '!**/*.spec.*',\n '!**/*.stories.*',\n '!**/*.d.ts',\n '!**/*.d.ts.map',\n];\n\nexport const OUTPUT_FORMAT: ('cjs' | 'esm')[] = ['esm', 'cjs'];\n\nexport const CACHE = true;\n\nexport const TYPE_CHECKING = false;\n"],"mappings":"AAAA,MAAa,EAAa,OAEb,EAAW,IAAA,GAEX,EAAmB,CAC9B,+CAEA,sBACA,cACA,eACA,mBACA,eACA,eACA,eACA,iBACA,gBACA,mBAEA,iBACA,eACA,eACA,kBACA,aACA,iBACD,CAEY,EAAmC,CAAC,MAAO,MAAM,CAEjD,EAAQ,GAER,EAAgB"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"../chunk-DXQkyQJp.mjs";var t=e({COMPILER_DICTIONARY_KEY_PREFIX:()=>``,COMPILER_ENABLED:()=>!0,COMPILER_NO_METADATA:()=>!1,COMPILER_SAVE_COMPONENTS:()=>!1});const n=!0,r=``,i=!1,a=!1;export{r as COMPILER_DICTIONARY_KEY_PREFIX,n as COMPILER_ENABLED,i as COMPILER_NO_METADATA,a as COMPILER_SAVE_COMPONENTS,t};
1
+ const e=!0,t=``,n=!1,r=!1;export{t as COMPILER_DICTIONARY_KEY_PREFIX,e as COMPILER_ENABLED,n as COMPILER_NO_METADATA,r as COMPILER_SAVE_COMPONENTS};
2
2
  //# sourceMappingURL=compiler.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"compiler.mjs","names":[],"sources":["../../../src/defaultValues/compiler.ts"],"sourcesContent":["export const COMPILER_ENABLED = true;\n\nexport const COMPILER_DICTIONARY_KEY_PREFIX = '';\n\nexport const COMPILER_NO_METADATA = false;\n\nexport const COMPILER_SAVE_COMPONENTS = false;\n"],"mappings":"+KAAA,MAAa,EAAmB,GAEnB,EAAiC,GAEjC,EAAuB,GAEvB,EAA2B"}
1
+ {"version":3,"file":"compiler.mjs","names":[],"sources":["../../../src/defaultValues/compiler.ts"],"sourcesContent":["export const COMPILER_ENABLED = true;\n\nexport const COMPILER_DICTIONARY_KEY_PREFIX = '';\n\nexport const COMPILER_NO_METADATA = false;\n\nexport const COMPILER_SAVE_COMPONENTS = false;\n"],"mappings":"AAAA,MAAa,EAAmB,GAEnB,EAAiC,GAEjC,EAAuB,GAEvB,EAA2B"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"../chunk-DXQkyQJp.mjs";var t=e({CODE_DIR:()=>a,CONTENT_DIR:()=>i,EXCLUDED_PATHS:()=>r,FILE_EXTENSIONS:()=>n,I18NEXT_DICTIONARIES_DIR:()=>o,REACT_INTL_MESSAGES_DIR:()=>s,WATCH:()=>!0});const n=[`.content.ts`,`.content.js`,`.content.cjs`,`.content.mjs`,`.content.json`,`.content.json5`,`.content.jsonc`,`.content.tsx`,`.content.jsx`],r=[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.intlayer/**`,`**/.next/**`,`**/.nuxt/**`,`**/.expo/**`,`**/.vercel/**`,`**/.turbo/**`,`**/.tanstack/**`],i=[`.`],a=[`.`],o=`i18next_resources`,s=`intl_messages`,c=!0;export{a as CODE_DIR,i as CONTENT_DIR,r as EXCLUDED_PATHS,n as FILE_EXTENSIONS,o as I18NEXT_DICTIONARIES_DIR,s as REACT_INTL_MESSAGES_DIR,c as WATCH,t};
1
+ const e=[`.content.ts`,`.content.js`,`.content.cjs`,`.content.mjs`,`.content.json`,`.content.json5`,`.content.jsonc`,`.content.tsx`,`.content.jsx`],t=[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.intlayer/**`,`**/.next/**`,`**/.nuxt/**`,`**/.expo/**`,`**/.vercel/**`,`**/.turbo/**`,`**/.tanstack/**`],n=[`.`],r=[`.`],i=`i18next_resources`,a=`intl_messages`,o=!0;export{r as CODE_DIR,n as CONTENT_DIR,t as EXCLUDED_PATHS,e as FILE_EXTENSIONS,i as I18NEXT_DICTIONARIES_DIR,a as REACT_INTL_MESSAGES_DIR,o as WATCH};
2
2
  //# sourceMappingURL=content.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"content.mjs","names":[],"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":["export const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.mjs',\n '.content.json',\n '.content.json5',\n '.content.jsonc',\n '.content.tsx',\n '.content.jsx',\n];\n\nexport const EXCLUDED_PATHS = [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.intlayer/**',\n '**/.next/**',\n '**/.nuxt/**',\n '**/.expo/**',\n '**/.vercel/**',\n '**/.turbo/**',\n '**/.tanstack/**',\n];\n\nexport const CONTENT_DIR = ['.'];\n\nexport const CODE_DIR = ['.'];\n\nexport const I18NEXT_DICTIONARIES_DIR = 'i18next_resources';\n\nexport const REACT_INTL_MESSAGES_DIR = 'intl_messages';\n\nexport const WATCH = true;\n"],"mappings":"2MAAA,MAAa,EAAkB,CAC7B,cACA,cACA,eACA,eACA,gBACA,iBACA,iBACA,eACA,eACD,CAEY,EAAiB,CAC5B,qBACA,aACA,cACA,kBACA,cACA,cACA,cACA,gBACA,eACA,kBACD,CAEY,EAAc,CAAC,IAAI,CAEnB,EAAW,CAAC,IAAI,CAEhB,EAA2B,oBAE3B,EAA0B,gBAE1B,EAAQ"}
1
+ {"version":3,"file":"content.mjs","names":[],"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":["export const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.mjs',\n '.content.json',\n '.content.json5',\n '.content.jsonc',\n '.content.tsx',\n '.content.jsx',\n];\n\nexport const EXCLUDED_PATHS = [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.intlayer/**',\n '**/.next/**',\n '**/.nuxt/**',\n '**/.expo/**',\n '**/.vercel/**',\n '**/.turbo/**',\n '**/.tanstack/**',\n];\n\nexport const CONTENT_DIR = ['.'];\n\nexport const CODE_DIR = ['.'];\n\nexport const I18NEXT_DICTIONARIES_DIR = 'i18next_resources';\n\nexport const REACT_INTL_MESSAGES_DIR = 'intl_messages';\n\nexport const WATCH = true;\n"],"mappings":"AAAA,MAAa,EAAkB,CAC7B,cACA,cACA,eACA,eACA,gBACA,iBACA,iBACA,eACA,eACD,CAEY,EAAiB,CAC5B,qBACA,aACA,cACA,kBACA,cACA,cACA,cACA,gBACA,eACA,kBACD,CAEY,EAAc,CAAC,IAAI,CAEnB,EAAW,CAAC,IAAI,CAEhB,EAA2B,oBAE3B,EAA0B,gBAE1B,EAAQ"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"../chunk-DXQkyQJp.mjs";var t=e({CONTENT_AUTO_TRANSFORMATION:()=>!1,FILL:()=>!0,IMPORT_MODE:()=>a,LOCATION:()=>r});const n=!0,r=`local`,i=!1,a=`static`;export{i as CONTENT_AUTO_TRANSFORMATION,n as FILL,a as IMPORT_MODE,r as LOCATION,t};
1
+ const e=!0,t=`local`,n=!1,r=`static`;export{n as CONTENT_AUTO_TRANSFORMATION,e as FILL,r as IMPORT_MODE,t as LOCATION};
2
2
  //# sourceMappingURL=dictionary.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../src/defaultValues/dictionary.ts"],"sourcesContent":["import type { DictionaryLocation } from '@intlayer/types/dictionary';\n\nexport const FILL = true;\nexport const LOCATION: DictionaryLocation = 'local';\nexport const CONTENT_AUTO_TRANSFORMATION = false;\nexport const IMPORT_MODE = 'static';\n"],"mappings":"qIAEA,MAAa,EAAO,GACP,EAA+B,QAC/B,EAA8B,GAC9B,EAAc"}
1
+ {"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../src/defaultValues/dictionary.ts"],"sourcesContent":["import type { DictionaryLocation } from '@intlayer/types/dictionary';\n\nexport const FILL = true;\nexport const LOCATION: DictionaryLocation = 'local';\nexport const CONTENT_AUTO_TRANSFORMATION = false;\nexport const IMPORT_MODE = 'static';\n"],"mappings":"AAEA,MAAa,EAAO,GACP,EAA+B,QAC/B,EAA8B,GAC9B,EAAc"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"../chunk-DXQkyQJp.mjs";var t=e({APPLICATION_URL:()=>void 0,BACKEND_URL:()=>a,CMS_URL:()=>i,DICTIONARY_PRIORITY_STRATEGY:()=>l,EDITOR_URL:()=>r,IS_ENABLED:()=>!1,LIVE_SYNC:()=>!0,LIVE_SYNC_PORT:()=>u,PORT:()=>o});const n=void 0,r=`http://localhost:8000`,i=`https://app.intlayer.org`,a=`https://back.intlayer.org`,o=8e3,s=!1,c=!0,l=`local_first`,u=4e3;export{n as APPLICATION_URL,a as BACKEND_URL,i as CMS_URL,l as DICTIONARY_PRIORITY_STRATEGY,r as EDITOR_URL,s as IS_ENABLED,c as LIVE_SYNC,u as LIVE_SYNC_PORT,o as PORT,t};
1
+ const e=void 0,t=`http://localhost:8000`,n=`https://app.intlayer.org`,r=`https://back.intlayer.org`,i=8e3,a=!1,o=!0,s=`local_first`,c=4e3;export{e as APPLICATION_URL,r as BACKEND_URL,n as CMS_URL,s as DICTIONARY_PRIORITY_STRATEGY,t as EDITOR_URL,a as IS_ENABLED,o as LIVE_SYNC,c as LIVE_SYNC_PORT,i as PORT};
2
2
  //# sourceMappingURL=editor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.mjs","names":[],"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const APPLICATION_URL = undefined;\nexport const EDITOR_URL = 'http://localhost:8000';\nexport const CMS_URL = 'https://app.intlayer.org';\nexport const BACKEND_URL = 'https://back.intlayer.org';\nexport const PORT = 8000;\nexport const IS_ENABLED = false;\nexport const LIVE_SYNC = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'local_first';\nexport const LIVE_SYNC_PORT = 4000;\n"],"mappings":"uOAAA,MAAa,EAAkB,IAAA,GAClB,EAAa,wBACb,EAAU,2BACV,EAAc,4BACd,EAAO,IACP,EAAa,GACb,EAAY,GACZ,EAA+B,cAC/B,EAAiB"}
1
+ {"version":3,"file":"editor.mjs","names":[],"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const APPLICATION_URL = undefined;\nexport const EDITOR_URL = 'http://localhost:8000';\nexport const CMS_URL = 'https://app.intlayer.org';\nexport const BACKEND_URL = 'https://back.intlayer.org';\nexport const PORT = 8000;\nexport const IS_ENABLED = false;\nexport const LIVE_SYNC = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'local_first';\nexport const LIVE_SYNC_PORT = 4000;\n"],"mappings":"AAAA,MAAa,EAAkB,IAAA,GAClB,EAAa,wBACb,EAAU,2BACV,EAAc,4BACd,EAAO,IACP,EAAa,GACb,EAAY,GACZ,EAA+B,cAC/B,EAAiB"}
@@ -1,2 +1 @@
1
- import{t as e}from"../chunk-DXQkyQJp.mjs";import{t}from"./build.mjs";import{t as n}from"./compiler.mjs";import{t as r}from"./content.mjs";import{t as i}from"./dictionary.mjs";import{t as a}from"./editor.mjs";import{t as o}from"./internationalization.mjs";import{t as s}from"./log.mjs";import{t as c}from"./routing.mjs";import{t as l}from"./system.mjs";var u=e({Build:()=>t,Compiler:()=>n,Content:()=>r,Dictionary:()=>i,Editor:()=>a,Internationalization:()=>o,Log:()=>s,Routing:()=>c,System:()=>l});export{t as Build,n as Compiler,r as Content,i as Dictionary,a as Editor,o as Internationalization,s as Log,c as Routing,l as System,u as t};
2
- //# sourceMappingURL=index.mjs.map
1
+ import{BUILD_MODE as e,CACHE as t,OPTIMIZE as n,OUTPUT_FORMAT as r,TRAVERSE_PATTERN as i,TYPE_CHECKING as a}from"./build.mjs";import{COMPILER_DICTIONARY_KEY_PREFIX as o,COMPILER_ENABLED as s,COMPILER_NO_METADATA as c,COMPILER_SAVE_COMPONENTS as l}from"./compiler.mjs";import{CODE_DIR as u,CONTENT_DIR as d,EXCLUDED_PATHS as f,FILE_EXTENSIONS as p,I18NEXT_DICTIONARIES_DIR as m,REACT_INTL_MESSAGES_DIR as h,WATCH as g}from"./content.mjs";import{CONTENT_AUTO_TRANSFORMATION as _,FILL as v,IMPORT_MODE as y,LOCATION as b}from"./dictionary.mjs";import{APPLICATION_URL as x,BACKEND_URL as S,CMS_URL as C,DICTIONARY_PRIORITY_STRATEGY as w,EDITOR_URL as T,IS_ENABLED as E,LIVE_SYNC as D,LIVE_SYNC_PORT as O,PORT as k}from"./editor.mjs";import{DEFAULT_LOCALE as A,LOCALES as j,REQUIRED_LOCALES as M,STRICT_MODE as N}from"./internationalization.mjs";import{MODE as P,PREFIX as F}from"./log.mjs";import{BASE_PATH as I,COOKIE_NAME as L,HEADER_NAME as R,LOCALE_STORAGE_NAME as z,ROUTING_MODE as B,SERVER_SET_COOKIE as V,STORAGE as H}from"./routing.mjs";import{CACHE_DIR as U,CONFIG_DIR as W,DICTIONARIES_DIR as G,DYNAMIC_DICTIONARIES_DIR as K,FETCH_DICTIONARIES_DIR as q,MAIN_DIR as J,MASKS_DIR as Y,MODULE_AUGMENTATION_DIR as X,REMOTE_DICTIONARIES_DIR as Z,TEMP_DIR as Q,TYPES_DIR as $,UNMERGED_DICTIONARIES_DIR as ee}from"./system.mjs";export{x as APPLICATION_URL,S as BACKEND_URL,I as BASE_PATH,e as BUILD_MODE,t as CACHE,U as CACHE_DIR,C as CMS_URL,u as CODE_DIR,o as COMPILER_DICTIONARY_KEY_PREFIX,s as COMPILER_ENABLED,c as COMPILER_NO_METADATA,l as COMPILER_SAVE_COMPONENTS,W as CONFIG_DIR,_ as CONTENT_AUTO_TRANSFORMATION,d as CONTENT_DIR,L as COOKIE_NAME,A as DEFAULT_LOCALE,G as DICTIONARIES_DIR,w as DICTIONARY_PRIORITY_STRATEGY,K as DYNAMIC_DICTIONARIES_DIR,T as EDITOR_URL,f as EXCLUDED_PATHS,q as FETCH_DICTIONARIES_DIR,p as FILE_EXTENSIONS,v as FILL,R as HEADER_NAME,m as I18NEXT_DICTIONARIES_DIR,y as IMPORT_MODE,E as IS_ENABLED,D as LIVE_SYNC,O as LIVE_SYNC_PORT,j as LOCALES,z as LOCALE_STORAGE_NAME,b as LOCATION,J as MAIN_DIR,Y as MASKS_DIR,P as MODE,X as MODULE_AUGMENTATION_DIR,n as OPTIMIZE,r as OUTPUT_FORMAT,k as PORT,F as PREFIX,h as REACT_INTL_MESSAGES_DIR,Z as REMOTE_DICTIONARIES_DIR,M as REQUIRED_LOCALES,B as ROUTING_MODE,V as SERVER_SET_COOKIE,H as STORAGE,N as STRICT_MODE,Q as TEMP_DIR,i as TRAVERSE_PATTERN,$ as TYPES_DIR,a as TYPE_CHECKING,ee as UNMERGED_DICTIONARIES_DIR,g as WATCH};
@@ -1,2 +1,2 @@
1
- import{t as e}from"../chunk-DXQkyQJp.mjs";import{ENGLISH as t}from"@intlayer/types/locales";var n=e({DEFAULT_LOCALE:()=>a,LOCALES:()=>r,REQUIRED_LOCALES:()=>i,STRICT_MODE:()=>o});const r=[t],i=[],a=t,o=`inclusive`;export{a as DEFAULT_LOCALE,r as LOCALES,i as REQUIRED_LOCALES,o as STRICT_MODE,n as t};
1
+ import{ENGLISH as e}from"@intlayer/types/locales";const t=[e],n=[],r=e,i=`inclusive`;export{r as DEFAULT_LOCALE,t as LOCALES,n as REQUIRED_LOCALES,i as STRICT_MODE};
2
2
  //# sourceMappingURL=internationalization.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"internationalization.mjs","names":[],"sources":["../../../src/defaultValues/internationalization.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { StrictMode } from '@intlayer/types/config';\nimport { ENGLISH } from '@intlayer/types/locales';\n\nexport const LOCALES: Locale[] = [ENGLISH];\n\nexport const REQUIRED_LOCALES: Locale[] = [];\n\nexport const DEFAULT_LOCALE: Locale = ENGLISH;\n\nexport const STRICT_MODE: StrictMode = 'inclusive';\n"],"mappings":"mLAIA,MAAa,EAAoB,CAAC,EAAQ,CAE7B,EAA6B,EAAE,CAE/B,EAAyB,EAEzB,EAA0B"}
1
+ {"version":3,"file":"internationalization.mjs","names":[],"sources":["../../../src/defaultValues/internationalization.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { StrictMode } from '@intlayer/types/config';\nimport { ENGLISH } from '@intlayer/types/locales';\n\nexport const LOCALES: Locale[] = [ENGLISH];\n\nexport const REQUIRED_LOCALES: Locale[] = [];\n\nexport const DEFAULT_LOCALE: Locale = ENGLISH;\n\nexport const STRICT_MODE: StrictMode = 'inclusive';\n"],"mappings":"kDAIA,MAAa,EAAoB,CAAC,EAAQ,CAE7B,EAA6B,EAAE,CAE/B,EAAyB,EAEzB,EAA0B"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"../chunk-DXQkyQJp.mjs";import{ANSIColors as t}from"../logger.mjs";var n=e({MODE:()=>r,PREFIX:()=>i});const r=`default`,i=`${t.GREY_DARK}[intlayer] ${t.RESET}`;export{r as MODE,i as PREFIX,n as t};
1
+ import{GREY_DARK as e,RESET as t}from"../colors.mjs";const n=`default`,r=`${e}[intlayer] ${t}`;export{n as MODE,r as PREFIX};
2
2
  //# sourceMappingURL=log.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.mjs","names":[],"sources":["../../../src/defaultValues/log.ts"],"sourcesContent":["import { ANSIColors } from '../logger';\n\nexport const MODE = 'default';\n\nexport const PREFIX = `${ANSIColors.GREY_DARK}[intlayer] ${ANSIColors.RESET}`;\n"],"mappings":"wHAEA,MAAa,EAAO,UAEP,EAAS,GAAG,EAAW,UAAU,aAAa,EAAW"}
1
+ {"version":3,"file":"log.mjs","names":["ANSIColors.GREY_DARK","ANSIColors.RESET"],"sources":["../../../src/defaultValues/log.ts"],"sourcesContent":["import * as ANSIColors from '../colors';\n\nexport const MODE = 'default';\n\nexport const PREFIX = `${ANSIColors.GREY_DARK}[intlayer] ${ANSIColors.RESET}`;\n"],"mappings":"qDAEA,MAAa,EAAO,UAEP,EAAS,GAAGA,EAAqB,aAAaC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"../chunk-DXQkyQJp.mjs";var t=e({BASE_PATH:()=>``,COOKIE_NAME:()=>r,HEADER_NAME:()=>n,LOCALE_STORAGE_NAME:()=>i,ROUTING_MODE:()=>s,SERVER_SET_COOKIE:()=>o,STORAGE:()=>c});const n=`x-intlayer-locale`,r=`INTLAYER_LOCALE`,i=`INTLAYER_LOCALE`,a=``,o=`always`,s=`prefix-no-default`,c=[`cookie`,`header`];export{a as BASE_PATH,r as COOKIE_NAME,n as HEADER_NAME,i as LOCALE_STORAGE_NAME,s as ROUTING_MODE,o as SERVER_SET_COOKIE,c as STORAGE,t};
1
+ const e=`x-intlayer-locale`,t=`INTLAYER_LOCALE`,n=`INTLAYER_LOCALE`,r=``,i=`always`,a=`prefix-no-default`,o=[`cookie`,`header`];export{r as BASE_PATH,t as COOKIE_NAME,e as HEADER_NAME,n as LOCALE_STORAGE_NAME,a as ROUTING_MODE,i as SERVER_SET_COOKIE,o as STORAGE};
2
2
  //# sourceMappingURL=routing.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"routing.mjs","names":[],"sources":["../../../src/defaultValues/routing.ts"],"sourcesContent":["import type { RoutingConfig } from '@intlayer/types/config';\n\nexport const HEADER_NAME = 'x-intlayer-locale';\n\nexport const COOKIE_NAME = 'INTLAYER_LOCALE';\nexport const LOCALE_STORAGE_NAME = 'INTLAYER_LOCALE';\n\nexport const BASE_PATH = '';\n\nexport const SERVER_SET_COOKIE = 'always';\n\nexport const ROUTING_MODE = 'prefix-no-default';\n\nexport const STORAGE: RoutingConfig['storage'] = ['cookie', 'header'];\n"],"mappings":"6LAEA,MAAa,EAAc,oBAEd,EAAc,kBACd,EAAsB,kBAEtB,EAAY,GAEZ,EAAoB,SAEpB,EAAe,oBAEf,EAAoC,CAAC,SAAU,SAAS"}
1
+ {"version":3,"file":"routing.mjs","names":[],"sources":["../../../src/defaultValues/routing.ts"],"sourcesContent":["import type { RoutingConfig } from '@intlayer/types/config';\n\nexport const HEADER_NAME = 'x-intlayer-locale';\n\nexport const COOKIE_NAME = 'INTLAYER_LOCALE';\nexport const LOCALE_STORAGE_NAME = 'INTLAYER_LOCALE';\n\nexport const BASE_PATH = '';\n\nexport const SERVER_SET_COOKIE = 'always';\n\nexport const ROUTING_MODE = 'prefix-no-default';\n\nexport const STORAGE: RoutingConfig['storage'] = ['cookie', 'header'];\n"],"mappings":"AAEA,MAAa,EAAc,oBAEd,EAAc,kBACd,EAAsB,kBAEtB,EAAY,GAEZ,EAAoB,SAEpB,EAAe,oBAEf,EAAoC,CAAC,SAAU,SAAS"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"../chunk-DXQkyQJp.mjs";var t=e({CACHE_DIR:()=>f,CONFIG_DIR:()=>d,DICTIONARIES_DIR:()=>r,DYNAMIC_DICTIONARIES_DIR:()=>s,FETCH_DICTIONARIES_DIR:()=>c,MAIN_DIR:()=>n,MASKS_DIR:()=>i,MODULE_AUGMENTATION_DIR:()=>u,REMOTE_DICTIONARIES_DIR:()=>a,TEMP_DIR:()=>p,TYPES_DIR:()=>l,UNMERGED_DICTIONARIES_DIR:()=>o});const n=`.intlayer/main`,r=`.intlayer/dictionary`,i=`.intlayer/mask`,a=`.intlayer/remote_dictionary`,o=`.intlayer/unmerged_dictionary`,s=`.intlayer/dynamic_dictionary`,c=`.intlayer/fetch_dictionary`,l=`.intlayer/types`,u=`.intlayer/types`,d=`.intlayer/config`,f=`.intlayer/cache`,p=`.intlayer/tmp`;export{f as CACHE_DIR,d as CONFIG_DIR,r as DICTIONARIES_DIR,s as DYNAMIC_DICTIONARIES_DIR,c as FETCH_DICTIONARIES_DIR,n as MAIN_DIR,i as MASKS_DIR,u as MODULE_AUGMENTATION_DIR,a as REMOTE_DICTIONARIES_DIR,p as TEMP_DIR,l as TYPES_DIR,o as UNMERGED_DICTIONARIES_DIR,t};
1
+ const e=`.intlayer/main`,t=`.intlayer/dictionary`,n=`.intlayer/mask`,r=`.intlayer/remote_dictionary`,i=`.intlayer/unmerged_dictionary`,a=`.intlayer/dynamic_dictionary`,o=`.intlayer/fetch_dictionary`,s=`.intlayer/types`,c=`.intlayer/types`,l=`.intlayer/config`,u=`.intlayer/cache`,d=`.intlayer/tmp`;export{u as CACHE_DIR,l as CONFIG_DIR,t as DICTIONARIES_DIR,a as DYNAMIC_DICTIONARIES_DIR,o as FETCH_DICTIONARIES_DIR,e as MAIN_DIR,n as MASKS_DIR,c as MODULE_AUGMENTATION_DIR,r as REMOTE_DICTIONARIES_DIR,d as TEMP_DIR,s as TYPES_DIR,i as UNMERGED_DICTIONARIES_DIR};
2
2
  //# sourceMappingURL=system.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.mjs","names":[],"sources":["../../../src/defaultValues/system.ts"],"sourcesContent":["export const MAIN_DIR = '.intlayer/main';\n\nexport const DICTIONARIES_DIR = '.intlayer/dictionary';\n\nexport const MASKS_DIR = '.intlayer/mask';\n\nexport const REMOTE_DICTIONARIES_DIR = '.intlayer/remote_dictionary';\n\nexport const UNMERGED_DICTIONARIES_DIR = '.intlayer/unmerged_dictionary';\n\nexport const DYNAMIC_DICTIONARIES_DIR = '.intlayer/dynamic_dictionary';\n\nexport const FETCH_DICTIONARIES_DIR = '.intlayer/fetch_dictionary';\n\nexport const TYPES_DIR = '.intlayer/types';\n\nexport const MODULE_AUGMENTATION_DIR = '.intlayer/types';\n\nexport const CONFIG_DIR = '.intlayer/config';\n\nexport const CACHE_DIR = '.intlayer/cache';\n\nexport const TEMP_DIR = '.intlayer/tmp';\n"],"mappings":"mUAAA,MAAa,EAAW,iBAEX,EAAmB,uBAEnB,EAAY,iBAEZ,EAA0B,8BAE1B,EAA4B,gCAE5B,EAA2B,+BAE3B,EAAyB,6BAEzB,EAAY,kBAEZ,EAA0B,kBAE1B,EAAa,mBAEb,EAAY,kBAEZ,EAAW"}
1
+ {"version":3,"file":"system.mjs","names":[],"sources":["../../../src/defaultValues/system.ts"],"sourcesContent":["export const MAIN_DIR = '.intlayer/main';\n\nexport const DICTIONARIES_DIR = '.intlayer/dictionary';\n\nexport const MASKS_DIR = '.intlayer/mask';\n\nexport const REMOTE_DICTIONARIES_DIR = '.intlayer/remote_dictionary';\n\nexport const UNMERGED_DICTIONARIES_DIR = '.intlayer/unmerged_dictionary';\n\nexport const DYNAMIC_DICTIONARIES_DIR = '.intlayer/dynamic_dictionary';\n\nexport const FETCH_DICTIONARIES_DIR = '.intlayer/fetch_dictionary';\n\nexport const TYPES_DIR = '.intlayer/types';\n\nexport const MODULE_AUGMENTATION_DIR = '.intlayer/types';\n\nexport const CONFIG_DIR = '.intlayer/config';\n\nexport const CACHE_DIR = '.intlayer/cache';\n\nexport const TEMP_DIR = '.intlayer/tmp';\n"],"mappings":"AAAA,MAAa,EAAW,iBAEX,EAAmB,uBAEnB,EAAY,iBAEZ,EAA0B,8BAE1B,EAA4B,gCAE5B,EAA2B,+BAE3B,EAAyB,6BAEzB,EAAY,kBAEZ,EAA0B,kBAE1B,EAAa,mBAEb,EAAY,kBAEZ,EAAW"}
@@ -1,2 +1,2 @@
1
- import{colorizePath as e,logger as t}from"../logger.mjs";import{parseFileContent as n}from"./parseFileContent.mjs";import{transpileTSToCJS as r,transpileTSToCJSSync as i}from"./transpileTSToCJS.mjs";import{readFileSync as a}from"node:fs";import{extname as o}from"node:path";import{readFile as s}from"node:fs/promises";import*as c from"json5";const l=c.parse||c.default?.parse,u=(e,r)=>{let s=o(e)||`.json`;try{if(s===`.json`||s===`.json5`||s===`.jsonc`)return l(a(e,`utf-8`));let o=i(a(e,`utf-8`),e,r?.buildOptions);if(!o){t(`File could not be loaded.`,{level:`error`});return}let c=n(o,{projectRequire:r?.projectRequire,envVarOptions:r?.envVarOptions,additionalEnvVars:r?.additionalEnvVars,mocks:r?.mocks,aliases:r?.aliases});if(c===void 0){t(`File could not be loaded. Path : ${e}`);return}return c}catch(e){t([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}},d=async(i,a)=>{let c=o(i);try{if(c===`.json`||c===`.json5`||c===`.jsonc`)return l(await s(i,`utf-8`));let o=await r(await s(i,`utf-8`),i,a?.buildOptions);if(!o){t(`File could not be loaded.`,{level:`error`});return}let u=n(o,{projectRequire:a?.projectRequire,envVarOptions:a?.envVarOptions,additionalEnvVars:a?.additionalEnvVars,mocks:a?.mocks,aliases:a?.aliases});if(u===void 0){t(`File could not be loaded. Path : ${e(i)}`);return}return u}catch(e){(a?.logError??!0)&&t([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}};export{d as loadExternalFile,u as loadExternalFileSync};
1
+ import{colorizePath as e,logger as t}from"../logger.mjs";import{parseFileContent as n}from"./parseFileContent.mjs";import{transpileTSToCJS as r,transpileTSToCJSSync as i}from"./transpileTSToCJS.mjs";import{readFileSync as a}from"node:fs";import{extname as o}from"node:path";import{readFile as s}from"node:fs/promises";import c from"json5";const l=c.parse||c.default?.parse,u=(e,r)=>{let s=o(e)||`.json`;try{if(s===`.json`||s===`.json5`||s===`.jsonc`)return l(a(e,`utf-8`));let o=i(a(e,`utf-8`),e,r?.buildOptions);if(!o){t(`File could not be loaded.`,{level:`error`});return}let c=n(o,{projectRequire:r?.projectRequire,envVarOptions:r?.envVarOptions,additionalEnvVars:r?.additionalEnvVars,mocks:r?.mocks,aliases:r?.aliases});if(c===void 0){t(`File could not be loaded. Path : ${e}`);return}return c}catch(e){t([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}},d=async(i,a)=>{let c=o(i);try{if(c===`.json`||c===`.json5`||c===`.jsonc`)return l(await s(i,`utf-8`));let o=await r(await s(i,`utf-8`),i,a?.buildOptions);if(!o){t(`File could not be loaded.`,{level:`error`});return}let u=n(o,{projectRequire:a?.projectRequire,envVarOptions:a?.envVarOptions,additionalEnvVars:a?.additionalEnvVars,mocks:a?.mocks,aliases:a?.aliases});if(u===void 0){t(`File could not be loaded. Path : ${e(i)}`);return}return u}catch(e){(a?.logError??!0)&&t([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}};export{d as loadExternalFile,u as loadExternalFileSync};
2
2
  //# sourceMappingURL=loadExternalFile.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadExternalFile.mjs","names":[],"sources":["../../../src/loadExternalFile/loadExternalFile.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { extname } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport * as JSON5 from 'json5';\nimport { colorizePath, logger } from '../logger';\nimport {\n parseFileContent,\n type SandBoxContextOptions,\n} from './parseFileContent';\nimport {\n type TranspileOptions,\n transpileTSToCJS,\n transpileTSToCJSSync,\n} from './transpileTSToCJS';\n\n// CJS MJS cross usage\nconst parseJSON5 = JSON5.parse || (JSON5 as any).default?.parse;\n\nexport type LoadExternalFileOptions = {\n configuration?: IntlayerConfig;\n buildOptions?: TranspileOptions;\n logError?: boolean;\n} & SandBoxContextOptions;\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFileSync = (\n filePath: string,\n options?: LoadExternalFileOptions\n): any | undefined => {\n const fileExtension = extname(filePath) || '.json';\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Assume JSON\n return parseJSON5(readFileSync(filePath, 'utf-8'));\n }\n\n // Rest is JS, MJS or TS\n const code = readFileSync(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = transpileTSToCJSSync(\n code,\n filePath,\n options?.buildOptions\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${filePath}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n};\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFile = async (\n filePath: string,\n options?: LoadExternalFileOptions\n): Promise<any | undefined> => {\n const fileExtension = extname(filePath);\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Remove cache to force getting fresh content\n const fileContent = await readFile(filePath, 'utf-8');\n return parseJSON5(fileContent);\n }\n\n // Rest is JS, MJS or TS\n const code = await readFile(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = await transpileTSToCJS(\n code,\n filePath,\n options?.buildOptions\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${colorizePath(filePath)}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n if (options?.logError ?? true) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n }\n};\n"],"mappings":"sVAiBA,MAAM,EAAa,EAAM,OAAU,EAAc,SAAS,MAa7C,GACX,EACA,IACoB,CACpB,IAAM,EAAgB,EAAQ,EAAS,EAAI,QAE3C,GAAI,CACF,GACE,IAAkB,SAClB,IAAkB,UAClB,IAAkB,SAGlB,OAAO,EAAW,EAAa,EAAU,QAAQ,CAAC,CAMpD,IAAM,EAAyC,EAFlC,EAAa,EAAU,QAAQ,CAI1C,EACA,GAAS,aACV,CAED,GAAI,CAAC,EAAoB,CACvB,EAAO,4BAA6B,CAAE,MAAO,QAAS,CAAC,CACvD,OAGF,IAAM,EAAc,EAAiB,EAAoB,CACvD,eAAgB,GAAS,eACzB,cAAe,GAAS,cACxB,kBAAmB,GAAS,kBAC5B,MAAO,GAAS,MAChB,QAAS,GAAS,QACnB,CAAC,CAEF,GAAW,IAAgB,OAAa,CACtC,EAAO,oCAAoC,IAAW,CACtD,OAGF,OAAO,QACA,EAAO,CACd,EACE,CACE,UAAW,EAAgB,QAAQ,KACnC,KAAK,UAAW,EAAgB,MAAO,KAAM,EAAE,CAChD,CACD,CACE,MAAO,QACR,CACF,GASQ,EAAmB,MAC9B,EACA,IAC6B,CAC7B,IAAM,EAAgB,EAAQ,EAAS,CAEvC,GAAI,CACF,GACE,IAAkB,SAClB,IAAkB,UAClB,IAAkB,SAIlB,OAAO,EADa,MAAM,EAAS,EAAU,QAAQ,CACvB,CAMhC,IAAM,EAAyC,MAAM,EAFxC,MAAM,EAAS,EAAU,QAAQ,CAI5C,EACA,GAAS,aACV,CAED,GAAI,CAAC,EAAoB,CACvB,EAAO,4BAA6B,CAAE,MAAO,QAAS,CAAC,CACvD,OAGF,IAAM,EAAc,EAAiB,EAAoB,CACvD,eAAgB,GAAS,eACzB,cAAe,GAAS,cACxB,kBAAmB,GAAS,kBAC5B,MAAO,GAAS,MAChB,QAAS,GAAS,QACnB,CAAC,CAEF,GAAW,IAAgB,OAAa,CACtC,EAAO,oCAAoC,EAAa,EAAS,GAAG,CACpE,OAGF,OAAO,QACA,EAAO,EACV,GAAS,UAAY,KACvB,EACE,CACE,UAAW,EAAgB,QAAQ,KACnC,KAAK,UAAW,EAAgB,MAAO,KAAM,EAAE,CAChD,CACD,CACE,MAAO,QACR,CACF"}
1
+ {"version":3,"file":"loadExternalFile.mjs","names":[],"sources":["../../../src/loadExternalFile/loadExternalFile.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { extname } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport JSON5 from 'json5';\nimport { colorizePath, logger } from '../logger';\nimport {\n parseFileContent,\n type SandBoxContextOptions,\n} from './parseFileContent';\nimport {\n type TranspileOptions,\n transpileTSToCJS,\n transpileTSToCJSSync,\n} from './transpileTSToCJS';\n\n// CJS MJS cross usage\nconst parseJSON5 = JSON5.parse || (JSON5 as any).default?.parse;\n\nexport type LoadExternalFileOptions = {\n configuration?: IntlayerConfig;\n buildOptions?: TranspileOptions;\n logError?: boolean;\n} & SandBoxContextOptions;\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFileSync = (\n filePath: string,\n options?: LoadExternalFileOptions\n): any | undefined => {\n const fileExtension = extname(filePath) || '.json';\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Assume JSON\n return parseJSON5(readFileSync(filePath, 'utf-8'));\n }\n\n // Rest is JS, MJS or TS\n const code = readFileSync(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = transpileTSToCJSSync(\n code,\n filePath,\n options?.buildOptions\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${filePath}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n};\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFile = async (\n filePath: string,\n options?: LoadExternalFileOptions\n): Promise<any | undefined> => {\n const fileExtension = extname(filePath);\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Remove cache to force getting fresh content\n const fileContent = await readFile(filePath, 'utf-8');\n return parseJSON5(fileContent);\n }\n\n // Rest is JS, MJS or TS\n const code = await readFile(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = await transpileTSToCJS(\n code,\n filePath,\n options?.buildOptions\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${colorizePath(filePath)}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n if (options?.logError ?? true) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n }\n};\n"],"mappings":"mVAiBA,MAAM,EAAa,EAAM,OAAU,EAAc,SAAS,MAa7C,GACX,EACA,IACoB,CACpB,IAAM,EAAgB,EAAQ,EAAS,EAAI,QAE3C,GAAI,CACF,GACE,IAAkB,SAClB,IAAkB,UAClB,IAAkB,SAGlB,OAAO,EAAW,EAAa,EAAU,QAAQ,CAAC,CAMpD,IAAM,EAAyC,EAFlC,EAAa,EAAU,QAAQ,CAI1C,EACA,GAAS,aACV,CAED,GAAI,CAAC,EAAoB,CACvB,EAAO,4BAA6B,CAAE,MAAO,QAAS,CAAC,CACvD,OAGF,IAAM,EAAc,EAAiB,EAAoB,CACvD,eAAgB,GAAS,eACzB,cAAe,GAAS,cACxB,kBAAmB,GAAS,kBAC5B,MAAO,GAAS,MAChB,QAAS,GAAS,QACnB,CAAC,CAEF,GAAW,IAAgB,OAAa,CACtC,EAAO,oCAAoC,IAAW,CACtD,OAGF,OAAO,QACA,EAAO,CACd,EACE,CACE,UAAW,EAAgB,QAAQ,KACnC,KAAK,UAAW,EAAgB,MAAO,KAAM,EAAE,CAChD,CACD,CACE,MAAO,QACR,CACF,GASQ,EAAmB,MAC9B,EACA,IAC6B,CAC7B,IAAM,EAAgB,EAAQ,EAAS,CAEvC,GAAI,CACF,GACE,IAAkB,SAClB,IAAkB,UAClB,IAAkB,SAIlB,OAAO,EADa,MAAM,EAAS,EAAU,QAAQ,CACvB,CAMhC,IAAM,EAAyC,MAAM,EAFxC,MAAM,EAAS,EAAU,QAAQ,CAI5C,EACA,GAAS,aACV,CAED,GAAI,CAAC,EAAoB,CACvB,EAAO,4BAA6B,CAAE,MAAO,QAAS,CAAC,CACvD,OAGF,IAAM,EAAc,EAAiB,EAAoB,CACvD,eAAgB,GAAS,eACzB,cAAe,GAAS,cACxB,kBAAmB,GAAS,kBAC5B,MAAO,GAAS,MAChB,QAAS,GAAS,QACnB,CAAC,CAEF,GAAW,IAAgB,OAAa,CACtC,EAAO,oCAAoC,EAAa,EAAS,GAAG,CACpE,OAGF,OAAO,QACA,EAAO,EACV,GAAS,UAAY,KACvB,EACE,CACE,UAAW,EAAgB,QAAQ,KACnC,KAAK,UAAW,EAAgB,MAAO,KAAM,EAAE,CAChD,CACD,CACE,MAAO,QACR,CACF"}
@@ -1,2 +1,2 @@
1
- import{getProjectRequire as e}from"../utils/ESMxCJSHelpers.mjs";import{loadEnvFile as t}from"../loadEnvFile.mjs";import{runInNewContext as n}from"node:vm";import*as r from"esbuild";const i=n=>{let{envVarOptions:i,projectRequire:a,additionalEnvVars:o,mocks:s,aliases:c}=n??{},l={},u=typeof a==`function`?a:e(),d=(()=>{let e=Object.assign({esbuild:r},s),t=Object.assign({},c),n=function(n){let r=t?.[n]?t[n]:n;return e&&Object.hasOwn(e,r)?e[r]:r!==n&&e&&Object.hasOwn(e,n)?e[n]:u(r)};return n.resolve=u.resolve.bind(u),n.main=u.main,n.extensions=u.extensions,n.cache=u.cache,n})();try{l={React:u(`react`)}}catch{l={React:{createElement:(e,t,...n)=>({type:e,props:{...t,children:n.length<=1?n[0]:n}}),Fragment:Symbol.for(`react.fragment`)}}}let f={exports:{default:{}},module:{exports:{}},process:{...process,env:{...process.env,...t(i),...o}},console,require:d,...l};return Object.getOwnPropertyNames(globalThis).forEach(e=>{e in f||(f[e]=globalThis[e])}),f},a=(e,t)=>{let r=i(t);n(`"use strict";\n${e}`,r);let a=[r.exports?.default,r.module?.exports?.defaults,r.module?.exports?.default,r.module?.exports];for(let e of a)if(e&&typeof e==`object`&&Object.keys(e).length>0)return e};export{i as getSandBoxContext,a as parseFileContent};
1
+ import{n as e}from"../ESMxCJSHelpers-BAuqwNXV.mjs";import{loadEnvFile as t}from"../loadEnvFile.mjs";import{runInNewContext as n}from"node:vm";import*as r from"esbuild";const i=n=>{let{envVarOptions:i,projectRequire:a,additionalEnvVars:o,mocks:s,aliases:c}=n??{},l={},u=typeof a==`function`?a:e(),d=(()=>{let e=Object.assign({esbuild:r},s),t=Object.assign({},c),n=function(n){let r=t?.[n]?t[n]:n;return e&&Object.hasOwn(e,r)?e[r]:r!==n&&e&&Object.hasOwn(e,n)?e[n]:u(r)};return n.resolve=u.resolve.bind(u),n.main=u.main,n.extensions=u.extensions,n.cache=u.cache,n})();try{l={React:u(`react`)}}catch{l={React:{createElement:(e,t,...n)=>({type:e,props:{...t,children:n.length<=1?n[0]:n}}),Fragment:Symbol.for(`react.fragment`)}}}let f={exports:{default:{}},module:{exports:{}},process:{...process,env:{...process.env,...t(i),...o}},console,require:d,...l};return Object.getOwnPropertyNames(globalThis).forEach(e=>{e in f||(f[e]=globalThis[e])}),f},a=(e,t)=>{let r=i(t);n(`"use strict";\n${e}`,r);let a=[r.exports?.default,r.module?.exports?.defaults,r.module?.exports?.default,r.module?.exports];for(let e of a)if(e&&typeof e==`object`&&Object.keys(e).length>0)return e};export{i as getSandBoxContext,a as parseFileContent};
2
2
  //# sourceMappingURL=parseFileContent.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseFileContent.mjs","names":[],"sources":["../../../src/loadExternalFile/parseFileContent.ts"],"sourcesContent":["import { type Context, runInNewContext } from 'node:vm';\nimport * as esbuild from 'esbuild';\nimport { type LoadEnvFileOptions, loadEnvFile } from '../loadEnvFile';\nimport { getProjectRequire } from '../utils/ESMxCJSHelpers';\n\nexport type SandBoxContextOptions = {\n envVarOptions?: LoadEnvFileOptions;\n projectRequire?: NodeJS.Require;\n additionalEnvVars?: Record<string, string>;\n /**\n * Map of specifier -> mocked export to be returned when code in the VM calls require(specifier).\n * Example:\n * mocks: {\n * '@intlayer/config/built': { getConfig: () => ({}), Locales: {} }\n * }\n */\n mocks?: Record<string, any>;\n /**\n * Optional alias map if you want to redirect specifiers.\n * Useful when user code imports a subpath you want to collapse.\n * Example:\n * aliases: { '@intlayer/config/built': '@intlayer/config' }\n */\n aliases?: Record<string, string>;\n};\n\nexport const getSandBoxContext = (options?: SandBoxContextOptions): Context => {\n const { envVarOptions, projectRequire, additionalEnvVars, mocks, aliases } =\n options ?? {};\n\n let additionalGlobalVar = {};\n\n const baseRequire: NodeJS.Require =\n typeof projectRequire === 'function' ? projectRequire : getProjectRequire();\n\n // Wrap require to honor mocks and aliases inside the VM\n const mockedRequire: NodeJS.Require = (() => {\n const mockTable = Object.assign(\n {\n esbuild,\n },\n mocks\n );\n const aliasTable = Object.assign({}, aliases);\n\n const wrappedRequire = function mockableRequire(id: string) {\n const target = aliasTable?.[id] ? aliasTable[id] : id;\n\n if (mockTable && Object.hasOwn(mockTable, target)) {\n return mockTable[target];\n }\n\n // If the original id was aliased, allow mocks to be defined on either key.\n if (target !== id && mockTable && Object.hasOwn(mockTable, id)) {\n return mockTable[id];\n }\n\n return baseRequire(target);\n } as NodeJS.Require;\n\n // Mirror NodeJS.Require properties\n wrappedRequire.resolve = baseRequire.resolve.bind(baseRequire);\n wrappedRequire.main = baseRequire.main;\n wrappedRequire.extensions = baseRequire.extensions;\n wrappedRequire.cache = baseRequire.cache;\n\n return wrappedRequire;\n })();\n\n try {\n // Dynamically try to require React if it's installed in the project\n additionalGlobalVar = {\n React: baseRequire('react'),\n };\n } catch (_err) {\n // React is not installed, so we inject a dummy React object to capture JSX elements\n // This allows using JSX in content declarations even if React is not installed (e.g. in Solid.js or Vue projects)\n // because esbuild's tsx loader defaults to React.createElement.\n additionalGlobalVar = {\n React: {\n createElement: (type: any, props: any, ...children: any[]) => ({\n type,\n props: {\n ...props,\n children: children.length <= 1 ? children[0] : children,\n },\n }),\n Fragment: Symbol.for('react.fragment'),\n },\n };\n }\n\n const sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n process: {\n ...process,\n env: {\n ...process.env,\n ...loadEnvFile(envVarOptions),\n ...additionalEnvVars,\n },\n },\n console,\n require: mockedRequire,\n ...additionalGlobalVar,\n };\n\n // Dynamically inject all global variables\n Object.getOwnPropertyNames(globalThis).forEach((key) => {\n if (!(key in sandboxContext)) {\n sandboxContext[key] = globalThis[key as keyof typeof globalThis];\n }\n });\n\n return sandboxContext;\n};\n\nexport const parseFileContent = <T>(\n fileContentString: string,\n options?: SandBoxContextOptions\n): T | undefined => {\n const sandboxContext = getSandBoxContext(options);\n\n // Force strict mode so illegal writes throw instead of silently failing.\n runInNewContext(`\"use strict\";\\n${fileContentString}`, sandboxContext);\n\n const candidates: unknown[] = [\n sandboxContext.exports?.default,\n sandboxContext.module?.exports?.defaults,\n sandboxContext.module?.exports?.default,\n sandboxContext.module?.exports,\n ];\n\n for (const candidate of candidates) {\n if (\n candidate &&\n typeof candidate === 'object' &&\n Object.keys(candidate as object).length > 0\n ) {\n return candidate as T;\n }\n }\n};\n"],"mappings":"qLA0BA,MAAa,EAAqB,GAA6C,CAC7E,GAAM,CAAE,gBAAe,iBAAgB,oBAAmB,QAAO,WAC/D,GAAW,EAAE,CAEX,EAAsB,EAAE,CAEtB,EACJ,OAAO,GAAmB,WAAa,EAAiB,GAAmB,CAGvE,OAAuC,CAC3C,IAAM,EAAY,OAAO,OACvB,CACE,UACD,CACD,EACD,CACK,EAAa,OAAO,OAAO,EAAE,CAAE,EAAQ,CAEvC,EAAiB,SAAyB,EAAY,CAC1D,IAAM,EAAS,IAAa,GAAM,EAAW,GAAM,EAWnD,OATI,GAAa,OAAO,OAAO,EAAW,EAAO,CACxC,EAAU,GAIf,IAAW,GAAM,GAAa,OAAO,OAAO,EAAW,EAAG,CACrD,EAAU,GAGZ,EAAY,EAAO,EAS5B,MALA,GAAe,QAAU,EAAY,QAAQ,KAAK,EAAY,CAC9D,EAAe,KAAO,EAAY,KAClC,EAAe,WAAa,EAAY,WACxC,EAAe,MAAQ,EAAY,MAE5B,KACL,CAEJ,GAAI,CAEF,EAAsB,CACpB,MAAO,EAAY,QAAQ,CAC5B,MACY,CAIb,EAAsB,CACpB,MAAO,CACL,eAAgB,EAAW,EAAY,GAAG,KAAqB,CAC7D,OACA,MAAO,CACL,GAAG,EACH,SAAU,EAAS,QAAU,EAAI,EAAS,GAAK,EAChD,CACF,EACD,SAAU,OAAO,IAAI,iBAAiB,CACvC,CACF,CAGH,IAAM,EAA0B,CAC9B,QAAS,CACP,QAAS,EAAE,CACZ,CACD,OAAQ,CACN,QAAS,EAAE,CACZ,CACD,QAAS,CACP,GAAG,QACH,IAAK,CACH,GAAG,QAAQ,IACX,GAAG,EAAY,EAAc,CAC7B,GAAG,EACJ,CACF,CACD,QACA,QAAS,EACT,GAAG,EACJ,CASD,OANA,OAAO,oBAAoB,WAAW,CAAC,QAAS,GAAQ,CAChD,KAAO,IACX,EAAe,GAAO,WAAW,KAEnC,CAEK,GAGI,GACX,EACA,IACkB,CAClB,IAAM,EAAiB,EAAkB,EAAQ,CAGjD,EAAgB,kBAAkB,IAAqB,EAAe,CAEtE,IAAM,EAAwB,CAC5B,EAAe,SAAS,QACxB,EAAe,QAAQ,SAAS,SAChC,EAAe,QAAQ,SAAS,QAChC,EAAe,QAAQ,QACxB,CAED,IAAK,IAAM,KAAa,EACtB,GACE,GACA,OAAO,GAAc,UACrB,OAAO,KAAK,EAAoB,CAAC,OAAS,EAE1C,OAAO"}
1
+ {"version":3,"file":"parseFileContent.mjs","names":[],"sources":["../../../src/loadExternalFile/parseFileContent.ts"],"sourcesContent":["import { type Context, runInNewContext } from 'node:vm';\nimport * as esbuild from 'esbuild';\nimport { type LoadEnvFileOptions, loadEnvFile } from '../loadEnvFile';\nimport { getProjectRequire } from '../utils/ESMxCJSHelpers';\n\nexport type SandBoxContextOptions = {\n envVarOptions?: LoadEnvFileOptions;\n projectRequire?: NodeJS.Require;\n additionalEnvVars?: Record<string, string>;\n /**\n * Map of specifier -> mocked export to be returned when code in the VM calls require(specifier).\n * Example:\n * mocks: {\n * '@intlayer/config/built': { getConfig: () => ({}), Locales: {} }\n * }\n */\n mocks?: Record<string, any>;\n /**\n * Optional alias map if you want to redirect specifiers.\n * Useful when user code imports a subpath you want to collapse.\n * Example:\n * aliases: { '@intlayer/config/built': '@intlayer/config' }\n */\n aliases?: Record<string, string>;\n};\n\nexport const getSandBoxContext = (options?: SandBoxContextOptions): Context => {\n const { envVarOptions, projectRequire, additionalEnvVars, mocks, aliases } =\n options ?? {};\n\n let additionalGlobalVar = {};\n\n const baseRequire: NodeJS.Require =\n typeof projectRequire === 'function' ? projectRequire : getProjectRequire();\n\n // Wrap require to honor mocks and aliases inside the VM\n const mockedRequire: NodeJS.Require = (() => {\n const mockTable = Object.assign(\n {\n esbuild,\n },\n mocks\n );\n const aliasTable = Object.assign({}, aliases);\n\n const wrappedRequire = function mockableRequire(id: string) {\n const target = aliasTable?.[id] ? aliasTable[id] : id;\n\n if (mockTable && Object.hasOwn(mockTable, target)) {\n return mockTable[target];\n }\n\n // If the original id was aliased, allow mocks to be defined on either key.\n if (target !== id && mockTable && Object.hasOwn(mockTable, id)) {\n return mockTable[id];\n }\n\n return baseRequire(target);\n } as NodeJS.Require;\n\n // Mirror NodeJS.Require properties\n wrappedRequire.resolve = baseRequire.resolve.bind(baseRequire);\n wrappedRequire.main = baseRequire.main;\n wrappedRequire.extensions = baseRequire.extensions;\n wrappedRequire.cache = baseRequire.cache;\n\n return wrappedRequire;\n })();\n\n try {\n // Dynamically try to require React if it's installed in the project\n additionalGlobalVar = {\n React: baseRequire('react'),\n };\n } catch (_err) {\n // React is not installed, so we inject a dummy React object to capture JSX elements\n // This allows using JSX in content declarations even if React is not installed (e.g. in Solid.js or Vue projects)\n // because esbuild's tsx loader defaults to React.createElement.\n additionalGlobalVar = {\n React: {\n createElement: (type: any, props: any, ...children: any[]) => ({\n type,\n props: {\n ...props,\n children: children.length <= 1 ? children[0] : children,\n },\n }),\n Fragment: Symbol.for('react.fragment'),\n },\n };\n }\n\n const sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n process: {\n ...process,\n env: {\n ...process.env,\n ...loadEnvFile(envVarOptions),\n ...additionalEnvVars,\n },\n },\n console,\n require: mockedRequire,\n ...additionalGlobalVar,\n };\n\n // Dynamically inject all global variables\n Object.getOwnPropertyNames(globalThis).forEach((key) => {\n if (!(key in sandboxContext)) {\n sandboxContext[key] = globalThis[key as keyof typeof globalThis];\n }\n });\n\n return sandboxContext;\n};\n\nexport const parseFileContent = <T>(\n fileContentString: string,\n options?: SandBoxContextOptions\n): T | undefined => {\n const sandboxContext = getSandBoxContext(options);\n\n // Force strict mode so illegal writes throw instead of silently failing.\n runInNewContext(`\"use strict\";\\n${fileContentString}`, sandboxContext);\n\n const candidates: unknown[] = [\n sandboxContext.exports?.default,\n sandboxContext.module?.exports?.defaults,\n sandboxContext.module?.exports?.default,\n sandboxContext.module?.exports,\n ];\n\n for (const candidate of candidates) {\n if (\n candidate &&\n typeof candidate === 'object' &&\n Object.keys(candidate as object).length > 0\n ) {\n return candidate as T;\n }\n }\n};\n"],"mappings":"wKA0BA,MAAa,EAAqB,GAA6C,CAC7E,GAAM,CAAE,gBAAe,iBAAgB,oBAAmB,QAAO,WAC/D,GAAW,EAAE,CAEX,EAAsB,EAAE,CAEtB,EACJ,OAAO,GAAmB,WAAa,EAAiB,GAAmB,CAGvE,OAAuC,CAC3C,IAAM,EAAY,OAAO,OACvB,CACE,UACD,CACD,EACD,CACK,EAAa,OAAO,OAAO,EAAE,CAAE,EAAQ,CAEvC,EAAiB,SAAyB,EAAY,CAC1D,IAAM,EAAS,IAAa,GAAM,EAAW,GAAM,EAWnD,OATI,GAAa,OAAO,OAAO,EAAW,EAAO,CACxC,EAAU,GAIf,IAAW,GAAM,GAAa,OAAO,OAAO,EAAW,EAAG,CACrD,EAAU,GAGZ,EAAY,EAAO,EAS5B,MALA,GAAe,QAAU,EAAY,QAAQ,KAAK,EAAY,CAC9D,EAAe,KAAO,EAAY,KAClC,EAAe,WAAa,EAAY,WACxC,EAAe,MAAQ,EAAY,MAE5B,KACL,CAEJ,GAAI,CAEF,EAAsB,CACpB,MAAO,EAAY,QAAQ,CAC5B,MACY,CAIb,EAAsB,CACpB,MAAO,CACL,eAAgB,EAAW,EAAY,GAAG,KAAqB,CAC7D,OACA,MAAO,CACL,GAAG,EACH,SAAU,EAAS,QAAU,EAAI,EAAS,GAAK,EAChD,CACF,EACD,SAAU,OAAO,IAAI,iBAAiB,CACvC,CACF,CAGH,IAAM,EAA0B,CAC9B,QAAS,CACP,QAAS,EAAE,CACZ,CACD,OAAQ,CACN,QAAS,EAAE,CACZ,CACD,QAAS,CACP,GAAG,QACH,IAAK,CACH,GAAG,QAAQ,IACX,GAAG,EAAY,EAAc,CAC7B,GAAG,EACJ,CACF,CACD,QACA,QAAS,EACT,GAAG,EACJ,CASD,OANA,OAAO,oBAAoB,WAAW,CAAC,QAAS,GAAQ,CAChD,KAAO,IACX,EAAe,GAAO,WAAW,KAEnC,CAEK,GAGI,GACX,EACA,IACkB,CAClB,IAAM,EAAiB,EAAkB,EAAQ,CAGjD,EAAgB,kBAAkB,IAAqB,EAAe,CAEtE,IAAM,EAAwB,CAC5B,EAAe,SAAS,QACxB,EAAe,QAAQ,SAAS,SAChC,EAAe,QAAQ,SAAS,QAChC,EAAe,QAAQ,QACxB,CAED,IAAK,IAAM,KAAa,EACtB,GACE,GACA,OAAO,GAAc,UACrB,OAAO,KAAK,EAAoB,CAAC,OAAS,EAE1C,OAAO"}
@@ -1,2 +1,2 @@
1
- let e;const t=t=>{e=t},n=t=>e===void 0?t:e,r=(e,t)=>{let r=t?.isVerbose??!1,i=t?.config?.mode??`default`,a=t?.level??`info`,o=n(t?.config?.prefix),s=t?.config?.log??console.log,c=t?.config?.info??console.info,l=t?.config?.warn??console.warn,u=t?.config?.error??console.error,d=t?.config?.debug??console.debug;if(i===`disabled`||r&&i!==`verbose`)return;let f=o?[o,...[e].flat()]:[e].flat();if(a===`debug`)return d(...f);if(a===`info`)return c(...f);if(a===`warn`)return l(...f);if(a===`error`)return u(...f);s(...f)};let i=function(e){return e.RESET=`\x1B[0m`,e.GREY=`\x1B[90m`,e.GREY_DARK=`\x1B[38;5;239m`,e.GREY_LIGHT=`\x1B[38;5;252m`,e.BLUE=`\x1B[34m`,e.RED=`\x1B[31m`,e.GREEN=`\x1B[32m`,e.YELLOW=`\x1B[38;5;226m`,e.MAGENTA=`\x1B[35m`,e.BEIGE=`\x1B[38;5;3m`,e.ORANGE=`\x1B[38;5;208m`,e.CYAN=`\x1B[36m`,e.WHITE=`\x1B[37m`,e.BOLD=`\x1B[1m`,e}({});const a=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],o=(e,t)=>(n,i)=>r(n,{...i??{},config:{...e?.log,...t?.config,...i?.config??{}}}),s=(e,t,n)=>t?`${t}${e}${n?typeof n==`boolean`?i.RESET:n:i.RESET}`:e,c=(e,t=i.GREEN,n=i.RESET)=>[e].flat().map(e=>s(e,t,n)).join(`, `),l=(e,t=i.BEIGE,n=i.RESET)=>[e].flat().map(e=>s(e,t,n)).join(`, `),u=(e,t=i.GREY,n=i.RESET)=>[e].flat().map(e=>s(e,t,n)).join(`, `),d=(e,t={zero:i.BLUE,one:i.BLUE,two:i.BLUE,few:i.BLUE,many:i.BLUE,other:i.BLUE})=>{if(e===0){let n=t.zero??i.GREEN;return s(e.toString(),n)}let n=t[new Intl.PluralRules(`en`).select(Number(e))];return s(e.toString(),n)},f=e=>e.replace(/\x1b\[[0-9;]*m/g,``),p=e=>{let t=0;return typeof e==`number`&&(t=e),typeof e==`string`&&(t=e.length),Array.isArray(e)&&e.every(e=>typeof e==`string`)&&(t=Math.max(...e.map(e=>e.length))),Array.isArray(e)&&e.every(e=>typeof e==`number`)&&(t=Math.max(...e)),Math.max(t,0)},m={colSize:0,minSize:0,maxSize:1/0,pad:`right`,padChar:`0`},h=(e,t)=>[e].flat().map(e=>{let{colSize:n,minSize:r,maxSize:i,pad:a}={...m,...t??{}},o=p(n),s=Math.max(r,Math.min(i,o-f(e).length));return a===`left`?`${` `.repeat(s)}${e}`:`${e}${` `.repeat(s)}`}).join(``),g=s(`✗`,i.RED),_=s(`✓`,i.GREEN),v=s(`⏲`,i.BLUE);export{i as ANSIColors,v as clock,h as colon,s as colorize,l as colorizeKey,c as colorizeLocales,d as colorizeNumber,u as colorizePath,o as getAppLogger,n as getPrefix,r as logger,f as removeColor,t as setPrefix,a as spinnerFrames,_ as v,g as x};
1
+ import{BEIGE as e,BLUE as t,GREEN as n,GREY as r,RED as i,RESET as a}from"./colors.mjs";let o;const s=e=>{o=e},c=e=>o===void 0?e:o,l=(e,t)=>{let n=t?.isVerbose??!1,r=t?.config?.mode??`default`,i=t?.level??`info`,a=c(t?.config?.prefix),o=t?.config?.log??console.log,s=t?.config?.info??console.info,l=t?.config?.warn??console.warn,u=t?.config?.error??console.error,d=t?.config?.debug??console.debug;if(r===`disabled`||n&&r!==`verbose`)return;let f=a?[a,...[e].flat()]:[e].flat();if(i===`debug`)return d(...f);if(i===`info`)return s(...f);if(i===`warn`)return l(...f);if(i===`error`)return u(...f);o(...f)},u=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],d=(e,t)=>(n,r)=>l(n,{...r??{},config:{...e?.log,...t?.config,...r?.config??{}}}),f=(e,t,n)=>t?`${t}${e}${n?typeof n==`boolean`?a:n:a}`:e,p=(e,t=n,r=a)=>[e].flat().map(e=>f(e,t,r)).join(`, `),m=(t,n=e,r=a)=>[t].flat().map(e=>f(e,n,r)).join(`, `),h=(e,t=r,n=a)=>[e].flat().map(e=>f(e,t,n)).join(`, `),g=(e,n={zero:t,one:t,two:t,few:t,many:t,other:t})=>{if(e===0){let t=n.zero??`\x1B[32m`;return f(e.toString(),t)}let r=n[new Intl.PluralRules(`en`).select(Number(e))];return f(e.toString(),r)},_=e=>e.replace(/\x1b\[[0-9;]*m/g,``),v=e=>{let t=0;return typeof e==`number`&&(t=e),typeof e==`string`&&(t=e.length),Array.isArray(e)&&e.every(e=>typeof e==`string`)&&(t=Math.max(...e.map(e=>e.length))),Array.isArray(e)&&e.every(e=>typeof e==`number`)&&(t=Math.max(...e)),Math.max(t,0)},y={colSize:0,minSize:0,maxSize:1/0,pad:`right`,padChar:`0`},b=(e,t)=>[e].flat().map(e=>{let{colSize:n,minSize:r,maxSize:i,pad:a}={...y,...t??{}},o=v(n),s=Math.max(r,Math.min(i,o-_(e).length));return a===`left`?`${` `.repeat(s)}${e}`:`${e}${` `.repeat(s)}`}).join(``),x=f(`✗`,i),S=f(`✓`,n),C=f(`⏲`,t);export{C as clock,b as colon,f as colorize,m as colorizeKey,p as colorizeLocales,g as colorizeNumber,h as colorizePath,d as getAppLogger,c as getPrefix,l as logger,_ as removeColor,s as setPrefix,u as spinnerFrames,S as v,x};
2
2
  //# sourceMappingURL=logger.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.mjs","names":[],"sources":["../../src/logger.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { CustomIntlayerConfig } from '@intlayer/types/config';\n\nexport type Details = {\n isVerbose?: boolean;\n level?: 'info' | 'warn' | 'error' | 'debug';\n config?: CustomIntlayerConfig['log'];\n};\n\nexport type Logger = (content: any, details?: Details) => void;\n\nlet loggerPrefix: string | undefined;\n\nexport const setPrefix = (prefix: string | undefined) => {\n loggerPrefix = prefix;\n};\n\nexport const getPrefix = (configPrefix?: string): string | undefined => {\n if (typeof loggerPrefix !== 'undefined') {\n return loggerPrefix;\n }\n\n return configPrefix;\n};\n\nexport const logger: Logger = (content, details) => {\n const isVerbose = details?.isVerbose ?? false;\n const mode = details?.config?.mode ?? 'default';\n const level = details?.level ?? 'info';\n const prefix = getPrefix(details?.config?.prefix);\n const log = details?.config?.log ?? console.log;\n const info = details?.config?.info ?? console.info;\n const warn = details?.config?.warn ?? console.warn;\n const error = details?.config?.error ?? console.error;\n const debug = details?.config?.debug ?? console.debug;\n\n if (mode === 'disabled') return;\n\n if (isVerbose && mode !== 'verbose') return;\n\n const flatContent = prefix ? [prefix, ...[content].flat()] : [content].flat();\n\n if (level === 'debug') {\n return debug(...flatContent);\n }\n\n if (level === 'info') {\n return info(...flatContent);\n }\n\n if (level === 'warn') {\n return warn(...flatContent);\n }\n\n if (level === 'error') {\n return error(...flatContent);\n }\n\n log(...flatContent);\n};\n\nexport enum ANSIColors {\n RESET = '\\x1b[0m',\n GREY = '\\x1b[90m',\n GREY_DARK = '\\x1b[38;5;239m',\n GREY_LIGHT = '\\x1b[38;5;252m',\n BLUE = '\\x1b[34m',\n RED = '\\x1b[31m',\n GREEN = '\\x1b[32m',\n YELLOW = '\\x1b[38;5;226m',\n MAGENTA = '\\x1b[35m',\n BEIGE = '\\x1b[38;5;3m',\n ORANGE = '\\x1b[38;5;208m',\n CYAN = '\\x1b[36m',\n WHITE = '\\x1b[37m',\n BOLD = '\\x1b[1m',\n}\n\nexport const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\n/**\n * The appLogger function takes the logger and merges it with the configuration from the intlayer config file.\n * It allows overriding the default configuration by passing a config object in the details parameter.\n * The configuration is merged with the default configuration from the intlayer config file.\n */\nexport const getAppLogger =\n (configuration?: CustomIntlayerConfig, globalDetails?: Details) =>\n (content: any, details?: Details) =>\n logger(content, {\n ...(details ?? {}),\n config: {\n ...configuration?.log,\n ...globalDetails?.config,\n ...(details?.config ?? {}),\n },\n });\n\nexport const colorize = (\n s: string,\n color?: ANSIColors,\n reset?: boolean | ANSIColors\n): string =>\n color\n ? `${color}${s}${reset ? (typeof reset === 'boolean' ? ANSIColors.RESET : reset) : ANSIColors.RESET}`\n : s;\n\nexport const colorizeLocales = (\n locales: Locale | Locale[],\n color = ANSIColors.GREEN,\n reset: boolean | ANSIColors = ANSIColors.RESET\n) =>\n [locales]\n .flat()\n .map((locale) => colorize(locale, color, reset))\n .join(`, `);\n\nexport const colorizeKey = (\n keyPath: string | string[],\n color = ANSIColors.BEIGE,\n reset: boolean | ANSIColors = ANSIColors.RESET\n) =>\n [keyPath]\n .flat()\n .map((key) => colorize(key, color, reset))\n .join(`, `);\n\nexport const colorizePath = (\n path: string | string[],\n color = ANSIColors.GREY,\n reset: boolean | ANSIColors = ANSIColors.RESET\n) =>\n [path]\n .flat()\n .map((p) => colorize(p, color, reset))\n .join(`, `);\n\n/**\n * Colorize numeric value using Intl.NumberFormat and optional ANSI colors.\n *\n * Examples:\n * colorizeNumber(2, [{ pluralRule: 'one' , color: ANSIColors.GREEN}, { pluralRule: 'other' , color: ANSIColors.RED}]) // \"'\\x1b[31m2\\x1b[0m\"\n */\nexport const colorizeNumber = (\n number: number | string,\n options: Partial<Record<Intl.LDMLPluralRule, ANSIColors>> = {\n zero: ANSIColors.BLUE,\n one: ANSIColors.BLUE,\n two: ANSIColors.BLUE,\n few: ANSIColors.BLUE,\n many: ANSIColors.BLUE,\n other: ANSIColors.BLUE,\n }\n): string => {\n if (number === 0) {\n const color = options.zero ?? ANSIColors.GREEN;\n return colorize(number.toString(), color);\n }\n\n const rule = new Intl.PluralRules('en').select(Number(number));\n const color = options[rule];\n return colorize(number.toString(), color);\n};\n\nexport const removeColor = (text: string) =>\n // biome-ignore lint/suspicious/noControlCharactersInRegex: we need to remove the color codes\n text.replace(/\\x1b\\[[0-9;]*m/g, '');\n\nconst getLength = (length: number | number[] | string | string[]): number => {\n let value: number = 0;\n if (typeof length === 'number') {\n value = length;\n }\n if (typeof length === 'string') {\n value = length.length;\n }\n if (Array.isArray(length) && length.every((l) => typeof l === 'string')) {\n value = Math.max(...length.map((str) => str.length));\n }\n if (Array.isArray(length) && length.every((l) => typeof l === 'number')) {\n value = Math.max(...length);\n }\n return Math.max(value, 0);\n};\n\nconst defaultColonOptions = {\n colSize: 0,\n minSize: 0,\n maxSize: Infinity,\n pad: 'right',\n padChar: '0',\n};\n\n/**\n * Create a string of spaces of a given length.\n *\n * @param colSize - The length of the string to create.\n * @returns A string of spaces.\n */\nexport const colon = (\n text: string | string[],\n options?: {\n colSize?: number | number[] | string | string[];\n minSize?: number;\n maxSize?: number;\n pad?: 'left' | 'right';\n padChar?: string;\n }\n): string =>\n [text]\n .flat()\n .map((text) => {\n const { colSize, minSize, maxSize, pad } = {\n ...defaultColonOptions,\n ...(options ?? {}),\n };\n\n const length = getLength(colSize);\n const spacesLength = Math.max(\n minSize!,\n Math.min(maxSize!, length - removeColor(text).length)\n );\n\n if (pad === 'left') {\n return `${' '.repeat(spacesLength)}${text}`;\n }\n\n return `${text}${' '.repeat(spacesLength)}`;\n })\n .join('');\n\nexport const x = colorize('✗', ANSIColors.RED);\nexport const v = colorize('✓', ANSIColors.GREEN);\nexport const clock = colorize('⏲', ANSIColors.BLUE);\n"],"mappings":"AAWA,IAAI,EAEJ,MAAa,EAAa,GAA+B,CACvD,EAAe,GAGJ,EAAa,GACb,IAAiB,OAIrB,EAHE,EAME,GAAkB,EAAS,IAAY,CAClD,IAAM,EAAY,GAAS,WAAa,GAClC,EAAO,GAAS,QAAQ,MAAQ,UAChC,EAAQ,GAAS,OAAS,OAC1B,EAAS,EAAU,GAAS,QAAQ,OAAO,CAC3C,EAAM,GAAS,QAAQ,KAAO,QAAQ,IACtC,EAAO,GAAS,QAAQ,MAAQ,QAAQ,KACxC,EAAO,GAAS,QAAQ,MAAQ,QAAQ,KACxC,EAAQ,GAAS,QAAQ,OAAS,QAAQ,MAC1C,EAAQ,GAAS,QAAQ,OAAS,QAAQ,MAIhD,GAFI,IAAS,YAET,GAAa,IAAS,UAAW,OAErC,IAAM,EAAc,EAAS,CAAC,EAAQ,GAAG,CAAC,EAAQ,CAAC,MAAM,CAAC,CAAG,CAAC,EAAQ,CAAC,MAAM,CAE7E,GAAI,IAAU,QACZ,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C,GAAG,IAAO,IAAI,OAAO,EAAa,IACzC,CACD,KAAK,GAAG,CAEA,EAAI,EAAS,IAAK,EAAW,IAAI,CACjC,EAAI,EAAS,IAAK,EAAW,MAAM,CACnC,EAAQ,EAAS,IAAK,EAAW,KAAK"}
1
+ {"version":3,"file":"logger.mjs","names":["ANSIColors.RESET","ANSIColors.GREEN","ANSIColors.BEIGE","ANSIColors.GREY","ANSIColors.BLUE","ANSIColors.RED"],"sources":["../../src/logger.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport * as ANSIColors from './colors';\n\nexport type ANSIColorsType = (typeof ANSIColors)[keyof typeof ANSIColors];\n\nexport type Details = {\n isVerbose?: boolean;\n level?: 'info' | 'warn' | 'error' | 'debug';\n config?: CustomIntlayerConfig['log'];\n};\n\nexport type Logger = (content: any, details?: Details) => void;\n\nlet loggerPrefix: string | undefined;\n\nexport const setPrefix = (prefix: string | undefined) => {\n loggerPrefix = prefix;\n};\n\nexport const getPrefix = (configPrefix?: string): string | undefined => {\n if (typeof loggerPrefix !== 'undefined') {\n return loggerPrefix;\n }\n\n return configPrefix;\n};\n\nexport const logger: Logger = (content, details) => {\n const isVerbose = details?.isVerbose ?? false;\n const mode = details?.config?.mode ?? 'default';\n const level = details?.level ?? 'info';\n const prefix = getPrefix(details?.config?.prefix);\n const log = details?.config?.log ?? console.log;\n const info = details?.config?.info ?? console.info;\n const warn = details?.config?.warn ?? console.warn;\n const error = details?.config?.error ?? console.error;\n const debug = details?.config?.debug ?? console.debug;\n\n if (mode === 'disabled') return;\n\n if (isVerbose && mode !== 'verbose') return;\n\n const flatContent = prefix ? [prefix, ...[content].flat()] : [content].flat();\n\n if (level === 'debug') {\n return debug(...flatContent);\n }\n\n if (level === 'info') {\n return info(...flatContent);\n }\n\n if (level === 'warn') {\n return warn(...flatContent);\n }\n\n if (level === 'error') {\n return error(...flatContent);\n }\n\n log(...flatContent);\n};\n\nexport const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\n/**\n * The appLogger function takes the logger and merges it with the configuration from the intlayer config file.\n * It allows overriding the default configuration by passing a config object in the details parameter.\n * The configuration is merged with the default configuration from the intlayer config file.\n */\nexport const getAppLogger =\n (configuration?: CustomIntlayerConfig, globalDetails?: Details) =>\n (content: any, details?: Details) =>\n logger(content, {\n ...(details ?? {}),\n config: {\n ...configuration?.log,\n ...globalDetails?.config,\n ...(details?.config ?? {}),\n },\n });\n\nexport const colorize = (\n s: string,\n color?: ANSIColorsType,\n reset?: boolean | ANSIColorsType\n): string =>\n color\n ? `${color}${s}${reset ? (typeof reset === 'boolean' ? ANSIColors.RESET : reset) : ANSIColors.RESET}`\n : s;\n\nexport const colorizeLocales = (\n locales: Locale | Locale[],\n color = ANSIColors.GREEN,\n reset: boolean | ANSIColorsType = ANSIColors.RESET\n) =>\n [locales]\n .flat()\n .map((locale) => colorize(locale, color, reset))\n .join(`, `);\n\nexport const colorizeKey = (\n keyPath: string | string[],\n color = ANSIColors.BEIGE,\n reset: boolean | ANSIColorsType = ANSIColors.RESET\n) =>\n [keyPath]\n .flat()\n .map((key) => colorize(key, color, reset))\n .join(`, `);\n\nexport const colorizePath = (\n path: string | string[],\n color = ANSIColors.GREY,\n reset: boolean | ANSIColorsType = ANSIColors.RESET\n) =>\n [path]\n .flat()\n .map((path) => colorize(path, color, reset))\n .join(`, `);\n\n/**\n * Colorize numeric value using Intl.NumberFormat and optional ANSI colors.\n *\n * Examples:\n * colorizeNumber(2, [{ pluralRule: 'one' , color: ANSIColors.GREEN}, { pluralRule: 'other' , color: ANSIColors.RED}]) // \"'\\x1b[31m2\\x1b[0m\"\n */\nexport const colorizeNumber = (\n number: number | string,\n options: Partial<Record<Intl.LDMLPluralRule, ANSIColorsType>> = {\n zero: ANSIColors.BLUE,\n one: ANSIColors.BLUE,\n two: ANSIColors.BLUE,\n few: ANSIColors.BLUE,\n many: ANSIColors.BLUE,\n other: ANSIColors.BLUE,\n }\n): string => {\n if (number === 0) {\n const color = options.zero ?? ANSIColors.GREEN;\n return colorize(number.toString(), color);\n }\n\n const rule = new Intl.PluralRules('en').select(Number(number));\n const color = options[rule];\n return colorize(number.toString(), color);\n};\n\nexport const removeColor = (text: string) =>\n // biome-ignore lint/suspicious/noControlCharactersInRegex: we need to remove the color codes\n text.replace(/\\x1b\\[[0-9;]*m/g, '');\n\nconst getLength = (length: number | number[] | string | string[]): number => {\n let value: number = 0;\n if (typeof length === 'number') {\n value = length;\n }\n if (typeof length === 'string') {\n value = length.length;\n }\n if (Array.isArray(length) && length.every((l) => typeof l === 'string')) {\n value = Math.max(...length.map((str) => str.length));\n }\n if (Array.isArray(length) && length.every((l) => typeof l === 'number')) {\n value = Math.max(...length);\n }\n return Math.max(value, 0);\n};\n\nconst defaultColonOptions = {\n colSize: 0,\n minSize: 0,\n maxSize: Infinity,\n pad: 'right',\n padChar: '0',\n};\n\n/**\n * Create a string of spaces of a given length.\n *\n * @param colSize - The length of the string to create.\n * @returns A string of spaces.\n */\nexport const colon = (\n text: string | string[],\n options?: {\n colSize?: number | number[] | string | string[];\n minSize?: number;\n maxSize?: number;\n pad?: 'left' | 'right';\n padChar?: string;\n }\n): string =>\n [text]\n .flat()\n .map((text) => {\n const { colSize, minSize, maxSize, pad } = {\n ...defaultColonOptions,\n ...(options ?? {}),\n };\n\n const length = getLength(colSize);\n const spacesLength = Math.max(\n minSize!,\n Math.min(maxSize!, length - removeColor(text).length)\n );\n\n if (pad === 'left') {\n return `${' '.repeat(spacesLength)}${text}`;\n }\n\n return `${text}${' '.repeat(spacesLength)}`;\n })\n .join('');\n\nexport const x = colorize('✗', ANSIColors.RED);\nexport const v = colorize('✓', ANSIColors.GREEN);\nexport const clock = colorize('⏲', ANSIColors.BLUE);\n"],"mappings":"wFAcA,IAAI,EAEJ,MAAa,EAAa,GAA+B,CACvD,EAAe,GAGJ,EAAa,GACb,IAAiB,OAIrB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EAAU,EAAQ,CAC3B,EAAe,KAAK,IACxB,EACA,KAAK,IAAI,EAAU,EAAS,EAAY,EAAK,CAAC,OAAO,CACtD,CAMD,OAJI,IAAQ,OACH,GAAG,IAAI,OAAO,EAAa,GAAG,IAGhC,GAAG,IAAO,IAAI,OAAO,EAAa,IACzC,CACD,KAAK,GAAG,CAEA,EAAI,EAAS,IAAKC,EAAe,CACjC,EAAI,EAAS,IAAKJ,EAAiB,CACnC,EAAQ,EAAS,IAAKG,EAAgB"}
package/dist/esm/node.mjs CHANGED
@@ -1 +1 @@
1
- import{buildConfigurationFields as e}from"./configFile/buildConfigurationFields.mjs";import{aiSchema as t,buildSchema as n,compilerSchema as r,contentSchema as i,cookiesAttributesSchema as a,dictionarySchema as o,editorSchema as s,internationalizationSchema as c,intlayerConfigSchema as l,logSchema as u,rewriteObjectSchema as d,rewriteRuleSchema as f,rewriteRulesSchema as p,routingSchema as m,storageAttributesSchema as h,storageSchema as g,systemSchema as _}from"./configFile/configurationSchema.mjs";import{configurationFilesCandidates as v,searchConfigurationFile as y}from"./configFile/searchConfigurationFile.mjs";import{getConfiguration as b,getConfigurationAndFilePath as x}from"./configFile/getConfiguration.mjs";import{t as S}from"./defaultValues/index.mjs";export{S as DefaultValues,t as aiSchema,e as buildConfigurationFields,n as buildSchema,r as compilerSchema,v as configurationFilesCandidates,i as contentSchema,a as cookiesAttributesSchema,o as dictionarySchema,s as editorSchema,b as getConfiguration,x as getConfigurationAndFilePath,c as internationalizationSchema,l as intlayerConfigSchema,u as logSchema,d as rewriteObjectSchema,f as rewriteRuleSchema,p as rewriteRulesSchema,m as routingSchema,y as searchConfigurationFile,h as storageAttributesSchema,g as storageSchema,_ as systemSchema};
1
+ import{buildConfigurationFields as e}from"./configFile/buildConfigurationFields.mjs";import{aiSchema as t,buildSchema as n,compilerSchema as r,contentSchema as i,cookiesAttributesSchema as a,dictionarySchema as o,editorSchema as s,internationalizationSchema as c,intlayerConfigSchema as l,logSchema as u,rewriteObjectSchema as d,rewriteRuleSchema as f,rewriteRulesSchema as p,routingSchema as m,storageAttributesSchema as h,storageSchema as g,systemSchema as _}from"./configFile/configurationSchema.mjs";import{configurationFilesCandidates as v,searchConfigurationFile as y}from"./configFile/searchConfigurationFile.mjs";import{getConfiguration as b,getConfigurationAndFilePath as x}from"./configFile/getConfiguration.mjs";export{t as aiSchema,e as buildConfigurationFields,n as buildSchema,r as compilerSchema,v as configurationFilesCandidates,i as contentSchema,a as cookiesAttributesSchema,o as dictionarySchema,s as editorSchema,b as getConfiguration,x as getConfigurationAndFilePath,c as internationalizationSchema,l as intlayerConfigSchema,u as logSchema,d as rewriteObjectSchema,f as rewriteRuleSchema,p as rewriteRulesSchema,m as routingSchema,y as searchConfigurationFile,h as storageAttributesSchema,g as storageSchema,_ as systemSchema};
@@ -1,2 +1 @@
1
- import{n as e}from"../chunk-DXQkyQJp.mjs";import{getPackageJsonPath as t}from"./getPackageJsonPath.mjs";import{createRequire as n}from"node:module";const r=typeof import.meta.url==`string`,i=e=>{let{packageJsonPath:r}=t(e);return n(r)},a=r?n(import.meta.url):e;export{a as configESMxCJSRequire,i as getProjectRequire,r as isESModule};
2
- //# sourceMappingURL=ESMxCJSHelpers.mjs.map
1
+ import{n as e,r as t,t as n}from"../ESMxCJSHelpers-BAuqwNXV.mjs";export{n as configESMxCJSRequire,e as getProjectRequire,t as isESModule};
@@ -1,2 +1,2 @@
1
- import{configESMxCJSRequire as e}from"./ESMxCJSHelpers.mjs";const t=(n,r=new Set)=>{if(!r.has(n)){r.add(n);try{let i=e.resolve(n),a=e.cache[i];a&&(a.children&&a.children.forEach(e=>{t(e.filename,r)}),delete e.cache[i])}catch(e){console.warn(`Could not clear cache for module: ${n}`,e)}}};export{t as clearModuleCache};
1
+ import{t as e}from"../ESMxCJSHelpers-BAuqwNXV.mjs";const t=(n,r=new Set)=>{if(!r.has(n)){r.add(n);try{let i=e.resolve(n),a=e.cache[i];a&&(a.children&&a.children.forEach(e=>{t(e.filename,r)}),delete e.cache[i])}catch(e){console.warn(`Could not clear cache for module: ${n}`,e)}}};export{t as clearModuleCache};
2
2
  //# sourceMappingURL=clearModuleCache.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"clearModuleCache.mjs","names":[],"sources":["../../../src/utils/clearModuleCache.ts"],"sourcesContent":["import { configESMxCJSRequire } from './ESMxCJSHelpers';\n\n/**\n * Recursively clears the require cache for a module and all its dependencies\n */\nexport const clearModuleCache = (\n modulePath: string,\n visited = new Set<string>()\n) => {\n // Avoid infinite loops\n if (visited.has(modulePath)) {\n return;\n }\n visited.add(modulePath);\n\n try {\n const resolvedPath = configESMxCJSRequire.resolve(modulePath);\n\n // Get the cached module\n const cachedModule = configESMxCJSRequire.cache[resolvedPath];\n\n if (cachedModule) {\n // Clear cache for all children (dependencies) first\n if (cachedModule.children) {\n cachedModule.children.forEach((child) => {\n clearModuleCache(child.filename, visited);\n });\n }\n\n // Clear the cache for this module\n delete configESMxCJSRequire.cache[resolvedPath];\n }\n } catch (error) {\n // Module might not exist or be resolvable, skip it\n console.warn(`Could not clear cache for module: ${modulePath}`, error);\n }\n};\n"],"mappings":"4DAKA,MAAa,GACX,EACA,EAAU,IAAI,MACX,CAEC,MAAQ,IAAI,EAAW,CAG3B,GAAQ,IAAI,EAAW,CAEvB,GAAI,CACF,IAAM,EAAe,EAAqB,QAAQ,EAAW,CAGvD,EAAe,EAAqB,MAAM,GAE5C,IAEE,EAAa,UACf,EAAa,SAAS,QAAS,GAAU,CACvC,EAAiB,EAAM,SAAU,EAAQ,EACzC,CAIJ,OAAO,EAAqB,MAAM,UAE7B,EAAO,CAEd,QAAQ,KAAK,qCAAqC,IAAc,EAAM"}
1
+ {"version":3,"file":"clearModuleCache.mjs","names":[],"sources":["../../../src/utils/clearModuleCache.ts"],"sourcesContent":["import { configESMxCJSRequire } from './ESMxCJSHelpers';\n\n/**\n * Recursively clears the require cache for a module and all its dependencies\n */\nexport const clearModuleCache = (\n modulePath: string,\n visited = new Set<string>()\n) => {\n // Avoid infinite loops\n if (visited.has(modulePath)) {\n return;\n }\n visited.add(modulePath);\n\n try {\n const resolvedPath = configESMxCJSRequire.resolve(modulePath);\n\n // Get the cached module\n const cachedModule = configESMxCJSRequire.cache[resolvedPath];\n\n if (cachedModule) {\n // Clear cache for all children (dependencies) first\n if (cachedModule.children) {\n cachedModule.children.forEach((child) => {\n clearModuleCache(child.filename, visited);\n });\n }\n\n // Clear the cache for this module\n delete configESMxCJSRequire.cache[resolvedPath];\n }\n } catch (error) {\n // Module might not exist or be resolvable, skip it\n console.warn(`Could not clear cache for module: ${modulePath}`, error);\n }\n};\n"],"mappings":"mDAKA,MAAa,GACX,EACA,EAAU,IAAI,MACX,CAEC,MAAQ,IAAI,EAAW,CAG3B,GAAQ,IAAI,EAAW,CAEvB,GAAI,CACF,IAAM,EAAe,EAAqB,QAAQ,EAAW,CAGvD,EAAe,EAAqB,MAAM,GAE5C,IAEE,EAAa,UACf,EAAa,SAAS,QAAS,GAAU,CACvC,EAAiB,EAAM,SAAU,EAAQ,EACzC,CAIJ,OAAO,EAAqB,MAAM,UAE7B,EAAO,CAEd,QAAQ,KAAK,qCAAqC,IAAc,EAAM"}