gt 2.14.35 → 2.14.36
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 +16 -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.js +104 -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,100 +1,79 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import loadJSON from
|
|
4
|
-
import { createDictionaryUpdates } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
1
|
+
import { logger } from "../console/logger.js";
|
|
2
|
+
import { exitSync } from "../console/logging.js";
|
|
3
|
+
import loadJSON from "../fs/loadJSON.js";
|
|
4
|
+
import { createDictionaryUpdates } from "../react/parse/createDictionaryUpdates.js";
|
|
5
|
+
import { isPythonLibrary } from "../types/libraries.js";
|
|
6
|
+
import { createInlineUpdates } from "../react/parse/createInlineUpdates.js";
|
|
7
|
+
import { createPythonInlineUpdates } from "../python/parse/createPythonInlineUpdates.js";
|
|
8
|
+
import createESBuildConfig from "../react/config/createESBuildConfig.js";
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
import fs from "fs";
|
|
11
|
+
//#region src/translation/parse.ts
|
|
11
12
|
/**
|
|
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
|
-
return update;
|
|
75
|
-
if (!hash) {
|
|
76
|
-
if (hashlessIds.has(id) || idHashMap.has(id)) {
|
|
77
|
-
warnHashlessDuplicateId(id);
|
|
78
|
-
}
|
|
79
|
-
hashlessIds.add(id);
|
|
80
|
-
return update;
|
|
81
|
-
}
|
|
82
|
-
if (hashlessIds.has(id)) {
|
|
83
|
-
warnHashlessDuplicateId(id);
|
|
84
|
-
}
|
|
85
|
-
const existingHash = idHashMap.get(id);
|
|
86
|
-
if (existingHash !== undefined) {
|
|
87
|
-
if (existingHash !== hash) {
|
|
88
|
-
errors.push(`Hashes don't match on two components with the same id: ${chalk.blue(id)}. Check your ${chalk.green('<T>')} tags and dictionary entries and make sure you're not accidentally duplicating IDs.`);
|
|
89
|
-
duplicateIds.add(id);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
idHashMap.set(id, hash);
|
|
94
|
-
}
|
|
95
|
-
return update;
|
|
96
|
-
});
|
|
97
|
-
// Filter out updates with duplicate IDs
|
|
98
|
-
updates = updates.filter((update) => !update.metadata.id || !duplicateIds.has(update.metadata.id));
|
|
99
|
-
return { updates, errors, warnings };
|
|
13
|
+
* Searches for gt-react or gt-next dictionary files and creates updates for them,
|
|
14
|
+
* as well as inline updates for <T> tags and useGT()/getGT() calls
|
|
15
|
+
*
|
|
16
|
+
* @param options - The options object
|
|
17
|
+
* @param sourceDictionary - The source dictionary file path
|
|
18
|
+
* @param pkg - The package name
|
|
19
|
+
* @returns An object containing the updates and errors
|
|
20
|
+
*/
|
|
21
|
+
async function createUpdates(options, src, sourceDictionary, pkg, validate, parsingFlags, parsingOptions) {
|
|
22
|
+
let updates = [];
|
|
23
|
+
let errors = [];
|
|
24
|
+
let warnings = [];
|
|
25
|
+
if (sourceDictionary && fs.existsSync(sourceDictionary) && fs.statSync(sourceDictionary).isFile()) if (sourceDictionary.endsWith(".json")) updates = [...updates, ...await createDictionaryUpdates(sourceDictionary, errors, warnings)];
|
|
26
|
+
else {
|
|
27
|
+
let esbuildConfig;
|
|
28
|
+
if (options.jsconfig) {
|
|
29
|
+
const jsconfig = loadJSON(options.jsconfig);
|
|
30
|
+
if (!jsconfig) {
|
|
31
|
+
logger.error(`Failed to resolve jsconfig.json or tsconfig.json at provided filepath: "${options.jsconfig}"`);
|
|
32
|
+
exitSync(1);
|
|
33
|
+
}
|
|
34
|
+
esbuildConfig = createESBuildConfig(jsconfig);
|
|
35
|
+
} else esbuildConfig = createESBuildConfig({});
|
|
36
|
+
updates = [...updates, ...await createDictionaryUpdates(sourceDictionary, errors, warnings, esbuildConfig)];
|
|
37
|
+
}
|
|
38
|
+
const { updates: newUpdates, errors: newErrors, warnings: newWarnings } = isPythonLibrary(pkg) ? await createPythonInlineUpdates(src) : await createInlineUpdates(pkg, validate, src, parsingFlags, parsingOptions);
|
|
39
|
+
errors = [...errors, ...newErrors];
|
|
40
|
+
warnings = [...warnings, ...newWarnings];
|
|
41
|
+
updates = [...updates, ...newUpdates];
|
|
42
|
+
const idHashMap = /* @__PURE__ */ new Map();
|
|
43
|
+
const hashlessIds = /* @__PURE__ */ new Set();
|
|
44
|
+
const warnedHashlessDuplicateIds = /* @__PURE__ */ new Set();
|
|
45
|
+
const duplicateIds = /* @__PURE__ */ new Set();
|
|
46
|
+
const warnHashlessDuplicateId = (id) => {
|
|
47
|
+
if (warnedHashlessDuplicateIds.has(id)) return;
|
|
48
|
+
warnings.push(`Duplicate id ${chalk.blue(id)} includes at least one entry without a hash. Hashless duplicate IDs cannot be compared, and later entries may overwrite earlier entries.`);
|
|
49
|
+
warnedHashlessDuplicateIds.add(id);
|
|
50
|
+
};
|
|
51
|
+
updates = updates.map((update) => {
|
|
52
|
+
const { id, hash } = update.metadata;
|
|
53
|
+
if (!id) return update;
|
|
54
|
+
if (!hash) {
|
|
55
|
+
if (hashlessIds.has(id) || idHashMap.has(id)) warnHashlessDuplicateId(id);
|
|
56
|
+
hashlessIds.add(id);
|
|
57
|
+
return update;
|
|
58
|
+
}
|
|
59
|
+
if (hashlessIds.has(id)) warnHashlessDuplicateId(id);
|
|
60
|
+
const existingHash = idHashMap.get(id);
|
|
61
|
+
if (existingHash !== void 0) {
|
|
62
|
+
if (existingHash !== hash) {
|
|
63
|
+
errors.push(`Hashes don't match on two components with the same id: ${chalk.blue(id)}. Check your ${chalk.green("<T>")} tags and dictionary entries and make sure you're not accidentally duplicating IDs.`);
|
|
64
|
+
duplicateIds.add(id);
|
|
65
|
+
}
|
|
66
|
+
} else idHashMap.set(id, hash);
|
|
67
|
+
return update;
|
|
68
|
+
});
|
|
69
|
+
updates = updates.filter((update) => !update.metadata.id || !duplicateIds.has(update.metadata.id));
|
|
70
|
+
return {
|
|
71
|
+
updates,
|
|
72
|
+
errors,
|
|
73
|
+
warnings
|
|
74
|
+
};
|
|
100
75
|
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { createUpdates };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","names":[],"sources":["../../src/translation/parse.ts"],"sourcesContent":["import { Updates, TranslateFlags } from '../types/index.js';\nimport fs from 'fs';\nimport { logger } from '../console/logger.js';\nimport loadJSON from '../fs/loadJSON.js';\nimport { createDictionaryUpdates } from '../react/parse/createDictionaryUpdates.js';\nimport { createInlineUpdates } from '../react/parse/createInlineUpdates.js';\nimport { createPythonInlineUpdates } from '../python/parse/createPythonInlineUpdates.js';\nimport createESBuildConfig from '../react/config/createESBuildConfig.js';\nimport chalk from 'chalk';\nimport type { ParsingConfigOptions, GTParsingFlags } from '../types/parsing.js';\nimport { exitSync } from '../console/logging.js';\nimport { InlineLibrary, isPythonLibrary } from '../types/libraries.js';\n\n/**\n * Searches for gt-react or gt-next dictionary files and creates updates for them,\n * as well as inline updates for <T> tags and useGT()/getGT() calls\n *\n * @param options - The options object\n * @param sourceDictionary - The source dictionary file path\n * @param pkg - The package name\n * @returns An object containing the updates and errors\n */\nexport async function createUpdates(\n options: TranslateFlags,\n src: string[] | undefined,\n sourceDictionary: string | undefined,\n pkg: InlineLibrary,\n validate: boolean,\n parsingFlags: GTParsingFlags,\n parsingOptions: ParsingConfigOptions\n): Promise<{ updates: Updates; errors: string[]; warnings: string[] }> {\n let updates: Updates = [];\n let errors: string[] = [];\n let warnings: string[] = [];\n\n // Parse dictionary with esbuildConfig\n if (\n sourceDictionary &&\n fs.existsSync(sourceDictionary) &&\n fs.statSync(sourceDictionary).isFile()\n ) {\n if (sourceDictionary.endsWith('.json')) {\n updates = [\n ...updates,\n ...(await createDictionaryUpdates(sourceDictionary, errors, warnings)),\n ];\n } else {\n let esbuildConfig;\n if (options.jsconfig) {\n const jsconfig = loadJSON(options.jsconfig);\n if (!jsconfig) {\n logger.error(\n `Failed to resolve jsconfig.json or tsconfig.json at provided filepath: \"${options.jsconfig}\"`\n );\n exitSync(1);\n }\n esbuildConfig = createESBuildConfig(jsconfig);\n } else {\n esbuildConfig = createESBuildConfig({});\n }\n updates = [\n ...updates,\n ...(await createDictionaryUpdates(\n sourceDictionary,\n errors,\n warnings,\n esbuildConfig\n )),\n ];\n }\n }\n // Scan through project for translatable content\n const {\n updates: newUpdates,\n errors: newErrors,\n warnings: newWarnings,\n } = isPythonLibrary(pkg)\n ? await createPythonInlineUpdates(src)\n : await createInlineUpdates(\n pkg,\n validate,\n src,\n parsingFlags,\n parsingOptions\n );\n\n errors = [...errors, ...newErrors];\n warnings = [...warnings, ...newWarnings];\n updates = [...updates, ...newUpdates];\n\n // Metadata addition and validation\n const idHashMap = new Map<string, string>();\n const hashlessIds = new Set<string>();\n const warnedHashlessDuplicateIds = new Set<string>();\n const duplicateIds = new Set<string>();\n\n const warnHashlessDuplicateId = (id: string) => {\n if (warnedHashlessDuplicateIds.has(id)) return;\n warnings.push(\n `Duplicate id ${chalk.blue(\n id\n )} includes at least one entry without a hash. Hashless duplicate IDs cannot be compared, and later entries may overwrite earlier entries.`\n );\n warnedHashlessDuplicateIds.add(id);\n };\n\n updates = updates.map((update) => {\n const { id, hash } = update.metadata;\n if (!id) return update;\n if (!hash) {\n if (hashlessIds.has(id) || idHashMap.has(id)) {\n warnHashlessDuplicateId(id);\n }\n hashlessIds.add(id);\n return update;\n }\n\n if (hashlessIds.has(id)) {\n warnHashlessDuplicateId(id);\n }\n\n const existingHash = idHashMap.get(id);\n if (existingHash !== undefined) {\n if (existingHash !== hash) {\n errors.push(\n `Hashes don't match on two components with the same id: ${chalk.blue(\n id\n )}. Check your ${chalk.green(\n '<T>'\n )} tags and dictionary entries and make sure you're not accidentally duplicating IDs.`\n );\n duplicateIds.add(id);\n }\n } else {\n idHashMap.set(id, hash);\n }\n return update;\n });\n\n // Filter out updates with duplicate IDs\n updates = updates.filter(\n (update) => !update.metadata.id || !duplicateIds.has(update.metadata.id)\n );\n return { updates, errors, warnings };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,eAAsB,cACpB,SACA,KACA,kBACA,KACA,UACA,cACA,gBACqE;CACrE,IAAI,UAAmB,EAAE;CACzB,IAAI,SAAmB,EAAE;CACzB,IAAI,WAAqB,EAAE;AAG3B,KACE,oBACA,GAAG,WAAW,iBAAiB,IAC/B,GAAG,SAAS,iBAAiB,CAAC,QAAQ,CAEtC,KAAI,iBAAiB,SAAS,QAAQ,CACpC,WAAU,CACR,GAAG,SACH,GAAI,MAAM,wBAAwB,kBAAkB,QAAQ,SAAS,CACtE;MACI;EACL,IAAI;AACJ,MAAI,QAAQ,UAAU;GACpB,MAAM,WAAW,SAAS,QAAQ,SAAS;AAC3C,OAAI,CAAC,UAAU;AACb,WAAO,MACL,2EAA2E,QAAQ,SAAS,GAC7F;AACD,aAAS,EAAE;;AAEb,mBAAgB,oBAAoB,SAAS;QAE7C,iBAAgB,oBAAoB,EAAE,CAAC;AAEzC,YAAU,CACR,GAAG,SACH,GAAI,MAAM,wBACR,kBACA,QACA,UACA,cACD,CACF;;CAIL,MAAM,EACJ,SAAS,YACT,QAAQ,WACR,UAAU,gBACR,gBAAgB,IAAI,GACpB,MAAM,0BAA0B,IAAI,GACpC,MAAM,oBACJ,KACA,UACA,KACA,cACA,eACD;AAEL,UAAS,CAAC,GAAG,QAAQ,GAAG,UAAU;AAClC,YAAW,CAAC,GAAG,UAAU,GAAG,YAAY;AACxC,WAAU,CAAC,GAAG,SAAS,GAAG,WAAW;CAGrC,MAAM,4BAAY,IAAI,KAAqB;CAC3C,MAAM,8BAAc,IAAI,KAAa;CACrC,MAAM,6CAA6B,IAAI,KAAa;CACpD,MAAM,+BAAe,IAAI,KAAa;CAEtC,MAAM,2BAA2B,OAAe;AAC9C,MAAI,2BAA2B,IAAI,GAAG,CAAE;AACxC,WAAS,KACP,gBAAgB,MAAM,KACpB,GACD,CAAC,0IACH;AACD,6BAA2B,IAAI,GAAG;;AAGpC,WAAU,QAAQ,KAAK,WAAW;EAChC,MAAM,EAAE,IAAI,SAAS,OAAO;AAC5B,MAAI,CAAC,GAAI,QAAO;AAChB,MAAI,CAAC,MAAM;AACT,OAAI,YAAY,IAAI,GAAG,IAAI,UAAU,IAAI,GAAG,CAC1C,yBAAwB,GAAG;AAE7B,eAAY,IAAI,GAAG;AACnB,UAAO;;AAGT,MAAI,YAAY,IAAI,GAAG,CACrB,yBAAwB,GAAG;EAG7B,MAAM,eAAe,UAAU,IAAI,GAAG;AACtC,MAAI,iBAAiB,KAAA;OACf,iBAAiB,MAAM;AACzB,WAAO,KACL,0DAA0D,MAAM,KAC9D,GACD,CAAC,eAAe,MAAM,MACrB,MACD,CAAC,qFACH;AACD,iBAAa,IAAI,GAAG;;QAGtB,WAAU,IAAI,IAAI,KAAK;AAEzB,SAAO;GACP;AAGF,WAAU,QAAQ,QACf,WAAW,CAAC,OAAO,SAAS,MAAM,CAAC,aAAa,IAAI,OAAO,SAAS,GAAG,CACzE;AACD,QAAO;EAAE;EAAS;EAAQ;EAAU"}
|
|
@@ -1,44 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import findFilepath from
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (errors.length > 0) {
|
|
26
|
-
if (options.ignoreErrors) {
|
|
27
|
-
logger.warn(chalk.yellow(`Warning: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content. These components will not be translated.\n` +
|
|
28
|
-
errors
|
|
29
|
-
.map((error) => chalk.yellow('• ') + chalk.white(error) + '\n')
|
|
30
|
-
.join('')));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
logErrorAndExit(chalk.red(`Error: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content. ${chalk.gray('To ignore these errors, re-run with --ignore-errors')}\n` +
|
|
34
|
-
errors
|
|
35
|
-
.map((error) => chalk.red('• ') + chalk.white(error) + '\n')
|
|
36
|
-
.join('')));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (updates.length == 0) {
|
|
40
|
-
logger.error(chalk.red(`No inline content or dictionaries were found for ${chalk.green(library)}. Are you sure you're running this command in the right directory?`));
|
|
41
|
-
return updates;
|
|
42
|
-
}
|
|
43
|
-
return updates;
|
|
1
|
+
import { logger } from "../console/logger.js";
|
|
2
|
+
import { logErrorAndExit } from "../console/logging.js";
|
|
3
|
+
import findFilepath from "../fs/findFilepath.js";
|
|
4
|
+
import { createUpdates } from "./parse.js";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
//#region src/translation/stage.ts
|
|
7
|
+
async function aggregateInlineTranslations(options, settings, library) {
|
|
8
|
+
if (!options.dictionary) options.dictionary = findFilepath([
|
|
9
|
+
"./dictionary.js",
|
|
10
|
+
"./src/dictionary.js",
|
|
11
|
+
"./dictionary.json",
|
|
12
|
+
"./src/dictionary.json",
|
|
13
|
+
"./dictionary.ts",
|
|
14
|
+
"./src/dictionary.ts"
|
|
15
|
+
]);
|
|
16
|
+
const { updates, errors, warnings } = await createUpdates(options, settings.src, options.dictionary, library, false, settings.files.gtJson.parsingFlags, settings.parsingOptions);
|
|
17
|
+
if (warnings.length > 0) logger.warn(chalk.yellow(`CLI tool encountered ${warnings.length} warnings while scanning for translatable content.\n` + warnings.map((warning) => chalk.yellow("• Warning: ") + chalk.white(warning)).join("\n")));
|
|
18
|
+
if (errors.length > 0) if (options.ignoreErrors) logger.warn(chalk.yellow(`Warning: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content. These components will not be translated.\n` + errors.map((error) => chalk.yellow("• ") + chalk.white(error) + "\n").join("")));
|
|
19
|
+
else logErrorAndExit(chalk.red(`Error: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content. ${chalk.gray("To ignore these errors, re-run with --ignore-errors")}\n` + errors.map((error) => chalk.red("• ") + chalk.white(error) + "\n").join("")));
|
|
20
|
+
if (updates.length == 0) {
|
|
21
|
+
logger.error(chalk.red(`No inline content or dictionaries were found for ${chalk.green(library)}. Are you sure you're running this command in the right directory?`));
|
|
22
|
+
return updates;
|
|
23
|
+
}
|
|
24
|
+
return updates;
|
|
44
25
|
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { aggregateInlineTranslations };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage.js","names":[],"sources":["../../src/translation/stage.ts"],"sourcesContent":["import { logErrorAndExit } from '../console/logging.js';\nimport chalk from 'chalk';\n\nimport findFilepath from '../fs/findFilepath.js';\nimport { Settings, TranslateFlags, Updates } from '../types/index.js';\nimport { logger } from '../console/logger.js';\n\nimport { createUpdates } from './parse.js';\nimport { InlineLibrary } from '../types/libraries.js';\n\nexport async function aggregateInlineTranslations(\n options: TranslateFlags,\n settings: Settings,\n library: InlineLibrary\n): Promise<Updates> {\n if (!options.dictionary) {\n options.dictionary = findFilepath([\n './dictionary.js',\n './src/dictionary.js',\n './dictionary.json',\n './src/dictionary.json',\n './dictionary.ts',\n './src/dictionary.ts',\n ]);\n }\n\n // ---- CREATING UPDATES ---- //\n const { updates, errors, warnings } = await createUpdates(\n options,\n settings.src,\n options.dictionary,\n library,\n false,\n settings.files.gtJson.parsingFlags,\n settings.parsingOptions\n );\n\n if (warnings.length > 0) {\n logger.warn(\n chalk.yellow(\n `CLI tool encountered ${warnings.length} warnings while scanning for translatable content.\\n` +\n warnings\n .map(\n (warning) => chalk.yellow('• Warning: ') + chalk.white(warning)\n )\n .join('\\n')\n )\n );\n }\n\n if (errors.length > 0) {\n if (options.ignoreErrors) {\n logger.warn(\n chalk.yellow(\n `Warning: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content. These components will not be translated.\\n` +\n errors\n .map((error) => chalk.yellow('• ') + chalk.white(error) + '\\n')\n .join('')\n )\n );\n } else {\n logErrorAndExit(\n chalk.red(\n `Error: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content. ${chalk.gray('To ignore these errors, re-run with --ignore-errors')}\\n` +\n errors\n .map((error) => chalk.red('• ') + chalk.white(error) + '\\n')\n .join('')\n )\n );\n }\n }\n\n if (updates.length == 0) {\n logger.error(\n chalk.red(\n `No inline content or dictionaries were found for ${chalk.green(\n library\n )}. Are you sure you're running this command in the right directory?`\n )\n );\n return updates;\n }\n\n return updates;\n}\n"],"mappings":";;;;;;AAUA,eAAsB,4BACpB,SACA,UACA,SACkB;AAClB,KAAI,CAAC,QAAQ,WACX,SAAQ,aAAa,aAAa;EAChC;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAIJ,MAAM,EAAE,SAAS,QAAQ,aAAa,MAAM,cAC1C,SACA,SAAS,KACT,QAAQ,YACR,SACA,OACA,SAAS,MAAM,OAAO,cACtB,SAAS,eACV;AAED,KAAI,SAAS,SAAS,EACpB,QAAO,KACL,MAAM,OACJ,wBAAwB,SAAS,OAAO,wDACtC,SACG,KACE,YAAY,MAAM,OAAO,cAAc,GAAG,MAAM,MAAM,QAAQ,CAChE,CACA,KAAK,KAAK,CAChB,CACF;AAGH,KAAI,OAAO,SAAS,EAClB,KAAI,QAAQ,aACV,QAAO,KACL,MAAM,OACJ,iCAAiC,OAAO,OAAO,sGAC7C,OACG,KAAK,UAAU,MAAM,OAAO,KAAK,GAAG,MAAM,MAAM,MAAM,GAAG,KAAK,CAC9D,KAAK,GAAG,CACd,CACF;KAED,iBACE,MAAM,IACJ,+BAA+B,OAAO,OAAO,0DAA0D,MAAM,KAAK,sDAAsD,CAAC,MACvK,OACG,KAAK,UAAU,MAAM,IAAI,KAAK,GAAG,MAAM,MAAM,MAAM,GAAG,KAAK,CAC3D,KAAK,GAAG,CACd,CACF;AAIL,KAAI,QAAQ,UAAU,GAAG;AACvB,SAAO,MACL,MAAM,IACJ,oDAAoD,MAAM,MACxD,QACD,CAAC,oEACH,CACF;AACD,SAAO;;AAGT,QAAO"}
|
|
@@ -1,100 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import findFilepath from
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
1
|
+
import { logger } from "../console/logger.js";
|
|
2
|
+
import { logErrorAndExit, stripAnsi } from "../console/logging.js";
|
|
3
|
+
import findFilepath from "../fs/findFilepath.js";
|
|
4
|
+
import "../types/libraries.js";
|
|
5
|
+
import { createInlineUpdates } from "../react/parse/createInlineUpdates.js";
|
|
6
|
+
import { createUpdates } from "./parse.js";
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
//#region src/translation/validate.ts
|
|
8
9
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
* Shared validation logic - returns raw results from createUpdates/createInlineUpdates
|
|
11
|
+
*/
|
|
11
12
|
async function runValidation(settings, pkg, files) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'./src/dictionary.json',
|
|
23
|
-
'./dictionary.ts',
|
|
24
|
-
'./src/dictionary.ts',
|
|
25
|
-
]);
|
|
26
|
-
return createUpdates(settings, settings.src, dictionary, pkg, true, settings.files.gtJson.parsingFlags, settings.parsingOptions);
|
|
13
|
+
if (files && files.length > 0) return createInlineUpdates(pkg, true, files, settings.files.gtJson.parsingFlags, settings.parsingOptions);
|
|
14
|
+
const dictionary = settings.dictionary || findFilepath([
|
|
15
|
+
"./dictionary.js",
|
|
16
|
+
"./src/dictionary.js",
|
|
17
|
+
"./dictionary.json",
|
|
18
|
+
"./src/dictionary.json",
|
|
19
|
+
"./dictionary.ts",
|
|
20
|
+
"./src/dictionary.ts"
|
|
21
|
+
]);
|
|
22
|
+
return createUpdates(settings, settings.src, dictionary, pkg, true, settings.files.gtJson.parsingFlags, settings.parsingOptions);
|
|
27
23
|
}
|
|
28
24
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
* Parse file path from error/warning string in withLocation format: "filepath (line:col): message"
|
|
26
|
+
*/
|
|
31
27
|
function parseFileFromMessage(msg) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// No file found - use empty string as key for "global" messages
|
|
47
|
-
return { file: '', message: msg };
|
|
28
|
+
const withLocation = msg.match(/^(.+)\s+\(\d+:\d+\)\s*:\s*([\s\S]+)$/);
|
|
29
|
+
if (withLocation) return {
|
|
30
|
+
file: withLocation[1].trim(),
|
|
31
|
+
message: withLocation[2].trim()
|
|
32
|
+
};
|
|
33
|
+
const lastColonSpace = msg.lastIndexOf(": ");
|
|
34
|
+
if (lastColonSpace > 0) return {
|
|
35
|
+
file: msg.substring(0, lastColonSpace).trim(),
|
|
36
|
+
message: msg.substring(lastColonSpace + 2).trim()
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
file: "",
|
|
40
|
+
message: msg
|
|
41
|
+
};
|
|
48
42
|
}
|
|
49
43
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
for (const warning of warnings) {
|
|
74
|
-
const { file, message } = parseFileFromMessage(stripAnsi(warning));
|
|
75
|
-
addMessage(file, 'warning', message);
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
44
|
+
* Programmatic API for validation - returns structured results instead of logging/exiting.
|
|
45
|
+
* Equivalent to running `gt validate` but returns data.
|
|
46
|
+
*/
|
|
47
|
+
async function getValidateJson(settings, pkg, files) {
|
|
48
|
+
const { errors, warnings } = await runValidation(settings, pkg === "gt-next" ? "gt-next" : pkg === "gt-react-native" ? "gt-react-native" : "gt-react", files);
|
|
49
|
+
const result = {};
|
|
50
|
+
const addMessage = (file, level, message) => {
|
|
51
|
+
if (!result[file]) result[file] = [];
|
|
52
|
+
result[file].push({
|
|
53
|
+
level,
|
|
54
|
+
message
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
for (const error of errors) {
|
|
58
|
+
const { file, message } = parseFileFromMessage(stripAnsi(error));
|
|
59
|
+
addMessage(file, "error", message);
|
|
60
|
+
}
|
|
61
|
+
for (const warning of warnings) {
|
|
62
|
+
const { file, message } = parseFileFromMessage(stripAnsi(warning));
|
|
63
|
+
addMessage(file, "warning", message);
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
78
66
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.map((warning) => chalk.yellow('• ') + chalk.white(warning))
|
|
86
|
-
.join('\n'));
|
|
87
|
-
}
|
|
88
|
-
if (errors.length > 0) {
|
|
89
|
-
logErrorAndExit(chalk.red(`Error: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content.\n` +
|
|
90
|
-
errors
|
|
91
|
-
.map((error) => chalk.red('• ') + chalk.white(error) + '\n')
|
|
92
|
-
.join('')));
|
|
93
|
-
}
|
|
94
|
-
if (updates.length === 0) {
|
|
95
|
-
logger.error(chalk.red(`No inline content or dictionaries were found for ${chalk.green(pkg)}. Are you sure you're running this command in the right directory?`));
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
logger.success(chalk.green(`Success! Found ${updates.length} translatable entries for ${chalk.green(pkg)}.`));
|
|
99
|
-
}
|
|
67
|
+
async function validateProject(settings, pkg, files) {
|
|
68
|
+
const { updates, errors, warnings } = await runValidation(settings, pkg, files);
|
|
69
|
+
if (warnings.length > 0) logger.warn(chalk.yellow(`CLI tool encountered ${warnings.length} warnings while scanning for translatable content.`) + "\n" + warnings.map((warning) => chalk.yellow("• ") + chalk.white(warning)).join("\n"));
|
|
70
|
+
if (errors.length > 0) logErrorAndExit(chalk.red(`Error: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content.\n` + errors.map((error) => chalk.red("• ") + chalk.white(error) + "\n").join("")));
|
|
71
|
+
if (updates.length === 0) logger.error(chalk.red(`No inline content or dictionaries were found for ${chalk.green(pkg)}. Are you sure you're running this command in the right directory?`));
|
|
72
|
+
else logger.success(chalk.green(`Success! Found ${updates.length} translatable entries for ${chalk.green(pkg)}.`));
|
|
100
73
|
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { getValidateJson, validateProject };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","names":[],"sources":["../../src/translation/validate.ts"],"sourcesContent":["import { logErrorAndExit, stripAnsi } from '../console/logging.js';\nimport chalk from 'chalk';\nimport findFilepath from '../fs/findFilepath.js';\nimport { Framework, Options, Settings, Updates } from '../types/index.js';\nimport { logger } from '../console/logger.js';\n\nimport { createUpdates } from './parse.js';\nimport { createInlineUpdates } from '../react/parse/createInlineUpdates.js';\nimport { InlineLibrary, Libraries } from '../types/libraries.js';\n\n// Types for programmatic validation API\nexport type ValidationLevel = 'error' | 'warning';\n\nexport type ValidationMessage = {\n level: ValidationLevel;\n message: string;\n};\n\nexport type ValidationResult = Record<string, ValidationMessage[]>;\n\n/**\n * Shared validation logic - returns raw results from createUpdates/createInlineUpdates\n */\nasync function runValidation(\n settings: Options & Settings,\n pkg: InlineLibrary,\n files?: string[]\n): Promise<{ updates: Updates; errors: string[]; warnings: string[] }> {\n if (files && files.length > 0) {\n return createInlineUpdates(\n pkg,\n true,\n files,\n settings.files.gtJson.parsingFlags,\n settings.parsingOptions\n );\n }\n\n // Full project validation\n // Use local variable to avoid mutating caller's settings object\n const dictionary =\n settings.dictionary ||\n findFilepath([\n './dictionary.js',\n './src/dictionary.js',\n './dictionary.json',\n './src/dictionary.json',\n './dictionary.ts',\n './src/dictionary.ts',\n ]);\n\n return createUpdates(\n settings,\n settings.src,\n dictionary,\n pkg,\n true,\n settings.files.gtJson.parsingFlags,\n settings.parsingOptions\n );\n}\n\n/**\n * Parse file path from error/warning string in withLocation format: \"filepath (line:col): message\"\n */\nfunction parseFileFromMessage(msg: string): { file: string; message: string } {\n // First try to match with location format: \"filepath (line:col): message\"\n // Using [\\s\\S] instead of . with /s flag for ES5 compatibility\n const withLocation = msg.match(/^(.+)\\s+\\(\\d+:\\d+\\)\\s*:\\s*([\\s\\S]+)$/);\n if (withLocation) {\n return { file: withLocation[1].trim(), message: withLocation[2].trim() };\n }\n\n // Fallback: find the last \": \" pattern (handles Windows paths like C:\\...)\n const lastColonSpace = msg.lastIndexOf(': ');\n if (lastColonSpace > 0) {\n return {\n file: msg.substring(0, lastColonSpace).trim(),\n message: msg.substring(lastColonSpace + 2).trim(),\n };\n }\n\n // No file found - use empty string as key for \"global\" messages\n return { file: '', message: msg };\n}\n\n/**\n * Programmatic API for validation - returns structured results instead of logging/exiting.\n * Equivalent to running `gt validate` but returns data.\n */\nexport async function getValidateJson(\n settings: Options & Settings,\n // TODO: fix compatability more generally so do not have to do this\n pkg:\n | `${typeof Libraries.GT_REACT}`\n | `${typeof Libraries.GT_NEXT}`\n | `${typeof Libraries.GT_REACT_NATIVE}`,\n files?: string[]\n): Promise<ValidationResult> {\n const validatedPkg: Framework =\n pkg === Libraries.GT_NEXT\n ? Libraries.GT_NEXT\n : pkg === Libraries.GT_REACT_NATIVE\n ? Libraries.GT_REACT_NATIVE\n : Libraries.GT_REACT;\n const { errors, warnings } = await runValidation(\n settings,\n validatedPkg,\n files\n );\n\n const result: ValidationResult = {};\n\n const addMessage = (\n file: string,\n level: ValidationLevel,\n message: string\n ) => {\n if (!result[file]) {\n result[file] = [];\n }\n result[file].push({ level, message });\n };\n\n for (const error of errors) {\n const { file, message } = parseFileFromMessage(stripAnsi(error));\n addMessage(file, 'error', message);\n }\n for (const warning of warnings) {\n const { file, message } = parseFileFromMessage(stripAnsi(warning));\n addMessage(file, 'warning', message);\n }\n\n return result;\n}\n\nexport async function validateProject(\n settings: Options & Settings,\n pkg: InlineLibrary,\n files?: string[]\n): Promise<void> {\n const { updates, errors, warnings } = await runValidation(\n settings,\n pkg,\n files\n );\n\n if (warnings.length > 0) {\n logger.warn(\n chalk.yellow(\n `CLI tool encountered ${warnings.length} warnings while scanning for translatable content.`\n ) +\n '\\n' +\n warnings\n .map((warning) => chalk.yellow('• ') + chalk.white(warning))\n .join('\\n')\n );\n }\n\n if (errors.length > 0) {\n logErrorAndExit(\n chalk.red(\n `Error: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content.\\n` +\n errors\n .map((error) => chalk.red('• ') + chalk.white(error) + '\\n')\n .join('')\n )\n );\n }\n\n if (updates.length === 0) {\n logger.error(\n chalk.red(\n `No inline content or dictionaries were found for ${chalk.green(\n pkg\n )}. Are you sure you're running this command in the right directory?`\n )\n );\n } else {\n logger.success(\n chalk.green(\n `Success! Found ${updates.length} translatable entries for ${chalk.green(\n pkg\n )}.`\n )\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAuBA,eAAe,cACb,UACA,KACA,OACqE;AACrE,KAAI,SAAS,MAAM,SAAS,EAC1B,QAAO,oBACL,KACA,MACA,OACA,SAAS,MAAM,OAAO,cACtB,SAAS,eACV;CAKH,MAAM,aACJ,SAAS,cACT,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEJ,QAAO,cACL,UACA,SAAS,KACT,YACA,KACA,MACA,SAAS,MAAM,OAAO,cACtB,SAAS,eACV;;;;;AAMH,SAAS,qBAAqB,KAAgD;CAG5E,MAAM,eAAe,IAAI,MAAM,uCAAuC;AACtE,KAAI,aACF,QAAO;EAAE,MAAM,aAAa,GAAG,MAAM;EAAE,SAAS,aAAa,GAAG,MAAM;EAAE;CAI1E,MAAM,iBAAiB,IAAI,YAAY,KAAK;AAC5C,KAAI,iBAAiB,EACnB,QAAO;EACL,MAAM,IAAI,UAAU,GAAG,eAAe,CAAC,MAAM;EAC7C,SAAS,IAAI,UAAU,iBAAiB,EAAE,CAAC,MAAM;EAClD;AAIH,QAAO;EAAE,MAAM;EAAI,SAAS;EAAK;;;;;;AAOnC,eAAsB,gBACpB,UAEA,KAIA,OAC2B;CAO3B,MAAM,EAAE,QAAQ,aAAa,MAAM,cACjC,UANA,QAAA,YAAA,YAEI,QAAA,oBAAA,oBAAA,YAMJ,MACD;CAED,MAAM,SAA2B,EAAE;CAEnC,MAAM,cACJ,MACA,OACA,YACG;AACH,MAAI,CAAC,OAAO,MACV,QAAO,QAAQ,EAAE;AAEnB,SAAO,MAAM,KAAK;GAAE;GAAO;GAAS,CAAC;;AAGvC,MAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,EAAE,MAAM,YAAY,qBAAqB,UAAU,MAAM,CAAC;AAChE,aAAW,MAAM,SAAS,QAAQ;;AAEpC,MAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,EAAE,MAAM,YAAY,qBAAqB,UAAU,QAAQ,CAAC;AAClE,aAAW,MAAM,WAAW,QAAQ;;AAGtC,QAAO;;AAGT,eAAsB,gBACpB,UACA,KACA,OACe;CACf,MAAM,EAAE,SAAS,QAAQ,aAAa,MAAM,cAC1C,UACA,KACA,MACD;AAED,KAAI,SAAS,SAAS,EACpB,QAAO,KACL,MAAM,OACJ,wBAAwB,SAAS,OAAO,oDACzC,GACC,OACA,SACG,KAAK,YAAY,MAAM,OAAO,KAAK,GAAG,MAAM,MAAM,QAAQ,CAAC,CAC3D,KAAK,KAAK,CAChB;AAGH,KAAI,OAAO,SAAS,EAClB,iBACE,MAAM,IACJ,+BAA+B,OAAO,OAAO,6DAC3C,OACG,KAAK,UAAU,MAAM,IAAI,KAAK,GAAG,MAAM,MAAM,MAAM,GAAG,KAAK,CAC3D,KAAK,GAAG,CACd,CACF;AAGH,KAAI,QAAQ,WAAW,EACrB,QAAO,MACL,MAAM,IACJ,oDAAoD,MAAM,MACxD,IACD,CAAC,oEACH,CACF;KAED,QAAO,QACL,MAAM,MACJ,kBAAkB,QAAQ,OAAO,4BAA4B,MAAM,MACjE,IACD,CAAC,GACH,CACF"}
|