@intlayer/chokidar 8.2.4 → 8.3.0-canary.1
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/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.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +4 -4
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +2 -2
- 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.map +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/generateDictionaryListContent.cjs +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 +2 -2
- package/dist/cjs/createType/createModuleAugmentation.cjs.map +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/filterInvalidDictionaries.cjs.map +1 -1
- package/dist/cjs/formatDictionary.cjs.map +1 -1
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +7 -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/initConfig/index.cjs +1 -1
- package/dist/cjs/listDictionariesPath.cjs.map +1 -1
- package/dist/cjs/listGitFiles.cjs +3 -3
- package/dist/cjs/listProjects.cjs +1 -1
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +1 -1
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/index.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +2 -2
- 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.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 +2 -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/applyMask.cjs.map +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/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/getComponentTransformPattern.cjs +1 -1
- package/dist/cjs/utils/getComponentTransformPattern.cjs.map +1 -1
- package/dist/cjs/utils/getContentExtension.cjs +2 -0
- package/dist/cjs/utils/getContentExtension.cjs.map +1 -0
- package/dist/cjs/utils/getFormatFromExtension.cjs +1 -1
- package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/cjs/utils/resolveRelativePath.cjs +2 -0
- package/dist/cjs/utils/resolveRelativePath.cjs.map +1 -0
- package/dist/cjs/watcher.cjs +1 -1
- package/dist/cjs/watcher.cjs.map +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 +3 -1
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +2 -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/esm/build.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +4 -4
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +2 -2
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -1
- package/dist/esm/cleanOutputDir.mjs.map +1 -1
- package/dist/esm/cleanRemovedContentDeclaration.mjs +1 -1
- package/dist/esm/cleanRemovedContentDeclaration.mjs.map +1 -1
- package/dist/esm/cli.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -1
- package/dist/esm/createType/createModuleAugmentation.mjs +2 -2
- package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
- package/dist/esm/createType/createType.mjs.map +1 -1
- package/dist/esm/detectFormatCommand.mjs +1 -1
- package/dist/esm/detectFormatCommand.mjs.map +1 -1
- package/dist/esm/fetchDistantDictionaries.mjs +1 -1
- package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
- package/dist/esm/formatDictionary.mjs.map +1 -1
- package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +7 -1
- package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -1
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs +1 -1
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -1
- package/dist/esm/handleContentDeclarationFileChange.mjs +1 -1
- package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -1
- package/dist/esm/handleContentDeclarationFileMoved.mjs +1 -1
- package/dist/esm/handleContentDeclarationFileMoved.mjs.map +1 -1
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +1 -1
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -1
- package/dist/esm/init/index.mjs +1 -1
- package/dist/esm/initConfig/index.mjs +1 -1
- package/dist/esm/listDictionariesPath.mjs.map +1 -1
- package/dist/esm/listGitFiles.mjs +4 -4
- package/dist/esm/listProjects.mjs +1 -1
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +1 -1
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
- package/dist/esm/loadDictionaries/index.mjs +1 -1
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +2 -2
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +1 -1
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs +1 -1
- package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs.map +1 -1
- package/dist/esm/logConfigDetails.mjs +2 -1
- package/dist/esm/logConfigDetails.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +1 -1
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -1
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
- package/dist/esm/utils/autoDecorateContent.mjs +1 -1
- package/dist/esm/utils/autoDecorateContent.mjs.map +1 -1
- package/dist/esm/utils/buildFilesList.mjs +1 -1
- package/dist/esm/utils/buildFilesList.mjs.map +1 -1
- package/dist/esm/utils/formatter.mjs +1 -1
- package/dist/esm/utils/formatter.mjs.map +1 -1
- package/dist/esm/utils/getComponentTransformPattern.mjs +1 -1
- package/dist/esm/utils/getComponentTransformPattern.mjs.map +1 -1
- package/dist/esm/utils/getContentExtension.mjs +2 -0
- package/dist/esm/utils/getContentExtension.mjs.map +1 -0
- package/dist/esm/utils/getFormatFromExtension.mjs +1 -1
- package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/resolveRelativePath.mjs +2 -0
- package/dist/esm/utils/resolveRelativePath.mjs.map +1 -0
- package/dist/esm/watcher.mjs +1 -1
- package/dist/esm/watcher.mjs.map +1 -1
- package/dist/esm/writeConfiguration/index.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +1 -1
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs +3 -1
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/transformJSONFile.mjs +2 -1
- package/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +1 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs +1 -1
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
- package/dist/types/build.d.ts +2 -2
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +3 -3
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +2 -1
- package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +5 -4
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +3 -3
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +3 -3
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +3 -3
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +2 -1
- package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -1
- package/dist/types/cleanOutputDir.d.ts +1 -1
- package/dist/types/cleanRemovedContentDeclaration.d.ts +1 -1
- package/dist/types/cleanRemovedContentDeclaration.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +2 -2
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +2 -2
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +1 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +1 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +1 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +1 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +1 -1
- package/dist/types/createType/createModuleAugmentation.d.ts +1 -1
- package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -1
- package/dist/types/createType/createType.d.ts +2 -1
- package/dist/types/createType/createType.d.ts.map +1 -1
- package/dist/types/detectFormatCommand.d.ts +1 -1
- package/dist/types/filterInvalidDictionaries.d.ts +2 -1
- package/dist/types/filterInvalidDictionaries.d.ts.map +1 -1
- package/dist/types/formatDictionary.d.ts +21 -20
- package/dist/types/formatDictionary.d.ts.map +1 -1
- package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +1 -1
- package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +1 -1
- package/dist/types/handleAdditionalContentDeclarationFile.d.ts +1 -1
- package/dist/types/handleContentDeclarationFileChange.d.ts +1 -1
- package/dist/types/handleContentDeclarationFileMoved.d.ts +1 -1
- package/dist/types/handleUnlinkedContentDeclarationFile.d.ts +1 -1
- package/dist/types/listDictionariesPath.d.ts +1 -1
- package/dist/types/loadDictionaries/getIntlayerBundle.d.ts +1 -1
- package/dist/types/loadDictionaries/index.d.ts +2 -2
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +5 -2
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadDictionaries.d.ts +2 -1
- package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +2 -1
- package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +3 -3
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts +1 -1
- package/dist/types/logConfigDetails.d.ts.map +1 -1
- package/dist/types/prepareIntlayer.d.ts +1 -1
- package/dist/types/reduceDictionaryContent/applyMask.d.ts +1 -1
- package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts +1 -1
- package/dist/types/utils/buildFilesList.d.ts.map +1 -1
- package/dist/types/utils/formatter.d.ts +1 -1
- package/dist/types/utils/formatter.d.ts.map +1 -1
- package/dist/types/utils/getComponentTransformPattern.d.ts +1 -1
- package/dist/types/utils/getComponentTransformPattern.d.ts.map +1 -1
- package/dist/types/utils/getContentExtension.d.ts +15 -0
- package/dist/types/utils/getContentExtension.d.ts.map +1 -0
- package/dist/types/utils/getFormatFromExtension.d.ts +2 -2
- package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +3 -1
- package/dist/types/utils/resolveRelativePath.d.ts +5 -0
- package/dist/types/utils/resolveRelativePath.d.ts.map +1 -0
- package/dist/types/watcher.d.ts +1 -1
- package/dist/types/writeConfiguration/index.d.ts +1 -1
- package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts +1 -1
- package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts +3 -2
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/transformJSONFile.d.ts +2 -2
- package/dist/types/writeContentDeclaration/transformJSONFile.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +4 -1
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts +3 -2
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -1
- package/package.json +21 -20
- package/dist/assets/getContentDeclarationFileTemplate/cjsTemplate.txt +0 -10
- package/dist/assets/getContentDeclarationFileTemplate/esmTemplate.txt +0 -10
- package/dist/assets/getContentDeclarationFileTemplate/jsonTemplate.txt +0 -6
- package/dist/assets/getContentDeclarationFileTemplate/tsTemplate.txt +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detectFormatCommand.cjs","names":[],"sources":["../../src/detectFormatCommand.ts"],"sourcesContent":["import { getProjectRequire } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nlet cachedFormatCommand: string | undefined | null = null;\n\nexport const detectFormatCommand = (\n configuration: IntlayerConfig,\n projectRequireProp?: NodeJS.Require\n) => {\n const {
|
|
1
|
+
{"version":3,"file":"detectFormatCommand.cjs","names":[],"sources":["../../src/detectFormatCommand.ts"],"sourcesContent":["import { getProjectRequire } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\nlet cachedFormatCommand: string | undefined | null = null;\n\nexport const detectFormatCommand = (\n configuration: IntlayerConfig,\n projectRequireProp?: NodeJS.Require\n) => {\n const { baseDir } = configuration.system;\n const { formatCommand } = configuration.content;\n const projectRequire = projectRequireProp ?? getProjectRequire(baseDir);\n\n // Priority: Explicit configuration\n // We do not cache this because the user might change their config file active-session.\n if (formatCommand) {\n return formatCommand;\n }\n\n // Priority: Cached detection\n // If not null, we have already performed the expensive checks.\n if (cachedFormatCommand !== null) {\n return cachedFormatCommand;\n }\n\n // Perform Detection\n\n // Try Prettier\n try {\n projectRequire.resolve('prettier');\n cachedFormatCommand = 'prettier --write \"{{file}}\" --log-level silent';\n return cachedFormatCommand;\n } catch (_error) {\n // Prettier not found, continue\n }\n\n // Try Biome\n try {\n projectRequire.resolve('biome');\n cachedFormatCommand = 'biome format \"{{file}}\" --write --log-level none';\n return cachedFormatCommand;\n } catch (_error) {\n // Biome not found, continue\n }\n\n // Try ESLint\n try {\n projectRequire.resolve('eslint');\n cachedFormatCommand =\n 'eslint --fix \"{{file}}\" --quiet || node -e \"process.exit(0)\"';\n return cachedFormatCommand;\n } catch (_error) {\n // ESLint not found\n }\n\n // No formatter found\n // Set to undefined (not null) so we know we checked and found nothing.\n cachedFormatCommand = undefined;\n return undefined;\n};\n"],"mappings":"uJAGI,EAAiD,KAErD,MAAa,GACX,EACA,IACG,CACH,GAAM,CAAE,WAAY,EAAc,OAC5B,CAAE,iBAAkB,EAAc,QAClC,EAAiB,IAAA,EAAA,EAAA,mBAAwC,EAAQ,CAIvE,GAAI,EACF,OAAO,EAKT,GAAI,IAAwB,KAC1B,OAAO,EAMT,GAAI,CAGF,OAFA,EAAe,QAAQ,WAAW,CAClC,EAAsB,iDACf,OACQ,EAKjB,GAAI,CAGF,OAFA,EAAe,QAAQ,QAAQ,CAC/B,EAAsB,mDACf,OACQ,EAKjB,GAAI,CAIF,OAHA,EAAe,QAAQ,SAAS,CAChC,EACE,+DACK,OACQ,EAMjB,EAAsB,IAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/parallelize.cjs`);let t=require(`@intlayer/config/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/parallelize.cjs`);let t=require(`@intlayer/config/logger`),n=require(`@intlayer/config/node`),r=require(`@intlayer/api`);const i=async(i,a)=>{let o=(0,n.getConfiguration)(),s=(0,t.getAppLogger)(o);try{let t=(0,r.getIntlayerAPIProxy)(void 0,o),n=i.dictionaryKeys,s=async e=>{a?.([{dictionaryKey:e,type:`remote`,status:`fetching`}]);try{let n=(await t.dictionary.getDictionary(e)).data;if(!n)throw Error(`Dictionary ${e} not found on remote`);return a?.([{dictionaryKey:e,type:`remote`,status:`fetched`}]),n}catch(t){a?.([{dictionaryKey:e,type:`remote`,status:`error`,error:`Error fetching dictionary ${e}: ${t}`}]);return}};return(await e.parallelize(n,async e=>await s(e))).filter(e=>e!==void 0)}catch{return s(`${t.x} Failed to fetch distant dictionaries`,{level:`error`}),[]}};exports.fetchDistantDictionaries=i;
|
|
2
2
|
//# sourceMappingURL=fetchDistantDictionaries.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterInvalidDictionaries.cjs","names":["formatPath","ANSIColors","formatLocale","x"],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getContent } from '@intlayer/core/interpreter';\nimport type { Dictionary
|
|
1
|
+
{"version":3,"file":"filterInvalidDictionaries.cjs","names":["formatPath","ANSIColors","formatLocale","x"],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getContent } from '@intlayer/core/interpreter';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n },\n locale,\n !isStrict\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":"yOAeA,MAAa,GACX,EACA,EACA,IACY,CACZ,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAE7C,GAAI,CAAC,EAAY,MAAO,GAKxB,IAAM,EAFJ,EAAW,WAAa,SAAW,OAAO,EAAW,UAAa,SAEzC,QAAU,SAC/B,EAAS,EAAQ,EAAW,IAC5B,EAAa,EAAQ,EAAW,QAEtC,GAAI,CAAC,EAKH,OAJA,EAAU,GAAG,EAAS,wBAAyB,CAC7C,MAAO,QACR,CAAC,CAEK,GAGT,GAAI,CAAC,EAOH,OANA,EACE,GAAG,EAAS,eAAA,EAAA,EAAA,aAA0B,EAAW,IAAI,CAAC,oBAAoB,EAAW,SAAWA,EAAAA,WAAW,EAAW,SAAS,EAAA,EAAA,EAAA,cAAgB,SAAS,GACxJ,CACE,MAAO,QACR,CACF,CACM,GAGT,GAAI,EAAW,QAAU,GAAS,aAO5B,EALF,OAAO,EAAW,SAAY,YAC7B,OAAO,EAAW,SAAY,UAC7B,EAAW,UAAY,MACvB,OAAQ,EAAW,QAAgB,MAAS,YAElC,CACZ,IAAM,EAAU,GAAe,sBAAsB,SAAW,EAAE,CAC5D,EACJ,GAAe,qBAAqB,aAAe,SAE/C,EACJ,OAAO,EAAW,QAAW,SACzB,GAAe,UAAU,EAAW,QACpC,IAAA,GAEN,GAAI,GAAU,OAAO,EAAO,WAAc,WACxC,IAAK,IAAM,KAAU,EAAS,CAC5B,IAAM,GAAA,EAAA,EAAA,YACJ,EAAW,QACX,CACE,cAAe,EAAW,IAC1B,QAAS,EAAE,CACZ,CACD,EACA,CAAC,EACF,CACK,EAAU,EAAe,UAAU,EAAgB,CAEzD,GAAI,CAAC,EAAO,QAiBV,OAhBA,EACE,GAAG,EAAS,eAAA,EAAA,EAAA,aAA0B,EAAW,IAAI,CAAC,4CAAA,EAAA,EAAA,UAAoD,EAAW,OAAkBC,EAAAA,WAAW,OAAO,CAAC,cAAcC,EAAAA,aAAa,EAAO,CAAC,KAAK,EAAW,SAAWF,EAAAA,WAAW,EAAW,SAAS,EAAA,EAAA,EAAA,cAAgB,SAAS,GAChR,CACE,MAAO,QACR,CACF,CAED,EAAO,MAAM,OAAO,QAAS,GAAe,CAC1C,EACE,GAAGG,EAAAA,EAAE,WAAA,EAAA,EAAA,aAAsB,EAAW,IAAI,CAAC,KAAKD,EAAAA,aAAa,EAAO,CAAC,MAAA,EAAA,EAAA,UAAc,GAAG,EAAM,KAAK,KAAK,IAAI,CAAC,GAAID,EAAAA,WAAW,KAAK,CAAC,IAAA,EAAA,EAAA,UAAY,EAAM,QAASA,EAAAA,WAAW,KAAK,GAC3K,CACE,MAAO,QACR,CACF,EACD,CAEK,IAOjB,MAAO,IAGI,GACX,EACA,EACA,KAEC,GAAgB,EAAE,GAAG,OAAQ,GAC5B,EAAoB,EAAY,EAAe,EAAQ,CACxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatDictionary.cjs","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":["import {\n i18nextToIntlayerFormatter,\n icuToIntlayerFormatter,\n intlayerToI18nextFormatter,\n intlayerToICUFormatter,\n intlayerToVueI18nFormatter,\n vueI18nToIntlayerFormatter,\n} from '@intlayer/core/messageFormat';\nimport type { Dictionary } from '@intlayer/types';\n\nexport const formatDictionary = (dictionary: Dictionary): Dictionary => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: icuToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: i18nextToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: vueI18nToIntlayerFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionaries = (dictionaries: Dictionary[]): Dictionary[] =>\n dictionaries.map(formatDictionary);\n\nexport const formatDictionaryOutput = (dictionary: Dictionary) => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'icu',\n content: intlayerToICUFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'i18next',\n content: intlayerToI18nextFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'vue-i18n',\n content: intlayerToVueI18nFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionariesOutput = (dictionaries: Dictionary[]) =>\n dictionaries.map(formatDictionaryOutput);\n"],"mappings":"6JAUA,MAAa,EAAoB,GAC3B,EAAW,SAAW,MACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,wBAAgC,EAAW,QAAQ,CACpD,CAGC,EAAW,SAAW,UACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGC,EAAW,SAAW,WACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGI,EAGI,EAAsB,GACjC,EAAa,IAAI,EAAiB,CAEvB,EAA0B,GACjC,EAAW,SAAW,MACjB,CACL,GAAG,EACH,OAAQ,MACR,SAAA,EAAA,EAAA,wBAAgC,EAAW,QAAQ,CACpD,CAGC,EAAW,SAAW,UACjB,CACL,GAAG,EACH,OAAQ,UACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGC,EAAW,SAAW,WACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGI,EAGI,EAA4B,GACvC,EAAa,IAAI,EAAuB"}
|
|
1
|
+
{"version":3,"file":"formatDictionary.cjs","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":["import {\n i18nextToIntlayerFormatter,\n icuToIntlayerFormatter,\n intlayerToI18nextFormatter,\n intlayerToICUFormatter,\n intlayerToVueI18nFormatter,\n vueI18nToIntlayerFormatter,\n} from '@intlayer/core/messageFormat';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const formatDictionary = (dictionary: Dictionary): Dictionary => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: icuToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: i18nextToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: vueI18nToIntlayerFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionaries = (dictionaries: Dictionary[]): Dictionary[] =>\n dictionaries.map(formatDictionary);\n\nexport const formatDictionaryOutput = (dictionary: Dictionary) => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'icu',\n content: intlayerToICUFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'i18next',\n content: intlayerToI18nextFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'vue-i18n',\n content: intlayerToVueI18nFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionariesOutput = (dictionaries: Dictionary[]) =>\n dictionaries.map(formatDictionaryOutput);\n"],"mappings":"6JAUA,MAAa,EAAoB,GAC3B,EAAW,SAAW,MACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,wBAAgC,EAAW,QAAQ,CACpD,CAGC,EAAW,SAAW,UACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGC,EAAW,SAAW,WACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGI,EAGI,EAAsB,GACjC,EAAa,IAAI,EAAiB,CAEvB,EAA0B,GACjC,EAAW,SAAW,MACjB,CACL,GAAG,EACH,OAAQ,MACR,SAAA,EAAA,EAAA,wBAAgC,EAAW,QAAQ,CACpD,CAGC,EAAW,SAAW,UACjB,CACL,GAAG,EACH,OAAQ,UACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGC,EAAW,SAAW,WACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGI,EAGI,EAA4B,GACvC,EAAa,IAAI,EAAuB"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/config/utils`);const t=async(t,n,r={},i)=>{let a=(0,e.kebabCaseToCamelCase)(t),o=a.charAt(0).toLowerCase()+a.slice(1),s=Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>`\n ${/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)?e:JSON.stringify(e)}: ${typeof t==`object`||typeof t==`string`?JSON.stringify(t):t},`).join(``),c;c=i?`{}`:n===`json`||n===`jsonc`||n===`json5`?[`{`,` "$schema": "https://intlayer.org/schema.json",`,` "key": "${t}",${s}`,` "content": {`,` }`,`}`].join(`
|
|
2
|
+
`):[`{`,` key: '${t}',${s}`,` content: {`,` },`,`}`].join(`
|
|
3
|
+
`);let l=`/** @type {import('intlayer').Dictionary${i?`['content']`:``}} **/`,u=i?`Dictionary['content']`:`Dictionary`;switch(n){case`ts`:return[`import { type Dictionary } from 'intlayer';`,``,`const ${o}Content = ${c} satisfies ${u};`,``,`export default ${o}Content;`,``].join(`
|
|
4
|
+
`);case`cjs`:return[l,`const ${o}Content = ${c};`,``,`module.exports = ${o}Content;`,``].join(`
|
|
5
|
+
`);case`json`:case`jsonc`:case`json5`:return[c,``].join(`
|
|
6
|
+
`);default:return[l,`const ${o}Content = ${c};`,``,`export default ${o}Content;`,``].join(`
|
|
7
|
+
`)}};exports.getContentDeclarationFileTemplate=t;
|
|
2
8
|
//# sourceMappingURL=getContentDeclarationFileTemplate.cjs.map
|
package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContentDeclarationFileTemplate.cjs","names":[
|
|
1
|
+
{"version":3,"file":"getContentDeclarationFileTemplate.cjs","names":[],"sources":["../../../src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts"],"sourcesContent":["import { kebabCaseToCamelCase } from '@intlayer/config/utils';\nimport type { Format } from '../utils/getFormatFromExtension';\n\nexport const getContentDeclarationFileTemplate = async (\n key: string,\n format: Format,\n fileParams: Record<string, any> = {},\n noMetadata?: boolean\n) => {\n const camelCaseKey = kebabCaseToCamelCase(key);\n const name = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\n const fileParamsString = Object.entries(fileParams)\n .filter(([, value]) => value !== undefined)\n .map(([paramKey, value]) => {\n const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(paramKey)\n ? paramKey\n : JSON.stringify(paramKey);\n\n const formattedValue =\n typeof value === 'object' || typeof value === 'string'\n ? JSON.stringify(value)\n : value;\n\n return `\\n ${formattedKey}: ${formattedValue},`;\n })\n .join('');\n\n let content: string;\n\n if (noMetadata) {\n content = '{}';\n } else if (format === 'json' || format === 'jsonc' || format === 'json5') {\n content = [\n '{',\n ' \"$schema\": \"https://intlayer.org/schema.json\",',\n ` \"key\": \"${key}\",${fileParamsString}`,\n ' \"content\": {',\n ' }',\n '}',\n ].join('\\n');\n } else {\n content = [\n '{',\n ` key: '${key}',${fileParamsString}`,\n ' content: {',\n ' },',\n '}',\n ].join('\\n');\n }\n\n const jsdoc = `/** @type {import('intlayer').Dictionary${noMetadata ? \"['content']\" : ''}} **/`;\n const satisfiesType = noMetadata ? \"Dictionary['content']\" : 'Dictionary';\n\n switch (format) {\n case 'ts':\n return [\n \"import { type Dictionary } from 'intlayer';\",\n '',\n `const ${name}Content = ${content} satisfies ${satisfiesType};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'cjs':\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `module.exports = ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'json':\n case 'jsonc':\n case 'json5':\n return [content, ''].join('\\n');\n\n default: // esm\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n }\n};\n"],"mappings":"wJAGA,MAAa,EAAoC,MAC/C,EACA,EACA,EAAkC,EAAE,CACpC,IACG,CACH,IAAM,GAAA,EAAA,EAAA,sBAAoC,EAAI,CACxC,EAAO,EAAa,OAAO,EAAE,CAAC,aAAa,CAAG,EAAa,MAAM,EAAE,CAEnE,EAAmB,OAAO,QAAQ,EAAW,CAChD,QAAQ,EAAG,KAAW,IAAU,IAAA,GAAU,CAC1C,KAAK,CAAC,EAAU,KAUR,OATc,6BAA6B,KAAK,EAAS,CAC5D,EACA,KAAK,UAAU,EAAS,CAOD,IAJzB,OAAO,GAAU,UAAY,OAAO,GAAU,SAC1C,KAAK,UAAU,EAAM,CACrB,EAEwC,GAC9C,CACD,KAAK,GAAG,CAEP,EAEJ,AAYE,EAZE,EACQ,KACD,IAAW,QAAU,IAAW,SAAW,IAAW,QACrD,CACR,IACA,mDACA,aAAa,EAAI,IAAI,IACrB,iBACA,MACA,IACD,CAAC,KAAK;EAAK,CAEF,CACR,IACA,WAAW,EAAI,IAAI,IACnB,eACA,OACA,IACD,CAAC,KAAK;EAAK,CAGd,IAAM,EAAQ,2CAA2C,EAAa,cAAgB,GAAG,OACnF,EAAgB,EAAa,wBAA0B,aAE7D,OAAQ,EAAR,CACE,IAAK,KACH,MAAO,CACL,8CACA,GACA,SAAS,EAAK,YAAY,EAAQ,aAAa,EAAc,GAC7D,GACA,kBAAkB,EAAK,UACvB,GACD,CAAC,KAAK;EAAK,CAEd,IAAK,MACH,MAAO,CACL,EACA,SAAS,EAAK,YAAY,EAAQ,GAClC,GACA,oBAAoB,EAAK,UACzB,GACD,CAAC,KAAK;EAAK,CAEd,IAAK,OACL,IAAK,QACL,IAAK,QACH,MAAO,CAAC,EAAS,GAAG,CAAC,KAAK;EAAK,CAEjC,QACE,MAAO,CACL,EACA,SAAS,EAAK,YAAY,EAAQ,GAClC,GACA,kBAAkB,EAAK,UACvB,GACD,CAAC,KAAK;EAAK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`),t=require(`./utils/formatter.cjs`),n=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),r=require(`./createType/createModuleAugmentation.cjs`),i=require(`./createType/createType.cjs`),a=require(`./loadDictionaries/loadLocalDictionaries.cjs`);let o=require(`@intlayer/config/logger`);const s=async(s,c)=>{let l=(0,o.getAppLogger)(c);l(`Additional file detected: ${t.formatPath(s)}`,{isVerbose:!0});let u=await n.buildDictionary(await a.loadLocalDictionaries(s,c),c);await i.createTypes(Object.values(u?.mergedDictionaries??{}).map(e=>e.dictionary),c),await e.createDictionaryEntryPoint(c),l(`Dictionaries built`,{isVerbose:!0}),r.createModuleAugmentation(c),l(`Module augmentation built`,{isVerbose:!0});for await(let e of c.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=u;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:c})}};exports.handleAdditionalContentDeclarationFile=s;
|
|
2
2
|
//# sourceMappingURL=handleAdditionalContentDeclarationFile.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleAdditionalContentDeclarationFile.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","createTypes","createDictionaryEntryPoint"],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"ueAQA,MAAa,EAAyC,MACpD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,6BAA6BA,EAAAA,WAAW,EAAS,GAAI,CAC7D,UAAW,GACZ,CAAC,CAIF,IAAM,EAAqB,MAAMC,EAAAA,gBAFN,MAAMC,EAAAA,sBAAsB,EAAU,EAAO,CAEH,EAAO,CAM5E,MAAMC,EAAAA,YAJsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CAAC,IAAK,GAAe,EAAW,WAAW,CAEL,EAAO,CAE9C,MAAMC,EAAAA,2BAA2B,EAAO,CAExC,EAAU,qBAAsB,CAC9B,UAAW,GACZ,CAAC,CAEF,EAAA,yBAAyB,EAAO,CAEhC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,CAIF,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"handleAdditionalContentDeclarationFile.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","createTypes","createDictionaryEntryPoint"],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"ueAQA,MAAa,EAAyC,MACpD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,6BAA6BA,EAAAA,WAAW,EAAS,GAAI,CAC7D,UAAW,GACZ,CAAC,CAIF,IAAM,EAAqB,MAAMC,EAAAA,gBAFN,MAAMC,EAAAA,sBAAsB,EAAU,EAAO,CAEH,EAAO,CAM5E,MAAMC,EAAAA,YAJsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CAAC,IAAK,GAAe,EAAW,WAAW,CAEL,EAAO,CAE9C,MAAMC,EAAAA,2BAA2B,EAAO,CAExC,EAAU,qBAAsB,CAC9B,UAAW,GACZ,CAAC,CAEF,EAAA,yBAAyB,EAAO,CAEhC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,CAIF,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./createDictionaryEntryPoint/getBuiltDictionariesPath.cjs`),t=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`),n=require(`./cleanRemovedContentDeclaration.cjs`),r=require(`./utils/formatter.cjs`),i=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),a=require(`./createType/createModuleAugmentation.cjs`),o=require(`./createType/createType.cjs`),s=require(`./loadDictionaries/loadLocalDictionaries.cjs`);let c=require(`@intlayer/config/logger`);const l=async(l,u)=>{let d=(0,c.getAppLogger)(u);d(`Change detected: ${r.formatPath(l)}`,{isVerbose:!0});let f=await e.getBuiltDictionariesPath(u),p=await s.loadLocalDictionaries(l,u),m=await i.buildDictionary(p,u),h=Object.values(m?.mergedDictionaries??{}),g=h.map(e=>e.dictionaryPath),{excludeKeys:_,hasRebuilt:v}=await n.cleanRemovedContentDeclaration(l,p.map(e=>e.key),u),y=g.some(e=>!f.includes(e));(v||y)&&(v||(await t.createDictionaryEntryPoint(u,{excludeKeys:_}),d(`Dictionary list built`,{isVerbose:!0}))),await o.createTypes(h.map(e=>e.dictionary),u),d(`TypeScript types built`,{isVerbose:!0}),y&&(await a.createModuleAugmentation(u),d(`Module augmentation built`,{isVerbose:!0}));for await(let e of u.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=m;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:u})}};exports.handleContentDeclarationFileChange=l;
|
|
2
2
|
//# sourceMappingURL=handleContentDeclarationFileChange.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleContentDeclarationFileChange.cjs","names":["formatPath","getBuiltDictionariesPath","loadLocalDictionaries","buildDictionary","cleanRemovedContentDeclaration","createDictionaryEntryPoint","createTypes","createModuleAugmentation"],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const allDictionariesPaths: string[] = await getBuiltDictionariesPath(config);\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionaries = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n );\n const updatedDictionariesPaths = updatedDictionaries.map(\n (dictionary) => dictionary.dictionaryPath\n );\n\n const { excludeKeys, hasRebuilt } = await cleanRemovedContentDeclaration(\n filePath,\n localeDictionaries.map((dictionary) => dictionary.key),\n config\n );\n\n const hasNewDictionaries = updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n );\n\n // Rebuild Entry Point & Module Augmentation\n // These only need to be updated if the *list* of dictionaries changed (Add/Remove/Rename)\n if (hasRebuilt || hasNewDictionaries) {\n // If hasRebuilt is true, cleanRemovedContentDeclaration has already updated the entry point\n // to remove the old keys (and it likely included the new ones if they were already on disk).\n // If NOT hasRebuilt, we explicitly need to update the entry point to include the new dictionaries.\n if (!hasRebuilt) {\n await createDictionaryEntryPoint(config, { excludeKeys });\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n }\n\n // Rebuild Types\n // Always regenerate types when a file changes, as the content structure (interface) might have changed\n // even if the key is the same.\n const dictionariesToBuild = updatedDictionaries.map(\n (dictionary) => dictionary.dictionary\n );\n\n await createTypes(dictionariesToBuild, config);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (hasNewDictionaries) {\n await createModuleAugmentation(config);\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n }\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"gmBAWA,MAAa,EAAqC,MAChD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,oBAAoBA,EAAAA,WAAW,EAAS,GAAI,CACpD,UAAW,GACZ,CAAC,CAEF,IAAM,EAAiC,MAAMC,EAAAA,yBAAyB,EAAO,CAEvE,EAAqB,MAAMC,EAAAA,sBAAsB,EAAU,EAAO,CAElE,EAAqB,MAAMC,EAAAA,gBAAgB,EAAoB,EAAO,CACtE,EAAsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CACK,EAA2B,EAAoB,IAClD,GAAe,EAAW,eAC5B,CAEK,CAAE,cAAa,cAAe,MAAMC,EAAAA,+BACxC,EACA,EAAmB,IAAK,GAAe,EAAW,IAAI,CACtD,EACD,CAEK,EAAqB,EAAyB,KACjD,GACC,CAAC,EAAqB,SAAS,EAAsB,CACxD,EAIG,GAAc,KAIX,IACH,MAAMC,EAAAA,2BAA2B,EAAQ,CAAE,cAAa,CAAC,CACzD,EAAU,wBAAyB,CACjC,UAAW,GACZ,CAAC,GAWN,MAAMC,EAAAA,YAJsB,EAAoB,IAC7C,GAAe,EAAW,WAC5B,CAEsC,EAAO,CAC9C,EAAU,yBAA0B,CAClC,UAAW,GACZ,CAAC,CAEE,IACF,MAAMC,EAAAA,yBAAyB,EAAO,CACtC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,EAKJ,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"handleContentDeclarationFileChange.cjs","names":["formatPath","getBuiltDictionariesPath","loadLocalDictionaries","buildDictionary","cleanRemovedContentDeclaration","createDictionaryEntryPoint","createTypes","createModuleAugmentation"],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const allDictionariesPaths: string[] = await getBuiltDictionariesPath(config);\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionaries = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n );\n const updatedDictionariesPaths = updatedDictionaries.map(\n (dictionary) => dictionary.dictionaryPath\n );\n\n const { excludeKeys, hasRebuilt } = await cleanRemovedContentDeclaration(\n filePath,\n localeDictionaries.map((dictionary) => dictionary.key),\n config\n );\n\n const hasNewDictionaries = updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n );\n\n // Rebuild Entry Point & Module Augmentation\n // These only need to be updated if the *list* of dictionaries changed (Add/Remove/Rename)\n if (hasRebuilt || hasNewDictionaries) {\n // If hasRebuilt is true, cleanRemovedContentDeclaration has already updated the entry point\n // to remove the old keys (and it likely included the new ones if they were already on disk).\n // If NOT hasRebuilt, we explicitly need to update the entry point to include the new dictionaries.\n if (!hasRebuilt) {\n await createDictionaryEntryPoint(config, { excludeKeys });\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n }\n\n // Rebuild Types\n // Always regenerate types when a file changes, as the content structure (interface) might have changed\n // even if the key is the same.\n const dictionariesToBuild = updatedDictionaries.map(\n (dictionary) => dictionary.dictionary\n );\n\n await createTypes(dictionariesToBuild, config);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (hasNewDictionaries) {\n await createModuleAugmentation(config);\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n }\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"gmBAWA,MAAa,EAAqC,MAChD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,oBAAoBA,EAAAA,WAAW,EAAS,GAAI,CACpD,UAAW,GACZ,CAAC,CAEF,IAAM,EAAiC,MAAMC,EAAAA,yBAAyB,EAAO,CAEvE,EAAqB,MAAMC,EAAAA,sBAAsB,EAAU,EAAO,CAElE,EAAqB,MAAMC,EAAAA,gBAAgB,EAAoB,EAAO,CACtE,EAAsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CACK,EAA2B,EAAoB,IAClD,GAAe,EAAW,eAC5B,CAEK,CAAE,cAAa,cAAe,MAAMC,EAAAA,+BACxC,EACA,EAAmB,IAAK,GAAe,EAAW,IAAI,CACtD,EACD,CAEK,EAAqB,EAAyB,KACjD,GACC,CAAC,EAAqB,SAAS,EAAsB,CACxD,EAIG,GAAc,KAIX,IACH,MAAMC,EAAAA,2BAA2B,EAAQ,CAAE,cAAa,CAAC,CACzD,EAAU,wBAAyB,CACjC,UAAW,GACZ,CAAC,GAWN,MAAMC,EAAAA,YAJsB,EAAoB,IAC7C,GAAe,EAAW,WAC5B,CAEsC,EAAO,CAC9C,EAAU,yBAA0B,CAClC,UAAW,GACZ,CAAC,CAEE,IACF,MAAMC,EAAAA,yBAAyB,EAAO,CACtC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,EAKJ,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./cleanRemovedContentDeclaration.cjs`),t=require(`./utils/formatter.cjs`),n=require(`./loadDictionaries/loadLocalDictionaries.cjs`),r=require(`./handleContentDeclarationFileChange.cjs`);let i=require(`@intlayer/config/logger`);const a=async(a,o,s)=>{let c=(0,i.getAppLogger)(s);c(`File moved from ${t.formatPath(a)} to ${t.formatPath(o)}`,{isVerbose:!0});let l=[];try{l=(await n.loadLocalDictionaries(o,s)).map(e=>e.key)}catch{c(`Error parsing new file during move operation: ${t.formatPath(o)}`,{isVerbose:!0})}await e.cleanRemovedContentDeclaration(a,l,s),await r.handleContentDeclarationFileChange(o,s)};exports.handleContentDeclarationFileMoved=a;
|
|
2
2
|
//# sourceMappingURL=handleContentDeclarationFileMoved.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleContentDeclarationFileMoved.cjs","names":["formatPath","loadLocalDictionaries","cleanRemovedContentDeclaration","handleContentDeclarationFileChange"],"sources":["../../src/handleContentDeclarationFileMoved.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileMoved = async (\n oldFilePath: string,\n newFilePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n appLogger(\n `File moved from ${formatPath(oldFilePath)} to ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n\n let keysToKeep: string[] = [];\n\n try {\n // Pre-load the new file to identify the keys inside it.\n // We need to pass these keys to the cleaner so it knows NOT to completely delete\n // the dictionary artifacts (types/json) if the key has simply moved to a new file.\n const newLocaleDictionaries = await loadLocalDictionaries(\n newFilePath,\n config\n );\n keysToKeep = newLocaleDictionaries.map((d) => d.key);\n } catch {\n appLogger(\n `Error parsing new file during move operation: ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n // Proceed with empty keysToKeep; this will result in the old dictionary being cleaned up\n // entirely, and the new one being re-created in the next step.\n }\n\n // Clean up the artifacts associated with the old file path.\n // By passing 'keysToKeep', we instruct the cleaner to remove the specific file association\n // (filePath reference) from the dictionaries, but preserve the dictionary Entry Point and Types\n // if the key is still present in the new file.\n await cleanRemovedContentDeclaration(oldFilePath, keysToKeep, config);\n\n // Process the new file.\n // This will add the new file association, rebuild the dictionary JSONs with the new path,\n // and ensure types and module augmentation are up to date.\n await handleContentDeclarationFileChange(newFilePath, config);\n};\n"],"mappings":"mWAOA,MAAa,EAAoC,MAC/C,EACA,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAEtC,EACE,mBAAmBA,EAAAA,WAAW,EAAY,CAAC,MAAMA,EAAAA,WAAW,EAAY,GACxE,CACE,UAAW,GACZ,CACF,CAED,IAAI,EAAuB,EAAE,CAE7B,GAAI,CAQF,GAJ8B,MAAMC,EAAAA,sBAClC,EACA,EACD,EACkC,IAAK,GAAM,EAAE,IAAI,MAC9C,CACN,EACE,iDAAiDD,EAAAA,WAAW,EAAY,GACxE,CACE,UAAW,GACZ,CACF,CASH,MAAME,EAAAA,+BAA+B,EAAa,EAAY,EAAO,CAKrE,MAAMC,EAAAA,mCAAmC,EAAa,EAAO"}
|
|
1
|
+
{"version":3,"file":"handleContentDeclarationFileMoved.cjs","names":["formatPath","loadLocalDictionaries","cleanRemovedContentDeclaration","handleContentDeclarationFileChange"],"sources":["../../src/handleContentDeclarationFileMoved.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileMoved = async (\n oldFilePath: string,\n newFilePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n appLogger(\n `File moved from ${formatPath(oldFilePath)} to ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n\n let keysToKeep: string[] = [];\n\n try {\n // Pre-load the new file to identify the keys inside it.\n // We need to pass these keys to the cleaner so it knows NOT to completely delete\n // the dictionary artifacts (types/json) if the key has simply moved to a new file.\n const newLocaleDictionaries = await loadLocalDictionaries(\n newFilePath,\n config\n );\n keysToKeep = newLocaleDictionaries.map((d) => d.key);\n } catch {\n appLogger(\n `Error parsing new file during move operation: ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n // Proceed with empty keysToKeep; this will result in the old dictionary being cleaned up\n // entirely, and the new one being re-created in the next step.\n }\n\n // Clean up the artifacts associated with the old file path.\n // By passing 'keysToKeep', we instruct the cleaner to remove the specific file association\n // (filePath reference) from the dictionaries, but preserve the dictionary Entry Point and Types\n // if the key is still present in the new file.\n await cleanRemovedContentDeclaration(oldFilePath, keysToKeep, config);\n\n // Process the new file.\n // This will add the new file association, rebuild the dictionary JSONs with the new path,\n // and ensure types and module augmentation are up to date.\n await handleContentDeclarationFileChange(newFilePath, config);\n};\n"],"mappings":"mWAOA,MAAa,EAAoC,MAC/C,EACA,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAEtC,EACE,mBAAmBA,EAAAA,WAAW,EAAY,CAAC,MAAMA,EAAAA,WAAW,EAAY,GACxE,CACE,UAAW,GACZ,CACF,CAED,IAAI,EAAuB,EAAE,CAE7B,GAAI,CAQF,GAJ8B,MAAMC,EAAAA,sBAClC,EACA,EACD,EACkC,IAAK,GAAM,EAAE,IAAI,MAC9C,CACN,EACE,iDAAiDD,EAAAA,WAAW,EAAY,GACxE,CACE,UAAW,GACZ,CACF,CASH,MAAME,EAAAA,+BAA+B,EAAa,EAAY,EAAO,CAKrE,MAAMC,EAAAA,mCAAmC,EAAa,EAAO"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./cleanRemovedContentDeclaration.cjs`),t=require(`./utils/formatter.cjs`),n=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),r=require(`./createType/createModuleAugmentation.cjs`),i=require(`./createType/createType.cjs`),a=require(`./loadDictionaries/loadLocalDictionaries.cjs`),o=require(`./listDictionariesPath.cjs`);let s=require(`node:path`),c=require(`@intlayer/config/logger`);const l=async(l,u)=>{let d=(0,c.getAppLogger)(u);d(`Unlinked detected: ${t.formatPath(l)}`,{isVerbose:!0});let f=await a.loadLocalDictionaries((await o.listDictionaries(u)).filter(e=>(0,s.normalize)(e)!==(0,s.normalize)(l)),u);await e.cleanRemovedContentDeclaration(l,[],u);let p=await n.buildDictionary(f,u);await i.createTypes(Object.values(p?.mergedDictionaries??{}).map(e=>e.dictionary),u),d(`Dictionaries rebuilt`,{isVerbose:!0}),await r.createModuleAugmentation(u),d(`Module augmentation built`,{isVerbose:!0});for await(let e of u.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=p;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:u})}};exports.handleUnlinkedContentDeclarationFile=l;
|
|
2
2
|
//# sourceMappingURL=handleUnlinkedContentDeclarationFile.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleUnlinkedContentDeclarationFile.cjs","names":["formatPath","loadLocalDictionaries","listDictionaries","cleanRemovedContentDeclaration","buildDictionary","createTypes","createModuleAugmentation"],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { normalize } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleUnlinkedContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = await listDictionaries(config);\n\n const existingFiles = files.filter(\n (file) => normalize(file) !== normalize(filePath)\n );\n\n const localeDictionaries = await loadLocalDictionaries(existingFiles, config);\n\n await cleanRemovedContentDeclaration(filePath, [], config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"+gBAWA,MAAa,EAAuC,MAClD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,sBAAsBA,EAAAA,WAAW,EAAS,GAAI,CACtD,UAAW,GACZ,CAAC,CAQF,IAAM,EAAqB,MAAMC,EAAAA,uBANT,MAAMC,EAAAA,iBAAiB,EAAO,EAE1B,OACzB,IAAA,EAAA,EAAA,WAAmB,EAAK,IAAA,EAAA,EAAA,WAAe,EAAS,CAClD,CAEqE,EAAO,CAE7E,MAAMC,EAAAA,+BAA+B,EAAU,EAAE,CAAE,EAAO,CAE1D,IAAM,EAAqB,MAAMC,EAAAA,gBAAgB,EAAoB,EAAO,CAM5E,MAAMC,EAAAA,YAJsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CAAC,IAAK,GAAe,EAAW,WAAW,CAEL,EAAO,CAE9C,EAAU,uBAAwB,CAChC,UAAW,GACZ,CAAC,CAEF,MAAMC,EAAAA,yBAAyB,EAAO,CAEtC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,CAIF,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"handleUnlinkedContentDeclarationFile.cjs","names":["formatPath","loadLocalDictionaries","listDictionaries","cleanRemovedContentDeclaration","buildDictionary","createTypes","createModuleAugmentation"],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { normalize } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleUnlinkedContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = await listDictionaries(config);\n\n const existingFiles = files.filter(\n (file) => normalize(file) !== normalize(filePath)\n );\n\n const localeDictionaries = await loadLocalDictionaries(existingFiles, config);\n\n await cleanRemovedContentDeclaration(filePath, [], config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"+gBAWA,MAAa,EAAuC,MAClD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,sBAAsBA,EAAAA,WAAW,EAAS,GAAI,CACtD,UAAW,GACZ,CAAC,CAQF,IAAM,EAAqB,MAAMC,EAAAA,uBANT,MAAMC,EAAAA,iBAAiB,EAAO,EAE1B,OACzB,IAAA,EAAA,EAAA,WAAmB,EAAK,IAAA,EAAA,EAAA,WAAe,EAAS,CAClD,CAEqE,EAAO,CAE7E,MAAMC,EAAAA,+BAA+B,EAAU,EAAE,CAAE,EAAO,CAE1D,IAAM,EAAqB,MAAMC,EAAAA,gBAAgB,EAAoB,EAAO,CAM5E,MAAMC,EAAAA,YAJsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CAAC,IAAK,GAAe,EAAW,WAAW,CAEL,EAAO,CAE9C,EAAU,uBAAwB,CAChC,UAAW,GACZ,CAAC,CAEF,MAAMC,EAAAA,yBAAyB,EAAO,CAEtC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,CAIF,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
|
package/dist/cjs/init/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../initConfig/index.cjs`),t=require(`./utils/configManipulation.cjs`),n=require(`./utils/fileSystem.cjs`),r=require(`./utils/jsonParser.cjs`),i=require(`./utils/tsConfig.cjs`);let a=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../initConfig/index.cjs`),t=require(`./utils/configManipulation.cjs`),n=require(`./utils/fileSystem.cjs`),r=require(`./utils/jsonParser.cjs`),i=require(`./utils/tsConfig.cjs`);let a=require(`node:path`),o=require(`@intlayer/config/logger`),s=require(`@intlayer/config/node`),c=require(`@intlayer/config/utils`);const l={NextJS:`https://intlayer.org/doc/environment/nextjs.md`,NextJS_15:`https://intlayer.org/doc/environment/nextjs/15.md`,NextJS_14:`https://intlayer.org/doc/environment/nextjs/14.md`,CRA:`https://intlayer.org/doc/environment/create-react-app.md`,Astro:`https://intlayer.org/doc/environment/astro.md`,ViteAndReact:`https://intlayer.org/doc/environment/vite-and-react.md`,ViteAndReact_ReactRouterV7:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md`,ViteAndReact_ReactRouterV7_FSRoutes:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md`,ViteAndVue:`https://intlayer.org/doc/environment/vite-and-vue.md`,ViteAndSolid:`https://intlayer.org/doc/environment/vite-and-solid.md`,ViteAndSvelte:`https://intlayer.org/doc/environment/vite-and-svelte.md`,ViteAndPreact:`https://intlayer.org/doc/environment/vite-and-preact.md`,TanStackRouter:`https://intlayer.org/doc/environment/tanstack.md`,NuxtAndVue:`https://intlayer.org/doc/environment/nuxt-and-vue.md`,Angular:`https://intlayer.org/doc/environment/angular.md`,SvelteKit:`https://intlayer.org/doc/environment/sveltekit.md`,ReactNativeAndExpo:`https://intlayer.org/doc/environment/react-native-and-expo.md`,Lynx:`https://intlayer.org/doc/environment/lynx-and-react.md`,Express:`https://intlayer.org/doc/environment/express.md`,NestJS:`https://intlayer.org/doc/environment/nestjs.md`,Fastify:`https://intlayer.org/doc/environment/fastify.md`,Default:`https://intlayer.org/doc/get-started`,NextIntl:`https://intlayer.org/blog/intlayer-with-next-intl.md`,ReactI18Next:`https://intlayer.org/blog/intlayer-with-react-i18next.md`,ReactIntl:`https://intlayer.org/blog/intlayer-with-react-intl.md`,NextI18Next:`https://intlayer.org/blog/intlayer-with-next-i18next.md`,VueI18n:`https://intlayer.org/blog/intlayer-with-vue-i18n.md`},u=e=>{let t={...e.dependencies,...e.devDependencies},n=(e,t)=>!e||typeof e!=`string`?!1:RegExp(`^[\\^~]?${t}(?:\\.|$)`).test(e);if(t[`@lynx-js/react`]||t[`@lynx-js/core`])return l.Lynx;if(t[`react-native`]||t.expo)return l.ReactNativeAndExpo;if(t.next){let e=t.next;return n(e,14)?l.NextJS_14:n(e,15)?l.NextJS_15:l.NextJS}if(t.nuxt)return l.NuxtAndVue;if(t.astro)return l.Astro;if(t[`@sveltejs/kit`])return l.SvelteKit;if(t[`@tanstack/react-router`])return l.TanStackRouter;let r=t[`react-router`];if(r&&typeof r==`string`){if(t[`@react-router/fs-routes`])return l.ViteAndReact_ReactRouterV7_FSRoutes;if(n(r,7))return l.ViteAndReact_ReactRouterV7}return t.vite?t.vue?l.ViteAndVue:t[`solid-js`]?l.ViteAndSolid:t.svelte?l.ViteAndSvelte:t.preact?l.ViteAndPreact:l.ViteAndReact:t[`react-scripts`]?l.CRA:t[`@angular/core`]?l.Angular:t[`@nestjs/core`]?l.NestJS:t.express?l.Express:t.fastify?l.Fastify:t[`next-intl`]?l.NextIntl:t[`react-i18next`]||t.i18next?l.ReactI18Next:t[`react-intl`]?l.ReactIntl:t[`next-i18next`]?l.NextI18Next:t[`vue-i18n`]?l.VueI18n:l.Default},d=async l=>{(0,o.logger)((0,o.colorize)(`Checking Intlayer configuration...`,o.ANSIColors.CYAN));let d=`package.json`;await n.exists(l,d)||((0,o.logger)(`${o.x} No ${(0,o.colorizePath)(`package.json`)} found. Please run this script from the project root.`,{level:`error`}),process.exit(1));let f=await n.readFileFromRoot(l,d),p;try{p=JSON.parse(f)}catch{(0,o.logger)(`${o.x} Could not parse ${(0,o.colorizePath)(`package.json`)}.`,{level:`error`}),process.exit(1)}let m=u(p),h=`.gitignore`;if(await n.exists(l,h)){let e=await n.readFileFromRoot(l,h);e.includes(`intlayer`)?(0,o.logger)(`${o.v} ${(0,o.colorizePath)(h)} already includes .intlayer`):(await n.writeFileToRoot(l,h,`${e}\n# Intlayer\n.intlayer\n`),(0,o.logger)(`${o.v} Added ${(0,o.colorizePath)(`.intlayer`)} to ${(0,o.colorizePath)(h)}`))}let g=`.vscode`,_=(0,a.join)(g,`extensions.json`),v=`intlayer.intlayer-vs-code-extension`;try{let e={recommendations:[]};await n.exists(l,_)?e=r.parseJSONWithComments(await n.readFileFromRoot(l,_)):await n.ensureDirectory(l,g),e.recommendations||=[],e.recommendations.includes(v)?(0,o.logger)(`${o.v} ${(0,o.colorizePath)(_)} already includes ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)}`):(e.recommendations.push(v),await n.writeFileToRoot(l,_,JSON.stringify(e,null,2)),(0,o.logger)(`${o.v} Added ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)} to ${(0,o.colorizePath)(_)}`))}catch{(0,o.logger)(`${o.x} Could not update ${(0,o.colorizePath)(_)}. You may need to add ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)} manually.`,{level:`warn`})}let y=await i.findTsConfigFiles(l),b=!1;for(let e of y)if(await n.exists(l,e)){b=!0;try{let t=r.parseJSONWithComments(await n.readFileFromRoot(l,e)),i=`.intlayer/**/*.ts`,a=!1;t.include&&(Array.isArray(t.include)&&!t.include.some(e=>e.includes(`.intlayer`))?(t.include.push(i),a=!0):t.include.includes(i)&&(0,o.logger)(`${o.v} ${(0,o.colorizePath)(e)} already includes intlayer types`)),a&&(await n.writeFileToRoot(l,e,JSON.stringify(t,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include intlayer types`))}catch{(0,o.logger)(`${o.x} Could not parse or update ${(0,o.colorizePath)(e)}. You may need to add ${(0,o.colorizePath)(`.intlayer/types/**/*.ts`)} manually.`,{level:`warn`})}}await e.initConfig(b?`intlayer.config.ts`:`intlayer.config.mjs`,l);let x=!1;for(let e of[`vite.config.ts`,`vite.config.js`,`vite.config.mjs`])if(await n.exists(l,e)){x=!0;let r=await n.readFileFromRoot(l,e);r.includes(`vite-intlayer`)||(await n.writeFileToRoot(l,e,t.updateViteConfig(r,e.split(`.`).pop())),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include Intlayer plugin`));break}for(let e of[`next.config.js`,`next.config.mjs`,`next.config.ts`])if(await n.exists(l,e)){x=!0;let r=await n.readFileFromRoot(l,e);r.includes(`next-intlayer`)||(await n.writeFileToRoot(l,e,t.updateNextConfig(r,e.split(`.`).pop())),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include Intlayer plugin`));break}for(let e of[`webpack.config.js`,`webpack.config.ts`,`webpack.config.mjs`,`webpack.config.cjs`])if(await n.exists(l,e)){x=!0,(0,o.logger)(`${o.v} Found ${(0,o.colorizePath)(e)}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`);break}if(!x){let e=(0,c.getAlias)({configuration:(0,s.getConfiguration)({baseDir:l})});if(b&&y.length>0){let t=y.find(e=>e===`tsconfig.json`)||y[0],i=r.parseJSONWithComments(await n.readFileFromRoot(l,t));i.compilerOptions??={},i.compilerOptions.paths??={};let a=!1;Object.entries(e).forEach(([e,t])=>{i.compilerOptions.paths[e]||(i.compilerOptions.paths[e]=[t],a=!0)}),a&&(await n.writeFileToRoot(l,t,JSON.stringify(i,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(t)} to include Intlayer aliases`))}else{let t=`jsconfig.json`;if(await n.exists(l,t)){let i=r.parseJSONWithComments(await n.readFileFromRoot(l,t));i.compilerOptions??={},i.compilerOptions.paths??={};let a=!1;Object.entries(e).forEach(([e,t])=>{i.compilerOptions.paths[e]||(i.compilerOptions.paths[e]=[t],a=!0)}),a&&(await n.writeFileToRoot(l,t,JSON.stringify(i,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(t)} to include Intlayer aliases`))}else{p.imports??={};let t=!1;Object.entries(e).forEach(([e,n])=>{let r=e.replace(`@`,`#`),i=n.startsWith(`.`)?n:`./${n}`;p.imports[r]||(p.imports[r]=i,t=!0)}),t&&(await n.writeFileToRoot(l,d,JSON.stringify(p,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(d)} to include Intlayer imports`))}}}(0,o.logger)(`${o.v} ${(0,o.colorize)(`Intlayer init setup complete.`,o.ANSIColors.GREEN)}`),(0,o.logger)([(0,o.colorize)(`Next →`,o.ANSIColors.MAGENTA),(0,o.colorize)(`Follow the instructions in the documentation to complete the setup:`,o.ANSIColors.GREY_LIGHT),(0,o.colorizePath)(m)])};exports.initIntlayer=d;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../_virtual/_utils_asset.cjs`);let t=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../_virtual/_utils_asset.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.readAsset(s(t.split(`.`).pop()))),(0,r.logger)(`Created ${t}`)};exports.initConfig=c;
|
|
2
2
|
//# sourceMappingURL=index.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';\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 { watchedFilesPatternWithPath, excludedPath } = configuration.content;\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":"+LASA,MAAa,EAAmB,KAC9B,IACsB,CACtB,GAAM,CAAE,8BAA6B,gBAAiB,EAAc,QAE9D,EAAe,EAA4B,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
|
+
{"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 { watchedFilesPatternWithPath, excludedPath } = configuration.content;\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":"+LASA,MAAa,EAAmB,KAC9B,IACsB,CACtB,GAAM,CAAE,8BAA6B,gBAAiB,EAAc,QAE9D,EAAe,EAA4B,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,6 +1,6 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`);let t=require(`node:path`),n=require(`@intlayer/config/logger`),r=require(`node:fs`),i=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`);let t=require(`node:path`),n=require(`@intlayer/config/logger`),r=require(`node:fs`),i=require(`simple-git`);i=e.__toESM(i);let a=require(`@intlayer/config/built`);a=e.__toESM(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
|
-
`).filter(Boolean).forEach(e=>{c.add(e)})),
|
|
5
|
-
`).forEach((e,t)=>{s.add(t+1)})}catch{}return t.includes(`uncommitted`)&&c(await o.diff([`--unified=0`,`HEAD`,`--`,e])),t.includes(`unpushed`)&&c(await o.diff([`--unified=0`,`@{push}...HEAD`,`--`,e])),t.includes(`gitDiff`)&&(await o.fetch(n),c(await o.diff([`--unified=0`,`${n}...${
|
|
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(`
|
|
5
|
+
`).forEach((e,t)=>{s.add(t+1)})}catch{}return t.includes(`uncommitted`)&&c(await o.diff([`--unified=0`,`HEAD`,`--`,e])),t.includes(`unpushed`)&&c(await o.diff([`--unified=0`,`@{push}...HEAD`,`--`,e])),t.includes(`gitDiff`)&&(await o.fetch(n),c(await o.diff([`--unified=0`,`${n}...${a}`,`--`,e]))),Array.from(s).sort((e,t)=>e-t)};exports.listGitFiles=s,exports.listGitLines=c;
|
|
6
6
|
//# sourceMappingURL=listGitFiles.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`);let t=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`);let t=require(`node:path`),n=require(`fast-glob`);n=e.__toESM(n);let r=require(`@intlayer/config/node`),i=require(`simple-git`);i=e.__toESM(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,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.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.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.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';\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.
|
|
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":"yQAmBA,MAAM,GACJ,EACA,KAEO,CACL,KAAM,gBACN,MAAM,EAAO,CACX,EAAM,UAAU,CAAE,OAAQ,KAAM,CAAG,GAAS,CAC1C,IAAM,EAAQ,EAAe,EAAK,MAElC,GAAI,GAAgB,SAAS,EAAK,KAAK,CACrC,OAAO,KAGT,GAAI,EACF,MAAO,CACL,KAAM,EACN,UAAW,2BACX,SAAU,GACX,CAIH,IAAK,IAAM,KAAO,OAAO,KAAK,EAAe,CAC3C,GAAI,EAAK,OAAS,GAAO,EAAK,KAAK,WAAW,GAAG,EAAI,GAAG,CAAE,CACxD,IAAM,EAAM,EAAK,KAAK,MAAM,EAAI,OAAO,CACvC,MAAO,CACL,KAAM,EAAe,GAAO,EAC5B,UAAW,2BACX,SAAU,GACX,GAGL,EAEL,EAMU,EAAoB,KAAO,IAAkC,CACxE,IAAM,GAAA,EAAA,EAAA,mBAAgC,EAAc,OAAO,QAAQ,CAC7D,EAAuBA,EAAAA,qBACvB,EAAeC,EAAAA,YAAAA,EAAAA,EAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KAA2C,CAAG,QAE7D,GAAA,EAAA,EAAA,MACJ,EAAc,OAAO,UACrB,qBACD,CAEK,EAAiB,CACrB,KAAM,EAAqB,QAAQ,OAAO,CAC1C,QAAS,EAAqB,QAAQ,UAAU,CAChD,yBAA0B,EAC1B,yBAA0B,EAAa,QAAQ,yBAAyB,CACxE,0BAA2B,EAAa,QAAQ,0BAA0B,CAC1E,0BAA2B,EAAa,QAAQ,0BAA0B,CAC1E,sBAAuB,EAAa,QAAQ,sBAAsB,CACnE,CAEK,EAAW,EAAY,QAAQ,WAAW,CAYhD,OATe,MAAA,EAAA,EAAA,YAFF,MAAA,EAAA,EAAA,UAAe,EAAU,QAAQ,CAER,EAAU,CAC9C,SAAU,CACR,GAAGC,EAAAA,eACH,GAAGA,EAAAA,eAAe,IAAK,GAAQ,QAAQ,IAAM,CAC9C,CACD,OAAQ,GACR,QAAS,CAAC,EAAmB,EAAe,CAAC,CAC9C,CAAC,EAEe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./loadContentDeclaration.cjs`),t=require(`./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./loadContentDeclaration.cjs`),t=require(`./loadLocalDictionaries.cjs`),n=require(`./loadRemoteDictionaries.cjs`),r=require(`./loadDictionaries.cjs`);exports.ensureIntlayerBundle=e.ensureIntlayerBundle,exports.formatDistantDictionaries=n.formatDistantDictionaries,exports.formatLocalDictionaries=e.formatLocalDictionaries,exports.loadContentDeclaration=e.loadContentDeclaration,exports.loadContentDeclarations=e.loadContentDeclarations,exports.loadDictionaries=r.loadDictionaries,exports.loadLocalDictionaries=t.loadLocalDictionaries,exports.loadRemoteDictionaries=n.loadRemoteDictionaries;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.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
|
|
2
|
-
`)}},aliases:{intlayer:
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.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
|
+
`)}},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 {
|
|
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":"4dAaA,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,IAAO,GAAK,GAAK,GAAK,EAC9B,CAAC,CAEI,GAAA,EAAA,EAAA,MAAgB,EAAO,SAAU,sBAAsB,CAS7D,OAR0B,MAAM,GAAS,GAIvC,MAAA,EAAA,EAAA,WAAgB,EADO,MAAMA,EAAAA,kBAAkB,EAAc,CACpB,CACzC,MAAM,EAAI,KAAK,EAGV,GAGI,EAAyB,MACpC,EACA,EACA,IACoC,CACpC,GAAM,CAAE,SAAU,EAEZ,EACJ,GAAmB,MAAM,EAAqB,EAAc,CAE9D,GAAI,CAgBF,OAfmB,MAAA,EAAA,EAAA,kBAAuB,EAAM,CAC9C,eAAgB,EAAM,UAAA,EAAA,EAAA,oBAA8B,CACpD,aAAc,CACZ,OAAQ,CACN,GAAI,CACF,oCAAoC,EAAK,IACzC,mCAAmC,EAAc,OAAO,QAAQ,IACjE,CAAC,KAAK;EAAK,CACb,CACF,CACD,QAAS,CACP,SAAU,EACX,CACF,CAAC,OAGK,EAAO,CACd,QAAQ,MAAM,wCAAwC,EAAK,GAAI,EAAM,CACrE,SAIS,EAA0B,MACrC,EACA,EACA,IAC0B,CAC1B,GAAM,CAAE,QAAO,UAAW,EAGtB,EAAM,YACR,EAAA,oBAAoB,EAA4B,EAAc,CAAC,MAC5D,GAAM,CACL,QAAQ,MAAM,sCAAuC,EAAE,EAE1D,CAGH,IAAM,EAAiB,MAAM,EAAqB,EAAc,CAEhE,GAAI,CACF,IAAM,EAAuB,EAA2B,IACtD,KAAO,KASE,CAAE,cAAA,EAAA,EAAA,UARqB,EAAc,OAAO,QAAS,EAAK,CAQ1C,WANJ,MAAM,EACvB,EACA,EACA,EACD,CAEkC,EAEtC,CAaK,EAAoC,GAXhB,MAAM,QAAQ,IAAI,EAAqB,EACpB,QAC1C,EAAK,CAAE,eAAc,iBAChB,IACF,EAAI,GAAgB,GAEf,GAET,EAAE,CACH,CAIC,EACD,CAAC,OAAQ,GAAe,EAAW,WAAa,SAAS,CAEpD,EAAwB,EAAoB,IAAK,IAAiB,CACtE,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(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../filterInvalidDictionaries.cjs`),t=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.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 { Dictionary, IntlayerConfig } from '@intlayer/types';\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 pluginsWithLoadDictionaries = (plugins ?? []).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":"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"}
|
|
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":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./loadContentDeclaration.cjs`);let t=require(`node:fs/promises`),n=require(`node:path`);const r=async(r,i)=>{let{
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.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 {
|
|
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":"yNAMA,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"}
|