@intlayer/engine 9.0.0-canary.12
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/README.md +330 -0
- package/dist/assets/initConfig/templates/cjs.txt +140 -0
- package/dist/assets/initConfig/templates/json.txt +98 -0
- package/dist/assets/initConfig/templates/mjs.txt +140 -0
- package/dist/assets/initConfig/templates/ts.txt +139 -0
- package/dist/assets/installSkills/LICENCE.md +201 -0
- package/dist/assets/installSkills/skills/angular.md +159 -0
- package/dist/assets/installSkills/skills/astro.md +40 -0
- package/dist/assets/installSkills/skills/cli.md +68 -0
- package/dist/assets/installSkills/skills/compiler.md +32 -0
- package/dist/assets/installSkills/skills/config.md +63 -0
- package/dist/assets/installSkills/skills/content.md +377 -0
- package/dist/assets/installSkills/skills/next-js.md +130 -0
- package/dist/assets/installSkills/skills/preact.md +83 -0
- package/dist/assets/installSkills/skills/react.md +105 -0
- package/dist/assets/installSkills/skills/remote-content.md +31 -0
- package/dist/assets/installSkills/skills/solid.md +90 -0
- package/dist/assets/installSkills/skills/svelte.md +84 -0
- package/dist/assets/installSkills/skills/usage.md +44 -0
- package/dist/assets/installSkills/skills/vue.md +56 -0
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/cjs/_virtual/_utils_asset.cjs +98 -0
- package/dist/cjs/build.cjs +60 -0
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +80 -0
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -0
- package/dist/cjs/buildIntlayerDictionary/index.cjs +6 -0
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +27 -0
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -0
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +206 -0
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -0
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +59 -0
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -0
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +49 -0
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -0
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +51 -0
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -0
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +62 -0
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -0
- package/dist/cjs/cleanOutputDir.cjs +31 -0
- package/dist/cjs/cleanOutputDir.cjs.map +1 -0
- package/dist/cjs/cleanRemovedContentDeclaration.cjs +97 -0
- package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -0
- package/dist/cjs/cli.cjs +48 -0
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +71 -0
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +43 -0
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +25 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +26 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +26 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +25 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +25 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/index.cjs +16 -0
- package/dist/cjs/createType/createModuleAugmentation.cjs +126 -0
- package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -0
- package/dist/cjs/createType/createType.cjs +30 -0
- package/dist/cjs/createType/createType.cjs.map +1 -0
- package/dist/cjs/createType/index.cjs +8 -0
- package/dist/cjs/detectFormatCommand.cjs +33 -0
- package/dist/cjs/detectFormatCommand.cjs.map +1 -0
- package/dist/cjs/docReview/alignBlocks.cjs +79 -0
- package/dist/cjs/docReview/alignBlocks.cjs.map +1 -0
- package/dist/cjs/docReview/computeSimilarity.cjs +42 -0
- package/dist/cjs/docReview/computeSimilarity.cjs.map +1 -0
- package/dist/cjs/docReview/fingerprintBlock.cjs +35 -0
- package/dist/cjs/docReview/fingerprintBlock.cjs.map +1 -0
- package/dist/cjs/docReview/index.cjs +25 -0
- package/dist/cjs/docReview/mapChangedLinesToBlocks.cjs +27 -0
- package/dist/cjs/docReview/mapChangedLinesToBlocks.cjs.map +1 -0
- package/dist/cjs/docReview/normalizeBlock.cjs +34 -0
- package/dist/cjs/docReview/normalizeBlock.cjs.map +1 -0
- package/dist/cjs/docReview/pipeline.cjs +144 -0
- package/dist/cjs/docReview/pipeline.cjs.map +1 -0
- package/dist/cjs/docReview/planActions.cjs +58 -0
- package/dist/cjs/docReview/planActions.cjs.map +1 -0
- package/dist/cjs/docReview/rebuildDocument.cjs +65 -0
- package/dist/cjs/docReview/rebuildDocument.cjs.map +1 -0
- package/dist/cjs/docReview/reviewReport.cjs +200 -0
- package/dist/cjs/docReview/reviewReport.cjs.map +1 -0
- package/dist/cjs/docReview/segmentDocument.cjs +134 -0
- package/dist/cjs/docReview/segmentDocument.cjs.map +1 -0
- package/dist/cjs/docReview/types.cjs +0 -0
- package/dist/cjs/fetchDistantDictionaries.cjs +53 -0
- package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -0
- package/dist/cjs/filterInvalidDictionaries.cjs +57 -0
- package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -0
- package/dist/cjs/formatDictionary.cjs +60 -0
- package/dist/cjs/formatDictionary.cjs.map +1 -0
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +83 -0
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -0
- package/dist/cjs/getContentDeclarationFileTemplate/index.cjs +4 -0
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +35 -0
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -0
- package/dist/cjs/handleContentDeclarationFileChange.cjs +56 -0
- package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -0
- package/dist/cjs/handleContentDeclarationFileMoved.cjs +25 -0
- package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -0
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +38 -0
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -0
- package/dist/cjs/init/cms.cjs +140 -0
- package/dist/cjs/init/cms.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/index.cjs +27 -0
- package/dist/cjs/init/frameworkSetup/index.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/detect.cjs +56 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/detect.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs +107 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs +163 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs +122 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs +196 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/detect.cjs +31 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/detect.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs +76 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs +116 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs +106 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs +141 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/types.cjs +0 -0
- package/dist/cjs/init/index.cjs +521 -0
- package/dist/cjs/init/index.cjs.map +1 -0
- package/dist/cjs/init/utils/astImports.cjs +56 -0
- package/dist/cjs/init/utils/astImports.cjs.map +1 -0
- package/dist/cjs/init/utils/configManipulation.cjs +516 -0
- package/dist/cjs/init/utils/configManipulation.cjs.map +1 -0
- package/dist/cjs/init/utils/fileSystem.cjs +231 -0
- package/dist/cjs/init/utils/fileSystem.cjs.map +1 -0
- package/dist/cjs/init/utils/githubActions.cjs +159 -0
- package/dist/cjs/init/utils/githubActions.cjs.map +1 -0
- package/dist/cjs/init/utils/index.cjs +51 -0
- package/dist/cjs/init/utils/jsonParser.cjs +43 -0
- package/dist/cjs/init/utils/jsonParser.cjs.map +1 -0
- package/dist/cjs/init/utils/nextCompilerBabel.cjs +119 -0
- package/dist/cjs/init/utils/nextCompilerBabel.cjs.map +1 -0
- package/dist/cjs/init/utils/packageManager.cjs +303 -0
- package/dist/cjs/init/utils/packageManager.cjs.map +1 -0
- package/dist/cjs/init/utils/tsConfig.cjs +19 -0
- package/dist/cjs/init/utils/tsConfig.cjs.map +1 -0
- package/dist/cjs/initConfig/index.cjs +49 -0
- package/dist/cjs/initConfig/index.cjs.map +1 -0
- package/dist/cjs/installLSP.cjs +58 -0
- package/dist/cjs/installLSP.cjs.map +1 -0
- package/dist/cjs/installMCP/installMCP.cjs +51 -0
- package/dist/cjs/installMCP/installMCP.cjs.map +1 -0
- package/dist/cjs/installSkills/index.cjs +307 -0
- package/dist/cjs/installSkills/index.cjs.map +1 -0
- package/dist/cjs/listDictionariesPath.cjs +43 -0
- package/dist/cjs/listDictionariesPath.cjs.map +1 -0
- package/dist/cjs/listGitFiles.cjs +105 -0
- package/dist/cjs/listGitFiles.cjs.map +1 -0
- package/dist/cjs/listProjects.cjs +48 -0
- package/dist/cjs/listProjects.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +56 -0
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/index.cjs +14 -0
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +133 -0
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +128 -0
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +28 -0
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs +45 -0
- package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +63 -0
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs +27 -0
- package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/log.cjs +138 -0
- package/dist/cjs/loadDictionaries/log.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +64 -0
- package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -0
- package/dist/cjs/logConfigDetails.cjs +40 -0
- package/dist/cjs/logConfigDetails.cjs.map +1 -0
- package/dist/cjs/prepareIntlayer.cjs +104 -0
- package/dist/cjs/prepareIntlayer.cjs.map +1 -0
- package/dist/cjs/reduceDictionaryContent/applyMask.cjs +31 -0
- package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -0
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +13 -0
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -0
- package/dist/cjs/scan/analyzeBundleContent.cjs +182 -0
- package/dist/cjs/scan/analyzeBundleContent.cjs.map +1 -0
- package/dist/cjs/scan/calculateScore.cjs +65 -0
- package/dist/cjs/scan/calculateScore.cjs.map +1 -0
- package/dist/cjs/scan/checks.cjs +274 -0
- package/dist/cjs/scan/checks.cjs.map +1 -0
- package/dist/cjs/scan/index.cjs +31 -0
- package/dist/cjs/scan/parseHtml.cjs +127 -0
- package/dist/cjs/scan/parseHtml.cjs.map +1 -0
- package/dist/cjs/scan/scanWebsite.cjs +205 -0
- package/dist/cjs/scan/scanWebsite.cjs.map +1 -0
- package/dist/cjs/scan/types.cjs +0 -0
- package/dist/cjs/utils/autoDecorateContent.cjs +90 -0
- package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -0
- package/dist/cjs/utils/buildComponentFilesList.cjs +94 -0
- package/dist/cjs/utils/buildComponentFilesList.cjs.map +1 -0
- package/dist/cjs/utils/buildFilesList.cjs +84 -0
- package/dist/cjs/utils/buildFilesList.cjs.map +1 -0
- package/dist/cjs/utils/chunkJSON.cjs +337 -0
- package/dist/cjs/utils/chunkJSON.cjs.map +1 -0
- package/dist/cjs/utils/formatter.cjs +18 -0
- package/dist/cjs/utils/formatter.cjs.map +1 -0
- package/dist/cjs/utils/getChunk.cjs +35 -0
- package/dist/cjs/utils/getChunk.cjs.map +1 -0
- package/dist/cjs/utils/getContentExtension.cjs +30 -0
- package/dist/cjs/utils/getContentExtension.cjs.map +1 -0
- package/dist/cjs/utils/getFormatFromExtension.cjs +41 -0
- package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -0
- package/dist/cjs/utils/getPathHash.cjs +22 -0
- package/dist/cjs/utils/getPathHash.cjs.map +1 -0
- package/dist/cjs/utils/index.cjs +50 -0
- package/dist/cjs/utils/mergeChunks.cjs +29 -0
- package/dist/cjs/utils/mergeChunks.cjs.map +1 -0
- package/dist/cjs/utils/pLimit.cjs +134 -0
- package/dist/cjs/utils/pLimit.cjs.map +1 -0
- package/dist/cjs/utils/parallelize.cjs +12 -0
- package/dist/cjs/utils/parallelize.cjs.map +1 -0
- package/dist/cjs/utils/parallelizeGlobal.cjs +30 -0
- package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -0
- package/dist/cjs/utils/readDictionariesFromDisk.cjs +25 -0
- package/dist/cjs/utils/readDictionariesFromDisk.cjs.map +1 -0
- package/dist/cjs/utils/reduceObjectFormat.cjs +70 -0
- package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -0
- package/dist/cjs/utils/resolveObjectPromises.cjs +22 -0
- package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -0
- package/dist/cjs/utils/resolveRelativePath.cjs +22 -0
- package/dist/cjs/utils/resolveRelativePath.cjs.map +1 -0
- package/dist/cjs/utils/runOnce.cjs +96 -0
- package/dist/cjs/utils/runOnce.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/bin.cjs +55 -0
- package/dist/cjs/utils/runParallel/bin.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/bootstrap.cjs +25 -0
- package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/index.cjs +102 -0
- package/dist/cjs/utils/runParallel/index.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/pidTree.cjs +146 -0
- package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/ps.cjs +50 -0
- package/dist/cjs/utils/runParallel/ps.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/runTask.cjs +155 -0
- package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/spawnPosix.cjs +49 -0
- package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/spawnWin32.cjs +44 -0
- package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/wmic.cjs +53 -0
- package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -0
- package/dist/cjs/utils/sortAlphabetically.cjs +8 -0
- package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -0
- package/dist/cjs/utils/splitTextByLine.cjs +12 -0
- package/dist/cjs/utils/splitTextByLine.cjs.map +1 -0
- package/dist/cjs/utils/verifyIdenticObjectFormat.cjs +66 -0
- package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -0
- package/dist/cjs/watcher.cjs +230 -0
- package/dist/cjs/watcher.cjs.map +1 -0
- package/dist/cjs/writeConfiguration/generateConfigurationContent.cjs +35 -0
- package/dist/cjs/writeConfiguration/generateConfigurationContent.cjs.map +1 -0
- package/dist/cjs/writeConfiguration/index.cjs +25 -0
- package/dist/cjs/writeConfiguration/index.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs +29 -0
- package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs +0 -0
- package/dist/cjs/writeContentDeclaration/index.cjs +10 -0
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +95 -0
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +417 -0
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +128 -0
- package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +164 -0
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +93 -0
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs +66 -0
- package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs +44 -0
- package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs.map +1 -0
- package/dist/cjs/writeFileIfChanged.cjs +51 -0
- package/dist/cjs/writeFileIfChanged.cjs.map +1 -0
- package/dist/cjs/writeJsonIfChanged.cjs +18 -0
- package/dist/cjs/writeJsonIfChanged.cjs.map +1 -0
- package/dist/esm/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/esm/_virtual/_utils_asset.mjs +97 -0
- package/dist/esm/build.mjs +26 -0
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +78 -0
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -0
- package/dist/esm/buildIntlayerDictionary/index.mjs +4 -0
- package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs +25 -0
- package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -0
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +201 -0
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -0
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +56 -0
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -0
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +47 -0
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -0
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +49 -0
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -0
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +59 -0
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -0
- package/dist/esm/cleanOutputDir.mjs +29 -0
- package/dist/esm/cleanOutputDir.mjs.map +1 -0
- package/dist/esm/cleanRemovedContentDeclaration.mjs +94 -0
- package/dist/esm/cleanRemovedContentDeclaration.mjs.map +1 -0
- package/dist/esm/cli.mjs +20 -0
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +69 -0
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +41 -0
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +22 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +23 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +23 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +22 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +22 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/index.mjs +9 -0
- package/dist/esm/createType/createModuleAugmentation.mjs +122 -0
- package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -0
- package/dist/esm/createType/createType.mjs +27 -0
- package/dist/esm/createType/createType.mjs.map +1 -0
- package/dist/esm/createType/index.mjs +4 -0
- package/dist/esm/detectFormatCommand.mjs +31 -0
- package/dist/esm/detectFormatCommand.mjs.map +1 -0
- package/dist/esm/docReview/alignBlocks.mjs +78 -0
- package/dist/esm/docReview/alignBlocks.mjs.map +1 -0
- package/dist/esm/docReview/computeSimilarity.mjs +39 -0
- package/dist/esm/docReview/computeSimilarity.mjs.map +1 -0
- package/dist/esm/docReview/fingerprintBlock.mjs +32 -0
- package/dist/esm/docReview/fingerprintBlock.mjs.map +1 -0
- package/dist/esm/docReview/index.mjs +12 -0
- package/dist/esm/docReview/mapChangedLinesToBlocks.mjs +25 -0
- package/dist/esm/docReview/mapChangedLinesToBlocks.mjs.map +1 -0
- package/dist/esm/docReview/normalizeBlock.mjs +32 -0
- package/dist/esm/docReview/normalizeBlock.mjs.map +1 -0
- package/dist/esm/docReview/pipeline.mjs +142 -0
- package/dist/esm/docReview/pipeline.mjs.map +1 -0
- package/dist/esm/docReview/planActions.mjs +56 -0
- package/dist/esm/docReview/planActions.mjs.map +1 -0
- package/dist/esm/docReview/rebuildDocument.mjs +62 -0
- package/dist/esm/docReview/rebuildDocument.mjs.map +1 -0
- package/dist/esm/docReview/reviewReport.mjs +196 -0
- package/dist/esm/docReview/reviewReport.mjs.map +1 -0
- package/dist/esm/docReview/segmentDocument.mjs +131 -0
- package/dist/esm/docReview/segmentDocument.mjs.map +1 -0
- package/dist/esm/docReview/types.mjs +0 -0
- package/dist/esm/fetchDistantDictionaries.mjs +51 -0
- package/dist/esm/fetchDistantDictionaries.mjs.map +1 -0
- package/dist/esm/filterInvalidDictionaries.mjs +53 -0
- package/dist/esm/filterInvalidDictionaries.mjs.map +1 -0
- package/dist/esm/formatDictionary.mjs +55 -0
- package/dist/esm/formatDictionary.mjs.map +1 -0
- package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +81 -0
- package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -0
- package/dist/esm/getContentDeclarationFileTemplate/index.mjs +3 -0
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs +33 -0
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -0
- package/dist/esm/handleContentDeclarationFileChange.mjs +54 -0
- package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -0
- package/dist/esm/handleContentDeclarationFileMoved.mjs +23 -0
- package/dist/esm/handleContentDeclarationFileMoved.mjs.map +1 -0
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +36 -0
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -0
- package/dist/esm/init/cms.mjs +131 -0
- package/dist/esm/init/cms.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/index.mjs +26 -0
- package/dist/esm/init/frameworkSetup/index.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/detect.mjs +52 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/detect.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs +104 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs +157 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/templates.mjs +113 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/templates.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs +193 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/tanstackStart/detect.mjs +28 -0
- package/dist/esm/init/frameworkSetup/tanstackStart/detect.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs +73 -0
- package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs +108 -0
- package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs +102 -0
- package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs +139 -0
- package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/types.mjs +0 -0
- package/dist/esm/init/index.mjs +518 -0
- package/dist/esm/init/index.mjs.map +1 -0
- package/dist/esm/init/utils/astImports.mjs +51 -0
- package/dist/esm/init/utils/astImports.mjs.map +1 -0
- package/dist/esm/init/utils/configManipulation.mjs +499 -0
- package/dist/esm/init/utils/configManipulation.mjs.map +1 -0
- package/dist/esm/init/utils/fileSystem.mjs +222 -0
- package/dist/esm/init/utils/fileSystem.mjs.map +1 -0
- package/dist/esm/init/utils/githubActions.mjs +155 -0
- package/dist/esm/init/utils/githubActions.mjs.map +1 -0
- package/dist/esm/init/utils/index.mjs +10 -0
- package/dist/esm/init/utils/jsonParser.mjs +41 -0
- package/dist/esm/init/utils/jsonParser.mjs.map +1 -0
- package/dist/esm/init/utils/nextCompilerBabel.mjs +115 -0
- package/dist/esm/init/utils/nextCompilerBabel.mjs.map +1 -0
- package/dist/esm/init/utils/packageManager.mjs +294 -0
- package/dist/esm/init/utils/packageManager.mjs.map +1 -0
- package/dist/esm/init/utils/tsConfig.mjs +17 -0
- package/dist/esm/init/utils/tsConfig.mjs.map +1 -0
- package/dist/esm/initConfig/index.mjs +47 -0
- package/dist/esm/initConfig/index.mjs.map +1 -0
- package/dist/esm/installLSP.mjs +55 -0
- package/dist/esm/installLSP.mjs.map +1 -0
- package/dist/esm/installMCP/installMCP.mjs +47 -0
- package/dist/esm/installMCP/installMCP.mjs.map +1 -0
- package/dist/esm/installSkills/index.mjs +299 -0
- package/dist/esm/installSkills/index.mjs.map +1 -0
- package/dist/esm/listDictionariesPath.mjs +39 -0
- package/dist/esm/listDictionariesPath.mjs.map +1 -0
- package/dist/esm/listGitFiles.mjs +101 -0
- package/dist/esm/listGitFiles.mjs.map +1 -0
- package/dist/esm/listProjects.mjs +44 -0
- package/dist/esm/listProjects.mjs.map +1 -0
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +54 -0
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -0
- package/dist/esm/loadDictionaries/index.mjs +6 -0
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +128 -0
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -0
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +125 -0
- package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -0
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +26 -0
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -0
- package/dist/esm/loadDictionaries/loadMarkdownContentDeclaration.mjs +43 -0
- package/dist/esm/loadDictionaries/loadMarkdownContentDeclaration.mjs.map +1 -0
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +60 -0
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -0
- package/dist/esm/loadDictionaries/loadYamlContentDeclaration.mjs +25 -0
- package/dist/esm/loadDictionaries/loadYamlContentDeclaration.mjs.map +1 -0
- package/dist/esm/loadDictionaries/log.mjs +135 -0
- package/dist/esm/loadDictionaries/log.mjs.map +1 -0
- package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs +62 -0
- package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs.map +1 -0
- package/dist/esm/logConfigDetails.mjs +37 -0
- package/dist/esm/logConfigDetails.mjs.map +1 -0
- package/dist/esm/prepareIntlayer.mjs +100 -0
- package/dist/esm/prepareIntlayer.mjs.map +1 -0
- package/dist/esm/reduceDictionaryContent/applyMask.mjs +29 -0
- package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -0
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +11 -0
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -0
- package/dist/esm/scan/analyzeBundleContent.mjs +180 -0
- package/dist/esm/scan/analyzeBundleContent.mjs.map +1 -0
- package/dist/esm/scan/calculateScore.mjs +61 -0
- package/dist/esm/scan/calculateScore.mjs.map +1 -0
- package/dist/esm/scan/checks.mjs +265 -0
- package/dist/esm/scan/checks.mjs.map +1 -0
- package/dist/esm/scan/index.mjs +7 -0
- package/dist/esm/scan/parseHtml.mjs +115 -0
- package/dist/esm/scan/parseHtml.mjs.map +1 -0
- package/dist/esm/scan/scanWebsite.mjs +203 -0
- package/dist/esm/scan/scanWebsite.mjs.map +1 -0
- package/dist/esm/scan/types.mjs +0 -0
- package/dist/esm/utils/autoDecorateContent.mjs +87 -0
- package/dist/esm/utils/autoDecorateContent.mjs.map +1 -0
- package/dist/esm/utils/buildComponentFilesList.mjs +91 -0
- package/dist/esm/utils/buildComponentFilesList.mjs.map +1 -0
- package/dist/esm/utils/buildFilesList.mjs +80 -0
- package/dist/esm/utils/buildFilesList.mjs.map +1 -0
- package/dist/esm/utils/chunkJSON.mjs +334 -0
- package/dist/esm/utils/chunkJSON.mjs.map +1 -0
- package/dist/esm/utils/formatter.mjs +14 -0
- package/dist/esm/utils/formatter.mjs.map +1 -0
- package/dist/esm/utils/getChunk.mjs +34 -0
- package/dist/esm/utils/getChunk.mjs.map +1 -0
- package/dist/esm/utils/getContentExtension.mjs +28 -0
- package/dist/esm/utils/getContentExtension.mjs.map +1 -0
- package/dist/esm/utils/getFormatFromExtension.mjs +38 -0
- package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -0
- package/dist/esm/utils/getPathHash.mjs +20 -0
- package/dist/esm/utils/getPathHash.mjs.map +1 -0
- package/dist/esm/utils/index.mjs +22 -0
- package/dist/esm/utils/mergeChunks.mjs +27 -0
- package/dist/esm/utils/mergeChunks.mjs.map +1 -0
- package/dist/esm/utils/pLimit.mjs +131 -0
- package/dist/esm/utils/pLimit.mjs.map +1 -0
- package/dist/esm/utils/parallelize.mjs +11 -0
- package/dist/esm/utils/parallelize.mjs.map +1 -0
- package/dist/esm/utils/parallelizeGlobal.mjs +27 -0
- package/dist/esm/utils/parallelizeGlobal.mjs.map +1 -0
- package/dist/esm/utils/readDictionariesFromDisk.mjs +23 -0
- package/dist/esm/utils/readDictionariesFromDisk.mjs.map +1 -0
- package/dist/esm/utils/reduceObjectFormat.mjs +67 -0
- package/dist/esm/utils/reduceObjectFormat.mjs.map +1 -0
- package/dist/esm/utils/resolveObjectPromises.mjs +20 -0
- package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -0
- package/dist/esm/utils/resolveRelativePath.mjs +20 -0
- package/dist/esm/utils/resolveRelativePath.mjs.map +1 -0
- package/dist/esm/utils/runOnce.mjs +93 -0
- package/dist/esm/utils/runOnce.mjs.map +1 -0
- package/dist/esm/utils/runParallel/bin.mjs +53 -0
- package/dist/esm/utils/runParallel/bin.mjs.map +1 -0
- package/dist/esm/utils/runParallel/bootstrap.mjs +23 -0
- package/dist/esm/utils/runParallel/bootstrap.mjs.map +1 -0
- package/dist/esm/utils/runParallel/index.mjs +100 -0
- package/dist/esm/utils/runParallel/index.mjs.map +1 -0
- package/dist/esm/utils/runParallel/pidTree.mjs +143 -0
- package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -0
- package/dist/esm/utils/runParallel/ps.mjs +47 -0
- package/dist/esm/utils/runParallel/ps.mjs.map +1 -0
- package/dist/esm/utils/runParallel/runTask.mjs +153 -0
- package/dist/esm/utils/runParallel/runTask.mjs.map +1 -0
- package/dist/esm/utils/runParallel/spawnPosix.mjs +47 -0
- package/dist/esm/utils/runParallel/spawnPosix.mjs.map +1 -0
- package/dist/esm/utils/runParallel/spawnWin32.mjs +42 -0
- package/dist/esm/utils/runParallel/spawnWin32.mjs.map +1 -0
- package/dist/esm/utils/runParallel/wmic.mjs +50 -0
- package/dist/esm/utils/runParallel/wmic.mjs.map +1 -0
- package/dist/esm/utils/sortAlphabetically.mjs +6 -0
- package/dist/esm/utils/sortAlphabetically.mjs.map +1 -0
- package/dist/esm/utils/splitTextByLine.mjs +10 -0
- package/dist/esm/utils/splitTextByLine.mjs.map +1 -0
- package/dist/esm/utils/verifyIdenticObjectFormat.mjs +64 -0
- package/dist/esm/utils/verifyIdenticObjectFormat.mjs.map +1 -0
- package/dist/esm/watcher.mjs +226 -0
- package/dist/esm/watcher.mjs.map +1 -0
- package/dist/esm/writeConfiguration/generateConfigurationContent.mjs +33 -0
- package/dist/esm/writeConfiguration/generateConfigurationContent.mjs.map +1 -0
- package/dist/esm/writeConfiguration/index.mjs +22 -0
- package/dist/esm/writeConfiguration/index.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs +27 -0
- package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/dictionaryStatus.mjs +0 -0
- package/dist/esm/writeContentDeclaration/index.mjs +6 -0
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +92 -0
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs +412 -0
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/transformJSONFile.mjs +125 -0
- package/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +162 -0
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs +91 -0
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs +64 -0
- package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/writeYamlFile.mjs +42 -0
- package/dist/esm/writeContentDeclaration/writeYamlFile.mjs.map +1 -0
- package/dist/esm/writeFileIfChanged.mjs +49 -0
- package/dist/esm/writeFileIfChanged.mjs.map +1 -0
- package/dist/esm/writeJsonIfChanged.mjs +17 -0
- package/dist/esm/writeJsonIfChanged.mjs.map +1 -0
- package/dist/types/build.d.ts +26 -0
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +25 -0
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/index.d.ts +3 -0
- package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +11 -0
- package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +77 -0
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +25 -0
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +40 -0
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +29 -0
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +34 -0
- package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -0
- package/dist/types/cleanOutputDir.d.ts +7 -0
- package/dist/types/cleanOutputDir.d.ts.map +1 -0
- package/dist/types/cleanRemovedContentDeclaration.d.ts +11 -0
- package/dist/types/cleanRemovedContentDeclaration.d.ts.map +1 -0
- package/dist/types/cli.d.ts +21 -0
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +14 -0
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +10 -0
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +10 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +10 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +10 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +10 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +10 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/index.d.ts +8 -0
- package/dist/types/createType/createModuleAugmentation.d.ts +9 -0
- package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -0
- package/dist/types/createType/createType.d.ts +12 -0
- package/dist/types/createType/createType.d.ts.map +1 -0
- package/dist/types/createType/index.d.ts +3 -0
- package/dist/types/detectFormatCommand.d.ts +7 -0
- package/dist/types/detectFormatCommand.d.ts.map +1 -0
- package/dist/types/docReview/alignBlocks.d.ts +18 -0
- package/dist/types/docReview/alignBlocks.d.ts.map +1 -0
- package/dist/types/docReview/computeSimilarity.d.ts +22 -0
- package/dist/types/docReview/computeSimilarity.d.ts.map +1 -0
- package/dist/types/docReview/fingerprintBlock.d.ts +18 -0
- package/dist/types/docReview/fingerprintBlock.d.ts.map +1 -0
- package/dist/types/docReview/index.d.ts +12 -0
- package/dist/types/docReview/mapChangedLinesToBlocks.d.ts +15 -0
- package/dist/types/docReview/mapChangedLinesToBlocks.d.ts.map +1 -0
- package/dist/types/docReview/normalizeBlock.d.ts +18 -0
- package/dist/types/docReview/normalizeBlock.d.ts.map +1 -0
- package/dist/types/docReview/pipeline.d.ts +46 -0
- package/dist/types/docReview/pipeline.d.ts.map +1 -0
- package/dist/types/docReview/planActions.d.ts +18 -0
- package/dist/types/docReview/planActions.d.ts.map +1 -0
- package/dist/types/docReview/rebuildDocument.d.ts +46 -0
- package/dist/types/docReview/rebuildDocument.d.ts.map +1 -0
- package/dist/types/docReview/reviewReport.d.ts +82 -0
- package/dist/types/docReview/reviewReport.d.ts.map +1 -0
- package/dist/types/docReview/segmentDocument.d.ts +40 -0
- package/dist/types/docReview/segmentDocument.d.ts.map +1 -0
- package/dist/types/docReview/types.d.ts +73 -0
- package/dist/types/docReview/types.d.ts.map +1 -0
- package/dist/types/fetchDistantDictionaries.d.ts +16 -0
- package/dist/types/fetchDistantDictionaries.d.ts.map +1 -0
- package/dist/types/filterInvalidDictionaries.d.ts +12 -0
- package/dist/types/filterInvalidDictionaries.d.ts.map +1 -0
- package/dist/types/formatDictionary.d.ts +62 -0
- package/dist/types/formatDictionary.d.ts.map +1 -0
- package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +7 -0
- package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +1 -0
- package/dist/types/getContentDeclarationFileTemplate/index.d.ts +2 -0
- package/dist/types/handleAdditionalContentDeclarationFile.d.ts +7 -0
- package/dist/types/handleAdditionalContentDeclarationFile.d.ts.map +1 -0
- package/dist/types/handleContentDeclarationFileChange.d.ts +7 -0
- package/dist/types/handleContentDeclarationFileChange.d.ts.map +1 -0
- package/dist/types/handleContentDeclarationFileMoved.d.ts +7 -0
- package/dist/types/handleContentDeclarationFileMoved.d.ts.map +1 -0
- package/dist/types/handleUnlinkedContentDeclarationFile.d.ts +7 -0
- package/dist/types/handleUnlinkedContentDeclarationFile.d.ts.map +1 -0
- package/dist/types/init/cms.d.ts +51 -0
- package/dist/types/init/cms.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/index.d.ts +13 -0
- package/dist/types/init/frameworkSetup/index.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/detect.d.ts +25 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/detect.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts +12 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/restructure.d.ts +56 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/restructure.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts +26 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts +23 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/tanstackStart/detect.d.ts +19 -0
- package/dist/types/init/frameworkSetup/tanstackStart/detect.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts +13 -0
- package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/tanstackStart/restructure.d.ts +68 -0
- package/dist/types/init/frameworkSetup/tanstackStart/restructure.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts +22 -0
- package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts +17 -0
- package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/types.d.ts +43 -0
- package/dist/types/init/frameworkSetup/types.d.ts.map +1 -0
- package/dist/types/init/index.d.ts +46 -0
- package/dist/types/init/index.d.ts.map +1 -0
- package/dist/types/init/utils/astImports.d.ts +29 -0
- package/dist/types/init/utils/astImports.d.ts.map +1 -0
- package/dist/types/init/utils/configManipulation.d.ts +99 -0
- package/dist/types/init/utils/configManipulation.d.ts.map +1 -0
- package/dist/types/init/utils/fileSystem.d.ts +111 -0
- package/dist/types/init/utils/fileSystem.d.ts.map +1 -0
- package/dist/types/init/utils/githubActions.d.ts +19 -0
- package/dist/types/init/utils/githubActions.d.ts.map +1 -0
- package/dist/types/init/utils/index.d.ts +9 -0
- package/dist/types/init/utils/jsonParser.d.ts +8 -0
- package/dist/types/init/utils/jsonParser.d.ts.map +1 -0
- package/dist/types/init/utils/nextCompilerBabel.d.ts +53 -0
- package/dist/types/init/utils/nextCompilerBabel.d.ts.map +1 -0
- package/dist/types/init/utils/packageManager.d.ts +149 -0
- package/dist/types/init/utils/packageManager.d.ts.map +1 -0
- package/dist/types/init/utils/tsConfig.d.ts +8 -0
- package/dist/types/init/utils/tsConfig.d.ts.map +1 -0
- package/dist/types/initConfig/index.d.ts +10 -0
- package/dist/types/initConfig/index.d.ts.map +1 -0
- package/dist/types/installLSP.d.ts +12 -0
- package/dist/types/installLSP.d.ts.map +1 -0
- package/dist/types/installMCP/installMCP.d.ts +11 -0
- package/dist/types/installMCP/installMCP.d.ts.map +1 -0
- package/dist/types/installSkills/index.d.ts +42 -0
- package/dist/types/installSkills/index.d.ts.map +1 -0
- package/dist/types/listDictionariesPath.d.ts +17 -0
- package/dist/types/listDictionariesPath.d.ts.map +1 -0
- package/dist/types/listGitFiles.d.ts +27 -0
- package/dist/types/listGitFiles.d.ts.map +1 -0
- package/dist/types/listProjects.d.ts +26 -0
- package/dist/types/listProjects.d.ts.map +1 -0
- package/dist/types/loadDictionaries/getIntlayerBundle.d.ts +7 -0
- package/dist/types/loadDictionaries/getIntlayerBundle.d.ts.map +1 -0
- package/dist/types/loadDictionaries/index.d.ts +5 -0
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +15 -0
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -0
- package/dist/types/loadDictionaries/loadDictionaries.d.ts +23 -0
- package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -0
- package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +8 -0
- package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +1 -0
- package/dist/types/loadDictionaries/loadMarkdownContentDeclaration.d.ts +7 -0
- package/dist/types/loadDictionaries/loadMarkdownContentDeclaration.d.ts.map +1 -0
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +15 -0
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -0
- package/dist/types/loadDictionaries/loadYamlContentDeclaration.d.ts +7 -0
- package/dist/types/loadDictionaries/loadYamlContentDeclaration.d.ts.map +1 -0
- package/dist/types/loadDictionaries/log.d.ts +36 -0
- package/dist/types/loadDictionaries/log.d.ts.map +1 -0
- package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts +7 -0
- package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts.map +1 -0
- package/dist/types/logConfigDetails.d.ts +7 -0
- package/dist/types/logConfigDetails.d.ts.map +1 -0
- package/dist/types/prepareIntlayer.d.ts +15 -0
- package/dist/types/prepareIntlayer.d.ts.map +1 -0
- package/dist/types/reduceDictionaryContent/applyMask.d.ts +7 -0
- package/dist/types/reduceDictionaryContent/applyMask.d.ts.map +1 -0
- package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts +7 -0
- package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts.map +1 -0
- package/dist/types/scan/analyzeBundleContent.d.ts +16 -0
- package/dist/types/scan/analyzeBundleContent.d.ts.map +1 -0
- package/dist/types/scan/calculateScore.d.ts +65 -0
- package/dist/types/scan/calculateScore.d.ts.map +1 -0
- package/dist/types/scan/checks.d.ts +38 -0
- package/dist/types/scan/checks.d.ts.map +1 -0
- package/dist/types/scan/index.d.ts +7 -0
- package/dist/types/scan/parseHtml.d.ts +54 -0
- package/dist/types/scan/parseHtml.d.ts.map +1 -0
- package/dist/types/scan/scanWebsite.d.ts +18 -0
- package/dist/types/scan/scanWebsite.d.ts.map +1 -0
- package/dist/types/scan/types.d.ts +76 -0
- package/dist/types/scan/types.d.ts.map +1 -0
- package/dist/types/utils/autoDecorateContent.d.ts +13 -0
- package/dist/types/utils/autoDecorateContent.d.ts.map +1 -0
- package/dist/types/utils/buildComponentFilesList.d.ts +28 -0
- package/dist/types/utils/buildComponentFilesList.d.ts.map +1 -0
- package/dist/types/utils/buildFilesList.d.ts +62 -0
- package/dist/types/utils/buildFilesList.d.ts.map +1 -0
- package/dist/types/utils/chunkJSON.d.ts +56 -0
- package/dist/types/utils/chunkJSON.d.ts.map +1 -0
- package/dist/types/utils/formatter.d.ts +9 -0
- package/dist/types/utils/formatter.d.ts.map +1 -0
- package/dist/types/utils/getChunk.d.ts +11 -0
- package/dist/types/utils/getChunk.d.ts.map +1 -0
- 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 +8 -0
- package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -0
- package/dist/types/utils/getPathHash.d.ts +8 -0
- package/dist/types/utils/getPathHash.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +21 -0
- package/dist/types/utils/mergeChunks.d.ts +5 -0
- package/dist/types/utils/mergeChunks.d.ts.map +1 -0
- package/dist/types/utils/pLimit.d.ts +16 -0
- package/dist/types/utils/pLimit.d.ts.map +1 -0
- package/dist/types/utils/parallelize.d.ts +5 -0
- package/dist/types/utils/parallelize.d.ts.map +1 -0
- package/dist/types/utils/parallelizeGlobal.d.ts +20 -0
- package/dist/types/utils/parallelizeGlobal.d.ts.map +1 -0
- package/dist/types/utils/readDictionariesFromDisk.d.ts +9 -0
- package/dist/types/utils/readDictionariesFromDisk.d.ts.map +1 -0
- package/dist/types/utils/reduceObjectFormat.d.ts +30 -0
- package/dist/types/utils/reduceObjectFormat.d.ts.map +1 -0
- package/dist/types/utils/resolveObjectPromises.d.ts +9 -0
- package/dist/types/utils/resolveObjectPromises.d.ts.map +1 -0
- package/dist/types/utils/resolveRelativePath.d.ts +5 -0
- package/dist/types/utils/resolveRelativePath.d.ts.map +1 -0
- package/dist/types/utils/runOnce.d.ts +45 -0
- package/dist/types/utils/runOnce.d.ts.map +1 -0
- package/dist/types/utils/runParallel/bin.d.ts +15 -0
- package/dist/types/utils/runParallel/bin.d.ts.map +1 -0
- package/dist/types/utils/runParallel/bootstrap.d.ts +5 -0
- package/dist/types/utils/runParallel/bootstrap.d.ts.map +1 -0
- package/dist/types/utils/runParallel/index.d.ts +14 -0
- package/dist/types/utils/runParallel/index.d.ts.map +1 -0
- package/dist/types/utils/runParallel/pidTree.d.ts +24 -0
- package/dist/types/utils/runParallel/pidTree.d.ts.map +1 -0
- package/dist/types/utils/runParallel/ps.d.ts +11 -0
- package/dist/types/utils/runParallel/ps.d.ts.map +1 -0
- package/dist/types/utils/runParallel/runTask.d.ts +26 -0
- package/dist/types/utils/runParallel/runTask.d.ts.map +1 -0
- package/dist/types/utils/runParallel/spawnPosix.d.ts +20 -0
- package/dist/types/utils/runParallel/spawnPosix.d.ts.map +1 -0
- package/dist/types/utils/runParallel/spawnWin32.d.ts +20 -0
- package/dist/types/utils/runParallel/spawnWin32.d.ts.map +1 -0
- package/dist/types/utils/runParallel/wmic.d.ts +11 -0
- package/dist/types/utils/runParallel/wmic.d.ts.map +1 -0
- package/dist/types/utils/sortAlphabetically.d.ts +5 -0
- package/dist/types/utils/sortAlphabetically.d.ts.map +1 -0
- package/dist/types/utils/splitTextByLine.d.ts +5 -0
- package/dist/types/utils/splitTextByLine.d.ts.map +1 -0
- package/dist/types/utils/verifyIdenticObjectFormat.d.ts +23 -0
- package/dist/types/utils/verifyIdenticObjectFormat.d.ts.map +1 -0
- package/dist/types/watcher.d.ts +17 -0
- package/dist/types/watcher.d.ts.map +1 -0
- package/dist/types/writeConfiguration/generateConfigurationContent.d.ts +7 -0
- package/dist/types/writeConfiguration/generateConfigurationContent.d.ts.map +1 -0
- package/dist/types/writeConfiguration/index.d.ts +8 -0
- package/dist/types/writeConfiguration/index.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts +12 -0
- package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +5 -0
- package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/index.d.ts +6 -0
- package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts +14 -0
- package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts +11 -0
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/transformJSONFile.d.ts +7 -0
- package/dist/types/writeContentDeclaration/transformJSONFile.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +19 -0
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts +14 -0
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/writeMarkdownFile.d.ts +8 -0
- package/dist/types/writeContentDeclaration/writeMarkdownFile.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/writeYamlFile.d.ts +8 -0
- package/dist/types/writeContentDeclaration/writeYamlFile.d.ts.map +1 -0
- package/dist/types/writeFileIfChanged.d.ts +11 -0
- package/dist/types/writeFileIfChanged.d.ts.map +1 -0
- package/dist/types/writeJsonIfChanged.d.ts +9 -0
- package/dist/types/writeJsonIfChanged.d.ts.map +1 -0
- package/package.json +159 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { exists, readFileFromRoot } from "./fileSystem.mjs";
|
|
2
|
+
import { installPackages } from "./packageManager.mjs";
|
|
3
|
+
import { colorize, colorizePath, logger, v, x } from "@intlayer/config/logger";
|
|
4
|
+
import * as ANSIColors from "@intlayer/config/colors";
|
|
5
|
+
|
|
6
|
+
//#region src/init/utils/nextCompilerBabel.ts
|
|
7
|
+
/**
|
|
8
|
+
* `babel.config.js` wiring the full Intlayer compiler + build-optimization
|
|
9
|
+
* pipeline for Next.js.
|
|
10
|
+
*
|
|
11
|
+
* The four passes run in a fixed order — extract first (so dictionaries exist),
|
|
12
|
+
* optimize last (because it erases the dictionary key the previous passes rely
|
|
13
|
+
* on). `presets: ["next/babel"]` is required so Babel keeps compiling JSX/TS
|
|
14
|
+
* the way Next.js does; without it the build breaks.
|
|
15
|
+
*/
|
|
16
|
+
const NEXT_INTLAYER_BABEL_CONFIG_CONTENT = `const {
|
|
17
|
+
intlayerExtractBabelPlugin,
|
|
18
|
+
intlayerPurgeBabelPlugin,
|
|
19
|
+
intlayerMinifyBabelPlugin,
|
|
20
|
+
intlayerOptimizeBabelPlugin,
|
|
21
|
+
getExtractPluginOptions,
|
|
22
|
+
getPurgePluginOptions,
|
|
23
|
+
getMinifyPluginOptions,
|
|
24
|
+
getOptimizePluginOptions,
|
|
25
|
+
} = require("@intlayer/babel");
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
presets: ["next/babel"],
|
|
29
|
+
plugins: [
|
|
30
|
+
// Extract: compile .content.ts files → .intlayer/**/*.json
|
|
31
|
+
[intlayerExtractBabelPlugin, getExtractPluginOptions()],
|
|
32
|
+
|
|
33
|
+
// Purge: remove unused fields from .intlayer/**/*.json
|
|
34
|
+
// (reads intlayer.config.ts build.purge flag)
|
|
35
|
+
[intlayerPurgeBabelPlugin, getPurgePluginOptions()],
|
|
36
|
+
|
|
37
|
+
// Minify: rename field keys in JSON + source code
|
|
38
|
+
// (reads intlayer.config.ts build.minify flag)
|
|
39
|
+
[intlayerMinifyBabelPlugin, getMinifyPluginOptions()],
|
|
40
|
+
|
|
41
|
+
// Optimize: rewrite useIntlayer('key') → useDictionary(hash)
|
|
42
|
+
// Must come last because it erases the dictionary key.
|
|
43
|
+
[intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
`;
|
|
47
|
+
/** Babel config filenames Next.js picks up, ordered by preference. */
|
|
48
|
+
const BABEL_CONFIG_CANDIDATES = [
|
|
49
|
+
"babel.config.js",
|
|
50
|
+
"babel.config.cjs",
|
|
51
|
+
"babel.config.mjs",
|
|
52
|
+
"babel.config.ts",
|
|
53
|
+
"babel.config.json",
|
|
54
|
+
".babelrc",
|
|
55
|
+
".babelrc.js",
|
|
56
|
+
".babelrc.cjs",
|
|
57
|
+
".babelrc.json"
|
|
58
|
+
];
|
|
59
|
+
/** Dev dependency required to run the Intlayer Babel compiler passes. */
|
|
60
|
+
const INTLAYER_BABEL_PACKAGE = "@intlayer/babel";
|
|
61
|
+
/**
|
|
62
|
+
* Returns the first existing config file from `candidates`, or `undefined` when
|
|
63
|
+
* none are present.
|
|
64
|
+
*/
|
|
65
|
+
const findExistingConfig = async (rootDir, candidates) => {
|
|
66
|
+
for (const candidate of candidates) if (await exists(rootDir, candidate)) return candidate;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Wires the Intlayer compiler + build-optimization Babel plugins into a Next.js
|
|
70
|
+
* project that already uses Babel.
|
|
71
|
+
*
|
|
72
|
+
* Only acts when a Babel config is detected. A default Next.js project compiles
|
|
73
|
+
* with SWC, where the Intlayer optimize pass is injected automatically by
|
|
74
|
+
* `withIntlayer` once `@intlayer/swc` is installed — no Babel config is needed,
|
|
75
|
+
* so there is nothing to set up here. Writing a `babel.config.js` would in fact
|
|
76
|
+
* be harmful: Next.js falls back from SWC to Babel as soon as one exists, which
|
|
77
|
+
* disables both the project's SWC compiler and the `@intlayer/swc` plugin.
|
|
78
|
+
*
|
|
79
|
+
* When a Babel config is present it:
|
|
80
|
+
*
|
|
81
|
+
* 1. Installs `@intlayer/babel` as a dev dependency (unless already present or
|
|
82
|
+
* `skipInstall` is set).
|
|
83
|
+
* 2. Leaves the existing config untouched and prints the plugins to add, since
|
|
84
|
+
* arbitrary user configs cannot be safely merged.
|
|
85
|
+
*
|
|
86
|
+
* Idempotent: re-running detects the already-wired `@intlayer/babel` import and
|
|
87
|
+
* skips.
|
|
88
|
+
*
|
|
89
|
+
* @param rootDir - Project root directory.
|
|
90
|
+
* @param packageManager - Detected package manager used to install the package.
|
|
91
|
+
* @param allDeps - Combined prod + dev dependencies, used to skip a redundant install.
|
|
92
|
+
* @param skipInstall - When `true`, dependency installation is skipped.
|
|
93
|
+
*/
|
|
94
|
+
const setupNextCompilerBabelConfig = async ({ rootDir, packageManager, allDeps, skipInstall }) => {
|
|
95
|
+
const existingBabelConfig = await findExistingConfig(rootDir, BABEL_CONFIG_CANDIDATES);
|
|
96
|
+
if (!existingBabelConfig) return;
|
|
97
|
+
if (!skipInstall && !allDeps[INTLAYER_BABEL_PACKAGE]) {
|
|
98
|
+
logger(colorize("Installing the Intlayer Babel compiler dependency...", ANSIColors.CYAN));
|
|
99
|
+
try {
|
|
100
|
+
installPackages(rootDir, [INTLAYER_BABEL_PACKAGE], packageManager, true);
|
|
101
|
+
logger(`${v} Installed: ${colorize(INTLAYER_BABEL_PACKAGE, ANSIColors.MAGENTA)}`);
|
|
102
|
+
} catch {
|
|
103
|
+
logger(`${x} Failed to install ${INTLAYER_BABEL_PACKAGE}. Please install manually: ${INTLAYER_BABEL_PACKAGE} (dev dependency)`, { level: "warn" });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if ((await readFileFromRoot(rootDir, existingBabelConfig)).includes(INTLAYER_BABEL_PACKAGE)) {
|
|
107
|
+
logger(`${v} ${colorizePath(existingBabelConfig)} already includes the Intlayer compiler plugins`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
logger(`${x} ${colorizePath(existingBabelConfig)} already exists. Add the Intlayer compiler plugins manually:\n${NEXT_INTLAYER_BABEL_CONFIG_CONTENT}`, { level: "warn" });
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
export { NEXT_INTLAYER_BABEL_CONFIG_CONTENT, setupNextCompilerBabelConfig };
|
|
115
|
+
//# sourceMappingURL=nextCompilerBabel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextCompilerBabel.mjs","names":[],"sources":["../../../../src/init/utils/nextCompilerBabel.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath, logger, v, x } from '@intlayer/config/logger';\nimport { exists, readFileFromRoot } from './fileSystem';\nimport { installPackages, type PackageManager } from './packageManager';\n\n/**\n * `babel.config.js` wiring the full Intlayer compiler + build-optimization\n * pipeline for Next.js.\n *\n * The four passes run in a fixed order — extract first (so dictionaries exist),\n * optimize last (because it erases the dictionary key the previous passes rely\n * on). `presets: [\"next/babel\"]` is required so Babel keeps compiling JSX/TS\n * the way Next.js does; without it the build breaks.\n */\nexport const NEXT_INTLAYER_BABEL_CONFIG_CONTENT = `const {\n intlayerExtractBabelPlugin,\n intlayerPurgeBabelPlugin,\n intlayerMinifyBabelPlugin,\n intlayerOptimizeBabelPlugin,\n getExtractPluginOptions,\n getPurgePluginOptions,\n getMinifyPluginOptions,\n getOptimizePluginOptions,\n} = require(\"@intlayer/babel\");\n\nmodule.exports = {\n presets: [\"next/babel\"],\n plugins: [\n // Extract: compile .content.ts files → .intlayer/**/*.json\n [intlayerExtractBabelPlugin, getExtractPluginOptions()],\n\n // Purge: remove unused fields from .intlayer/**/*.json\n // (reads intlayer.config.ts build.purge flag)\n [intlayerPurgeBabelPlugin, getPurgePluginOptions()],\n\n // Minify: rename field keys in JSON + source code\n // (reads intlayer.config.ts build.minify flag)\n [intlayerMinifyBabelPlugin, getMinifyPluginOptions()],\n\n // Optimize: rewrite useIntlayer('key') → useDictionary(hash)\n // Must come last because it erases the dictionary key.\n [intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],\n ],\n};\n`;\n\n/** Babel config filenames Next.js picks up, ordered by preference. */\nconst BABEL_CONFIG_CANDIDATES = [\n 'babel.config.js',\n 'babel.config.cjs',\n 'babel.config.mjs',\n 'babel.config.ts',\n 'babel.config.json',\n '.babelrc',\n '.babelrc.js',\n '.babelrc.cjs',\n '.babelrc.json',\n];\n\n/** Dev dependency required to run the Intlayer Babel compiler passes. */\nconst INTLAYER_BABEL_PACKAGE = '@intlayer/babel';\n\n/**\n * Returns the first existing config file from `candidates`, or `undefined` when\n * none are present.\n */\nconst findExistingConfig = async (\n rootDir: string,\n candidates: string[]\n): Promise<string | undefined> => {\n for (const candidate of candidates) {\n if (await exists(rootDir, candidate)) return candidate;\n }\n return undefined;\n};\n\n/**\n * Wires the Intlayer compiler + build-optimization Babel plugins into a Next.js\n * project that already uses Babel.\n *\n * Only acts when a Babel config is detected. A default Next.js project compiles\n * with SWC, where the Intlayer optimize pass is injected automatically by\n * `withIntlayer` once `@intlayer/swc` is installed — no Babel config is needed,\n * so there is nothing to set up here. Writing a `babel.config.js` would in fact\n * be harmful: Next.js falls back from SWC to Babel as soon as one exists, which\n * disables both the project's SWC compiler and the `@intlayer/swc` plugin.\n *\n * When a Babel config is present it:\n *\n * 1. Installs `@intlayer/babel` as a dev dependency (unless already present or\n * `skipInstall` is set).\n * 2. Leaves the existing config untouched and prints the plugins to add, since\n * arbitrary user configs cannot be safely merged.\n *\n * Idempotent: re-running detects the already-wired `@intlayer/babel` import and\n * skips.\n *\n * @param rootDir - Project root directory.\n * @param packageManager - Detected package manager used to install the package.\n * @param allDeps - Combined prod + dev dependencies, used to skip a redundant install.\n * @param skipInstall - When `true`, dependency installation is skipped.\n */\nexport const setupNextCompilerBabelConfig = async ({\n rootDir,\n packageManager,\n allDeps,\n skipInstall,\n}: {\n rootDir: string;\n packageManager: PackageManager;\n allDeps: Record<string, string>;\n skipInstall: boolean;\n}): Promise<void> => {\n const existingBabelConfig = await findExistingConfig(\n rootDir,\n BABEL_CONFIG_CANDIDATES\n );\n\n // Nothing to wire into: the project compiles with SWC, where `withIntlayer`\n // injects the optimize pass automatically once `@intlayer/swc` is installed.\n if (!existingBabelConfig) return;\n\n // INSTALL @intlayer/babel\n if (!skipInstall && !allDeps[INTLAYER_BABEL_PACKAGE]) {\n logger(\n colorize(\n 'Installing the Intlayer Babel compiler dependency...',\n ANSIColors.CYAN\n )\n );\n try {\n installPackages(rootDir, [INTLAYER_BABEL_PACKAGE], packageManager, true);\n logger(\n `${v} Installed: ${colorize(INTLAYER_BABEL_PACKAGE, ANSIColors.MAGENTA)}`\n );\n } catch {\n logger(\n `${x} Failed to install ${INTLAYER_BABEL_PACKAGE}. Please install manually: ${INTLAYER_BABEL_PACKAGE} (dev dependency)`,\n { level: 'warn' }\n );\n }\n }\n\n // EXISTING BABEL CONFIG — never overwrite, print the plugins to add instead.\n const content = await readFileFromRoot(rootDir, existingBabelConfig);\n\n if (content.includes(INTLAYER_BABEL_PACKAGE)) {\n logger(\n `${v} ${colorizePath(existingBabelConfig)} already includes the Intlayer compiler plugins`\n );\n return;\n }\n\n logger(\n `${x} ${colorizePath(existingBabelConfig)} already exists. Add the Intlayer compiler plugins manually:\\n${NEXT_INTLAYER_BABEL_CONFIG_CONTENT}`,\n { level: 'warn' }\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiClD,MAAM,0BAA0B;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAM,yBAAyB;;;;;AAM/B,MAAM,qBAAqB,OACzB,SACA,eACgC;AAChC,MAAK,MAAM,aAAa,WACtB,KAAI,MAAM,OAAO,SAAS,UAAU,CAAE,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BjD,MAAa,+BAA+B,OAAO,EACjD,SACA,gBACA,SACA,kBAMmB;CACnB,MAAM,sBAAsB,MAAM,mBAChC,SACA,wBACD;AAID,KAAI,CAAC,oBAAqB;AAG1B,KAAI,CAAC,eAAe,CAAC,QAAQ,yBAAyB;AACpD,SACE,SACE,wDACA,WAAW,KACZ,CACF;AACD,MAAI;AACF,mBAAgB,SAAS,CAAC,uBAAuB,EAAE,gBAAgB,KAAK;AACxE,UACE,GAAG,EAAE,cAAc,SAAS,wBAAwB,WAAW,QAAQ,GACxE;UACK;AACN,UACE,GAAG,EAAE,qBAAqB,uBAAuB,6BAA6B,uBAAuB,oBACrG,EAAE,OAAO,QAAQ,CAClB;;;AAOL,MAAI,MAFkB,iBAAiB,SAAS,oBAAoB,EAExD,SAAS,uBAAuB,EAAE;AAC5C,SACE,GAAG,EAAE,GAAG,aAAa,oBAAoB,CAAC,iDAC3C;AACD;;AAGF,QACE,GAAG,EAAE,GAAG,aAAa,oBAAoB,CAAC,gEAAgE,sCAC1G,EAAE,OAAO,QAAQ,CAClB"}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { compareVersions } from "@intlayer/config/utils";
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
|
+
|
|
6
|
+
//#region src/init/utils/packageManager.ts
|
|
7
|
+
/**
|
|
8
|
+
* Detects the package manager in use by checking for lock files in the
|
|
9
|
+
* project root. Falls back to npm when no lock file is found.
|
|
10
|
+
*/
|
|
11
|
+
const detectPackageManager = (rootDir) => {
|
|
12
|
+
if (existsSync(join(rootDir, "bun.lock")) || existsSync(join(rootDir, "bun.lockb"))) return "bun";
|
|
13
|
+
if (existsSync(join(rootDir, "pnpm-lock.yaml"))) return "pnpm";
|
|
14
|
+
if (existsSync(join(rootDir, "yarn.lock"))) return "yarn";
|
|
15
|
+
return "npm";
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Returns the install command for the given package manager and package list.
|
|
19
|
+
*/
|
|
20
|
+
const buildInstallCommand = (packageManager, packages, isDev = false) => {
|
|
21
|
+
const packageList = packages.join(" ");
|
|
22
|
+
switch (packageManager) {
|
|
23
|
+
case "bun": return `bun add ${isDev ? "-d " : ""}${packageList}`;
|
|
24
|
+
case "pnpm": return `pnpm add ${isDev ? "-D " : ""}${packageList}`;
|
|
25
|
+
case "yarn": return `yarn add ${isDev ? "-D " : ""}${packageList}`;
|
|
26
|
+
case "npm": return `npm install ${isDev ? "-D " : ""}${packageList}`;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const detectMissingIntlayerPackages = (allDependencies, options = {}) => {
|
|
30
|
+
const packagesToInstall = [];
|
|
31
|
+
const devPackagesToInstall = [];
|
|
32
|
+
let compatSyncConfig;
|
|
33
|
+
let compatVitePluginConfig;
|
|
34
|
+
const effectiveDependencies = {
|
|
35
|
+
...allDependencies,
|
|
36
|
+
...options.hintDependencies ?? {}
|
|
37
|
+
};
|
|
38
|
+
const isInstalled = (packageName) => Boolean(effectiveDependencies[packageName]);
|
|
39
|
+
const addIfMissing = (packageName) => {
|
|
40
|
+
if (!isInstalled(packageName)) packagesToInstall.push(packageName);
|
|
41
|
+
};
|
|
42
|
+
const addDevIfMissing = (packageName) => {
|
|
43
|
+
if (!isInstalled(packageName)) devPackagesToInstall.push(packageName);
|
|
44
|
+
};
|
|
45
|
+
addIfMissing("intlayer");
|
|
46
|
+
if (isInstalled("next")) addIfMissing("next-intlayer");
|
|
47
|
+
else if (isInstalled("react")) addIfMissing("react-intlayer");
|
|
48
|
+
if (isInstalled("react-native") || isInstalled("expo")) addDevIfMissing("react-native-intlayer");
|
|
49
|
+
if (isInstalled("svelte")) addIfMissing("svelte-intlayer");
|
|
50
|
+
if (isInstalled("solid-js")) addIfMissing("solid-intlayer");
|
|
51
|
+
if (isInstalled("@angular/core")) addIfMissing("angular-intlayer");
|
|
52
|
+
if (isInstalled("vue")) addIfMissing("vue-intlayer");
|
|
53
|
+
if (isInstalled("vite")) addIfMissing("vite-intlayer");
|
|
54
|
+
if (isInstalled("next-intl") || isInstalled("@intlayer/next-intl")) {
|
|
55
|
+
addIfMissing("@intlayer/next-intl");
|
|
56
|
+
addIfMissing("next-intl");
|
|
57
|
+
compatSyncConfig ??= {
|
|
58
|
+
format: "icu",
|
|
59
|
+
sourceTemplate: "./messages/${locale}.json",
|
|
60
|
+
splitKeys: true
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (isInstalled("next-i18next") || isInstalled("@intlayer/next-i18next")) {
|
|
64
|
+
addIfMissing("@intlayer/next-i18next");
|
|
65
|
+
addIfMissing("next-i18next");
|
|
66
|
+
compatSyncConfig ??= {
|
|
67
|
+
format: "i18next",
|
|
68
|
+
sourceTemplate: "./src/locales/${locale}/${key}.json"
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (isInstalled("next-translate") || isInstalled("@intlayer/next-translate")) {
|
|
72
|
+
addIfMissing("@intlayer/next-translate");
|
|
73
|
+
addIfMissing("next-translate");
|
|
74
|
+
compatSyncConfig ??= {
|
|
75
|
+
format: "i18next",
|
|
76
|
+
sourceTemplate: "./locales/${locale}/${key}.json"
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (isInstalled("i18next") || isInstalled("@intlayer/i18next")) {
|
|
80
|
+
addIfMissing("@intlayer/i18next");
|
|
81
|
+
addIfMissing("i18next");
|
|
82
|
+
compatSyncConfig ??= {
|
|
83
|
+
format: "i18next",
|
|
84
|
+
sourceTemplate: "./src/locales/${locale}/${key}.json"
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (isInstalled("react-i18next") || isInstalled("@intlayer/react-i18next")) {
|
|
88
|
+
addIfMissing("@intlayer/react-i18next");
|
|
89
|
+
addIfMissing("react-i18next");
|
|
90
|
+
compatSyncConfig ??= {
|
|
91
|
+
format: "i18next",
|
|
92
|
+
sourceTemplate: "./src/locales/${locale}/${key}.json"
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (isInstalled("vue-i18n") || isInstalled("@intlayer/vue-i18n")) {
|
|
96
|
+
addIfMissing("@intlayer/vue-i18n");
|
|
97
|
+
addIfMissing("vue-i18n");
|
|
98
|
+
compatSyncConfig ??= {
|
|
99
|
+
format: "vue-i18n",
|
|
100
|
+
sourceTemplate: "./locales/${locale}/${key}.json"
|
|
101
|
+
};
|
|
102
|
+
compatVitePluginConfig ??= {
|
|
103
|
+
pluginFunctionName: "vueI18nVitePlugin",
|
|
104
|
+
pluginPackageSource: "@intlayer/vue-i18n/plugin"
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (isInstalled("use-intl") || isInstalled("@intlayer/use-intl")) {
|
|
108
|
+
addIfMissing("@intlayer/use-intl");
|
|
109
|
+
addIfMissing("use-intl");
|
|
110
|
+
compatSyncConfig ??= {
|
|
111
|
+
format: "icu",
|
|
112
|
+
sourceTemplate: "./messages/${locale}.json",
|
|
113
|
+
splitKeys: true
|
|
114
|
+
};
|
|
115
|
+
compatVitePluginConfig ??= {
|
|
116
|
+
pluginFunctionName: "useIntlVitePlugin",
|
|
117
|
+
pluginPackageSource: "@intlayer/use-intl/plugin"
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (isInstalled("react-intl") || isInstalled("@intlayer/react-intl")) {
|
|
121
|
+
addIfMissing("@intlayer/react-intl");
|
|
122
|
+
addIfMissing("react-intl");
|
|
123
|
+
compatSyncConfig ??= {
|
|
124
|
+
format: "icu",
|
|
125
|
+
sourceTemplate: "./src/i18n/${locale}.json"
|
|
126
|
+
};
|
|
127
|
+
compatVitePluginConfig ??= {
|
|
128
|
+
pluginFunctionName: "reactIntlVitePlugin",
|
|
129
|
+
pluginPackageSource: "@intlayer/react-intl/plugin"
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (isInstalled("@ngneat/transloco") || isInstalled("@intlayer/transloco")) {
|
|
133
|
+
addIfMissing("@intlayer/transloco");
|
|
134
|
+
addIfMissing("@ngneat/transloco");
|
|
135
|
+
compatVitePluginConfig ??= {
|
|
136
|
+
pluginFunctionName: "translocoVitePlugin",
|
|
137
|
+
pluginPackageSource: "@intlayer/transloco/plugin"
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (isInstalled("svelte-i18n") || isInstalled("@intlayer/svelte-i18n")) {
|
|
141
|
+
addIfMissing("@intlayer/svelte-i18n");
|
|
142
|
+
addIfMissing("svelte-i18n");
|
|
143
|
+
compatSyncConfig ??= {
|
|
144
|
+
format: "i18next",
|
|
145
|
+
sourceTemplate: "./src/locales/${locale}.json"
|
|
146
|
+
};
|
|
147
|
+
compatVitePluginConfig ??= {
|
|
148
|
+
pluginFunctionName: "svelteI18nVitePlugin",
|
|
149
|
+
pluginPackageSource: "@intlayer/svelte-i18n/plugin"
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (isInstalled("node-polyglot") || isInstalled("@intlayer/polyglot")) {
|
|
153
|
+
addIfMissing("@intlayer/polyglot");
|
|
154
|
+
addIfMissing("node-polyglot");
|
|
155
|
+
compatVitePluginConfig ??= {
|
|
156
|
+
pluginFunctionName: "polyglotVitePlugin",
|
|
157
|
+
pluginPackageSource: "@intlayer/polyglot/plugin"
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
if (isInstalled("@nuxtjs/i18n") || isInstalled("@intlayer/nuxtjs-i18n")) {
|
|
161
|
+
addIfMissing("@intlayer/nuxtjs-i18n");
|
|
162
|
+
addIfMissing("@nuxtjs/i18n");
|
|
163
|
+
compatSyncConfig ??= {
|
|
164
|
+
format: "vue-i18n",
|
|
165
|
+
sourceTemplate: "./locales/${locale}/${key}.json"
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
if (isInstalled("@ngx-translate/core") || isInstalled("@intlayer/ngx-translate")) {
|
|
169
|
+
addIfMissing("@intlayer/ngx-translate");
|
|
170
|
+
addIfMissing("@ngx-translate/core");
|
|
171
|
+
compatSyncConfig ??= {
|
|
172
|
+
format: "i18next",
|
|
173
|
+
sourceTemplate: "./assets/i18n/${locale}.json"
|
|
174
|
+
};
|
|
175
|
+
compatVitePluginConfig ??= {
|
|
176
|
+
pluginFunctionName: "ngxTranslateVitePlugin",
|
|
177
|
+
pluginPackageSource: "@intlayer/ngx-translate/plugin"
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
if (isInstalled("@lingui/core") || isInstalled("@lingui/react") || isInstalled("@intlayer/lingui")) {
|
|
181
|
+
addIfMissing("@intlayer/lingui");
|
|
182
|
+
addIfMissing("@lingui/core");
|
|
183
|
+
const linguiUsesPo = options.linguiCatalogFormat === "po";
|
|
184
|
+
compatSyncConfig ??= linguiUsesPo ? {
|
|
185
|
+
plugin: "po",
|
|
186
|
+
format: "icu",
|
|
187
|
+
sourceTemplate: "./src/locales/${locale}/${key}.po"
|
|
188
|
+
} : {
|
|
189
|
+
plugin: "json",
|
|
190
|
+
format: "icu",
|
|
191
|
+
sourceTemplate: "./src/locales/${locale}/${key}.json"
|
|
192
|
+
};
|
|
193
|
+
compatVitePluginConfig ??= {
|
|
194
|
+
pluginFunctionName: "lingui",
|
|
195
|
+
pluginPackageSource: "@intlayer/lingui/plugin",
|
|
196
|
+
replacesVitePlugin: {
|
|
197
|
+
importName: "lingui",
|
|
198
|
+
fromPackageSource: "@lingui/vite-plugin"
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
if (isInstalled("i18n-js") || isInstalled("@intlayer/i18n-js")) {
|
|
203
|
+
addIfMissing("@intlayer/i18n-js");
|
|
204
|
+
addIfMissing("i18n-js");
|
|
205
|
+
compatVitePluginConfig ??= {
|
|
206
|
+
pluginFunctionName: "i18nJsVitePlugin",
|
|
207
|
+
pluginPackageSource: "@intlayer/i18n-js/plugin"
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
if (compatSyncConfig) addDevIfMissing(compatSyncConfig.plugin === "po" ? "@intlayer/sync-po-plugin" : "@intlayer/sync-json-plugin");
|
|
211
|
+
return {
|
|
212
|
+
packagesToInstall,
|
|
213
|
+
devPackagesToInstall,
|
|
214
|
+
compatSyncConfig,
|
|
215
|
+
compatVitePluginConfig
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* Runs the package install command synchronously.
|
|
220
|
+
* Throws if the install process exits with a non-zero code.
|
|
221
|
+
*/
|
|
222
|
+
const installPackages = (rootDir, packages, packageManager, isDev = false) => {
|
|
223
|
+
execSync(buildInstallCommand(packageManager, packages, isDev), {
|
|
224
|
+
cwd: rootDir,
|
|
225
|
+
stdio: "inherit"
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Determines whether a dependency name belongs to the Intlayer ecosystem.
|
|
230
|
+
*
|
|
231
|
+
* Matches the core `intlayer` package, every scoped `@intlayer/*` package
|
|
232
|
+
* (including compat adapters such as `@intlayer/next-intl`) and the framework
|
|
233
|
+
* runtime integrations that follow the `<framework>-intlayer` convention
|
|
234
|
+
* (e.g. `next-intlayer`, `react-intlayer`, `express-intlayer`).
|
|
235
|
+
*/
|
|
236
|
+
const isIntlayerPackageName = (packageName) => packageName === "intlayer" || packageName.startsWith("@intlayer/") || /-intlayer$/.test(packageName);
|
|
237
|
+
/**
|
|
238
|
+
* Reduces a semver range or full version to its `major.minor.patch` core,
|
|
239
|
+
* stripping range prefixes (`^`, `~`), pre-release identifiers and build
|
|
240
|
+
* metadata. Returns `null` when no `major.minor.patch` can be extracted.
|
|
241
|
+
*
|
|
242
|
+
* @example normalizeVersion('^9.0.0-canary.3') // '9.0.0'
|
|
243
|
+
*/
|
|
244
|
+
const normalizeVersion = (version) => {
|
|
245
|
+
if (!version || typeof version !== "string") return null;
|
|
246
|
+
const match = version.match(/(\d+)\.(\d+)\.(\d+)/);
|
|
247
|
+
return match ? `${match[1]}.${match[2]}.${match[3]}` : null;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Reads the installed version of a package from its `package.json` inside the
|
|
251
|
+
* project's `node_modules`. Returns `null` when the package is not installed or
|
|
252
|
+
* its manifest cannot be read.
|
|
253
|
+
*/
|
|
254
|
+
const getInstalledPackageVersion = (rootDir, packageName) => {
|
|
255
|
+
try {
|
|
256
|
+
const manifestPath = join(rootDir, "node_modules", packageName, "package.json");
|
|
257
|
+
if (!existsSync(manifestPath)) return null;
|
|
258
|
+
const { version } = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
259
|
+
return typeof version === "string" ? version : null;
|
|
260
|
+
} catch {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Returns the Intlayer packages from `dependencies` whose installed version is
|
|
266
|
+
* behind `targetVersion` (compared on `major.minor.patch`). Packages that are
|
|
267
|
+
* not installed yet are ignored — those are handled by
|
|
268
|
+
* {@link detectMissingIntlayerPackages}.
|
|
269
|
+
*/
|
|
270
|
+
const detectOutdatedIntlayerPackages = (rootDir, dependencies, targetVersion) => {
|
|
271
|
+
const normalizedTarget = normalizeVersion(targetVersion);
|
|
272
|
+
if (!normalizedTarget) return [];
|
|
273
|
+
return Object.keys(dependencies).filter(isIntlayerPackageName).filter((packageName) => {
|
|
274
|
+
const normalizedInstalled = normalizeVersion(getInstalledPackageVersion(rootDir, packageName) ?? void 0);
|
|
275
|
+
if (!normalizedInstalled) return false;
|
|
276
|
+
return compareVersions(normalizedInstalled, "<", normalizedTarget);
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Upgrades the given packages to `targetVersion` synchronously, preserving the
|
|
281
|
+
* dependency type via the `isDev` flag. Throws if the install process exits
|
|
282
|
+
* with a non-zero code.
|
|
283
|
+
*/
|
|
284
|
+
const upgradePackages = (rootDir, packages, packageManager, targetVersion, isDev = false) => {
|
|
285
|
+
if (packages.length === 0) return;
|
|
286
|
+
execSync(buildInstallCommand(packageManager, packages.map((packageName) => `${packageName}@${targetVersion}`), isDev), {
|
|
287
|
+
cwd: rootDir,
|
|
288
|
+
stdio: "inherit"
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
//#endregion
|
|
293
|
+
export { detectMissingIntlayerPackages, detectOutdatedIntlayerPackages, detectPackageManager, getInstalledPackageVersion, installPackages, isIntlayerPackageName, normalizeVersion, upgradePackages };
|
|
294
|
+
//# sourceMappingURL=packageManager.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageManager.mjs","names":[],"sources":["../../../../src/init/utils/packageManager.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { compareVersions } from '@intlayer/config/utils';\n\n/** Package managers supported for dependency installation. */\nexport type PackageManager = 'bun' | 'pnpm' | 'yarn' | 'npm';\n\n/**\n * Configuration for the syncJSON plugin injected into intlayer.config\n * when a compat i18n library is detected.\n */\nexport type CompatSyncConfig = {\n /**\n * Which sync plugin ingests the catalogs:\n * - `'json'` → `syncJSON` from `@intlayer/sync-json-plugin` (default).\n * - `'po'` → `syncPO` from `@intlayer/sync-po-plugin` (lingui's default\n * format).\n */\n plugin?: 'json' | 'po';\n /**\n * JSON format matching the compat library's conventions. Ignored when\n * `plugin` is `'po'` (PO catalogs are always serialized as gettext).\n */\n format: 'icu' | 'i18next' | 'vue-i18n';\n /**\n * Source path template using ${locale} and ${key} placeholders.\n * Rendered as a template literal in the generated config.\n */\n sourceTemplate: string;\n /**\n * Force `splitKeys: true` in the generated `syncJSON(...)` call so each\n * top-level key of a single per-locale file becomes its own dictionary.\n *\n * Set for libraries whose single `messages/${locale}.json` file groups\n * namespaces by its first-level keys (`next-intl` / `use-intl`, where\n * `useTranslations('Hero')` resolves to the `Hero` dictionary). Left\n * undefined for libraries whose top-level keys are plain message keys\n * (e.g. `i18next`, `react-intl`); for those, syncJSON's auto-detection\n * (split only when the source has no `${key}` segment) stays in control.\n *\n * Only meaningful for flat templates (no `${key}` segment); it is dropped\n * automatically when the resolved template addresses one namespace per file.\n */\n splitKeys?: boolean;\n};\n\n/**\n * Configuration for injecting a compat vite plugin into vite.config.\n * The plugin replaces the generic `intlayer` plugin for libraries that\n * require alias injection (e.g. `vue-i18n` → `@intlayer/vue-i18n`).\n */\nexport type CompatVitePluginConfig = {\n /** Exported function name from the plugin package, e.g. `'vueI18nVitePlugin'`. */\n pluginFunctionName: string;\n /** Import path for the plugin package, e.g. `'@intlayer/vue-i18n/plugin'`. */\n pluginPackageSource: string;\n /**\n * Set when the compat plugin is a drop-in replacement for an i18n library's\n * own Vite plugin (e.g. lingui ships `@lingui/vite-plugin`). When the original\n * import is present, init rewrites only that import's module source to\n * `pluginPackageSource` — keeping the binding and its call site — instead of\n * injecting a second import and appending another plugin to the array.\n */\n replacesVitePlugin?: {\n /** Imported binding to keep, e.g. `'lingui'`. */\n importName: string;\n /** Original package source to rewrite, e.g. `'@lingui/vite-plugin'`. */\n fromPackageSource: string;\n };\n};\n\n/** Result of analyzing project dependencies for intlayer package gaps. */\nexport type IntlayerPackageAnalysis = {\n /** Intlayer packages that are referenced but not yet installed. */\n packagesToInstall: string[];\n /** Intlayer dev packages that are referenced but not yet installed. */\n devPackagesToInstall: string[];\n /**\n * syncJSON plugin configuration to inject when a compat i18n library is\n * detected. Undefined when no compat library is present or format is not\n * yet implemented.\n */\n compatSyncConfig: CompatSyncConfig | undefined;\n /**\n * Vite config plugin to inject when a vite-based compat library is\n * detected. Undefined for Next.js/Nuxt-only compat libs or when no compat\n * library requires alias injection.\n */\n compatVitePluginConfig: CompatVitePluginConfig | undefined;\n};\n\n/**\n * Detects the package manager in use by checking for lock files in the\n * project root. Falls back to npm when no lock file is found.\n */\nexport const detectPackageManager = (rootDir: string): PackageManager => {\n if (\n existsSync(join(rootDir, 'bun.lock')) ||\n existsSync(join(rootDir, 'bun.lockb'))\n ) {\n return 'bun';\n }\n if (existsSync(join(rootDir, 'pnpm-lock.yaml'))) {\n return 'pnpm';\n }\n if (existsSync(join(rootDir, 'yarn.lock'))) {\n return 'yarn';\n }\n return 'npm';\n};\n\n/**\n * Returns the install command for the given package manager and package list.\n */\nconst buildInstallCommand = (\n packageManager: PackageManager,\n packages: string[],\n isDev: boolean = false\n): string => {\n const packageList = packages.join(' ');\n switch (packageManager) {\n case 'bun':\n return `bun add ${isDev ? '-d ' : ''}${packageList}`;\n case 'pnpm':\n return `pnpm add ${isDev ? '-D ' : ''}${packageList}`;\n case 'yarn':\n return `yarn add ${isDev ? '-D ' : ''}${packageList}`;\n case 'npm':\n return `npm install ${isDev ? '-D ' : ''}${packageList}`;\n }\n};\n\n/**\n * Analyzes existing project dependencies to determine which intlayer packages\n * are missing and what syncJSON configuration to inject when compat i18n\n * libraries are present.\n */\n/** Extra signals (from a filesystem scan) that refine compat detection. */\nexport type DetectMissingPackagesOptions = {\n /**\n * Catalog format detected for a lingui project (`'po'` or `'json'`), or\n * `null`/undefined when none was found. Decides which sync plugin + dev\n * dependency the lingui compat setup uses.\n */\n linguiCatalogFormat?: 'po' | 'json' | null;\n /**\n * Extra package names injected by the interactive init prompt when the user\n * selects a compat i18n library that is not yet in `package.json`.\n * These are merged with the real dependency map before running detection so\n * the correct sync plugin and compat adapter are scheduled for installation.\n */\n hintDependencies?: Record<string, string>;\n};\n\nexport const detectMissingIntlayerPackages = (\n allDependencies: Record<string, string>,\n options: DetectMissingPackagesOptions = {}\n): IntlayerPackageAnalysis => {\n const packagesToInstall: string[] = [];\n const devPackagesToInstall: string[] = [];\n let compatSyncConfig: CompatSyncConfig | undefined;\n let compatVitePluginConfig: CompatVitePluginConfig | undefined;\n\n // Merge hint deps supplied by the interactive init prompt so that compat\n // libraries the user declared (but hasn't installed yet) are treated the same\n // as pre-existing deps when building the install and config lists.\n const effectiveDependencies: Record<string, string> = {\n ...allDependencies,\n ...(options.hintDependencies ?? {}),\n };\n\n const isInstalled = (packageName: string): boolean =>\n Boolean(effectiveDependencies[packageName]);\n\n const addIfMissing = (packageName: string): void => {\n if (!isInstalled(packageName)) {\n packagesToInstall.push(packageName);\n }\n };\n\n const addDevIfMissing = (packageName: string): void => {\n if (!isInstalled(packageName)) {\n devPackagesToInstall.push(packageName);\n }\n };\n\n // Core package — always required\n addIfMissing('intlayer');\n\n // Framework-specific runtime integrations\n if (isInstalled('next')) {\n addIfMissing('next-intlayer');\n } else if (isInstalled('react')) {\n addIfMissing('react-intlayer');\n }\n\n // React Native / Expo — the Metro plugin lives in react-native-intlayer,\n // installed as a dev dependency (it is only used by the bundler).\n if (isInstalled('react-native') || isInstalled('expo')) {\n addDevIfMissing('react-native-intlayer');\n }\n\n if (isInstalled('svelte')) {\n addIfMissing('svelte-intlayer');\n }\n\n if (isInstalled('solid-js')) {\n addIfMissing('solid-intlayer');\n }\n\n if (isInstalled('@angular/core')) {\n addIfMissing('angular-intlayer');\n }\n\n if (isInstalled('vue')) {\n addIfMissing('vue-intlayer');\n }\n\n if (isInstalled('vite')) {\n addIfMissing('vite-intlayer');\n }\n\n // -------------------------------------------------------------------------\n // Compat adapters for existing i18n libraries.\n //\n // Detection order matters: more specific libraries are checked first so that\n // `compatSyncConfig ??=` and `compatVitePluginConfig ??=` capture the most\n // relevant match. Libraries that only affect the Next.js or Nuxt config do\n // not set `compatVitePluginConfig` (handled separately in init/index.ts).\n // Libraries whose JSON format is not yet supported leave `compatSyncConfig`\n // undefined so no syncJSON plugin is injected.\n // -------------------------------------------------------------------------\n\n // next-intl — next.js only, ICU format. Default layout is a single file per\n // locale (`messages/${locale}.json`) whose top-level keys are namespaces;\n // syncJSON `splitKeys` auto-detection (no `${key}` segment) turns each\n // top-level key into its own dictionary. The exact path is refined from\n // `i18n/request.ts` in init/index.ts when present.\n if (isInstalled('next-intl') || isInstalled('@intlayer/next-intl')) {\n addIfMissing('@intlayer/next-intl');\n addIfMissing('next-intl');\n compatSyncConfig ??= {\n format: 'icu',\n sourceTemplate: './messages/${locale}.json',\n // next-intl groups namespaces by the first-level keys of one file.\n splitKeys: true,\n };\n // next config handled via updateNextConfigForNextIntl in init/index.ts\n }\n\n // next-i18next — next.js only, i18next JSON format\n if (isInstalled('next-i18next') || isInstalled('@intlayer/next-i18next')) {\n addIfMissing('@intlayer/next-i18next');\n addIfMissing('next-i18next');\n compatSyncConfig ??= {\n format: 'i18next',\n sourceTemplate: './src/locales/${locale}/${key}.json',\n };\n // next config handled via updateNextConfigForNextI18next in init/index.ts\n }\n\n // next-translate — next.js only, i18next-style flat-namespace JSON\n if (\n isInstalled('next-translate') ||\n isInstalled('@intlayer/next-translate')\n ) {\n addIfMissing('@intlayer/next-translate');\n addIfMissing('next-translate');\n compatSyncConfig ??= {\n format: 'i18next',\n sourceTemplate: './locales/${locale}/${key}.json',\n };\n // next config handled via updateNextConfigForNextTranslate in init/index.ts\n }\n\n // i18next — explicit import from @intlayer/i18next (no alias injection needed)\n if (isInstalled('i18next') || isInstalled('@intlayer/i18next')) {\n addIfMissing('@intlayer/i18next');\n // Ensure the required peer dependency is installed\n addIfMissing('i18next');\n compatSyncConfig ??= {\n format: 'i18next',\n sourceTemplate: './src/locales/${locale}/${key}.json',\n };\n }\n\n // react-i18next — explicit import from @intlayer/react-i18next (no alias)\n if (isInstalled('react-i18next') || isInstalled('@intlayer/react-i18next')) {\n addIfMissing('@intlayer/react-i18next');\n // Ensure the required peer dependency is installed\n addIfMissing('react-i18next');\n compatSyncConfig ??= {\n format: 'i18next',\n sourceTemplate: './src/locales/${locale}/${key}.json',\n };\n }\n\n // vue-i18n — vite alias injection required\n if (isInstalled('vue-i18n') || isInstalled('@intlayer/vue-i18n')) {\n addIfMissing('@intlayer/vue-i18n');\n addIfMissing('vue-i18n');\n compatSyncConfig ??= {\n format: 'vue-i18n',\n sourceTemplate: './locales/${locale}/${key}.json',\n };\n compatVitePluginConfig ??= {\n pluginFunctionName: 'vueI18nVitePlugin',\n pluginPackageSource: '@intlayer/vue-i18n/plugin',\n };\n }\n\n // use-intl — framework-agnostic React core of next-intl; vite alias\n // injection required, ICU format. Commonly a single `messages/${locale}.json`\n // file whose top-level keys are namespaces, handled by syncJSON `splitKeys`\n // auto-detection (no `${key}` segment in the source template).\n if (isInstalled('use-intl') || isInstalled('@intlayer/use-intl')) {\n addIfMissing('@intlayer/use-intl');\n addIfMissing('use-intl');\n compatSyncConfig ??= {\n format: 'icu',\n sourceTemplate: './messages/${locale}.json',\n // use-intl (the core of next-intl) uses the same single-file namespace model.\n splitKeys: true,\n };\n compatVitePluginConfig ??= {\n pluginFunctionName: 'useIntlVitePlugin',\n pluginPackageSource: '@intlayer/use-intl/plugin',\n };\n }\n\n // react-intl — vite alias injection required, ICU format\n if (isInstalled('react-intl') || isInstalled('@intlayer/react-intl')) {\n addIfMissing('@intlayer/react-intl');\n addIfMissing('react-intl');\n compatSyncConfig ??= {\n format: 'icu',\n sourceTemplate: './src/i18n/${locale}.json',\n };\n compatVitePluginConfig ??= {\n pluginFunctionName: 'reactIntlVitePlugin',\n pluginPackageSource: '@intlayer/react-intl/plugin',\n };\n }\n\n // @ngneat/transloco — vite alias injection required\n // @todo syncJSON format not yet implemented for transloco\n if (isInstalled('@ngneat/transloco') || isInstalled('@intlayer/transloco')) {\n addIfMissing('@intlayer/transloco');\n addIfMissing('@ngneat/transloco');\n compatVitePluginConfig ??= {\n pluginFunctionName: 'translocoVitePlugin',\n pluginPackageSource: '@intlayer/transloco/plugin',\n };\n }\n\n // svelte-i18n — vite alias injection required, flat JSON (i18next-compatible)\n if (isInstalled('svelte-i18n') || isInstalled('@intlayer/svelte-i18n')) {\n addIfMissing('@intlayer/svelte-i18n');\n addIfMissing('svelte-i18n');\n compatSyncConfig ??= {\n format: 'i18next',\n sourceTemplate: './src/locales/${locale}.json',\n };\n compatVitePluginConfig ??= {\n pluginFunctionName: 'svelteI18nVitePlugin',\n pluginPackageSource: '@intlayer/svelte-i18n/plugin',\n };\n }\n\n // node-polyglot — vite alias injection required\n // @todo syncJSON format not yet implemented for polyglot\n if (isInstalled('node-polyglot') || isInstalled('@intlayer/polyglot')) {\n addIfMissing('@intlayer/polyglot');\n addIfMissing('node-polyglot');\n compatVitePluginConfig ??= {\n pluginFunctionName: 'polyglotVitePlugin',\n pluginPackageSource: '@intlayer/polyglot/plugin',\n };\n }\n\n // @nuxtjs/i18n — nuxt module (no vite plugin), vue-i18n JSON format\n if (isInstalled('@nuxtjs/i18n') || isInstalled('@intlayer/nuxtjs-i18n')) {\n addIfMissing('@intlayer/nuxtjs-i18n');\n addIfMissing('@nuxtjs/i18n');\n compatSyncConfig ??= {\n format: 'vue-i18n',\n sourceTemplate: './locales/${locale}/${key}.json',\n };\n // nuxt config handled via updateNuxtConfigForNuxtjsI18n in init/index.ts\n }\n\n // @ngx-translate/core — vite alias injection required, flat JSON (i18next)\n if (\n isInstalled('@ngx-translate/core') ||\n isInstalled('@intlayer/ngx-translate')\n ) {\n addIfMissing('@intlayer/ngx-translate');\n addIfMissing('@ngx-translate/core');\n compatSyncConfig ??= {\n format: 'i18next',\n sourceTemplate: './assets/i18n/${locale}.json',\n };\n compatVitePluginConfig ??= {\n pluginFunctionName: 'ngxTranslateVitePlugin',\n pluginPackageSource: '@intlayer/ngx-translate/plugin',\n };\n }\n\n // @lingui/core — vite alias injection required.\n // lingui keeps one catalog file per locale (default name `messages`), as\n // `.po` (its default) or `.json`. The catalog filename is captured by the\n // `${key}` segment so the produced dictionary key is `messages`, matching the\n // fixed `messages` namespace the lingui compat runtime reads from.\n if (\n isInstalled('@lingui/core') ||\n isInstalled('@lingui/react') ||\n isInstalled('@intlayer/lingui')\n ) {\n addIfMissing('@intlayer/lingui');\n addIfMissing('@lingui/core');\n\n const linguiUsesPo = options.linguiCatalogFormat === 'po';\n compatSyncConfig ??= linguiUsesPo\n ? {\n plugin: 'po',\n format: 'icu',\n sourceTemplate: './src/locales/${locale}/${key}.po',\n }\n : {\n plugin: 'json',\n format: 'icu',\n sourceTemplate: './src/locales/${locale}/${key}.json',\n };\n\n compatVitePluginConfig ??= {\n // `@intlayer/lingui/plugin` exports `lingui` as a drop-in replacement for\n // `@lingui/vite-plugin`, so a fresh project gets `lingui()` injected and a\n // project already using `@lingui/vite-plugin` only has its import source\n // rewritten (see `replacesVitePlugin`).\n pluginFunctionName: 'lingui',\n pluginPackageSource: '@intlayer/lingui/plugin',\n replacesVitePlugin: {\n importName: 'lingui',\n fromPackageSource: '@lingui/vite-plugin',\n },\n };\n }\n\n // i18n-js — vite alias injection required\n // @todo syncJSON format not yet implemented for i18n-js\n if (isInstalled('i18n-js') || isInstalled('@intlayer/i18n-js')) {\n addIfMissing('@intlayer/i18n-js');\n addIfMissing('i18n-js');\n compatVitePluginConfig ??= {\n pluginFunctionName: 'i18nJsVitePlugin',\n pluginPackageSource: '@intlayer/i18n-js/plugin',\n };\n }\n\n if (compatSyncConfig) {\n addDevIfMissing(\n compatSyncConfig.plugin === 'po'\n ? '@intlayer/sync-po-plugin'\n : '@intlayer/sync-json-plugin'\n );\n }\n\n return {\n packagesToInstall,\n devPackagesToInstall,\n compatSyncConfig,\n compatVitePluginConfig,\n };\n};\n\n/**\n * Runs the package install command synchronously.\n * Throws if the install process exits with a non-zero code.\n */\nexport const installPackages = (\n rootDir: string,\n packages: string[],\n packageManager: PackageManager,\n isDev: boolean = false\n): void => {\n const command = buildInstallCommand(packageManager, packages, isDev);\n execSync(command, { cwd: rootDir, stdio: 'inherit' });\n};\n\n/**\n * Determines whether a dependency name belongs to the Intlayer ecosystem.\n *\n * Matches the core `intlayer` package, every scoped `@intlayer/*` package\n * (including compat adapters such as `@intlayer/next-intl`) and the framework\n * runtime integrations that follow the `<framework>-intlayer` convention\n * (e.g. `next-intlayer`, `react-intlayer`, `express-intlayer`).\n */\nexport const isIntlayerPackageName = (packageName: string): boolean =>\n packageName === 'intlayer' ||\n packageName.startsWith('@intlayer/') ||\n /-intlayer$/.test(packageName);\n\n/**\n * Reduces a semver range or full version to its `major.minor.patch` core,\n * stripping range prefixes (`^`, `~`), pre-release identifiers and build\n * metadata. Returns `null` when no `major.minor.patch` can be extracted.\n *\n * @example normalizeVersion('^9.0.0-canary.3') // '9.0.0'\n */\nexport const normalizeVersion = (version?: string): string | null => {\n if (!version || typeof version !== 'string') return null;\n const match = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\n return match ? `${match[1]}.${match[2]}.${match[3]}` : null;\n};\n\n/**\n * Reads the installed version of a package from its `package.json` inside the\n * project's `node_modules`. Returns `null` when the package is not installed or\n * its manifest cannot be read.\n */\nexport const getInstalledPackageVersion = (\n rootDir: string,\n packageName: string\n): string | null => {\n try {\n const manifestPath = join(\n rootDir,\n 'node_modules',\n packageName,\n 'package.json'\n );\n if (!existsSync(manifestPath)) return null;\n const { version } = JSON.parse(readFileSync(manifestPath, 'utf-8'));\n return typeof version === 'string' ? version : null;\n } catch {\n return null;\n }\n};\n\n/**\n * Returns the Intlayer packages from `dependencies` whose installed version is\n * behind `targetVersion` (compared on `major.minor.patch`). Packages that are\n * not installed yet are ignored — those are handled by\n * {@link detectMissingIntlayerPackages}.\n */\nexport const detectOutdatedIntlayerPackages = (\n rootDir: string,\n dependencies: Record<string, string>,\n targetVersion: string\n): string[] => {\n const normalizedTarget = normalizeVersion(targetVersion);\n if (!normalizedTarget) return [];\n\n return Object.keys(dependencies)\n .filter(isIntlayerPackageName)\n .filter((packageName) => {\n const installedVersion = getInstalledPackageVersion(rootDir, packageName);\n const normalizedInstalled = normalizeVersion(\n installedVersion ?? undefined\n );\n if (!normalizedInstalled) return false;\n return compareVersions(normalizedInstalled, '<', normalizedTarget);\n });\n};\n\n/**\n * Upgrades the given packages to `targetVersion` synchronously, preserving the\n * dependency type via the `isDev` flag. Throws if the install process exits\n * with a non-zero code.\n */\nexport const upgradePackages = (\n rootDir: string,\n packages: string[],\n packageManager: PackageManager,\n targetVersion: string,\n isDev: boolean = false\n): void => {\n if (packages.length === 0) return;\n const versionedPackages = packages.map(\n (packageName) => `${packageName}@${targetVersion}`\n );\n const command = buildInstallCommand(packageManager, versionedPackages, isDev);\n execSync(command, { cwd: rootDir, stdio: 'inherit' });\n};\n"],"mappings":";;;;;;;;;;AAgGA,MAAa,wBAAwB,YAAoC;AACvE,KACE,WAAW,KAAK,SAAS,WAAW,CAAC,IACrC,WAAW,KAAK,SAAS,YAAY,CAAC,CAEtC,QAAO;AAET,KAAI,WAAW,KAAK,SAAS,iBAAiB,CAAC,CAC7C,QAAO;AAET,KAAI,WAAW,KAAK,SAAS,YAAY,CAAC,CACxC,QAAO;AAET,QAAO;;;;;AAMT,MAAM,uBACJ,gBACA,UACA,QAAiB,UACN;CACX,MAAM,cAAc,SAAS,KAAK,IAAI;AACtC,SAAQ,gBAAR;EACE,KAAK,MACH,QAAO,WAAW,QAAQ,QAAQ,KAAK;EACzC,KAAK,OACH,QAAO,YAAY,QAAQ,QAAQ,KAAK;EAC1C,KAAK,OACH,QAAO,YAAY,QAAQ,QAAQ,KAAK;EAC1C,KAAK,MACH,QAAO,eAAe,QAAQ,QAAQ,KAAK;;;AA0BjD,MAAa,iCACX,iBACA,UAAwC,EAAE,KACd;CAC5B,MAAM,oBAA8B,EAAE;CACtC,MAAM,uBAAiC,EAAE;CACzC,IAAI;CACJ,IAAI;CAKJ,MAAM,wBAAgD;EACpD,GAAG;EACH,GAAI,QAAQ,oBAAoB,EAAE;EACnC;CAED,MAAM,eAAe,gBACnB,QAAQ,sBAAsB,aAAa;CAE7C,MAAM,gBAAgB,gBAA8B;AAClD,MAAI,CAAC,YAAY,YAAY,CAC3B,mBAAkB,KAAK,YAAY;;CAIvC,MAAM,mBAAmB,gBAA8B;AACrD,MAAI,CAAC,YAAY,YAAY,CAC3B,sBAAqB,KAAK,YAAY;;AAK1C,cAAa,WAAW;AAGxB,KAAI,YAAY,OAAO,CACrB,cAAa,gBAAgB;UACpB,YAAY,QAAQ,CAC7B,cAAa,iBAAiB;AAKhC,KAAI,YAAY,eAAe,IAAI,YAAY,OAAO,CACpD,iBAAgB,wBAAwB;AAG1C,KAAI,YAAY,SAAS,CACvB,cAAa,kBAAkB;AAGjC,KAAI,YAAY,WAAW,CACzB,cAAa,iBAAiB;AAGhC,KAAI,YAAY,gBAAgB,CAC9B,cAAa,mBAAmB;AAGlC,KAAI,YAAY,MAAM,CACpB,cAAa,eAAe;AAG9B,KAAI,YAAY,OAAO,CACrB,cAAa,gBAAgB;AAmB/B,KAAI,YAAY,YAAY,IAAI,YAAY,sBAAsB,EAAE;AAClE,eAAa,sBAAsB;AACnC,eAAa,YAAY;AACzB,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GAEhB,WAAW;GACZ;;AAKH,KAAI,YAAY,eAAe,IAAI,YAAY,yBAAyB,EAAE;AACxE,eAAa,yBAAyB;AACtC,eAAa,eAAe;AAC5B,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GACjB;;AAKH,KACE,YAAY,iBAAiB,IAC7B,YAAY,2BAA2B,EACvC;AACA,eAAa,2BAA2B;AACxC,eAAa,iBAAiB;AAC9B,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GACjB;;AAKH,KAAI,YAAY,UAAU,IAAI,YAAY,oBAAoB,EAAE;AAC9D,eAAa,oBAAoB;AAEjC,eAAa,UAAU;AACvB,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GACjB;;AAIH,KAAI,YAAY,gBAAgB,IAAI,YAAY,0BAA0B,EAAE;AAC1E,eAAa,0BAA0B;AAEvC,eAAa,gBAAgB;AAC7B,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GACjB;;AAIH,KAAI,YAAY,WAAW,IAAI,YAAY,qBAAqB,EAAE;AAChE,eAAa,qBAAqB;AAClC,eAAa,WAAW;AACxB,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GACjB;AACD,6BAA2B;GACzB,oBAAoB;GACpB,qBAAqB;GACtB;;AAOH,KAAI,YAAY,WAAW,IAAI,YAAY,qBAAqB,EAAE;AAChE,eAAa,qBAAqB;AAClC,eAAa,WAAW;AACxB,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GAEhB,WAAW;GACZ;AACD,6BAA2B;GACzB,oBAAoB;GACpB,qBAAqB;GACtB;;AAIH,KAAI,YAAY,aAAa,IAAI,YAAY,uBAAuB,EAAE;AACpE,eAAa,uBAAuB;AACpC,eAAa,aAAa;AAC1B,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GACjB;AACD,6BAA2B;GACzB,oBAAoB;GACpB,qBAAqB;GACtB;;AAKH,KAAI,YAAY,oBAAoB,IAAI,YAAY,sBAAsB,EAAE;AAC1E,eAAa,sBAAsB;AACnC,eAAa,oBAAoB;AACjC,6BAA2B;GACzB,oBAAoB;GACpB,qBAAqB;GACtB;;AAIH,KAAI,YAAY,cAAc,IAAI,YAAY,wBAAwB,EAAE;AACtE,eAAa,wBAAwB;AACrC,eAAa,cAAc;AAC3B,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GACjB;AACD,6BAA2B;GACzB,oBAAoB;GACpB,qBAAqB;GACtB;;AAKH,KAAI,YAAY,gBAAgB,IAAI,YAAY,qBAAqB,EAAE;AACrE,eAAa,qBAAqB;AAClC,eAAa,gBAAgB;AAC7B,6BAA2B;GACzB,oBAAoB;GACpB,qBAAqB;GACtB;;AAIH,KAAI,YAAY,eAAe,IAAI,YAAY,wBAAwB,EAAE;AACvE,eAAa,wBAAwB;AACrC,eAAa,eAAe;AAC5B,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GACjB;;AAKH,KACE,YAAY,sBAAsB,IAClC,YAAY,0BAA0B,EACtC;AACA,eAAa,0BAA0B;AACvC,eAAa,sBAAsB;AACnC,uBAAqB;GACnB,QAAQ;GACR,gBAAgB;GACjB;AACD,6BAA2B;GACzB,oBAAoB;GACpB,qBAAqB;GACtB;;AAQH,KACE,YAAY,eAAe,IAC3B,YAAY,gBAAgB,IAC5B,YAAY,mBAAmB,EAC/B;AACA,eAAa,mBAAmB;AAChC,eAAa,eAAe;EAE5B,MAAM,eAAe,QAAQ,wBAAwB;AACrD,uBAAqB,eACjB;GACE,QAAQ;GACR,QAAQ;GACR,gBAAgB;GACjB,GACD;GACE,QAAQ;GACR,QAAQ;GACR,gBAAgB;GACjB;AAEL,6BAA2B;GAKzB,oBAAoB;GACpB,qBAAqB;GACrB,oBAAoB;IAClB,YAAY;IACZ,mBAAmB;IACpB;GACF;;AAKH,KAAI,YAAY,UAAU,IAAI,YAAY,oBAAoB,EAAE;AAC9D,eAAa,oBAAoB;AACjC,eAAa,UAAU;AACvB,6BAA2B;GACzB,oBAAoB;GACpB,qBAAqB;GACtB;;AAGH,KAAI,iBACF,iBACE,iBAAiB,WAAW,OACxB,6BACA,6BACL;AAGH,QAAO;EACL;EACA;EACA;EACA;EACD;;;;;;AAOH,MAAa,mBACX,SACA,UACA,gBACA,QAAiB,UACR;AAET,UADgB,oBAAoB,gBAAgB,UAAU,MAC9C,EAAE;EAAE,KAAK;EAAS,OAAO;EAAW,CAAC;;;;;;;;;;AAWvD,MAAa,yBAAyB,gBACpC,gBAAgB,cAChB,YAAY,WAAW,aAAa,IACpC,aAAa,KAAK,YAAY;;;;;;;;AAShC,MAAa,oBAAoB,YAAoC;AACnE,KAAI,CAAC,WAAW,OAAO,YAAY,SAAU,QAAO;CACpD,MAAM,QAAQ,QAAQ,MAAM,sBAAsB;AAClD,QAAO,QAAQ,GAAG,MAAM,GAAG,GAAG,MAAM,GAAG,GAAG,MAAM,OAAO;;;;;;;AAQzD,MAAa,8BACX,SACA,gBACkB;AAClB,KAAI;EACF,MAAM,eAAe,KACnB,SACA,gBACA,aACA,eACD;AACD,MAAI,CAAC,WAAW,aAAa,CAAE,QAAO;EACtC,MAAM,EAAE,YAAY,KAAK,MAAM,aAAa,cAAc,QAAQ,CAAC;AACnE,SAAO,OAAO,YAAY,WAAW,UAAU;SACzC;AACN,SAAO;;;;;;;;;AAUX,MAAa,kCACX,SACA,cACA,kBACa;CACb,MAAM,mBAAmB,iBAAiB,cAAc;AACxD,KAAI,CAAC,iBAAkB,QAAO,EAAE;AAEhC,QAAO,OAAO,KAAK,aAAa,CAC7B,OAAO,sBAAsB,CAC7B,QAAQ,gBAAgB;EAEvB,MAAM,sBAAsB,iBADH,2BAA2B,SAAS,YAE3C,IAAI,OACrB;AACD,MAAI,CAAC,oBAAqB,QAAO;AACjC,SAAO,gBAAgB,qBAAqB,KAAK,iBAAiB;GAClE;;;;;;;AAQN,MAAa,mBACX,SACA,UACA,gBACA,eACA,QAAiB,UACR;AACT,KAAI,SAAS,WAAW,EAAG;AAK3B,UADgB,oBAAoB,gBAHV,SAAS,KAChC,gBAAgB,GAAG,YAAY,GAAG,gBAEgC,EAAE,MACvD,EAAE;EAAE,KAAK;EAAS,OAAO;EAAW,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { readdir } from "node:fs/promises";
|
|
2
|
+
|
|
3
|
+
//#region src/init/utils/tsConfig.ts
|
|
4
|
+
/**
|
|
5
|
+
* Helper to find all tsconfig files (tsconfig.json, tsconfig.*.json)
|
|
6
|
+
*/
|
|
7
|
+
const findTsConfigFiles = async (rootDir) => {
|
|
8
|
+
try {
|
|
9
|
+
return (await readdir(rootDir)).filter((file) => file === "tsconfig.json" || /^tsconfig\..+\.json$/.test(file));
|
|
10
|
+
} catch {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { findTsConfigFiles };
|
|
17
|
+
//# sourceMappingURL=tsConfig.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsConfig.mjs","names":[],"sources":["../../../../src/init/utils/tsConfig.ts"],"sourcesContent":["import { readdir } from 'node:fs/promises';\n\n/**\n * Helper to find all tsconfig files (tsconfig.json, tsconfig.*.json)\n */\nexport const findTsConfigFiles = async (rootDir: string): Promise<string[]> => {\n try {\n const files = await readdir(rootDir);\n\n return files.filter(\n (file) => file === 'tsconfig.json' || /^tsconfig\\..+\\.json$/.test(file)\n );\n } catch {\n return [];\n }\n};\n"],"mappings":";;;;;;AAKA,MAAa,oBAAoB,OAAO,YAAuC;AAC7E,KAAI;AAGF,UAAO,MAFa,QAAQ,QAAQ,EAEvB,QACV,SAAS,SAAS,mBAAmB,uBAAuB,KAAK,KAAK,CACxE;SACK;AACN,SAAO,EAAE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { readAsset } from "../_virtual/_utils_asset.mjs";
|
|
2
|
+
import { writeFile } from "node:fs/promises";
|
|
3
|
+
import { join, relative } from "node:path";
|
|
4
|
+
import { colorizePath, logger, v } from "@intlayer/config/logger";
|
|
5
|
+
import { searchConfigurationFile } from "@intlayer/config/node";
|
|
6
|
+
|
|
7
|
+
//#region src/initConfig/index.ts
|
|
8
|
+
/**
|
|
9
|
+
* UTILITIES
|
|
10
|
+
*/
|
|
11
|
+
const rootDir = process.cwd();
|
|
12
|
+
const writeFileToRoot = async (filePath, content) => await writeFile(join(rootDir, filePath), content, "utf8");
|
|
13
|
+
const getTemplatePath = (format) => {
|
|
14
|
+
switch (format) {
|
|
15
|
+
case "ts": return "./templates/ts.txt";
|
|
16
|
+
case "cjs": return "./templates/cjs.txt";
|
|
17
|
+
case "mjs": return "./templates/mjs.txt";
|
|
18
|
+
case "js": return "./templates/mjs.txt";
|
|
19
|
+
case "json": return "./templates/json.txt";
|
|
20
|
+
default: return "./templates/ts.txt";
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Initialize the Intlayer configuration file
|
|
25
|
+
*/
|
|
26
|
+
const initConfig = async (format, baseDir, locales) => {
|
|
27
|
+
const { configurationFilePath } = searchConfigurationFile(baseDir);
|
|
28
|
+
if (configurationFilePath) {
|
|
29
|
+
logger(`${v} ${colorizePath(relative(baseDir, configurationFilePath))} already exists`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const extension = format.split(".").pop();
|
|
33
|
+
let configContent = readAsset(getTemplatePath(extension));
|
|
34
|
+
if (locales && locales.length > 0) if (extension === "json") {
|
|
35
|
+
const localesString = JSON.stringify(locales);
|
|
36
|
+
configContent = configContent.replace("[\"en\"]", localesString);
|
|
37
|
+
} else {
|
|
38
|
+
const localesString = `[${locales.map((locale) => `'${locale}'`).join(", ")}]`;
|
|
39
|
+
configContent = configContent.replace("[Locales.ENGLISH]", localesString);
|
|
40
|
+
}
|
|
41
|
+
await writeFileToRoot(format, configContent);
|
|
42
|
+
logger(`${v} Created ${colorizePath(format)}`);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { initConfig };
|
|
47
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/initConfig/index.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { colorizePath, logger, v } from '@intlayer/config/logger';\nimport {\n type configurationFilesCandidates,\n searchConfigurationFile,\n} from '@intlayer/config/node';\n\n/**\n * UTILITIES\n */\nconst rootDir = process.cwd();\n\n// Helper to write a file\nconst writeFileToRoot = async (filePath: string, content: string) =>\n await writeFile(join(rootDir, filePath), content, 'utf8');\n\ntype ConfigFormat = 'ts' | 'cjs' | 'mjs' | 'js' | 'json';\n\nconst getTemplatePath = (format: ConfigFormat) => {\n switch (format) {\n case 'ts':\n return './templates/ts.txt';\n case 'cjs':\n return './templates/cjs.txt';\n case 'mjs':\n return './templates/mjs.txt';\n case 'js':\n return './templates/mjs.txt';\n case 'json':\n return './templates/json.txt';\n default:\n return './templates/ts.txt';\n }\n};\n\n/**\n * Initialize the Intlayer configuration file\n */\nexport const initConfig = async (\n format: (typeof configurationFilesCandidates)[number],\n baseDir: string,\n locales?: string[]\n) => {\n // Search for configuration file\n const { configurationFilePath } = searchConfigurationFile(baseDir);\n\n // return if the configuration file is found\n if (configurationFilePath) {\n const relativePath = relative(baseDir, configurationFilePath);\n logger(`${v} ${colorizePath(relativePath)} already exists`);\n return;\n }\n\n // Extract the format from the filename (e.g. 'intlayer.config.ts' -> 'ts')\n const extension = format.split('.').pop() as ConfigFormat;\n\n const templatePath = getTemplatePath(extension);\n let configContent = readAsset(templatePath);\n\n if (locales && locales.length > 0) {\n if (extension === 'json') {\n const localesString = JSON.stringify(locales);\n configContent = configContent.replace('[\"en\"]', localesString);\n } else {\n const localesString = `[${locales.map((locale) => `'${locale}'`).join(', ')}]`;\n configContent = configContent.replace('[Locales.ENGLISH]', localesString);\n }\n }\n\n await writeFileToRoot(format, configContent);\n logger(`${v} Created ${colorizePath(format)}`);\n};\n"],"mappings":";;;;;;;;;;AAYA,MAAM,UAAU,QAAQ,KAAK;AAG7B,MAAM,kBAAkB,OAAO,UAAkB,YAC/C,MAAM,UAAU,KAAK,SAAS,SAAS,EAAE,SAAS,OAAO;AAI3D,MAAM,mBAAmB,WAAyB;AAChD,SAAQ,QAAR;EACE,KAAK,KACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,KACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,QACE,QAAO;;;;;;AAOb,MAAa,aAAa,OACxB,QACA,SACA,YACG;CAEH,MAAM,EAAE,0BAA0B,wBAAwB,QAAQ;AAGlE,KAAI,uBAAuB;AAEzB,SAAO,GAAG,EAAE,GAAG,aADM,SAAS,SAAS,sBACC,CAAC,CAAC,iBAAiB;AAC3D;;CAIF,MAAM,YAAY,OAAO,MAAM,IAAI,CAAC,KAAK;CAGzC,IAAI,gBAAgB,UADC,gBAAgB,UACK,CAAC;AAE3C,KAAI,WAAW,QAAQ,SAAS,EAC9B,KAAI,cAAc,QAAQ;EACxB,MAAM,gBAAgB,KAAK,UAAU,QAAQ;AAC7C,kBAAgB,cAAc,QAAQ,YAAU,cAAc;QACzD;EACL,MAAM,gBAAgB,IAAI,QAAQ,KAAK,WAAW,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,CAAC;AAC5E,kBAAgB,cAAc,QAAQ,qBAAqB,cAAc;;AAI7E,OAAM,gBAAgB,QAAQ,cAAc;AAC5C,QAAO,GAAG,EAAE,WAAW,aAAa,OAAO,GAAG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { promises } from "node:fs";
|
|
3
|
+
|
|
4
|
+
//#region src/installLSP.ts
|
|
5
|
+
const VSCODE_DIR = ".vscode";
|
|
6
|
+
const SETTINGS_FILENAME = "settings.json";
|
|
7
|
+
const LSP_COMMAND_KEY = "intlayer.languageServer.command";
|
|
8
|
+
const LSP_ARGS_KEY = "intlayer.languageServer.args";
|
|
9
|
+
const LSP_COMMAND_VALUE = "npx";
|
|
10
|
+
const LSP_ARGS_VALUE = ["@intlayer/lsp"];
|
|
11
|
+
/**
|
|
12
|
+
* Writes the Intlayer LSP configuration to `.vscode/settings.json`.
|
|
13
|
+
* Creates the file (and the `.vscode/` directory) if they don't exist.
|
|
14
|
+
* Does not overwrite keys that are already present.
|
|
15
|
+
*
|
|
16
|
+
* Returns a human-readable summary of what was done plus next-step instructions.
|
|
17
|
+
*/
|
|
18
|
+
const installLSP = async (projectRoot) => {
|
|
19
|
+
const settingsPath = path.join(projectRoot, VSCODE_DIR, SETTINGS_FILENAME);
|
|
20
|
+
await promises.mkdir(path.dirname(settingsPath), { recursive: true });
|
|
21
|
+
let settings = {};
|
|
22
|
+
try {
|
|
23
|
+
const raw = await promises.readFile(settingsPath, "utf-8");
|
|
24
|
+
settings = JSON.parse(raw);
|
|
25
|
+
} catch {}
|
|
26
|
+
const updated = [];
|
|
27
|
+
if (!settings[LSP_COMMAND_KEY]) {
|
|
28
|
+
settings[LSP_COMMAND_KEY] = LSP_COMMAND_VALUE;
|
|
29
|
+
updated.push(LSP_COMMAND_KEY);
|
|
30
|
+
}
|
|
31
|
+
if (!settings[LSP_ARGS_KEY]) {
|
|
32
|
+
settings[LSP_ARGS_KEY] = LSP_ARGS_VALUE;
|
|
33
|
+
updated.push(LSP_ARGS_KEY);
|
|
34
|
+
}
|
|
35
|
+
await promises.writeFile(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
|
|
36
|
+
return [
|
|
37
|
+
updated.length > 0 ? `Added to ${settingsPath}:\n${updated.map((k) => ` "${k}"`).join("\n")}` : `${settingsPath} already contains the LSP configuration — no changes made.`,
|
|
38
|
+
"",
|
|
39
|
+
"Next steps:",
|
|
40
|
+
"",
|
|
41
|
+
"1. Install the language server binary (required once):",
|
|
42
|
+
" npm install -g @intlayer/lsp",
|
|
43
|
+
"",
|
|
44
|
+
"2. (Optional) Register the Intlayer Claude Code plugin and enable Go-to-Definition inside Claude Code:",
|
|
45
|
+
" claude plugin marketplace add intlayer@github:aymericzip/intlayer",
|
|
46
|
+
" claude plugin install intlayer-lsp@intlayer",
|
|
47
|
+
" claude plugin enable intlayer-lsp@intlayer",
|
|
48
|
+
"",
|
|
49
|
+
"3. Reload your editor window so the new settings take effect."
|
|
50
|
+
].join("\n");
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { installLSP };
|
|
55
|
+
//# sourceMappingURL=installLSP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installLSP.mjs","names":["fs"],"sources":["../../src/installLSP.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\n\nconst VSCODE_DIR = '.vscode';\nconst SETTINGS_FILENAME = 'settings.json';\n\nconst LSP_COMMAND_KEY = 'intlayer.languageServer.command';\nconst LSP_ARGS_KEY = 'intlayer.languageServer.args';\nconst LSP_COMMAND_VALUE = 'npx';\nconst LSP_ARGS_VALUE = ['@intlayer/lsp'];\n\n/**\n * Writes the Intlayer LSP configuration to `.vscode/settings.json`.\n * Creates the file (and the `.vscode/` directory) if they don't exist.\n * Does not overwrite keys that are already present.\n *\n * Returns a human-readable summary of what was done plus next-step instructions.\n */\nexport const installLSP = async (projectRoot: string): Promise<string> => {\n const settingsPath = path.join(projectRoot, VSCODE_DIR, SETTINGS_FILENAME);\n\n await fs.mkdir(path.dirname(settingsPath), { recursive: true });\n\n let settings: Record<string, unknown> = {};\n try {\n const raw = await fs.readFile(settingsPath, 'utf-8');\n settings = JSON.parse(raw);\n } catch {\n // File does not exist or is invalid JSON — start from an empty object.\n }\n\n const updated: string[] = [];\n\n if (!settings[LSP_COMMAND_KEY]) {\n settings[LSP_COMMAND_KEY] = LSP_COMMAND_VALUE;\n updated.push(LSP_COMMAND_KEY);\n }\n\n if (!settings[LSP_ARGS_KEY]) {\n settings[LSP_ARGS_KEY] = LSP_ARGS_VALUE;\n updated.push(LSP_ARGS_KEY);\n }\n\n await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2), 'utf-8');\n\n const configSummary =\n updated.length > 0\n ? `Added to ${settingsPath}:\\n${updated.map((k) => ` \"${k}\"`).join('\\n')}`\n : `${settingsPath} already contains the LSP configuration — no changes made.`;\n\n return [\n configSummary,\n '',\n 'Next steps:',\n '',\n '1. Install the language server binary (required once):',\n ' npm install -g @intlayer/lsp',\n '',\n '2. (Optional) Register the Intlayer Claude Code plugin and enable Go-to-Definition inside Claude Code:',\n ' claude plugin marketplace add intlayer@github:aymericzip/intlayer',\n ' claude plugin install intlayer-lsp@intlayer',\n ' claude plugin enable intlayer-lsp@intlayer',\n '',\n '3. Reload your editor window so the new settings take effect.',\n ].join('\\n');\n};\n"],"mappings":";;;;AAGA,MAAM,aAAa;AACnB,MAAM,oBAAoB;AAE1B,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,iBAAiB,CAAC,gBAAgB;;;;;;;;AASxC,MAAa,aAAa,OAAO,gBAAyC;CACxE,MAAM,eAAe,KAAK,KAAK,aAAa,YAAY,kBAAkB;AAE1E,OAAMA,SAAG,MAAM,KAAK,QAAQ,aAAa,EAAE,EAAE,WAAW,MAAM,CAAC;CAE/D,IAAI,WAAoC,EAAE;AAC1C,KAAI;EACF,MAAM,MAAM,MAAMA,SAAG,SAAS,cAAc,QAAQ;AACpD,aAAW,KAAK,MAAM,IAAI;SACpB;CAIR,MAAM,UAAoB,EAAE;AAE5B,KAAI,CAAC,SAAS,kBAAkB;AAC9B,WAAS,mBAAmB;AAC5B,UAAQ,KAAK,gBAAgB;;AAG/B,KAAI,CAAC,SAAS,eAAe;AAC3B,WAAS,gBAAgB;AACzB,UAAQ,KAAK,aAAa;;AAG5B,OAAMA,SAAG,UAAU,cAAc,KAAK,UAAU,UAAU,MAAM,EAAE,EAAE,QAAQ;AAO5E,QAAO;EAJL,QAAQ,SAAS,IACb,YAAY,aAAa,KAAK,QAAQ,KAAK,MAAM,MAAM,EAAE,GAAG,CAAC,KAAK,KAAK,KACvE,GAAG,aAAa;EAIpB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK"}
|