gt 2.14.35 → 2.14.37
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/CHANGELOG.md +22 -1
- package/dist/api/collectUserEditDiffs.js +112 -155
- package/dist/api/collectUserEditDiffs.js.map +1 -0
- package/dist/api/downloadFileBatch.js +164 -241
- package/dist/api/downloadFileBatch.js.map +1 -0
- package/dist/api/saveLocalEdits.js +37 -41
- package/dist/api/saveLocalEdits.js.map +1 -0
- package/dist/bin/bin-entry.js +17 -7
- package/dist/bin/bin-entry.js.map +1 -0
- package/dist/bin/bin-main.js +43 -61
- package/dist/bin/bin-main.js.map +1 -0
- package/dist/cli/base.js +382 -497
- package/dist/cli/base.js.map +1 -0
- package/dist/cli/commands/download.js +41 -49
- package/dist/cli/commands/download.js.map +1 -0
- package/dist/cli/commands/enqueue.js +26 -25
- package/dist/cli/commands/enqueue.js.map +1 -0
- package/dist/cli/commands/setupProject.js +33 -36
- package/dist/cli/commands/setupProject.js.map +1 -0
- package/dist/cli/commands/stage.js +53 -61
- package/dist/cli/commands/stage.js.map +1 -0
- package/dist/cli/commands/translate.js +75 -112
- package/dist/cli/commands/translate.js.map +1 -0
- package/dist/cli/commands/upload.js +185 -213
- package/dist/cli/commands/upload.js.map +1 -0
- package/dist/cli/commands/utils/validation.js +39 -34
- package/dist/cli/commands/utils/validation.js.map +1 -0
- package/dist/cli/flags.js +35 -62
- package/dist/cli/flags.js.map +1 -0
- package/dist/cli/inline.js +112 -137
- package/dist/cli/inline.js.map +1 -0
- package/dist/cli/next.js +17 -12
- package/dist/cli/next.js.map +1 -0
- package/dist/cli/node.js +19 -15
- package/dist/cli/node.js.map +1 -0
- package/dist/cli/python.js +13 -8
- package/dist/cli/python.js.map +1 -0
- package/dist/cli/react.js +61 -78
- package/dist/cli/react.js.map +1 -0
- package/dist/config/defaults.js +16 -11
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/generateSettings.js +167 -269
- package/dist/config/generateSettings.js.map +1 -0
- package/dist/config/optionPresets.js +78 -96
- package/dist/config/optionPresets.js.map +1 -0
- package/dist/config/resolveConfig.js +27 -32
- package/dist/config/resolveConfig.js.map +1 -0
- package/dist/config/utils.js +7 -3
- package/dist/config/utils.js.map +1 -0
- package/dist/config/validateSettings.js +19 -30
- package/dist/config/validateSettings.js.map +1 -0
- package/dist/console/colors.js +18 -13
- package/dist/console/colors.js.map +1 -0
- package/dist/console/displayTranslateSummary.js +40 -37
- package/dist/console/displayTranslateSummary.js.map +1 -0
- package/dist/console/formatting.js +8 -5
- package/dist/console/formatting.js.map +1 -0
- package/dist/console/index.d.ts +11 -9
- package/dist/console/index.js +53 -50
- package/dist/console/index.js.map +1 -0
- package/dist/console/inkFields.d.ts +23 -0
- package/dist/console/inkFields.js +87 -0
- package/dist/console/inkFields.js.map +1 -0
- package/dist/console/inkLayout.d.ts +7 -0
- package/dist/console/inkLayout.js +139 -0
- package/dist/console/inkLayout.js.map +1 -0
- package/dist/console/inkLocaleData.d.ts +4 -0
- package/dist/console/inkLocaleData.js +32 -0
- package/dist/console/inkLocaleData.js.map +1 -0
- package/dist/console/inkPrompts.d.ts +8 -0
- package/dist/console/inkPrompts.js +496 -0
- package/dist/console/inkPrompts.js.map +1 -0
- package/dist/console/inkSession.d.ts +3 -0
- package/dist/console/inkSession.js +42 -0
- package/dist/console/inkSession.js.map +1 -0
- package/dist/console/inkTerminal.d.ts +4 -0
- package/dist/console/inkTerminal.js +15 -0
- package/dist/console/inkTerminal.js.map +1 -0
- package/dist/console/inkTypes.d.ts +66 -0
- package/dist/console/inkTypes.js +1 -0
- package/dist/console/inkUtils.d.ts +24 -0
- package/dist/console/inkUtils.js +87 -0
- package/dist/console/inkUtils.js.map +1 -0
- package/dist/console/logger.js +209 -249
- package/dist/console/logger.js.map +1 -0
- package/dist/console/logging.d.ts +14 -0
- package/dist/console/logging.js +203 -162
- package/dist/console/logging.js.map +1 -0
- package/dist/console/promptParsing.d.ts +5 -0
- package/dist/console/promptParsing.js +28 -0
- package/dist/console/promptParsing.js.map +1 -0
- package/dist/console/terminalSession.d.ts +5 -0
- package/dist/console/terminalSession.js +38 -0
- package/dist/console/terminalSession.js.map +1 -0
- package/dist/extraction/index.js +3 -2
- package/dist/extraction/mapToUpdates.js +19 -18
- package/dist/extraction/mapToUpdates.js.map +1 -0
- package/dist/extraction/postProcess.js +68 -86
- package/dist/extraction/postProcess.js.map +1 -0
- package/dist/formats/files/aggregateFiles.js +223 -304
- package/dist/formats/files/aggregateFiles.js.map +1 -0
- package/dist/formats/files/collectFiles.js +53 -54
- package/dist/formats/files/collectFiles.js.map +1 -0
- package/dist/formats/files/convertToFileTranslationData.js +21 -19
- package/dist/formats/files/convertToFileTranslationData.js.map +1 -0
- package/dist/formats/files/fileMapping.js +82 -119
- package/dist/formats/files/fileMapping.js.map +1 -0
- package/dist/formats/files/preprocess/mdx.js +15 -12
- package/dist/formats/files/preprocess/mdx.js.map +1 -0
- package/dist/formats/files/preprocess/mintlify.js +15 -13
- package/dist/formats/files/preprocess/mintlify.js.map +1 -0
- package/dist/formats/files/preprocessContent.js +20 -21
- package/dist/formats/files/preprocessContent.js.map +1 -0
- package/dist/formats/files/save.js +18 -15
- package/dist/formats/files/save.js.map +1 -0
- package/dist/formats/files/supportedFiles.js +27 -22
- package/dist/formats/files/supportedFiles.js.map +1 -0
- package/dist/formats/files/transformFormat.js +93 -100
- package/dist/formats/files/transformFormat.js.map +1 -0
- package/dist/formats/json/extractJson.js +83 -110
- package/dist/formats/json/extractJson.js.map +1 -0
- package/dist/formats/json/flattenJson.js +41 -48
- package/dist/formats/json/flattenJson.js.map +1 -0
- package/dist/formats/json/jsonPath.js +20 -15
- package/dist/formats/json/jsonPath.js.map +1 -0
- package/dist/formats/json/jsonPointer.js +17 -17
- package/dist/formats/json/jsonPointer.js.map +1 -0
- package/dist/formats/json/mergeJson.js +230 -371
- package/dist/formats/json/mergeJson.js.map +1 -0
- package/dist/formats/json/parseJson.js +74 -111
- package/dist/formats/json/parseJson.js.map +1 -0
- package/dist/formats/json/transformJson.js +53 -61
- package/dist/formats/json/transformJson.js.map +1 -0
- package/dist/formats/json/utils.js +158 -187
- package/dist/formats/json/utils.js.map +1 -0
- package/dist/formats/parseKeyedMetadata.js +85 -106
- package/dist/formats/parseKeyedMetadata.js.map +1 -0
- package/dist/formats/utils.js +13 -23
- package/dist/formats/utils.js.map +1 -0
- package/dist/formats/yaml/extractYaml.js +32 -31
- package/dist/formats/yaml/extractYaml.js.map +1 -0
- package/dist/formats/yaml/mergeYaml.js +43 -60
- package/dist/formats/yaml/mergeYaml.js.map +1 -0
- package/dist/formats/yaml/parseYaml.js +34 -23
- package/dist/formats/yaml/parseYaml.js.map +1 -0
- package/dist/formats/yaml/utils.js +19 -21
- package/dist/formats/yaml/utils.js.map +1 -0
- package/dist/fs/clearLocaleDirs.js +82 -114
- package/dist/fs/clearLocaleDirs.js.map +1 -0
- package/dist/fs/config/downloadedVersions.js +174 -188
- package/dist/fs/config/downloadedVersions.js.map +1 -0
- package/dist/fs/config/loadConfig.js +12 -8
- package/dist/fs/config/loadConfig.js.map +1 -0
- package/dist/fs/config/parseFilesConfig.js +166 -227
- package/dist/fs/config/parseFilesConfig.js.map +1 -0
- package/dist/fs/config/setupConfig.js +43 -52
- package/dist/fs/config/setupConfig.js.map +1 -0
- package/dist/fs/config/updateConfig.js +44 -56
- package/dist/fs/config/updateConfig.js.map +1 -0
- package/dist/fs/config/updateVersions.js +27 -28
- package/dist/fs/config/updateVersions.js.map +1 -0
- package/dist/fs/copyFile.js +33 -37
- package/dist/fs/copyFile.js.map +1 -0
- package/dist/fs/createLoadTranslationsFile.js +32 -48
- package/dist/fs/createLoadTranslationsFile.js.map +1 -0
- package/dist/fs/determineFramework/detectPythonLibrary.js +30 -34
- package/dist/fs/determineFramework/detectPythonLibrary.js.map +1 -0
- package/dist/fs/determineFramework/index.js +46 -64
- package/dist/fs/determineFramework/index.js.map +1 -0
- package/dist/fs/determineFramework/matchPyprojectDependency.js +65 -78
- package/dist/fs/determineFramework/matchPyprojectDependency.js.map +1 -0
- package/dist/fs/determineFramework/matchRequirementsTxtDependency.js +21 -19
- package/dist/fs/determineFramework/matchRequirementsTxtDependency.js.map +1 -0
- package/dist/fs/determineFramework/matchSetupPyDependency.js +60 -81
- package/dist/fs/determineFramework/matchSetupPyDependency.js.map +1 -0
- package/dist/fs/determineFramework/resolveGtDependency.js +15 -15
- package/dist/fs/determineFramework/resolveGtDependency.js.map +1 -0
- package/dist/fs/findFilepath.js +63 -78
- package/dist/fs/findFilepath.js.map +1 -0
- package/dist/fs/loadJSON.js +18 -15
- package/dist/fs/loadJSON.js.map +1 -0
- package/dist/fs/matchFiles.js +12 -7
- package/dist/fs/matchFiles.js.map +1 -0
- package/dist/fs/saveJSON.js +10 -6
- package/dist/fs/saveJSON.js.map +1 -0
- package/dist/fs/utils.js +19 -15
- package/dist/fs/utils.js.map +1 -0
- package/dist/functions.d.ts +2 -1
- package/dist/functions.js +3 -6
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +6 -2
- package/dist/generated/version.js.map +1 -0
- package/dist/git/branches.js +77 -83
- package/dist/git/branches.js.map +1 -0
- package/dist/hooks/postProcess.js +97 -114
- package/dist/hooks/postProcess.js.map +1 -0
- package/dist/index.js +23 -31
- package/dist/index.js.map +1 -0
- package/dist/locadex/setupFlow.js +11 -8
- package/dist/locadex/setupFlow.js.map +1 -0
- package/dist/main.js +17 -7
- package/dist/main.js.map +1 -0
- package/dist/next/config/parseNextConfig.js +32 -51
- package/dist/next/config/parseNextConfig.js.map +1 -0
- package/dist/next/jsx/utils.js +25 -37
- package/dist/next/jsx/utils.js.map +1 -0
- package/dist/next/parse/handleInitGT.js +87 -154
- package/dist/next/parse/handleInitGT.js.map +1 -0
- package/dist/next/parse/wrapContent.js +136 -158
- package/dist/next/parse/wrapContent.js.map +1 -0
- package/dist/python/parse/createPythonInlineUpdates.js +36 -33
- package/dist/python/parse/createPythonInlineUpdates.js.map +1 -0
- package/dist/react/config/createESBuildConfig.js +115 -115
- package/dist/react/config/createESBuildConfig.js.map +1 -0
- package/dist/react/jsx/evaluateJsx.js +90 -124
- package/dist/react/jsx/evaluateJsx.js.map +1 -0
- package/dist/react/jsx/utils/buildImportMap.js +24 -28
- package/dist/react/jsx/utils/buildImportMap.js.map +1 -0
- package/dist/react/jsx/utils/constants.js +79 -87
- package/dist/react/jsx/utils/constants.js.map +1 -0
- package/dist/react/jsx/utils/extractSourceCode.js +36 -37
- package/dist/react/jsx/utils/extractSourceCode.js.map +1 -0
- package/dist/react/jsx/utils/getCalleeNameFromExpression.js +30 -30
- package/dist/react/jsx/utils/getCalleeNameFromExpression.js.map +1 -0
- package/dist/react/jsx/utils/getPathsAndAliases.js +70 -105
- package/dist/react/jsx/utils/getPathsAndAliases.js.map +1 -0
- package/dist/react/jsx/utils/isNumberLiteral.js +13 -11
- package/dist/react/jsx/utils/isNumberLiteral.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js +103 -148
- package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/autoInsertion.js +305 -389
- package/dist/react/jsx/utils/jsxParsing/autoInsertion.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js +122 -193
- package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js +50 -64
- package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js +41 -68
- package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/parseJsx.js +760 -1107
- package/dist/react/jsx/utils/jsxParsing/parseJsx.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/parseTProps.js +35 -71
- package/dist/react/jsx/utils/jsxParsing/parseTProps.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.js +39 -58
- package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/types.js +10 -24
- package/dist/react/jsx/utils/jsxParsing/types.js.map +1 -0
- package/dist/react/jsx/utils/mapAttributeName.js +13 -13
- package/dist/react/jsx/utils/mapAttributeName.js.map +1 -0
- package/dist/react/jsx/utils/parseAst.js +142 -272
- package/dist/react/jsx/utils/parseAst.js.map +1 -0
- package/dist/react/jsx/utils/parseString.js +726 -1090
- package/dist/react/jsx/utils/parseString.js.map +1 -0
- package/dist/react/jsx/utils/parseStringFunction.js +274 -401
- package/dist/react/jsx/utils/parseStringFunction.js.map +1 -0
- package/dist/react/jsx/utils/resolveImportPath.d.ts +1 -1
- package/dist/react/jsx/utils/resolveImportPath.js +125 -108
- package/dist/react/jsx/utils/resolveImportPath.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/derivation/containsDeriveCall.js +18 -24
- package/dist/react/jsx/utils/stringParsing/derivation/containsDeriveCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/derivation/handleDerivation.js +412 -579
- package/dist/react/jsx/utils/stringParsing/derivation/handleDerivation.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/derivation/index.js +57 -67
- package/dist/react/jsx/utils/stringParsing/derivation/index.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/derivation/isDeriveCall.js +26 -36
- package/dist/react/jsx/utils/stringParsing/derivation/isDeriveCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js +29 -24
- package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js +34 -32
- package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js +80 -117
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js +24 -19
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js +18 -21
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js +45 -50
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js +54 -59
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js +56 -69
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js.map +1 -0
- package/dist/react/jsx/utils/validateStringFunction.js +21 -29
- package/dist/react/jsx/utils/validateStringFunction.js.map +1 -0
- package/dist/react/jsx/wrapJsx.js +192 -375
- package/dist/react/jsx/wrapJsx.js.map +1 -0
- package/dist/react/parse/addVitePlugin/index.js +40 -34
- package/dist/react/parse/addVitePlugin/index.js.map +1 -0
- package/dist/react/parse/addVitePlugin/installCompiler.js +18 -20
- package/dist/react/parse/addVitePlugin/installCompiler.js.map +1 -0
- package/dist/react/parse/addVitePlugin/updateViteConfig.js +107 -111
- package/dist/react/parse/addVitePlugin/updateViteConfig.js.map +1 -0
- package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js +23 -26
- package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js.map +1 -0
- package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js +29 -43
- package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js.map +1 -0
- package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js +70 -104
- package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js.map +1 -0
- package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js +23 -29
- package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js.map +1 -0
- package/dist/react/parse/createDictionaryUpdates.js +121 -185
- package/dist/react/parse/createDictionaryUpdates.js.map +1 -0
- package/dist/react/parse/createInlineUpdates.js +123 -139
- package/dist/react/parse/createInlineUpdates.js.map +1 -0
- package/dist/react/parse/wrapContent.js +131 -156
- package/dist/react/parse/wrapContent.js.map +1 -0
- package/dist/react/utils/flattenDictionary.js +55 -70
- package/dist/react/utils/flattenDictionary.js.map +1 -0
- package/dist/react/utils/getEntryAndMetadata.js +14 -10
- package/dist/react/utils/getEntryAndMetadata.js.map +1 -0
- package/dist/react/utils/getVariableName.js +36 -33
- package/dist/react/utils/getVariableName.js.map +1 -0
- package/dist/setup/detectFramework.js +85 -102
- package/dist/setup/detectFramework.js.map +1 -0
- package/dist/setup/frameworkUtils.js +17 -28
- package/dist/setup/frameworkUtils.js.map +1 -0
- package/dist/setup/userInput.js +24 -31
- package/dist/setup/userInput.js.map +1 -0
- package/dist/setup/wizard.js +141 -143
- package/dist/setup/wizard.js.map +1 -0
- package/dist/state/mintlifyRefMap.js +12 -9
- package/dist/state/mintlifyRefMap.js.map +1 -0
- package/dist/state/recentDownloads.js +26 -23
- package/dist/state/recentDownloads.js.map +1 -0
- package/dist/state/translateWarnings.js +17 -8
- package/dist/state/translateWarnings.js.map +1 -0
- package/dist/translation/parse.js +77 -98
- package/dist/translation/parse.js.map +1 -0
- package/dist/translation/stage.js +28 -43
- package/dist/translation/stage.js.map +1 -0
- package/dist/translation/validate.js +68 -91
- package/dist/translation/validate.js.map +1 -0
- package/dist/types/libraries.js +93 -91
- package/dist/types/libraries.js.map +1 -0
- package/dist/types/parsing.js +19 -10
- package/dist/types/parsing.js.map +1 -0
- package/dist/utils/addExplicitAnchorIds.js +270 -389
- package/dist/utils/addExplicitAnchorIds.js.map +1 -0
- package/dist/utils/calculateTimeoutMs.js +11 -6
- package/dist/utils/calculateTimeoutMs.js.map +1 -0
- package/dist/utils/constants.js +15 -12
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/credentials.js +67 -114
- package/dist/utils/credentials.js.map +1 -0
- package/dist/utils/fetch.js +22 -20
- package/dist/utils/fetch.js.map +1 -0
- package/dist/utils/flattenJsonFiles.js +27 -34
- package/dist/utils/flattenJsonFiles.js.map +1 -0
- package/dist/utils/gitDiff.js +30 -32
- package/dist/utils/gitDiff.js.map +1 -0
- package/dist/utils/gt.js +7 -2
- package/dist/utils/gt.js.map +1 -0
- package/dist/utils/hash.js +14 -9
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/headers.js +10 -13
- package/dist/utils/headers.js.map +1 -0
- package/dist/utils/installPackage.js +70 -75
- package/dist/utils/installPackage.js.map +1 -0
- package/dist/utils/localizeRelativeAssets.js +114 -157
- package/dist/utils/localizeRelativeAssets.js.map +1 -0
- package/dist/utils/localizeStaticImports.js +229 -371
- package/dist/utils/localizeStaticImports.js.map +1 -0
- package/dist/utils/localizeStaticUrls.js +241 -424
- package/dist/utils/localizeStaticUrls.js.map +1 -0
- package/dist/utils/mintlifyTitleFallback.js +64 -72
- package/dist/utils/mintlifyTitleFallback.js.map +1 -0
- package/dist/utils/monorepoVersionCheck.js +177 -215
- package/dist/utils/monorepoVersionCheck.js.map +1 -0
- package/dist/utils/packageInfo.js +17 -16
- package/dist/utils/packageInfo.js.map +1 -0
- package/dist/utils/packageJson.js +51 -66
- package/dist/utils/packageJson.js.map +1 -0
- package/dist/utils/packageManager.js +237 -260
- package/dist/utils/packageManager.js.map +1 -0
- package/dist/utils/parse/needsCJS.js +36 -69
- package/dist/utils/parse/needsCJS.js.map +1 -0
- package/dist/utils/persistPostprocessHashes.js +30 -32
- package/dist/utils/persistPostprocessHashes.js.map +1 -0
- package/dist/utils/processAnchorIds.js +32 -54
- package/dist/utils/processAnchorIds.js.map +1 -0
- package/dist/utils/processOpenApi.js +469 -578
- package/dist/utils/processOpenApi.js.map +1 -0
- package/dist/utils/resolveMintlifyRefs.js +89 -105
- package/dist/utils/resolveMintlifyRefs.js.map +1 -0
- package/dist/utils/resolvePublish.js +46 -54
- package/dist/utils/resolvePublish.js.map +1 -0
- package/dist/utils/sanitizeFileContent.js +20 -27
- package/dist/utils/sanitizeFileContent.js.map +1 -0
- package/dist/utils/sharedStaticAssets.js +248 -366
- package/dist/utils/sharedStaticAssets.js.map +1 -0
- package/dist/utils/splitMintlifyLanguageRefs.js +208 -282
- package/dist/utils/splitMintlifyLanguageRefs.js.map +1 -0
- package/dist/utils/validateMdx.js +26 -23
- package/dist/utils/validateMdx.js.map +1 -0
- package/dist/utils/wrapPlainUrls.js +58 -70
- package/dist/utils/wrapPlainUrls.js.map +1 -0
- package/dist/workflows/download.js +92 -126
- package/dist/workflows/download.js.map +1 -0
- package/dist/workflows/enqueue.js +47 -54
- package/dist/workflows/enqueue.js.map +1 -0
- package/dist/workflows/publish.js +29 -29
- package/dist/workflows/publish.js.map +1 -0
- package/dist/workflows/setupProject.js +39 -40
- package/dist/workflows/setupProject.js.map +1 -0
- package/dist/workflows/stage.js +61 -65
- package/dist/workflows/stage.js.map +1 -0
- package/dist/workflows/steps/BranchStep.js +118 -163
- package/dist/workflows/steps/BranchStep.js.map +1 -0
- package/dist/workflows/steps/DownloadStep.js +107 -137
- package/dist/workflows/steps/DownloadStep.js.map +1 -0
- package/dist/workflows/steps/EnqueueStep.js +32 -32
- package/dist/workflows/steps/EnqueueStep.js.map +1 -0
- package/dist/workflows/steps/PollJobsStep.js +208 -292
- package/dist/workflows/steps/PollJobsStep.js.map +1 -0
- package/dist/workflows/steps/PublishStep.js +33 -38
- package/dist/workflows/steps/PublishStep.js.map +1 -0
- package/dist/workflows/steps/SetupStep.js +71 -72
- package/dist/workflows/steps/SetupStep.js.map +1 -0
- package/dist/workflows/steps/TagStep.js +39 -44
- package/dist/workflows/steps/TagStep.js.map +1 -0
- package/dist/workflows/steps/UploadSourcesStep.js +108 -140
- package/dist/workflows/steps/UploadSourcesStep.js.map +1 -0
- package/dist/workflows/steps/UploadTranslationsStep.js +61 -71
- package/dist/workflows/steps/UploadTranslationsStep.js.map +1 -0
- package/dist/workflows/steps/UserEditDiffsStep.js +32 -34
- package/dist/workflows/steps/UserEditDiffsStep.js.map +1 -0
- package/dist/workflows/steps/WorkflowStep.js +6 -2
- package/dist/workflows/steps/WorkflowStep.js.map +1 -0
- package/dist/workflows/upload.js +45 -46
- package/dist/workflows/upload.js.map +1 -0
- package/package.json +14 -7
|
@@ -1,97 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
case 'openapi':
|
|
76
|
-
return {
|
|
77
|
-
include: ['$..summary', '$..description'],
|
|
78
|
-
};
|
|
79
|
-
default:
|
|
80
|
-
return {};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
switch (preset) {
|
|
85
|
-
case 'mintlify':
|
|
86
|
-
return {
|
|
87
|
-
include: ['$..summary', '$..description'],
|
|
88
|
-
};
|
|
89
|
-
case 'openapi':
|
|
90
|
-
return {
|
|
91
|
-
include: ['$..summary', '$..description'],
|
|
92
|
-
};
|
|
93
|
-
default:
|
|
94
|
-
return {};
|
|
95
|
-
}
|
|
96
|
-
}
|
|
1
|
+
//#region src/config/optionPresets.ts
|
|
2
|
+
function generatePreset(preset, type) {
|
|
3
|
+
if (type === "json") switch (preset) {
|
|
4
|
+
case "mintlify": return {
|
|
5
|
+
resolveRefs: true,
|
|
6
|
+
composite: {
|
|
7
|
+
"$.navigation.languages": {
|
|
8
|
+
type: "array",
|
|
9
|
+
key: "$.language",
|
|
10
|
+
experimentalSort: "localesAlphabetical",
|
|
11
|
+
splitEntries: true,
|
|
12
|
+
include: [
|
|
13
|
+
"$..group",
|
|
14
|
+
"$..tab",
|
|
15
|
+
"$..item",
|
|
16
|
+
"$..anchor",
|
|
17
|
+
"$..dropdown"
|
|
18
|
+
],
|
|
19
|
+
transform: { "$..pages[*]": {
|
|
20
|
+
match: "^{locale}/(.*)$",
|
|
21
|
+
replace: "{locale}/$1"
|
|
22
|
+
} }
|
|
23
|
+
},
|
|
24
|
+
"$.redirects": {
|
|
25
|
+
type: "array",
|
|
26
|
+
key: "$.language",
|
|
27
|
+
include: [],
|
|
28
|
+
transform: {
|
|
29
|
+
"$.source": {
|
|
30
|
+
match: "^/{locale}/(.*)$",
|
|
31
|
+
replace: "/{locale}/$1"
|
|
32
|
+
},
|
|
33
|
+
"$.destination": {
|
|
34
|
+
match: "^/{locale}/(.*)$",
|
|
35
|
+
replace: "/{locale}/$1"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
case "mintlify-hide-default": return {
|
|
42
|
+
resolveRefs: true,
|
|
43
|
+
composite: { "$.navigation.languages": {
|
|
44
|
+
type: "array",
|
|
45
|
+
key: "$.language",
|
|
46
|
+
experimentalSort: "localesAlphabetical",
|
|
47
|
+
splitEntries: true,
|
|
48
|
+
include: [
|
|
49
|
+
"$..group",
|
|
50
|
+
"$..tab",
|
|
51
|
+
"$..item",
|
|
52
|
+
"$..anchor",
|
|
53
|
+
"$..dropdown"
|
|
54
|
+
],
|
|
55
|
+
transform: {
|
|
56
|
+
"$..pages[*]": {
|
|
57
|
+
match: "^/?(.*)$",
|
|
58
|
+
replace: "{locale}/$1"
|
|
59
|
+
},
|
|
60
|
+
"$..root": {
|
|
61
|
+
match: "^/?(.*)$",
|
|
62
|
+
replace: "{locale}/$1"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} }
|
|
66
|
+
};
|
|
67
|
+
case "openapi": return { include: ["$..summary", "$..description"] };
|
|
68
|
+
default: return {};
|
|
69
|
+
}
|
|
70
|
+
else switch (preset) {
|
|
71
|
+
case "mintlify": return { include: ["$..summary", "$..description"] };
|
|
72
|
+
case "openapi": return { include: ["$..summary", "$..description"] };
|
|
73
|
+
default: return {};
|
|
74
|
+
}
|
|
97
75
|
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { generatePreset };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=optionPresets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionPresets.js","names":[],"sources":["../../src/config/optionPresets.ts"],"sourcesContent":["import { JsonSchema, YamlSchema } from '../types/index.js';\n\nexport function generatePreset(\n preset: JsonSchema['preset'],\n type: 'json'\n): JsonSchema;\nexport function generatePreset(\n preset: YamlSchema['preset'],\n type: 'yaml'\n): YamlSchema;\nexport function generatePreset(\n preset: string | undefined,\n type: 'json' | 'yaml'\n): JsonSchema | YamlSchema {\n if (type === 'json') {\n switch (preset) {\n case 'mintlify':\n // https://mintlify.com/docs/navigation\n return {\n resolveRefs: true,\n composite: {\n '$.navigation.languages': {\n type: 'array',\n key: '$.language',\n experimentalSort: 'localesAlphabetical',\n splitEntries: true,\n include: [\n '$..group',\n '$..tab',\n '$..item',\n '$..anchor',\n '$..dropdown',\n ],\n transform: {\n '$..pages[*]': {\n match: '^{locale}/(.*)$',\n replace: '{locale}/$1',\n },\n },\n },\n '$.redirects': {\n type: 'array',\n key: '$.language',\n include: [],\n transform: {\n '$.source': {\n match: '^/{locale}/(.*)$',\n replace: '/{locale}/$1',\n },\n '$.destination': {\n match: '^/{locale}/(.*)$',\n replace: '/{locale}/$1',\n },\n },\n },\n },\n };\n case 'mintlify-hide-default':\n // Mintlify with hideDefaultLocale — paths don't have locale prefix in source\n return {\n resolveRefs: true,\n composite: {\n '$.navigation.languages': {\n type: 'array',\n key: '$.language',\n experimentalSort: 'localesAlphabetical',\n splitEntries: true,\n include: [\n '$..group',\n '$..tab',\n '$..item',\n '$..anchor',\n '$..dropdown',\n ],\n transform: {\n '$..pages[*]': {\n match: '^/?(.*)$',\n replace: '{locale}/$1',\n },\n '$..root': {\n match: '^/?(.*)$',\n replace: '{locale}/$1',\n },\n },\n },\n },\n };\n case 'openapi':\n return {\n include: ['$..summary', '$..description'],\n };\n default:\n return {};\n }\n } else {\n switch (preset) {\n case 'mintlify':\n return {\n include: ['$..summary', '$..description'],\n };\n case 'openapi':\n return {\n include: ['$..summary', '$..description'],\n };\n default:\n return {};\n }\n }\n}\n"],"mappings":";AAUA,SAAgB,eACd,QACA,MACyB;AACzB,KAAI,SAAS,OACX,SAAQ,QAAR;EACE,KAAK,WAEH,QAAO;GACL,aAAa;GACb,WAAW;IACT,0BAA0B;KACxB,MAAM;KACN,KAAK;KACL,kBAAkB;KAClB,cAAc;KACd,SAAS;MACP;MACA;MACA;MACA;MACA;MACD;KACD,WAAW,EACT,eAAe;MACb,OAAO;MACP,SAAS;MACV,EACF;KACF;IACD,eAAe;KACb,MAAM;KACN,KAAK;KACL,SAAS,EAAE;KACX,WAAW;MACT,YAAY;OACV,OAAO;OACP,SAAS;OACV;MACD,iBAAiB;OACf,OAAO;OACP,SAAS;OACV;MACF;KACF;IACF;GACF;EACH,KAAK,wBAEH,QAAO;GACL,aAAa;GACb,WAAW,EACT,0BAA0B;IACxB,MAAM;IACN,KAAK;IACL,kBAAkB;IAClB,cAAc;IACd,SAAS;KACP;KACA;KACA;KACA;KACA;KACD;IACD,WAAW;KACT,eAAe;MACb,OAAO;MACP,SAAS;MACV;KACD,WAAW;MACT,OAAO;MACP,SAAS;MACV;KACF;IACF,EACF;GACF;EACH,KAAK,UACH,QAAO,EACL,SAAS,CAAC,cAAc,iBAAiB,EAC1C;EACH,QACE,QAAO,EAAE;;KAGb,SAAQ,QAAR;EACE,KAAK,WACH,QAAO,EACL,SAAS,CAAC,cAAc,iBAAiB,EAC1C;EACH,KAAK,UACH,QAAO,EACL,SAAS,CAAC,cAAc,iBAAiB,EAC1C;EACH,QACE,QAAO,EAAE"}
|
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import path from
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
// Backward compatibility: support legacy .locadex directory
|
|
26
|
-
if (fs.existsSync(path.join(cwd, '.locadex/gt.config.json'))) {
|
|
27
|
-
return {
|
|
28
|
-
path: path.join(cwd, '.locadex/gt.config.json'),
|
|
29
|
-
config: loadConfig(path.join(cwd, '.locadex/gt.config.json')),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
1
|
+
import { loadConfig } from "../fs/config/loadConfig.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
//#region src/config/resolveConfig.ts
|
|
5
|
+
function resolveConfig(cwd) {
|
|
6
|
+
const configFilepath = "gt.config.json";
|
|
7
|
+
if (fs.existsSync(path.join(cwd, configFilepath))) return {
|
|
8
|
+
path: path.join(cwd, configFilepath),
|
|
9
|
+
config: loadConfig(path.join(cwd, configFilepath))
|
|
10
|
+
};
|
|
11
|
+
if (fs.existsSync(path.join(cwd, "src/gt.config.json"))) return {
|
|
12
|
+
path: path.join(cwd, "src/gt.config.json"),
|
|
13
|
+
config: loadConfig(path.join(cwd, "src/gt.config.json"))
|
|
14
|
+
};
|
|
15
|
+
if (fs.existsSync(path.join(cwd, ".gt/gt.config.json"))) return {
|
|
16
|
+
path: path.join(cwd, ".gt/gt.config.json"),
|
|
17
|
+
config: loadConfig(path.join(cwd, ".gt/gt.config.json"))
|
|
18
|
+
};
|
|
19
|
+
if (fs.existsSync(path.join(cwd, ".locadex/gt.config.json"))) return {
|
|
20
|
+
path: path.join(cwd, ".locadex/gt.config.json"),
|
|
21
|
+
config: loadConfig(path.join(cwd, ".locadex/gt.config.json"))
|
|
22
|
+
};
|
|
23
|
+
return null;
|
|
33
24
|
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { resolveConfig };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=resolveConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveConfig.js","names":[],"sources":["../../src/config/resolveConfig.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { loadConfig } from '../fs/config/loadConfig.js';\n\nexport function resolveConfig(cwd: string): {\n path: string;\n config: Record<string, unknown>;\n} | null {\n const configFilepath = 'gt.config.json';\n if (fs.existsSync(path.join(cwd, configFilepath))) {\n return {\n path: path.join(cwd, configFilepath),\n config: loadConfig(path.join(cwd, configFilepath)),\n };\n }\n if (fs.existsSync(path.join(cwd, 'src/gt.config.json'))) {\n return {\n path: path.join(cwd, 'src/gt.config.json'),\n config: loadConfig(path.join(cwd, 'src/gt.config.json')),\n };\n }\n // Support config under .gt for parity with .locadex\n if (fs.existsSync(path.join(cwd, '.gt/gt.config.json'))) {\n return {\n path: path.join(cwd, '.gt/gt.config.json'),\n config: loadConfig(path.join(cwd, '.gt/gt.config.json')),\n };\n }\n // Backward compatibility: support legacy .locadex directory\n if (fs.existsSync(path.join(cwd, '.locadex/gt.config.json'))) {\n return {\n path: path.join(cwd, '.locadex/gt.config.json'),\n config: loadConfig(path.join(cwd, '.locadex/gt.config.json')),\n };\n }\n return null;\n}\n"],"mappings":";;;;AAIA,SAAgB,cAAc,KAGrB;CACP,MAAM,iBAAiB;AACvB,KAAI,GAAG,WAAW,KAAK,KAAK,KAAK,eAAe,CAAC,CAC/C,QAAO;EACL,MAAM,KAAK,KAAK,KAAK,eAAe;EACpC,QAAQ,WAAW,KAAK,KAAK,KAAK,eAAe,CAAC;EACnD;AAEH,KAAI,GAAG,WAAW,KAAK,KAAK,KAAK,qBAAqB,CAAC,CACrD,QAAO;EACL,MAAM,KAAK,KAAK,KAAK,qBAAqB;EAC1C,QAAQ,WAAW,KAAK,KAAK,KAAK,qBAAqB,CAAC;EACzD;AAGH,KAAI,GAAG,WAAW,KAAK,KAAK,KAAK,qBAAqB,CAAC,CACrD,QAAO;EACL,MAAM,KAAK,KAAK,KAAK,qBAAqB;EAC1C,QAAQ,WAAW,KAAK,KAAK,KAAK,qBAAqB,CAAC;EACzD;AAGH,KAAI,GAAG,WAAW,KAAK,KAAK,KAAK,0BAA0B,CAAC,CAC1D,QAAO;EACL,MAAM,KAAK,KAAK,KAAK,0BAA0B;EAC/C,QAAQ,WAAW,KAAK,KAAK,KAAK,0BAA0B,CAAC;EAC9D;AAEH,QAAO"}
|
package/dist/config/utils.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/config/utils.ts
|
|
2
|
+
function isUsingLocalTranslations(settings) {
|
|
3
|
+
return !!(settings.files && settings.files.placeholderPaths.gt);
|
|
4
4
|
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { isUsingLocalTranslations };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/config/utils.ts"],"sourcesContent":["import { Settings } from '../types/index.js';\n\n// returns true if the project is configured to use local translations\nexport function isUsingLocalTranslations(settings: Settings): boolean {\n return !!(settings.files && settings.files.placeholderPaths.gt);\n}\n"],"mappings":";AAGA,SAAgB,yBAAyB,UAA6B;AACpE,QAAO,CAAC,EAAE,SAAS,SAAS,SAAS,MAAM,iBAAiB"}
|
|
@@ -1,32 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import fs from
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
!isValidLocale(settings.defaultLocale, settings.customMapping)) {
|
|
14
|
-
return logErrorAndExit(`defaultLocale: ${settings.defaultLocale} is not a valid locale!`);
|
|
15
|
-
}
|
|
16
|
-
// defaultLocale cannot be a superset of any other locale
|
|
17
|
-
if (settings.defaultLocale &&
|
|
18
|
-
settings.locales.some((locale) => isSupersetLocale(settings.defaultLocale, locale) &&
|
|
19
|
-
!isSupersetLocale(locale, settings.defaultLocale))) {
|
|
20
|
-
const locale = settings.locales.find((locale) => isSupersetLocale(settings.defaultLocale, locale));
|
|
21
|
-
return logErrorAndExit(`defaultLocale: ${settings.defaultLocale} is a superset of another locale (${locale})! Change the defaultLocale to a more specific locale.`);
|
|
22
|
-
}
|
|
1
|
+
import { logErrorAndExit } from "../console/logging.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { isSupersetLocale, isValidLocale } from "@generaltranslation/format";
|
|
5
|
+
//#region src/config/validateSettings.ts
|
|
6
|
+
function validateSettings(settings) {
|
|
7
|
+
for (const locale of settings.locales) if (!isValidLocale(locale, settings.customMapping)) return logErrorAndExit(`Locale "${locale}" is not valid in the provided locales: "${settings?.locales?.join()}". Use a valid BCP 47 locale code or add a custom mapping in gt.config.json.`);
|
|
8
|
+
if (settings.defaultLocale && !isValidLocale(settings.defaultLocale, settings.customMapping)) return logErrorAndExit(`defaultLocale "${settings.defaultLocale}" is not valid. Use a valid BCP 47 locale code or add a custom mapping in gt.config.json.`);
|
|
9
|
+
if (settings.defaultLocale && settings.locales.some((locale) => isSupersetLocale(settings.defaultLocale, locale) && !isSupersetLocale(locale, settings.defaultLocale))) {
|
|
10
|
+
const locale = settings.locales.find((locale) => isSupersetLocale(settings.defaultLocale, locale));
|
|
11
|
+
return logErrorAndExit(`defaultLocale "${settings.defaultLocale}" is broader than configured locale "${locale}". Change defaultLocale to a more specific locale.`);
|
|
12
|
+
}
|
|
23
13
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (fs.existsSync(path.resolve(path.relative(process.cwd(), possibleConfigPath)))) {
|
|
28
|
-
return possibleConfigPath;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return logErrorAndExit('No gt.config.json file found. Are you in the correct directory?');
|
|
14
|
+
function validateConfigExists() {
|
|
15
|
+
for (const possibleConfigPath of ["gt.config.json", "src/gt.config.json"]) if (fs.existsSync(path.resolve(path.relative(process.cwd(), possibleConfigPath)))) return possibleConfigPath;
|
|
16
|
+
return logErrorAndExit("No gt.config.json file was found. Run this command from your project root, pass --config, or run npx gt init to create one.");
|
|
32
17
|
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { validateConfigExists, validateSettings };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=validateSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateSettings.js","names":[],"sources":["../../src/config/validateSettings.ts"],"sourcesContent":["import { isValidLocale, isSupersetLocale } from '@generaltranslation/format';\nimport { Settings } from '../types/index.js';\nimport { logErrorAndExit } from '../console/logging.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nexport function validateSettings(settings: Settings) {\n // Validate locales\n for (const locale of settings.locales) {\n if (!isValidLocale(locale, settings.customMapping)) {\n return logErrorAndExit(\n `Locale \"${locale}\" is not valid in the provided locales: \"${settings?.locales?.join()}\". Use a valid BCP 47 locale code or add a custom mapping in gt.config.json.`\n );\n }\n }\n if (\n settings.defaultLocale &&\n !isValidLocale(settings.defaultLocale, settings.customMapping)\n ) {\n return logErrorAndExit(\n `defaultLocale \"${settings.defaultLocale}\" is not valid. Use a valid BCP 47 locale code or add a custom mapping in gt.config.json.`\n );\n }\n\n // defaultLocale cannot be a superset of any other locale\n if (\n settings.defaultLocale &&\n settings.locales.some(\n (locale) =>\n isSupersetLocale(settings.defaultLocale, locale) &&\n !isSupersetLocale(locale, settings.defaultLocale)\n )\n ) {\n const locale = settings.locales.find((locale) =>\n isSupersetLocale(settings.defaultLocale, locale)\n );\n return logErrorAndExit(\n `defaultLocale \"${settings.defaultLocale}\" is broader than configured locale \"${locale}\". Change defaultLocale to a more specific locale.`\n );\n }\n}\n\nexport function validateConfigExists() {\n const possibleConfigPaths = ['gt.config.json', 'src/gt.config.json'];\n for (const possibleConfigPath of possibleConfigPaths) {\n if (\n fs.existsSync(\n path.resolve(path.relative(process.cwd(), possibleConfigPath))\n )\n ) {\n return possibleConfigPath;\n }\n }\n return logErrorAndExit(\n 'No gt.config.json file was found. Run this command from your project root, pass --config, or run npx gt init to create one.'\n );\n}\n"],"mappings":";;;;;AAMA,SAAgB,iBAAiB,UAAoB;AAEnD,MAAK,MAAM,UAAU,SAAS,QAC5B,KAAI,CAAC,cAAc,QAAQ,SAAS,cAAc,CAChD,QAAO,gBACL,WAAW,OAAO,2CAA2C,UAAU,SAAS,MAAM,CAAC,8EACxF;AAGL,KACE,SAAS,iBACT,CAAC,cAAc,SAAS,eAAe,SAAS,cAAc,CAE9D,QAAO,gBACL,kBAAkB,SAAS,cAAc,2FAC1C;AAIH,KACE,SAAS,iBACT,SAAS,QAAQ,MACd,WACC,iBAAiB,SAAS,eAAe,OAAO,IAChD,CAAC,iBAAiB,QAAQ,SAAS,cAAc,CACpD,EACD;EACA,MAAM,SAAS,SAAS,QAAQ,MAAM,WACpC,iBAAiB,SAAS,eAAe,OAAO,CACjD;AACD,SAAO,gBACL,kBAAkB,SAAS,cAAc,uCAAuC,OAAO,oDACxF;;;AAIL,SAAgB,uBAAuB;AAErC,MAAK,MAAM,sBAAsB,CADJ,kBAAkB,qBACK,CAClD,KACE,GAAG,WACD,KAAK,QAAQ,KAAK,SAAS,QAAQ,KAAK,EAAE,mBAAmB,CAAC,CAC/D,CAED,QAAO;AAGX,QAAO,gBACL,8HACD"}
|
package/dist/console/colors.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import chalk from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
//#region src/console/colors.ts
|
|
3
|
+
function colorizeFilepath(filepath) {
|
|
4
|
+
return chalk.cyan(filepath);
|
|
4
5
|
}
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
function colorizeComponent(component) {
|
|
7
|
+
return chalk.yellow(component);
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
function colorizeFunctionName(functionName) {
|
|
10
|
+
return chalk.yellow(functionName);
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
function colorizeIdString(id) {
|
|
13
|
+
return chalk.yellow(id);
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
function colorizeContent(content) {
|
|
16
|
+
return chalk.yellow(content);
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
function colorizeLine(line) {
|
|
19
|
+
return chalk.dim(line);
|
|
19
20
|
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { colorizeComponent, colorizeContent, colorizeFilepath, colorizeFunctionName, colorizeIdString, colorizeLine };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.js","names":[],"sources":["../../src/console/colors.ts"],"sourcesContent":["import chalk from 'chalk';\n\nexport function colorizeFilepath(filepath: string) {\n return chalk.cyan(filepath);\n}\n\nexport function colorizeComponent(component: string) {\n return chalk.yellow(component);\n}\n\nexport function colorizeFunctionName(functionName: string) {\n return chalk.yellow(functionName);\n}\n\nexport function colorizeIdString(id: string) {\n return chalk.yellow(id);\n}\nexport function colorizeContent(content: string) {\n return chalk.yellow(content);\n}\n\nexport function colorizeLine(line: string) {\n return chalk.dim(line);\n}\n"],"mappings":";;AAEA,SAAgB,iBAAiB,UAAkB;AACjD,QAAO,MAAM,KAAK,SAAS;;AAG7B,SAAgB,kBAAkB,WAAmB;AACnD,QAAO,MAAM,OAAO,UAAU;;AAGhC,SAAgB,qBAAqB,cAAsB;AACzD,QAAO,MAAM,OAAO,aAAa;;AAGnC,SAAgB,iBAAiB,IAAY;AAC3C,QAAO,MAAM,OAAO,GAAG;;AAEzB,SAAgB,gBAAgB,SAAiB;AAC/C,QAAO,MAAM,OAAO,QAAQ;;AAG9B,SAAgB,aAAa,MAAc;AACzC,QAAO,MAAM,IAAI,KAAK"}
|
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { logger } from "./logger.js";
|
|
2
|
+
import { getWarnings, hasWarnings } from "../state/translateWarnings.js";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
//#region src/console/displayTranslateSummary.ts
|
|
4
5
|
const CATEGORY_LABELS = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
skipped_file: "Files skipped",
|
|
7
|
+
failed_move: "File moves failed",
|
|
8
|
+
failed_translation: "Translations failed",
|
|
9
|
+
failed_download: "Downloads failed"
|
|
9
10
|
};
|
|
10
11
|
const CATEGORY_ORDER = [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
"skipped_file",
|
|
13
|
+
"failed_move",
|
|
14
|
+
"failed_translation",
|
|
15
|
+
"failed_download"
|
|
15
16
|
];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
logger.warn(lines.join('\n'));
|
|
17
|
+
function displayTranslateSummary() {
|
|
18
|
+
if (!hasWarnings()) return;
|
|
19
|
+
const warnings = getWarnings();
|
|
20
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
21
|
+
for (const w of warnings) {
|
|
22
|
+
let list = grouped.get(w.category);
|
|
23
|
+
if (!list) {
|
|
24
|
+
list = [];
|
|
25
|
+
grouped.set(w.category, list);
|
|
26
|
+
}
|
|
27
|
+
list.push({
|
|
28
|
+
fileName: w.fileName,
|
|
29
|
+
reason: w.reason
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const lines = [chalk.yellow("⚠ Warnings:"), ""];
|
|
33
|
+
for (const category of CATEGORY_ORDER) {
|
|
34
|
+
const items = grouped.get(category);
|
|
35
|
+
if (!items) continue;
|
|
36
|
+
lines.push(` ${CATEGORY_LABELS[category]} (${items.length}):`);
|
|
37
|
+
for (const item of items) lines.push(` - ${item.fileName}: ${item.reason}`);
|
|
38
|
+
lines.push("");
|
|
39
|
+
}
|
|
40
|
+
logger.warn(lines.join("\n"));
|
|
42
41
|
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { displayTranslateSummary };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=displayTranslateSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayTranslateSummary.js","names":[],"sources":["../../src/console/displayTranslateSummary.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { logger } from './logger.js';\nimport {\n getWarnings,\n hasWarnings,\n type WarningCategory,\n} from '../state/translateWarnings.js';\n\nconst CATEGORY_LABELS: Record<WarningCategory, string> = {\n skipped_file: 'Files skipped',\n failed_move: 'File moves failed',\n failed_translation: 'Translations failed',\n failed_download: 'Downloads failed',\n};\n\nconst CATEGORY_ORDER: WarningCategory[] = [\n 'skipped_file',\n 'failed_move',\n 'failed_translation',\n 'failed_download',\n];\n\nexport function displayTranslateSummary() {\n if (!hasWarnings()) return;\n\n const warnings = getWarnings();\n\n // Group by category\n const grouped = new Map<\n WarningCategory,\n { fileName: string; reason: string }[]\n >();\n for (const w of warnings) {\n let list = grouped.get(w.category);\n if (!list) {\n list = [];\n grouped.set(w.category, list);\n }\n list.push({ fileName: w.fileName, reason: w.reason });\n }\n\n const lines: string[] = [chalk.yellow('⚠ Warnings:'), ''];\n\n for (const category of CATEGORY_ORDER) {\n const items = grouped.get(category);\n if (!items) continue;\n lines.push(` ${CATEGORY_LABELS[category]} (${items.length}):`);\n for (const item of items) {\n lines.push(` - ${item.fileName}: ${item.reason}`);\n }\n lines.push('');\n }\n\n logger.warn(lines.join('\\n'));\n}\n"],"mappings":";;;;AAQA,MAAM,kBAAmD;CACvD,cAAc;CACd,aAAa;CACb,oBAAoB;CACpB,iBAAiB;CAClB;AAED,MAAM,iBAAoC;CACxC;CACA;CACA;CACA;CACD;AAED,SAAgB,0BAA0B;AACxC,KAAI,CAAC,aAAa,CAAE;CAEpB,MAAM,WAAW,aAAa;CAG9B,MAAM,0BAAU,IAAI,KAGjB;AACH,MAAK,MAAM,KAAK,UAAU;EACxB,IAAI,OAAO,QAAQ,IAAI,EAAE,SAAS;AAClC,MAAI,CAAC,MAAM;AACT,UAAO,EAAE;AACT,WAAQ,IAAI,EAAE,UAAU,KAAK;;AAE/B,OAAK,KAAK;GAAE,UAAU,EAAE;GAAU,QAAQ,EAAE;GAAQ,CAAC;;CAGvD,MAAM,QAAkB,CAAC,MAAM,OAAO,eAAe,EAAE,GAAG;AAE1D,MAAK,MAAM,YAAY,gBAAgB;EACrC,MAAM,QAAQ,QAAQ,IAAI,SAAS;AACnC,MAAI,CAAC,MAAO;AACZ,QAAM,KAAK,OAAO,gBAAgB,UAAU,IAAI,MAAM,OAAO,IAAI;AACjE,OAAK,MAAM,QAAQ,MACjB,OAAM,KAAK,WAAW,KAAK,SAAS,IAAI,KAAK,SAAS;AAExD,QAAM,KAAK,GAAG;;AAGhB,QAAO,KAAK,MAAM,KAAK,KAAK,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
//#region src/console/formatting.ts
|
|
1
2
|
const MAX_CODE_GEN_LENGTH = 100;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
return `${code.slice(0, MAX_CODE_GEN_LENGTH)}...`;
|
|
3
|
+
function formatCodeClamp(code) {
|
|
4
|
+
if (code.length <= MAX_CODE_GEN_LENGTH) return code;
|
|
5
|
+
return `${code.slice(0, MAX_CODE_GEN_LENGTH)}...`;
|
|
7
6
|
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { formatCodeClamp };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=formatting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting.js","names":[],"sources":["../../src/console/formatting.ts"],"sourcesContent":["const MAX_CODE_GEN_LENGTH = 100;\nexport function formatCodeClamp(code: string) {\n if (code.length <= MAX_CODE_GEN_LENGTH) {\n return code;\n }\n return `${code.slice(0, MAX_CODE_GEN_LENGTH)}...`;\n}\n"],"mappings":";AAAA,MAAM,sBAAsB;AAC5B,SAAgB,gBAAgB,MAAc;AAC5C,KAAI,KAAK,UAAU,oBACjB,QAAO;AAET,QAAO,GAAG,KAAK,MAAM,GAAG,oBAAoB,CAAC"}
|
package/dist/console/index.d.ts
CHANGED
|
@@ -31,13 +31,15 @@ export declare const warnDeriveCircularSpreadSync: (file: string, varName: strin
|
|
|
31
31
|
export declare const warnDeriveDestructuringSync: (file: string, varName: string, location?: string) => string;
|
|
32
32
|
export declare const warnDeriveOptionalChainingSync: (file: string, code: string, location?: string) => string;
|
|
33
33
|
export declare const warnUnresolvedImportSync: (file: string, functionName: string, importPath: string, location?: string) => string;
|
|
34
|
-
export declare const noLocalesError = "No locales found
|
|
35
|
-
export declare const noDefaultLocaleError = "No default locale found
|
|
36
|
-
export declare const noFilesError = "
|
|
37
|
-
export declare const noSourceFileError = "No source file found
|
|
38
|
-
export declare const noSupportedFormatError = "
|
|
39
|
-
export declare const noApiKeyError = "No API key found
|
|
34
|
+
export declare const noLocalesError = "No target locales were found. Add locales to gt.config.json or pass them with the --locales flag.";
|
|
35
|
+
export declare const noDefaultLocaleError = "No default locale was found. Add defaultLocale to gt.config.json or pass it with --default-locale.";
|
|
36
|
+
export declare const noFilesError = "The files configuration is missing or invalid. Check the files section in gt.config.json and try again.";
|
|
37
|
+
export declare const noSourceFileError = "No source translation file was found. Check your translations directory and default locale configuration.";
|
|
38
|
+
export declare const noSupportedFormatError = "The translation file format is not supported. Use a supported file extension in translationsDir.";
|
|
39
|
+
export declare const noApiKeyError = "No API key was found. Pass --api-key or set the GT_API_KEY environment variable.";
|
|
40
40
|
export declare const devApiKeyError = "Development API keys cannot be used with the General Translation API. Use a production API key instead.\nGenerate a production API key with: npx gt auth -t production";
|
|
41
|
-
export declare const noProjectIdError = "No project ID found
|
|
42
|
-
export declare const noVersionIdError = "No version ID found
|
|
43
|
-
export declare const invalidConfigurationError = "
|
|
41
|
+
export declare const noProjectIdError = "No project ID was found. Pass --project-id, add projectId to gt.config.json, or set the GT_PROJECT_ID environment variable.";
|
|
42
|
+
export declare const noVersionIdError = "No version ID was found. Pass --version-id or add _versionId to gt.config.json.";
|
|
43
|
+
export declare const invalidConfigurationError = "The files configuration cannot be used for this operation. Provide a valid download configuration or set --publish true to upload translations to the CDN.";
|
|
44
|
+
export declare const branchResolutionError = "The current git branch could not be resolved. Specify a branch explicitly or run the command from a git worktree with branch metadata available.";
|
|
45
|
+
export declare const withOriginalError: (message: string, error: unknown) => string;
|