@intlayer/chokidar 8.11.1 → 8.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/cjs/_virtual/_utils_asset.cjs +0 -1
  2. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +0 -1
  3. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
  4. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +0 -1
  5. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
  6. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +0 -1
  7. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
  8. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +0 -1
  9. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
  10. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +0 -1
  11. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
  12. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +0 -1
  13. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
  14. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +0 -1
  15. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
  16. package/dist/cjs/cleanOutputDir.cjs +0 -1
  17. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  18. package/dist/cjs/cli.cjs +2 -0
  19. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +0 -1
  20. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
  21. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +0 -1
  22. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  23. package/dist/cjs/createType/createType.cjs +0 -1
  24. package/dist/cjs/createType/createType.cjs.map +1 -1
  25. package/dist/cjs/detectFormatCommand.cjs +0 -1
  26. package/dist/cjs/detectFormatCommand.cjs.map +1 -1
  27. package/dist/cjs/fetchDistantDictionaries.cjs +0 -1
  28. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  29. package/dist/cjs/formatDictionary.cjs +0 -1
  30. package/dist/cjs/formatDictionary.cjs.map +1 -1
  31. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +0 -1
  32. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
  33. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +0 -1
  34. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
  35. package/dist/cjs/handleContentDeclarationFileChange.cjs +0 -1
  36. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
  37. package/dist/cjs/handleContentDeclarationFileMoved.cjs +0 -1
  38. package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -1
  39. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +0 -1
  40. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
  41. package/dist/cjs/init/index.cjs +28 -0
  42. package/dist/cjs/init/index.cjs.map +1 -1
  43. package/dist/cjs/init/utils/fileSystem.cjs +0 -1
  44. package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
  45. package/dist/cjs/init/utils/tsConfig.cjs +0 -1
  46. package/dist/cjs/init/utils/tsConfig.cjs.map +1 -1
  47. package/dist/cjs/initConfig/index.cjs +0 -1
  48. package/dist/cjs/initConfig/index.cjs.map +1 -1
  49. package/dist/cjs/installLSP.cjs +58 -0
  50. package/dist/cjs/installLSP.cjs.map +1 -0
  51. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +0 -1
  52. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
  53. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +0 -1
  54. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  55. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +0 -1
  56. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
  57. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs +0 -1
  58. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs.map +1 -1
  59. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +0 -1
  60. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  61. package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs +0 -1
  62. package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs.map +1 -1
  63. package/dist/cjs/loadDictionaries/log.cjs +1 -2
  64. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  65. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +0 -1
  66. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
  67. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +0 -1
  68. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  69. package/dist/cjs/utils/readDictionariesFromDisk.cjs +0 -1
  70. package/dist/cjs/utils/readDictionariesFromDisk.cjs.map +1 -1
  71. package/dist/cjs/utils/resolveRelativePath.cjs +0 -1
  72. package/dist/cjs/utils/resolveRelativePath.cjs.map +1 -1
  73. package/dist/cjs/utils/runParallel/bin.cjs +0 -1
  74. package/dist/cjs/utils/runParallel/bin.cjs.map +1 -1
  75. package/dist/cjs/utils/runParallel/index.cjs +0 -1
  76. package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
  77. package/dist/cjs/utils/runParallel/runTask.cjs +0 -1
  78. package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -1
  79. package/dist/cjs/utils/runParallel/spawnPosix.cjs +0 -1
  80. package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -1
  81. package/dist/cjs/utils/runParallel/spawnWin32.cjs +0 -1
  82. package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -1
  83. package/dist/cjs/writeConfiguration/generateConfigurationContent.cjs +2 -6
  84. package/dist/cjs/writeConfiguration/generateConfigurationContent.cjs.map +1 -1
  85. package/dist/cjs/writeConfiguration/index.cjs +0 -1
  86. package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
  87. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +0 -1
  88. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  89. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +0 -1
  90. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  91. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs +0 -1
  92. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs.map +1 -1
  93. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs +0 -1
  94. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs.map +1 -1
  95. package/dist/cjs/writeFileIfChanged.cjs +0 -1
  96. package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
  97. package/dist/esm/cli.mjs +2 -1
  98. package/dist/esm/init/index.mjs +28 -0
  99. package/dist/esm/init/index.mjs.map +1 -1
  100. package/dist/esm/installLSP.mjs +55 -0
  101. package/dist/esm/installLSP.mjs.map +1 -0
  102. package/dist/esm/loadDictionaries/log.mjs +2 -2
  103. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  104. package/dist/esm/writeConfiguration/generateConfigurationContent.mjs +2 -6
  105. package/dist/esm/writeConfiguration/generateConfigurationContent.mjs.map +1 -1
  106. package/dist/types/cli.d.ts +2 -1
  107. package/dist/types/init/index.d.ts.map +1 -1
  108. package/dist/types/installLSP.d.ts +12 -0
  109. package/dist/types/installLSP.d.ts.map +1 -0
  110. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"log.cjs","names":["spinnerFrames","defaultConfiguration","ANSIColors","v","x"],"sources":["../../../src/loadDictionaries/log.ts"],"sourcesContent":["import { default as defaultConfiguration } from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n getPrefix,\n spinnerFrames,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { extractErrorMessage } from '@intlayer/config/utils';\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 private pluginTotal = 0;\n private pluginDone = 0;\n private pluginError: string | undefined;\n\n constructor() {\n this.prefix = getPrefix(defaultConfiguration.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 setPluginTotal(total: number) {\n if (this.isFinished) return;\n this.pluginTotal = total;\n if (total > 0) {\n this.startSpinner();\n }\n this.render();\n }\n\n setPluginDone(done: number) {\n if (this.isFinished) return;\n this.pluginDone = done;\n this.render();\n }\n\n setPluginError(error?: Error) {\n if (this.isFinished) return;\n this.pluginError = extractErrorMessage(error);\n this.render();\n }\n\n private render() {\n const {\n localTotal,\n localDone,\n remoteTotal,\n remoteDone,\n pluginTotal,\n pluginDone,\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 const isPluginDone = pluginDone === pluginTotal;\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 // Plugin line: show error or progress counts\n if (pluginTotal > 0 || this.pluginError) {\n if (this.pluginError) {\n lines.push(\n `${this.prefix} ${x} Plugin content: ${colorize(\n this.pluginError,\n ANSIColors.RED\n )}`\n );\n } else if (isPluginDone) {\n lines.push(\n `${this.prefix} ${v} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.GREEN)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.BLUE)}${colorize(`/${pluginTotal}`, 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 pluginTotal: this.pluginTotal,\n pluginDone: this.pluginDone,\n } as const;\n }\n}\n"],"mappings":";;;;;;;;;;AAYA,IAAa,qBAAb,MAAgC;CAC9B,AAAQ,WAAiC,CAAC;CAC1C,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;CACR,AAAQ,cAAc;CACtB,AAAQ,aAAa;CACrB,AAAQ;CAER,cAAc;EACZ,KAAK,gDAAmBC,+BAAqB,KAAK,MAAM,KAAK;CAC/D;CAEA,gBAAgB,QAAiB;EAC/B,KAAK,eAAe;CACtB;CAEA,mBAAmB;EACjB,IAAI,KAAK,YAAY;EACrB,KAAK,wBAAwB;EAC7B,KAAK,aAAa;EAClB,KAAK,OAAO;CACd;CAEA,kBAAkB;EAChB,KAAK,wBAAwB;CAC/B;CAEA,OAAO,aAAmC;EACxC,IAAI,KAAK,YAAY;EACrB,KAAK,MAAM,UAAU,aAAa;GAChC,MAAM,QAAQ,KAAK,SAAS,WACzB,MACC,EAAE,kBAAkB,OAAO,iBAAiB,EAAE,SAAS,OAAO,IAClE;GACA,IAAI,SAAS,GACX,KAAK,SAAS,SAAS;QAEvB,KAAK,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B;EAEF,KAAK,oBAAoB;EAEzB,IAAI,KAAK,gBAAgB,GACvB,QAAQ,OAAO,MAAM,QAAQ,KAAK,cAAc,EAAE;EAGpD,MAAM,oBAAoB,KAAK,IAAI,KAAK,eAAe,MAAM,MAAM;EACnE,KAAK,IAAI,IAAI,GAAG,IAAI,mBAAmB,KAAK;GAC1C,QAAQ,OAAO,MAAM,SAAS;GAC9B,MAAM,OAAO,MAAM;GACnB,IAAI,SAAS,QACX,QAAQ,OAAO,MAAM,IAAI;GAE3B,QAAQ,OAAO,MAAM,IAAI;EAC3B;EAEA,KAAK,gBAAgB,MAAM;CAC7B;CAEA,AAAQ,kBAAkB;EACxB,MAAM,YAAY,IAAI,IACpB,KAAK,SACF,QAAQ,MAAM,EAAE,SAAS,OAAO,EAChC,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,MAAM,gBAAgB,IAAI,IACxB,KAAK,SACF,QACE,MACC,EAAE,SAAS,YAAY,EAAE,WAAW,WAAW,EAAE,WAAW,QAChE,EACC,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,MAAM,aAAa,IAAI,IACrB,KAAK,SACF,QAAQ,MAAM,EAAE,SAAS,QAAQ,EACjC,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,MAAM,iBAAiB,IAAI,IACzB,KAAK,SACF,QACE,MACC,EAAE,SAAS,aACV,EAAE,WAAW,aACZ,EAAE,WAAW,cACb,EAAE,WAAW,QACnB,EACC,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,OAAO;GACL,YAAY,UAAU;GACtB,WAAW,cAAc;GACzB,aAAa,WAAW;GACxB,YAAY,eAAe;GAC3B,aAAa,KAAK;GAClB,YAAY,KAAK;EACnB;CACF;AACF"}
1
+ {"version":3,"file":"log.cjs","names":["spinnerFrames","log","ANSIColors","v","x"],"sources":["../../../src/loadDictionaries/log.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n getPrefix,\n spinnerFrames,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { extractErrorMessage } from '@intlayer/config/utils';\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 private pluginTotal = 0;\n private pluginDone = 0;\n private pluginError: string | undefined;\n\n constructor() {\n this.prefix = getPrefix(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 setPluginTotal(total: number) {\n if (this.isFinished) return;\n this.pluginTotal = total;\n if (total > 0) {\n this.startSpinner();\n }\n this.render();\n }\n\n setPluginDone(done: number) {\n if (this.isFinished) return;\n this.pluginDone = done;\n this.render();\n }\n\n setPluginError(error?: Error) {\n if (this.isFinished) return;\n this.pluginError = extractErrorMessage(error);\n this.render();\n }\n\n private render() {\n const {\n localTotal,\n localDone,\n remoteTotal,\n remoteDone,\n pluginTotal,\n pluginDone,\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 const isPluginDone = pluginDone === pluginTotal;\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 // Plugin line: show error or progress counts\n if (pluginTotal > 0 || this.pluginError) {\n if (this.pluginError) {\n lines.push(\n `${this.prefix} ${x} Plugin content: ${colorize(\n this.pluginError,\n ANSIColors.RED\n )}`\n );\n } else if (isPluginDone) {\n lines.push(\n `${this.prefix} ${v} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.GREEN)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.BLUE)}${colorize(`/${pluginTotal}`, 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 pluginTotal: this.pluginTotal,\n pluginDone: this.pluginDone,\n } as const;\n }\n}\n"],"mappings":";;;;;;;;;AAYA,IAAa,qBAAb,MAAgC;CAC9B,AAAQ,WAAiC,CAAC;CAC1C,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;CACR,AAAQ,cAAc;CACtB,AAAQ,aAAa;CACrB,AAAQ;CAER,cAAc;EACZ,KAAK,gDAAmBC,4BAAK,MAAM,KAAK;CAC1C;CAEA,gBAAgB,QAAiB;EAC/B,KAAK,eAAe;CACtB;CAEA,mBAAmB;EACjB,IAAI,KAAK,YAAY;EACrB,KAAK,wBAAwB;EAC7B,KAAK,aAAa;EAClB,KAAK,OAAO;CACd;CAEA,kBAAkB;EAChB,KAAK,wBAAwB;CAC/B;CAEA,OAAO,aAAmC;EACxC,IAAI,KAAK,YAAY;EACrB,KAAK,MAAM,UAAU,aAAa;GAChC,MAAM,QAAQ,KAAK,SAAS,WACzB,MACC,EAAE,kBAAkB,OAAO,iBAAiB,EAAE,SAAS,OAAO,IAClE;GACA,IAAI,SAAS,GACX,KAAK,SAAS,SAAS;QAEvB,KAAK,SAAS,KAAK,MAAM;EAE7B;EAGA,MAAM,EAAE,gBAAgB,KAAK,gBAAgB;EAC7C,IAAI,KAAK,gBAAgB,CAAC,KAAK,yBAAyB,gBAAgB,GAEtE;EAGF,KAAK,aAAa;EAClB,KAAK,OAAO;CACd;CAEA,SAAS;EACP,KAAK,aAAa;EAClB,KAAK,YAAY;EAEjB,KAAK,OAAO;CACd;CAEA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B,MAAM,OAAO,MAAM;GACnB,IAAI,SAAS,QACX,QAAQ,OAAO,MAAM,IAAI;GAE3B,QAAQ,OAAO,MAAM,IAAI;EAC3B;EAEA,KAAK,gBAAgB,MAAM;CAC7B;CAEA,AAAQ,kBAAkB;EACxB,MAAM,YAAY,IAAI,IACpB,KAAK,SACF,QAAQ,MAAM,EAAE,SAAS,OAAO,EAChC,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,MAAM,gBAAgB,IAAI,IACxB,KAAK,SACF,QACE,MACC,EAAE,SAAS,YAAY,EAAE,WAAW,WAAW,EAAE,WAAW,QAChE,EACC,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,MAAM,aAAa,IAAI,IACrB,KAAK,SACF,QAAQ,MAAM,EAAE,SAAS,QAAQ,EACjC,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,MAAM,iBAAiB,IAAI,IACzB,KAAK,SACF,QACE,MACC,EAAE,SAAS,aACV,EAAE,WAAW,aACZ,EAAE,WAAW,cACb,EAAE,WAAW,QACnB,EACC,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,OAAO;GACL,YAAY,UAAU;GACtB,WAAW,cAAc;GACzB,aAAa,WAAW;GACxB,YAAY,eAAe;GAC3B,aAAa,KAAK;GAClB,YAAY,KAAK;EACnB;CACF;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let node_path = require("node:path");
4
3
  let _intlayer_config_logger = require("@intlayer/config/logger");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"logTypeScriptErrors.cjs","names":[],"sources":["../../../src/loadDictionaries/logTypeScriptErrors.ts"],"sourcesContent":["import { dirname, extname } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\nexport const logTypeScriptErrors = async (\n filePaths: string[],\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n\n const filesToCheck = filePaths.filter((path) => {\n const ext = extname(path);\n\n return ['.ts', '.tsx', '.js', '.jsx', '.cjs', '.mjs', '.json'].includes(\n ext\n );\n });\n\n if (filesToCheck.length === 0) return;\n\n let ts: typeof import('typescript');\n\n try {\n ts = (await import('typescript')).default || (await import('typescript'));\n } catch {\n // TypeScript not installed, skip type checking\n\n return;\n }\n\n const configFileName = ts.findConfigFile(\n configuration.system?.baseDir ?? process.cwd(),\n ts.sys.fileExists,\n 'tsconfig.json'\n );\n\n let compilerOptions: any = {\n noEmit: true,\n\n allowJs: true,\n\n resolveJsonModule: true,\n };\n\n if (configFileName) {\n const configFileText = ts.sys.readFile(configFileName);\n\n if (configFileText) {\n const configJson = ts.parseConfigFileTextToJson(\n configFileName,\n\n configFileText\n );\n\n if (!configJson.error) {\n const parsedConfig = ts.parseJsonConfigFileContent(\n configJson.config,\n\n ts.sys,\n\n dirname(configFileName)\n );\n\n const { incremental, tsBuildInfoFile, ...restOptions } =\n parsedConfig.options;\n\n compilerOptions = { ...compilerOptions, ...restOptions, noEmit: true };\n }\n }\n }\n\n const program = ts.createProgram(filesToCheck, compilerOptions);\n\n filesToCheck.forEach((filePath) => {\n const sourceFile = program.getSourceFile(filePath);\n\n if (!sourceFile) return;\n\n const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);\n\n diagnostics.forEach((diagnostic) => {\n const message = ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n\n '\\n'\n );\n\n if (diagnostic.file && diagnostic.start !== undefined) {\n const { line, character } =\n diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n\n appLogger(\n `TS Error in ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`,\n\n { level: 'warn' }\n );\n }\n });\n });\n};\n"],"mappings":";;;;;;AAIA,MAAa,sBAAsB,OACjC,WACA,kBACG;CACH,MAAM,sDAAyB,aAAa;CAE5C,MAAM,eAAe,UAAU,QAAQ,SAAS;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+ {"version":3,"file":"logTypeScriptErrors.cjs","names":[],"sources":["../../../src/loadDictionaries/logTypeScriptErrors.ts"],"sourcesContent":["import { dirname, extname } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\nexport const logTypeScriptErrors = async (\n filePaths: string[],\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n\n const filesToCheck = filePaths.filter((path) => {\n const ext = extname(path);\n\n return ['.ts', '.tsx', '.js', '.jsx', '.cjs', '.mjs', '.json'].includes(\n ext\n );\n });\n\n if (filesToCheck.length === 0) return;\n\n let ts: typeof import('typescript');\n\n try {\n ts = (await import('typescript')).default || (await import('typescript'));\n } catch {\n // TypeScript not installed, skip type checking\n\n return;\n }\n\n const configFileName = ts.findConfigFile(\n configuration.system?.baseDir ?? process.cwd(),\n ts.sys.fileExists,\n 'tsconfig.json'\n );\n\n let compilerOptions: any = {\n noEmit: true,\n\n allowJs: true,\n\n resolveJsonModule: true,\n };\n\n if (configFileName) {\n const configFileText = ts.sys.readFile(configFileName);\n\n if (configFileText) {\n const configJson = ts.parseConfigFileTextToJson(\n configFileName,\n\n configFileText\n );\n\n if (!configJson.error) {\n const parsedConfig = ts.parseJsonConfigFileContent(\n configJson.config,\n\n ts.sys,\n\n dirname(configFileName)\n );\n\n const { incremental, tsBuildInfoFile, ...restOptions } =\n parsedConfig.options;\n\n compilerOptions = { ...compilerOptions, ...restOptions, noEmit: true };\n }\n }\n }\n\n const program = ts.createProgram(filesToCheck, compilerOptions);\n\n filesToCheck.forEach((filePath) => {\n const sourceFile = program.getSourceFile(filePath);\n\n if (!sourceFile) return;\n\n const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);\n\n diagnostics.forEach((diagnostic) => {\n const message = ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n\n '\\n'\n );\n\n if (diagnostic.file && diagnostic.start !== undefined) {\n const { line, character } =\n diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n\n appLogger(\n `TS Error in ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`,\n\n { level: 'warn' }\n );\n }\n });\n });\n};\n"],"mappings":";;;;;AAIA,MAAa,sBAAsB,OACjC,WACA,kBACG;CACH,MAAM,sDAAyB,aAAa;CAE5C,MAAM,eAAe,UAAU,QAAQ,SAAS;EAC9C,MAAM,6BAAc,IAAI;EAExB,OAAO;GAAC;GAAO;GAAQ;GAAO;GAAQ;GAAQ;GAAQ;EAAO,EAAE,SAC7D,GACF;CACF,CAAC;CAED,IAAI,aAAa,WAAW,GAAG;CAE/B,IAAI;CAEJ,IAAI;EACF,MAAM,MAAM,OAAO,eAAe,WAAY,MAAM,OAAO;CAC7D,QAAQ;EAGN;CACF;CAEA,MAAM,iBAAiB,GAAG,eACxB,cAAc,QAAQ,WAAW,QAAQ,IAAI,GAC7C,GAAG,IAAI,YACP,eACF;CAEA,IAAI,kBAAuB;EACzB,QAAQ;EAER,SAAS;EAET,mBAAmB;CACrB;CAEA,IAAI,gBAAgB;EAClB,MAAM,iBAAiB,GAAG,IAAI,SAAS,cAAc;EAErD,IAAI,gBAAgB;GAClB,MAAM,aAAa,GAAG,0BACpB,gBAEA,cACF;GAEA,IAAI,CAAC,WAAW,OAAO;IASrB,MAAM,EAAE,aAAa,iBAAiB,GAAG,gBARpB,GAAG,2BACtB,WAAW,QAEX,GAAG,4BAEK,cAAc,CAIX,EAAE;IAEf,kBAAkB;KAAE,GAAG;KAAiB,GAAG;KAAa,QAAQ;IAAK;GACvE;EACF;CACF;CAEA,MAAM,UAAU,GAAG,cAAc,cAAc,eAAe;CAE9D,aAAa,SAAS,aAAa;EACjC,MAAM,aAAa,QAAQ,cAAc,QAAQ;EAEjD,IAAI,CAAC,YAAY;EAIjB,AAFoB,GAAG,sBAAsB,SAAS,UAE5C,EAAE,SAAS,eAAe;GAClC,MAAM,UAAU,GAAG,6BACjB,WAAW,aAEX,IACF;GAEA,IAAI,WAAW,QAAQ,WAAW,UAAU,QAAW;IACrD,MAAM,EAAE,MAAM,cACZ,WAAW,KAAK,8BAA8B,WAAW,KAAK;IAEhE,UACE,eAAe,WAAW,KAAK,SAAS,IAAI,OAAO,EAAE,GAAG,YAAY,EAAE,KAAK,WAE3E,EAAE,OAAO,OAAO,CAClB;GACF;EACF,CAAC;CACH,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_reduceDictionaryContent_applyMask = require('./applyMask.cjs');
4
3
  let _intlayer_core_plugins = require("@intlayer/core/plugins");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"reduceDictionaryContent.cjs","names":["applyMask"],"sources":["../../../src/reduceDictionaryContent/reduceDictionaryContent.ts"],"sourcesContent":["import { getMaskContent } from '@intlayer/core/plugins';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { applyMask } from './applyMask';\n\nexport const reduceDictionaryContent = (\n fullDictionary: Dictionary,\n partialDictionary: Dictionary\n) => {\n const mask = getMaskContent(partialDictionary);\n const result = applyMask(fullDictionary, mask);\n\n return result;\n};\n"],"mappings":";;;;;;AAIA,MAAa,2BACX,gBACA,sBACG;CAIH,OAFeA,oDAAU,2DADG,iBACgB,CAEhC;AACd"}
1
+ {"version":3,"file":"reduceDictionaryContent.cjs","names":["applyMask"],"sources":["../../../src/reduceDictionaryContent/reduceDictionaryContent.ts"],"sourcesContent":["import { getMaskContent } from '@intlayer/core/plugins';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { applyMask } from './applyMask';\n\nexport const reduceDictionaryContent = (\n fullDictionary: Dictionary,\n partialDictionary: Dictionary\n) => {\n const mask = getMaskContent(partialDictionary);\n const result = applyMask(fullDictionary, mask);\n\n return result;\n};\n"],"mappings":";;;;;AAIA,MAAa,2BACX,gBACA,sBACG;CAIH,OAFeA,oDAAU,2DADG,iBACgB,CAEhC;AACd"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let node_path = require("node:path");
4
3
  let node_fs = require("node:fs");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"readDictionariesFromDisk.cjs","names":[],"sources":["../../../src/utils/readDictionariesFromDisk.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { basename, extname, join } from 'node:path';\n\n/**\n * Reads all JSON dictionary files from a directory, keyed by filename.\n * Uses readFileSync instead of require() to avoid require.cache memory leak.\n */\nexport const readDictionariesFromDisk = <T = Record<string, any>>(\n directory: string\n): T => {\n const dictionaries: Record<string, any> = {};\n\n if (existsSync(directory)) {\n const files = readdirSync(directory).filter((file) =>\n file.endsWith('.json')\n );\n\n for (const file of files) {\n const key = basename(file, extname(file));\n dictionaries[key] = JSON.parse(\n readFileSync(join(directory, file), 'utf-8')\n );\n }\n }\n\n return dictionaries as T;\n};\n"],"mappings":";;;;;;;;;;AAOA,MAAa,4BACX,cACM;CACN,MAAM,eAAoC,CAAC;CAE3C,4BAAe,SAAS,GAAG;EACzB,MAAM,iCAAoB,SAAS,EAAE,QAAQ,SAC3C,KAAK,SAAS,OAAO,CACvB;EAEA,KAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,8BAAe,6BAAc,IAAI,CAAC;GACxC,aAAa,OAAO,KAAK,oDACL,WAAW,IAAI,GAAG,OAAO,CAC7C;EACF;CACF;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"readDictionariesFromDisk.cjs","names":[],"sources":["../../../src/utils/readDictionariesFromDisk.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { basename, extname, join } from 'node:path';\n\n/**\n * Reads all JSON dictionary files from a directory, keyed by filename.\n * Uses readFileSync instead of require() to avoid require.cache memory leak.\n */\nexport const readDictionariesFromDisk = <T = Record<string, any>>(\n directory: string\n): T => {\n const dictionaries: Record<string, any> = {};\n\n if (existsSync(directory)) {\n const files = readdirSync(directory).filter((file) =>\n file.endsWith('.json')\n );\n\n for (const file of files) {\n const key = basename(file, extname(file));\n dictionaries[key] = JSON.parse(\n readFileSync(join(directory, file), 'utf-8')\n );\n }\n }\n\n return dictionaries as T;\n};\n"],"mappings":";;;;;;;;;AAOA,MAAa,4BACX,cACM;CACN,MAAM,eAAoC,CAAC;CAE3C,4BAAe,SAAS,GAAG;EACzB,MAAM,iCAAoB,SAAS,EAAE,QAAQ,SAC3C,KAAK,SAAS,OAAO,CACvB;EAEA,KAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,8BAAe,6BAAc,IAAI,CAAC;GACxC,aAAa,OAAO,KAAK,oDACL,WAAW,IAAI,GAAG,OAAO,CAC7C;EACF;CACF;CAEA,OAAO;AACT"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let node_path = require("node:path");
4
3
 
5
4
  //#region src/utils/resolveRelativePath.ts
@@ -1 +1 @@
1
- {"version":3,"file":"resolveRelativePath.cjs","names":[],"sources":["../../../src/utils/resolveRelativePath.ts"],"sourcesContent":["import { dirname, isAbsolute, normalize, resolve } from 'node:path';\n\nexport const resolveRelativePath = (\n path: string,\n sourcePath: string,\n baseDir: string\n) => {\n // Handle absolute paths\n if (isAbsolute(path)) {\n const normalizedResult = normalize(path);\n const normalizedBaseDir = normalize(baseDir);\n\n // Check if it's relative to baseDir (starts with /)\n // but not a system path (like /usr/local)\n if (\n path.startsWith('/') &&\n !normalizedResult.startsWith(normalizedBaseDir)\n ) {\n // Try to resolve it relative to baseDir first\n const relativeToBase = resolve(baseDir, path.substring(1));\n\n // If the path doesn't exist in common system directories, treat as relative to baseDir\n if (\n !path.startsWith('/usr/') &&\n !path.startsWith('/etc/') &&\n !path.startsWith('/var/') &&\n !path.startsWith('/home/') &&\n !path.startsWith('/Users/') &&\n !path.startsWith('/tmp/') &&\n !path.startsWith('/private/') &&\n !path.startsWith('/opt/')\n ) {\n return relativeToBase;\n }\n }\n\n // It's a true system absolute path\n return normalizedResult;\n }\n\n // Handle relative paths (starting with ./ or ../)\n if (path.startsWith('./') || path.startsWith('../')) {\n const fileDir = dirname(sourcePath);\n return resolve(fileDir, path);\n }\n\n // Default case: treat as relative to baseDir\n return resolve(baseDir, path);\n};\n"],"mappings":";;;;;AAEA,MAAa,uBACX,MACA,YACA,YACG;CAEH,8BAAe,IAAI,GAAG;EACpB,MAAM,4CAA6B,IAAI;EACvC,MAAM,6CAA8B,OAAO;EAI3C,IACE,KAAK,WAAW,GAAG,KACnB,CAAC,iBAAiB,WAAW,iBAAiB,GAC9C;GAEA,MAAM,wCAAyB,SAAS,KAAK,UAAU,CAAC,CAAC;GAGzD,IACE,CAAC,KAAK,WAAW,OAAO,KACxB,CAAC,KAAK,WAAW,OAAO,KACxB,CAAC,KAAK,WAAW,OAAO,KACxB,CAAC,KAAK,WAAW,QAAQ,KACzB,CAAC,KAAK,WAAW,SAAS,KAC1B,CAAC,KAAK,WAAW,OAAO,KACxB,CAAC,KAAK,WAAW,WAAW,KAC5B,CAAC,KAAK,WAAW,OAAO,GAExB,OAAO;EAEX;EAGA,OAAO;CACT;CAGA,IAAI,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK,GAEhD,qDADwB,UACH,GAAG,IAAI;CAI9B,8BAAe,SAAS,IAAI;AAC9B"}
1
+ {"version":3,"file":"resolveRelativePath.cjs","names":[],"sources":["../../../src/utils/resolveRelativePath.ts"],"sourcesContent":["import { dirname, isAbsolute, normalize, resolve } from 'node:path';\n\nexport const resolveRelativePath = (\n path: string,\n sourcePath: string,\n baseDir: string\n) => {\n // Handle absolute paths\n if (isAbsolute(path)) {\n const normalizedResult = normalize(path);\n const normalizedBaseDir = normalize(baseDir);\n\n // Check if it's relative to baseDir (starts with /)\n // but not a system path (like /usr/local)\n if (\n path.startsWith('/') &&\n !normalizedResult.startsWith(normalizedBaseDir)\n ) {\n // Try to resolve it relative to baseDir first\n const relativeToBase = resolve(baseDir, path.substring(1));\n\n // If the path doesn't exist in common system directories, treat as relative to baseDir\n if (\n !path.startsWith('/usr/') &&\n !path.startsWith('/etc/') &&\n !path.startsWith('/var/') &&\n !path.startsWith('/home/') &&\n !path.startsWith('/Users/') &&\n !path.startsWith('/tmp/') &&\n !path.startsWith('/private/') &&\n !path.startsWith('/opt/')\n ) {\n return relativeToBase;\n }\n }\n\n // It's a true system absolute path\n return normalizedResult;\n }\n\n // Handle relative paths (starting with ./ or ../)\n if (path.startsWith('./') || path.startsWith('../')) {\n const fileDir = dirname(sourcePath);\n return resolve(fileDir, path);\n }\n\n // Default case: treat as relative to baseDir\n return resolve(baseDir, path);\n};\n"],"mappings":";;;;AAEA,MAAa,uBACX,MACA,YACA,YACG;CAEH,8BAAe,IAAI,GAAG;EACpB,MAAM,4CAA6B,IAAI;EACvC,MAAM,6CAA8B,OAAO;EAI3C,IACE,KAAK,WAAW,GAAG,KACnB,CAAC,iBAAiB,WAAW,iBAAiB,GAC9C;GAEA,MAAM,wCAAyB,SAAS,KAAK,UAAU,CAAC,CAAC;GAGzD,IACE,CAAC,KAAK,WAAW,OAAO,KACxB,CAAC,KAAK,WAAW,OAAO,KACxB,CAAC,KAAK,WAAW,OAAO,KACxB,CAAC,KAAK,WAAW,QAAQ,KACzB,CAAC,KAAK,WAAW,SAAS,KAC1B,CAAC,KAAK,WAAW,OAAO,KACxB,CAAC,KAAK,WAAW,WAAW,KAC5B,CAAC,KAAK,WAAW,OAAO,GAExB,OAAO;EAEX;EAGA,OAAO;CACT;CAGA,IAAI,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK,GAEhD,qDADwB,UACH,GAAG,IAAI;CAI9B,8BAAe,SAAS,IAAI;AAC9B"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let node_child_process = require("node:child_process");
4
3
 
5
4
  //#region src/utils/runParallel/bin.ts
@@ -1 +1 @@
1
- {"version":3,"file":"bin.cjs","names":[],"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;CACtE,IAAI,CAAC,QAAQ;CACb,IAAI,UAAU,OAAO,KAAK;CAI1B,UAAU,QAAQ,QAAQ,wDAAO,EAAE;CAEnC,OAAO,QAAQ,KAAK,KAAK;AAC3B;;;;;;;;AASA,MAAa,OACX,KACA,MACA,SACA,SACS;CACT,IAAI;CACJ,IAAI;CAEJ,IAAI,OAAO,YAAY,YAAY;EACjC,iBAAiB;EACjB,oBAAoB;CACtB,OAAO;EACL,iBAAiB;EACjB,oBAAoB;CACtB;CAEA,IAAI,WAAW;CACf,MAAM,mCAAyB,KAAK,MAAM,qBAAqB,CAAC,CAAC;CACjE,IAAI,SAAS;CACb,IAAI,SAAS;CAEb,IAAI,GAAG,QACL,GAAG,OAAO,GAAG,SAAS,MAAc;EAClC,UAAU,EAAE,SAAS;CACvB,CAAC;CAGH,IAAI,GAAG,QACL,GAAG,OAAO,GAAG,SAAS,MAAc;EAClC,UAAU,EAAE,SAAS;CACvB,CAAC;CAGH,GAAG,GAAG,UAAU,QAAe;EAC7B,IAAI,UAAU;EACd,WAAW;EACX,eAAe,IAAI,MAAM,OAAO,GAAG,CAAC,CAAC;CACvC,CAAC;CAED,GAAG,GAAG,UAAU,SAAwB;EACtC,IAAI,UAAU;EACd,WAAW;EAEX,MAAM,gBAAgB,YAAY,MAAM;EACxC,IAAI,eACF,OAAO,eAAe,IAAI,MAAM,aAAa,CAAC;EAGhD,eAAe,MAAM,QAAQ,QAAQ,MAAS;CAChD,CAAC;AACH"}
1
+ {"version":3,"file":"bin.cjs","names":[],"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;CACtE,IAAI,CAAC,QAAQ;CACb,IAAI,UAAU,OAAO,KAAK;CAI1B,UAAU,QAAQ,QAAQ,wDAAO,EAAE;CAEnC,OAAO,QAAQ,KAAK,KAAK;AAC3B;;;;;;;;AASA,MAAa,OACX,KACA,MACA,SACA,SACS;CACT,IAAI;CACJ,IAAI;CAEJ,IAAI,OAAO,YAAY,YAAY;EACjC,iBAAiB;EACjB,oBAAoB;CACtB,OAAO;EACL,iBAAiB;EACjB,oBAAoB;CACtB;CAEA,IAAI,WAAW;CACf,MAAM,mCAAyB,KAAK,MAAM,qBAAqB,CAAC,CAAC;CACjE,IAAI,SAAS;CACb,IAAI,SAAS;CAEb,IAAI,GAAG,QACL,GAAG,OAAO,GAAG,SAAS,MAAc;EAClC,UAAU,EAAE,SAAS;CACvB,CAAC;CAGH,IAAI,GAAG,QACL,GAAG,OAAO,GAAG,SAAS,MAAc;EAClC,UAAU,EAAE,SAAS;CACvB,CAAC;CAGH,GAAG,GAAG,UAAU,QAAe;EAC7B,IAAI,UAAU;EACd,WAAW;EACX,eAAe,IAAI,MAAM,OAAO,GAAG,CAAC,CAAC;CACvC,CAAC;CAED,GAAG,GAAG,UAAU,SAAwB;EACtC,IAAI,UAAU;EACd,WAAW;EAEX,MAAM,gBAAgB,YAAY,MAAM;EACxC,IAAI,eACF,OAAO,eAAe,IAAI,MAAM,aAAa,CAAC;EAGhD,eAAe,MAAM,QAAQ,QAAQ,MAAS;CAChD,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_utils_runParallel_spawnPosix = require('./spawnPosix.cjs');
4
3
  const require_utils_runParallel_spawnWin32 = require('./spawnWin32.cjs');
5
4
  let node_path = require("node:path");
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["delimiter","spawnWin32","spawnPosix"],"sources":["../../../../src/utils/runParallel/index.ts"],"sourcesContent":["import { delimiter, join } from 'node:path';\nimport { spawnPosix } from './spawnPosix';\nimport { spawnWin32 } from './spawnWin32';\n\nexport type ParallelHandle = {\n kill: () => void;\n result: Promise<any>;\n commandText: string;\n};\n\n/**\n * Start a cross-platform parallel process using npm-run-all approach.\n * Accepts either a single string (e.g., 'next start') or an array of tokens (e.g., ['next', 'start']).\n */\nexport const runParallel = (proc?: string | string[]): ParallelHandle => {\n if (!proc || (Array.isArray(proc) && proc.length === 0))\n throw new Error('Invalid command');\n\n const commandText = Array.isArray(proc) ? proc.join(' ') : proc;\n\n const isArray = Array.isArray(proc);\n const command = isArray ? (proc as string[])[0] : commandText;\n const args = isArray ? (proc as string[]).slice(1) : [];\n\n // Ensure local binaries (node_modules/.bin) are resolvable\n const cwdBin = join(process.cwd(), 'node_modules', '.bin');\n const PATH_KEY =\n Object.keys(process.env).find((key) => key.toLowerCase() === 'path') ??\n 'PATH';\n\n const extendedPath = [cwdBin, process.env[PATH_KEY] ?? '']\n .filter(Boolean)\n .join(delimiter);\n\n const childEnv = {\n ...process.env,\n [PATH_KEY]: extendedPath,\n } as NodeJS.ProcessEnv;\n\n const isWin = process.platform === 'win32';\n const spawnFunc = isWin ? spawnWin32 : spawnPosix;\n\n // Spawn options\n const spawnOptions = {\n cwd: process.cwd(),\n stdio: 'inherit' as const,\n env: childEnv,\n shell: isWin,\n };\n\n // Spawn the child process\n const child = isArray\n ? // If provided as a single string element that includes spaces, treat it like a shell command\n args.length === 0 && /\\s/.test(command)\n ? isWin\n ? spawnFunc(\n process.env.ComSpec ?? 'cmd.exe',\n ['/d', '/s', '/c', command],\n spawnOptions\n )\n : spawnFunc(\n process.env.SHELL ?? '/bin/sh',\n ['-c', command],\n spawnOptions\n )\n : spawnFunc(command, args, spawnOptions)\n : isWin\n ? spawnFunc(\n process.env.ComSpec ?? 'cmd.exe',\n ['/d', '/s', '/c', commandText],\n spawnOptions\n )\n : spawnFunc(\n process.env.SHELL ?? '/bin/sh',\n ['-c', commandText],\n spawnOptions\n );\n\n const result = new Promise<void>((resolve, reject) => {\n child.on('error', (err) => {\n try {\n console.error(\n `[runParallel] Failed to start: ${err?.message ?? String(err)}`\n );\n } catch {}\n reject(err);\n });\n\n child.on('exit', (code, signal) => {\n // Treat common termination signals as graceful exits, not failures\n const gracefulSignals = ['SIGINT', 'SIGTERM', 'SIGQUIT', 'SIGHUP'];\n // Also treat shell-convention exit codes (128 + signal number) as graceful:\n // 129 = SIGHUP, 130 = SIGINT, 131 = SIGQUIT, 143 = SIGTERM\n const gracefulSignalCodes = new Set([129, 130, 131, 143]);\n if (\n code === 0 ||\n gracefulSignalCodes.has(code ?? -1) ||\n (signal && gracefulSignals.includes(signal))\n ) {\n resolve();\n } else {\n reject(\n Object.assign(new Error('Parallel process failed'), { code, signal })\n );\n }\n });\n });\n\n const kill = () => {\n try {\n child.kill('SIGTERM');\n } catch {\n // Best effort\n }\n };\n\n const handleExit = () => kill();\n\n const handleSigInt = () => {\n kill();\n process.off('SIGINT', handleSigInt);\n process.kill(process.pid, 'SIGINT'); // Propagate to allow natural shutdown\n };\n\n const handleSigTerm = () => {\n kill();\n process.off('SIGTERM', handleSigTerm);\n process.kill(process.pid, 'SIGTERM'); // Propagate to allow natural shutdown\n };\n\n process.on('exit', handleExit);\n process.on('SIGINT', handleSigInt);\n process.on('SIGTERM', handleSigTerm);\n\n child.on('exit', () => {\n process.off('exit', handleExit);\n process.off('SIGINT', handleSigInt);\n process.off('SIGTERM', handleSigTerm);\n });\n\n return { kill, result, commandText };\n};\n"],"mappings":";;;;;;;;;;;AAcA,MAAa,eAAe,SAA6C;CACvE,IAAI,CAAC,QAAS,MAAM,QAAQ,IAAI,KAAK,KAAK,WAAW,GACnD,MAAM,IAAI,MAAM,iBAAiB;CAEnC,MAAM,cAAc,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK,GAAG,IAAI;CAE3D,MAAM,UAAU,MAAM,QAAQ,IAAI;CAClC,MAAM,UAAU,UAAW,KAAkB,KAAK;CAClD,MAAM,OAAO,UAAW,KAAkB,MAAM,CAAC,IAAI,CAAC;CAGtD,MAAM,6BAAc,QAAQ,IAAI,GAAG,gBAAgB,MAAM;CACzD,MAAM,WACJ,OAAO,KAAK,QAAQ,GAAG,EAAE,MAAM,QAAQ,IAAI,YAAY,MAAM,MAAM,KACnE;CAEF,MAAM,eAAe,CAAC,QAAQ,QAAQ,IAAI,aAAa,EAAE,EACtD,OAAO,OAAO,EACd,KAAKA,mBAAS;CAEjB,MAAM,WAAW;EACf,GAAG,QAAQ;GACV,WAAW;CACd;CAEA,MAAM,QAAQ,QAA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,sBAAsB;EAC1B,KAAK;EACL,QAAQ,IAAI,WAAW,aAAa;EACpC,QAAQ,KAAK,QAAQ,KAAK,SAAS;CACrC;CAEA,QAAQ,GAAG,QAAQ,UAAU;CAC7B,QAAQ,GAAG,UAAU,YAAY;CACjC,QAAQ,GAAG,WAAW,aAAa;CAEnC,MAAM,GAAG,cAAc;EACrB,QAAQ,IAAI,QAAQ,UAAU;EAC9B,QAAQ,IAAI,UAAU,YAAY;EAClC,QAAQ,IAAI,WAAW,aAAa;CACtC,CAAC;CAED,OAAO;EAAE;EAAM;EAAQ;CAAY;AACrC"}
1
+ {"version":3,"file":"index.cjs","names":["delimiter","spawnWin32","spawnPosix"],"sources":["../../../../src/utils/runParallel/index.ts"],"sourcesContent":["import { delimiter, join } from 'node:path';\nimport { spawnPosix } from './spawnPosix';\nimport { spawnWin32 } from './spawnWin32';\n\nexport type ParallelHandle = {\n kill: () => void;\n result: Promise<any>;\n commandText: string;\n};\n\n/**\n * Start a cross-platform parallel process using npm-run-all approach.\n * Accepts either a single string (e.g., 'next start') or an array of tokens (e.g., ['next', 'start']).\n */\nexport const runParallel = (proc?: string | string[]): ParallelHandle => {\n if (!proc || (Array.isArray(proc) && proc.length === 0))\n throw new Error('Invalid command');\n\n const commandText = Array.isArray(proc) ? proc.join(' ') : proc;\n\n const isArray = Array.isArray(proc);\n const command = isArray ? (proc as string[])[0] : commandText;\n const args = isArray ? (proc as string[]).slice(1) : [];\n\n // Ensure local binaries (node_modules/.bin) are resolvable\n const cwdBin = join(process.cwd(), 'node_modules', '.bin');\n const PATH_KEY =\n Object.keys(process.env).find((key) => key.toLowerCase() === 'path') ??\n 'PATH';\n\n const extendedPath = [cwdBin, process.env[PATH_KEY] ?? '']\n .filter(Boolean)\n .join(delimiter);\n\n const childEnv = {\n ...process.env,\n [PATH_KEY]: extendedPath,\n } as NodeJS.ProcessEnv;\n\n const isWin = process.platform === 'win32';\n const spawnFunc = isWin ? spawnWin32 : spawnPosix;\n\n // Spawn options\n const spawnOptions = {\n cwd: process.cwd(),\n stdio: 'inherit' as const,\n env: childEnv,\n shell: isWin,\n };\n\n // Spawn the child process\n const child = isArray\n ? // If provided as a single string element that includes spaces, treat it like a shell command\n args.length === 0 && /\\s/.test(command)\n ? isWin\n ? spawnFunc(\n process.env.ComSpec ?? 'cmd.exe',\n ['/d', '/s', '/c', command],\n spawnOptions\n )\n : spawnFunc(\n process.env.SHELL ?? '/bin/sh',\n ['-c', command],\n spawnOptions\n )\n : spawnFunc(command, args, spawnOptions)\n : isWin\n ? spawnFunc(\n process.env.ComSpec ?? 'cmd.exe',\n ['/d', '/s', '/c', commandText],\n spawnOptions\n )\n : spawnFunc(\n process.env.SHELL ?? '/bin/sh',\n ['-c', commandText],\n spawnOptions\n );\n\n const result = new Promise<void>((resolve, reject) => {\n child.on('error', (err) => {\n try {\n console.error(\n `[runParallel] Failed to start: ${err?.message ?? String(err)}`\n );\n } catch {}\n reject(err);\n });\n\n child.on('exit', (code, signal) => {\n // Treat common termination signals as graceful exits, not failures\n const gracefulSignals = ['SIGINT', 'SIGTERM', 'SIGQUIT', 'SIGHUP'];\n // Also treat shell-convention exit codes (128 + signal number) as graceful:\n // 129 = SIGHUP, 130 = SIGINT, 131 = SIGQUIT, 143 = SIGTERM\n const gracefulSignalCodes = new Set([129, 130, 131, 143]);\n if (\n code === 0 ||\n gracefulSignalCodes.has(code ?? -1) ||\n (signal && gracefulSignals.includes(signal))\n ) {\n resolve();\n } else {\n reject(\n Object.assign(new Error('Parallel process failed'), { code, signal })\n );\n }\n });\n });\n\n const kill = () => {\n try {\n child.kill('SIGTERM');\n } catch {\n // Best effort\n }\n };\n\n const handleExit = () => kill();\n\n const handleSigInt = () => {\n kill();\n process.off('SIGINT', handleSigInt);\n process.kill(process.pid, 'SIGINT'); // Propagate to allow natural shutdown\n };\n\n const handleSigTerm = () => {\n kill();\n process.off('SIGTERM', handleSigTerm);\n process.kill(process.pid, 'SIGTERM'); // Propagate to allow natural shutdown\n };\n\n process.on('exit', handleExit);\n process.on('SIGINT', handleSigInt);\n process.on('SIGTERM', handleSigTerm);\n\n child.on('exit', () => {\n process.off('exit', handleExit);\n process.off('SIGINT', handleSigInt);\n process.off('SIGTERM', handleSigTerm);\n });\n\n return { kill, result, commandText };\n};\n"],"mappings":";;;;;;;;;;AAcA,MAAa,eAAe,SAA6C;CACvE,IAAI,CAAC,QAAS,MAAM,QAAQ,IAAI,KAAK,KAAK,WAAW,GACnD,MAAM,IAAI,MAAM,iBAAiB;CAEnC,MAAM,cAAc,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK,GAAG,IAAI;CAE3D,MAAM,UAAU,MAAM,QAAQ,IAAI;CAClC,MAAM,UAAU,UAAW,KAAkB,KAAK;CAClD,MAAM,OAAO,UAAW,KAAkB,MAAM,CAAC,IAAI,CAAC;CAGtD,MAAM,6BAAc,QAAQ,IAAI,GAAG,gBAAgB,MAAM;CACzD,MAAM,WACJ,OAAO,KAAK,QAAQ,GAAG,EAAE,MAAM,QAAQ,IAAI,YAAY,MAAM,MAAM,KACnE;CAEF,MAAM,eAAe,CAAC,QAAQ,QAAQ,IAAI,aAAa,EAAE,EACtD,OAAO,OAAO,EACd,KAAKA,mBAAS;CAEjB,MAAM,WAAW;EACf,GAAG,QAAQ;GACV,WAAW;CACd;CAEA,MAAM,QAAQ,QAAQ,aAAa;CACnC,MAAM,YAAY,QAAQC,kDAAaC;CAGvC,MAAM,eAAe;EACnB,KAAK,QAAQ,IAAI;EACjB,OAAO;EACP,KAAK;EACL,OAAO;CACT;CAGA,MAAM,QAAQ,UAEV,KAAK,WAAW,KAAK,KAAK,KAAK,OAAO,IACpC,QACE,UACE,QAAQ,IAAI,WAAW,WACvB;EAAC;EAAM;EAAM;EAAM;CAAO,GAC1B,YACF,IACA,UACE,QAAQ,IAAI,SAAS,WACrB,CAAC,MAAM,OAAO,GACd,YACF,IACF,UAAU,SAAS,MAAM,YAAY,IACvC,QACE,UACE,QAAQ,IAAI,WAAW,WACvB;EA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ty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let node_stream = require("node:stream");
4
3
 
5
4
  //#region src/utils/runParallel/runTask.ts
@@ -1 +1 @@
1
- {"version":3,"file":"runTask.cjs","names":["Writable"],"sources":["../../../../src/utils/runParallel/runTask.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport { Writable } from 'node:stream';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Remove the given value from the array.\n */\nconst remove = <T>(array: T[], x: T): void => {\n const index = array.indexOf(x);\n if (index !== -1) {\n array.splice(index, 1);\n }\n};\n\nconst signals: Record<string, number> = {\n // Signal name mappings to their respective standard numeric codes.\n // See: https://man7.org/linux/man-pages/man7/signal.7.html\n\n SIGABRT: 6, // Abort signal from abort(3)\n SIGALRM: 14, // Timer signal from alarm(2)\n SIGBUS: 10, // Bus error (bad memory access)\n SIGCHLD: 20, // Child stopped or terminated\n SIGCONT: 19, // Continue if stopped\n SIGFPE: 8, // Floating point exception\n SIGHUP: 1, // Hangup detected on controlling terminal or death of controlling process\n SIGILL: 4, // Illegal Instruction\n SIGINT: 2, // Interrupt from keyboard (Ctrl+C)\n SIGKILL: 9, // Kill signal (cannot be caught or ignored)\n SIGPIPE: 13, // Broken pipe: write to pipe with no readers\n SIGQUIT: 3, // Quit from keyboard (Ctrl+\\)\n SIGSEGV: 11, // Invalid memory reference (segmentation fault)\n SIGSTOP: 17, // Stop process (cannot be caught or ignored)\n SIGTERM: 15, // Termination signal\n SIGTRAP: 5, // Trace/breakpoint trap\n SIGTSTP: 18, // Stop typed at tty (Ctrl+Z)\n SIGTTIN: 21, // tty input for background process\n SIGTTOU: 22, // tty output for background process\n SIGUSR1: 30, // User-defined signal 1\n SIGUSR2: 31, // User-defined signal 2\n};\n\n/**\n * Converts a signal name to a number.\n */\nconst convert = (signal: string): number => {\n return signals[signal] || 0;\n};\n\n/**\n * Simple in-memory writable stream\n */\nclass MemoryStream extends Writable {\n private chunks: Buffer[] = [];\n\n _write(\n chunk: Buffer,\n _encoding: string,\n callback: (error?: Error | null) => void\n ): void {\n this.chunks.push(chunk);\n callback();\n }\n\n toString(): string {\n return Buffer.concat(this.chunks).toString('utf8');\n }\n}\n\n//------------------------------------------------------------------------------\n// Types\n//------------------------------------------------------------------------------\n\ninterface TaskResult {\n name: string;\n code: number | null;\n signal?: string | null;\n}\n\ninterface TaskQueueItem {\n name: string;\n index: number;\n}\n\ninterface RunTaskOptions {\n stdout: NodeJS.WritableStream;\n stderr?: NodeJS.WritableStream;\n aggregateOutput?: boolean;\n continueOnError?: boolean;\n race?: boolean;\n maxParallel?: number;\n}\n\ninterface TaskPromise extends Promise<TaskResult> {\n abort?: () => void;\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Run npm-scripts of given names in parallel.\n *\n * If a npm-script exited with a non-zero code, this aborts other all npm-scripts.\n *\n * Note: This is a simplified version for our use case.\n * The full implementation would require the actual runTask function from npm-run-all.\n */\nexport const runTasks = (\n tasks: string[],\n options: RunTaskOptions\n): Promise<TaskResult[]> => {\n return new Promise((resolve, reject) => {\n if (tasks.length === 0) {\n resolve([]);\n return;\n }\n\n const results: TaskResult[] = tasks.map((task) => ({\n name: task,\n code: undefined as any,\n }));\n const queue: TaskQueueItem[] = tasks.map((task, index) => ({\n name: task,\n index,\n }));\n const promises: TaskPromise[] = [];\n let error: Error | null = null;\n let aborted = false;\n\n /**\n * Done.\n */\n const done = (): void => {\n if (error == null) {\n resolve(results);\n } else {\n reject(error);\n }\n };\n\n /**\n * Aborts all tasks.\n */\n const abort = (): void => {\n if (aborted) {\n return;\n }\n aborted = true;\n\n if (promises.length === 0) {\n done();\n } else {\n for (const p of promises) {\n p.abort?.();\n }\n Promise.all(promises).then(done, reject);\n }\n };\n\n /**\n * Runs a next task.\n */\n const next = (): void => {\n if (aborted) {\n return;\n }\n if (queue.length === 0) {\n if (promises.length === 0) {\n done();\n }\n return;\n }\n\n const originalOutputStream = options.stdout;\n const optionsClone = { ...options };\n const writer = new MemoryStream();\n\n if (options.aggregateOutput) {\n optionsClone.stdout = writer as any;\n }\n\n const task = queue.shift()!;\n\n // Note: This requires the actual runTask implementation from npm-run-all\n // For now, this is a placeholder that would need to be implemented\n const promise = Promise.resolve({\n name: task.name,\n code: 0,\n signal: null,\n }) as TaskPromise;\n\n promises.push(promise);\n promise.then(\n (result) => {\n remove(promises, promise);\n if (aborted) {\n return;\n }\n\n if (options.aggregateOutput) {\n originalOutputStream.write(writer.toString());\n }\n\n // Check if the task failed as a result of a signal, and\n // amend the exit code as a result.\n if (\n result.code === null &&\n result.signal !== null &&\n result.signal !== undefined\n ) {\n // An exit caused by a signal must return a status code\n // of 128 plus the value of the signal code.\n // Ref: https://nodejs.org/api/process.html#process_exit_codes\n result.code = 128 + convert(result.signal);\n }\n\n // Save the result.\n results[task.index].code = result.code;\n\n // Aborts all tasks if it's an error.\n if (result.code) {\n error = new Error(\n `Task ${result.name} failed with code ${result.code}`\n );\n if (!options.continueOnError) {\n abort();\n return;\n }\n }\n\n // Aborts all tasks if options.race is true.\n if (options.race && !result.code) {\n abort();\n return;\n }\n\n // Call the next task.\n next();\n },\n (thisError: Error) => {\n remove(promises, promise);\n if (!options.continueOnError || options.race) {\n error = thisError;\n abort();\n return;\n }\n next();\n }\n );\n };\n\n const max = options.maxParallel;\n const end =\n typeof max === 'number' && max > 0\n ? Math.min(tasks.length, max)\n : tasks.length;\n for (let i = 0; i < end; ++i) {\n next();\n }\n });\n};\n"],"mappings":";;;;;;;;AAaA,MAAM,UAAa,OAAY,MAAe;CAC5C,MAAM,QAAQ,MAAM,QAAQ,CAAC;CAC7B,IAAI,UAAU,IACZ,MAAM,OAAO,OAAO,CAAC;AAEzB;AAEA,MAAM,UAAkC;CAItC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;C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C,MAAM,eAAe,EAAE,GAAG,QAAQ;GAClC,MAAM,SAAS,IAAI,aAAa;GAEhC,IAAI,QAAQ,iBACV,aAAa,SAAS;GAGxB,MAAM,OAAO,MAAM,MAAM;GAIzB,MAAM,UAAU,QAAQ,QAAQ;IAC9B,MAAM,KAAK;IACX,MAAM;IACN,QAAQ;GACV,CAAC;GAED,SAAS,KAAK,OAAO;GACrB,QAAQ,MACL,WAAW;IACV,OAAO,UAAU,OAAO;IACxB,IAAI,SACF;IAGF,IAAI,QAAQ,iBACV,qBAAqB,MAAM,OAAO,SAAS,CAAC;IAK9C,IACE,OAAO,SAAS,QAChB,OAAO,WAAW,QAClB,OAAO,WAAW,QAKlB,OAAO,OAAO,MAAM,QAAQ,OAAO,MAAM;IAI3C,QAAQ,KAAK,OAAO,OAAO,OAAO;IAGlC,IAAI,OAAO,MAAM;KACf,wBAAQ,IAAI,MACV,QAAQ,OAAO,KAAK,oBAAoB,OAAO,MACjD;KACA,IAAI,CAAC,QAAQ,iBAAiB;MAC5B,MAAM;MACN;KACF;IACF;IAGA,IAAI,QAAQ,QAAQ,CAAC,OAAO,MAAM;KAChC,MAAM;KACN;IACF;IAGA,KAAK;GACP,IACC,cAAqB;IACpB,OAAO,UAAU,OAAO;IACxB,IAAI,CAAC,QAAQ,mBAAmB,QAAQ,MAAM;KAC5C,QAAQ;KACR,MAAM;KACN;IACF;IACA,KAAK;GACP,CACF;EACF;EAEA,MAAM,MAAM,QAAQ;EACpB,MAAM,MACJ,OAAO,QAAQ,YAAY,MAAM,IAC7B,KAAK,IAAI,MAAM,QAAQ,GAAG,IAC1B,MAAM;EACZ,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,EAAE,GACzB,KAAK;CAET,CAAC;AACH"}
1
+ {"version":3,"file":"runTask.cjs","names":["Writable"],"sources":["../../../../src/utils/runParallel/runTask.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport { Writable } from 'node:stream';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Remove the given value from the array.\n */\nconst remove = <T>(array: T[], x: T): void => {\n const index = array.indexOf(x);\n if (index !== -1) {\n array.splice(index, 1);\n }\n};\n\nconst signals: Record<string, number> = {\n // Signal name mappings to their respective standard numeric codes.\n // See: https://man7.org/linux/man-pages/man7/signal.7.html\n\n SIGABRT: 6, // Abort signal from abort(3)\n SIGALRM: 14, // Timer signal from alarm(2)\n SIGBUS: 10, // Bus error (bad memory access)\n SIGCHLD: 20, // Child stopped or terminated\n SIGCONT: 19, // Continue if stopped\n SIGFPE: 8, // Floating point exception\n SIGHUP: 1, // Hangup detected on controlling terminal or death of controlling process\n SIGILL: 4, // Illegal Instruction\n SIGINT: 2, // Interrupt from keyboard (Ctrl+C)\n SIGKILL: 9, // Kill signal (cannot be caught or ignored)\n SIGPIPE: 13, // Broken pipe: write to pipe with no readers\n SIGQUIT: 3, // Quit from keyboard (Ctrl+\\)\n SIGSEGV: 11, // Invalid memory reference (segmentation fault)\n SIGSTOP: 17, // Stop process (cannot be caught or ignored)\n SIGTERM: 15, // Termination signal\n SIGTRAP: 5, // Trace/breakpoint trap\n SIGTSTP: 18, // Stop typed at tty (Ctrl+Z)\n SIGTTIN: 21, // tty input for background process\n SIGTTOU: 22, // tty output for background process\n SIGUSR1: 30, // User-defined signal 1\n SIGUSR2: 31, // User-defined signal 2\n};\n\n/**\n * Converts a signal name to a number.\n */\nconst convert = (signal: string): number => {\n return signals[signal] || 0;\n};\n\n/**\n * Simple in-memory writable stream\n */\nclass MemoryStream extends Writable {\n private chunks: Buffer[] = [];\n\n _write(\n chunk: Buffer,\n _encoding: string,\n callback: (error?: Error | null) => void\n ): void {\n this.chunks.push(chunk);\n callback();\n }\n\n toString(): string {\n return Buffer.concat(this.chunks).toString('utf8');\n }\n}\n\n//------------------------------------------------------------------------------\n// Types\n//------------------------------------------------------------------------------\n\ninterface TaskResult {\n name: string;\n code: number | null;\n signal?: string | null;\n}\n\ninterface TaskQueueItem {\n name: string;\n index: number;\n}\n\ninterface RunTaskOptions {\n stdout: NodeJS.WritableStream;\n stderr?: NodeJS.WritableStream;\n aggregateOutput?: boolean;\n continueOnError?: boolean;\n race?: boolean;\n maxParallel?: number;\n}\n\ninterface TaskPromise extends Promise<TaskResult> {\n abort?: () => void;\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Run npm-scripts of given names in parallel.\n *\n * If a npm-script exited with a non-zero code, this aborts other all npm-scripts.\n *\n * Note: This is a simplified version for our use case.\n * The full implementation would require the actual runTask function from npm-run-all.\n */\nexport const runTasks = (\n tasks: string[],\n options: RunTaskOptions\n): Promise<TaskResult[]> => {\n return new Promise((resolve, reject) => {\n if (tasks.length === 0) {\n resolve([]);\n return;\n }\n\n const results: TaskResult[] = tasks.map((task) => ({\n name: task,\n code: undefined as any,\n }));\n const queue: TaskQueueItem[] = tasks.map((task, index) => ({\n name: task,\n index,\n }));\n const promises: TaskPromise[] = [];\n let error: Error | null = null;\n let aborted = false;\n\n /**\n * Done.\n */\n const done = (): void => {\n if (error == null) {\n resolve(results);\n } else {\n reject(error);\n }\n };\n\n /**\n * Aborts all tasks.\n */\n const abort = (): void => {\n if (aborted) {\n return;\n }\n aborted = true;\n\n if (promises.length === 0) {\n done();\n } else {\n for (const p of promises) {\n p.abort?.();\n }\n Promise.all(promises).then(done, reject);\n }\n };\n\n /**\n * Runs a next task.\n */\n const next = (): void => {\n if (aborted) {\n return;\n }\n if (queue.length === 0) {\n if (promises.length === 0) {\n done();\n }\n return;\n }\n\n const originalOutputStream = options.stdout;\n const optionsClone = { ...options };\n const writer = new MemoryStream();\n\n if (options.aggregateOutput) {\n optionsClone.stdout = writer as any;\n }\n\n const task = queue.shift()!;\n\n // Note: This requires the actual runTask implementation from npm-run-all\n // For now, this is a placeholder that would need to be implemented\n const promise = Promise.resolve({\n name: task.name,\n code: 0,\n signal: null,\n }) as TaskPromise;\n\n promises.push(promise);\n promise.then(\n (result) => {\n remove(promises, promise);\n if (aborted) {\n return;\n }\n\n if (options.aggregateOutput) {\n originalOutputStream.write(writer.toString());\n }\n\n // Check if the task failed as a result of a signal, and\n // amend the exit code as a result.\n if (\n result.code === null &&\n result.signal !== null &&\n result.signal !== undefined\n ) {\n // An exit caused by a signal must return a status code\n // of 128 plus the value of the signal code.\n // Ref: https://nodejs.org/api/process.html#process_exit_codes\n result.code = 128 + convert(result.signal);\n }\n\n // Save the result.\n results[task.index].code = result.code;\n\n // Aborts all tasks if it's an error.\n if (result.code) {\n error = new Error(\n `Task ${result.name} failed with code ${result.code}`\n );\n if (!options.continueOnError) {\n abort();\n return;\n }\n }\n\n // Aborts all tasks if options.race is true.\n if (options.race && !result.code) {\n abort();\n return;\n }\n\n // Call the next task.\n next();\n },\n (thisError: Error) => {\n remove(promises, promise);\n if (!options.continueOnError || options.race) {\n error = thisError;\n abort();\n return;\n }\n next();\n }\n );\n };\n\n const max = options.maxParallel;\n const end =\n typeof max === 'number' && max > 0\n ? Math.min(tasks.length, max)\n : tasks.length;\n for (let i = 0; i < end; ++i) {\n next();\n }\n });\n};\n"],"mappings":";;;;;;;AAaA,MAAM,UAAa,OAAY,MAAe;CAC5C,MAAM,QAAQ,MAAM,QAAQ,CAAC;CAC7B,IAAI,UAAU,IACZ,MAAM,OAAO,OAAO,CAAC;AAEzB;AAEA,MAAM,UAAkC;CAItC,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;AACX;;;;AAKA,MAAM,WAAW,WAA2B;CAC1C,OAAO,QAAQ,WAAW;AAC5B;;;;AAKA,IAAM,eAAN,cAA2BA,qBAAS;CAClC,AAAQ,SA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AAI,SACF;IAGF,IAAI,QAAQ,iBACV,qBAAqB,MAAM,OAAO,SAAS,CAAC;IAK9C,IACE,OAAO,SAAS,QAChB,OAAO,WAAW,QAClB,OAAO,WAAW,QAKlB,OAAO,OAAO,MAAM,QAAQ,OAAO,MAAM;IAI3C,QAAQ,KAAK,OAAO,OAAO,OAAO;IAGlC,IAAI,OAAO,MAAM;KACf,wBAAQ,IAAI,MACV,QAAQ,OAAO,KAAK,oBAAoB,OAAO,MACjD;KACA,IAAI,CAAC,QAAQ,iBAAiB;MAC5B,MAAM;MACN;KACF;IACF;IAGA,IAAI,QAAQ,QAAQ,CAAC,OAAO,MAAM;KAChC,MAAM;KACN;IACF;IAGA,KAAK;GACP,IACC,cAAqB;IACpB,OAAO,UAAU,OAAO;IACxB,IAAI,CAAC,QAAQ,mBAAmB,QAAQ,MAAM;KAC5C,QAAQ;KACR,MAAM;KACN;IACF;IACA,KAAK;GACP,CACF;EACF;EAEA,MAAM,MAAM,QAAQ;EACpB,MAAM,MACJ,OAAO,QAAQ,YAAY,MAAM,IAC7B,KAAK,IAAI,MAAM,QAAQ,GAAG,IAC1B,MAAM;EACZ,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,EAAE,GACzB,KAAK;CAET,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let node_child_process = require("node:child_process");
4
3
 
5
4
  //#region src/utils/runParallel/spawnPosix.ts
@@ -1 +1 @@
1
- {"version":3,"file":"spawnPosix.cjs","names":[],"sources":["../../../../src/utils/runParallel/spawnPosix.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport type { SpawnOptions } from 'node:child_process';\nimport { type ChildProcess, spawn as nodeSpawn } from 'node:child_process';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Kills the new process and its sub processes synchronously using\n * process group kill (negative PID). This ensures all descendants\n * are terminated before the parent calls process.exit().\n */\nconst createKillHandler = (\n child: ChildProcess\n): ((signal?: NodeJS.Signals | number) => boolean) => {\n return (signal?: NodeJS.Signals | number): boolean => {\n if (!child.pid) return false;\n\n const killSignal = signal ?? 'SIGTERM';\n\n // Use synchronous process group kill (negative PID) as primary strategy.\n // This kills the entire process group (shell + all descendants) immediately.\n try {\n process.kill(-child.pid, killSignal);\n return true;\n } catch {\n // Process group kill failed (e.g., process not a group leader).\n }\n\n // Fallback: kill the child process directly.\n try {\n process.kill(child.pid, killSignal);\n } catch {\n // ignore — process may have already exited.\n }\n\n return true;\n };\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Launches a new process with the given command.\n * This is almost same as `child_process.spawn`.\n *\n * This returns a `ChildProcess` instance.\n * `kill` method of the instance kills the new process and its sub processes.\n *\n * @param command - The command to run.\n * @param args - List of string arguments.\n * @param options - Options.\n * @returns A ChildProcess instance of new process.\n * @private\n */\nexport const spawnPosix = (\n command: string,\n args: string[],\n options: SpawnOptions\n): ChildProcess => {\n // Spawn detached so the child becomes its own process group leader.\n // This allows killing the entire tree via process.kill(-pid, signal).\n const child = nodeSpawn(command, args, { ...options, detached: true });\n child.kill = createKillHandler(child);\n\n return child;\n};\n"],"mappings":";;;;;;;;;;AAgBA,MAAM,qBACJ,UACoD;CACpD,QAAQ,WAA8C;EACpD,IAAI,CAAC,MAAM,KAAK,OAAO;EAEvB,MAAM,aAAa,UAAU;EAI7B,IAAI;GACF,QAAQ,KAAK,CAAC,MAAM,KAAK,UAAU;GACnC,OAAO;EACT,QAAQ,CAER;EAGA,IAAI;GACF,QAAQ,KAAK,MAAM,KAAK,UAAU;EACpC,QAAQ,CAER;EAEA,OAAO;CACT;AACF;;;;;;;;;;;;;;AAmBA,MAAa,cACX,SACA,MACA,YACiB;CAGjB,MAAM,sCAAkB,SAAS,MAAM;EAAE,GAAG;EAAS,UAAU;CAAK,CAAC;CACrE,MAAM,OAAO,kBAAkB,KAAK;CAEpC,OAAO;AACT"}
1
+ {"version":3,"file":"spawnPosix.cjs","names":[],"sources":["../../../../src/utils/runParallel/spawnPosix.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport type { SpawnOptions } from 'node:child_process';\nimport { type ChildProcess, spawn as nodeSpawn } from 'node:child_process';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Kills the new process and its sub processes synchronously using\n * process group kill (negative PID). This ensures all descendants\n * are terminated before the parent calls process.exit().\n */\nconst createKillHandler = (\n child: ChildProcess\n): ((signal?: NodeJS.Signals | number) => boolean) => {\n return (signal?: NodeJS.Signals | number): boolean => {\n if (!child.pid) return false;\n\n const killSignal = signal ?? 'SIGTERM';\n\n // Use synchronous process group kill (negative PID) as primary strategy.\n // This kills the entire process group (shell + all descendants) immediately.\n try {\n process.kill(-child.pid, killSignal);\n return true;\n } catch {\n // Process group kill failed (e.g., process not a group leader).\n }\n\n // Fallback: kill the child process directly.\n try {\n process.kill(child.pid, killSignal);\n } catch {\n // ignore — process may have already exited.\n }\n\n return true;\n };\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Launches a new process with the given command.\n * This is almost same as `child_process.spawn`.\n *\n * This returns a `ChildProcess` instance.\n * `kill` method of the instance kills the new process and its sub processes.\n *\n * @param command - The command to run.\n * @param args - List of string arguments.\n * @param options - Options.\n * @returns A ChildProcess instance of new process.\n * @private\n */\nexport const spawnPosix = (\n command: string,\n args: string[],\n options: SpawnOptions\n): ChildProcess => {\n // Spawn detached so the child becomes its own process group leader.\n // This allows killing the entire tree via process.kill(-pid, signal).\n const child = nodeSpawn(command, args, { ...options, detached: true });\n child.kill = createKillHandler(child);\n\n return child;\n};\n"],"mappings":";;;;;;;;;AAgBA,MAAM,qBACJ,UACoD;CACpD,QAAQ,WAA8C;EACpD,IAAI,CAAC,MAAM,KAAK,OAAO;EAEvB,MAAM,aAAa,UAAU;EAI7B,IAAI;GACF,QAAQ,KAAK,CAAC,MAAM,KAAK,UAAU;GACnC,OAAO;EACT,QAAQ,CAER;EAGA,IAAI;GACF,QAAQ,KAAK,MAAM,KAAK,UAAU;EACpC,QAAQ,CAER;EAEA,OAAO;CACT;AACF;;;;;;;;;;;;;;AAmBA,MAAa,cACX,SACA,MACA,YACiB;CAGjB,MAAM,sCAAkB,SAAS,MAAM;EAAE,GAAG;EAAS,UAAU;CAAK,CAAC;CACrE,MAAM,OAAO,kBAAkB,KAAK;CAEpC,OAAO;AACT"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  let node_child_process = require("node:child_process");
4
3
 
5
4
  //#region src/utils/runParallel/spawnWin32.ts
@@ -1 +1 @@
1
- {"version":3,"file":"spawnWin32.cjs","names":[],"sources":["../../../../src/utils/runParallel/spawnWin32.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport type { SpawnOptions } from 'node:child_process';\nimport {\n type ChildProcess,\n spawn as nodeSpawn,\n spawnSync,\n} from 'node:child_process';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Kills the new process and its sub processes forcibly.\n */\nconst createKillHandler = (child: ChildProcess) => {\n return (): boolean => {\n if (!child.pid) return false;\n\n try {\n // This MUST be synchronous. Otherwise, it dies with the parent process.\n spawnSync('taskkill', ['/F', '/T', '/PID', String(child.pid)], {\n stdio: 'ignore',\n });\n } catch {\n // ignore\n }\n\n return true;\n };\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Launches a new process with the given command.\n * This is almost same as `child_process.spawn`.\n *\n * This returns a `ChildProcess` instance.\n * `kill` method of the instance kills the new process and its sub processes forcibly.\n *\n * @param command - The command to run.\n * @param args - List of string arguments.\n * @param options - Options.\n * @returns A ChildProcess instance of new process.\n * @private\n */\nexport const spawnWin32 = (\n command: string,\n args: string[],\n options: SpawnOptions\n): ChildProcess => {\n const child = nodeSpawn(command, args, options);\n child.kill = createKillHandler(child);\n\n return child;\n};\n"],"mappings":";;;;;;;;AAkBA,MAAM,qBAAqB,UAAwB;CACjD,aAAsB;EACpB,IAAI,CAAC,MAAM,KAAK,OAAO;EAEvB,IAAI;GAEF,kCAAU,YAAY;IAAC;IAAM;IAAM;IAAQ,OAAO,MAAM,GAAG;GAAC,GAAG,EAC7D,OAAO,SACT,CAAC;EACH,QAAQ,CAER;EAEA,OAAO;CACT;AACF;;;;;;;;;;;;;;AAmBA,MAAa,cACX,SACA,MACA,YACiB;CACjB,MAAM,sCAAkB,SAAS,MAAM,OAAO;CAC9C,MAAM,OAAO,kBAAkB,KAAK;CAEpC,OAAO;AACT"}
1
+ {"version":3,"file":"spawnWin32.cjs","names":[],"sources":["../../../../src/utils/runParallel/spawnWin32.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport type { SpawnOptions } from 'node:child_process';\nimport {\n type ChildProcess,\n spawn as nodeSpawn,\n spawnSync,\n} from 'node:child_process';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Kills the new process and its sub processes forcibly.\n */\nconst createKillHandler = (child: ChildProcess) => {\n return (): boolean => {\n if (!child.pid) return false;\n\n try {\n // This MUST be synchronous. Otherwise, it dies with the parent process.\n spawnSync('taskkill', ['/F', '/T', '/PID', String(child.pid)], {\n stdio: 'ignore',\n });\n } catch {\n // ignore\n }\n\n return true;\n };\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Launches a new process with the given command.\n * This is almost same as `child_process.spawn`.\n *\n * This returns a `ChildProcess` instance.\n * `kill` method of the instance kills the new process and its sub processes forcibly.\n *\n * @param command - The command to run.\n * @param args - List of string arguments.\n * @param options - Options.\n * @returns A ChildProcess instance of new process.\n * @private\n */\nexport const spawnWin32 = (\n command: string,\n args: string[],\n options: SpawnOptions\n): ChildProcess => {\n const child = nodeSpawn(command, args, options);\n child.kill = createKillHandler(child);\n\n return child;\n};\n"],"mappings":";;;;;;;AAkBA,MAAM,qBAAqB,UAAwB;CACjD,aAAsB;EACpB,IAAI,CAAC,MAAM,KAAK,OAAO;EAEvB,IAAI;GAEF,kCAAU,YAAY;IAAC;IAAM;IAAM;IAAQ,OAAO,MAAM,GAAG;GAAC,GAAG,EAC7D,OAAO,SACT,CAAC;EACH,QAAQ,CAER;EAEA,OAAO;CACT;AACF;;;;;;;;;;;;;;AAmBA,MAAa,cACX,SACA,MACA,YACiB;CACjB,MAAM,sCAAkB,SAAS,MAAM,OAAO;CAC9C,MAAM,OAAO,kBAAkB,KAAK;CAEpC,OAAO;AACT"}
@@ -14,11 +14,8 @@ const generateConfigurationContent = (configuration, format) => {
14
14
  fileContent += `const dictionary = ${JSON.stringify(dictionary, null, 2)};\n`;
15
15
  fileContent += `const build = ${JSON.stringify(build, null, 2)};\n`;
16
16
  fileContent += `const compiler = ${JSON.stringify(compiler, null, 2)};\n`;
17
- fileContent += `const configuration = { internationalization, routing, editor, log, system, content, ai, dictionary, build, compiler };\n`;
18
- if (format === "esm") {
19
- fileContent += `\nexport { internationalization, routing, editor, log, system, content, ai, dictionary, build, compiler, configuration };\n`;
20
- fileContent += `export default configuration;\n`;
21
- } else {
17
+ if (format === "esm") fileContent += `\nexport { internationalization, routing, editor, log, system, content, ai, dictionary, build, compiler };\n`;
18
+ else {
22
19
  fileContent += `\nmodule.exports.internationalization = internationalization;\n`;
23
20
  fileContent += `module.exports.routing = routing;\n`;
24
21
  fileContent += `module.exports.editor = editor;\n`;
@@ -29,7 +26,6 @@ const generateConfigurationContent = (configuration, format) => {
29
26
  fileContent += `module.exports.dictionary = dictionary;\n`;
30
27
  fileContent += `module.exports.build = build;\n`;
31
28
  fileContent += `module.exports.compiler = compiler;\n`;
32
- fileContent += `module.exports = configuration;\n`;
33
29
  }
34
30
  return fileContent;
35
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"generateConfigurationContent.cjs","names":[],"sources":["../../../src/writeConfiguration/generateConfigurationContent.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\n\nexport const generateConfigurationContent = (\n configuration: IntlayerConfig,\n format: 'cjs' | 'esm'\n): string => {\n const {\n internationalization,\n routing,\n editor,\n log,\n system,\n content,\n ai,\n dictionary,\n build,\n compiler,\n } = configuration;\n\n let fileContent = '';\n\n fileContent += `const internationalization = ${JSON.stringify(internationalization, null, 2)};\\n`;\n fileContent += `const routing = ${JSON.stringify(routing, null, 2)};\\n`;\n fileContent += `const editor = ${JSON.stringify(editor, null, 2)};\\n`;\n fileContent += `const log = ${JSON.stringify(log, null, 2)};\\n`;\n fileContent += `const system = ${JSON.stringify(system, null, 2)};\\n`;\n fileContent += `const content = ${JSON.stringify(content, null, 2)};\\n`;\n fileContent += `const ai = ${JSON.stringify(ai, null, 2)};\\n`;\n fileContent += `const dictionary = ${JSON.stringify(dictionary, null, 2)};\\n`;\n fileContent += `const build = ${JSON.stringify(build, null, 2)};\\n`;\n fileContent += `const compiler = ${JSON.stringify(compiler, null, 2)};\\n`;\n fileContent += `const configuration = { internationalization, routing, editor, log, system, content, ai, dictionary, build, compiler };\\n`;\n\n if (format === 'esm') {\n fileContent += `\\nexport { internationalization, routing, editor, log, system, content, ai, dictionary, build, compiler, configuration };\\n`;\n fileContent += `export default configuration;\\n`;\n } else {\n fileContent += `\\nmodule.exports.internationalization = internationalization;\\n`;\n fileContent += `module.exports.routing = routing;\\n`;\n fileContent += `module.exports.editor = editor;\\n`;\n fileContent += `module.exports.log = log;\\n`;\n fileContent += `module.exports.system = system;\\n`;\n fileContent += `module.exports.content = content;\\n`;\n fileContent += `module.exports.ai = ai;\\n`;\n fileContent += `module.exports.dictionary = dictionary;\\n`;\n fileContent += `module.exports.build = build;\\n`;\n fileContent += `module.exports.compiler = compiler;\\n`;\n fileContent += `module.exports = configuration;\\n`;\n }\n\n return fileContent;\n};\n"],"mappings":";;;AAEA,MAAa,gCACX,eACA,WACW;CACX,MAAM,EACJ,sBACA,SACA,QACA,KACA,QACA,SACA,IACA,YACA,OACA,aACE;CAEJ,IAAI,cAAc;CAElB,eAAe,gCAAgC,KAAK,UAAU,sBAAsB,MAAM,CAAC,EAAE;CAC7F,eAAe,mBAAmB,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE;CACnE,eAAe,kBAAkB,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE;CACjE,eAAe,eAAe,KAAK,UAAU,KAAK,MAAM,CAAC,EAAE;CAC3D,eAAe,kBAAkB,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE;CACjE,eAAe,mBAAmB,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE;CACnE,eAAe,cAAc,KAAK,UAAU,IAAI,MAAM,CAAC,EAAE;CACzD,eAAe,sBAAsB,KAAK,UAAU,YAAY,MAAM,CAAC,EAAE;CACzE,eAAe,iBAAiB,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE;CAC/D,eAAe,oBAAoB,KAAK,UAAU,UAAU,MAAM,CAAC,EAAE;CACrE,eAAe;CAEf,IAAI,WAAW,OAAO;EACpB,eAAe;EACf,eAAe;CACjB,OAAO;EACL,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;CACjB;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"generateConfigurationContent.cjs","names":[],"sources":["../../../src/writeConfiguration/generateConfigurationContent.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\n\nexport const generateConfigurationContent = (\n configuration: IntlayerConfig,\n format: 'cjs' | 'esm'\n): string => {\n const {\n internationalization,\n routing,\n editor,\n log,\n system,\n content,\n ai,\n dictionary,\n build,\n compiler,\n } = configuration;\n\n let fileContent = '';\n\n fileContent += `const internationalization = ${JSON.stringify(internationalization, null, 2)};\\n`;\n fileContent += `const routing = ${JSON.stringify(routing, null, 2)};\\n`;\n fileContent += `const editor = ${JSON.stringify(editor, null, 2)};\\n`;\n fileContent += `const log = ${JSON.stringify(log, null, 2)};\\n`;\n fileContent += `const system = ${JSON.stringify(system, null, 2)};\\n`;\n fileContent += `const content = ${JSON.stringify(content, null, 2)};\\n`;\n fileContent += `const ai = ${JSON.stringify(ai, null, 2)};\\n`;\n fileContent += `const dictionary = ${JSON.stringify(dictionary, null, 2)};\\n`;\n fileContent += `const build = ${JSON.stringify(build, null, 2)};\\n`;\n fileContent += `const compiler = ${JSON.stringify(compiler, null, 2)};\\n`;\n\n if (format === 'esm') {\n fileContent += `\\nexport { internationalization, routing, editor, log, system, content, ai, dictionary, build, compiler };\\n`;\n } else {\n fileContent += `\\nmodule.exports.internationalization = internationalization;\\n`;\n fileContent += `module.exports.routing = routing;\\n`;\n fileContent += `module.exports.editor = editor;\\n`;\n fileContent += `module.exports.log = log;\\n`;\n fileContent += `module.exports.system = system;\\n`;\n fileContent += `module.exports.content = content;\\n`;\n fileContent += `module.exports.ai = ai;\\n`;\n fileContent += `module.exports.dictionary = dictionary;\\n`;\n fileContent += `module.exports.build = build;\\n`;\n fileContent += `module.exports.compiler = compiler;\\n`;\n }\n\n return fileContent;\n};\n"],"mappings":";;;AAEA,MAAa,gCACX,eACA,WACW;CACX,MAAM,EACJ,sBACA,SACA,QACA,KACA,QACA,SACA,IACA,YACA,OACA,aACE;CAEJ,IAAI,cAAc;CAElB,eAAe,gCAAgC,KAAK,UAAU,sBAAsB,MAAM,CAAC,EAAE;CAC7F,eAAe,mBAAmB,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE;CACnE,eAAe,kBAAkB,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE;CACjE,eAAe,eAAe,KAAK,UAAU,KAAK,MAAM,CAAC,EAAE;CAC3D,eAAe,kBAAkB,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE;CACjE,eAAe,mBAAmB,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE;CACnE,eAAe,cAAc,KAAK,UAAU,IAAI,MAAM,CAAC,EAAE;CACzD,eAAe,sBAAsB,KAAK,UAAU,YAAY,MAAM,CAAC,EAAE;CACzE,eAAe,iBAAiB,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE;CAC/D,eAAe,oBAAoB,KAAK,UAAU,UAAU,MAAM,CAAC,EAAE;CAErE,IAAI,WAAW,OACb,eAAe;MACV;EACL,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;CACjB;CAEA,OAAO;AACT"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_writeFileIfChanged = require('../writeFileIfChanged.cjs');
4
3
  const require_writeConfiguration_generateConfigurationContent = require('./generateConfigurationContent.cjs');
5
4
  let node_fs_promises = require("node:fs/promises");
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["generateConfigurationContent","writeFileIfChanged"],"sources":["../../../src/writeConfiguration/index.ts"],"sourcesContent":["import { mkdir, readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { writeFileIfChanged } from '../writeFileIfChanged';\nimport { generateConfigurationContent } from './generateConfigurationContent';\n\nexport const isCachedConfigurationUpToDate = async (\n configuration: IntlayerConfig\n): Promise<boolean | null> => {\n try {\n const mjsPath = join(configuration.system.configDir, 'configuration.mjs');\n const existingContent = await readFile(mjsPath, 'utf8');\n const expectedContent = generateConfigurationContent(configuration, 'esm');\n return existingContent === expectedContent;\n } catch {\n return null; // Can crash if file doesn't exist yet or config is not defined\n }\n};\n\nexport const writeConfiguration = async (configuration: IntlayerConfig) => {\n const { configDir } = configuration.system;\n\n await mkdir(configDir, { recursive: true });\n\n await Promise.all([\n writeFileIfChanged(\n join(configDir, 'configuration.mjs'),\n generateConfigurationContent(configuration, 'esm')\n ),\n writeFileIfChanged(\n join(configDir, 'configuration.cjs'),\n generateConfigurationContent(configuration, 'cjs')\n ),\n ]);\n};\n"],"mappings":";;;;;;;;AAMA,MAAa,gCAAgC,OAC3C,kBAC4B;CAC5B,IAAI;EAIF,OAAO,yDAHc,cAAc,OAAO,WAAW,mBACR,GAAG,MAAM,MAC9BA,qFAA6B,eAAe,KAC3B;CAC3C,QAAQ;EACN,OAAO;CACT;AACF;AAEA,MAAa,qBAAqB,OAAO,kBAAkC;CACzE,MAAM,EAAE,cAAc,cAAc;CAEpC,kCAAY,WAAW,EAAE,WAAW,KAAK,CAAC;CAE1C,MAAM,QAAQ,IAAI,CAChBC,kEACO,WAAW,mBAAmB,GACnCD,qFAA6B,eAAe,KAAK,CACnD,GACAC,kEACO,WAAW,mBAAmB,GACnCD,qFAA6B,eAAe,KAAK,CACnD,CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.cjs","names":["generateConfigurationContent","writeFileIfChanged"],"sources":["../../../src/writeConfiguration/index.ts"],"sourcesContent":["import { mkdir, readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { writeFileIfChanged } from '../writeFileIfChanged';\nimport { generateConfigurationContent } from './generateConfigurationContent';\n\nexport const isCachedConfigurationUpToDate = async (\n configuration: IntlayerConfig\n): Promise<boolean | null> => {\n try {\n const mjsPath = join(configuration.system.configDir, 'configuration.mjs');\n const existingContent = await readFile(mjsPath, 'utf8');\n const expectedContent = generateConfigurationContent(configuration, 'esm');\n return existingContent === expectedContent;\n } catch {\n return null; // Can crash if file doesn't exist yet or config is not defined\n }\n};\n\nexport const writeConfiguration = async (configuration: IntlayerConfig) => {\n const { configDir } = configuration.system;\n\n await mkdir(configDir, { recursive: true });\n\n await Promise.all([\n writeFileIfChanged(\n join(configDir, 'configuration.mjs'),\n generateConfigurationContent(configuration, 'esm')\n ),\n writeFileIfChanged(\n join(configDir, 'configuration.cjs'),\n generateConfigurationContent(configuration, 'cjs')\n ),\n ]);\n};\n"],"mappings":";;;;;;;AAMA,MAAa,gCAAgC,OAC3C,kBAC4B;CAC5B,IAAI;EAIF,OAAO,yDAHc,cAAc,OAAO,WAAW,mBACR,GAAG,MAAM,MAC9BA,qFAA6B,eAAe,KAC3B;CAC3C,QAAQ;EACN,OAAO;CACT;AACF;AAEA,MAAa,qBAAqB,OAAO,kBAAkC;CACzE,MAAM,EAAE,cAAc,cAAc;CAEpC,kCAAY,WAAW,EAAE,WAAW,KAAK,CAAC;CAE1C,MAAM,QAAQ,IAAI,CAChBC,kEACO,WAAW,mBAAmB,GACnCD,qFAA6B,eAAe,KAAK,CACnD,GACAC,kEACO,WAAW,mBAAmB,GACnCD,qFAA6B,eAAe,KAAK,CACnD,CACF,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_utils_readDictionariesFromDisk = require('../utils/readDictionariesFromDisk.cjs');
4
3
  const require_utils_getFormatFromExtension = require('../utils/getFormatFromExtension.cjs');
5
4
  const require_detectFormatCommand = require('../detectFormatCommand.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"writeContentDeclaration.cjs","names":["processContentDeclarationContent","getFormatFromExtension","COMPILER_NO_METADATA","readDictionariesFromDisk","writeMarkdownFile","writeYamlFile","transformJSONFile","detectFormatCommand","writeJSFile"],"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, extname, join, resolve } from 'node:path';\nimport { isDeepStrictEqual } from 'node:util';\nimport { COMPILER_NO_METADATA } from '@intlayer/config/defaultValues';\nimport {\n getFilteredLocalesDictionary,\n getPerLocaleDictionary,\n} from '@intlayer/core/plugins';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { detectFormatCommand } from '../detectFormatCommand';\nimport {\n type Extension,\n getFormatFromExtension,\n} from '../utils/getFormatFromExtension';\nimport { readDictionariesFromDisk } from '../utils/readDictionariesFromDisk';\nimport type { DictionaryStatus } from './dictionaryStatus';\nimport { processContentDeclarationContent } from './processContentDeclarationContent';\nimport { transformJSONFile } from './transformJSONFile';\nimport { writeJSFile } from './writeJSFile';\nimport { writeMarkdownFile } from './writeMarkdownFile';\nimport { writeYamlFile } from './writeYamlFile';\n\nconst formatContentDeclaration = async (\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n localeList?: LocalesValues[]\n) => {\n /**\n * Clean Markdown, Insertion, File, etc. node metadata\n */\n const processedDictionary =\n await processContentDeclarationContent(dictionary);\n\n let content = processedDictionary.content;\n\n /**\n * Filter locales content\n */\n\n if (dictionary.locale) {\n content = getPerLocaleDictionary(\n processedDictionary,\n dictionary.locale\n ).content;\n } else if (localeList) {\n content = getFilteredLocalesDictionary(\n processedDictionary,\n localeList\n ).content;\n }\n\n let pluginFormatResult: any = {\n ...dictionary,\n content,\n } satisfies Dictionary;\n\n /**\n * Format the dictionary with the plugins\n */\n\n for await (const plugin of configuration.plugins ?? []) {\n if (plugin.formatOutput) {\n const formattedResult = await plugin.formatOutput?.({\n dictionary: pluginFormatResult,\n configuration,\n });\n\n if (formattedResult) {\n pluginFormatResult = formattedResult;\n }\n }\n }\n\n const isDictionaryFormat =\n pluginFormatResult.content && pluginFormatResult.key;\n\n if (!isDictionaryFormat) return pluginFormatResult;\n\n // Build result from the original dictionary so that extra user-defined fields\n // (e.g. custom frontmatter in markdown files) are preserved.\n // Strip internal-only fields that must never appear in persisted output.\n const INTERNAL_FIELDS = new Set([\n '$schema',\n 'filePath',\n 'localId',\n 'localIds',\n 'projectIds',\n ]);\n\n const preservedFields = Object.fromEntries(\n Object.entries(dictionary as Record<string, unknown>).filter(\n ([k]) => !INTERNAL_FIELDS.has(k)\n )\n );\n\n let result: Dictionary = {\n ...preservedFields,\n content,\n } as Dictionary;\n\n /**\n * Add $schema to JSON dictionaries\n */\n const extension = (\n dictionary.filePath ? extname(dictionary.filePath) : '.json'\n ) as Extension;\n const format = getFormatFromExtension(extension);\n\n if (\n format === 'json' &&\n pluginFormatResult.content &&\n pluginFormatResult.key\n ) {\n result = {\n $schema: 'https://intlayer.org/schema.json',\n ...result,\n };\n }\n\n return result;\n};\n\ntype WriteContentDeclarationOptions = {\n newDictionariesPath?: string;\n localeList?: LocalesValues[];\n fallbackLocale?: Locale;\n};\n\nconst defaultOptions = {\n newDictionariesPath: 'intlayer-dictionaries',\n} satisfies WriteContentDeclarationOptions;\n\nexport const writeContentDeclaration = async (\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n options?: WriteContentDeclarationOptions\n): Promise<{ status: DictionaryStatus; path: string }> => {\n const { system, compiler } = configuration;\n const { baseDir } = system;\n\n const noMetadata = compiler?.noMetadata ?? COMPILER_NO_METADATA;\n const { newDictionariesPath, localeList } = {\n ...defaultOptions,\n ...options,\n };\n\n const newDictionaryLocationPath = join(baseDir, newDictionariesPath);\n\n const unmergedDictionariesRecord = readDictionariesFromDisk<\n Record<string, Dictionary[]>\n >(configuration.system.unmergedDictionariesDir);\n const unmergedDictionaries = unmergedDictionariesRecord[\n dictionary.key\n ] as Dictionary[];\n\n const existingDictionary = unmergedDictionaries?.find(\n (el) => el.localId === dictionary.localId\n );\n\n const formattedContentDeclaration = await formatContentDeclaration(\n dictionary,\n configuration,\n localeList\n );\n\n if (existingDictionary?.filePath) {\n // Compare existing dictionary content with new dictionary content\n const isSameContent = isDeepStrictEqual(existingDictionary, dictionary);\n\n const filePath = resolve(\n configuration.system.baseDir,\n existingDictionary.filePath\n );\n\n // Up to date, nothing to do\n if (isSameContent) {\n return {\n status: 'up-to-date',\n path: filePath,\n };\n }\n\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return { status: 'updated', path: filePath };\n }\n\n if (dictionary.filePath) {\n const filePath = resolve(configuration.system.baseDir, dictionary.filePath);\n\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return { status: 'created', path: filePath };\n }\n\n // No existing dictionary, write to new location\n const contentDeclarationPath = join(\n newDictionaryLocationPath,\n `${dictionary.key}.content.json`\n );\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n};\n\nconst writeFileWithDirectories = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n noMetadata?: boolean\n): Promise<void> => {\n // Extract the directory from the file path\n const dir = dirname(absoluteFilePath);\n\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n\n const extension = extname(absoluteFilePath);\n\n if (extension === '.md' || extension === '.mdx') {\n await writeMarkdownFile(absoluteFilePath, dictionary, configuration);\n return;\n }\n\n if (extension === '.yaml' || extension === '.yml') {\n await writeYamlFile(absoluteFilePath, dictionary, configuration);\n return;\n }\n\n // Handle JSON, JSONC, and JSON5 via the AST transformer\n if (['.json', '.jsonc', '.json5'].includes(extension)) {\n let fileContent = '{}';\n\n if (existsSync(absoluteFilePath)) {\n try {\n fileContent = await readFile(absoluteFilePath, 'utf-8');\n } catch {\n // ignore read errors, start with empty object\n }\n }\n\n const transformedContent = transformJSONFile(\n fileContent,\n dictionary,\n noMetadata\n );\n\n // We use standard writeFile because transformedContent is already a string\n const tempDir = configuration.system?.tempDir;\n if (tempDir) {\n await mkdir(tempDir, { recursive: true });\n }\n\n const tempFileName = `${basename(absoluteFilePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${absoluteFilePath}.${tempFileName}`;\n try {\n await writeFile(tempPath, transformedContent, 'utf-8');\n await rename(tempPath, absoluteFilePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // Ignore\n }\n throw error;\n }\n\n const formatCommand = detectFormatCommand(configuration);\n\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', absoluteFilePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,\n });\n } catch (error) {\n console.error(error);\n }\n }\n\n return;\n }\n\n const knownJsExtensions = new Set([\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ]);\n\n if (!knownJsExtensions.has(extension)) {\n // Unknown extension (e.g. .po managed by a plugin) — skip; the plugin\n // owns this file format and writeJSFile / prettier would corrupt it.\n return;\n }\n\n await writeJSFile(absoluteFilePath, dictionary, configuration, noMetadata);\n\n // remove the cache as content has changed\n // Will force a new preparation of the intlayer on next build\n try {\n const sentinelPath = join(\n configuration.system.cacheDir,\n 'intlayer-prepared.lock'\n );\n await rm(sentinelPath, { recursive: true });\n } catch {}\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BA,MAAM,2BAA2B,OAC/B,YACA,eACA,eACG;;;;CAIH,MAAM,sBACJ,MAAMA,kGAAiC,UAAU;CAEnD,IAAI,UAAU,oBAAoB;;;;CAMlC,IAAI,WAAW,QACb,6DACE,qBACA,WAAW,MACb,EAAE;MACG,IAAI,YACT,mEACE,qBACA,UACF,EAAE;CAGJ,IAAI,qBAA0B;EAC5B,GAAG;EACH;CACF;;;;CAMA,WAAW,MAAM,UAAU,cAAc,WAAW,CAAC,GACnD,IAAI,OAAO,cAAc;EACvB,MAAM,kBAAkB,MAAM,OAAO,eAAe;GAClD,YAAY;GACZ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vD,IAAI,eACF,IAAI;GACF,iCAAS,cAAc,QAAQ,YAAY,gBAAgB,GAAG;IAC5D,OAAO;IACP,KAAK,cAAc,OAAO;GAC5B,CAAC;EACH,SAAS,OAAO;GACd,QAAQ,MAAM,KAAK;EACrB;EAGF;CACF;CAWA,IAAI,CAAC,IATyB,IAAI;EAChC;EACA;EACA;EACA;EACA;EACA;CACF,CAEqB,EAAE,IAAI,SAAS,GAGlC;CAGF,MAAMC,wDAAY,kBAAkB,YAAY,eAAe,UAAU;CAIzE,IAAI;EAKF,mDAHE,cAAc,OAAO,UACrB,wBAEkB,GAAG,EAAE,WAAW,KAAK,CAAC;CAC5C,QAAQ,CAAC;AACX"}
1
+ {"version":3,"file":"writeContentDeclaration.cjs","names":["processContentDeclarationContent","getFormatFromExtension","COMPILER_NO_METADATA","readDictionariesFromDisk","writeMarkdownFile","writeYamlFile","transformJSONFile","detectFormatCommand","writeJSFile"],"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, extname, join, resolve } from 'node:path';\nimport { isDeepStrictEqual } from 'node:util';\nimport { COMPILER_NO_METADATA } from '@intlayer/config/defaultValues';\nimport {\n getFilteredLocalesDictionary,\n getPerLocaleDictionary,\n} from '@intlayer/core/plugins';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { detectFormatCommand } from '../detectFormatCommand';\nimport {\n type Extension,\n getFormatFromExtension,\n} from '../utils/getFormatFromExtension';\nimport { readDictionariesFromDisk } from '../utils/readDictionariesFromDisk';\nimport type { DictionaryStatus } from './dictionaryStatus';\nimport { processContentDeclarationContent } from './processContentDeclarationContent';\nimport { transformJSONFile } from './transformJSONFile';\nimport { writeJSFile } from './writeJSFile';\nimport { writeMarkdownFile } from './writeMarkdownFile';\nimport { writeYamlFile } from './writeYamlFile';\n\nconst formatContentDeclaration = async (\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n localeList?: LocalesValues[]\n) => {\n /**\n * Clean Markdown, Insertion, File, etc. node metadata\n */\n const processedDictionary =\n await processContentDeclarationContent(dictionary);\n\n let content = processedDictionary.content;\n\n /**\n * Filter locales content\n */\n\n if (dictionary.locale) {\n content = getPerLocaleDictionary(\n processedDictionary,\n dictionary.locale\n ).content;\n } else if (localeList) {\n content = getFilteredLocalesDictionary(\n processedDictionary,\n localeList\n ).content;\n }\n\n let pluginFormatResult: any = {\n ...dictionary,\n content,\n } satisfies Dictionary;\n\n /**\n * Format the dictionary with the plugins\n */\n\n for await (const plugin of configuration.plugins ?? []) {\n if (plugin.formatOutput) {\n const formattedResult = await plugin.formatOutput?.({\n dictionary: pluginFormatResult,\n configuration,\n });\n\n if (formattedResult) {\n pluginFormatResult = formattedResult;\n }\n }\n }\n\n const isDictionaryFormat =\n pluginFormatResult.content && pluginFormatResult.key;\n\n if (!isDictionaryFormat) return pluginFormatResult;\n\n // Build result from the original dictionary so that extra user-defined fields\n // (e.g. custom frontmatter in markdown files) are preserved.\n // Strip internal-only fields that must never appear in persisted output.\n const INTERNAL_FIELDS = new Set([\n '$schema',\n 'filePath',\n 'localId',\n 'localIds',\n 'projectIds',\n ]);\n\n const preservedFields = Object.fromEntries(\n Object.entries(dictionary as Record<string, unknown>).filter(\n ([k]) => !INTERNAL_FIELDS.has(k)\n )\n );\n\n let result: Dictionary = {\n ...preservedFields,\n content,\n } as Dictionary;\n\n /**\n * Add $schema to JSON dictionaries\n */\n const extension = (\n dictionary.filePath ? extname(dictionary.filePath) : '.json'\n ) as Extension;\n const format = getFormatFromExtension(extension);\n\n if (\n format === 'json' &&\n pluginFormatResult.content &&\n pluginFormatResult.key\n ) {\n result = {\n $schema: 'https://intlayer.org/schema.json',\n ...result,\n };\n }\n\n return result;\n};\n\ntype WriteContentDeclarationOptions = {\n newDictionariesPath?: string;\n localeList?: LocalesValues[];\n fallbackLocale?: Locale;\n};\n\nconst defaultOptions = {\n newDictionariesPath: 'intlayer-dictionaries',\n} satisfies WriteContentDeclarationOptions;\n\nexport const writeContentDeclaration = async (\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n options?: WriteContentDeclarationOptions\n): Promise<{ status: DictionaryStatus; path: string }> => {\n const { system, compiler } = configuration;\n const { baseDir } = system;\n\n const noMetadata = compiler?.noMetadata ?? COMPILER_NO_METADATA;\n const { newDictionariesPath, localeList } = {\n ...defaultOptions,\n ...options,\n };\n\n const newDictionaryLocationPath = join(baseDir, newDictionariesPath);\n\n const unmergedDictionariesRecord = readDictionariesFromDisk<\n Record<string, Dictionary[]>\n >(configuration.system.unmergedDictionariesDir);\n const unmergedDictionaries = unmergedDictionariesRecord[\n dictionary.key\n ] as Dictionary[];\n\n const existingDictionary = unmergedDictionaries?.find(\n (el) => el.localId === dictionary.localId\n );\n\n const formattedContentDeclaration = await formatContentDeclaration(\n dictionary,\n configuration,\n localeList\n );\n\n if (existingDictionary?.filePath) {\n // Compare existing dictionary content with new dictionary content\n const isSameContent = isDeepStrictEqual(existingDictionary, dictionary);\n\n const filePath = resolve(\n configuration.system.baseDir,\n existingDictionary.filePath\n );\n\n // Up to date, nothing to do\n if (isSameContent) {\n return {\n status: 'up-to-date',\n path: filePath,\n };\n }\n\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return { status: 'updated', path: filePath };\n }\n\n if (dictionary.filePath) {\n const filePath = resolve(configuration.system.baseDir, dictionary.filePath);\n\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return { status: 'created', path: filePath };\n }\n\n // No existing dictionary, write to new location\n const contentDeclarationPath = join(\n newDictionaryLocationPath,\n `${dictionary.key}.content.json`\n );\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n};\n\nconst writeFileWithDirectories = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n noMetadata?: boolean\n): Promise<void> => {\n // Extract the directory from the file path\n const dir = dirname(absoluteFilePath);\n\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n\n const extension = extname(absoluteFilePath);\n\n if (extension === '.md' || extension === '.mdx') {\n await writeMarkdownFile(absoluteFilePath, dictionary, configuration);\n return;\n }\n\n if (extension === '.yaml' || extension === '.yml') {\n await writeYamlFile(absoluteFilePath, dictionary, configuration);\n return;\n }\n\n // Handle JSON, JSONC, and JSON5 via the AST transformer\n if (['.json', '.jsonc', '.json5'].includes(extension)) {\n let fileContent = '{}';\n\n if (existsSync(absoluteFilePath)) {\n try {\n fileContent = await readFile(absoluteFilePath, 'utf-8');\n } catch {\n // ignore read errors, start with empty object\n }\n }\n\n const transformedContent = transformJSONFile(\n fileContent,\n dictionary,\n noMetadata\n );\n\n // We use standard writeFile because transformedContent is already a string\n const tempDir = configuration.system?.tempDir;\n if (tempDir) {\n await mkdir(tempDir, { recursive: true });\n }\n\n const tempFileName = `${basename(absoluteFilePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${absoluteFilePath}.${tempFileName}`;\n try {\n await writeFile(tempPath, transformedContent, 'utf-8');\n await rename(tempPath, absoluteFilePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // Ignore\n }\n throw error;\n }\n\n const formatCommand = detectFormatCommand(configuration);\n\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', absoluteFilePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,\n });\n } catch (error) {\n console.error(error);\n }\n }\n\n return;\n }\n\n const knownJsExtensions = new Set([\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ]);\n\n if (!knownJsExtensions.has(extension)) {\n // Unknown extension (e.g. .po managed by a plugin) — skip; the plugin\n // owns this file format and writeJSFile / prettier would corrupt it.\n return;\n }\n\n await writeJSFile(absoluteFilePath, dictionary, configuration, noMetadata);\n\n // remove the cache as content has changed\n // Will force a new preparation of the intlayer on next build\n try {\n const sentinelPath = join(\n configuration.system.cacheDir,\n 'intlayer-prepared.lock'\n );\n await rm(sentinelPath, { recursive: true });\n } catch {}\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,MAAM,2BAA2B,OAC/B,YACA,eACA,eACG;;;;CAIH,MAAM,sBACJ,MAAMA,kGAAiC,UAAU;CAEnD,IAAI,UAAU,oBAAoB;;;;CAMlC,IAAI,WAAW,QACb,6DACE,qBACA,WAAW,MACb,EAAE;MACG,IAAI,YACT,mEACE,qBACA,UACF,EAAE;CAGJ,IAAI,qBAA0B;EAC5B,GAAG;EACH;CACF;;;;CAMA,WAAW,MAAM,UAAU,cAAc,WAAW,CAAC,GACnD,IAAI,OAAO,cAAc;EACvB,MAAM,kBAAkB,MAAM,OAAO,eAAe;GAClD,YAAY;GACZ;EACF,CAAC;EAED,IAAI,iBACF,qBAAqB;CAEzB;CAMF,IAAI,EAFF,mBAAmB,WAAW,mBAAmB,MAE1B,OAAO;CAKhC,MAAM,kBAAkB,IAAI,IAAI;EAC9B;EACA;EACA;EACA;EACA;CACF,CAAC;CAQD,IAAI,SAAqB;EACvB,GAPsB,OAAO,YAC7B,OAAO,QAAQ,UAAqC,EAAE,QACnD,CAAC,OAAO,CAAC,gBAAgB,IAAI,CAAC,CACjC,CAIiB;EACjB;CACF;CAUA,IAFeC,4DAFb,WAAW,kCAAmB,WAAW,QAAQ,IAAI,OAKhD,MAAM,UACX,mBAAmB,WACnB,mBAAmB,KAEnB,SAAS;EACP,SAAS;EACT,GAAG;CACL;CAGF,OAAO;AACT;AAQA,MAAM,iBAAiB,EACrB,qBAAqB,wBACvB;AAEA,M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aAAa;EAC/D;CACF;CAGA,IAAI;EAAC;EAAS;EAAU;CAAQ,EAAE,SAAS,SAAS,GAAG;EACrD,IAAI,cAAc;EAElB,4BAAe,gBAAgB,GAC7B,IAAI;GACF,cAAc,qCAAe,kBAAkB,OAAO;EACxD,QAAQ,CAER;EAGF,MAAM,qBAAqBC,oEACzB,aACA,YACA,UACF;EAGA,MAAM,UAAU,cAAc,QAAQ;EACtC,IAAI,SACF,kCAAY,SAAS,EAAE,WAAW,KAAK,CAAC;EAG1C,MAAM,eAAe,2BAAY,gBAAgB,EAAE,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE;EACxG,MAAM,WAAW,8BACR,SAAS,YAAY,IAC1B,GAAG,iBAAiB,GAAG;EAC3B,IAAI;GACF,sCAAgB,UAAU,oBAAoB,OAAO;GACrD,mCAAa,UAAU,gBAAgB;EACzC,SAAS,OAAO;GACd,IAAI;IACF,+BAAS,UAAU,EAAE,OAAO,KAAK,CAAC;GACpC,QAAQ,CAER;GACA,MAAM;EACR;EAEA,MAAM,gBAAgBC,gDAAoB,aAAa;EAEvD,IAAI,eACF,IAAI;GACF,iCAAS,cAAc,QAAQ,YAAY,gBAAgB,GAAG;IAC5D,OAAO;IACP,KAAK,cAAc,OAAO;GAC5B,CAAC;EACH,SAAS,OAAO;GACd,QAAQ,MAAM,KAAK;EACrB;EAGF;CACF;CAWA,IAAI,CAAC,IATyB,IAAI;EAChC;EACA;EACA;EACA;EACA;EACA;CACF,CAEqB,EAAE,IAAI,SAAS,GAGlC;CAGF,MAAMC,wDAAY,kBAAkB,YAAY,eAAe,UAAU;CAIzE,IAAI;EAKF,mDAHE,cAAc,OAAO,UACrB,wBAEkB,GAAG,EAAE,WAAW,KAAK,CAAC;CAC5C,QAAQ,CAAC;AACX"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_utils_getFormatFromExtension = require('../utils/getFormatFromExtension.cjs');
4
3
  const require_writeContentDeclaration_transformJSFile = require('./transformJSFile.cjs');
5
4
  const require_detectFormatCommand = require('../detectFormatCommand.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"writeJSFile.cjs","names":["getFormatFromExtension","getContentDeclarationFileTemplate","transformJSFile","detectFormatCommand"],"sources":["../../../src/writeContentDeclaration/writeJSFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, extname, join } from 'node:path';\nimport { getAppLogger, logger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { detectFormatCommand } from '../detectFormatCommand';\nimport { getContentDeclarationFileTemplate } from '../getContentDeclarationFileTemplate/getContentDeclarationFileTemplate';\nimport {\n type Extension,\n getFormatFromExtension,\n} from '../utils/getFormatFromExtension';\nimport { transformJSFile } from './transformJSFile';\n\n/**\n * Updates a JavaScript/TypeScript file based on the provided JSON instructions.\n * It targets a specific dictionary object within the file (identified by its 'key' property)\n * and updates its 'content' entries. Currently, it focuses on modifying arguments\n * of 't' (translation) function calls.\n */\nexport const writeJSFile = async (\n filePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n noMetadata?: boolean\n): Promise<void> => {\n const mergedDictionary = {\n ...configuration.dictionary,\n ...dictionary,\n };\n\n const appLogger = getAppLogger(configuration);\n\n // Check if the file exist\n if (!existsSync(filePath)) {\n const fileExtension = extname(filePath) as Extension;\n\n const format = getFormatFromExtension(fileExtension);\n\n appLogger('File does not exist, creating it', {\n isVerbose: true,\n });\n const template = await getContentDeclarationFileTemplate(\n mergedDictionary.key,\n format,\n // Filter out undefined values\n Object.fromEntries(\n Object.entries({\n id: noMetadata ? undefined : mergedDictionary.id,\n locale: noMetadata ? undefined : mergedDictionary.locale,\n filled: noMetadata ? undefined : mergedDictionary.filled,\n fill: noMetadata ? undefined : mergedDictionary.fill,\n description: noMetadata ? undefined : mergedDictionary.description,\n title: noMetadata ? undefined : mergedDictionary.title,\n tags: noMetadata ? undefined : mergedDictionary.tags,\n version: noMetadata ? undefined : mergedDictionary.version,\n priority: noMetadata ? undefined : mergedDictionary.priority,\n importMode: noMetadata ? undefined : mergedDictionary.importMode,\n }).filter(([, value]) => value !== undefined)\n ),\n noMetadata\n );\n\n const tempDir = configuration.system?.tempDir;\n if (tempDir) {\n await mkdir(tempDir, { recursive: true });\n }\n\n const tempFileName = `${basename(filePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${filePath}.${tempFileName}`;\n try {\n await writeFile(tempPath, template, 'utf-8');\n await rename(tempPath, filePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // Ignore\n }\n throw error;\n }\n }\n\n let fileContent = await readFile(filePath, 'utf-8');\n\n if (fileContent === '') {\n const format = getFormatFromExtension(extname(filePath) as Extension);\n\n fileContent = await getContentDeclarationFileTemplate(\n mergedDictionary.key,\n format,\n {},\n noMetadata\n );\n }\n\n const finalCode = await transformJSFile(\n fileContent,\n dictionary,\n dictionary.locale as any,\n noMetadata\n );\n\n // Write the modified code back to the file\n const tempDir = configuration.system?.tempDir;\n if (tempDir) {\n await mkdir(tempDir, { recursive: true });\n }\n\n const tempFileName = `${basename(filePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${filePath}.${tempFileName}`;\n try {\n await writeFile(tempPath, finalCode, 'utf-8');\n await rename(tempPath, filePath);\n logger(`Successfully updated ${filePath}`, {\n level: 'info',\n isVerbose: true,\n });\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // Ignore\n }\n const err = error as Error;\n logger(`Failed to write updated file: ${filePath}`, {\n level: 'error',\n });\n throw new Error(`Failed to write updated file ${filePath}: ${err.message}`);\n }\n\n const formatCommand = detectFormatCommand(configuration);\n\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', filePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,\n });\n } catch (error) {\n console.error(error);\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAa,cAAc,OACzB,UACA,YACA,eACA,eACkB;CAClB,MAAM,mBAAmB;EACvB,GAAG,cAAc;EACjB,GAAG;CACL;CAEA,MAAM,sDAAyB,aAAa;CAG5C,IAAI,yBAAY,QAAQ,GAAG;EAGzB,MAAM,SAASA,mFAFe,QAEoB,CAAC;EAEnD,UAAU,oCAAoC,EAC5C,WAAW,KACb,CAAC;EACD,MAAM,WAAW,MAAMC,8GACrB,iBAAiB,KACjB,QAEA,OAAO,YACL,OAAO,QAAQ;GACb,IAAI,aAAa,SAAY,iBAAiB;GAC9C,QAAQ,aAAa,SAAY,iBAAiB;GAClD,QAAQ,aAAa,SAAY,iBAAiB;GAClD,MAAM,aAAa,SAAY,iBAAiB;GAChD,aAAa,aAAa,SAAY,iBAAiB;GACvD,OAAO,aAAa,SAAY,iBAAiB;GACjD,MAAM,aAAa,SAAY,iBAAiB;GAChD,SAAS,aAAa,SAAY,iBAAiB;GACnD,UAAU,aAAa,SAAY,iBAAiB;GACpD,YAAY,aAAa,SAAY,iBAAiB;EACxD,CAAC,EAAE,QAAQ,GAAG,WAAW,UAAU,MAAS,CAC9C,GACA,UACF;EAEA,MAAM,UAAU,cAAc,QAAQ;EACtC,IAAI,SACF,kCAAY,SAAS,EAAE,WAAW,KAAK,CAAC;EAG1C,MAAM,eAAe,2BAAY,QAAQ,EAAE,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE;EAChG,MAAM,WAAW,8BACR,SAAS,YAAY,IAC1B,GAAG,SAAS,GAAG;EACnB,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}
1
+ {"version":3,"file":"writeJSFile.cjs","names":["getFormatFromExtension","getContentDeclarationFileTemplate","transformJSFile","detectFormatCommand"],"sources":["../../../src/writeContentDeclaration/writeJSFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, extname, join } from 'node:path';\nimport { getAppLogger, logger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { detectFormatCommand } from '../detectFormatCommand';\nimport { getContentDeclarationFileTemplate } from '../getContentDeclarationFileTemplate/getContentDeclarationFileTemplate';\nimport {\n type Extension,\n getFormatFromExtension,\n} from '../utils/getFormatFromExtension';\nimport { transformJSFile } from './transformJSFile';\n\n/**\n * Updates a JavaScript/TypeScript file based on the provided JSON instructions.\n * It targets a specific dictionary object within the file (identified by its 'key' property)\n * and updates its 'content' entries. Currently, it focuses on modifying arguments\n * of 't' (translation) function calls.\n */\nexport const writeJSFile = async (\n filePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n noMetadata?: boolean\n): Promise<void> => {\n const mergedDictionary = {\n ...configuration.dictionary,\n ...dictionary,\n };\n\n const appLogger = getAppLogger(configuration);\n\n // Check if the file exist\n if (!existsSync(filePath)) {\n const fileExtension = extname(filePath) as Extension;\n\n const format = getFormatFromExtension(fileExtension);\n\n appLogger('File does not exist, creating it', {\n isVerbose: true,\n });\n const template = await getContentDeclarationFileTemplate(\n mergedDictionary.key,\n format,\n // Filter out undefined values\n Object.fromEntries(\n Object.entries({\n id: noMetadata ? undefined : mergedDictionary.id,\n locale: noMetadata ? undefined : mergedDictionary.locale,\n filled: noMetadata ? undefined : mergedDictionary.filled,\n fill: noMetadata ? undefined : mergedDictionary.fill,\n description: noMetadata ? undefined : mergedDictionary.description,\n title: noMetadata ? undefined : mergedDictionary.title,\n tags: noMetadata ? undefined : mergedDictionary.tags,\n version: noMetadata ? undefined : mergedDictionary.version,\n priority: noMetadata ? undefined : mergedDictionary.priority,\n importMode: noMetadata ? undefined : mergedDictionary.importMode,\n }).filter(([, value]) => value !== undefined)\n ),\n noMetadata\n );\n\n const tempDir = configuration.system?.tempDir;\n if (tempDir) {\n await mkdir(tempDir, { recursive: true });\n }\n\n const tempFileName = `${basename(filePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${filePath}.${tempFileName}`;\n try {\n await writeFile(tempPath, template, 'utf-8');\n await rename(tempPath, filePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // Ignore\n }\n throw error;\n }\n }\n\n let fileContent = await readFile(filePath, 'utf-8');\n\n if (fileContent === '') {\n const format = getFormatFromExtension(extname(filePath) as Extension);\n\n fileContent = await getContentDeclarationFileTemplate(\n mergedDictionary.key,\n format,\n {},\n noMetadata\n );\n }\n\n const finalCode = await transformJSFile(\n fileContent,\n dictionary,\n dictionary.locale as any,\n noMetadata\n );\n\n // Write the modified code back to the file\n const tempDir = configuration.system?.tempDir;\n if (tempDir) {\n await mkdir(tempDir, { recursive: true });\n }\n\n const tempFileName = `${basename(filePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${filePath}.${tempFileName}`;\n try {\n await writeFile(tempPath, finalCode, 'utf-8');\n await rename(tempPath, filePath);\n logger(`Successfully updated ${filePath}`, {\n level: 'info',\n isVerbose: true,\n });\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // Ignore\n }\n const err = error as Error;\n logger(`Failed to write updated file: ${filePath}`, {\n level: 'error',\n });\n throw new Error(`Failed to write updated file ${filePath}: ${err.message}`);\n }\n\n const formatCommand = detectFormatCommand(configuration);\n\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', filePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,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F;CAEA,IAAI,cAAc,qCAAe,UAAU,OAAO;CAElD,IAAI,gBAAgB,IAAI;EACtB,MAAM,SAASD,mFAA+B,QAAQ,CAAc;EAEpE,cAAc,MAAMC,8GAClB,iBAAiB,KACjB,QACA,CAAC,GACD,UACF;CACF;CAEA,MAAM,YAAY,MAAMC,gEACtB,aACA,YACA,WAAW,QACX,UACF;CAGA,MAAM,UAAU,cAAc,QAAQ;CACtC,IAAI,SACF,kCAAY,SAAS,EAAE,WAAW,KAAK,CAAC;CAG1C,MAAM,eAAe,2BAAY,QAAQ,EAAE,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE;CAChG,MAAM,WAAW,8BACR,SAAS,YAAY,IAC1B,GAAG,SAAS,GAAG;CACnB,IAAI;EACF,sCAAgB,UAAU,WAAW,OAAO;EAC5C,mCAAa,UAAU,QAAQ;EAC/B,oCAAO,wBAAwB,YAAY;GACzC,OAAO;GACP,WAAW;EACb,CAAC;CACH,SAAS,OAAO;EACd,IAAI;GACF,+BAAS,UAAU,EAAE,OAAO,KAAK,CAAC;EACpC,QAAQ,CAER;EACA,MAAM,MAAM;EACZ,oCAAO,iCAAiC,YAAY,EAClD,OAAO,QACT,CAAC;EACD,MAAM,IAAI,MAAM,gCAAgC,SAAS,IAAI,IAAI,SAAS;CAC5E;CAEA,MAAM,gBAAgBC,gDAAoB,aAAa;CAEvD,IAAI,eACF,IAAI;EACF,iCAAS,cAAc,QAAQ,YAAY,QAAQ,GAAG;GACpD,OAAO;GACP,KAAK,cAAc,OAAO;EAC5B,CAAC;CACH,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;CACrB;AAEJ"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_detectFormatCommand = require('../detectFormatCommand.cjs');
4
3
  let node_fs_promises = require("node:fs/promises");
5
4
  let node_path = require("node:path");
@@ -1 +1 @@
1
- {"version":3,"file":"writeMarkdownFile.cjs","names":["MARKDOWN","detectFormatCommand"],"sources":["../../../src/writeContentDeclaration/writeMarkdownFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { mkdir, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { MARKDOWN } from '@intlayer/types/nodeType';\nimport { detectFormatCommand } from '../detectFormatCommand';\n\nconst stringifyYamlFrontmatter = (fields: Record<string, any>): string =>\n Object.entries(fields)\n .filter(([, value]) => value !== undefined && value !== null)\n .map(([key, value]) => {\n if (Array.isArray(value)) {\n return `${key}:\\n${value.map((item) => ` - ${JSON.stringify(item)}`).join('\\n')}`;\n }\n if (\n typeof value === 'string' &&\n (value.includes(':') || value.includes('\\n') || value.includes('#'))\n ) {\n return `${key}: ${JSON.stringify(value)}`;\n }\n return `${key}: ${value}`;\n })\n .join('\\n');\n\n// Strips YAML frontmatter from a markdown string, returning only the body\nconst getMarkdownBody = (content: string): string => {\n const lines = content.split(/\\r?\\n/);\n const firstNonEmptyIndex = lines.findIndex((line) => line.trim() !== '');\n\n if (firstNonEmptyIndex === -1 || lines[firstNonEmptyIndex].trim() !== '---') {\n return content;\n }\n\n let endIndex = -1;\n for (let i = firstNonEmptyIndex + 1; i < lines.length; i++) {\n if (lines[i].trim() === '---') {\n endIndex = i;\n break;\n }\n }\n\n if (endIndex === -1) return content;\n\n return lines\n .slice(endIndex + 1)\n .join('\\n')\n .trimStart();\n};\n\n// Fields that are auto-generated / internal and must not appear in frontmatter\nconst EXCLUDED_FRONTMATTER_KEYS = new Set<string>([\n 'content',\n '$schema',\n 'filePath',\n 'localId',\n 'localIds',\n 'projectIds',\n]);\n\nexport const writeMarkdownFile = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Promise<void> => {\n const content = dictionary.content as any;\n const markdownRaw =\n typeof content === 'object' && content?.nodeType === MARKDOWN\n ? (content[MARKDOWN] ?? '')\n : '';\n // content.markdown now stores the full file (frontmatter + body); extract only the body\n const markdownBody = getMarkdownBody(markdownRaw);\n\n const frontmatterFields = Object.fromEntries(\n Object.entries(dictionary).filter(\n ([k, v]) => !EXCLUDED_FRONTMATTER_KEYS.has(k) && v !== undefined\n )\n );\n\n const frontmatterStr = stringifyYamlFrontmatter(frontmatterFields);\n const fileContent = `---\\n${frontmatterStr}\\n---\\n\\n${markdownBody}`;\n\n const dir = dirname(absoluteFilePath);\n await mkdir(dir, { recursive: true });\n\n const tempDir = configuration.system?.tempDir;\n if (tempDir) await mkdir(tempDir, { recursive: true });\n\n const tempFileName = `${basename(absoluteFilePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${absoluteFilePath}.${tempFileName}`;\n\n try {\n await writeFile(tempPath, fileContent, 'utf-8');\n await rename(tempPath, absoluteFilePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // ignore\n }\n throw error;\n }\n\n const formatCommand = detectFormatCommand(configuration);\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', absoluteFilePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,\n });\n } catch (error) {\n console.error(error);\n }\n }\n};\n"],"mappings":";;;;;;;;;AAQA,MAAM,4BAA4B,WAChC,OAAO,QAAQ,MAAM,EAClB,QAAQ,GAAG,WAAW,UAAU,UAAa,UAAU,IAAI,EAC3D,KAAK,CAAC,KAAK,WAAW;CACrB,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,GAAG,IAAI,KAAK,MAAM,KAAK,SAAS,OAAO,KAAK,UAAU,IAAI,GAAG,EAAE,KAAK,IAAI;CAEjF,IACE,OAAO,UAAU,aAChB,MAAM,SAAS,GAAG,KAAK,MAAM,SAAS,IAAI,KAAK,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WAAW,8BACR,SAAS,YAAY,IAC1B,GAAG,iBAAiB,GAAG;CAE3B,IAAI;EACF,sCAAgB,UAAU,aAAa,OAAO;EAC9C,mCAAa,UAAU,gBAAgB;CACzC,SAAS,OAAO;EACd,IAAI;GACF,+BAAS,UAAU,EAAE,OAAO,KAAK,CAAC;EACpC,QAAQ,CAER;EACA,MAAM;CACR;CAEA,MAAM,gBAAgBC,gDAAoB,aAAa;CACvD,IAAI,eACF,IAAI;EACF,iCAAS,cAAc,QAAQ,YAAY,gBAAgB,GAAG;GAC5D,OAAO;GACP,KAAK,cAAc,OAAO;EAC5B,CAAC;CACH,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;CACrB;AAEJ"}
1
+ {"version":3,"file":"writeMarkdownFile.cjs","names":["MARKDOWN","detectFormatCommand"],"sources":["../../../src/writeContentDeclaration/writeMarkdownFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { mkdir, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { MARKDOWN } from '@intlayer/types/nodeType';\nimport { detectFormatCommand } from '../detectFormatCommand';\n\nconst stringifyYamlFrontmatter = (fields: Record<string, any>): string =>\n Object.entries(fields)\n .filter(([, value]) => value !== undefined && value !== null)\n .map(([key, value]) => {\n if (Array.isArray(value)) {\n return `${key}:\\n${value.map((item) => ` - ${JSON.stringify(item)}`).join('\\n')}`;\n }\n if (\n typeof value === 'string' &&\n (value.includes(':') || value.includes('\\n') || value.includes('#'))\n ) {\n return `${key}: ${JSON.stringify(value)}`;\n }\n return `${key}: ${value}`;\n })\n .join('\\n');\n\n// Strips YAML frontmatter from a markdown string, returning only the body\nconst getMarkdownBody = (content: string): string => {\n const lines = content.split(/\\r?\\n/);\n const firstNonEmptyIndex = lines.findIndex((line) => line.trim() !== '');\n\n if (firstNonEmptyIndex === -1 || lines[firstNonEmptyIndex].trim() !== '---') {\n return content;\n }\n\n let endIndex = -1;\n for (let i = firstNonEmptyIndex + 1; i < lines.length; i++) {\n if (lines[i].trim() === '---') {\n endIndex = i;\n break;\n }\n }\n\n if (endIndex === -1) return content;\n\n return lines\n .slice(endIndex + 1)\n .join('\\n')\n .trimStart();\n};\n\n// Fields that are auto-generated / internal and must not appear in frontmatter\nconst EXCLUDED_FRONTMATTER_KEYS = new Set<string>([\n 'content',\n '$schema',\n 'filePath',\n 'localId',\n 'localIds',\n 'projectIds',\n]);\n\nexport const writeMarkdownFile = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Promise<void> => {\n const content = dictionary.content as any;\n const markdownRaw =\n typeof content === 'object' && content?.nodeType === MARKDOWN\n ? (content[MARKDOWN] ?? '')\n : '';\n // content.markdown now stores the full file (frontmatter + body); extract only the body\n const markdownBody = getMarkdownBody(markdownRaw);\n\n const frontmatterFields = Object.fromEntries(\n Object.entries(dictionary).filter(\n ([k, v]) => !EXCLUDED_FRONTMATTER_KEYS.has(k) && v !== undefined\n )\n );\n\n const frontmatterStr = stringifyYamlFrontmatter(frontmatterFields);\n const fileContent = `---\\n${frontmatterStr}\\n---\\n\\n${markdownBody}`;\n\n const dir = dirname(absoluteFilePath);\n await mkdir(dir, { recursive: true });\n\n const tempDir = configuration.system?.tempDir;\n if (tempDir) await mkdir(tempDir, { recursive: true });\n\n const tempFileName = `${basename(absoluteFilePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${absoluteFilePath}.${tempFileName}`;\n\n try {\n await writeFile(tempPath, fileContent, 'utf-8');\n await rename(tempPath, absoluteFilePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // ignore\n }\n throw error;\n }\n\n const formatCommand = detectFormatCommand(configuration);\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', absoluteFilePath), {\n stdio: 'inherit',\n cwd: config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AC/B,OAAO,QAAQ,UAAU,EAAE,QACxB,CAAC,GAAG,OAAO,CAAC,0BAA0B,IAAI,CAAC,KAAK,MAAM,MACzD,CAG8D,CACvB,EAAE,WAAW;CAGtD,yDADoB,gBACN,GAAG,EAAE,WAAW,KAAK,CAAC;CAEpC,MAAM,UAAU,cAAc,QAAQ;CACtC,IAAI,SAAS,kCAAY,SAAS,EAAE,WAAW,KAAK,CAAC;CAErD,MAAM,eAAe,2BAAY,gBAAgB,EAAE,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE;CACxG,MAAM,WAAW,8BACR,SAAS,YAAY,IAC1B,GAAG,iBAAiB,GAAG;CAE3B,IAAI;EACF,sCAAgB,UAAU,aAAa,OAAO;EAC9C,mCAAa,UAAU,gBAAgB;CACzC,SAAS,OAAO;EACd,IAAI;GACF,+BAAS,UAAU,EAAE,OAAO,KAAK,CAAC;EACpC,QAAQ,CAER;EACA,MAAM;CACR;CAEA,MAAM,gBAAgBC,gDAAoB,aAAa;CACvD,IAAI,eACF,IAAI;EACF,iCAAS,cAAc,QAAQ,YAAY,gBAAgB,GAAG;GAC5D,OAAO;GACP,KAAK,cAAc,OAAO;EAC5B,CAAC;CACH,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;CACrB;AAEJ"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_detectFormatCommand = require('../detectFormatCommand.cjs');
4
3
  let node_fs_promises = require("node:fs/promises");
5
4
  let node_path = require("node:path");
@@ -1 +1 @@
1
- {"version":3,"file":"writeYamlFile.cjs","names":["detectFormatCommand"],"sources":["../../../src/writeContentDeclaration/writeYamlFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { mkdir, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\nimport { stringifyYaml } from '@intlayer/core/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { detectFormatCommand } from '../detectFormatCommand';\n\n// Fields that are auto-generated or runtime-only, not persisted in the file\nconst EXCLUDED_YAML_KEYS = new Set<string>(['$schema', 'id', 'filePath']);\n\nexport const writeYamlFile = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Promise<void> => {\n const filtered = Object.fromEntries(\n Object.entries(dictionary).filter(\n ([k, v]) => !EXCLUDED_YAML_KEYS.has(k) && v !== undefined\n )\n );\n\n const fileContent = stringifyYaml(filtered);\n\n const dir = dirname(absoluteFilePath);\n await mkdir(dir, { recursive: true });\n\n const tempDir = configuration.system?.tempDir;\n if (tempDir) await mkdir(tempDir, { recursive: true });\n\n const tempFileName = `${basename(absoluteFilePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${absoluteFilePath}.${tempFileName}`;\n\n try {\n await writeFile(tempPath, fileContent, 'utf-8');\n await rename(tempPath, absoluteFilePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // ignore\n }\n throw error;\n }\n\n const formatCommand = detectFormatCommand(configuration);\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', absoluteFilePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,\n });\n } catch (error) {\n console.error(error);\n }\n }\n};\n"],"mappings":";;;;;;;;;AASA,MAAM,qBAAqB,IAAI,IAAY;CAAC;CAAW;CAAM;AAAU,CAAC;AAExE,MAAa,gBAAgB,OAC3B,kBACA,YACA,kBACkB;CAOlB,MAAM,sDANW,OAAO,YACtB,OAAO,QAAQ,UAAU,EAAE,QACxB,CAAC,GAAG,OAAO,CAAC,mBAAmB,IAAI,CAAC,KAAK,MAAM,MAClD,CAGuC,CAAC;CAG1C,yDADoB,gBACN,GAAG,EAAE,WAAW,KAAK,CAAC;CAEpC,MAAM,UAAU,cAAc,QAAQ;CACtC,IAAI,SAAS,kCAAY,SAAS,EAAE,WAAW,KAAK,CAAC;CAErD,MAAM,eAAe,2BAAY,gBAAgB,EAAE,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE;CACxG,MAAM,WAAW,8BACR,SAAS,YAAY,IAC1B,GAAG,iBAAiB,GAAG;CAE3B,IAAI;EACF,sCAAgB,UAAU,aAAa,OAAO;EAC9C,mCAAa,UAAU,gBAAgB;CACzC,SAAS,OAAO;EACd,IAAI;GACF,+BAAS,UAAU,EAAE,OAAO,KAAK,CAAC;EACpC,QAAQ,CAER;EACA,MAAM;CACR;CAEA,MAAM,gBAAgBA,gDAAoB,aAAa;CACvD,IAAI,eACF,IAAI;EACF,iCAAS,cAAc,QAAQ,YAAY,gBAAgB,GAAG;GAC5D,OAAO;GACP,KAAK,cAAc,OAAO;EAC5B,CAAC;CACH,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;CACrB;AAEJ"}
1
+ {"version":3,"file":"writeYamlFile.cjs","names":["detectFormatCommand"],"sources":["../../../src/writeContentDeclaration/writeYamlFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { mkdir, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\nimport { stringifyYaml } from '@intlayer/core/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { detectFormatCommand } from '../detectFormatCommand';\n\n// Fields that are auto-generated or runtime-only, not persisted in the file\nconst EXCLUDED_YAML_KEYS = new Set<string>(['$schema', 'id', 'filePath']);\n\nexport const writeYamlFile = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Promise<void> => {\n const filtered = Object.fromEntries(\n Object.entries(dictionary).filter(\n ([k, v]) => !EXCLUDED_YAML_KEYS.has(k) && v !== undefined\n )\n );\n\n const fileContent = stringifyYaml(filtered);\n\n const dir = dirname(absoluteFilePath);\n await mkdir(dir, { recursive: true });\n\n const tempDir = configuration.system?.tempDir;\n if (tempDir) await mkdir(tempDir, { recursive: true });\n\n const tempFileName = `${basename(absoluteFilePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${absoluteFilePath}.${tempFileName}`;\n\n try {\n await writeFile(tempPath, fileContent, 'utf-8');\n await rename(tempPath, absoluteFilePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // ignore\n }\n throw error;\n }\n\n const formatCommand = detectFormatCommand(configuration);\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', absoluteFilePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,\n });\n } catch (error) {\n console.error(error);\n }\n }\n};\n"],"mappings":";;;;;;;;AASA,MAAM,qBAAqB,IAAI,IAAY;CAAC;CAAW;CAAM;AAAU,CAAC;AAExE,MAAa,gBAAgB,OAC3B,kBACA,YACA,kBACkB;CAOlB,MAAM,sDANW,OAAO,YACtB,OAAO,QAAQ,UAAU,EAAE,QACxB,CAAC,GAAG,OAAO,CAAC,mBAAmB,IAAI,CAAC,KAAK,MAAM,MAClD,CAGuC,CAAC;CAG1C,yDADoB,gBACN,GAAG,EAAE,WAAW,KAAK,CAAC;CAEpC,MAAM,UAAU,cAAc,QAAQ;CACtC,IAAI,SAAS,kCAAY,SAAS,EAAE,WAAW,KAAK,CAAC;CAErD,MAAM,eAAe,2BAAY,gBAAgB,EAAE,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE;CACxG,MAAM,WAAW,8BACR,SAAS,YAAY,IAC1B,GAAG,iBAAiB,GAAG;CAE3B,IAAI;EACF,sCAAgB,UAAU,aAAa,OAAO;EAC9C,mCAAa,UAAU,gBAAgB;CACzC,SAAS,OAAO;EACd,IAAI;GACF,+BAAS,UAAU,EAAE,OAAO,KAAK,CAAC;EACpC,QAAQ,CAER;EACA,MAAM;CACR;CAEA,MAAM,gBAAgBA,gDAAoB,aAAa;CACvD,IAAI,eACF,IAAI;EACF,iCAAS,cAAc,QAAQ,YAAY,gBAAgB,GAAG;GAC5D,OAAO;GACP,KAAK,cAAc,OAAO;EAC5B,CAAC;CACH,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;CACrB;AAEJ"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let node_fs_promises = require("node:fs/promises");
4
3
  let node_path = require("node:path");
5
4
  let node_crypto = require("node:crypto");