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
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type PromptOption<T> = {
|
|
3
|
+
value: T;
|
|
4
|
+
label: string;
|
|
5
|
+
hint?: string;
|
|
6
|
+
};
|
|
7
|
+
export type PromptResult<T> = {
|
|
8
|
+
value?: T;
|
|
9
|
+
cancelled: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type TextPromptProps = {
|
|
12
|
+
message: string;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
validate?: (value: string) => boolean | string;
|
|
15
|
+
onComplete: (result: PromptResult<string>) => void;
|
|
16
|
+
};
|
|
17
|
+
export type LocaleOption = {
|
|
18
|
+
code: string;
|
|
19
|
+
label: string;
|
|
20
|
+
name: string;
|
|
21
|
+
nativeName: string;
|
|
22
|
+
searchable: string;
|
|
23
|
+
};
|
|
24
|
+
export type LocalePromptProps = {
|
|
25
|
+
message: string;
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
onComplete: (result: PromptResult<string>) => void;
|
|
28
|
+
};
|
|
29
|
+
export type LocaleMultiPromptProps = {
|
|
30
|
+
message: string;
|
|
31
|
+
defaultValue?: string[];
|
|
32
|
+
required: boolean;
|
|
33
|
+
onComplete: (result: PromptResult<string[]>) => void;
|
|
34
|
+
};
|
|
35
|
+
export type GlobPromptProps = {
|
|
36
|
+
label: string;
|
|
37
|
+
message?: string;
|
|
38
|
+
defaultValue?: string;
|
|
39
|
+
onComplete: (result: PromptResult<string>) => void;
|
|
40
|
+
};
|
|
41
|
+
export type EditableTextPromptProps = TextPromptProps & {
|
|
42
|
+
footer?: string;
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
};
|
|
45
|
+
export type SelectPromptProps<T> = {
|
|
46
|
+
message: string;
|
|
47
|
+
options: Array<PromptOption<T>>;
|
|
48
|
+
defaultValue?: T;
|
|
49
|
+
onComplete: (result: PromptResult<T>) => void;
|
|
50
|
+
};
|
|
51
|
+
export type MultiSelectPromptProps<T extends string> = {
|
|
52
|
+
message: string;
|
|
53
|
+
options: Array<PromptOption<T>>;
|
|
54
|
+
required: boolean;
|
|
55
|
+
onComplete: (result: PromptResult<Array<T>>) => void;
|
|
56
|
+
};
|
|
57
|
+
export type ConfirmPromptProps = {
|
|
58
|
+
message: string;
|
|
59
|
+
defaultValue?: boolean;
|
|
60
|
+
onComplete: (result: PromptResult<boolean>) => void;
|
|
61
|
+
};
|
|
62
|
+
export type PromptFrameProps = {
|
|
63
|
+
message: string;
|
|
64
|
+
children: ReactNode;
|
|
65
|
+
footer: string;
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PromptResult } from './inkTypes.js';
|
|
2
|
+
import { stripAnsi } from './logging.js';
|
|
3
|
+
export { stripAnsi };
|
|
4
|
+
export declare const CANCELLED: PromptResult<never>;
|
|
5
|
+
export declare const SELECTED_TAG_ROW_INDEX = -1;
|
|
6
|
+
export declare function normalizedMessage(message: string): string;
|
|
7
|
+
export declare function wrapText(text: string, width: number): string[];
|
|
8
|
+
export declare function complete<T>(result: PromptResult<T>, onComplete: (result: PromptResult<T>) => void): void;
|
|
9
|
+
export declare function getContentWidth(columns: number): number;
|
|
10
|
+
export declare function getInputWidth(columns: number): number;
|
|
11
|
+
export declare function getOptionWidth(columns: number): number;
|
|
12
|
+
export declare function getVisibleCount(rows: number, reservedRows: number): number;
|
|
13
|
+
export declare function previousIndex(index: number, length: number): number;
|
|
14
|
+
export declare function nextIndex(index: number, length: number): number;
|
|
15
|
+
export declare function truncate(value: string, width: number): string;
|
|
16
|
+
export declare function getScrollWindow<T>({ items, index, visibleCount, }: {
|
|
17
|
+
items: T[];
|
|
18
|
+
index: number;
|
|
19
|
+
visibleCount: number;
|
|
20
|
+
}): {
|
|
21
|
+
start: number;
|
|
22
|
+
visibleItems: T[];
|
|
23
|
+
};
|
|
24
|
+
export declare function getSafeIndex(index: number, length: number): number;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { stripAnsi } from "./logging.js";
|
|
2
|
+
//#region src/console/inkUtils.ts
|
|
3
|
+
const MIN_CONTENT_WIDTH = 20;
|
|
4
|
+
const MAX_CONTENT_WIDTH = 96;
|
|
5
|
+
const INPUT_HORIZONTAL_PADDING = 4;
|
|
6
|
+
const MAX_VISIBLE_LOCALES = 7;
|
|
7
|
+
const CANCELLED = { cancelled: true };
|
|
8
|
+
const SELECTED_TAG_ROW_INDEX = -1;
|
|
9
|
+
function normalizedMessage(message) {
|
|
10
|
+
return stripAnsi(message).trim();
|
|
11
|
+
}
|
|
12
|
+
function wrapText(text, width) {
|
|
13
|
+
const safeWidth = Math.max(1, width);
|
|
14
|
+
const lines = [];
|
|
15
|
+
for (const paragraph of text.split("\n")) {
|
|
16
|
+
const words = paragraph.trim().split(/\s+/).filter(Boolean);
|
|
17
|
+
let currentLine = "";
|
|
18
|
+
if (words.length === 0) {
|
|
19
|
+
lines.push("");
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
for (const word of words) {
|
|
23
|
+
if (word.length > safeWidth) {
|
|
24
|
+
if (currentLine) {
|
|
25
|
+
lines.push(currentLine);
|
|
26
|
+
currentLine = "";
|
|
27
|
+
}
|
|
28
|
+
for (let index = 0; index < word.length; index += safeWidth) lines.push(word.slice(index, index + safeWidth));
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const nextLine = currentLine ? `${currentLine} ${word}` : word;
|
|
32
|
+
if (nextLine.length > safeWidth) {
|
|
33
|
+
lines.push(currentLine);
|
|
34
|
+
currentLine = word;
|
|
35
|
+
} else currentLine = nextLine;
|
|
36
|
+
}
|
|
37
|
+
if (currentLine) lines.push(currentLine);
|
|
38
|
+
}
|
|
39
|
+
return lines;
|
|
40
|
+
}
|
|
41
|
+
function complete(result, onComplete) {
|
|
42
|
+
onComplete(result);
|
|
43
|
+
}
|
|
44
|
+
function getContentWidth(columns) {
|
|
45
|
+
return Math.min(Math.max(MIN_CONTENT_WIDTH, columns - 4), MAX_CONTENT_WIDTH);
|
|
46
|
+
}
|
|
47
|
+
function getInputWidth(columns) {
|
|
48
|
+
return Math.max(MIN_CONTENT_WIDTH, getContentWidth(columns) - INPUT_HORIZONTAL_PADDING);
|
|
49
|
+
}
|
|
50
|
+
function getOptionWidth(columns) {
|
|
51
|
+
return Math.max(MIN_CONTENT_WIDTH, getContentWidth(columns) - 2);
|
|
52
|
+
}
|
|
53
|
+
function getVisibleCount(rows, reservedRows) {
|
|
54
|
+
return Math.min(MAX_VISIBLE_LOCALES, Math.max(1, rows - reservedRows));
|
|
55
|
+
}
|
|
56
|
+
function previousIndex(index, length) {
|
|
57
|
+
if (length === 0) return 0;
|
|
58
|
+
return index === 0 ? length - 1 : index - 1;
|
|
59
|
+
}
|
|
60
|
+
function nextIndex(index, length) {
|
|
61
|
+
if (length === 0) return 0;
|
|
62
|
+
return (index + 1) % length;
|
|
63
|
+
}
|
|
64
|
+
function truncate(value, width) {
|
|
65
|
+
if (value.length <= width) return value;
|
|
66
|
+
if (width <= 1) return value.slice(0, width);
|
|
67
|
+
if (width <= 3) return ".".repeat(width);
|
|
68
|
+
return `${value.slice(0, width - 3)}...`;
|
|
69
|
+
}
|
|
70
|
+
function getScrollWindow({ items, index, visibleCount }) {
|
|
71
|
+
const safeVisibleCount = Math.max(1, visibleCount);
|
|
72
|
+
const half = Math.floor(safeVisibleCount / 2);
|
|
73
|
+
const start = Math.min(Math.max(0, index - half), Math.max(0, items.length - safeVisibleCount));
|
|
74
|
+
const end = start + safeVisibleCount;
|
|
75
|
+
return {
|
|
76
|
+
start,
|
|
77
|
+
visibleItems: items.slice(start, end)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function getSafeIndex(index, length) {
|
|
81
|
+
if (length === 0) return 0;
|
|
82
|
+
return Math.max(0, Math.min(index, length - 1));
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
export { CANCELLED, SELECTED_TAG_ROW_INDEX, complete, getContentWidth, getInputWidth, getOptionWidth, getSafeIndex, getScrollWindow, getVisibleCount, nextIndex, normalizedMessage, previousIndex, stripAnsi, truncate, wrapText };
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=inkUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inkUtils.js","names":[],"sources":["../../src/console/inkUtils.ts"],"sourcesContent":["import type { PromptResult } from './inkTypes.js';\nimport { stripAnsi } from './logging.js';\nexport { stripAnsi };\n\nconst MIN_CONTENT_WIDTH = 20;\nconst MAX_CONTENT_WIDTH = 96;\nconst INPUT_HORIZONTAL_PADDING = 4;\nconst MAX_VISIBLE_LOCALES = 7;\n\nexport const CANCELLED: PromptResult<never> = { cancelled: true };\nexport const SELECTED_TAG_ROW_INDEX = -1;\n\nexport function normalizedMessage(message: string): string {\n return stripAnsi(message).trim();\n}\n\nexport function wrapText(text: string, width: number) {\n const safeWidth = Math.max(1, width);\n const lines: string[] = [];\n\n for (const paragraph of text.split('\\n')) {\n const words = paragraph.trim().split(/\\s+/).filter(Boolean);\n let currentLine = '';\n\n if (words.length === 0) {\n lines.push('');\n continue;\n }\n\n for (const word of words) {\n if (word.length > safeWidth) {\n if (currentLine) {\n lines.push(currentLine);\n currentLine = '';\n }\n for (let index = 0; index < word.length; index += safeWidth) {\n lines.push(word.slice(index, index + safeWidth));\n }\n continue;\n }\n\n const nextLine = currentLine ? `${currentLine} ${word}` : word;\n if (nextLine.length > safeWidth) {\n lines.push(currentLine);\n currentLine = word;\n } else {\n currentLine = nextLine;\n }\n }\n\n if (currentLine) lines.push(currentLine);\n }\n\n return lines;\n}\n\nexport function complete<T>(\n result: PromptResult<T>,\n onComplete: (result: PromptResult<T>) => void\n) {\n onComplete(result);\n}\n\nexport function getContentWidth(columns: number) {\n return Math.min(Math.max(MIN_CONTENT_WIDTH, columns - 4), MAX_CONTENT_WIDTH);\n}\n\nexport function getInputWidth(columns: number) {\n return Math.max(\n MIN_CONTENT_WIDTH,\n getContentWidth(columns) - INPUT_HORIZONTAL_PADDING\n );\n}\n\nexport function getOptionWidth(columns: number) {\n return Math.max(MIN_CONTENT_WIDTH, getContentWidth(columns) - 2);\n}\n\nexport function getVisibleCount(rows: number, reservedRows: number) {\n return Math.min(MAX_VISIBLE_LOCALES, Math.max(1, rows - reservedRows));\n}\n\nexport function previousIndex(index: number, length: number) {\n if (length === 0) return 0;\n return index === 0 ? length - 1 : index - 1;\n}\n\nexport function nextIndex(index: number, length: number) {\n if (length === 0) return 0;\n return (index + 1) % length;\n}\n\nexport function truncate(value: string, width: number) {\n if (value.length <= width) return value;\n if (width <= 1) return value.slice(0, width);\n if (width <= 3) return '.'.repeat(width);\n return `${value.slice(0, width - 3)}...`;\n}\n\nexport function getScrollWindow<T>({\n items,\n index,\n visibleCount,\n}: {\n items: T[];\n index: number;\n visibleCount: number;\n}) {\n const safeVisibleCount = Math.max(1, visibleCount);\n const half = Math.floor(safeVisibleCount / 2);\n const start = Math.min(\n Math.max(0, index - half),\n Math.max(0, items.length - safeVisibleCount)\n );\n const end = start + safeVisibleCount;\n return {\n start,\n visibleItems: items.slice(start, end),\n };\n}\n\nexport function getSafeIndex(index: number, length: number) {\n if (length === 0) return 0;\n return Math.max(0, Math.min(index, length - 1));\n}\n"],"mappings":";;AAIA,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB;AAC1B,MAAM,2BAA2B;AACjC,MAAM,sBAAsB;AAE5B,MAAa,YAAiC,EAAE,WAAW,MAAM;AACjE,MAAa,yBAAyB;AAEtC,SAAgB,kBAAkB,SAAyB;AACzD,QAAO,UAAU,QAAQ,CAAC,MAAM;;AAGlC,SAAgB,SAAS,MAAc,OAAe;CACpD,MAAM,YAAY,KAAK,IAAI,GAAG,MAAM;CACpC,MAAM,QAAkB,EAAE;AAE1B,MAAK,MAAM,aAAa,KAAK,MAAM,KAAK,EAAE;EACxC,MAAM,QAAQ,UAAU,MAAM,CAAC,MAAM,MAAM,CAAC,OAAO,QAAQ;EAC3D,IAAI,cAAc;AAElB,MAAI,MAAM,WAAW,GAAG;AACtB,SAAM,KAAK,GAAG;AACd;;AAGF,OAAK,MAAM,QAAQ,OAAO;AACxB,OAAI,KAAK,SAAS,WAAW;AAC3B,QAAI,aAAa;AACf,WAAM,KAAK,YAAY;AACvB,mBAAc;;AAEhB,SAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS,UAChD,OAAM,KAAK,KAAK,MAAM,OAAO,QAAQ,UAAU,CAAC;AAElD;;GAGF,MAAM,WAAW,cAAc,GAAG,YAAY,GAAG,SAAS;AAC1D,OAAI,SAAS,SAAS,WAAW;AAC/B,UAAM,KAAK,YAAY;AACvB,kBAAc;SAEd,eAAc;;AAIlB,MAAI,YAAa,OAAM,KAAK,YAAY;;AAG1C,QAAO;;AAGT,SAAgB,SACd,QACA,YACA;AACA,YAAW,OAAO;;AAGpB,SAAgB,gBAAgB,SAAiB;AAC/C,QAAO,KAAK,IAAI,KAAK,IAAI,mBAAmB,UAAU,EAAE,EAAE,kBAAkB;;AAG9E,SAAgB,cAAc,SAAiB;AAC7C,QAAO,KAAK,IACV,mBACA,gBAAgB,QAAQ,GAAG,yBAC5B;;AAGH,SAAgB,eAAe,SAAiB;AAC9C,QAAO,KAAK,IAAI,mBAAmB,gBAAgB,QAAQ,GAAG,EAAE;;AAGlE,SAAgB,gBAAgB,MAAc,cAAsB;AAClE,QAAO,KAAK,IAAI,qBAAqB,KAAK,IAAI,GAAG,OAAO,aAAa,CAAC;;AAGxE,SAAgB,cAAc,OAAe,QAAgB;AAC3D,KAAI,WAAW,EAAG,QAAO;AACzB,QAAO,UAAU,IAAI,SAAS,IAAI,QAAQ;;AAG5C,SAAgB,UAAU,OAAe,QAAgB;AACvD,KAAI,WAAW,EAAG,QAAO;AACzB,SAAQ,QAAQ,KAAK;;AAGvB,SAAgB,SAAS,OAAe,OAAe;AACrD,KAAI,MAAM,UAAU,MAAO,QAAO;AAClC,KAAI,SAAS,EAAG,QAAO,MAAM,MAAM,GAAG,MAAM;AAC5C,KAAI,SAAS,EAAG,QAAO,IAAI,OAAO,MAAM;AACxC,QAAO,GAAG,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAC;;AAGtC,SAAgB,gBAAmB,EACjC,OACA,OACA,gBAKC;CACD,MAAM,mBAAmB,KAAK,IAAI,GAAG,aAAa;CAClD,MAAM,OAAO,KAAK,MAAM,mBAAmB,EAAE;CAC7C,MAAM,QAAQ,KAAK,IACjB,KAAK,IAAI,GAAG,QAAQ,KAAK,EACzB,KAAK,IAAI,GAAG,MAAM,SAAS,iBAAiB,CAC7C;CACD,MAAM,MAAM,QAAQ;AACpB,QAAO;EACL;EACA,cAAc,MAAM,MAAM,OAAO,IAAI;EACtC;;AAGH,SAAgB,aAAa,OAAe,QAAgB;AAC1D,KAAI,WAAW,EAAG,QAAO;AACzB,QAAO,KAAK,IAAI,GAAG,KAAK,IAAI,OAAO,SAAS,EAAE,CAAC"}
|
package/dist/console/logger.js
CHANGED
|
@@ -1,250 +1,210 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
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
|
-
}
|
|
1
|
+
import { endTerminalSession } from "./terminalSession.js";
|
|
2
|
+
import { intro, log, outro, progress, spinner } from "@clack/prompts";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import { destination, pino } from "pino";
|
|
6
|
+
//#region src/console/logger.ts
|
|
7
|
+
function wrapTerminalSessionAware(target) {
|
|
8
|
+
const start = target.start.bind(target);
|
|
9
|
+
const stop = target.stop.bind(target);
|
|
10
|
+
const message = target.message.bind(target);
|
|
11
|
+
target.start = (msg) => {
|
|
12
|
+
endTerminalSession();
|
|
13
|
+
return start(msg);
|
|
14
|
+
};
|
|
15
|
+
target.stop = (msg, code) => {
|
|
16
|
+
endTerminalSession();
|
|
17
|
+
return stop(msg, code);
|
|
18
|
+
};
|
|
19
|
+
target.message = (msg) => {
|
|
20
|
+
endTerminalSession();
|
|
21
|
+
return message(msg);
|
|
22
|
+
};
|
|
23
|
+
if ("advance" in target) {
|
|
24
|
+
const advance = target.advance.bind(target);
|
|
25
|
+
target.advance = (amount, msg) => {
|
|
26
|
+
endTerminalSession();
|
|
27
|
+
return advance(amount, msg);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
32
31
|
}
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
else {
|
|
213
|
-
return new MockSpinner(this);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
// Progress bar functionality
|
|
217
|
-
createProgressBar(total) {
|
|
218
|
-
if (this.logFormat === 'default') {
|
|
219
|
-
return progress({ max: total });
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
return new MockProgress(total, this);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
// Command start/end markers
|
|
226
|
-
startCommand(message) {
|
|
227
|
-
if (this.logFormat === 'default') {
|
|
228
|
-
intro(chalk.cyan(message));
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
this.info(`╭─ ${message}`);
|
|
232
|
-
}
|
|
233
|
-
this.fileLogger?.info(`[START] ${message}`);
|
|
234
|
-
}
|
|
235
|
-
endCommand(message) {
|
|
236
|
-
if (this.logFormat === 'default') {
|
|
237
|
-
outro(chalk.cyan(message));
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
this.info(`╰─ ${message}`);
|
|
241
|
-
}
|
|
242
|
-
this.fileLogger?.info(`[END] ${message}`);
|
|
243
|
-
}
|
|
244
|
-
// Flush logs to ensure they're written before process exit
|
|
245
|
-
flush() {
|
|
246
|
-
this.pinoLogger?.flush();
|
|
247
|
-
this.fileLogger?.flush();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
export const logger = Logger.getInstance();
|
|
32
|
+
var MockSpinner = class {
|
|
33
|
+
currentMessage = "";
|
|
34
|
+
logger;
|
|
35
|
+
isCancelled = false;
|
|
36
|
+
constructor(logger) {
|
|
37
|
+
this.logger = logger;
|
|
38
|
+
}
|
|
39
|
+
start(message) {
|
|
40
|
+
if (message) {
|
|
41
|
+
this.currentMessage = message;
|
|
42
|
+
this.logger.info(`[Spinner] ${message}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
stop(message) {
|
|
46
|
+
const msg = message || this.currentMessage;
|
|
47
|
+
if (msg) this.logger.info(`[Spinner] ${msg}`);
|
|
48
|
+
this.currentMessage = "";
|
|
49
|
+
}
|
|
50
|
+
message(message) {
|
|
51
|
+
if (message) {
|
|
52
|
+
this.currentMessage = message;
|
|
53
|
+
this.logger.info(`[Spinner] ${message}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var MockProgress = class {
|
|
58
|
+
max;
|
|
59
|
+
current = 0;
|
|
60
|
+
logger;
|
|
61
|
+
isCancelled = false;
|
|
62
|
+
constructor(max, logger) {
|
|
63
|
+
this.max = max;
|
|
64
|
+
this.logger = logger;
|
|
65
|
+
}
|
|
66
|
+
start(message) {
|
|
67
|
+
const msg = message || "Starting progress";
|
|
68
|
+
this.logger.info(`[Progress] ${msg} (0/${this.max})`);
|
|
69
|
+
}
|
|
70
|
+
stop(message) {
|
|
71
|
+
const msg = message || "Complete";
|
|
72
|
+
this.logger.info(`[Progress] ${msg} (${this.current}/${this.max})`);
|
|
73
|
+
}
|
|
74
|
+
message(message) {
|
|
75
|
+
if (message) this.logger.info(`[Progress] ${message} (${this.current}/${this.max})`);
|
|
76
|
+
}
|
|
77
|
+
advance(amount, message) {
|
|
78
|
+
this.current += amount;
|
|
79
|
+
const msg = message || "Progress";
|
|
80
|
+
this.logger.info(`[Progress] ${msg} (${this.current}/${this.max})`);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const logger = class Logger {
|
|
84
|
+
static instance;
|
|
85
|
+
pinoLogger = null;
|
|
86
|
+
fileLogger = null;
|
|
87
|
+
logFormat;
|
|
88
|
+
constructor() {
|
|
89
|
+
const format = (process.env.GT_LOG_FORMAT || "default").toLowerCase();
|
|
90
|
+
const logFile = process.env.GT_LOG_FILE;
|
|
91
|
+
const logLevel = process.env.GT_LOG_LEVEL || "info";
|
|
92
|
+
if (format !== "default" && format !== "json") {
|
|
93
|
+
console.error("Invalid log format");
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
if (logLevel !== "debug" && logLevel !== "info" && logLevel !== "warn" && logLevel !== "error") {
|
|
97
|
+
console.error("Invalid log level");
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
this.logFormat = format;
|
|
101
|
+
if (format === "json") this.pinoLogger = pino({
|
|
102
|
+
level: logLevel,
|
|
103
|
+
mixin: () => ({ logId: randomUUID() })
|
|
104
|
+
}, destination(1));
|
|
105
|
+
if (logFile) this.fileLogger = pino({
|
|
106
|
+
level: logLevel,
|
|
107
|
+
mixin: () => ({ logId: randomUUID() })
|
|
108
|
+
}, destination(logFile));
|
|
109
|
+
}
|
|
110
|
+
static getInstance() {
|
|
111
|
+
if (!Logger.instance) Logger.instance = new Logger();
|
|
112
|
+
return Logger.instance;
|
|
113
|
+
}
|
|
114
|
+
trace(message) {
|
|
115
|
+
if (this.logFormat === "default") {
|
|
116
|
+
endTerminalSession();
|
|
117
|
+
log.message(message, { symbol: chalk.dim("•") });
|
|
118
|
+
} else this.pinoLogger?.trace(message);
|
|
119
|
+
this.fileLogger?.trace(message);
|
|
120
|
+
}
|
|
121
|
+
debug(message) {
|
|
122
|
+
if (this.logFormat === "default") {
|
|
123
|
+
endTerminalSession();
|
|
124
|
+
log.message(message, { symbol: chalk.dim("◆") });
|
|
125
|
+
} else this.pinoLogger?.debug(message);
|
|
126
|
+
this.fileLogger?.debug(message);
|
|
127
|
+
}
|
|
128
|
+
info(message) {
|
|
129
|
+
if (this.logFormat === "default") {
|
|
130
|
+
endTerminalSession();
|
|
131
|
+
log.info(message);
|
|
132
|
+
} else this.pinoLogger?.info(message);
|
|
133
|
+
this.fileLogger?.info(message);
|
|
134
|
+
}
|
|
135
|
+
warn(message) {
|
|
136
|
+
if (this.logFormat === "default") {
|
|
137
|
+
endTerminalSession();
|
|
138
|
+
log.warn(message);
|
|
139
|
+
} else this.pinoLogger?.warn(message);
|
|
140
|
+
this.fileLogger?.warn(message);
|
|
141
|
+
}
|
|
142
|
+
error(message) {
|
|
143
|
+
if (this.logFormat === "default") {
|
|
144
|
+
endTerminalSession();
|
|
145
|
+
log.error(message);
|
|
146
|
+
} else this.pinoLogger?.error(message);
|
|
147
|
+
this.fileLogger?.error(message);
|
|
148
|
+
}
|
|
149
|
+
fatal(message) {
|
|
150
|
+
if (this.logFormat === "default") {
|
|
151
|
+
endTerminalSession();
|
|
152
|
+
log.error(message);
|
|
153
|
+
} else this.pinoLogger?.fatal(message);
|
|
154
|
+
this.fileLogger?.fatal(message);
|
|
155
|
+
}
|
|
156
|
+
silent(message) {
|
|
157
|
+
this.fileLogger?.silent(message);
|
|
158
|
+
}
|
|
159
|
+
success(message) {
|
|
160
|
+
if (this.logFormat === "default") {
|
|
161
|
+
endTerminalSession();
|
|
162
|
+
log.success(message);
|
|
163
|
+
} else this.pinoLogger?.info(message);
|
|
164
|
+
this.fileLogger?.info(message);
|
|
165
|
+
}
|
|
166
|
+
step(message) {
|
|
167
|
+
if (this.logFormat === "default") {
|
|
168
|
+
endTerminalSession();
|
|
169
|
+
log.step(message);
|
|
170
|
+
} else this.pinoLogger?.info(message);
|
|
171
|
+
this.fileLogger?.info(message);
|
|
172
|
+
}
|
|
173
|
+
message(message, symbol) {
|
|
174
|
+
if (this.logFormat === "default") {
|
|
175
|
+
endTerminalSession();
|
|
176
|
+
log.message(message, symbol ? { symbol } : void 0);
|
|
177
|
+
} else this.pinoLogger?.info(message);
|
|
178
|
+
this.fileLogger?.info(message);
|
|
179
|
+
}
|
|
180
|
+
createSpinner(indicator = "timer") {
|
|
181
|
+
if (this.logFormat === "default") return wrapTerminalSessionAware(spinner({ indicator }));
|
|
182
|
+
else return new MockSpinner(this);
|
|
183
|
+
}
|
|
184
|
+
createProgressBar(total) {
|
|
185
|
+
if (this.logFormat === "default") return wrapTerminalSessionAware(progress({ max: total }));
|
|
186
|
+
else return new MockProgress(total, this);
|
|
187
|
+
}
|
|
188
|
+
startCommand(message) {
|
|
189
|
+
if (this.logFormat === "default") {
|
|
190
|
+
endTerminalSession();
|
|
191
|
+
intro(chalk.cyan(message));
|
|
192
|
+
} else this.info(`╭─ ${message}`);
|
|
193
|
+
this.fileLogger?.info(`[START] ${message}`);
|
|
194
|
+
}
|
|
195
|
+
endCommand(message) {
|
|
196
|
+
if (this.logFormat === "default") {
|
|
197
|
+
endTerminalSession();
|
|
198
|
+
outro(chalk.cyan(message));
|
|
199
|
+
} else this.info(`╰─ ${message}`);
|
|
200
|
+
this.fileLogger?.info(`[END] ${message}`);
|
|
201
|
+
}
|
|
202
|
+
flush() {
|
|
203
|
+
this.pinoLogger?.flush();
|
|
204
|
+
this.fileLogger?.flush();
|
|
205
|
+
}
|
|
206
|
+
}.getInstance();
|
|
207
|
+
//#endregion
|
|
208
|
+
export { logger };
|
|
209
|
+
|
|
210
|
+
//# sourceMappingURL=logger.js.map
|