@intlayer/config 8.0.2 → 8.0.5-canary.0

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 (102) hide show
  1. package/dist/cjs/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +3 -3
  2. package/dist/cjs/alias.cjs +4 -3
  3. package/dist/cjs/alias.cjs.map +1 -1
  4. package/dist/cjs/built.cjs +1 -2
  5. package/dist/cjs/built.cjs.map +1 -1
  6. package/dist/cjs/bundleJSFile.cjs +2 -1
  7. package/dist/cjs/bundleJSFile.cjs.map +1 -1
  8. package/dist/cjs/client.cjs +1 -0
  9. package/dist/cjs/configFile/buildConfigurationFields.cjs +5 -3
  10. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  11. package/dist/cjs/configFile/getConfiguration.cjs +2 -1
  12. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  13. package/dist/cjs/configFile/index.cjs +1 -0
  14. package/dist/cjs/configFile/loadConfigurationFile.cjs +1 -0
  15. package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
  16. package/dist/cjs/configFile/searchConfigurationFile.cjs +2 -1
  17. package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
  18. package/dist/cjs/defaultValues/build.cjs +4 -3
  19. package/dist/cjs/defaultValues/build.cjs.map +1 -1
  20. package/dist/cjs/defaultValues/compiler.cjs +1 -0
  21. package/dist/cjs/defaultValues/compiler.cjs.map +1 -1
  22. package/dist/cjs/defaultValues/content.cjs +3 -2
  23. package/dist/cjs/defaultValues/content.cjs.map +1 -1
  24. package/dist/cjs/defaultValues/dictionary.cjs +3 -2
  25. package/dist/cjs/defaultValues/dictionary.cjs.map +1 -1
  26. package/dist/cjs/defaultValues/editor.cjs +3 -2
  27. package/dist/cjs/defaultValues/editor.cjs.map +1 -1
  28. package/dist/cjs/defaultValues/index.cjs +3 -2
  29. package/dist/cjs/defaultValues/internationalization.cjs +3 -2
  30. package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
  31. package/dist/cjs/defaultValues/log.cjs +3 -2
  32. package/dist/cjs/defaultValues/log.cjs.map +1 -1
  33. package/dist/cjs/defaultValues/routing.cjs +3 -2
  34. package/dist/cjs/defaultValues/routing.cjs.map +1 -1
  35. package/dist/cjs/defaultValues/system.cjs +3 -2
  36. package/dist/cjs/defaultValues/system.cjs.map +1 -1
  37. package/dist/cjs/index.cjs +1 -0
  38. package/dist/cjs/loadEnvFile.cjs +3 -2
  39. package/dist/cjs/loadEnvFile.cjs.map +1 -1
  40. package/dist/cjs/loadExternalFile/bundleFile.cjs +2 -1
  41. package/dist/cjs/loadExternalFile/bundleFile.cjs.map +1 -1
  42. package/dist/cjs/loadExternalFile/loadExternalFile.cjs +3 -2
  43. package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -1
  44. package/dist/cjs/loadExternalFile/parseFileContent.cjs +3 -2
  45. package/dist/cjs/loadExternalFile/parseFileContent.cjs.map +1 -1
  46. package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs +2 -1
  47. package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs.map +1 -1
  48. package/dist/cjs/logger.cjs +1 -0
  49. package/dist/cjs/logger.cjs.map +1 -1
  50. package/dist/cjs/retryManager.cjs +1 -0
  51. package/dist/cjs/retryManager.cjs.map +1 -1
  52. package/dist/cjs/utils/ESMxCJSHelpers.cjs +2 -1
  53. package/dist/cjs/utils/ESMxCJSHelpers.cjs.map +1 -1
  54. package/dist/cjs/utils/cacheDisk.cjs +3 -2
  55. package/dist/cjs/utils/cacheDisk.cjs.map +1 -1
  56. package/dist/cjs/utils/cacheMemory.cjs +2 -1
  57. package/dist/cjs/utils/cacheMemory.cjs.map +1 -1
  58. package/dist/cjs/utils/clearModuleCache.cjs +1 -0
  59. package/dist/cjs/utils/clearModuleCache.cjs.map +1 -1
  60. package/dist/cjs/utils/compareVersions.cjs +1 -0
  61. package/dist/cjs/utils/compareVersions.cjs.map +1 -1
  62. package/dist/cjs/utils/extractErrorMessage.cjs +1 -0
  63. package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
  64. package/dist/cjs/utils/getExtension.cjs +1 -0
  65. package/dist/cjs/utils/getExtension.cjs.map +1 -1
  66. package/dist/cjs/utils/getPackageJsonPath.cjs +2 -1
  67. package/dist/cjs/utils/getPackageJsonPath.cjs.map +1 -1
  68. package/dist/cjs/utils/logStack.cjs +1 -0
  69. package/dist/cjs/utils/logStack.cjs.map +1 -1
  70. package/dist/cjs/utils/normalizePath.cjs +1 -0
  71. package/dist/cjs/utils/normalizePath.cjs.map +1 -1
  72. package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs +1 -0
  73. package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs.map +1 -1
  74. package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs +1 -0
  75. package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs.map +1 -1
  76. package/dist/cjs/utils/stringFormatter/index.cjs +1 -0
  77. package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs +1 -0
  78. package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs.map +1 -1
  79. package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs +1 -0
  80. package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs.map +1 -1
  81. package/dist/esm/_virtual/{rolldown_runtime.mjs → _rolldown/runtime.mjs} +3 -3
  82. package/dist/esm/alias.mjs +2 -2
  83. package/dist/esm/alias.mjs.map +1 -1
  84. package/dist/esm/built.mjs +1 -2
  85. package/dist/esm/built.mjs.map +1 -1
  86. package/dist/esm/configFile/buildConfigurationFields.mjs +3 -2
  87. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  88. package/dist/esm/defaultValues/build.mjs +2 -2
  89. package/dist/esm/defaultValues/build.mjs.map +1 -1
  90. package/dist/esm/defaultValues/content.mjs +1 -1
  91. package/dist/esm/defaultValues/dictionary.mjs +1 -1
  92. package/dist/esm/defaultValues/editor.mjs +1 -1
  93. package/dist/esm/defaultValues/index.mjs +1 -1
  94. package/dist/esm/defaultValues/internationalization.mjs +1 -1
  95. package/dist/esm/defaultValues/log.mjs +1 -1
  96. package/dist/esm/defaultValues/routing.mjs +1 -1
  97. package/dist/esm/defaultValues/system.mjs +1 -1
  98. package/dist/esm/utils/ESMxCJSHelpers.mjs +1 -1
  99. package/dist/types/bundleJSFile.d.ts +13 -13
  100. package/dist/types/bundleJSFile.d.ts.map +1 -1
  101. package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
  102. package/package.json +7 -7
@@ -1,7 +1,8 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
3
  let node_fs = require("node:fs");
3
4
  let dotenv = require("dotenv");
4
- dotenv = require_rolldown_runtime.__toESM(dotenv);
5
+ dotenv = require_runtime.__toESM(dotenv);
5
6
 
6
7
  //#region src/loadEnvFile.ts
7
8
  const DEFAULT_ENV = process.env.NODE_ENV ?? "development";
@@ -1 +1 @@
1
- {"version":3,"file":"loadEnvFile.cjs","names":["existsSync"],"sources":["../../src/loadEnvFile.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport dotenv from 'dotenv';\n\nconst DEFAULT_ENV = process.env.NODE_ENV ?? 'development';\n\nexport type LoadEnvFileOptions = {\n env?: string;\n envFile?: string;\n};\n\nexport const getEnvFilePath = (\n env: string = process.env.NODE_ENV ?? 'development',\n envFile?: string\n): string | undefined => {\n const envFiles = envFile\n ? [envFile]\n : [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env'];\n\n return envFiles.find(existsSync); // Returns the first existing env file\n};\n\nexport const loadEnvFile = (options?: Partial<LoadEnvFileOptions>) => {\n const env = options?.env ?? DEFAULT_ENV;\n\n const envFiles = options?.envFile\n ? [options.envFile]\n : [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env'];\n\n const result = {};\n\n dotenv.config({\n path: envFiles,\n processEnv: result,\n quiet: true,\n });\n\n return result; // Return the parsed env object\n};\n"],"mappings":";;;;;;AAGA,MAAM,cAAc,QAAQ,IAAI,YAAY;AAO5C,MAAa,kBACX,MAAc,QAAQ,IAAI,YAAY,eACtC,YACuB;AAKvB,SAJiB,UACb,CAAC,QAAQ,GACT;EAAC,QAAQ,IAAI;EAAS,QAAQ;EAAO;EAAc;EAAO,EAE9C,KAAKA,mBAAW;;AAGlC,MAAa,eAAe,YAA0C;CACpE,MAAM,MAAM,SAAS,OAAO;CAE5B,MAAM,WAAW,SAAS,UACtB,CAAC,QAAQ,QAAQ,GACjB;EAAC,QAAQ,IAAI;EAAS,QAAQ;EAAO;EAAc;EAAO;CAE9D,MAAM,SAAS,EAAE;AAEjB,gBAAO,OAAO;EACZ,MAAM;EACN,YAAY;EACZ,OAAO;EACR,CAAC;AAEF,QAAO"}
1
+ {"version":3,"file":"loadEnvFile.cjs","names":["existsSync"],"sources":["../../src/loadEnvFile.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport dotenv from 'dotenv';\n\nconst DEFAULT_ENV = process.env.NODE_ENV ?? 'development';\n\nexport type LoadEnvFileOptions = {\n env?: string;\n envFile?: string;\n};\n\nexport const getEnvFilePath = (\n env: string = process.env.NODE_ENV ?? 'development',\n envFile?: string\n): string | undefined => {\n const envFiles = envFile\n ? [envFile]\n : [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env'];\n\n return envFiles.find(existsSync); // Returns the first existing env file\n};\n\nexport const loadEnvFile = (options?: Partial<LoadEnvFileOptions>) => {\n const env = options?.env ?? DEFAULT_ENV;\n\n const envFiles = options?.envFile\n ? [options.envFile]\n : [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env'];\n\n const result = {};\n\n dotenv.config({\n path: envFiles,\n processEnv: result,\n quiet: true,\n });\n\n return result; // Return the parsed env object\n};\n"],"mappings":";;;;;;;AAGA,MAAM,cAAc,QAAQ,IAAI,YAAY;AAO5C,MAAa,kBACX,MAAc,QAAQ,IAAI,YAAY,eACtC,YACuB;AAKvB,SAJiB,UACb,CAAC,QAAQ,GACT;EAAC,QAAQ,IAAI;EAAS,QAAQ;EAAO;EAAc;EAAO,EAE9C,KAAKA,mBAAW;;AAGlC,MAAa,eAAe,YAA0C;CACpE,MAAM,MAAM,SAAS,OAAO;CAE5B,MAAM,WAAW,SAAS,UACtB,CAAC,QAAQ,QAAQ,GACjB;EAAC,QAAQ,IAAI;EAAS,QAAQ;EAAO;EAAc;EAAO;CAE9D,MAAM,SAAS,EAAE;AAEjB,gBAAO,OAAO;EACZ,MAAM;EACN,YAAY;EACZ,OAAO;EACR,CAAC;AAEF,QAAO"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  let node_path = require("node:path");
3
4
  let esbuild = require("esbuild");
4
5
  let node_url = require("node:url");
@@ -1 +1 @@
1
- {"version":3,"file":"bundleFile.cjs","names":[],"sources":["../../../src/loadExternalFile/bundleFile.ts"],"sourcesContent":["import { dirname, extname } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport {\n type BuildOptions,\n type BuildResult,\n build,\n buildSync,\n type Loader,\n type Plugin,\n} from 'esbuild';\n\nexport type ESBuildPlugin = Plugin;\n\nexport const getLoader = (extension: string): Loader => {\n switch (extension) {\n case '.js':\n return 'js';\n case '.jsx':\n return 'jsx';\n case '.mjs':\n return 'js';\n case '.ts':\n return 'ts';\n case '.tsx':\n return 'tsx';\n case '.cjs':\n return 'js';\n case '.json':\n return 'json';\n case '.md':\n return 'text';\n case '.mdx':\n return 'text';\n default:\n return 'js';\n }\n};\n\nconst getTransformationOptions = (filePath: string): BuildOptions => ({\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n '.md': 'text',\n '.mdx': 'text',\n },\n format: 'cjs',\n target: 'node16',\n platform: 'neutral',\n write: false,\n packages: 'bundle',\n external: ['esbuild'],\n bundle: true,\n define: {\n 'import.meta.url': JSON.stringify(pathToFileURL(filePath).href),\n },\n});\n\nexport const bundleFileSync = (\n code: string,\n filePath: string,\n options?: BuildOptions\n): string | undefined => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const moduleResult: BuildResult = buildSync({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...options,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n\nexport const bundleFile = async (\n code: string,\n filePath: string,\n options?: BuildOptions\n): Promise<string | undefined> => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const moduleResult: BuildResult = await build({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...options,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n"],"mappings":";;;;;;AAaA,MAAa,aAAa,cAA8B;AACtD,SAAQ,WAAR;EACE,KAAK,MACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAM,4BAA4B,cAAoC;CACpE,QAAQ;EACN,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,OAAO;EACP,QAAQ;EACT;CACD,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,OAAO;CACP,UAAU;CACV,UAAU,CAAC,UAAU;CACrB,QAAQ;CACR,QAAQ,EACN,mBAAmB,KAAK,sCAAwB,SAAS,CAAC,KAAK,EAChE;CACF;AAED,MAAa,kBACX,MACA,UACA,YACuB;AAiBvB,+BAb4C;EAC1C,OAAO;GACL,UAAU;GACV,QALW,iCADW,SAAS,CACA;GAM/B,mCAAoB,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,CAEsC,cAAc,GAAG;;AAK3D,MAAa,aAAa,OACxB,MACA,UACA,YACgC;AAiBhC,SAbkC,yBAAY;EAC5C,OAAO;GACL,UAAU;GACV,QALW,iCADW,SAAS,CACA;GAM/B,mCAAoB,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,EAEsC,cAAc,GAAG"}
1
+ {"version":3,"file":"bundleFile.cjs","names":[],"sources":["../../../src/loadExternalFile/bundleFile.ts"],"sourcesContent":["import { dirname, extname } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport {\n type BuildOptions,\n type BuildResult,\n build,\n buildSync,\n type Loader,\n type Plugin,\n} from 'esbuild';\n\nexport type ESBuildPlugin = Plugin;\n\nexport const getLoader = (extension: string): Loader => {\n switch (extension) {\n case '.js':\n return 'js';\n case '.jsx':\n return 'jsx';\n case '.mjs':\n return 'js';\n case '.ts':\n return 'ts';\n case '.tsx':\n return 'tsx';\n case '.cjs':\n return 'js';\n case '.json':\n return 'json';\n case '.md':\n return 'text';\n case '.mdx':\n return 'text';\n default:\n return 'js';\n }\n};\n\nconst getTransformationOptions = (filePath: string): BuildOptions => ({\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n '.md': 'text',\n '.mdx': 'text',\n },\n format: 'cjs',\n target: 'node16',\n platform: 'neutral',\n write: false,\n packages: 'bundle',\n external: ['esbuild'],\n bundle: true,\n define: {\n 'import.meta.url': JSON.stringify(pathToFileURL(filePath).href),\n },\n});\n\nexport const bundleFileSync = (\n code: string,\n filePath: string,\n options?: BuildOptions\n): string | undefined => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const moduleResult: BuildResult = buildSync({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...options,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n\nexport const bundleFile = async (\n code: string,\n filePath: string,\n options?: BuildOptions\n): Promise<string | undefined> => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const moduleResult: BuildResult = await build({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...options,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n"],"mappings":";;;;;;;AAaA,MAAa,aAAa,cAA8B;AACtD,SAAQ,WAAR;EACE,KAAK,MACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAM,4BAA4B,cAAoC;CACpE,QAAQ;EACN,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,OAAO;EACP,QAAQ;EACT;CACD,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,OAAO;CACP,UAAU;CACV,UAAU,CAAC,UAAU;CACrB,QAAQ;CACR,QAAQ,EACN,mBAAmB,KAAK,sCAAwB,SAAS,CAAC,KAAK,EAChE;CACF;AAED,MAAa,kBACX,MACA,UACA,YACuB;AAiBvB,+BAb4C;EAC1C,OAAO;GACL,UAAU;GACV,QALW,iCADW,SAAS,CACA;GAM/B,mCAAoB,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,CAEsC,cAAc,GAAG;;AAK3D,MAAa,aAAa,OACxB,MACA,UACA,YACgC;AAiBhC,SAbkC,yBAAY;EAC5C,OAAO;GACL,UAAU;GACV,QALW,iCADW,SAAS,CACA;GAM/B,mCAAoB,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,EAEsC,cAAc,GAAG"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  const require_logger = require('../logger.cjs');
3
4
  const require_loadExternalFile_parseFileContent = require('./parseFileContent.cjs');
4
5
  const require_loadExternalFile_transpileTSToCJS = require('./transpileTSToCJS.cjs');
@@ -6,7 +7,7 @@ let node_path = require("node:path");
6
7
  let node_fs = require("node:fs");
7
8
  let node_fs_promises = require("node:fs/promises");
8
9
  let json5 = require("json5");
9
- json5 = require_rolldown_runtime.__toESM(json5);
10
+ json5 = require_runtime.__toESM(json5);
10
11
 
11
12
  //#region src/loadExternalFile/loadExternalFile.ts
12
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"loadExternalFile.cjs","names":["JSON5","transpileTSToCJSSync","parseFileContent","transpileTSToCJS","colorizePath"],"sources":["../../../src/loadExternalFile/loadExternalFile.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { extname } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport type { BuildOptions, Plugin } from 'esbuild';\nimport JSON5 from 'json5';\nimport { colorizePath, logger } from '../logger';\nimport {\n parseFileContent,\n type SandBoxContextOptions,\n} from './parseFileContent';\nimport { transpileTSToCJS, transpileTSToCJSSync } from './transpileTSToCJS';\n\nexport type ESBuildPlugin = Plugin;\n\nexport type LoadExternalFileOptions = {\n configuration?: IntlayerConfig;\n buildOptions?: BuildOptions;\n} & SandBoxContextOptions;\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFileSync = (\n filePath: string,\n options?: LoadExternalFileOptions\n): any | undefined => {\n const fileExtension = extname(filePath) || '.json';\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Assume JSON\n return JSON5.parse(readFileSync(filePath, 'utf-8'));\n }\n\n // Rest is JS, MJS or TS\n const code = readFileSync(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = transpileTSToCJSSync(\n code,\n filePath\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${filePath}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n};\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFile = async (\n filePath: string,\n options?: LoadExternalFileOptions\n): Promise<any | undefined> => {\n const fileExtension = extname(filePath);\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Remove cache to force getting fresh content\n const fileContent = await readFile(filePath, 'utf-8');\n return JSON5.parse(fileContent);\n }\n\n // Rest is JS, MJS or TS\n const code = await readFile(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = await transpileTSToCJS(\n code,\n filePath,\n options?.buildOptions\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${colorizePath(filePath)}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAa,wBACX,UACA,YACoB;CACpB,MAAM,uCAAwB,SAAS,IAAI;AAE3C,KAAI;AACF,MACE,kBAAkB,WAClB,kBAAkB,YAClB,kBAAkB,SAGlB,QAAOA,cAAM,gCAAmB,UAAU,QAAQ,CAAC;EAMrD,MAAM,qBAAyCC,yFAFrB,UAAU,QAAQ,EAI1C,SACD;AAED,MAAI,CAAC,oBAAoB;AACvB,yBAAO,6BAA6B,EAAE,OAAO,SAAS,CAAC;AACvD;;EAGF,MAAM,cAAcC,2DAAiB,oBAAoB;GACvD,gBAAgB,SAAS;GACzB,eAAe,SAAS;GACxB,mBAAmB,SAAS;GAC5B,OAAO,SAAS;GAChB,SAAS,SAAS;GACnB,CAAC;AAEF,MAAI,OAAO,gBAAgB,aAAa;AACtC,yBAAO,oCAAoC,WAAW;AACtD;;AAGF,SAAO;UACA,OAAO;AACd,wBACE,CACE,UAAW,MAAgB,QAAQ,MACnC,KAAK,UAAW,MAAgB,OAAO,MAAM,EAAE,CAChD,EACD,EACE,OAAO,SACR,CACF;;;;;;;;AASL,MAAa,mBAAmB,OAC9B,UACA,YAC6B;CAC7B,MAAM,uCAAwB,SAAS;AAEvC,KAAI;AACF,MACE,kBAAkB,WAClB,kBAAkB,YAClB,kBAAkB,UAClB;GAEA,MAAM,cAAc,qCAAe,UAAU,QAAQ;AACrD,UAAOF,cAAM,MAAM,YAAY;;EAMjC,MAAM,qBAAyC,MAAMG,2DAFxC,qCAAe,UAAU,QAAQ,EAI5C,UACA,SAAS,aACV;AAED,MAAI,CAAC,oBAAoB;AACvB,yBAAO,6BAA6B,EAAE,OAAO,SAAS,CAAC;AACvD;;EAGF,MAAM,cAAcD,2DAAiB,oBAAoB;GACvD,gBAAgB,SAAS;GACzB,eAAe,SAAS;GACxB,mBAAmB,SAAS;GAC5B,OAAO,SAAS;GAChB,SAAS,SAAS;GACnB,CAAC;AAEF,MAAI,OAAO,gBAAgB,aAAa;AACtC,yBAAO,oCAAoCE,4BAAa,SAAS,GAAG;AACpE;;AAGF,SAAO;UACA,OAAO;AACd,wBACE,CACE,UAAW,MAAgB,QAAQ,MACnC,KAAK,UAAW,MAAgB,OAAO,MAAM,EAAE,CAChD,EACD,EACE,OAAO,SACR,CACF"}
1
+ {"version":3,"file":"loadExternalFile.cjs","names":["JSON5","transpileTSToCJSSync","parseFileContent","transpileTSToCJS","colorizePath"],"sources":["../../../src/loadExternalFile/loadExternalFile.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { extname } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport type { BuildOptions, Plugin } from 'esbuild';\nimport JSON5 from 'json5';\nimport { colorizePath, logger } from '../logger';\nimport {\n parseFileContent,\n type SandBoxContextOptions,\n} from './parseFileContent';\nimport { transpileTSToCJS, transpileTSToCJSSync } from './transpileTSToCJS';\n\nexport type ESBuildPlugin = Plugin;\n\nexport type LoadExternalFileOptions = {\n configuration?: IntlayerConfig;\n buildOptions?: BuildOptions;\n} & SandBoxContextOptions;\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFileSync = (\n filePath: string,\n options?: LoadExternalFileOptions\n): any | undefined => {\n const fileExtension = extname(filePath) || '.json';\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Assume JSON\n return JSON5.parse(readFileSync(filePath, 'utf-8'));\n }\n\n // Rest is JS, MJS or TS\n const code = readFileSync(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = transpileTSToCJSSync(\n code,\n filePath\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${filePath}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n};\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFile = async (\n filePath: string,\n options?: LoadExternalFileOptions\n): Promise<any | undefined> => {\n const fileExtension = extname(filePath);\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Remove cache to force getting fresh content\n const fileContent = await readFile(filePath, 'utf-8');\n return JSON5.parse(fileContent);\n }\n\n // Rest is JS, MJS or TS\n const code = await readFile(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = await transpileTSToCJS(\n code,\n filePath,\n options?.buildOptions\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${colorizePath(filePath)}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,MAAa,wBACX,UACA,YACoB;CACpB,MAAM,uCAAwB,SAAS,IAAI;AAE3C,KAAI;AACF,MACE,kBAAkB,WAClB,kBAAkB,YAClB,kBAAkB,SAGlB,QAAOA,cAAM,gCAAmB,UAAU,QAAQ,CAAC;EAMrD,MAAM,qBAAyCC,yFAFrB,UAAU,QAAQ,EAI1C,SACD;AAED,MAAI,CAAC,oBAAoB;AACvB,yBAAO,6BAA6B,EAAE,OAAO,SAAS,CAAC;AACvD;;EAGF,MAAM,cAAcC,2DAAiB,oBAAoB;GACvD,gBAAgB,SAAS;GACzB,eAAe,SAAS;GACxB,mBAAmB,SAAS;GAC5B,OAAO,SAAS;GAChB,SAAS,SAAS;GACnB,CAAC;AAEF,MAAI,OAAO,gBAAgB,aAAa;AACtC,yBAAO,oCAAoC,WAAW;AACtD;;AAGF,SAAO;UACA,OAAO;AACd,wBACE,CACE,UAAW,MAAgB,QAAQ,MACnC,KAAK,UAAW,MAAgB,OAAO,MAAM,EAAE,CAChD,EACD,EACE,OAAO,SACR,CACF;;;;;;;;AASL,MAAa,mBAAmB,OAC9B,UACA,YAC6B;CAC7B,MAAM,uCAAwB,SAAS;AAEvC,KAAI;AACF,MACE,kBAAkB,WAClB,kBAAkB,YAClB,kBAAkB,UAClB;GAEA,MAAM,cAAc,qCAAe,UAAU,QAAQ;AACrD,UAAOF,cAAM,MAAM,YAAY;;EAMjC,MAAM,qBAAyC,MAAMG,2DAFxC,qCAAe,UAAU,QAAQ,EAI5C,UACA,SAAS,aACV;AAED,MAAI,CAAC,oBAAoB;AACvB,yBAAO,6BAA6B,EAAE,OAAO,SAAS,CAAC;AACvD;;EAGF,MAAM,cAAcD,2DAAiB,oBAAoB;GACvD,gBAAgB,SAAS;GACzB,eAAe,SAAS;GACxB,mBAAmB,SAAS;GAC5B,OAAO,SAAS;GAChB,SAAS,SAAS;GACnB,CAAC;AAEF,MAAI,OAAO,gBAAgB,aAAa;AACtC,yBAAO,oCAAoCE,4BAAa,SAAS,GAAG;AACpE;;AAGF,SAAO;UACA,OAAO;AACd,wBACE,CACE,UAAW,MAAgB,QAAQ,MACnC,KAAK,UAAW,MAAgB,OAAO,MAAM,EAAE,CAChD,EACD,EACE,OAAO,SACR,CACF"}
@@ -1,9 +1,10 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  const require_loadEnvFile = require('../loadEnvFile.cjs');
3
4
  const require_utils_ESMxCJSHelpers = require('../utils/ESMxCJSHelpers.cjs');
4
5
  let node_vm = require("node:vm");
5
6
  let esbuild = require("esbuild");
6
- esbuild = require_rolldown_runtime.__toESM(esbuild);
7
+ esbuild = require_runtime.__toESM(esbuild);
7
8
 
8
9
  //#region src/loadExternalFile/parseFileContent.ts
9
10
  const getSandBoxContext = (options) => {
@@ -1 +1 @@
1
- {"version":3,"file":"parseFileContent.cjs","names":["getProjectRequire","loadEnvFile"],"sources":["../../../src/loadExternalFile/parseFileContent.ts"],"sourcesContent":["import { type Context, runInNewContext } from 'node:vm';\nimport * as esbuild from 'esbuild';\nimport { type LoadEnvFileOptions, loadEnvFile } from '../loadEnvFile';\nimport { getProjectRequire } from '../utils/ESMxCJSHelpers';\n\nexport type SandBoxContextOptions = {\n envVarOptions?: LoadEnvFileOptions;\n projectRequire?: NodeJS.Require;\n additionalEnvVars?: Record<string, string>;\n /**\n * Map of specifier -> mocked export to be returned when code in the VM calls require(specifier).\n * Example:\n * mocks: {\n * '@intlayer/config/built': { getConfig: () => ({}), Locales: {} }\n * }\n */\n mocks?: Record<string, any>;\n /**\n * Optional alias map if you want to redirect specifiers.\n * Useful when user code imports a subpath you want to collapse.\n * Example:\n * aliases: { '@intlayer/config/built': '@intlayer/config' }\n */\n aliases?: Record<string, string>;\n};\n\nexport const getSandBoxContext = (options?: SandBoxContextOptions): Context => {\n const { envVarOptions, projectRequire, additionalEnvVars, mocks, aliases } =\n options ?? {};\n\n let additionalGlobalVar = {};\n\n const baseRequire: NodeJS.Require =\n typeof projectRequire === 'function' ? projectRequire : getProjectRequire();\n\n // Wrap require to honor mocks and aliases inside the VM\n const mockedRequire: NodeJS.Require = (() => {\n const mockTable = Object.assign(\n {\n esbuild,\n },\n mocks\n );\n const aliasTable = Object.assign({}, aliases);\n\n const wrappedRequire = function mockableRequire(id: string) {\n const target = aliasTable?.[id] ? aliasTable[id] : id;\n\n if (mockTable && Object.hasOwn(mockTable, target)) {\n return mockTable[target];\n }\n\n // If the original id was aliased, allow mocks to be defined on either key.\n if (target !== id && mockTable && Object.hasOwn(mockTable, id)) {\n return mockTable[id];\n }\n\n return baseRequire(target);\n } as NodeJS.Require;\n\n // Mirror NodeJS.Require properties\n wrappedRequire.resolve = baseRequire.resolve.bind(baseRequire);\n wrappedRequire.main = baseRequire.main;\n wrappedRequire.extensions = baseRequire.extensions;\n wrappedRequire.cache = baseRequire.cache;\n\n return wrappedRequire;\n })();\n\n try {\n // Dynamically try to require React if it's installed in the project\n additionalGlobalVar = {\n React: baseRequire('react'),\n };\n } catch (_err) {\n // React is not installed, so we inject a dummy React object to capture JSX elements\n // This allows using JSX in content declarations even if React is not installed (e.g. in Solid.js or Vue projects)\n // because esbuild's tsx loader defaults to React.createElement.\n additionalGlobalVar = {\n React: {\n createElement: (type: any, props: any, ...children: any[]) => ({\n type,\n props: {\n ...props,\n children: children.length <= 1 ? children[0] : children,\n },\n }),\n Fragment: Symbol.for('react.fragment'),\n },\n };\n }\n\n const sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n process: {\n ...process,\n env: {\n ...process.env,\n ...loadEnvFile(envVarOptions),\n ...additionalEnvVars,\n },\n },\n console,\n require: mockedRequire,\n ...additionalGlobalVar,\n };\n\n // Dynamically inject all global variables\n Object.getOwnPropertyNames(globalThis).forEach((key) => {\n if (!(key in sandboxContext)) {\n sandboxContext[key] = globalThis[key as keyof typeof globalThis];\n }\n });\n\n return sandboxContext;\n};\n\nexport const parseFileContent = <T>(\n fileContentString: string,\n options?: SandBoxContextOptions\n): T | undefined => {\n const sandboxContext = getSandBoxContext(options);\n\n // Force strict mode so illegal writes throw instead of silently failing.\n runInNewContext(`\"use strict\";\\n${fileContentString}`, sandboxContext);\n\n const candidates: unknown[] = [\n sandboxContext.exports?.default,\n sandboxContext.module?.exports?.defaults,\n sandboxContext.module?.exports?.default,\n sandboxContext.module?.exports,\n ];\n\n for (const candidate of candidates) {\n if (\n candidate &&\n typeof candidate === 'object' &&\n Object.keys(candidate as object).length > 0\n ) {\n return candidate as T;\n }\n }\n};\n"],"mappings":";;;;;;;;AA0BA,MAAa,qBAAqB,YAA6C;CAC7E,MAAM,EAAE,eAAe,gBAAgB,mBAAmB,OAAO,YAC/D,WAAW,EAAE;CAEf,IAAI,sBAAsB,EAAE;CAE5B,MAAM,cACJ,OAAO,mBAAmB,aAAa,iBAAiBA,gDAAmB;CAG7E,MAAM,uBAAuC;EAC3C,MAAM,YAAY,OAAO,OACvB,EACE,SACD,EACD,MACD;EACD,MAAM,aAAa,OAAO,OAAO,EAAE,EAAE,QAAQ;EAE7C,MAAM,iBAAiB,SAAS,gBAAgB,IAAY;GAC1D,MAAM,SAAS,aAAa,MAAM,WAAW,MAAM;AAEnD,OAAI,aAAa,O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cjs","names":["getProjectRequire","loadEnvFile"],"sources":["../../../src/loadExternalFile/parseFileContent.ts"],"sourcesContent":["import { type Context, runInNewContext } from 'node:vm';\nimport * as esbuild from 'esbuild';\nimport { type LoadEnvFileOptions, loadEnvFile } from '../loadEnvFile';\nimport { getProjectRequire } from '../utils/ESMxCJSHelpers';\n\nexport type SandBoxContextOptions = {\n envVarOptions?: LoadEnvFileOptions;\n projectRequire?: NodeJS.Require;\n additionalEnvVars?: Record<string, string>;\n /**\n * Map of specifier -> mocked export to be returned when code in the VM calls require(specifier).\n * Example:\n * mocks: {\n * '@intlayer/config/built': { getConfig: () => ({}), Locales: {} }\n * }\n */\n mocks?: Record<string, any>;\n /**\n * Optional alias map if you want to redirect specifiers.\n * Useful when user code imports a subpath you want to collapse.\n * Example:\n * aliases: { '@intlayer/config/built': '@intlayer/config' }\n */\n aliases?: Record<string, string>;\n};\n\nexport const getSandBoxContext = (options?: SandBoxContextOptions): Context => {\n const { envVarOptions, projectRequire, additionalEnvVars, mocks, aliases } =\n options ?? {};\n\n let additionalGlobalVar = {};\n\n const baseRequire: NodeJS.Require =\n typeof projectRequire === 'function' ? projectRequire : getProjectRequire();\n\n // Wrap require to honor mocks and aliases inside the VM\n const mockedRequire: NodeJS.Require = (() => {\n const mockTable = Object.assign(\n {\n esbuild,\n },\n mocks\n );\n const aliasTable = Object.assign({}, aliases);\n\n const wrappedRequire = function mockableRequire(id: string) {\n const target = aliasTable?.[id] ? aliasTable[id] : id;\n\n if (mockTable && Object.hasOwn(mockTable, target)) {\n return mockTable[target];\n }\n\n // If the original id was aliased, allow mocks to be defined on either key.\n if (target !== id && mockTable && Object.hasOwn(mockTable, id)) {\n return mockTable[id];\n }\n\n return baseRequire(target);\n } as NodeJS.Require;\n\n // Mirror NodeJS.Require properties\n wrappedRequire.resolve = baseRequire.resolve.bind(baseRequire);\n wrappedRequire.main = baseRequire.main;\n wrappedRequire.extensions = baseRequire.extensions;\n wrappedRequire.cache = baseRequire.cache;\n\n return wrappedRequire;\n })();\n\n try {\n // Dynamically try to require React if it's installed in the project\n additionalGlobalVar = {\n React: baseRequire('react'),\n };\n } catch (_err) {\n // React is not installed, so we inject a dummy React object to capture JSX elements\n // This allows using JSX in content declarations even if React is not installed (e.g. in Solid.js or Vue projects)\n // because esbuild's tsx loader defaults to React.createElement.\n additionalGlobalVar = {\n React: {\n createElement: (type: any, props: any, ...children: any[]) => ({\n type,\n props: {\n ...props,\n children: children.length <= 1 ? children[0] : children,\n },\n }),\n Fragment: Symbol.for('react.fragment'),\n },\n };\n }\n\n const sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n process: {\n ...process,\n env: {\n ...process.env,\n ...loadEnvFile(envVarOptions),\n ...additionalEnvVars,\n },\n },\n console,\n require: mockedRequire,\n ...additionalGlobalVar,\n };\n\n // Dynamically inject all global variables\n Object.getOwnPropertyNames(globalThis).forEach((key) => {\n if (!(key in sandboxContext)) {\n sandboxContext[key] = globalThis[key as keyof typeof globalThis];\n }\n });\n\n return sandboxContext;\n};\n\nexport const parseFileContent = <T>(\n fileContentString: string,\n options?: SandBoxContextOptions\n): T | undefined => {\n const sandboxContext = getSandBoxContext(options);\n\n // Force strict mode so illegal writes throw instead of silently failing.\n runInNewContext(`\"use strict\";\\n${fileContentString}`, sandboxContext);\n\n const candidates: unknown[] = [\n sandboxContext.exports?.default,\n sandboxContext.module?.exports?.defaults,\n sandboxContext.module?.exports?.default,\n sandboxContext.module?.exports,\n ];\n\n for (const candidate of candidates) {\n if (\n candidate &&\n typeof candidate === 'object' &&\n Object.keys(candidate as object).length > 0\n ) {\n return candidate as T;\n }\n }\n};\n"],"mappings":";;;;;;;;;AA0BA,MAAa,qBAAqB,YAA6C;CAC7E,MAAM,EAAE,eAAe,gBAAgB,mBAAmB,OAAO,YAC/D,WAAW,EAAE;CAEf,IAAI,sBAAsB,EAAE;CAE5B,MAAM,cACJ,OAAO,mBAAmB,aAAa,iBAAiBA,gDAAmB;CAG7E,MAAM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Ae,SAAS;EACxB,eAAe,QAAQ,SAAS;EAChC,eAAe,QAAQ,SAAS;EAChC,eAAe,QAAQ;EACxB;AAED,MAAK,MAAM,aAAa,WACtB,KACE,aACA,OAAO,cAAc,YACrB,OAAO,KAAK,UAAoB,CAAC,SAAS,EAE1C,QAAO"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  const require_utils_getPackageJsonPath = require('../utils/getPackageJsonPath.cjs');
3
4
  const require_loadExternalFile_bundleFile = require('./bundleFile.cjs');
4
5
  let node_path = require("node:path");
@@ -1 +1 @@
1
- {"version":3,"file":"transpileTSToCJS.cjs","names":["getPackageJsonPath","getLoader"],"sources":["../../../src/loadExternalFile/transpileTSToCJS.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, extname, join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport {\n type BuildOptions,\n type BuildResult,\n build,\n buildSync,\n type Plugin,\n} from 'esbuild';\nimport { getPackageJsonPath } from '..';\nimport { getLoader } from './bundleFile';\n\nexport type ESBuildPlugin = Plugin;\n\nconst getTsConfigPath = (filePath: string): string | undefined => {\n const tsconfigPath = join(\n getPackageJsonPath(dirname(filePath)).baseDir,\n 'tsconfig.json'\n );\n\n // Only return the tsconfig path if it exists\n return existsSync(tsconfigPath) ? tsconfigPath : undefined;\n};\n\nconst getTransformationOptions = (filePath: string): BuildOptions => ({\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n '.md': 'text',\n '.mdx': 'text',\n },\n format: 'cjs',\n target: 'node20',\n platform: 'node',\n write: false,\n packages: 'external',\n bundle: true,\n tsconfig: getTsConfigPath(filePath),\n define: {\n 'import.meta.url': JSON.stringify(pathToFileURL(filePath).href),\n },\n});\n\nexport const transpileTSToCJSSync = (\n code: string,\n filePath: string,\n options?: BuildOptions\n): string | undefined => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const moduleResult: BuildResult = buildSync({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...options,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n\nexport const transpileTSToCJS = async (\n code: string,\n filePath: string,\n options?: BuildOptions\n): Promise<string | undefined> => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const moduleResult: BuildResult = await build({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...options,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n"],"mappings":";;;;;;;;;AAeA,MAAM,mBAAmB,aAAyC;CAChE,MAAM,mCACJA,2EAA2B,SAAS,CAAC,CAAC,SACtC,gBACD;AAGD,gCAAkB,aAAa,GAAG,eAAe;;AAGnD,MAAM,4BAA4B,cAAoC;CACpE,QAAQ;EACN,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,OAAO;EACP,QAAQ;EACT;CACD,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,OAAO;CACP,UAAU;CACV,QAAQ;CACR,UAAU,gBAAgB,SAAS;CACnC,QAAQ,EACN,mBAAmB,KAAK,sCAAwB,SAAS,CAAC,KAAK,EAChE;CACF;AAED,MAAa,wBACX,MACA,UACA,YACuB;AAiBvB,+BAb4C;EAC1C,OAAO;GACL,UAAU;GACV,QALWC,qEADW,SAAS,CACA;GAM/B,mCAAoB,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,CAEsC,cAAc,GAAG;;AAK3D,MAAa,mBAAmB,OAC9B,MACA,UACA,YACgC;AAiBhC,SAbkC,yBAAY;EAC5C,OAAO;GACL,UAAU;GACV,QALWA,qEADW,SAAS,CACA;GAM/B,mCAAoB,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,EAEsC,cAAc,GAAG"}
1
+ {"version":3,"file":"transpileTSToCJS.cjs","names":["getPackageJsonPath","getLoader"],"sources":["../../../src/loadExternalFile/transpileTSToCJS.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, extname, join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport {\n type BuildOptions,\n type BuildResult,\n build,\n buildSync,\n type Plugin,\n} from 'esbuild';\nimport { getPackageJsonPath } from '..';\nimport { getLoader } from './bundleFile';\n\nexport type ESBuildPlugin = Plugin;\n\nconst getTsConfigPath = (filePath: string): string | undefined => {\n const tsconfigPath = join(\n getPackageJsonPath(dirname(filePath)).baseDir,\n 'tsconfig.json'\n );\n\n // Only return the tsconfig path if it exists\n return existsSync(tsconfigPath) ? tsconfigPath : undefined;\n};\n\nconst getTransformationOptions = (filePath: string): BuildOptions => ({\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n '.md': 'text',\n '.mdx': 'text',\n },\n format: 'cjs',\n target: 'node20',\n platform: 'node',\n write: false,\n packages: 'external',\n bundle: true,\n tsconfig: getTsConfigPath(filePath),\n define: {\n 'import.meta.url': JSON.stringify(pathToFileURL(filePath).href),\n },\n});\n\nexport const transpileTSToCJSSync = (\n code: string,\n filePath: string,\n options?: BuildOptions\n): string | undefined => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const moduleResult: BuildResult = buildSync({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...options,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n\nexport const transpileTSToCJS = async (\n code: string,\n filePath: string,\n options?: BuildOptions\n): Promise<string | undefined> => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const moduleResult: BuildResult = await build({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...options,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n"],"mappings":";;;;;;;;;;AAeA,MAAM,mBAAmB,aAAyC;CAChE,MAAM,mCACJA,2EAA2B,SAAS,CAAC,CAAC,SACtC,gBACD;AAGD,gCAAkB,aAAa,GAAG,eAAe;;AAGnD,MAAM,4BAA4B,cAAoC;CACpE,QAAQ;EACN,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,OAAO;EACP,QAAQ;EACT;CACD,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,OAAO;CACP,UAAU;CACV,QAAQ;CACR,UAAU,gBAAgB,SAAS;CACnC,QAAQ,EACN,mBAAmB,KAAK,sCAAwB,SAAS,CAAC,KAAK,EAChE;CACF;AAED,MAAa,wBACX,MACA,UACA,YACuB;AAiBvB,+BAb4C;EAC1C,OAAO;GACL,UAAU;GACV,QALWC,qEADW,SAAS,CACA;GAM/B,mCAAoB,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,CAEsC,cAAc,GAAG;;AAK3D,MAAa,mBAAmB,OAC9B,MACA,UACA,YACgC;AAiBhC,SAbkC,yBAAY;EAC5C,OAAO;GACL,UAAU;GACV,QALWA,qEADW,SAAS,CACA;GAM/B,mCAAoB,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,EAEsC,cAAc,GAAG"}
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region src/logger.ts
3
4
  let loggerPrefix;
@@ -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":";;AAUA,IAAI;AAEJ,MAAa,aAAa,WAA+B;AACvD,gBAAe;;AAGjB,MAAa,aAAa,iBAA8C;AACtE,KAAI,OAAO,iBAAiB,YAC1B,QAAO;AAGT,QAAO;;AAGT,MAAa,UAAkB,SAAS,YAAY;CAClD,MAAM,YAAY,SAAS,aAAa;CACxC,MAAM,OAAO,SAAS,QAAQ,QAAQ;CACtC,MAAM,QAAQ,SAAS,SAAS;CAChC,MAAM,SAAS,UAAU,SAAS,QAAQ,OAAO;CACjD,MAAM,MAAM,SAAS,QAAQ,OAAO,QAAQ;CAC5C,MAAM,OAAO,SAAS,QAAQ,QAAQ,QAAQ;CAC9C,MAAM,OAAO,SAAS,QAAQ,QAAQ,QAAQ;CAC9C,MAAM,QAAQ,SAAS,QAAQ,SAAS,QAAQ;CAChD,MAAM,QAAQ,SAAS,QAAQ,SAAS,QAAQ;AAEhD,KAAI,SAAS,WAAY;AAEzB,KAAI,aAAa,SAAS,UAAW;CAErC,MAAM,cAAc,SAAS,CAAC,QAAQ,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM;AAE7E,KAAI,UAAU,QACZ,QAAO,MAAM,GAAG,YAAY;AAG9B,KAAI,UAAU,OACZ,QAAO,KAAK,GAAG,YAAY;AAG7B,KAAI,UAAU,OACZ,QAAO,KAAK,GAAG,YAAY;AAG7B,KAAI,UAAU,QACZ,QAAO,MAAM,GAAG,YAAY;AAG9B,KAAI,GAAG,YAAY;;AAGrB,IAAY,kDAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGF,MAAa,gBAAgB;CAAC;CAAK;CAAK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mB,GAAG;AAErC,MAAM,aAAa,WAA0D;CAC3E,IAAI,QAAgB;AACpB,KAAI,OAAO,WAAW,SACpB,SAAQ;AAEV,KAAI,OAAO,WAAW,SACpB,SAAQ,OAAO;AAEjB,KAAI,MAAM,QAAQ,OAAO,IAAI,OAAO,OAAO,MAAM,OAAO,MAAM,SAAS,CACrE,SAAQ,KAAK,IAAI,GAAG,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC;AAEtD,KAAI,MAAM,QAAQ,OAAO,IAAI,OAAO,OAAO,MAAM,OAAO,MAAM,SAAS,CACrE,SAAQ,KAAK,IAAI,GAAG,OAAO;AAE7B,QAAO,KAAK,IAAI,OAAO,EAAE;;AAG3B,MAAM,sBAAsB;CAC1B,SAAS;CACT,SAAS;CACT,SAAS;CACT,KAAK;CACL,SAAS;CACV;;;;;;;AAQD,MAAa,SACX,MACA,YAQA,CAAC,KAAK,CACH,MAAM,CACN,KAAK,SAAS;CACb,MAAM,EAAE,SAAS,SAAS,SAAS,KAAK,YAAY;EAClD,GAAG;EACH,GAAI,WAAW,EAAE;EAClB;CAED,MAAM,SAAS,UAAU,QAAQ;CACjC,MAAM,eAAe,KAAK,IACxB,SACA,KAAK,IAAI,SAAU,SAAS,YAAY,KAAK,CAAC,OAAO,CACtD;AAED,KAAI,QAAQ,OACV,QAAO,GAAG,IAAI,OAAO,aAAa,GAAG;AAGvC,QAAO,GAAG,OAAO,IAAI,OAAO,aAAa;EACzC,CACD,KAAK,GAAG;AAEb,MAAa,IAAI,SAAS,KAAK,WAAW,IAAI;AAC9C,MAAa,IAAI,SAAS,KAAK,WAAW,MAAM;AAChD,MAAa,QAAQ,SAAS,KAAK,WAAW,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);\nexport const clock = colorize('⏲', ANSIColors.BLUE);\n"],"mappings":";;;AAUA,IAAI;AAEJ,MAAa,aAAa,WAA+B;AACvD,gBAAe;;AAGjB,MAAa,aAAa,iBAA8C;AACtE,KAAI,OAAO,iBAAiB,YAC1B,QAAO;AAGT,QAAO;;AAGT,MAAa,UAAkB,SAAS,YAAY;CAClD,MAAM,YAAY,SAAS,aAAa;CACxC,MAAM,OAAO,SAAS,QAAQ,QAAQ;CACtC,MAAM,QAAQ,SAAS,SAAS;CAChC,MAAM,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B,SAAS;CACT,SAAS;CACT,SAAS;CACT,KAAK;CACL,SAAS;CACV;;;;;;;AAQD,MAAa,SACX,MACA,YAQA,CAAC,KAAK,CACH,MAAM,CACN,KAAK,SAAS;CACb,MAAM,EAAE,SAAS,SAAS,SAAS,KAAK,YAAY;EAClD,GAAG;EACH,GAAI,WAAW,EAAE;EAClB;CAED,MAAM,SAAS,UAAU,QAAQ;CACjC,MAAM,eAAe,KAAK,IACxB,SACA,KAAK,IAAI,SAAU,SAAS,YAAY,KAAK,CAAC,OAAO,CACtD;AAED,KAAI,QAAQ,OACV,QAAO,GAAG,IAAI,OAAO,aAAa,GAAG;AAGvC,QAAO,GAAG,OAAO,IAAI,OAAO,aAAa;EACzC,CACD,KAAK,GAAG;AAEb,MAAa,IAAI,SAAS,KAAK,WAAW,IAAI;AAC9C,MAAa,IAAI,SAAS,KAAK,WAAW,MAAM;AAChD,MAAa,QAAQ,SAAS,KAAK,WAAW,KAAK"}
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
  const require_logger = require('./logger.cjs');
2
3
  const require_utils_extractErrorMessage = require('./utils/extractErrorMessage.cjs');
3
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"retryManager.cjs","names":["extractErrorMessage"],"sources":["../../src/retryManager.ts"],"sourcesContent":["import { logger } from './logger';\nimport { extractErrorMessage } from './utils/extractErrorMessage';\n\nexport type RetryManagerOptions = {\n /** maximum number of retries before giving up */\n maxRetry?: number;\n /** delay between attempts, in milliseconds */\n delay?: number;\n /** function to call when an error occurs */\n onError?: (details: {\n error: string;\n attempt: number;\n maxRetry: number;\n }) => void;\n /** function to call when the maximum number of retries is reached */\n onMaxTryReached?: (details: {\n error: string;\n attempt: number;\n maxRetry: number;\n }) => void;\n};\n\nconst DEFAULT_MAX_RETRY = 3;\nconst DEFAULT_DELAY = 0;\n\n/**\n * Wrap an async function `fn` so it’s retried on failure.\n *\n * @param fn The async function to wrap\n * @param options { maxRetry, delay }\n * @returns A new function with the same signature as `fn`\n */\nexport const retryManager =\n <Args extends any[], R>(\n fn: (...args: Args) => Promise<R>,\n {\n maxRetry = DEFAULT_MAX_RETRY,\n delay = DEFAULT_DELAY,\n onError,\n onMaxTryReached,\n }: RetryManagerOptions = {}\n ): ((...args: Args) => Promise<R>) =>\n // ───────────────────────────────^ returned wrapper function\n async (...args: Args): Promise<R> => {\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= maxRetry; attempt++) {\n try {\n return await fn(...args);\n } catch (err) {\n lastError = err;\n const error = extractErrorMessage(err);\n\n // If this was the last attempt, handle max retry reached\n if (attempt >= maxRetry) {\n if (onMaxTryReached) {\n onMaxTryReached?.({ error, attempt, maxRetry });\n return null as R;\n }\n\n // Otherwise, throw the error\n throw err;\n }\n\n if (onError) {\n onError?.({ error, attempt, maxRetry });\n } else {\n logger(error, {\n level: 'error',\n });\n }\n\n // Wait before retrying\n if (delay > 0) {\n await new Promise((res) => setTimeout(res, delay));\n }\n }\n }\n\n // This should never be reached, but TypeScript needs it\n throw (\n lastError ?? new Error('Unexpected: retry loop completed without result')\n );\n };\n"],"mappings":";;;;AAsBA,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;;;;;;;;AAStB,MAAa,gBAET,IACA,EACE,WAAW,mBACX,QAAQ,eACR,SACA,oBACuB,EAAE,KAG7B,OAAO,GAAG,SAA2B;CACnC,IAAI;AAEJ,MAAK,IAAI,UAAU,GAAG,WAAW,UAAU,UACzC,KAAI;AACF,SAAO,MAAM,GAAG,GAAG,KAAK;UACjB,KAAK;AACZ,cAAY;EACZ,MAAM,QAAQA,sDAAoB,IAAI;AAGtC,MAAI,WAAW,UAAU;AACvB,OAAI,iBAAiB;AACnB,sBAAkB;KAAE;KAAO;KAAS;KAAU,CAAC;AAC/C,WAAO;;AAIT,SAAM;;AAGR,MAAI,QACF,WAAU;GAAE;GAAO;GAAS;GAAU,CAAC;MAEvC,uBAAO,OAAO,EACZ,OAAO,SACR,CAAC;AAIJ,MAAI,QAAQ,EACV,OAAM,IAAI,SAAS,QAAQ,WAAW,KAAK,MAAM,CAAC;;AAMxD,OACE,6BAAa,IAAI,MAAM,kDAAkD"}
1
+ {"version":3,"file":"retryManager.cjs","names":["extractErrorMessage"],"sources":["../../src/retryManager.ts"],"sourcesContent":["import { logger } from './logger';\nimport { extractErrorMessage } from './utils/extractErrorMessage';\n\nexport type RetryManagerOptions = {\n /** maximum number of retries before giving up */\n maxRetry?: number;\n /** delay between attempts, in milliseconds */\n delay?: number;\n /** function to call when an error occurs */\n onError?: (details: {\n error: string;\n attempt: number;\n maxRetry: number;\n }) => void;\n /** function to call when the maximum number of retries is reached */\n onMaxTryReached?: (details: {\n error: string;\n attempt: number;\n maxRetry: number;\n }) => void;\n};\n\nconst DEFAULT_MAX_RETRY = 3;\nconst DEFAULT_DELAY = 0;\n\n/**\n * Wrap an async function `fn` so it’s retried on failure.\n *\n * @param fn The async function to wrap\n * @param options { maxRetry, delay }\n * @returns A new function with the same signature as `fn`\n */\nexport const retryManager =\n <Args extends any[], R>(\n fn: (...args: Args) => Promise<R>,\n {\n maxRetry = DEFAULT_MAX_RETRY,\n delay = DEFAULT_DELAY,\n onError,\n onMaxTryReached,\n }: RetryManagerOptions = {}\n ): ((...args: Args) => Promise<R>) =>\n // ───────────────────────────────^ returned wrapper function\n async (...args: Args): Promise<R> => {\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= maxRetry; attempt++) {\n try {\n return await fn(...args);\n } catch (err) {\n lastError = err;\n const error = extractErrorMessage(err);\n\n // If this was the last attempt, handle max retry reached\n if (attempt >= maxRetry) {\n if (onMaxTryReached) {\n onMaxTryReached?.({ error, attempt, maxRetry });\n return null as R;\n }\n\n // Otherwise, throw the error\n throw err;\n }\n\n if (onError) {\n onError?.({ error, attempt, maxRetry });\n } else {\n logger(error, {\n level: 'error',\n });\n }\n\n // Wait before retrying\n if (delay > 0) {\n await new Promise((res) => setTimeout(res, delay));\n }\n }\n }\n\n // This should never be reached, but TypeScript needs it\n throw (\n lastError ?? new Error('Unexpected: retry loop completed without result')\n );\n };\n"],"mappings":";;;;;AAsBA,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;;;;;;;;AAStB,MAAa,gBAET,IACA,EACE,WAAW,mBACX,QAAQ,eACR,SACA,oBACuB,EAAE,KAG7B,OAAO,GAAG,SAA2B;CACnC,IAAI;AAEJ,MAAK,IAAI,UAAU,GAAG,WAAW,UAAU,UACzC,KAAI;AACF,SAAO,MAAM,GAAG,GAAG,KAAK;UACjB,KAAK;AACZ,cAAY;EACZ,MAAM,QAAQA,sDAAoB,IAAI;AAGtC,MAAI,WAAW,UAAU;AACvB,OAAI,iBAAiB;AACnB,sBAAkB;KAAE;KAAO;KAAS;KAAU,CAAC;AAC/C,WAAO;;AAIT,SAAM;;AAGR,MAAI,QACF,WAAU;GAAE;GAAO;GAAS;GAAU,CAAC;MAEvC,uBAAO,OAAO,EACZ,OAAO,SACR,CAAC;AAIJ,MAAI,QAAQ,EACV,OAAM,IAAI,SAAS,QAAQ,WAAW,KAAK,MAAM,CAAC;;AAMxD,OACE,6BAAa,IAAI,MAAM,kDAAkD"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  const require_utils_getPackageJsonPath = require('./getPackageJsonPath.cjs');
3
4
  let node_module = require("node:module");
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"ESMxCJSHelpers.cjs","names":["getPackageJsonPath"],"sources":["../../../src/utils/ESMxCJSHelpers.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { getPackageJsonPath } from './getPackageJsonPath';\n\nexport const isESModule = typeof import.meta.url === 'string';\n\n/**\n * Require relative to the user project\n *\n * Note: Can resolve package that are installed in the user project, ex `'intlayer'`\n */\nexport const getProjectRequire = (startDir?: string): NodeJS.Require => {\n // Can fail on VSCode extensions\n const { packageJsonPath } = getPackageJsonPath(startDir);\n\n return createRequire(packageJsonPath);\n};\n\n/**\n * Require relative to the @intlayer/config package\n *\n * Note: Can resolve package that are installed in the config package, ex `'@intlayer/types'`\n */\nexport const configESMxCJSRequire: NodeJS.Require = isESModule\n ? createRequire(import.meta.url)\n : require;\n"],"mappings":";;;;;AAGA,MAAa,aAAa,yDAA2B;;;;;;AAOrD,MAAa,qBAAqB,aAAsC;CAEtE,MAAM,EAAE,oBAAoBA,oDAAmB,SAAS;AAExD,uCAAqB,gBAAgB;;;;;;;AAQvC,MAAa,uBAAuC,0FAClB,GAC9B"}
1
+ {"version":3,"file":"ESMxCJSHelpers.cjs","names":["getPackageJsonPath"],"sources":["../../../src/utils/ESMxCJSHelpers.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { getPackageJsonPath } from './getPackageJsonPath';\n\nexport const isESModule = typeof import.meta.url === 'string';\n\n/**\n * Require relative to the user project\n *\n * Note: Can resolve package that are installed in the user project, ex `'intlayer'`\n */\nexport const getProjectRequire = (startDir?: string): NodeJS.Require => {\n // Can fail on VSCode extensions\n const { packageJsonPath } = getPackageJsonPath(startDir);\n\n return createRequire(packageJsonPath);\n};\n\n/**\n * Require relative to the @intlayer/config package\n *\n * Note: Can resolve package that are installed in the config package, ex `'@intlayer/types'`\n */\nexport const configESMxCJSRequire: NodeJS.Require = isESModule\n ? createRequire(import.meta.url)\n : require;\n"],"mappings":";;;;;;AAGA,MAAa,aAAa,yDAA2B;;;;;;AAOrD,MAAa,qBAAqB,aAAsC;CAEtE,MAAM,EAAE,oBAAoBA,oDAAmB,SAAS;AAExD,uCAAqB,gBAAgB;;;;;;;AAQvC,MAAa,uBAAuC,0FAClB,GAC9B"}
@@ -1,8 +1,9 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  const require_utils_cacheMemory = require('./cacheMemory.cjs');
3
4
  let node_path = require("node:path");
4
5
  let _intlayer_types_package_json = require("@intlayer/types/package.json");
5
- _intlayer_types_package_json = require_rolldown_runtime.__toESM(_intlayer_types_package_json);
6
+ _intlayer_types_package_json = require_runtime.__toESM(_intlayer_types_package_json);
6
7
  let node_fs_promises = require("node:fs/promises");
7
8
  let node_v8 = require("node:v8");
8
9
  let node_zlib = require("node:zlib");
@@ -1 +1 @@
1
- {"version":3,"file":"cacheDisk.cjs","names":["computeKeyId","configPackageJson"],"sources":["../../../src/utils/cacheDisk.ts"],"sourcesContent":["import {\n mkdir,\n readFile,\n rename,\n rm,\n stat,\n unlink,\n writeFile,\n} from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { deserialize, serialize } from 'node:v8';\nimport { gunzipSync, gzipSync } from 'node:zlib';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport configPackageJson from '@intlayer/types/package.json' with {\n type: 'json',\n};\nimport { type CacheKey, clearAllCache, computeKeyId } from './cacheMemory';\n\n/** ------------------------- Persistence layer ------------------------- **/\n\n/** Cache envelope structure stored on disk */\ntype CacheEnvelope = {\n /** Version of the config package (for cache invalidation) */\n version: string;\n /** Timestamp when the cache entry was created (in milliseconds) */\n timestamp: number;\n /** Data payload (the actual cached value) */\n data: unknown;\n};\n\ntype LocalCacheOptions = {\n /** Preferred new option name */\n persistent?: boolean;\n /** Time-to-live in ms; if expired, disk entry is ignored. */\n ttlMs?: number;\n /** Max age in ms based on stored creation timestamp; invalidates on exceed. */\n maxTimeMs?: number;\n /** Optional namespace to separate different logical caches. */\n namespace?: string;\n /** Gzip values on disk (on by default for blobs > 1KB). */\n compress?: boolean;\n};\n\nconst DEFAULTS: Required<Pick<LocalCacheOptions, 'compress'>> = {\n compress: true,\n};\n\nconst ensureDir = async (dir: string) => {\n await mkdir(dir, { recursive: true });\n};\n\nconst atomicWriteFile = async (file: string, data: Buffer) => {\n const tmp = `${file}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`;\n await writeFile(tmp, data);\n await rename(tmp, file);\n};\n\nconst shouldUseCompression = (buf: Buffer, force?: boolean) =>\n force === true || (force !== false && buf.byteLength > 1024);\n\n/** Derive on-disk path from config dir + namespace + key id. */\nconst cachePath = (cacheDir: string, id: string, ns?: string) =>\n join(cacheDir, ns ? join(ns, id) : id);\n\n/** ------------------------- Local cache facade ------------------------- **/\n\nconst cacheMap = new Map<string, any>();\n\nexport const cacheDisk = (\n intlayerConfig: IntlayerConfig,\n keys: CacheKey[],\n options?: LocalCacheOptions\n) => {\n const { cacheDir } = intlayerConfig.system;\n const buildCacheEnabled = intlayerConfig.build.cache ?? true;\n const persistent =\n options?.persistent === true ||\n (typeof options?.persistent === 'undefined' && buildCacheEnabled);\n\n const { compress, ttlMs, maxTimeMs, namespace } = {\n ...DEFAULTS,\n ...options,\n };\n\n // single stable id for this key tuple (works for both memory & disk)\n const id = computeKeyId(keys);\n const filePath = cachePath(cacheDir, id, namespace);\n\n const readFromDisk = async (): Promise<unknown | undefined> => {\n try {\n const statValue = await stat(filePath).catch(() => undefined);\n\n if (!statValue) return undefined;\n\n if (typeof ttlMs === 'number' && ttlMs > 0) {\n const age = Date.now() - statValue.mtimeMs;\n if (age > ttlMs) return undefined;\n }\n let raw = await readFile(filePath);\n // header: 1 byte flag (0x00 raw, 0x01 gzip)\n const flag = raw[0];\n\n raw = raw.subarray(1);\n\n const payload = flag === 0x01 ? gunzipSync(raw) : raw;\n const deserialized = deserialize(payload) as unknown;\n\n let value: unknown;\n const maybeObj = deserialized as Record<string, unknown> | null;\n const isEnvelope =\n !!maybeObj &&\n typeof maybeObj === 'object' &&\n typeof (maybeObj as any).version === 'string' &&\n typeof (maybeObj as any).timestamp === 'number' &&\n Object.hasOwn(maybeObj, 'data');\n\n if (isEnvelope) {\n const entry = maybeObj as CacheEnvelope;\n\n if (entry.version !== configPackageJson.version) {\n try {\n await unlink(filePath);\n } catch {}\n return undefined;\n }\n\n if (typeof maxTimeMs === 'number' && maxTimeMs > 0) {\n const age = Date.now() - entry.timestamp;\n if (age > maxTimeMs) {\n try {\n await unlink(filePath);\n } catch {}\n return undefined;\n }\n }\n\n value = entry.data;\n } else {\n // Backward compatibility: old entries had raw serialized value.\n if (typeof maxTimeMs === 'number' && maxTimeMs > 0) {\n const age = Date.now() - statValue.mtimeMs;\n if (age > maxTimeMs) {\n try {\n await unlink(filePath);\n } catch {}\n return undefined;\n }\n }\n value = deserialized;\n }\n\n // hydrate memory cache as well\n cacheMap.set(id, value);\n return value;\n } catch {\n return undefined;\n }\n };\n\n const writeToDisk = async (value: unknown) => {\n try {\n await ensureDir(dirname(filePath));\n const envelope: CacheEnvelope = {\n version: configPackageJson.version,\n timestamp: Date.now(),\n data: value,\n };\n const payload = Buffer.from(serialize(envelope));\n\n const gz = shouldUseCompression(payload, compress)\n ? gzipSync(payload)\n : payload;\n\n // prepend a 1-byte header indicating compression\n const buf = Buffer.concat([\n Buffer.from([gz === payload ? 0x00 : 0x01]),\n gz,\n ]);\n\n await atomicWriteFile(filePath, buf);\n } catch {\n // swallow disk errors for cache writes\n }\n };\n\n return {\n /** In-memory first, then disk (if enabled), otherwise undefined. */\n get: async <T>(): Promise<T | undefined> => {\n const mem = cacheMap.get(id);\n\n if (mem !== undefined) return mem as T;\n\n if (persistent && buildCacheEnabled) {\n return (await readFromDisk()) as T | undefined;\n }\n return undefined;\n },\n /** Sets in-memory (always) and persists to disk if enabled. */\n set: async (value: unknown): Promise<void> => {\n cacheMap.set(id, value);\n\n if (persistent && buildCacheEnabled) {\n await writeToDisk(value);\n }\n },\n /** Clears only this entry from memory and disk. */\n clear: async (): Promise<void> => {\n cacheMap.delete(id);\n\n try {\n await unlink(filePath);\n } catch {}\n },\n /** Clears ALL cached entries (memory Map and entire cacheDir namespace if persistent). */\n clearAll: async (): Promise<void> => {\n clearAllCache();\n if (persistent && buildCacheEnabled) {\n // remove only the current namespace (if provided), else the root dir\n const base = namespace ? join(cacheDir, namespace) : cacheDir;\n\n try {\n await rm(base, { recursive: true, force: true });\n } catch {}\n\n try {\n await mkdir(base, { recursive: true });\n } catch {}\n }\n },\n /** Expose the computed id (useful if you want to key other structures). */\n isValid: async (): Promise<boolean> => {\n const cachedValue = cacheMap.get(id);\n if (cachedValue !== undefined) return true;\n\n // If persistence is disabled or build cache disabled, only memory can be valid\n if (!persistent || !buildCacheEnabled) return false;\n\n try {\n const statValue = await stat(filePath).catch(() => undefined);\n if (!statValue) return false;\n\n if (typeof ttlMs === 'number' && ttlMs > 0) {\n const age = Date.now() - statValue.mtimeMs;\n if (age > ttlMs) return false;\n }\n\n let raw = await readFile(filePath);\n const flag = raw[0];\n raw = raw.subarray(1);\n const payload = flag === 0x01 ? gunzipSync(raw) : raw;\n const deserialized = deserialize(payload) as unknown;\n\n const maybeObj = deserialized as Record<string, unknown> | null;\n const isEnvelope =\n !!maybeObj &&\n typeof maybeObj === 'object' &&\n typeof maybeObj.version === 'string' &&\n typeof maybeObj.timestamp === 'number' &&\n Object.hasOwn(maybeObj, 'data');\n\n if (isEnvelope) {\n const entry = maybeObj as CacheEnvelope;\n if (entry.version !== configPackageJson.version) return false;\n\n if (typeof maxTimeMs === 'number' && maxTimeMs > 0) {\n const age = Date.now() - entry.timestamp;\n if (age > maxTimeMs) return false;\n }\n return true;\n }\n\n if (typeof maxTimeMs === 'number' && maxTimeMs > 0) {\n const age = Date.now() - statValue.mtimeMs;\n if (age > maxTimeMs) return false;\n }\n return true;\n } catch {\n return false;\n }\n },\n /** Expose the computed id (useful if you want to key other structures). */\n id,\n /** Expose the absolute file path for debugging. */\n filePath,\n };\n};\n"],"mappings":";;;;;;;;;;AA2CA,MAAM,WAA0D,EAC9D,UAAU,MACX;AAED,MAAM,YAAY,OAAO,QAAgB;AACvC,mCAAY,KAAK,EAAE,WAAW,MAAM,CAAC;;AAGvC,MAAM,kBAAkB,OAAO,MAAc,SAAiB;CAC5D,MAAM,MAAM,GAAG,KAAK,OAAO,QAAQ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CAAC;YAC1C;AAER,QAAI;AACF,uCAAY,MAAM,EAAE,WAAW,MAAM,CAAC;YAChC;;;EAIZ,SAAS,YAA8B;AAErC,OADoB,SAAS,IAAI,GAAG,KAChB,OAAW,QAAO;AAGtC,OAAI,CAAC,cAAc,CAAC,kBAAmB,QAAO;AAE9C,OAAI;IACF,MAAM,YAAY,iCAAW,SAAS,CAAC,YAAY,OAAU;AAC7D,QAAI,CAAC,UAAW,QAAO;AAEvB,QAAI,OAAO,UAAU,YAAY,QAAQ,GAEvC;SADY,KAAK,KAAK,GAAG,UAAU,UACzB,MAAO,QAAO;;IAG1B,IAAI,MAAM,qCAAe,SAAS;IAClC,MAAM,OAAO,IAAI;AACjB,UAAM,IAAI,SAAS,EAAE;IAIrB,MAAM,oCAHU,SAAS,8BAAkB,IAAI,GAAG,IACT;AAUzC,QANE,CAAC,CAAC,YACF,OAAO,aAAa,YACpB,OAAO,SAAS,YAAY,YAC5B,OAAO,SAAS,cAAc,YAC9B,OAAO,OAAO,UAAU,OAAO,EAEjB;KACd,MAAM,QAAQ;AACd,SAAI,MAAM,YAAYA,qCAAkB,QAAS,QAAO;AAExD,SAAI,OAAO,cAAc,YAAY,YAAY,GAE/C;UADY,KAAK,KAAK,GAAG,MAAM,YACrB,UAAW,QAAO;;AAE9B,YAAO;;AAGT,QAAI,OAAO,cAAc,YAAY,YAAY,GAE/C;SADY,KAAK,KAAK,GAAG,UAAU,UACzB,UAAW,QAAO;;AAE9B,WAAO;WACD;AACN,WAAO;;;EAIX;EAEA;EACD"}
1
+ {"version":3,"file":"cacheDisk.cjs","names":["computeKeyId","configPackageJson"],"sources":["../../../src/utils/cacheDisk.ts"],"sourcesContent":["import {\n mkdir,\n readFile,\n rename,\n rm,\n stat,\n unlink,\n writeFile,\n} from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { deserialize, serialize } from 'node:v8';\nimport { gunzipSync, gzipSync } from 'node:zlib';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport configPackageJson from '@intlayer/types/package.json' with {\n type: 'json',\n};\nimport { type CacheKey, clearAllCache, computeKeyId } from './cacheMemory';\n\n/** ------------------------- Persistence layer ------------------------- **/\n\n/** Cache envelope structure stored on disk */\ntype CacheEnvelope = {\n /** Version of the config package (for cache invalidation) */\n version: string;\n /** Timestamp when the cache entry was created (in milliseconds) */\n timestamp: number;\n /** Data payload (the actual cached value) */\n data: unknown;\n};\n\ntype LocalCacheOptions = {\n /** Preferred new option name */\n persistent?: boolean;\n /** Time-to-live in ms; if expired, disk entry is ignored. */\n ttlMs?: number;\n /** Max age in ms based on stored creation timestamp; invalidates on exceed. */\n maxTimeMs?: number;\n /** Optional namespace to separate different logical caches. */\n namespace?: string;\n /** Gzip values on disk (on by default for blobs > 1KB). */\n compress?: boolean;\n};\n\nconst DEFAULTS: Required<Pick<LocalCacheOptions, 'compress'>> = {\n compress: true,\n};\n\nconst ensureDir = async (dir: string) => {\n await mkdir(dir, { recursive: true });\n};\n\nconst atomicWriteFile = async (file: string, data: Buffer) => {\n const tmp = `${file}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`;\n await writeFile(tmp, data);\n await rename(tmp, file);\n};\n\nconst shouldUseCompression = (buf: Buffer, force?: boolean) =>\n force === true || (force !== false && buf.byteLength > 1024);\n\n/** Derive on-disk path from config dir + namespace + key id. */\nconst cachePath = (cacheDir: string, id: string, ns?: string) =>\n join(cacheDir, ns ? join(ns, id) : id);\n\n/** ------------------------- Local cache facade ------------------------- **/\n\nconst cacheMap = new Map<string, any>();\n\nexport const cacheDisk = (\n intlayerConfig: IntlayerConfig,\n keys: CacheKey[],\n options?: LocalCacheOptions\n) => {\n const { cacheDir } = intlayerConfig.system;\n const buildCacheEnabled = intlayerConfig.build.cache ?? true;\n const persistent =\n options?.persistent === true ||\n (typeof options?.persistent === 'undefined' && buildCacheEnabled);\n\n const { compress, ttlMs, maxTimeMs, namespace } = {\n ...DEFAULTS,\n ...options,\n };\n\n // single stable id for this key tuple (works for both memory & disk)\n const id = computeKeyId(keys);\n const filePath = cachePath(cacheDir, id, namespace);\n\n const readFromDisk = async (): Promise<unknown | undefined> => {\n try {\n const statValue = await stat(filePath).catch(() => undefined);\n\n if (!statValue) return undefined;\n\n if (typeof ttlMs === 'number' && ttlMs > 0) {\n const age = Date.now() - statValue.mtimeMs;\n if (age > ttlMs) return undefined;\n }\n let raw = await readFile(filePath);\n // header: 1 byte flag (0x00 raw, 0x01 gzip)\n const flag = raw[0];\n\n raw = raw.subarray(1);\n\n const payload = flag === 0x01 ? gunzipSync(raw) : raw;\n const deserialized = deserialize(payload) as unknown;\n\n let value: unknown;\n const maybeObj = deserialized as Record<string, unknown> | null;\n const isEnvelope =\n !!maybeObj &&\n typeof maybeObj === 'object' &&\n typeof (maybeObj as any).version === 'string' &&\n typeof (maybeObj as any).timestamp === 'number' &&\n Object.hasOwn(maybeObj, 'data');\n\n if (isEnvelope) {\n const entry = maybeObj as CacheEnvelope;\n\n if (entry.version !== configPackageJson.version) {\n try {\n await unlink(filePath);\n } catch {}\n return undefined;\n }\n\n if (typeof maxTimeMs === 'number' && maxTimeMs > 0) {\n const age = Date.now() - entry.timestamp;\n if (age > maxTimeMs) {\n try {\n await unlink(filePath);\n } catch {}\n return undefined;\n }\n }\n\n value = entry.data;\n } else {\n // Backward compatibility: old entries had raw serialized value.\n if (typeof maxTimeMs === 'number' && maxTimeMs > 0) {\n const age = Date.now() - statValue.mtimeMs;\n if (age > maxTimeMs) {\n try {\n await unlink(filePath);\n } catch {}\n return undefined;\n }\n }\n value = deserialized;\n }\n\n // hydrate memory cache as well\n cacheMap.set(id, value);\n return value;\n } catch {\n return undefined;\n }\n };\n\n const writeToDisk = async (value: unknown) => {\n try {\n await ensureDir(dirname(filePath));\n const envelope: CacheEnvelope = {\n version: configPackageJson.version,\n timestamp: Date.now(),\n data: value,\n };\n const payload = Buffer.from(serialize(envelope));\n\n const gz = shouldUseCompression(payload, compress)\n ? gzipSync(payload)\n : payload;\n\n // prepend a 1-byte header indicating compression\n const buf = Buffer.concat([\n Buffer.from([gz === payload ? 0x00 : 0x01]),\n gz,\n ]);\n\n await atomicWriteFile(filePath, buf);\n } catch {\n // swallow disk errors for cache writes\n }\n };\n\n return {\n /** In-memory first, then disk (if enabled), otherwise undefined. */\n get: async <T>(): Promise<T | undefined> => {\n const mem = cacheMap.get(id);\n\n if (mem !== undefined) return mem as T;\n\n if (persistent && buildCacheEnabled) {\n return (await readFromDisk()) as T | undefined;\n }\n return undefined;\n },\n /** Sets in-memory (always) and persists to disk if enabled. */\n set: async (value: unknown): Promise<void> => {\n cacheMap.set(id, value);\n\n if (persistent && buildCacheEnabled) {\n await writeToDisk(value);\n }\n },\n /** Clears only this entry from memory and disk. */\n clear: async (): Promise<void> => {\n cacheMap.delete(id);\n\n try {\n await unlink(filePath);\n } catch {}\n },\n /** Clears ALL cached entries (memory Map and entire cacheDir namespace if persistent). */\n clearAll: async (): Promise<void> => {\n clearAllCache();\n if (persistent && buildCacheEnabled) {\n // remove only the current namespace (if provided), else the root dir\n const base = namespace ? join(cacheDir, namespace) : cacheDir;\n\n try {\n await rm(base, { recursive: true, force: true });\n } catch {}\n\n try {\n await mkdir(base, { recursive: true });\n } catch {}\n }\n },\n /** Expose the computed id (useful if you want to key other structures). */\n isValid: async (): Promise<boolean> => {\n const cachedValue = cacheMap.get(id);\n if (cachedValue !== undefined) return true;\n\n // If persistence is disabled or build cache disabled, only memory can be valid\n if (!persistent || !buildCacheEnabled) return false;\n\n try {\n const statValue = await stat(filePath).catch(() => undefined);\n if (!statValue) return false;\n\n if (typeof ttlMs === 'number' && ttlMs > 0) {\n const age = Date.now() - statValue.mtimeMs;\n if (age > ttlMs) return false;\n }\n\n let raw = await readFile(filePath);\n const flag = raw[0];\n raw = raw.subarray(1);\n const payload = flag === 0x01 ? gunzipSync(raw) : raw;\n const deserialized = deserialize(payload) as unknown;\n\n const maybeObj = deserialized as Record<string, unknown> | null;\n const isEnvelope =\n !!maybeObj &&\n typeof maybeObj === 'object' &&\n typeof maybeObj.version === 'string' &&\n typeof maybeObj.timestamp === 'number' &&\n Object.hasOwn(maybeObj, 'data');\n\n if (isEnvelope) {\n const entry = maybeObj as CacheEnvelope;\n if (entry.version !== configPackageJson.version) return false;\n\n if (typeof maxTimeMs === 'number' && maxTimeMs > 0) {\n const age = Date.now() - entry.timestamp;\n if (age > maxTimeMs) return false;\n }\n return true;\n }\n\n if (typeof maxTimeMs === 'number' && maxTimeMs > 0) {\n const age = Date.now() - statValue.mtimeMs;\n if (age > maxTimeMs) return false;\n }\n return true;\n } catch {\n return false;\n }\n },\n /** Expose the computed id (useful if you want to key other structures). */\n id,\n /** Expose the absolute file path for debugging. */\n filePath,\n };\n};\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,WAA0D,EAC9D,UAAU,MACX;AAED,MAAM,YAAY,OAAO,QAAgB;AACvC,mCAAY,KAAK,EAAE,WAAW,MAAM,CAAC;;AAGvC,MAAM,kBAAkB,OAAO,MAAc,SAAiB;CAC5D,MAAM,MAAM,GAAG,KAAK,OAAO,QAAQ,IAAI,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE;AAC7E,uCAAgB,KAAK,KAAK;AAC1B,oCAAa,KAAK,KAAK;;AAGzB,MAAM,wBAAwB,KAAa,UACzC,UAAU,QAAS,UAAU,SAAS,IAAI,aAAa;;AAGzD,MAAM,aAAa,UAAkB,IAAY,2BAC1C,UAAU,yBAAU,IAAI,GAAG,GAAG,GAAG;;AAIxC,MAAM,2BAAW,IAAI,KAAkB;AAEvC,MAAa,aACX,gBACA,MACA,YACG;CACH,MAAM,EAAE,aAAa,eAAe;CACpC,MAAM,oBAAoB,eAAe,MAAM,SAAS;CACxD,MAAM,aACJ,SAAS,eAAe,QACvB,OAAO,SAAS,eAAe,eAAe;CAEjD,MAAM,EAAE,UAAU,OAAO,WAAW,cAAc;EAChD,GAAG;EACH,GAAG;EACJ;CAGD,MAAM,KAAKA,uCAAa,KAAK;CAC7B,MAA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AC5B,OAAO,SAAS,cAAc,YAC9B,OAAO,OAAO,UAAU,OAAO,EAEjB;KACd,MAAM,QAAQ;AACd,SAAI,MAAM,YAAYA,qCAAkB,QAAS,QAAO;AAExD,SAAI,OAAO,cAAc,YAAY,YAAY,GAE/C;UADY,KAAK,KAAK,GAAG,MAAM,YACrB,UAAW,QAAO;;AAE9B,YAAO;;AAGT,QAAI,OAAO,cAAc,YAAY,YAAY,GAE/C;SADY,KAAK,KAAK,GAAG,UAAU,UACzB,UAAW,QAAO;;AAE9B,WAAO;WACD;AACN,WAAO;;;EAIX;EAEA;EACD"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  let node_crypto = require("node:crypto");
3
4
 
4
5
  //#region src/utils/cacheMemory.ts
@@ -1 +1 @@
1
- {"version":3,"file":"cacheMemory.cjs","names":[],"sources":["../../../src/utils/cacheMemory.ts"],"sourcesContent":["import { createHash, type Hash } from 'node:crypto';\n\n/** ------------------------- Utilities ------------------------- **/\n\n/** Prefer a fast non-crypto hash if available, then fast crypto, then sha256. */\nconst pickHashAlgorithm = (): string => {\n try {\n // Node 20+ supports xxhash64 (very fast). We feature-detect at module load.\n createHash('xxhash64').update('test').digest();\n return 'xxhash64';\n } catch {}\n try {\n // sha1 is faster than sha256 and sufficient for cache keys.\n createHash('sha1').update('test').digest();\n return 'sha1';\n } catch {}\n\n return 'sha256';\n};\nconst HASH_ALGORITHM = pickHashAlgorithm();\n\n/** Base64url without padding for compact, file-system-safe ids. */\nconst toBase64Url = (buffer: Buffer): string =>\n buffer\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/g, '');\n\n/** Token helpers to minimize collisions while streaming to the hasher. */\nconst token = {\n start: (hasher: Hash, tag: string) => hasher.update(`<${tag}>`),\n sep: (hasher: Hash) => hasher.update('|'),\n end: (hasher: Hash, tag: string) => hasher.update(`</${tag}>`),\n str: (hasher: Hash, stringValue: string) => {\n // length prefix to avoid ambiguity: len#value\n hasher.update(`${stringValue.length}#`);\n hasher.update(stringValue);\n },\n num: (hasher: Hash, numberValue: number) =>\n hasher.update(\n Number.isNaN(numberValue)\n ? 'NaN'\n : numberValue === Infinity\n ? 'Inf'\n : numberValue === -Infinity\n ? '-Inf'\n : String(numberValue)\n ),\n big: (hasher: Hash, bigintValue: bigint) =>\n hasher.update(bigintValue.toString(10)),\n bool: (hasher: Hash, booleanValue: boolean) =>\n hasher.update(booleanValue ? '1' : '0'),\n};\n\n/** ------------------- Canonical, streaming hasher ------------------- **/\n\ntype Seen = WeakSet<object>;\n\n/**\n * Streams a canonical representation of `value` into `hasher` without\n * constructing large intermediate strings. Objects/Maps/Sets are normalized.\n */\nconst stableHashValue = (hasher: Hash, value: unknown, seen: Seen): void => {\n const valueType = typeof value;\n\n if (value === null) {\n token.start(hasher, 'null');\n token.end(hasher, 'null');\n return;\n }\n\n if (valueType === 'undefined') {\n token.start(hasher, 'undef');\n token.end(hasher, 'undef');\n return;\n }\n\n if (valueType === 'number') {\n token.start(hasher, 'num');\n token.num(hasher, value as number);\n token.end(hasher, 'num');\n return;\n }\n\n if (valueType === 'bigint') {\n token.start(hasher, 'big');\n token.big(hasher, value as bigint);\n token.end(hasher, 'big');\n return;\n }\n\n if (valueType === 'boolean') {\n token.start(hasher, 'bool');\n token.bool(hasher, value as boolean);\n token.end(hasher, 'bool');\n return;\n }\n\n if (valueType === 'string') {\n token.start(hasher, 'str');\n token.str(hasher, value as string);\n token.end(hasher, 'str');\n return;\n }\n\n if (valueType === 'symbol') {\n token.start(hasher, 'sym');\n token.str(hasher, String(value));\n token.end(hasher, 'sym');\n return;\n }\n\n if (valueType === 'function') {\n // Stable-ish fingerprint: name and arity (avoid source text).\n const functionValue = value as Function;\n token.start(hasher, 'fn');\n token.str(hasher, functionValue.name ?? '');\n token.sep(hasher);\n token.num(hasher, functionValue.length);\n token.end(hasher, 'fn');\n return;\n }\n\n // Arrays and typed arrays\n if (Array.isArray(value)) {\n if (seen.has(value)) {\n token.start(hasher, 'arr');\n token.str(hasher, 'Circular');\n token.end(hasher, 'arr');\n return;\n }\n seen.add(value);\n token.start(hasher, 'arr');\n for (let i = 0; i < value.length; i++) {\n token.sep(hasher);\n stableHashValue(hasher, value[i], seen);\n }\n token.end(hasher, 'arr');\n seen.delete(value);\n return;\n }\n\n // Node/Builtins\n if (value instanceof Date) {\n token.start(hasher, 'date');\n token.str(hasher, (value as Date).toISOString());\n token.end(hasher, 'date');\n return;\n }\n\n if (value instanceof RegExp) {\n const regex = value as RegExp;\n token.start(hasher, 're');\n token.str(hasher, regex.source);\n token.sep(hasher);\n token.str(hasher, regex.flags);\n token.end(hasher, 're');\n return;\n }\n\n if (value instanceof Set) {\n const setValue = value as Set<unknown>;\n if (seen.has(setValue)) {\n token.start(hasher, 'set');\n token.str(hasher, 'Circular');\n token.end(hasher, 'set');\n return;\n }\n seen.add(setValue);\n // Normalize by item fingerprints (strings) to sort deterministically.\n const items: string[] = [];\n for (const v of setValue) items.push(stableStringify(v)); // small, bounded use of stringify\n items.sort();\n token.start(hasher, 'set');\n for (const item of items) {\n token.sep(hasher);\n token.str(hasher, item);\n }\n token.end(hasher, 'set');\n seen.delete(setValue);\n return;\n }\n\n if (value instanceof Map) {\n const mapObject = value as Map<unknown, unknown>;\n if (seen.has(mapObject)) {\n token.start(hasher, 'map');\n token.str(hasher, 'Circular');\n token.end(hasher, 'map');\n return;\n }\n seen.add(mapObject);\n // Normalize by sorted key fingerprints.\n const entries: Array<[string, unknown]> = [];\n for (const [k, v] of mapObject.entries())\n entries.push([stableStringify(k), v]);\n entries.sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0));\n token.start(hasher, 'map');\n for (const [keyFingerprint, entryValue] of entries) {\n token.sep(hasher);\n token.str(hasher, keyFingerprint);\n token.sep(hasher);\n stableHashValue(hasher, entryValue, seen);\n }\n token.end(hasher, 'map');\n seen.delete(mapObject);\n return;\n }\n\n // ArrayBuffer & typed arrays\n if (ArrayBuffer.isView(value)) {\n const view = value as ArrayBufferView;\n token.start(hasher, 'typed');\n token.str(hasher, Object.getPrototypeOf(view).constructor.name);\n token.sep(hasher);\n hasher.update(Buffer.from(view.buffer, view.byteOffset, view.byteLength));\n token.end(hasher, 'typed');\n return;\n }\n if (value instanceof ArrayBuffer) {\n const buffer = Buffer.from(value as ArrayBuffer);\n token.start(hasher, 'ab');\n hasher.update(buffer);\n token.end(hasher, 'ab');\n return;\n }\n\n // URL\n if (typeof URL !== 'undefined' && value instanceof URL) {\n token.start(hasher, 'url');\n token.str(hasher, (value as URL).toString());\n token.end(hasher, 'url');\n return;\n }\n\n // Errors\n if (value instanceof Error) {\n const errorValue = value as Error;\n token.start(hasher, 'err');\n token.str(hasher, errorValue.name || '');\n token.sep(hasher);\n token.str(hasher, errorValue.message || '');\n token.sep(hasher);\n token.str(hasher, errorValue.stack || '');\n token.end(hasher, 'err');\n return;\n }\n\n // Generic objects\n if (valueType === 'object') {\n const objectValue = value as Record<string, unknown>;\n if (seen.has(objectValue)) {\n token.start(hasher, 'obj');\n token.str(hasher, 'Circular');\n token.end(hasher, 'obj');\n return;\n }\n seen.add(objectValue);\n\n const keys = Object.keys(objectValue).sort();\n token.start(hasher, 'obj');\n for (const key of keys) {\n token.sep(hasher);\n token.str(hasher, key);\n token.sep(hasher);\n stableHashValue(hasher, (objectValue as any)[key], seen);\n }\n token.end(hasher, 'obj');\n\n seen.delete(objectValue);\n return;\n }\n\n // Fallback\n token.start(hasher, 'other');\n token.str(hasher, String(value));\n token.end(hasher, 'other');\n};\n\n/** Public stringify kept for convenience / debugging (now faster & broader). */\nexport const stableStringify = (\n value: unknown,\n _stack = new WeakSet<object>()\n): string => {\n const hasher = createHash(HASH_ALGORITHM);\n stableHashValue(hasher, value, _stack);\n return toBase64Url(hasher.digest());\n};\n\n/** Compute a compact, stable id for arbitrary key tuples. */\nexport const computeKeyId = (keyParts: unknown[]): string => {\n const h = createHash(HASH_ALGORITHM);\n token.start(h, 'keys');\n for (let i = 0; i < keyParts.length; i++) {\n token.sep(h);\n stableHashValue(h, keyParts[i], new WeakSet());\n }\n token.end(h, 'keys');\n return toBase64Url(h.digest());\n};\n\n/** ------------------------- In-memory cache ------------------------- **/\n\nexport type CacheKey = unknown;\nconst cacheMap = new Map<string, any>();\n\nexport const getCache = <T>(...key: CacheKey[]): T | undefined => {\n return cacheMap.get(computeKeyId(key));\n};\n\ntype CacheSetArgs<T> = [...keys: CacheKey[], value: T];\n\nexport const setCache = <T>(...args: CacheSetArgs<T>): void => {\n const value = args[args.length - 1] as T;\n const key = args.slice(0, -1) as CacheKey[];\n cacheMap.set(computeKeyId(key), value);\n};\n\nexport const clearCache = (idOrKey: string): void => {\n // Accept either our computed id or a legacy string id the caller already computed.\n cacheMap.delete(idOrKey);\n};\n\nexport const clearAllCache = (): void => {\n cacheMap.clear();\n};\n\nexport const cacheMemory = {\n get: getCache,\n set: setCache,\n clear: clearCache,\n};\n"],"mappings":";;;;;;AAKA,MAAM,0BAAkC;AACtC,KAAI;AAEF,8BAAW,WAAW,CAAC,OAAO,OAAO,CAAC,QAAQ;AAC9C,SAAO;SACD;AACR,KAAI;AAEF,8BAAW,OAAO,CAAC,OAAO,OAAO,CAAC,QAAQ;AAC1C,SAAO;SACD;AAER,QAAO;;AAET,MAAM,iBAAiB,mBAAmB;;AAG1C,MAAM,eAAe,WACnB,OACG,SAAS,SAAS,CAClB,QAAQ,OAAO,IAAI,CACnB,QAAQ,OAAO,IAAI,CACnB,QAAQ,QAAQ,GAAG;;AAGxB,MAAM,QAAQ;CACZ,QAAQ,QAAc,QAAgB,OAAO,OAAO,IAAI,IAAI,GAAG;CAC/D,MAAM,WAAiB,OAAO,OAAO,IAAI;CACzC,MAAM,QAAc,QAAgB,OAAO,OAAO,KAAK,IAAI,GAAG;CAC9D,MAAM,Q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AAM,IAAI,QAAQ,QAAQ;;;AAI5B,MAAa,mBACX,OACA,yBAAS,IAAI,SAAiB,KACnB;CACX,MAAM,qCAAoB,eAAe;AACzC,iBAAgB,QAAQ,OAAO,OAAO;AACtC,QAAO,YAAY,OAAO,QAAQ,CAAC;;;AAIrC,MAAa,gBAAgB,aAAgC;CAC3D,MAAM,gCAAe,eAAe;AACpC,OAAM,MAAM,GAAG,OAAO;AACtB,MAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,QAAM,IAAI,EAAE;AACZ,kBAAgB,GAAG,SAAS,oBAAI,IAAI,SAAS,CAAC;;AAEhD,OAAM,IAAI,GAAG,OAAO;AACpB,QAAO,YAAY,EAAE,QAAQ,CAAC;;AAMhC,MAAM,2BAAW,IAAI,KAAkB;AAEvC,MAAa,YAAe,GAAG,QAAmC;AAChE,QAAO,SAAS,IAAI,aAAa,IAAI,CAAC;;AAKxC,MAAa,YAAe,GAAG,SAAgC;CAC7D,MAAM,QAAQ,KAAK,KAAK,SAAS;CACjC,MAAM,MAAM,KAAK,MAAM,GAAG,GAAG;AAC7B,UAAS,IAAI,aAAa,IAAI,EAAE,MAAM;;AAGxC,MAAa,cAAc,YAA0B;AAEnD,UAAS,OAAO,QAAQ;;AAG1B,MAAa,sBAA4B;AACvC,UAAS,OAAO;;AAGlB,MAAa,cAAc;CACzB,KAAK;CACL,KAAK;CACL,OAAO;CACR"}
1
+ {"version":3,"file":"cacheMemory.cjs","names":[],"sources":["../../../src/utils/cacheMemory.ts"],"sourcesContent":["import { createHash, type Hash } from 'node:crypto';\n\n/** ------------------------- Utilities ------------------------- **/\n\n/** Prefer a fast non-crypto hash if available, then fast crypto, then sha256. */\nconst pickHashAlgorithm = (): string => {\n try {\n // Node 20+ supports xxhash64 (very fast). We feature-detect at module load.\n createHash('xxhash64').update('test').digest();\n return 'xxhash64';\n } catch {}\n try {\n // sha1 is faster than sha256 and sufficient for cache keys.\n createHash('sha1').update('test').digest();\n return 'sha1';\n } catch {}\n\n return 'sha256';\n};\nconst HASH_ALGORITHM = pickHashAlgorithm();\n\n/** Base64url without padding for compact, file-system-safe ids. */\nconst toBase64Url = (buffer: Buffer): string =>\n buffer\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/g, '');\n\n/** Token helpers to minimize collisions while streaming to the hasher. */\nconst token = {\n start: (hasher: Hash, tag: string) => hasher.update(`<${tag}>`),\n sep: (hasher: Hash) => hasher.update('|'),\n end: (hasher: Hash, tag: string) => hasher.update(`</${tag}>`),\n str: (hasher: Hash, stringValue: string) => {\n // length prefix to avoid ambiguity: len#value\n hasher.update(`${stringValue.length}#`);\n hasher.update(stringValue);\n },\n num: (hasher: Hash, numberValue: number) =>\n hasher.update(\n Number.isNaN(numberValue)\n ? 'NaN'\n : numberValue === Infinity\n ? 'Inf'\n : numberValue === -Infinity\n ? '-Inf'\n : String(numberValue)\n ),\n big: (hasher: Hash, bigintValue: bigint) =>\n hasher.update(bigintValue.toString(10)),\n bool: (hasher: Hash, booleanValue: boolean) =>\n hasher.update(booleanValue ? '1' : '0'),\n};\n\n/** ------------------- Canonical, streaming hasher ------------------- **/\n\ntype Seen = WeakSet<object>;\n\n/**\n * Streams a canonical representation of `value` into `hasher` without\n * constructing large intermediate strings. Objects/Maps/Sets are normalized.\n */\nconst stableHashValue = (hasher: Hash, value: unknown, seen: Seen): void => {\n const valueType = typeof value;\n\n if (value === null) {\n token.start(hasher, 'null');\n token.end(hasher, 'null');\n return;\n }\n\n if (valueType === 'undefined') {\n token.start(hasher, 'undef');\n token.end(hasher, 'undef');\n return;\n }\n\n if (valueType === 'number') {\n token.start(hasher, 'num');\n token.num(hasher, value as number);\n token.end(hasher, 'num');\n return;\n }\n\n if (valueType === 'bigint') {\n token.start(hasher, 'big');\n token.big(hasher, value as bigint);\n token.end(hasher, 'big');\n return;\n }\n\n if (valueType === 'boolean') {\n token.start(hasher, 'bool');\n token.bool(hasher, value as boolean);\n token.end(hasher, 'bool');\n return;\n }\n\n if (valueType === 'string') {\n token.start(hasher, 'str');\n token.str(hasher, value as string);\n token.end(hasher, 'str');\n return;\n }\n\n if (valueType === 'symbol') {\n token.start(hasher, 'sym');\n token.str(hasher, String(value));\n token.end(hasher, 'sym');\n return;\n }\n\n if (valueType === 'function') {\n // Stable-ish fingerprint: name and arity (avoid source text).\n const functionValue = value as Function;\n token.start(hasher, 'fn');\n token.str(hasher, functionValue.name ?? '');\n token.sep(hasher);\n token.num(hasher, functionValue.length);\n token.end(hasher, 'fn');\n return;\n }\n\n // Arrays and typed arrays\n if (Array.isArray(value)) {\n if (seen.has(value)) {\n token.start(hasher, 'arr');\n token.str(hasher, 'Circular');\n token.end(hasher, 'arr');\n return;\n }\n seen.add(value);\n token.start(hasher, 'arr');\n for (let i = 0; i < value.length; i++) {\n token.sep(hasher);\n stableHashValue(hasher, value[i], seen);\n }\n token.end(hasher, 'arr');\n seen.delete(value);\n return;\n }\n\n // Node/Builtins\n if (value instanceof Date) {\n token.start(hasher, 'date');\n token.str(hasher, (value as Date).toISOString());\n token.end(hasher, 'date');\n return;\n }\n\n if (value instanceof RegExp) {\n const regex = value as RegExp;\n token.start(hasher, 're');\n token.str(hasher, regex.source);\n token.sep(hasher);\n token.str(hasher, regex.flags);\n token.end(hasher, 're');\n return;\n }\n\n if (value instanceof Set) {\n const setValue = value as Set<unknown>;\n if (seen.has(setValue)) {\n token.start(hasher, 'set');\n token.str(hasher, 'Circular');\n token.end(hasher, 'set');\n return;\n }\n seen.add(setValue);\n // Normalize by item fingerprints (strings) to sort deterministically.\n const items: string[] = [];\n for (const v of setValue) items.push(stableStringify(v)); // small, bounded use of stringify\n items.sort();\n token.start(hasher, 'set');\n for (const item of items) {\n token.sep(hasher);\n token.str(hasher, item);\n }\n token.end(hasher, 'set');\n seen.delete(setValue);\n return;\n }\n\n if (value instanceof Map) {\n const mapObject = value as Map<unknown, unknown>;\n if (seen.has(mapObject)) {\n token.start(hasher, 'map');\n token.str(hasher, 'Circular');\n token.end(hasher, 'map');\n return;\n }\n seen.add(mapObject);\n // Normalize by sorted key fingerprints.\n const entries: Array<[string, unknown]> = [];\n for (const [k, v] of mapObject.entries())\n entries.push([stableStringify(k), v]);\n entries.sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0));\n token.start(hasher, 'map');\n for (const [keyFingerprint, entryValue] of entries) {\n token.sep(hasher);\n token.str(hasher, keyFingerprint);\n token.sep(hasher);\n stableHashValue(hasher, entryValue, seen);\n }\n token.end(hasher, 'map');\n seen.delete(mapObject);\n return;\n }\n\n // ArrayBuffer & typed arrays\n if (ArrayBuffer.isView(value)) {\n const view = value as ArrayBufferView;\n token.start(hasher, 'typed');\n token.str(hasher, Object.getPrototypeOf(view).constructor.name);\n token.sep(hasher);\n hasher.update(Buffer.from(view.buffer, view.byteOffset, view.byteLength));\n token.end(hasher, 'typed');\n return;\n }\n if (value instanceof ArrayBuffer) {\n const buffer = Buffer.from(value as ArrayBuffer);\n token.start(hasher, 'ab');\n hasher.update(buffer);\n token.end(hasher, 'ab');\n return;\n }\n\n // URL\n if (typeof URL !== 'undefined' && value instanceof URL) {\n token.start(hasher, 'url');\n token.str(hasher, (value as URL).toString());\n token.end(hasher, 'url');\n return;\n }\n\n // Errors\n if (value instanceof Error) {\n const errorValue = value as Error;\n token.start(hasher, 'err');\n token.str(hasher, errorValue.name || '');\n token.sep(hasher);\n token.str(hasher, errorValue.message || '');\n token.sep(hasher);\n token.str(hasher, errorValue.stack || '');\n token.end(hasher, 'err');\n return;\n }\n\n // Generic objects\n if (valueType === 'object') {\n const objectValue = value as Record<string, unknown>;\n if (seen.has(objectValue)) {\n token.start(hasher, 'obj');\n token.str(hasher, 'Circular');\n token.end(hasher, 'obj');\n return;\n }\n seen.add(objectValue);\n\n const keys = Object.keys(objectValue).sort();\n token.start(hasher, 'obj');\n for (const key of keys) {\n token.sep(hasher);\n token.str(hasher, key);\n token.sep(hasher);\n stableHashValue(hasher, (objectValue as any)[key], seen);\n }\n token.end(hasher, 'obj');\n\n seen.delete(objectValue);\n return;\n }\n\n // Fallback\n token.start(hasher, 'other');\n token.str(hasher, String(value));\n token.end(hasher, 'other');\n};\n\n/** Public stringify kept for convenience / debugging (now faster & broader). */\nexport const stableStringify = (\n value: unknown,\n _stack = new WeakSet<object>()\n): string => {\n const hasher = createHash(HASH_ALGORITHM);\n stableHashValue(hasher, value, _stack);\n return toBase64Url(hasher.digest());\n};\n\n/** Compute a compact, stable id for arbitrary key tuples. */\nexport const computeKeyId = (keyParts: unknown[]): string => {\n const h = createHash(HASH_ALGORITHM);\n token.start(h, 'keys');\n for (let i = 0; i < keyParts.length; i++) {\n token.sep(h);\n stableHashValue(h, keyParts[i], new WeakSet());\n }\n token.end(h, 'keys');\n return toBase64Url(h.digest());\n};\n\n/** ------------------------- In-memory cache ------------------------- **/\n\nexport type CacheKey = unknown;\nconst cacheMap = new Map<string, any>();\n\nexport const getCache = <T>(...key: CacheKey[]): T | undefined => {\n return cacheMap.get(computeKeyId(key));\n};\n\ntype CacheSetArgs<T> = [...keys: CacheKey[], value: T];\n\nexport const setCache = <T>(...args: CacheSetArgs<T>): void => {\n const value = args[args.length - 1] as T;\n const key = args.slice(0, -1) as CacheKey[];\n cacheMap.set(computeKeyId(key), value);\n};\n\nexport const clearCache = (idOrKey: string): void => {\n // Accept either our computed id or a legacy string id the caller already computed.\n cacheMap.delete(idOrKey);\n};\n\nexport const clearAllCache = (): void => {\n cacheMap.clear();\n};\n\nexport const cacheMemory = {\n get: getCache,\n set: setCache,\n clear: clearCache,\n};\n"],"mappings":";;;;;;;AAKA,MAAM,0BAAkC;AACtC,KAAI;AAEF,8BAAW,WAAW,CAAC,OAAO,OAAO,CAAC,QAAQ;AAC9C,SAAO;SACD;AACR,KAAI;AAEF,8BAAW,OAAO,CAAC,OAAO,OAAO,CAAC,QAAQ;AAC1C,SAAO;SACD;AAER,QAAO;;AAET,MAAM,iBAAiB,mBAAmB;;AAG1C,MAAM,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value: 'Module' });
1
2
  const require_utils_ESMxCJSHelpers = require('./ESMxCJSHelpers.cjs');
2
3
 
3
4
  //#region src/utils/clearModuleCache.ts
@@ -1 +1 @@
1
- {"version":3,"file":"clearModuleCache.cjs","names":["configESMxCJSRequire"],"sources":["../../../src/utils/clearModuleCache.ts"],"sourcesContent":["import { configESMxCJSRequire } from './ESMxCJSHelpers';\n\n/**\n * Recursively clears the require cache for a module and all its dependencies\n */\nexport const clearModuleCache = (\n modulePath: string,\n visited = new Set<string>()\n) => {\n // Avoid infinite loops\n if (visited.has(modulePath)) {\n return;\n }\n visited.add(modulePath);\n\n try {\n const resolvedPath = configESMxCJSRequire.resolve(modulePath);\n\n // Get the cached module\n const cachedModule = configESMxCJSRequire.cache[resolvedPath];\n\n if (cachedModule) {\n // Clear cache for all children (dependencies) first\n if (cachedModule.children) {\n cachedModule.children.forEach((child) => {\n clearModuleCache(child.filename, visited);\n });\n }\n\n // Clear the cache for this module\n delete configESMxCJSRequire.cache[resolvedPath];\n }\n } catch (error) {\n // Module might not exist or be resolvable, skip it\n console.warn(`Could not clear cache for module: ${modulePath}`, error);\n }\n};\n"],"mappings":";;;;;;AAKA,MAAa,oBACX,YACA,0BAAU,IAAI,KAAa,KACxB;AAEH,KAAI,QAAQ,IAAI,WAAW,CACzB;AAEF,SAAQ,IAAI,WAAW;AAEvB,KAAI;EACF,MAAM,eAAeA,kDAAqB,QAAQ,WAAW;EAG7D,MAAM,eAAeA,kDAAqB,MAAM;AAEhD,MAAI,cAAc;AAEhB,OAAI,aAAa,SACf,cAAa,SAAS,SAAS,UAAU;AACvC,qBAAiB,MAAM,UAAU,QAAQ;KACzC;AAIJ,UAAOA,kDAAqB,MAAM;;UAE7B,OAAO;AAEd,UAAQ,KAAK,qCAAqC,cAAc,MAAM"}
1
+ {"version":3,"file":"clearModuleCache.cjs","names":["configESMxCJSRequire"],"sources":["../../../src/utils/clearModuleCache.ts"],"sourcesContent":["import { configESMxCJSRequire } from './ESMxCJSHelpers';\n\n/**\n * Recursively clears the require cache for a module and all its dependencies\n */\nexport const clearModuleCache = (\n modulePath: string,\n visited = new Set<string>()\n) => {\n // Avoid infinite loops\n if (visited.has(modulePath)) {\n return;\n }\n visited.add(modulePath);\n\n try {\n const resolvedPath = configESMxCJSRequire.resolve(modulePath);\n\n // Get the cached module\n const cachedModule = configESMxCJSRequire.cache[resolvedPath];\n\n if (cachedModule) {\n // Clear cache for all children (dependencies) first\n if (cachedModule.children) {\n cachedModule.children.forEach((child) => {\n clearModuleCache(child.filename, visited);\n });\n }\n\n // Clear the cache for this module\n delete configESMxCJSRequire.cache[resolvedPath];\n }\n } catch (error) {\n // Module might not exist or be resolvable, skip it\n console.warn(`Could not clear cache for module: ${modulePath}`, error);\n }\n};\n"],"mappings":";;;;;;;AAKA,MAAa,oBACX,YACA,0BAAU,IAAI,KAAa,KACxB;AAEH,KAAI,QAAQ,IAAI,WAAW,CACzB;AAEF,SAAQ,IAAI,WAAW;AAEvB,KAAI;EACF,MAAM,eAAeA,kDAAqB,QAAQ,WAAW;EAG7D,MAAM,eAAeA,kDAAqB,MAAM;AAEhD,MAAI,cAAc;AAEhB,OAAI,aAAa,SACf,cAAa,SAAS,SAAS,UAAU;AACvC,qBAAiB,MAAM,UAAU,QAAQ;KACzC;AAIJ,UAAOA,kDAAqB,MAAM;;UAE7B,OAAO;AAEd,UAAQ,KAAK,qCAAqC,cAAc,MAAM"}
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region src/utils/compareVersions.ts
3
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"compareVersions.cjs","names":[],"sources":["../../../src/utils/compareVersions.ts"],"sourcesContent":["/**\n * Compare two semver-like version strings (e.g. \"15.10.4\" vs \"15.3.5\").\n *\n * @param version1 - first version string\n * @param version2 - second version string\n * @param comparison - type of comparison: 'gt', 'lt', 'eq', 'gte', 'lte'\n * @returns boolean indicating if version1 meets the specified comparison condition vs version2\n */\nexport const compareVersions = (\n version1: string,\n comparison: '>' | '<' | '=' | '≥' | '≤',\n version2: string\n): boolean => {\n const v1Parts = version1.split('.').map(Number);\n const v2Parts = version2.split('.').map(Number);\n const maxLen = Math.max(v1Parts.length, v2Parts.length);\n\n // Compute a basic -1, 0, or 1 comparison\n let result = 0;\n for (let i = 0; i < maxLen; i++) {\n const part1 = v1Parts[i] || 0;\n const part2 = v2Parts[i] || 0;\n if (part1 > part2) {\n result = 1;\n break;\n } else if (part1 < part2) {\n result = -1;\n break;\n }\n }\n\n switch (comparison) {\n case '>':\n return result === 1;\n case '<':\n return result === -1;\n case '=':\n return result === 0;\n case '≥':\n return result === 0 || result === 1;\n case '≤':\n return result === 0 || result === -1;\n }\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,mBACX,UACA,YACA,aACY;CACZ,MAAM,UAAU,SAAS,MAAM,IAAI,CAAC,IAAI,OAAO;CAC/C,MAAM,UAAU,SAAS,MAAM,IAAI,CAAC,IAAI,OAAO;CAC/C,MAAM,SAAS,KAAK,IAAI,QAAQ,QAAQ,QAAQ,OAAO;CAGvD,IAAI,SAAS;AACb,MAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,KAAK;EAC/B,MAAM,QAAQ,QAAQ,MAAM;EAC5B,MAAM,QAAQ,QAAQ,MAAM;AAC5B,MAAI,QAAQ,OAAO;AACjB,YAAS;AACT;aACS,QAAQ,OAAO;AACxB,YAAS;AACT;;;AAIJ,SAAQ,YAAR;EACE,KAAK,IACH,QAAO,WAAW;EACpB,KAAK,IACH,QAAO,WAAW;EACpB,KAAK,IACH,QAAO,WAAW;EACpB,KAAK,IACH,QAAO,WAAW,KAAK,WAAW;EACpC,KAAK,IACH,QAAO,WAAW,KAAK,WAAW"}
1
+ {"version":3,"file":"compareVersions.cjs","names":[],"sources":["../../../src/utils/compareVersions.ts"],"sourcesContent":["/**\n * Compare two semver-like version strings (e.g. \"15.10.4\" vs \"15.3.5\").\n *\n * @param version1 - first version string\n * @param version2 - second version string\n * @param comparison - type of comparison: 'gt', 'lt', 'eq', 'gte', 'lte'\n * @returns boolean indicating if version1 meets the specified comparison condition vs version2\n */\nexport const compareVersions = (\n version1: string,\n comparison: '>' | '<' | '=' | '≥' | '≤',\n version2: string\n): boolean => {\n const v1Parts = version1.split('.').map(Number);\n const v2Parts = version2.split('.').map(Number);\n const maxLen = Math.max(v1Parts.length, v2Parts.length);\n\n // Compute a basic -1, 0, or 1 comparison\n let result = 0;\n for (let i = 0; i < maxLen; i++) {\n const part1 = v1Parts[i] || 0;\n const part2 = v2Parts[i] || 0;\n if (part1 > part2) {\n result = 1;\n break;\n } else if (part1 < part2) {\n result = -1;\n break;\n }\n }\n\n switch (comparison) {\n case '>':\n return result === 1;\n case '<':\n return result === -1;\n case '=':\n return result === 0;\n case '≥':\n return result === 0 || result === 1;\n case '≤':\n return result === 0 || result === -1;\n }\n};\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,mBACX,UACA,YACA,aACY;CACZ,MAAM,UAAU,SAAS,MAAM,IAAI,CAAC,IAAI,OAAO;CAC/C,MAAM,UAAU,SAAS,MAAM,IAAI,CAAC,IAAI,OAAO;CAC/C,MAAM,SAAS,KAAK,IAAI,QAAQ,QAAQ,QAAQ,OAAO;CAGvD,IAAI,SAAS;AACb,MAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,KAAK;EAC/B,MAAM,QAAQ,QAAQ,MAAM;EAC5B,MAAM,QAAQ,QAAQ,MAAM;AAC5B,MAAI,QAAQ,OAAO;AACjB,YAAS;AACT;aACS,QAAQ,OAAO;AACxB,YAAS;AACT;;;AAIJ,SAAQ,YAAR;EACE,KAAK,IACH,QAAO,WAAW;EACpB,KAAK,IACH,QAAO,WAAW;EACpB,KAAK,IACH,QAAO,WAAW;EACpB,KAAK,IACH,QAAO,WAAW,KAAK,WAAW;EACpC,KAAK,IACH,QAAO,WAAW,KAAK,WAAW"}
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region src/utils/extractErrorMessage.ts
3
4
  const extractErrorMessage = (error) => {
@@ -1 +1 @@
1
- {"version":3,"file":"extractErrorMessage.cjs","names":[],"sources":["../../../src/utils/extractErrorMessage.ts"],"sourcesContent":["export const extractErrorMessage = (error: unknown): string => {\n const trimToSingleLine = (text: string): string =>\n text\n .split(/\\r?\\n/)\n .map((s) => s.trim())\n .filter(Boolean)[0] ?? text.trim();\n\n const looksLikeJson = (value: string): boolean => {\n const s = value.trim();\n if (!s) return false;\n const first = s[0];\n return first === '{' || first === '[' || first === '\"';\n };\n\n const sanitizeUnexpectedTokenMessage = (text: string): string => {\n // If the text mentions an invalid JSON parse, try to extract the meaningful part\n const t = text.trim();\n if (/Unexpected token/i.test(t) && /not valid JSON/i.test(t)) {\n const quoted = t.match(/\"([^\"]+)\"/);\n if (quoted?.[1]) return quoted[1];\n // Fallback: drop the leading parser error description\n const afterColon = t.split(':').slice(1).join(':').trim();\n if (afterColon) return afterColon;\n }\n return t;\n };\n\n const pickFieldsFromObject = (\n value: unknown,\n seen: Set<unknown>\n ): string | undefined => {\n if (!value || typeof value !== 'object') return undefined;\n if (seen.has(value)) return undefined;\n seen.add(value);\n\n const obj = value as Record<string, unknown>;\n\n // Check for message first (highest priority)\n if (typeof obj.message === 'string' && obj.message.trim()) {\n return obj.message;\n }\n\n // Check for error_description\n if (\n typeof obj.error_description === 'string' &&\n obj.error_description.trim()\n ) {\n return obj.error_description;\n }\n\n // Check for error\n if (typeof obj.error === 'string' && obj.error.trim()) {\n return obj.error;\n }\n\n // Handle title and code combination\n const title = typeof obj.title === 'string' ? obj.title.trim() : '';\n const code = typeof obj.code === 'string' ? obj.code.trim() : '';\n\n if (title && code) {\n return `${title} (${code})`;\n }\n\n if (title) {\n return title;\n }\n\n if (code) {\n return code;\n }\n\n // Check for statusText\n if (typeof obj.statusText === 'string' && obj.statusText.trim()) {\n return obj.statusText;\n }\n\n // Common nested structures (Axios/Fetch-like)\n const response = obj.response as Record<string, unknown> | undefined;\n if (response && typeof response === 'object') {\n const data = response.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n }\n\n const data = obj.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n\n // Nested cause chain\n const cause = (obj as { cause?: unknown }).cause;\n const fromCause =\n pickFieldsFromObject(cause, seen) ??\n (typeof (cause as any)?.message === 'string'\n ? (cause as any).message\n : undefined);\n if (fromCause) return fromCause;\n\n // Arrays of errors\n const errors = obj.errors as unknown;\n if (Array.isArray(errors)) {\n for (const item of errors) {\n const fromItem = pickFieldsFromObject(item, seen);\n if (fromItem) return fromItem;\n if (typeof (item as any)?.message === 'string')\n return (item as any).message;\n }\n }\n\n return undefined;\n };\n\n const tryParseJsonString = (maybeJson: string): string | undefined => {\n if (!looksLikeJson(maybeJson)) return undefined;\n try {\n const parsed = JSON.parse(maybeJson);\n const picked = pickFieldsFromObject(parsed, new Set());\n if (picked) return picked;\n if (typeof parsed === 'string') return parsed;\n return undefined;\n } catch {\n return undefined;\n }\n };\n\n if (typeof error === 'string') {\n const cleaned = sanitizeUnexpectedTokenMessage(error);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n if (error && typeof error === 'object') {\n // Native Error instance\n if (error instanceof Error) {\n const cleaned = sanitizeUnexpectedTokenMessage(error.message);\n const fromMessage = tryParseJsonString(cleaned);\n if (fromMessage) return trimToSingleLine(fromMessage);\n // Dive into cause when present\n const fromCause = extractErrorMessage(error.cause as unknown);\n if (fromCause && fromCause !== 'An unknown error occurred')\n return trimToSingleLine(fromCause);\n return trimToSingleLine(cleaned);\n }\n\n // Generic object\n const seen = new Set<unknown>();\n const fromObject = pickFieldsFromObject(error, seen);\n if (fromObject) {\n const cleaned = sanitizeUnexpectedTokenMessage(fromObject);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n try {\n const serialized = JSON.stringify(error);\n return trimToSingleLine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Ac,mBAAmB,QAAQ;AAC/C,OAAI,YAAa,QAAO,iBAAiB,YAAY;GAErD,MAAM,YAAY,oBAAoB,MAAM,MAAiB;AAC7D,OAAI,aAAa,cAAc,4BAC7B,QAAO,iBAAiB,UAAU;AACpC,UAAO,iBAAiB,QAAQ;;EAKlC,MAAM,aAAa,qBAAqB,uBAD3B,IAAI,KAAc,CACqB;AACpD,MAAI,YAAY;GACd,MAAM,UAAU,+BAA+B,WAAW;AAC1D,UAAO,mBAAmB,QAAQ,IAAI,iBAAiB,QAAQ;;AAGjE,MAAI;AAEF,UAAO,iBADY,KAAK,UAAU,MAAM,CACL;UAC7B;AACN,UAAO,iBAAiB,OAAO,MAAM,CAAC;;;AAI1C,QAAO"}
1
+ {"version":3,"file":"extractErrorMessage.cjs","names":[],"sources":["../../../src/utils/extractErrorMessage.ts"],"sourcesContent":["export const extractErrorMessage = (error: unknown): string => {\n const trimToSingleLine = (text: string): string =>\n text\n .split(/\\r?\\n/)\n .map((s) => s.trim())\n .filter(Boolean)[0] ?? text.trim();\n\n const looksLikeJson = (value: string): boolean => {\n const s = value.trim();\n if (!s) return false;\n const first = s[0];\n return first === '{' || first === '[' || first === '\"';\n };\n\n const sanitizeUnexpectedTokenMessage = (text: string): string => {\n // If the text mentions an invalid JSON parse, try to extract the meaningful part\n const t = text.trim();\n if (/Unexpected token/i.test(t) && /not valid JSON/i.test(t)) {\n const quoted = t.match(/\"([^\"]+)\"/);\n if (quoted?.[1]) return quoted[1];\n // Fallback: drop the leading parser error description\n const afterColon = t.split(':').slice(1).join(':').trim();\n if (afterColon) return afterColon;\n }\n return t;\n };\n\n const pickFieldsFromObject = (\n value: unknown,\n seen: Set<unknown>\n ): string | undefined => {\n if (!value || typeof value !== 'object') return undefined;\n if (seen.has(value)) return undefined;\n seen.add(value);\n\n const obj = value as Record<string, unknown>;\n\n // Check for message first (highest priority)\n if (typeof obj.message === 'string' && obj.message.trim()) {\n return obj.message;\n }\n\n // Check for error_description\n if (\n typeof obj.error_description === 'string' &&\n obj.error_description.trim()\n ) {\n return obj.error_description;\n }\n\n // Check for error\n if (typeof obj.error === 'string' && obj.error.trim()) {\n return obj.error;\n }\n\n // Handle title and code combination\n const title = typeof obj.title === 'string' ? obj.title.trim() : '';\n const code = typeof obj.code === 'string' ? obj.code.trim() : '';\n\n if (title && code) {\n return `${title} (${code})`;\n }\n\n if (title) {\n return title;\n }\n\n if (code) {\n return code;\n }\n\n // Check for statusText\n if (typeof obj.statusText === 'string' && obj.statusText.trim()) {\n return obj.statusText;\n }\n\n // Common nested structures (Axios/Fetch-like)\n const response = obj.response as Record<string, unknown> | undefined;\n if (response && typeof response === 'object') {\n const data = response.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n }\n\n const data = obj.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n\n // Nested cause chain\n const cause = (obj as { cause?: unknown }).cause;\n const fromCause =\n pickFieldsFromObject(cause, seen) ??\n (typeof (cause as any)?.message === 'string'\n ? (cause as any).message\n : undefined);\n if (fromCause) return fromCause;\n\n // Arrays of errors\n const errors = obj.errors as unknown;\n if (Array.isArray(errors)) {\n for (const item of errors) {\n const fromItem = pickFieldsFromObject(item, seen);\n if (fromItem) return fromItem;\n if (typeof (item as any)?.message === 'string')\n return (item as any).message;\n }\n }\n\n return undefined;\n };\n\n const tryParseJsonString = (maybeJson: string): string | undefined => {\n if (!looksLikeJson(maybeJson)) return undefined;\n try {\n const parsed = JSON.parse(maybeJson);\n const picked = pickFieldsFromObject(parsed, new Set());\n if (picked) return picked;\n if (typeof parsed === 'string') return parsed;\n return undefined;\n } catch {\n return undefined;\n }\n };\n\n if (typeof error === 'string') {\n const cleaned = sanitizeUnexpectedTokenMessage(error);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n if (error && typeof error === 'object') {\n // Native Error instance\n if (error instanceof Error) {\n const cleaned = sanitizeUnexpectedTokenMessage(error.message);\n const fromMessage = tryParseJsonString(cleaned);\n if (fromMessage) return trimToSingleLine(fromMessage);\n // Dive into cause when present\n const fromCause = extractErrorMessage(error.cause as unknown);\n if (fromCause && fromCause !== 'An unknown error occurred')\n return trimToSingleLine(fromCause);\n return trimToSingleLine(cleaned);\n }\n\n // Generic object\n const seen = new Set<unknown>();\n const fromObject = pickFieldsFromObject(error, seen);\n if (fromObject) {\n const cleaned = sanitizeUnexpectedTokenMessage(fromObject);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n try {\n const serialized = JSON.stringify(error);\n return trimToSingleLine(serialized);\n } catch {\n return trimToSingleLine(String(error));\n }\n }\n\n return 'An unknown error occurred';\n};\n"],"mappings":";;;AAAA,MAAa,uBAAuB,UAA2B;CAC7D,MAAM,oBAAoB,SACxB,KACG,MAAM,QAAQ,CACd,KAAK,MAAM,EAAE,MAAM,CAAC,CACpB,OAAO,QAAQ,CAAC,MAAM,KAAK,MAAM;CAEtC,MAAM,iBAAiB,UAA2B;EAChD,MAAM,IAAI,MAAM,MAAM;AACtB,MAAI,CAAC,EAAG,QAAO;EACf,MAAM,QAAQ,EAAE;AAChB,SAAO,UAAU,OAAO,UAAU,OAAO,UAAU;;CAGrD,MAAM,kCAAkC,SAAyB;EAE/D,MAAM,IAAI,KAAK,MAAM;AACrB,MAAI,oBAAoB,KAAK,EAAE,IAAI,kBAAkB,KAAK,EAAE,EAAE;GAC5D,MAAM,SAAS,EAAE,MAAM,YAAY;AACnC,OAAI,SAAS,GAAI,QAAO,OAAO;GAE/B,MAAM,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC,MAAM;AACzD,OAAI,WAAY,QAAO;;AAEzB,SAAO;;CAGT,MAAM,wBACJ,OACA,SACuB;AACvB,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;AAChD,MAAI,KAAK,IAAI,MAAM,CAAE,QAAO;AAC5B,OAAK,IAAI,MAAM;EAEf,MAAM,MAAM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AAM,SAAS,qBAAqB,wBAAQ,IAAI,KAAK,CAAC;AACtD,OAAI,OAAQ,QAAO;AACnB,OAAI,OAAO,WAAW,SAAU,QAAO;AACvC;UACM;AACN;;;AAIJ,KAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,UAAU,+BAA+B,MAAM;AACrD,SAAO,mBAAmB,QAAQ,IAAI,iBAAiB,QAAQ;;AAGjE,KAAI,SAAS,OAAO,UAAU,UAAU;AAEtC,MAAI,iBAAiB,OAAO;GAC1B,MAAM,UAAU,+BAA+B,MAAM,QAAQ;GAC7D,MAAM,cAAc,mBAAmB,QAAQ;AAC/C,OAAI,YAAa,QAAO,iBAAiB,YAAY;GAErD,MAAM,YAAY,oBAAoB,MAAM,MAAiB;AAC7D,OAAI,aAAa,cAAc,4BAC7B,QAAO,iBAAiB,UAAU;AACpC,UAAO,iBAAiB,QAAQ;;EAKlC,MAAM,aAAa,qBAAqB,uBAD3B,IAAI,KAAc,CACqB;AACpD,MAAI,YAAY;GACd,MAAM,UAAU,+BAA+B,WAAW;AAC1D,UAAO,mBAAmB,QAAQ,IAAI,iBAAiB,QAAQ;;AAGjE,MAAI;AAEF,UAAO,iBADY,KAAK,UAAU,MAAM,CACL;UAC7B;AACN,UAAO,iBAAiB,OAAO,MAAM,CAAC;;;AAI1C,QAAO"}
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region src/utils/getExtension.ts
3
4
  const getExtension = (configuration, format) => {
@@ -1 +1 @@
1
- {"version":3,"file":"getExtension.cjs","names":[],"sources":["../../../src/utils/getExtension.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types';\n\nexport const getExtension = (\n configuration: IntlayerConfig,\n format?: 'esm' | 'cjs' | undefined\n) => {\n const outputFormats = configuration.build.outputFormat;\n\n if (format === 'cjs') return 'cjs';\n if (format === 'esm') return 'mjs';\n\n if (outputFormats.includes('cjs')) return 'cjs';\n if (outputFormats.includes('esm')) return 'mjs';\n\n return 'cjs';\n};\n"],"mappings":";;AAEA,MAAa,gBACX,eACA,WACG;CACH,MAAM,gBAAgB,cAAc,MAAM;AAE1C,KAAI,WAAW,MAAO,QAAO;AAC7B,KAAI,WAAW,MAAO,QAAO;AAE7B,KAAI,cAAc,SAAS,MAAM,CAAE,QAAO;AAC1C,KAAI,cAAc,SAAS,MAAM,CAAE,QAAO;AAE1C,QAAO"}
1
+ {"version":3,"file":"getExtension.cjs","names":[],"sources":["../../../src/utils/getExtension.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types';\n\nexport const getExtension = (\n configuration: IntlayerConfig,\n format?: 'esm' | 'cjs' | undefined\n) => {\n const outputFormats = configuration.build.outputFormat;\n\n if (format === 'cjs') return 'cjs';\n if (format === 'esm') return 'mjs';\n\n if (outputFormats.includes('cjs')) return 'cjs';\n if (outputFormats.includes('esm')) return 'mjs';\n\n return 'cjs';\n};\n"],"mappings":";;;AAEA,MAAa,gBACX,eACA,WACG;CACH,MAAM,gBAAgB,cAAc,MAAM;AAE1C,KAAI,WAAW,MAAO,QAAO;AAC7B,KAAI,WAAW,MAAO,QAAO;AAE7B,KAAI,cAAc,SAAS,MAAM,CAAE,QAAO;AAC1C,KAAI,cAAc,SAAS,MAAM,CAAE,QAAO;AAE1C,QAAO"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  const require_utils_cacheMemory = require('./cacheMemory.cjs');
3
4
  let node_path = require("node:path");
4
5
  let node_fs = require("node:fs");
@@ -1 +1 @@
1
- {"version":3,"file":"getPackageJsonPath.cjs","names":["cacheMemory"],"sources":["../../../src/utils/getPackageJsonPath.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { cacheMemory } from './cacheMemory';\n\nexport const isESModule = typeof import.meta.url === 'string';\n\nconst MAX_LEVELS = 15;\n\ntype PackageJsonPathCache = {\n packageJsonPath: string;\n baseDir: string;\n};\n\nexport const getPackageJsonPath = (\n startDir: string = process.cwd()\n): PackageJsonPathCache => {\n const checkedCache = cacheMemory.get<PackageJsonPathCache>(\n 'packageJsonPath',\n startDir\n );\n\n if (checkedCache) return checkedCache;\n\n let currentDir = startDir;\n\n for (let level = 0; level < MAX_LEVELS; level++) {\n const packageJsonPath = join(currentDir, 'package.json');\n\n if (existsSync(packageJsonPath)) {\n cacheMemory.set('packageJsonPath', startDir, {\n packageJsonPath,\n baseDir: currentDir,\n });\n\n return { packageJsonPath, baseDir: currentDir };\n }\n\n const parentDir = dirname(currentDir);\n\n // If we've reached the root directory, stop\n if (parentDir === currentDir) {\n break;\n }\n\n currentDir = parentDir;\n }\n\n throw new Error(\n `Could not find package.json in current directory or any of the ${MAX_LEVELS} parent directories. Searched from: ${startDir}`\n );\n};\n"],"mappings":";;;;;;AAIA,MAAa,aAAa,yDAA2B;AAErD,MAAM,aAAa;AAOnB,MAAa,sBACX,WAAmB,QAAQ,KAAK,KACP;CACzB,MAAM,eAAeA,sCAAY,IAC/B,mBACA,SACD;AAED,KAAI,aAAc,QAAO;CAEzB,IAAI,aAAa;AAEjB,MAAK,IAAI,QAAQ,GAAG,QAAQ,YAAY,SAAS;EAC/C,MAAM,sCAAuB,YAAY,eAAe;AAExD,8BAAe,gBAAgB,EAAE;AAC/B,yCAAY,IAAI,mBAAmB,UAAU;IAC3C;IACA,SAAS;IACV,CAAC;AAEF,UAAO;IAAE;IAAiB,SAAS;IAAY;;EAGjD,MAAM,mCAAoB,WAAW;AAGrC,MAAI,cAAc,WAChB;AAGF,eAAa;;AAGf,OAAM,IAAI,MACR,kEAAkE,WAAW,sCAAsC,WACpH"}
1
+ {"version":3,"file":"getPackageJsonPath.cjs","names":["cacheMemory"],"sources":["../../../src/utils/getPackageJsonPath.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { cacheMemory } from './cacheMemory';\n\nexport const isESModule = typeof import.meta.url === 'string';\n\nconst MAX_LEVELS = 15;\n\ntype PackageJsonPathCache = {\n packageJsonPath: string;\n baseDir: string;\n};\n\nexport const getPackageJsonPath = (\n startDir: string = process.cwd()\n): PackageJsonPathCache => {\n const checkedCache = cacheMemory.get<PackageJsonPathCache>(\n 'packageJsonPath',\n startDir\n );\n\n if (checkedCache) return checkedCache;\n\n let currentDir = startDir;\n\n for (let level = 0; level < MAX_LEVELS; level++) {\n const packageJsonPath = join(currentDir, 'package.json');\n\n if (existsSync(packageJsonPath)) {\n cacheMemory.set('packageJsonPath', startDir, {\n packageJsonPath,\n baseDir: currentDir,\n });\n\n return { packageJsonPath, baseDir: currentDir };\n }\n\n const parentDir = dirname(currentDir);\n\n // If we've reached the root directory, stop\n if (parentDir === currentDir) {\n break;\n }\n\n currentDir = parentDir;\n }\n\n throw new Error(\n `Could not find package.json in current directory or any of the ${MAX_LEVELS} parent directories. Searched from: ${startDir}`\n );\n};\n"],"mappings":";;;;;;;AAIA,MAAa,aAAa,yDAA2B;AAErD,MAAM,aAAa;AAOnB,MAAa,sBACX,WAAmB,QAAQ,KAAK,KACP;CACzB,MAAM,eAAeA,sCAAY,IAC/B,mBACA,SACD;AAED,KAAI,aAAc,QAAO;CAEzB,IAAI,aAAa;AAEjB,MAAK,IAAI,QAAQ,GAAG,QAAQ,YAAY,SAAS;EAC/C,MAAM,sCAAuB,YAAY,eAAe;AAExD,8BAAe,gBAAgB,EAAE;AAC/B,yCAAY,IAAI,mBAAmB,UAAU;IAC3C;IACA,SAAS;IACV,CAAC;AAEF,UAAO;IAAE;IAAiB,SAAS;IAAY;;EAGjD,MAAM,mCAAoB,WAAW;AAGrC,MAAI,cAAc,WAChB;AAGF,eAAa;;AAGf,OAAM,IAAI,MACR,kEAAkE,WAAW,sCAAsC,WACpH"}
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
  const require_logger = require('../logger.cjs');
2
3
 
3
4
  //#region src/utils/logStack.ts
@@ -1 +1 @@
1
- {"version":3,"file":"logStack.cjs","names":["colorize","ANSIColors"],"sources":["../../../src/utils/logStack.ts"],"sourcesContent":["import { ANSIColors, colorize } from '../logger';\n\nexport const logStack = (\n message: string,\n options: { limit: number } = { limit: 50 }\n) => {\n Error.stackTraceLimit = options.limit;\n\n try {\n throw new Error('test');\n } catch (error) {\n console.log(colorize(message, ANSIColors.YELLOW));\n console.log(colorize((error as Error).stack ?? '', ANSIColors.BLUE));\n }\n};\n"],"mappings":";;;AAEA,MAAa,YACX,SACA,UAA6B,EAAE,OAAO,IAAI,KACvC;AACH,OAAM,kBAAkB,QAAQ;AAEhC,KAAI;AACF,QAAM,IAAI,MAAM,OAAO;UAChB,OAAO;AACd,UAAQ,IAAIA,wBAAS,SAASC,0BAAW,OAAO,CAAC;AACjD,UAAQ,IAAID,wBAAU,MAAgB,SAAS,IAAIC,0BAAW,KAAK,CAAC"}
1
+ {"version":3,"file":"logStack.cjs","names":["colorize","ANSIColors"],"sources":["../../../src/utils/logStack.ts"],"sourcesContent":["import { ANSIColors, colorize } from '../logger';\n\nexport const logStack = (\n message: string,\n options: { limit: number } = { limit: 50 }\n) => {\n Error.stackTraceLimit = options.limit;\n\n try {\n throw new Error('test');\n } catch (error) {\n console.log(colorize(message, ANSIColors.YELLOW));\n console.log(colorize((error as Error).stack ?? '', ANSIColors.BLUE));\n }\n};\n"],"mappings":";;;;AAEA,MAAa,YACX,SACA,UAA6B,EAAE,OAAO,IAAI,KACvC;AACH,OAAM,kBAAkB,QAAQ;AAEhC,KAAI;AACF,QAAM,IAAI,MAAM,OAAO;UAChB,OAAO;AACd,UAAQ,IAAIA,wBAAS,SAASC,0BAAW,OAAO,CAAC;AACjD,UAAQ,IAAID,wBAAU,MAAgB,SAAS,IAAIC,0BAAW,KAAK,CAAC"}