gtx-cli 2.3.5 → 2.3.6-alpha.2
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/package.json +23 -18
- package/dist/api/checkFileTranslations.d.ts +0 -23
- package/dist/api/checkFileTranslations.js +0 -236
- package/dist/api/downloadFileBatch.d.ts +0 -20
- package/dist/api/downloadFileBatch.js +0 -113
- package/dist/api/sendFiles.d.ts +0 -17
- package/dist/api/sendFiles.js +0 -115
- package/dist/api/uploadFiles.d.ts +0 -27
- package/dist/api/uploadFiles.js +0 -40
- package/dist/cli/base.d.ts +0 -32
- package/dist/cli/base.js +0 -335
- package/dist/cli/commands/stage.d.ts +0 -5
- package/dist/cli/commands/stage.js +0 -100
- package/dist/cli/commands/translate.d.ts +0 -6
- package/dist/cli/commands/translate.js +0 -63
- package/dist/cli/flags.d.ts +0 -3
- package/dist/cli/flags.js +0 -38
- package/dist/cli/next.d.ts +0 -11
- package/dist/cli/next.js +0 -20
- package/dist/cli/react.d.ts +0 -18
- package/dist/cli/react.js +0 -175
- package/dist/config/generateSettings.d.ts +0 -9
- package/dist/config/generateSettings.js +0 -176
- package/dist/config/optionPresets.d.ts +0 -2
- package/dist/config/optionPresets.js +0 -56
- package/dist/config/resolveConfig.d.ts +0 -4
- package/dist/config/resolveConfig.js +0 -19
- package/dist/config/utils.d.ts +0 -2
- package/dist/config/utils.js +0 -4
- package/dist/config/validateSettings.d.ts +0 -3
- package/dist/config/validateSettings.js +0 -32
- package/dist/console/colors.d.ts +0 -5
- package/dist/console/colors.js +0 -16
- package/dist/console/index.d.ts +0 -21
- package/dist/console/index.js +0 -24
- package/dist/console/logging.d.ts +0 -53
- package/dist/console/logging.js +0 -185
- package/dist/formats/files/fileMapping.d.ts +0 -11
- package/dist/formats/files/fileMapping.js +0 -82
- package/dist/formats/files/save.d.ts +0 -5
- package/dist/formats/files/save.js +0 -17
- package/dist/formats/files/supportedFiles.d.ts +0 -10
- package/dist/formats/files/supportedFiles.js +0 -18
- package/dist/formats/files/translate.d.ts +0 -4
- package/dist/formats/files/translate.js +0 -119
- package/dist/formats/files/upload.d.ts +0 -13
- package/dist/formats/files/upload.js +0 -136
- package/dist/formats/gt/save.d.ts +0 -9
- package/dist/formats/gt/save.js +0 -26
- package/dist/formats/json/flattenJson.d.ts +0 -14
- package/dist/formats/json/flattenJson.js +0 -64
- package/dist/formats/json/mergeJson.d.ts +0 -13
- package/dist/formats/json/mergeJson.js +0 -257
- package/dist/formats/json/parseJson.d.ts +0 -2
- package/dist/formats/json/parseJson.js +0 -108
- package/dist/formats/json/utils.d.ts +0 -47
- package/dist/formats/json/utils.js +0 -149
- package/dist/formats/utils.d.ts +0 -2
- package/dist/formats/utils.js +0 -24
- package/dist/formats/yaml/mergeYaml.d.ts +0 -5
- package/dist/formats/yaml/mergeYaml.js +0 -55
- package/dist/formats/yaml/parseYaml.d.ts +0 -5
- package/dist/formats/yaml/parseYaml.js +0 -23
- package/dist/formats/yaml/utils.d.ts +0 -2
- package/dist/formats/yaml/utils.js +0 -22
- package/dist/fs/config/loadConfig.d.ts +0 -1
- package/dist/fs/config/loadConfig.js +0 -9
- package/dist/fs/config/parseFilesConfig.d.ts +0 -27
- package/dist/fs/config/parseFilesConfig.js +0 -129
- package/dist/fs/config/setupConfig.d.ts +0 -17
- package/dist/fs/config/setupConfig.js +0 -50
- package/dist/fs/config/updateConfig.d.ts +0 -10
- package/dist/fs/config/updateConfig.js +0 -36
- package/dist/fs/config/updateVersions.d.ts +0 -10
- package/dist/fs/config/updateVersions.js +0 -30
- package/dist/fs/copyFile.d.ts +0 -7
- package/dist/fs/copyFile.js +0 -39
- package/dist/fs/createLoadTranslationsFile.d.ts +0 -1
- package/dist/fs/createLoadTranslationsFile.js +0 -36
- package/dist/fs/determineFramework.d.ts +0 -5
- package/dist/fs/determineFramework.js +0 -46
- package/dist/fs/findFilepath.d.ts +0 -36
- package/dist/fs/findFilepath.js +0 -89
- package/dist/fs/getPackageResource.d.ts +0 -1
- package/dist/fs/getPackageResource.js +0 -6
- package/dist/fs/index.d.ts +0 -1
- package/dist/fs/index.js +0 -1
- package/dist/fs/loadJSON.d.ts +0 -6
- package/dist/fs/loadJSON.js +0 -17
- package/dist/fs/matchFiles.d.ts +0 -1
- package/dist/fs/matchFiles.js +0 -8
- package/dist/fs/saveJSON.d.ts +0 -1
- package/dist/fs/saveJSON.js +0 -7
- package/dist/fs/utils.d.ts +0 -1
- package/dist/fs/utils.js +0 -16
- package/dist/hooks/postProcess.d.ts +0 -4
- package/dist/hooks/postProcess.js +0 -110
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -20
- package/dist/main.d.ts +0 -2
- package/dist/main.js +0 -9
- package/dist/next/config/parseNextConfig.d.ts +0 -10
- package/dist/next/config/parseNextConfig.js +0 -53
- package/dist/next/jsx/utils.d.ts +0 -7
- package/dist/next/jsx/utils.js +0 -42
- package/dist/next/parse/handleInitGT.d.ts +0 -7
- package/dist/next/parse/handleInitGT.js +0 -208
- package/dist/next/parse/wrapContent.d.ts +0 -11
- package/dist/next/parse/wrapContent.js +0 -163
- package/dist/react/config/createESBuildConfig.d.ts +0 -2
- package/dist/react/config/createESBuildConfig.js +0 -119
- package/dist/react/data-_gt/addGTIdentifierToSyntaxTree.d.ts +0 -8
- package/dist/react/data-_gt/addGTIdentifierToSyntaxTree.js +0 -111
- package/dist/react/jsx/evaluateJsx.d.ts +0 -17
- package/dist/react/jsx/evaluateJsx.js +0 -85
- package/dist/react/jsx/trimJsxStringChildren.d.ts +0 -7
- package/dist/react/jsx/trimJsxStringChildren.js +0 -95
- package/dist/react/jsx/utils/constants.d.ts +0 -10
- package/dist/react/jsx/utils/constants.js +0 -31
- package/dist/react/jsx/utils/parseAst.d.ts +0 -30
- package/dist/react/jsx/utils/parseAst.js +0 -277
- package/dist/react/jsx/utils/parseJsx.d.ts +0 -21
- package/dist/react/jsx/utils/parseJsx.js +0 -244
- package/dist/react/jsx/utils/parseStringFunction.d.ts +0 -16
- package/dist/react/jsx/utils/parseStringFunction.js +0 -411
- package/dist/react/jsx/utils/validateStringFunction.d.ts +0 -7
- package/dist/react/jsx/utils/validateStringFunction.js +0 -31
- package/dist/react/jsx/wrapJsx.d.ts +0 -51
- package/dist/react/jsx/wrapJsx.js +0 -387
- package/dist/react/parse/createDictionaryUpdates.d.ts +0 -3
- package/dist/react/parse/createDictionaryUpdates.js +0 -169
- package/dist/react/parse/createInlineUpdates.d.ts +0 -6
- package/dist/react/parse/createInlineUpdates.js +0 -122
- package/dist/react/parse/wrapContent.d.ts +0 -11
- package/dist/react/parse/wrapContent.js +0 -162
- package/dist/react/utils/flattenDictionary.d.ts +0 -20
- package/dist/react/utils/flattenDictionary.js +0 -75
- package/dist/react/utils/getEntryAndMetadata.d.ts +0 -5
- package/dist/react/utils/getEntryAndMetadata.js +0 -11
- package/dist/react/utils/getVariableName.d.ts +0 -25
- package/dist/react/utils/getVariableName.js +0 -37
- package/dist/setup/userInput.d.ts +0 -4
- package/dist/setup/userInput.js +0 -29
- package/dist/setup/wizard.d.ts +0 -2
- package/dist/setup/wizard.js +0 -127
- package/dist/translation/parse.d.ts +0 -15
- package/dist/translation/parse.js +0 -76
- package/dist/translation/stage.d.ts +0 -2
- package/dist/translation/stage.js +0 -44
- package/dist/translation/validate.d.ts +0 -2
- package/dist/translation/validate.js +0 -50
- package/dist/types/data/json.d.ts +0 -6
- package/dist/types/data/json.js +0 -1
- package/dist/types/data.d.ts +0 -30
- package/dist/types/data.js +0 -1
- package/dist/types/files.d.ts +0 -1
- package/dist/types/files.js +0 -1
- package/dist/types/index.d.ts +0 -173
- package/dist/types/index.js +0 -1
- package/dist/utils/addExplicitAnchorIds.d.ts +0 -24
- package/dist/utils/addExplicitAnchorIds.js +0 -260
- package/dist/utils/constants.d.ts +0 -2
- package/dist/utils/constants.js +0 -2
- package/dist/utils/credentials.d.ts +0 -12
- package/dist/utils/credentials.js +0 -119
- package/dist/utils/flattenJsonFiles.d.ts +0 -2
- package/dist/utils/flattenJsonFiles.js +0 -36
- package/dist/utils/gt.d.ts +0 -2
- package/dist/utils/gt.js +0 -2
- package/dist/utils/hash.d.ts +0 -6
- package/dist/utils/hash.js +0 -11
- package/dist/utils/headers.d.ts +0 -1
- package/dist/utils/headers.js +0 -14
- package/dist/utils/installPackage.d.ts +0 -3
- package/dist/utils/installPackage.js +0 -77
- package/dist/utils/localizeStaticImports.d.ts +0 -15
- package/dist/utils/localizeStaticImports.js +0 -341
- package/dist/utils/localizeStaticUrls.d.ts +0 -19
- package/dist/utils/localizeStaticUrls.js +0 -432
- package/dist/utils/packageInfo.d.ts +0 -3
- package/dist/utils/packageInfo.js +0 -17
- package/dist/utils/packageJson.d.ts +0 -6
- package/dist/utils/packageJson.js +0 -76
- package/dist/utils/packageManager.d.ts +0 -28
- package/dist/utils/packageManager.js +0 -269
- package/dist/utils/processAnchorIds.d.ts +0 -6
- package/dist/utils/processAnchorIds.js +0 -47
- package/dist/utils/sanitizeFileContent.d.ts +0 -6
- package/dist/utils/sanitizeFileContent.js +0 -29
- package/dist/utils/validateMdx.d.ts +0 -10
- package/dist/utils/validateMdx.js +0 -25
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import { logError } from '../console/logging.js';
|
|
3
|
-
import loadJSON from '../fs/loadJSON.js';
|
|
4
|
-
import { createDictionaryUpdates } from '../react/parse/createDictionaryUpdates.js';
|
|
5
|
-
import { createInlineUpdates } from '../react/parse/createInlineUpdates.js';
|
|
6
|
-
import createESBuildConfig from '../react/config/createESBuildConfig.js';
|
|
7
|
-
import chalk from 'chalk';
|
|
8
|
-
/**
|
|
9
|
-
* Searches for gt-react or gt-next dictionary files and creates updates for them,
|
|
10
|
-
* as well as inline updates for <T> tags and useGT()/getGT() calls
|
|
11
|
-
*
|
|
12
|
-
* @param options - The options object
|
|
13
|
-
* @param sourceDictionary - The source dictionary file path
|
|
14
|
-
* @param pkg - The package name
|
|
15
|
-
* @returns An object containing the updates and errors
|
|
16
|
-
*/
|
|
17
|
-
export async function createUpdates(options, src, sourceDictionary, pkg, validate) {
|
|
18
|
-
let updates = [];
|
|
19
|
-
let errors = [];
|
|
20
|
-
let warnings = [];
|
|
21
|
-
// Parse dictionary with esbuildConfig
|
|
22
|
-
if (sourceDictionary &&
|
|
23
|
-
fs.existsSync(sourceDictionary) &&
|
|
24
|
-
fs.statSync(sourceDictionary).isFile()) {
|
|
25
|
-
if (sourceDictionary.endsWith('.json')) {
|
|
26
|
-
updates = [
|
|
27
|
-
...updates,
|
|
28
|
-
...(await createDictionaryUpdates(sourceDictionary)),
|
|
29
|
-
];
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
let esbuildConfig;
|
|
33
|
-
if (options.jsconfig) {
|
|
34
|
-
const jsconfig = loadJSON(options.jsconfig);
|
|
35
|
-
if (!jsconfig) {
|
|
36
|
-
logError(`Failed to resolve jsconfig.json or tsconfig.json at provided filepath: "${options.jsconfig}"`);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
esbuildConfig = createESBuildConfig(jsconfig);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
esbuildConfig = createESBuildConfig({});
|
|
43
|
-
}
|
|
44
|
-
updates = [
|
|
45
|
-
...updates,
|
|
46
|
-
...(await createDictionaryUpdates(sourceDictionary, esbuildConfig)),
|
|
47
|
-
];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Scan through project for <T> tags
|
|
51
|
-
const { updates: newUpdates, errors: newErrors, warnings: newWarnings, } = await createInlineUpdates(pkg, validate, src);
|
|
52
|
-
errors = [...errors, ...newErrors];
|
|
53
|
-
warnings = [...warnings, ...newWarnings];
|
|
54
|
-
updates = [...updates, ...newUpdates];
|
|
55
|
-
// Metadata addition and validation
|
|
56
|
-
const idHashMap = new Map();
|
|
57
|
-
const duplicateIds = new Set();
|
|
58
|
-
updates = updates.map((update) => {
|
|
59
|
-
if (!update.metadata.id)
|
|
60
|
-
return update;
|
|
61
|
-
const existingHash = idHashMap.get(update.metadata.id);
|
|
62
|
-
if (existingHash) {
|
|
63
|
-
if (existingHash !== update.metadata.hash) {
|
|
64
|
-
errors.push(`Hashes don't match on two components with the same id: ${chalk.blue(update.metadata.id)}. Check your ${chalk.green('<T>')} tags and dictionary entries and make sure you're not accidentally duplicating IDs.`);
|
|
65
|
-
duplicateIds.add(update.metadata.id);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
idHashMap.set(update.metadata.id, update.metadata.hash);
|
|
70
|
-
}
|
|
71
|
-
return update;
|
|
72
|
-
});
|
|
73
|
-
// Filter out updates with duplicate IDs
|
|
74
|
-
updates = updates.filter((update) => !duplicateIds.has(update.metadata.id));
|
|
75
|
-
return { updates, errors, warnings };
|
|
76
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { logErrorAndExit } from '../console/logging.js';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import findFilepath from '../fs/findFilepath.js';
|
|
4
|
-
import { logWarning, logError } from '../console/logging.js';
|
|
5
|
-
import { createUpdates } from './parse.js';
|
|
6
|
-
export async function aggregateReactTranslations(options, settings, library) {
|
|
7
|
-
if (!options.dictionary) {
|
|
8
|
-
options.dictionary = findFilepath([
|
|
9
|
-
'./dictionary.js',
|
|
10
|
-
'./src/dictionary.js',
|
|
11
|
-
'./dictionary.json',
|
|
12
|
-
'./src/dictionary.json',
|
|
13
|
-
'./dictionary.ts',
|
|
14
|
-
'./src/dictionary.ts',
|
|
15
|
-
]);
|
|
16
|
-
}
|
|
17
|
-
// ---- CREATING UPDATES ---- //
|
|
18
|
-
const { updates, errors, warnings } = await createUpdates(options, settings.src, options.dictionary, library, false);
|
|
19
|
-
if (warnings.length > 0) {
|
|
20
|
-
logWarning(chalk.yellow(`CLI tool encountered ${warnings.length} warnings while scanning for translatable content.\n` +
|
|
21
|
-
warnings
|
|
22
|
-
.map((warning) => chalk.yellow('• Warning: ') + chalk.white(warning))
|
|
23
|
-
.join('\n')));
|
|
24
|
-
}
|
|
25
|
-
if (errors.length > 0) {
|
|
26
|
-
if (options.ignoreErrors) {
|
|
27
|
-
logWarning(chalk.yellow(`Warning: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content. These components will not be translated.\n` +
|
|
28
|
-
errors
|
|
29
|
-
.map((error) => chalk.yellow('• ') + chalk.white(error) + '\n')
|
|
30
|
-
.join('')));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
logErrorAndExit(chalk.red(`Error: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content. ${chalk.gray('To ignore these errors, re-run with --ignore-errors')}\n` +
|
|
34
|
-
errors
|
|
35
|
-
.map((error) => chalk.red('• ') + chalk.white(error) + '\n')
|
|
36
|
-
.join('')));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (updates.length == 0) {
|
|
40
|
-
logError(chalk.red(`No in-line content or dictionaries were found for ${chalk.green(library)}. Are you sure you're running this command in the right directory?`));
|
|
41
|
-
return updates;
|
|
42
|
-
}
|
|
43
|
-
return updates;
|
|
44
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { logErrorAndExit, logWarning } from '../console/logging.js';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import findFilepath from '../fs/findFilepath.js';
|
|
4
|
-
import { logError, logSuccess } from '../console/logging.js';
|
|
5
|
-
import { createUpdates } from './parse.js';
|
|
6
|
-
import { createInlineUpdates } from '../react/parse/createInlineUpdates.js';
|
|
7
|
-
export async function validateProject(settings, pkg, files) {
|
|
8
|
-
if (files && files.length > 0) {
|
|
9
|
-
// Validate specific files using createInlineUpdates
|
|
10
|
-
const { errors, updates } = await createInlineUpdates(pkg, true, files);
|
|
11
|
-
if (errors.length > 0) {
|
|
12
|
-
logErrorAndExit(chalk.red(`Error: CLI tool encountered ${errors.length} syntax errors:\n` +
|
|
13
|
-
errors
|
|
14
|
-
.map((error) => chalk.red('• ') + chalk.white(error) + '\n')
|
|
15
|
-
.join('')));
|
|
16
|
-
}
|
|
17
|
-
logSuccess(chalk.green(`Success! Found ${updates.length} translatable entries.`));
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (!settings.dictionary) {
|
|
21
|
-
settings.dictionary = findFilepath([
|
|
22
|
-
'./dictionary.js',
|
|
23
|
-
'./src/dictionary.js',
|
|
24
|
-
'./dictionary.json',
|
|
25
|
-
'./src/dictionary.json',
|
|
26
|
-
'./dictionary.ts',
|
|
27
|
-
'./src/dictionary.ts',
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
const { updates, errors, warnings } = await createUpdates(settings, settings.src, settings.dictionary, pkg, true);
|
|
31
|
-
if (warnings.length > 0) {
|
|
32
|
-
logWarning(chalk.yellow(`CLI tool encountered ${warnings.length} warnings while scanning for translatable content.`) +
|
|
33
|
-
'\n' +
|
|
34
|
-
warnings
|
|
35
|
-
.map((warning) => chalk.yellow('• ') + chalk.white(warning))
|
|
36
|
-
.join('\n'));
|
|
37
|
-
}
|
|
38
|
-
if (errors.length > 0) {
|
|
39
|
-
logErrorAndExit(chalk.red(`Error: CLI tool encountered ${errors.length} syntax errors while scanning for translatable content.\n` +
|
|
40
|
-
errors
|
|
41
|
-
.map((error) => chalk.red('• ') + chalk.white(error) + '\n')
|
|
42
|
-
.join('')));
|
|
43
|
-
}
|
|
44
|
-
if (updates.length === 0) {
|
|
45
|
-
logError(chalk.red(`No in-line content or dictionaries were found for ${chalk.green(pkg)}. Are you sure you're running this command in the right directory?`));
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
logSuccess(chalk.green(`Success! Found ${updates.length} translatable entries for ${chalk.green(pkg)}.`));
|
|
49
|
-
}
|
|
50
|
-
}
|
package/dist/types/data/json.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/data.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export type Entry = string;
|
|
2
|
-
export type DictionaryMetadata = {
|
|
3
|
-
context?: string;
|
|
4
|
-
variablesOptions?: Record<string, any>;
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
};
|
|
7
|
-
export type DictionaryEntry = Entry | [Entry] | [Entry, DictionaryMetadata];
|
|
8
|
-
export type Dictionary = {
|
|
9
|
-
[key: string]: Dictionary | DictionaryEntry;
|
|
10
|
-
};
|
|
11
|
-
export type FlattenedDictionary = {
|
|
12
|
-
[key: string]: DictionaryEntry;
|
|
13
|
-
};
|
|
14
|
-
export type JSONDictionary = {
|
|
15
|
-
[key: string]: string | JSONDictionary;
|
|
16
|
-
};
|
|
17
|
-
export type FlattenedJSONDictionary = {
|
|
18
|
-
[key: string]: string;
|
|
19
|
-
};
|
|
20
|
-
export type { FileFormat, DataFormat, FileToTranslate, } from 'generaltranslation/types';
|
|
21
|
-
export type JsxChildren = string | string[] | any;
|
|
22
|
-
export type Translations = {
|
|
23
|
-
[key: string]: JsxChildren;
|
|
24
|
-
};
|
|
25
|
-
export type TranslationsMetadata = {
|
|
26
|
-
[key: string]: {
|
|
27
|
-
id?: string;
|
|
28
|
-
hash?: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
package/dist/types/data.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/files.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type FileMapping = Record<string, Record<string, string>>;
|
package/dist/types/files.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { CustomMapping } from 'generaltranslation/types';
|
|
2
|
-
import { SUPPORTED_FILE_EXTENSIONS } from '../formats/files/supportedFiles.js';
|
|
3
|
-
export type { Updates } from 'generaltranslation/types';
|
|
4
|
-
export type Options = {
|
|
5
|
-
config: string;
|
|
6
|
-
apiKey?: string;
|
|
7
|
-
projectId?: string;
|
|
8
|
-
versionId?: string;
|
|
9
|
-
jsconfig?: string;
|
|
10
|
-
dictionary?: string;
|
|
11
|
-
src?: string[];
|
|
12
|
-
defaultLocale?: string;
|
|
13
|
-
locales?: string[];
|
|
14
|
-
baseUrl: string;
|
|
15
|
-
inline?: boolean;
|
|
16
|
-
ignoreErrors: boolean;
|
|
17
|
-
suppressWarnings: boolean;
|
|
18
|
-
dryRun: boolean;
|
|
19
|
-
timeout: number;
|
|
20
|
-
force?: boolean;
|
|
21
|
-
stageTranslations?: boolean;
|
|
22
|
-
experimentalLocalizeStaticUrls?: boolean;
|
|
23
|
-
experimentalHideDefaultLocale?: boolean;
|
|
24
|
-
experimentalFlattenJsonFiles?: boolean;
|
|
25
|
-
experimentalLocalizeStaticImports?: boolean;
|
|
26
|
-
experimentalAddHeaderAnchorIds?: 'mintlify';
|
|
27
|
-
};
|
|
28
|
-
export type TranslateFlags = {
|
|
29
|
-
config?: string;
|
|
30
|
-
apiKey?: string;
|
|
31
|
-
projectId?: string;
|
|
32
|
-
versionId?: string;
|
|
33
|
-
jsconfig?: string;
|
|
34
|
-
dictionary?: string;
|
|
35
|
-
defaultLocale?: string;
|
|
36
|
-
locales?: string[];
|
|
37
|
-
ignoreErrors?: boolean;
|
|
38
|
-
src?: string[];
|
|
39
|
-
timeout: number;
|
|
40
|
-
dryRun: boolean;
|
|
41
|
-
stageTranslations?: boolean;
|
|
42
|
-
publish?: boolean;
|
|
43
|
-
force?: boolean;
|
|
44
|
-
experimentalLocalizeStaticUrls?: boolean;
|
|
45
|
-
experimentalHideDefaultLocale?: boolean;
|
|
46
|
-
experimentalFlattenJsonFiles?: boolean;
|
|
47
|
-
experimentalLocalizeStaticImports?: boolean;
|
|
48
|
-
experimentalAddHeaderAnchorIds?: 'mintlify';
|
|
49
|
-
excludeStaticUrls?: string[];
|
|
50
|
-
excludeStaticImports?: string[];
|
|
51
|
-
};
|
|
52
|
-
export type WrapOptions = {
|
|
53
|
-
src?: string[];
|
|
54
|
-
config: string;
|
|
55
|
-
skipTs: boolean;
|
|
56
|
-
disableIds: boolean;
|
|
57
|
-
disableFormatting: boolean;
|
|
58
|
-
addGTProvider: boolean;
|
|
59
|
-
};
|
|
60
|
-
export type SetupOptions = {
|
|
61
|
-
src?: string[];
|
|
62
|
-
config: string;
|
|
63
|
-
};
|
|
64
|
-
export type GenerateSourceOptions = {
|
|
65
|
-
src?: string[];
|
|
66
|
-
config: string;
|
|
67
|
-
defaultLocale: string;
|
|
68
|
-
dictionary?: string;
|
|
69
|
-
jsconfig?: string;
|
|
70
|
-
inline?: boolean;
|
|
71
|
-
ignoreErrors: boolean;
|
|
72
|
-
suppressWarnings: boolean;
|
|
73
|
-
};
|
|
74
|
-
export type Framework = 'gt-next' | 'gt-react';
|
|
75
|
-
export type SupportedFrameworks = 'next-app' | 'next-pages' | 'vite' | 'gatsby' | 'react' | 'redwood';
|
|
76
|
-
export type SupportedLibraries = 'gt-next' | 'gt-react' | 'next-intl' | 'react-i18next' | 'next-i18next' | 'i18next' | 'i18next-icu' | 'base';
|
|
77
|
-
export interface ContentScanner {
|
|
78
|
-
scanForContent(options: WrapOptions, framework: Framework): Promise<{
|
|
79
|
-
errors: string[];
|
|
80
|
-
filesUpdated: string[];
|
|
81
|
-
warnings: string[];
|
|
82
|
-
}>;
|
|
83
|
-
}
|
|
84
|
-
export type SupportedFileExtension = (typeof SUPPORTED_FILE_EXTENSIONS)[number];
|
|
85
|
-
export type ResolvedFiles = {
|
|
86
|
-
[K in SupportedFileExtension]?: string[];
|
|
87
|
-
} & {
|
|
88
|
-
gt?: string;
|
|
89
|
-
};
|
|
90
|
-
export type TransformOption = {
|
|
91
|
-
match?: string;
|
|
92
|
-
replace: string;
|
|
93
|
-
};
|
|
94
|
-
export type TransformFiles = {
|
|
95
|
-
[K in SupportedFileExtension]?: TransformOption | string;
|
|
96
|
-
};
|
|
97
|
-
export type FilesOptions = {
|
|
98
|
-
[K in SupportedFileExtension]?: {
|
|
99
|
-
include: string[];
|
|
100
|
-
exclude?: string[];
|
|
101
|
-
transform?: string | TransformOption;
|
|
102
|
-
};
|
|
103
|
-
} & {
|
|
104
|
-
gt?: {
|
|
105
|
-
output: string;
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
export type Settings = {
|
|
109
|
-
config: string;
|
|
110
|
-
configDirectory: string;
|
|
111
|
-
baseUrl: string;
|
|
112
|
-
dashboardUrl: string;
|
|
113
|
-
apiKey?: string;
|
|
114
|
-
projectId?: string;
|
|
115
|
-
defaultLocale: string;
|
|
116
|
-
locales: string[];
|
|
117
|
-
customMapping?: CustomMapping;
|
|
118
|
-
files: {
|
|
119
|
-
resolvedPaths: ResolvedFiles;
|
|
120
|
-
placeholderPaths: ResolvedFiles;
|
|
121
|
-
transformPaths: TransformFiles;
|
|
122
|
-
} | undefined;
|
|
123
|
-
stageTranslations: boolean;
|
|
124
|
-
publish: boolean;
|
|
125
|
-
_versionId?: string;
|
|
126
|
-
version?: string;
|
|
127
|
-
description?: string;
|
|
128
|
-
src: string[];
|
|
129
|
-
framework?: SupportedFrameworks;
|
|
130
|
-
options?: AdditionalOptions;
|
|
131
|
-
modelProvider?: string;
|
|
132
|
-
};
|
|
133
|
-
export type AdditionalOptions = {
|
|
134
|
-
jsonSchema?: {
|
|
135
|
-
[fileGlob: string]: JsonSchema;
|
|
136
|
-
};
|
|
137
|
-
yamlSchema?: {
|
|
138
|
-
[fileGlob: string]: YamlSchema;
|
|
139
|
-
};
|
|
140
|
-
docsUrlPattern?: string;
|
|
141
|
-
docsImportPattern?: string;
|
|
142
|
-
excludeStaticUrls?: string[];
|
|
143
|
-
excludeStaticImports?: string[];
|
|
144
|
-
docsHideDefaultLocaleImport?: boolean;
|
|
145
|
-
copyFiles?: string[];
|
|
146
|
-
experimentalLocalizeStaticImports?: boolean;
|
|
147
|
-
experimentalLocalizeStaticUrls?: boolean;
|
|
148
|
-
experimentalAddHeaderAnchorIds?: 'mintlify';
|
|
149
|
-
experimentalHideDefaultLocale?: boolean;
|
|
150
|
-
experimentalFlattenJsonFiles?: boolean;
|
|
151
|
-
baseDomain?: string;
|
|
152
|
-
};
|
|
153
|
-
export type JsonSchema = {
|
|
154
|
-
preset?: 'mintlify';
|
|
155
|
-
include?: string[];
|
|
156
|
-
composite?: {
|
|
157
|
-
[sourceObjectPath: string]: SourceObjectOptions;
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
export type YamlSchema = {
|
|
161
|
-
preset?: 'mintlify';
|
|
162
|
-
include?: string[];
|
|
163
|
-
};
|
|
164
|
-
export type SourceObjectOptions = {
|
|
165
|
-
type: 'array' | 'object';
|
|
166
|
-
include: string[];
|
|
167
|
-
key?: string;
|
|
168
|
-
localeProperty?: string;
|
|
169
|
-
transform?: TransformOptions;
|
|
170
|
-
};
|
|
171
|
-
export type TransformOptions = {
|
|
172
|
-
[transformPath: string]: TransformOption;
|
|
173
|
-
};
|
package/dist/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a heading with its position and metadata
|
|
3
|
-
*/
|
|
4
|
-
export interface HeadingInfo {
|
|
5
|
-
text: string;
|
|
6
|
-
level: number;
|
|
7
|
-
slug: string;
|
|
8
|
-
position: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Extracts heading information from content (read-only, no modifications)
|
|
12
|
-
*/
|
|
13
|
-
export declare function extractHeadingInfo(mdxContent: string): HeadingInfo[];
|
|
14
|
-
/**
|
|
15
|
-
* Applies anchor IDs to translated content based on source heading mapping
|
|
16
|
-
*/
|
|
17
|
-
export declare function addExplicitAnchorIds(translatedContent: string, sourceHeadingMap: HeadingInfo[], settings?: any, sourcePath?: string, translatedPath?: string): {
|
|
18
|
-
content: string;
|
|
19
|
-
hasChanges: boolean;
|
|
20
|
-
addedIds: Array<{
|
|
21
|
-
heading: string;
|
|
22
|
-
id: string;
|
|
23
|
-
}>;
|
|
24
|
-
};
|