@intlayer/chokidar 8.4.0 → 8.4.2
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.
- package/dist/cjs/_utils_asset-SJVy1xMD.cjs +2 -0
- package/dist/cjs/build.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
- package/dist/cjs/{_virtual/_rolldown/runtime.cjs → chunk-Bmb41Sf3.cjs} +1 -1
- package/dist/cjs/cleanOutputDir.cjs +1 -1
- package/dist/cjs/cleanOutputDir.cjs.map +1 -1
- package/dist/cjs/cleanRemovedContentDeclaration.cjs +1 -1
- package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -1
- package/dist/cjs/cli.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createType/createModuleAugmentation.cjs +1 -1
- package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
- package/dist/cjs/createType/createType.cjs +1 -1
- package/dist/cjs/createType/createType.cjs.map +1 -1
- package/dist/cjs/detectFormatCommand.cjs +1 -1
- package/dist/cjs/detectFormatCommand.cjs.map +1 -1
- package/dist/cjs/fetchDistantDictionaries.cjs +1 -1
- package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/filterInvalidDictionaries.cjs +1 -1
- package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
- package/dist/cjs/formatDictionary.cjs +1 -1
- package/dist/cjs/formatDictionary.cjs.map +1 -1
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +1 -1
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +1 -1
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
- package/dist/cjs/handleContentDeclarationFileChange.cjs +1 -1
- package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
- package/dist/cjs/handleContentDeclarationFileMoved.cjs +1 -1
- package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -1
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +1 -1
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
- package/dist/cjs/init/index.cjs +1 -1
- package/dist/cjs/init/index.cjs.map +1 -1
- package/dist/cjs/init/utils/configManipulation.cjs +1 -1
- package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
- package/dist/cjs/init/utils/fileSystem.cjs +1 -1
- package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
- package/dist/cjs/init/utils/tsConfig.cjs +1 -1
- package/dist/cjs/init/utils/tsConfig.cjs.map +1 -1
- package/dist/cjs/initConfig/index.cjs +1 -1
- package/dist/cjs/initConfig/index.cjs.map +1 -1
- package/dist/cjs/installMCP/installMCP.cjs +1 -1
- package/dist/cjs/installMCP/installMCP.cjs.map +1 -1
- package/dist/cjs/installSkills/index.cjs +1 -1
- package/dist/cjs/installSkills/index.cjs.map +1 -1
- package/dist/cjs/listDictionariesPath.cjs +1 -1
- package/dist/cjs/listDictionariesPath.cjs.map +1 -1
- package/dist/cjs/listGitFiles.cjs +1 -1
- package/dist/cjs/listGitFiles.cjs.map +1 -1
- package/dist/cjs/listProjects.cjs +1 -1
- package/dist/cjs/listProjects.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +1 -1
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/log.cjs +1 -1
- package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +1 -1
- package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
- package/dist/cjs/logConfigDetails.cjs +1 -1
- package/dist/cjs/logConfigDetails.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +1 -1
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +1 -1
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
- package/dist/cjs/utils/autoDecorateContent.cjs +1 -1
- package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -1
- package/dist/cjs/utils/buildComponentFilesList.cjs +1 -1
- package/dist/cjs/utils/buildComponentFilesList.cjs.map +1 -1
- package/dist/cjs/utils/buildFilesList.cjs +1 -1
- package/dist/cjs/utils/buildFilesList.cjs.map +1 -1
- package/dist/cjs/utils/formatter.cjs +1 -1
- package/dist/cjs/utils/formatter.cjs.map +1 -1
- package/dist/cjs/utils/getPathHash.cjs +1 -1
- package/dist/cjs/utils/getPathHash.cjs.map +1 -1
- package/dist/cjs/utils/resolveRelativePath.cjs +1 -1
- package/dist/cjs/utils/resolveRelativePath.cjs.map +1 -1
- package/dist/cjs/utils/runOnce.cjs +1 -1
- package/dist/cjs/utils/runOnce.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/bin.cjs +1 -1
- package/dist/cjs/utils/runParallel/bin.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/index.cjs +1 -1
- package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/pidTree.cjs +1 -1
- package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/ps.cjs +1 -1
- package/dist/cjs/utils/runParallel/ps.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/runTask.cjs +1 -1
- package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/spawnPosix.cjs +1 -1
- package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/spawnWin32.cjs +1 -1
- package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/wmic.cjs +1 -1
- package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -1
- package/dist/cjs/watcher.cjs +1 -1
- package/dist/cjs/watcher.cjs.map +1 -1
- package/dist/cjs/writeConfiguration/index.cjs +1 -1
- package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
- package/dist/cjs/writeFileIfChanged.cjs +1 -1
- package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
- package/dist/esm/{_virtual/_utils_asset.mjs → _utils_asset-4w8dPH9r.mjs} +1 -1
- package/dist/esm/build.mjs +1 -1
- package/dist/esm/{_virtual/_rolldown/runtime.mjs → chunk-DDgYwkfe.mjs} +1 -1
- package/dist/esm/cli.mjs +1 -1
- package/dist/esm/init/index.mjs +1 -1
- package/dist/esm/init/index.mjs.map +1 -1
- package/dist/esm/init/utils/configManipulation.mjs +1 -1
- package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
- package/dist/esm/initConfig/index.mjs +1 -1
- package/dist/esm/initConfig/index.mjs.map +1 -1
- package/dist/esm/installMCP/installMCP.mjs +1 -1
- package/dist/esm/installMCP/installMCP.mjs.map +1 -1
- package/dist/esm/installSkills/index.mjs +1 -1
- package/dist/esm/installSkills/index.mjs.map +1 -1
- package/dist/esm/listDictionariesPath.mjs +1 -1
- package/dist/esm/listDictionariesPath.mjs.map +1 -1
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +1 -1
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
- package/dist/esm/utils/buildComponentFilesList.mjs +1 -1
- package/dist/esm/utils/buildComponentFilesList.mjs.map +1 -1
- package/dist/esm/utils/formatter.mjs +1 -1
- package/dist/esm/utils/formatter.mjs.map +1 -1
- package/dist/esm/watcher.mjs +1 -1
- package/dist/esm/watcher.mjs.map +1 -1
- package/dist/esm/writeConfiguration/index.mjs +1 -1
- package/dist/esm/writeConfiguration/index.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -1
- package/dist/types/build.d.ts +20 -20
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +2 -24
- package/dist/types/buildIntlayerDictionary/index.d.ts +2 -2
- package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +2 -11
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +2 -36
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +1 -1
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +2 -30
- package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +2 -34
- package/dist/types/buildIntlayerDictionary-BGj5jDFy.d.ts +24 -0
- package/dist/types/buildIntlayerDictionary-BGj5jDFy.d.ts.map +1 -0
- package/dist/types/cli.d.ts +6 -6
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +2 -14
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +2 -10
- package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +2 -10
- package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +2 -10
- package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +2 -10
- package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +2 -10
- package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +2 -10
- package/dist/types/createDictionaryEntryPoint/index.d.ts +7 -7
- package/dist/types/createDictionaryEntryPoint-Bc5lHSiY.d.ts +14 -0
- package/dist/types/createDictionaryEntryPoint-Bc5lHSiY.d.ts.map +1 -0
- package/dist/types/createModuleAugmentation-D1eIVnjg.d.ts +9 -0
- package/dist/types/createModuleAugmentation-D1eIVnjg.d.ts.map +1 -0
- package/dist/types/createType/createModuleAugmentation.d.ts +2 -9
- package/dist/types/createType/createType.d.ts +2 -12
- package/dist/types/createType/index.d.ts +2 -2
- package/dist/types/createType--rDwdg2t.d.ts +12 -0
- package/dist/types/createType--rDwdg2t.d.ts.map +1 -0
- package/dist/types/detectExportedComponentName-DVXsp_FG.d.ts +12 -0
- package/dist/types/detectExportedComponentName-DVXsp_FG.d.ts.map +1 -0
- package/dist/types/dictionaryStatus-DPVO37qe.d.ts +5 -0
- package/dist/types/dictionaryStatus-DPVO37qe.d.ts.map +1 -0
- package/dist/types/fetchDistantDictionaries.d.ts +1 -1
- package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/generateDictionaryListContent-DAtHG6SR.d.ts +10 -0
- package/dist/types/generateDictionaryListContent-DAtHG6SR.d.ts.map +1 -0
- package/dist/types/getBuiltDictionariesPath-C4it65a1.d.ts +10 -0
- package/dist/types/getBuiltDictionariesPath-C4it65a1.d.ts.map +1 -0
- package/dist/types/getBuiltDynamicDictionariesPath-Cj9EWnjT.d.ts +10 -0
- package/dist/types/getBuiltDynamicDictionariesPath-Cj9EWnjT.d.ts.map +1 -0
- package/dist/types/getBuiltFetchDictionariesPath-1JleRhT3.d.ts +10 -0
- package/dist/types/getBuiltFetchDictionariesPath-1JleRhT3.d.ts.map +1 -0
- package/dist/types/getBuiltRemoteDictionariesPath-DHOmqNCr.d.ts +10 -0
- package/dist/types/getBuiltRemoteDictionariesPath-DHOmqNCr.d.ts.map +1 -0
- package/dist/types/getBuiltUnmergedDictionariesPath-GUmmLxTB.d.ts +10 -0
- package/dist/types/getBuiltUnmergedDictionariesPath-GUmmLxTB.d.ts.map +1 -0
- package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +2 -7
- package/dist/types/getContentDeclarationFileTemplate/index.d.ts +1 -1
- package/dist/types/getContentDeclarationFileTemplate-Dz3rnFy9.d.ts +7 -0
- package/dist/types/getContentDeclarationFileTemplate-Dz3rnFy9.d.ts.map +1 -0
- package/dist/types/getFormatFromExtension-SdXYWfPx.d.ts +8 -0
- package/dist/types/getFormatFromExtension-SdXYWfPx.d.ts.map +1 -0
- package/dist/types/listDictionariesPath.d.ts.map +1 -1
- package/dist/types/loadContentDeclaration-CBMS4vkA.d.ts +12 -0
- package/dist/types/loadContentDeclaration-CBMS4vkA.d.ts.map +1 -0
- package/dist/types/loadDictionaries/index.d.ts +4 -4
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +2 -12
- package/dist/types/loadDictionaries/loadDictionaries.d.ts +2 -23
- package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +2 -8
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +2 -15
- package/dist/types/loadDictionaries/log.d.ts +1 -1
- package/dist/types/loadDictionaries-BIqHwtYE.d.ts +23 -0
- package/dist/types/loadDictionaries-BIqHwtYE.d.ts.map +1 -0
- package/dist/types/loadLocalDictionaries-CNmVaw0c.d.ts +8 -0
- package/dist/types/loadLocalDictionaries-CNmVaw0c.d.ts.map +1 -0
- package/dist/types/loadRemoteDictionaries-MoITTb7W.d.ts +15 -0
- package/dist/types/loadRemoteDictionaries-MoITTb7W.d.ts.map +1 -0
- package/dist/types/processContentDeclaration-CAvrHaIT.d.ts +11 -0
- package/dist/types/processContentDeclaration-CAvrHaIT.d.ts.map +1 -0
- package/dist/types/transformJSFile-Cg0LkeLb.d.ts +11 -0
- package/dist/types/transformJSFile-Cg0LkeLb.d.ts.map +1 -0
- package/dist/types/utils/getFormatFromExtension.d.ts +2 -8
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/watcher.d.ts.map +1 -1
- package/dist/types/writeConfiguration/index.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts +2 -12
- package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +2 -5
- package/dist/types/writeContentDeclaration/index.d.ts +5 -5
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts +2 -11
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +2 -19
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts +2 -14
- package/dist/types/writeContentDeclaration-XdGxj0KP.d.ts +19 -0
- package/dist/types/writeContentDeclaration-XdGxj0KP.d.ts.map +1 -0
- package/dist/types/writeDynamicDictionary-DE3SJg-g.d.ts +36 -0
- package/dist/types/writeDynamicDictionary-DE3SJg-g.d.ts.map +1 -0
- package/dist/types/writeJSFile-kK95jzg_.d.ts +14 -0
- package/dist/types/writeJSFile-kK95jzg_.d.ts.map +1 -0
- package/dist/types/writeMergedDictionary-C4EvgXbL.d.ts +30 -0
- package/dist/types/writeMergedDictionary-C4EvgXbL.d.ts.map +1 -0
- package/dist/types/writeUnmergedDictionary-Cxx51isz.d.ts +34 -0
- package/dist/types/writeUnmergedDictionary-Cxx51isz.d.ts.map +1 -0
- package/package.json +16 -8
- package/dist/cjs/_virtual/_utils_asset.cjs +0 -2
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +0 -1
- package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +0 -1
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +0 -1
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +0 -1
- package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +0 -1
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +0 -1
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +0 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +0 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +0 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +0 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +0 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +0 -1
- package/dist/types/createType/createModuleAugmentation.d.ts.map +0 -1
- package/dist/types/createType/createType.d.ts.map +0 -1
- package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +0 -1
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +0 -1
- package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +0 -1
- package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +0 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +0 -1
- package/dist/types/utils/getFormatFromExtension.d.ts.map +0 -1
- package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts.map +0 -1
- package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +0 -1
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +0 -1
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +0 -1
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configManipulation.cjs","names":[],"sources":["../../../../src/init/utils/configManipulation.ts"],"sourcesContent":["import * as recast from 'recast';\n\nconst b = recast.types.builders;\nconst n = recast.types.namedTypes;\n\n/**\n * Checks if a module is already imported or required.\n */\nconst isModuleImported = (ast: any, moduleName: string): boolean => {\n let found = false;\n recast.visit(ast, {\n visitImportDeclaration(path) {\n if (path.node.source.value === moduleName) {\n found = true;\n }\n return false;\n },\n visitCallExpression(path) {\n const { callee, arguments: args } = path.node;\n\n if (\n n.Identifier.check(callee) &&\n callee.name === 'require' &&\n args[0] &&\n n.StringLiteral.check(args[0]) &&\n args[0].value === moduleName\n ) {\n found = true;\n }\n return false;\n },\n });\n return found;\n};\n\n/**\n * Injects import/require at the top of the file.\n */\nconst injectImport = (\n ast: any,\n isCJS: boolean,\n importName: string,\n source: string\n) => {\n if (isModuleImported(ast, source)) return;\n\n const declaration = isCJS\n ? b.variableDeclaration('const', [\n b.variableDeclarator(\n b.objectPattern([\n b.objectProperty.from({\n key: b.identifier(importName),\n value: b.identifier(importName),\n shorthand: true,\n }),\n ]),\n b.callExpression(b.identifier('require'), [b.stringLiteral(source)])\n ),\n ])\n : b.importDeclaration(\n [b.importSpecifier(b.identifier(importName))],\n b.stringLiteral(source)\n );\n\n ast.program.body.unshift(declaration);\n};\n\nexport const updateViteConfig = (\n content: string,\n extension: string\n): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n const isCJSFile =\n extension === 'cjs' ||\n (content.includes('module.exports') && !content.includes('import '));\n\n injectImport(ast, isCJSFile, 'intlayer', 'vite-intlayer');\n\n const updateConfigObject = (objExpr: any) => {\n if (\n !objExpr ||\n (objExpr.type !== 'ObjectExpression' &&\n !n.ObjectExpression.check(objExpr))\n )\n return;\n\n let pluginsProp = objExpr.properties.find((p: any) => {\n if (!p || !p.key) return false;\n const keyName = p.key.name || p.key.value;\n return keyName === 'plugins';\n }) as any;\n\n if (!pluginsProp) {\n pluginsProp = b.property(\n 'init',\n b.identifier('plugins'),\n b.arrayExpression([])\n );\n objExpr.properties.push(pluginsProp);\n }\n\n const pluginsValue = pluginsProp.value;\n\n if (\n pluginsValue &&\n (pluginsValue.type === 'ArrayExpression' ||\n n.ArrayExpression.check(pluginsValue))\n ) {\n const hasPlugin = pluginsValue.elements.some((el: any) => {\n const callee = el?.callee;\n\n if (!callee) return false;\n const name = callee.name || callee.id?.name;\n return name === 'intlayer' || name === 'il';\n });\n\n if (!hasPlugin) {\n pluginsValue.elements.push(\n b.callExpression(b.identifier('intlayer'), [])\n );\n }\n }\n };\n\n recast.visit(ast, {\n visitExportDefaultDeclaration(path) {\n const decl = path.node.declaration;\n\n if (n.ObjectExpression.check(decl)) {\n updateConfigObject(decl);\n } else if (\n n.CallExpression.check(decl) &&\n n.Identifier.check(decl.callee) &&\n decl.callee.name === 'defineConfig'\n ) {\n if (n.ObjectExpression.check(decl.arguments[0])) {\n updateConfigObject(decl.arguments[0]);\n }\n } else if (n.Identifier.check(decl)) {\n const name = decl.name;\n ast.program.body.forEach((stmt: any) => {\n if (n.VariableDeclaration.check(stmt)) {\n stmt.declarations.forEach((vdecl: any) => {\n if (\n n.VariableDeclarator.check(vdecl) &&\n n.Identifier.check(vdecl.id) &&\n vdecl.id.name === name &&\n n.ObjectExpression.check(vdecl.init)\n ) {\n updateConfigObject(vdecl.init);\n }\n });\n }\n });\n }\n return false;\n },\n visitAssignmentExpression(path) {\n const { left, right } = path.node;\n\n if (\n n.MemberExpression.check(left) &&\n recast.print(left).code === 'module.exports'\n ) {\n if (n.ObjectExpression.check(right)) {\n updateConfigObject(right);\n } else if (\n n.CallExpression.check(right) &&\n n.Identifier.check(right.callee) &&\n right.callee.name === 'defineConfig'\n ) {\n if (n.ObjectExpression.check(right.arguments[0])) {\n updateConfigObject(right.arguments[0]);\n }\n }\n }\n return false;\n },\n });\n\n return recast.print(ast).code;\n};\n\nexport const updateNextConfig = (\n content: string,\n extension: string\n): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n const isCJSFile = extension === 'cjs' || content.includes('module.exports');\n\n injectImport(ast, isCJSFile, 'withIntlayer', 'next-intlayer/server');\n\n recast.visit(ast, {\n visitExportDefaultDeclaration(path) {\n const declaration = path.node.declaration;\n if (\n n.Expression.check(declaration) &&\n !(\n n.CallExpression.check(declaration) &&\n n.Identifier.check(declaration.callee) &&\n declaration.callee.name === 'withIntlayer'\n )\n ) {\n path\n .get('declaration')\n .replace(\n b.callExpression(b.identifier('withIntlayer'), [declaration as any])\n );\n }\n return false;\n },\n visitAssignmentExpression(path) {\n const { left, right } = path.node;\n\n if (\n n.MemberExpression.check(left) &&\n recast.print(left).code === 'module.exports' &&\n !(\n n.CallExpression.check(right) &&\n n.Identifier.check(right.callee) &&\n right.callee.name === 'withIntlayer'\n )\n ) {\n path\n .get('right')\n .replace(b.callExpression(b.identifier('withIntlayer'), [right]));\n }\n return false;\n },\n });\n\n return recast.print(ast).code;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"configManipulation.cjs","names":[],"sources":["../../../../src/init/utils/configManipulation.ts"],"sourcesContent":["import * as recast from 'recast';\n\nconst b = recast.types.builders;\nconst n = recast.types.namedTypes;\n\n/**\n * Checks if a module is already imported or required.\n */\nconst isModuleImported = (ast: any, moduleName: string): boolean => {\n let found = false;\n recast.visit(ast, {\n visitImportDeclaration(path) {\n if (path.node.source.value === moduleName) {\n found = true;\n }\n return false;\n },\n visitCallExpression(path) {\n const { callee, arguments: args } = path.node;\n\n if (\n n.Identifier.check(callee) &&\n callee.name === 'require' &&\n args[0] &&\n n.StringLiteral.check(args[0]) &&\n args[0].value === moduleName\n ) {\n found = true;\n }\n return false;\n },\n });\n return found;\n};\n\n/**\n * Injects import/require at the top of the file.\n */\nconst injectImport = (\n ast: any,\n isCJS: boolean,\n importName: string,\n source: string\n) => {\n if (isModuleImported(ast, source)) return;\n\n const declaration = isCJS\n ? b.variableDeclaration('const', [\n b.variableDeclarator(\n b.objectPattern([\n b.objectProperty.from({\n key: b.identifier(importName),\n value: b.identifier(importName),\n shorthand: true,\n }),\n ]),\n b.callExpression(b.identifier('require'), [b.stringLiteral(source)])\n ),\n ])\n : b.importDeclaration(\n [b.importSpecifier(b.identifier(importName))],\n b.stringLiteral(source)\n );\n\n ast.program.body.unshift(declaration);\n};\n\nexport const updateViteConfig = (\n content: string,\n extension: string\n): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n const isCJSFile =\n extension === 'cjs' ||\n (content.includes('module.exports') && !content.includes('import '));\n\n injectImport(ast, isCJSFile, 'intlayer', 'vite-intlayer');\n\n const updateConfigObject = (objExpr: any) => {\n if (\n !objExpr ||\n (objExpr.type !== 'ObjectExpression' &&\n !n.ObjectExpression.check(objExpr))\n )\n return;\n\n let pluginsProp = objExpr.properties.find((p: any) => {\n if (!p || !p.key) return false;\n const keyName = p.key.name || p.key.value;\n return keyName === 'plugins';\n }) as any;\n\n if (!pluginsProp) {\n pluginsProp = b.property(\n 'init',\n b.identifier('plugins'),\n b.arrayExpression([])\n );\n objExpr.properties.push(pluginsProp);\n }\n\n const pluginsValue = pluginsProp.value;\n\n if (\n pluginsValue &&\n (pluginsValue.type === 'ArrayExpression' ||\n n.ArrayExpression.check(pluginsValue))\n ) {\n const hasPlugin = pluginsValue.elements.some((el: any) => {\n const callee = el?.callee;\n\n if (!callee) return false;\n const name = callee.name || callee.id?.name;\n return name === 'intlayer' || name === 'il';\n });\n\n if (!hasPlugin) {\n pluginsValue.elements.push(\n b.callExpression(b.identifier('intlayer'), [])\n );\n }\n }\n };\n\n recast.visit(ast, {\n visitExportDefaultDeclaration(path) {\n const decl = path.node.declaration;\n\n if (n.ObjectExpression.check(decl)) {\n updateConfigObject(decl);\n } else if (\n n.CallExpression.check(decl) &&\n n.Identifier.check(decl.callee) &&\n decl.callee.name === 'defineConfig'\n ) {\n if (n.ObjectExpression.check(decl.arguments[0])) {\n updateConfigObject(decl.arguments[0]);\n }\n } else if (n.Identifier.check(decl)) {\n const name = decl.name;\n ast.program.body.forEach((stmt: any) => {\n if (n.VariableDeclaration.check(stmt)) {\n stmt.declarations.forEach((vdecl: any) => {\n if (\n n.VariableDeclarator.check(vdecl) &&\n n.Identifier.check(vdecl.id) &&\n vdecl.id.name === name &&\n n.ObjectExpression.check(vdecl.init)\n ) {\n updateConfigObject(vdecl.init);\n }\n });\n }\n });\n }\n return false;\n },\n visitAssignmentExpression(path) {\n const { left, right } = path.node;\n\n if (\n n.MemberExpression.check(left) &&\n recast.print(left).code === 'module.exports'\n ) {\n if (n.ObjectExpression.check(right)) {\n updateConfigObject(right);\n } else if (\n n.CallExpression.check(right) &&\n n.Identifier.check(right.callee) &&\n right.callee.name === 'defineConfig'\n ) {\n if (n.ObjectExpression.check(right.arguments[0])) {\n updateConfigObject(right.arguments[0]);\n }\n }\n }\n return false;\n },\n });\n\n return recast.print(ast).code;\n};\n\nexport const updateNextConfig = (\n content: string,\n extension: string\n): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n const isCJSFile = extension === 'cjs' || content.includes('module.exports');\n\n injectImport(ast, isCJSFile, 'withIntlayer', 'next-intlayer/server');\n\n recast.visit(ast, {\n visitExportDefaultDeclaration(path) {\n const declaration = path.node.declaration;\n if (\n n.Expression.check(declaration) &&\n !(\n n.CallExpression.check(declaration) &&\n n.Identifier.check(declaration.callee) &&\n declaration.callee.name === 'withIntlayer'\n )\n ) {\n path\n .get('declaration')\n .replace(\n b.callExpression(b.identifier('withIntlayer'), [declaration as any])\n );\n }\n return false;\n },\n visitAssignmentExpression(path) {\n const { left, right } = path.node;\n\n if (\n n.MemberExpression.check(left) &&\n recast.print(left).code === 'module.exports' &&\n !(\n n.CallExpression.check(right) &&\n n.Identifier.check(right.callee) &&\n right.callee.name === 'withIntlayer'\n )\n ) {\n path\n .get('right')\n .replace(b.callExpression(b.identifier('withIntlayer'), [right]));\n }\n return false;\n },\n });\n\n return recast.print(ast).code;\n};\n"],"mappings":"gJAEA,MAAM,EAAI,EAAO,MAAM,SACjB,EAAI,EAAO,MAAM,WAKjB,GAAoB,EAAU,IAAgC,CAClE,IAAI,EAAQ,GAuBZ,OAtBA,EAAO,MAAM,EAAK,CAChB,uBAAuB,EAAM,CAI3B,OAHI,EAAK,KAAK,OAAO,QAAU,IAC7B,EAAQ,IAEH,IAET,oBAAoB,EAAM,CACxB,GAAM,CAAE,SAAQ,UAAW,GAAS,EAAK,KAWzC,OARE,EAAE,WAAW,MAAM,EAAO,EAC1B,EAAO,OAAS,WAChB,EAAK,IACL,EAAE,cAAc,MAAM,EAAK,GAAG,EAC9B,EAAK,GAAG,QAAU,IAElB,EAAQ,IAEH,IAEV,CAAC,CACK,GAMH,GACJ,EACA,EACA,EACA,IACG,CACH,GAAI,EAAiB,EAAK,EAAO,CAAE,OAEnC,IAAM,EAAc,EAChB,EAAE,oBAAoB,QAAS,CAC7B,EAAE,mBACA,EAAE,cAAc,CACd,EAAE,eAAe,KAAK,CACpB,IAAK,EAAE,WAAW,EAAW,CAC7B,MAAO,EAAE,WAAW,EAAW,CAC/B,UAAW,GACZ,CAAC,CACH,CAAC,CACF,EAAE,eAAe,EAAE,WAAW,UAAU,CAAE,CAAC,EAAE,cAAc,EAAO,CAAC,CAAC,CACrE,CACF,CAAC,CACF,EAAE,kBACA,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAW,CAAC,CAAC,CAC7C,EAAE,cAAc,EAAO,CACxB,CAEL,EAAI,QAAQ,KAAK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0BAA0B,EAAM,CAC9B,GAAM,CAAE,OAAM,SAAU,EAAK,KAe7B,OAZE,EAAE,iBAAiB,MAAM,EAAK,EAC9B,EAAO,MAAM,EAAK,CAAC,OAAS,kBAC5B,EACE,EAAE,eAAe,MAAM,EAAM,EAC7B,EAAE,WAAW,MAAM,EAAM,OAAO,EAChC,EAAM,OAAO,OAAS,iBAGxB,EACG,IAAI,QAAQ,CACZ,QAAQ,EAAE,eAAe,EAAE,WAAW,eAAe,CAAE,CAAC,EAAM,CAAC,CAAC,CAE9D,IAEV,CAAC,CAEK,EAAO,MAAM,EAAI,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../chunk-Bmb41Sf3.cjs`);let e=require(`node:fs/promises`),t=require(`node:path`);const n=async(n,r)=>{try{return await(0,e.access)((0,t.join)(n,r)),!0}catch{return!1}},r=async(n,r)=>await(0,e.readFile)((0,t.join)(n,r),`utf8`),i=async(n,r,i)=>await(0,e.writeFile)((0,t.join)(n,r),i,`utf8`),a=async(n,r)=>{try{await(0,e.mkdir)((0,t.join)(n,r),{recursive:!0})}catch{}};exports.ensureDirectory=a,exports.exists=n,exports.readFileFromRoot=r,exports.writeFileToRoot=i;
|
|
2
2
|
//# sourceMappingURL=fileSystem.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileSystem.cjs","names":[],"sources":["../../../../src/init/utils/fileSystem.ts"],"sourcesContent":["import { access, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Helper to check if a file exists\n */\nexport const exists = async (rootDir: string, filePath: string) => {\n try {\n await access(join(rootDir, filePath));\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Helper to read a file\n */\nexport const readFileFromRoot = async (rootDir: string, filePath: string) =>\n await readFile(join(rootDir, filePath), 'utf8');\n\n/**\n * Helper to write a file\n */\nexport const writeFileToRoot = async (\n rootDir: string,\n filePath: string,\n content: string\n) => await writeFile(join(rootDir, filePath), content, 'utf8');\n\n/**\n * Helper to ensure a directory exists\n */\nexport const ensureDirectory = async (rootDir: string, dirPath: string) => {\n try {\n await mkdir(join(rootDir, dirPath), { recursive: true });\n } catch {\n // Directory already exists or could not be created\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"fileSystem.cjs","names":[],"sources":["../../../../src/init/utils/fileSystem.ts"],"sourcesContent":["import { access, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Helper to check if a file exists\n */\nexport const exists = async (rootDir: string, filePath: string) => {\n try {\n await access(join(rootDir, filePath));\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Helper to read a file\n */\nexport const readFileFromRoot = async (rootDir: string, filePath: string) =>\n await readFile(join(rootDir, filePath), 'utf8');\n\n/**\n * Helper to write a file\n */\nexport const writeFileToRoot = async (\n rootDir: string,\n filePath: string,\n content: string\n) => await writeFile(join(rootDir, filePath), content, 'utf8');\n\n/**\n * Helper to ensure a directory exists\n */\nexport const ensureDirectory = async (rootDir: string, dirPath: string) => {\n try {\n await mkdir(join(rootDir, dirPath), { recursive: true });\n } catch {\n // Directory already exists or could not be created\n }\n};\n"],"mappings":"gKAMA,MAAa,EAAS,MAAO,EAAiB,IAAqB,CACjE,GAAI,CAEF,OADA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,MAAkB,EAAS,EAAS,CAAC,CAC9B,QACD,CACN,MAAO,KAOE,EAAmB,MAAO,EAAiB,IACtD,MAAA,EAAA,EAAA,WAAA,EAAA,EAAA,MAAoB,EAAS,EAAS,CAAE,OAAO,CAKpC,EAAkB,MAC7B,EACA,EACA,IACG,MAAA,EAAA,EAAA,YAAA,EAAA,EAAA,MAAqB,EAAS,EAAS,CAAE,EAAS,OAAO,CAKjD,EAAkB,MAAO,EAAiB,IAAoB,CACzE,GAAI,CACF,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,MAAiB,EAAS,EAAQ,CAAE,CAAE,UAAW,GAAM,CAAC,MAClD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../chunk-Bmb41Sf3.cjs`);let e=require(`node:fs/promises`);const t=async t=>{try{return(await(0,e.readdir)(t)).filter(e=>e===`tsconfig.json`||/^tsconfig\..+\.json$/.test(e))}catch{return[]}};exports.findTsConfigFiles=t;
|
|
2
2
|
//# sourceMappingURL=tsConfig.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsConfig.cjs","names":[],"sources":["../../../../src/init/utils/tsConfig.ts"],"sourcesContent":["import { readdir } from 'node:fs/promises';\n\n/**\n * Helper to find all tsconfig files (tsconfig.json, tsconfig.*.json)\n */\nexport const findTsConfigFiles = async (rootDir: string): Promise<string[]> => {\n try {\n const files = await readdir(rootDir);\n\n return files.filter(\n (file) => file === 'tsconfig.json' || /^tsconfig\\..+\\.json$/.test(file)\n );\n } catch {\n return [];\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsConfig.cjs","names":[],"sources":["../../../../src/init/utils/tsConfig.ts"],"sourcesContent":["import { readdir } from 'node:fs/promises';\n\n/**\n * Helper to find all tsconfig files (tsconfig.json, tsconfig.*.json)\n */\nexport const findTsConfigFiles = async (rootDir: string): Promise<string[]> => {\n try {\n const files = await readdir(rootDir);\n\n return files.filter(\n (file) => file === 'tsconfig.json' || /^tsconfig\\..+\\.json$/.test(file)\n );\n } catch {\n return [];\n }\n};\n"],"mappings":"yIAKA,MAAa,EAAoB,KAAO,IAAuC,CAC7E,GAAI,CAGF,OAFc,MAAA,EAAA,EAAA,SAAc,EAAQ,EAEvB,OACV,GAAS,IAAS,iBAAmB,uBAAuB,KAAK,EAAK,CACxE,MACK,CACN,MAAO,EAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);const e=require(`../_utils_asset-SJVy1xMD.cjs`);let t=require(`node:fs/promises`),n=require(`node:path`),r=require(`@intlayer/config/logger`),i=require(`@intlayer/config/node`);const a=process.cwd(),o=async(e,r)=>await(0,t.writeFile)((0,n.join)(a,e),r,`utf8`),s=e=>{switch(e){case`ts`:return`./templates/ts.txt`;case`cjs`:return`./templates/cjs.txt`;case`mjs`:return`./templates/mjs.txt`;case`js`:return`./templates/mjs.txt`;case`json`:return`./templates/json.txt`;default:return`./templates/ts.txt`}},c=async(t,a)=>{let{configurationFilePath:c}=(0,i.searchConfigurationFile)(a);if(c){(0,r.logger)(`${r.v} ${(0,r.colorizePath)((0,n.relative)(a,c))} already exists`);return}await o(t,e.t(s(t.split(`.`).pop()))),(0,r.logger)(`${r.v} Created ${(0,r.colorizePath)(t)}`)};exports.initConfig=c;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["v","readAsset"],"sources":["../../../src/initConfig/index.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { colorizePath, logger, v } from '@intlayer/config/logger';\nimport {\n type configurationFilesCandidates,\n searchConfigurationFile,\n} from '@intlayer/config/node';\n\n/**\n * UTILITIES\n */\nconst rootDir = process.cwd();\n\n// Helper to write a file\nconst writeFileToRoot = async (filePath: string, content: string) =>\n await writeFile(join(rootDir, filePath), content, 'utf8');\n\ntype ConfigFormat = 'ts' | 'cjs' | 'mjs' | 'js' | 'json';\n\nconst getTemplatePath = (format: ConfigFormat) => {\n switch (format) {\n case 'ts':\n return './templates/ts.txt';\n case 'cjs':\n return './templates/cjs.txt';\n case 'mjs':\n return './templates/mjs.txt';\n case 'js':\n return './templates/mjs.txt';\n case 'json':\n return './templates/json.txt';\n default:\n return './templates/ts.txt';\n }\n};\n\n/**\n * Initialize the Intlayer configuration file\n */\nexport const initConfig = async (\n format: (typeof configurationFilesCandidates)[number],\n baseDir: string\n) => {\n // Search for configuration file\n const { configurationFilePath } = searchConfigurationFile(baseDir);\n\n // return if the configuration file is found\n if (configurationFilePath) {\n const relativePath = relative(baseDir, configurationFilePath);\n logger(`${v} ${colorizePath(relativePath)} already exists`);\n return;\n }\n\n // Extract the format from the filename (e.g. 'intlayer.config.ts' -> 'ts')\n const extension = format.split('.').pop() as ConfigFormat;\n\n const templatePath = getTemplatePath(extension);\n const configContent = readAsset(templatePath);\n\n await writeFileToRoot(format, configContent);\n logger(`${v} Created ${colorizePath(format)}`);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["v","readAsset"],"sources":["../../../src/initConfig/index.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { colorizePath, logger, v } from '@intlayer/config/logger';\nimport {\n type configurationFilesCandidates,\n searchConfigurationFile,\n} from '@intlayer/config/node';\n\n/**\n * UTILITIES\n */\nconst rootDir = process.cwd();\n\n// Helper to write a file\nconst writeFileToRoot = async (filePath: string, content: string) =>\n await writeFile(join(rootDir, filePath), content, 'utf8');\n\ntype ConfigFormat = 'ts' | 'cjs' | 'mjs' | 'js' | 'json';\n\nconst getTemplatePath = (format: ConfigFormat) => {\n switch (format) {\n case 'ts':\n return './templates/ts.txt';\n case 'cjs':\n return './templates/cjs.txt';\n case 'mjs':\n return './templates/mjs.txt';\n case 'js':\n return './templates/mjs.txt';\n case 'json':\n return './templates/json.txt';\n default:\n return './templates/ts.txt';\n }\n};\n\n/**\n * Initialize the Intlayer configuration file\n */\nexport const initConfig = async (\n format: (typeof configurationFilesCandidates)[number],\n baseDir: string\n) => {\n // Search for configuration file\n const { configurationFilePath } = searchConfigurationFile(baseDir);\n\n // return if the configuration file is found\n if (configurationFilePath) {\n const relativePath = relative(baseDir, configurationFilePath);\n logger(`${v} ${colorizePath(relativePath)} already exists`);\n return;\n }\n\n // Extract the format from the filename (e.g. 'intlayer.config.ts' -> 'ts')\n const extension = format.split('.').pop() as ConfigFormat;\n\n const templatePath = getTemplatePath(extension);\n const configContent = readAsset(templatePath);\n\n await writeFileToRoot(format, configContent);\n logger(`${v} Created ${colorizePath(format)}`);\n};\n"],"mappings":"qRAYA,MAAM,EAAU,QAAQ,KAAK,CAGvB,EAAkB,MAAO,EAAkB,IAC/C,MAAA,EAAA,EAAA,YAAA,EAAA,EAAA,MAAqB,EAAS,EAAS,CAAE,EAAS,OAAO,CAIrD,EAAmB,GAAyB,CAChD,OAAQ,EAAR,CACE,IAAK,KACH,MAAO,qBACT,IAAK,MACH,MAAO,sBACT,IAAK,MACH,MAAO,sBACT,IAAK,KACH,MAAO,sBACT,IAAK,OACH,MAAO,uBACT,QACE,MAAO,uBAOA,EAAa,MACxB,EACA,IACG,CAEH,GAAM,CAAE,0BAAA,EAAA,EAAA,yBAAkD,EAAQ,CAGlE,GAAI,EAAuB,EAEzB,EAAA,EAAA,QAAO,GAAGA,EAAAA,EAAE,IAAA,EAAA,EAAA,eAAA,EAAA,EAAA,UADkB,EAAS,EAAsB,CACpB,CAAC,iBAAiB,CAC3D,OASF,MAAM,EAAgB,EAFAC,EAAAA,EADD,EAFH,EAAO,MAAM,IAAI,CAAC,KAAK,CAEM,CACF,CAED,EAC5C,EAAA,EAAA,QAAO,GAAGD,EAAAA,EAAE,YAAA,EAAA,EAAA,cAAwB,EAAO,GAAG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-Bmb41Sf3.cjs`),t=require(`../installSkills/index.cjs`);let n=require(`node:path`);n=e.t(n);let r=require(`node:fs`),i=require(`node:os`);i=e.t(i);const a=process.platform===`win32`?n.default.join(process.env.APPDATA||``,`Claude`,`claude_desktop_config.json`):n.default.join(i.default.homedir(),`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`),o=async(e,i,o)=>{let s,c=`mcpServers`;if(i===`Claude`)s=a;else{let r=n.default.dirname(t.PLATFORMS_METADATA[i].dir);s=n.default.join(e,r,`mcp.json`),i===`VSCode`&&(c=`servers`)}await r.promises.mkdir(n.default.dirname(s),{recursive:!0});let l={};try{let e=await r.promises.readFile(s,`utf-8`);l=JSON.parse(e)}catch{}if(l[c]||(l[c]={}),o===`stdio`){let e={command:`npx`,args:[`-y`,`@intlayer/mcp`]};i===`VSCode`&&(e.type=`stdio`),l[c].intlayer=e}else{let e={url:`https://mcp.intlayer.org`};i===`VSCode`?e.type=`sse`:e.transport=`sse`,l[c].intlayer=e}return await r.promises.writeFile(s,JSON.stringify(l,null,2),`utf-8`),`MCP server configuration updated in ${s}`};exports.installMCP=o;
|
|
2
2
|
//# sourceMappingURL=installMCP.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installMCP.cjs","names":["path","os","PLATFORMS_METADATA","fs"],"sources":["../../../src/installMCP/installMCP.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { PLATFORMS_METADATA, type Platform } from '../installSkills';\n\nexport type MCPTransport = 'stdio' | 'sse';\n\nconst MCP_CONFIG_FILENAME = 'mcp.json';\n\nconst CLAUDE_DESKTOP_CONFIG_PATH =\n process.platform === 'win32'\n ? path.join(\n process.env.APPDATA || '',\n 'Claude',\n 'claude_desktop_config.json'\n )\n : path.join(\n os.homedir(),\n 'Library',\n 'Application Support',\n 'Claude',\n 'claude_desktop_config.json'\n );\n\n/**\n * Installs the Intlayer MCP server configuration for a specific platform.\n */\nexport const installMCP = async (\n projectRoot: string,\n platform: Platform,\n transport: MCPTransport\n): Promise<string> => {\n let configPath: string;\n let configKey = 'mcpServers';\n\n if (platform === 'Claude') {\n configPath = CLAUDE_DESKTOP_CONFIG_PATH;\n } else {\n const relativeDir = path.dirname(PLATFORMS_METADATA[platform].dir); // e.g. .cursor or .vscode\n configPath = path.join(projectRoot, relativeDir, MCP_CONFIG_FILENAME);\n\n if (platform === 'VSCode') {\n configKey = 'servers';\n }\n }\n\n // Ensure the configuration directory exists\n await fs.mkdir(path.dirname(configPath), { recursive: true });\n\n let config: any = {};\n try {\n const content = await fs.readFile(configPath, 'utf-8');\n config = JSON.parse(content);\n } catch {\n // File doesn't exist or is invalid JSON, start fresh\n }\n\n if (!config[configKey]) {\n config[configKey] = {};\n }\n\n if (transport === 'stdio') {\n const mcpConfig: any = {\n command: 'npx',\n args: ['-y', '@intlayer/mcp'],\n };\n\n if (platform === 'VSCode') {\n mcpConfig.type = 'stdio';\n }\n\n config[configKey].intlayer = mcpConfig;\n } else {\n const mcpConfig: any = {\n url: 'https://mcp.intlayer.org',\n };\n\n if (platform === 'VSCode') {\n mcpConfig.type = 'sse';\n } else {\n mcpConfig.transport = 'sse';\n }\n\n config[configKey].intlayer = mcpConfig;\n }\n\n await fs.writeFile(configPath, JSON.stringify(config, null, 2), 'utf-8');\n\n return `MCP server configuration updated in ${configPath}`;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"installMCP.cjs","names":["path","os","PLATFORMS_METADATA","fs"],"sources":["../../../src/installMCP/installMCP.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { PLATFORMS_METADATA, type Platform } from '../installSkills';\n\nexport type MCPTransport = 'stdio' | 'sse';\n\nconst MCP_CONFIG_FILENAME = 'mcp.json';\n\nconst CLAUDE_DESKTOP_CONFIG_PATH =\n process.platform === 'win32'\n ? path.join(\n process.env.APPDATA || '',\n 'Claude',\n 'claude_desktop_config.json'\n )\n : path.join(\n os.homedir(),\n 'Library',\n 'Application Support',\n 'Claude',\n 'claude_desktop_config.json'\n );\n\n/**\n * Installs the Intlayer MCP server configuration for a specific platform.\n */\nexport const installMCP = async (\n projectRoot: string,\n platform: Platform,\n transport: MCPTransport\n): Promise<string> => {\n let configPath: string;\n let configKey = 'mcpServers';\n\n if (platform === 'Claude') {\n configPath = CLAUDE_DESKTOP_CONFIG_PATH;\n } else {\n const relativeDir = path.dirname(PLATFORMS_METADATA[platform].dir); // e.g. .cursor or .vscode\n configPath = path.join(projectRoot, relativeDir, MCP_CONFIG_FILENAME);\n\n if (platform === 'VSCode') {\n configKey = 'servers';\n }\n }\n\n // Ensure the configuration directory exists\n await fs.mkdir(path.dirname(configPath), { recursive: true });\n\n let config: any = {};\n try {\n const content = await fs.readFile(configPath, 'utf-8');\n config = JSON.parse(content);\n } catch {\n // File doesn't exist or is invalid JSON, start fresh\n }\n\n if (!config[configKey]) {\n config[configKey] = {};\n }\n\n if (transport === 'stdio') {\n const mcpConfig: any = {\n command: 'npx',\n args: ['-y', '@intlayer/mcp'],\n };\n\n if (platform === 'VSCode') {\n mcpConfig.type = 'stdio';\n }\n\n config[configKey].intlayer = mcpConfig;\n } else {\n const mcpConfig: any = {\n url: 'https://mcp.intlayer.org',\n };\n\n if (platform === 'VSCode') {\n mcpConfig.type = 'sse';\n } else {\n mcpConfig.transport = 'sse';\n }\n\n config[configKey].intlayer = mcpConfig;\n }\n\n await fs.writeFile(configPath, JSON.stringify(config, null, 2), 'utf-8');\n\n return `MCP server configuration updated in ${configPath}`;\n};\n"],"mappings":"+OAOA,MAEM,EACJ,QAAQ,WAAa,QACjBA,EAAAA,QAAK,KACH,QAAQ,IAAI,SAAW,GACvB,SACA,6BACD,CACDA,EAAAA,QAAK,KACHC,EAAAA,QAAG,SAAS,CACZ,UACA,sBACA,SACA,6BACD,CAKM,EAAa,MACxB,EACA,EACA,IACoB,CACpB,IAAI,EACA,EAAY,aAEhB,GAAI,IAAa,SACf,EAAa,MACR,CACL,IAAM,EAAcD,EAAAA,QAAK,QAAQE,EAAAA,mBAAmB,GAAU,IAAI,CAClE,EAAaF,EAAAA,QAAK,KAAK,EAAa,EAAa,WAAoB,CAEjE,IAAa,WACf,EAAY,WAKhB,MAAMG,EAAAA,SAAG,MAAMH,EAAAA,QAAK,QAAQ,EAAW,CAAE,CAAE,UAAW,GAAM,CAAC,CAE7D,IAAI,EAAc,EAAE,CACpB,GAAI,CACF,IAAM,EAAU,MAAMG,EAAAA,SAAG,SAAS,EAAY,QAAQ,CACtD,EAAS,KAAK,MAAM,EAAQ,MACtB,EAQR,GAJK,EAAO,KACV,EAAO,GAAa,EAAE,EAGpB,IAAc,QAAS,CACzB,IAAM,EAAiB,CACrB,QAAS,MACT,KAAM,CAAC,KAAM,gBAAgB,CAC9B,CAEG,IAAa,WACf,EAAU,KAAO,SAGnB,EAAO,GAAW,SAAW,MACxB,CACL,IAAM,EAAiB,CACrB,IAAK,2BACN,CAEG,IAAa,SACf,EAAU,KAAO,MAEjB,EAAU,UAAY,MAGxB,EAAO,GAAW,SAAW,EAK/B,OAFA,MAAMA,EAAAA,SAAG,UAAU,EAAY,KAAK,UAAU,EAAQ,KAAM,EAAE,CAAE,QAAQ,CAEjE,uCAAuC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-Bmb41Sf3.cjs`),t=require(`../_utils_asset-SJVy1xMD.cjs`);let n=require(`node:path`);n=e.t(n);let r=require(`@intlayer/config/logger`),i=require(`node:fs`),a=require(`@intlayer/core/markdown`);const o={Config:`Intlayer configuration documentation`,Content:`Reference for all Intlayer content node types (t, enu, etc.)`,Usage:`How to use Intlayer in your project`,CLI:`Intlayer CLI commands and usage`,Compiler:`Intlayer Compiler setup and usage for automatic content extraction without .content files`,RemoteContent:`How to use Intlayer with Remote/CMS/Server-side content`,NextJS:`Next.js-specific usage (Server & Client components)`,React:`React-specific syntax and hooks usage`,Vue:`Vue-specific composables and syntax`,Svelte:`Svelte-specific stores and syntax`,Angular:`Angular-specific syntax and Injectable Function usage`,Preact:`Preact-specific syntax and hooks usage`,Solid:`Integrates Intlayer internationalization with SolidJS components. Use when the user asks to "setup SolidJS i18n", use the "useIntlayer" hook in Solid, or manage locales in a SolidJS application.`,Astro:`Astro-specific usage and getIntlayer`},s=Object.keys(o),c=e=>{let t=[`Usage`,`Content`,`Config`,`CLI`,`Compiler`];return e.next&&t.push(`NextJS`),(e.react||!e.next)&&t.push(`React`),e.preact&&t.push(`Preact`),e[`solid-js`]&&t.push(`Solid`),(e.vue||e.nuxt)&&t.push(`Vue`),(e.svelte||e[`@sveltejs/kit`])&&t.push(`Svelte`),e.astro&&t.push(`Astro`),t},l={Cursor:{label:`Cursor`,dir:`.cursor/skills`,check:()=>process.env.CURSOR===`true`||process.env.TERM_PROGRAM===`cursor`},Windsurf:{label:`Windsurf`,dir:`.windsurf/skills`,check:()=>process.env.WINDSURF===`true`||process.env.TERM_PROGRAM===`windsurf`},Trae:{label:`Trae`,dir:`.trae/skills`,check:()=>process.env.TRAE===`true`||process.env.TERM_PROGRAM===`trae`},TraeCN:{label:`Trae CN`,dir:`.trae/skills`,check:()=>process.env.TRAE_CN===`true`},VSCode:{label:`VS Code`,dir:`.vscode/skills`,check:()=>process.env.VSCODE===`true`||process.env.TERM_PROGRAM===`vscode`},OpenCode:{label:`OpenCode`,dir:`.opencode/skills`,check:()=>process.env.OPENCODE===`true`},Claude:{label:`Claude Code`,dir:`.claude/skills`,check:()=>process.env.CLAUDE===`true`},GitHub:{label:`GitHub Copilot Workspace`,dir:`.github/skills`,check:()=>process.env.GITHUB_ACTIONS===`true`||!!process.env.GITHUB_WORKSPACE},Antigravity:{label:`Antigravity`,dir:`.agent/skills`},Augment:{label:`Augment`,dir:`.augment/skills`},OpenClaw:{label:`OpenClaw`,dir:`skills`},Cline:{label:`Cline`,dir:`.cline/skills`},CodeBuddy:{label:`CodeBuddy`,dir:`.codebuddy/skills`},CommandCode:{label:`Command Code`,dir:`.commandcode/skills`},Continue:{label:`Continue`,dir:`.continue/skills`},Crush:{label:`Crush`,dir:`.crush/skills`},Droid:{label:`Droid`,dir:`.factory/skills`},Goose:{label:`Goose`,dir:`.goose/skills`},IFlow:{label:`iFlow CLI`,dir:`.iflow/skills`},Junie:{label:`Junie`,dir:`.junie/skills`},KiloCode:{label:`Kilo Code`,dir:`.kilocode/skills`},Kiro:{label:`Kiro CLI`,dir:`.kiro/skills`},Kode:{label:`Kode`,dir:`.kode/skills`},MCPJam:{label:`MCPJam`,dir:`.mcpjam/skills`},MistralVibe:{label:`Mistral Vibe`,dir:`.vibe/skills`},Mux:{label:`Mux`,dir:`.mux/skills`},OpenHands:{label:`OpenHands`,dir:`.openhands/skills`},Pi:{label:`Pi`,dir:`.pi/skills`},Qoder:{label:`Qoder`,dir:`.qoder/skills`},Qwen:{label:`Qwen Code`,dir:`.qwen/skills`},RooCode:{label:`Roo Code`,dir:`.roo/skills`},Zencoder:{label:`Zencoder`,dir:`.zencoder/skills`},Neovate:{label:`Neovate`,dir:`.neovate/skills`},Pochi:{label:`Pochi`,dir:`.pochi/skills`},Other:{label:`Other`,dir:`skills`}},u=Object.keys(l),d={},f=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),p=e=>{let n=`./skills/${d[e]??f(e)}.md`;try{return t.t(n)}catch{return console.warn(`Warning: Could not read asset for skill: ${e} at ${n}`),``}},m=()=>{try{return t.t(`./LICENCE.md`)}catch{return console.warn(`Warning: Could not read LICENCE.md asset`),``}},h=async e=>{let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: ${t.statusText}`);return t.text()},g=async(e,t,o)=>{let s=l[t].dir??`skills`,c=n.default.join(e,s);await i.promises.mkdir(c,{recursive:!0});let u=[],g=m();for(let e of o){let t=`intlayer-${d[e]??f(e)}`,r=p(e);if(!r)continue;let o=Array.from(new Set(r.match(/https:\/\/intlayer\.org\/doc\/[^\s)]+\.md/g)||[])),s=n.default.join(c,t),l=n.default.join(s,`references`);await i.promises.mkdir(l,{recursive:!0}),g&&await i.promises.writeFile(n.default.join(s,`LICENCE.md`),g,`utf-8`);let m=r,_=o.map(async t=>{try{let e=await h(t),n=(0,a.getMarkdownMetadata)(e),r=``;return r=Array.isArray(n.slugs)?n.slugs.filter(e=>e!==`doc`).join(`_`):new URL(t).pathname.split(`/`).filter(e=>e&&e!==`doc`).map(e=>e.replace(`.md`,``)).join(`_`),r=r?`${r}.md`:`index.md`,{url:t,localRefPath:`references/${r}`,fileName:r,content:e,success:!0}}catch(n){return console.warn(`Warning: Failed to download ref ${t} for skill ${e}`,n),{url:t,success:!1}}}),v=await Promise.all(_);for(let e of v)e.success&&e.fileName&&e.content&&e.localRefPath&&(await i.promises.writeFile(n.default.join(l,e.fileName),e.content,`utf-8`),m=m.replaceAll(e.url,e.localRefPath));let y=n.default.join(s,`SKILL.md`);await i.promises.writeFile(y,m,`utf-8`),u.push(`${t}/SKILL.md`)}return u.length===0?`No skill files were created. Check your asset paths.`:`${r.v} Created ${u.length} skills in ${c}`};exports.PLATFORMS=u,exports.PLATFORMS_METADATA=l,exports.SKILLS=s,exports.SKILLS_METADATA=o,exports.getInitialSkills=c,exports.installSkills=g;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["readAsset","path","fs","v"],"sources":["../../../src/installSkills/index.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { v } from '@intlayer/config/logger';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\n\n/**\n * Metadata for each available documentation skill.\n */\nexport const SKILLS_METADATA = {\n Config: 'Intlayer configuration documentation',\n Content: 'Reference for all Intlayer content node types (t, enu, etc.)',\n Usage: 'How to use Intlayer in your project',\n CLI: 'Intlayer CLI commands and usage',\n Compiler:\n 'Intlayer Compiler setup and usage for automatic content extraction without .content files',\n RemoteContent: 'How to use Intlayer with Remote/CMS/Server-side content',\n NextJS: 'Next.js-specific usage (Server & Client components)',\n React: 'React-specific syntax and hooks usage',\n Vue: 'Vue-specific composables and syntax',\n Svelte: 'Svelte-specific stores and syntax',\n Angular: 'Angular-specific syntax and Injectable Function usage',\n Preact: 'Preact-specific syntax and hooks usage',\n Solid:\n 'Integrates Intlayer internationalization with SolidJS components. Use when the user asks to \"setup SolidJS i18n\", use the \"useIntlayer\" hook in Solid, or manage locales in a SolidJS application.',\n Astro: 'Astro-specific usage and getIntlayer',\n} as const;\n\nexport type Skill = keyof typeof SKILLS_METADATA;\n\nexport const SKILLS = Object.keys(SKILLS_METADATA) as Skill[];\n\nexport const getInitialSkills = (\n deps: Record<string, string>\n): (keyof typeof SKILLS_METADATA)[] => {\n const skills: (keyof typeof SKILLS_METADATA)[] = [\n 'Usage',\n 'Content',\n 'Config',\n 'CLI',\n 'Compiler',\n ];\n\n if (deps.next) skills.push('NextJS');\n if (deps.react || !deps.next) skills.push('React');\n if (deps.preact) skills.push('Preact');\n if (deps['solid-js']) skills.push('Solid');\n if (deps.vue || deps.nuxt) skills.push('Vue');\n if (deps.svelte || deps['@sveltejs/kit']) skills.push('Svelte');\n if (deps.astro) skills.push('Astro');\n\n return skills;\n};\n\nexport interface PlatformMetadata {\n label: string;\n dir: string;\n check?: () => boolean;\n}\n\n/**\n * Metadata and configuration for each supported platform.\n */\nexport const PLATFORMS_METADATA: Record<string, PlatformMetadata> = {\n Cursor: {\n label: 'Cursor',\n dir: '.cursor/skills',\n check: () =>\n process.env.CURSOR === 'true' || process.env.TERM_PROGRAM === 'cursor',\n },\n Windsurf: {\n label: 'Windsurf',\n dir: '.windsurf/skills',\n check: () =>\n process.env.WINDSURF === 'true' ||\n process.env.TERM_PROGRAM === 'windsurf',\n },\n Trae: {\n label: 'Trae',\n dir: '.trae/skills',\n check: () =>\n process.env.TRAE === 'true' || process.env.TERM_PROGRAM === 'trae',\n },\n TraeCN: {\n label: 'Trae CN',\n dir: '.trae/skills',\n check: () => process.env.TRAE_CN === 'true',\n },\n VSCode: {\n label: 'VS Code',\n dir: '.vscode/skills',\n check: () =>\n process.env.VSCODE === 'true' || process.env.TERM_PROGRAM === 'vscode',\n },\n OpenCode: {\n label: 'OpenCode',\n dir: '.opencode/skills',\n check: () => process.env.OPENCODE === 'true',\n },\n Claude: {\n label: 'Claude Code',\n dir: '.claude/skills',\n check: () => process.env.CLAUDE === 'true',\n },\n GitHub: {\n label: 'GitHub Copilot Workspace',\n dir: '.github/skills',\n check: () =>\n process.env.GITHUB_ACTIONS === 'true' || !!process.env.GITHUB_WORKSPACE,\n },\n Antigravity: {\n label: 'Antigravity',\n dir: '.agent/skills',\n },\n Augment: {\n label: 'Augment',\n dir: '.augment/skills',\n },\n OpenClaw: {\n label: 'OpenClaw',\n dir: 'skills',\n },\n Cline: {\n label: 'Cline',\n dir: '.cline/skills',\n },\n CodeBuddy: {\n label: 'CodeBuddy',\n dir: '.codebuddy/skills',\n },\n CommandCode: {\n label: 'Command Code',\n dir: '.commandcode/skills',\n },\n Continue: {\n label: 'Continue',\n dir: '.continue/skills',\n },\n Crush: {\n label: 'Crush',\n dir: '.crush/skills',\n },\n Droid: {\n label: 'Droid',\n dir: '.factory/skills',\n },\n Goose: {\n label: 'Goose',\n dir: '.goose/skills',\n },\n IFlow: {\n label: 'iFlow CLI',\n dir: '.iflow/skills',\n },\n Junie: {\n label: 'Junie',\n dir: '.junie/skills',\n },\n KiloCode: {\n label: 'Kilo Code',\n dir: '.kilocode/skills',\n },\n Kiro: {\n label: 'Kiro CLI',\n dir: '.kiro/skills',\n },\n Kode: {\n label: 'Kode',\n dir: '.kode/skills',\n },\n MCPJam: {\n label: 'MCPJam',\n dir: '.mcpjam/skills',\n },\n MistralVibe: {\n label: 'Mistral Vibe',\n dir: '.vibe/skills',\n },\n Mux: {\n label: 'Mux',\n dir: '.mux/skills',\n },\n OpenHands: {\n label: 'OpenHands',\n dir: '.openhands/skills',\n },\n Pi: {\n label: 'Pi',\n dir: '.pi/skills',\n },\n Qoder: {\n label: 'Qoder',\n dir: '.qoder/skills',\n },\n Qwen: {\n label: 'Qwen Code',\n dir: '.qwen/skills',\n },\n RooCode: {\n label: 'Roo Code',\n dir: '.roo/skills',\n },\n Zencoder: {\n label: 'Zencoder',\n dir: '.zencoder/skills',\n },\n Neovate: {\n label: 'Neovate',\n dir: '.neovate/skills',\n },\n Pochi: {\n label: 'Pochi',\n dir: '.pochi/skills',\n },\n Other: {\n label: 'Other',\n dir: 'skills',\n },\n} as const;\n\nexport type Platform = keyof typeof PLATFORMS_METADATA;\n\nexport const PLATFORMS = Object.keys(PLATFORMS_METADATA) as Platform[];\n\n/**\n * Maps specific skill keys to special filenames if they differ from standard snake_case.\n */\nconst SKILL_FILENAME_MAP: Partial<Record<Skill, string>> = {};\n\n/**\n * Helper to convert CamelCase to kebab-case for directory naming\n */\nconst camelToKebabCase = (str: string) =>\n str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\n/**\n * Reads the raw markdown content for a specific skill from the assets folder.\n */\nconst getSkillContent = (skill: Skill): string => {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill);\n const fileName = `./skills/${baseName}.md`;\n\n try {\n return readAsset(fileName);\n } catch {\n console.warn(\n `Warning: Could not read asset for skill: ${skill} at ${fileName}`\n );\n return '';\n }\n};\n\n/**\n * Reads the licence content from the assets folder.\n */\nconst getLicenceContent = (): string => {\n try {\n return readAsset('./LICENCE.md');\n } catch {\n console.warn('Warning: Could not read LICENCE.md asset');\n return '';\n }\n};\n\n/**\n * Fetches the content of a URL using native fetch.\n */\nconst fetchUrlContent = async (url: string): Promise<string> => {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to fetch ${url}: ${response.statusText}`);\n }\n return response.text();\n};\n\n/**\n * Installs skills using the \"Agent Skills\" directory standard.\n * Standard: <PROJECT_ROOT>/<CONFIG_DIR>/skills/<SKILL_NAME>/SKILL.md\n */\nexport const installSkills = async (\n projectRoot: string,\n platform: Platform,\n skills: Skill[]\n): Promise<string> => {\n // Determine destination directory\n const relativeDir = PLATFORMS_METADATA[platform].dir ?? 'skills';\n const skillsBaseDir = path.join(projectRoot, relativeDir);\n\n // Ensure the base directory exists\n await fs.mkdir(skillsBaseDir, { recursive: true });\n\n const createdSkills: string[] = [];\n const licenceContent = getLicenceContent();\n\n for (const skill of skills) {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill);\n const skillName = `intlayer-${baseName}`;\n const skillContent = getSkillContent(skill);\n\n if (!skillContent) continue;\n\n // Extract unique URLs\n const urls = Array.from(\n new Set(\n skillContent.match(/https:\\/\\/intlayer\\.org\\/doc\\/[^\\s)]+\\.md/g) || []\n )\n );\n\n // Agent Standard: .../skills/<skill-name>/SKILL.md\n const skillDir = path.join(skillsBaseDir, skillName);\n const referenceDir = path.join(skillDir, 'references');\n\n // Ensure directories exist\n await fs.mkdir(referenceDir, { recursive: true });\n\n // Write License\n if (licenceContent) {\n await fs.writeFile(\n path.join(skillDir, 'LICENCE.md'),\n licenceContent,\n 'utf-8'\n );\n }\n\n let updatedSkillContent = skillContent;\n\n // Parallel download of references\n const downloadPromises = urls.map(async (url) => {\n try {\n const content = await fetchUrlContent(url);\n const metadata = getMarkdownMetadata<{ slugs?: string[] }>(content);\n\n let fileName = '';\n\n // Determine filename from slugs or URL path\n if (Array.isArray(metadata.slugs)) {\n fileName = metadata.slugs.filter((slug) => slug !== 'doc').join('_');\n } else {\n const urlPath = new URL(url).pathname;\n fileName = urlPath\n .split('/')\n .filter((part) => part && part !== 'doc')\n .map((part) => part.replace('.md', '')) // Clean extension for joining\n .join('_');\n }\n\n // Ensure it ends with .md\n fileName = fileName ? `${fileName}.md` : 'index.md';\n const localRefPath = `references/${fileName}`;\n\n return {\n url,\n localRefPath,\n fileName,\n content,\n success: true,\n };\n } catch (error) {\n console.warn(\n `Warning: Failed to download ref ${url} for skill ${skill}`,\n error\n );\n return { url, success: false };\n }\n });\n\n const results = await Promise.all(downloadPromises);\n\n // Process results: Write files and update content string\n for (const res of results) {\n if (res.success && res.fileName && res.content && res.localRefPath) {\n // Write the reference file\n await fs.writeFile(\n path.join(referenceDir, res.fileName),\n res.content,\n 'utf-8'\n );\n\n // Update the main content to point to local file\n updatedSkillContent = updatedSkillContent.replaceAll(\n res.url,\n res.localRefPath\n );\n }\n }\n\n // Write the main SKILL.md\n const filePath = path.join(skillDir, 'SKILL.md');\n await fs.writeFile(filePath, updatedSkillContent, 'utf-8');\n createdSkills.push(`${skillName}/SKILL.md`);\n }\n\n if (createdSkills.length === 0) {\n return `No skill files were created. Check your asset paths.`;\n }\n\n return `${v} Created ${createdSkills.length} skills in ${skillsBaseDir}`;\n};\n"],"mappings":"+SASA,MAAa,EAAkB,CAC7B,OAAQ,uCACR,QAAS,+DACT,MAAO,sCACP,IAAK,kCACL,SACE,4FACF,cAAe,0DACf,OAAQ,sDACR,MAAO,wCACP,IAAK,sCACL,OAAQ,oCACR,QAAS,wDACT,OAAQ,yCACR,MACE,qMACF,MAAO,uCACR,CAIY,EAAS,OAAO,KAAK,EAAgB,CAErC,EACX,GACqC,CACrC,IAAM,EAA2C,CAC/C,QACA,UACA,SACA,MACA,WACD,CAUD,OARI,EAAK,MAAM,EAAO,KAAK,SAAS,EAChC,EAAK,OAAS,CAAC,EAAK,OAAM,EAAO,KAAK,QAAQ,CAC9C,EAAK,QAAQ,EAAO,KAAK,SAAS,CAClC,EAAK,aAAa,EAAO,KAAK,QAAQ,EACtC,EAAK,KAAO,EAAK,OAAM,EAAO,KAAK,MAAM,EACzC,EAAK,QAAU,EAAK,mBAAkB,EAAO,KAAK,SAAS,CAC3D,EAAK,OAAO,EAAO,KAAK,QAAQ,CAE7B,GAYI,EAAuD,CAClE,OAAQ,CACN,MAAO,SACP,IAAK,iBAC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pD,MAAMC,EAAAA,SAAG,UACPD,EAAAA,QAAK,KAAK,EAAc,EAAI,SAAS,CACrC,EAAI,QACJ,QACD,CAGD,EAAsB,EAAoB,WACxC,EAAI,IACJ,EAAI,aACL,EAKL,IAAM,EAAWA,EAAAA,QAAK,KAAK,EAAU,WAAW,CAChD,MAAMC,EAAAA,SAAG,UAAU,EAAU,EAAqB,QAAQ,CAC1D,EAAc,KAAK,GAAG,EAAU,WAAW,CAO7C,OAJI,EAAc,SAAW,EACpB,uDAGF,GAAGC,EAAAA,EAAE,WAAW,EAAc,OAAO,aAAa"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["readAsset","path","fs","v"],"sources":["../../../src/installSkills/index.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { v } from '@intlayer/config/logger';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\n\n/**\n * Metadata for each available documentation skill.\n */\nexport const SKILLS_METADATA = {\n Config: 'Intlayer configuration documentation',\n Content: 'Reference for all Intlayer content node types (t, enu, etc.)',\n Usage: 'How to use Intlayer in your project',\n CLI: 'Intlayer CLI commands and usage',\n Compiler:\n 'Intlayer Compiler setup and usage for automatic content extraction without .content files',\n RemoteContent: 'How to use Intlayer with Remote/CMS/Server-side content',\n NextJS: 'Next.js-specific usage (Server & Client components)',\n React: 'React-specific syntax and hooks usage',\n Vue: 'Vue-specific composables and syntax',\n Svelte: 'Svelte-specific stores and syntax',\n Angular: 'Angular-specific syntax and Injectable Function usage',\n Preact: 'Preact-specific syntax and hooks usage',\n Solid:\n 'Integrates Intlayer internationalization with SolidJS components. Use when the user asks to \"setup SolidJS i18n\", use the \"useIntlayer\" hook in Solid, or manage locales in a SolidJS application.',\n Astro: 'Astro-specific usage and getIntlayer',\n} as const;\n\nexport type Skill = keyof typeof SKILLS_METADATA;\n\nexport const SKILLS = Object.keys(SKILLS_METADATA) as Skill[];\n\nexport const getInitialSkills = (\n deps: Record<string, string>\n): (keyof typeof SKILLS_METADATA)[] => {\n const skills: (keyof typeof SKILLS_METADATA)[] = [\n 'Usage',\n 'Content',\n 'Config',\n 'CLI',\n 'Compiler',\n ];\n\n if (deps.next) skills.push('NextJS');\n if (deps.react || !deps.next) skills.push('React');\n if (deps.preact) skills.push('Preact');\n if (deps['solid-js']) skills.push('Solid');\n if (deps.vue || deps.nuxt) skills.push('Vue');\n if (deps.svelte || deps['@sveltejs/kit']) skills.push('Svelte');\n if (deps.astro) skills.push('Astro');\n\n return skills;\n};\n\nexport interface PlatformMetadata {\n label: string;\n dir: string;\n check?: () => boolean;\n}\n\n/**\n * Metadata and configuration for each supported platform.\n */\nexport const PLATFORMS_METADATA: Record<string, PlatformMetadata> = {\n Cursor: {\n label: 'Cursor',\n dir: '.cursor/skills',\n check: () =>\n process.env.CURSOR === 'true' || process.env.TERM_PROGRAM === 'cursor',\n },\n Windsurf: {\n label: 'Windsurf',\n dir: '.windsurf/skills',\n check: () =>\n process.env.WINDSURF === 'true' ||\n process.env.TERM_PROGRAM === 'windsurf',\n },\n Trae: {\n label: 'Trae',\n dir: '.trae/skills',\n check: () =>\n process.env.TRAE === 'true' || process.env.TERM_PROGRAM === 'trae',\n },\n TraeCN: {\n label: 'Trae CN',\n dir: '.trae/skills',\n check: () => process.env.TRAE_CN === 'true',\n },\n VSCode: {\n label: 'VS Code',\n dir: '.vscode/skills',\n check: () =>\n process.env.VSCODE === 'true' || process.env.TERM_PROGRAM === 'vscode',\n },\n OpenCode: {\n label: 'OpenCode',\n dir: '.opencode/skills',\n check: () => process.env.OPENCODE === 'true',\n },\n Claude: {\n label: 'Claude Code',\n dir: '.claude/skills',\n check: () => process.env.CLAUDE === 'true',\n },\n GitHub: {\n label: 'GitHub Copilot Workspace',\n dir: '.github/skills',\n check: () =>\n process.env.GITHUB_ACTIONS === 'true' || !!process.env.GITHUB_WORKSPACE,\n },\n Antigravity: {\n label: 'Antigravity',\n dir: '.agent/skills',\n },\n Augment: {\n label: 'Augment',\n dir: '.augment/skills',\n },\n OpenClaw: {\n label: 'OpenClaw',\n dir: 'skills',\n },\n Cline: {\n label: 'Cline',\n dir: '.cline/skills',\n },\n CodeBuddy: {\n label: 'CodeBuddy',\n dir: '.codebuddy/skills',\n },\n CommandCode: {\n label: 'Command Code',\n dir: '.commandcode/skills',\n },\n Continue: {\n label: 'Continue',\n dir: '.continue/skills',\n },\n Crush: {\n label: 'Crush',\n dir: '.crush/skills',\n },\n Droid: {\n label: 'Droid',\n dir: '.factory/skills',\n },\n Goose: {\n label: 'Goose',\n dir: '.goose/skills',\n },\n IFlow: {\n label: 'iFlow CLI',\n dir: '.iflow/skills',\n },\n Junie: {\n label: 'Junie',\n dir: '.junie/skills',\n },\n KiloCode: {\n label: 'Kilo Code',\n dir: '.kilocode/skills',\n },\n Kiro: {\n label: 'Kiro CLI',\n dir: '.kiro/skills',\n },\n Kode: {\n label: 'Kode',\n dir: '.kode/skills',\n },\n MCPJam: {\n label: 'MCPJam',\n dir: '.mcpjam/skills',\n },\n MistralVibe: {\n label: 'Mistral Vibe',\n dir: '.vibe/skills',\n },\n Mux: {\n label: 'Mux',\n dir: '.mux/skills',\n },\n OpenHands: {\n label: 'OpenHands',\n dir: '.openhands/skills',\n },\n Pi: {\n label: 'Pi',\n dir: '.pi/skills',\n },\n Qoder: {\n label: 'Qoder',\n dir: '.qoder/skills',\n },\n Qwen: {\n label: 'Qwen Code',\n dir: '.qwen/skills',\n },\n RooCode: {\n label: 'Roo Code',\n dir: '.roo/skills',\n },\n Zencoder: {\n label: 'Zencoder',\n dir: '.zencoder/skills',\n },\n Neovate: {\n label: 'Neovate',\n dir: '.neovate/skills',\n },\n Pochi: {\n label: 'Pochi',\n dir: '.pochi/skills',\n },\n Other: {\n label: 'Other',\n dir: 'skills',\n },\n} as const;\n\nexport type Platform = keyof typeof PLATFORMS_METADATA;\n\nexport const PLATFORMS = Object.keys(PLATFORMS_METADATA) as Platform[];\n\n/**\n * Maps specific skill keys to special filenames if they differ from standard snake_case.\n */\nconst SKILL_FILENAME_MAP: Partial<Record<Skill, string>> = {};\n\n/**\n * Helper to convert CamelCase to kebab-case for directory naming\n */\nconst camelToKebabCase = (str: string) =>\n str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\n/**\n * Reads the raw markdown content for a specific skill from the assets folder.\n */\nconst getSkillContent = (skill: Skill): string => {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill);\n const fileName = `./skills/${baseName}.md`;\n\n try {\n return readAsset(fileName);\n } catch {\n console.warn(\n `Warning: Could not read asset for skill: ${skill} at ${fileName}`\n );\n return '';\n }\n};\n\n/**\n * Reads the licence content from the assets folder.\n */\nconst getLicenceContent = (): string => {\n try {\n return readAsset('./LICENCE.md');\n } catch {\n console.warn('Warning: Could not read LICENCE.md asset');\n return '';\n }\n};\n\n/**\n * Fetches the content of a URL using native fetch.\n */\nconst fetchUrlContent = async (url: string): Promise<string> => {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to fetch ${url}: ${response.statusText}`);\n }\n return response.text();\n};\n\n/**\n * Installs skills using the \"Agent Skills\" directory standard.\n * Standard: <PROJECT_ROOT>/<CONFIG_DIR>/skills/<SKILL_NAME>/SKILL.md\n */\nexport const installSkills = async (\n projectRoot: string,\n platform: Platform,\n skills: Skill[]\n): Promise<string> => {\n // Determine destination directory\n const relativeDir = PLATFORMS_METADATA[platform].dir ?? 'skills';\n const skillsBaseDir = path.join(projectRoot, relativeDir);\n\n // Ensure the base directory exists\n await fs.mkdir(skillsBaseDir, { recursive: true });\n\n const createdSkills: string[] = [];\n const licenceContent = getLicenceContent();\n\n for (const skill of skills) {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill);\n const skillName = `intlayer-${baseName}`;\n const skillContent = getSkillContent(skill);\n\n if (!skillContent) continue;\n\n // Extract unique URLs\n const urls = Array.from(\n new Set(\n skillContent.match(/https:\\/\\/intlayer\\.org\\/doc\\/[^\\s)]+\\.md/g) || []\n )\n );\n\n // Agent Standard: .../skills/<skill-name>/SKILL.md\n const skillDir = path.join(skillsBaseDir, skillName);\n const referenceDir = path.join(skillDir, 'references');\n\n // Ensure directories exist\n await fs.mkdir(referenceDir, { recursive: true });\n\n // Write License\n if (licenceContent) {\n await fs.writeFile(\n path.join(skillDir, 'LICENCE.md'),\n licenceContent,\n 'utf-8'\n );\n }\n\n let updatedSkillContent = skillContent;\n\n // Parallel download of references\n const downloadPromises = urls.map(async (url) => {\n try {\n const content = await fetchUrlContent(url);\n const metadata = getMarkdownMetadata<{ slugs?: string[] }>(content);\n\n let fileName = '';\n\n // Determine filename from slugs or URL path\n if (Array.isArray(metadata.slugs)) {\n fileName = metadata.slugs.filter((slug) => slug !== 'doc').join('_');\n } else {\n const urlPath = new URL(url).pathname;\n fileName = urlPath\n .split('/')\n .filter((part) => part && part !== 'doc')\n .map((part) => part.replace('.md', '')) // Clean extension for joining\n .join('_');\n }\n\n // Ensure it ends with .md\n fileName = fileName ? `${fileName}.md` : 'index.md';\n const localRefPath = `references/${fileName}`;\n\n return {\n url,\n localRefPath,\n fileName,\n content,\n success: true,\n };\n } catch (error) {\n console.warn(\n `Warning: Failed to download ref ${url} for skill ${skill}`,\n error\n );\n return { url, success: false };\n }\n });\n\n const results = await Promise.all(downloadPromises);\n\n // Process results: Write files and update content string\n for (const res of results) {\n if (res.success && res.fileName && res.content && res.localRefPath) {\n // Write the reference file\n await fs.writeFile(\n path.join(referenceDir, res.fileName),\n res.content,\n 'utf-8'\n );\n\n // Update the main content to point to local file\n updatedSkillContent = updatedSkillContent.replaceAll(\n res.url,\n res.localRefPath\n );\n }\n }\n\n // Write the main SKILL.md\n const filePath = path.join(skillDir, 'SKILL.md');\n await fs.writeFile(filePath, updatedSkillContent, 'utf-8');\n createdSkills.push(`${skillName}/SKILL.md`);\n }\n\n if (createdSkills.length === 0) {\n return `No skill files were created. Check your asset paths.`;\n }\n\n return `${v} Created ${createdSkills.length} skills in ${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IAAI,SAAW,OACrC,CACD,OAAQ,CACN,MAAO,2BACP,IAAK,iBACL,UACE,QAAQ,IAAI,iBAAmB,QAAU,CAAC,CAAC,QAAQ,IAAI,iBAC1D,CACD,YAAa,CACX,MAAO,cACP,IAAK,gBACN,CACD,QAAS,CACP,MAAO,UACP,IAAK,kBACN,CACD,SAAU,CACR,MAAO,WACP,IAAK,SACN,CACD,MAAO,CACL,MAAO,QACP,IAAK,gBACN,CACD,UAAW,CACT,MAAO,YACP,IAAK,oBACN,CACD,YAAa,CACX,MAAO,eACP,IAAK,sBACN,CACD,SAAU,CACR,MAAO,WACP,IAAK,mBACN,CACD,MAAO,CACL,MAAO,QACP,IAAK,gBACN,CACD,MAAO,CACL,MAAO,QACP,IAAK,kBACN,CACD,MAAO,CACL,MAAO,QACP,IAAK,gBACN,CACD,MAAO,CACL,MAAO,YACP,IAAK,gBACN,CACD,MAAO,CACL,MAAO,QACP,IAAK,gBACN,CACD,SAAU,CACR,MAAO,YACP,IAAK,mBACN,CACD,KAAM,CACJ,MAAO,WACP,IAAK,eACN,CACD,KAAM,CACJ,MAAO,OACP,IAAK,eACN,CACD,OAAQ,CACN,MAAO,SACP,IAAK,iBACN,CACD,YAAa,CACX,MAAO,eACP,IAAK,eACN,CACD,IAAK,CACH,MAAO,MACP,IAAK,cACN,CACD,UAAW,CACT,MAAO,YACP,IAAK,oBACN,CACD,GAAI,CACF,MAAO,KACP,IAAK,aACN,CACD,MAAO,CACL,MAAO,QACP,IAAK,gBACN,CACD,KAAM,CACJ,MAAO,YACP,IAAK,eACN,CACD,QAAS,CACP,MAAO,WACP,IAAK,cACN,CACD,SAAU,CACR,MAAO,WACP,IAAK,mBACN,CACD,QAAS,CACP,MAAO,UACP,IAAK,kBACN,CACD,MAAO,CACL,MAAO,QACP,IAAK,gBACN,CACD,MAAO,CACL,MAAO,QACP,IAAK,SACN,CACF,CAIY,EAAY,OAAO,KAAK,EAAmB,CAKlD,EAAqD,EAAE,CAKvD,EAAoB,GAC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KAAO,IAAQ,CAC/C,GAAI,CACF,IAAM,EAAU,MAAM,EAAgB,EAAI,CACpC,GAAA,EAAA,EAAA,qBAAqD,EAAQ,CAE/D,EAAW,GAkBf,MAfA,CAIE,EAJE,MAAM,QAAQ,EAAS,MAAM,CACpB,EAAS,MAAM,OAAQ,GAAS,IAAS,MAAM,CAAC,KAAK,IAAI,CAEpD,IAAI,IAAI,EAAI,CAAC,SAE1B,MAAM,IAAI,CACV,OAAQ,GAAS,GAAQ,IAAS,MAAM,CACxC,IAAK,GAAS,EAAK,QAAQ,MAAO,GAAG,CAAC,CACtC,KAAK,IAAI,CAId,EAAW,EAAW,GAAG,EAAS,KAAO,WAGlC,CACL,MACA,aAJmB,cAAc,IAKjC,WACA,UACA,QAAS,GACV,OACM,EAAO,CAKd,OAJA,QAAQ,KACN,mCAAmC,EAAI,aAAa,IACpD,EACD,CACM,CAAE,MAAK,QAAS,GAAO,GAEhC,CAEI,EAAU,MAAM,QAAQ,IAAI,EAAiB,CAGnD,IAAK,IAAM,KAAO,EACZ,EAAI,SAAW,EAAI,UAAY,EAAI,SAAW,EAAI,eAEpD,MAAMC,EAAAA,SAAG,UACPD,EAAAA,QAAK,KAAK,EAAc,EAAI,SAAS,CACrC,EAAI,QACJ,QACD,CAGD,EAAsB,EAAoB,WACxC,EAAI,IACJ,EAAI,aACL,EAKL,IAAM,EAAWA,EAAAA,QAAK,KAAK,EAAU,WAAW,CAChD,MAAMC,EAAAA,SAAG,UAAU,EAAU,EAAqB,QAAQ,CAC1D,EAAc,KAAK,GAAG,EAAU,WAAW,CAO7C,OAJI,EAAc,SAAW,EACpB,uDAGF,GAAGC,EAAAA,EAAE,WAAW,EAAc,OAAO,aAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`node:fs/promises`),n=require(`fast-glob`);n=e.t(n);let r=require(`@intlayer/config/utils`);const i=async e=>{let{fileExtensions:t,contentDir:i,excludedPath:a}=e.content,o=t.flatMap(e=>i.map(t=>`${(0,r.normalizePath)(t)}/**/*${e}`.replace(`//`,`/`))).map(async e=>{let t=e.search(/[*?{}(]/),r=t>-1?e.slice(0,t):e;return(0,n.default)(e,{ignore:a.filter(e=>{let t=e.replace(/\*\*/g,``).replace(/\//g,``);return!(t&&r.includes(`/${t}/`))}),absolute:!0,dot:!0})}),s=await Promise.all(o);return Array.from(new Set(s.flat()))},a=async e=>{let n=await i(e);return Promise.all(n.map(async e=>({path:e,stats:await(0,t.stat)(e)})))};exports.listDictionaries=i,exports.listDictionariesWithStats=a;
|
|
2
2
|
//# sourceMappingURL=listDictionariesPath.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listDictionariesPath.cjs","names":[],"sources":["../../src/listDictionariesPath.ts"],"sourcesContent":["import { stat } from 'node:fs/promises';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport fg from 'fast-glob';\n\n/**\n * List all dictionaries absolute paths in the project\n * @param configuration - The configuration object\n * @returns An array of dictionary paths\n */\nexport const listDictionaries = async (\n configuration: IntlayerConfig\n): Promise<string[]> => {\n const {
|
|
1
|
+
{"version":3,"file":"listDictionariesPath.cjs","names":[],"sources":["../../src/listDictionariesPath.ts"],"sourcesContent":["import { stat } from 'node:fs/promises';\nimport { normalizePath } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport fg from 'fast-glob';\n\n/**\n * List all dictionaries absolute paths in the project\n * @param configuration - The configuration object\n * @returns An array of dictionary paths\n */\nexport const listDictionaries = async (\n configuration: IntlayerConfig\n): Promise<string[]> => {\n const { fileExtensions, contentDir, excludedPath } = configuration.content;\n\n const watchedFilesPatternWithPath = fileExtensions.flatMap((ext) =>\n contentDir.map((dir) =>\n `${normalizePath(dir)}/**/*${ext}`.replace('//', '/')\n )\n );\n\n const filePromises = watchedFilesPatternWithPath.map(async (pattern) => {\n // Identify the static part of the path (before any wildcards like *)\n // e.g. \"/Users/.../design-system/dist/esm/**/*.content.ts\" -> \"/Users/.../design-system/dist/esm/\"\n const magicIndex = pattern.search(/[*?{}(]/);\n const basePattern =\n magicIndex > -1 ? pattern.slice(0, magicIndex) : pattern;\n\n // Filter the global ignored list for this specific pattern\n const applicableIgnore = excludedPath.filter((excludePattern) => {\n // Heuristic: Extract the key directory name from the glob\n // e.g. \"**/dist/**\" -> \"dist\", \"**/node_modules/**\" -> \"node_modules\"\n const cleanName = excludePattern.replace(/\\*\\*/g, '').replace(/\\//g, '');\n\n // If the explicit base path contains the excluded directory (e.g. \".../dist/...\"),\n // we assume you explicitly want it, so we REMOVE it from the ignore list.\n // We check for `/${cleanName}/` to ensure we match whole folder names.\n if (cleanName && basePattern.includes(`/${cleanName}/`)) {\n return false; // Drop this exclude rule\n }\n\n return true; // Keep this exclude rule\n });\n\n // Run fast-glob with the customized ignore list\n return fg(pattern, {\n ignore: applicableIgnore,\n absolute: true,\n dot: true,\n });\n });\n\n const filesArrays = await Promise.all(filePromises);\n\n // Flatten and deduplicate\n const uniqueFiles = Array.from(new Set(filesArrays.flat()));\n\n return uniqueFiles;\n};\n\nexport const listDictionariesWithStats = async (\n configuration: IntlayerConfig\n) => {\n const files = await listDictionaries(configuration);\n\n return Promise.all(\n files.map(async (file) => ({ path: file, stats: await stat(file) }))\n );\n};\n"],"mappings":"qNAUA,MAAa,EAAmB,KAC9B,IACsB,CACtB,GAAM,CAAE,iBAAgB,aAAY,gBAAiB,EAAc,QAQ7D,EAN8B,EAAe,QAAS,GAC1D,EAAW,IAAK,GACd,IAAA,EAAA,EAAA,eAAiB,EAAI,CAAC,OAAO,IAAM,QAAQ,KAAM,IAAI,CACtD,CACF,CAEgD,IAAI,KAAO,IAAY,CAGtE,IAAM,EAAa,EAAQ,OAAO,UAAU,CACtC,EACJ,EAAa,GAAK,EAAQ,MAAM,EAAG,EAAW,CAAG,EAmBnD,OAAA,EAAA,EAAA,SAAU,EAAS,CACjB,OAjBuB,EAAa,OAAQ,GAAmB,CAG/D,IAAM,EAAY,EAAe,QAAQ,QAAS,GAAG,CAAC,QAAQ,MAAO,GAAG,CASxE,MAJA,EAAI,GAAa,EAAY,SAAS,IAAI,EAAU,GAAG,GAKvD,CAKA,SAAU,GACV,IAAK,GACN,CAAC,EACF,CAEI,EAAc,MAAM,QAAQ,IAAI,EAAa,CAKnD,OAFoB,MAAM,KAAK,IAAI,IAAI,EAAY,MAAM,CAAC,CAAC,EAKhD,EAA4B,KACvC,IACG,CACH,IAAM,EAAQ,MAAM,EAAiB,EAAc,CAEnD,OAAO,QAAQ,IACb,EAAM,IAAI,KAAO,KAAU,CAAE,KAAM,EAAM,MAAO,MAAA,EAAA,EAAA,MAAW,EAAK,CAAE,EAAE,CACrE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`node:path`),n=require(`@intlayer/config/logger`),r=require(`node:fs`),i=require(`simple-git`);i=e.t(i);let a=require(`@intlayer/config/built`);a=e.t(a);const o=async()=>{try{return(await(0,i.default)().revparse([`--show-toplevel`])).trim()}catch(e){return(0,n.getAppLogger)(a.default)(`Error getting git root directory: ${e}`,{level:`error`}),null}},s=async({mode:e,baseRef:n=`origin/main`,currentRef:r=`HEAD`,absolute:a=!0})=>{try{let s=(0,i.default)(),c=new Set;if(e.includes(`untracked`)&&(await s.status()).not_added.forEach(e=>{c.add(e)}),e.includes(`uncommitted`)&&(await s.diff([`--name-only`,`HEAD`])).split(`
|
|
2
2
|
`).filter(Boolean).forEach(e=>{c.add(e)}),e.includes(`unpushed`)&&(await s.diff([`--name-only`,`@{push}...HEAD`])).split(`
|
|
3
3
|
`).filter(Boolean).forEach(e=>{c.add(e)}),e.includes(`gitDiff`)&&(await s.fetch(n),(await s.diff([`--name-only`,`${n}...${r}`])).split(`
|
|
4
4
|
`).filter(Boolean).forEach(e=>{c.add(e)})),a){let e=await o();return e?Array.from(c).map(n=>(0,t.join)(e,n)):[]}return Array.from(c)}catch(e){console.warn(`Failed to get changes list:`,e)}},c=async(e,{mode:t,baseRef:n=`origin/main`,currentRef:a=`HEAD`})=>{let o=(0,i.default)(),s=new Set,c=e=>{let t=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/g,n;for(;(n=t.exec(e))!==null;){let e=n[2]?Number(n[2]):1,t=Number(n[3]),r=n[4]?Number(n[4]):1;if(r>0)for(let e=0;e<r;e++)s.add(t+e);e>0&&r===0&&(t>1&&s.add(t-1),s.add(t))}};if(t.includes(`untracked`)&&(await o.status()).not_added.includes(e))try{(0,r.readFileSync)(e,`utf-8`).split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listGitFiles.cjs","names":["configuration"],"sources":["../../src/listGitFiles.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport configuration from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport simpleGit from 'simple-git';\n\nexport type DiffMode = 'gitDiff' | 'uncommitted' | 'unpushed' | 'untracked';\n\nconst getGitRootDir = async (): Promise<string | null> => {\n try {\n const git = simpleGit();\n const rootDir = await git.revparse(['--show-toplevel']);\n return rootDir.trim();\n } catch (error) {\n const appLogger = getAppLogger(configuration);\n appLogger(`Error getting git root directory: ${error}`, {\n level: 'error',\n });\n return null;\n }\n};\n\nexport type ListGitFilesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n absolute?: boolean;\n};\n\nexport const listGitFiles = async ({\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n absolute = true,\n}: ListGitFilesOptions) => {\n try {\n const git = simpleGit();\n const diff: Set<string> = new Set();\n\n if (mode.includes('untracked')) {\n const status = await git.status();\n status.not_added.forEach((file) => {\n diff.add(file);\n });\n }\n\n if (mode.includes('uncommitted')) {\n // Get uncommitted changes\n const uncommittedDiff = await git.diff(['--name-only', 'HEAD']);\n\n const uncommittedFiles = uncommittedDiff.split('\\n').filter(Boolean);\n\n uncommittedFiles.forEach((file) => {\n diff.add(file);\n });\n }\n\n if (mode.includes('unpushed')) {\n // Get unpushed commits\n const unpushedDiff = await git.diff(['--name-only', '@{push}...HEAD']);\n\n const unpushedFiles = unpushedDiff.split('\\n').filter(Boolean);\n\n unpushedFiles.forEach((file) => {\n diff.add(file);\n });\n }\n\n if (mode.includes('gitDiff')) {\n // Get the base branch (usually main/master) from CI environment\n\n await git.fetch(baseRef);\n\n const diffBranch = await git.diff([\n '--name-only',\n `${baseRef}...${currentRef}`,\n ]);\n\n const gitDiffFiles = diffBranch.split('\\n').filter(Boolean);\n\n gitDiffFiles.forEach((file) => {\n diff.add(file);\n });\n }\n\n if (absolute) {\n const gitRootDir = await getGitRootDir();\n if (!gitRootDir) {\n return [];\n }\n return Array.from(diff).map((file) => join(gitRootDir, file));\n }\n\n return Array.from(diff);\n } catch (error) {\n console.warn('Failed to get changes list:', error);\n }\n};\n\nexport type ListGitLinesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n};\n\nexport const listGitLines = async (\n filePath: string,\n {\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n }: ListGitLinesOptions\n): Promise<number[]> => {\n const git = simpleGit();\n // We collect **line numbers** (1-based) that were modified/added by the diff.\n // Using a Set ensures uniqueness when the same line is reported by several modes.\n const changedLines: Set<number> = new Set();\n\n /**\n * Extracts line numbers from a diff generated with `--unified=0`.\n * Each hunk header looks like: @@ -<oldStart>,<oldCount> +<newStart>,<newCount> @@\n * We consider both the \"+\" (new) side for additions and the \"-\" (old) side for deletions.\n * For deletions, we add the line before and after the deletion point in the current file.\n */\n const collectLinesFromDiff = (diffOutput: string) => {\n const hunkRegex = /@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/g;\n let match: RegExpExecArray | null;\n\n // biome-ignore lint/suspicious/noAssignInExpressions: Used in while loop condition\n while ((match = hunkRegex.exec(diffOutput)) !== null) {\n const oldCount = match[2] ? Number(match[2]) : 1;\n const newStart = Number(match[3]);\n const newCount = match[4] ? Number(match[4]) : 1;\n\n // Handle additions/modifications (+ side)\n if (newCount > 0) {\n for (let i = 0; i < newCount; i++) {\n changedLines.add(newStart + i);\n }\n }\n\n // Handle deletions (- side)\n if (oldCount > 0 && newCount === 0) {\n // For deletions, add the line before and after the deletion point\n // The deletion point in the new file is at newStart\n if (newStart > 1) {\n changedLines.add(newStart - 1); // Line before deletion\n }\n changedLines.add(newStart); // Line after deletion (if it exists)\n }\n }\n };\n\n // 1. Handle untracked files – when a file is untracked its entire content is new.\n if (mode.includes('untracked')) {\n const status = await git.status();\n const isUntracked = status.not_added.includes(filePath);\n if (isUntracked) {\n try {\n const content = readFileSync(filePath, 'utf-8');\n content.split('\\n').forEach((_, idx) => {\n changedLines.add(idx + 1);\n });\n } catch {\n // ignore read errors – file may have been deleted, etc.\n }\n }\n }\n\n // 2. Uncommitted changes (working tree vs HEAD)\n if (mode.includes('uncommitted')) {\n const diffOutput = await git.diff(['--unified=0', 'HEAD', '--', filePath]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 3. Unpushed commits – compare local branch to its upstream\n if (mode.includes('unpushed')) {\n const diffOutput = await git.diff([\n '--unified=0',\n '@{push}...HEAD',\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 4. Regular git diff between baseRef and currentRef (e.g., CI pull-request diff)\n if (mode.includes('gitDiff')) {\n await git.fetch(baseRef);\n const diffOutput = await git.diff([\n '--unified=0',\n `${baseRef}...${currentRef}`,\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // Return the list sorted for convenience\n return Array.from(changedLines).sort((a, b) => a - b);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"listGitFiles.cjs","names":["configuration"],"sources":["../../src/listGitFiles.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport configuration from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport simpleGit from 'simple-git';\n\nexport type DiffMode = 'gitDiff' | 'uncommitted' | 'unpushed' | 'untracked';\n\nconst getGitRootDir = async (): Promise<string | null> => {\n try {\n const git = simpleGit();\n const rootDir = await git.revparse(['--show-toplevel']);\n return rootDir.trim();\n } catch (error) {\n const appLogger = getAppLogger(configuration);\n appLogger(`Error getting git root directory: ${error}`, {\n level: 'error',\n });\n return null;\n }\n};\n\nexport type ListGitFilesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n absolute?: boolean;\n};\n\nexport const listGitFiles = async ({\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n absolute = true,\n}: ListGitFilesOptions) => {\n try {\n const git = simpleGit();\n const diff: Set<string> = new Set();\n\n if (mode.includes('untracked')) {\n const status = await git.status();\n status.not_added.forEach((file) => {\n diff.add(file);\n });\n }\n\n if (mode.includes('uncommitted')) {\n // Get uncommitted changes\n const uncommittedDiff = await git.diff(['--name-only', 'HEAD']);\n\n const uncommittedFiles = uncommittedDiff.split('\\n').filter(Boolean);\n\n uncommittedFiles.forEach((file) => {\n diff.add(file);\n });\n }\n\n if (mode.includes('unpushed')) {\n // Get unpushed commits\n const unpushedDiff = await git.diff(['--name-only', '@{push}...HEAD']);\n\n const unpushedFiles = unpushedDiff.split('\\n').filter(Boolean);\n\n unpushedFiles.forEach((file) => {\n diff.add(file);\n });\n }\n\n if (mode.includes('gitDiff')) {\n // Get the base branch (usually main/master) from CI environment\n\n await git.fetch(baseRef);\n\n const diffBranch = await git.diff([\n '--name-only',\n `${baseRef}...${currentRef}`,\n ]);\n\n const gitDiffFiles = diffBranch.split('\\n').filter(Boolean);\n\n gitDiffFiles.forEach((file) => {\n diff.add(file);\n });\n }\n\n if (absolute) {\n const gitRootDir = await getGitRootDir();\n if (!gitRootDir) {\n return [];\n }\n return Array.from(diff).map((file) => join(gitRootDir, file));\n }\n\n return Array.from(diff);\n } catch (error) {\n console.warn('Failed to get changes list:', error);\n }\n};\n\nexport type ListGitLinesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n};\n\nexport const listGitLines = async (\n filePath: string,\n {\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n }: ListGitLinesOptions\n): Promise<number[]> => {\n const git = simpleGit();\n // We collect **line numbers** (1-based) that were modified/added by the diff.\n // Using a Set ensures uniqueness when the same line is reported by several modes.\n const changedLines: Set<number> = new Set();\n\n /**\n * Extracts line numbers from a diff generated with `--unified=0`.\n * Each hunk header looks like: @@ -<oldStart>,<oldCount> +<newStart>,<newCount> @@\n * We consider both the \"+\" (new) side for additions and the \"-\" (old) side for deletions.\n * For deletions, we add the line before and after the deletion point in the current file.\n */\n const collectLinesFromDiff = (diffOutput: string) => {\n const hunkRegex = /@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/g;\n let match: RegExpExecArray | null;\n\n // biome-ignore lint/suspicious/noAssignInExpressions: Used in while loop condition\n while ((match = hunkRegex.exec(diffOutput)) !== null) {\n const oldCount = match[2] ? Number(match[2]) : 1;\n const newStart = Number(match[3]);\n const newCount = match[4] ? Number(match[4]) : 1;\n\n // Handle additions/modifications (+ side)\n if (newCount > 0) {\n for (let i = 0; i < newCount; i++) {\n changedLines.add(newStart + i);\n }\n }\n\n // Handle deletions (- side)\n if (oldCount > 0 && newCount === 0) {\n // For deletions, add the line before and after the deletion point\n // The deletion point in the new file is at newStart\n if (newStart > 1) {\n changedLines.add(newStart - 1); // Line before deletion\n }\n changedLines.add(newStart); // Line after deletion (if it exists)\n }\n }\n };\n\n // 1. Handle untracked files – when a file is untracked its entire content is new.\n if (mode.includes('untracked')) {\n const status = await git.status();\n const isUntracked = status.not_added.includes(filePath);\n if (isUntracked) {\n try {\n const content = readFileSync(filePath, 'utf-8');\n content.split('\\n').forEach((_, idx) => {\n changedLines.add(idx + 1);\n });\n } catch {\n // ignore read errors – file may have been deleted, etc.\n }\n }\n }\n\n // 2. Uncommitted changes (working tree vs HEAD)\n if (mode.includes('uncommitted')) {\n const diffOutput = await git.diff(['--unified=0', 'HEAD', '--', filePath]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 3. Unpushed commits – compare local branch to its upstream\n if (mode.includes('unpushed')) {\n const diffOutput = await git.diff([\n '--unified=0',\n '@{push}...HEAD',\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 4. Regular git diff between baseRef and currentRef (e.g., CI pull-request diff)\n if (mode.includes('gitDiff')) {\n await git.fetch(baseRef);\n const diffOutput = await git.diff([\n '--unified=0',\n `${baseRef}...${currentRef}`,\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // Return the list sorted for convenience\n return Array.from(changedLines).sort((a, b) => a - b);\n};\n"],"mappings":"kRAQA,MAAM,EAAgB,SAAoC,CACxD,GAAI,CAGF,OADgB,MAAA,EAAA,EAAA,UADO,CACG,SAAS,CAAC,kBAAkB,CAAC,EACxC,MAAM,OACd,EAAO,CAKd,OAHA,EAAA,EAAA,cAD+BA,EAAAA,QAAc,CACnC,qCAAqC,IAAS,CACtD,MAAO,QACR,CAAC,CACK,OAWE,EAAe,MAAO,CACjC,OACA,UAAU,cACV,aAAa,OACb,WAAW,MACc,CACzB,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,UAAiB,CACjB,EAAoB,IAAI,IAgD9B,GA9CI,EAAK,SAAS,YAAY,GACb,MAAM,EAAI,QAAQ,EAC1B,UAAU,QAAS,GAAS,CACjC,EAAK,IAAI,EAAK,EACd,CAGA,EAAK,SAAS,cAAc,GAEN,MA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,EAAa,IAAI,EAAS,IAMhC,GAAI,EAAK,SAAS,YAAY,GACb,MAAM,EAAI,QAAQ,EACN,UAAU,SAAS,EAAS,CAErD,GAAI,EAEF,EAAA,EAAA,cAD6B,EAAU,QAAQ,CACvC,MAAM;EAAK,CAAC,SAAS,EAAG,IAAQ,CACtC,EAAa,IAAI,EAAM,EAAE,EACzB,MACI,EAoCZ,OA7BI,EAAK,SAAS,cAAc,EAE9B,EADmB,MAAM,EAAI,KAAK,CAAC,cAAe,OAAQ,KAAM,EAAS,CAAC,CAC1C,CAI9B,EAAK,SAAS,WAAW,EAO3B,EANmB,MAAM,EAAI,KAAK,CAChC,cACA,iBACA,KACA,EACD,CAAC,CAC8B,CAI9B,EAAK,SAAS,UAAU,GAC1B,MAAM,EAAI,MAAM,EAAQ,CAOxB,EANmB,MAAM,EAAI,KAAK,CAChC,cACA,GAAG,EAAQ,KAAK,IAChB,KACA,EACD,CAAC,CAC8B,EAI3B,MAAM,KAAK,EAAa,CAAC,MAAM,EAAG,IAAM,EAAI,EAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`node:path`),n=require(`fast-glob`);n=e.t(n);let r=require(`@intlayer/config/node`),i=require(`simple-git`);i=e.t(i);const a=async e=>{try{return(await(e?(0,i.default)(e):(0,i.default)()).revparse([`--show-toplevel`])).trim()}catch{return null}},o=async e=>{let i=e?.baseDir??process.cwd();if(e?.gitRoot){let e=await a(i);e&&(i=e)}let o=await(0,n.default)(r.configurationFilesCandidates.map(e=>`**/${e}`),{cwd:i,absolute:!0,ignore:[`**/node_modules/**`,`**/.git/**`],dot:!0}),s=[...new Set(o.map(e=>(0,t.dirname)(e)))];return{searchDir:i,projectsPath:s.sort()}};exports.listProjects=o;
|
|
2
2
|
//# sourceMappingURL=listProjects.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listProjects.cjs","names":["configurationFilesCandidates"],"sources":["../../src/listProjects.ts"],"sourcesContent":["import { dirname } from 'node:path';\nimport { configurationFilesCandidates } from '@intlayer/config/node';\nimport fg from 'fast-glob';\nimport simpleGit from 'simple-git';\n\nexport type ListProjectsOptions = {\n /**\n * Base directory to search from\n * @default process.cwd()\n */\n baseDir?: string;\n /**\n * If true, search from the git root directory instead of baseDir\n * @default false\n */\n gitRoot?: boolean;\n};\n\n/**\n * Get the git root directory\n */\nconst getGitRootDir = async (cwd?: string): Promise<string | null> => {\n try {\n const git = cwd ? simpleGit(cwd) : simpleGit();\n const rootDir = await git.revparse(['--show-toplevel']);\n return rootDir.trim();\n } catch (_error) {\n return null;\n }\n};\n\n/**\n * List all Intlayer projects by searching for configuration files\n *\n * @param options - Options for listing projects\n * @returns Array of absolute paths to project directories containing Intlayer config\n */\nexport const listProjects = async (\n options?: ListProjectsOptions\n): Promise<{ searchDir: string; projectsPath: string[] }> => {\n let searchDir = options?.baseDir ?? process.cwd();\n\n // If gitRoot option is enabled, try to get the git root directory\n if (options?.gitRoot) {\n const gitRootDir = await getGitRootDir(searchDir);\n if (gitRootDir) {\n searchDir = gitRootDir;\n }\n }\n\n // Build glob patterns for all config file candidates\n const configPatterns = configurationFilesCandidates.map(\n (fileName) => `**/${fileName}`\n );\n\n // Search for all config files\n const configFiles = await fg(configPatterns, {\n cwd: searchDir,\n absolute: true,\n ignore: ['**/node_modules/**', '**/.git/**'],\n dot: true, // Include dot files like .intlayerrc\n });\n\n // Extract unique directory paths from config files\n const projectDirs = [...new Set(configFiles.map((file) => dirname(file)))];\n\n // Sort alphabetically for consistent output\n return { searchDir, projectsPath: projectDirs.sort() };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"listProjects.cjs","names":["configurationFilesCandidates"],"sources":["../../src/listProjects.ts"],"sourcesContent":["import { dirname } from 'node:path';\nimport { configurationFilesCandidates } from '@intlayer/config/node';\nimport fg from 'fast-glob';\nimport simpleGit from 'simple-git';\n\nexport type ListProjectsOptions = {\n /**\n * Base directory to search from\n * @default process.cwd()\n */\n baseDir?: string;\n /**\n * If true, search from the git root directory instead of baseDir\n * @default false\n */\n gitRoot?: boolean;\n};\n\n/**\n * Get the git root directory\n */\nconst getGitRootDir = async (cwd?: string): Promise<string | null> => {\n try {\n const git = cwd ? simpleGit(cwd) : simpleGit();\n const rootDir = await git.revparse(['--show-toplevel']);\n return rootDir.trim();\n } catch (_error) {\n return null;\n }\n};\n\n/**\n * List all Intlayer projects by searching for configuration files\n *\n * @param options - Options for listing projects\n * @returns Array of absolute paths to project directories containing Intlayer config\n */\nexport const listProjects = async (\n options?: ListProjectsOptions\n): Promise<{ searchDir: string; projectsPath: string[] }> => {\n let searchDir = options?.baseDir ?? process.cwd();\n\n // If gitRoot option is enabled, try to get the git root directory\n if (options?.gitRoot) {\n const gitRootDir = await getGitRootDir(searchDir);\n if (gitRootDir) {\n searchDir = gitRootDir;\n }\n }\n\n // Build glob patterns for all config file candidates\n const configPatterns = configurationFilesCandidates.map(\n (fileName) => `**/${fileName}`\n );\n\n // Search for all config files\n const configFiles = await fg(configPatterns, {\n cwd: searchDir,\n absolute: true,\n ignore: ['**/node_modules/**', '**/.git/**'],\n dot: true, // Include dot files like .intlayerrc\n });\n\n // Extract unique directory paths from config files\n const projectDirs = [...new Set(configFiles.map((file) => dirname(file)))];\n\n // Sort alphabetically for consistent output\n return { searchDir, projectsPath: projectDirs.sort() };\n};\n"],"mappings":"8OAqBA,MAAM,EAAgB,KAAO,IAAyC,CACpE,GAAI,CAGF,OADgB,MADJ,GAAA,EAAA,EAAA,SAAgB,EAAI,EAAA,EAAA,EAAA,UAAc,EACpB,SAAS,CAAC,kBAAkB,CAAC,EACxC,MAAM,MACN,CACf,OAAO,OAUE,EAAe,KAC1B,IAC2D,CAC3D,IAAI,EAAY,GAAS,SAAW,QAAQ,KAAK,CAGjD,GAAI,GAAS,QAAS,CACpB,IAAM,EAAa,MAAM,EAAc,EAAU,CAC7C,IACF,EAAY,GAUhB,IAAM,EAAc,MAAA,EAAA,EAAA,SALGA,EAAAA,6BAA6B,IACjD,GAAa,MAAM,IACrB,CAG4C,CAC3C,IAAK,EACL,SAAU,GACV,OAAQ,CAAC,qBAAsB,aAAa,CAC5C,IAAK,GACN,CAAC,CAGI,EAAc,CAAC,GAAG,IAAI,IAAI,EAAY,IAAK,IAAA,EAAA,EAAA,SAAiB,EAAK,CAAC,CAAC,CAAC,CAG1E,MAAO,CAAE,YAAW,aAAc,EAAY,MAAM,CAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);let e=require(`node:fs/promises`),t=require(`node:path`),n=require(`@intlayer/config/utils`),r=require(`@intlayer/config/file`),i=require(`node:module`);const a=(e,t)=>({name:`rewrite-paths`,setup(n){n.onResolve({filter:/.*/},n=>{let r=e[n.path];if(t?.includes(n.path))return null;if(r)return{path:r,namespace:`intlayer-replace-modules`,external:!0};for(let t of Object.keys(e))if(n.path===t||n.path.startsWith(`${t}/`)){let r=n.path.slice(t.length);return{path:e[t]+r,namespace:`intlayer-replace-modules`,external:!0}}})}}),o=async o=>{let s=(0,n.getProjectRequire)(o.system.baseDir),c=n.configESMxCJSRequire,l=n.isESModule?(0,i.createRequire)(require(`url`).pathToFileURL(__filename).href):require,u=(0,t.join)(o.system.configDir,`configuration.json`),d={defu:c.resolve(`defu`),esbuild:c.resolve(`esbuild`),"@intlayer/config/built":u,"@intlayer/config/utils":l.resolve(`@intlayer/config/utils`),"@intlayer/config/client":l.resolve(`@intlayer/config/client`),"@intlayer/config/logger":l.resolve(`@intlayer/config/logger`),"@intlayer/core/file":l.resolve(`@intlayer/core/file`)},f=s.resolve(`intlayer`);return await(0,r.bundleFile)(await(0,e.readFile)(f,`utf-8`),f,{external:[...i.builtinModules,...i.builtinModules.map(e=>`node:${e}`)],minify:!0,plugins:[a(d)]})??``};exports.getIntlayerBundle=o;
|
|
2
2
|
//# sourceMappingURL=getIntlayerBundle.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIntlayerBundle.cjs","names":["configESMxCJSRequire","isESModule","builtinModules"],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport { bundleFile, type ESBuildPlugin } from '@intlayer/config/file';\nimport {\n configESMxCJSRequire,\n getProjectRequire,\n isESModule,\n} from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = getProjectRequire(configuration.system.baseDir);\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.system.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n defu: configPackageRequire.resolve('defu'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config/utils': localRequire.resolve('@intlayer/config/utils'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/config/logger': localRequire.resolve('@intlayer/config/logger'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getIntlayerBundle.cjs","names":["configESMxCJSRequire","isESModule","builtinModules"],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport { bundleFile, type ESBuildPlugin } from '@intlayer/config/file';\nimport {\n configESMxCJSRequire,\n getProjectRequire,\n isESModule,\n} from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = getProjectRequire(configuration.system.baseDir);\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.system.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n defu: configPackageRequire.resolve('defu'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config/utils': localRequire.resolve('@intlayer/config/utils'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/config/logger': localRequire.resolve('@intlayer/config/logger'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":"6PAmBA,MAAM,GACJ,EACA,KAEO,CACL,KAAM,gBACN,MAAM,EAAO,CACX,EAAM,UAAU,CAAE,OAAQ,KAAM,CAAG,GAAS,CAC1C,IA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ag,{value:`Module`}),require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);const e=require(`../utils/parallelize.cjs`),t=require(`../filterInvalidDictionaries.cjs`),n=require(`../buildIntlayerDictionary/processContentDeclaration.cjs`),r=require(`./getIntlayerBundle.cjs`),i=require(`./logTypeScriptErrors.cjs`);let a=require(`node:fs/promises`),o=require(`node:path`),s=require(`@intlayer/config/utils`),c=require(`@intlayer/config/file`);const l=(e,t)=>Object.entries(e).map(([e,n])=>({...n,location:n.location??t.dictionary?.location??`local`,localId:`${n.key}::local::${e}`,filePath:e})),u=async e=>{let{system:t}=e,{set:n,isValid:i}=(0,s.cacheDisk)(e,[`intlayer-bundle`],{ttlMs:1e3*60*60*24*5}),c=(0,o.join)(t.cacheDir,`intlayer-bundle.cjs`);return await i()||(await(0,a.writeFile)(c,await r.getIntlayerBundle(e)),await n(`ok`)),c},d=async(e,t,n)=>{let{build:r}=t,i=n??await u(t);try{return await(0,c.loadExternalFile)(e,{projectRequire:r.require??(0,s.getProjectRequire)(),buildOptions:{banner:{js:[`globalThis.INTLAYER_FILE_PATH = '${e}';`,`globalThis.INTLAYER_BASE_DIR = '${t.system.baseDir}';`].join(`
|
|
2
2
|
`)}},aliases:{intlayer:i}})}catch(t){console.error(`Error loading content declaration at ${e}:`,t);return}},f=async(r,a,s)=>{let{build:c,system:f}=a;c.checkTypes&&i.logTypeScriptErrors(r,a).catch(e=>{console.error(`Error during TypeScript validation:`,e)});let p=await u(a);try{let i=r.map(async e=>({relativePath:(0,o.relative)(a.system.baseDir,e),dictionary:await d(e,a,p)})),c=l((await Promise.all(i)).reduce((e,{relativePath:t,dictionary:n})=>(n&&(e[t]=n),e),{}),a).filter(e=>e.location!==`remote`),u=c.map(e=>({dictionaryKey:e.key,type:`local`,status:`found`}));return s?.(u),t.filterInvalidDictionaries(await e.parallelize(c,async e=>{if(!e)return;s?.([{dictionaryKey:e.key,type:`local`,status:`building`}]);let t=await n.processContentDeclaration(e,a);if(t)return s?.([{dictionaryKey:t.key,type:`local`,status:`built`}]),t}),a,{checkSchema:!1})}catch{console.error(`Error loading content declarations`)}return[]};exports.ensureIntlayerBundle=u,exports.formatLocalDictionaries=l,exports.loadContentDeclaration=d,exports.loadContentDeclarations=f;
|
|
3
3
|
//# sourceMappingURL=loadContentDeclaration.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadContentDeclaration.cjs","names":["getIntlayerBundle","filterInvalidDictionaries","parallelize","processContentDeclaration"],"sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport { loadExternalFile } from '@intlayer/config/file';\nimport { cacheDisk, getProjectRequire } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { processContentDeclaration } from '../buildIntlayerDictionary/processContentDeclaration';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { parallelize } from '../utils/parallelize';\nimport { getIntlayerBundle } from './getIntlayerBundle';\nimport type { DictionariesStatus } from './loadDictionaries';\nimport { logTypeScriptErrors } from './logTypeScriptErrors';\n\nexport const formatLocalDictionaries = (\n dictionariesRecord: Record<string, Dictionary>,\n configuration: IntlayerConfig\n): Dictionary[] =>\n Object.entries(dictionariesRecord).map(([relativePath, dict]) => ({\n ...dict,\n location: dict.location ?? configuration.dictionary?.location ?? 'local',\n localId: `${dict.key}::local::${relativePath}`,\n filePath: relativePath,\n }));\n\nexport const ensureIntlayerBundle = async (\n configuration: IntlayerConfig\n): Promise<string> => {\n const { system } = configuration;\n\n const { set, isValid } = cacheDisk(configuration, ['intlayer-bundle'], {\n ttlMs: 1000 * 60 * 60 * 24 * 5, // 5 days\n });\n\n const filePath = join(system.cacheDir, 'intlayer-bundle.cjs');\n const hasIntlayerBundle = await isValid();\n\n if (!hasIntlayerBundle) {\n const intlayerBundle = await getIntlayerBundle(configuration);\n await writeFile(filePath, intlayerBundle);\n await set('ok');\n }\n\n return filePath;\n};\n\nexport const loadContentDeclaration = async (\n path: string,\n configuration: IntlayerConfig,\n bundleFilePath?: string\n): Promise<Dictionary | undefined> => {\n const { build } = configuration;\n\n const resolvedBundleFilePath =\n bundleFilePath ?? (await ensureIntlayerBundle(configuration));\n\n try {\n const dictionary = await loadExternalFile(path, {\n projectRequire: build.require ?? getProjectRequire(),\n buildOptions: {\n banner: {\n js: [\n `globalThis.INTLAYER_FILE_PATH = '${path}';`,\n `globalThis.INTLAYER_BASE_DIR = '${configuration.system.baseDir}';`,\n ].join('\\n'),\n },\n },\n aliases: {\n intlayer: resolvedBundleFilePath,\n },\n });\n\n return dictionary;\n } catch (error) {\n console.error(`Error loading content declaration at ${path}:`, error);\n return undefined;\n }\n};\n\nexport const loadContentDeclarations = async (\n contentDeclarationFilePath: string[],\n configuration: IntlayerConfig,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<Dictionary[]> => {\n const { build, system } = configuration;\n\n // Check for TypeScript warnings before we build\n if (build.checkTypes) {\n logTypeScriptErrors(contentDeclarationFilePath, configuration).catch(\n (e) => {\n console.error('Error during TypeScript validation:', e);\n }\n );\n }\n\n const bundleFilePath = await ensureIntlayerBundle(configuration);\n\n try {\n const dictionariesPromises = contentDeclarationFilePath.map(\n async (path) => {\n const relativePath = relative(configuration.system.baseDir, path);\n\n const dictionary = await loadContentDeclaration(\n path,\n configuration,\n bundleFilePath\n );\n\n return { relativePath, dictionary };\n }\n );\n\n const dictionariesArray = await Promise.all(dictionariesPromises);\n const dictionariesRecord = dictionariesArray.reduce(\n (acc, { relativePath, dictionary }) => {\n if (dictionary) {\n acc[relativePath] = dictionary;\n }\n return acc;\n },\n {} as Record<string, Dictionary>\n );\n\n const contentDeclarations: Dictionary[] = formatLocalDictionaries(\n dictionariesRecord,\n configuration\n ).filter((dictionary) => dictionary.location !== 'remote');\n\n const listFoundDictionaries = contentDeclarations.map((declaration) => ({\n dictionaryKey: declaration.key,\n type: 'local' as const,\n status: 'found' as const,\n }));\n\n onStatusUpdate?.(listFoundDictionaries);\n\n const processedDictionaries = await parallelize(\n contentDeclarations,\n async (contentDeclaration): Promise<Dictionary | undefined> => {\n if (!contentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: contentDeclaration.key,\n type: 'local',\n status: 'building',\n },\n ]);\n\n const processedContentDeclaration = await processContentDeclaration(\n contentDeclaration as Dictionary,\n configuration\n );\n\n if (!processedContentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: processedContentDeclaration.key,\n type: 'local',\n status: 'built',\n },\n ]);\n\n return processedContentDeclaration;\n }\n );\n\n return filterInvalidDictionaries(processedDictionaries, configuration, {\n checkSchema: false,\n });\n } catch {\n console.error('Error loading content declarations');\n }\n\n return [];\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadContentDeclaration.cjs","names":["getIntlayerBundle","filterInvalidDictionaries","parallelize","processContentDeclaration"],"sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport { loadExternalFile } from '@intlayer/config/file';\nimport { cacheDisk, getProjectRequire } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { processContentDeclaration } from '../buildIntlayerDictionary/processContentDeclaration';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { parallelize } from '../utils/parallelize';\nimport { getIntlayerBundle } from './getIntlayerBundle';\nimport type { DictionariesStatus } from './loadDictionaries';\nimport { logTypeScriptErrors } from './logTypeScriptErrors';\n\nexport const formatLocalDictionaries = (\n dictionariesRecord: Record<string, Dictionary>,\n configuration: IntlayerConfig\n): Dictionary[] =>\n Object.entries(dictionariesRecord).map(([relativePath, dict]) => ({\n ...dict,\n location: dict.location ?? configuration.dictionary?.location ?? 'local',\n localId: `${dict.key}::local::${relativePath}`,\n filePath: relativePath,\n }));\n\nexport const ensureIntlayerBundle = async (\n configuration: IntlayerConfig\n): Promise<string> => {\n const { system } = configuration;\n\n const { set, isValid } = cacheDisk(configuration, ['intlayer-bundle'], {\n ttlMs: 1000 * 60 * 60 * 24 * 5, // 5 days\n });\n\n const filePath = join(system.cacheDir, 'intlayer-bundle.cjs');\n const hasIntlayerBundle = await isValid();\n\n if (!hasIntlayerBundle) {\n const intlayerBundle = await getIntlayerBundle(configuration);\n await writeFile(filePath, intlayerBundle);\n await set('ok');\n }\n\n return filePath;\n};\n\nexport const loadContentDeclaration = async (\n path: string,\n configuration: IntlayerConfig,\n bundleFilePath?: string\n): Promise<Dictionary | undefined> => {\n const { build } = configuration;\n\n const resolvedBundleFilePath =\n bundleFilePath ?? (await ensureIntlayerBundle(configuration));\n\n try {\n const dictionary = await loadExternalFile(path, {\n projectRequire: build.require ?? getProjectRequire(),\n buildOptions: {\n banner: {\n js: [\n `globalThis.INTLAYER_FILE_PATH = '${path}';`,\n `globalThis.INTLAYER_BASE_DIR = '${configuration.system.baseDir}';`,\n ].join('\\n'),\n },\n },\n aliases: {\n intlayer: resolvedBundleFilePath,\n },\n });\n\n return dictionary;\n } catch (error) {\n console.error(`Error loading content declaration at ${path}:`, error);\n return undefined;\n }\n};\n\nexport const loadContentDeclarations = async (\n contentDeclarationFilePath: string[],\n configuration: IntlayerConfig,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<Dictionary[]> => {\n const { build, system } = configuration;\n\n // Check for TypeScript warnings before we build\n if (build.checkTypes) {\n logTypeScriptErrors(contentDeclarationFilePath, configuration).catch(\n (e) => {\n console.error('Error during TypeScript validation:', e);\n }\n );\n }\n\n const bundleFilePath = await ensureIntlayerBundle(configuration);\n\n try {\n const dictionariesPromises = contentDeclarationFilePath.map(\n async (path) => {\n const relativePath = relative(configuration.system.baseDir, path);\n\n const dictionary = await loadContentDeclaration(\n path,\n configuration,\n bundleFilePath\n );\n\n return { relativePath, dictionary };\n }\n );\n\n const dictionariesArray = await Promise.all(dictionariesPromises);\n const dictionariesRecord = dictionariesArray.reduce(\n (acc, { relativePath, dictionary }) => {\n if (dictionary) {\n acc[relativePath] = dictionary;\n }\n return acc;\n },\n {} as Record<string, Dictionary>\n );\n\n const contentDeclarations: Dictionary[] = formatLocalDictionaries(\n dictionariesRecord,\n configuration\n ).filter((dictionary) => dictionary.location !== 'remote');\n\n const listFoundDictionaries = contentDeclarations.map((declaration) => ({\n dictionaryKey: declaration.key,\n type: 'local' as const,\n status: 'found' as const,\n }));\n\n onStatusUpdate?.(listFoundDictionaries);\n\n const processedDictionaries = await parallelize(\n contentDeclarations,\n async (contentDeclaration): Promise<Dictionary | undefined> => {\n if (!contentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: contentDeclaration.key,\n type: 'local',\n status: 'building',\n },\n ]);\n\n const processedContentDeclaration = await processContentDeclaration(\n contentDeclaration as Dictionary,\n configuration\n );\n\n if (!processedContentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: processedContentDeclaration.key,\n type: 'local',\n status: 'built',\n },\n ]);\n\n return processedContentDeclaration;\n }\n );\n\n return filterInvalidDictionaries(processedDictionaries, configuration, {\n checkSchema: false,\n });\n } catch {\n console.error('Error loading content declarations');\n }\n\n return [];\n};\n"],"mappings":"gdAaA,MAAa,GACX,EACA,IAEA,OAAO,QAAQ,EAAmB,CAAC,KAAK,CAAC,EAAc,MAAW,CAChE,GAAG,EACH,SAAU,EAAK,UAAY,EAAc,YAAY,UAAY,QACjE,QAAS,GAAG,EAAK,IAAI,WAAW,IAChC,SAAU,EACX,EAAE,CAEQ,EAAuB,KAClC,IACoB,CACpB,GAAM,CAAE,UAAW,EAEb,CAAE,MAAK,YAAA,EAAA,EAAA,WAAsB,EAAe,CAAC,kBAAkB,CAAE,CACrE,MAAO,IAA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cAAe,EAAY,IAC3B,KAAM,QACN,OAAQ,QACT,EAAE,CAwCH,OAtCA,IAAiB,EAAsB,CAsChCC,EAAAA,0BApCuB,MAAMC,EAAAA,YAClC,EACA,KAAO,IAAwD,CAC7D,GAAI,CAAC,EACH,OAGF,IAAiB,CACf,CACE,cAAe,EAAmB,IAClC,KAAM,QACN,OAAQ,WACT,CACF,CAAC,CAEF,IAAM,EAA8B,MAAMC,EAAAA,0BACxC,EACA,EACD,CAEI,KAYL,OARA,IAAiB,CACf,CACE,cAAe,EAA4B,IAC3C,KAAM,QACN,OAAQ,QACT,CACF,CAAC,CAEK,GAEV,CAEuD,EAAe,CACrE,YAAa,GACd,CAAC,MACI,CACN,QAAQ,MAAM,qCAAqC,CAGrD,MAAO,EAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);const e=require(`../filterInvalidDictionaries.cjs`),t=require(`./loadContentDeclaration.cjs`),n=require(`../formatDictionary.cjs`),r=require(`./loadRemoteDictionaries.cjs`),i=require(`./log.cjs`);let a=require(`@intlayer/config/logger`),o=[];const s=new i.DictionariesLogger,c=e=>{let t=[...o];for(let n of e){let e=t.findIndex(e=>e.dictionaryKey===n.dictionaryKey&&e.type===n.type);e>=0?t[e]=n:t.push(n)}return o=t,s.update(e),t},l=e=>{switch(e){case`built`:case`imported`:case`fetched`:return`✔`;case`error`:return`✖`;default:return`⏲`}},u=e=>{switch(e){case`built`:case`imported`:case`fetched`:return a.ANSIColors.GREEN;case`error`:return a.ANSIColors.RED;default:return a.ANSIColors.BLUE}},d=e=>{if(e.log.mode!==`verbose`)return;let t=(0,a.getAppLogger)(e),n=new Map;for(let e of o){let t=n.get(e.dictionaryKey)??{};e.type===`local`&&(t.local=e.status),e.type===`remote`&&(t.remote=e.status),n.set(e.dictionaryKey,t)}let r=Array.from(n.keys()).sort((e,t)=>e.localeCompare(t)),i=0;for(let e of r){let t=n.get(e);if(t.local){let e=`[local: ${l(t.local)} ${t.local}]`;e.length>i&&(i=e.length)}}for(let e of r){let o=n.get(e),s=[];if(o.local){let e=(0,a.colorize)(`${l(o.local)} ${o.local}`,u(o.local)),t=`${a.ANSIColors.GREY}[`+(0,a.colorize)(`local: `,a.ANSIColors.GREY)+e+`${a.ANSIColors.GREY}]${a.ANSIColors.RESET}`,n=`[local: ${l(o.local)} ${o.local}]`,r=Math.max(0,i-n.length);s.push(t+` `.repeat(r))}else s.push(` `.repeat(i));if(o.remote){let e=(0,a.colorize)(`${l(o.remote)} ${o.remote}`,u(o.remote));s.push(`${a.ANSIColors.GREY}[`+(0,a.colorize)(`distant: `,a.ANSIColors.GREY)+e+`${a.ANSIColors.GREY}]${a.ANSIColors.RESET}`)}t(` - ${(0,a.colon)((0,a.colorizeKey)(e),{colSize:r})} ${s.join(` `)}`)}},f=async(i,o)=>{let{plugins:l}=o,u=Date.now();(0,a.getAppLogger)(o)(`Dictionaries:`,{isVerbose:!0});let f=(await Promise.all(l??[])).filter(e=>e.loadDictionaries).map(async e=>{try{return await e.loadDictionaries?.({configuration:o})??[]}catch(e){return s.setPluginError(e),[]}}),p=await Promise.all(f).then(e=>e.flat()).then(t=>e.filterInvalidDictionaries(t,o)).then(e=>n.formatDictionaries(e));s.setPluginTotal(p.length),s.setPluginDone(p.length);let m=Date.now(),h=await t.loadContentDeclarations(Array.isArray(i)?i:[i],o,c).then(t=>e.filterInvalidDictionaries(t,o)).then(e=>n.formatDictionaries(e)),g=Date.now();c(h.map(e=>({dictionaryKey:e.key,type:`local`,status:`built`})));let _=!!(o.editor.clientId&&o.editor.clientSecret);_&&s.setExpectRemote(!0);let v=[];_&&(v=await r.loadRemoteDictionaries(o,c,{onStartRemoteCheck:()=>s.startRemoteCheck(),onStopRemoteCheck:()=>s.stopRemoteCheck(),onError:e=>s.setRemoteError(e)}).then(t=>e.filterInvalidDictionaries(t,o)).then(e=>n.formatDictionaries(e)));let y=Date.now();return s.finish(),d(o),{localDictionaries:h,remoteDictionaries:v,pluginDictionaries:p,time:{localDictionaries:g-m,remoteDictionaries:y-g,pluginDictionaries:m-u}}};exports.loadDictionaries=f;
|
|
2
2
|
//# sourceMappingURL=loadDictionaries.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadDictionaries.cjs","names":["DictionariesLogger","ANSIColors","filterInvalidDictionaries","formatDictionaries","loadContentDeclarations","loadRemoteDictionaries"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { formatDictionaries } from '../formatDictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const status of loadDictionariesStatus) {\n const rec = byKey.get(status.dictionaryKey) ?? {};\n if (status.type === 'local') rec.local = status.status;\n if (status.type === 'remote') rec.remote = status.status;\n byKey.set(status.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n pluginDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const resolvedPlugins = await Promise.all(plugins ?? []);\n\n const pluginsWithLoadDictionaries = resolvedPlugins.filter(\n (plugin) => plugin.loadDictionaries\n );\n\n const loadPluginDictionariesPromise = pluginsWithLoadDictionaries.map(\n async (plugin) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n\n return (res as Dictionary[] | undefined) ?? [];\n } catch (error) {\n logger.setPluginError(error as Error);\n\n return [];\n }\n }\n );\n\n const pluginDictionaries: Dictionary[] = await Promise.all(\n loadPluginDictionariesPromise as Promise<Dictionary[]>[]\n )\n .then((dictionaries) => dictionaries.flat())\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n logger.setPluginTotal(pluginDictionaries.length);\n logger.setPluginDone(pluginDictionaries.length);\n\n const pluginDictionariesTime = Date.now();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n const localDictionariesTime = Date.now();\n\n const localDictionariesStatus = localDictionaries.map(\n (dictionary) =>\n ({\n dictionaryKey: dictionary.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n }\n\n const remoteDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - pluginDictionariesTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n pluginDictionaries: pluginDictionariesTime - loadDictionariesStartTime,\n },\n };\n};\n"],"mappings":"6VA8BI,EAA+C,EAAE,CACrD,MAAM,EAAS,IAAIA,EAAAA,mBAEb,EAA6B,GAAmC,CACpE,IAAM,EAAgC,CAAC,GAAG,EAAuB,CAEjE,IAAK,IAAM,KAAY,EAAU,CAC/B,IAAM,EAAQ,EAAQ,UACnB,GACC,EAA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formatDictionaries","loadContentDeclarations","loadRemoteDictionaries"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { formatDictionaries } from '../formatDictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const status of loadDictionariesStatus) {\n const rec = byKey.get(status.dictionaryKey) ?? {};\n if (status.type === 'local') rec.local = status.status;\n if (status.type === 'remote') rec.remote = status.status;\n byKey.set(status.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n pluginDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const resolvedPlugins = await Promise.all(plugins ?? []);\n\n const pluginsWithLoadDictionaries = resolvedPlugins.filter(\n (plugin) => plugin.loadDictionaries\n );\n\n const loadPluginDictionariesPromise = pluginsWithLoadDictionaries.map(\n async (plugin) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n\n return (res as Dictionary[] | undefined) ?? [];\n } catch (error) {\n logger.setPluginError(error as Error);\n\n return [];\n }\n }\n );\n\n const pluginDictionaries: Dictionary[] = await Promise.all(\n loadPluginDictionariesPromise as Promise<Dictionary[]>[]\n )\n .then((dictionaries) => dictionaries.flat())\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n logger.setPluginTotal(pluginDictionaries.length);\n logger.setPluginDone(pluginDictionaries.length);\n\n const pluginDictionariesTime = Date.now();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n const localDictionariesTime = Date.now();\n\n const localDictionariesStatus = localDictionaries.map(\n (dictionary) =>\n ({\n dictionaryKey: dictionary.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n }\n\n const remoteDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - pluginDictionariesTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n pluginDictionaries: pluginDictionariesTime - loadDictionariesStartTime,\n },\n };\n};\n"],"mappings":"iVA8BI,EAA+C,EAAE,CACrD,MAAM,EAAS,IAAIA,EAAAA,mBAEb,EAA6B,GAAmC,CACpE,IAAM,EAAgC,CAAC,GAAG,EAAuB,CAEjE,IAAK,IAAM,KAAY,EAAU,CAC/B,IAAM,EAAQ,EAAQ,UACnB,GACC,EAAE,gBAAkB,EAAS,eAAiB,EAAE,OAAS,EAAS,KACrE,CACG,GAAS,EACX,EAAQ,GAAS,EAEjB,EAAQ,KAAK,EAAS,CAO1B,MAHA,GAAyB,EACzB,EAAO,OAAO,EAAS,CAEhB,GAQH,EAAW,GAAyC,CACxD,OAAQ,EAAR,CACE,IAAK,QACL,IAAK,WACL,IAAK,UACH,MAAO,IACT,IAAK,QACH,MAAO,IACT,QACE,MAAO,MAIP,EAAY,GAAyC,CACzD,OAAQ,EAAR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BAJhC,MAAM,QAAQ,EAAyB,CACjD,EACA,CAAC,EAAyB,CAI5B,EACA,EACD,CACE,KAAM,GACLF,EAAAA,0BAA0B,EAAc,EAAc,CACvD,CACA,KAAM,GAAiBC,EAAAA,mBAAmB,EAAa,CAAC,CAErD,EAAwB,KAAK,KAAK,CAWxC,EATgC,EAAkB,IAC/C,IACE,CACC,cAAe,EAAW,IAC1B,KAAM,QACN,OAAQ,QACT,EACJ,CAEiD,CAElD,IAAM,EAAwB,GAC5B,EAAc,OAAO,UAAY,EAAc,OAAO,cAGpD,GAEF,EAAO,gBAAgB,GAAK,CAG9B,IAAI,EAAmC,EAAE,CAErC,IACF,EAAqB,MAAME,EAAAA,uBACzB,EACA,EACA,CACE,uBAA0B,EAAO,kBAAkB,CACnD,sBAAyB,EAAO,iBAAiB,CACjD,QAAU,GAAM,EAAO,eAAe,EAAE,CACzC,CACF,CACE,KAAM,GACLH,EAAAA,0BAA0B,EAAc,EAAc,CACvD,CACA,KAAM,GAAiBC,EAAAA,mBAAmB,EAAa,CAAC,EAG7D,IAAM,EAAyB,KAAK,KAAK,CAOzC,OAJA,EAAO,QAAQ,CAEf,EAAa,EAAc,CAEpB,CACL,oBACA,qBACA,qBACA,KAAM,CACJ,kBAAmB,EAAwB,EAC3C,mBAAoB,EAAyB,EAC7C,mBAAoB,EAAyB,EAC9C,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);const e=require(`./loadContentDeclaration.cjs`);let t=require(`node:fs/promises`),n=require(`node:path`);const r=async(r,i)=>{let{system:a}=i,{dictionariesDir:o,baseDir:s}=a;typeof r==`string`&&(r=[r]),await(0,t.mkdir)((0,n.resolve)(o),{recursive:!0});let c=[];for await(let t of r){let r=await e.loadContentDeclarations([t],i),a=(0,n.relative)(s,t),o={...r[0],filePath:a};c.push(o)}return c};exports.loadLocalDictionaries=r;
|
|
2
2
|
//# sourceMappingURL=loadLocalDictionaries.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadLocalDictionaries.cjs","names":["loadContentDeclarations"],"sources":["../../../src/loadDictionaries/loadLocalDictionaries.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\n\nexport const loadLocalDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<Dictionary[]> => {\n const { system } = configuration;\n const { dictionariesDir, baseDir } = system;\n\n if (typeof contentDeclarationsPaths === 'string') {\n contentDeclarationsPaths = [contentDeclarationsPaths];\n }\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(dictionariesDir), { recursive: true });\n\n const result: Dictionary[] = [];\n\n for await (const contentDeclarationPath of contentDeclarationsPaths) {\n const dictionary = await loadContentDeclarations(\n [contentDeclarationPath],\n configuration\n );\n\n const relativeFilePath = relative(baseDir, contentDeclarationPath);\n\n const dictionaryWithPath: Dictionary = {\n ...dictionary[0],\n filePath: relativeFilePath,\n };\n\n result.push(dictionaryWithPath);\n }\n\n return result;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadLocalDictionaries.cjs","names":["loadContentDeclarations"],"sources":["../../../src/loadDictionaries/loadLocalDictionaries.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\n\nexport const loadLocalDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<Dictionary[]> => {\n const { system } = configuration;\n const { dictionariesDir, baseDir } = system;\n\n if (typeof contentDeclarationsPaths === 'string') {\n contentDeclarationsPaths = [contentDeclarationsPaths];\n }\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(dictionariesDir), { recursive: true });\n\n const result: Dictionary[] = [];\n\n for await (const contentDeclarationPath of contentDeclarationsPaths) {\n const dictionary = await loadContentDeclarations(\n [contentDeclarationPath],\n configuration\n );\n\n const relativeFilePath = relative(baseDir, contentDeclarationPath);\n\n const dictionaryWithPath: Dictionary = {\n ...dictionary[0],\n filePath: relativeFilePath,\n };\n\n result.push(dictionaryWithPath);\n }\n\n return result;\n};\n"],"mappings":"6MAMA,MAAa,EAAwB,MACnC,EACA,IAC0B,CAC1B,GAAM,CAAE,UAAW,EACb,CAAE,kBAAiB,WAAY,EAEjC,OAAO,GAA6B,WACtC,EAA2B,CAAC,EAAyB,EAIvD,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,SAAoB,EAAgB,CAAE,CAAE,UAAW,GAAM,CAAC,CAE1D,IAAM,EAAuB,EAAE,CAE/B,UAAW,IAAM,KAA0B,EAA0B,CACnE,IAAM,EAAa,MAAMA,EAAAA,wBACvB,CAAC,EAAuB,CACxB,EACD,CAEK,GAAA,EAAA,EAAA,UAA4B,EAAS,EAAuB,CAE5D,EAAiC,CACrC,GAAG,EAAW,GACd,SAAU,EACX,CAED,EAAO,KAAK,EAAmB,CAGjC,OAAO"}
|