@intlayer/config 7.5.12 → 7.5.14

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 (66) hide show
  1. package/dist/cjs/_virtual/rolldown_runtime.cjs +2 -2
  2. package/dist/cjs/built.cjs.map +1 -1
  3. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  4. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  5. package/dist/cjs/configFile/searchConfigurationFile.cjs +2 -0
  6. package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
  7. package/dist/cjs/defaultValues/build.cjs +1 -1
  8. package/dist/cjs/defaultValues/build.cjs.map +1 -1
  9. package/dist/cjs/defaultValues/content.cjs +3 -1
  10. package/dist/cjs/defaultValues/content.cjs.map +1 -1
  11. package/dist/cjs/defaultValues/editor.cjs +1 -1
  12. package/dist/cjs/defaultValues/index.cjs +1 -1
  13. package/dist/cjs/defaultValues/internationalization.cjs +1 -1
  14. package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
  15. package/dist/cjs/defaultValues/log.cjs +1 -1
  16. package/dist/cjs/defaultValues/routing.cjs +1 -1
  17. package/dist/cjs/defaultValues/routing.cjs.map +1 -1
  18. package/dist/cjs/index.cjs +1 -1
  19. package/dist/cjs/loadExternalFile/loadExternalFile.cjs +10 -14
  20. package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -1
  21. package/dist/cjs/loadExternalFile/parseFileContent.cjs +1 -1
  22. package/dist/cjs/loadExternalFile/parseFileContent.cjs.map +1 -1
  23. package/dist/cjs/loadExternalFile/{transpileTSToMJS.cjs → transpileTSToCJS.cjs} +6 -6
  24. package/dist/cjs/loadExternalFile/{transpileTSToMJS.cjs.map → transpileTSToCJS.cjs.map} +1 -1
  25. package/dist/cjs/logger.cjs.map +1 -1
  26. package/dist/cjs/retryManager.cjs.map +1 -1
  27. package/dist/cjs/utils/ESMxCJSHelpers.cjs.map +1 -1
  28. package/dist/cjs/utils/cacheDisk.cjs.map +1 -1
  29. package/dist/cjs/utils/cacheMemory.cjs.map +1 -1
  30. package/dist/esm/_virtual/rolldown_runtime.mjs +2 -2
  31. package/dist/esm/built.mjs.map +1 -1
  32. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  33. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  34. package/dist/esm/configFile/searchConfigurationFile.mjs +2 -0
  35. package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
  36. package/dist/esm/defaultValues/build.mjs +2 -2
  37. package/dist/esm/defaultValues/build.mjs.map +1 -1
  38. package/dist/esm/defaultValues/content.mjs +4 -2
  39. package/dist/esm/defaultValues/content.mjs.map +1 -1
  40. package/dist/esm/defaultValues/editor.mjs +2 -2
  41. package/dist/esm/defaultValues/index.mjs +2 -2
  42. package/dist/esm/defaultValues/internationalization.mjs +2 -2
  43. package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
  44. package/dist/esm/defaultValues/log.mjs +2 -2
  45. package/dist/esm/defaultValues/routing.mjs +2 -2
  46. package/dist/esm/defaultValues/routing.mjs.map +1 -1
  47. package/dist/esm/index.mjs +1 -1
  48. package/dist/esm/loadExternalFile/loadExternalFile.mjs +9 -14
  49. package/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -1
  50. package/dist/esm/loadExternalFile/parseFileContent.mjs +1 -1
  51. package/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -1
  52. package/dist/esm/loadExternalFile/{transpileTSToMJS.mjs → transpileTSToCJS.mjs} +5 -5
  53. package/dist/esm/loadExternalFile/{transpileTSToMJS.mjs.map → transpileTSToCJS.mjs.map} +1 -1
  54. package/dist/esm/logger.mjs.map +1 -1
  55. package/dist/esm/retryManager.mjs.map +1 -1
  56. package/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -1
  57. package/dist/esm/utils/cacheDisk.mjs.map +1 -1
  58. package/dist/esm/utils/cacheMemory.mjs.map +1 -1
  59. package/dist/types/configFile/searchConfigurationFile.d.ts +1 -1
  60. package/dist/types/configFile/searchConfigurationFile.d.ts.map +1 -1
  61. package/dist/types/defaultValues/content.d.ts.map +1 -1
  62. package/dist/types/loadExternalFile/loadExternalFile.d.ts.map +1 -1
  63. package/dist/types/loadExternalFile/transpileTSToCJS.d.ts +9 -0
  64. package/dist/types/loadExternalFile/{transpileTSToMJS.d.ts.map → transpileTSToCJS.d.ts.map} +1 -1
  65. package/package.json +8 -7
  66. package/dist/types/loadExternalFile/transpileTSToMJS.d.ts +0 -9
@@ -1 +1 @@
1
- {"version":3,"file":"routing.mjs","names":["STORAGE: RoutingConfig['storage']"],"sources":["../../../src/defaultValues/routing.ts"],"sourcesContent":["import type { RoutingConfig } from '@intlayer/types';\n\nexport const HEADER_NAME = 'x-intlayer-locale';\n\nexport const COOKIE_NAME = 'INTLAYER_LOCALE';\nexport const LOCALE_STORAGE_NAME = 'INTLAYER_LOCALE';\n\nexport const BASE_PATH = '';\n\nexport const SERVER_SET_COOKIE = 'always';\n\nexport const ROUTING_MODE = 'prefix-no-default';\n\nexport const STORAGE: RoutingConfig['storage'] = ['cookie', 'header'];\n"],"mappings":";;;;;;;;;;;;AAEA,MAAa,cAAc;AAE3B,MAAa,cAAc;AAC3B,MAAa,sBAAsB;AAEnC,MAAa,YAAY;AAEzB,MAAa,oBAAoB;AAEjC,MAAa,eAAe;AAE5B,MAAaA,UAAoC,CAAC,UAAU,SAAS"}
1
+ {"version":3,"file":"routing.mjs","names":[],"sources":["../../../src/defaultValues/routing.ts"],"sourcesContent":["import type { RoutingConfig } from '@intlayer/types';\n\nexport const HEADER_NAME = 'x-intlayer-locale';\n\nexport const COOKIE_NAME = 'INTLAYER_LOCALE';\nexport const LOCALE_STORAGE_NAME = 'INTLAYER_LOCALE';\n\nexport const BASE_PATH = '';\n\nexport const SERVER_SET_COOKIE = 'always';\n\nexport const ROUTING_MODE = 'prefix-no-default';\n\nexport const STORAGE: RoutingConfig['storage'] = ['cookie', 'header'];\n"],"mappings":";;;;;;;;;;;;AAEA,MAAa,cAAc;AAE3B,MAAa,cAAc;AAC3B,MAAa,sBAAsB;AAEnC,MAAa,YAAY;AAEzB,MAAa,oBAAoB;AAEjC,MAAa,eAAe;AAE5B,MAAa,UAAoC,CAAC,UAAU,SAAS"}
@@ -5,8 +5,8 @@ import { ANSIColors, clock, colon, colorize, colorizeKey, colorizeLocales, color
5
5
  import { cacheMemory } from "./utils/cacheMemory.mjs";
6
6
  import { getPackageJsonPath } from "./utils/getPackageJsonPath.mjs";
7
7
  import { buildConfigurationFields } from "./configFile/buildConfigurationFields.mjs";
8
- import { configESMxCJSRequire, getProjectRequire, isESModule } from "./utils/ESMxCJSHelpers.mjs";
9
8
  import { getEnvFilePath, loadEnvFile } from "./loadEnvFile.mjs";
9
+ import { configESMxCJSRequire, getProjectRequire, isESModule } from "./utils/ESMxCJSHelpers.mjs";
10
10
  import { parseFileContent } from "./loadExternalFile/parseFileContent.mjs";
11
11
  import { bundleJSFile } from "./bundleJSFile.mjs";
12
12
  import { configurationFilesCandidates, searchConfigurationFile } from "./configFile/searchConfigurationFile.mjs";
@@ -1,10 +1,10 @@
1
1
  import { colorizePath, logger } from "../logger.mjs";
2
- import { getProjectRequire } from "../utils/ESMxCJSHelpers.mjs";
3
2
  import { parseFileContent } from "./parseFileContent.mjs";
4
- import { transpileTSToMJS, transpileTSToMJSSync } from "./transpileTSToMJS.mjs";
3
+ import { transpileTSToCJS, transpileTSToCJSSync } from "./transpileTSToCJS.mjs";
5
4
  import { extname } from "node:path";
6
5
  import { readFileSync } from "node:fs";
7
6
  import { readFile } from "node:fs/promises";
7
+ import JSON5 from "json5";
8
8
 
9
9
  //#region src/loadExternalFile/loadExternalFile.ts
10
10
  /**
@@ -13,14 +13,10 @@ import { readFile } from "node:fs/promises";
13
13
  * Accepts JSON, JS, MJS and TS files as configuration
14
14
  */
15
15
  const loadExternalFileSync = (filePath, options) => {
16
- const fileExtension = extname(filePath);
17
- const safeProjectRequire = options?.projectRequire ?? getProjectRequire();
16
+ const fileExtension = extname(filePath) || ".json";
18
17
  try {
19
- if (fileExtension === "json") {
20
- delete safeProjectRequire.cache[safeProjectRequire.resolve(filePath)];
21
- return safeProjectRequire(filePath);
22
- }
23
- const moduleResultString = transpileTSToMJSSync(readFileSync(filePath, "utf-8"), filePath);
18
+ if (fileExtension === ".json" || fileExtension === ".json5" || fileExtension === ".jsonc") return JSON5.parse(readFileSync(filePath, "utf-8"));
19
+ const moduleResultString = transpileTSToCJSSync(readFileSync(filePath, "utf-8"), filePath);
24
20
  if (!moduleResultString) {
25
21
  logger("File could not be loaded.", { level: "error" });
26
22
  return;
@@ -48,13 +44,12 @@ const loadExternalFileSync = (filePath, options) => {
48
44
  */
49
45
  const loadExternalFile = async (filePath, options) => {
50
46
  const fileExtension = extname(filePath);
51
- const safeProjectRequire = options?.projectRequire ?? getProjectRequire();
52
47
  try {
53
- if (fileExtension === ".json") {
54
- delete safeProjectRequire.cache[safeProjectRequire.resolve(filePath)];
55
- return safeProjectRequire(filePath);
48
+ if (fileExtension === ".json" || fileExtension === ".json5" || fileExtension === ".jsonc") {
49
+ const fileContent$1 = await readFile(filePath, "utf-8");
50
+ return JSON5.parse(fileContent$1);
56
51
  }
57
- const moduleResultString = await transpileTSToMJS(await readFile(filePath, "utf-8"), filePath, options?.buildOptions);
52
+ const moduleResultString = await transpileTSToCJS(await readFile(filePath, "utf-8"), filePath, options?.buildOptions);
58
53
  if (!moduleResultString) {
59
54
  logger("File could not be loaded.", { level: "error" });
60
55
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"loadExternalFile.mjs","names":["moduleResultString: string | undefined"],"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 { colorizePath, logger } from '../logger';\nimport { getProjectRequire } from '../utils/ESMxCJSHelpers';\nimport {\n parseFileContent,\n type SandBoxContextOptions,\n} from './parseFileContent';\nimport { transpileTSToMJS, transpileTSToMJSSync } from './transpileTSToMJS';\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);\n const safeProjectRequire = options?.projectRequire ?? getProjectRequire();\n\n try {\n if (fileExtension === 'json') {\n // Remove cache to force getting fresh content\n delete safeProjectRequire.cache[safeProjectRequire.resolve(filePath)];\n // Assume JSON\n return safeProjectRequire(filePath);\n }\n\n // Rest is JS, MJS or TS\n const code = readFileSync(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = transpileTSToMJSSync(\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 const safeProjectRequire = options?.projectRequire ?? getProjectRequire();\n\n try {\n if (fileExtension === '.json') {\n // Remove cache to force getting fresh content\n delete safeProjectRequire.cache[safeProjectRequire.resolve(filePath)];\n // Assume JSON\n const result = safeProjectRequire(filePath);\n return result;\n }\n\n // Rest is JS, MJS or TS\n const code = await readFile(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = await transpileTSToMJS(\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,gBAAgB,QAAQ,SAAS;CACvC,MAAM,qBAAqB,SAAS,kBAAkB,mBAAmB;AAEzE,KAAI;AACF,MAAI,kBAAkB,QAAQ;AAE5B,UAAO,mBAAmB,MAAM,mBAAmB,QAAQ,SAAS;AAEpE,UAAO,mBAAmB,SAAS;;EAMrC,MAAMA,qBAAyC,qBAFlC,aAAa,UAAU,QAAQ,EAI1C,SACD;AAED,MAAI,CAAC,oBAAoB;AACvB,UAAO,6BAA6B,EAAE,OAAO,SAAS,CAAC;AACvD;;EAGF,MAAM,cAAc,iBAAiB,oBAAoB;GACvD,gBAAgB,SAAS;GACzB,eAAe,SAAS;GACxB,mBAAmB,SAAS;GAC5B,OAAO,SAAS;GAChB,SAAS,SAAS;GACnB,CAAC;AAEF,MAAI,OAAO,gBAAgB,aAAa;AACtC,UAAO,oCAAoC,WAAW;AACtD;;AAGF,SAAO;UACA,OAAO;AACd,SACE,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,gBAAgB,QAAQ,SAAS;CACvC,MAAM,qBAAqB,SAAS,kBAAkB,mBAAmB;AAEzE,KAAI;AACF,MAAI,kBAAkB,SAAS;AAE7B,UAAO,mBAAmB,MAAM,mBAAmB,QAAQ,SAAS;AAGpE,UADe,mBAAmB,SAAS;;EAO7C,MAAMA,qBAAyC,MAAM,iBAFxC,MAAM,SAAS,UAAU,QAAQ,EAI5C,UACA,SAAS,aACV;AAED,MAAI,CAAC,oBAAoB;AACvB,UAAO,6BAA6B,EAAE,OAAO,SAAS,CAAC;AACvD;;EAGF,MAAM,cAAc,iBAAiB,oBAAoB;GACvD,gBAAgB,SAAS;GACzB,eAAe,SAAS;GACxB,mBAAmB,SAAS;GAC5B,OAAO,SAAS;GAChB,SAAS,SAAS;GACnB,CAAC;AAEF,MAAI,OAAO,gBAAgB,aAAa;AACtC,UAAO,oCAAoC,aAAa,SAAS,GAAG;AACpE;;AAGF,SAAO;UACA,OAAO;AACd,SACE,CACE,UAAW,MAAgB,QAAQ,MACnC,KAAK,UAAW,MAAgB,OAAO,MAAM,EAAE,CAChD,EACD,EACE,OAAO,SACR,CACF"}
1
+ {"version":3,"file":"loadExternalFile.mjs","names":["fileContent"],"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,gBAAgB,QAAQ,SAAS,IAAI;AAE3C,KAAI;AACF,MACE,kBAAkB,WAClB,kBAAkB,YAClB,kBAAkB,SAGlB,QAAO,MAAM,MAAM,aAAa,UAAU,QAAQ,CAAC;EAMrD,MAAM,qBAAyC,qBAFlC,aAAa,UAAU,QAAQ,EAI1C,SACD;AAED,MAAI,CAAC,oBAAoB;AACvB,UAAO,6BAA6B,EAAE,OAAO,SAAS,CAAC;AACvD;;EAGF,MAAM,cAAc,iBAAiB,oBAAoB;GACvD,gBAAgB,SAAS;GACzB,eAAe,SAAS;GACxB,mBAAmB,SAAS;GAC5B,OAAO,SAAS;GAChB,SAAS,SAAS;GACnB,CAAC;AAEF,MAAI,OAAO,gBAAgB,aAAa;AACtC,UAAO,oCAAoC,WAAW;AACtD;;AAGF,SAAO;UACA,OAAO;AACd,SACE,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,gBAAgB,QAAQ,SAAS;AAEvC,KAAI;AACF,MACE,kBAAkB,WAClB,kBAAkB,YAClB,kBAAkB,UAClB;GAEA,MAAMA,gBAAc,MAAM,SAAS,UAAU,QAAQ;AACrD,UAAO,MAAM,MAAMA,cAAY;;EAMjC,MAAM,qBAAyC,MAAM,iBAFxC,MAAM,SAAS,UAAU,QAAQ,EAI5C,UACA,SAAS,aACV;AAED,MAAI,CAAC,oBAAoB;AACvB,UAAO,6BAA6B,EAAE,OAAO,SAAS,CAAC;AACvD;;EAGF,MAAM,cAAc,iBAAiB,oBAAoB;GACvD,gBAAgB,SAAS;GACzB,eAAe,SAAS;GACxB,mBAAmB,SAAS;GAC5B,OAAO,SAAS;GAChB,SAAS,SAAS;GACnB,CAAC;AAEF,MAAI,OAAO,gBAAgB,aAAa;AACtC,UAAO,oCAAoC,aAAa,SAAS,GAAG;AACpE;;AAGF,SAAO;UACA,OAAO;AACd,SACE,CACE,UAAW,MAAgB,QAAQ,MACnC,KAAK,UAAW,MAAgB,OAAO,MAAM,EAAE,CAChD,EACD,EACE,OAAO,SACR,CACF"}
@@ -1,5 +1,5 @@
1
- import { getProjectRequire } from "../utils/ESMxCJSHelpers.mjs";
2
1
  import { loadEnvFile } from "../loadEnvFile.mjs";
2
+ import { getProjectRequire } from "../utils/ESMxCJSHelpers.mjs";
3
3
  import { runInNewContext } from "node:vm";
4
4
  import * as esbuild from "esbuild";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"parseFileContent.mjs","names":["baseRequire: NodeJS.Require","mockedRequire: NodeJS.Require","sandboxContext: Context","candidates: unknown[]"],"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 don't inject it\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,MAAMA,cACJ,OAAO,mBAAmB,aAAa,iBAAiB,mBAAmB;CAG7E,MAAMC,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,OAAO,OAAO,WAAW,OAAO,CAC/C,QAAO,UAAU;AAInB,OAAI,WAAW,MAAM,aAAa,OAAO,OAAO,WAAW,GAAG,CAC5D,QAAO,UAAU;AAGnB,UAAO,YAAY,OAAO;;AAI5B,iBAAe,UAAU,YAAY,QAAQ,KAAK,YAAY;AAC9D,iBAAe,OAAO,YAAY;AAClC,iBAAe,aAAa,YAAY;AACxC,iBAAe,QAAQ,YAAY;AAEnC,SAAO;KACL;AAEJ,KAAI;AAEF,wBAAsB,EACpB,OAAO,YAAY,QAAQ,EAC5B;UACM,MAAM;CAIf,MAAMC,iBAA0B;EAC9B,SAAS,EACP,SAAS,EAAE,EACZ;EACD,QAAQ,EACN,SAAS,EAAE,EACZ;EACD,SAAS;GACP,GAAG;GACH,KAAK;IACH,GAAG,QAAQ;IACX,GAAG,YAAY,cAAc;IAC7B,GAAG;IACJ;GACF;EACD;EACA,SAAS;EACT,GAAG;EACJ;AAGD,QAAO,oBAAoB,WAAW,CAAC,SAAS,QAAQ;AACtD,MAAI,EAAE,OAAO,gBACX,gBAAe,OAAO,WAAW;GAEnC;AAEF,QAAO;;AAGT,MAAa,oBACX,mBACA,YACkB;CAClB,MAAM,iBAAiB,kBAAkB,QAAQ;AAGjD,iBAAgB,kBAAkB,qBAAqB,eAAe;CAEtE,MAAMC,aAAwB;EAC5B,eAAe,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
+ {"version":3,"file":"parseFileContent.mjs","names":[],"sources":["../../../src/loadExternalFile/parseFileContent.ts"],"sourcesContent":["import { type Context, runInNewContext } from 'node:vm';\nimport * as esbuild from 'esbuild';\nimport { type LoadEnvFileOptions, loadEnvFile } from '../loadEnvFile';\nimport { getProjectRequire } from '../utils/ESMxCJSHelpers';\n\nexport type SandBoxContextOptions = {\n envVarOptions?: LoadEnvFileOptions;\n projectRequire?: NodeJS.Require;\n additionalEnvVars?: Record<string, string>;\n /**\n * Map of specifier -> mocked export to be returned when code in the VM calls require(specifier).\n * Example:\n * mocks: {\n * '@intlayer/config/built': { getConfig: () => ({}), Locales: {} }\n * }\n */\n mocks?: Record<string, any>;\n /**\n * Optional alias map if you want to redirect specifiers.\n * Useful when user code imports a subpath you want to collapse.\n * Example:\n * aliases: { '@intlayer/config/built': '@intlayer/config' }\n */\n aliases?: Record<string, string>;\n};\n\nexport const getSandBoxContext = (options?: SandBoxContextOptions): Context => {\n const { envVarOptions, projectRequire, additionalEnvVars, mocks, aliases } =\n options ?? {};\n\n let additionalGlobalVar = {};\n\n const baseRequire: NodeJS.Require =\n typeof projectRequire === 'function' ? projectRequire : getProjectRequire();\n\n // Wrap require to honor mocks and aliases inside the VM\n const mockedRequire: NodeJS.Require = (() => {\n const mockTable = Object.assign(\n {\n esbuild,\n },\n mocks\n );\n const aliasTable = Object.assign({}, aliases);\n\n const wrappedRequire = function mockableRequire(id: string) {\n const target = aliasTable?.[id] ? aliasTable[id] : id;\n\n if (mockTable && Object.hasOwn(mockTable, target)) {\n return mockTable[target];\n }\n\n // If the original id was aliased, allow mocks to be defined on either key.\n if (target !== id && mockTable && Object.hasOwn(mockTable, id)) {\n return mockTable[id];\n }\n\n return baseRequire(target);\n } as NodeJS.Require;\n\n // Mirror NodeJS.Require properties\n wrappedRequire.resolve = baseRequire.resolve.bind(baseRequire);\n wrappedRequire.main = baseRequire.main;\n wrappedRequire.extensions = baseRequire.extensions;\n wrappedRequire.cache = baseRequire.cache;\n\n return wrappedRequire;\n })();\n\n try {\n // Dynamically try to require React if it's installed in the project\n additionalGlobalVar = {\n React: baseRequire('react'),\n };\n } catch (_err) {\n // React is not installed, so we don't inject it\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,iBAAiB,mBAAmB;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,OAAO,OAAO,WAAW,OAAO,CAC/C,QAAO,UAAU;AAInB,OAAI,WAAW,MAAM,aAAa,OAAO,OAAO,WAAW,GAAG,CAC5D,QAAO,UAAU;AAGnB,UAAO,YAAY,OAAO;;AAI5B,iBAAe,UAAU,YAAY,QAAQ,KAAK,YAAY;AAC9D,iBAAe,OAAO,YAAY;AAClC,iBAAe,aAAa,YAAY;AACxC,iBAAe,QAAQ,YAAY;AAEnC,SAAO;KACL;AAEJ,KAAI;AAEF,wBAAsB,EACpB,OAAO,YAAY,QAAQ,EAC5B;UACM,MAAM;CAIf,MAAM,iBAA0B;EAC9B,SAAS,EACP,SAAS,EAAE,EACZ;EACD,QAAQ,EACN,SAAS,EAAE,EACZ;EACD,SAAS;GACP,GAAG;GACH,KAAK;IACH,GAAG,QAAQ;IACX,GAAG,YAAY,cAAc;IAC7B,GAAG;IACJ;GACF;EACD;EACA,SAAS;EACT,GAAG;EACJ;AAGD,QAAO,oBAAoB,WAAW,CAAC,SAAS,QAAQ;AACtD,MAAI,EAAE,OAAO,gBACX,gBAAe,OAAO,WAAW;GAEnC;AAEF,QAAO;;AAGT,MAAa,oBACX,mBACA,YACkB;CAClB,MAAM,iBAAiB,kBAAkB,QAAQ;AAGjD,iBAAgB,kBAAkB,qBAAqB,eAAe;CAEtE,MAAM,aAAwB;EAC5B,eAAe,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"}
@@ -5,7 +5,7 @@ import { existsSync } from "node:fs";
5
5
  import { build, buildSync } from "esbuild";
6
6
  import { pathToFileURL } from "node:url";
7
7
 
8
- //#region src/loadExternalFile/transpileTSToMJS.ts
8
+ //#region src/loadExternalFile/transpileTSToCJS.ts
9
9
  const getTsConfigPath = (filePath) => {
10
10
  const tsconfigPath = join(getPackageJsonPath(dirname(filePath)).baseDir, "tsconfig.json");
11
11
  return existsSync(tsconfigPath) ? tsconfigPath : void 0;
@@ -31,7 +31,7 @@ const getTransformationOptions = (filePath) => ({
31
31
  tsconfig: getTsConfigPath(filePath),
32
32
  define: { "import.meta.url": JSON.stringify(pathToFileURL(filePath).href) }
33
33
  });
34
- const transpileTSToMJSSync = (code, filePath, options) => {
34
+ const transpileTSToCJSSync = (code, filePath, options) => {
35
35
  return buildSync({
36
36
  stdin: {
37
37
  contents: code,
@@ -43,7 +43,7 @@ const transpileTSToMJSSync = (code, filePath, options) => {
43
43
  ...options
44
44
  }).outputFiles?.[0].text;
45
45
  };
46
- const transpileTSToMJS = async (code, filePath, options) => {
46
+ const transpileTSToCJS = async (code, filePath, options) => {
47
47
  return (await build({
48
48
  stdin: {
49
49
  contents: code,
@@ -57,5 +57,5 @@ const transpileTSToMJS = async (code, filePath, options) => {
57
57
  };
58
58
 
59
59
  //#endregion
60
- export { transpileTSToMJS, transpileTSToMJSSync };
61
- //# sourceMappingURL=transpileTSToMJS.mjs.map
60
+ export { transpileTSToCJS, transpileTSToCJSSync };
61
+ //# sourceMappingURL=transpileTSToCJS.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"transpileTSToMJS.mjs","names":[],"sources":["../../../src/loadExternalFile/transpileTSToMJS.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 transpileTSToMJSSync = (\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 transpileTSToMJS = 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,eAAe,KACnB,mBAAmB,QAAQ,SAAS,CAAC,CAAC,SACtC,gBACD;AAGD,QAAO,WAAW,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,UAAU,cAAc,SAAS,CAAC,KAAK,EAChE;CACF;AAED,MAAa,wBACX,MACA,UACA,YACuB;AAiBvB,QAbkC,UAAU;EAC1C,OAAO;GACL,UAAU;GACV,QALW,UADG,QAAQ,SAAS,CACA;GAM/B,YAAY,QAAQ,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,CAEsC,cAAc,GAAG;;AAK3D,MAAa,mBAAmB,OAC9B,MACA,UACA,YACgC;AAiBhC,SAbkC,MAAM,MAAM;EAC5C,OAAO;GACL,UAAU;GACV,QALW,UADG,QAAQ,SAAS,CACA;GAM/B,YAAY,QAAQ,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,EAEsC,cAAc,GAAG"}
1
+ {"version":3,"file":"transpileTSToCJS.mjs","names":[],"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,eAAe,KACnB,mBAAmB,QAAQ,SAAS,CAAC,CAAC,SACtC,gBACD;AAGD,QAAO,WAAW,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,UAAU,cAAc,SAAS,CAAC,KAAK,EAChE;CACF;AAED,MAAa,wBACX,MACA,UACA,YACuB;AAiBvB,QAbkC,UAAU;EAC1C,OAAO;GACL,UAAU;GACV,QALW,UADG,QAAQ,SAAS,CACA;GAM/B,YAAY,QAAQ,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,CAEsC,cAAc,GAAG;;AAK3D,MAAa,mBAAmB,OAC9B,MACA,UACA,YACgC;AAiBhC,SAbkC,MAAM,MAAM;EAC5C,OAAO;GACL,UAAU;GACV,QALW,UADG,QAAQ,SAAS,CACA;GAM/B,YAAY,QAAQ,SAAS;GAC7B,YAAY;GACb;EACD,GAAG,yBAAyB,SAAS;EACrC,GAAG;EACJ,CAAC,EAEsC,cAAc,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.mjs","names":["logger: Logger","color","value: number","text"],"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\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 = details?.config?.prefix ? details?.config?.prefix : undefined;\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,MAAaA,UAAkB,SAAS,YAAY;CAClD,MAAM,YAAY,SAAS,aAAa;CACxC,MAAM,OAAO,SAAS,QAAQ,QAAQ;CACtC,MAAM,QAAQ,SAAS,SAAS;CAChC,MAAM,SAAS,SAAS,QAAQ,SAAS,SAAS,QAAQ,SAAS;CACnE,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,QA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M,SAAS,UAAU,QAAQ;CACjC,MAAM,eAAe,KAAK,IACxB,SACA,KAAK,IAAI,SAAU,SAAS,YAAYC,OAAK,CAAC,OAAO,CACtD;AAED,KAAI,QAAQ,OACV,QAAO,GAAG,IAAI,OAAO,aAAa,GAAGA;AAGvC,QAAO,GAAGA,SAAO,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.mjs","names":["color","text"],"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\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 = details?.config?.prefix ? details?.config?.prefix : undefined;\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 })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AAO,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,WAAS;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,YAAYC,OAAK,CAAC,OAAO,CACtD;AAED,KAAI,QAAQ,OACV,QAAO,GAAG,IAAI,OAAO,aAAa,GAAGA;AAGvC,QAAO,GAAGA,SAAO,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 +1 @@
1
- {"version":3,"file":"retryManager.mjs","names":["lastError: unknown"],"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,IAAIA;AAEJ,MAAK,IAAI,UAAU,GAAG,WAAW,UAAU,UACzC,KAAI;AACF,SAAO,MAAM,GAAG,GAAG,KAAK;UACjB,KAAK;AACZ,cAAY;EACZ,MAAM,QAAQ,oBAAoB,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,QAAO,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.mjs","names":[],"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,QAAQ,oBAAoB,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,QAAO,OAAO,EACZ,OAAO,SACR,CAAC;AAIJ,MAAI,QAAQ,EACV,OAAM,IAAI,SAAS,QAAQ,WAAW,KAAK,MAAM,CAAC;;AAMxD,OACE,6BAAa,IAAI,MAAM,kDAAkD"}
@@ -1 +1 @@
1
- {"version":3,"file":"ESMxCJSHelpers.mjs","names":["configESMxCJSRequire: NodeJS.Require"],"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,OAAO,OAAO,KAAK,QAAQ;;;;;;AAOrD,MAAa,qBAAqB,aAAsC;CAEtE,MAAM,EAAE,oBAAoB,mBAAmB,SAAS;AAExD,QAAO,cAAc,gBAAgB;;;;;;;AAQvC,MAAaA,uBAAuC,aAChD,cAAc,OAAO,KAAK,IAAI"}
1
+ {"version":3,"file":"ESMxCJSHelpers.mjs","names":[],"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,OAAO,OAAO,KAAK,QAAQ;;;;;;AAOrD,MAAa,qBAAqB,aAAsC;CAEtE,MAAM,EAAE,oBAAoB,mBAAmB,SAAS;AAExD,QAAO,cAAc,gBAAgB;;;;;;;AAQvC,MAAa,uBAAuC,aAChD,cAAc,OAAO,KAAK,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"cacheDisk.mjs","names":["DEFAULTS: Required<Pick<LocalCacheOptions, 'compress'>>","value: unknown","configPackageJson","envelope: CacheEnvelope"],"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.content;\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,MAAMA,WAA0D,EAC9D,UAAU,MACX;AAED,MAAM,YAAY,OAAO,QAAgB;AACvC,OAAM,MAAM,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,OAAM,UAAU,KAAK,KAAK;AAC1B,OAAM,OAAO,KAAK,KAAK;;AAGzB,MAAM,wBAAwB,KAAa,UACzC,UAAU,QAAS,UAAU,SAAS,IAAI,aAAa;;AAGzD,MAAM,aAAa,UAAkB,IAAY,OAC/C,KAAK,UAAU,KAAK,KAAK,IAAI,GAAG,GAAG,GAAG;;AAIxC,MAAM,2BAAW,IAAI,KAAkB;AAEvC,MAAa,aACX,gBACA,MACA,YACG;CACH,MAAM,EAAE,aAAa,eAAe;CACpC,MAAM,oBAAoB,eAA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AEvC;SADY,KAAK,KAAK,GAAG,UAAU,UACzB,MAAO,QAAO;;IAG1B,IAAI,MAAM,MAAM,SAAS,SAAS;IAClC,MAAM,OAAO,IAAI;AACjB,UAAM,IAAI,SAAS,EAAE;IAIrB,MAAM,WAFe,YADL,SAAS,IAAO,WAAW,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,YAAkB,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.mjs","names":["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.content;\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,OAAM,MAAM,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,OAAM,UAAU,KAAK,KAAK;AAC1B,OAAM,OAAO,KAAK,KAAK;;AAGzB,MAAM,wBAAwB,KAAa,UACzC,UAAU,QAAS,UAAU,SAAS,IAAI,aAAa;;AAGzD,MAAM,aAAa,UAAkB,IAAY,OAC/C,KAAK,UAAU,KAAK,KAAK,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,KAAK,aAAa,KAAK;CAC7B,MAAM,WAAW,UAAU,UAAU,IAAI,UAAU;CAEnD,MAAM,eAAe,YAA0C;AAC7D,MAAI;GACF,MAAM,YAAY,MAAM,KAAK,SAAS,CAAC,YAAY,OAAU;AAE7D,OAAI,CAAC,UAAW,QAAO;AAEvB,OAAI,OAAO,UAAU,YAAY,QAAQ,GAEvC;QADY,KAAK,KAAK,GAAG,UAAU,UACzB,MAAO,QAAO;;GAE1B,IAAI,MAAM,MAAM,SAAS,SAAS;GAElC,MAAM,OA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,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 +1 @@
1
- {"version":3,"file":"cacheMemory.mjs","names":["items: string[]","entries: Array<[string, unknown]>"],"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,aAAW,WAAW,CAAC,OAAO,OAAO,CAAC,QAAQ;AAC9C,SAAO;SACD;AACR,KAAI;AAEF,aAAW,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,QAAc,gBAAwB;AAE1C,SAAO,OAAO,GAAG,YAAY,OAAO,GAAG;AACvC,SAAO,OAAO,YAAY;;CAE5B,MAAM,QAAc,gBAClB,OAAO,OACL,OAAO,MAAM,YAAY,GACrB,QACA,gBAAgB,WACd,QACA,gBAAgB,YACd,SACA,OAAO,YAAY,CAC5B;CACH,MAAM,QAAc,gBAClB,OAAO,OAAO,YAAY,SAAS,GAAG,CAAC;CACzC,OAAO,QAAc,iBACnB,OAAO,OAAO,eAAe,MAAM,IAAI;CAC1C;;;;;AAUD,MAAM,mBAAmB,QAAc,OAAgB,SAAqB;CAC1E,MAAM,YAAY,OAAO;AAEzB,KAAI,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D,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.mjs","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,aAAW,WAAW,CAAC,OAAO,OAAO,CAAC,QAAQ;AAC9C,SAAO;SACD;AACR,KAAI;AAEF,aAAW,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,QAAc,gBAAwB;AAE1C,SAAO,OAAO,GAAG,YAAY,OAAO,GAAG;AACvC,SAAO,OAAO,YAAY;;CAE5B,MAAM,QAAc,gBAClB,OAA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,iBAAgB,QAAQ,OAAO,OAAO;AACtC,QAAO,YAAY,OAAO,QAAQ,CAAC;;;AAIrC,MAAa,gBAAgB,aAAgC;CAC3D,MAAM,IAAI,WAAW,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,5 +1,5 @@
1
1
  //#region src/configFile/searchConfigurationFile.d.ts
2
- declare const configurationFilesCandidates: readonly ["intlayer.config.ts", "intlayer.config.js", "intlayer.config.json", "intlayer.config.cjs", "intlayer.config.mjs", ".intlayerrc"];
2
+ declare const configurationFilesCandidates: readonly ["intlayer.config.ts", "intlayer.config.js", "intlayer.config.json", "intlayer.config.json5", "intlayer.config.jsonc", "intlayer.config.cjs", "intlayer.config.mjs", ".intlayerrc"];
3
3
  type SearchConfigurationFileResult = {
4
4
  configurationFilePath?: string;
5
5
  numCustomConfiguration: number;
@@ -1 +1 @@
1
- {"version":3,"file":"searchConfigurationFile.d.ts","names":[],"sources":["../../../src/configFile/searchConfigurationFile.ts"],"sourcesContent":[],"mappings":";cAKa;AAAb,KASK,6BAAA,GAFK;EAEL,qBAAA,CAAA,EAAA,MAAA;EAgBQ,sBAAA,EAAA,MA4BZ;;;;;;;;;;;;;cA5BY,+CAEV"}
1
+ {"version":3,"file":"searchConfigurationFile.d.ts","names":[],"sources":["../../../src/configFile/searchConfigurationFile.ts"],"sourcesContent":[],"mappings":";cAKa;AAAb,KAWK,6BAAA,GAFK;EAEL,qBAAA,CAAA,EAAA,MAAA;EAgBQ,sBAAA,EAAA,MA4BZ;;;;;;;;;;;;;cA5BY,+CAEV"}
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","names":[],"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":[],"mappings":";;;cAAa;cAWA;cAaA;cAEA,QAAA;cAEA,gBAAA;cAEA,SAAA;cAEA,uBAAA;cAEA,yBAAA;cAEA,wBAAA;cAEA,sBAAA;cAEA,SAAA;cAEA,uBAAA;cAEA,wBAAA;cAEA,uBAAA;cAEA,UAAA;cAEA,SAAA;cAEA"}
1
+ {"version":3,"file":"content.d.ts","names":[],"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":[],"mappings":";;;cAAa;cAaA;cAaA;cAEA,QAAA;cAEA,gBAAA;cAEA,SAAA;cAEA,uBAAA;cAEA,yBAAA;cAEA,wBAAA;cAEA,sBAAA;cAEA,SAAA;cAEA,uBAAA;cAEA,wBAAA;cAEA,uBAAA;cAEA,UAAA;cAEA,SAAA;cAEA"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadExternalFile.d.ts","names":[],"sources":["../../../src/loadExternalFile/loadExternalFile.ts"],"sourcesContent":[],"mappings":";;;;;KAaY,aAAA,GAAgB;KAEhB,uBAAA;EAFA,aAAA,CAAA,EAGM,cAHU;EAEhB,YAAA,CAAA,EAEK,YAFkB;CACjB,GAEd,qBAFc;;;;AASlB;AA4DA;cA5Da,mDAED;;;;;;cA0DC,+CAED,4BACT"}
1
+ {"version":3,"file":"loadExternalFile.d.ts","names":[],"sources":["../../../src/loadExternalFile/loadExternalFile.ts"],"sourcesContent":[],"mappings":";;;;;KAaY,aAAA,GAAgB;KAEhB,uBAAA;EAFA,aAAA,CAAA,EAGM,cAHU;EAEhB,YAAA,CAAA,EAEK,YAFkB;CACjB,GAEd,qBAFc;;;;AASlB;AA6DA;cA7Da,mDAED;;;;;;cA2DC,+CAED,4BACT"}
@@ -0,0 +1,9 @@
1
+ import { BuildOptions, Plugin } from "esbuild";
2
+
3
+ //#region src/loadExternalFile/transpileTSToCJS.d.ts
4
+ type ESBuildPlugin = Plugin;
5
+ declare const transpileTSToCJSSync: (code: string, filePath: string, options?: BuildOptions) => string | undefined;
6
+ declare const transpileTSToCJS: (code: string, filePath: string, options?: BuildOptions) => Promise<string | undefined>;
7
+ //#endregion
8
+ export { ESBuildPlugin, transpileTSToCJS, transpileTSToCJSSync };
9
+ //# sourceMappingURL=transpileTSToCJS.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transpileTSToMJS.d.ts","names":[],"sources":["../../../src/loadExternalFile/transpileTSToMJS.ts"],"sourcesContent":[],"mappings":";;;KAaY,aAAA,GAAgB;cAoCf,iEAGD;AAvCA,cA4DC,gBA5De,EAAM,CAAA,IAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EA+DtB,YA/DsB,EAAA,GAgE/B,OAhE+B,CAAA,MAAA,GAAA,SAAA,CAAA"}
1
+ {"version":3,"file":"transpileTSToCJS.d.ts","names":[],"sources":["../../../src/loadExternalFile/transpileTSToCJS.ts"],"sourcesContent":[],"mappings":";;;KAaY,aAAA,GAAgB;cAoCf,iEAGD;AAvCA,cA4DC,gBA5De,EAAM,CAAA,IAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EA+DtB,YA/DsB,EAAA,GAgE/B,OAhE+B,CAAA,MAAA,GAAA,SAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/config",
3
- "version": "7.5.12",
3
+ "version": "7.5.14",
4
4
  "private": false,
5
5
  "description": "Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.",
6
6
  "keywords": [
@@ -96,23 +96,24 @@
96
96
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
97
97
  },
98
98
  "dependencies": {
99
- "@intlayer/types": "7.5.12",
99
+ "@intlayer/types": "7.5.14",
100
100
  "defu": "6.1.4",
101
101
  "dotenv": "16.6.1",
102
- "esbuild": "0.27.2"
102
+ "esbuild": "0.27.2",
103
+ "json5": "^2.2.3"
103
104
  },
104
105
  "devDependencies": {
105
- "@types/node": "25.0.3",
106
+ "@types/node": "25.0.6",
106
107
  "@utils/ts-config": "1.0.4",
107
108
  "@utils/ts-config-types": "1.0.4",
108
109
  "@utils/tsdown-config": "1.0.4",
109
110
  "rimraf": "6.1.2",
110
- "tsdown": "0.18.2",
111
+ "tsdown": "0.19.0",
111
112
  "typescript": "5.9.3",
112
- "vitest": "4.0.16"
113
+ "vitest": "4.0.17"
113
114
  },
114
115
  "peerDependencies": {
115
- "intlayer": "7.5.12",
116
+ "intlayer": "7.5.14",
116
117
  "react": ">=16.0.0"
117
118
  },
118
119
  "peerDependenciesMeta": {
@@ -1,9 +0,0 @@
1
- import { BuildOptions, Plugin } from "esbuild";
2
-
3
- //#region src/loadExternalFile/transpileTSToMJS.d.ts
4
- type ESBuildPlugin = Plugin;
5
- declare const transpileTSToMJSSync: (code: string, filePath: string, options?: BuildOptions) => string | undefined;
6
- declare const transpileTSToMJS: (code: string, filePath: string, options?: BuildOptions) => Promise<string | undefined>;
7
- //#endregion
8
- export { ESBuildPlugin, transpileTSToMJS, transpileTSToMJSSync };
9
- //# sourceMappingURL=transpileTSToMJS.d.ts.map