@intlayer/config 8.2.1 → 8.2.3

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 (51) hide show
  1. package/dist/cjs/client.cjs +1 -1
  2. package/dist/cjs/configFile/buildConfigurationFields.cjs +1 -1
  3. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  4. package/dist/cjs/configFile/getConfiguration.cjs +1 -1
  5. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  6. package/dist/cjs/configFile/searchConfigurationFile.cjs +1 -1
  7. package/dist/cjs/defaultValues/build.cjs +1 -1
  8. package/dist/cjs/defaultValues/build.cjs.map +1 -1
  9. package/dist/cjs/defaultValues/content.cjs +1 -1
  10. package/dist/cjs/defaultValues/content.cjs.map +1 -1
  11. package/dist/cjs/defaultValues/dictionary.cjs +1 -1
  12. package/dist/cjs/defaultValues/dictionary.cjs.map +1 -1
  13. package/dist/cjs/defaultValues/editor.cjs +1 -1
  14. package/dist/cjs/defaultValues/editor.cjs.map +1 -1
  15. package/dist/cjs/defaultValues/routing.cjs +1 -1
  16. package/dist/cjs/defaultValues/routing.cjs.map +1 -1
  17. package/dist/cjs/loadExternalFile/loadExternalFile.cjs +1 -1
  18. package/dist/cjs/loadExternalFile/parseFileContent.cjs +1 -1
  19. package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs +1 -1
  20. package/dist/cjs/logger.cjs.map +1 -1
  21. package/dist/cjs/utils/getPackageJsonPath.cjs +1 -1
  22. package/dist/esm/client.mjs +1 -1
  23. package/dist/esm/configFile/buildConfigurationFields.mjs +1 -1
  24. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  25. package/dist/esm/configFile/getConfiguration.mjs +1 -1
  26. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  27. package/dist/esm/configFile/searchConfigurationFile.mjs +1 -1
  28. package/dist/esm/defaultValues/build.mjs +1 -1
  29. package/dist/esm/defaultValues/build.mjs.map +1 -1
  30. package/dist/esm/defaultValues/content.mjs +1 -1
  31. package/dist/esm/defaultValues/content.mjs.map +1 -1
  32. package/dist/esm/defaultValues/dictionary.mjs +1 -1
  33. package/dist/esm/defaultValues/dictionary.mjs.map +1 -1
  34. package/dist/esm/defaultValues/editor.mjs +1 -1
  35. package/dist/esm/defaultValues/editor.mjs.map +1 -1
  36. package/dist/esm/defaultValues/routing.mjs +1 -1
  37. package/dist/esm/defaultValues/routing.mjs.map +1 -1
  38. package/dist/esm/loadExternalFile/loadExternalFile.mjs +1 -1
  39. package/dist/esm/loadExternalFile/parseFileContent.mjs +1 -1
  40. package/dist/esm/loadExternalFile/transpileTSToCJS.mjs +1 -1
  41. package/dist/esm/logger.mjs.map +1 -1
  42. package/dist/esm/utils/getPackageJsonPath.mjs +1 -1
  43. package/dist/types/client.d.ts +1 -2
  44. package/dist/types/configFile/getConfiguration.d.ts +1 -0
  45. package/dist/types/configFile/getConfiguration.d.ts.map +1 -1
  46. package/dist/types/defaultValues/content.d.ts.map +1 -1
  47. package/dist/types/utils/index.d.ts +1 -1
  48. package/package.json +4 -9
  49. package/dist/cjs/index.cjs +0 -1
  50. package/dist/esm/index.mjs +0 -1
  51. package/dist/types/index.d.ts +0 -28
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./logger.cjs`),t=require(`./utils/normalizePath.cjs`),n=require(`./utils/extractErrorMessage.cjs`),r=require(`./utils/logStack.cjs`),i=require(`./utils/stringFormatter/camelCaseToKebabCase.cjs`),a=require(`./utils/stringFormatter/camelCaseToSentence.cjs`),o=require(`./utils/stringFormatter/kebabCaseToCamelCase.cjs`),s=require(`./utils/stringFormatter/toLowerCamelCase.cjs`),c=require(`./defaultValues/index.cjs`);exports.ANSIColors=e.ANSIColors,Object.defineProperty(exports,`DefaultValues`,{enumerable:!0,get:function(){return c.defaultValues_exports}}),exports.camelCaseToKebabCase=i.camelCaseToKebabCase,exports.camelCaseToSentence=a.camelCaseToSentence,exports.clock=e.clock,exports.colon=e.colon,exports.colorize=e.colorize,exports.colorizeKey=e.colorizeKey,exports.colorizeLocales=e.colorizeLocales,exports.colorizeNumber=e.colorizeNumber,exports.colorizePath=e.colorizePath,exports.extractErrorMessage=n.extractErrorMessage,exports.getAppLogger=e.getAppLogger,exports.getPrefix=e.getPrefix,exports.kebabCaseToCamelCase=o.kebabCaseToCamelCase,exports.logStack=r.logStack,exports.logger=e.logger,exports.normalizePath=t.normalizePath,exports.removeColor=e.removeColor,exports.setPrefix=e.setPrefix,exports.spinnerFrames=e.spinnerFrames,exports.toLowerCamelCase=s.toLowerCamelCase,exports.v=e.v,exports.x=e.x;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./utils/normalizePath.cjs`),t=require(`./utils/extractErrorMessage.cjs`),n=require(`./utils/logStack.cjs`),r=require(`./utils/stringFormatter/camelCaseToKebabCase.cjs`),i=require(`./utils/stringFormatter/camelCaseToSentence.cjs`),a=require(`./utils/stringFormatter/kebabCaseToCamelCase.cjs`),o=require(`./utils/stringFormatter/toLowerCamelCase.cjs`),s=require(`./defaultValues/index.cjs`);Object.defineProperty(exports,`DefaultValues`,{enumerable:!0,get:function(){return s.defaultValues_exports}}),exports.camelCaseToKebabCase=r.camelCaseToKebabCase,exports.camelCaseToSentence=i.camelCaseToSentence,exports.extractErrorMessage=t.extractErrorMessage,exports.kebabCaseToCamelCase=a.kebabCaseToCamelCase,exports.logStack=n.logStack,exports.normalizePath=e.normalizePath,exports.toLowerCamelCase=o.toLowerCamelCase;
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../defaultValues/build.cjs`),n=require(`../defaultValues/compiler.cjs`),r=require(`../defaultValues/content.cjs`),i=require(`../defaultValues/dictionary.cjs`),a=require(`../defaultValues/editor.cjs`),o=require(`../defaultValues/internationalization.cjs`),s=require(`../defaultValues/log.cjs`),c=require(`../defaultValues/routing.cjs`),l=require(`../defaultValues/system.cjs`),u=require(`../utils/normalizePath.cjs`),d=require(`../utils/ESMxCJSHelpers.cjs`);let f=require(`node:path`),p=require(`node:fs`),m=require(`@intlayer/types/package.json`);m=e.__toESM(m);let h;const g=e=>({locales:e?.locales??o.LOCALES,requiredLocales:e?.requiredLocales??e?.locales??o.REQUIRED_LOCALES,strictMode:e?.strictMode??o.STRICT_MODE,defaultLocale:e?.defaultLocale??o.DEFAULT_LOCALE}),_=e=>({mode:e?.mode??c.ROUTING_MODE,storage:e?.storage??c.STORAGE,basePath:e?.basePath??c.BASE_PATH,rewrite:e?.rewrite}),v=(e,t)=>{let n=e?.fileExtensions??r.FILE_EXTENSIONS,i=e?.baseDir??t??process.cwd(),a=e=>{let t;try{t=d.getProjectRequire(i).resolve(e,{paths:[i]})}catch{try{t=require.resolve(e,{paths:[i]})}catch{t=(0,f.isAbsolute)(e)?e:(0,f.join)(i,e)}}try{if((0,p.statSync)(t).isFile())return(0,f.dirname)(t)}catch{if(/\.[a-z0-9]+$/i.test(t))return(0,f.dirname)(t)}return t},o=(e?.contentDir??r.CONTENT_DIR).map(a);return{fileExtensions:n,baseDir:i,contentDir:o,codeDir:(e?.codeDir??r.CODE_DIR).map(a),excludedPath:e?.excludedPath??r.EXCLUDED_PATHS,watch:e?.watch??r.WATCH,formatCommand:e?.formatCommand,watchedFilesPattern:n.map(e=>`/**/*${e}`),watchedFilesPatternWithPath:n.flatMap(e=>o.map(t=>`${u.normalizePath(t)}/**/*${e}`))}},y=(e,t)=>{let n=t?.baseDir??process.cwd(),r=e=>{let t;try{t=d.getProjectRequire(n).resolve(e,{paths:[n]})}catch{t=(0,f.isAbsolute)(e)?e:(0,f.join)(n,e)}try{if((0,p.statSync)(t).isFile())return(0,f.dirname)(t)}catch{if(/\.[a-z0-9]+$/i.test(t))return(0,f.dirname)(t)}return t},i=r(e?.dictionariesDir??l.DICTIONARIES_DIR);return{moduleAugmentationDir:r(e?.moduleAugmentationDir??l.MODULE_AUGMENTATION_DIR),unmergedDictionariesDir:r(e?.unmergedDictionariesDir??l.UNMERGED_DICTIONARIES_DIR),remoteDictionariesDir:r(e?.remoteDictionariesDir??l.REMOTE_DICTIONARIES_DIR),dictionariesDir:i,dynamicDictionariesDir:r(e?.dynamicDictionariesDir??l.DYNAMIC_DICTIONARIES_DIR),fetchDictionariesDir:r(e?.fetchDictionariesDir??l.FETCH_DICTIONARIES_DIR),typesDir:r(e?.typesDir??l.TYPES_DIR),mainDir:r(e?.mainDir??l.MAIN_DIR),configDir:r(e?.configDir??l.CONFIG_DIR),cacheDir:r(e?.cacheDir??l.CACHE_DIR),tempDir:r(e?.tempDir??l.TEMP_DIR),outputFilesPatternWithPath:`${u.normalizePath(i)}/**/*.json`}},b=e=>({applicationURL:e?.applicationURL??a.APPLICATION_URL,editorURL:e?.editorURL??a.EDITOR_URL,cmsURL:e?.cmsURL??a.CMS_URL,backendURL:e?.backendURL??a.BACKEND_URL,port:e?.port??a.PORT,enabled:e?.enabled??a.IS_ENABLED,clientId:e?.clientId??void 0,clientSecret:e?.clientSecret??void 0,dictionaryPriorityStrategy:e?.dictionaryPriorityStrategy??a.DICTIONARY_PRIORITY_STRATEGY,liveSync:e?.liveSync??a.LIVE_SYNC,liveSyncPort:e?.liveSyncPort??a.LIVE_SYNC_PORT,liveSyncURL:e?.liveSyncURL??`http://localhost:${e?.liveSyncPort??a.LIVE_SYNC_PORT}`}),x=(e,t)=>({mode:e?.mode??s.MODE,prefix:e?.prefix??s.PREFIX,error:t?.error,log:t?.log,info:t?.info,warn:t?.warn}),S=e=>({provider:e?.provider,apiKey:e?.apiKey,model:e?.model,temperature:e?.temperature,applicationContext:e?.applicationContext,baseURL:e?.baseURL,dataSerialization:e?.dataSerialization}),C=e=>({mode:e?.mode??t.BUILD_MODE,optimize:e?.optimize,importMode:e?.importMode,traversePattern:e?.traversePattern??t.TRAVERSE_PATTERN,outputFormat:e?.outputFormat??t.OUTPUT_FORMAT,cache:e?.cache??t.CACHE,require:e?.require,checkTypes:e?.checkTypes??t.TYPE_CHECKING}),w=e=>({enabled:e?.enabled??n.COMPILER_ENABLED,dictionaryKeyPrefix:e?.dictionaryKeyPrefix??n.COMPILER_DICTIONARY_KEY_PREFIX,transformPattern:e?.transformPattern??n.COMPILER_TRANSFORM_PATTERN,excludePattern:e?.excludePattern??n.COMPILER_EXCLUDE_PATTERN,outputDir:e?.outputDir??n.COMPILER_OUTPUT_DIR,saveComponents:e?.saveComponents??n.COMPILER_SAVE_COMPONENTS}),T=e=>{let t=e?.contentAutoTransformation??i.CONTENT_AUTO_TRANSFORMATION;return{fill:e?.fill??i.FILL,contentAutoTransformation:typeof t==`object`?{markdown:t.markdown??!1,html:t.html??!1,insertion:t.insertion??!1}:t,location:e?.location??i.LOCATION,locale:e?.locale,title:e?.title,description:e?.description,tags:e?.tags,priority:e?.priority,importMode:e?.importMode??i.IMPORT_MODE,version:e?.version}},E=(e,t,n)=>{let r=g(e?.internationalization),i=_(e?.routing),a=v(e?.content,t);return h={internationalization:r,routing:i,content:a,system:y(e?.system,a),editor:b(e?.editor),log:x(e?.log,n),ai:S(e?.ai),build:C(e?.build),compiler:w(e?.compiler),dictionary:T(e?.dictionary),plugins:e?.plugins,schemas:e?.schemas,metadata:{name:`Intlayer`,version:m.default.version,doc:`https://intlayer.org/docs`}},h};exports.buildConfigurationFields=E;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../defaultValues/build.cjs`),n=require(`../defaultValues/compiler.cjs`),r=require(`../defaultValues/content.cjs`);require(`../defaultValues/dictionary.cjs`),require(`../defaultValues/editor.cjs`);const i=require(`../defaultValues/internationalization.cjs`),a=require(`../defaultValues/log.cjs`),o=require(`../defaultValues/routing.cjs`);require(`../defaultValues/system.cjs`);const s=require(`../utils/normalizePath.cjs`),c=require(`../utils/ESMxCJSHelpers.cjs`);let l=require(`node:fs`),u=require(`node:path`),d=require(`@intlayer/types/package.json`);d=e.__toESM(d);let f;const p=e=>({locales:e?.locales??i.LOCALES,requiredLocales:e?.requiredLocales??e?.locales??i.REQUIRED_LOCALES,strictMode:e?.strictMode??`inclusive`,defaultLocale:e?.defaultLocale??i.DEFAULT_LOCALE}),m=e=>({mode:e?.mode??`prefix-no-default`,storage:e?.storage??o.STORAGE,basePath:e?.basePath??``,rewrite:e?.rewrite}),h=(e,t)=>{let n=e?.fileExtensions??r.FILE_EXTENSIONS,i=e?.baseDir??t??process.cwd(),a=e=>{let t;try{t=c.getProjectRequire(i).resolve(e,{paths:[i]})}catch{try{t=require.resolve(e,{paths:[i]})}catch{t=(0,u.isAbsolute)(e)?e:(0,u.join)(i,e)}}try{if((0,l.statSync)(t).isFile())return(0,u.dirname)(t)}catch{if(/\.[a-z0-9]+$/i.test(t))return(0,u.dirname)(t)}return t},o=(e?.contentDir??r.CONTENT_DIR).map(a);return{fileExtensions:n,baseDir:i,contentDir:o,codeDir:(e?.codeDir??r.CODE_DIR).map(a),excludedPath:e?.excludedPath??r.EXCLUDED_PATHS,watch:e?.watch??!0,formatCommand:e?.formatCommand,watchedFilesPattern:n.map(e=>`/**/*${e}`),watchedFilesPatternWithPath:n.flatMap(e=>o.map(t=>`${s.normalizePath(t)}/**/*${e}`))}},g=(e,t)=>{let n=t?.baseDir??process.cwd(),r=e=>{let t;try{t=c.getProjectRequire(n).resolve(e,{paths:[n]})}catch{t=(0,u.isAbsolute)(e)?e:(0,u.join)(n,e)}try{if((0,l.statSync)(t).isFile())return(0,u.dirname)(t)}catch{if(/\.[a-z0-9]+$/i.test(t))return(0,u.dirname)(t)}return t},i=r(e?.dictionariesDir??`.intlayer/dictionary`);return{moduleAugmentationDir:r(e?.moduleAugmentationDir??`.intlayer/types`),unmergedDictionariesDir:r(e?.unmergedDictionariesDir??`.intlayer/unmerged_dictionary`),remoteDictionariesDir:r(e?.remoteDictionariesDir??`.intlayer/remote_dictionary`),dictionariesDir:i,dynamicDictionariesDir:r(e?.dynamicDictionariesDir??`.intlayer/dynamic_dictionary`),fetchDictionariesDir:r(e?.fetchDictionariesDir??`.intlayer/fetch_dictionary`),typesDir:r(e?.typesDir??`.intlayer/types`),mainDir:r(e?.mainDir??`.intlayer/main`),configDir:r(e?.configDir??`.intlayer/config`),cacheDir:r(e?.cacheDir??`.intlayer/cache`),tempDir:r(e?.tempDir??`.intlayer/tmp`),outputFilesPatternWithPath:`${s.normalizePath(i)}/**/*.json`}},_=e=>({applicationURL:e?.applicationURL??``,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??!0,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}`}),v=(e,t)=>({mode:e?.mode??`default`,prefix:e?.prefix??a.PREFIX,error:t?.error,log:t?.log,info:t?.info,warn:t?.warn}),y=e=>({provider:e?.provider,apiKey:e?.apiKey,model:e?.model,temperature:e?.temperature,applicationContext:e?.applicationContext,baseURL:e?.baseURL,dataSerialization:e?.dataSerialization}),b=e=>({mode:e?.mode??`auto`,optimize:e?.optimize,importMode:e?.importMode,traversePattern:e?.traversePattern??t.TRAVERSE_PATTERN,outputFormat:e?.outputFormat??t.OUTPUT_FORMAT,cache:e?.cache??!0,require:e?.require,checkTypes:e?.checkTypes??!1}),x=e=>({enabled:e?.enabled??!0,dictionaryKeyPrefix:e?.dictionaryKeyPrefix??`comp-`,transformPattern:e?.transformPattern??n.COMPILER_TRANSFORM_PATTERN,excludePattern:e?.excludePattern??n.COMPILER_EXCLUDE_PATTERN,outputDir:e?.outputDir??`./compiler`,saveComponents:e?.saveComponents??!1}),S=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`,version:e?.version}},C=(e,t,n)=>{let r=p(e?.internationalization),i=m(e?.routing),a=h(e?.content,t);return f={internationalization:r,routing:i,content:a,system:g(e?.system,a),editor:_(e?.editor),log:v(e?.log,n),ai:y(e?.ai),build:b(e?.build),compiler:x(e?.compiler),dictionary:S(e?.dictionary),plugins:e?.plugins,schemas:e?.schemas,metadata:{name:`Intlayer`,version:d.default.version,doc:`https://intlayer.org/docs`}},f};exports.buildConfigurationFields=C;
2
2
  //# sourceMappingURL=buildConfigurationFields.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildConfigurationFields.cjs","names":["LOCALES","REQUIRED_LOCALES","STRICT_MODE","DEFAULT_LOCALE","ROUTING_MODE","STORAGE","BASE_PATH","FILE_EXTENSIONS","getProjectRequire","CONTENT_DIR","CODE_DIR","EXCLUDED_PATHS","WATCH","normalizePath","DICTIONARIES_DIR","MODULE_AUGMENTATION_DIR","UNMERGED_DICTIONARIES_DIR","REMOTE_DICTIONARIES_DIR","DYNAMIC_DICTIONARIES_DIR","FETCH_DICTIONARIES_DIR","TYPES_DIR","MAIN_DIR","CONFIG_DIR","CACHE_DIR","TEMP_DIR","APPLICATION_URL","EDITOR_URL","CMS_URL","BACKEND_URL","PORT","IS_ENABLED","DICTIONARY_PRIORITY_STRATEGY","LIVE_SYNC","LIVE_SYNC_PORT","MODE","PREFIX","BUILD_MODE","TRAVERSE_PATTERN","OUTPUT_FORMAT","CACHE","TYPE_CHECKING","COMPILER_ENABLED","COMPILER_DICTIONARY_KEY_PREFIX","COMPILER_TRANSFORM_PATTERN","COMPILER_EXCLUDE_PATTERN","COMPILER_OUTPUT_DIR","COMPILER_SAVE_COMPONENTS","CONTENT_AUTO_TRANSFORMATION","FILL","LOCATION","IMPORT_MODE","packageJson"],"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';\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_EXCLUDE_PATTERN,\n COMPILER_OUTPUT_DIR,\n COMPILER_SAVE_COMPONENTS,\n COMPILER_TRANSFORM_PATTERN,\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';\nimport { normalizePath } from '../utils/normalizePath';\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 buildContentFields = (\n customConfiguration?: Partial<ContentConfig>,\n baseDir?: string\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n const projectBaseDir =\n customConfiguration?.baseDir ?? baseDir ?? process.cwd();\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(projectBaseDir);\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n try {\n // Fall back to native require.resolve if the custom require fails\n absolutePath = require.resolve(pathInput, { paths: [projectBaseDir] });\n } catch {\n // If all resolution fails, fall back to standard path joining\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, 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 baseDir: projectBaseDir,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),\n watchedFilesPatternWithPath: fileExtensions.flatMap((ext) =>\n contentDir.map((dir) => `${normalizePath(dir)}/**/*${ext}`)\n ),\n };\n};\n\nconst buildSystemFields = (\n customConfiguration?: Partial<SystemConfig>,\n contentConfig?: ContentConfig\n): SystemConfig => {\n const projectBaseDir = contentConfig?.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 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 outputFilesPatternWithPath: `${normalizePath(dictionariesDir)}/**/*.json`,\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: true;\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 transformPattern:\n customConfiguration?.transformPattern ?? COMPILER_TRANSFORM_PATTERN,\n\n /**\n * Pattern to exclude from the optimization.\n */\n excludePattern:\n customConfiguration?.excludePattern ?? COMPILER_EXCLUDE_PATTERN,\n\n /**\n * Output directory for the optimized dictionaries.\n */\n outputDir: customConfiguration?.outputDir ?? COMPILER_OUTPUT_DIR,\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 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 * The version of the dictionary.\n */\n version: customConfiguration?.version,\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 contentConfig = buildContentFields(\n customConfiguration?.content,\n baseDir\n );\n\n const systemConfig = buildSystemFields(\n customConfiguration?.system,\n contentConfig\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":"qrBAiFA,IAAI,EAEJ,MAAM,EACJ,IACgC,CAOhC,QAAS,GAAqB,SAAWA,EAAAA,QAWzC,gBACE,GAAqB,iBACrB,GAAqB,SACrBC,EAAAA,iBAUF,WAAY,GAAqB,YAAcC,EAAAA,YAO/C,cAAe,GAAqB,eAAiBC,EAAAA,eACtD,EAEK,EACJ,IACmB,CAuBnB,KAAM,GAAqB,MAAQC,EAAAA,aAWnC,QAAS,GAAqB,SAAWC,EAAAA,QAazC,SAAU,GAAqB,UAAYC,EAAAA,UA6B3C,QAAS,GAAqB,QAC/B,EAEK,GACJ,EACA,IACkB,CAClB,IAAM,EAAiB,GAAqB,gBAAkBC,EAAAA,gBACxD,EACJ,GAAqB,SAAW,GAAW,QAAQ,KAAK,CAEpD,EAAuB,GAAsB,CACjD,IAAI,EAEJ,GAAI,CAGF,EADwBC,EAAAA,kBAAkB,EAAe,CAC1B,QAAQ,EAAW,CAChD,MAAO,CAAC,EAAe,CACxB,CAAC,MACI,CACN,GAAI,CAEF,EAAe,QAAQ,QAAQ,EAAW,CAAE,MAAO,CAAC,EAAe,CAAE,CAAC,MAChE,CAEN,GAAA,EAAA,EAAA,YAA0B,EAAU,CAChC,GAAA,EAAA,EAAA,MACK,EAAgB,EAAU,EAIvC,GAAI,CAMF,IAAA,EAAA,EAAA,UAJuB,EAAa,CAI1B,QAAQ,CAChB,OAAA,EAAA,EAAA,SAAe,EAAa,MAExB,CAGN,GAAI,gBAAgB,KAAK,EAAa,CACpC,OAAA,EAAA,EAAA,SAAe,EAAa,CAKhC,OAAO,GAGH,GAAc,GAAqB,YAAcC,EAAAA,aAAa,IAClE,EACD,CAMD,MAAO,CACL,iBACA,QAAS,EACT,aACA,SARmB,GAAqB,SAETC,EAA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":"buildConfigurationFields.cjs","names":["LOCALES","REQUIRED_LOCALES","DEFAULT_LOCALE","STORAGE","FILE_EXTENSIONS","getProjectRequire","CONTENT_DIR","CODE_DIR","EXCLUDED_PATHS","normalizePath","PREFIX","TRAVERSE_PATTERN","OUTPUT_FORMAT","COMPILER_TRANSFORM_PATTERN","COMPILER_EXCLUDE_PATTERN","packageJson"],"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';\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_EXCLUDE_PATTERN,\n COMPILER_OUTPUT_DIR,\n COMPILER_SAVE_COMPONENTS,\n COMPILER_TRANSFORM_PATTERN,\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';\nimport { normalizePath } from '../utils/normalizePath';\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 buildContentFields = (\n customConfiguration?: Partial<ContentConfig>,\n baseDir?: string\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n const projectBaseDir =\n customConfiguration?.baseDir ?? baseDir ?? process.cwd();\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(projectBaseDir);\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n try {\n // Fall back to native require.resolve if the custom require fails\n absolutePath = require.resolve(pathInput, { paths: [projectBaseDir] });\n } catch {\n // If all resolution fails, fall back to standard path joining\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, 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 baseDir: projectBaseDir,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),\n watchedFilesPatternWithPath: fileExtensions.flatMap((ext) =>\n contentDir.map((dir) => `${normalizePath(dir)}/**/*${ext}`)\n ),\n };\n};\n\nconst buildSystemFields = (\n customConfiguration?: Partial<SystemConfig>,\n contentConfig?: ContentConfig\n): SystemConfig => {\n const projectBaseDir = contentConfig?.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 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 outputFilesPatternWithPath: `${normalizePath(dictionariesDir)}/**/*.json`,\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: true;\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 transformPattern:\n customConfiguration?.transformPattern ?? COMPILER_TRANSFORM_PATTERN,\n\n /**\n * Pattern to exclude from the optimization.\n */\n excludePattern:\n customConfiguration?.excludePattern ?? COMPILER_EXCLUDE_PATTERN,\n\n /**\n * Output directory for the optimized dictionaries.\n */\n outputDir: customConfiguration?.outputDir ?? COMPILER_OUTPUT_DIR,\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 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 * The version of the dictionary.\n */\n version: customConfiguration?.version,\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 contentConfig = buildContentFields(\n customConfiguration?.content,\n baseDir\n );\n\n const systemConfig = buildSystemFields(\n customConfiguration?.system,\n contentConfig\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":"2rBAiFA,IAAI,EAEJ,MAAM,EACJ,IACgC,CAOhC,QAAS,GAAqB,SAAWA,EAAAA,QAWzC,gBACE,GAAqB,iBACrB,GAAqB,SACrBC,EAAAA,iBAUF,WAAY,GAAqB,YAAA,YAOjC,cAAe,GAAqB,eAAiBC,EAAAA,eACtD,EAEK,EACJ,IACmB,CAuBnB,KAAM,GAAqB,MAAA,oBAW3B,QAAS,GAAqB,SAAWC,EAAAA,QAazC,SAAU,GAAqB,UAAA,GA6B/B,QAAS,GAAqB,QAC/B,EAEK,GACJ,EACA,IACkB,CAClB,IAAM,EAAiB,GAAqB,gBAAkBC,EAAAA,gBACxD,EACJ,GAAqB,SAAW,GAAW,QAAQ,KAAK,CAEpD,EAAuB,GAAsB,CACjD,IAAI,EAEJ,GAAI,CAGF,EADwBC,EAAAA,kBAAkB,EAAe,CAC1B,QAAQ,EAAW,CAChD,MAAO,CAAC,EAAe,CACxB,CAAC,MACI,CACN,GAAI,CAEF,EAAe,QAAQ,QAAQ,EAAW,CAAE,MAAO,CAAC,EAAe,CAAE,CAAC,MAChE,CAEN,GAAA,EAAA,EAAA,YAA0B,EAAU,CAChC,GAAA,EAAA,EAAA,MACK,EAAgB,EAAU,EAIvC,GAAI,CAMF,IAAA,EAAA,EAAA,UAJuB,EAAa,CAI1B,QAAQ,CAChB,OAAA,EAAA,EAAA,SAAe,EAAa,MAExB,CAG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BACE,GAAqB,qBAAA,QAKvB,iBACE,GAAqB,kBAAoBC,EAAAA,2BAK3C,eACE,GAAqB,gBAAkBC,EAAAA,yBAKzC,UAAW,GAAqB,WAAA,aAKhC,eACE,GAAqB,gBAAA,GACxB,EAEK,EACJ,GACqB,CACrB,IAAM,EACJ,GAAqB,2BAAA,GAGvB,MAAO,CAML,KAAM,GAAqB,MAAA,GAO3B,0BACE,OAAO,GAA8B,SACjC,CACE,SAAU,EAA0B,UAAY,GAChD,KAAM,EAA0B,MAAQ,GACxC,UAAW,EAA0B,WAAa,GACnD,CACD,EAON,SAAU,GAAqB,UAAA,QAO/B,OAAQ,GAAqB,OAK7B,MAAO,GAAqB,MAK5B,YAAa,GAAqB,YAKlC,KAAM,GAAqB,KAK3B,SAAU,GAAqB,SAY/B,WAAY,GAAqB,YAAA,SAKjC,QAAS,GAAqB,QAC/B,EAMU,GACX,EACA,EACA,IACmB,CACnB,IAAM,EAA6B,EACjC,GAAqB,qBACtB,CAEK,EAAgB,EAAmB,GAAqB,QAAQ,CAEhE,EAAgB,EACpB,GAAqB,QACrB,EACD,CAyCD,MApBA,GAAsB,CACpB,qBAAsB,EACtB,QAAS,EACT,QAAS,EACT,OAvBmB,EACnB,GAAqB,OACrB,EACD,CAqBC,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,QAASC,EAAAA,QAAY,QACrB,IAAK,4BACN,CACF,CAEM"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../loadEnvFile.cjs`),t=require(`../logger.cjs`),n=require(`../utils/cacheMemory.cjs`),r=require(`../utils/getPackageJsonPath.cjs`),i=require(`./buildConfigurationFields.cjs`),a=require(`./loadConfigurationFile.cjs`),o=require(`./searchConfigurationFile.cjs`);let s=require(`node:path`),c=require(`/Users/aymericpineau/Documents/node_modules/@intlayer/chokidar/dist/esm/utils/index.mjs`),l=require(`defu`);const u=u=>{let d;try{d=u?.baseDir??r.getPackageJsonPath().baseDir}catch{return{configuration:i.buildConfigurationFields({},u?.baseDir,u?.logFunctions),configurationFilePath:void 0}}let f=n.cacheMemory.get(u);if(f)return f;let{configurationFilePath:p,numCustomConfiguration:m}=o.searchConfigurationFile(d),h;h=p?i.buildConfigurationFields(a.loadConfigurationFile(p,{projectRequire:u?.require,envVarOptions:{env:u?.env,envFile:u?.envFile},additionalEnvVars:u?.additionalEnvVars,aliases:u?.aliases}),u?.baseDir,u?.logFunctions):i.buildConfigurationFields({},u?.baseDir,u?.logFunctions);let g=(0,l.defu)(u?.require?{build:{require:u?.require,cache:u?.cache}}:{},h),_=(0,l.defu)(u?.override??{},g);n.cacheMemory.set(u,{configuration:_,configurationFilePath:p});let v=t.getAppLogger(_);if(m===0)v(`Configuration file not found, using default configuration.`,{isVerbose:!0});else{let t=(0,s.relative)(d,p);if(m===1){let n=e.getEnvFilePath(u?.env,u?.envFile);v(`Configuration loaded ${(0,c.formatPath)(t)}${n?` - Env: ${(0,c.formatPath)(n)}`:``}`,{isVerbose:!0})}else v(`Multiple configuration files found, using ${t}.`,{isVerbose:!0})}return{configuration:_,configurationFilePath:p}},d=e=>u(e).configuration;exports.getConfiguration=d,exports.getConfigurationAndFilePath=u;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/cacheMemory.cjs`),t=require(`../utils/getPackageJsonPath.cjs`),n=require(`./buildConfigurationFields.cjs`),r=require(`./loadConfigurationFile.cjs`),i=require(`./searchConfigurationFile.cjs`);let a=require(`defu`);const o=o=>{let s;try{s=o?.baseDir??t.getPackageJsonPath().baseDir}catch{return{configuration:n.buildConfigurationFields({},o?.baseDir,o?.logFunctions),numCustomConfiguration:0,configurationFilePath:void 0}}let c=e.cacheMemory.get(o);if(c)return c;let{configurationFilePath:l,numCustomConfiguration:u}=i.searchConfigurationFile(s),d;d=l?n.buildConfigurationFields(r.loadConfigurationFile(l,{projectRequire:o?.require,envVarOptions:{env:o?.env,envFile:o?.envFile},additionalEnvVars:o?.additionalEnvVars,aliases:o?.aliases}),o?.baseDir,o?.logFunctions):n.buildConfigurationFields({},o?.baseDir,o?.logFunctions);let f=(0,a.defu)(o?.require?{build:{require:o?.require,cache:o?.cache}}:{},d),p=(0,a.defu)(o?.override??{},f);return e.cacheMemory.set(o,{configuration:p,numCustomConfiguration:u,configurationFilePath:l}),{configuration:p,numCustomConfiguration:u,configurationFilePath:l}},s=e=>o(e).configuration;exports.getConfiguration=s,exports.getConfigurationAndFilePath=o;
2
2
  //# sourceMappingURL=getConfiguration.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getConfiguration.cjs","names":["getPackageJsonPath","buildConfigurationFields","cacheMemory","searchConfigurationFile","loadConfigurationFile","getAppLogger","getEnvFilePath"],"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { formatPath } from '@intlayer/chokidar/utils';\nimport type {\n CustomIntlayerConfig,\n IntlayerConfig,\n LogFunctions,\n} from '@intlayer/types';\nimport { defu } from 'defu';\nimport { getEnvFilePath } from '../loadEnvFile';\nimport type { SandBoxContextOptions } from '../loadExternalFile/parseFileContent';\nimport { getAppLogger } from '../logger';\nimport { cacheMemory } from '../utils/cacheMemory';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n // Dotenv options\n env?: string;\n envFile?: string;\n // Log functions\n logFunctions?: LogFunctions;\n // Require function\n require?: NodeJS.Require;\n // cache\n cache?: boolean;\n} & Omit<SandBoxContextOptions, 'projectRequire'>;\n\nexport type GetConfigurationAndFilePathResult = {\n configuration: IntlayerConfig;\n configurationFilePath: string | undefined;\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfigurationAndFilePath = (\n options?: GetConfigurationOptions\n): GetConfigurationAndFilePathResult => {\n let baseDir: string | undefined;\n\n try {\n // Can fail in some environments (e.g. MCP server, VScode extension)\n baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n } catch (_err) {\n // Return default config if the package.json is not found\n return {\n configuration: buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n ),\n configurationFilePath: undefined,\n };\n }\n\n const cachedConfiguration =\n cacheMemory.get<GetConfigurationAndFilePathResult>(options);\n\n if (cachedConfiguration) return cachedConfiguration;\n\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n let storedConfiguration: IntlayerConfig;\n\n if (configurationFilePath) {\n // Load the custom configuration\n const customConfiguration: CustomIntlayerConfig | undefined =\n loadConfigurationFile(configurationFilePath, {\n projectRequire: options?.require,\n // Dotenv options\n envVarOptions: {\n env: options?.env,\n envFile: options?.envFile,\n },\n // Sandbox context additional variables\n additionalEnvVars: options?.additionalEnvVars,\n aliases: options?.aliases,\n });\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n options?.baseDir,\n options?.logFunctions\n );\n } else {\n // No configuration file found, use default configuration\n storedConfiguration = buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n );\n }\n\n // Log warning if multiple configuration files are found\n\n const projectRequireConfig: CustomIntlayerConfig = options?.require\n ? {\n build: {\n require: options?.require,\n cache: options?.cache,\n },\n }\n : {};\n\n const configWithProjectRequire = defu(\n projectRequireConfig,\n storedConfiguration\n ) as IntlayerConfig;\n\n const configuration = defu(\n options?.override ?? {},\n configWithProjectRequire\n ) as IntlayerConfig;\n\n cacheMemory.set(options, {\n configuration,\n configurationFilePath,\n });\n\n const appLogger = getAppLogger(configuration);\n\n if (numCustomConfiguration === 0) {\n appLogger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(baseDir, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n const dotEnvFilePath = getEnvFilePath(options?.env, options?.envFile);\n\n appLogger(\n `Configuration loaded ${formatPath(relativeOutputPath)}${dotEnvFilePath ? ` - Env: ${formatPath(dotEnvFilePath)}` : ''}`,\n {\n isVerbose: true,\n }\n );\n } else {\n appLogger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n\n return {\n configuration,\n configurationFilePath,\n };\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => getConfigurationAndFilePath(options).configuration;\n"],"mappings":"shBAuCA,MAAa,EACX,GACsC,CACtC,IAAI,EAEJ,GAAI,CAEF,EAAU,GAAS,SAAWA,EAAAA,oBAAoB,CAAC,aACtC,CAEb,MAAO,CACL,cAAeC,EAAAA,yBACb,EAAE,CACF,GAAS,QACT,GAAS,aACV,CACD,sBAAuB,IAAA,GACxB,CAGH,IAAM,EACJC,EAAAA,YAAY,IAAuC,EAAQ,CAE7D,GAAI,EAAqB,OAAO,EAGhC,GAAM,CAAE,wBAAuB,0BAC7BC,EAAAA,wBAAwB,EAAQ,CAE9B,EAEJ,AAuBE,EAvBE,EAgBoBF,EAAAA,yBAbpBG,EAAAA,sBAAsB,EAAuB,CAC3C,eAAgB,GAAS,QAEzB,cAAe,CACb,IAAK,GAAS,IACd,QAAS,GAAS,QACnB,CAED,kBAAmB,GAAS,kBAC5B,QAAS,GAAS,QACnB,CAAC,CAKF,GAAS,QACT,GAAS,aACV,CAGqBH,EAAAA,yBACpB,EAAE,CACF,GAAS,QACT,GAAS,aACV,CAcH,IAAM,GAAA,EAAA,EAAA,MAT6C,GAAS,QACxD,CACE,MAAO,CACL,QAAS,GAAS,QAClB,MAAO,GAAS,MACjB,CACF,CACD,EAAE,CAIJ,EACD,CAEK,GAAA,EAAA,EAAA,MACJ,GAAS,UAAY,EAAE,CACvB,EACD,CAED,EAAA,YAAY,IAAI,EAAS,CACvB,gBACA,wBACD,CAAC,CAEF,IAAM,EAAYI,EAAAA,aAAa,EAAc,CAE7C,GAAI,IAA2B,EAC7B,EAAU,6DAA8D,CACtE,UAAW,GACZ,CAAC,KACG,CACL,IAAM,GAAA,EAAA,EAAA,UAA8B,EAAS,EAAuB,CAEpE,GAAI,IAA2B,EAAG,CAChC,IAAM,EAAiBC,EAAAA,eAAe,GAAS,IAAK,GAAS,QAAQ,CAErE,EACE,yBAAA,EAAA,EAAA,YAAmC,EAAmB,GAAG,EAAiB,YAAA,EAAA,EAAA,YAAsB,EAAe,GAAK,KACpH,CACE,UAAW,GACZ,CACF,MAED,EACE,6CAA6C,EAAmB,GAChE,CACE,UAAW,GACZ,CACF,CAIL,MAAO,CACL,gBACA,wBACD,EAMU,EACX,GACmB,EAA4B,EAAQ,CAAC"}
1
+ {"version":3,"file":"getConfiguration.cjs","names":["getPackageJsonPath","buildConfigurationFields","cacheMemory","searchConfigurationFile","loadConfigurationFile"],"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import type {\n CustomIntlayerConfig,\n IntlayerConfig,\n LogFunctions,\n} from '@intlayer/types';\nimport { defu } from 'defu';\nimport type { SandBoxContextOptions } from '../loadExternalFile/parseFileContent';\nimport { cacheMemory } from '../utils/cacheMemory';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n // Dotenv options\n env?: string;\n envFile?: string;\n // Log functions\n logFunctions?: LogFunctions;\n // Require function\n require?: NodeJS.Require;\n // cache\n cache?: boolean;\n} & Omit<SandBoxContextOptions, 'projectRequire'>;\n\nexport type GetConfigurationAndFilePathResult = {\n configuration: IntlayerConfig;\n numCustomConfiguration: number;\n configurationFilePath: string | undefined;\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfigurationAndFilePath = (\n options?: GetConfigurationOptions\n): GetConfigurationAndFilePathResult => {\n let baseDir: string | undefined;\n\n try {\n // Can fail in some environments (e.g. MCP server, VScode extension)\n baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n } catch (_err) {\n // Return default config if the package.json is not found\n return {\n configuration: buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n ),\n numCustomConfiguration: 0,\n configurationFilePath: undefined,\n };\n }\n\n const cachedConfiguration =\n cacheMemory.get<GetConfigurationAndFilePathResult>(options);\n\n if (cachedConfiguration) return cachedConfiguration;\n\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n let storedConfiguration: IntlayerConfig;\n\n if (configurationFilePath) {\n // Load the custom configuration\n const customConfiguration: CustomIntlayerConfig | undefined =\n loadConfigurationFile(configurationFilePath, {\n projectRequire: options?.require,\n // Dotenv options\n envVarOptions: {\n env: options?.env,\n envFile: options?.envFile,\n },\n // Sandbox context additional variables\n additionalEnvVars: options?.additionalEnvVars,\n aliases: options?.aliases,\n });\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n options?.baseDir,\n options?.logFunctions\n );\n } else {\n // No configuration file found, use default configuration\n storedConfiguration = buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n );\n }\n\n // Log warning if multiple configuration files are found\n\n const projectRequireConfig: CustomIntlayerConfig = options?.require\n ? {\n build: {\n require: options?.require,\n cache: options?.cache,\n },\n }\n : {};\n\n const configWithProjectRequire = defu(\n projectRequireConfig,\n storedConfiguration\n ) as IntlayerConfig;\n\n const configuration = defu(\n options?.override ?? {},\n configWithProjectRequire\n ) as IntlayerConfig;\n\n cacheMemory.set(options, {\n configuration,\n numCustomConfiguration,\n configurationFilePath,\n });\n\n return {\n configuration,\n numCustomConfiguration,\n configurationFilePath,\n };\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => getConfigurationAndFilePath(options).configuration;\n"],"mappings":"+VAoCA,MAAa,EACX,GACsC,CACtC,IAAI,EAEJ,GAAI,CAEF,EAAU,GAAS,SAAWA,EAAAA,oBAAoB,CAAC,aACtC,CAEb,MAAO,CACL,cAAeC,EAAAA,yBACb,EAAE,CACF,GAAS,QACT,GAAS,aACV,CACD,uBAAwB,EACxB,sBAAuB,IAAA,GACxB,CAGH,IAAM,EACJC,EAAAA,YAAY,IAAuC,EAAQ,CAE7D,GAAI,EAAqB,OAAO,EAGhC,GAAM,CAAE,wBAAuB,0BAC7BC,EAAAA,wBAAwB,EAAQ,CAE9B,EAEJ,AAuBE,EAvBE,EAgBoBF,EAAAA,yBAbpBG,EAAAA,sBAAsB,EAAuB,CAC3C,eAAgB,GAAS,QAEzB,cAAe,CACb,IAAK,GAAS,IACd,QAAS,GAAS,QACnB,CAED,kBAAmB,GAAS,kBAC5B,QAAS,GAAS,QACnB,CAAC,CAKF,GAAS,QACT,GAAS,aACV,CAGqBH,EAAAA,yBACpB,EAAE,CACF,GAAS,QACT,GAAS,aACV,CAcH,IAAM,GAAA,EAAA,EAAA,MAT6C,GAAS,QACxD,CACE,MAAO,CACL,QAAS,GAAS,QAClB,MAAO,GAAS,MACjB,CACF,CACD,EAAE,CAIJ,EACD,CAEK,GAAA,EAAA,EAAA,MACJ,GAAS,UAAY,EAAE,CACvB,EACD,CAQD,OANA,EAAA,YAAY,IAAI,EAAS,CACvB,gBACA,yBACA,wBACD,CAAC,CAEK,CACL,gBACA,yBACA,wBACD,EAMU,EACX,GACmB,EAA4B,EAAQ,CAAC"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../logger.cjs`),t=require(`../utils/getPackageJsonPath.cjs`);let n=require(`node:path`),r=require(`node:fs`);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=a=>{let o,s=0,{baseDir:c}=t.getPackageJsonPath(a);for(let t of i)try{let e=(0,n.resolve)(c,t);(0,r.existsSync)(e)&&(s+=1,o||=e)}catch(n){e.logger(`${t}: ${n}`,{level:`error`})}return{configurationFilePath:o,numCustomConfiguration:s}};exports.configurationFilesCandidates=i,exports.searchConfigurationFile=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/getPackageJsonPath.cjs`),t=require(`../logger.cjs`);let n=require(`node:fs`),r=require(`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=a=>{let o,s=0,{baseDir:c}=e.getPackageJsonPath(a);for(let e of i)try{let t=(0,r.resolve)(c,e);(0,n.existsSync)(t)&&(s+=1,o||=t)}catch(n){t.logger(`${e}: ${n}`,{level:`error`})}return{configurationFilePath:o,numCustomConfiguration:s}};exports.configurationFilesCandidates=i,exports.searchConfigurationFile=a;
2
2
  //# sourceMappingURL=searchConfigurationFile.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=require(`../_virtual/_rolldown/runtime.cjs`).__exportAll({BUILD_MODE:()=>t,CACHE:()=>a,OPTIMIZE:()=>n,OUTPUT_FORMAT:()=>i,TRAVERSE_PATTERN:()=>r,TYPE_CHECKING:()=>o});const t=`auto`,n=void 0,r=[`**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}`,`!**/node_modules/**`],i=[`esm`,`cjs`],a=!0,o=!1;exports.BUILD_MODE=t,exports.CACHE=!0,exports.OPTIMIZE=void 0,exports.OUTPUT_FORMAT=i,exports.TRAVERSE_PATTERN=r,exports.TYPE_CHECKING=!1,Object.defineProperty(exports,`build_exports`,{enumerable:!0,get:function(){return e}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=require(`../_virtual/_rolldown/runtime.cjs`).__exportAll({BUILD_MODE:()=>t,CACHE:()=>!0,OPTIMIZE:()=>void 0,OUTPUT_FORMAT:()=>r,TRAVERSE_PATTERN:()=>n,TYPE_CHECKING:()=>!1});const t=`auto`,n=[`**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}`,`!**/node_modules/**`],r=[`esm`,`cjs`];exports.BUILD_MODE=t,exports.CACHE=!0,exports.OPTIMIZE=void 0,exports.OUTPUT_FORMAT=r,exports.TRAVERSE_PATTERN=n,exports.TYPE_CHECKING=!1,Object.defineProperty(exports,`build_exports`,{enumerable:!0,get:function(){return e}});
2
2
  //# sourceMappingURL=build.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.cjs","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 '!**/node_modules/**',\n];\n\nexport const OUTPUT_FORMAT: ('cjs' | 'esm')[] = ['esm', 'cjs'];\n\nexport const CACHE = true;\n\nexport const TYPE_CHECKING = false;\n"],"mappings":"gPAAA,MAAa,EAAa,OAEb,EAAW,IAAA,GAEX,EAAmB,CAC9B,+CACA,sBACD,CAEY,EAAmC,CAAC,MAAO,MAAM,CAEjD,EAAQ,GAER,EAAgB"}
1
+ {"version":3,"file":"build.cjs","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 '!**/node_modules/**',\n];\n\nexport const OUTPUT_FORMAT: ('cjs' | 'esm')[] = ['esm', 'cjs'];\n\nexport const CACHE = true;\n\nexport const TYPE_CHECKING = false;\n"],"mappings":"uPAAA,MAAa,EAAa,OAIb,EAAmB,CAC9B,+CACA,sBACD,CAEY,EAAmC,CAAC,MAAO,MAAM"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=require(`../_virtual/_rolldown/runtime.cjs`).__exportAll({CODE_DIR:()=>i,CONTENT_DIR:()=>r,EXCLUDED_PATHS:()=>n,FILE_EXTENSIONS:()=>t,I18NEXT_DICTIONARIES_DIR:()=>a,REACT_INTL_MESSAGES_DIR:()=>o,WATCH:()=>s});const t=[`.content.ts`,`.content.js`,`.content.cjs`,`.content.mjs`,`.content.json`,`.content.json5`,`.content.jsonc`,`.content.tsx`,`.content.jsx`],n=[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.intlayer/**`,`**/.next/**`,`**/.nuxt/**`,`**/.expo/**`,`**/.vercel/**`,`**/.turbo/**`,`**/.tanstack/**`],r=[`.`],i=[`.`],a=`i18next_resources`,o=`intl_messages`,s=!0;exports.CODE_DIR=i,exports.CONTENT_DIR=r,exports.EXCLUDED_PATHS=n,exports.FILE_EXTENSIONS=t,exports.I18NEXT_DICTIONARIES_DIR=a,exports.REACT_INTL_MESSAGES_DIR=o,exports.WATCH=!0,Object.defineProperty(exports,`content_exports`,{enumerable:!0,get:function(){return e}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=require(`../_virtual/_rolldown/runtime.cjs`).__exportAll({CODE_DIR:()=>i,CONTENT_DIR:()=>r,EXCLUDED_PATHS:()=>n,FILE_EXTENSIONS:()=>t,I18NEXT_DICTIONARIES_DIR:()=>a,REACT_INTL_MESSAGES_DIR:()=>o,WATCH:()=>!0});const t=[`.content.ts`,`.content.js`,`.content.cjs`,`.content.mjs`,`.content.json`,`.content.json5`,`.content.jsonc`,`.content.tsx`,`.content.jsx`],n=[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.intlayer/**`,`**/.next/**`,`**/.nuxt/**`,`**/.expo/**`,`**/.vercel/**`,`**/.turbo/**`,`**/.tanstack/**`],r=[`.`],i=[`.`],a=`i18next_resources`,o=`intl_messages`;exports.CODE_DIR=i,exports.CONTENT_DIR=r,exports.EXCLUDED_PATHS=n,exports.FILE_EXTENSIONS=t,exports.I18NEXT_DICTIONARIES_DIR=a,exports.REACT_INTL_MESSAGES_DIR=o,exports.WATCH=!0,Object.defineProperty(exports,`content_exports`,{enumerable:!0,get:function(){return e}});
2
2
  //# sourceMappingURL=content.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"content.cjs","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];\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":"0RAAA,MAAa,EAAkB,CAC7B,cACA,cACA,eACA,eACA,gBACA,iBACA,iBACA,eACA,eACD,CACY,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.cjs","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":"2RAAA,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"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=require(`../_virtual/_rolldown/runtime.cjs`).__exportAll({CONTENT_AUTO_TRANSFORMATION:()=>r,FILL:()=>t,IMPORT_MODE:()=>i,LOCATION:()=>n});const t=!0,n=`local`,r=!1,i=`static`;exports.CONTENT_AUTO_TRANSFORMATION=!1,exports.FILL=!0,exports.IMPORT_MODE=i,exports.LOCATION=n,Object.defineProperty(exports,`dictionary_exports`,{enumerable:!0,get:function(){return e}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=require(`../_virtual/_rolldown/runtime.cjs`).__exportAll({CONTENT_AUTO_TRANSFORMATION:()=>!1,FILL:()=>!0,IMPORT_MODE:()=>n,LOCATION:()=>t});const t=`local`,n=`static`;exports.CONTENT_AUTO_TRANSFORMATION=!1,exports.FILL=!0,exports.IMPORT_MODE=n,exports.LOCATION=t,Object.defineProperty(exports,`dictionary_exports`,{enumerable:!0,get:function(){return e}});
2
2
  //# sourceMappingURL=dictionary.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.cjs","names":[],"sources":["../../../src/defaultValues/dictionary.ts"],"sourcesContent":["import type { DictionaryLocation } from '@intlayer/types';\n\nexport const FILL = true;\nexport const LOCATION: DictionaryLocation = 'local';\nexport const CONTENT_AUTO_TRANSFORMATION = false;\nexport const IMPORT_MODE = 'static';\n"],"mappings":"mNAEA,MAAa,EAAO,GACP,EAA+B,QAC/B,EAA8B,GAC9B,EAAc"}
1
+ {"version":3,"file":"dictionary.cjs","names":[],"sources":["../../../src/defaultValues/dictionary.ts"],"sourcesContent":["import type { DictionaryLocation } from '@intlayer/types';\n\nexport const FILL = true;\nexport const LOCATION: DictionaryLocation = 'local';\nexport const CONTENT_AUTO_TRANSFORMATION = false;\nexport const IMPORT_MODE = 'static';\n"],"mappings":"qNAEA,MACa,EAA+B,QAE/B,EAAc"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=require(`../_virtual/_rolldown/runtime.cjs`).__exportAll({APPLICATION_URL:()=>t,BACKEND_URL:()=>i,CMS_URL:()=>r,DICTIONARY_PRIORITY_STRATEGY:()=>c,EDITOR_URL:()=>n,IS_ENABLED:()=>o,LIVE_SYNC:()=>s,LIVE_SYNC_PORT:()=>l,PORT:()=>a});const t=``,n=`http://localhost:8000`,r=`https://app.intlayer.org`,i=`https://back.intlayer.org`,a=8e3,o=!0,s=!0,c=`local_first`,l=4e3;exports.APPLICATION_URL=``,exports.BACKEND_URL=i,exports.CMS_URL=r,exports.DICTIONARY_PRIORITY_STRATEGY=c,exports.EDITOR_URL=n,exports.IS_ENABLED=!0,exports.LIVE_SYNC=!0,exports.LIVE_SYNC_PORT=l,exports.PORT=a,Object.defineProperty(exports,`editor_exports`,{enumerable:!0,get:function(){return e}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=require(`../_virtual/_rolldown/runtime.cjs`).__exportAll({APPLICATION_URL:()=>``,BACKEND_URL:()=>r,CMS_URL:()=>n,DICTIONARY_PRIORITY_STRATEGY:()=>a,EDITOR_URL:()=>t,IS_ENABLED:()=>!0,LIVE_SYNC:()=>!0,LIVE_SYNC_PORT:()=>o,PORT:()=>i});const t=`http://localhost:8000`,n=`https://app.intlayer.org`,r=`https://back.intlayer.org`,i=8e3,a=`local_first`,o=4e3;exports.APPLICATION_URL=``,exports.BACKEND_URL=r,exports.CMS_URL=n,exports.DICTIONARY_PRIORITY_STRATEGY=a,exports.EDITOR_URL=t,exports.IS_ENABLED=!0,exports.LIVE_SYNC=!0,exports.LIVE_SYNC_PORT=o,exports.PORT=i,Object.defineProperty(exports,`editor_exports`,{enumerable:!0,get:function(){return e}});
2
2
  //# sourceMappingURL=editor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.cjs","names":[],"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const APPLICATION_URL = '';\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 = true;\nexport const LIVE_SYNC = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'local_first';\nexport const LIVE_SYNC_PORT = 4000;\n"],"mappings":"gTAAA,MAAa,EAAkB,GAClB,EAAa,wBACb,EAAU,2BACV,EAAc,4BACd,EAAO,IACP,EAAa,GACb,EAAY,GACZ,EAA+B,cAC/B,EAAiB"}
1
+ {"version":3,"file":"editor.cjs","names":[],"sources":["../../../src/defaultValues/editor.ts"],"sourcesContent":["export const APPLICATION_URL = '';\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 = true;\nexport const LIVE_SYNC = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'local_first';\nexport const LIVE_SYNC_PORT = 4000;\n"],"mappings":"mTAAA,MACa,EAAa,wBACb,EAAU,2BACV,EAAc,4BACd,EAAO,IAGP,EAA+B,cAC/B,EAAiB"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=require(`../_virtual/_rolldown/runtime.cjs`).__exportAll({BASE_PATH:()=>i,COOKIE_NAME:()=>n,HEADER_NAME:()=>t,LOCALE_STORAGE_NAME:()=>r,ROUTING_MODE:()=>o,SERVER_SET_COOKIE:()=>a,STORAGE:()=>s});const t=`x-intlayer-locale`,n=`INTLAYER_LOCALE`,r=`INTLAYER_LOCALE`,i=``,a=`always`,o=`prefix-no-default`,s=[`cookie`,`header`];exports.BASE_PATH=``,exports.COOKIE_NAME=n,exports.HEADER_NAME=t,exports.LOCALE_STORAGE_NAME=r,exports.ROUTING_MODE=o,exports.SERVER_SET_COOKIE=a,exports.STORAGE=s,Object.defineProperty(exports,`routing_exports`,{enumerable:!0,get:function(){return e}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=require(`../_virtual/_rolldown/runtime.cjs`).__exportAll({BASE_PATH:()=>``,COOKIE_NAME:()=>n,HEADER_NAME:()=>t,LOCALE_STORAGE_NAME:()=>r,ROUTING_MODE:()=>a,SERVER_SET_COOKIE:()=>i,STORAGE:()=>o});const t=`x-intlayer-locale`,n=`INTLAYER_LOCALE`,r=`INTLAYER_LOCALE`,i=`always`,a=`prefix-no-default`,o=[`cookie`,`header`];exports.BASE_PATH=``,exports.COOKIE_NAME=n,exports.HEADER_NAME=t,exports.LOCALE_STORAGE_NAME=r,exports.ROUTING_MODE=a,exports.SERVER_SET_COOKIE=i,exports.STORAGE=o,Object.defineProperty(exports,`routing_exports`,{enumerable:!0,get:function(){return e}});
2
2
  //# sourceMappingURL=routing.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"routing.cjs","names":[],"sources":["../../../src/defaultValues/routing.ts"],"sourcesContent":["import type { RoutingConfig } from '@intlayer/types';\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":"4QAEA,MAAa,EAAc,oBAEd,EAAc,kBACd,EAAsB,kBAEtB,EAAY,GAEZ,EAAoB,SAEpB,EAAe,oBAEf,EAAoC,CAAC,SAAU,SAAS"}
1
+ {"version":3,"file":"routing.cjs","names":[],"sources":["../../../src/defaultValues/routing.ts"],"sourcesContent":["import type { RoutingConfig } from '@intlayer/types';\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":"6QAEA,MAAa,EAAc,oBAEd,EAAc,kBACd,EAAsB,kBAItB,EAAoB,SAEpB,EAAe,oBAEf,EAAoC,CAAC,SAAU,SAAS"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../logger.cjs`),n=require(`./parseFileContent.cjs`),r=require(`./transpileTSToCJS.cjs`);let i=require(`node:path`),a=require(`node:fs`),o=require(`node:fs/promises`),s=require(`json5`);s=e.__toESM(s);const c=(e,o)=>{let c=(0,i.extname)(e)||`.json`;try{if(c===`.json`||c===`.json5`||c===`.jsonc`)return s.default.parse((0,a.readFileSync)(e,`utf-8`));let i=r.transpileTSToCJSSync((0,a.readFileSync)(e,`utf-8`),e);if(!i){t.logger(`File could not be loaded.`,{level:`error`});return}let l=n.parseFileContent(i,{projectRequire:o?.projectRequire,envVarOptions:o?.envVarOptions,additionalEnvVars:o?.additionalEnvVars,mocks:o?.mocks,aliases:o?.aliases});if(l===void 0){t.logger(`File could not be loaded. Path : ${e}`);return}return l}catch(e){t.logger([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}},l=async(e,a)=>{let c=(0,i.extname)(e);try{if(c===`.json`||c===`.json5`||c===`.jsonc`){let t=await(0,o.readFile)(e,`utf-8`);return s.default.parse(t)}let i=await r.transpileTSToCJS(await(0,o.readFile)(e,`utf-8`),e,a?.buildOptions);if(!i){t.logger(`File could not be loaded.`,{level:`error`});return}let l=n.parseFileContent(i,{projectRequire:a?.projectRequire,envVarOptions:a?.envVarOptions,additionalEnvVars:a?.additionalEnvVars,mocks:a?.mocks,aliases:a?.aliases});if(l===void 0){t.logger(`File could not be loaded. Path : ${t.colorizePath(e)}`);return}return l}catch(e){t.logger([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}};exports.loadExternalFile=l,exports.loadExternalFileSync=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../logger.cjs`),n=require(`./parseFileContent.cjs`),r=require(`./transpileTSToCJS.cjs`);let i=require(`node:fs`),a=require(`node:path`),o=require(`node:fs/promises`),s=require(`json5`);s=e.__toESM(s);const c=(e,o)=>{let c=(0,a.extname)(e)||`.json`;try{if(c===`.json`||c===`.json5`||c===`.jsonc`)return s.default.parse((0,i.readFileSync)(e,`utf-8`));let a=r.transpileTSToCJSSync((0,i.readFileSync)(e,`utf-8`),e);if(!a){t.logger(`File could not be loaded.`,{level:`error`});return}let l=n.parseFileContent(a,{projectRequire:o?.projectRequire,envVarOptions:o?.envVarOptions,additionalEnvVars:o?.additionalEnvVars,mocks:o?.mocks,aliases:o?.aliases});if(l===void 0){t.logger(`File could not be loaded. Path : ${e}`);return}return l}catch(e){t.logger([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}},l=async(e,i)=>{let c=(0,a.extname)(e);try{if(c===`.json`||c===`.json5`||c===`.jsonc`){let t=await(0,o.readFile)(e,`utf-8`);return s.default.parse(t)}let a=await r.transpileTSToCJS(await(0,o.readFile)(e,`utf-8`),e,i?.buildOptions);if(!a){t.logger(`File could not be loaded.`,{level:`error`});return}let l=n.parseFileContent(a,{projectRequire:i?.projectRequire,envVarOptions:i?.envVarOptions,additionalEnvVars:i?.additionalEnvVars,mocks:i?.mocks,aliases:i?.aliases});if(l===void 0){t.logger(`File could not be loaded. Path : ${t.colorizePath(e)}`);return}return l}catch(e){t.logger([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}};exports.loadExternalFile=l,exports.loadExternalFileSync=c;
2
2
  //# sourceMappingURL=loadExternalFile.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../loadEnvFile.cjs`),n=require(`../utils/ESMxCJSHelpers.cjs`);let r=require(`node:vm`),i=require(`esbuild`);i=e.__toESM(i);const a=e=>{let{envVarOptions:r,projectRequire:a,additionalEnvVars:o,mocks:s,aliases:c}=e??{},l={},u=typeof a==`function`?a:n.getProjectRequire(),d=(()=>{let e=Object.assign({esbuild:i},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.loadEnvFile(r),...o}},console,require:d,...l};return Object.getOwnPropertyNames(globalThis).forEach(e=>{e in f||(f[e]=globalThis[e])}),f},o=(e,t)=>{let n=a(t);(0,r.runInNewContext)(`"use strict";\n${e}`,n);let i=[n.exports?.default,n.module?.exports?.defaults,n.module?.exports?.default,n.module?.exports];for(let e of i)if(e&&typeof e==`object`&&Object.keys(e).length>0)return e};exports.getSandBoxContext=a,exports.parseFileContent=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../utils/ESMxCJSHelpers.cjs`),n=require(`../loadEnvFile.cjs`);let r=require(`node:vm`),i=require(`esbuild`);i=e.__toESM(i);const a=e=>{let{envVarOptions:r,projectRequire:a,additionalEnvVars:o,mocks:s,aliases:c}=e??{},l={},u=typeof a==`function`?a:t.getProjectRequire(),d=(()=>{let e=Object.assign({esbuild:i},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,...n.loadEnvFile(r),...o}},console,require:d,...l};return Object.getOwnPropertyNames(globalThis).forEach(e=>{e in f||(f[e]=globalThis[e])}),f},o=(e,t)=>{let n=a(t);(0,r.runInNewContext)(`"use strict";\n${e}`,n);let i=[n.exports?.default,n.module?.exports?.defaults,n.module?.exports?.default,n.module?.exports];for(let e of i)if(e&&typeof e==`object`&&Object.keys(e).length>0)return e};exports.getSandBoxContext=a,exports.parseFileContent=o;
2
2
  //# sourceMappingURL=parseFileContent.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/getPackageJsonPath.cjs`),t=require(`./bundleFile.cjs`);let n=require(`node:path`),r=require(`node:fs`),i=require(`esbuild`),a=require(`node:url`);const o=t=>{let i=(0,n.join)(e.getPackageJsonPath((0,n.dirname)(t)).baseDir,`tsconfig.json`);return(0,r.existsSync)(i)?i:void 0},s=e=>({loader:{".js":`js`,".jsx":`jsx`,".mjs":`js`,".ts":`ts`,".tsx":`tsx`,".cjs":`js`,".json":`json`,".md":`text`,".mdx":`text`},format:`cjs`,target:`node20`,platform:`node`,write:!1,packages:`external`,bundle:!0,tsconfig:o(e),define:{"import.meta.url":JSON.stringify((0,a.pathToFileURL)(e).href)}}),c=(e,r,a)=>(0,i.buildSync)({stdin:{contents:e,loader:t.getLoader((0,n.extname)(r)),resolveDir:(0,n.dirname)(r),sourcefile:r},...s(r),...a}).outputFiles?.[0].text,l=async(e,r,a)=>(await(0,i.build)({stdin:{contents:e,loader:t.getLoader((0,n.extname)(r)),resolveDir:(0,n.dirname)(r),sourcefile:r},...s(r),...a})).outputFiles?.[0].text;exports.transpileTSToCJS=l,exports.transpileTSToCJSSync=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/getPackageJsonPath.cjs`),t=require(`./bundleFile.cjs`);let n=require(`node:fs`),r=require(`node:path`),i=require(`esbuild`),a=require(`node:url`);const o=t=>{let i=(0,r.join)(e.getPackageJsonPath((0,r.dirname)(t)).baseDir,`tsconfig.json`);return(0,n.existsSync)(i)?i:void 0},s=e=>({loader:{".js":`js`,".jsx":`jsx`,".mjs":`js`,".ts":`ts`,".tsx":`tsx`,".cjs":`js`,".json":`json`,".md":`text`,".mdx":`text`},format:`cjs`,target:`node20`,platform:`node`,write:!1,packages:`external`,bundle:!0,tsconfig:o(e),define:{"import.meta.url":JSON.stringify((0,a.pathToFileURL)(e).href)}}),c=(e,n,a)=>(0,i.buildSync)({stdin:{contents:e,loader:t.getLoader((0,r.extname)(n)),resolveDir:(0,r.dirname)(n),sourcefile:n},...s(n),...a}).outputFiles?.[0].text,l=async(e,n,a)=>(await(0,i.build)({stdin:{contents:e,loader:t.getLoader((0,r.extname)(n)),resolveDir:(0,r.dirname)(n),sourcefile:n},...s(n),...a})).outputFiles?.[0].text;exports.transpileTSToCJS=l,exports.transpileTSToCJSSync=c;
2
2
  //# sourceMappingURL=transpileTSToCJS.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.cjs","names":[],"sources":["../../src/logger.ts"],"sourcesContent":["import type { CustomIntlayerConfig, Locale } from '@intlayer/types';\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, padChar } = {\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":"mEAUA,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,OAAO,EAAM,GAAG,EAAY,CAG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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.cjs","names":[],"sources":["../../src/logger.ts"],"sourcesContent":["import type { CustomIntlayerConfig, Locale } from '@intlayer/types';\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, padChar } = {\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);\n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b,MAAM,QAAQ,EAAO,EAAI,EAAO,MAAO,GAAM,OAAO,GAAM,SAAS,GACrE,EAAQ,KAAK,IAAI,GAAG,EAAO,IAAK,GAAQ,EAAI,OAAO,CAAC,EAElD,MAAM,QAAQ,EAAO,EAAI,EAAO,MAAO,GAAM,OAAO,GAAM,SAAS,GACrE,EAAQ,KAAK,IAAI,GAAG,EAAO,EAEtB,KAAK,IAAI,EAAO,EAAE,EAGrB,EAAsB,CAC1B,QAAS,EACT,QAAS,EACT,QAAS,IACT,IAAK,QACL,QAAS,IACV,CAQY,GACX,EACA,IAQA,CAAC,EAAK,CACH,MAAM,CACN,IAAK,GAAS,CACb,GAAM,CAAE,UAAS,UAAS,UAAS,MAAK,WAAY,CAClD,GAAG,EACH,GAAI,GAAW,EAAE,CAClB,CAEK,EAAS,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,IAAK,EAAW,IAAI,CACjC,EAAI,EAAS,IAAK,EAAW,MAAM,CACnC,EAAQ,EAAS,IAAK,EAAW,KAAK"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./cacheMemory.cjs`);let t=require(`node:path`),n=require(`node:fs`);const r=(r=process.cwd())=>{let i=e.cacheMemory.get(`packageJsonPath`,r);if(i)return i;let a=r;for(let i=0;i<15;i++){let i=(0,t.join)(a,`package.json`);if((0,n.existsSync)(i))return e.cacheMemory.set(`packageJsonPath`,r,{packageJsonPath:i,baseDir:a}),{packageJsonPath:i,baseDir:a};let o=(0,t.dirname)(a);if(o===a)break;a=o}throw Error(`Could not find package.json in current directory or any of the 15 parent directories. Searched from: ${r}`)};exports.getPackageJsonPath=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./cacheMemory.cjs`);let t=require(`node:fs`),n=require(`node:path`);const r=(r=process.cwd())=>{let i=e.cacheMemory.get(`packageJsonPath`,r);if(i)return i;let a=r;for(let i=0;i<15;i++){let i=(0,n.join)(a,`package.json`);if((0,t.existsSync)(i))return e.cacheMemory.set(`packageJsonPath`,r,{packageJsonPath:i,baseDir:a}),{packageJsonPath:i,baseDir:a};let o=(0,n.dirname)(a);if(o===a)break;a=o}throw Error(`Could not find package.json in current directory or any of the 15 parent directories. Searched from: ${r}`)};exports.getPackageJsonPath=r;
2
2
  //# sourceMappingURL=getPackageJsonPath.cjs.map
@@ -1 +1 @@
1
- import{ANSIColors as e,clock as t,colon as n,colorize as r,colorizeKey as i,colorizeLocales as a,colorizeNumber as o,colorizePath as s,getAppLogger as c,getPrefix as l,logger as u,removeColor as d,setPrefix as f,spinnerFrames as p,v as m,x as h}from"./logger.mjs";import{normalizePath as g}from"./utils/normalizePath.mjs";import{extractErrorMessage as _}from"./utils/extractErrorMessage.mjs";import{logStack as v}from"./utils/logStack.mjs";import{camelCaseToKebabCase as y}from"./utils/stringFormatter/camelCaseToKebabCase.mjs";import{camelCaseToSentence as b}from"./utils/stringFormatter/camelCaseToSentence.mjs";import{kebabCaseToCamelCase as x}from"./utils/stringFormatter/kebabCaseToCamelCase.mjs";import{toLowerCamelCase as S}from"./utils/stringFormatter/toLowerCamelCase.mjs";import{defaultValues_exports as C}from"./defaultValues/index.mjs";export{e as ANSIColors,C as DefaultValues,y as camelCaseToKebabCase,b as camelCaseToSentence,t as clock,n as colon,r as colorize,i as colorizeKey,a as colorizeLocales,o as colorizeNumber,s as colorizePath,_ as extractErrorMessage,c as getAppLogger,l as getPrefix,x as kebabCaseToCamelCase,v as logStack,u as logger,g as normalizePath,d as removeColor,f as setPrefix,p as spinnerFrames,S as toLowerCamelCase,m as v,h as x};
1
+ import{normalizePath as e}from"./utils/normalizePath.mjs";import{extractErrorMessage as t}from"./utils/extractErrorMessage.mjs";import{logStack as n}from"./utils/logStack.mjs";import{camelCaseToKebabCase as r}from"./utils/stringFormatter/camelCaseToKebabCase.mjs";import{camelCaseToSentence as i}from"./utils/stringFormatter/camelCaseToSentence.mjs";import{kebabCaseToCamelCase as a}from"./utils/stringFormatter/kebabCaseToCamelCase.mjs";import{toLowerCamelCase as o}from"./utils/stringFormatter/toLowerCamelCase.mjs";import{defaultValues_exports as s}from"./defaultValues/index.mjs";export{s as DefaultValues,r as camelCaseToKebabCase,i as camelCaseToSentence,t as extractErrorMessage,a as kebabCaseToCamelCase,n as logStack,e as normalizePath,o as toLowerCamelCase};
@@ -1,2 +1,2 @@
1
- import{__require as e}from"../_virtual/_rolldown/runtime.mjs";import{BUILD_MODE as t,CACHE as n,OUTPUT_FORMAT as r,TRAVERSE_PATTERN as i,TYPE_CHECKING as a}from"../defaultValues/build.mjs";import{COMPILER_DICTIONARY_KEY_PREFIX as o,COMPILER_ENABLED as s,COMPILER_EXCLUDE_PATTERN as c,COMPILER_OUTPUT_DIR as l,COMPILER_SAVE_COMPONENTS as u,COMPILER_TRANSFORM_PATTERN as d}from"../defaultValues/compiler.mjs";import{CODE_DIR as f,CONTENT_DIR as ee,EXCLUDED_PATHS as te,FILE_EXTENSIONS as ne,WATCH as p}from"../defaultValues/content.mjs";import{CONTENT_AUTO_TRANSFORMATION as m,FILL as h,IMPORT_MODE as g,LOCATION as _}from"../defaultValues/dictionary.mjs";import{APPLICATION_URL as v,BACKEND_URL as y,CMS_URL as b,DICTIONARY_PRIORITY_STRATEGY as x,EDITOR_URL as S,IS_ENABLED as C,LIVE_SYNC as w,LIVE_SYNC_PORT as T,PORT as E}from"../defaultValues/editor.mjs";import{DEFAULT_LOCALE as D,LOCALES as O,REQUIRED_LOCALES as k,STRICT_MODE as A}from"../defaultValues/internationalization.mjs";import{MODE as j,PREFIX as M}from"../defaultValues/log.mjs";import{BASE_PATH as N,ROUTING_MODE as P,STORAGE as F}from"../defaultValues/routing.mjs";import{CACHE_DIR as I,CONFIG_DIR as re,DICTIONARIES_DIR as L,DYNAMIC_DICTIONARIES_DIR as R,FETCH_DICTIONARIES_DIR as z,MAIN_DIR as B,MODULE_AUGMENTATION_DIR as V,REMOTE_DICTIONARIES_DIR as H,TEMP_DIR as U,TYPES_DIR as W,UNMERGED_DICTIONARIES_DIR as G}from"../defaultValues/system.mjs";import{normalizePath as K}from"../utils/normalizePath.mjs";import{getProjectRequire as q}from"../utils/ESMxCJSHelpers.mjs";import{dirname as J,isAbsolute as Y,join as X}from"node:path";import{statSync as Z}from"node:fs";import ie from"@intlayer/types/package.json"with{type:"json"};let Q;const ae=e=>({locales:e?.locales??O,requiredLocales:e?.requiredLocales??e?.locales??k,strictMode:e?.strictMode??A,defaultLocale:e?.defaultLocale??D}),oe=e=>({mode:e?.mode??P,storage:e?.storage??F,basePath:e?.basePath??N,rewrite:e?.rewrite}),$=(t,n)=>{let r=t?.fileExtensions??ne,i=t?.baseDir??n??process.cwd(),a=t=>{let n;try{n=q(i).resolve(t,{paths:[i]})}catch{try{n=e.resolve(t,{paths:[i]})}catch{n=Y(t)?t:X(i,t)}}try{if(Z(n).isFile())return J(n)}catch{if(/\.[a-z0-9]+$/i.test(n))return J(n)}return n},o=(t?.contentDir??ee).map(a);return{fileExtensions:r,baseDir:i,contentDir:o,codeDir:(t?.codeDir??f).map(a),excludedPath:t?.excludedPath??te,watch:t?.watch??p,formatCommand:t?.formatCommand,watchedFilesPattern:r.map(e=>`/**/*${e}`),watchedFilesPatternWithPath:r.flatMap(e=>o.map(t=>`${K(t)}/**/*${e}`))}},se=(e,t)=>{let n=t?.baseDir??process.cwd(),r=e=>{let t;try{t=q(n).resolve(e,{paths:[n]})}catch{t=Y(e)?e:X(n,e)}try{if(Z(t).isFile())return J(t)}catch{if(/\.[a-z0-9]+$/i.test(t))return J(t)}return t},i=r(e?.dictionariesDir??L);return{moduleAugmentationDir:r(e?.moduleAugmentationDir??V),unmergedDictionariesDir:r(e?.unmergedDictionariesDir??G),remoteDictionariesDir:r(e?.remoteDictionariesDir??H),dictionariesDir:i,dynamicDictionariesDir:r(e?.dynamicDictionariesDir??R),fetchDictionariesDir:r(e?.fetchDictionariesDir??z),typesDir:r(e?.typesDir??W),mainDir:r(e?.mainDir??B),configDir:r(e?.configDir??re),cacheDir:r(e?.cacheDir??I),tempDir:r(e?.tempDir??U),outputFilesPatternWithPath:`${K(i)}/**/*.json`}},ce=e=>({applicationURL:e?.applicationURL??v,editorURL:e?.editorURL??S,cmsURL:e?.cmsURL??b,backendURL:e?.backendURL??y,port:e?.port??E,enabled:e?.enabled??C,clientId:e?.clientId??void 0,clientSecret:e?.clientSecret??void 0,dictionaryPriorityStrategy:e?.dictionaryPriorityStrategy??x,liveSync:e?.liveSync??w,liveSyncPort:e?.liveSyncPort??T,liveSyncURL:e?.liveSyncURL??`http://localhost:${e?.liveSyncPort??T}`}),le=(e,t)=>({mode:e?.mode??j,prefix:e?.prefix??M,error:t?.error,log:t?.log,info:t?.info,warn:t?.warn}),ue=e=>({provider:e?.provider,apiKey:e?.apiKey,model:e?.model,temperature:e?.temperature,applicationContext:e?.applicationContext,baseURL:e?.baseURL,dataSerialization:e?.dataSerialization}),de=e=>({mode:e?.mode??t,optimize:e?.optimize,importMode:e?.importMode,traversePattern:e?.traversePattern??i,outputFormat:e?.outputFormat??r,cache:e?.cache??n,require:e?.require,checkTypes:e?.checkTypes??a}),fe=e=>({enabled:e?.enabled??s,dictionaryKeyPrefix:e?.dictionaryKeyPrefix??o,transformPattern:e?.transformPattern??d,excludePattern:e?.excludePattern??c,outputDir:e?.outputDir??l,saveComponents:e?.saveComponents??u}),pe=e=>{let t=e?.contentAutoTransformation??m;return{fill:e?.fill??h,contentAutoTransformation:typeof t==`object`?{markdown:t.markdown??!1,html:t.html??!1,insertion:t.insertion??!1}:t,location:e?.location??_,locale:e?.locale,title:e?.title,description:e?.description,tags:e?.tags,priority:e?.priority,importMode:e?.importMode??g,version:e?.version}},me=(e,t,n)=>{let r=ae(e?.internationalization),i=oe(e?.routing),a=$(e?.content,t);return Q={internationalization:r,routing:i,content:a,system:se(e?.system,a),editor:ce(e?.editor),log:le(e?.log,n),ai:ue(e?.ai),build:de(e?.build),compiler:fe(e?.compiler),dictionary:pe(e?.dictionary),plugins:e?.plugins,schemas:e?.schemas,metadata:{name:`Intlayer`,version:ie.version,doc:`https://intlayer.org/docs`}},Q};export{me as buildConfigurationFields};
1
+ import{__require as e}from"../_virtual/_rolldown/runtime.mjs";import{OUTPUT_FORMAT as t,TRAVERSE_PATTERN as n}from"../defaultValues/build.mjs";import{COMPILER_EXCLUDE_PATTERN as r,COMPILER_TRANSFORM_PATTERN as i}from"../defaultValues/compiler.mjs";import{CODE_DIR as a,CONTENT_DIR as o,EXCLUDED_PATHS as s,FILE_EXTENSIONS as c}from"../defaultValues/content.mjs";import"../defaultValues/dictionary.mjs";import"../defaultValues/editor.mjs";import{DEFAULT_LOCALE as l,LOCALES as u,REQUIRED_LOCALES as d}from"../defaultValues/internationalization.mjs";import{PREFIX as f}from"../defaultValues/log.mjs";import{STORAGE as p}from"../defaultValues/routing.mjs";import"../defaultValues/system.mjs";import{normalizePath as m}from"../utils/normalizePath.mjs";import{getProjectRequire as h}from"../utils/ESMxCJSHelpers.mjs";import{statSync as g}from"node:fs";import{dirname as _,isAbsolute as v,join as y}from"node:path";import b from"@intlayer/types/package.json"with{type:"json"};let x;const S=e=>({locales:e?.locales??u,requiredLocales:e?.requiredLocales??e?.locales??d,strictMode:e?.strictMode??`inclusive`,defaultLocale:e?.defaultLocale??l}),C=e=>({mode:e?.mode??`prefix-no-default`,storage:e?.storage??p,basePath:e?.basePath??``,rewrite:e?.rewrite}),w=(t,n)=>{let r=t?.fileExtensions??c,i=t?.baseDir??n??process.cwd(),l=t=>{let n;try{n=h(i).resolve(t,{paths:[i]})}catch{try{n=e.resolve(t,{paths:[i]})}catch{n=v(t)?t:y(i,t)}}try{if(g(n).isFile())return _(n)}catch{if(/\.[a-z0-9]+$/i.test(n))return _(n)}return n},u=(t?.contentDir??o).map(l);return{fileExtensions:r,baseDir:i,contentDir:u,codeDir:(t?.codeDir??a).map(l),excludedPath:t?.excludedPath??s,watch:t?.watch??!0,formatCommand:t?.formatCommand,watchedFilesPattern:r.map(e=>`/**/*${e}`),watchedFilesPatternWithPath:r.flatMap(e=>u.map(t=>`${m(t)}/**/*${e}`))}},T=(e,t)=>{let n=t?.baseDir??process.cwd(),r=e=>{let t;try{t=h(n).resolve(e,{paths:[n]})}catch{t=v(e)?e:y(n,e)}try{if(g(t).isFile())return _(t)}catch{if(/\.[a-z0-9]+$/i.test(t))return _(t)}return t},i=r(e?.dictionariesDir??`.intlayer/dictionary`);return{moduleAugmentationDir:r(e?.moduleAugmentationDir??`.intlayer/types`),unmergedDictionariesDir:r(e?.unmergedDictionariesDir??`.intlayer/unmerged_dictionary`),remoteDictionariesDir:r(e?.remoteDictionariesDir??`.intlayer/remote_dictionary`),dictionariesDir:i,dynamicDictionariesDir:r(e?.dynamicDictionariesDir??`.intlayer/dynamic_dictionary`),fetchDictionariesDir:r(e?.fetchDictionariesDir??`.intlayer/fetch_dictionary`),typesDir:r(e?.typesDir??`.intlayer/types`),mainDir:r(e?.mainDir??`.intlayer/main`),configDir:r(e?.configDir??`.intlayer/config`),cacheDir:r(e?.cacheDir??`.intlayer/cache`),tempDir:r(e?.tempDir??`.intlayer/tmp`),outputFilesPatternWithPath:`${m(i)}/**/*.json`}},E=e=>({applicationURL:e?.applicationURL??``,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??!0,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}`}),D=(e,t)=>({mode:e?.mode??`default`,prefix:e?.prefix??f,error:t?.error,log:t?.log,info:t?.info,warn:t?.warn}),O=e=>({provider:e?.provider,apiKey:e?.apiKey,model:e?.model,temperature:e?.temperature,applicationContext:e?.applicationContext,baseURL:e?.baseURL,dataSerialization:e?.dataSerialization}),k=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}),A=e=>({enabled:e?.enabled??!0,dictionaryKeyPrefix:e?.dictionaryKeyPrefix??`comp-`,transformPattern:e?.transformPattern??i,excludePattern:e?.excludePattern??r,outputDir:e?.outputDir??`./compiler`,saveComponents:e?.saveComponents??!1}),j=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`,version:e?.version}},M=(e,t,n)=>{let r=S(e?.internationalization),i=C(e?.routing),a=w(e?.content,t);return x={internationalization:r,routing:i,content:a,system:T(e?.system,a),editor:E(e?.editor),log:D(e?.log,n),ai:O(e?.ai),build:k(e?.build),compiler:A(e?.compiler),dictionary:j(e?.dictionary),plugins:e?.plugins,schemas:e?.schemas,metadata:{name:`Intlayer`,version:b.version,doc:`https://intlayer.org/docs`}},x};export{M 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';\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_EXCLUDE_PATTERN,\n COMPILER_OUTPUT_DIR,\n COMPILER_SAVE_COMPONENTS,\n COMPILER_TRANSFORM_PATTERN,\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';\nimport { normalizePath } from '../utils/normalizePath';\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 buildContentFields = (\n customConfiguration?: Partial<ContentConfig>,\n baseDir?: string\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n const projectBaseDir =\n customConfiguration?.baseDir ?? baseDir ?? process.cwd();\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(projectBaseDir);\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n try {\n // Fall back to native require.resolve if the custom require fails\n absolutePath = require.resolve(pathInput, { paths: [projectBaseDir] });\n } catch {\n // If all resolution fails, fall back to standard path joining\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, 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 baseDir: projectBaseDir,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),\n watchedFilesPatternWithPath: fileExtensions.flatMap((ext) =>\n contentDir.map((dir) => `${normalizePath(dir)}/**/*${ext}`)\n ),\n };\n};\n\nconst buildSystemFields = (\n customConfiguration?: Partial<SystemConfig>,\n contentConfig?: ContentConfig\n): SystemConfig => {\n const projectBaseDir = contentConfig?.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 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 outputFilesPatternWithPath: `${normalizePath(dictionariesDir)}/**/*.json`,\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: true;\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 transformPattern:\n customConfiguration?.transformPattern ?? COMPILER_TRANSFORM_PATTERN,\n\n /**\n * Pattern to exclude from the optimization.\n */\n excludePattern:\n customConfiguration?.excludePattern ?? COMPILER_EXCLUDE_PATTERN,\n\n /**\n * Output directory for the optimized dictionaries.\n */\n outputDir: customConfiguration?.outputDir ?? COMPILER_OUTPUT_DIR,\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 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 * The version of the dictionary.\n */\n version: customConfiguration?.version,\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 contentConfig = buildContentFields(\n customConfiguration?.content,\n baseDir\n );\n\n const systemConfig = buildSystemFields(\n customConfiguration?.system,\n contentConfig\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\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,GAAmB,GAAqB,QAAQ,CAEhE,EAAgB,EACpB,GAAqB,QACrB,EACD,CAyCD,MApBA,GAAsB,CACpB,qBAAsB,EACtB,QAAS,EACT,QAAS,EACT,OAvBmB,GACnB,GAAqB,OACrB,EACD,CAqBC,OAnBmB,GAAkB,GAAqB,OAAO,CAoBjE,IAlBgB,GAAe,GAAqB,IAAK,EAAa,CAmBtE,GAjBe,GAAc,GAAqB,GAAG,CAkBrD,MAhBkB,GAAiB,GAAqB,MAAM,CAiB9D,SAfqB,GAAoB,GAAqB,SAAS,CAgBvE,WAduB,GACvB,GAAqB,WACtB,CAaC,QAAS,GAAqB,QAC9B,QAAS,GAAqB,QAC9B,SAAU,CACR,KAAM,WACN,QAAS,GAAY,QACrB,IAAK,4BACN,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';\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_EXCLUDE_PATTERN,\n COMPILER_OUTPUT_DIR,\n COMPILER_SAVE_COMPONENTS,\n COMPILER_TRANSFORM_PATTERN,\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';\nimport { normalizePath } from '../utils/normalizePath';\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 buildContentFields = (\n customConfiguration?: Partial<ContentConfig>,\n baseDir?: string\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n const projectBaseDir =\n customConfiguration?.baseDir ?? baseDir ?? process.cwd();\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(projectBaseDir);\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch {\n try {\n // Fall back to native require.resolve if the custom require fails\n absolutePath = require.resolve(pathInput, { paths: [projectBaseDir] });\n } catch {\n // If all resolution fails, fall back to standard path joining\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, 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 baseDir: projectBaseDir,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),\n watchedFilesPatternWithPath: fileExtensions.flatMap((ext) =>\n contentDir.map((dir) => `${normalizePath(dir)}/**/*${ext}`)\n ),\n };\n};\n\nconst buildSystemFields = (\n customConfiguration?: Partial<SystemConfig>,\n contentConfig?: ContentConfig\n): SystemConfig => {\n const projectBaseDir = contentConfig?.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 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 outputFilesPatternWithPath: `${normalizePath(dictionariesDir)}/**/*.json`,\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: true;\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 transformPattern:\n customConfiguration?.transformPattern ?? COMPILER_TRANSFORM_PATTERN,\n\n /**\n * Pattern to exclude from the optimization.\n */\n excludePattern:\n customConfiguration?.excludePattern ?? COMPILER_EXCLUDE_PATTERN,\n\n /**\n * Output directory for the optimized dictionaries.\n */\n outputDir: customConfiguration?.outputDir ?? COMPILER_OUTPUT_DIR,\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 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 * The version of the dictionary.\n */\n version: customConfiguration?.version,\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 contentConfig = buildContentFields(\n customConfiguration?.content,\n baseDir\n );\n\n const systemConfig = buildSystemFields(\n customConfiguration?.system,\n contentConfig\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":"08BAiFA,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,IACkB,CAClB,IAAM,EAAiB,GAAqB,gBAAkB,EACxD,EACJ,GAAqB,SAAW,GAAW,QAAQ,KAAK,CAEpD,EAAuB,GAAsB,CACjD,IAAI,EAEJ,GAAI,CAGF,EADwB,EAAkB,EAAe,CAC1B,QAAQ,EAAW,CAChD,MAAO,CAAC,EAAe,CACxB,CAAC,MACI,CACN,GAAI,CAEF,EAAA,EAAuB,QAAQ,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oB,CAIpB,QAAS,GAAqB,SAAA,GAK9B,oBACE,GAAqB,qBAAA,QAKvB,iBACE,GAAqB,kBAAoB,EAK3C,eACE,GAAqB,gBAAkB,EAKzC,UAAW,GAAqB,WAAA,aAKhC,eACE,GAAqB,gBAAA,GACxB,EAEK,EACJ,GACqB,CACrB,IAAM,EACJ,GAAqB,2BAAA,GAGvB,MAAO,CAML,KAAM,GAAqB,MAAA,GAO3B,0BACE,OAAO,GAA8B,SACjC,CACE,SAAU,EAA0B,UAAY,GAChD,KAAM,EAA0B,MAAQ,GACxC,UAAW,EAA0B,WAAa,GACnD,CACD,EAON,SAAU,GAAqB,UAAA,QAO/B,OAAQ,GAAqB,OAK7B,MAAO,GAAqB,MAK5B,YAAa,GAAqB,YAKlC,KAAM,GAAqB,KAK3B,SAAU,GAAqB,SAY/B,WAAY,GAAqB,YAAA,SAKjC,QAAS,GAAqB,QAC/B,EAMU,GACX,EACA,EACA,IACmB,CACnB,IAAM,EAA6B,EACjC,GAAqB,qBACtB,CAEK,EAAgB,EAAmB,GAAqB,QAAQ,CAEhE,EAAgB,EACpB,GAAqB,QACrB,EACD,CAyCD,MApBA,GAAsB,CACpB,qBAAsB,EACtB,QAAS,EACT,QAAS,EACT,OAvBmB,EACnB,GAAqB,OACrB,EACD,CAqBC,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{getEnvFilePath as e}from"../loadEnvFile.mjs";import{getAppLogger as t}from"../logger.mjs";import{cacheMemory as n}from"../utils/cacheMemory.mjs";import{getPackageJsonPath as r}from"../utils/getPackageJsonPath.mjs";import{buildConfigurationFields as i}from"./buildConfigurationFields.mjs";import{loadConfigurationFile as a}from"./loadConfigurationFile.mjs";import{searchConfigurationFile as o}from"./searchConfigurationFile.mjs";import{relative as s}from"node:path";import{formatPath as c}from"/Users/aymericpineau/Documents/node_modules/@intlayer/chokidar/dist/esm/utils/index.mjs";import{defu as l}from"defu";const u=u=>{let d;try{d=u?.baseDir??r().baseDir}catch{return{configuration:i({},u?.baseDir,u?.logFunctions),configurationFilePath:void 0}}let f=n.get(u);if(f)return f;let{configurationFilePath:p,numCustomConfiguration:m}=o(d),h;h=i(p?a(p,{projectRequire:u?.require,envVarOptions:{env:u?.env,envFile:u?.envFile},additionalEnvVars:u?.additionalEnvVars,aliases:u?.aliases}):{},u?.baseDir,u?.logFunctions);let g=l(u?.require?{build:{require:u?.require,cache:u?.cache}}:{},h),_=l(u?.override??{},g);n.set(u,{configuration:_,configurationFilePath:p});let v=t(_);if(m===0)v(`Configuration file not found, using default configuration.`,{isVerbose:!0});else{let t=s(d,p);if(m===1){let n=e(u?.env,u?.envFile);v(`Configuration loaded ${c(t)}${n?` - Env: ${c(n)}`:``}`,{isVerbose:!0})}else v(`Multiple configuration files found, using ${t}.`,{isVerbose:!0})}return{configuration:_,configurationFilePath:p}},d=e=>u(e).configuration;export{d as getConfiguration,u as getConfigurationAndFilePath};
1
+ import{cacheMemory as e}from"../utils/cacheMemory.mjs";import{getPackageJsonPath as t}from"../utils/getPackageJsonPath.mjs";import{buildConfigurationFields as n}from"./buildConfigurationFields.mjs";import{loadConfigurationFile as r}from"./loadConfigurationFile.mjs";import{searchConfigurationFile as i}from"./searchConfigurationFile.mjs";import{defu as a}from"defu";const o=o=>{let s;try{s=o?.baseDir??t().baseDir}catch{return{configuration:n({},o?.baseDir,o?.logFunctions),numCustomConfiguration:0,configurationFilePath:void 0}}let c=e.get(o);if(c)return c;let{configurationFilePath:l,numCustomConfiguration:u}=i(s),d;d=n(l?r(l,{projectRequire:o?.require,envVarOptions:{env:o?.env,envFile:o?.envFile},additionalEnvVars:o?.additionalEnvVars,aliases:o?.aliases}):{},o?.baseDir,o?.logFunctions);let f=a(o?.require?{build:{require:o?.require,cache:o?.cache}}:{},d),p=a(o?.override??{},f);return e.set(o,{configuration:p,numCustomConfiguration:u,configurationFilePath:l}),{configuration:p,numCustomConfiguration:u,configurationFilePath:l}},s=e=>o(e).configuration;export{s as getConfiguration,o as getConfigurationAndFilePath};
2
2
  //# sourceMappingURL=getConfiguration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getConfiguration.mjs","names":[],"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { formatPath } from '@intlayer/chokidar/utils';\nimport type {\n CustomIntlayerConfig,\n IntlayerConfig,\n LogFunctions,\n} from '@intlayer/types';\nimport { defu } from 'defu';\nimport { getEnvFilePath } from '../loadEnvFile';\nimport type { SandBoxContextOptions } from '../loadExternalFile/parseFileContent';\nimport { getAppLogger } from '../logger';\nimport { cacheMemory } from '../utils/cacheMemory';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n // Dotenv options\n env?: string;\n envFile?: string;\n // Log functions\n logFunctions?: LogFunctions;\n // Require function\n require?: NodeJS.Require;\n // cache\n cache?: boolean;\n} & Omit<SandBoxContextOptions, 'projectRequire'>;\n\nexport type GetConfigurationAndFilePathResult = {\n configuration: IntlayerConfig;\n configurationFilePath: string | undefined;\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfigurationAndFilePath = (\n options?: GetConfigurationOptions\n): GetConfigurationAndFilePathResult => {\n let baseDir: string | undefined;\n\n try {\n // Can fail in some environments (e.g. MCP server, VScode extension)\n baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n } catch (_err) {\n // Return default config if the package.json is not found\n return {\n configuration: buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n ),\n configurationFilePath: undefined,\n };\n }\n\n const cachedConfiguration =\n cacheMemory.get<GetConfigurationAndFilePathResult>(options);\n\n if (cachedConfiguration) return cachedConfiguration;\n\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n let storedConfiguration: IntlayerConfig;\n\n if (configurationFilePath) {\n // Load the custom configuration\n const customConfiguration: CustomIntlayerConfig | undefined =\n loadConfigurationFile(configurationFilePath, {\n projectRequire: options?.require,\n // Dotenv options\n envVarOptions: {\n env: options?.env,\n envFile: options?.envFile,\n },\n // Sandbox context additional variables\n additionalEnvVars: options?.additionalEnvVars,\n aliases: options?.aliases,\n });\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n options?.baseDir,\n options?.logFunctions\n );\n } else {\n // No configuration file found, use default configuration\n storedConfiguration = buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n );\n }\n\n // Log warning if multiple configuration files are found\n\n const projectRequireConfig: CustomIntlayerConfig = options?.require\n ? {\n build: {\n require: options?.require,\n cache: options?.cache,\n },\n }\n : {};\n\n const configWithProjectRequire = defu(\n projectRequireConfig,\n storedConfiguration\n ) as IntlayerConfig;\n\n const configuration = defu(\n options?.override ?? {},\n configWithProjectRequire\n ) as IntlayerConfig;\n\n cacheMemory.set(options, {\n configuration,\n configurationFilePath,\n });\n\n const appLogger = getAppLogger(configuration);\n\n if (numCustomConfiguration === 0) {\n appLogger('Configuration file not found, using default configuration.', {\n isVerbose: true,\n });\n } else {\n const relativeOutputPath = relative(baseDir, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n const dotEnvFilePath = getEnvFilePath(options?.env, options?.envFile);\n\n appLogger(\n `Configuration loaded ${formatPath(relativeOutputPath)}${dotEnvFilePath ? ` - Env: ${formatPath(dotEnvFilePath)}` : ''}`,\n {\n isVerbose: true,\n }\n );\n } else {\n appLogger(\n `Multiple configuration files found, using ${relativeOutputPath}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n\n return {\n configuration,\n configurationFilePath,\n };\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => getConfigurationAndFilePath(options).configuration;\n"],"mappings":"ymBAuCA,MAAa,EACX,GACsC,CACtC,IAAI,EAEJ,GAAI,CAEF,EAAU,GAAS,SAAW,GAAoB,CAAC,aACtC,CAEb,MAAO,CACL,cAAe,EACb,EAAE,CACF,GAAS,QACT,GAAS,aACV,CACD,sBAAuB,IAAA,GACxB,CAGH,IAAM,EACJ,EAAY,IAAuC,EAAQ,CAE7D,GAAI,EAAqB,OAAO,EAGhC,GAAM,CAAE,wBAAuB,0BAC7B,EAAwB,EAAQ,CAE9B,EAEJ,AAuBE,EAPsB,EAhBpB,EAGA,EAAsB,EAAuB,CAC3C,eAAgB,GAAS,QAEzB,cAAe,CACb,IAAK,GAAS,IACd,QAAS,GAAS,QACnB,CAED,kBAAmB,GAAS,kBAC5B,QAAS,GAAS,QACnB,CAAC,CAWF,EAAE,CANF,GAAS,QACT,GAAS,aAQV,CAcH,IAAM,EAA2B,EATkB,GAAS,QACxD,CACE,MAAO,CACL,QAAS,GAAS,QAClB,MAAO,GAAS,MACjB,CACF,CACD,EAAE,CAIJ,EACD,CAEK,EAAgB,EACpB,GAAS,UAAY,EAAE,CACvB,EACD,CAED,EAAY,IAAI,EAAS,CACvB,gBACA,wBACD,CAAC,CAEF,IAAM,EAAY,EAAa,EAAc,CAE7C,GAAI,IAA2B,EAC7B,EAAU,6DAA8D,CACtE,UAAW,GACZ,CAAC,KACG,CACL,IAAM,EAAqB,EAAS,EAAS,EAAuB,CAEpE,GAAI,IAA2B,EAAG,CAChC,IAAM,EAAiB,EAAe,GAAS,IAAK,GAAS,QAAQ,CAErE,EACE,wBAAwB,EAAW,EAAmB,GAAG,EAAiB,WAAW,EAAW,EAAe,GAAK,KACpH,CACE,UAAW,GACZ,CACF,MAED,EACE,6CAA6C,EAAmB,GAChE,CACE,UAAW,GACZ,CACF,CAIL,MAAO,CACL,gBACA,wBACD,EAMU,EACX,GACmB,EAA4B,EAAQ,CAAC"}
1
+ {"version":3,"file":"getConfiguration.mjs","names":[],"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import type {\n CustomIntlayerConfig,\n IntlayerConfig,\n LogFunctions,\n} from '@intlayer/types';\nimport { defu } from 'defu';\nimport type { SandBoxContextOptions } from '../loadExternalFile/parseFileContent';\nimport { cacheMemory } from '../utils/cacheMemory';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n // Dotenv options\n env?: string;\n envFile?: string;\n // Log functions\n logFunctions?: LogFunctions;\n // Require function\n require?: NodeJS.Require;\n // cache\n cache?: boolean;\n} & Omit<SandBoxContextOptions, 'projectRequire'>;\n\nexport type GetConfigurationAndFilePathResult = {\n configuration: IntlayerConfig;\n numCustomConfiguration: number;\n configurationFilePath: string | undefined;\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfigurationAndFilePath = (\n options?: GetConfigurationOptions\n): GetConfigurationAndFilePathResult => {\n let baseDir: string | undefined;\n\n try {\n // Can fail in some environments (e.g. MCP server, VScode extension)\n baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n } catch (_err) {\n // Return default config if the package.json is not found\n return {\n configuration: buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n ),\n numCustomConfiguration: 0,\n configurationFilePath: undefined,\n };\n }\n\n const cachedConfiguration =\n cacheMemory.get<GetConfigurationAndFilePathResult>(options);\n\n if (cachedConfiguration) return cachedConfiguration;\n\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n let storedConfiguration: IntlayerConfig;\n\n if (configurationFilePath) {\n // Load the custom configuration\n const customConfiguration: CustomIntlayerConfig | undefined =\n loadConfigurationFile(configurationFilePath, {\n projectRequire: options?.require,\n // Dotenv options\n envVarOptions: {\n env: options?.env,\n envFile: options?.envFile,\n },\n // Sandbox context additional variables\n additionalEnvVars: options?.additionalEnvVars,\n aliases: options?.aliases,\n });\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n options?.baseDir,\n options?.logFunctions\n );\n } else {\n // No configuration file found, use default configuration\n storedConfiguration = buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n );\n }\n\n // Log warning if multiple configuration files are found\n\n const projectRequireConfig: CustomIntlayerConfig = options?.require\n ? {\n build: {\n require: options?.require,\n cache: options?.cache,\n },\n }\n : {};\n\n const configWithProjectRequire = defu(\n projectRequireConfig,\n storedConfiguration\n ) as IntlayerConfig;\n\n const configuration = defu(\n options?.override ?? {},\n configWithProjectRequire\n ) as IntlayerConfig;\n\n cacheMemory.set(options, {\n configuration,\n numCustomConfiguration,\n configurationFilePath,\n });\n\n return {\n configuration,\n numCustomConfiguration,\n configurationFilePath,\n };\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => getConfigurationAndFilePath(options).configuration;\n"],"mappings":"8WAoCA,MAAa,EACX,GACsC,CACtC,IAAI,EAEJ,GAAI,CAEF,EAAU,GAAS,SAAW,GAAoB,CAAC,aACtC,CAEb,MAAO,CACL,cAAe,EACb,EAAE,CACF,GAAS,QACT,GAAS,aACV,CACD,uBAAwB,EACxB,sBAAuB,IAAA,GACxB,CAGH,IAAM,EACJ,EAAY,IAAuC,EAAQ,CAE7D,GAAI,EAAqB,OAAO,EAGhC,GAAM,CAAE,wBAAuB,0BAC7B,EAAwB,EAAQ,CAE9B,EAEJ,AAuBE,EAPsB,EAhBpB,EAGA,EAAsB,EAAuB,CAC3C,eAAgB,GAAS,QAEzB,cAAe,CACb,IAAK,GAAS,IACd,QAAS,GAAS,QACnB,CAED,kBAAmB,GAAS,kBAC5B,QAAS,GAAS,QACnB,CAAC,CAWF,EAAE,CANF,GAAS,QACT,GAAS,aAQV,CAcH,IAAM,EAA2B,EATkB,GAAS,QACxD,CACE,MAAO,CACL,QAAS,GAAS,QAClB,MAAO,GAAS,MACjB,CACF,CACD,EAAE,CAIJ,EACD,CAEK,EAAgB,EACpB,GAAS,UAAY,EAAE,CACvB,EACD,CAQD,OANA,EAAY,IAAI,EAAS,CACvB,gBACA,yBACA,wBACD,CAAC,CAEK,CACL,gBACA,yBACA,wBACD,EAMU,EACX,GACmB,EAA4B,EAAQ,CAAC"}
@@ -1,2 +1,2 @@
1
- import{logger as e}from"../logger.mjs";import{getPackageJsonPath as t}from"../utils/getPackageJsonPath.mjs";import{resolve as n}from"node:path";import{existsSync as r}from"node:fs";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=a=>{let o,s=0,{baseDir:c}=t(a);for(let t of i)try{let e=n(c,t);r(e)&&(s+=1,o||=e)}catch(n){e(`${t}: ${n}`,{level:`error`})}return{configurationFilePath:o,numCustomConfiguration:s}};export{i as configurationFilesCandidates,a 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=a=>{let o,s=0,{baseDir:c}=e(a);for(let e of i)try{let t=r(c,e);n(t)&&(s+=1,o||=t)}catch(n){t(`${e}: ${n}`,{level:`error`})}return{configurationFilePath:o,numCustomConfiguration:s}};export{i as configurationFilesCandidates,a as searchConfigurationFile};
2
2
  //# sourceMappingURL=searchConfigurationFile.mjs.map
@@ -1,2 +1,2 @@
1
- import{__exportAll as e}from"../_virtual/_rolldown/runtime.mjs";var t=e({BUILD_MODE:()=>n,CACHE:()=>o,OPTIMIZE:()=>r,OUTPUT_FORMAT:()=>a,TRAVERSE_PATTERN:()=>i,TYPE_CHECKING:()=>s});const n=`auto`,r=void 0,i=[`**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}`,`!**/node_modules/**`],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 as build_exports};
1
+ import{__exportAll as e}from"../_virtual/_rolldown/runtime.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/**`],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 as build_exports};
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 '!**/node_modules/**',\n];\n\nexport const OUTPUT_FORMAT: ('cjs' | 'esm')[] = ['esm', 'cjs'];\n\nexport const CACHE = true;\n\nexport const TYPE_CHECKING = false;\n"],"mappings":"sLAAA,MAAa,EAAa,OAEb,EAAW,IAAA,GAEX,EAAmB,CAC9B,+CACA,sBACD,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 '!**/node_modules/**',\n];\n\nexport const OUTPUT_FORMAT: ('cjs' | 'esm')[] = ['esm', 'cjs'];\n\nexport const CACHE = true;\n\nexport const TYPE_CHECKING = false;\n"],"mappings":"6LAAA,MAAa,EAAa,OAEb,EAAW,IAAA,GAEX,EAAmB,CAC9B,+CACA,sBACD,CAEY,EAAmC,CAAC,MAAO,MAAM,CAEjD,EAAQ,GAER,EAAgB"}
@@ -1,2 +1,2 @@
1
- import{__exportAll as e}from"../_virtual/_rolldown/runtime.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:()=>c});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 as content_exports};
1
+ import{__exportAll as e}from"../_virtual/_rolldown/runtime.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 as content_exports};
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];\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":"gOAAA,MAAa,EAAkB,CAC7B,cACA,cACA,eACA,eACA,gBACA,iBACA,iBACA,eACA,eACD,CACY,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":"iOAAA,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{__exportAll as e}from"../_virtual/_rolldown/runtime.mjs";var t=e({CONTENT_AUTO_TRANSFORMATION:()=>i,FILL:()=>n,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 as dictionary_exports};
1
+ import{__exportAll as e}from"../_virtual/_rolldown/runtime.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 as dictionary_exports};
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';\n\nexport const FILL = true;\nexport const LOCATION: DictionaryLocation = 'local';\nexport const CONTENT_AUTO_TRANSFORMATION = false;\nexport const IMPORT_MODE = 'static';\n"],"mappings":"yJAEA,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';\n\nexport const FILL = true;\nexport const LOCATION: DictionaryLocation = 'local';\nexport const CONTENT_AUTO_TRANSFORMATION = false;\nexport const IMPORT_MODE = 'static';\n"],"mappings":"2JAEA,MAAa,EAAO,GACP,EAA+B,QAC/B,EAA8B,GAC9B,EAAc"}
@@ -1,2 +1,2 @@
1
- import{__exportAll as e}from"../_virtual/_rolldown/runtime.mjs";var t=e({APPLICATION_URL:()=>n,BACKEND_URL:()=>a,CMS_URL:()=>i,DICTIONARY_PRIORITY_STRATEGY:()=>l,EDITOR_URL:()=>r,IS_ENABLED:()=>s,LIVE_SYNC:()=>c,LIVE_SYNC_PORT:()=>u,PORT:()=>o});const n=``,r=`http://localhost:8000`,i=`https://app.intlayer.org`,a=`https://back.intlayer.org`,o=8e3,s=!0,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 as editor_exports};
1
+ import{__exportAll as e}from"../_virtual/_rolldown/runtime.mjs";var t=e({APPLICATION_URL:()=>``,BACKEND_URL:()=>a,CMS_URL:()=>i,DICTIONARY_PRIORITY_STRATEGY:()=>l,EDITOR_URL:()=>r,IS_ENABLED:()=>!0,LIVE_SYNC:()=>!0,LIVE_SYNC_PORT:()=>u,PORT:()=>o});const n=``,r=`http://localhost:8000`,i=`https://app.intlayer.org`,a=`https://back.intlayer.org`,o=8e3,s=!0,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 as editor_exports};
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 = '';\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 = true;\nexport const LIVE_SYNC = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'local_first';\nexport const LIVE_SYNC_PORT = 4000;\n"],"mappings":"sPAAA,MAAa,EAAkB,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 = '';\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 = true;\nexport const LIVE_SYNC = true;\nexport const DICTIONARY_PRIORITY_STRATEGY = 'local_first';\nexport const LIVE_SYNC_PORT = 4000;\n"],"mappings":"yPAAA,MAAa,EAAkB,GAClB,EAAa,wBACb,EAAU,2BACV,EAAc,4BACd,EAAO,IACP,EAAa,GACb,EAAY,GACZ,EAA+B,cAC/B,EAAiB"}
@@ -1,2 +1,2 @@
1
- import{__exportAll as e}from"../_virtual/_rolldown/runtime.mjs";var t=e({BASE_PATH:()=>a,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 as routing_exports};
1
+ import{__exportAll as e}from"../_virtual/_rolldown/runtime.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 as routing_exports};
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';\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":"kNAEA,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';\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":"mNAEA,MAAa,EAAc,oBAEd,EAAc,kBACd,EAAsB,kBAEtB,EAAY,GAEZ,EAAoB,SAEpB,EAAe,oBAEf,EAAoC,CAAC,SAAU,SAAS"}
@@ -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{extname as a}from"node:path";import{readFileSync as o}from"node:fs";import{readFile as s}from"node:fs/promises";import c from"json5";const l=(e,r)=>{let s=a(e)||`.json`;try{if(s===`.json`||s===`.json5`||s===`.jsonc`)return c.parse(o(e,`utf-8`));let a=i(o(e,`utf-8`),e);if(!a){t(`File could not be loaded.`,{level:`error`});return}let l=n(a,{projectRequire:r?.projectRequire,envVarOptions:r?.envVarOptions,additionalEnvVars:r?.additionalEnvVars,mocks:r?.mocks,aliases:r?.aliases});if(l===void 0){t(`File could not be loaded. Path : ${e}`);return}return l}catch(e){t([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}},u=async(i,o)=>{let l=a(i);try{if(l===`.json`||l===`.json5`||l===`.jsonc`){let e=await s(i,`utf-8`);return c.parse(e)}let a=await r(await s(i,`utf-8`),i,o?.buildOptions);if(!a){t(`File could not be loaded.`,{level:`error`});return}let u=n(a,{projectRequire:o?.projectRequire,envVarOptions:o?.envVarOptions,additionalEnvVars:o?.additionalEnvVars,mocks:o?.mocks,aliases:o?.aliases});if(u===void 0){t(`File could not be loaded. Path : ${e(i)}`);return}return u}catch(e){t([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}};export{u as loadExternalFile,l 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=(e,r)=>{let s=o(e)||`.json`;try{if(s===`.json`||s===`.json5`||s===`.jsonc`)return c.parse(a(e,`utf-8`));let o=i(a(e,`utf-8`),e);if(!o){t(`File could not be loaded.`,{level:`error`});return}let l=n(o,{projectRequire:r?.projectRequire,envVarOptions:r?.envVarOptions,additionalEnvVars:r?.additionalEnvVars,mocks:r?.mocks,aliases:r?.aliases});if(l===void 0){t(`File could not be loaded. Path : ${e}`);return}return l}catch(e){t([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}},u=async(i,a)=>{let l=o(i);try{if(l===`.json`||l===`.json5`||l===`.jsonc`){let e=await s(i,`utf-8`);return c.parse(e)}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){t([`Error: ${e.message} - `,JSON.stringify(e.stack,null,2)],{level:`error`})}};export{u as loadExternalFile,l as loadExternalFileSync};
2
2
  //# sourceMappingURL=loadExternalFile.mjs.map
@@ -1,2 +1,2 @@
1
- import{loadEnvFile as e}from"../loadEnvFile.mjs";import{getProjectRequire as t}from"../utils/ESMxCJSHelpers.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:t(),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,...e(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{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};
2
2
  //# sourceMappingURL=parseFileContent.mjs.map
@@ -1,2 +1,2 @@
1
- import{getPackageJsonPath as e}from"../utils/getPackageJsonPath.mjs";import{getLoader as t}from"./bundleFile.mjs";import{dirname as n,extname as r,join as i}from"node:path";import{existsSync as a}from"node:fs";import{build as o,buildSync as s}from"esbuild";import{pathToFileURL as c}from"node:url";const l=t=>{let r=i(e(n(t)).baseDir,`tsconfig.json`);return a(r)?r:void 0},u=e=>({loader:{".js":`js`,".jsx":`jsx`,".mjs":`js`,".ts":`ts`,".tsx":`tsx`,".cjs":`js`,".json":`json`,".md":`text`,".mdx":`text`},format:`cjs`,target:`node20`,platform:`node`,write:!1,packages:`external`,bundle:!0,tsconfig:l(e),define:{"import.meta.url":JSON.stringify(c(e).href)}}),d=(e,i,a)=>s({stdin:{contents:e,loader:t(r(i)),resolveDir:n(i),sourcefile:i},...u(i),...a}).outputFiles?.[0].text,f=async(e,i,a)=>(await o({stdin:{contents:e,loader:t(r(i)),resolveDir:n(i),sourcefile:i},...u(i),...a})).outputFiles?.[0].text;export{f as transpileTSToCJS,d as transpileTSToCJSSync};
1
+ import{getPackageJsonPath as e}from"../utils/getPackageJsonPath.mjs";import{getLoader as t}from"./bundleFile.mjs";import{existsSync as n}from"node:fs";import{dirname as r,extname as i,join as a}from"node:path";import{build as o,buildSync as s}from"esbuild";import{pathToFileURL as c}from"node:url";const l=t=>{let i=a(e(r(t)).baseDir,`tsconfig.json`);return n(i)?i:void 0},u=e=>({loader:{".js":`js`,".jsx":`jsx`,".mjs":`js`,".ts":`ts`,".tsx":`tsx`,".cjs":`js`,".json":`json`,".md":`text`,".mdx":`text`},format:`cjs`,target:`node20`,platform:`node`,write:!1,packages:`external`,bundle:!0,tsconfig:l(e),define:{"import.meta.url":JSON.stringify(c(e).href)}}),d=(e,n,a)=>s({stdin:{contents:e,loader:t(i(n)),resolveDir:r(n),sourcefile:n},...u(n),...a}).outputFiles?.[0].text,f=async(e,n,a)=>(await o({stdin:{contents:e,loader:t(i(n)),resolveDir:r(n),sourcefile:n},...u(n),...a})).outputFiles?.[0].text;export{f as transpileTSToCJS,d as transpileTSToCJSSync};
2
2
  //# sourceMappingURL=transpileTSToCJS.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.mjs","names":[],"sources":["../../src/logger.ts"],"sourcesContent":["import type { CustomIntlayerConfig, Locale } from '@intlayer/types';\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, padChar } = {\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":"AAUA,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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OACH,GAAG,IAAI,OAAO,EAAa,GAAG,IAGhC,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":[],"sources":["../../src/logger.ts"],"sourcesContent":["import type { CustomIntlayerConfig, Locale } from '@intlayer/types';\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, padChar } = {\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('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AAO,GAAW,WACpB,EAAQ,GAEN,OAAO,GAAW,WACpB,EAAQ,EAAO,QAEb,MAAM,QAAQ,EAAO,EAAI,EAAO,MAAO,GAAM,OAAO,GAAM,SAAS,GACrE,EAAQ,KAAK,IAAI,GAAG,EAAO,IAAK,GAAQ,EAAI,OAAO,CAAC,EAElD,MAAM,QAAQ,EAAO,EAAI,EAAO,MAAO,GAAM,OAAO,GAAM,SAAS,GACrE,EAAQ,KAAK,IAAI,GAAG,EAAO,EAEtB,KAAK,IAAI,EAAO,EAAE,EAGrB,EAAsB,CAC1B,QAAS,EACT,QAAS,EACT,QAAS,IACT,IAAK,QACL,QAAS,IACV,CAQY,GACX,EACA,IAQA,CAAC,EAAK,CACH,MAAM,CACN,IAAK,GAAS,CACb,GAAM,CAAE,UAAS,UAAS,UAAS,MAAK,WAAY,CAClD,GAAG,EACH,GAAI,GAAW,EAAE,CAClB,CAEK,EAAS,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,IAAK,EAAW,IAAI,CACjC,EAAI,EAAS,IAAK,EAAW,MAAM,CACnC,EAAQ,EAAS,IAAK,EAAW,KAAK"}
@@ -1,2 +1,2 @@
1
- import{cacheMemory as e}from"./cacheMemory.mjs";import{dirname as t,join as n}from"node:path";import{existsSync as r}from"node:fs";const i=(i=process.cwd())=>{let a=e.get(`packageJsonPath`,i);if(a)return a;let o=i;for(let a=0;a<15;a++){let a=n(o,`package.json`);if(r(a))return e.set(`packageJsonPath`,i,{packageJsonPath:a,baseDir:o}),{packageJsonPath:a,baseDir:o};let s=t(o);if(s===o)break;o=s}throw Error(`Could not find package.json in current directory or any of the 15 parent directories. Searched from: ${i}`)};export{i as getPackageJsonPath};
1
+ import{cacheMemory as e}from"./cacheMemory.mjs";import{existsSync as t}from"node:fs";import{dirname as n,join as r}from"node:path";const i=(i=process.cwd())=>{let a=e.get(`packageJsonPath`,i);if(a)return a;let o=i;for(let a=0;a<15;a++){let a=r(o,`package.json`);if(t(a))return e.set(`packageJsonPath`,i,{packageJsonPath:a,baseDir:o}),{packageJsonPath:a,baseDir:o};let s=n(o);if(s===o)break;o=s}throw Error(`Could not find package.json in current directory or any of the 15 parent directories. Searched from: ${i}`)};export{i as getPackageJsonPath};
2
2
  //# sourceMappingURL=getPackageJsonPath.mjs.map
@@ -1,5 +1,4 @@
1
1
  import { index_d_exports } from "./defaultValues/index.js";
2
- import { ANSIColors, Details, Logger, clock, colon, colorize, colorizeKey, colorizeLocales, colorizeNumber, colorizePath, getAppLogger, getPrefix, logger, removeColor, setPrefix, spinnerFrames, v, x } from "./logger.js";
3
2
  import { extractErrorMessage } from "./utils/extractErrorMessage.js";
4
3
  import { logStack } from "./utils/logStack.js";
5
4
  import { normalizePath } from "./utils/normalizePath.js";
@@ -7,4 +6,4 @@ import { camelCaseToKebabCase } from "./utils/stringFormatter/camelCaseToKebabCa
7
6
  import { camelCaseToSentence } from "./utils/stringFormatter/camelCaseToSentence.js";
8
7
  import { kebabCaseToCamelCase } from "./utils/stringFormatter/kebabCaseToCamelCase.js";
9
8
  import { toLowerCamelCase } from "./utils/stringFormatter/toLowerCamelCase.js";
10
- export { ANSIColors, index_d_exports as DefaultValues, Details, Logger, camelCaseToKebabCase, camelCaseToSentence, clock, colon, colorize, colorizeKey, colorizeLocales, colorizeNumber, colorizePath, extractErrorMessage, getAppLogger, getPrefix, kebabCaseToCamelCase, logStack, logger, normalizePath, removeColor, setPrefix, spinnerFrames, toLowerCamelCase, v, x };
9
+ export { index_d_exports as DefaultValues, camelCaseToKebabCase, camelCaseToSentence, extractErrorMessage, kebabCaseToCamelCase, logStack, normalizePath, toLowerCamelCase };
@@ -13,6 +13,7 @@ type GetConfigurationOptions = {
13
13
  } & Omit<SandBoxContextOptions, 'projectRequire'>;
14
14
  type GetConfigurationAndFilePathResult = {
15
15
  configuration: IntlayerConfig;
16
+ numCustomConfiguration: number;
16
17
  configurationFilePath: string | undefined;
17
18
  };
18
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"getConfiguration.d.ts","names":[],"sources":["../../../src/configFile/getConfiguration.ts"],"mappings":";;;;KAiBY,uBAAA;EACV,OAAA;EACA,QAAA,GAAW,oBAAA;EAEX,GAAA;EACA,OAAA;EAEA,YAAA,GAAe,YAAA;EAEf,OAAA,GAAU,MAAA,CAAO,OAAA;EAEjB,KAAA;AAAA,IACE,IAAA,CAAK,qBAAA;AAAA,KAEG,iCAAA;EACV,aAAA,EAAe,cAAA;EACf,qBAAA;AAAA;;;;cAMW,2BAAA,GACX,OAAA,GAAU,uBAAA,KACT,iCAAA;;;;cA0HU,gBAAA,GACX,OAAA,GAAU,uBAAA,KACT,cAAA"}
1
+ {"version":3,"file":"getConfiguration.d.ts","names":[],"sources":["../../../src/configFile/getConfiguration.ts"],"mappings":";;;;KAaY,uBAAA;EACV,OAAA;EACA,QAAA,GAAW,oBAAA;EAEX,GAAA;EACA,OAAA;EAEA,YAAA,GAAe,YAAA;EAEf,OAAA,GAAU,MAAA,CAAO,OAAA;EAEjB,KAAA;AAAA,IACE,IAAA,CAAK,qBAAA;AAAA,KAEG,iCAAA;EACV,aAAA,EAAe,cAAA;EACf,sBAAA;EACA,qBAAA;AAAA;;;;cAMW,2BAAA,GACX,OAAA,GAAU,uBAAA,KACT,iCAAA;;;;cAiGU,gBAAA,GACX,OAAA,GAAU,uBAAA,KACT,cAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","names":[],"sources":["../../../src/defaultValues/content.ts"],"mappings":";;;cAAa,eAAA;AAAA,cAWA,cAAA;AAAA,cAaA,WAAA;AAAA,cAEA,QAAA;AAAA,cAEA,wBAAA;AAAA,cAEA,uBAAA;AAAA,cAEA,KAAA"}
1
+ {"version":3,"file":"content.d.ts","names":[],"sources":["../../../src/defaultValues/content.ts"],"mappings":";;;cAAa,eAAA;AAAA,cAYA,cAAA;AAAA,cAaA,WAAA;AAAA,cAEA,QAAA;AAAA,cAEA,wBAAA;AAAA,cAEA,uBAAA;AAAA,cAEA,KAAA"}
@@ -5,12 +5,12 @@ import { camelCaseToKebabCase } from "./stringFormatter/camelCaseToKebabCase.js"
5
5
  import { camelCaseToSentence } from "./stringFormatter/camelCaseToSentence.js";
6
6
  import { kebabCaseToCamelCase } from "./stringFormatter/kebabCaseToCamelCase.js";
7
7
  import { toLowerCamelCase } from "./stringFormatter/toLowerCamelCase.js";
8
+ import { configESMxCJSRequire, getProjectRequire, isESModule } from "./ESMxCJSHelpers.js";
8
9
  import { GetAliasOptions, getAlias } from "./alias.js";
9
10
  import { CacheKey, cacheMemory, clearAllCache, clearCache, computeKeyId, getCache, setCache, stableStringify } from "./cacheMemory.js";
10
11
  import { cacheDisk } from "./cacheDisk.js";
11
12
  import { clearModuleCache } from "./clearModuleCache.js";
12
13
  import { compareVersions } from "./compareVersions.js";
13
- import { configESMxCJSRequire, getProjectRequire, isESModule } from "./ESMxCJSHelpers.js";
14
14
  import { getExtension } from "./getExtension.js";
15
15
  import { getPackageJsonPath } from "./getPackageJsonPath.js";
16
16
  import { RetryManagerOptions, retryManager } from "./retryManager.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/config",
3
- "version": "8.2.1",
3
+ "version": "8.2.3",
4
4
  "private": false,
5
5
  "description": "Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.",
6
6
  "keywords": [
@@ -37,11 +37,6 @@
37
37
  ],
38
38
  "sideEffects": false,
39
39
  "exports": {
40
- ".": {
41
- "types": "./dist/types/index.d.ts",
42
- "require": "./dist/cjs/index.cjs",
43
- "import": "./dist/esm/index.mjs"
44
- },
45
40
  "./node": {
46
41
  "types": "./dist/types/node.d.ts",
47
42
  "require": "./dist/cjs/node.cjs",
@@ -132,19 +127,19 @@
132
127
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
133
128
  },
134
129
  "dependencies": {
135
- "@intlayer/types": "8.2.1",
130
+ "@intlayer/types": "8.2.3",
136
131
  "defu": "6.1.4",
137
132
  "dotenv": "17.3.1",
138
133
  "esbuild": "0.27.2",
139
134
  "json5": "2.2.3"
140
135
  },
141
136
  "devDependencies": {
142
- "@types/node": "25.3.3",
137
+ "@types/node": "25.3.5",
143
138
  "@utils/ts-config": "1.0.4",
144
139
  "@utils/ts-config-types": "1.0.4",
145
140
  "@utils/tsdown-config": "1.0.4",
146
141
  "rimraf": "6.1.3",
147
- "tsdown": "0.20.3",
142
+ "tsdown": "0.21.0",
148
143
  "typescript": "5.9.3",
149
144
  "vitest": "4.0.18"
150
145
  },
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./loadEnvFile.cjs`),t=require(`./logger.cjs`),n=require(`./utils/cacheMemory.cjs`),r=require(`./utils/getPackageJsonPath.cjs`),i=require(`./utils/getExtension.cjs`),a=require(`./utils/normalizePath.cjs`),o=require(`./utils/alias.cjs`),s=require(`./utils/cacheDisk.cjs`),c=require(`./utils/ESMxCJSHelpers.cjs`),l=require(`./utils/clearModuleCache.cjs`),u=require(`./utils/compareVersions.cjs`),d=require(`./utils/extractErrorMessage.cjs`),f=require(`./utils/logStack.cjs`),p=require(`./utils/retryManager.cjs`),m=require(`./utils/stringFormatter/camelCaseToKebabCase.cjs`),h=require(`./utils/stringFormatter/camelCaseToSentence.cjs`),g=require(`./utils/stringFormatter/kebabCaseToCamelCase.cjs`),_=require(`./utils/stringFormatter/toLowerCamelCase.cjs`),v=require(`./configFile/buildConfigurationFields.cjs`),y=require(`./loadExternalFile/parseFileContent.cjs`),b=require(`./loadExternalFile/bundleFile.cjs`),x=require(`./loadExternalFile/transpileTSToCJS.cjs`),S=require(`./loadExternalFile/loadExternalFile.cjs`),C=require(`./configFile/searchConfigurationFile.cjs`),w=require(`./configFile/getConfiguration.cjs`),T=require(`./defaultValues/index.cjs`),E=require(`./loadExternalFile/bundleJSFile.cjs`);exports.ANSIColors=t.ANSIColors,Object.defineProperty(exports,`DefaultValues`,{enumerable:!0,get:function(){return T.defaultValues_exports}}),exports.buildConfigurationFields=v.buildConfigurationFields,exports.bundleFile=b.bundleFile,exports.bundleFileSync=b.bundleFileSync,exports.bundleJSFile=E.bundleJSFile,exports.cacheDisk=s.cacheDisk,exports.cacheMemory=n.cacheMemory,exports.camelCaseToKebabCase=m.camelCaseToKebabCase,exports.camelCaseToSentence=h.camelCaseToSentence,exports.clearAllCache=n.clearAllCache,exports.clearCache=n.clearCache,exports.clearModuleCache=l.clearModuleCache,exports.clock=t.clock,exports.colon=t.colon,exports.colorize=t.colorize,exports.colorizeKey=t.colorizeKey,exports.colorizeLocales=t.colorizeLocales,exports.colorizeNumber=t.colorizeNumber,exports.colorizePath=t.colorizePath,exports.compareVersions=u.compareVersions,exports.computeKeyId=n.computeKeyId,exports.configESMxCJSRequire=c.configESMxCJSRequire,exports.configurationFilesCandidates=C.configurationFilesCandidates,exports.extractErrorMessage=d.extractErrorMessage,exports.getAlias=o.getAlias,exports.getAppLogger=t.getAppLogger,exports.getCache=n.getCache,exports.getConfiguration=w.getConfiguration,exports.getConfigurationAndFilePath=w.getConfigurationAndFilePath,exports.getEnvFilePath=e.getEnvFilePath,exports.getExtension=i.getExtension,exports.getLoader=b.getLoader,exports.getPackageJsonPath=r.getPackageJsonPath,exports.getPrefix=t.getPrefix,exports.getProjectRequire=c.getProjectRequire,exports.getSandBoxContext=y.getSandBoxContext,exports.isESModule=c.isESModule,exports.kebabCaseToCamelCase=g.kebabCaseToCamelCase,exports.loadEnvFile=e.loadEnvFile,exports.loadExternalFile=S.loadExternalFile,exports.loadExternalFileSync=S.loadExternalFileSync,exports.logStack=f.logStack,exports.logger=t.logger,exports.normalizePath=a.normalizePath,exports.parseFileContent=y.parseFileContent,exports.removeColor=t.removeColor,exports.retryManager=p.retryManager,exports.searchConfigurationFile=C.searchConfigurationFile,exports.setCache=n.setCache,exports.setPrefix=t.setPrefix,exports.spinnerFrames=t.spinnerFrames,exports.stableStringify=n.stableStringify,exports.toLowerCamelCase=_.toLowerCamelCase,exports.transpileTSToCJS=x.transpileTSToCJS,exports.transpileTSToCJSSync=x.transpileTSToCJSSync,exports.v=t.v,exports.x=t.x;
@@ -1 +0,0 @@
1
- import{getEnvFilePath as e,loadEnvFile as t}from"./loadEnvFile.mjs";import{ANSIColors as n,clock as r,colon as i,colorize as a,colorizeKey as o,colorizeLocales as s,colorizeNumber as c,colorizePath as l,getAppLogger as u,getPrefix as d,logger as f,removeColor as p,setPrefix as m,spinnerFrames as h,v as g,x as _}from"./logger.mjs";import{cacheMemory as v,clearAllCache as y,clearCache as b,computeKeyId as x,getCache as S,setCache as C,stableStringify as w}from"./utils/cacheMemory.mjs";import{getPackageJsonPath as T}from"./utils/getPackageJsonPath.mjs";import{getExtension as E}from"./utils/getExtension.mjs";import{normalizePath as D}from"./utils/normalizePath.mjs";import{getAlias as O}from"./utils/alias.mjs";import{cacheDisk as k}from"./utils/cacheDisk.mjs";import{configESMxCJSRequire as A,getProjectRequire as j,isESModule as M}from"./utils/ESMxCJSHelpers.mjs";import{clearModuleCache as N}from"./utils/clearModuleCache.mjs";import{compareVersions as P}from"./utils/compareVersions.mjs";import{extractErrorMessage as F}from"./utils/extractErrorMessage.mjs";import{logStack as I}from"./utils/logStack.mjs";import{retryManager as L}from"./utils/retryManager.mjs";import{camelCaseToKebabCase as R}from"./utils/stringFormatter/camelCaseToKebabCase.mjs";import{camelCaseToSentence as z}from"./utils/stringFormatter/camelCaseToSentence.mjs";import{kebabCaseToCamelCase as B}from"./utils/stringFormatter/kebabCaseToCamelCase.mjs";import{toLowerCamelCase as V}from"./utils/stringFormatter/toLowerCamelCase.mjs";import{buildConfigurationFields as H}from"./configFile/buildConfigurationFields.mjs";import{getSandBoxContext as U,parseFileContent as W}from"./loadExternalFile/parseFileContent.mjs";import{bundleFile as G,bundleFileSync as K,getLoader as q}from"./loadExternalFile/bundleFile.mjs";import{transpileTSToCJS as J,transpileTSToCJSSync as Y}from"./loadExternalFile/transpileTSToCJS.mjs";import{loadExternalFile as X,loadExternalFileSync as Z}from"./loadExternalFile/loadExternalFile.mjs";import{configurationFilesCandidates as Q,searchConfigurationFile as $}from"./configFile/searchConfigurationFile.mjs";import{getConfiguration as ee,getConfigurationAndFilePath as te}from"./configFile/getConfiguration.mjs";import{defaultValues_exports as ne}from"./defaultValues/index.mjs";import{bundleJSFile as re}from"./loadExternalFile/bundleJSFile.mjs";export{n as ANSIColors,ne as DefaultValues,H as buildConfigurationFields,G as bundleFile,K as bundleFileSync,re as bundleJSFile,k as cacheDisk,v as cacheMemory,R as camelCaseToKebabCase,z as camelCaseToSentence,y as clearAllCache,b as clearCache,N as clearModuleCache,r as clock,i as colon,a as colorize,o as colorizeKey,s as colorizeLocales,c as colorizeNumber,l as colorizePath,P as compareVersions,x as computeKeyId,A as configESMxCJSRequire,Q as configurationFilesCandidates,F as extractErrorMessage,O as getAlias,u as getAppLogger,S as getCache,ee as getConfiguration,te as getConfigurationAndFilePath,e as getEnvFilePath,E as getExtension,q as getLoader,T as getPackageJsonPath,d as getPrefix,j as getProjectRequire,U as getSandBoxContext,M as isESModule,B as kebabCaseToCamelCase,t as loadEnvFile,X as loadExternalFile,Z as loadExternalFileSync,I as logStack,f as logger,D as normalizePath,W as parseFileContent,p as removeColor,L as retryManager,$ as searchConfigurationFile,C as setCache,m as setPrefix,h as spinnerFrames,w as stableStringify,V as toLowerCamelCase,J as transpileTSToCJS,Y as transpileTSToCJSSync,g as v,_ as x};
@@ -1,28 +0,0 @@
1
- import { index_d_exports } from "./defaultValues/index.js";
2
- import { ANSIColors, Details, Logger, clock, colon, colorize, colorizeKey, colorizeLocales, colorizeNumber, colorizePath, getAppLogger, getPrefix, logger, removeColor, setPrefix, spinnerFrames, v, x } from "./logger.js";
3
- import { extractErrorMessage } from "./utils/extractErrorMessage.js";
4
- import { logStack } from "./utils/logStack.js";
5
- import { normalizePath } from "./utils/normalizePath.js";
6
- import { camelCaseToKebabCase } from "./utils/stringFormatter/camelCaseToKebabCase.js";
7
- import { camelCaseToSentence } from "./utils/stringFormatter/camelCaseToSentence.js";
8
- import { kebabCaseToCamelCase } from "./utils/stringFormatter/kebabCaseToCamelCase.js";
9
- import { toLowerCamelCase } from "./utils/stringFormatter/toLowerCamelCase.js";
10
- import { buildConfigurationFields } from "./configFile/buildConfigurationFields.js";
11
- import { LoadEnvFileOptions, getEnvFilePath, loadEnvFile } from "./loadEnvFile.js";
12
- import { SandBoxContextOptions, getSandBoxContext, parseFileContent } from "./loadExternalFile/parseFileContent.js";
13
- import { GetConfigurationAndFilePathResult, GetConfigurationOptions, getConfiguration, getConfigurationAndFilePath } from "./configFile/getConfiguration.js";
14
- import { configurationFilesCandidates, searchConfigurationFile } from "./configFile/searchConfigurationFile.js";
15
- import { LoadExternalFileOptions, loadExternalFile, loadExternalFileSync } from "./loadExternalFile/loadExternalFile.js";
16
- import { ESBuildPlugin, bundleFile, bundleFileSync, getLoader } from "./loadExternalFile/bundleFile.js";
17
- import { bundleJSFile } from "./loadExternalFile/bundleJSFile.js";
18
- import { transpileTSToCJS, transpileTSToCJSSync } from "./loadExternalFile/transpileTSToCJS.js";
19
- import { GetAliasOptions, getAlias } from "./utils/alias.js";
20
- import { CacheKey, cacheMemory, clearAllCache, clearCache, computeKeyId, getCache, setCache, stableStringify } from "./utils/cacheMemory.js";
21
- import { cacheDisk } from "./utils/cacheDisk.js";
22
- import { clearModuleCache } from "./utils/clearModuleCache.js";
23
- import { compareVersions } from "./utils/compareVersions.js";
24
- import { configESMxCJSRequire, getProjectRequire, isESModule } from "./utils/ESMxCJSHelpers.js";
25
- import { getExtension } from "./utils/getExtension.js";
26
- import { getPackageJsonPath } from "./utils/getPackageJsonPath.js";
27
- import { RetryManagerOptions, retryManager } from "./utils/retryManager.js";
28
- export { ANSIColors, CacheKey, index_d_exports as DefaultValues, Details, ESBuildPlugin, GetAliasOptions, GetConfigurationAndFilePathResult, GetConfigurationOptions, LoadEnvFileOptions, LoadExternalFileOptions, Logger, RetryManagerOptions, SandBoxContextOptions, buildConfigurationFields, bundleFile, bundleFileSync, bundleJSFile, cacheDisk, cacheMemory, camelCaseToKebabCase, camelCaseToSentence, clearAllCache, clearCache, clearModuleCache, clock, colon, colorize, colorizeKey, colorizeLocales, colorizeNumber, colorizePath, compareVersions, computeKeyId, configESMxCJSRequire, configurationFilesCandidates, extractErrorMessage, getAlias, getAppLogger, getCache, getConfiguration, getConfigurationAndFilePath, getEnvFilePath, getExtension, getLoader, getPackageJsonPath, getPrefix, getProjectRequire, getSandBoxContext, isESModule, kebabCaseToCamelCase, loadEnvFile, loadExternalFile, loadExternalFileSync, logStack, logger, normalizePath, parseFileContent, removeColor, retryManager, searchConfigurationFile, setCache, setPrefix, spinnerFrames, stableStringify, toLowerCamelCase, transpileTSToCJS, transpileTSToCJSSync, v, x };