tnp-core 19.0.16 → 19.0.17
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/README.md +20 -20
- package/browser/README.md +24 -24
- package/browser/fesm2022/tnp-core.mjs +587 -60
- package/browser/fesm2022/tnp-core.mjs.map +1 -1
- package/browser/package.json +1 -1
- package/cli.backend.js +2 -2
- package/cli.backend.js.map +1 -1
- package/client/README.md +24 -24
- package/client/fesm2022/tnp-core.mjs +587 -60
- package/client/fesm2022/tnp-core.mjs.map +1 -1
- package/client/package.json +1 -1
- package/index.js.map +1 -1
- package/lib/build-info._auto-generated_.d.ts +2 -1
- package/lib/build-info._auto-generated_.js +3 -2
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/command-exists.js.map +1 -1
- package/lib/core-cli.js.map +1 -1
- package/lib/core-config.js.map +1 -1
- package/lib/core-imports.js.map +1 -1
- package/lib/core-models.js.map +1 -1
- package/lib/framework-name.js.map +1 -1
- package/lib/helpers-isomorphic.js.map +1 -1
- package/lib/helpers-messages.js.map +1 -1
- package/lib/helpers.d.ts +1 -1
- package/lib/helpers.js +2 -4
- package/lib/helpers.js.map +1 -1
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/node-chalk-mock.js +2 -2
- package/lib/node-chalk-mock.js.map +1 -1
- package/lib/node-path-mock.js +2 -2
- package/lib/node-path-mock.js.map +1 -1
- package/lib/progress-data.js.map +1 -1
- package/lib/public-api.js.map +1 -1
- package/lib/required-global-npm-packages.js.map +1 -1
- package/lib/utils.js.map +1 -1
- package/migrations/index.js.map +1 -1
- package/migrations/migrations_index._auto-generated_.js.map +1 -1
- package/package.json +1 -1
- package/tmp-environment.json +4 -4
- package/websql/README.md +24 -24
- package/websql/fesm2022/tnp-core.mjs +591 -60
- package/websql/fesm2022/tnp-core.mjs.map +1 -1
- package/websql/package.json +1 -1
- package/lib/required.d.ts +0 -44
- package/lib/required.js +0 -76
- package/lib/required.js.map +0 -1
@@ -14,16 +14,18 @@ import { Blob as Blob$1 } from 'buffer';
|
|
14
14
|
import axios from 'axios';
|
15
15
|
|
16
16
|
let isBrowser = false;
|
17
|
+
//#region @browser
|
17
18
|
isBrowser = true;
|
19
|
+
//#endregion
|
18
20
|
const frameworkNameBeTmp = '';
|
19
21
|
/* */
|
20
22
|
/* */
|
21
23
|
/* */
|
22
24
|
const frameworkNameBe = frameworkNameBeTmp;
|
23
25
|
const frameworkName = isBrowser ? 'taon' : frameworkNameBe;
|
24
|
-
;
|
25
|
-
({}); // @--end-of-file-for-module=tnp-core lib/framework-name.ts
|
26
26
|
|
27
|
+
// TODO finish this MOCK @LAST
|
28
|
+
// const c:Chalk = void 0;
|
27
29
|
const allObj = {
|
28
30
|
black(a) {
|
29
31
|
console.log(a);
|
@@ -63,14 +65,15 @@ for (let i = 0; i < all.length; i++) {
|
|
63
65
|
}
|
64
66
|
}
|
65
67
|
const chalk$1 = allObj;
|
66
|
-
|
67
|
-
({}); // @--end-of-file-for-module=tnp-core lib/node-chalk-mock.ts
|
68
|
+
//#endregion
|
68
69
|
|
70
|
+
//#region @browser
|
69
71
|
function assertPath(path) {
|
70
72
|
if (typeof path !== 'string') {
|
71
73
|
throw new TypeError('[taon-core] Path must be a string. Received ' + JSON.stringify(path));
|
72
74
|
}
|
73
75
|
}
|
76
|
+
// Resolves . and .. elements in a path with directory names
|
74
77
|
function normalizeStringPosix(path, allowAboveRoot) {
|
75
78
|
var res = '';
|
76
79
|
var lastSegmentLength = 0;
|
@@ -86,6 +89,7 @@ function normalizeStringPosix(path, allowAboveRoot) {
|
|
86
89
|
code = 47 /*/*/;
|
87
90
|
if (code === 47 /*/*/) {
|
88
91
|
if (lastSlash === i - 1 || dots === 1) {
|
92
|
+
// NOOP
|
89
93
|
}
|
90
94
|
else if (lastSlash !== i - 1 && dots === 2) {
|
91
95
|
if (res.length < 2 ||
|
@@ -155,6 +159,7 @@ function _format(sep, pathObject) {
|
|
155
159
|
return dir + sep + base;
|
156
160
|
}
|
157
161
|
const path$1 = {
|
162
|
+
// path.resolve([from ...], to)
|
158
163
|
resolve: function resolve(pathToResovle) {
|
159
164
|
return pathToResovle;
|
160
165
|
},
|
@@ -164,6 +169,7 @@ const path$1 = {
|
|
164
169
|
return '.';
|
165
170
|
var isAbsolute = pathArg.charCodeAt(0) === 47; /*/*/
|
166
171
|
var trailingSeparator = pathArg.charCodeAt(pathArg.length - 1) === 47; /*/*/
|
172
|
+
// Normalize the path
|
167
173
|
pathArg = normalizeStringPosix(pathArg, !isAbsolute);
|
168
174
|
if (pathArg.length === 0 && !isAbsolute)
|
169
175
|
pathArg = '.';
|
@@ -204,6 +210,7 @@ const path$1 = {
|
|
204
210
|
to = path$1.resolve(to);
|
205
211
|
if (from === to)
|
206
212
|
return '';
|
213
|
+
// Trim any leading backslashes
|
207
214
|
var fromStart = 1;
|
208
215
|
for (; fromStart < from.length; ++fromStart) {
|
209
216
|
if (from.charCodeAt(fromStart) !== 47 /*/*/)
|
@@ -211,6 +218,7 @@ const path$1 = {
|
|
211
218
|
}
|
212
219
|
var fromEnd = from.length;
|
213
220
|
var fromLen = fromEnd - fromStart;
|
221
|
+
// Trim any leading backslashes
|
214
222
|
var toStart = 1;
|
215
223
|
for (; toStart < to.length; ++toStart) {
|
216
224
|
if (to.charCodeAt(toStart) !== 47 /*/*/)
|
@@ -218,6 +226,7 @@ const path$1 = {
|
|
218
226
|
}
|
219
227
|
var toEnd = to.length;
|
220
228
|
var toLen = toEnd - toStart;
|
229
|
+
// Compare paths to find the longest common path from root
|
221
230
|
var length = fromLen < toLen ? fromLen : toLen;
|
222
231
|
var lastCommonSep = -1;
|
223
232
|
var i = 0;
|
@@ -225,17 +234,25 @@ const path$1 = {
|
|
225
234
|
if (i === length) {
|
226
235
|
if (toLen > length) {
|
227
236
|
if (to.charCodeAt(toStart + i) === 47 /*/*/) {
|
237
|
+
// We get here if `from` is the exact base path for `to`.
|
238
|
+
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
228
239
|
return to.slice(toStart + i + 1);
|
229
240
|
}
|
230
241
|
else if (i === 0) {
|
242
|
+
// We get here if `from` is the root
|
243
|
+
// For example: from='/'; to='/foo'
|
231
244
|
return to.slice(toStart + i);
|
232
245
|
}
|
233
246
|
}
|
234
247
|
else if (fromLen > length) {
|
235
248
|
if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
|
249
|
+
// We get here if `to` is the exact base path for `from`.
|
250
|
+
// For example: from='/foo/bar/baz'; to='/foo/bar'
|
236
251
|
lastCommonSep = i;
|
237
252
|
}
|
238
253
|
else if (i === 0) {
|
254
|
+
// We get here if `to` is the root.
|
255
|
+
// For example: from='/foo'; to='/'
|
239
256
|
lastCommonSep = 0;
|
240
257
|
}
|
241
258
|
}
|
@@ -249,6 +266,8 @@ const path$1 = {
|
|
249
266
|
lastCommonSep = i;
|
250
267
|
}
|
251
268
|
var out = '';
|
269
|
+
// Generate the relative path based on the path difference between `to`
|
270
|
+
// and `from`
|
252
271
|
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
253
272
|
if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
|
254
273
|
if (out.length === 0)
|
@@ -257,6 +276,8 @@ const path$1 = {
|
|
257
276
|
out += '/..';
|
258
277
|
}
|
259
278
|
}
|
279
|
+
// Lastly, append the rest of the destination (`to`) path that comes after
|
280
|
+
// the common path parts
|
260
281
|
if (out.length > 0)
|
261
282
|
return out + to.slice(toStart + lastCommonSep);
|
262
283
|
else {
|
@@ -286,6 +307,7 @@ const path$1 = {
|
|
286
307
|
}
|
287
308
|
}
|
288
309
|
else {
|
310
|
+
// We saw the first non-path separator
|
289
311
|
matchedSlash = false;
|
290
312
|
}
|
291
313
|
}
|
@@ -311,6 +333,8 @@ const path$1 = {
|
|
311
333
|
for (i = pathArg.length - 1; i >= 0; --i) {
|
312
334
|
var code = pathArg.charCodeAt(i);
|
313
335
|
if (code === 47 /*/*/) {
|
336
|
+
// If we reached a path separator that was not part of a set of path
|
337
|
+
// separators at the end of the string, stop now
|
314
338
|
if (!matchedSlash) {
|
315
339
|
start = i + 1;
|
316
340
|
break;
|
@@ -318,16 +342,23 @@ const path$1 = {
|
|
318
342
|
}
|
319
343
|
else {
|
320
344
|
if (firstNonSlashEnd === -1) {
|
345
|
+
// We saw the first non-path separator, remember this index in case
|
346
|
+
// we need it if the extension ends up not matching
|
321
347
|
matchedSlash = false;
|
322
348
|
firstNonSlashEnd = i + 1;
|
323
349
|
}
|
324
350
|
if (extIdx >= 0) {
|
351
|
+
// Try to match the explicit extension
|
325
352
|
if (code === ext.charCodeAt(extIdx)) {
|
326
353
|
if (--extIdx === -1) {
|
354
|
+
// We matched the extension, so mark this as the end of our path
|
355
|
+
// component
|
327
356
|
end = i;
|
328
357
|
}
|
329
358
|
}
|
330
359
|
else {
|
360
|
+
// Extension does not match, so our result is the entire path
|
361
|
+
// component
|
331
362
|
extIdx = -1;
|
332
363
|
end = firstNonSlashEnd;
|
333
364
|
}
|
@@ -343,12 +374,16 @@ const path$1 = {
|
|
343
374
|
else {
|
344
375
|
for (i = pathArg.length - 1; i >= 0; --i) {
|
345
376
|
if (pathArg.charCodeAt(i) === 47 /*/*/) {
|
377
|
+
// If we reached a path separator that was not part of a set of path
|
378
|
+
// separators at the end of the string, stop now
|
346
379
|
if (!matchedSlash) {
|
347
380
|
start = i + 1;
|
348
381
|
break;
|
349
382
|
}
|
350
383
|
}
|
351
384
|
else if (end === -1) {
|
385
|
+
// We saw the first non-path separator, mark this as the end of our
|
386
|
+
// path component
|
352
387
|
matchedSlash = false;
|
353
388
|
end = i + 1;
|
354
389
|
}
|
@@ -364,10 +399,14 @@ const path$1 = {
|
|
364
399
|
var startPart = 0;
|
365
400
|
var end = -1;
|
366
401
|
var matchedSlash = true;
|
402
|
+
// Track the state of characters (if any) we see before our first dot and
|
403
|
+
// after any path separator we find
|
367
404
|
var preDotState = 0;
|
368
405
|
for (var i = pathArg.length - 1; i >= 0; --i) {
|
369
406
|
var code = pathArg.charCodeAt(i);
|
370
407
|
if (code === 47 /*/*/) {
|
408
|
+
// If we reached a path separator that was not part of a set of path
|
409
|
+
// separators at the end of the string, stop now
|
371
410
|
if (!matchedSlash) {
|
372
411
|
startPart = i + 1;
|
373
412
|
break;
|
@@ -375,22 +414,29 @@ const path$1 = {
|
|
375
414
|
continue;
|
376
415
|
}
|
377
416
|
if (end === -1) {
|
417
|
+
// We saw the first non-path separator, mark this as the end of our
|
418
|
+
// extension
|
378
419
|
matchedSlash = false;
|
379
420
|
end = i + 1;
|
380
421
|
}
|
381
422
|
if (code === 46 /*.*/) {
|
423
|
+
// If this is our first dot, mark it as the start of our extension
|
382
424
|
if (startDot === -1)
|
383
425
|
startDot = i;
|
384
426
|
else if (preDotState !== 1)
|
385
427
|
preDotState = 1;
|
386
428
|
}
|
387
429
|
else if (startDot !== -1) {
|
430
|
+
// We saw a non-dot and non-path separator before our dot, so we should
|
431
|
+
// have a good chance at having a non-empty extension
|
388
432
|
preDotState = -1;
|
389
433
|
}
|
390
434
|
}
|
391
435
|
if (startDot === -1 ||
|
392
436
|
end === -1 ||
|
437
|
+
// We saw a non-dot character immediately before the dot
|
393
438
|
preDotState === 0 ||
|
439
|
+
// The (right-most) trimmed path component is exactly '..'
|
394
440
|
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
|
395
441
|
return '';
|
396
442
|
}
|
@@ -423,10 +469,15 @@ const path$1 = {
|
|
423
469
|
var end = -1;
|
424
470
|
var matchedSlash = true;
|
425
471
|
var i = pathArg.length - 1;
|
472
|
+
// Track the state of characters (if any) we see before our first dot and
|
473
|
+
// after any path separator we find
|
426
474
|
var preDotState = 0;
|
475
|
+
// Get non-dir info
|
427
476
|
for (; i >= start; --i) {
|
428
477
|
code = pathArg.charCodeAt(i);
|
429
478
|
if (code === 47 /*/*/) {
|
479
|
+
// If we reached a path separator that was not part of a set of path
|
480
|
+
// separators at the end of the string, stop now
|
430
481
|
if (!matchedSlash) {
|
431
482
|
startPart = i + 1;
|
432
483
|
break;
|
@@ -434,22 +485,29 @@ const path$1 = {
|
|
434
485
|
continue;
|
435
486
|
}
|
436
487
|
if (end === -1) {
|
488
|
+
// We saw the first non-path separator, mark this as the end of our
|
489
|
+
// extension
|
437
490
|
matchedSlash = false;
|
438
491
|
end = i + 1;
|
439
492
|
}
|
440
493
|
if (code === 46 /*.*/) {
|
494
|
+
// If this is our first dot, mark it as the start of our extension
|
441
495
|
if (startDot === -1)
|
442
496
|
startDot = i;
|
443
497
|
else if (preDotState !== 1)
|
444
498
|
preDotState = 1;
|
445
499
|
}
|
446
500
|
else if (startDot !== -1) {
|
501
|
+
// We saw a non-dot and non-path separator before our dot, so we should
|
502
|
+
// have a good chance at having a non-empty extension
|
447
503
|
preDotState = -1;
|
448
504
|
}
|
449
505
|
}
|
450
506
|
if (startDot === -1 ||
|
451
507
|
end === -1 ||
|
508
|
+
// We saw a non-dot character immediately before the dot
|
452
509
|
preDotState === 0 ||
|
510
|
+
// The (right-most) trimmed path component is exactly '..'
|
453
511
|
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
|
454
512
|
if (end !== -1) {
|
455
513
|
if (startPart === 0 && isAbsolute)
|
@@ -485,50 +543,90 @@ const path$1 = {
|
|
485
543
|
},
|
486
544
|
posix: null,
|
487
545
|
};
|
488
|
-
|
489
|
-
({}); // @--end-of-file-for-module=tnp-core lib/node-path-mock.ts
|
546
|
+
//#endregion
|
490
547
|
|
491
548
|
let forceTrace = false;
|
549
|
+
//#region constants
|
492
550
|
/* */
|
493
551
|
/* */
|
552
|
+
//#endregion
|
553
|
+
//#region set up browser mocks
|
554
|
+
//#region set up browser mocks / mock jquery
|
494
555
|
let $;
|
556
|
+
//#region @browser
|
495
557
|
$ = jQuery;
|
558
|
+
//#endregion
|
496
559
|
/* */
|
497
560
|
/* */
|
561
|
+
//#endregion
|
562
|
+
//#region set up browser mocks / mock path
|
498
563
|
let path = void 0;
|
499
564
|
/* */
|
500
565
|
/* */
|
566
|
+
//#region @browser
|
501
567
|
// @ts-ignore
|
502
568
|
path = path$1;
|
569
|
+
//#endregion
|
570
|
+
//#endregion
|
571
|
+
//#region set up browser mocks / mock chalk
|
503
572
|
let chalk = void 0;
|
504
573
|
/* */
|
505
574
|
/* */
|
575
|
+
//#region @browser
|
506
576
|
// @ts-ignore
|
507
577
|
chalk = chalk$1;
|
578
|
+
//#endregion
|
579
|
+
//#endregion
|
580
|
+
//#region set up browser mocks / mock glob
|
508
581
|
let glob = void 0;
|
509
582
|
/* */
|
510
583
|
/* */
|
584
|
+
//#region @browser
|
585
|
+
// TODO: implement browser glob
|
586
|
+
//#endregion
|
587
|
+
//#endregion
|
588
|
+
//#region set up browser mocks / mock fse
|
511
589
|
let fse = void 0;
|
512
590
|
/* */
|
513
591
|
/* */
|
592
|
+
//#region @browser
|
593
|
+
// TODO: implement browser fse
|
594
|
+
//#endregion
|
595
|
+
//#endregion
|
596
|
+
//#region set up browser mocks / mock os
|
514
597
|
let os = void 0;
|
515
598
|
/* */
|
516
599
|
/* */
|
600
|
+
//#region @browser
|
601
|
+
// TODO: implement browser os
|
602
|
+
//#endregion
|
603
|
+
//#endregion
|
604
|
+
//#region set up browser mocks / mock child_process
|
517
605
|
let child_process = void 0;
|
518
606
|
/* */
|
519
607
|
/* */
|
608
|
+
//#endregion
|
609
|
+
//#region set up browser mocks / mock http
|
520
610
|
let http = void 0;
|
521
611
|
/* */
|
522
612
|
/* */
|
613
|
+
//#endregion
|
614
|
+
//#region set up browser mocks / mock https
|
523
615
|
let https = void 0;
|
524
616
|
/* */
|
525
617
|
/* */
|
618
|
+
//#endregion
|
619
|
+
//#region set up browser mocks / mock isRoot
|
526
620
|
let isRoot = void 0;
|
527
621
|
/* */
|
528
622
|
/* */
|
623
|
+
//#endregion
|
624
|
+
//#region set up browser mocks / mock isAdmin
|
529
625
|
let isAdmin = void 0;
|
530
626
|
/* */
|
531
627
|
/* */
|
628
|
+
//#endregion
|
629
|
+
//#region set up browser mocks / mock isElevated
|
532
630
|
/**
|
533
631
|
* check if the current process is elevated
|
534
632
|
* - sudo in unix/macos
|
@@ -537,39 +635,65 @@ let isAdmin = void 0;
|
|
537
635
|
let isElevated = void 0;
|
538
636
|
/* */
|
539
637
|
/* */
|
638
|
+
//#endregion
|
639
|
+
//#region set up browser mocks / mock fkill
|
540
640
|
let fkill = void 0;
|
541
641
|
/* */
|
542
642
|
/* */
|
643
|
+
//#endregion
|
644
|
+
//#region set up browser mocks / mock psList
|
543
645
|
let psList = void 0;
|
544
646
|
/* */
|
545
647
|
/* */
|
648
|
+
//#endregion
|
649
|
+
//#region set up browser mocks / mock net
|
546
650
|
let net = void 0;
|
547
651
|
/* */
|
548
652
|
/* */
|
653
|
+
//#endregion
|
654
|
+
//#region set up browser mocks / mock spawn
|
549
655
|
let spawn = void 0;
|
550
656
|
/* */
|
551
657
|
/* */
|
658
|
+
//#endregion
|
659
|
+
//#region set up browser mocks / mock minimatch
|
552
660
|
let minimatch = void 0;
|
553
661
|
/* */
|
554
662
|
/* */
|
663
|
+
//#endregion
|
664
|
+
//#region set up browser mocks / mock rimraf
|
555
665
|
let rimraf = void 0;
|
556
666
|
/* */
|
557
667
|
/* */
|
668
|
+
//#endregion
|
669
|
+
//#region set up browser mocks / mock chokidar
|
558
670
|
let chokidar = void 0;
|
559
671
|
/* */
|
560
672
|
/* */
|
673
|
+
//#endregion
|
674
|
+
//#region set up browser mocks / mock mkdirp
|
561
675
|
let mkdirp = void 0;
|
562
676
|
/* */
|
563
677
|
/* */
|
678
|
+
//#endregion
|
679
|
+
//#region set up browser mocks / mock ncp
|
564
680
|
let ncp = void 0;
|
565
681
|
/* */
|
566
682
|
/* */
|
683
|
+
//#endregion
|
684
|
+
//#region set up browser mocks / mock ps
|
567
685
|
let ps = void 0;
|
568
686
|
/* */
|
569
687
|
/* */
|
688
|
+
//#endregion
|
689
|
+
//#region set up browser mocks / mock fg
|
570
690
|
let fg = void 0;
|
571
691
|
/* */
|
572
692
|
/* */
|
693
|
+
//#endregion
|
694
|
+
//#endregion
|
695
|
+
//#region crossPlatformPath
|
696
|
+
//#region transform unix path to win32 path
|
573
697
|
/**
|
574
698
|
* transform unix path to win32 path
|
575
699
|
*/
|
@@ -583,6 +707,7 @@ const win32Path = (p) => {
|
|
583
707
|
}
|
584
708
|
return path.win32.normalize(p);
|
585
709
|
};
|
710
|
+
//#endregion
|
586
711
|
/**
|
587
712
|
* This funciton will replace // to /
|
588
713
|
*/
|
@@ -593,6 +718,7 @@ const crossPlatformPath = (pathStringOrPathParts) => {
|
|
593
718
|
if (typeof pathStringOrPathParts !== 'string') {
|
594
719
|
return pathStringOrPathParts;
|
595
720
|
}
|
721
|
+
// debugger;
|
596
722
|
if (typeof pathStringOrPathParts === 'string' &&
|
597
723
|
/^[A-Z]\:/.test(pathStringOrPathParts)) {
|
598
724
|
pathStringOrPathParts = _.lowerFirst(pathStringOrPathParts);
|
@@ -621,41 +747,22 @@ const crossPlatformPath = (pathStringOrPathParts) => {
|
|
621
747
|
/* */
|
622
748
|
/* */
|
623
749
|
const regexWinPath1 = /^(\/)[a-zA-Z]\:/;
|
750
|
+
// handle supported gitbash path
|
751
|
+
// (nodejs require need to use /c/ instead of c:/)
|
624
752
|
if (isWindows && regexWinPath1.test(pathStringOrPathParts)) {
|
625
753
|
pathStringOrPathParts = pathStringOrPathParts.slice(1);
|
626
754
|
}
|
755
|
+
// let isUnixLike = !isWindows;
|
756
|
+
// const regexWinPath2 = /^(\\)[a-zA-Z]\:/;
|
757
|
+
// if (isUnixLike && regexWinPath2.test(pathStringOrPathParts)) {
|
758
|
+
// console.warn(
|
759
|
+
// `[taon-core][crossPlatformPath]: Path starts with \\ and not from /`,
|
760
|
+
// );
|
761
|
+
// console.trace(`path: "${pathStringOrPathParts}"`);
|
762
|
+
// }
|
627
763
|
return pathStringOrPathParts;
|
628
764
|
};
|
629
|
-
|
630
|
-
/* */
|
631
|
-
/* */
|
632
|
-
/* */
|
633
|
-
/* */
|
634
|
-
/* */
|
635
|
-
/* */
|
636
|
-
/* */
|
637
|
-
/* */
|
638
|
-
/* */
|
639
|
-
/* */
|
640
|
-
/* */
|
641
|
-
/* */
|
642
|
-
/* */
|
643
|
-
/* */
|
644
|
-
/* */
|
645
|
-
/* */
|
646
|
-
/* */
|
647
|
-
/* */
|
648
|
-
/* */
|
649
|
-
/* */
|
650
|
-
/* */
|
651
|
-
/* */
|
652
|
-
/* */
|
653
|
-
/* */
|
654
|
-
/* */
|
655
|
-
/* */
|
656
|
-
/* */
|
657
|
-
;
|
658
|
-
({}); // @--end-of-file-for-module=tnp-core lib/core-imports.ts
|
765
|
+
//#endregion
|
659
766
|
|
660
767
|
var CoreModels;
|
661
768
|
(function (CoreModels) {
|
@@ -668,6 +775,8 @@ var CoreModels;
|
|
668
775
|
'rc',
|
669
776
|
'lts',
|
670
777
|
];
|
778
|
+
//#endregion
|
779
|
+
//#region environment name
|
671
780
|
/**
|
672
781
|
* Available application environments.
|
673
782
|
*/
|
@@ -743,6 +852,8 @@ var CoreModels;
|
|
743
852
|
'png',
|
744
853
|
'svg',
|
745
854
|
];
|
855
|
+
//#endregion
|
856
|
+
//#region base project type arr
|
746
857
|
CoreModels.BaseProjectTypeArr = [
|
747
858
|
'typescript',
|
748
859
|
'angular',
|
@@ -750,6 +861,9 @@ var CoreModels;
|
|
750
861
|
'unknown',
|
751
862
|
'unknown-npm-project',
|
752
863
|
];
|
864
|
+
//#endregion
|
865
|
+
//#region mime types / content type
|
866
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
753
867
|
CoreModels.mimeTypes = {
|
754
868
|
'.aac': 'audio/aac',
|
755
869
|
'.abw': 'application/x-abiword',
|
@@ -840,13 +954,16 @@ var CoreModels;
|
|
840
954
|
'model',
|
841
955
|
];
|
842
956
|
CoreModels.MimeTypesObj = CoreModels.mimeTypes;
|
957
|
+
//#endregion
|
843
958
|
})(CoreModels || (CoreModels = {}));
|
844
|
-
;
|
845
|
-
({}); // @--end-of-file-for-module=tnp-core lib/core-models.ts
|
846
959
|
|
960
|
+
//#region imports
|
961
|
+
//#endregion
|
847
962
|
const BLOB_SUPPORTED_IN_SQLJS = false;
|
963
|
+
//#region utils
|
848
964
|
var Utils;
|
849
965
|
(function (Utils) {
|
966
|
+
//#region utils / uniq array
|
850
967
|
Utils.uniqArray = (array, uniqueProperty) => {
|
851
968
|
var seen = {};
|
852
969
|
return array
|
@@ -857,6 +974,8 @@ var Utils;
|
|
857
974
|
: (seen[uniqueProperty ? item[uniqueProperty] : item] = true);
|
858
975
|
});
|
859
976
|
};
|
977
|
+
//#endregion
|
978
|
+
//#region utils / recursive sort keys in object
|
860
979
|
/**
|
861
980
|
* @param anyObject
|
862
981
|
* @returns object with sorted keys
|
@@ -872,6 +991,8 @@ var Utils;
|
|
872
991
|
}
|
873
992
|
return anyObject;
|
874
993
|
};
|
994
|
+
//#endregion
|
995
|
+
//#region utils / escape string for reg exp
|
875
996
|
/**
|
876
997
|
* Example:
|
877
998
|
* new RegExp(escapeStringForRegEx('a.b.c'),'g') => /a\.b\.c/g
|
@@ -879,21 +1000,31 @@ var Utils;
|
|
879
1000
|
Utils.escapeStringForRegEx = (stringForRegExp) => {
|
880
1001
|
return stringForRegExp.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
881
1002
|
};
|
1003
|
+
//#endregion
|
1004
|
+
//#region utils / remove chalk special chars
|
882
1005
|
function removeChalkSpecialChars(str) {
|
1006
|
+
// Regex to match ANSI escape sequences used by Chalk
|
883
1007
|
const ansiRegex = /\u001b\[[0-9;]*m/g;
|
1008
|
+
// Replace all ANSI escape sequences with an empty string
|
884
1009
|
return str.replace(ansiRegex, '');
|
885
1010
|
}
|
886
1011
|
Utils.removeChalkSpecialChars = removeChalkSpecialChars;
|
1012
|
+
//#endregion
|
1013
|
+
//#region utils / full date time
|
887
1014
|
Utils.fullDateTime = () => {
|
888
1015
|
/* */
|
889
1016
|
/* */
|
890
1017
|
return (void 0);
|
891
1018
|
};
|
1019
|
+
//#endregion
|
1020
|
+
//#region utils / full date
|
892
1021
|
Utils.fullDate = () => {
|
893
1022
|
/* */
|
894
1023
|
/* */
|
895
1024
|
return (void 0);
|
896
1025
|
};
|
1026
|
+
//#endregion
|
1027
|
+
//#region utils / get free port
|
897
1028
|
const takenPorts = [];
|
898
1029
|
Utils.getFreePort = async (options) => {
|
899
1030
|
/* */
|
@@ -928,6 +1059,8 @@ var Utils;
|
|
928
1059
|
/* */
|
929
1060
|
return (void 0);
|
930
1061
|
};
|
1062
|
+
//#endregion
|
1063
|
+
//#region utils / required uncached
|
931
1064
|
/**
|
932
1065
|
* Traverses the cache to search for all the cached
|
933
1066
|
* files of the specified module name
|
@@ -982,6 +1115,8 @@ var Utils;
|
|
982
1115
|
/* */
|
983
1116
|
return (void 0);
|
984
1117
|
};
|
1118
|
+
//#endregion
|
1119
|
+
//#region utils / camelize
|
985
1120
|
/**
|
986
1121
|
* similar to camelCase but remove
|
987
1122
|
* all non word / repeated characters
|
@@ -999,6 +1134,7 @@ var Utils;
|
|
999
1134
|
json.getAtrributies = (jsonDeepPath, // lodash path to property in json ex. deep.path.to.prop
|
1000
1135
|
fileContent) => {
|
1001
1136
|
const lines = fileContent.split('\n');
|
1137
|
+
// split path to parts but keep part if is for example 'sql.js
|
1002
1138
|
const pathParts = jsonDeepPath.split('.').reduce((a, b) => {
|
1003
1139
|
if (a.length === 0) {
|
1004
1140
|
return [b];
|
@@ -1013,6 +1149,8 @@ var Utils;
|
|
1013
1149
|
}
|
1014
1150
|
return a;
|
1015
1151
|
}, []);
|
1152
|
+
// console.log({ pathParts });
|
1153
|
+
// const pathParts = jsonDeepPath.split('.');
|
1016
1154
|
const keyName = pathParts.pop().replace(/^\["(.+)"\]$/, '$1');
|
1017
1155
|
let currentPath = '';
|
1018
1156
|
let attributes = [];
|
@@ -1020,21 +1158,34 @@ var Utils;
|
|
1020
1158
|
for (const line of lines) {
|
1021
1159
|
const trimmedLine = line.trim();
|
1022
1160
|
if (trimmedLine.startsWith('//')) {
|
1161
|
+
// Collect comments
|
1023
1162
|
collectedComments.push(trimmedLine);
|
1163
|
+
// trimmedLine.startsWith('//pizda') &&
|
1164
|
+
// console.log('pushlin line', { trimmedLine });
|
1024
1165
|
}
|
1025
1166
|
else if (trimmedLine.startsWith('"') || trimmedLine.startsWith("'")) {
|
1167
|
+
// Extract the key from the line
|
1026
1168
|
const match = trimmedLine.match(/["']([^"']+)["']\s*:/);
|
1169
|
+
// console.log({ match0: match && match[0], match1: match && match[1] });
|
1027
1170
|
if (match) {
|
1028
1171
|
const key = match[1];
|
1029
1172
|
currentPath = currentPath
|
1030
1173
|
? `${currentPath}.${key.includes('.') ? `['${key}']` : key}`
|
1031
1174
|
: key;
|
1175
|
+
// console.log({ key });
|
1176
|
+
// Check if the current path matches the jsonDeepPath
|
1032
1177
|
if ((currentPath.endsWith(keyName) &&
|
1033
1178
|
!currentPath.endsWith('/' + keyName)) ||
|
1034
1179
|
currentPath.endsWith(`['${keyName}']`)) {
|
1180
|
+
// console.log('extract attributes', {
|
1181
|
+
// keyName,
|
1182
|
+
// collectedCommentsLength: collectedComments.length,
|
1183
|
+
// });
|
1184
|
+
// Process the collected comments to extract attributes
|
1035
1185
|
attributes = extractAttributesFromComments(collectedComments);
|
1036
1186
|
break;
|
1037
1187
|
}
|
1188
|
+
// Reset collected comments as they only relate to the next key
|
1038
1189
|
collectedComments = [];
|
1039
1190
|
}
|
1040
1191
|
}
|
@@ -1044,6 +1195,7 @@ var Utils;
|
|
1044
1195
|
const extractAttributesFromComments = (comments) => {
|
1045
1196
|
const attributes = [];
|
1046
1197
|
const attrRegex = /@(\w+)(?:\s*=\s*([^\s@]+))?/g;
|
1198
|
+
// console.log({ comments });
|
1047
1199
|
for (const comment of comments) {
|
1048
1200
|
let match;
|
1049
1201
|
while ((match = attrRegex.exec(comment)) !== null) {
|
@@ -1067,6 +1219,7 @@ var Utils;
|
|
1067
1219
|
}
|
1068
1220
|
}
|
1069
1221
|
}
|
1222
|
+
// Normalize single values not to be arrays
|
1070
1223
|
attributes.forEach(attr => {
|
1071
1224
|
if (Array.isArray(attr.value) && attr.value.length === 1) {
|
1072
1225
|
attr.value = attr.value[0];
|
@@ -1075,6 +1228,9 @@ var Utils;
|
|
1075
1228
|
return attributes;
|
1076
1229
|
};
|
1077
1230
|
})(json = Utils.json || (Utils.json = {}));
|
1231
|
+
//#endregion
|
1232
|
+
//#region binary
|
1233
|
+
//#region db binary format type
|
1078
1234
|
let DbBinaryFormatEnum;
|
1079
1235
|
(function (DbBinaryFormatEnum) {
|
1080
1236
|
DbBinaryFormatEnum["Blob"] = "Blob";
|
@@ -1085,8 +1241,11 @@ var Utils;
|
|
1085
1241
|
})(DbBinaryFormatEnum = Utils.DbBinaryFormatEnum || (Utils.DbBinaryFormatEnum = {}));
|
1086
1242
|
/* */
|
1087
1243
|
/* */
|
1244
|
+
//#endregion
|
1088
1245
|
let binary;
|
1089
1246
|
(function (binary) {
|
1247
|
+
//#region binay utils / array buffer to blob
|
1248
|
+
//#region @browser
|
1090
1249
|
/**
|
1091
1250
|
* This is for BROWSER ONLY
|
1092
1251
|
*
|
@@ -1099,6 +1258,9 @@ var Utils;
|
|
1099
1258
|
return new Blob$1([buffer], { type: contentType });
|
1100
1259
|
}
|
1101
1260
|
binary.arrayBufferToBlob = arrayBufferToBlob;
|
1261
|
+
//#endregion
|
1262
|
+
//#endregion
|
1263
|
+
//#region binay utils / blob to array buffer
|
1102
1264
|
/**
|
1103
1265
|
* This is for BROWSER ONLY
|
1104
1266
|
* @param blob
|
@@ -1115,6 +1277,8 @@ var Utils;
|
|
1115
1277
|
});
|
1116
1278
|
}
|
1117
1279
|
binary.blobToArrayBuffer = blobToArrayBuffer;
|
1280
|
+
//#endregion
|
1281
|
+
//#region binay utils / blob to base64 string
|
1118
1282
|
/**
|
1119
1283
|
* it is revers to base64toBlob
|
1120
1284
|
* @param blob
|
@@ -1128,6 +1292,8 @@ var Utils;
|
|
1128
1292
|
});
|
1129
1293
|
}
|
1130
1294
|
binary.blobToBase64 = blobToBase64;
|
1295
|
+
//#endregion
|
1296
|
+
//#region binay utils / base64 string to blob
|
1131
1297
|
/**
|
1132
1298
|
* it is revers to blobToBase64()
|
1133
1299
|
* @param base64Data
|
@@ -1141,6 +1307,7 @@ var Utils;
|
|
1141
1307
|
if (!m) {
|
1142
1308
|
throw new Error(`[taon-framework][base64toBlob] Not a base64 blob [${base64Data}]`);
|
1143
1309
|
}
|
1310
|
+
// tslint:disable-next-line:prefer-const
|
1144
1311
|
var [__, contenttype, filebase64] = m;
|
1145
1312
|
content_type = contenttype;
|
1146
1313
|
file_base64 = filebase64;
|
@@ -1156,6 +1323,7 @@ var Utils;
|
|
1156
1323
|
const begin = sliceIndex * sliceSize;
|
1157
1324
|
const end = Math.min(begin + sliceSize, bytesLength);
|
1158
1325
|
const bytes = new Array(end - begin);
|
1326
|
+
// tslint:disable-next-line:one-variable-per-declaration
|
1159
1327
|
for (let offset = begin, i = 0; offset < end; ++i, ++offset) {
|
1160
1328
|
bytes[i] = byteCharacters[offset].charCodeAt(0);
|
1161
1329
|
}
|
@@ -1164,8 +1332,11 @@ var Utils;
|
|
1164
1332
|
return new Blob$1(byteArrays, { type: content_type });
|
1165
1333
|
}
|
1166
1334
|
binary.base64toBlob = base64toBlob;
|
1335
|
+
//#endregion
|
1336
|
+
//#region binay utils / base64 string to db binary format
|
1167
1337
|
async function base64toDbBinaryFormat(text) {
|
1168
1338
|
let result;
|
1339
|
+
//#region @browser
|
1169
1340
|
result = await (async () => {
|
1170
1341
|
if (BLOB_SUPPORTED_IN_SQLJS) {
|
1171
1342
|
const blob = await base64toBlob(text);
|
@@ -1173,6 +1344,7 @@ var Utils;
|
|
1173
1344
|
}
|
1174
1345
|
return text;
|
1175
1346
|
})();
|
1347
|
+
//#endregion
|
1176
1348
|
/* */
|
1177
1349
|
/* */
|
1178
1350
|
/* */
|
@@ -1181,8 +1353,11 @@ var Utils;
|
|
1181
1353
|
return result;
|
1182
1354
|
}
|
1183
1355
|
binary.base64toDbBinaryFormat = base64toDbBinaryFormat;
|
1356
|
+
//#endregion
|
1357
|
+
//#region binay utils / db binary format to base64 string
|
1184
1358
|
async function dbBinaryFormatToBase64(binaryFormat) {
|
1185
1359
|
let result;
|
1360
|
+
//#region @browser
|
1186
1361
|
result = await (async () => {
|
1187
1362
|
if (BLOB_SUPPORTED_IN_SQLJS) {
|
1188
1363
|
const text = await blobToBase64(binaryFormat);
|
@@ -1190,6 +1365,7 @@ var Utils;
|
|
1190
1365
|
}
|
1191
1366
|
return binaryFormat;
|
1192
1367
|
})();
|
1368
|
+
//#endregion
|
1193
1369
|
/* */
|
1194
1370
|
/* */
|
1195
1371
|
/* */
|
@@ -1198,8 +1374,11 @@ var Utils;
|
|
1198
1374
|
return result;
|
1199
1375
|
}
|
1200
1376
|
binary.dbBinaryFormatToBase64 = dbBinaryFormatToBase64;
|
1377
|
+
//#endregion
|
1378
|
+
//#region binay utils / base64 string to db binary format
|
1201
1379
|
async function textToDbBinaryFormat(text) {
|
1202
1380
|
let result;
|
1381
|
+
//#region @browser
|
1203
1382
|
result = await (async () => {
|
1204
1383
|
if (BLOB_SUPPORTED_IN_SQLJS) {
|
1205
1384
|
const blob = await textToBlob(text);
|
@@ -1207,6 +1386,7 @@ var Utils;
|
|
1207
1386
|
}
|
1208
1387
|
return text;
|
1209
1388
|
})();
|
1389
|
+
//#endregion
|
1210
1390
|
/* */
|
1211
1391
|
/* */
|
1212
1392
|
/* */
|
@@ -1215,8 +1395,11 @@ var Utils;
|
|
1215
1395
|
return result;
|
1216
1396
|
}
|
1217
1397
|
binary.textToDbBinaryFormat = textToDbBinaryFormat;
|
1398
|
+
//#endregion
|
1399
|
+
//#region binay utils / db binary format to base64 string
|
1218
1400
|
async function dbBinaryFormatToText(binaryFormat) {
|
1219
1401
|
let result;
|
1402
|
+
//#region @browser
|
1220
1403
|
result = await (async () => {
|
1221
1404
|
if (BLOB_SUPPORTED_IN_SQLJS) {
|
1222
1405
|
const text = await blobToText(binaryFormat);
|
@@ -1224,6 +1407,7 @@ var Utils;
|
|
1224
1407
|
}
|
1225
1408
|
return binaryFormat;
|
1226
1409
|
})();
|
1410
|
+
//#endregion
|
1227
1411
|
/* */
|
1228
1412
|
/* */
|
1229
1413
|
/* */
|
@@ -1232,6 +1416,8 @@ var Utils;
|
|
1232
1416
|
return result;
|
1233
1417
|
}
|
1234
1418
|
binary.dbBinaryFormatToText = dbBinaryFormatToText;
|
1419
|
+
//#endregion
|
1420
|
+
//#region binay utils / base64 string to nodejs buffer
|
1235
1421
|
/* */
|
1236
1422
|
/* */
|
1237
1423
|
/* */
|
@@ -1241,18 +1427,24 @@ var Utils;
|
|
1241
1427
|
/* */
|
1242
1428
|
/* */
|
1243
1429
|
/* */
|
1430
|
+
//#endregion
|
1431
|
+
//#region binay utils / nodejs buffer to base64 string
|
1244
1432
|
/* */
|
1245
1433
|
/* */
|
1246
1434
|
/* */
|
1247
1435
|
/* */
|
1248
1436
|
/* */
|
1249
1437
|
/* */
|
1438
|
+
//#endregion
|
1439
|
+
//#region binay utils / file to blob
|
1250
1440
|
async function fileToBlob(file) {
|
1251
1441
|
return new Blob$1([new Uint8Array(await file.arrayBuffer())], {
|
1252
1442
|
type: file.type,
|
1253
1443
|
});
|
1254
1444
|
}
|
1255
1445
|
binary.fileToBlob = fileToBlob;
|
1446
|
+
//#endregion
|
1447
|
+
//#region binay utils / blob to file
|
1256
1448
|
async function blobToFile(blob, nameForFile = 'my-file-name') {
|
1257
1449
|
if (!nameForFile) {
|
1258
1450
|
nameForFile = 'nonamefile' + new Date().getTime();
|
@@ -1261,17 +1453,23 @@ var Utils;
|
|
1261
1453
|
return new File([blob], nameForFile);
|
1262
1454
|
}
|
1263
1455
|
binary.blobToFile = blobToFile;
|
1456
|
+
//#endregion
|
1457
|
+
//#region binay utils / nodejs blob to nodejs buffer
|
1264
1458
|
/* */
|
1265
1459
|
/* */
|
1266
1460
|
/* */
|
1267
1461
|
/* */
|
1268
1462
|
/* */
|
1269
1463
|
/* */
|
1464
|
+
//#endregion
|
1465
|
+
//#region binay utils / nodejs buffer to nodejs blob
|
1270
1466
|
/* */
|
1271
1467
|
/* */
|
1272
1468
|
/* */
|
1273
1469
|
/* */
|
1274
1470
|
/* */
|
1471
|
+
//#endregion
|
1472
|
+
//#region binay utils / text to nodejs buffer
|
1275
1473
|
/* */
|
1276
1474
|
/* */
|
1277
1475
|
/* */
|
@@ -1281,33 +1479,51 @@ var Utils;
|
|
1281
1479
|
/* */
|
1282
1480
|
/* */
|
1283
1481
|
/* */
|
1482
|
+
//#endregion
|
1483
|
+
//#region binay utils / nodejs buffer to text
|
1284
1484
|
/* */
|
1285
1485
|
/* */
|
1286
1486
|
/* */
|
1287
1487
|
/* */
|
1288
1488
|
/* */
|
1289
1489
|
/* */
|
1490
|
+
//#endregion
|
1491
|
+
//#region binay utils / text to blob
|
1290
1492
|
async function textToBlob(text, type = 'text/plain') {
|
1291
1493
|
const blob = new Blob$1([text], { type });
|
1292
1494
|
return blob;
|
1293
1495
|
}
|
1294
1496
|
binary.textToBlob = textToBlob;
|
1497
|
+
//#endregion
|
1498
|
+
//#region binay utils / blob to text
|
1295
1499
|
async function blobToText(blob) {
|
1296
1500
|
return await blob.text();
|
1297
1501
|
}
|
1298
1502
|
binary.blobToText = blobToText;
|
1503
|
+
//#endregion
|
1504
|
+
//#region binay utils / text to file
|
1299
1505
|
async function textToFile(text, fileRelativePathOrName) {
|
1506
|
+
// console.log({ path })
|
1300
1507
|
const ext = path.extname(fileRelativePathOrName);
|
1301
1508
|
const type = CoreModels.mimeTypes[ext];
|
1302
1509
|
const blob = new Blob$1([text], { type });
|
1303
1510
|
const file = await blobToFile(blob, fileRelativePathOrName);
|
1511
|
+
// console.log({
|
1512
|
+
// ext,
|
1513
|
+
// blob, file
|
1514
|
+
// });
|
1515
|
+
// debugger
|
1304
1516
|
return file;
|
1305
1517
|
}
|
1306
1518
|
binary.textToFile = textToFile;
|
1519
|
+
//#endregion
|
1520
|
+
//#region binay utils / file to text
|
1307
1521
|
async function fileToText(file) {
|
1308
1522
|
return await file.text();
|
1309
1523
|
}
|
1310
1524
|
binary.fileToText = fileToText;
|
1525
|
+
//#endregion
|
1526
|
+
//#region binay utils / json to blob
|
1311
1527
|
async function jsonToBlob(jsonObj) {
|
1312
1528
|
const blob = new Blob$1([JSON.stringify(jsonObj, null, 2)], {
|
1313
1529
|
type: 'application/json',
|
@@ -1315,6 +1531,8 @@ var Utils;
|
|
1315
1531
|
return blob;
|
1316
1532
|
}
|
1317
1533
|
binary.jsonToBlob = jsonToBlob;
|
1534
|
+
//#endregion
|
1535
|
+
//#region binay utils / blob to json
|
1318
1536
|
/**
|
1319
1537
|
* TODO NOT TESTED
|
1320
1538
|
*/
|
@@ -1322,6 +1540,8 @@ var Utils;
|
|
1322
1540
|
return JSON.parse(await blob.text());
|
1323
1541
|
}
|
1324
1542
|
binary.blobToJson = blobToJson;
|
1543
|
+
//#endregion
|
1544
|
+
//#region binay utils / get blob from url
|
1325
1545
|
async function getBlobFrom(url) {
|
1326
1546
|
const response = await axios({
|
1327
1547
|
url,
|
@@ -1331,27 +1551,40 @@ var Utils;
|
|
1331
1551
|
return response.data;
|
1332
1552
|
}
|
1333
1553
|
binary.getBlobFrom = getBlobFrom;
|
1554
|
+
//#endregion
|
1334
1555
|
})(binary = Utils.binary || (Utils.binary = {}));
|
1556
|
+
//#endregion
|
1557
|
+
//#region css
|
1335
1558
|
let css;
|
1336
1559
|
(function (css) {
|
1560
|
+
//#region css utils / numeric value of pixels
|
1337
1561
|
/**
|
1338
1562
|
*
|
1339
1563
|
* @param pixelsCss pixels ex. 100px
|
1340
1564
|
* @returns
|
1341
1565
|
*/
|
1342
1566
|
function numValue(pixelsCss) {
|
1567
|
+
// tslint:disable-next-line:radix
|
1343
1568
|
return parseInt(pixelsCss?.toString()?.replace('px', ''));
|
1344
1569
|
}
|
1345
1570
|
css.numValue = numValue;
|
1571
|
+
//#endregion
|
1346
1572
|
})(css = Utils.css || (Utils.css = {}));
|
1573
|
+
//#endregion
|
1347
1574
|
})(Utils || (Utils = {}));
|
1575
|
+
//#endregion
|
1576
|
+
//#region utils process
|
1348
1577
|
var UtilsProcess;
|
1349
1578
|
(function (UtilsProcess) {
|
1579
|
+
//#endregion
|
1580
|
+
//#region utils process / TODO start async
|
1350
1581
|
/**
|
1351
1582
|
* TODO IMPLEMENT
|
1352
1583
|
* start async node process
|
1353
1584
|
*/
|
1354
|
-
UtilsProcess.startAsync = async (command, cwd,
|
1585
|
+
UtilsProcess.startAsync = async (command, cwd,
|
1586
|
+
// options?: ProcessStartOptions, // TODO change to this
|
1587
|
+
options) => {
|
1355
1588
|
/* */
|
1356
1589
|
/* */
|
1357
1590
|
/* */
|
@@ -1639,6 +1872,16 @@ var UtilsProcess;
|
|
1639
1872
|
/* */
|
1640
1873
|
return (void 0);
|
1641
1874
|
};
|
1875
|
+
//#endregion
|
1876
|
+
//#region utils process / TODO start sync
|
1877
|
+
// /**
|
1878
|
+
// * TODO IMPLEMENT
|
1879
|
+
// */
|
1880
|
+
// export function startSync(command: string, options?: ProcessStartOptions) {
|
1881
|
+
// TODO @LAST
|
1882
|
+
// }
|
1883
|
+
//#endregion
|
1884
|
+
//#region utils process / start async child process command until
|
1642
1885
|
/**
|
1643
1886
|
* This let you start child process and resolve promise when some
|
1644
1887
|
* condition is met. It is useful for example when you want to start
|
@@ -1712,6 +1955,8 @@ var UtilsProcess;
|
|
1712
1955
|
/* */
|
1713
1956
|
return (void 0);
|
1714
1957
|
};
|
1958
|
+
//#endregion
|
1959
|
+
//#region utils process / get git bash path
|
1715
1960
|
UtilsProcess.getGitBashPath = () => {
|
1716
1961
|
/* */
|
1717
1962
|
/* */
|
@@ -1733,6 +1978,8 @@ var UtilsProcess;
|
|
1733
1978
|
/* */
|
1734
1979
|
return (void 0);
|
1735
1980
|
};
|
1981
|
+
//#endregion
|
1982
|
+
//#region utils process / start process in new graphical terminal window
|
1736
1983
|
/**
|
1737
1984
|
* TODO IMPLEMENT
|
1738
1985
|
* start async node process
|
@@ -1849,8 +2096,12 @@ var UtilsProcess;
|
|
1849
2096
|
/* */
|
1850
2097
|
return (void 0);
|
1851
2098
|
};
|
2099
|
+
//#endregion
|
2100
|
+
//#region utils process / get bash or shell name
|
1852
2101
|
UtilsProcess.getBashOrShellName = () => {
|
2102
|
+
//#region @browser
|
1853
2103
|
return 'browser';
|
2104
|
+
//#endregion
|
1854
2105
|
/* */
|
1855
2106
|
/* */
|
1856
2107
|
/* */
|
@@ -1885,6 +2136,7 @@ var UtilsProcess;
|
|
1885
2136
|
/* */
|
1886
2137
|
return (void 0);
|
1887
2138
|
};
|
2139
|
+
//#endregion
|
1888
2140
|
/**
|
1889
2141
|
* Get CPU and memory usage for a single PID.
|
1890
2142
|
*/
|
@@ -2004,8 +2256,11 @@ var UtilsProcess;
|
|
2004
2256
|
return (void 0);
|
2005
2257
|
};
|
2006
2258
|
})(UtilsProcess || (UtilsProcess = {}));
|
2259
|
+
//#endregion
|
2260
|
+
//#region utils os
|
2007
2261
|
var UtilsOs;
|
2008
2262
|
(function (UtilsOs) {
|
2263
|
+
//#region utils os / is running in browser
|
2009
2264
|
/**
|
2010
2265
|
* check if script is running in client browser
|
2011
2266
|
* (websql model -> is also considered as browser
|
@@ -2016,6 +2271,8 @@ var UtilsOs;
|
|
2016
2271
|
/* */
|
2017
2272
|
return true;
|
2018
2273
|
};
|
2274
|
+
//#endregion
|
2275
|
+
//#region utils os / is running in node
|
2019
2276
|
/**
|
2020
2277
|
* check if script is running in nodejs
|
2021
2278
|
* (backend script or electron script)
|
@@ -2025,6 +2282,8 @@ var UtilsOs;
|
|
2025
2282
|
/* */
|
2026
2283
|
return false;
|
2027
2284
|
};
|
2285
|
+
//#endregion
|
2286
|
+
//#region utils os / is running in websql
|
2028
2287
|
/**
|
2029
2288
|
* check if script is running special
|
2030
2289
|
* browser mode that has sql.js backend
|
@@ -2033,14 +2292,19 @@ var UtilsOs;
|
|
2033
2292
|
UtilsOs.isRunningInWebSQL = () => {
|
2034
2293
|
/* */
|
2035
2294
|
/* */
|
2295
|
+
//#region @websqlOnly
|
2036
2296
|
return true;
|
2297
|
+
//#endregion
|
2037
2298
|
return false;
|
2038
2299
|
};
|
2300
|
+
//#endregion
|
2301
|
+
//#region utils os / is running in electron
|
2039
2302
|
/**
|
2040
2303
|
* check whether the current process is running inside
|
2041
2304
|
* Electron backend or browser.
|
2042
2305
|
*/
|
2043
2306
|
UtilsOs.isRunningInElectron = () => {
|
2307
|
+
// Renderer process
|
2044
2308
|
// @ts-ignore
|
2045
2309
|
if (typeof window !== 'undefined' &&
|
2046
2310
|
typeof window.process === 'object' &&
|
@@ -2048,12 +2312,14 @@ var UtilsOs;
|
|
2048
2312
|
window.process.type === 'renderer') {
|
2049
2313
|
return true;
|
2050
2314
|
}
|
2315
|
+
// Main process
|
2051
2316
|
// @ts-ignore
|
2052
2317
|
if (typeof process !== 'undefined' &&
|
2053
2318
|
typeof process.versions === 'object' &&
|
2054
2319
|
!!process.versions.electron) {
|
2055
2320
|
return true;
|
2056
2321
|
}
|
2322
|
+
// Detect the user agent when the `nodeIntegration` option is set to false
|
2057
2323
|
if (typeof navigator === 'object' &&
|
2058
2324
|
typeof navigator.userAgent === 'string' &&
|
2059
2325
|
navigator.userAgent.indexOf('Electron') >= 0) {
|
@@ -2061,6 +2327,8 @@ var UtilsOs;
|
|
2061
2327
|
}
|
2062
2328
|
return false;
|
2063
2329
|
};
|
2330
|
+
//#endregion
|
2331
|
+
//#region utils os / is running in vscode extension
|
2064
2332
|
/**
|
2065
2333
|
* Check whether the current process is running inside
|
2066
2334
|
* a Visual Studio Code extension.
|
@@ -2076,12 +2344,16 @@ var UtilsOs;
|
|
2076
2344
|
/* */
|
2077
2345
|
return (void 0);
|
2078
2346
|
};
|
2347
|
+
//#endregion
|
2348
|
+
//#region utils os / is running in wsl
|
2079
2349
|
/**
|
2080
2350
|
* Check wether the current process is running inside
|
2081
2351
|
* windows subsystem for linux (WSL).
|
2082
2352
|
*/
|
2083
2353
|
UtilsOs.isRunningInWsl = () => {
|
2354
|
+
//#region @browser
|
2084
2355
|
return false;
|
2356
|
+
//#endregion
|
2085
2357
|
/* */
|
2086
2358
|
/* */
|
2087
2359
|
/* */
|
@@ -2101,6 +2373,8 @@ var UtilsOs;
|
|
2101
2373
|
/* */
|
2102
2374
|
return (void 0);
|
2103
2375
|
};
|
2376
|
+
//#endregion
|
2377
|
+
//#region utils os / is running in windows / powershell / cmd
|
2104
2378
|
const getProcessTree = () => {
|
2105
2379
|
/* */
|
2106
2380
|
/* */
|
@@ -2159,8 +2433,12 @@ var UtilsOs;
|
|
2159
2433
|
UtilsOs.isRunningInWindowsCmd = () => {
|
2160
2434
|
return findAncestorProcessName(['cmd.exe']) !== undefined;
|
2161
2435
|
};
|
2436
|
+
//#endregion
|
2437
|
+
//#region utils os / is running in docker
|
2162
2438
|
UtilsOs.isRunningInDocker = () => {
|
2439
|
+
//#region @browser
|
2163
2440
|
return false;
|
2441
|
+
//#endregion
|
2164
2442
|
/* */
|
2165
2443
|
/* */
|
2166
2444
|
/* */
|
@@ -2170,6 +2448,8 @@ var UtilsOs;
|
|
2170
2448
|
/* */
|
2171
2449
|
return (void 0);
|
2172
2450
|
};
|
2451
|
+
//#endregion
|
2452
|
+
//#region utils os / is running in linux graphics capable environment
|
2173
2453
|
UtilsOs.isRunningInLinuxGraphicsCapableEnvironment = () => {
|
2174
2454
|
/* */
|
2175
2455
|
/* */
|
@@ -2180,24 +2460,34 @@ var UtilsOs;
|
|
2180
2460
|
/* */
|
2181
2461
|
return (void 0);
|
2182
2462
|
};
|
2463
|
+
//#endregion
|
2464
|
+
//#region utils os / is running in cli mode
|
2183
2465
|
/**
|
2184
2466
|
* Check whether the current process is running in CLI mode.
|
2185
2467
|
*/
|
2186
2468
|
UtilsOs.isRunningInCliMode = () => {
|
2469
|
+
//#region @browser
|
2187
2470
|
return false;
|
2471
|
+
//#endregion
|
2188
2472
|
/* */
|
2189
2473
|
/* */
|
2190
2474
|
return (void 0);
|
2191
2475
|
};
|
2476
|
+
//#endregion
|
2477
|
+
//#region utils os / is running in mocha test
|
2192
2478
|
/**
|
2193
2479
|
* Check whether the current process is running in mocha test.
|
2194
2480
|
*/
|
2195
2481
|
UtilsOs.isRunningInMochaTest = () => {
|
2482
|
+
//#region @browser
|
2196
2483
|
return false;
|
2484
|
+
//#endregion
|
2197
2485
|
/* */
|
2198
2486
|
/* */
|
2199
2487
|
return (void 0);
|
2200
2488
|
};
|
2489
|
+
//#endregion
|
2490
|
+
//#region utils os / is port in use
|
2201
2491
|
const isPortInUseOnHost = (port, host) => {
|
2202
2492
|
/* */
|
2203
2493
|
/* */
|
@@ -2248,16 +2538,26 @@ var UtilsOs;
|
|
2248
2538
|
/* */
|
2249
2539
|
return (void 0);
|
2250
2540
|
};
|
2541
|
+
//#endregion
|
2251
2542
|
})(UtilsOs || (UtilsOs = {}));
|
2543
|
+
//#endregion
|
2544
|
+
//#region utils string
|
2252
2545
|
var UtilsString;
|
2253
2546
|
(function (UtilsString) {
|
2547
|
+
//#region utils string / kebab case no split numbers
|
2254
2548
|
UtilsString.kebabCaseNoSplitNumbers = (input) => {
|
2255
2549
|
return (input
|
2550
|
+
// Match spaces or any kind of whitespace and replace with a hyphen
|
2256
2551
|
.replace(/\s+/g, '-')
|
2552
|
+
// Match uppercase letters and replace them with a hyphen and the lowercase version of the letter
|
2257
2553
|
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
2554
|
+
// Convert everything to lowercase
|
2258
2555
|
.toLowerCase());
|
2259
2556
|
};
|
2557
|
+
//#endregion
|
2260
2558
|
})(UtilsString || (UtilsString = {}));
|
2559
|
+
//#endregion
|
2560
|
+
//#region utils migrations
|
2261
2561
|
/**
|
2262
2562
|
* Taon migration utilities
|
2263
2563
|
*/
|
@@ -2265,6 +2565,7 @@ var UtilsMigrations;
|
|
2265
2565
|
(function (UtilsMigrations) {
|
2266
2566
|
UtilsMigrations.getTimestampFromClassName = (className) => {
|
2267
2567
|
const [maybeTimestamp1, maybeTimestamp2] = className.split('_') || [];
|
2568
|
+
// console.log({ maybeTimestamp1, maybeTimestamp2 });
|
2268
2569
|
const timestamp1 = parseInt(maybeTimestamp1);
|
2269
2570
|
const timestamp2 = parseInt(maybeTimestamp2);
|
2270
2571
|
const timestamp = !_.isNaN(timestamp1) ? timestamp1 : timestamp2;
|
@@ -2290,8 +2591,12 @@ var UtilsMigrations;
|
|
2290
2591
|
return value >= minTimestamp && value <= maxTimestamp;
|
2291
2592
|
};
|
2292
2593
|
})(UtilsMigrations || (UtilsMigrations = {}));
|
2594
|
+
//#endregion
|
2595
|
+
//#region utils terminal
|
2293
2596
|
var UtilsTerminal;
|
2294
2597
|
(function (UtilsTerminal) {
|
2598
|
+
//#endregion
|
2599
|
+
//#region wait
|
2295
2600
|
UtilsTerminal.wait = (second) => {
|
2296
2601
|
return new Promise((resolve, reject) => {
|
2297
2602
|
setTimeout(() => {
|
@@ -2299,6 +2604,8 @@ var UtilsTerminal;
|
|
2299
2604
|
}, second * 1000);
|
2300
2605
|
});
|
2301
2606
|
};
|
2607
|
+
//#endregion
|
2608
|
+
//#region clear
|
2302
2609
|
UtilsTerminal.clearConsole = () => {
|
2303
2610
|
/* */
|
2304
2611
|
/* */
|
@@ -2313,6 +2620,8 @@ var UtilsTerminal;
|
|
2313
2620
|
/* */
|
2314
2621
|
return (void 0);
|
2315
2622
|
};
|
2623
|
+
//#endregion
|
2624
|
+
//#region transform choices
|
2316
2625
|
const transformChoices = (choices) => {
|
2317
2626
|
/* */
|
2318
2627
|
/* */
|
@@ -2333,6 +2642,8 @@ var UtilsTerminal;
|
|
2333
2642
|
/* */
|
2334
2643
|
return (void 0);
|
2335
2644
|
};
|
2645
|
+
//#endregion
|
2646
|
+
//#region multiselect
|
2336
2647
|
UtilsTerminal.multiselect = async (options) => {
|
2337
2648
|
/* */
|
2338
2649
|
/* */
|
@@ -2418,6 +2729,8 @@ var UtilsTerminal;
|
|
2418
2729
|
/* */
|
2419
2730
|
return (void 0);
|
2420
2731
|
};
|
2732
|
+
//#endregion
|
2733
|
+
//#region select and execute
|
2421
2734
|
/**
|
2422
2735
|
* Similar to select but executes action if provided
|
2423
2736
|
* @returns selected and executed value
|
@@ -2465,6 +2778,8 @@ var UtilsTerminal;
|
|
2465
2778
|
/* */
|
2466
2779
|
return (void 0);
|
2467
2780
|
};
|
2781
|
+
//#endregion
|
2782
|
+
//#region select and execute
|
2468
2783
|
/**
|
2469
2784
|
* Similar to select but executes action if provided
|
2470
2785
|
* @returns selected and executed value
|
@@ -2507,6 +2822,8 @@ var UtilsTerminal;
|
|
2507
2822
|
/* */
|
2508
2823
|
return (void 0);
|
2509
2824
|
};
|
2825
|
+
//#endregion
|
2826
|
+
//#region select
|
2510
2827
|
UtilsTerminal.select = async (options) => {
|
2511
2828
|
/* */
|
2512
2829
|
/* */
|
@@ -2570,11 +2887,15 @@ var UtilsTerminal;
|
|
2570
2887
|
/* */
|
2571
2888
|
return (void 0);
|
2572
2889
|
};
|
2890
|
+
//#endregion
|
2891
|
+
//#region pipe enter to stdin
|
2573
2892
|
UtilsTerminal.pipeEnterToStdin = () => {
|
2574
2893
|
/* */
|
2575
2894
|
/* */
|
2576
2895
|
return (void 0);
|
2577
2896
|
};
|
2897
|
+
//#endregion
|
2898
|
+
//#region input
|
2578
2899
|
UtilsTerminal.input = async ({ defaultValue, question, required, // TODO something is werid with required
|
2579
2900
|
}) => {
|
2580
2901
|
/* */
|
@@ -2595,6 +2916,8 @@ var UtilsTerminal;
|
|
2595
2916
|
/* */
|
2596
2917
|
return (void 0);
|
2597
2918
|
};
|
2919
|
+
//#endregion
|
2920
|
+
//#region confirm
|
2598
2921
|
UtilsTerminal.confirm = async (options) => {
|
2599
2922
|
/* */
|
2600
2923
|
/* */
|
@@ -2677,6 +3000,8 @@ var UtilsTerminal;
|
|
2677
3000
|
/* */
|
2678
3001
|
return (void 0);
|
2679
3002
|
};
|
3003
|
+
//#endregion
|
3004
|
+
//#region press any key to continue
|
2680
3005
|
UtilsTerminal.pressAnyKeyToContinueAsync = (options) => {
|
2681
3006
|
/* */
|
2682
3007
|
/* */
|
@@ -2698,6 +3023,8 @@ var UtilsTerminal;
|
|
2698
3023
|
/* */
|
2699
3024
|
return (void 0);
|
2700
3025
|
};
|
3026
|
+
//#endregion
|
3027
|
+
//#region press any key
|
2701
3028
|
/**
|
2702
3029
|
* @deprecated use UtilsTerminal.pressAnyKeyToContinueAsync()
|
2703
3030
|
*/
|
@@ -2731,6 +3058,8 @@ var UtilsTerminal;
|
|
2731
3058
|
/* */
|
2732
3059
|
return (void 0);
|
2733
3060
|
};
|
3061
|
+
//#endregion
|
3062
|
+
//#region preview long list as select
|
2734
3063
|
UtilsTerminal.previewLongList = async (list, listName = 'List') => {
|
2735
3064
|
/* */
|
2736
3065
|
/* */
|
@@ -2751,6 +3080,8 @@ var UtilsTerminal;
|
|
2751
3080
|
/* */
|
2752
3081
|
return (void 0);
|
2753
3082
|
};
|
3083
|
+
//#endregion
|
3084
|
+
//#region preview long list with 'less' (git log like)
|
2754
3085
|
/**
|
2755
3086
|
* Displays a long list in the console using a pager like `less`.
|
2756
3087
|
* Returns a Promise that resolves when the user exits the pager.
|
@@ -2785,9 +3116,9 @@ var UtilsTerminal;
|
|
2785
3116
|
/* */
|
2786
3117
|
return (void 0);
|
2787
3118
|
};
|
3119
|
+
//#endregion
|
2788
3120
|
})(UtilsTerminal || (UtilsTerminal = {}));
|
2789
|
-
|
2790
|
-
({}); // @--end-of-file-for-module=tnp-core lib/utils.ts
|
3121
|
+
//#endregion
|
2791
3122
|
|
2792
3123
|
class HelpersIsomorphic {
|
2793
3124
|
/**
|
@@ -2837,9 +3168,8 @@ class HelpersIsomorphic {
|
|
2837
3168
|
}).length > 0);
|
2838
3169
|
}
|
2839
3170
|
}
|
2840
|
-
;
|
2841
|
-
({}); // @--end-of-file-for-module=tnp-core lib/helpers-isomorphic.ts
|
2842
3171
|
|
3172
|
+
// TODO handle global.testMode ?
|
2843
3173
|
const KEY = {
|
2844
3174
|
LAST_ERROR: Symbol(),
|
2845
3175
|
LAST_INFO: Symbol(),
|
@@ -2889,12 +3219,16 @@ const KEY_IMPORTANTCE = {
|
|
2889
3219
|
/* */
|
2890
3220
|
/* */
|
2891
3221
|
const LIMIT = 10;
|
3222
|
+
//#region transformData
|
2892
3223
|
/**
|
2893
3224
|
* @param details any data to be transformed
|
2894
3225
|
* @returns string ready to be displayed
|
2895
3226
|
*/
|
2896
3227
|
const transformData = (details) => {
|
2897
3228
|
if (typeof details === 'object') {
|
3229
|
+
// if (Array.isArray(details)) {
|
3230
|
+
// return details.join('\n');
|
3231
|
+
// }
|
2898
3232
|
try {
|
2899
3233
|
const json = JSON.stringify(details, null, 2);
|
2900
3234
|
details = json;
|
@@ -2905,6 +3239,7 @@ const transformData = (details) => {
|
|
2905
3239
|
}
|
2906
3240
|
return details;
|
2907
3241
|
};
|
3242
|
+
//#endregion
|
2908
3243
|
class HelpersMessages extends HelpersIsomorphic {
|
2909
3244
|
msgCacheClear() {
|
2910
3245
|
/* */
|
@@ -2915,6 +3250,7 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
2915
3250
|
}
|
2916
3251
|
renderError(err) {
|
2917
3252
|
if (this.isBrowser) {
|
3253
|
+
// TODO for FE
|
2918
3254
|
console.error(err);
|
2919
3255
|
}
|
2920
3256
|
else {
|
@@ -2941,9 +3277,11 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
2941
3277
|
*/
|
2942
3278
|
stopApplication(details) {
|
2943
3279
|
if (this.isBrowser) {
|
3280
|
+
//#region @browser
|
2944
3281
|
document.body.innerHTML =
|
2945
3282
|
'<h1>Application has encountered an error and stopped.</h1>';
|
2946
3283
|
document.body.style.pointerEvents = 'none';
|
3284
|
+
//#endregion
|
2947
3285
|
/* */
|
2948
3286
|
/* */
|
2949
3287
|
/* */
|
@@ -2955,10 +3293,12 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
2955
3293
|
Helpers.error(error, true, true);
|
2956
3294
|
}
|
2957
3295
|
error(details, noExit = false, noTrace = false) {
|
3296
|
+
//#region browser mode
|
2958
3297
|
if (Helpers.isBrowser) {
|
2959
3298
|
console.error(details);
|
2960
3299
|
return;
|
2961
3300
|
}
|
3301
|
+
//#endregion
|
2962
3302
|
/* */
|
2963
3303
|
/* */
|
2964
3304
|
/* */
|
@@ -3010,6 +3350,8 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3010
3350
|
/* */
|
3011
3351
|
/* */
|
3012
3352
|
}
|
3353
|
+
//#endregion
|
3354
|
+
//#region info
|
3013
3355
|
info(details, repeatable = false) {
|
3014
3356
|
/* */
|
3015
3357
|
/* */
|
@@ -3056,6 +3398,8 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3056
3398
|
/* */
|
3057
3399
|
/* */
|
3058
3400
|
}
|
3401
|
+
//#endregion
|
3402
|
+
//#region info
|
3059
3403
|
success(details) {
|
3060
3404
|
if (Helpers.isBrowser) {
|
3061
3405
|
console.info(details);
|
@@ -3099,6 +3443,7 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3099
3443
|
/* */
|
3100
3444
|
/* */
|
3101
3445
|
}
|
3446
|
+
//#endregion
|
3102
3447
|
/**
|
3103
3448
|
*
|
3104
3449
|
* @param details
|
@@ -3158,6 +3503,7 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3158
3503
|
/* */
|
3159
3504
|
/* */
|
3160
3505
|
}
|
3506
|
+
//#endregion
|
3161
3507
|
taskDone(details, isLessImportant = false) {
|
3162
3508
|
if (Helpers.isBrowser) {
|
3163
3509
|
console.info(details);
|
@@ -3216,11 +3562,15 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3216
3562
|
/* */
|
3217
3563
|
/* */
|
3218
3564
|
}
|
3565
|
+
//#endregion
|
3219
3566
|
get isVerboseMode() {
|
3567
|
+
//#region @browser
|
3220
3568
|
return true; // TODO what it means in browser
|
3569
|
+
//#endregion
|
3221
3570
|
/* */
|
3222
3571
|
/* */
|
3223
3572
|
}
|
3573
|
+
//#region log
|
3224
3574
|
/**
|
3225
3575
|
* log messages only available in verbose mode
|
3226
3576
|
*/
|
@@ -3280,6 +3630,7 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3280
3630
|
/* */
|
3281
3631
|
/* */
|
3282
3632
|
}
|
3633
|
+
//#endregion
|
3283
3634
|
/**
|
3284
3635
|
* Logs not visible in normal use of taon-cli
|
3285
3636
|
*/
|
@@ -3313,6 +3664,7 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3313
3664
|
/* */
|
3314
3665
|
return (void 0);
|
3315
3666
|
}
|
3667
|
+
//#endregion
|
3316
3668
|
/**
|
3317
3669
|
* Logs not visible in normal use of taon-cli
|
3318
3670
|
*/
|
@@ -3324,6 +3676,7 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3324
3676
|
/* */
|
3325
3677
|
return (void 0);
|
3326
3678
|
}
|
3679
|
+
//#region warn
|
3327
3680
|
warn(details, trace = false) {
|
3328
3681
|
if (Helpers.isBrowser) {
|
3329
3682
|
console.warn(details);
|
@@ -3383,9 +3736,8 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3383
3736
|
/* */
|
3384
3737
|
}
|
3385
3738
|
}
|
3386
|
-
;
|
3387
|
-
({}); // @--end-of-file-for-module=tnp-core lib/helpers-messages.ts
|
3388
3739
|
|
3740
|
+
//#region import
|
3389
3741
|
/* */
|
3390
3742
|
/* */
|
3391
3743
|
/* */
|
@@ -3403,11 +3755,17 @@ class HelpersMessages extends HelpersIsomorphic {
|
|
3403
3755
|
/* */
|
3404
3756
|
/* */
|
3405
3757
|
/* */
|
3758
|
+
//#region @browser
|
3406
3759
|
const encoding = 'utf8';
|
3407
3760
|
/* */
|
3408
3761
|
/* */
|
3409
3762
|
const WEBSQL_PROC_MOCK_PROCESSES_PID = {};
|
3410
3763
|
const WEBSQL_PROC_MOCK_PROCESSES_PPID = {};
|
3764
|
+
//#endregion
|
3765
|
+
// TODO UNCOMMENT
|
3766
|
+
// const globalProcessStdout = {};
|
3767
|
+
// const globalProcessStder = {};
|
3768
|
+
// const maxProcessHistoryLinesChekc = 20;
|
3411
3769
|
class HelpersCore extends HelpersMessages {
|
3412
3770
|
static get InstanceCore() {
|
3413
3771
|
if (!HelpersCore._instanceCore) {
|
@@ -3435,8 +3793,12 @@ class HelpersCore extends HelpersMessages {
|
|
3435
3793
|
/* */
|
3436
3794
|
/* */
|
3437
3795
|
/* */
|
3796
|
+
//#endregion
|
3797
|
+
//#region constructor
|
3438
3798
|
constructor() {
|
3439
3799
|
super();
|
3800
|
+
//#endregion
|
3801
|
+
//#region fields / getters
|
3440
3802
|
/* */
|
3441
3803
|
/* */
|
3442
3804
|
this.bigMaxBuffer = 2024 * 500;
|
@@ -3444,30 +3806,40 @@ class HelpersCore extends HelpersMessages {
|
|
3444
3806
|
/* */
|
3445
3807
|
/* */
|
3446
3808
|
}
|
3809
|
+
//#endregion
|
3810
|
+
//#region methods / is wsl
|
3447
3811
|
/**
|
3448
3812
|
* @deprecated use UtilsOs.isRunningInsideWsl()
|
3449
3813
|
*/
|
3450
3814
|
get isWsl() {
|
3451
3815
|
return UtilsOs.isRunningInWsl();
|
3452
3816
|
}
|
3817
|
+
//#endregion
|
3818
|
+
//#region methods / is running in docker
|
3453
3819
|
/**
|
3454
3820
|
* @deprecated use UtilsOs.isRunningInDocker
|
3455
3821
|
*/
|
3456
3822
|
isRunningInDocker() {
|
3457
3823
|
return UtilsOs.isRunningInDocker();
|
3458
3824
|
}
|
3825
|
+
//#endregion
|
3826
|
+
//#region methods / is running in docker
|
3459
3827
|
/**
|
3460
3828
|
* @deprecated use UtilsOs.isRunningInLinuxGraphicEnvironment
|
3461
3829
|
*/
|
3462
3830
|
isRunningInLinuxGraphicsCapableEnvironment() {
|
3463
3831
|
return UtilsOs.isRunningInLinuxGraphicsCapableEnvironment();
|
3464
3832
|
}
|
3833
|
+
//#endregion
|
3834
|
+
//#region clear console
|
3465
3835
|
/**
|
3466
3836
|
* @deprecated use UtilsTerminal.clearConsole
|
3467
3837
|
*/
|
3468
3838
|
clearConsole() {
|
3469
3839
|
return UtilsTerminal.clearConsole();
|
3470
3840
|
}
|
3841
|
+
//#endregion
|
3842
|
+
//#region methods / electron ipc renderer
|
3471
3843
|
/**
|
3472
3844
|
* @deprecated
|
3473
3845
|
* get electron browser ipc renderer
|
@@ -3475,11 +3847,17 @@ class HelpersCore extends HelpersMessages {
|
|
3475
3847
|
get ipcRenderer() {
|
3476
3848
|
/* */
|
3477
3849
|
/* */
|
3850
|
+
//#region @browser
|
3478
3851
|
if (!this.isElectron) {
|
3479
3852
|
return;
|
3480
3853
|
}
|
3481
3854
|
return void 0;
|
3855
|
+
// return (window as any).require('electron')
|
3856
|
+
// .ipcRenderer as typeof ipcRenderer;
|
3857
|
+
//#endregion
|
3482
3858
|
}
|
3859
|
+
//#endregion
|
3860
|
+
//#region methods / electron webframe
|
3483
3861
|
/**
|
3484
3862
|
* get electron web frame
|
3485
3863
|
*/
|
@@ -3487,11 +3865,16 @@ class HelpersCore extends HelpersMessages {
|
|
3487
3865
|
//typeof webFrame
|
3488
3866
|
/* */
|
3489
3867
|
/* */
|
3868
|
+
//#region @browser
|
3490
3869
|
if (!this.isElectron) {
|
3491
3870
|
return;
|
3492
3871
|
}
|
3493
3872
|
return void 0;
|
3873
|
+
// return (window as any).require('electron').webFrame as typeof webFrame;
|
3874
|
+
//#endregion
|
3494
3875
|
}
|
3876
|
+
//#endregion
|
3877
|
+
//#region methods / electron ipc renderer
|
3495
3878
|
/**
|
3496
3879
|
* @deprecated
|
3497
3880
|
* get electron backend ipc main proces
|
@@ -3504,6 +3887,8 @@ class HelpersCore extends HelpersMessages {
|
|
3504
3887
|
/* */
|
3505
3888
|
return (void 0);
|
3506
3889
|
}
|
3890
|
+
//#endregion
|
3891
|
+
//#region methods / get electron window
|
3507
3892
|
getElectronWindow({ allowRunningInsecureContent = true, } = {}) {
|
3508
3893
|
/* */
|
3509
3894
|
/* */
|
@@ -3522,16 +3907,22 @@ class HelpersCore extends HelpersMessages {
|
|
3522
3907
|
/* */
|
3523
3908
|
return (void 0);
|
3524
3909
|
}
|
3910
|
+
//#endregion
|
3911
|
+
//#region methods / media from type
|
3525
3912
|
mediaTypeFromSrc(src) {
|
3526
3913
|
const ext = path.extname(src);
|
3527
3914
|
const media = CoreModels.mimeTypes[ext];
|
3528
3915
|
return _.first(media?.split('/'));
|
3529
3916
|
}
|
3917
|
+
//#endregion
|
3918
|
+
//#region methods / sleep
|
3530
3919
|
sleep(seconds = 1) {
|
3531
3920
|
/* */
|
3532
3921
|
/* */
|
3533
3922
|
return (void 0);
|
3534
3923
|
}
|
3924
|
+
//#endregion
|
3925
|
+
//#region methods / remove if exists
|
3535
3926
|
removeIfExists(absoluteFileOrFolderPath) {
|
3536
3927
|
/* */
|
3537
3928
|
/* */
|
@@ -3553,12 +3944,16 @@ class HelpersCore extends HelpersMessages {
|
|
3553
3944
|
/* */
|
3554
3945
|
return (void 0);
|
3555
3946
|
}
|
3947
|
+
//#endregion
|
3948
|
+
//#region methods / relative
|
3556
3949
|
/**
|
3557
3950
|
* path.relative that return cross platform path
|
3558
3951
|
*/
|
3559
3952
|
relative(cwd, to) {
|
3560
3953
|
return crossPlatformPath(path.relative(cwd, to));
|
3561
3954
|
}
|
3955
|
+
//#endregion
|
3956
|
+
//#region methods / remove file if exists
|
3562
3957
|
removeFileIfExists(absoluteFilePath) {
|
3563
3958
|
/* */
|
3564
3959
|
/* */
|
@@ -3575,6 +3970,8 @@ class HelpersCore extends HelpersMessages {
|
|
3575
3970
|
/* */
|
3576
3971
|
return (void 0);
|
3577
3972
|
}
|
3973
|
+
//#endregion
|
3974
|
+
//#region methods / remove folder if exists
|
3578
3975
|
removeFolderIfExists(absoluteFolderPath) {
|
3579
3976
|
/* */
|
3580
3977
|
/* */
|
@@ -3592,6 +3989,8 @@ class HelpersCore extends HelpersMessages {
|
|
3592
3989
|
/* */
|
3593
3990
|
return (void 0);
|
3594
3991
|
}
|
3992
|
+
//#endregion
|
3993
|
+
//#region methods / remove empty line from string
|
3595
3994
|
/**
|
3596
3995
|
* leave max 1 empty line
|
3597
3996
|
*/
|
@@ -3602,20 +4001,25 @@ class HelpersCore extends HelpersMessages {
|
|
3602
4001
|
.filter(line => {
|
3603
4002
|
if (line.trim() === '') {
|
3604
4003
|
if (previousWasEmpty) {
|
4004
|
+
// Skip this line because the previous line was also empty
|
3605
4005
|
return false;
|
3606
4006
|
}
|
3607
4007
|
else {
|
4008
|
+
// Allow this line, but set flag that next empty line should be skipped
|
3608
4009
|
previousWasEmpty = true;
|
3609
4010
|
return true;
|
3610
4011
|
}
|
3611
4012
|
}
|
3612
4013
|
else {
|
4014
|
+
// Reset flag if the line is not empty
|
3613
4015
|
previousWasEmpty = false;
|
3614
4016
|
return true;
|
3615
4017
|
}
|
3616
4018
|
})
|
3617
4019
|
.join('\n');
|
3618
4020
|
}
|
4021
|
+
//#endregion
|
4022
|
+
//#region methods / try remove empty dir
|
3619
4023
|
/**
|
3620
4024
|
* @deprecated
|
3621
4025
|
*/
|
@@ -3658,6 +4062,8 @@ class HelpersCore extends HelpersMessages {
|
|
3658
4062
|
/* */
|
3659
4063
|
return (void 0);
|
3660
4064
|
}
|
4065
|
+
//#endregion
|
4066
|
+
//#region methods / remove file or folder
|
3661
4067
|
remove(fileOrFolderPathOrPatter, exactFolder = false) {
|
3662
4068
|
/* */
|
3663
4069
|
/* */
|
@@ -3671,6 +4077,8 @@ class HelpersCore extends HelpersMessages {
|
|
3671
4077
|
/* */
|
3672
4078
|
return (void 0);
|
3673
4079
|
}
|
4080
|
+
//#endregion
|
4081
|
+
//#region methods / clean exit process
|
3674
4082
|
/* */
|
3675
4083
|
/* */
|
3676
4084
|
/* */
|
@@ -3681,6 +4089,8 @@ class HelpersCore extends HelpersMessages {
|
|
3681
4089
|
/* */
|
3682
4090
|
/* */
|
3683
4091
|
/* */
|
4092
|
+
//#endregion
|
4093
|
+
//#region methods / is running in git bash
|
3684
4094
|
get isRunningInGitBash() {
|
3685
4095
|
/* */
|
3686
4096
|
/* */
|
@@ -3692,11 +4102,15 @@ class HelpersCore extends HelpersMessages {
|
|
3692
4102
|
/* */
|
3693
4103
|
return (void 0);
|
3694
4104
|
}
|
4105
|
+
//#endregion
|
4106
|
+
//#region methods / check if projects is running in supported terminal
|
3695
4107
|
/**
|
3696
4108
|
* Check if the current shell is supported by Taon framework.
|
3697
4109
|
*/
|
3698
4110
|
get isSupportedTaonTerminal() {
|
4111
|
+
//#region @browser
|
3699
4112
|
return false;
|
4113
|
+
//#endregion
|
3700
4114
|
/* */
|
3701
4115
|
/* */
|
3702
4116
|
/* */
|
@@ -3709,18 +4123,25 @@ class HelpersCore extends HelpersMessages {
|
|
3709
4123
|
/* */
|
3710
4124
|
return (void 0);
|
3711
4125
|
}
|
4126
|
+
//#endregion
|
4127
|
+
//#region methods / check if function is class
|
3712
4128
|
/**
|
3713
4129
|
* check if function is class
|
3714
4130
|
*/
|
3715
4131
|
isClass(funcOrClass) {
|
3716
4132
|
let isClass = false;
|
3717
4133
|
if (typeof funcOrClass === 'function') {
|
4134
|
+
// Check if it has a prototype property
|
4135
|
+
// console.log('Object.getOwnPropertyNames(funcOrClass.prototype)', Object.getOwnPropertyNames(funcOrClass.prototype).filter(f => f !== 'constructor'))
|
3718
4136
|
isClass =
|
3719
4137
|
!!funcOrClass.prototype &&
|
3720
4138
|
Object.getOwnPropertyNames(funcOrClass.prototype).filter(f => f !== 'constructor').length > 0;
|
3721
4139
|
}
|
4140
|
+
// console.log('is class: ' + isClass, funcOrClass)
|
3722
4141
|
return isClass;
|
3723
4142
|
}
|
4143
|
+
//#endregion
|
4144
|
+
//#region methods / is blob
|
3724
4145
|
/**
|
3725
4146
|
* check if data is nodejs/browser blob
|
3726
4147
|
*
|
@@ -3728,8 +4149,11 @@ class HelpersCore extends HelpersMessages {
|
|
3728
4149
|
* @returns
|
3729
4150
|
*/
|
3730
4151
|
isBlob(maybeBlob) {
|
4152
|
+
// TODO is this needed hmmmm
|
3731
4153
|
return maybeBlob instanceof Blob; // || toString.call(maybeBlob) === '[object Blob]';
|
3732
4154
|
}
|
4155
|
+
//#endregion
|
4156
|
+
//#region methods / is buffer
|
3733
4157
|
/**
|
3734
4158
|
* Check if data is nodejs buffer
|
3735
4159
|
*
|
@@ -3740,33 +4164,62 @@ class HelpersCore extends HelpersMessages {
|
|
3740
4164
|
/* */
|
3741
4165
|
/* */
|
3742
4166
|
/* */
|
4167
|
+
//#endregion
|
4168
|
+
//#region methods / remove slash at the end of string
|
3743
4169
|
removeSlashAtEnd(s) {
|
3744
4170
|
s = s?.endsWith(`/`) ? s.slice(0, s.length - 1) : s;
|
3745
4171
|
return s;
|
3746
4172
|
}
|
4173
|
+
//#endregion
|
4174
|
+
//#region methods / remove slash at the begin of string
|
3747
4175
|
removeSlashAtBegin(s) {
|
3748
4176
|
s = s?.startsWith(`/`) ? s.slice(1) : s;
|
3749
4177
|
return s;
|
3750
4178
|
}
|
4179
|
+
//#endregion
|
4180
|
+
//#region methods / stringify object pretty format
|
3751
4181
|
/**
|
3752
4182
|
* stringify to pretty json string
|
3753
4183
|
*/
|
3754
4184
|
stringify(inputObject) {
|
4185
|
+
// if (_.isString(inputObject)) {
|
4186
|
+
// return inputObject;
|
4187
|
+
// }
|
4188
|
+
// if (_.isObject(inputObject)) {
|
4189
|
+
// config.log(inputObject)
|
4190
|
+
// Helpers.error(`[tnp-helpers] trying to stringify not a object`, false, true);
|
4191
|
+
// }
|
3755
4192
|
return JSON.stringify(inputObject, null, 2);
|
3756
4193
|
}
|
4194
|
+
//#endregion
|
4195
|
+
//#region methods / run sync or async
|
3757
4196
|
async runSyncOrAsync(fnOrOptions) {
|
3758
4197
|
if (_.isUndefined(fnOrOptions)) {
|
3759
4198
|
return void 0;
|
3760
4199
|
}
|
3761
4200
|
let promisOrValue;
|
4201
|
+
// const optionsMode = _.isObject(fnOrOptions)
|
4202
|
+
// && !_.isArray(fnOrOptions)
|
4203
|
+
// && !_.isFunction(fnOrOptions)
|
4204
|
+
// && !_.isNil(fnOrOptions)
|
4205
|
+
// ;
|
4206
|
+
// if (optionsMode) {
|
3762
4207
|
const { functionFn, context, arrayOfParams } = fnOrOptions;
|
3763
4208
|
promisOrValue = functionFn.apply(context, arrayOfParams);
|
4209
|
+
// } else {
|
3764
4210
|
// // @ts-ignore
|
4211
|
+
// promisOrValue = _.isArray(fnOrOptions) ? fnOrOptions[1][fnOrOptions[0]](...firstArg) : fnOrOptions(...firstArg);
|
4212
|
+
// }
|
4213
|
+
// let wasPromise = false;
|
3765
4214
|
if (promisOrValue instanceof Promise) {
|
4215
|
+
// wasPromise = true;
|
3766
4216
|
promisOrValue = Promise.resolve(promisOrValue);
|
3767
4217
|
}
|
4218
|
+
// console.log('was promis ', wasPromise)
|
3768
4219
|
return promisOrValue;
|
3769
4220
|
}
|
4221
|
+
//#endregion
|
4222
|
+
//#region methods / create symlink
|
3770
4223
|
/* */
|
3771
4224
|
/* */
|
3772
4225
|
/* */
|
@@ -4005,6 +4458,8 @@ class HelpersCore extends HelpersMessages {
|
|
4005
4458
|
/* */
|
4006
4459
|
/* */
|
4007
4460
|
/* */
|
4461
|
+
//#endregion
|
4462
|
+
//#region methods / mkdirp
|
4008
4463
|
/* */
|
4009
4464
|
/* */
|
4010
4465
|
/* */
|
@@ -4055,6 +4510,8 @@ class HelpersCore extends HelpersMessages {
|
|
4055
4510
|
/* */
|
4056
4511
|
/* */
|
4057
4512
|
/* */
|
4513
|
+
//#endregion
|
4514
|
+
//#region methods / is symlink that matches url
|
4058
4515
|
/**
|
4059
4516
|
* symlink may have existed or unexisted destiantion url
|
4060
4517
|
* @param destUrl M
|
@@ -4095,6 +4552,8 @@ class HelpersCore extends HelpersMessages {
|
|
4095
4552
|
/* */
|
4096
4553
|
return (void 0);
|
4097
4554
|
}
|
4555
|
+
//#endregion
|
4556
|
+
//#region methods / is symlink file existed or unexisted
|
4098
4557
|
isSymlinkFileExitedOrUnexisted(filePath) {
|
4099
4558
|
/* */
|
4100
4559
|
/* */
|
@@ -4108,6 +4567,8 @@ class HelpersCore extends HelpersMessages {
|
|
4108
4567
|
/* */
|
4109
4568
|
return (void 0);
|
4110
4569
|
}
|
4570
|
+
//#endregion
|
4571
|
+
//#region methods / is unexisted link
|
4111
4572
|
/**
|
4112
4573
|
* If symbolnk link that target file does not exits
|
4113
4574
|
*/
|
@@ -4134,6 +4595,8 @@ class HelpersCore extends HelpersMessages {
|
|
4134
4595
|
/* */
|
4135
4596
|
return (void 0);
|
4136
4597
|
}
|
4598
|
+
//#endregion
|
4599
|
+
//#region methods / is exited symlink
|
4137
4600
|
/**
|
4138
4601
|
* @param existedLink check if source of link exists
|
4139
4602
|
*/
|
@@ -4162,6 +4625,8 @@ class HelpersCore extends HelpersMessages {
|
|
4162
4625
|
/* */
|
4163
4626
|
return (void 0);
|
4164
4627
|
}
|
4628
|
+
//#endregion
|
4629
|
+
//#region methods / path contain link
|
4165
4630
|
/* */
|
4166
4631
|
/* */
|
4167
4632
|
/* */
|
@@ -4180,6 +4645,8 @@ class HelpersCore extends HelpersMessages {
|
|
4180
4645
|
/* */
|
4181
4646
|
/* */
|
4182
4647
|
/* */
|
4648
|
+
//#endregion
|
4649
|
+
//#region methods / exists
|
4183
4650
|
exists(folderOrFilePath) {
|
4184
4651
|
/* */
|
4185
4652
|
/* */
|
@@ -4207,6 +4674,8 @@ class HelpersCore extends HelpersMessages {
|
|
4207
4674
|
/* */
|
4208
4675
|
return (void 0);
|
4209
4676
|
}
|
4677
|
+
//#endregion
|
4678
|
+
//#region methods / fix command
|
4210
4679
|
/**
|
4211
4680
|
* this is HACK for running procesess inside processes
|
4212
4681
|
*/
|
@@ -4222,7 +4691,10 @@ class HelpersCore extends HelpersMessages {
|
|
4222
4691
|
}
|
4223
4692
|
return command;
|
4224
4693
|
}
|
4694
|
+
//#endregion
|
4695
|
+
//#region methods / command
|
4225
4696
|
command(command) {
|
4697
|
+
// console.log({ command })
|
4226
4698
|
command = Helpers._fixCommand(command);
|
4227
4699
|
return {
|
4228
4700
|
/* */
|
@@ -4280,6 +4752,8 @@ class HelpersCore extends HelpersMessages {
|
|
4280
4752
|
/* */
|
4281
4753
|
};
|
4282
4754
|
}
|
4755
|
+
//#endregion
|
4756
|
+
//#region methods / wait
|
4283
4757
|
/**
|
4284
4758
|
* @deprecated use UtilsTerminal.wait
|
4285
4759
|
*/
|
@@ -4289,6 +4763,8 @@ class HelpersCore extends HelpersMessages {
|
|
4289
4763
|
async timeout(seconds) {
|
4290
4764
|
return await Helpers.wait(seconds);
|
4291
4765
|
}
|
4766
|
+
//#endregion
|
4767
|
+
//#region methods / command output as string async
|
4292
4768
|
/* */
|
4293
4769
|
/* */
|
4294
4770
|
/* */
|
@@ -4324,6 +4800,8 @@ class HelpersCore extends HelpersMessages {
|
|
4324
4800
|
/* */
|
4325
4801
|
/* */
|
4326
4802
|
/* */
|
4803
|
+
//#endregion
|
4804
|
+
//#region methods / command output as string
|
4327
4805
|
/* */
|
4328
4806
|
/* */
|
4329
4807
|
/* */
|
@@ -4367,6 +4845,8 @@ class HelpersCore extends HelpersMessages {
|
|
4367
4845
|
/* */
|
4368
4846
|
/* */
|
4369
4847
|
/* */
|
4848
|
+
//#endregion
|
4849
|
+
//#region methods / kill process by port
|
4370
4850
|
async killProcessByPort(portOrPortsToKill, options) {
|
4371
4851
|
/* */
|
4372
4852
|
/* */
|
@@ -4414,15 +4894,20 @@ class HelpersCore extends HelpersMessages {
|
|
4414
4894
|
/* */
|
4415
4895
|
return (void 0);
|
4416
4896
|
}
|
4897
|
+
//#endregion
|
4898
|
+
//#region methods / kill on port
|
4417
4899
|
async killOnPort(portOrPortsToKill, options) {
|
4418
4900
|
return await Helpers.killProcessByPort(portOrPortsToKill, options);
|
4419
4901
|
}
|
4902
|
+
//#endregion
|
4903
|
+
//#region methods / kill process
|
4420
4904
|
killProcess(byPid) {
|
4421
4905
|
/* */
|
4422
4906
|
/* */
|
4423
4907
|
/* */
|
4424
4908
|
/* */
|
4425
4909
|
/* */
|
4910
|
+
//#region @websqlOnly
|
4426
4911
|
if (WEBSQL_PROC_MOCK_PROCESSES_PID[byPid]) {
|
4427
4912
|
const ppid = WEBSQL_PROC_MOCK_PROCESSES_PID[byPid].ppid;
|
4428
4913
|
if (WEBSQL_PROC_MOCK_PROCESSES_PPID[ppid]) {
|
@@ -4441,9 +4926,13 @@ class HelpersCore extends HelpersMessages {
|
|
4441
4926
|
}
|
4442
4927
|
delete WEBSQL_PROC_MOCK_PROCESSES_PPID[byPid];
|
4443
4928
|
}
|
4929
|
+
//#endregion
|
4444
4930
|
}
|
4931
|
+
//#endregion
|
4932
|
+
//#region methods / run
|
4445
4933
|
run(command, options) {
|
4446
4934
|
command = Helpers._fixCommand(command);
|
4935
|
+
// console.log({ command })
|
4447
4936
|
/* */
|
4448
4937
|
/* */
|
4449
4938
|
/* */
|
@@ -4457,6 +4946,7 @@ class HelpersCore extends HelpersMessages {
|
|
4457
4946
|
* start command as synchronous nodej proces
|
4458
4947
|
*/
|
4459
4948
|
sync() {
|
4949
|
+
// TODO buffer
|
4460
4950
|
/* */
|
4461
4951
|
/* */
|
4462
4952
|
/* */
|
@@ -4494,7 +4984,12 @@ class HelpersCore extends HelpersMessages {
|
|
4494
4984
|
* start command as asynchronous nodej proces
|
4495
4985
|
* @param detach (default: false) - if true process will be detached
|
4496
4986
|
*/
|
4497
|
-
async(detach = false,
|
4987
|
+
async(detach = false,
|
4988
|
+
//#region @browser
|
4989
|
+
mockFun) {
|
4990
|
+
//#region websqlFunc
|
4991
|
+
//#region mock of process
|
4992
|
+
//#region @browser
|
4498
4993
|
if (mockFun) {
|
4499
4994
|
const subStdoutSub = new Subject();
|
4500
4995
|
const subStderSub = new Subject();
|
@@ -4577,11 +5072,14 @@ class HelpersCore extends HelpersMessages {
|
|
4577
5072
|
});
|
4578
5073
|
return procDummy;
|
4579
5074
|
}
|
5075
|
+
//#endregion
|
5076
|
+
//#endregion
|
4580
5077
|
/* */
|
4581
5078
|
/* */
|
4582
5079
|
/* */
|
4583
5080
|
/* */
|
4584
5081
|
return (void 0);
|
5082
|
+
//#endregion
|
4585
5083
|
},
|
4586
5084
|
/**
|
4587
5085
|
* start command as asynchronous nodej proces inside promise
|
@@ -4794,6 +5292,8 @@ class HelpersCore extends HelpersMessages {
|
|
4794
5292
|
},
|
4795
5293
|
};
|
4796
5294
|
}
|
5295
|
+
//#endregion
|
5296
|
+
//#region methods / question yest no
|
4797
5297
|
/**
|
4798
5298
|
* @deprecated use UtilsTerminal.confirm
|
4799
5299
|
*/
|
@@ -4807,6 +5307,8 @@ class HelpersCore extends HelpersMessages {
|
|
4807
5307
|
/* */
|
4808
5308
|
return (void 0);
|
4809
5309
|
}
|
5310
|
+
//#endregion
|
5311
|
+
//#region methods / get stdio
|
4810
5312
|
/* */
|
4811
5313
|
/* */
|
4812
5314
|
/* */
|
@@ -4833,6 +5335,8 @@ class HelpersCore extends HelpersMessages {
|
|
4833
5335
|
/* */
|
4834
5336
|
/* */
|
4835
5337
|
/* */
|
5338
|
+
//#endregion
|
5339
|
+
//#region methods / run sync in
|
4836
5340
|
/* */
|
4837
5341
|
/* */
|
4838
5342
|
/* */
|
@@ -4842,6 +5346,8 @@ class HelpersCore extends HelpersMessages {
|
|
4842
5346
|
/* */
|
4843
5347
|
/* */
|
4844
5348
|
/* */
|
5349
|
+
//#endregion
|
5350
|
+
//#region methods / run async in
|
4845
5351
|
/* */
|
4846
5352
|
/* */
|
4847
5353
|
/* */
|
@@ -4911,6 +5417,8 @@ class HelpersCore extends HelpersMessages {
|
|
4911
5417
|
/* */
|
4912
5418
|
/* */
|
4913
5419
|
/* */
|
5420
|
+
//#endregion
|
5421
|
+
//#region methods / log process
|
4914
5422
|
/* */
|
4915
5423
|
/* */
|
4916
5424
|
/* */
|
@@ -5011,6 +5519,8 @@ class HelpersCore extends HelpersMessages {
|
|
5011
5519
|
/* */
|
5012
5520
|
/* */
|
5013
5521
|
/* */
|
5522
|
+
//#endregion
|
5523
|
+
//#region methods / check process
|
5014
5524
|
/* */
|
5015
5525
|
/* */
|
5016
5526
|
/* */
|
@@ -5026,6 +5536,8 @@ class HelpersCore extends HelpersMessages {
|
|
5026
5536
|
/* */
|
5027
5537
|
/* */
|
5028
5538
|
/* */
|
5539
|
+
//#endregion
|
5540
|
+
//#region methods / modify line by line
|
5029
5541
|
/* */
|
5030
5542
|
/* */
|
5031
5543
|
/* */
|
@@ -5079,6 +5591,8 @@ class HelpersCore extends HelpersMessages {
|
|
5079
5591
|
/* */
|
5080
5592
|
/* */
|
5081
5593
|
/* */
|
5594
|
+
//#endregion
|
5595
|
+
//#region methods / is folder
|
5082
5596
|
/* */
|
5083
5597
|
/* */
|
5084
5598
|
/* */
|
@@ -5087,6 +5601,8 @@ class HelpersCore extends HelpersMessages {
|
|
5087
5601
|
/* */
|
5088
5602
|
/* */
|
5089
5603
|
/* */
|
5604
|
+
//#endregion
|
5605
|
+
//#region methods / values
|
5090
5606
|
/**
|
5091
5607
|
* Quick fix for object values
|
5092
5608
|
* @deprecated
|
@@ -5104,6 +5620,8 @@ class HelpersCore extends HelpersMessages {
|
|
5104
5620
|
}
|
5105
5621
|
return [];
|
5106
5622
|
}
|
5623
|
+
//#endregion
|
5624
|
+
//#region methods / is file
|
5107
5625
|
/**
|
5108
5626
|
* does not make sense
|
5109
5627
|
* @deprecated
|
@@ -5117,6 +5635,8 @@ class HelpersCore extends HelpersMessages {
|
|
5117
5635
|
/* */
|
5118
5636
|
return (void 0);
|
5119
5637
|
}
|
5638
|
+
//#endregion
|
5639
|
+
//#region methods / read file
|
5120
5640
|
async tryReadFile(absoluteFilePath, // @ts-ignore
|
5121
5641
|
defaultValueWhenNotExists = void 0, notTrim = false) {
|
5122
5642
|
/* */
|
@@ -5174,10 +5694,10 @@ class HelpersCore extends HelpersMessages {
|
|
5174
5694
|
/* */
|
5175
5695
|
/* */
|
5176
5696
|
/* */
|
5177
|
-
/* */
|
5178
|
-
/* */
|
5179
5697
|
return (void 0);
|
5180
5698
|
}
|
5699
|
+
//#endregion
|
5700
|
+
//#region methods / read json
|
5181
5701
|
/**
|
5182
5702
|
* read json from absolute path
|
5183
5703
|
* @returns json object
|
@@ -5216,6 +5736,8 @@ class HelpersCore extends HelpersMessages {
|
|
5216
5736
|
/* */
|
5217
5737
|
return (void 0);
|
5218
5738
|
}
|
5739
|
+
//#endregion
|
5740
|
+
//#region methods / parse
|
5219
5741
|
/* */
|
5220
5742
|
/* */
|
5221
5743
|
/* */
|
@@ -5231,6 +5753,8 @@ class HelpersCore extends HelpersMessages {
|
|
5231
5753
|
/* */
|
5232
5754
|
/* */
|
5233
5755
|
/* */
|
5756
|
+
//#endregion
|
5757
|
+
//#region methods / compilation wrapper
|
5234
5758
|
/* */
|
5235
5759
|
/* */
|
5236
5760
|
/* */
|
@@ -5255,6 +5779,8 @@ class HelpersCore extends HelpersMessages {
|
|
5255
5779
|
/* */
|
5256
5780
|
/* */
|
5257
5781
|
/* */
|
5782
|
+
//#endregion
|
5783
|
+
//#region methods / replace in line
|
5258
5784
|
replaceLinesInFile(absoluteFilePath, lineReplaceFn) {
|
5259
5785
|
/* */
|
5260
5786
|
/* */
|
@@ -5263,6 +5789,8 @@ class HelpersCore extends HelpersMessages {
|
|
5263
5789
|
/* */
|
5264
5790
|
/* */
|
5265
5791
|
}
|
5792
|
+
//#endregion
|
5793
|
+
//#region methods / write file
|
5266
5794
|
/* */
|
5267
5795
|
/* */
|
5268
5796
|
/* */
|
@@ -5352,6 +5880,8 @@ class HelpersCore extends HelpersMessages {
|
|
5352
5880
|
/* */
|
5353
5881
|
/* */
|
5354
5882
|
/* */
|
5883
|
+
//#endregion
|
5884
|
+
//#region methods / write json
|
5355
5885
|
/* */
|
5356
5886
|
/* */
|
5357
5887
|
/* */
|
@@ -5420,6 +5950,8 @@ class HelpersCore extends HelpersMessages {
|
|
5420
5950
|
/* */
|
5421
5951
|
/* */
|
5422
5952
|
/* */
|
5953
|
+
//#endregion
|
5954
|
+
//#region methods / folders from
|
5423
5955
|
/* */
|
5424
5956
|
/* */
|
5425
5957
|
/* */
|
@@ -5468,6 +6000,8 @@ class HelpersCore extends HelpersMessages {
|
|
5468
6000
|
/* */
|
5469
6001
|
/* */
|
5470
6002
|
/* */
|
6003
|
+
//#endregion
|
6004
|
+
//#region methods / links from
|
5471
6005
|
/* */
|
5472
6006
|
/* */
|
5473
6007
|
/* */
|
@@ -5503,6 +6037,8 @@ class HelpersCore extends HelpersMessages {
|
|
5503
6037
|
/* */
|
5504
6038
|
/* */
|
5505
6039
|
/* */
|
6040
|
+
//#endregion
|
6041
|
+
//#region methods / links to folders from path
|
5506
6042
|
/* */
|
5507
6043
|
/* */
|
5508
6044
|
/* */
|
@@ -5536,6 +6072,8 @@ class HelpersCore extends HelpersMessages {
|
|
5536
6072
|
/* */
|
5537
6073
|
/* */
|
5538
6074
|
/* */
|
6075
|
+
//#endregion
|
6076
|
+
//#region methods / files from
|
5539
6077
|
/* */
|
5540
6078
|
/* */
|
5541
6079
|
/* */
|
@@ -5585,6 +6123,8 @@ class HelpersCore extends HelpersMessages {
|
|
5585
6123
|
/* */
|
5586
6124
|
/* */
|
5587
6125
|
/* */
|
6126
|
+
//#endregion
|
6127
|
+
//#region methods / open folder in file explorer
|
5588
6128
|
/* */
|
5589
6129
|
/* */
|
5590
6130
|
/* */
|
@@ -5605,22 +6145,20 @@ class HelpersCore extends HelpersMessages {
|
|
5605
6145
|
/* */
|
5606
6146
|
/* */
|
5607
6147
|
/* */
|
6148
|
+
//#endregion
|
6149
|
+
//#region methods / hide node warnings
|
5608
6150
|
hideNodeWarnings() {
|
5609
6151
|
/* */
|
5610
6152
|
/* */
|
5611
6153
|
/* */
|
5612
6154
|
}
|
5613
6155
|
}
|
5614
|
-
;
|
5615
|
-
({}); // @--end-of-file-for-module=tnp-core lib/helpers.ts
|
5616
6156
|
|
5617
6157
|
const CoreConfig = {
|
5618
6158
|
message: {
|
5619
6159
|
globalSystemToolMode: 'globalSystemToolMode',
|
5620
6160
|
},
|
5621
6161
|
};
|
5622
|
-
;
|
5623
|
-
({}); // @--end-of-file-for-module=tnp-core lib/core-config.ts
|
5624
6162
|
|
5625
6163
|
class PROGRESS_DATA {
|
5626
6164
|
constructor() {
|
@@ -5645,6 +6183,7 @@ class PROGRESS_DATA {
|
|
5645
6183
|
if (checkSplit) {
|
5646
6184
|
const split = chunk.split(/\r\n|\n|\r/);
|
5647
6185
|
if (split.length > 1) {
|
6186
|
+
// console.log('split founded', split)
|
5648
6187
|
split.forEach(s => {
|
5649
6188
|
res = res.concat(this.resolveFrom(s, callbackOnFounded, false));
|
5650
6189
|
});
|
@@ -5672,8 +6211,6 @@ class PROGRESS_DATA {
|
|
5672
6211
|
return res;
|
5673
6212
|
}
|
5674
6213
|
}
|
5675
|
-
;
|
5676
|
-
({}); // @--end-of-file-for-module=tnp-core lib/progress-data.ts
|
5677
6214
|
|
5678
6215
|
/* */
|
5679
6216
|
/* */
|
@@ -5692,8 +6229,6 @@ class CLI {
|
|
5692
6229
|
/* */
|
5693
6230
|
static { this.chalk = chalk; }
|
5694
6231
|
}
|
5695
|
-
;
|
5696
|
-
({}); // @--end-of-file-for-module=tnp-core lib/core-cli.ts
|
5697
6232
|
|
5698
6233
|
/**
|
5699
6234
|
* TODO slowly refactor this.. only actually globally needed are:
|
@@ -5771,12 +6306,8 @@ const requiredForDev = {
|
|
5771
6306
|
/* */
|
5772
6307
|
],
|
5773
6308
|
};
|
5774
|
-
;
|
5775
|
-
({}); // @--end-of-file-for-module=tnp-core lib/required-global-npm-packages.ts
|
5776
6309
|
|
5777
6310
|
let Helpers = HelpersCore.InstanceCore;
|
5778
|
-
;
|
5779
|
-
({}); // @--end-of-file-for-module=tnp-core lib/index.ts
|
5780
6311
|
|
5781
6312
|
/**
|
5782
6313
|
* Generated bundle index. Do not edit.
|