gt 2.22.4 → 2.23.0
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 +28 -0
- package/dist/auth/errors.d.ts +1 -0
- package/dist/auth/errors.js +12 -2
- package/dist/auth/errors.js.map +1 -1
- package/dist/auth/interactiveLogin.d.ts +2 -0
- package/dist/auth/interactiveLogin.js +22 -0
- package/dist/auth/interactiveLogin.js.map +1 -0
- package/dist/auth/oauth.js +2 -2
- package/dist/auth/oauth.js.map +1 -1
- package/dist/cli/base.d.ts +22 -4
- package/dist/cli/base.js +328 -223
- package/dist/cli/base.js.map +1 -1
- package/dist/cli/commands/api.js +15 -16
- package/dist/cli/commands/api.js.map +1 -1
- package/dist/cli/node.js +1 -1
- package/dist/cli/node.js.map +1 -1
- package/dist/cli/react.js +1 -1
- package/dist/cli/react.js.map +1 -1
- package/dist/cli/vue.js +2 -2
- package/dist/cli/vue.js.map +1 -1
- package/dist/config/generateSettings.d.ts +2 -0
- package/dist/config/generateSettings.js +13 -6
- package/dist/config/generateSettings.js.map +1 -1
- package/dist/config/resolveConfig.js +0 -4
- package/dist/config/resolveConfig.js.map +1 -1
- package/dist/config/validateSettings.js +5 -4
- package/dist/config/validateSettings.js.map +1 -1
- package/dist/console/{inkLocaleData.d.ts → localeOptions.d.ts} +7 -2
- package/dist/console/{inkLocaleData.js → localeOptions.js} +3 -8
- package/dist/console/localeOptions.js.map +1 -0
- package/dist/console/logger.d.ts +7 -0
- package/dist/console/logger.js +48 -85
- package/dist/console/logger.js.map +1 -1
- package/dist/console/logging.d.ts +11 -1
- package/dist/console/logging.js +88 -100
- package/dist/console/logging.js.map +1 -1
- package/dist/formats/files/aggregateFiles.js +1 -1
- package/dist/formats/files/supportedFiles.d.ts +3 -0
- package/dist/formats/files/supportedFiles.js +10 -1
- package/dist/formats/files/supportedFiles.js.map +1 -1
- package/dist/formats/yaml/mergeYaml.js +1 -1
- package/dist/fs/config/loadConfig.d.ts +2 -0
- package/dist/fs/config/loadConfig.js +5 -1
- package/dist/fs/config/loadConfig.js.map +1 -1
- package/dist/fs/config/setupConfig.d.ts +18 -9
- package/dist/fs/config/setupConfig.js +51 -31
- package/dist/fs/config/setupConfig.js.map +1 -1
- package/dist/fs/createLoadTranslationsFile.d.ts +22 -1
- package/dist/fs/createLoadTranslationsFile.js +43 -20
- package/dist/fs/createLoadTranslationsFile.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/generated/version.js.map +1 -1
- package/dist/hooks/postProcess.d.ts +1 -2
- package/dist/hooks/postProcess.js +1 -1
- package/dist/hooks/postProcess.js.map +1 -1
- package/dist/locadex/setupFlow.d.ts +4 -1
- package/dist/locadex/setupFlow.js +5 -3
- package/dist/locadex/setupFlow.js.map +1 -1
- package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js +1 -1
- package/dist/react/jsx/utils/jsxParsing/parseJsx.js +1 -1
- package/dist/react/jsx/utils/parseString.js +1 -1
- package/dist/react/jsx/utils/stringParsing/derivation/index.js +1 -1
- package/dist/setup/buildTools/index.d.ts +44 -0
- package/dist/setup/buildTools/index.js +10 -0
- package/dist/setup/buildTools/index.js.map +1 -0
- package/dist/setup/buildTools/vite.d.ts +2 -0
- package/dist/setup/buildTools/vite.js +61 -0
- package/dist/setup/buildTools/vite.js.map +1 -0
- package/dist/setup/developmentCredentials.d.ts +40 -5
- package/dist/setup/developmentCredentials.js +119 -37
- package/dist/setup/developmentCredentials.js.map +1 -1
- package/dist/setup/instructions/base.md +1 -1
- package/dist/setup/onboarding.d.ts +131 -0
- package/dist/setup/onboarding.js +289 -0
- package/dist/setup/onboarding.js.map +1 -0
- package/dist/setup/setupTarget.d.ts +1 -0
- package/dist/setup/setupTarget.js +52 -0
- package/dist/setup/setupTarget.js.map +1 -0
- package/dist/setup/setupViteSPA.d.ts +32 -1
- package/dist/setup/setupViteSPA.js +110 -20
- package/dist/setup/setupViteSPA.js.map +1 -1
- package/dist/setup/userInput.d.ts +12 -3
- package/dist/setup/userInput.js +27 -11
- package/dist/setup/userInput.js.map +1 -1
- package/dist/setup/wizard.d.ts +19 -3
- package/dist/setup/wizard.js +119 -105
- package/dist/setup/wizard.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +13 -1
- package/dist/types/index.js.map +1 -0
- package/dist/utils/credentials.d.ts +9 -6
- package/dist/utils/credentials.js +36 -22
- package/dist/utils/credentials.js.map +1 -1
- package/dist/utils/monorepoVersionCheck.d.ts +1 -1
- package/dist/utils/monorepoVersionCheck.js +5 -5
- package/dist/utils/monorepoVersionCheck.js.map +1 -1
- package/dist/utils/packageManager.js +13 -14
- package/dist/utils/packageManager.js.map +1 -1
- package/package.json +5 -9
- package/dist/console/inkFields.d.ts +0 -23
- package/dist/console/inkFields.js +0 -88
- package/dist/console/inkFields.js.map +0 -1
- package/dist/console/inkLayout.d.ts +0 -7
- package/dist/console/inkLayout.js +0 -140
- package/dist/console/inkLayout.js.map +0 -1
- package/dist/console/inkLocaleData.js.map +0 -1
- package/dist/console/inkPrompts.d.ts +0 -8
- package/dist/console/inkPrompts.js +0 -499
- package/dist/console/inkPrompts.js.map +0 -1
- package/dist/console/inkSession.d.ts +0 -3
- package/dist/console/inkSession.js +0 -42
- package/dist/console/inkSession.js.map +0 -1
- package/dist/console/inkTerminal.d.ts +0 -4
- package/dist/console/inkTerminal.js +0 -15
- package/dist/console/inkTerminal.js.map +0 -1
- package/dist/console/inkTheme.d.ts +0 -1
- package/dist/console/inkTheme.js +0 -6
- package/dist/console/inkTheme.js.map +0 -1
- package/dist/console/inkTypes.d.ts +0 -69
- package/dist/console/inkTypes.js +0 -1
- package/dist/console/inkUtils.d.ts +0 -24
- package/dist/console/inkUtils.js +0 -87
- package/dist/console/inkUtils.js.map +0 -1
- package/dist/console/terminalSession.d.ts +0 -5
- package/dist/console/terminalSession.js +0 -38
- package/dist/console/terminalSession.js.map +0 -1
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { CustomMapping } from 'generaltranslation/types';
|
|
3
|
-
export type PromptOption<T> = {
|
|
4
|
-
value: T;
|
|
5
|
-
label: string;
|
|
6
|
-
hint?: string;
|
|
7
|
-
};
|
|
8
|
-
export type PromptResult<T> = {
|
|
9
|
-
value?: T;
|
|
10
|
-
cancelled: boolean;
|
|
11
|
-
};
|
|
12
|
-
export type TextPromptProps = {
|
|
13
|
-
message: string;
|
|
14
|
-
defaultValue?: string;
|
|
15
|
-
validate?: (value: string) => boolean | string;
|
|
16
|
-
onComplete: (result: PromptResult<string>) => void;
|
|
17
|
-
};
|
|
18
|
-
export type LocaleOption = {
|
|
19
|
-
code: string;
|
|
20
|
-
label: string;
|
|
21
|
-
name: string;
|
|
22
|
-
nativeName: string;
|
|
23
|
-
searchable: string;
|
|
24
|
-
};
|
|
25
|
-
export type LocalePromptProps = {
|
|
26
|
-
message: string;
|
|
27
|
-
defaultValue?: string;
|
|
28
|
-
customMapping?: CustomMapping;
|
|
29
|
-
onComplete: (result: PromptResult<string>) => void;
|
|
30
|
-
};
|
|
31
|
-
export type LocaleMultiPromptProps = {
|
|
32
|
-
message: string;
|
|
33
|
-
defaultValue?: string[];
|
|
34
|
-
required: boolean;
|
|
35
|
-
customMapping?: CustomMapping;
|
|
36
|
-
onComplete: (result: PromptResult<string[]>) => void;
|
|
37
|
-
};
|
|
38
|
-
export type GlobPromptProps = {
|
|
39
|
-
label: string;
|
|
40
|
-
message?: string;
|
|
41
|
-
defaultValue?: string;
|
|
42
|
-
onComplete: (result: PromptResult<string>) => void;
|
|
43
|
-
};
|
|
44
|
-
export type EditableTextPromptProps = TextPromptProps & {
|
|
45
|
-
footer?: string;
|
|
46
|
-
placeholder?: string;
|
|
47
|
-
};
|
|
48
|
-
export type SelectPromptProps<T> = {
|
|
49
|
-
message: string;
|
|
50
|
-
options: Array<PromptOption<T>>;
|
|
51
|
-
defaultValue?: T;
|
|
52
|
-
onComplete: (result: PromptResult<T>) => void;
|
|
53
|
-
};
|
|
54
|
-
export type MultiSelectPromptProps<T extends string> = {
|
|
55
|
-
message: string;
|
|
56
|
-
options: Array<PromptOption<T>>;
|
|
57
|
-
required: boolean;
|
|
58
|
-
onComplete: (result: PromptResult<Array<T>>) => void;
|
|
59
|
-
};
|
|
60
|
-
export type ConfirmPromptProps = {
|
|
61
|
-
message: string;
|
|
62
|
-
defaultValue?: boolean;
|
|
63
|
-
onComplete: (result: PromptResult<boolean>) => void;
|
|
64
|
-
};
|
|
65
|
-
export type PromptFrameProps = {
|
|
66
|
-
message: string;
|
|
67
|
-
children: ReactNode;
|
|
68
|
-
footer: string;
|
|
69
|
-
};
|
package/dist/console/inkTypes.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
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;
|
package/dist/console/inkUtils.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
//#region src/console/terminalSession.ts
|
|
2
|
-
let activeCleanup;
|
|
3
|
-
let processCleanupRegistered = false;
|
|
4
|
-
function registerProcessCleanup() {
|
|
5
|
-
if (processCleanupRegistered) return;
|
|
6
|
-
processCleanupRegistered = true;
|
|
7
|
-
process.on("exit", () => {
|
|
8
|
-
endTerminalSession();
|
|
9
|
-
});
|
|
10
|
-
process.on("SIGINT", () => {
|
|
11
|
-
endTerminalSession();
|
|
12
|
-
process.exit(130);
|
|
13
|
-
});
|
|
14
|
-
process.on("SIGTERM", () => {
|
|
15
|
-
endTerminalSession();
|
|
16
|
-
process.exit(143);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function registerTerminalSessionCleanup(cleanup) {
|
|
20
|
-
registerProcessCleanup();
|
|
21
|
-
activeCleanup = cleanup;
|
|
22
|
-
return () => {
|
|
23
|
-
if (activeCleanup === cleanup) activeCleanup = void 0;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function endTerminalSession() {
|
|
27
|
-
const cleanup = activeCleanup;
|
|
28
|
-
if (!cleanup) return;
|
|
29
|
-
activeCleanup = void 0;
|
|
30
|
-
cleanup();
|
|
31
|
-
}
|
|
32
|
-
function shouldUseInkPrompts() {
|
|
33
|
-
return process.env.GT_INK !== "0" && process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
export { endTerminalSession, registerTerminalSessionCleanup, shouldUseInkPrompts };
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=terminalSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"terminalSession.js","names":[],"sources":["../../src/console/terminalSession.ts"],"sourcesContent":["type Cleanup = () => void;\n\nlet activeCleanup: Cleanup | undefined;\nlet processCleanupRegistered = false;\n\nfunction registerProcessCleanup() {\n if (processCleanupRegistered) return;\n processCleanupRegistered = true;\n\n process.on('exit', () => {\n endTerminalSession();\n });\n process.on('SIGINT', () => {\n endTerminalSession();\n process.exit(130);\n });\n process.on('SIGTERM', () => {\n endTerminalSession();\n process.exit(143);\n });\n}\n\nexport function registerTerminalSessionCleanup(cleanup: Cleanup) {\n registerProcessCleanup();\n activeCleanup = cleanup;\n\n return () => {\n if (activeCleanup === cleanup) {\n activeCleanup = undefined;\n }\n };\n}\n\nexport function endTerminalSession() {\n const cleanup = activeCleanup;\n if (!cleanup) return;\n activeCleanup = undefined;\n cleanup();\n}\n\nexport function shouldUseInkPrompts() {\n return (\n process.env.GT_INK !== '0' &&\n process.stdin.isTTY === true &&\n process.stdout.isTTY === true\n );\n}\n"],"mappings":";AAEA,IAAI;AACJ,IAAI,2BAA2B;AAE/B,SAAS,yBAAyB;AAChC,KAAI,yBAA0B;AAC9B,4BAA2B;AAE3B,SAAQ,GAAG,cAAc;AACvB,sBAAoB;GACpB;AACF,SAAQ,GAAG,gBAAgB;AACzB,sBAAoB;AACpB,UAAQ,KAAK,IAAI;GACjB;AACF,SAAQ,GAAG,iBAAiB;AAC1B,sBAAoB;AACpB,UAAQ,KAAK,IAAI;GACjB;;AAGJ,SAAgB,+BAA+B,SAAkB;AAC/D,yBAAwB;AACxB,iBAAgB;AAEhB,cAAa;AACX,MAAI,kBAAkB,QACpB,iBAAgB,KAAA;;;AAKtB,SAAgB,qBAAqB;CACnC,MAAM,UAAU;AAChB,KAAI,CAAC,QAAS;AACd,iBAAgB,KAAA;AAChB,UAAS;;AAGX,SAAgB,sBAAsB;AACpC,QACE,QAAQ,IAAI,WAAW,OACvB,QAAQ,MAAM,UAAU,QACxB,QAAQ,OAAO,UAAU"}
|