@intlayer/chokidar 7.0.3-canary.1 → 7.0.4-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/cjs/cleanOutputDir.cjs +3 -3
  2. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  3. package/dist/cjs/createType/createType.cjs +1 -1
  4. package/dist/cjs/createType/createType.cjs.map +1 -1
  5. package/dist/cjs/fetchDistantDictionaries.cjs +2 -2
  6. package/dist/cjs/index.cjs +4 -2
  7. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +1 -1
  8. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
  9. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +1 -1
  10. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  11. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +12 -12
  12. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  13. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +2 -2
  14. package/dist/cjs/loadDictionaries/log.cjs +14 -12
  15. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  16. package/dist/cjs/utils/runParallel/bin.cjs +55 -0
  17. package/dist/cjs/utils/runParallel/bin.cjs.map +1 -0
  18. package/dist/cjs/utils/runParallel/bootstrap.cjs +24 -0
  19. package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -0
  20. package/dist/cjs/utils/runParallel/index.cjs +111 -0
  21. package/dist/cjs/utils/runParallel/index.cjs.map +1 -0
  22. package/dist/cjs/utils/runParallel/pidTree.cjs +145 -0
  23. package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -0
  24. package/dist/cjs/utils/runParallel/ps.cjs +49 -0
  25. package/dist/cjs/utils/runParallel/ps.cjs.map +1 -0
  26. package/dist/cjs/utils/runParallel/runTask.cjs +155 -0
  27. package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -0
  28. package/dist/cjs/utils/runParallel/spawnPosix.cjs +60 -0
  29. package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -0
  30. package/dist/cjs/utils/runParallel/spawnWin32.cjs +44 -0
  31. package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -0
  32. package/dist/cjs/utils/runParallel/wmic.cjs +52 -0
  33. package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -0
  34. package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs +4 -3
  35. package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs.map +1 -1
  36. package/dist/esm/cleanOutputDir.mjs +1 -1
  37. package/dist/esm/cleanOutputDir.mjs.map +1 -1
  38. package/dist/esm/createType/createType.mjs +2 -2
  39. package/dist/esm/createType/createType.mjs.map +1 -1
  40. package/dist/esm/fetchDistantDictionaries.mjs +1 -1
  41. package/dist/esm/index.mjs +3 -2
  42. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +2 -2
  43. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
  44. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +2 -2
  45. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  46. package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
  47. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  48. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +1 -1
  49. package/dist/esm/loadDictionaries/log.mjs +3 -2
  50. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  51. package/dist/esm/utils/runParallel/bin.mjs +53 -0
  52. package/dist/esm/utils/runParallel/bin.mjs.map +1 -0
  53. package/dist/esm/utils/runParallel/bootstrap.mjs +23 -0
  54. package/dist/esm/utils/runParallel/bootstrap.mjs.map +1 -0
  55. package/dist/esm/utils/runParallel/index.mjs +109 -0
  56. package/dist/esm/utils/runParallel/index.mjs.map +1 -0
  57. package/dist/esm/utils/runParallel/pidTree.mjs +143 -0
  58. package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -0
  59. package/dist/esm/utils/runParallel/ps.mjs +47 -0
  60. package/dist/esm/utils/runParallel/ps.mjs.map +1 -0
  61. package/dist/esm/utils/runParallel/runTask.mjs +153 -0
  62. package/dist/esm/utils/runParallel/runTask.mjs.map +1 -0
  63. package/dist/esm/utils/runParallel/spawnPosix.mjs +58 -0
  64. package/dist/esm/utils/runParallel/spawnPosix.mjs.map +1 -0
  65. package/dist/esm/utils/runParallel/spawnWin32.mjs +42 -0
  66. package/dist/esm/utils/runParallel/spawnWin32.mjs.map +1 -0
  67. package/dist/esm/utils/runParallel/wmic.mjs +50 -0
  68. package/dist/esm/utils/runParallel/wmic.mjs.map +1 -0
  69. package/dist/esm/writeContentDeclaration/detectFormatCommand.mjs +5 -4
  70. package/dist/esm/writeContentDeclaration/detectFormatCommand.mjs.map +1 -1
  71. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +3 -3
  72. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +3 -3
  73. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +2 -2
  74. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +2 -2
  75. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +2 -2
  76. package/dist/types/index.d.ts +3 -2
  77. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
  78. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
  79. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +2 -2
  80. package/dist/types/loadDictionaries/log.d.ts.map +1 -1
  81. package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -1
  82. package/dist/types/utils/runParallel/bin.d.ts +15 -0
  83. package/dist/types/utils/runParallel/bin.d.ts.map +1 -0
  84. package/dist/types/utils/runParallel/bootstrap.d.ts +5 -0
  85. package/dist/types/utils/runParallel/bootstrap.d.ts.map +1 -0
  86. package/dist/types/utils/runParallel/index.d.ts +14 -0
  87. package/dist/types/utils/runParallel/index.d.ts.map +1 -0
  88. package/dist/types/utils/runParallel/pidTree.d.ts +24 -0
  89. package/dist/types/utils/runParallel/pidTree.d.ts.map +1 -0
  90. package/dist/types/utils/runParallel/ps.d.ts +11 -0
  91. package/dist/types/utils/runParallel/ps.d.ts.map +1 -0
  92. package/dist/types/utils/runParallel/runTask.d.ts +26 -0
  93. package/dist/types/utils/runParallel/runTask.d.ts.map +1 -0
  94. package/dist/types/utils/runParallel/spawnPosix.d.ts +21 -0
  95. package/dist/types/utils/runParallel/spawnPosix.d.ts.map +1 -0
  96. package/dist/types/utils/runParallel/spawnWin32.d.ts +21 -0
  97. package/dist/types/utils/runParallel/spawnWin32.d.ts.map +1 -0
  98. package/dist/types/utils/runParallel/wmic.d.ts +11 -0
  99. package/dist/types/utils/runParallel/wmic.d.ts.map +1 -0
  100. package/package.json +21 -21
@@ -1,13 +1,13 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
  let node_fs = require("node:fs");
3
3
  node_fs = require_rolldown_runtime.__toESM(node_fs);
4
- let __intlayer_config = require("@intlayer/config");
5
- __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
4
+ let __intlayer_config_client = require("@intlayer/config/client");
5
+ __intlayer_config_client = require_rolldown_runtime.__toESM(__intlayer_config_client);
6
6
 
7
7
  //#region src/cleanOutputDir.ts
8
8
  const cleanOutputDir = (configuration) => {
9
9
  const { dictionariesDir, unmergedDictionariesDir, dynamicDictionariesDir, mainDir, typesDir, configDir } = configuration.content;
10
- const appLogger = (0, __intlayer_config.getAppLogger)(configuration);
10
+ const appLogger = (0, __intlayer_config_client.getAppLogger)(configuration);
11
11
  if ((0, node_fs.existsSync)(dictionariesDir)) (0, node_fs.rmSync)(dictionariesDir, { recursive: true });
12
12
  if ((0, node_fs.existsSync)(unmergedDictionariesDir)) (0, node_fs.rmSync)(unmergedDictionariesDir, { recursive: true });
13
13
  if ((0, node_fs.existsSync)(dynamicDictionariesDir)) (0, node_fs.rmSync)(dynamicDictionariesDir, { recursive: true });
@@ -1 +1 @@
1
- {"version":3,"file":"cleanOutputDir.cjs","names":[],"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { existsSync, rmSync } from 'node:fs';\nimport { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const cleanOutputDir = (configuration: IntlayerConfig) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n } = configuration.content;\n\n const appLogger = getAppLogger(configuration);\n\n if (existsSync(dictionariesDir)) {\n // Delete the dictionary directory\n rmSync(dictionariesDir, { recursive: true });\n }\n\n if (existsSync(unmergedDictionariesDir)) {\n // Delete the unmerged dictionaries directory\n rmSync(unmergedDictionariesDir, { recursive: true });\n }\n\n if (existsSync(dynamicDictionariesDir)) {\n // Delete the dynamic dictionaries directory\n rmSync(dynamicDictionariesDir, { recursive: true });\n }\n\n // Delete the main directory\n if (existsSync(mainDir)) {\n rmSync(mainDir, { recursive: true });\n }\n\n // Delete the types directory\n if (existsSync(typesDir)) {\n rmSync(typesDir, { recursive: true });\n }\n\n // Delete the config directory\n if (existsSync(configDir)) {\n rmSync(configDir, { recursive: true });\n }\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":";;;;;;;AAIA,MAAa,kBAAkB,kBAAkC;CAC/D,MAAM,EACJ,iBACA,yBACA,wBACA,SACA,UACA,cACE,cAAc;CAElB,MAAM,gDAAyB,cAAc;AAE7C,6BAAe,gBAAgB,CAE7B,qBAAO,iBAAiB,EAAE,WAAW,MAAM,CAAC;AAG9C,6BAAe,wBAAwB,CAErC,qBAAO,yBAAyB,EAAE,WAAW,MAAM,CAAC;AAGtD,6BAAe,uBAAuB,CAEpC,qBAAO,wBAAwB,EAAE,WAAW,MAAM,CAAC;AAIrD,6BAAe,QAAQ,CACrB,qBAAO,SAAS,EAAE,WAAW,MAAM,CAAC;AAItC,6BAAe,SAAS,CACtB,qBAAO,UAAU,EAAE,WAAW,MAAM,CAAC;AAIvC,6BAAe,UAAU,CACvB,qBAAO,WAAW,EAAE,WAAW,MAAM,CAAC;AAGxC,WAAU,4BAA4B,EACpC,WAAW,MACZ,CAAC"}
1
+ {"version":3,"file":"cleanOutputDir.cjs","names":[],"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { existsSync, rmSync } from 'node:fs';\nimport { getAppLogger } from '@intlayer/config/client';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const cleanOutputDir = (configuration: IntlayerConfig) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n } = configuration.content;\n\n const appLogger = getAppLogger(configuration);\n\n if (existsSync(dictionariesDir)) {\n // Delete the dictionary directory\n rmSync(dictionariesDir, { recursive: true });\n }\n\n if (existsSync(unmergedDictionariesDir)) {\n // Delete the unmerged dictionaries directory\n rmSync(unmergedDictionariesDir, { recursive: true });\n }\n\n if (existsSync(dynamicDictionariesDir)) {\n // Delete the dynamic dictionaries directory\n rmSync(dynamicDictionariesDir, { recursive: true });\n }\n\n // Delete the main directory\n if (existsSync(mainDir)) {\n rmSync(mainDir, { recursive: true });\n }\n\n // Delete the types directory\n if (existsSync(typesDir)) {\n rmSync(typesDir, { recursive: true });\n }\n\n // Delete the config directory\n if (existsSync(configDir)) {\n rmSync(configDir, { recursive: true });\n }\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":";;;;;;;AAIA,MAAa,kBAAkB,kBAAkC;CAC/D,MAAM,EACJ,iBACA,yBACA,wBACA,SACA,UACA,cACE,cAAc;CAElB,MAAM,uDAAyB,cAAc;AAE7C,6BAAe,gBAAgB,CAE7B,qBAAO,iBAAiB,EAAE,WAAW,MAAM,CAAC;AAG9C,6BAAe,wBAAwB,CAErC,qBAAO,yBAAyB,EAAE,WAAW,MAAM,CAAC;AAGtD,6BAAe,uBAAuB,CAEpC,qBAAO,wBAAwB,EAAE,WAAW,MAAM,CAAC;AAIrD,6BAAe,QAAQ,CACrB,qBAAO,SAAS,EAAE,WAAW,MAAM,CAAC;AAItC,6BAAe,SAAS,CACtB,qBAAO,UAAU,EAAE,WAAW,MAAM,CAAC;AAIvC,6BAAe,UAAU,CACvB,qBAAO,WAAW,EAAE,WAAW,MAAM,CAAC;AAGxC,WAAU,4BAA4B,EACpC,WAAW,MACZ,CAAC"}
@@ -19,7 +19,7 @@ const createTypes = async (dictionariesPaths, configuration) => {
19
19
  const { typesDir } = content;
20
20
  await (0, node_fs_promises.mkdir)(typesDir, { recursive: true });
21
21
  return (await require_utils_parallelize.parallelize(dictionariesPaths, async (dictionaryPath) => {
22
- const requireFunction = build.require ?? __intlayer_config.ESMxCJSRequire;
22
+ const requireFunction = build.require ?? (0, __intlayer_config.getProjectRequire)();
23
23
  (0, __intlayer_config.clearModuleCache)(dictionaryPath);
24
24
  const dictionary = requireFunction(dictionaryPath);
25
25
  if (!dictionary.key) return;
@@ -1 +1 @@
1
- {"version":3,"file":"createType.cjs","names":["parallelize","ESMxCJSRequire","dictionary: Dictionary","typeDefinition: string","outputPath: string"],"sources":["../../../src/createType/createType.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { clearModuleCache, ESMxCJSRequire } from '@intlayer/config';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { parallelize } from '../utils/parallelize';\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2);\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = async (\n dictionariesPaths: string[],\n configuration: IntlayerConfig\n): Promise<string[]> => {\n const { build, content } = configuration;\n const { typesDir } = content;\n\n // Create type folders if they don't exist\n await mkdir(typesDir, { recursive: true });\n\n const results = await parallelize(\n dictionariesPaths,\n async (dictionaryPath): Promise<string | undefined> => {\n const requireFunction = build.require ?? ESMxCJSRequire;\n clearModuleCache(dictionaryPath);\n\n const dictionary: Dictionary = requireFunction(dictionaryPath);\n\n if (!dictionary.key) {\n return undefined;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n await writeFile(outputPath, typeDefinition);\n\n return outputPath;\n }\n );\n\n return results.filter(Boolean) as string[];\n};\n"],"mappings":";;;;;;;;;;AAMA,MAAa,0BAA0B,eAA2B;AAGhE,QAAO,wCAFY,KAAK,UAAU,YAAY,MAAM,EAAE,CAEI;;;;;AAK5D,MAAa,cAAc,OACzB,mBACA,kBACsB;CACtB,MAAM,EAAE,OAAO,YAAY;CAC3B,MAAM,EAAE,aAAa;AAGrB,mCAAY,UAAU,EAAE,WAAW,MAAM,CAAC;AAwB1C,SAtBgB,MAAMA,sCACpB,mBACA,OAAO,mBAAgD;EACrD,MAAM,kBAAkB,MAAM,WAAWC;AACzC,0CAAiB,eAAe;EAEhC,MAAMC,aAAyB,gBAAgB,eAAe;AAE9D,MAAI,CAAC,WAAW,IACd;EAGF,MAAMC,iBAAyB,uBAAuB,WAAW;EAEjE,MAAMC,oCAA6B,UAAU,GAAG,WAAW,IAAI,KAAK;AAEpE,wCAAgB,YAAY,eAAe;AAE3C,SAAO;GAEV,EAEc,OAAO,QAAQ"}
1
+ {"version":3,"file":"createType.cjs","names":["parallelize","dictionary: Dictionary","typeDefinition: string","outputPath: string"],"sources":["../../../src/createType/createType.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { clearModuleCache, getProjectRequire } from '@intlayer/config';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { parallelize } from '../utils/parallelize';\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2);\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = async (\n dictionariesPaths: string[],\n configuration: IntlayerConfig\n): Promise<string[]> => {\n const { build, content } = configuration;\n const { typesDir } = content;\n\n // Create type folders if they don't exist\n await mkdir(typesDir, { recursive: true });\n\n const results = await parallelize(\n dictionariesPaths,\n async (dictionaryPath): Promise<string | undefined> => {\n const requireFunction = build.require ?? getProjectRequire();\n clearModuleCache(dictionaryPath);\n\n const dictionary: Dictionary = requireFunction(dictionaryPath);\n\n if (!dictionary.key) {\n return undefined;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n await writeFile(outputPath, typeDefinition);\n\n return outputPath;\n }\n );\n\n return results.filter(Boolean) as string[];\n};\n"],"mappings":";;;;;;;;;;AAMA,MAAa,0BAA0B,eAA2B;AAGhE,QAAO,wCAFY,KAAK,UAAU,YAAY,MAAM,EAAE,CAEI;;;;;AAK5D,MAAa,cAAc,OACzB,mBACA,kBACsB;CACtB,MAAM,EAAE,OAAO,YAAY;CAC3B,MAAM,EAAE,aAAa;AAGrB,mCAAY,UAAU,EAAE,WAAW,MAAM,CAAC;AAwB1C,SAtBgB,MAAMA,sCACpB,mBACA,OAAO,mBAAgD;EACrD,MAAM,kBAAkB,MAAM,qDAA8B;AAC5D,0CAAiB,eAAe;EAEhC,MAAMC,aAAyB,gBAAgB,eAAe;AAE9D,MAAI,CAAC,WAAW,IACd;EAGF,MAAMC,iBAAyB,uBAAuB,WAAW;EAEjE,MAAMC,oCAA6B,UAAU,GAAG,WAAW,IAAI,KAAK;AAEpE,wCAAgB,YAAY,eAAe;AAE3C,SAAO;GAEV,EAEc,OAAO,QAAQ"}
@@ -1,9 +1,9 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
  const require_utils_parallelize = require('./utils/parallelize.cjs');
3
- let __intlayer_config = require("@intlayer/config");
4
- __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
5
3
  let __intlayer_api = require("@intlayer/api");
6
4
  __intlayer_api = require_rolldown_runtime.__toESM(__intlayer_api);
5
+ let __intlayer_config = require("@intlayer/config");
6
+ __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
7
7
 
8
8
  //#region src/fetchDistantDictionaries.ts
9
9
  /**
@@ -37,12 +37,13 @@ const require_utils_chunkJSON = require('./utils/chunkJSON.cjs');
37
37
  const require_utils_getFormatFromExtension = require('./utils/getFormatFromExtension.cjs');
38
38
  const require_utils_parallelizeGlobal = require('./utils/parallelizeGlobal.cjs');
39
39
  const require_utils_reduceObjectFormat = require('./utils/reduceObjectFormat.cjs');
40
- const require_utils_runParallel = require('./utils/runParallel.cjs');
40
+ const require_utils_runParallel_index = require('./utils/runParallel/index.cjs');
41
41
  const require_utils_verifyIdenticObjectFormat = require('./utils/verifyIdenticObjectFormat.cjs');
42
42
  const require_watcher = require('./watcher.cjs');
43
43
  const require_writeContentDeclaration_detectExportedComponentName = require('./writeContentDeclaration/detectExportedComponentName.cjs');
44
44
  const require_writeContentDeclaration_transformJSFile = require('./writeContentDeclaration/transformJSFile.cjs');
45
45
  const require_writeContentDeclaration_processContentDeclarationContent = require('./writeContentDeclaration/processContentDeclarationContent.cjs');
46
+ const require_writeContentDeclaration_detectFormatCommand = require('./writeContentDeclaration/detectFormatCommand.cjs');
46
47
  const require_writeContentDeclaration_writeJSFile = require('./writeContentDeclaration/writeJSFile.cjs');
47
48
  const require_writeContentDeclaration_writeContentDeclaration = require('./writeContentDeclaration/writeContentDeclaration.cjs');
48
49
 
@@ -55,6 +56,7 @@ exports.createDictionaryEntryPoint = require_createDictionaryEntryPoint_createDi
55
56
  exports.createModuleAugmentation = require_createType_createModuleAugmentation.createModuleAugmentation;
56
57
  exports.createTypes = require_createType_createType.createTypes;
57
58
  exports.detectExportedComponentName = require_writeContentDeclaration_detectExportedComponentName.detectExportedComponentName;
59
+ exports.detectFormatCommand = require_writeContentDeclaration_detectFormatCommand.detectFormatCommand;
58
60
  exports.fetchDistantDictionaries = require_fetchDistantDictionaries.fetchDistantDictionaries;
59
61
  exports.formatLocale = require_utils_formatter.formatLocale;
60
62
  exports.formatPath = require_utils_formatter.formatPath;
@@ -93,7 +95,7 @@ exports.reduceDictionaryContent = require_reduceDictionaryContent_reduceDictiona
93
95
  exports.reduceObjectFormat = require_utils_reduceObjectFormat.reduceObjectFormat;
94
96
  exports.resolveObjectPromises = require_utils_resolveObjectPromises.resolveObjectPromises;
95
97
  exports.runOnce = require_utils_runOnce.runOnce;
96
- exports.runParallel = require_utils_runParallel.runParallel;
98
+ exports.runParallel = require_utils_runParallel_index.runParallel;
97
99
  exports.sortAlphabetically = require_utils_sortAlphabetically.sortAlphabetically;
98
100
  exports.splitTextByLines = require_utils_splitTextByLine.splitTextByLines;
99
101
  exports.transformJSFile = require_writeContentDeclaration_transformJSFile.transformJSFile;
@@ -45,7 +45,7 @@ const rewritePathsPlugin = (replaceModules, excludeModules) => {
45
45
  * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.
46
46
  */
47
47
  const getIntlayerBundle = async (configuration) => {
48
- const rootRequire = __intlayer_config.ESMxCJSRequire;
48
+ const rootRequire = (0, __intlayer_config.getProjectRequire)(configuration.content.baseDir);
49
49
  const configPackageRequire = __intlayer_config.configESMxCJSRequire;
50
50
  const localRequire = __intlayer_config.isESModule ? (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href) : require;
51
51
  const configurationPath = (0, node_path.join)(configuration.content.configDir, `configuration.json`);
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayerBundle.cjs","names":["ESMxCJSRequire","configESMxCJSRequire","isESModule","builtinModules"],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport type { ESBuildPlugin } from '@intlayer/config';\nimport {\n bundleFile,\n configESMxCJSRequire,\n ESMxCJSRequire,\n isESModule,\n} from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = ESMxCJSRequire;\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.content.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n deepmerge: localRequire.resolve('deepmerge'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config': localRequire.resolve('@intlayer/config'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,MAAM,sBACJ,gBACA,mBACkB;AAClB,QAAO;EACL,MAAM;EACN,MAAM,OAAO;AACX,SAAM,UAAU,EAAE,QAAQ,MAAM,GAAG,SAAS;IAC1C,MAAM,QAAQ,eAAe,KAAK;AAElC,QAAI,gBAAgB,SAAS,KAAK,KAAK,CACrC,QAAO;AAGT,QAAI,MACF,QAAO;KACL,MAAM;KACN,WAAW;KACX,UAAU;KACX;AAIH,SAAK,MAAM,OAAO,OAAO,KAAK,eAAe,CAC3C,KAAI,KAAK,SAAS,OAAO,KAAK,KAAK,WAAW,GAAG,IAAI,GAAG,EAAE;KACxD,MAAM,MAAM,KAAK,KAAK,MAAM,IAAI,OAAO;AACvC,YAAO;MACL,MAAM,eAAe,OAAO;MAC5B,WAAW;MACX,UAAU;MACX;;KAGL;;EAEL;;;;;AAMH,MAAa,oBAAoB,OAAO,kBAAkC;CACxE,MAAM,cAAcA;CACpB,MAAM,uBAAuBC;CAC7B,MAAM,eAAeC,4GAA2C,GAAG;CAEnE,MAAM,wCACJ,cAAc,QAAQ,WACtB,qBACD;CAED,MAAM,iBAAiB;EACrB,WAAW,aAAa,QAAQ,YAAY;EAC5C,SAAS,qBAAqB,QAAQ,UAAU;EAChD,0BAA0B;EAC1B,oBAAoB,aAAa,QAAQ,mBAAmB;EAC5D,2BAA2B,aAAa,QAAQ,0BAA0B;EAC1E,uBAAuB,aAAa,QAAQ,sBAAsB;EACnE;CAED,MAAM,WAAW,YAAY,QAAQ,WAAW;AAYhD,QATe,wCAFF,qCAAe,UAAU,QAAQ,EAER,UAAU;EAC9C,UAAU,CACR,GAAGC,4BACH,GAAGA,2BAAe,KAAK,QAAQ,QAAQ,MAAM,CAC9C;EACD,QAAQ;EACR,SAAS,CAAC,mBAAmB,eAAe,CAAC;EAC9C,CAAC,IAEe"}
1
+ {"version":3,"file":"getIntlayerBundle.cjs","names":["configESMxCJSRequire","isESModule","builtinModules"],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport type { ESBuildPlugin } from '@intlayer/config';\nimport {\n bundleFile,\n configESMxCJSRequire,\n getProjectRequire,\n isESModule,\n} from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = getProjectRequire(configuration.content.baseDir);\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.content.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n deepmerge: localRequire.resolve('deepmerge'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config': localRequire.resolve('@intlayer/config'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,MAAM,sBACJ,gBACA,mBACkB;AAClB,QAAO;EACL,MAAM;EACN,MAAM,OAAO;AACX,SAAM,UAAU,EAAE,QAAQ,MAAM,GAAG,SAAS;IAC1C,MAAM,QAAQ,eAAe,KAAK;AAElC,QAAI,gBAAgB,SAAS,KAAK,KAAK,CACrC,QAAO;AAGT,QAAI,MACF,QAAO;KACL,MAAM;KACN,WAAW;KACX,UAAU;KACX;AAIH,SAAK,MAAM,OAAO,OAAO,KAAK,eAAe,CAC3C,KAAI,KAAK,SAAS,OAAO,KAAK,KAAK,WAAW,GAAG,IAAI,GAAG,EAAE;KACxD,MAAM,MAAM,KAAK,KAAK,MAAM,IAAI,OAAO;AACvC,YAAO;MACL,MAAM,eAAe,OAAO;MAC5B,WAAW;MACX,UAAU;MACX;;KAGL;;EAEL;;;;;AAMH,MAAa,oBAAoB,OAAO,kBAAkC;CACxE,MAAM,uDAAgC,cAAc,QAAQ,QAAQ;CACpE,MAAM,uBAAuBA;CAC7B,MAAM,eAAeC,4GAA2C,GAAG;CAEnE,MAAM,wCACJ,cAAc,QAAQ,WACtB,qBACD;CAED,MAAM,iBAAiB;EACrB,WAAW,aAAa,QAAQ,YAAY;EAC5C,SAAS,qBAAqB,QAAQ,UAAU;EAChD,0BAA0B;EAC1B,oBAAoB,aAAa,QAAQ,mBAAmB;EAC5D,2BAA2B,aAAa,QAAQ,0BAA0B;EAC1E,uBAAuB,aAAa,QAAQ,sBAAsB;EACnE;CAED,MAAM,WAAW,YAAY,QAAQ,WAAW;AAYhD,QATe,wCAFF,qCAAe,UAAU,QAAQ,EAER,UAAU;EAC9C,UAAU,CACR,GAAGC,4BACH,GAAGA,2BAAe,KAAK,QAAQ,QAAQ,MAAM,CAC9C;EACD,QAAQ;EACR,SAAS,CAAC,mBAAmB,eAAe,CAAC;EAC9C,CAAC,IAEe"}
@@ -30,7 +30,7 @@ const loadContentDeclarations = async (contentDeclarationFilePath, configuration
30
30
  return {
31
31
  relativePath: (0, node_path.relative)(configuration.content.baseDir, path),
32
32
  dictionary: await (0, __intlayer_config.loadExternalFile)(path, {
33
- projectRequire: build.require,
33
+ projectRequire: build.require ?? (0, __intlayer_config.getProjectRequire)(),
34
34
  buildOptions: { banner: { js: [`globalThis.INTLAYER_FILE_PATH = '${path}';`, `globalThis.INTLAYER_BASE_DIR = '${configuration.content.baseDir}';`].join("\n") } },
35
35
  aliases: { intlayer: filePath }
36
36
  })
@@ -1 +1 @@
1
- {"version":3,"file":"loadContentDeclaration.cjs","names":["isInvalidDictionary","getIntlayerBundle","contentDeclarations: Dictionary[]","filterInvalidDictionaries","parallelize","processContentDeclaration"],"sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport { loadExternalFile, localCache } from '@intlayer/config';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { processContentDeclaration } from '../buildIntlayerDictionary/processContentDeclaration';\nimport {\n filterInvalidDictionaries,\n isInvalidDictionary,\n} from '../filterInvalidDictionaries';\nimport { parallelize } from '../utils/parallelize';\nimport { getIntlayerBundle } from './getIntlayerBundle';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport const formatLocalDictionaries = (\n dictionariesRecord: Record<string, Dictionary>,\n configuration: IntlayerConfig\n): Dictionary[] =>\n Object.entries(dictionariesRecord)\n .filter(([_relativePath, dict]) => isInvalidDictionary(dict, configuration))\n .map(([relativePath, dict]) => ({\n ...dict,\n localId: `${dict.key}::local::${relativePath}`,\n location: 'local' as const,\n filePath: relativePath,\n }));\n\nexport const loadContentDeclarations = async (\n contentDeclarationFilePath: string[],\n configuration: IntlayerConfig,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<Dictionary[]> => {\n const { build, content } = configuration;\n\n const { set, isValid } = localCache(configuration, ['intlayer-bundle'], {\n ttlMs: 1000 * 60 * 60 * 24 * 5, // 5 days\n });\n\n const filePath = join(content.cacheDir, 'intlayer-bundle.cjs');\n const hasIntlayerBundle = await isValid();\n\n // If cache is invalid, write the intlayer bundle to the cache\n if (!hasIntlayerBundle) {\n const intlayerBundle = await getIntlayerBundle(configuration);\n await writeFile(filePath, intlayerBundle);\n await set('ok');\n }\n\n try {\n const dictionariesPromises = contentDeclarationFilePath.map(\n async (path) => {\n const relativePath = relative(configuration.content.baseDir, path);\n\n const dictionary = await loadExternalFile(path, {\n projectRequire: build.require,\n buildOptions: {\n banner: {\n js: [\n `globalThis.INTLAYER_FILE_PATH = '${path}';`,\n `globalThis.INTLAYER_BASE_DIR = '${configuration.content.baseDir}';`,\n ].join('\\n'),\n },\n },\n aliases: {\n intlayer: filePath,\n },\n });\n\n return { relativePath, dictionary };\n }\n );\n\n const dictionariesArray = await Promise.all(dictionariesPromises);\n const dictionariesRecord = dictionariesArray.reduce(\n (acc, { relativePath, dictionary }) => {\n acc[relativePath] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n );\n\n const contentDeclarations: Dictionary[] = formatLocalDictionaries(\n dictionariesRecord,\n configuration\n );\n\n const listFoundDictionaries = contentDeclarations.map((declaration) => ({\n dictionaryKey: declaration.key,\n type: 'local' as const,\n status: 'found' as const,\n }));\n\n onStatusUpdate?.(listFoundDictionaries);\n\n const processedDictionaries = await parallelize(\n contentDeclarations,\n async (contentDeclaration): Promise<Dictionary | undefined> => {\n if (!contentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: contentDeclaration.key,\n type: 'local',\n status: 'building',\n },\n ]);\n\n const processedContentDeclaration = await processContentDeclaration(\n contentDeclaration as Dictionary\n );\n\n if (!processedContentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: processedContentDeclaration.key,\n type: 'local',\n status: 'built',\n },\n ]);\n\n return processedContentDeclaration;\n }\n );\n\n return filterInvalidDictionaries(processedDictionaries, configuration);\n } finally {\n // await rm(tempFilePath, { recursive: true });\n }\n};\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,2BACX,oBACA,kBAEA,OAAO,QAAQ,mBAAmB,CAC/B,QAAQ,CAAC,eAAe,UAAUA,sDAAoB,MAAM,cAAc,CAAC,CAC3E,KAAK,CAAC,cAAc,WAAW;CAC9B,GAAG;CACH,SAAS,GAAG,KAAK,IAAI,WAAW;CAChC,UAAU;CACV,UAAU;CACX,EAAE;AAEP,MAAa,0BAA0B,OACrC,4BACA,eACA,mBAC0B;CAC1B,MAAM,EAAE,OAAO,YAAY;CAE3B,MAAM,EAAE,KAAK,8CAAuB,eAAe,CAAC,kBAAkB,EAAE,EACtE,OAAO,MAAO,KAAK,KAAK,KAAK,GAC9B,CAAC;CAEF,MAAM,+BAAgB,QAAQ,UAAU,sBAAsB;AAI9D,KAAI,CAHsB,MAAM,SAAS,EAGjB;AAEtB,wCAAgB,UADO,MAAMC,6DAAkB,cAAc,CACpB;AACzC,QAAM,IAAI,KAAK;;AAGjB,KAAI;EACF,MAAM,uBAAuB,2BAA2B,IACtD,OAAO,SAAS;AAkBd,UAAO;IAAE,sCAjBqB,cAAc,QAAQ,SAAS,KAAK;IAiB3C,YAfJ,8CAAuB,MAAM;KAC9C,gBAAgB,MAAM;KACtB,cAAc,EACZ,QAAQ,EACN,IAAI,CACF,oCAAoC,KAAK,KACzC,mCAAmC,cAAc,QAAQ,QAAQ,IAClE,CAAC,KAAK,KAAK,EACb,EACF;KACD,SAAS,EACP,UAAU,UACX;KACF,CAAC;IAEiC;IAEtC;EAWD,MAAMC,sBAAoC,yBAThB,MAAM,QAAQ,IAAI,qBAAqB,EACpB,QAC1C,KAAK,EAAE,cAAc,iBAAiB;AACrC,OAAI,gBAAgB;AACpB,UAAO;KAET,EAAE,CACH,EAIC,cACD;EAED,MAAM,wBAAwB,oBAAoB,KAAK,iBAAiB;GACtE,eAAe,YAAY;GAC3B,MAAM;GACN,QAAQ;GACT,EAAE;AAEH,mBAAiB,sBAAsB;AAqCvC,SAAOC,4DAnCuB,MAAMC,sCAClC,qBACA,OAAO,uBAAwD;AAC7D,OAAI,CAAC,mBACH;AAGF,oBAAiB,CACf;IACE,eAAe,mBAAmB;IAClC,MAAM;IACN,QAAQ;IACT,CACF,CAAC;GAEF,MAAM,8BAA8B,MAAMC,oFACxC,mBACD;AAED,OAAI,CAAC,4BACH;AAGF,oBAAiB,CACf;IACE,eAAe,4BAA4B;IAC3C,MAAM;IACN,QAAQ;IACT,CACF,CAAC;AAEF,UAAO;IAEV,EAEuD,cAAc;WAC9D"}
1
+ {"version":3,"file":"loadContentDeclaration.cjs","names":["isInvalidDictionary","getIntlayerBundle","contentDeclarations: Dictionary[]","filterInvalidDictionaries","parallelize","processContentDeclaration"],"sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport {\n getProjectRequire,\n loadExternalFile,\n localCache,\n} from '@intlayer/config';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { processContentDeclaration } from '../buildIntlayerDictionary/processContentDeclaration';\nimport {\n filterInvalidDictionaries,\n isInvalidDictionary,\n} from '../filterInvalidDictionaries';\nimport { parallelize } from '../utils/parallelize';\nimport { getIntlayerBundle } from './getIntlayerBundle';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport const formatLocalDictionaries = (\n dictionariesRecord: Record<string, Dictionary>,\n configuration: IntlayerConfig\n): Dictionary[] =>\n Object.entries(dictionariesRecord)\n .filter(([_relativePath, dict]) => isInvalidDictionary(dict, configuration))\n .map(([relativePath, dict]) => ({\n ...dict,\n localId: `${dict.key}::local::${relativePath}`,\n location: 'local' as const,\n filePath: relativePath,\n }));\n\nexport const loadContentDeclarations = async (\n contentDeclarationFilePath: string[],\n configuration: IntlayerConfig,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<Dictionary[]> => {\n const { build, content } = configuration;\n\n const { set, isValid } = localCache(configuration, ['intlayer-bundle'], {\n ttlMs: 1000 * 60 * 60 * 24 * 5, // 5 days\n });\n\n const filePath = join(content.cacheDir, 'intlayer-bundle.cjs');\n const hasIntlayerBundle = await isValid();\n\n // If cache is invalid, write the intlayer bundle to the cache\n if (!hasIntlayerBundle) {\n const intlayerBundle = await getIntlayerBundle(configuration);\n await writeFile(filePath, intlayerBundle);\n await set('ok');\n }\n\n try {\n const dictionariesPromises = contentDeclarationFilePath.map(\n async (path) => {\n const relativePath = relative(configuration.content.baseDir, path);\n\n const dictionary = await loadExternalFile(path, {\n projectRequire: build.require ?? getProjectRequire(),\n buildOptions: {\n banner: {\n js: [\n `globalThis.INTLAYER_FILE_PATH = '${path}';`,\n `globalThis.INTLAYER_BASE_DIR = '${configuration.content.baseDir}';`,\n ].join('\\n'),\n },\n },\n aliases: {\n intlayer: filePath,\n },\n });\n\n return { relativePath, dictionary };\n }\n );\n\n const dictionariesArray = await Promise.all(dictionariesPromises);\n const dictionariesRecord = dictionariesArray.reduce(\n (acc, { relativePath, dictionary }) => {\n acc[relativePath] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n );\n\n const contentDeclarations: Dictionary[] = formatLocalDictionaries(\n dictionariesRecord,\n configuration\n );\n\n const listFoundDictionaries = contentDeclarations.map((declaration) => ({\n dictionaryKey: declaration.key,\n type: 'local' as const,\n status: 'found' as const,\n }));\n\n onStatusUpdate?.(listFoundDictionaries);\n\n const processedDictionaries = await parallelize(\n contentDeclarations,\n async (contentDeclaration): Promise<Dictionary | undefined> => {\n if (!contentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: contentDeclaration.key,\n type: 'local',\n status: 'building',\n },\n ]);\n\n const processedContentDeclaration = await processContentDeclaration(\n contentDeclaration as Dictionary\n );\n\n if (!processedContentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: processedContentDeclaration.key,\n type: 'local',\n status: 'built',\n },\n ]);\n\n return processedContentDeclaration;\n }\n );\n\n return filterInvalidDictionaries(processedDictionaries, configuration);\n } finally {\n // await rm(tempFilePath, { recursive: true });\n }\n};\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAa,2BACX,oBACA,kBAEA,OAAO,QAAQ,mBAAmB,CAC/B,QAAQ,CAAC,eAAe,UAAUA,sDAAoB,MAAM,cAAc,CAAC,CAC3E,KAAK,CAAC,cAAc,WAAW;CAC9B,GAAG;CACH,SAAS,GAAG,KAAK,IAAI,WAAW;CAChC,UAAU;CACV,UAAU;CACX,EAAE;AAEP,MAAa,0BAA0B,OACrC,4BACA,eACA,mBAC0B;CAC1B,MAAM,EAAE,OAAO,YAAY;CAE3B,MAAM,EAAE,KAAK,8CAAuB,eAAe,CAAC,kBAAkB,EAAE,EACtE,OAAO,MAAO,KAAK,KAAK,KAAK,GAC9B,CAAC;CAEF,MAAM,+BAAgB,QAAQ,UAAU,sBAAsB;AAI9D,KAAI,CAHsB,MAAM,SAAS,EAGjB;AAEtB,wCAAgB,UADO,MAAMC,6DAAkB,cAAc,CACpB;AACzC,QAAM,IAAI,KAAK;;AAGjB,KAAI;EACF,MAAM,uBAAuB,2BAA2B,IACtD,OAAO,SAAS;AAkBd,UAAO;IAAE,sCAjBqB,cAAc,QAAQ,SAAS,KAAK;IAiB3C,YAfJ,8CAAuB,MAAM;KAC9C,gBAAgB,MAAM,qDAA8B;KACpD,cAAc,EACZ,QAAQ,EACN,IAAI,CACF,oCAAoC,KAAK,KACzC,mCAAmC,cAAc,QAAQ,QAAQ,IAClE,CAAC,KAAK,KAAK,EACb,EACF;KACD,SAAS,EACP,UAAU,UACX;KACF,CAAC;IAEiC;IAEtC;EAWD,MAAMC,sBAAoC,yBAThB,MAAM,QAAQ,IAAI,qBAAqB,EACpB,QAC1C,KAAK,EAAE,cAAc,iBAAiB;AACrC,OAAI,gBAAgB;AACpB,UAAO;KAET,EAAE,CACH,EAIC,cACD;EAED,MAAM,wBAAwB,oBAAoB,KAAK,iBAAiB;GACtE,eAAe,YAAY;GAC3B,MAAM;GACN,QAAQ;GACT,EAAE;AAEH,mBAAiB,sBAAsB;AAqCvC,SAAOC,4DAnCuB,MAAMC,sCAClC,qBACA,OAAO,uBAAwD;AAC7D,OAAI,CAAC,mBACH;AAGF,oBAAiB,CACf;IACE,eAAe,mBAAmB;IAClC,MAAM;IACN,QAAQ;IACT,CACF,CAAC;GAEF,MAAM,8BAA8B,MAAMC,oFACxC,mBACD;AAED,OAAI,CAAC,4BACH;AAGF,oBAAiB,CACf;IACE,eAAe,4BAA4B;IAC3C,MAAM;IACN,QAAQ;IACT,CACF,CAAC;AAEF,UAAO;IAEV,EAEuD,cAAc;WAC9D"}
@@ -3,8 +3,8 @@ const require_filterInvalidDictionaries = require('../filterInvalidDictionaries.
3
3
  const require_loadDictionaries_loadContentDeclaration = require('./loadContentDeclaration.cjs');
4
4
  const require_loadDictionaries_loadRemoteDictionaries = require('./loadRemoteDictionaries.cjs');
5
5
  const require_loadDictionaries_log = require('./log.cjs');
6
- let __intlayer_config = require("@intlayer/config");
7
- __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
6
+ let __intlayer_config_client = require("@intlayer/config/client");
7
+ __intlayer_config_client = require_rolldown_runtime.__toESM(__intlayer_config_client);
8
8
 
9
9
  //#region src/loadDictionaries/loadDictionaries.ts
10
10
  let loadDictionariesStatus = [];
@@ -33,14 +33,14 @@ const colorFor = (status) => {
33
33
  switch (status) {
34
34
  case "built":
35
35
  case "imported":
36
- case "fetched": return __intlayer_config.ANSIColors.GREEN;
37
- case "error": return __intlayer_config.ANSIColors.RED;
38
- default: return __intlayer_config.ANSIColors.BLUE;
36
+ case "fetched": return __intlayer_config_client.ANSIColors.GREEN;
37
+ case "error": return __intlayer_config_client.ANSIColors.RED;
38
+ default: return __intlayer_config_client.ANSIColors.BLUE;
39
39
  }
40
40
  };
41
41
  const printSummary = (configuration) => {
42
42
  if (configuration.log.mode !== "verbose") return;
43
- const appLogger = (0, __intlayer_config.getAppLogger)(configuration);
43
+ const appLogger = (0, __intlayer_config_client.getAppLogger)(configuration);
44
44
  const byKey = /* @__PURE__ */ new Map();
45
45
  for (const s of loadDictionariesStatus) {
46
46
  const rec = byKey.get(s.dictionaryKey) ?? {};
@@ -61,23 +61,23 @@ const printSummary = (configuration) => {
61
61
  const rec = byKey.get(key);
62
62
  const labels = [];
63
63
  if (rec.local) {
64
- const inner = (0, __intlayer_config.colorize)(`${iconFor(rec.local)} ${rec.local}`, colorFor(rec.local));
65
- const coloredLocal = `${__intlayer_config.ANSIColors.GREY}[` + (0, __intlayer_config.colorize)("local: ", __intlayer_config.ANSIColors.GREY) + inner + `${__intlayer_config.ANSIColors.GREY}]${__intlayer_config.ANSIColors.RESET}`;
64
+ const inner = (0, __intlayer_config_client.colorize)(`${iconFor(rec.local)} ${rec.local}`, colorFor(rec.local));
65
+ const coloredLocal = `${__intlayer_config_client.ANSIColors.GREY}[` + (0, __intlayer_config_client.colorize)("local: ", __intlayer_config_client.ANSIColors.GREY) + inner + `${__intlayer_config_client.ANSIColors.GREY}]${__intlayer_config_client.ANSIColors.RESET}`;
66
66
  const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;
67
67
  const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);
68
68
  labels.push(coloredLocal + " ".repeat(pad));
69
69
  } else labels.push(" ".repeat(maxLocalLabelLen));
70
70
  if (rec.remote) {
71
- const inner = (0, __intlayer_config.colorize)(`${iconFor(rec.remote)} ${rec.remote}`, colorFor(rec.remote));
72
- labels.push(`${__intlayer_config.ANSIColors.GREY}[` + (0, __intlayer_config.colorize)("distant: ", __intlayer_config.ANSIColors.GREY) + inner + `${__intlayer_config.ANSIColors.GREY}]${__intlayer_config.ANSIColors.RESET}`);
71
+ const inner = (0, __intlayer_config_client.colorize)(`${iconFor(rec.remote)} ${rec.remote}`, colorFor(rec.remote));
72
+ labels.push(`${__intlayer_config_client.ANSIColors.GREY}[` + (0, __intlayer_config_client.colorize)("distant: ", __intlayer_config_client.ANSIColors.GREY) + inner + `${__intlayer_config_client.ANSIColors.GREY}]${__intlayer_config_client.ANSIColors.RESET}`);
73
73
  }
74
- appLogger(` - ${(0, __intlayer_config.colon)((0, __intlayer_config.colorizeKey)(key), { colSize: keys })} ${labels.join(" ")}`);
74
+ appLogger(` - ${(0, __intlayer_config_client.colon)((0, __intlayer_config_client.colorizeKey)(key), { colSize: keys })} ${labels.join(" ")}`);
75
75
  }
76
76
  };
77
77
  const loadDictionaries = async (contentDeclarationsPaths, configuration) => {
78
78
  const { plugins } = configuration;
79
79
  const loadDictionariesStartTime = Date.now();
80
- (0, __intlayer_config.getAppLogger)(configuration)("Dictionaries:", { isVerbose: true });
80
+ (0, __intlayer_config_client.getAppLogger)(configuration)("Dictionaries:", { isVerbose: true });
81
81
  const loadPluginDictionariesPromise = (plugins ?? []).map(async (plugin) => {
82
82
  try {
83
83
  return await plugin.loadDictionaries?.({ configuration }) ?? [];
@@ -1 +1 @@
1
- {"version":3,"file":"loadDictionaries.cjs","names":["loadDictionariesStatus: DictionariesStatus[]","DictionariesLogger","updated: DictionariesStatus[]","ANSIColors","labels: string[]","pluginDictionaries: Dictionary[]","localDictionaries: Dictionary[]","loadContentDeclarations","filterInvalidDictionaries","remoteDictionaries: Dictionary[]","loadRemoteDictionaries"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const s of loadDictionariesStatus) {\n const rec = byKey.get(s.dictionaryKey) ?? {};\n if (s.type === 'local') rec.local = s.status;\n if (s.type === 'remote') rec.remote = s.status;\n byKey.set(s.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const loadPluginDictionariesPromise = (plugins ?? []).map(async (plugin) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n return (res as Dictionary[] | undefined) ?? [];\n } catch {\n return [];\n }\n });\n\n const pluginDictionaries: Dictionary[] = (\n await Promise.all(loadPluginDictionariesPromise)\n ).flat();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n );\n\n const localDictionariesTime = Date.now();\n\n const filteredLocalDictionaries = filterInvalidDictionaries(\n localDictionaries,\n configuration\n );\n\n const localDictionariesStatus = filteredLocalDictionaries.map(\n (dict) =>\n ({\n dictionaryKey: dict.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n );\n }\n const remoteDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries: filteredLocalDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - loadDictionariesStartTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n },\n };\n};\n"],"mappings":";;;;;;;;;AA6BA,IAAIA,yBAA+C,EAAE;AACrD,MAAM,SAAS,IAAIC,iDAAoB;AAEvC,MAAM,6BAA6B,aAAmC;CACpE,MAAMC,UAAgC,CAAC,GAAG,uBAAuB;AAEjE,MAAK,MAAM,YAAY,UAAU;EAC/B,MAAM,QAAQ,QAAQ,WACnB,MACC,EAAE,kBAAkB,SAAS,iBAAiB,EAAE,SAAS,SAAS,KACrE;AACD,MAAI,SAAS,EACX,SAAQ,SAAS;MAEjB,SAAQ,KAAK,SAAS;;AAI1B,0BAAyB;AACzB,QAAO,OAAO,SAAS;AAEvB,QAAO;;AAQT,MAAM,WAAW,WAAyC;AACxD,SAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK,UACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAM,YAAY,WAAyC;AACzD,SAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK,UACH,QAAOC,6BAAW;EACpB,KAAK,QACH,QAAOA,6BAAW;EACpB,QACE,QAAOA,6BAAW;;;AAIxB,MAAM,gBAAgB,kBAAkC;AACtD,KAAI,cAAc,IAAI,SAAS,UAAW;CAE1C,MAAM,gDAAyB,cAAc;CAG7C,MAAM,wBAAQ,IAAI,KAA2B;AAC7C,MAAK,MAAM,KAAK,wBAAwB;EACtC,MAAM,MAAM,MAAM,IAAI,EAAE,cAAc,IAAI,EAAE;AAC5C,MAAI,EAAE,SAAS,QAAS,KAAI,QAAQ,EAAE;AACtC,MAAI,EAAE,SAAS,SAAU,KAAI,SAAS,EAAE;AACxC,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,MAAa,mBAAmB,OAC9B,0BACA,kBASI;CACJ,MAAM,EAAE,YAAY;CACpB,MAAM,4BAA4B,KAAK,KAAK;AAG5C,qCAF+B,cAAc,CAEnC,iBAAiB,EAAE,WAAW,MAAM,CAAC;CAG/C,MAAM,iCAAiC,WAAW,EAAE,EAAE,IAAI,OAAO,WAAW;AAC1E,MAAI;AAIF,UAHY,MAAM,OAAO,mBAAmB,EAC1C,eACD,CAAC,IAC0C,EAAE;UACxC;AACN,UAAO,EAAE;;GAEX;CAEF,MAAME,sBACJ,MAAM,QAAQ,IAAI,8BAA8B,EAChD,MAAM;CAMR,MAAMC,oBAAkC,MAAMC,wEAJhC,MAAM,QAAQ,yBAAyB,GACjD,2BACA,CAAC,yBAAyB,EAI5B,eACA,0BACD;CAED,MAAM,wBAAwB,KAAK,KAAK;CAExC,MAAM,4BAA4BC,4DAChC,mBACA,cACD;AAWD,2BATgC,0BAA0B,KACvD,UACE;EACC,eAAe,KAAK;EACpB,MAAM;EACN,QAAQ;EACT,EACJ,CAEiD;CAElD,MAAM,wBAAwB,QAC5B,cAAc,OAAO,YAAY,cAAc,OAAO,aACvD;AAED,KAAI,sBAEF,QAAO,gBAAgB,KAAK;CAG9B,IAAIC,qBAAmC,EAAE;AACzC,KAAI,sBACF,sBAAqB,MAAMC,uEACzB,eACA,2BACA;EACE,0BAA0B,OAAO,kBAAkB;EACnD,yBAAyB,OAAO,iBAAiB;EACjD,UAAU,MAAM,OAAO,eAAe,EAAE;EACzC,CACF;CAEH,MAAM,yBAAyB,KAAK,KAAK;AAGzC,QAAO,QAAQ;AAEf,cAAa,cAAc;AAE3B,QAAO;EACL,mBAAmB;EACnB;EACA;EACA,MAAM;GACJ,mBAAmB,wBAAwB;GAC3C,oBAAoB,yBAAyB;GAC9C;EACF"}
1
+ {"version":3,"file":"loadDictionaries.cjs","names":["loadDictionariesStatus: DictionariesStatus[]","DictionariesLogger","updated: DictionariesStatus[]","ANSIColors","labels: string[]","pluginDictionaries: Dictionary[]","localDictionaries: Dictionary[]","loadContentDeclarations","filterInvalidDictionaries","remoteDictionaries: Dictionary[]","loadRemoteDictionaries"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/client';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const s of loadDictionariesStatus) {\n const rec = byKey.get(s.dictionaryKey) ?? {};\n if (s.type === 'local') rec.local = s.status;\n if (s.type === 'remote') rec.remote = s.status;\n byKey.set(s.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const loadPluginDictionariesPromise = (plugins ?? []).map(async (plugin) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n return (res as Dictionary[] | undefined) ?? [];\n } catch {\n return [];\n }\n });\n\n const pluginDictionaries: Dictionary[] = (\n await Promise.all(loadPluginDictionariesPromise)\n ).flat();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n );\n\n const localDictionariesTime = Date.now();\n\n const filteredLocalDictionaries = filterInvalidDictionaries(\n localDictionaries,\n configuration\n );\n\n const localDictionariesStatus = filteredLocalDictionaries.map(\n (dict) =>\n ({\n dictionaryKey: dict.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n );\n }\n const remoteDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries: filteredLocalDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - loadDictionariesStartTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n },\n };\n};\n"],"mappings":";;;;;;;;;AA4BA,IAAIA,yBAA+C,EAAE;AACrD,MAAM,SAAS,IAAIC,iDAAoB;AAEvC,MAAM,6BAA6B,aAAmC;CACpE,MAAMC,UAAgC,CAAC,GAAG,uBAAuB;AAEjE,MAAK,MAAM,YAAY,UAAU;EAC/B,MAAM,QAAQ,QAAQ,WACnB,MACC,EAAE,kBAAkB,SAAS,iBAAiB,EAAE,SAAS,SAAS,KACrE;AACD,MAAI,SAAS,EACX,SAAQ,SAAS;MAEjB,SAAQ,KAAK,SAAS;;AAI1B,0BAAyB;AACzB,QAAO,OAAO,SAAS;AAEvB,QAAO;;AAQT,MAAM,WAAW,WAAyC;AACxD,SAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK,UACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,QACE,QAAO;;;AAIb,MAAM,YAAY,WAAyC;AACzD,SAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK,UACH,QAAOC,oCAAW;EACpB,KAAK,QACH,QAAOA,oCAAW;EACpB,QACE,QAAOA,oCAAW;;;AAIxB,MAAM,gBAAgB,kBAAkC;AACtD,KAAI,cAAc,IAAI,SAAS,UAAW;CAE1C,MAAM,uDAAyB,cAAc;CAG7C,MAAM,wBAAQ,IAAI,KAA2B;AAC7C,MAAK,MAAM,KAAK,wBAAwB;EACtC,MAAM,MAAM,MAAM,IAAI,EAAE,cAAc,IAAI,EAAE;AAC5C,MAAI,EAAE,SAAS,QAAS,KAAI,QAAQ,EAAE;AACtC,MAAI,EAAE,SAAS,SAAU,KAAI,SAAS,EAAE;AACxC,QAAM,IAAI,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mB,OAC9B,0BACA,kBASI;CACJ,MAAM,EAAE,YAAY;CACpB,MAAM,4BAA4B,KAAK,KAAK;AAG5C,4CAF+B,cAAc,CAEnC,iBAAiB,EAAE,WAAW,MAAM,CAAC;CAG/C,MAAM,iCAAiC,WAAW,EAAE,EAAE,IAAI,OAAO,WAAW;AAC1E,MAAI;AAIF,UAHY,MAAM,OAAO,mBAAmB,EAC1C,eACD,CAAC,IAC0C,EAAE;UACxC;AACN,UAAO,EAAE;;GAEX;CAEF,MAAME,sBACJ,MAAM,QAAQ,IAAI,8BAA8B,EAChD,MAAM;CAMR,MAAMC,oBAAkC,MAAMC,wEAJhC,MAAM,QAAQ,yBAAyB,GACjD,2BACA,CAAC,yBAAyB,EAI5B,eACA,0BACD;CAED,MAAM,wBAAwB,KAAK,KAAK;CAExC,MAAM,4BAA4BC,4DAChC,mBACA,cACD;AAWD,2BATgC,0BAA0B,KACvD,UACE;EACC,eAAe,KAAK;EACpB,MAAM;EACN,QAAQ;EACT,EACJ,CAEiD;CAElD,MAAM,wBAAwB,QAC5B,cAAc,OAAO,YAAY,cAAc,OAAO,aACvD;AAED,KAAI,sBAEF,QAAO,gBAAgB,KAAK;CAG9B,IAAIC,qBAAmC,EAAE;AACzC,KAAI,sBACF,sBAAqB,MAAMC,uEACzB,eACA,2BACA;EACE,0BAA0B,OAAO,kBAAkB;EACnD,yBAAyB,OAAO,iBAAiB;EACjD,UAAU,MAAM,OAAO,eAAe,EAAE;EACzC,CACF;CAEH,MAAM,yBAAyB,KAAK,KAAK;AAGzC,QAAO,QAAQ;AAEf,cAAa,cAAc;AAE3B,QAAO;EACL,mBAAmB;EACnB;EACA;EACA,MAAM;GACJ,mBAAmB,wBAAwB;GAC3C,oBAAoB,yBAAyB;GAC9C;EACF"}
@@ -1,10 +1,10 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_fetchDistantDictionaries = require('../fetchDistantDictionaries.cjs');
3
3
  const require_utils_sortAlphabetically = require('../utils/sortAlphabetically.cjs');
4
- let __intlayer_config = require("@intlayer/config");
5
- __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
6
4
  let __intlayer_api = require("@intlayer/api");
7
5
  __intlayer_api = require_rolldown_runtime.__toESM(__intlayer_api);
6
+ let __intlayer_config = require("@intlayer/config");
7
+ __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
8
8
  let __intlayer_remote_dictionaries_entry = require("@intlayer/remote-dictionaries-entry");
9
9
  __intlayer_remote_dictionaries_entry = require_rolldown_runtime.__toESM(__intlayer_remote_dictionaries_entry);
10
10
 
@@ -1,6 +1,8 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- let __intlayer_config = require("@intlayer/config");
3
- __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
2
+ let __intlayer_config_client = require("@intlayer/config/client");
3
+ __intlayer_config_client = require_rolldown_runtime.__toESM(__intlayer_config_client);
4
+ let __intlayer_config_built = require("@intlayer/config/built");
5
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
4
6
 
5
7
  //#region src/loadDictionaries/log.ts
6
8
  var DictionariesLogger = class {
@@ -8,7 +10,7 @@ var DictionariesLogger = class {
8
10
  spinnerTimer = null;
9
11
  spinnerIndex = 0;
10
12
  renderedLines = 0;
11
- spinnerFrames = __intlayer_config.spinnerFrames;
13
+ spinnerFrames = __intlayer_config_client.spinnerFrames;
12
14
  isFinished = false;
13
15
  prefix;
14
16
  lastRenderedState = "";
@@ -16,7 +18,7 @@ var DictionariesLogger = class {
16
18
  expectRemote = false;
17
19
  remoteError;
18
20
  constructor() {
19
- this.prefix = (0, __intlayer_config.getConfiguration)().log.prefix;
21
+ this.prefix = __intlayer_config_built.default?.log?.prefix ?? "";
20
22
  }
21
23
  setExpectRemote(expect) {
22
24
  this.expectRemote = expect;
@@ -60,23 +62,23 @@ var DictionariesLogger = class {
60
62
  this.spinnerTimer = null;
61
63
  }
62
64
  setRemoteError = (error) => {
63
- this.remoteError = (0, __intlayer_config.extractErrorMessage)(error);
65
+ this.remoteError = (0, __intlayer_config_client.extractErrorMessage)(error);
64
66
  this.stopRemoteCheck();
65
67
  this.render();
66
68
  };
67
69
  render() {
68
70
  const { localTotal, localDone, remoteTotal, remoteDone } = this.computeProgress();
69
71
  const frame = this.spinnerFrames[this.spinnerIndex];
70
- const clock = (0, __intlayer_config.colorize)(frame, __intlayer_config.ANSIColors.BLUE);
72
+ const clock = (0, __intlayer_config_client.colorize)(frame, __intlayer_config_client.ANSIColors.BLUE);
71
73
  const lines = [];
72
74
  const isLocalDone = localDone === localTotal;
73
75
  const isRemoteDone = remoteDone === remoteTotal;
74
- if (!(this.expectRemote && this.remoteCheckInProgress && remoteTotal === 0)) if (isLocalDone) lines.push(`${this.prefix} ${__intlayer_config.v} Local content: ${(0, __intlayer_config.colorize)(`${localDone}`, __intlayer_config.ANSIColors.GREEN)}${(0, __intlayer_config.colorize)(`/${localTotal}`, __intlayer_config.ANSIColors.GREY)}`);
75
- else lines.push(`${this.prefix} ${clock} Local content: ${(0, __intlayer_config.colorize)(`${localDone}`, __intlayer_config.ANSIColors.BLUE)}${(0, __intlayer_config.colorize)(`/${localTotal}`, __intlayer_config.ANSIColors.GREY)}`);
76
- if (remoteTotal > 0 || this.remoteCheckInProgress || this.remoteError) if (this.remoteError) lines.push(`${this.prefix} ${__intlayer_config.x} Remote content: ${(0, __intlayer_config.colorize)(this.remoteError, __intlayer_config.ANSIColors.RED)}`);
77
- else if (remoteTotal === 0) lines.push(`${this.prefix} ${clock} Remote content: ${(0, __intlayer_config.colorize)("Check server", __intlayer_config.ANSIColors.BLUE)}`);
78
- else if (isRemoteDone) lines.push(`${this.prefix} ${__intlayer_config.v} Remote content: ${(0, __intlayer_config.colorize)(`${remoteDone}`, __intlayer_config.ANSIColors.GREEN)}${(0, __intlayer_config.colorize)(`/${remoteTotal}`, __intlayer_config.ANSIColors.GREY)}`);
79
- else lines.push(`${this.prefix} ${clock} Remote content: ${(0, __intlayer_config.colorize)(`${remoteDone}`, __intlayer_config.ANSIColors.BLUE)}${(0, __intlayer_config.colorize)(`/${remoteTotal}`, __intlayer_config.ANSIColors.GREY)}`);
76
+ if (!(this.expectRemote && this.remoteCheckInProgress && remoteTotal === 0)) if (isLocalDone) lines.push(`${this.prefix} ${__intlayer_config_client.v} Local content: ${(0, __intlayer_config_client.colorize)(`${localDone}`, __intlayer_config_client.ANSIColors.GREEN)}${(0, __intlayer_config_client.colorize)(`/${localTotal}`, __intlayer_config_client.ANSIColors.GREY)}`);
77
+ else lines.push(`${this.prefix} ${clock} Local content: ${(0, __intlayer_config_client.colorize)(`${localDone}`, __intlayer_config_client.ANSIColors.BLUE)}${(0, __intlayer_config_client.colorize)(`/${localTotal}`, __intlayer_config_client.ANSIColors.GREY)}`);
78
+ if (remoteTotal > 0 || this.remoteCheckInProgress || this.remoteError) if (this.remoteError) lines.push(`${this.prefix} ${__intlayer_config_client.x} Remote content: ${(0, __intlayer_config_client.colorize)(this.remoteError, __intlayer_config_client.ANSIColors.RED)}`);
79
+ else if (remoteTotal === 0) lines.push(`${this.prefix} ${clock} Remote content: ${(0, __intlayer_config_client.colorize)("Check server", __intlayer_config_client.ANSIColors.BLUE)}`);
80
+ else if (isRemoteDone) lines.push(`${this.prefix} ${__intlayer_config_client.v} Remote content: ${(0, __intlayer_config_client.colorize)(`${remoteDone}`, __intlayer_config_client.ANSIColors.GREEN)}${(0, __intlayer_config_client.colorize)(`/${remoteTotal}`, __intlayer_config_client.ANSIColors.GREY)}`);
81
+ else lines.push(`${this.prefix} ${clock} Remote content: ${(0, __intlayer_config_client.colorize)(`${remoteDone}`, __intlayer_config_client.ANSIColors.BLUE)}${(0, __intlayer_config_client.colorize)(`/${remoteTotal}`, __intlayer_config_client.ANSIColors.GREY)}`);
80
82
  const currentState = lines.join("\n");
81
83
  if (currentState === this.lastRenderedState) return;
82
84
  this.lastRenderedState = currentState;
@@ -1 +1 @@
1
- {"version":3,"file":"log.cjs","names":["spinnerFrames","ANSIColors","lines: string[]","v","x"],"sources":["../../../src/loadDictionaries/log.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n extractErrorMessage,\n getConfiguration,\n spinnerFrames,\n v,\n x,\n} from '@intlayer/config';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport class DictionariesLogger {\n private statuses: DictionariesStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n private remoteCheckInProgress = false;\n private expectRemote = false;\n private remoteError: string | undefined;\n\n constructor() {\n const configuration = getConfiguration();\n this.prefix = configuration.log.prefix;\n }\n\n setExpectRemote(expect: boolean) {\n this.expectRemote = expect;\n }\n\n startRemoteCheck() {\n if (this.isFinished) return;\n this.remoteCheckInProgress = true;\n this.startSpinner();\n this.render();\n }\n\n stopRemoteCheck() {\n this.remoteCheckInProgress = false;\n }\n\n update(newStatuses: DictionariesStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) =>\n s.dictionaryKey === status.dictionaryKey && s.type === status.type\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n // If we expect remote fetch later, avoid rendering a local-only line first\n const { remoteTotal } = this.computeProgress();\n if (this.expectRemote && !this.remoteCheckInProgress && remoteTotal === 0) {\n // Do not start spinner or render yet; wait until remote check starts\n return;\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n // Render final state and keep it visible\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n public setRemoteError = (error?: Error) => {\n this.remoteError = extractErrorMessage(error);\n // Avoid rendering a transient remote-only line while the remote check flag is still true\n // Ensure local + remote are rendered together after a failure\n this.stopRemoteCheck();\n this.render();\n };\n\n private render() {\n const { localTotal, localDone, remoteTotal, remoteDone } =\n this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const clock = colorize(frame, ANSIColors.BLUE);\n const lines: string[] = [];\n\n const isLocalDone = localDone === localTotal;\n const isRemoteDone = remoteDone === remoteTotal;\n\n const suppressLocalWhileCheckingRemote =\n this.expectRemote && this.remoteCheckInProgress && remoteTotal === 0;\n\n if (!suppressLocalWhileCheckingRemote) {\n if (isLocalDone) {\n lines.push(\n `${this.prefix} ${v} Local content: ${colorize(`${localDone}`, ANSIColors.GREEN)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Local content: ${colorize(`${localDone}`, ANSIColors.BLUE)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Single remote line: show error, check, or progress counts\n if (remoteTotal > 0 || this.remoteCheckInProgress || this.remoteError) {\n if (this.remoteError) {\n lines.push(\n `${this.prefix} ${x} Remote content: ${colorize(\n this.remoteError,\n ANSIColors.RED\n )}`\n );\n } else if (remoteTotal === 0) {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize('Check server', ANSIColors.BLUE)}`\n );\n } else if (isRemoteDone) {\n lines.push(\n `${this.prefix} ${v} Remote content: ${colorize(`${remoteDone}`, ANSIColors.GREEN)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize(`${remoteDone}`, ANSIColors.BLUE)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Check if the state has changed to avoid duplicate rendering\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const localKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'local')\n .map((s) => s.dictionaryKey)\n );\n\n const localDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'local' && (s.status === 'built' || s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n const remoteKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'remote')\n .map((s) => s.dictionaryKey)\n );\n\n const remoteDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'remote' &&\n (s.status === 'fetched' ||\n s.status === 'imported' ||\n s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n return {\n localTotal: localKeys.size,\n localDone: localDoneKeys.size,\n remoteTotal: remoteKeys.size,\n remoteDone: remoteDoneKeys.size,\n } as const;\n }\n}\n"],"mappings":";;;;;AAWA,IAAa,qBAAb,MAAgC;CAC9B,AAAQ,WAAiC,EAAE;CAC3C,AAAQ,eAAsC;CAC9C,AAAQ,eAAe;CACvB,AAAQ,gBAAgB;CACxB,AAAiB,gBAAgBA;CACjC,AAAQ,aAAa;CACrB,AAAiB;CACjB,AAAQ,oBAA4B;CACpC,AAAQ,wBAAwB;CAChC,AAAQ,eAAe;CACvB,AAAQ;CAER,cAAc;AAEZ,OAAK,kDADmC,CACZ,IAAI;;CAGlC,gBAAgB,QAAiB;AAC/B,OAAK,eAAe;;CAGtB,mBAAmB;AACjB,MAAI,KAAK,WAAY;AACrB,OAAK,wBAAwB;AAC7B,OAAK,cAAc;AACnB,OAAK,QAAQ;;CA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c,CAC/B;EAED,MAAM,gBAAgB,IAAI,IACxB,KAAK,SACF,QACE,MACC,EAAE,SAAS,YAAY,EAAE,WAAW,WAAW,EAAE,WAAW,SAC/D,CACA,KAAK,MAAM,EAAE,cAAc,CAC/B;EAED,MAAM,aAAa,IAAI,IACrB,KAAK,SACF,QAAQ,MAAM,EAAE,SAAS,SAAS,CAClC,KAAK,MAAM,EAAE,cAAc,CAC/B;EAED,MAAM,iBAAiB,IAAI,IACzB,KAAK,SACF,QACE,MACC,EAAE,SAAS,aACV,EAAE,WAAW,aACZ,EAAE,WAAW,cACb,EAAE,WAAW,SAClB,CACA,KAAK,MAAM,EAAE,cAAc,CAC/B;AAED,SAAO;GACL,YAAY,UAAU;GACtB,WAAW,cAAc;GACzB,aAAa,WAAW;GACxB,YAAY,eAAe;GAC5B"}
1
+ {"version":3,"file":"log.cjs","names":["spinnerFrames","configuration","ANSIColors","lines: string[]","v","x"],"sources":["../../../src/loadDictionaries/log.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n ANSIColors,\n colorize,\n extractErrorMessage,\n spinnerFrames,\n v,\n x,\n} from '@intlayer/config/client';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport class DictionariesLogger {\n private statuses: DictionariesStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n private remoteCheckInProgress = false;\n private expectRemote = false;\n private remoteError: string | undefined;\n\n constructor() {\n this.prefix = configuration?.log?.prefix ?? '';\n }\n\n setExpectRemote(expect: boolean) {\n this.expectRemote = expect;\n }\n\n startRemoteCheck() {\n if (this.isFinished) return;\n this.remoteCheckInProgress = true;\n this.startSpinner();\n this.render();\n }\n\n stopRemoteCheck() {\n this.remoteCheckInProgress = false;\n }\n\n update(newStatuses: DictionariesStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) =>\n s.dictionaryKey === status.dictionaryKey && s.type === status.type\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n // If we expect remote fetch later, avoid rendering a local-only line first\n const { remoteTotal } = this.computeProgress();\n if (this.expectRemote && !this.remoteCheckInProgress && remoteTotal === 0) {\n // Do not start spinner or render yet; wait until remote check starts\n return;\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n // Render final state and keep it visible\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n public setRemoteError = (error?: Error) => {\n this.remoteError = extractErrorMessage(error);\n // Avoid rendering a transient remote-only line while the remote check flag is still true\n // Ensure local + remote are rendered together after a failure\n this.stopRemoteCheck();\n this.render();\n };\n\n private render() {\n const { localTotal, localDone, remoteTotal, remoteDone } =\n this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const clock = colorize(frame, ANSIColors.BLUE);\n const lines: string[] = [];\n\n const isLocalDone = localDone === localTotal;\n const isRemoteDone = remoteDone === remoteTotal;\n\n const suppressLocalWhileCheckingRemote =\n this.expectRemote && this.remoteCheckInProgress && remoteTotal === 0;\n\n if (!suppressLocalWhileCheckingRemote) {\n if (isLocalDone) {\n lines.push(\n `${this.prefix} ${v} Local content: ${colorize(`${localDone}`, ANSIColors.GREEN)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Local content: ${colorize(`${localDone}`, ANSIColors.BLUE)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Single remote line: show error, check, or progress counts\n if (remoteTotal > 0 || this.remoteCheckInProgress || this.remoteError) {\n if (this.remoteError) {\n lines.push(\n `${this.prefix} ${x} Remote content: ${colorize(\n this.remoteError,\n ANSIColors.RED\n )}`\n );\n } else if (remoteTotal === 0) {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize('Check server', ANSIColors.BLUE)}`\n );\n } else if (isRemoteDone) {\n lines.push(\n `${this.prefix} ${v} Remote content: ${colorize(`${remoteDone}`, ANSIColors.GREEN)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize(`${remoteDone}`, ANSIColors.BLUE)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Check if the state has changed to avoid duplicate rendering\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const localKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'local')\n .map((s) => s.dictionaryKey)\n );\n\n const localDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'local' && (s.status === 'built' || s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n const remoteKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'remote')\n .map((s) => s.dictionaryKey)\n );\n\n const remoteDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'remote' &&\n (s.status === 'fetched' ||\n s.status === 'imported' ||\n s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n return {\n localTotal: localKeys.size,\n localDone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AK;AACrC,MAAI,iBAAiB,KAAK,kBACxB;AAEF,OAAK,oBAAoB;AAEzB,MAAI,KAAK,gBAAgB,EACvB,SAAQ,OAAO,MAAM,QAAQ,KAAK,cAAc,GAAG;EAGrD,MAAM,oBAAoB,KAAK,IAAI,KAAK,eAAe,MAAM,OAAO;AACpE,OAAK,IAAI,IAAI,GAAG,IAAI,mBAAmB,KAAK;AAC1C,WAAQ,OAAO,MAAM,UAAU;GAC/B,MAAM,OAAO,MAAM;AACnB,OAAI,SAAS,OACX,SAAQ,OAAO,MAAM,KAAK;AAE5B,WAAQ,OAAO,MAAM,KAAK;;AAG5B,OAAK,gBAAgB,MAAM;;CAG7B,AAAQ,kBAAkB;EACxB,MAAM,YAAY,IAAI,IACpB,KAAK,SACF,QAAQ,MAAM,EAAE,SAAS,QAAQ,CACjC,KAAK,MAAM,EAAE,cAAc,CAC/B;EAED,MAAM,gBAAgB,IAAI,IACxB,KAAK,SACF,QACE,MACC,EAAE,SAAS,YAAY,EAAE,WAAW,WAAW,EAAE,WAAW,SAC/D,CACA,KAAK,MAAM,EAAE,cAAc,CAC/B;EAED,MAAM,aAAa,IAAI,IACrB,KAAK,SACF,QAAQ,MAAM,EAAE,SAAS,SAAS,CAClC,KAAK,MAAM,EAAE,cAAc,CAC/B;EAED,MAAM,iBAAiB,IAAI,IACzB,KAAK,SACF,QACE,MACC,EAAE,SAAS,aACV,EAAE,WAAW,aACZ,EAAE,WAAW,cACb,EAAE,WAAW,SAClB,CACA,KAAK,MAAM,EAAE,cAAc,CAC/B;AAED,SAAO;GACL,YAAY,UAAU;GACtB,WAAW,cAAc;GACzB,aAAa,WAAW;GACxB,YAAY,eAAe;GAC5B"}
@@ -0,0 +1,55 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let node_child_process = require("node:child_process");
3
+ node_child_process = require_rolldown_runtime.__toESM(node_child_process);
4
+
5
+ //#region src/utils/runParallel/bin.ts
6
+ const stripStderr = (stderr) => {
7
+ if (!stderr) return;
8
+ let cleaned = stderr.trim();
9
+ cleaned = cleaned.replace(/your \d+x\d+ screen size is bogus\. expect trouble/gi, "");
10
+ return cleaned.trim() || void 0;
11
+ };
12
+ /**
13
+ * Spawn a binary and read its stdout.
14
+ * @param cmd The name of the binary to spawn.
15
+ * @param args The arguments for the binary.
16
+ * @param options Optional option for the spawn function.
17
+ * @param done Callback function.
18
+ */
19
+ const run = (cmd, args, options, done) => {
20
+ let normalizedOptions;
21
+ let normalizedDone;
22
+ if (typeof options === "function") {
23
+ normalizedDone = options;
24
+ normalizedOptions = void 0;
25
+ } else {
26
+ normalizedDone = done;
27
+ normalizedOptions = options;
28
+ }
29
+ let executed = false;
30
+ const ch = (0, node_child_process.spawn)(cmd, args, normalizedOptions ?? {});
31
+ let stdout = "";
32
+ let stderr = "";
33
+ if (ch.stdout) ch.stdout.on("data", (d) => {
34
+ stdout += d.toString();
35
+ });
36
+ if (ch.stderr) ch.stderr.on("data", (d) => {
37
+ stderr += d.toString();
38
+ });
39
+ ch.on("error", (err) => {
40
+ if (executed) return;
41
+ executed = true;
42
+ normalizedDone(new Error(String(err)));
43
+ });
44
+ ch.on("close", (code) => {
45
+ if (executed) return;
46
+ executed = true;
47
+ const cleanedStderr = stripStderr(stderr);
48
+ if (cleanedStderr) return normalizedDone(new Error(cleanedStderr));
49
+ normalizedDone(null, stdout, code ?? void 0);
50
+ });
51
+ };
52
+
53
+ //#endregion
54
+ exports.run = run;
55
+ //# sourceMappingURL=bin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.cjs","names":["normalizedOptions: SpawnOptions | undefined","normalizedDone: BinCallback","ch: ChildProcess"],"sources":["../../../../src/utils/runParallel/bin.ts"],"sourcesContent":["import type { ChildProcess } from 'node:child_process';\nimport { type SpawnOptions, spawn } from 'node:child_process';\n\ntype BinCallback = (err: Error | null, stdout?: string, code?: number) => void;\n\nconst stripStderr = (stderr: string | undefined): string | undefined => {\n if (!stderr) return;\n let cleaned = stderr.trim();\n // Strip bogus screen size error.\n // See https://github.com/microsoft/vscode/issues/98590\n const regex = /your \\d+x\\d+ screen size is bogus\\. expect trouble/gi;\n cleaned = cleaned.replace(regex, '');\n\n return cleaned.trim() || undefined;\n};\n\n/**\n * Spawn a binary and read its stdout.\n * @param cmd The name of the binary to spawn.\n * @param args The arguments for the binary.\n * @param options Optional option for the spawn function.\n * @param done Callback function.\n */\nexport const run = (\n cmd: string,\n args: string[],\n options: SpawnOptions | BinCallback | undefined,\n done?: BinCallback\n): void => {\n let normalizedOptions: SpawnOptions | undefined;\n let normalizedDone: BinCallback;\n\n if (typeof options === 'function') {\n normalizedDone = options;\n normalizedOptions = undefined;\n } else {\n normalizedDone = done!;\n normalizedOptions = options;\n }\n\n let executed = false;\n const ch: ChildProcess = spawn(cmd, args, normalizedOptions ?? {});\n let stdout = '';\n let stderr = '';\n\n if (ch.stdout) {\n ch.stdout.on('data', (d: Buffer) => {\n stdout += d.toString();\n });\n }\n\n if (ch.stderr) {\n ch.stderr.on('data', (d: Buffer) => {\n stderr += d.toString();\n });\n }\n\n ch.on('error', (err: Error) => {\n if (executed) return;\n executed = true;\n normalizedDone(new Error(String(err)));\n });\n\n ch.on('close', (code: number | null) => {\n if (executed) return;\n executed = true;\n\n const cleanedStderr = stripStderr(stderr);\n if (cleanedStderr) {\n return normalizedDone(new Error(cleanedStderr));\n }\n\n normalizedDone(null, stdout, code ?? undefined);\n });\n};\n"],"mappings":";;;;;AAKA,MAAM,eAAe,WAAmD;AACtE,KAAI,CAAC,OAAQ;CACb,IAAI,UAAU,OAAO,MAAM;AAI3B,WAAU,QAAQ,QADJ,wDACmB,GAAG;AAEpC,QAAO,QAAQ,MAAM,IAAI;;;;;;;;;AAU3B,MAAa,OACX,KACA,MACA,SACA,SACS;CACT,IAAIA;CACJ,IAAIC;AAEJ,KAAI,OAAO,YAAY,YAAY;AACjC,mBAAiB;AACjB,sBAAoB;QACf;AACL,mBAAiB;AACjB,sBAAoB;;CAGtB,IAAI,WAAW;CACf,MAAMC,mCAAyB,KAAK,MAAM,qBAAqB,EAAE,CAAC;CAClE,IAAI,SAAS;CACb,IAAI,SAAS;AAEb,KAAI,GAAG,OACL,IAAG,OAAO,GAAG,SAAS,MAAc;AAClC,YAAU,EAAE,UAAU;GACtB;AAGJ,KAAI,GAAG,OACL,IAAG,OAAO,GAAG,SAAS,MAAc;AAClC,YAAU,EAAE,UAAU;GACtB;AAGJ,IAAG,GAAG,UAAU,QAAe;AAC7B,MAAI,SAAU;AACd,aAAW;AACX,iBAAe,IAAI,MAAM,OAAO,IAAI,CAAC,CAAC;GACtC;AAEF,IAAG,GAAG,UAAU,SAAwB;AACtC,MAAI,SAAU;AACd,aAAW;EAEX,MAAM,gBAAgB,YAAY,OAAO;AACzC,MAAI,cACF,QAAO,eAAe,IAAI,MAAM,cAAc,CAAC;AAGjD,iBAAe,MAAM,QAAQ,QAAQ,OAAU;GAC/C"}
@@ -0,0 +1,24 @@
1
+
2
+ //#region src/utils/runParallel/bootstrap.ts
3
+ const bootstrap = (_name) => {
4
+ switch (process.argv.slice(2)[0]) {
5
+ case void 0:
6
+ case "-h":
7
+ case "--help":
8
+ console.log("Help not implemented");
9
+ return;
10
+ case "-v":
11
+ case "--version":
12
+ console.log("Version not implemented");
13
+ return;
14
+ default:
15
+ process.stdout.setMaxListeners(0);
16
+ process.stderr.setMaxListeners(0);
17
+ process.stdin.setMaxListeners(0);
18
+ return;
19
+ }
20
+ };
21
+
22
+ //#endregion
23
+ exports.bootstrap = bootstrap;
24
+ //# sourceMappingURL=bootstrap.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.cjs","names":[],"sources":["../../../../src/utils/runParallel/bootstrap.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport const bootstrap = (_name: string): void | Promise<void> => {\n const argv = process.argv.slice(2);\n\n switch (argv[0]) {\n case undefined:\n case '-h':\n case '--help':\n // Not needed for our use case\n console.log('Help not implemented');\n return;\n\n case '-v':\n case '--version':\n // Not needed for our use case\n console.log('Version not implemented');\n return;\n\n default:\n // https://github.com/mysticatea/npm-run-all/issues/105\n // Avoid MaxListenersExceededWarnings.\n process.stdout.setMaxListeners(0);\n process.stderr.setMaxListeners(0);\n process.stdin.setMaxListeners(0);\n return;\n }\n};\n"],"mappings":";;AAIA,MAAa,aAAa,UAAwC;AAGhE,SAFa,QAAQ,KAAK,MAAM,EAAE,CAErB,IAAb;EACE,KAAK;EACL,KAAK;EACL,KAAK;AAEH,WAAQ,IAAI,uBAAuB;AACnC;EAEF,KAAK;EACL,KAAK;AAEH,WAAQ,IAAI,0BAA0B;AACtC;EAEF;AAGE,WAAQ,OAAO,gBAAgB,EAAE;AACjC,WAAQ,OAAO,gBAAgB,EAAE;AACjC,WAAQ,MAAM,gBAAgB,EAAE;AAChC"}