gtx-cli 1.2.30-alpha.26 → 1.2.30-alpha.28
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.
|
@@ -12,11 +12,7 @@ export declare function displayProjectId(projectId: string): void;
|
|
|
12
12
|
export declare function displayResolvedPaths(resolvedPaths: [string, string][]): void;
|
|
13
13
|
export declare function displayCreatedConfigFile(configFilepath: string): void;
|
|
14
14
|
export declare function displayUpdatedConfigFile(configFilepath: string): void;
|
|
15
|
-
export declare function createSpinner(indicator?: 'dots' | 'timer'):
|
|
16
|
-
start: (msg?: string) => void;
|
|
17
|
-
stop: (msg?: string, code?: number) => void;
|
|
18
|
-
message: (msg?: string) => void;
|
|
19
|
-
};
|
|
15
|
+
export declare function createSpinner(indicator?: 'dots' | 'timer'): import("@clack/prompts").SpinnerResult;
|
|
20
16
|
export declare function createOraSpinner(indicator?: 'dots' | 'circleHalves'): Promise<import("ora").Ora>;
|
|
21
17
|
export declare function promptText({ message, defaultValue, validate, }: {
|
|
22
18
|
message: string;
|
|
@@ -36,9 +36,8 @@ export default async function createDictionaryUpdates(dictionaryPath, esbuildCon
|
|
|
36
36
|
// Clean up the temporary file
|
|
37
37
|
await fs.promises.unlink(tempFilePath);
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
dictionaryModule);
|
|
39
|
+
const unwrappedDictionary = unwrapDictionaryModule(dictionaryModule);
|
|
40
|
+
dictionary = flattenDictionary(unwrappedDictionary);
|
|
42
41
|
}
|
|
43
42
|
// ----- CREATE PARTIAL UPDATES ----- //
|
|
44
43
|
const updates = [];
|
|
@@ -65,3 +64,104 @@ export default async function createDictionaryUpdates(dictionaryPath, esbuildCon
|
|
|
65
64
|
}
|
|
66
65
|
return updates;
|
|
67
66
|
}
|
|
67
|
+
function unwrapDictionaryModule(mod) {
|
|
68
|
+
let current = mod;
|
|
69
|
+
// Keep unwrapping until we get to the actual dictionary
|
|
70
|
+
while (current && typeof current === 'object') {
|
|
71
|
+
const keys = Object.keys(current);
|
|
72
|
+
// Check if this looks like a module namespace object (has only module-related keys)
|
|
73
|
+
const isModuleNamespace = keys.every((key) => key === 'default' || key === 'module.exports' || key === '__esModule');
|
|
74
|
+
// Check if this is a module with named exports (has 'dictionary' export)
|
|
75
|
+
// Only check for named exports if it's NOT a pure module namespace
|
|
76
|
+
const hasNamedDictionary = !isModuleNamespace &&
|
|
77
|
+
'dictionary' in current &&
|
|
78
|
+
current.dictionary &&
|
|
79
|
+
typeof current.dictionary === 'object' &&
|
|
80
|
+
!Array.isArray(current.dictionary);
|
|
81
|
+
if (hasNamedDictionary) {
|
|
82
|
+
// If there's a named 'dictionary' export, use that
|
|
83
|
+
return current.dictionary;
|
|
84
|
+
}
|
|
85
|
+
else if (isModuleNamespace) {
|
|
86
|
+
// Try to get the default export
|
|
87
|
+
if ('default' in current) {
|
|
88
|
+
let result = current.default;
|
|
89
|
+
// If the default export is a function (getter), call it
|
|
90
|
+
if (typeof result === 'function') {
|
|
91
|
+
try {
|
|
92
|
+
result = result();
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// If calling fails, break the loop
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// If we have a valid object, check if we should continue unwrapping
|
|
100
|
+
if (result && typeof result === 'object' && !Array.isArray(result)) {
|
|
101
|
+
const resultKeys = Object.keys(result);
|
|
102
|
+
// Only continue unwrapping if this looks like a getter-based module layer
|
|
103
|
+
// We should NOT continue if this is just a user dictionary with a 'default' property
|
|
104
|
+
const hasGetterProperties = resultKeys.some((key) => {
|
|
105
|
+
try {
|
|
106
|
+
const descriptor = Object.getOwnPropertyDescriptor(result, key);
|
|
107
|
+
return descriptor && typeof descriptor.get === 'function';
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
if (hasGetterProperties) {
|
|
114
|
+
current = result;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// This is the actual dictionary, return it
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Try module.exports as fallback
|
|
124
|
+
if ('module.exports' in current) {
|
|
125
|
+
let result = current['module.exports'];
|
|
126
|
+
if (typeof result === 'function') {
|
|
127
|
+
try {
|
|
128
|
+
result = result();
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
// If calling fails, break the loop
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (result && typeof result === 'object' && !Array.isArray(result)) {
|
|
136
|
+
const resultKeys = Object.keys(result);
|
|
137
|
+
// Only continue unwrapping if this looks like a getter-based module layer
|
|
138
|
+
// We should NOT continue if this is just a user dictionary with a 'default' property
|
|
139
|
+
const hasGetterProperties = resultKeys.some((key) => {
|
|
140
|
+
try {
|
|
141
|
+
const descriptor = Object.getOwnPropertyDescriptor(result, key);
|
|
142
|
+
return descriptor && typeof descriptor.get === 'function';
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
if (hasGetterProperties) {
|
|
149
|
+
current = result;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
// This is the actual dictionary, return it
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// If we can't unwrap further, break
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
// This appears to be the actual dictionary object, not a module wrapper
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return current || {};
|
|
167
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtx-cli",
|
|
3
|
-
"version": "1.2.30-alpha.
|
|
3
|
+
"version": "1.2.30-alpha.28",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": "dist/main.js",
|
|
6
6
|
"files": [
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"esbuild": "^0.25.4",
|
|
88
88
|
"fast-glob": "^3.3.3",
|
|
89
89
|
"form-data": "^4.0.2",
|
|
90
|
-
"generaltranslation": "^7.0.0-alpha.
|
|
90
|
+
"generaltranslation": "^7.0.0-alpha.28",
|
|
91
91
|
"open": "^10.1.1",
|
|
92
92
|
"ora": "^8.2.0",
|
|
93
93
|
"resolve": "^1.22.10",
|