gt 2.14.35 → 2.14.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -1
- package/dist/api/collectUserEditDiffs.js +112 -155
- package/dist/api/collectUserEditDiffs.js.map +1 -0
- package/dist/api/downloadFileBatch.js +164 -241
- package/dist/api/downloadFileBatch.js.map +1 -0
- package/dist/api/saveLocalEdits.js +37 -41
- package/dist/api/saveLocalEdits.js.map +1 -0
- package/dist/bin/bin-entry.js +17 -7
- package/dist/bin/bin-entry.js.map +1 -0
- package/dist/bin/bin-main.js +43 -61
- package/dist/bin/bin-main.js.map +1 -0
- package/dist/cli/base.js +382 -497
- package/dist/cli/base.js.map +1 -0
- package/dist/cli/commands/download.js +41 -49
- package/dist/cli/commands/download.js.map +1 -0
- package/dist/cli/commands/enqueue.js +26 -25
- package/dist/cli/commands/enqueue.js.map +1 -0
- package/dist/cli/commands/setupProject.js +33 -36
- package/dist/cli/commands/setupProject.js.map +1 -0
- package/dist/cli/commands/stage.js +53 -61
- package/dist/cli/commands/stage.js.map +1 -0
- package/dist/cli/commands/translate.js +75 -112
- package/dist/cli/commands/translate.js.map +1 -0
- package/dist/cli/commands/upload.js +185 -213
- package/dist/cli/commands/upload.js.map +1 -0
- package/dist/cli/commands/utils/validation.js +39 -34
- package/dist/cli/commands/utils/validation.js.map +1 -0
- package/dist/cli/flags.js +35 -62
- package/dist/cli/flags.js.map +1 -0
- package/dist/cli/inline.js +112 -137
- package/dist/cli/inline.js.map +1 -0
- package/dist/cli/next.js +17 -12
- package/dist/cli/next.js.map +1 -0
- package/dist/cli/node.js +19 -15
- package/dist/cli/node.js.map +1 -0
- package/dist/cli/python.js +13 -8
- package/dist/cli/python.js.map +1 -0
- package/dist/cli/react.js +61 -78
- package/dist/cli/react.js.map +1 -0
- package/dist/config/defaults.js +16 -11
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/generateSettings.js +167 -269
- package/dist/config/generateSettings.js.map +1 -0
- package/dist/config/optionPresets.js +78 -96
- package/dist/config/optionPresets.js.map +1 -0
- package/dist/config/resolveConfig.js +27 -32
- package/dist/config/resolveConfig.js.map +1 -0
- package/dist/config/utils.js +7 -3
- package/dist/config/utils.js.map +1 -0
- package/dist/config/validateSettings.js +19 -30
- package/dist/config/validateSettings.js.map +1 -0
- package/dist/console/colors.js +18 -13
- package/dist/console/colors.js.map +1 -0
- package/dist/console/displayTranslateSummary.js +40 -37
- package/dist/console/displayTranslateSummary.js.map +1 -0
- package/dist/console/formatting.js +8 -5
- package/dist/console/formatting.js.map +1 -0
- package/dist/console/index.d.ts +11 -9
- package/dist/console/index.js +53 -50
- package/dist/console/index.js.map +1 -0
- package/dist/console/inkFields.d.ts +23 -0
- package/dist/console/inkFields.js +87 -0
- package/dist/console/inkFields.js.map +1 -0
- package/dist/console/inkLayout.d.ts +7 -0
- package/dist/console/inkLayout.js +139 -0
- package/dist/console/inkLayout.js.map +1 -0
- package/dist/console/inkLocaleData.d.ts +4 -0
- package/dist/console/inkLocaleData.js +32 -0
- package/dist/console/inkLocaleData.js.map +1 -0
- package/dist/console/inkPrompts.d.ts +8 -0
- package/dist/console/inkPrompts.js +496 -0
- package/dist/console/inkPrompts.js.map +1 -0
- package/dist/console/inkSession.d.ts +3 -0
- package/dist/console/inkSession.js +42 -0
- package/dist/console/inkSession.js.map +1 -0
- package/dist/console/inkTerminal.d.ts +4 -0
- package/dist/console/inkTerminal.js +15 -0
- package/dist/console/inkTerminal.js.map +1 -0
- package/dist/console/inkTypes.d.ts +66 -0
- package/dist/console/inkTypes.js +1 -0
- package/dist/console/inkUtils.d.ts +24 -0
- package/dist/console/inkUtils.js +87 -0
- package/dist/console/inkUtils.js.map +1 -0
- package/dist/console/logger.js +209 -249
- package/dist/console/logger.js.map +1 -0
- package/dist/console/logging.d.ts +14 -0
- package/dist/console/logging.js +203 -162
- package/dist/console/logging.js.map +1 -0
- package/dist/console/promptParsing.d.ts +5 -0
- package/dist/console/promptParsing.js +28 -0
- package/dist/console/promptParsing.js.map +1 -0
- package/dist/console/terminalSession.d.ts +5 -0
- package/dist/console/terminalSession.js +38 -0
- package/dist/console/terminalSession.js.map +1 -0
- package/dist/extraction/index.js +3 -2
- package/dist/extraction/mapToUpdates.js +19 -18
- package/dist/extraction/mapToUpdates.js.map +1 -0
- package/dist/extraction/postProcess.js +68 -86
- package/dist/extraction/postProcess.js.map +1 -0
- package/dist/formats/files/aggregateFiles.js +223 -304
- package/dist/formats/files/aggregateFiles.js.map +1 -0
- package/dist/formats/files/collectFiles.js +53 -54
- package/dist/formats/files/collectFiles.js.map +1 -0
- package/dist/formats/files/convertToFileTranslationData.js +21 -19
- package/dist/formats/files/convertToFileTranslationData.js.map +1 -0
- package/dist/formats/files/fileMapping.js +82 -119
- package/dist/formats/files/fileMapping.js.map +1 -0
- package/dist/formats/files/preprocess/mdx.js +15 -12
- package/dist/formats/files/preprocess/mdx.js.map +1 -0
- package/dist/formats/files/preprocess/mintlify.js +15 -13
- package/dist/formats/files/preprocess/mintlify.js.map +1 -0
- package/dist/formats/files/preprocessContent.js +20 -21
- package/dist/formats/files/preprocessContent.js.map +1 -0
- package/dist/formats/files/save.js +18 -15
- package/dist/formats/files/save.js.map +1 -0
- package/dist/formats/files/supportedFiles.js +27 -22
- package/dist/formats/files/supportedFiles.js.map +1 -0
- package/dist/formats/files/transformFormat.js +93 -100
- package/dist/formats/files/transformFormat.js.map +1 -0
- package/dist/formats/json/extractJson.js +83 -110
- package/dist/formats/json/extractJson.js.map +1 -0
- package/dist/formats/json/flattenJson.js +41 -48
- package/dist/formats/json/flattenJson.js.map +1 -0
- package/dist/formats/json/jsonPath.js +20 -15
- package/dist/formats/json/jsonPath.js.map +1 -0
- package/dist/formats/json/jsonPointer.js +17 -17
- package/dist/formats/json/jsonPointer.js.map +1 -0
- package/dist/formats/json/mergeJson.js +230 -371
- package/dist/formats/json/mergeJson.js.map +1 -0
- package/dist/formats/json/parseJson.js +74 -111
- package/dist/formats/json/parseJson.js.map +1 -0
- package/dist/formats/json/transformJson.js +53 -61
- package/dist/formats/json/transformJson.js.map +1 -0
- package/dist/formats/json/utils.js +158 -187
- package/dist/formats/json/utils.js.map +1 -0
- package/dist/formats/parseKeyedMetadata.js +85 -106
- package/dist/formats/parseKeyedMetadata.js.map +1 -0
- package/dist/formats/utils.js +13 -23
- package/dist/formats/utils.js.map +1 -0
- package/dist/formats/yaml/extractYaml.js +32 -31
- package/dist/formats/yaml/extractYaml.js.map +1 -0
- package/dist/formats/yaml/mergeYaml.js +43 -60
- package/dist/formats/yaml/mergeYaml.js.map +1 -0
- package/dist/formats/yaml/parseYaml.js +34 -23
- package/dist/formats/yaml/parseYaml.js.map +1 -0
- package/dist/formats/yaml/utils.js +19 -21
- package/dist/formats/yaml/utils.js.map +1 -0
- package/dist/fs/clearLocaleDirs.js +82 -114
- package/dist/fs/clearLocaleDirs.js.map +1 -0
- package/dist/fs/config/downloadedVersions.js +174 -188
- package/dist/fs/config/downloadedVersions.js.map +1 -0
- package/dist/fs/config/loadConfig.js +12 -8
- package/dist/fs/config/loadConfig.js.map +1 -0
- package/dist/fs/config/parseFilesConfig.js +166 -227
- package/dist/fs/config/parseFilesConfig.js.map +1 -0
- package/dist/fs/config/setupConfig.js +43 -52
- package/dist/fs/config/setupConfig.js.map +1 -0
- package/dist/fs/config/updateConfig.js +44 -56
- package/dist/fs/config/updateConfig.js.map +1 -0
- package/dist/fs/config/updateVersions.js +27 -28
- package/dist/fs/config/updateVersions.js.map +1 -0
- package/dist/fs/copyFile.js +33 -37
- package/dist/fs/copyFile.js.map +1 -0
- package/dist/fs/createLoadTranslationsFile.js +32 -48
- package/dist/fs/createLoadTranslationsFile.js.map +1 -0
- package/dist/fs/determineFramework/detectPythonLibrary.js +30 -34
- package/dist/fs/determineFramework/detectPythonLibrary.js.map +1 -0
- package/dist/fs/determineFramework/index.js +46 -64
- package/dist/fs/determineFramework/index.js.map +1 -0
- package/dist/fs/determineFramework/matchPyprojectDependency.js +65 -78
- package/dist/fs/determineFramework/matchPyprojectDependency.js.map +1 -0
- package/dist/fs/determineFramework/matchRequirementsTxtDependency.js +21 -19
- package/dist/fs/determineFramework/matchRequirementsTxtDependency.js.map +1 -0
- package/dist/fs/determineFramework/matchSetupPyDependency.js +60 -81
- package/dist/fs/determineFramework/matchSetupPyDependency.js.map +1 -0
- package/dist/fs/determineFramework/resolveGtDependency.js +15 -15
- package/dist/fs/determineFramework/resolveGtDependency.js.map +1 -0
- package/dist/fs/findFilepath.js +63 -78
- package/dist/fs/findFilepath.js.map +1 -0
- package/dist/fs/loadJSON.js +18 -15
- package/dist/fs/loadJSON.js.map +1 -0
- package/dist/fs/matchFiles.js +12 -7
- package/dist/fs/matchFiles.js.map +1 -0
- package/dist/fs/saveJSON.js +10 -6
- package/dist/fs/saveJSON.js.map +1 -0
- package/dist/fs/utils.js +19 -15
- package/dist/fs/utils.js.map +1 -0
- package/dist/functions.d.ts +2 -1
- package/dist/functions.js +3 -6
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +6 -2
- package/dist/generated/version.js.map +1 -0
- package/dist/git/branches.js +77 -83
- package/dist/git/branches.js.map +1 -0
- package/dist/hooks/postProcess.js +97 -114
- package/dist/hooks/postProcess.js.map +1 -0
- package/dist/index.js +23 -31
- package/dist/index.js.map +1 -0
- package/dist/locadex/setupFlow.js +11 -8
- package/dist/locadex/setupFlow.js.map +1 -0
- package/dist/main.js +17 -7
- package/dist/main.js.map +1 -0
- package/dist/next/config/parseNextConfig.js +32 -51
- package/dist/next/config/parseNextConfig.js.map +1 -0
- package/dist/next/jsx/utils.js +25 -37
- package/dist/next/jsx/utils.js.map +1 -0
- package/dist/next/parse/handleInitGT.js +87 -154
- package/dist/next/parse/handleInitGT.js.map +1 -0
- package/dist/next/parse/wrapContent.js +136 -158
- package/dist/next/parse/wrapContent.js.map +1 -0
- package/dist/python/parse/createPythonInlineUpdates.js +36 -33
- package/dist/python/parse/createPythonInlineUpdates.js.map +1 -0
- package/dist/react/config/createESBuildConfig.js +115 -115
- package/dist/react/config/createESBuildConfig.js.map +1 -0
- package/dist/react/jsx/evaluateJsx.js +90 -124
- package/dist/react/jsx/evaluateJsx.js.map +1 -0
- package/dist/react/jsx/utils/buildImportMap.js +24 -28
- package/dist/react/jsx/utils/buildImportMap.js.map +1 -0
- package/dist/react/jsx/utils/constants.js +79 -87
- package/dist/react/jsx/utils/constants.js.map +1 -0
- package/dist/react/jsx/utils/extractSourceCode.js +36 -37
- package/dist/react/jsx/utils/extractSourceCode.js.map +1 -0
- package/dist/react/jsx/utils/getCalleeNameFromExpression.js +30 -30
- package/dist/react/jsx/utils/getCalleeNameFromExpression.js.map +1 -0
- package/dist/react/jsx/utils/getPathsAndAliases.js +70 -105
- package/dist/react/jsx/utils/getPathsAndAliases.js.map +1 -0
- package/dist/react/jsx/utils/isNumberLiteral.js +13 -11
- package/dist/react/jsx/utils/isNumberLiteral.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js +103 -148
- package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/autoInsertion.js +305 -389
- package/dist/react/jsx/utils/jsxParsing/autoInsertion.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js +122 -193
- package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js +50 -64
- package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js +41 -68
- package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/parseJsx.js +760 -1107
- package/dist/react/jsx/utils/jsxParsing/parseJsx.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/parseTProps.js +35 -71
- package/dist/react/jsx/utils/jsxParsing/parseTProps.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.js +39 -58
- package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.js.map +1 -0
- package/dist/react/jsx/utils/jsxParsing/types.js +10 -24
- package/dist/react/jsx/utils/jsxParsing/types.js.map +1 -0
- package/dist/react/jsx/utils/mapAttributeName.js +13 -13
- package/dist/react/jsx/utils/mapAttributeName.js.map +1 -0
- package/dist/react/jsx/utils/parseAst.js +142 -272
- package/dist/react/jsx/utils/parseAst.js.map +1 -0
- package/dist/react/jsx/utils/parseString.js +726 -1090
- package/dist/react/jsx/utils/parseString.js.map +1 -0
- package/dist/react/jsx/utils/parseStringFunction.js +274 -401
- package/dist/react/jsx/utils/parseStringFunction.js.map +1 -0
- package/dist/react/jsx/utils/resolveImportPath.d.ts +1 -1
- package/dist/react/jsx/utils/resolveImportPath.js +125 -108
- package/dist/react/jsx/utils/resolveImportPath.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/derivation/containsDeriveCall.js +18 -24
- package/dist/react/jsx/utils/stringParsing/derivation/containsDeriveCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/derivation/handleDerivation.js +412 -579
- package/dist/react/jsx/utils/stringParsing/derivation/handleDerivation.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/derivation/index.js +57 -67
- package/dist/react/jsx/utils/stringParsing/derivation/index.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/derivation/isDeriveCall.js +26 -36
- package/dist/react/jsx/utils/stringParsing/derivation/isDeriveCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js +29 -24
- package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js +34 -32
- package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js +80 -117
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js +24 -19
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js +18 -21
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js +45 -50
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js +54 -59
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js.map +1 -0
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js +56 -69
- package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js.map +1 -0
- package/dist/react/jsx/utils/validateStringFunction.js +21 -29
- package/dist/react/jsx/utils/validateStringFunction.js.map +1 -0
- package/dist/react/jsx/wrapJsx.js +192 -375
- package/dist/react/jsx/wrapJsx.js.map +1 -0
- package/dist/react/parse/addVitePlugin/index.js +40 -34
- package/dist/react/parse/addVitePlugin/index.js.map +1 -0
- package/dist/react/parse/addVitePlugin/installCompiler.js +18 -20
- package/dist/react/parse/addVitePlugin/installCompiler.js.map +1 -0
- package/dist/react/parse/addVitePlugin/updateViteConfig.js +107 -111
- package/dist/react/parse/addVitePlugin/updateViteConfig.js.map +1 -0
- package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js +23 -26
- package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js.map +1 -0
- package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js +29 -43
- package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js.map +1 -0
- package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js +70 -104
- package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js.map +1 -0
- package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js +23 -29
- package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js.map +1 -0
- package/dist/react/parse/createDictionaryUpdates.js +121 -185
- package/dist/react/parse/createDictionaryUpdates.js.map +1 -0
- package/dist/react/parse/createInlineUpdates.js +123 -139
- package/dist/react/parse/createInlineUpdates.js.map +1 -0
- package/dist/react/parse/wrapContent.js +131 -156
- package/dist/react/parse/wrapContent.js.map +1 -0
- package/dist/react/utils/flattenDictionary.js +55 -70
- package/dist/react/utils/flattenDictionary.js.map +1 -0
- package/dist/react/utils/getEntryAndMetadata.js +14 -10
- package/dist/react/utils/getEntryAndMetadata.js.map +1 -0
- package/dist/react/utils/getVariableName.js +36 -33
- package/dist/react/utils/getVariableName.js.map +1 -0
- package/dist/setup/detectFramework.js +85 -102
- package/dist/setup/detectFramework.js.map +1 -0
- package/dist/setup/frameworkUtils.js +17 -28
- package/dist/setup/frameworkUtils.js.map +1 -0
- package/dist/setup/userInput.js +24 -31
- package/dist/setup/userInput.js.map +1 -0
- package/dist/setup/wizard.js +141 -143
- package/dist/setup/wizard.js.map +1 -0
- package/dist/state/mintlifyRefMap.js +12 -9
- package/dist/state/mintlifyRefMap.js.map +1 -0
- package/dist/state/recentDownloads.js +26 -23
- package/dist/state/recentDownloads.js.map +1 -0
- package/dist/state/translateWarnings.js +17 -8
- package/dist/state/translateWarnings.js.map +1 -0
- package/dist/translation/parse.js +77 -98
- package/dist/translation/parse.js.map +1 -0
- package/dist/translation/stage.js +28 -43
- package/dist/translation/stage.js.map +1 -0
- package/dist/translation/validate.js +68 -91
- package/dist/translation/validate.js.map +1 -0
- package/dist/types/libraries.js +93 -91
- package/dist/types/libraries.js.map +1 -0
- package/dist/types/parsing.js +19 -10
- package/dist/types/parsing.js.map +1 -0
- package/dist/utils/addExplicitAnchorIds.js +270 -389
- package/dist/utils/addExplicitAnchorIds.js.map +1 -0
- package/dist/utils/calculateTimeoutMs.js +11 -6
- package/dist/utils/calculateTimeoutMs.js.map +1 -0
- package/dist/utils/constants.js +15 -12
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/credentials.js +67 -114
- package/dist/utils/credentials.js.map +1 -0
- package/dist/utils/fetch.js +22 -20
- package/dist/utils/fetch.js.map +1 -0
- package/dist/utils/flattenJsonFiles.js +27 -34
- package/dist/utils/flattenJsonFiles.js.map +1 -0
- package/dist/utils/gitDiff.js +30 -32
- package/dist/utils/gitDiff.js.map +1 -0
- package/dist/utils/gt.js +7 -2
- package/dist/utils/gt.js.map +1 -0
- package/dist/utils/hash.js +14 -9
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/headers.js +10 -13
- package/dist/utils/headers.js.map +1 -0
- package/dist/utils/installPackage.js +70 -75
- package/dist/utils/installPackage.js.map +1 -0
- package/dist/utils/localizeRelativeAssets.js +114 -157
- package/dist/utils/localizeRelativeAssets.js.map +1 -0
- package/dist/utils/localizeStaticImports.js +229 -371
- package/dist/utils/localizeStaticImports.js.map +1 -0
- package/dist/utils/localizeStaticUrls.js +241 -424
- package/dist/utils/localizeStaticUrls.js.map +1 -0
- package/dist/utils/mintlifyTitleFallback.js +64 -72
- package/dist/utils/mintlifyTitleFallback.js.map +1 -0
- package/dist/utils/monorepoVersionCheck.js +177 -215
- package/dist/utils/monorepoVersionCheck.js.map +1 -0
- package/dist/utils/packageInfo.js +17 -16
- package/dist/utils/packageInfo.js.map +1 -0
- package/dist/utils/packageJson.js +51 -66
- package/dist/utils/packageJson.js.map +1 -0
- package/dist/utils/packageManager.js +237 -260
- package/dist/utils/packageManager.js.map +1 -0
- package/dist/utils/parse/needsCJS.js +36 -69
- package/dist/utils/parse/needsCJS.js.map +1 -0
- package/dist/utils/persistPostprocessHashes.js +30 -32
- package/dist/utils/persistPostprocessHashes.js.map +1 -0
- package/dist/utils/processAnchorIds.js +32 -54
- package/dist/utils/processAnchorIds.js.map +1 -0
- package/dist/utils/processOpenApi.js +469 -578
- package/dist/utils/processOpenApi.js.map +1 -0
- package/dist/utils/resolveMintlifyRefs.js +89 -105
- package/dist/utils/resolveMintlifyRefs.js.map +1 -0
- package/dist/utils/resolvePublish.js +46 -54
- package/dist/utils/resolvePublish.js.map +1 -0
- package/dist/utils/sanitizeFileContent.js +20 -27
- package/dist/utils/sanitizeFileContent.js.map +1 -0
- package/dist/utils/sharedStaticAssets.js +248 -366
- package/dist/utils/sharedStaticAssets.js.map +1 -0
- package/dist/utils/splitMintlifyLanguageRefs.js +208 -282
- package/dist/utils/splitMintlifyLanguageRefs.js.map +1 -0
- package/dist/utils/validateMdx.js +26 -23
- package/dist/utils/validateMdx.js.map +1 -0
- package/dist/utils/wrapPlainUrls.js +58 -70
- package/dist/utils/wrapPlainUrls.js.map +1 -0
- package/dist/workflows/download.js +92 -126
- package/dist/workflows/download.js.map +1 -0
- package/dist/workflows/enqueue.js +47 -54
- package/dist/workflows/enqueue.js.map +1 -0
- package/dist/workflows/publish.js +29 -29
- package/dist/workflows/publish.js.map +1 -0
- package/dist/workflows/setupProject.js +39 -40
- package/dist/workflows/setupProject.js.map +1 -0
- package/dist/workflows/stage.js +61 -65
- package/dist/workflows/stage.js.map +1 -0
- package/dist/workflows/steps/BranchStep.js +118 -163
- package/dist/workflows/steps/BranchStep.js.map +1 -0
- package/dist/workflows/steps/DownloadStep.js +107 -137
- package/dist/workflows/steps/DownloadStep.js.map +1 -0
- package/dist/workflows/steps/EnqueueStep.js +32 -32
- package/dist/workflows/steps/EnqueueStep.js.map +1 -0
- package/dist/workflows/steps/PollJobsStep.js +208 -292
- package/dist/workflows/steps/PollJobsStep.js.map +1 -0
- package/dist/workflows/steps/PublishStep.js +33 -38
- package/dist/workflows/steps/PublishStep.js.map +1 -0
- package/dist/workflows/steps/SetupStep.js +71 -72
- package/dist/workflows/steps/SetupStep.js.map +1 -0
- package/dist/workflows/steps/TagStep.js +39 -44
- package/dist/workflows/steps/TagStep.js.map +1 -0
- package/dist/workflows/steps/UploadSourcesStep.js +108 -140
- package/dist/workflows/steps/UploadSourcesStep.js.map +1 -0
- package/dist/workflows/steps/UploadTranslationsStep.js +61 -71
- package/dist/workflows/steps/UploadTranslationsStep.js.map +1 -0
- package/dist/workflows/steps/UserEditDiffsStep.js +32 -34
- package/dist/workflows/steps/UserEditDiffsStep.js.map +1 -0
- package/dist/workflows/steps/WorkflowStep.js +6 -2
- package/dist/workflows/steps/WorkflowStep.js.map +1 -0
- package/dist/workflows/upload.js +45 -46
- package/dist/workflows/upload.js.map +1 -0
- package/package.json +14 -7
|
@@ -1,75 +1,60 @@
|
|
|
1
|
-
import { logErrorAndExit } from
|
|
1
|
+
import { logErrorAndExit } from "../../console/logging.js";
|
|
2
|
+
//#region src/react/utils/flattenDictionary.ts
|
|
2
3
|
const createDuplicateKeyError = (key) => `Duplicate key found in dictionary: "${key}"`;
|
|
3
4
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
else {
|
|
28
|
-
if (flattened.hasOwnProperty(newKey)) {
|
|
29
|
-
logErrorAndExit(createDuplicateKeyError(newKey));
|
|
30
|
-
}
|
|
31
|
-
flattened[newKey] = dictionary[key];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return flattened;
|
|
5
|
+
* Flattens a nested dictionary by concatenating nested keys.
|
|
6
|
+
* Throws an error if two keys result in the same flattened key.
|
|
7
|
+
* @param {Record<string, any>} dictionary - The dictionary to flatten.
|
|
8
|
+
* @param {string} [prefix=''] - The prefix for nested keys.
|
|
9
|
+
* @returns {Record<string, React.ReactNode>} The flattened dictionary object.
|
|
10
|
+
* @throws {Error} If two keys result in the same flattened key.
|
|
11
|
+
*/
|
|
12
|
+
function flattenDictionary(dictionary, prefix = "") {
|
|
13
|
+
const flattened = {};
|
|
14
|
+
for (const key in dictionary) if (dictionary.hasOwnProperty(key)) {
|
|
15
|
+
const newKey = prefix ? `${prefix}.${key}` : key;
|
|
16
|
+
if (typeof dictionary[key] === "object" && dictionary[key] !== null && !Array.isArray(dictionary[key])) {
|
|
17
|
+
const nestedFlattened = flattenDictionary(dictionary[key], newKey);
|
|
18
|
+
for (const flatKey in nestedFlattened) {
|
|
19
|
+
if (flattened.hasOwnProperty(flatKey)) logErrorAndExit(createDuplicateKeyError(flatKey));
|
|
20
|
+
flattened[flatKey] = nestedFlattened[flatKey];
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
if (flattened.hasOwnProperty(newKey)) logErrorAndExit(createDuplicateKeyError(newKey));
|
|
24
|
+
flattened[newKey] = dictionary[key];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return flattened;
|
|
36
28
|
}
|
|
37
29
|
/**
|
|
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
|
-
else if (typeof value === 'string') {
|
|
66
|
-
// Handle string values
|
|
67
|
-
if (flattened.hasOwnProperty(newKey)) {
|
|
68
|
-
logErrorAndExit(createDuplicateKeyError(newKey));
|
|
69
|
-
}
|
|
70
|
-
flattened[newKey] = value;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return flattened;
|
|
30
|
+
* Flattens a nested dictionary containing only string values
|
|
31
|
+
* Throws an error if two keys result in the same flattened key.
|
|
32
|
+
* @param {JSONDictionary} dictionary - The dictionary to flatten.
|
|
33
|
+
* @param {string} [prefix=''] - The prefix for nested keys.
|
|
34
|
+
* @returns {FlattenedJSONDictionary} The flattened dictionary with string values.
|
|
35
|
+
* @throws {Error} If two keys result in the same flattened key.
|
|
36
|
+
* @throws {Error} If a value is an array.
|
|
37
|
+
*/
|
|
38
|
+
function flattenJsonDictionary(dictionary, prefix = "") {
|
|
39
|
+
const flattened = {};
|
|
40
|
+
for (const key in dictionary) if (dictionary.hasOwnProperty(key)) {
|
|
41
|
+
const newKey = prefix ? `${prefix}.${key}` : key;
|
|
42
|
+
const value = dictionary[key];
|
|
43
|
+
if (Array.isArray(value)) logErrorAndExit(`Arrays are not supported in JSON dictionary at key: "${newKey}"`);
|
|
44
|
+
else if (typeof value === "object" && value !== null) {
|
|
45
|
+
const nestedFlattened = flattenJsonDictionary(value, newKey);
|
|
46
|
+
for (const flatKey in nestedFlattened) {
|
|
47
|
+
if (flattened.hasOwnProperty(flatKey)) logErrorAndExit(createDuplicateKeyError(flatKey));
|
|
48
|
+
flattened[flatKey] = nestedFlattened[flatKey];
|
|
49
|
+
}
|
|
50
|
+
} else if (typeof value === "string") {
|
|
51
|
+
if (flattened.hasOwnProperty(newKey)) logErrorAndExit(createDuplicateKeyError(newKey));
|
|
52
|
+
flattened[newKey] = value;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return flattened;
|
|
75
56
|
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { flattenDictionary as default, flattenJsonDictionary };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=flattenDictionary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenDictionary.js","names":[],"sources":["../../../src/react/utils/flattenDictionary.ts"],"sourcesContent":["import {\n Dictionary,\n FlattenedDictionary,\n FlattenedJSONDictionary,\n JSONDictionary,\n} from '../../types/data.js';\nimport { logErrorAndExit } from '../../console/logging.js';\n\nconst createDuplicateKeyError = (key: string) =>\n `Duplicate key found in dictionary: \"${key}\"`;\n\n/**\n * Flattens a nested dictionary by concatenating nested keys.\n * Throws an error if two keys result in the same flattened key.\n * @param {Record<string, any>} dictionary - The dictionary to flatten.\n * @param {string} [prefix=''] - The prefix for nested keys.\n * @returns {Record<string, React.ReactNode>} The flattened dictionary object.\n * @throws {Error} If two keys result in the same flattened key.\n */\nexport default function flattenDictionary(\n dictionary: Dictionary,\n prefix: string = ''\n): FlattenedDictionary {\n const flattened: FlattenedDictionary = {};\n for (const key in dictionary) {\n if (dictionary.hasOwnProperty(key)) {\n const newKey = prefix ? `${prefix}.${key}` : key;\n if (\n typeof dictionary[key] === 'object' &&\n dictionary[key] !== null &&\n !Array.isArray(dictionary[key])\n ) {\n const nestedFlattened = flattenDictionary(dictionary[key], newKey);\n for (const flatKey in nestedFlattened) {\n if (flattened.hasOwnProperty(flatKey)) {\n logErrorAndExit(createDuplicateKeyError(flatKey));\n }\n flattened[flatKey] = nestedFlattened[flatKey];\n }\n } else {\n if (flattened.hasOwnProperty(newKey)) {\n logErrorAndExit(createDuplicateKeyError(newKey));\n }\n flattened[newKey] = dictionary[key];\n }\n }\n }\n return flattened;\n}\n\n/**\n * Flattens a nested dictionary containing only string values\n * Throws an error if two keys result in the same flattened key.\n * @param {JSONDictionary} dictionary - The dictionary to flatten.\n * @param {string} [prefix=''] - The prefix for nested keys.\n * @returns {FlattenedJSONDictionary} The flattened dictionary with string values.\n * @throws {Error} If two keys result in the same flattened key.\n * @throws {Error} If a value is an array.\n */\nexport function flattenJsonDictionary(\n dictionary: JSONDictionary,\n prefix: string = ''\n): FlattenedJSONDictionary {\n const flattened: FlattenedJSONDictionary = {};\n for (const key in dictionary) {\n if (dictionary.hasOwnProperty(key)) {\n const newKey = prefix ? `${prefix}.${key}` : key;\n const value = dictionary[key];\n\n if (Array.isArray(value)) {\n logErrorAndExit(\n `Arrays are not supported in JSON dictionary at key: \"${newKey}\"`\n );\n } else if (typeof value === 'object' && value !== null) {\n // Recursively flatten nested objects\n const nestedFlattened = flattenJsonDictionary(value, newKey);\n for (const flatKey in nestedFlattened) {\n if (flattened.hasOwnProperty(flatKey)) {\n logErrorAndExit(createDuplicateKeyError(flatKey));\n }\n flattened[flatKey] = nestedFlattened[flatKey];\n }\n } else if (typeof value === 'string') {\n // Handle string values\n if (flattened.hasOwnProperty(newKey)) {\n logErrorAndExit(createDuplicateKeyError(newKey));\n }\n flattened[newKey] = value;\n }\n }\n }\n return flattened;\n}\n"],"mappings":";;AAQA,MAAM,2BAA2B,QAC/B,uCAAuC,IAAI;;;;;;;;;AAU7C,SAAwB,kBACtB,YACA,SAAiB,IACI;CACrB,MAAM,YAAiC,EAAE;AACzC,MAAK,MAAM,OAAO,WAChB,KAAI,WAAW,eAAe,IAAI,EAAE;EAClC,MAAM,SAAS,SAAS,GAAG,OAAO,GAAG,QAAQ;AAC7C,MACE,OAAO,WAAW,SAAS,YAC3B,WAAW,SAAS,QACpB,CAAC,MAAM,QAAQ,WAAW,KAAK,EAC/B;GACA,MAAM,kBAAkB,kBAAkB,WAAW,MAAM,OAAO;AAClE,QAAK,MAAM,WAAW,iBAAiB;AACrC,QAAI,UAAU,eAAe,QAAQ,CACnC,iBAAgB,wBAAwB,QAAQ,CAAC;AAEnD,cAAU,WAAW,gBAAgB;;SAElC;AACL,OAAI,UAAU,eAAe,OAAO,CAClC,iBAAgB,wBAAwB,OAAO,CAAC;AAElD,aAAU,UAAU,WAAW;;;AAIrC,QAAO;;;;;;;;;;;AAYT,SAAgB,sBACd,YACA,SAAiB,IACQ;CACzB,MAAM,YAAqC,EAAE;AAC7C,MAAK,MAAM,OAAO,WAChB,KAAI,WAAW,eAAe,IAAI,EAAE;EAClC,MAAM,SAAS,SAAS,GAAG,OAAO,GAAG,QAAQ;EAC7C,MAAM,QAAQ,WAAW;AAEzB,MAAI,MAAM,QAAQ,MAAM,CACtB,iBACE,wDAAwD,OAAO,GAChE;WACQ,OAAO,UAAU,YAAY,UAAU,MAAM;GAEtD,MAAM,kBAAkB,sBAAsB,OAAO,OAAO;AAC5D,QAAK,MAAM,WAAW,iBAAiB;AACrC,QAAI,UAAU,eAAe,QAAQ,CACnC,iBAAgB,wBAAwB,QAAQ,CAAC;AAEnD,cAAU,WAAW,gBAAgB;;aAE9B,OAAO,UAAU,UAAU;AAEpC,OAAI,UAAU,eAAe,OAAO,CAClC,iBAAgB,wBAAwB,OAAO,CAAC;AAElD,aAAU,UAAU;;;AAI1B,QAAO"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//#region src/react/utils/getEntryAndMetadata.ts
|
|
2
|
+
function getEntryAndMetadata(value) {
|
|
3
|
+
if (Array.isArray(value)) {
|
|
4
|
+
if (value.length === 1) return { entry: value[0] };
|
|
5
|
+
if (value.length === 2) return {
|
|
6
|
+
entry: value[0],
|
|
7
|
+
metadata: value[1]
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return { entry: value };
|
|
11
11
|
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { getEntryAndMetadata as default };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=getEntryAndMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntryAndMetadata.js","names":[],"sources":["../../../src/react/utils/getEntryAndMetadata.ts"],"sourcesContent":["import { DictionaryEntry, DictionaryMetadata } from '../../types/data.js';\n\nexport default function getEntryAndMetadata(value: DictionaryEntry): {\n entry: string;\n metadata?: DictionaryMetadata;\n} {\n if (Array.isArray(value)) {\n if (value.length === 1) {\n return { entry: value[0] };\n }\n if (value.length === 2) {\n return { entry: value[0], metadata: value[1] as DictionaryMetadata };\n }\n }\n return { entry: value };\n}\n"],"mappings":";AAEA,SAAwB,oBAAoB,OAG1C;AACA,KAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,MAAI,MAAM,WAAW,EACnB,QAAO,EAAE,OAAO,MAAM,IAAI;AAE5B,MAAI,MAAM,WAAW,EACnB,QAAO;GAAE,OAAO,MAAM;GAAI,UAAU,MAAM;GAA0B;;AAGxE,QAAO,EAAE,OAAO,OAAO"}
|
|
@@ -1,41 +1,44 @@
|
|
|
1
|
+
//#region src/react/utils/getVariableName.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
* These are the names of the variable components as they appear in gt-next and gt-react
|
|
4
|
+
*/
|
|
5
|
+
const defaultVariableNames = {
|
|
6
|
+
Var: "value",
|
|
7
|
+
GtInternalVar: "value",
|
|
8
|
+
Num: "n",
|
|
9
|
+
DateTime: "date",
|
|
10
|
+
RelativeTime: "time",
|
|
11
|
+
Currency: "cost"
|
|
11
12
|
};
|
|
12
13
|
const minifyVariableTypeMap = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
Var: "v",
|
|
15
|
+
GtInternalVar: "v",
|
|
16
|
+
Num: "n",
|
|
17
|
+
DateTime: "d",
|
|
18
|
+
RelativeTime: "rt",
|
|
19
|
+
Currency: "c"
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
* Minify the variable type from the name of the variable component (from gt-next and gt-react)
|
|
23
|
+
* @param variableType - The type of the variable (Var, Num, DateTime, Currency)
|
|
24
|
+
* @returns The minified variable type
|
|
25
|
+
*/
|
|
26
|
+
const minifyVariableType = (variableType) => {
|
|
27
|
+
return minifyVariableTypeMap[variableType];
|
|
27
28
|
};
|
|
28
|
-
|
|
29
|
+
const baseVariablePrefix = "_gt_";
|
|
29
30
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const baseVariableName = defaultVariableNames[variableType] || 'value';
|
|
40
|
-
return `${baseVariablePrefix}${baseVariableName}_${id}`;
|
|
31
|
+
* Get the name of a variable
|
|
32
|
+
* @param props - The props of the variable
|
|
33
|
+
* @param variableType - The type of the variable (Var, Num, DateTime, Currency)
|
|
34
|
+
* @param id - The id of the variable
|
|
35
|
+
* @returns The name of the variable
|
|
36
|
+
*/
|
|
37
|
+
function getVariableName(props = {}, variableType, id) {
|
|
38
|
+
if (typeof props.name === "string") return props.name;
|
|
39
|
+
return `${baseVariablePrefix}${defaultVariableNames[variableType] || "value"}_${id}`;
|
|
41
40
|
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { baseVariablePrefix, defaultVariableNames, getVariableName, minifyVariableType };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=getVariableName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVariableName.js","names":[],"sources":["../../../src/react/utils/getVariableName.ts"],"sourcesContent":["import type { VariableType } from '@generaltranslation/format/types';\n\n/**\n * These are the names of the variable components as they appear in gt-next and gt-react\n */\nexport const defaultVariableNames = {\n Var: 'value',\n GtInternalVar: 'value',\n Num: 'n',\n DateTime: 'date',\n RelativeTime: 'time',\n Currency: 'cost',\n} as const;\n\nconst minifyVariableTypeMap = {\n Var: 'v',\n GtInternalVar: 'v',\n Num: 'n',\n DateTime: 'd',\n RelativeTime: 'rt',\n Currency: 'c',\n} as const;\n\n/**\n * Minify the variable type from the name of the variable component (from gt-next and gt-react)\n * @param variableType - The type of the variable (Var, Num, DateTime, Currency)\n * @returns The minified variable type\n */\nexport const minifyVariableType = (\n variableType: keyof typeof defaultVariableNames\n): VariableType => {\n return minifyVariableTypeMap[variableType] as VariableType;\n};\n\nexport const baseVariablePrefix = '_gt_';\n\n/**\n * Get the name of a variable\n * @param props - The props of the variable\n * @param variableType - The type of the variable (Var, Num, DateTime, Currency)\n * @param id - The id of the variable\n * @returns The name of the variable\n */\nexport function getVariableName(\n props: Record<string, unknown> = {},\n variableType: keyof typeof defaultVariableNames,\n id: number\n): string {\n if (typeof props.name === 'string') return props.name;\n const baseVariableName =\n (defaultVariableNames as Record<string, string>)[variableType] || 'value';\n return `${baseVariablePrefix}${baseVariableName}_${id}`;\n}\n"],"mappings":";;;;AAKA,MAAa,uBAAuB;CAClC,KAAK;CACL,eAAe;CACf,KAAK;CACL,UAAU;CACV,cAAc;CACd,UAAU;CACX;AAED,MAAM,wBAAwB;CAC5B,KAAK;CACL,eAAe;CACf,KAAK;CACL,UAAU;CACV,cAAc;CACd,UAAU;CACX;;;;;;AAOD,MAAa,sBACX,iBACiB;AACjB,QAAO,sBAAsB;;AAG/B,MAAa,qBAAqB;;;;;;;;AASlC,SAAgB,gBACd,QAAiC,EAAE,EACnC,cACA,IACQ;AACR,KAAI,OAAO,MAAM,SAAS,SAAU,QAAO,MAAM;AAGjD,QAAO,GAAG,qBADP,qBAAgD,iBAAiB,QACpB,GAAG"}
|
|
@@ -1,106 +1,89 @@
|
|
|
1
|
-
import { isPackageInstalled } from
|
|
2
|
-
import
|
|
3
|
-
import fs from
|
|
4
|
-
|
|
5
|
-
/* ----- MAIN ----- */
|
|
1
|
+
import { isPackageInstalled, searchForPackageJson } from "../utils/packageJson.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
//#region src/setup/detectFramework.ts
|
|
6
5
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// Check for React (generic)
|
|
59
|
-
if (isPackageInstalled('react', packageJson, false, true)) {
|
|
60
|
-
return { name: 'react', type: 'react' };
|
|
61
|
-
}
|
|
62
|
-
return { name: undefined };
|
|
6
|
+
* Detects the frontend framework used in the current project.
|
|
7
|
+
*
|
|
8
|
+
* Analyzes the project structure and dependencies to identify the framework.
|
|
9
|
+
* Detection order: Mintlify → Next.js (App/Pages Router) → Gatsby → RedwoodJS → Vite → React.
|
|
10
|
+
*
|
|
11
|
+
* For Next.js projects, further determines whether it uses App Router or Pages Router
|
|
12
|
+
* by checking for the presence of `app/` or `pages/` directories.
|
|
13
|
+
*
|
|
14
|
+
* @returns A promise resolving to a FrameworkObject containing:
|
|
15
|
+
* - `name`: The detected framework identifier (e.g., 'next-app', 'gatsby', 'react')
|
|
16
|
+
* or undefined if no framework is detected
|
|
17
|
+
* - `type`: The framework category (currently only 'react' for React-based frameworks)
|
|
18
|
+
*/
|
|
19
|
+
async function detectFramework() {
|
|
20
|
+
const packageJson = await searchForPackageJson();
|
|
21
|
+
if (isMintlifyProject(packageJson)) return { name: "mintlify" };
|
|
22
|
+
if (!packageJson) return { name: void 0 };
|
|
23
|
+
if (isPackageInstalled("next", packageJson, false, true)) {
|
|
24
|
+
const cwd = process.cwd();
|
|
25
|
+
const hasAppDir = fs.existsSync(path.join(cwd, "app")) || fs.existsSync(path.join(cwd, "src", "app"));
|
|
26
|
+
const hasPagesDir = fs.existsSync(path.join(cwd, "pages")) || fs.existsSync(path.join(cwd, "src", "pages"));
|
|
27
|
+
if (hasAppDir) return {
|
|
28
|
+
name: "next-app",
|
|
29
|
+
type: "react"
|
|
30
|
+
};
|
|
31
|
+
if (hasPagesDir) return {
|
|
32
|
+
name: "next-pages",
|
|
33
|
+
type: "react"
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
name: "next-app",
|
|
37
|
+
type: "react"
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (isPackageInstalled("gatsby", packageJson, false, true)) return {
|
|
41
|
+
name: "gatsby",
|
|
42
|
+
type: "react"
|
|
43
|
+
};
|
|
44
|
+
if (isPackageInstalled("@redwoodjs/core", packageJson, false, true)) return {
|
|
45
|
+
name: "redwood",
|
|
46
|
+
type: "react"
|
|
47
|
+
};
|
|
48
|
+
if (isPackageInstalled("vite", packageJson, false, true)) return {
|
|
49
|
+
name: "vite",
|
|
50
|
+
type: "react"
|
|
51
|
+
};
|
|
52
|
+
if (isPackageInstalled("react", packageJson, false, true)) return {
|
|
53
|
+
name: "react",
|
|
54
|
+
type: "react"
|
|
55
|
+
};
|
|
56
|
+
return { name: void 0 };
|
|
63
57
|
}
|
|
64
|
-
// ----- HELPER FUNCTIONS ----- //
|
|
65
58
|
/**
|
|
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
|
-
if (fs.existsSync(docsJsonPath)) {
|
|
93
|
-
try {
|
|
94
|
-
const docsJson = JSON.parse(fs.readFileSync(docsJsonPath, 'utf-8'));
|
|
95
|
-
// Validate the $schema field contains mintlify.com/docs.json
|
|
96
|
-
if (docsJson.$schema &&
|
|
97
|
-
docsJson.$schema.includes('mintlify.com/docs.json')) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return false;
|
|
59
|
+
* Detects if the current project is a Mintlify documentation project.
|
|
60
|
+
*
|
|
61
|
+
* Checks for the presence of docs.json (preferred) or mint.json (legacy) files.
|
|
62
|
+
* For docs.json, validates that the $schema field contains "mintlify.com/docs.json".
|
|
63
|
+
* Rejects projects with Next.js config files to avoid misclassification.
|
|
64
|
+
*
|
|
65
|
+
* @param _packageJson - The parsed package.json object (not used for Mintlify detection,
|
|
66
|
+
* but kept for API consistency with other detection functions)
|
|
67
|
+
* @returns True if the project is identified as a Mintlify project, false otherwise
|
|
68
|
+
*/
|
|
69
|
+
function isMintlifyProject(_packageJson) {
|
|
70
|
+
const cwd = process.cwd();
|
|
71
|
+
for (const configFile of [
|
|
72
|
+
"next.config.js",
|
|
73
|
+
"next.config.ts",
|
|
74
|
+
"next.config.mjs",
|
|
75
|
+
"next.config.cjs"
|
|
76
|
+
]) if (fs.existsSync(path.join(cwd, configFile))) return false;
|
|
77
|
+
const docsJsonPath = path.join(cwd, "docs.json");
|
|
78
|
+
if (fs.existsSync(docsJsonPath)) try {
|
|
79
|
+
const docsJson = JSON.parse(fs.readFileSync(docsJsonPath, "utf-8"));
|
|
80
|
+
if (docsJson.$schema && docsJson.$schema.includes("mintlify.com/docs.json")) return true;
|
|
81
|
+
} catch {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
106
85
|
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { detectFramework, isMintlifyProject };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=detectFramework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectFramework.js","names":[],"sources":["../../src/setup/detectFramework.ts"],"sourcesContent":["import { FrameworkObject } from '../types/index.js';\nimport { isPackageInstalled } from '../utils/packageJson.js';\nimport { searchForPackageJson } from '../utils/packageJson.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\n/* ----- MAIN ----- */\n\n/**\n * Detects the frontend framework used in the current project.\n *\n * Analyzes the project structure and dependencies to identify the framework.\n * Detection order: Mintlify → Next.js (App/Pages Router) → Gatsby → RedwoodJS → Vite → React.\n *\n * For Next.js projects, further determines whether it uses App Router or Pages Router\n * by checking for the presence of `app/` or `pages/` directories.\n *\n * @returns A promise resolving to a FrameworkObject containing:\n * - `name`: The detected framework identifier (e.g., 'next-app', 'gatsby', 'react')\n * or undefined if no framework is detected\n * - `type`: The framework category (currently only 'react' for React-based frameworks)\n */\nexport async function detectFramework(): Promise<\n FrameworkObject | { name: undefined; type?: undefined }\n> {\n const packageJson = await searchForPackageJson();\n\n if (isMintlifyProject(packageJson)) {\n return { name: 'mintlify' };\n }\n\n if (!packageJson) {\n return { name: undefined };\n }\n\n // Check for Next.js first\n if (isPackageInstalled('next', packageJson, false, true)) {\n // Determine if it's App Router or Pages Router\n const cwd = process.cwd();\n const hasAppDir =\n fs.existsSync(path.join(cwd, 'app')) ||\n fs.existsSync(path.join(cwd, 'src', 'app'));\n const hasPagesDir =\n fs.existsSync(path.join(cwd, 'pages')) ||\n fs.existsSync(path.join(cwd, 'src', 'pages'));\n\n // App Router takes precedence if both exist\n if (hasAppDir) {\n return { name: 'next-app', type: 'react' };\n }\n if (hasPagesDir) {\n return { name: 'next-pages', type: 'react' };\n }\n // Default to app router for new Next.js projects\n return { name: 'next-app', type: 'react' };\n }\n\n // Check for Gatsby\n if (isPackageInstalled('gatsby', packageJson, false, true)) {\n return { name: 'gatsby', type: 'react' };\n }\n\n // Check for RedwoodJS\n if (isPackageInstalled('@redwoodjs/core', packageJson, false, true)) {\n return { name: 'redwood', type: 'react' };\n }\n\n // Check for Vite\n if (isPackageInstalled('vite', packageJson, false, true)) {\n return { name: 'vite', type: 'react' };\n }\n\n // Check for React (generic)\n if (isPackageInstalled('react', packageJson, false, true)) {\n return { name: 'react', type: 'react' };\n }\n\n return { name: undefined };\n}\n\n// ----- HELPER FUNCTIONS ----- //\n\n/**\n * Detects if the current project is a Mintlify documentation project.\n *\n * Checks for the presence of docs.json (preferred) or mint.json (legacy) files.\n * For docs.json, validates that the $schema field contains \"mintlify.com/docs.json\".\n * Rejects projects with Next.js config files to avoid misclassification.\n *\n * @param _packageJson - The parsed package.json object (not used for Mintlify detection,\n * but kept for API consistency with other detection functions)\n * @returns True if the project is identified as a Mintlify project, false otherwise\n */\nexport function isMintlifyProject(\n _packageJson: Record<string, unknown> | null\n): boolean {\n const cwd = process.cwd();\n\n // Check for Next.js config files - if present, this is not a Mintlify project\n const nextConfigFiles = [\n 'next.config.js',\n 'next.config.ts',\n 'next.config.mjs',\n 'next.config.cjs',\n ];\n\n for (const configFile of nextConfigFiles) {\n if (fs.existsSync(path.join(cwd, configFile))) {\n return false;\n }\n }\n\n // Check for docs.json (preferred format)\n const docsJsonPath = path.join(cwd, 'docs.json');\n if (fs.existsSync(docsJsonPath)) {\n try {\n const docsJson = JSON.parse(fs.readFileSync(docsJsonPath, 'utf-8'));\n // Validate the $schema field contains mintlify.com/docs.json\n if (\n docsJson.$schema &&\n docsJson.$schema.includes('mintlify.com/docs.json')\n ) {\n return true;\n }\n } catch {\n return false;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,eAAsB,kBAEpB;CACA,MAAM,cAAc,MAAM,sBAAsB;AAEhD,KAAI,kBAAkB,YAAY,CAChC,QAAO,EAAE,MAAM,YAAY;AAG7B,KAAI,CAAC,YACH,QAAO,EAAE,MAAM,KAAA,GAAW;AAI5B,KAAI,mBAAmB,QAAQ,aAAa,OAAO,KAAK,EAAE;EAExD,MAAM,MAAM,QAAQ,KAAK;EACzB,MAAM,YACJ,GAAG,WAAW,KAAK,KAAK,KAAK,MAAM,CAAC,IACpC,GAAG,WAAW,KAAK,KAAK,KAAK,OAAO,MAAM,CAAC;EAC7C,MAAM,cACJ,GAAG,WAAW,KAAK,KAAK,KAAK,QAAQ,CAAC,IACtC,GAAG,WAAW,KAAK,KAAK,KAAK,OAAO,QAAQ,CAAC;AAG/C,MAAI,UACF,QAAO;GAAE,MAAM;GAAY,MAAM;GAAS;AAE5C,MAAI,YACF,QAAO;GAAE,MAAM;GAAc,MAAM;GAAS;AAG9C,SAAO;GAAE,MAAM;GAAY,MAAM;GAAS;;AAI5C,KAAI,mBAAmB,UAAU,aAAa,OAAO,KAAK,CACxD,QAAO;EAAE,MAAM;EAAU,MAAM;EAAS;AAI1C,KAAI,mBAAmB,mBAAmB,aAAa,OAAO,KAAK,CACjE,QAAO;EAAE,MAAM;EAAW,MAAM;EAAS;AAI3C,KAAI,mBAAmB,QAAQ,aAAa,OAAO,KAAK,CACtD,QAAO;EAAE,MAAM;EAAQ,MAAM;EAAS;AAIxC,KAAI,mBAAmB,SAAS,aAAa,OAAO,KAAK,CACvD,QAAO;EAAE,MAAM;EAAS,MAAM;EAAS;AAGzC,QAAO,EAAE,MAAM,KAAA,GAAW;;;;;;;;;;;;;AAgB5B,SAAgB,kBACd,cACS;CACT,MAAM,MAAM,QAAQ,KAAK;AAUzB,MAAK,MAAM,cAAc;EANvB;EACA;EACA;EACA;EAGsC,CACtC,KAAI,GAAG,WAAW,KAAK,KAAK,KAAK,WAAW,CAAC,CAC3C,QAAO;CAKX,MAAM,eAAe,KAAK,KAAK,KAAK,YAAY;AAChD,KAAI,GAAG,WAAW,aAAa,CAC7B,KAAI;EACF,MAAM,WAAW,KAAK,MAAM,GAAG,aAAa,cAAc,QAAQ,CAAC;AAEnE,MACE,SAAS,WACT,SAAS,QAAQ,SAAS,yBAAyB,CAEnD,QAAO;SAEH;AACN,SAAO;;AAIX,QAAO"}
|
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (frameworkObject.name === 'vite') {
|
|
13
|
-
return 'Vite + React';
|
|
14
|
-
}
|
|
15
|
-
if (frameworkObject.name === 'gatsby') {
|
|
16
|
-
return 'Gatsby';
|
|
17
|
-
}
|
|
18
|
-
if (frameworkObject.name === 'redwood') {
|
|
19
|
-
return 'RedwoodJS';
|
|
20
|
-
}
|
|
21
|
-
if (frameworkObject.type === 'react') {
|
|
22
|
-
return 'React';
|
|
23
|
-
}
|
|
24
|
-
return 'another framework';
|
|
1
|
+
import "../types/libraries.js";
|
|
2
|
+
//#region src/setup/frameworkUtils.ts
|
|
3
|
+
function getFrameworkDisplayName(frameworkObject) {
|
|
4
|
+
if (frameworkObject.name === "mintlify") return "Mintlify";
|
|
5
|
+
if (frameworkObject.name === "next-app") return "Next.js App Router";
|
|
6
|
+
if (frameworkObject.name === "next-pages") return "Next.js Pages Router";
|
|
7
|
+
if (frameworkObject.name === "vite") return "Vite + React";
|
|
8
|
+
if (frameworkObject.name === "gatsby") return "Gatsby";
|
|
9
|
+
if (frameworkObject.name === "redwood") return "RedwoodJS";
|
|
10
|
+
if (frameworkObject.type === "react") return "React";
|
|
11
|
+
return "another framework";
|
|
25
12
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
? Libraries.GT_NEXT
|
|
29
|
-
: Libraries.GT_REACT;
|
|
13
|
+
function getReactFrameworkLibrary(frameworkObject) {
|
|
14
|
+
return frameworkObject.name === "next-app" ? "gt-next" : "gt-react";
|
|
30
15
|
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { getFrameworkDisplayName, getReactFrameworkLibrary };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=frameworkUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameworkUtils.js","names":[],"sources":["../../src/setup/frameworkUtils.ts"],"sourcesContent":["import { FrameworkObject, ReactFrameworkObject } from '../types/index.js';\nimport { Libraries } from '../types/libraries.js';\n\nexport function getFrameworkDisplayName(\n frameworkObject: FrameworkObject\n): string {\n if (frameworkObject.name === 'mintlify') {\n return 'Mintlify';\n }\n if (frameworkObject.name === 'next-app') {\n return 'Next.js App Router';\n }\n if (frameworkObject.name === 'next-pages') {\n return 'Next.js Pages Router';\n }\n if (frameworkObject.name === 'vite') {\n return 'Vite + React';\n }\n if (frameworkObject.name === 'gatsby') {\n return 'Gatsby';\n }\n if (frameworkObject.name === 'redwood') {\n return 'RedwoodJS';\n }\n if (frameworkObject.type === 'react') {\n return 'React';\n }\n return 'another framework';\n}\n\nexport function getReactFrameworkLibrary(\n frameworkObject: ReactFrameworkObject\n): string {\n return frameworkObject.name === 'next-app'\n ? Libraries.GT_NEXT\n : Libraries.GT_REACT;\n}\n"],"mappings":";;AAGA,SAAgB,wBACd,iBACQ;AACR,KAAI,gBAAgB,SAAS,WAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,WAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,aAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,OAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,SAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,UAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,QAC3B,QAAO;AAET,QAAO;;AAGT,SAAgB,yBACd,iBACQ;AACR,QAAO,gBAAgB,SAAS,aAAA,YAAA"}
|
package/dist/setup/userInput.js
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return 'Enter a valid locale (e.g., es fr de)';
|
|
22
|
-
}
|
|
23
|
-
for (const locale of localeList) {
|
|
24
|
-
if (!gt.isValidLocale(locale)) {
|
|
25
|
-
return 'Enter a valid locale (e.g., es fr de)';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
return { defaultLocale, locales: locales.split(' ') };
|
|
1
|
+
import { promptLocale, promptLocaleList } from "../console/logging.js";
|
|
2
|
+
import { libraryDefaultLocale } from "generaltranslation/internal";
|
|
3
|
+
//#region src/setup/userInput.ts
|
|
4
|
+
async function getDesiredLocales() {
|
|
5
|
+
return {
|
|
6
|
+
defaultLocale: await promptLocale({
|
|
7
|
+
message: "What is the default locale for your project?",
|
|
8
|
+
defaultValue: libraryDefaultLocale
|
|
9
|
+
}),
|
|
10
|
+
locales: await promptLocaleList({
|
|
11
|
+
message: "Which languages would you like to translate your project into?",
|
|
12
|
+
defaultValue: [
|
|
13
|
+
"es",
|
|
14
|
+
"fr",
|
|
15
|
+
"de",
|
|
16
|
+
"ja",
|
|
17
|
+
"zh"
|
|
18
|
+
]
|
|
19
|
+
})
|
|
20
|
+
};
|
|
32
21
|
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { getDesiredLocales };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=userInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userInput.js","names":[],"sources":["../../src/setup/userInput.ts"],"sourcesContent":["import { libraryDefaultLocale } from 'generaltranslation/internal';\nimport { promptLocale, promptLocaleList } from '../console/logging.js';\n\nexport async function getDesiredLocales(): Promise<{\n defaultLocale: string;\n locales: string[];\n}> {\n // Ask for the default locale\n const defaultLocale = await promptLocale({\n message: 'What is the default locale for your project?',\n defaultValue: libraryDefaultLocale,\n });\n\n // Ask for the locales\n const locales = await promptLocaleList({\n message: 'Which languages would you like to translate your project into?',\n defaultValue: ['es', 'fr', 'de', 'ja', 'zh'],\n });\n return { defaultLocale, locales };\n}\n"],"mappings":";;;AAGA,eAAsB,oBAGnB;AAYD,QAAO;EAAE,eAAA,MAVmB,aAAa;GACvC,SAAS;GACT,cAAc;GACf,CAAC;EAOsB,SAAA,MAJF,iBAAiB;GACrC,SAAS;GACT,cAAc;IAAC;IAAM;IAAM;IAAM;IAAM;IAAK;GAC7C,CAAC;EAC+B"}
|