tnp-core 21.0.166 → 21.0.167
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/VERIFIED-BUILD-DATA.jsonc +3 -3
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/full-dts/build-info._auto-generated_.d.ts +24 -0
- package/full-dts/config.d.ts +171 -0
- package/full-dts/constants.d.ts +306 -0
- package/full-dts/core-cli.d.ts +8 -0
- package/full-dts/core-config.d.ts +5 -0
- package/full-dts/core-imports.d.ts +71 -0
- package/full-dts/core-models.d.ts +313 -0
- package/full-dts/core-project.d.ts +6 -0
- package/full-dts/cross-platform-path.d.ts +5 -0
- package/full-dts/env/env.angular-node-app.d.ts +67 -0
- package/full-dts/env/env.docs-webapp.d.ts +67 -0
- package/full-dts/env/env.electron-app.d.ts +67 -0
- package/full-dts/env/env.mobile-app.d.ts +67 -0
- package/full-dts/env/env.npm-lib-and-cli-tool.d.ts +67 -0
- package/full-dts/env/env.vscode-plugin.d.ts +67 -0
- package/full-dts/env/index.d.ts +6 -0
- package/full-dts/framework-name.d.ts +3 -0
- package/full-dts/global-logs.d.ts +5 -0
- package/full-dts/global-spinner.d.ts +27 -0
- package/full-dts/global-storage.d.ts +17 -0
- package/full-dts/global-task-manager.d.ts +20 -0
- package/full-dts/helpers.d.ts +325 -0
- package/full-dts/index.d.ts +53 -0
- package/full-dts/jsonc-parser.d.ts +4 -0
- package/full-dts/lodash.namespace.d.ts +308 -0
- package/full-dts/lowdb/adapters/Memory.d.ts +11 -0
- package/full-dts/lowdb/adapters/client/LocalStorage.d.ts +4 -0
- package/full-dts/lowdb/adapters/client/SessionStorage.d.ts +4 -0
- package/full-dts/lowdb/adapters/client/WebStorage.d.ts +8 -0
- package/full-dts/lowdb/adapters/node/DataFile.d.ts +25 -0
- package/full-dts/lowdb/adapters/node/JSONFile.d.ts +8 -0
- package/full-dts/lowdb/adapters/node/TextFile.d.ts +17 -0
- package/full-dts/lowdb/adapters/node/steno.d.ts +13 -0
- package/full-dts/lowdb/browser.d.ts +3 -0
- package/full-dts/lowdb/core/Low.d.ts +24 -0
- package/full-dts/lowdb/examples/server.d.ts +0 -0
- package/full-dts/lowdb/index.d.ts +3 -0
- package/full-dts/lowdb/node.d.ts +4 -0
- package/full-dts/lowdb/presets/browser.d.ts +3 -0
- package/full-dts/lowdb/presets/node.d.ts +4 -0
- package/full-dts/node-chalk-mock.d.ts +2 -0
- package/full-dts/node-path-mock.d.ts +25 -0
- package/full-dts/public-api.d.ts +4 -0
- package/full-dts/required-global-npm-packages.d.ts +44 -0
- package/full-dts/start-cli.d.ts +7 -0
- package/full-dts/taon-state-machine.d.ts +23 -0
- package/full-dts/utils-binary.d.ts +68 -0
- package/full-dts/utils-cli.d.ts +41 -0
- package/full-dts/utils-dot-file.d.ts +17 -0
- package/full-dts/utils-env.d.ts +101 -0
- package/full-dts/utils-etc-hosts.d.ts +28 -0
- package/full-dts/utils-exec-proc-vscode.d.ts +62 -0
- package/full-dts/utils-exec-proc.d.ts +100 -0
- package/full-dts/utils-files-folders.d.ts +106 -0
- package/full-dts/utils-http.d.ts +188 -0
- package/full-dts/utils-i18n.d.ts +38 -0
- package/full-dts/utils-imports.d.ts +0 -0
- package/full-dts/utils-imports.test.d.ts +0 -0
- package/full-dts/utils-json.d.ts +37 -0
- package/full-dts/utils-jwt.d.ts +12 -0
- package/full-dts/utils-md-docs.d.ts +21 -0
- package/full-dts/utils-network.d.ts +79 -0
- package/full-dts/utils-os.d.ts +126 -0
- package/full-dts/utils-passwords.d.ts +8 -0
- package/full-dts/utils-process-logger.d.ts +97 -0
- package/full-dts/utils-process.d.ts +93 -0
- package/full-dts/utils-progress.d.ts +26 -0
- package/full-dts/utils-projects.d.ts +327 -0
- package/full-dts/utils-projects.test.d.ts +0 -0
- package/full-dts/utils-secret-env.d.ts +41 -0
- package/full-dts/utils-start-async.d.ts +67 -0
- package/full-dts/utils-stdin-stdout-logger.d.ts +9 -0
- package/full-dts/utils-string-regex.d.ts +11 -0
- package/full-dts/utils-sudo.d.ts +32 -0
- package/full-dts/utils-temp-folder.d.ts +29 -0
- package/full-dts/utils-terminal.d.ts +171 -0
- package/full-dts/utils-time.d.ts +16 -0
- package/full-dts/utils-wait-notifier.d.ts +11 -0
- package/full-dts/utils.d.ts +100 -0
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/core-imports.d.ts +1 -4
- package/lib/framework-name.d.ts +3 -3
- package/lib/package.json +1 -1
- package/lib/utils-binary.d.ts +1 -9
- package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib-esm/lib/build-info._auto-generated_.js +1 -1
- package/lib-esm/lib/config.d.ts +2 -2
- package/lib-esm/lib/core-imports.d.ts +1 -4
- package/lib-esm/lib/framework-name.d.ts +3 -3
- package/lib-esm/lib/utils-binary.d.ts +1 -9
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/package.json +1 -1
- package/package.json +1 -1
- package/src.d.ts +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
- package/lib/jsonc-parse.test.d.ts +0 -1
- package/lib/utils-env.test.d.ts +0 -1
- package/lib/utils-json.test.d.ts +0 -1
- package/lib/utils-jwt.test.d.ts +0 -1
- package/lib/utils-md-docs.test.d.ts +0 -1
- package/lib/utils-progress.test.d.ts +0 -1
- /package/{lib-esm/lib/utils-imports.test.d.ts → full-dts/index._auto-generated_.d.ts} +0 -0
- /package/{lib-esm/lib/utils-projects.test.d.ts → full-dts/json10writer.d.ts} +0 -0
- /package/{lib-esm/lib → full-dts}/jsonc-parse.test.d.ts +0 -0
- /package/{lib-esm/lib/taon-state-machine.test.d.ts → full-dts/lowdb/examples/browser.d.ts} +0 -0
- /package/{lib/utils-imports.test.d.ts → full-dts/lowdb/examples/cli.d.ts} +0 -0
- /package/{lib/utils-projects.test.d.ts → full-dts/lowdb/examples/in-memory.d.ts} +0 -0
- /package/{lib → full-dts}/taon-state-machine.test.d.ts +0 -0
- /package/{lib-esm/lib → full-dts}/utils-env.test.d.ts +0 -0
- /package/{lib-esm/lib → full-dts}/utils-json.test.d.ts +0 -0
- /package/{lib-esm/lib → full-dts}/utils-jwt.test.d.ts +0 -0
- /package/{lib-esm/lib → full-dts}/utils-md-docs.test.d.ts +0 -0
- /package/{lib-esm/lib → full-dts}/utils-progress.test.d.ts +0 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
export declare namespace UtilsProjects {
|
|
2
|
+
interface OrderAbleProject {
|
|
3
|
+
location?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Sorts Taon projects using their dependency graph.
|
|
8
|
+
*
|
|
9
|
+
* This function has 3 main modes:
|
|
10
|
+
*
|
|
11
|
+
* ============================================================================
|
|
12
|
+
* 1. STANDARD MODE
|
|
13
|
+
* ============================================================================
|
|
14
|
+
*
|
|
15
|
+
* Sort all projects in normal dependency build order.
|
|
16
|
+
*
|
|
17
|
+
* Meaning:
|
|
18
|
+
*
|
|
19
|
+
* If:
|
|
20
|
+
*
|
|
21
|
+
* app depends on ui
|
|
22
|
+
* ui depends on core
|
|
23
|
+
* core depends on nothing
|
|
24
|
+
*
|
|
25
|
+
* Then build order is:
|
|
26
|
+
*
|
|
27
|
+
* core -> ui -> app
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
*
|
|
31
|
+
* Projects:
|
|
32
|
+
*
|
|
33
|
+
* not-related
|
|
34
|
+
* core
|
|
35
|
+
* ui -> core
|
|
36
|
+
* app -> ui
|
|
37
|
+
*
|
|
38
|
+
* Result:
|
|
39
|
+
*
|
|
40
|
+
* [
|
|
41
|
+
* 'not-related',
|
|
42
|
+
* 'core',
|
|
43
|
+
* 'ui',
|
|
44
|
+
* 'app',
|
|
45
|
+
* ]
|
|
46
|
+
*
|
|
47
|
+
* Graph:
|
|
48
|
+
*
|
|
49
|
+
* core
|
|
50
|
+
* |
|
|
51
|
+
* v
|
|
52
|
+
* ui
|
|
53
|
+
* |
|
|
54
|
+
* v
|
|
55
|
+
* app
|
|
56
|
+
*
|
|
57
|
+
* Build direction:
|
|
58
|
+
*
|
|
59
|
+
* core ---> ui ---> app
|
|
60
|
+
*
|
|
61
|
+
* Usage:
|
|
62
|
+
*
|
|
63
|
+
* sortGroupOfProject({
|
|
64
|
+
* projects,
|
|
65
|
+
* resoveDepsArray: p => p.dependencies,
|
|
66
|
+
* projNameToCompare: p => p.name,
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
*
|
|
70
|
+
* ============================================================================
|
|
71
|
+
* 2. onlyDepsForProject MODE
|
|
72
|
+
* ============================================================================
|
|
73
|
+
*
|
|
74
|
+
* Returns selected project plus its dependency chain.
|
|
75
|
+
*
|
|
76
|
+
* This answers the question:
|
|
77
|
+
*
|
|
78
|
+
* "What does this project need before it can be built?"
|
|
79
|
+
*
|
|
80
|
+
* Example:
|
|
81
|
+
*
|
|
82
|
+
* app depends on ui
|
|
83
|
+
* ui depends on core
|
|
84
|
+
*
|
|
85
|
+
* onlyDepsForProject: 'app'
|
|
86
|
+
*
|
|
87
|
+
* Result:
|
|
88
|
+
*
|
|
89
|
+
* [
|
|
90
|
+
* 'app',
|
|
91
|
+
* 'ui',
|
|
92
|
+
* 'core',
|
|
93
|
+
* ]
|
|
94
|
+
*
|
|
95
|
+
* Graph:
|
|
96
|
+
*
|
|
97
|
+
* app
|
|
98
|
+
* |
|
|
99
|
+
* v
|
|
100
|
+
* ui
|
|
101
|
+
* |
|
|
102
|
+
* v
|
|
103
|
+
* core
|
|
104
|
+
*
|
|
105
|
+
* Read as:
|
|
106
|
+
*
|
|
107
|
+
* app needs ui
|
|
108
|
+
* ui needs core
|
|
109
|
+
*
|
|
110
|
+
* This mode walks backwards through dependencies.
|
|
111
|
+
*
|
|
112
|
+
* Possible usage:
|
|
113
|
+
*
|
|
114
|
+
* - debugging project dependency chain
|
|
115
|
+
* - checking what project depends on directly/indirectly
|
|
116
|
+
* - maybe useful before creating a build plan
|
|
117
|
+
*
|
|
118
|
+
* NOTE:
|
|
119
|
+
*
|
|
120
|
+
* This mode may not be needed for Taon watch rebuilds.
|
|
121
|
+
* For leader builds, `onlyAffectedByProject` is usually more useful.
|
|
122
|
+
*
|
|
123
|
+
* Usage:
|
|
124
|
+
*
|
|
125
|
+
* sortGroupOfProject({
|
|
126
|
+
* projects,
|
|
127
|
+
* resoveDepsArray: p => p.dependencies,
|
|
128
|
+
* projNameToCompare: p => p.name,
|
|
129
|
+
* onlyDepsForProject: 'app',
|
|
130
|
+
* });
|
|
131
|
+
*
|
|
132
|
+
*
|
|
133
|
+
* ============================================================================
|
|
134
|
+
* 3. onlyAffectedByProject MODE
|
|
135
|
+
* ============================================================================
|
|
136
|
+
*
|
|
137
|
+
* Returns selected project plus all projects that are affected by it.
|
|
138
|
+
*
|
|
139
|
+
* This answers the question:
|
|
140
|
+
*
|
|
141
|
+
* "Project X changed. What active projects must be rebuilt?"
|
|
142
|
+
*
|
|
143
|
+
* Example:
|
|
144
|
+
*
|
|
145
|
+
* app depends on ui
|
|
146
|
+
* ui depends on core
|
|
147
|
+
*
|
|
148
|
+
* onlyAffectedByProject: 'core'
|
|
149
|
+
*
|
|
150
|
+
* Result:
|
|
151
|
+
*
|
|
152
|
+
* [
|
|
153
|
+
* 'core',
|
|
154
|
+
* 'ui',
|
|
155
|
+
* 'app',
|
|
156
|
+
* ]
|
|
157
|
+
*
|
|
158
|
+
* Graph:
|
|
159
|
+
*
|
|
160
|
+
* core
|
|
161
|
+
* |
|
|
162
|
+
* v
|
|
163
|
+
* ui
|
|
164
|
+
* |
|
|
165
|
+
* v
|
|
166
|
+
* app
|
|
167
|
+
*
|
|
168
|
+
* Read as:
|
|
169
|
+
*
|
|
170
|
+
* core changed
|
|
171
|
+
* therefore ui is affected
|
|
172
|
+
* therefore app is affected
|
|
173
|
+
*
|
|
174
|
+
* This mode walks forward through dependents.
|
|
175
|
+
*
|
|
176
|
+
* This is the most important mode for Taon lightweight watch.
|
|
177
|
+
*
|
|
178
|
+
* Leader build flow:
|
|
179
|
+
*
|
|
180
|
+
* 1. User changes file in project X.
|
|
181
|
+
* 2. Current build session is canceled.
|
|
182
|
+
* 3. Worker calculates projects affected by X.
|
|
183
|
+
* 4. Worker returns ordered build plan.
|
|
184
|
+
* 5. Last changed project becomes build leader.
|
|
185
|
+
* 6. Build leader executes projects one by one.
|
|
186
|
+
*
|
|
187
|
+
* Example:
|
|
188
|
+
*
|
|
189
|
+
* Changed project:
|
|
190
|
+
*
|
|
191
|
+
* core
|
|
192
|
+
*
|
|
193
|
+
* Active projects:
|
|
194
|
+
*
|
|
195
|
+
* core
|
|
196
|
+
* ui
|
|
197
|
+
* app
|
|
198
|
+
* not-related
|
|
199
|
+
*
|
|
200
|
+
* Dependency graph:
|
|
201
|
+
*
|
|
202
|
+
* core ---> ui ---> app
|
|
203
|
+
*
|
|
204
|
+
* not-related
|
|
205
|
+
*
|
|
206
|
+
* onlyAffectedByProject: 'core'
|
|
207
|
+
*
|
|
208
|
+
* Build plan:
|
|
209
|
+
*
|
|
210
|
+
* [
|
|
211
|
+
* 'core',
|
|
212
|
+
* 'ui',
|
|
213
|
+
* 'app',
|
|
214
|
+
* ]
|
|
215
|
+
*
|
|
216
|
+
* not-related is skipped because it does not depend on core.
|
|
217
|
+
*
|
|
218
|
+
* Usage:
|
|
219
|
+
*
|
|
220
|
+
* sortGroupOfProject({
|
|
221
|
+
* projects,
|
|
222
|
+
* resoveDepsArray: p => p.dependencies,
|
|
223
|
+
* projNameToCompare: p => p.name,
|
|
224
|
+
* onlyAffectedByProject: 'core',
|
|
225
|
+
* });
|
|
226
|
+
*
|
|
227
|
+
*
|
|
228
|
+
* ============================================================================
|
|
229
|
+
* Extra behavior
|
|
230
|
+
* ============================================================================
|
|
231
|
+
*
|
|
232
|
+
* Circular dependencies:
|
|
233
|
+
*
|
|
234
|
+
* The function detects cycles.
|
|
235
|
+
*
|
|
236
|
+
* Example:
|
|
237
|
+
*
|
|
238
|
+
* a -> b -> c -> a
|
|
239
|
+
*
|
|
240
|
+
* This throws:
|
|
241
|
+
*
|
|
242
|
+
* Circular dependency detected involving project: <project>
|
|
243
|
+
*
|
|
244
|
+
*
|
|
245
|
+
* Duplicate project names:
|
|
246
|
+
*
|
|
247
|
+
* Dependencies are resolved by logical project/package name:
|
|
248
|
+
*
|
|
249
|
+
* projNameToCompare(project)
|
|
250
|
+
*
|
|
251
|
+
* But project identity can be resolved by unique key:
|
|
252
|
+
*
|
|
253
|
+
* projUniqueKeyToCompare(project)
|
|
254
|
+
*
|
|
255
|
+
* This is useful when multiple active projects have the same package name
|
|
256
|
+
* but different location, port, or runtime context.
|
|
257
|
+
*
|
|
258
|
+
*
|
|
259
|
+
* Override order:
|
|
260
|
+
*
|
|
261
|
+
* overridePackagesOrder can be used for special/hacky cases where some
|
|
262
|
+
* projects must be moved manually inside the sorted result.
|
|
263
|
+
*
|
|
264
|
+
*
|
|
265
|
+
* Mental model:
|
|
266
|
+
*
|
|
267
|
+
* Standard mode:
|
|
268
|
+
*
|
|
269
|
+
* dependencies first
|
|
270
|
+
*
|
|
271
|
+
* onlyDepsForProject:
|
|
272
|
+
*
|
|
273
|
+
* "what do I need?"
|
|
274
|
+
*
|
|
275
|
+
* onlyAffectedByProject:
|
|
276
|
+
*
|
|
277
|
+
* "who needs me?"
|
|
278
|
+
*
|
|
279
|
+
*
|
|
280
|
+
* Best Taon watcher usage:
|
|
281
|
+
*
|
|
282
|
+
* Use `onlyAffectedByProject` for leader build plans.
|
|
283
|
+
*/
|
|
284
|
+
const sortGroupOfProject: <T extends OrderAbleProject>(options: {
|
|
285
|
+
/**
|
|
286
|
+
* Projects that needs to be sorted by dependencies
|
|
287
|
+
*/
|
|
288
|
+
projects: T[];
|
|
289
|
+
/**
|
|
290
|
+
* How to resolve dependencies array:
|
|
291
|
+
* exmaple: proj => proj.dependencies # or something similar
|
|
292
|
+
*/
|
|
293
|
+
resoveDepsArray: (proj: T) => string[];
|
|
294
|
+
/**
|
|
295
|
+
* each project has name that is being use also for project.dependencies list.
|
|
296
|
+
* exmaple: proj => proj.name
|
|
297
|
+
*/
|
|
298
|
+
projNameToCompare: (proj: T) => string;
|
|
299
|
+
/**
|
|
300
|
+
* Since there may be duplicated project with the same name but diffrent
|
|
301
|
+
* other propers => this is a way to compares projects
|
|
302
|
+
* example: proj => proj.uniqueKey # or other unique property
|
|
303
|
+
* <uniqueKey may be for example: projectName+Localtion+port>
|
|
304
|
+
*/
|
|
305
|
+
projUniqueKeyToCompare?: (proj: T) => string;
|
|
306
|
+
/**
|
|
307
|
+
* Override packages order (sometimes needed for some hacks)
|
|
308
|
+
*/
|
|
309
|
+
overridePackagesOrder?: string[];
|
|
310
|
+
/**
|
|
311
|
+
* Filter project and give me only deps for specyfic proj
|
|
312
|
+
*/
|
|
313
|
+
onlyDepsForProject?: string;
|
|
314
|
+
/**
|
|
315
|
+
* Filter projects and return only projects affected by this project.
|
|
316
|
+
*
|
|
317
|
+
* Example:
|
|
318
|
+
* core changed
|
|
319
|
+
* -> ui depends on core
|
|
320
|
+
* -> app depends on ui
|
|
321
|
+
*
|
|
322
|
+
* result:
|
|
323
|
+
* ['core', 'ui', 'app']
|
|
324
|
+
*/
|
|
325
|
+
onlyAffectedByProject?: string | string[];
|
|
326
|
+
}) => T[];
|
|
327
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare function decodeEnv(encryptedValue: string | any): Promise<string>;
|
|
2
|
+
export declare namespace UtilsSecretEnv {
|
|
3
|
+
const MASTER_PASS_KEY = "TAON_MASTER_PASS_KEY";
|
|
4
|
+
const TAON_ENCRYPTED_START = "$$$TAON_ENCRYPTED_START$$$";
|
|
5
|
+
const TAON_ENCRYPTED_END = "$$$TAON_ENCRYPTED_END$$$";
|
|
6
|
+
/**
|
|
7
|
+
* Result format:
|
|
8
|
+
*
|
|
9
|
+
* v1:<iterations>:<salt>:<iv>:<ciphertext>
|
|
10
|
+
*
|
|
11
|
+
* Salt and IV are intentionally stored with the ciphertext.
|
|
12
|
+
* They are not secrets.
|
|
13
|
+
*/
|
|
14
|
+
function encrypt(value: string, password: string): Promise<string>;
|
|
15
|
+
function decrypt(encryptedValue: string, password: string): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Extracts a static string from forms such as:
|
|
18
|
+
*
|
|
19
|
+
* () => 'secret'
|
|
20
|
+
* () => "secret"
|
|
21
|
+
* () => `secret`
|
|
22
|
+
* () => `s${'asd'}ecret`
|
|
23
|
+
* () => `port-${123}`
|
|
24
|
+
*
|
|
25
|
+
* Returns undefined for dynamic expressions:
|
|
26
|
+
*
|
|
27
|
+
* () => getSecret()
|
|
28
|
+
* () => process.env.SECRET
|
|
29
|
+
* () => `secret-${someVariable}`
|
|
30
|
+
*/
|
|
31
|
+
function extractStaticStringFromArrowFunction(contentPropFunction: string): string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Generates a cryptographically secure random password.
|
|
34
|
+
*
|
|
35
|
+
* Works in:
|
|
36
|
+
* - Node.js
|
|
37
|
+
* - Browser
|
|
38
|
+
* - Cloudflare Workers
|
|
39
|
+
*/
|
|
40
|
+
function generateRandomPassword(length?: number): string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ChildProcess } from 'child_process';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
export interface ProcessStartOptions {
|
|
4
|
+
/**
|
|
5
|
+
* unique name for the process
|
|
6
|
+
*/
|
|
7
|
+
uniqueName?: string;
|
|
8
|
+
/**
|
|
9
|
+
* by default is process.cwd();
|
|
10
|
+
*/
|
|
11
|
+
cwd?: string;
|
|
12
|
+
/**
|
|
13
|
+
* by default is false
|
|
14
|
+
*/
|
|
15
|
+
showCommand?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Line by line check and remove not needed stuff
|
|
18
|
+
*/
|
|
19
|
+
extractFromLine?: (string | Function)[];
|
|
20
|
+
/**
|
|
21
|
+
* Modify output line by line
|
|
22
|
+
*/
|
|
23
|
+
outputLineReplace?: (outputLineStderOrStdout: string) => string;
|
|
24
|
+
resolvePromiseMsg_stdout: string | string[];
|
|
25
|
+
resolvePromiseMsg_stderr: string | string[];
|
|
26
|
+
resolvePromiseMsgCallback_stdout: () => void | Promise<void>;
|
|
27
|
+
resolvePromiseMsgCallback_stderr: () => void | Promise<void>;
|
|
28
|
+
resolvePromiseMsgCallback_anystd: () => void | Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Exit with
|
|
31
|
+
*/
|
|
32
|
+
onExitCallback?: (code?: number, resolve?: () => any, reject?: () => any) => void | Promise<void>;
|
|
33
|
+
hideOutput_stdout?: boolean;
|
|
34
|
+
hideOutput_stderr?: boolean;
|
|
35
|
+
env: any;
|
|
36
|
+
/**
|
|
37
|
+
* Prefix messages output from child_process
|
|
38
|
+
* (if true - it will take unique name)
|
|
39
|
+
*/
|
|
40
|
+
prefix?: string | boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Try command again after fail after n milliseconds
|
|
43
|
+
*/
|
|
44
|
+
tryAgainWhenFailAfter?: number;
|
|
45
|
+
askToTryAgainOnError?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Use big buffer for big webpack logs
|
|
48
|
+
* (it may slow down smaller processes execution)
|
|
49
|
+
*/
|
|
50
|
+
biggerBuffer?: boolean;
|
|
51
|
+
rebuildOnChange?: Observable<any>;
|
|
52
|
+
/**
|
|
53
|
+
* todo implement
|
|
54
|
+
*/
|
|
55
|
+
similarProcessKey?: string;
|
|
56
|
+
onChildProcessChange?: (childProcess: ChildProcess) => void;
|
|
57
|
+
/**
|
|
58
|
+
* TODO do I need this ?
|
|
59
|
+
*/
|
|
60
|
+
outputBuffer?: string[];
|
|
61
|
+
outputBufferMaxSize?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* TODO IMPLEMENT
|
|
65
|
+
* start async node process
|
|
66
|
+
*/
|
|
67
|
+
export declare const startAsync: (command: string, cwd: string, options?: Partial<ProcessStartOptions>) => Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare namespace UtilsStdinStdoutLogger {
|
|
2
|
+
const __REGISTER_STARTED__ = "UtilsStdinStdoutLogger-registering-started";
|
|
3
|
+
interface RegisteredAppLogging {
|
|
4
|
+
logFilePath: string;
|
|
5
|
+
unregister: () => void;
|
|
6
|
+
}
|
|
7
|
+
const startedRegistering: () => boolean;
|
|
8
|
+
const registerFor: (workerName: string, groupName: string) => RegisteredAppLogging;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare namespace UtilsString {
|
|
2
|
+
const kebabCaseNoSplitNumbers: (input: string) => string;
|
|
3
|
+
const listDiff: (arr1: string[], arr2: string[]) => {
|
|
4
|
+
added: string[];
|
|
5
|
+
removed: string[];
|
|
6
|
+
infoMessage: () => void;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare namespace UtilsStringRegex {
|
|
10
|
+
const containsNonAscii: (pathStringOrPathParts: string) => boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare namespace UtilsSudo {
|
|
2
|
+
/**
|
|
3
|
+
* All possible sudo states on Windows 11 (24H2+)
|
|
4
|
+
*/
|
|
5
|
+
enum SudoStatus {
|
|
6
|
+
NotInstalled = "NotInstalled",
|
|
7
|
+
Disabled = "Disabled",
|
|
8
|
+
Enabled_ForceNewWindow = "Enabled_ForceNewWindow",// Enabled = 2
|
|
9
|
+
Enabled_Inline = "Enabled_Inline",// Enabled = 3 ← current default
|
|
10
|
+
Unknown = "Unknown"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @returns true if current process is elevated (admin or sudo root), false otherwise
|
|
14
|
+
*/
|
|
15
|
+
export const isCurrentProcessElevated: () => Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Main function – returns detailed sudo status
|
|
18
|
+
*/
|
|
19
|
+
export function getStatus(): Promise<{
|
|
20
|
+
status: SudoStatus;
|
|
21
|
+
label: string;
|
|
22
|
+
isAvailable: boolean;
|
|
23
|
+
isInline: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* check if sudo is available and in proper mode
|
|
27
|
+
*/
|
|
28
|
+
export const isInProperModeForTaon: ({ displayErrorMessage, }: {
|
|
29
|
+
displayErrorMessage?: boolean;
|
|
30
|
+
}) => Promise<boolean>;
|
|
31
|
+
export {};
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare namespace UtilsTempFolder {
|
|
2
|
+
interface GetTempFolderOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Automatically remove this folder after the specified number of days.
|
|
5
|
+
*
|
|
6
|
+
* Folders with expiration enabled are created inside:
|
|
7
|
+
* <system-temp>/__temp__folders__with__exp__date
|
|
8
|
+
*/
|
|
9
|
+
deleteAfterDays?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Optional readable part of the generated folder name.
|
|
12
|
+
*/
|
|
13
|
+
prefix?: string;
|
|
14
|
+
/**
|
|
15
|
+
* When true, creates a unique folder on every call.
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
* /tmp/cloudflare-db-1789309118998-1234-a1b2c3d4e5f6
|
|
19
|
+
*
|
|
20
|
+
* When false, creates/reuses a persistent folder:
|
|
21
|
+
* /tmp/cloudflare-db
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
everytimeNew?: boolean;
|
|
26
|
+
}
|
|
27
|
+
const getPath: (options?: GetTempFolderOptions) => Promise<string>;
|
|
28
|
+
function getPathForNodeOnly(options: GetTempFolderOptions): string;
|
|
29
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { CoreModels } from './core-models';
|
|
3
|
+
export declare namespace UtilsTerminal {
|
|
4
|
+
export interface SelectChoice {
|
|
5
|
+
/**
|
|
6
|
+
* Title of the choice
|
|
7
|
+
*/
|
|
8
|
+
name?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SelectChoiceValue<T = string> extends SelectChoice {
|
|
12
|
+
value?: T;
|
|
13
|
+
}
|
|
14
|
+
type SelectActionChoice = {
|
|
15
|
+
[choice: string]: SelectChoice & {
|
|
16
|
+
/**
|
|
17
|
+
* Action to execute
|
|
18
|
+
*/
|
|
19
|
+
action?: () => any;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export const wait: (second: number) => Promise<void>;
|
|
23
|
+
export const waitMilliseconds: (milliseconds: number) => Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Check if cli is running in verbose mode
|
|
26
|
+
* @returns true if cli is running with arugment -verbose
|
|
27
|
+
*/
|
|
28
|
+
export const isVerboseModeTaon: () => boolean;
|
|
29
|
+
export const waitForUserAnyKey: (callback: () => void | Promise<void>, options?: {
|
|
30
|
+
/**
|
|
31
|
+
* by default, the action is only triggered once when a key is pressed.
|
|
32
|
+
* if this option is set, the action will be triggered on every key press.
|
|
33
|
+
* (Promise will not be resolved until process is killed)
|
|
34
|
+
*/
|
|
35
|
+
triggerActionEveryKeypress?: boolean;
|
|
36
|
+
}) => Promise<void>;
|
|
37
|
+
export const getTerminalHeight: () => number;
|
|
38
|
+
export const clearConsole: () => void;
|
|
39
|
+
export const multiselect: <T = string>(options: {
|
|
40
|
+
question?: string;
|
|
41
|
+
/**
|
|
42
|
+
* If true, then only one choice can be selected
|
|
43
|
+
* @deprecated use select instead
|
|
44
|
+
*/
|
|
45
|
+
onlyOneChoice?: boolean;
|
|
46
|
+
choices: SelectChoiceValue<T>[] | {
|
|
47
|
+
[choice: string]: SelectChoice;
|
|
48
|
+
};
|
|
49
|
+
autocomplete?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* at least one choice must be selected
|
|
52
|
+
*/
|
|
53
|
+
required?: boolean;
|
|
54
|
+
defaultSelected?: string[];
|
|
55
|
+
}) => Promise<T[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Similar to select but executes action if provided
|
|
58
|
+
* @returns selected and executed value
|
|
59
|
+
*/
|
|
60
|
+
export const multiselectActionAndExecute: <CHOICE extends SelectActionChoice = SelectActionChoice>(choices: CHOICE, options?: {
|
|
61
|
+
question?: string;
|
|
62
|
+
autocomplete?: boolean;
|
|
63
|
+
defaultSelected?: string;
|
|
64
|
+
hint?: string;
|
|
65
|
+
executeActionsOnDefault?: boolean;
|
|
66
|
+
}) => Promise<{
|
|
67
|
+
selected: (keyof CHOICE)[];
|
|
68
|
+
actionResults: unknown[];
|
|
69
|
+
/**
|
|
70
|
+
* object containing all selected actions
|
|
71
|
+
*/
|
|
72
|
+
actions: (() => any)[];
|
|
73
|
+
}>;
|
|
74
|
+
/**
|
|
75
|
+
* Similar to select but executes action if provided
|
|
76
|
+
* @returns selected and executed value
|
|
77
|
+
*/
|
|
78
|
+
export const selectActionAndExecute: <CHOICE extends SelectActionChoice = SelectActionChoice>(choices: CHOICE, options?: {
|
|
79
|
+
question?: string;
|
|
80
|
+
autocomplete?: boolean;
|
|
81
|
+
defaultSelected?: string;
|
|
82
|
+
hint?: string;
|
|
83
|
+
executeActionOnDefault?: boolean;
|
|
84
|
+
}) => Promise<{
|
|
85
|
+
selected: any;
|
|
86
|
+
action: () => Promise<any>;
|
|
87
|
+
actionResult?: undefined;
|
|
88
|
+
} | {
|
|
89
|
+
selected: keyof CHOICE;
|
|
90
|
+
actionResult: unknown;
|
|
91
|
+
action: () => Promise<any>;
|
|
92
|
+
}>;
|
|
93
|
+
export const select: <T = string>(options: {
|
|
94
|
+
question?: string;
|
|
95
|
+
choices: SelectChoiceValue<T>[] | {
|
|
96
|
+
[choice: string]: SelectChoice;
|
|
97
|
+
};
|
|
98
|
+
autocomplete?: boolean;
|
|
99
|
+
defaultSelected?: string;
|
|
100
|
+
hint?: string;
|
|
101
|
+
}) => Promise<T | undefined>;
|
|
102
|
+
export const pipeEnterToStdin: () => void;
|
|
103
|
+
export const input: ({ defaultValue, question, required, validate, }: {
|
|
104
|
+
defaultValue?: string;
|
|
105
|
+
question: string;
|
|
106
|
+
required?: boolean;
|
|
107
|
+
validate?: (value: string) => boolean;
|
|
108
|
+
}) => Promise<string>;
|
|
109
|
+
export const password: ({ question, required, validate, }: {
|
|
110
|
+
defaultValue?: string;
|
|
111
|
+
question: string;
|
|
112
|
+
required?: boolean;
|
|
113
|
+
validate?: (value: string) => boolean;
|
|
114
|
+
}) => Promise<string>;
|
|
115
|
+
export function canUseInteractiveToggle(): Promise<boolean>;
|
|
116
|
+
export function basicYesNo(message: string, defaultValue?: boolean): Promise<boolean>;
|
|
117
|
+
export const confirm: (options?: {
|
|
118
|
+
/**
|
|
119
|
+
* default: Are you sure?
|
|
120
|
+
*/
|
|
121
|
+
message?: string;
|
|
122
|
+
callbackTrue?: () => any;
|
|
123
|
+
callbackFalse?: () => any;
|
|
124
|
+
/**
|
|
125
|
+
* default: true
|
|
126
|
+
*/
|
|
127
|
+
defaultValue?: boolean;
|
|
128
|
+
engine?: "inquirer-toggle" | "prompts" | "enquirer" | "@inquirer/prompts";
|
|
129
|
+
}) => Promise<boolean>;
|
|
130
|
+
export const pressAnyKeyToContinueAsync: (options?: {
|
|
131
|
+
message?: string;
|
|
132
|
+
}) => Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated use UtilsTerminal.pressAnyKey
|
|
135
|
+
*/
|
|
136
|
+
export const pressKeyAndContinueSync: (message?: string) => void;
|
|
137
|
+
/**
|
|
138
|
+
* @returns true if user wants to try again, false otherwise
|
|
139
|
+
*/
|
|
140
|
+
export const pressAnyKeyToTryAgainErrorOccurred: (error: unknown) => Promise<boolean>;
|
|
141
|
+
/**
|
|
142
|
+
* @deprecated use UtilsTerminal.pressAnyKeyToContinueAsync()
|
|
143
|
+
*/
|
|
144
|
+
export const pressAnyKey: (options?: {
|
|
145
|
+
message?: string;
|
|
146
|
+
}) => void;
|
|
147
|
+
export const previewLongList: (list: string | string[], listName?: string) => Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Displays a long list in the console using a pager like `less`.
|
|
150
|
+
* Returns a Promise that resolves when the user exits the pager.
|
|
151
|
+
*
|
|
152
|
+
* @param {string} list - The long string content to display.
|
|
153
|
+
* @returns {Promise<void>} A Promise that resolves when the pager exits.
|
|
154
|
+
*/
|
|
155
|
+
export const previewLongListGitLogLike: (list: string | string[]) => Promise<void>;
|
|
156
|
+
export const drawBigText: (text: string, options?: {
|
|
157
|
+
skipDrawing?: boolean;
|
|
158
|
+
align?: CoreModels.CfontAlign;
|
|
159
|
+
style?: CoreModels.CfontStyle;
|
|
160
|
+
}) => Promise<string>;
|
|
161
|
+
export const drawVerticalLine: (col?: number) => void;
|
|
162
|
+
export const drawHorizontalLine: (col?: number) => void;
|
|
163
|
+
export function fetchAndDisplay<DataModel = any>(opt: {
|
|
164
|
+
fetchFn: () => Promise<DataModel[]>;
|
|
165
|
+
title: string;
|
|
166
|
+
refreshEveryMs?: number;
|
|
167
|
+
requestTimeoutMs?: number;
|
|
168
|
+
onTimeout?: () => void;
|
|
169
|
+
}): Promise<void>;
|
|
170
|
+
export {};
|
|
171
|
+
}
|