@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,51 @@
|
|
|
1
|
+
import * as recast from "recast";
|
|
2
|
+
|
|
3
|
+
//#region src/init/utils/astImports.ts
|
|
4
|
+
const { builders: b } = recast.types;
|
|
5
|
+
/**
|
|
6
|
+
* Index just past the leading directives (e.g. `'use client'`) and import
|
|
7
|
+
* declarations — the safe insertion point for a new import.
|
|
8
|
+
*/
|
|
9
|
+
const firstInsertIndex = (ast) => {
|
|
10
|
+
const body = ast.program.body;
|
|
11
|
+
let index = 0;
|
|
12
|
+
while (index < body.length && (body[index].type === "ExpressionStatement" && body[index].expression?.type === "StringLiteral" || body[index].type === "ImportDeclaration")) index++;
|
|
13
|
+
return index;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Whether `name` is already bound at module scope — by any import (under that
|
|
17
|
+
* local name, regardless of source) or by a top-level
|
|
18
|
+
* `const`/`let`/`var`/`function`/`class` declaration.
|
|
19
|
+
*
|
|
20
|
+
* Used to avoid redeclaring an identifier the file already provides (e.g. a
|
|
21
|
+
* `defaultLocale` re-exported from a local `i18n` module), which would otherwise
|
|
22
|
+
* produce an `Identifier '…' has already been declared` parse error.
|
|
23
|
+
*/
|
|
24
|
+
const isModuleScopeBinding = (ast, name) => ast.program.body.some((statement) => {
|
|
25
|
+
const node = (statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration") && statement.declaration ? statement.declaration : statement;
|
|
26
|
+
if (node.type === "ImportDeclaration") return node.specifiers.some((spec) => spec.local?.name === name);
|
|
27
|
+
if (node.type === "VariableDeclaration") return node.declarations.some((decl) => decl.id?.type === "Identifier" && decl.id.name === name);
|
|
28
|
+
if (node.type === "FunctionDeclaration" || node.type === "ClassDeclaration") return node.id?.name === name;
|
|
29
|
+
return false;
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Ensures `import { importName } from source`, merging into an existing import
|
|
33
|
+
* from the same source. No-ops when `importName` is already bound at module
|
|
34
|
+
* scope (imported from another source or declared locally), reusing that binding
|
|
35
|
+
* instead of redeclaring it.
|
|
36
|
+
*
|
|
37
|
+
* Shared across every framework adapter so injected identifiers never collide
|
|
38
|
+
* with bindings the user's file already provides.
|
|
39
|
+
*/
|
|
40
|
+
const ensureNamedImport = (ast, importName, source) => {
|
|
41
|
+
if (isModuleScopeBinding(ast, importName)) return;
|
|
42
|
+
for (const statement of ast.program.body) if (statement.type === "ImportDeclaration" && statement.source.value === source) {
|
|
43
|
+
if (!statement.specifiers.some((spec) => spec.type === "ImportSpecifier" && spec.imported?.name === importName)) statement.specifiers.push(b.importSpecifier(b.identifier(importName)));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
ast.program.body.splice(firstInsertIndex(ast), 0, b.importDeclaration([b.importSpecifier(b.identifier(importName))], b.stringLiteral(source)));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { ensureNamedImport, firstInsertIndex, isModuleScopeBinding };
|
|
51
|
+
//# sourceMappingURL=astImports.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astImports.mjs","names":[],"sources":["../../../../src/init/utils/astImports.ts"],"sourcesContent":["import * as recast from 'recast';\n\nconst { builders: b } = recast.types;\n\n/**\n * Index just past the leading directives (e.g. `'use client'`) and import\n * declarations — the safe insertion point for a new import.\n */\nexport const firstInsertIndex = (ast: any): number => {\n const body = ast.program.body;\n let index = 0;\n while (\n index < body.length &&\n ((body[index].type === 'ExpressionStatement' &&\n body[index].expression?.type === 'StringLiteral') ||\n body[index].type === 'ImportDeclaration')\n ) {\n index++;\n }\n return index;\n};\n\n/**\n * Whether `name` is already bound at module scope — by any import (under that\n * local name, regardless of source) or by a top-level\n * `const`/`let`/`var`/`function`/`class` declaration.\n *\n * Used to avoid redeclaring an identifier the file already provides (e.g. a\n * `defaultLocale` re-exported from a local `i18n` module), which would otherwise\n * produce an `Identifier '…' has already been declared` parse error.\n */\nexport const isModuleScopeBinding = (ast: any, name: string): boolean =>\n ast.program.body.some((statement: any) => {\n // `export const x = …` / `export function x` / `export default class x`\n const node =\n (statement.type === 'ExportNamedDeclaration' ||\n statement.type === 'ExportDefaultDeclaration') &&\n statement.declaration\n ? statement.declaration\n : statement;\n\n if (node.type === 'ImportDeclaration') {\n return node.specifiers.some((spec: any) => spec.local?.name === name);\n }\n if (node.type === 'VariableDeclaration') {\n return node.declarations.some(\n (decl: any) => decl.id?.type === 'Identifier' && decl.id.name === name\n );\n }\n if (\n node.type === 'FunctionDeclaration' ||\n node.type === 'ClassDeclaration'\n ) {\n return node.id?.name === name;\n }\n return false;\n });\n\n/**\n * Ensures `import { importName } from source`, merging into an existing import\n * from the same source. No-ops when `importName` is already bound at module\n * scope (imported from another source or declared locally), reusing that binding\n * instead of redeclaring it.\n *\n * Shared across every framework adapter so injected identifiers never collide\n * with bindings the user's file already provides.\n */\nexport const ensureNamedImport = (\n ast: any,\n importName: string,\n source: string\n): void => {\n if (isModuleScopeBinding(ast, importName)) return;\n\n for (const statement of ast.program.body) {\n if (\n statement.type === 'ImportDeclaration' &&\n statement.source.value === source\n ) {\n const hasSpecifier = statement.specifiers.some(\n (spec: any) =>\n spec.type === 'ImportSpecifier' && spec.imported?.name === importName\n );\n if (!hasSpecifier) {\n statement.specifiers.push(b.importSpecifier(b.identifier(importName)));\n }\n return;\n }\n }\n\n ast.program.body.splice(\n firstInsertIndex(ast),\n 0,\n b.importDeclaration(\n [b.importSpecifier(b.identifier(importName))],\n b.stringLiteral(source)\n )\n );\n};\n"],"mappings":";;;AAEA,MAAM,EAAE,UAAU,MAAM,OAAO;;;;;AAM/B,MAAa,oBAAoB,QAAqB;CACpD,MAAM,OAAO,IAAI,QAAQ;CACzB,IAAI,QAAQ;AACZ,QACE,QAAQ,KAAK,WACX,KAAK,OAAO,SAAS,yBACrB,KAAK,OAAO,YAAY,SAAS,mBACjC,KAAK,OAAO,SAAS,qBAEvB;AAEF,QAAO;;;;;;;;;;;AAYT,MAAa,wBAAwB,KAAU,SAC7C,IAAI,QAAQ,KAAK,MAAM,cAAmB;CAExC,MAAM,QACH,UAAU,SAAS,4BAClB,UAAU,SAAS,+BACrB,UAAU,cACN,UAAU,cACV;AAEN,KAAI,KAAK,SAAS,oBAChB,QAAO,KAAK,WAAW,MAAM,SAAc,KAAK,OAAO,SAAS,KAAK;AAEvE,KAAI,KAAK,SAAS,sBAChB,QAAO,KAAK,aAAa,MACtB,SAAc,KAAK,IAAI,SAAS,gBAAgB,KAAK,GAAG,SAAS,KACnE;AAEH,KACE,KAAK,SAAS,yBACd,KAAK,SAAS,mBAEd,QAAO,KAAK,IAAI,SAAS;AAE3B,QAAO;EACP;;;;;;;;;;AAWJ,MAAa,qBACX,KACA,YACA,WACS;AACT,KAAI,qBAAqB,KAAK,WAAW,CAAE;AAE3C,MAAK,MAAM,aAAa,IAAI,QAAQ,KAClC,KACE,UAAU,SAAS,uBACnB,UAAU,OAAO,UAAU,QAC3B;AAKA,MAAI,CAJiB,UAAU,WAAW,MACvC,SACC,KAAK,SAAS,qBAAqB,KAAK,UAAU,SAAS,WAE9C,CACf,WAAU,WAAW,KAAK,EAAE,gBAAgB,EAAE,WAAW,WAAW,CAAC,CAAC;AAExE;;AAIJ,KAAI,QAAQ,KAAK,OACf,iBAAiB,IAAI,EACrB,GACA,EAAE,kBACA,CAAC,EAAE,gBAAgB,EAAE,WAAW,WAAW,CAAC,CAAC,EAC7C,EAAE,cAAc,OAAO,CACxB,CACF"}
|
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
import { __require } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { isModuleScopeBinding } from "./astImports.mjs";
|
|
3
|
+
import * as recast from "recast";
|
|
4
|
+
|
|
5
|
+
//#region src/init/utils/configManipulation.ts
|
|
6
|
+
const { builders: b, namedTypes: n } = recast.types;
|
|
7
|
+
/** Narrows an arbitrary recast node to an object expression. */
|
|
8
|
+
const isObjectExpression = (node) => Boolean(node) && (node.type === "ObjectExpression" || n.ObjectExpression.check(node));
|
|
9
|
+
/**
|
|
10
|
+
* Finds a property by key name on an object expression, creating it with the
|
|
11
|
+
* provided default value node when it is absent. Returns the property node so
|
|
12
|
+
* callers can read or mutate its value while preserving any attached comments.
|
|
13
|
+
*/
|
|
14
|
+
const ensureObjectProperty = (objExpr, key, defaultValueNode) => {
|
|
15
|
+
let property = objExpr.properties.find((prop) => {
|
|
16
|
+
if (!prop?.key) return false;
|
|
17
|
+
return (prop.key.name ?? prop.key.value) === key;
|
|
18
|
+
});
|
|
19
|
+
if (!property) {
|
|
20
|
+
property = b.property("init", b.identifier(key), defaultValueNode);
|
|
21
|
+
objExpr.properties.push(property);
|
|
22
|
+
}
|
|
23
|
+
return property;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Sets (or replaces) a property's value on an object expression. When the
|
|
27
|
+
* property already exists only its value node is swapped, which keeps the
|
|
28
|
+
* leading documentation comment in place.
|
|
29
|
+
*/
|
|
30
|
+
const setObjectPropertyValue = (objExpr, key, valueNode) => {
|
|
31
|
+
const property = objExpr.properties.find((prop) => {
|
|
32
|
+
if (!prop?.key) return false;
|
|
33
|
+
return (prop.key.name ?? prop.key.value) === key;
|
|
34
|
+
});
|
|
35
|
+
if (property) {
|
|
36
|
+
property.value = valueNode;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
objExpr.properties.push(b.property("init", b.identifier(key), valueNode));
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Adds a `process.env.<envVar>` reference property to an object expression when
|
|
43
|
+
* the property is not already present. Existing values are left untouched.
|
|
44
|
+
*/
|
|
45
|
+
const addEnvReferenceProperty = (objExpr, key, envVar) => {
|
|
46
|
+
if (objExpr.properties.some((prop) => {
|
|
47
|
+
if (!prop?.key) return false;
|
|
48
|
+
return (prop.key.name ?? prop.key.value) === key;
|
|
49
|
+
})) return;
|
|
50
|
+
objExpr.properties.push(b.property("init", b.identifier(key), b.memberExpression(b.memberExpression(b.identifier("process"), b.identifier("env")), b.identifier(envVar))));
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Sets `routing.mode` in an Intlayer configuration file to the requested
|
|
54
|
+
* strategy. Idempotent: re-running with the same mode produces identical
|
|
55
|
+
* output. Supports `.ts`, `.mjs`, `.js` and `.cjs` configs; JSON configs are
|
|
56
|
+
* handled with a scoped string replacement since they cannot be parsed by the
|
|
57
|
+
* TypeScript recast parser.
|
|
58
|
+
*/
|
|
59
|
+
const setIntlayerConfigRoutingMode = (content, extension, mode) => {
|
|
60
|
+
if (extension === "json") return content.replace(/("mode"\s*:\s*)"(?:prefix-no-default|prefix-all|no-prefix|search-params)"/, `$1"${mode}"`);
|
|
61
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
62
|
+
genericRecastVisit(ast, (objExpr) => {
|
|
63
|
+
if (!isObjectExpression(objExpr)) return;
|
|
64
|
+
const routingProperty = ensureObjectProperty(objExpr, "routing", b.objectExpression([]));
|
|
65
|
+
if (!isObjectExpression(routingProperty.value)) return;
|
|
66
|
+
setObjectPropertyValue(routingProperty.value, "mode", b.stringLiteral(mode));
|
|
67
|
+
});
|
|
68
|
+
return recast.print(ast).code;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Enables the Intlayer visual editor in a configuration file: sets
|
|
72
|
+
* `editor.enabled` to `true` and wires `clientId` / `clientSecret` to the
|
|
73
|
+
* `INTLAYER_CLIENT_ID` / `INTLAYER_CLIENT_SECRET` environment variables.
|
|
74
|
+
* Idempotent and non-destructive — existing `clientId` / `clientSecret` values
|
|
75
|
+
* are preserved. Only `.ts`, `.mjs`, `.js` and `.cjs` configs are supported
|
|
76
|
+
* (JSON cannot reference `process.env`).
|
|
77
|
+
*/
|
|
78
|
+
const enableIntlayerEditorConfig = (content) => {
|
|
79
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
80
|
+
genericRecastVisit(ast, (objExpr) => {
|
|
81
|
+
if (!isObjectExpression(objExpr)) return;
|
|
82
|
+
const editorProperty = ensureObjectProperty(objExpr, "editor", b.objectExpression([]));
|
|
83
|
+
if (!isObjectExpression(editorProperty.value)) return;
|
|
84
|
+
const editorObject = editorProperty.value;
|
|
85
|
+
setObjectPropertyValue(editorObject, "enabled", b.booleanLiteral(true));
|
|
86
|
+
addEnvReferenceProperty(editorObject, "clientId", "INTLAYER_CLIENT_ID");
|
|
87
|
+
addEnvReferenceProperty(editorObject, "clientSecret", "INTLAYER_CLIENT_SECRET");
|
|
88
|
+
});
|
|
89
|
+
return recast.print(ast).code;
|
|
90
|
+
};
|
|
91
|
+
const injectImport = (ast, isCJS, importName, source) => {
|
|
92
|
+
if (!isCJS && isModuleScopeBinding(ast, importName)) return;
|
|
93
|
+
if (ast.program.body.some((stmt) => {
|
|
94
|
+
if (isCJS) return n.VariableDeclaration.check(stmt) && stmt.declarations.some((decl) => n.VariableDeclarator.check(decl) && n.CallExpression.check(decl.init) && n.Identifier.check(decl.init.callee) && decl.init.callee.name === "require" && n.StringLiteral.check(decl.init.arguments[0]) && decl.init.arguments[0].value === source);
|
|
95
|
+
return n.ImportDeclaration.check(stmt) && (stmt.source.value === source || stmt.specifiers?.some((spec) => n.ImportSpecifier.check(spec) && spec.imported.name === importName || n.ImportDefaultSpecifier.check(spec) && spec.local?.name === importName));
|
|
96
|
+
})) return;
|
|
97
|
+
const declaration = isCJS ? b.variableDeclaration("const", [b.variableDeclarator(b.identifier(`{ ${importName} }`), b.callExpression(b.identifier("require"), [b.stringLiteral(source)]))]) : b.importDeclaration([b.importSpecifier(b.identifier(importName))], b.stringLiteral(source));
|
|
98
|
+
ast.program.body.unshift(declaration);
|
|
99
|
+
};
|
|
100
|
+
const updatePluginArray = (objExpr, propertyName, pluginName) => {
|
|
101
|
+
if (!objExpr || objExpr.type !== "ObjectExpression" && !n.ObjectExpression.check(objExpr)) return;
|
|
102
|
+
let prop = objExpr.properties.find((p) => {
|
|
103
|
+
if (!p?.key) return false;
|
|
104
|
+
return (p.key.name || p.key.value) === propertyName;
|
|
105
|
+
});
|
|
106
|
+
if (!prop) {
|
|
107
|
+
prop = b.property("init", b.identifier(propertyName), b.arrayExpression([]));
|
|
108
|
+
objExpr.properties.push(prop);
|
|
109
|
+
}
|
|
110
|
+
const arrayValue = prop.value;
|
|
111
|
+
if (arrayValue && (arrayValue.type === "ArrayExpression" || n.ArrayExpression.check(arrayValue))) {
|
|
112
|
+
if (!arrayValue.elements.some((el) => {
|
|
113
|
+
const callee = el?.callee;
|
|
114
|
+
if (!callee) return false;
|
|
115
|
+
const name = callee.name || callee.id?.name;
|
|
116
|
+
return name === pluginName || name === "il";
|
|
117
|
+
})) arrayValue.elements.push(b.callExpression(b.identifier(pluginName), []));
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const genericRecastVisit = (ast, updateConfigObject, callNames = ["defineConfig"]) => {
|
|
121
|
+
/**
|
|
122
|
+
* Resolves an identifier reference (e.g. `export default config` /
|
|
123
|
+
* `module.exports = config`) back to the object expression it was declared
|
|
124
|
+
* with, then runs the updater on it.
|
|
125
|
+
*/
|
|
126
|
+
const resolveIdentifierConfig = (name) => {
|
|
127
|
+
ast.program.body.forEach((stmt) => {
|
|
128
|
+
if (n.VariableDeclaration.check(stmt)) stmt.declarations.forEach((vdecl) => {
|
|
129
|
+
if (n.VariableDeclarator.check(vdecl) && n.Identifier.check(vdecl.id) && vdecl.id.name === name && n.ObjectExpression.check(vdecl.init)) updateConfigObject(vdecl.init);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
recast.visit(ast, {
|
|
134
|
+
visitExportDefaultDeclaration(path) {
|
|
135
|
+
const decl = path.node.declaration;
|
|
136
|
+
if (n.ObjectExpression.check(decl)) updateConfigObject(decl);
|
|
137
|
+
else if (n.CallExpression.check(decl) && n.Identifier.check(decl.callee) && callNames.includes(decl.callee.name)) {
|
|
138
|
+
if (n.ObjectExpression.check(decl.arguments[0])) updateConfigObject(decl.arguments[0]);
|
|
139
|
+
} else if (n.Identifier.check(decl)) resolveIdentifierConfig(decl.name);
|
|
140
|
+
return false;
|
|
141
|
+
},
|
|
142
|
+
visitAssignmentExpression(path) {
|
|
143
|
+
const { left, right } = path.node;
|
|
144
|
+
if (n.MemberExpression.check(left) && recast.print(left).code === "module.exports") {
|
|
145
|
+
if (n.ObjectExpression.check(right)) updateConfigObject(right);
|
|
146
|
+
else if (n.CallExpression.check(right) && n.Identifier.check(right.callee) && callNames.includes(right.callee.name)) {
|
|
147
|
+
if (n.ObjectExpression.check(right.arguments[0])) updateConfigObject(right.arguments[0]);
|
|
148
|
+
} else if (n.Identifier.check(right)) resolveIdentifierConfig(right.name);
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
const updateViteConfig = (content, extension) => {
|
|
155
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
156
|
+
injectImport(ast, extension === "cjs" || content.includes("module.exports") && !content.includes("import "), "intlayer", "vite-intlayer");
|
|
157
|
+
genericRecastVisit(ast, (obj) => updatePluginArray(obj, "plugins", "intlayer"));
|
|
158
|
+
return recast.print(ast).code;
|
|
159
|
+
};
|
|
160
|
+
const updateAstroConfig = (content, extension) => {
|
|
161
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
162
|
+
injectImport(ast, extension === "cjs" || content.includes("module.exports") && !content.includes("import "), "intlayer", "astro-intlayer");
|
|
163
|
+
genericRecastVisit(ast, (obj) => updatePluginArray(obj, "integrations", "intlayer"));
|
|
164
|
+
return recast.print(ast).code;
|
|
165
|
+
};
|
|
166
|
+
const updateNextConfig = (content, extension) => {
|
|
167
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
168
|
+
injectImport(ast, extension === "cjs" || content.includes("module.exports"), "withIntlayer", "next-intlayer/server");
|
|
169
|
+
recast.visit(ast, {
|
|
170
|
+
visitExportDefaultDeclaration(path) {
|
|
171
|
+
const declaration = path.node.declaration;
|
|
172
|
+
if (n.Expression.check(declaration) && !(n.CallExpression.check(declaration) && n.Identifier.check(declaration.callee) && declaration.callee.name === "withIntlayer")) path.get("declaration").replace(b.callExpression(b.identifier("withIntlayer"), [declaration]));
|
|
173
|
+
return false;
|
|
174
|
+
},
|
|
175
|
+
visitAssignmentExpression(path) {
|
|
176
|
+
const { left, right } = path.node;
|
|
177
|
+
if (n.MemberExpression.check(left) && recast.print(left).code === "module.exports" && !(n.CallExpression.check(right) && n.Identifier.check(right.callee) && right.callee.name === "withIntlayer")) path.get("right").replace(b.callExpression(b.identifier("withIntlayer"), [right]));
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return recast.print(ast).code;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Returns true when the expression looks like an Immediately Invoked Function
|
|
185
|
+
* Expression (e.g. `(async () => { ... })()`). Such custom async exports cannot
|
|
186
|
+
* be safely wrapped with the synchronous Metro helper, so they are skipped.
|
|
187
|
+
*/
|
|
188
|
+
const isImmediatelyInvokedFunction = (node) => n.CallExpression.check(node) && (n.ArrowFunctionExpression.check(node.callee) || n.FunctionExpression.check(node.callee));
|
|
189
|
+
/**
|
|
190
|
+
* Wraps a React Native Metro config's exported value with
|
|
191
|
+
* `configMetroIntlayerSync` from `react-native-intlayer/metro`, injecting the
|
|
192
|
+
* import. The synchronous helper is used because it wraps a plain config object
|
|
193
|
+
* and needs no IIFE, making it safe to inject into existing configs without
|
|
194
|
+
* restructuring them.
|
|
195
|
+
*
|
|
196
|
+
* Non-destructive: returns the content unchanged when the export is already
|
|
197
|
+
* wrapped, when the Intlayer Metro plugin is already present, or when the export
|
|
198
|
+
* is a custom async IIFE that cannot be wrapped synchronously. Callers should
|
|
199
|
+
* compare the result with the input to detect the skipped case.
|
|
200
|
+
*/
|
|
201
|
+
const updateMetroConfig = (content, extension) => {
|
|
202
|
+
if (content.includes("react-native-intlayer")) return content;
|
|
203
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
204
|
+
const isCJSFile = extension === "cjs" || content.includes("module.exports") && !content.includes("import ");
|
|
205
|
+
const wrapperName = "configMetroIntlayerSync";
|
|
206
|
+
const isWrappable = (node) => n.Expression.check(node) && !isImmediatelyInvokedFunction(node) && !(n.CallExpression.check(node) && n.Identifier.check(node.callee) && node.callee.name === wrapperName);
|
|
207
|
+
let wrapped = false;
|
|
208
|
+
recast.visit(ast, {
|
|
209
|
+
visitExportDefaultDeclaration(path) {
|
|
210
|
+
const declaration = path.node.declaration;
|
|
211
|
+
if (isWrappable(declaration)) {
|
|
212
|
+
path.get("declaration").replace(b.callExpression(b.identifier(wrapperName), [declaration]));
|
|
213
|
+
wrapped = true;
|
|
214
|
+
}
|
|
215
|
+
return false;
|
|
216
|
+
},
|
|
217
|
+
visitAssignmentExpression(path) {
|
|
218
|
+
const { left, right } = path.node;
|
|
219
|
+
if (n.MemberExpression.check(left) && recast.print(left).code === "module.exports" && isWrappable(right)) {
|
|
220
|
+
path.get("right").replace(b.callExpression(b.identifier(wrapperName), [right]));
|
|
221
|
+
wrapped = true;
|
|
222
|
+
}
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
if (!wrapped) return content;
|
|
227
|
+
injectImport(ast, isCJSFile, wrapperName, "react-native-intlayer/metro");
|
|
228
|
+
return recast.print(ast).code;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Builds the contents of a fresh `metro.config.js` wired with the Intlayer
|
|
232
|
+
* Metro plugin. Uses the async `configMetroIntlayer` helper (which can build
|
|
233
|
+
* dictionaries on server start) and picks the default-config source based on
|
|
234
|
+
* whether the project is an Expo app.
|
|
235
|
+
*/
|
|
236
|
+
const getMetroConfigTemplate = (isExpo) => {
|
|
237
|
+
return `const { getDefaultConfig } = require("${isExpo ? "expo/metro-config" : "@react-native/metro-config"}");
|
|
238
|
+
const { configMetroIntlayer } = require("react-native-intlayer/metro");
|
|
239
|
+
|
|
240
|
+
module.exports = (async () => {
|
|
241
|
+
const defaultConfig = getDefaultConfig(__dirname);
|
|
242
|
+
|
|
243
|
+
return await configMetroIntlayer(defaultConfig);
|
|
244
|
+
})();
|
|
245
|
+
`;
|
|
246
|
+
};
|
|
247
|
+
const updateNuxtConfig = (content) => {
|
|
248
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
249
|
+
const updateConfigObject = (objExpr) => {
|
|
250
|
+
if (!objExpr || objExpr.type !== "ObjectExpression" && !n.ObjectExpression.check(objExpr)) return;
|
|
251
|
+
let modulesProp = objExpr.properties.find((p) => {
|
|
252
|
+
if (!p?.key) return false;
|
|
253
|
+
return (p.key.name || p.key.value) === "modules";
|
|
254
|
+
});
|
|
255
|
+
if (!modulesProp) {
|
|
256
|
+
modulesProp = b.property("init", b.identifier("modules"), b.arrayExpression([]));
|
|
257
|
+
objExpr.properties.push(modulesProp);
|
|
258
|
+
}
|
|
259
|
+
const modulesValue = modulesProp.value;
|
|
260
|
+
if (modulesValue && (modulesValue.type === "ArrayExpression" || n.ArrayExpression.check(modulesValue))) {
|
|
261
|
+
if (!modulesValue.elements.some((el) => {
|
|
262
|
+
if (n.StringLiteral.check(el) || el.type === "StringLiteral" || el.type === "Literal") return (el.value || el.extra?.rawValue) === "nuxt-intlayer";
|
|
263
|
+
return false;
|
|
264
|
+
})) modulesValue.elements.push(b.stringLiteral("nuxt-intlayer"));
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
genericRecastVisit(ast, updateConfigObject, ["defineNuxtConfig"]);
|
|
268
|
+
return recast.print(ast).code;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Updates a Vite config for vue-i18n compat: injects `vueI18nVitePlugin` from
|
|
272
|
+
* `@intlayer/vue-i18n/plugin` into the plugins array.
|
|
273
|
+
*/
|
|
274
|
+
const updateViteConfigForVueI18n = (content, extension) => {
|
|
275
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
276
|
+
injectImport(ast, extension === "cjs" || content.includes("module.exports") && !content.includes("import "), "vueI18nVitePlugin", "@intlayer/vue-i18n/plugin");
|
|
277
|
+
genericRecastVisit(ast, (obj) => updatePluginArray(obj, "plugins", "vueI18nVitePlugin"));
|
|
278
|
+
return recast.print(ast).code;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Generic vite config updater for any compat plugin that uses alias injection.
|
|
282
|
+
* Injects the named import from `pluginPackageSource` and appends the plugin
|
|
283
|
+
* call to the `plugins` array.
|
|
284
|
+
*/
|
|
285
|
+
const updateViteConfigForCompatPlugin = (content, extension, pluginConfig) => {
|
|
286
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
287
|
+
injectImport(ast, extension === "cjs" || content.includes("module.exports") && !content.includes("import "), pluginConfig.pluginFunctionName, pluginConfig.pluginPackageSource);
|
|
288
|
+
genericRecastVisit(ast, (obj) => updatePluginArray(obj, "plugins", pluginConfig.pluginFunctionName));
|
|
289
|
+
return recast.print(ast).code;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Rewrites the module source of an existing named import in a vite config,
|
|
293
|
+
* keeping the imported binding and its call site untouched. Used when a compat
|
|
294
|
+
* plugin is a drop-in replacement for an i18n library's own vite plugin — e.g.
|
|
295
|
+
* lingui: `import { lingui } from "@lingui/vite-plugin"` becomes
|
|
296
|
+
* `import { lingui } from "@intlayer/lingui/plugin"`, leaving `lingui()` in the
|
|
297
|
+
* `plugins` array as-is. Returns the content unchanged when no matching import
|
|
298
|
+
* is found.
|
|
299
|
+
*/
|
|
300
|
+
const replaceViteConfigPluginImportSource = (content, importName, fromPackageSource, toPackageSource) => {
|
|
301
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
302
|
+
let changed = false;
|
|
303
|
+
recast.visit(ast, { visitImportDeclaration(path) {
|
|
304
|
+
const { source, specifiers } = path.node;
|
|
305
|
+
const importsBinding = (specifiers ?? []).some((specifier) => n.ImportSpecifier.check(specifier) && specifier.imported.name === importName);
|
|
306
|
+
if (n.StringLiteral.check(source) && source.value === fromPackageSource && importsBinding) {
|
|
307
|
+
source.value = toPackageSource;
|
|
308
|
+
changed = true;
|
|
309
|
+
}
|
|
310
|
+
return false;
|
|
311
|
+
} });
|
|
312
|
+
if (!changed) return content;
|
|
313
|
+
return recast.print(ast).code;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Generic Next.js config wrapper for compat plugins. Injects the import and
|
|
317
|
+
* wraps the default export / `module.exports` with a HOC call.
|
|
318
|
+
*/
|
|
319
|
+
const wrapNextConfigWithHoc = (content, extension, hocFunctionName, pluginPackageSource) => {
|
|
320
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
321
|
+
injectImport(ast, extension === "cjs" || content.includes("module.exports"), hocFunctionName, pluginPackageSource);
|
|
322
|
+
recast.visit(ast, {
|
|
323
|
+
visitExportDefaultDeclaration(path) {
|
|
324
|
+
const declaration = path.node.declaration;
|
|
325
|
+
if (n.Expression.check(declaration) && !(n.CallExpression.check(declaration) && n.Identifier.check(declaration.callee) && declaration.callee.name === hocFunctionName)) path.get("declaration").replace(b.callExpression(b.identifier(hocFunctionName), [declaration]));
|
|
326
|
+
return false;
|
|
327
|
+
},
|
|
328
|
+
visitAssignmentExpression(path) {
|
|
329
|
+
const { left, right } = path.node;
|
|
330
|
+
if (n.MemberExpression.check(left) && recast.print(left).code === "module.exports" && !(n.CallExpression.check(right) && n.Identifier.check(right.callee) && right.callee.name === hocFunctionName)) path.get("right").replace(b.callExpression(b.identifier(hocFunctionName), [right]));
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
return recast.print(ast).code;
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Updates a Next.js config for next-translate compat: wraps the default export
|
|
338
|
+
* with `withNextTranslate` from `@intlayer/next-translate/plugin`.
|
|
339
|
+
*/
|
|
340
|
+
const updateNextConfigForNextTranslate = (content, extension) => wrapNextConfigWithHoc(content, extension, "withNextTranslate", "@intlayer/next-translate/plugin");
|
|
341
|
+
/**
|
|
342
|
+
* Updates a Nuxt config for nuxtjs-i18n compat: adds `@intlayer/nuxtjs-i18n`
|
|
343
|
+
* to the `modules` array.
|
|
344
|
+
*/
|
|
345
|
+
const updateNuxtConfigForNuxtjsI18n = (content) => {
|
|
346
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
347
|
+
const updateConfigObject = (objExpr) => {
|
|
348
|
+
if (!objExpr || objExpr.type !== "ObjectExpression" && !n.ObjectExpression.check(objExpr)) return;
|
|
349
|
+
let modulesProp = objExpr.properties.find((p) => {
|
|
350
|
+
if (!p?.key) return false;
|
|
351
|
+
return (p.key.name || p.key.value) === "modules";
|
|
352
|
+
});
|
|
353
|
+
if (!modulesProp) {
|
|
354
|
+
modulesProp = b.property("init", b.identifier("modules"), b.arrayExpression([]));
|
|
355
|
+
objExpr.properties.push(modulesProp);
|
|
356
|
+
}
|
|
357
|
+
const modulesValue = modulesProp.value;
|
|
358
|
+
if (modulesValue && (modulesValue.type === "ArrayExpression" || n.ArrayExpression.check(modulesValue))) {
|
|
359
|
+
if (!modulesValue.elements.some((el) => {
|
|
360
|
+
if (n.StringLiteral.check(el) || el.type === "StringLiteral" || el.type === "Literal") return (el.value ?? el.extra?.rawValue) === "@intlayer/nuxtjs-i18n";
|
|
361
|
+
return false;
|
|
362
|
+
})) modulesValue.elements.push(b.stringLiteral("@intlayer/nuxtjs-i18n"));
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
genericRecastVisit(ast, updateConfigObject, ["defineNuxtConfig"]);
|
|
366
|
+
return recast.print(ast).code;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Updates a Next.js config for next-i18next compat: wraps the default export
|
|
370
|
+
* with `withI18next` from `@intlayer/next-i18next/plugin`.
|
|
371
|
+
*/
|
|
372
|
+
const updateNextConfigForNextI18next = (content, extension) => wrapNextConfigWithHoc(content, extension, "withI18next", "@intlayer/next-i18next/plugin");
|
|
373
|
+
/**
|
|
374
|
+
* Updates a Next.js config for next-intl compat: replaces any existing
|
|
375
|
+
* `next-intl/plugin` import source with `@intlayer/next-intl/plugin`, or
|
|
376
|
+
* injects `createNextIntlPlugin` with a factory-call wrapper when no such
|
|
377
|
+
* import is present.
|
|
378
|
+
*/
|
|
379
|
+
const updateNextConfigForNextIntl = (content, extension) => {
|
|
380
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
381
|
+
const isCJSFile = extension === "cjs" || content.includes("module.exports");
|
|
382
|
+
let replacedExistingSource = false;
|
|
383
|
+
recast.visit(ast, { visitImportDeclaration(path) {
|
|
384
|
+
if (path.node.source.value === "next-intl/plugin") {
|
|
385
|
+
path.node.source = b.stringLiteral("@intlayer/next-intl/plugin");
|
|
386
|
+
replacedExistingSource = true;
|
|
387
|
+
}
|
|
388
|
+
return false;
|
|
389
|
+
} });
|
|
390
|
+
if (replacedExistingSource) return recast.print(ast).code;
|
|
391
|
+
if (ast.program.body.some((stmt) => {
|
|
392
|
+
if (!n.ImportDeclaration.check(stmt)) return false;
|
|
393
|
+
return (stmt.specifiers ?? []).some((spec) => n.ImportSpecifier.check(spec) && spec.imported.name === "createNextIntlPlugin" || n.ImportDefaultSpecifier.check(spec) && spec.local?.name === "createNextIntlPlugin");
|
|
394
|
+
})) return recast.print(ast).code;
|
|
395
|
+
injectImport(ast, isCJSFile, "createNextIntlPlugin", "@intlayer/next-intl/plugin");
|
|
396
|
+
const lastImportIndex = ast.program.body.reduce((lastIndex, stmt, index) => {
|
|
397
|
+
if (n.ImportDeclaration.check(stmt)) return index;
|
|
398
|
+
return lastIndex;
|
|
399
|
+
}, -1);
|
|
400
|
+
const factoryCallDeclaration = b.variableDeclaration("const", [b.variableDeclarator(b.identifier("_withNextIntlayer"), b.callExpression(b.identifier("createNextIntlPlugin"), []))]);
|
|
401
|
+
ast.program.body.splice(lastImportIndex + 1, 0, factoryCallDeclaration);
|
|
402
|
+
recast.visit(ast, {
|
|
403
|
+
visitExportDefaultDeclaration(path) {
|
|
404
|
+
const declaration = path.node.declaration;
|
|
405
|
+
if (n.Expression.check(declaration) && !(n.CallExpression.check(declaration) && n.Identifier.check(declaration.callee) && declaration.callee.name === "_withNextIntlayer")) path.get("declaration").replace(b.callExpression(b.identifier("_withNextIntlayer"), [declaration]));
|
|
406
|
+
return false;
|
|
407
|
+
},
|
|
408
|
+
visitAssignmentExpression(path) {
|
|
409
|
+
const { left, right } = path.node;
|
|
410
|
+
if (n.MemberExpression.check(left) && recast.print(left).code === "module.exports" && !(n.CallExpression.check(right) && n.Identifier.check(right.callee) && right.callee.name === "_withNextIntlayer")) path.get("right").replace(b.callExpression(b.identifier("_withNextIntlayer"), [right]));
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
return recast.print(ast).code;
|
|
415
|
+
};
|
|
416
|
+
/** Resolves the sync plugin (function + package) for a compat sync config. */
|
|
417
|
+
const getSyncPluginInfo = (syncConfig) => syncConfig.plugin === "po" ? {
|
|
418
|
+
functionName: "syncPO",
|
|
419
|
+
packageSource: "@intlayer/sync-po-plugin"
|
|
420
|
+
} : {
|
|
421
|
+
functionName: "syncJSON",
|
|
422
|
+
packageSource: "@intlayer/sync-json-plugin"
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* Parses a `syncJSON({ ... })` / `syncPO({ ... })` call expression from a source
|
|
426
|
+
* snippet so it can be injected into a config AST without manually constructing
|
|
427
|
+
* template-literal nodes via builders.
|
|
428
|
+
*
|
|
429
|
+
* The destructuring parameters adapt to whether the source template uses the
|
|
430
|
+
* `key` placeholder (nested pattern) or only `locale` (flat pattern).
|
|
431
|
+
*/
|
|
432
|
+
const buildSyncCallNode = (syncConfig) => {
|
|
433
|
+
const { functionName } = getSyncPluginInfo(syncConfig);
|
|
434
|
+
const paramDestructuring = !syncConfig.sourceTemplate.includes("${key}") ? "{ locale }" : syncConfig.format === "icu" || syncConfig.plugin === "po" ? "{ key, locale }" : "{ locale, key }";
|
|
435
|
+
const formatProperty = syncConfig.plugin === "po" ? "" : `format: '${syncConfig.format}', `;
|
|
436
|
+
const splitKeysProperty = syncConfig.splitKeys ? ", splitKeys: true" : "";
|
|
437
|
+
const snippet = `${functionName}({ ${formatProperty}source: (${paramDestructuring}) => \`${syncConfig.sourceTemplate}\`${splitKeysProperty} })`;
|
|
438
|
+
return recast.parse(snippet, { parser: __require("recast/parsers/typescript") }).program.body[0].expression;
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* Injects or ensures `dictionary: { format: '<value>' }` exists in an object
|
|
442
|
+
* expression. Leaves any pre-existing `dictionary` properties untouched —
|
|
443
|
+
* only the `format` sub-property is added when absent.
|
|
444
|
+
*/
|
|
445
|
+
const injectDictionaryFormat = (objExpr, format) => {
|
|
446
|
+
if (!objExpr || objExpr.type !== "ObjectExpression" && !n.ObjectExpression.check(objExpr)) return;
|
|
447
|
+
let dictionaryProp = objExpr.properties.find((prop) => {
|
|
448
|
+
if (!prop?.key) return false;
|
|
449
|
+
return (prop.key.name ?? prop.key.value) === "dictionary";
|
|
450
|
+
});
|
|
451
|
+
if (!dictionaryProp) {
|
|
452
|
+
dictionaryProp = b.property("init", b.identifier("dictionary"), b.objectExpression([]));
|
|
453
|
+
objExpr.properties.push(dictionaryProp);
|
|
454
|
+
}
|
|
455
|
+
const dictionaryObj = dictionaryProp.value;
|
|
456
|
+
if (!dictionaryObj || dictionaryObj.type !== "ObjectExpression" && !n.ObjectExpression.check(dictionaryObj)) return;
|
|
457
|
+
if (!dictionaryObj.properties.some((prop) => {
|
|
458
|
+
if (!prop?.key) return false;
|
|
459
|
+
return (prop.key.name ?? prop.key.value) === "format";
|
|
460
|
+
})) dictionaryObj.properties.push(b.property("init", b.identifier("format"), b.stringLiteral(format)));
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* Injects the sync plugin import (`syncJSON` / `syncPO`) and a configured
|
|
464
|
+
* `syncJSON(...)` / `syncPO(...)` call into the plugins array of an intlayer
|
|
465
|
+
* config file. Idempotent: skips when the plugin call is already present.
|
|
466
|
+
*/
|
|
467
|
+
const updateIntlayerConfigWithSyncPlugin = (content, extension, syncConfig) => {
|
|
468
|
+
const ast = recast.parse(content, { parser: __require("recast/parsers/typescript") });
|
|
469
|
+
const isCJSFile = extension === "cjs" || content.includes("module.exports");
|
|
470
|
+
const { functionName, packageSource } = getSyncPluginInfo(syncConfig);
|
|
471
|
+
injectImport(ast, isCJSFile, functionName, packageSource);
|
|
472
|
+
const callNode = buildSyncCallNode(syncConfig);
|
|
473
|
+
const dictionaryFormat = syncConfig.plugin === "po" ? "po" : syncConfig.format;
|
|
474
|
+
genericRecastVisit(ast, (objExpr) => {
|
|
475
|
+
if (!objExpr || objExpr.type !== "ObjectExpression" && !n.ObjectExpression.check(objExpr)) return;
|
|
476
|
+
injectDictionaryFormat(objExpr, dictionaryFormat);
|
|
477
|
+
let pluginsProp = objExpr.properties.find((prop) => {
|
|
478
|
+
if (!prop?.key) return false;
|
|
479
|
+
return (prop.key.name ?? prop.key.value) === "plugins";
|
|
480
|
+
});
|
|
481
|
+
if (!pluginsProp) {
|
|
482
|
+
pluginsProp = b.property("init", b.identifier("plugins"), b.arrayExpression([]));
|
|
483
|
+
objExpr.properties.push(pluginsProp);
|
|
484
|
+
}
|
|
485
|
+
const arrayValue = pluginsProp.value;
|
|
486
|
+
if (arrayValue && (arrayValue.type === "ArrayExpression" || n.ArrayExpression.check(arrayValue))) {
|
|
487
|
+
if (!arrayValue.elements.some((element) => {
|
|
488
|
+
const callee = element?.callee;
|
|
489
|
+
if (!callee) return false;
|
|
490
|
+
return (callee.name ?? callee.id?.name) === functionName;
|
|
491
|
+
})) arrayValue.elements.push(callNode);
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
return recast.print(ast).code;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
//#endregion
|
|
498
|
+
export { enableIntlayerEditorConfig, getMetroConfigTemplate, replaceViteConfigPluginImportSource, setIntlayerConfigRoutingMode, updateAstroConfig, updateIntlayerConfigWithSyncPlugin, updateMetroConfig, updateNextConfig, updateNextConfigForNextI18next, updateNextConfigForNextIntl, updateNextConfigForNextTranslate, updateNuxtConfig, updateNuxtConfigForNuxtjsI18n, updateViteConfig, updateViteConfigForCompatPlugin, updateViteConfigForVueI18n };
|
|
499
|
+
//# sourceMappingURL=configManipulation.mjs.map
|