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.
Files changed (47) hide show
  1. package/README.md +20 -20
  2. package/browser/README.md +24 -24
  3. package/browser/fesm2022/tnp-core.mjs +587 -60
  4. package/browser/fesm2022/tnp-core.mjs.map +1 -1
  5. package/browser/package.json +1 -1
  6. package/cli.backend.js +2 -2
  7. package/cli.backend.js.map +1 -1
  8. package/client/README.md +24 -24
  9. package/client/fesm2022/tnp-core.mjs +587 -60
  10. package/client/fesm2022/tnp-core.mjs.map +1 -1
  11. package/client/package.json +1 -1
  12. package/index.js.map +1 -1
  13. package/lib/build-info._auto-generated_.d.ts +2 -1
  14. package/lib/build-info._auto-generated_.js +3 -2
  15. package/lib/build-info._auto-generated_.js.map +1 -1
  16. package/lib/command-exists.js.map +1 -1
  17. package/lib/core-cli.js.map +1 -1
  18. package/lib/core-config.js.map +1 -1
  19. package/lib/core-imports.js.map +1 -1
  20. package/lib/core-models.js.map +1 -1
  21. package/lib/framework-name.js.map +1 -1
  22. package/lib/helpers-isomorphic.js.map +1 -1
  23. package/lib/helpers-messages.js.map +1 -1
  24. package/lib/helpers.d.ts +1 -1
  25. package/lib/helpers.js +2 -4
  26. package/lib/helpers.js.map +1 -1
  27. package/lib/index._auto-generated_.js.map +1 -1
  28. package/lib/index.js.map +1 -1
  29. package/lib/node-chalk-mock.js +2 -2
  30. package/lib/node-chalk-mock.js.map +1 -1
  31. package/lib/node-path-mock.js +2 -2
  32. package/lib/node-path-mock.js.map +1 -1
  33. package/lib/progress-data.js.map +1 -1
  34. package/lib/public-api.js.map +1 -1
  35. package/lib/required-global-npm-packages.js.map +1 -1
  36. package/lib/utils.js.map +1 -1
  37. package/migrations/index.js.map +1 -1
  38. package/migrations/migrations_index._auto-generated_.js.map +1 -1
  39. package/package.json +1 -1
  40. package/tmp-environment.json +4 -4
  41. package/websql/README.md +24 -24
  42. package/websql/fesm2022/tnp-core.mjs +591 -60
  43. package/websql/fesm2022/tnp-core.mjs.map +1 -1
  44. package/websql/package.json +1 -1
  45. package/lib/required.d.ts +0 -44
  46. package/lib/required.js +0 -76
  47. 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, options) => {
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
@@ -2037,11 +2296,14 @@ var UtilsOs;
2037
2296
  /* */
2038
2297
  return false;
2039
2298
  };
2299
+ //#endregion
2300
+ //#region utils os / is running in electron
2040
2301
  /**
2041
2302
  * check whether the current process is running inside
2042
2303
  * Electron backend or browser.
2043
2304
  */
2044
2305
  UtilsOs.isRunningInElectron = () => {
2306
+ // Renderer process
2045
2307
  // @ts-ignore
2046
2308
  if (typeof window !== 'undefined' &&
2047
2309
  typeof window.process === 'object' &&
@@ -2049,12 +2311,14 @@ var UtilsOs;
2049
2311
  window.process.type === 'renderer') {
2050
2312
  return true;
2051
2313
  }
2314
+ // Main process
2052
2315
  // @ts-ignore
2053
2316
  if (typeof process !== 'undefined' &&
2054
2317
  typeof process.versions === 'object' &&
2055
2318
  !!process.versions.electron) {
2056
2319
  return true;
2057
2320
  }
2321
+ // Detect the user agent when the `nodeIntegration` option is set to false
2058
2322
  if (typeof navigator === 'object' &&
2059
2323
  typeof navigator.userAgent === 'string' &&
2060
2324
  navigator.userAgent.indexOf('Electron') >= 0) {
@@ -2062,6 +2326,8 @@ var UtilsOs;
2062
2326
  }
2063
2327
  return false;
2064
2328
  };
2329
+ //#endregion
2330
+ //#region utils os / is running in vscode extension
2065
2331
  /**
2066
2332
  * Check whether the current process is running inside
2067
2333
  * a Visual Studio Code extension.
@@ -2077,12 +2343,16 @@ var UtilsOs;
2077
2343
  /* */
2078
2344
  return (void 0);
2079
2345
  };
2346
+ //#endregion
2347
+ //#region utils os / is running in wsl
2080
2348
  /**
2081
2349
  * Check wether the current process is running inside
2082
2350
  * windows subsystem for linux (WSL).
2083
2351
  */
2084
2352
  UtilsOs.isRunningInWsl = () => {
2353
+ //#region @browser
2085
2354
  return false;
2355
+ //#endregion
2086
2356
  /* */
2087
2357
  /* */
2088
2358
  /* */
@@ -2102,6 +2372,8 @@ var UtilsOs;
2102
2372
  /* */
2103
2373
  return (void 0);
2104
2374
  };
2375
+ //#endregion
2376
+ //#region utils os / is running in windows / powershell / cmd
2105
2377
  const getProcessTree = () => {
2106
2378
  /* */
2107
2379
  /* */
@@ -2160,8 +2432,12 @@ var UtilsOs;
2160
2432
  UtilsOs.isRunningInWindowsCmd = () => {
2161
2433
  return findAncestorProcessName(['cmd.exe']) !== undefined;
2162
2434
  };
2435
+ //#endregion
2436
+ //#region utils os / is running in docker
2163
2437
  UtilsOs.isRunningInDocker = () => {
2438
+ //#region @browser
2164
2439
  return false;
2440
+ //#endregion
2165
2441
  /* */
2166
2442
  /* */
2167
2443
  /* */
@@ -2171,6 +2447,8 @@ var UtilsOs;
2171
2447
  /* */
2172
2448
  return (void 0);
2173
2449
  };
2450
+ //#endregion
2451
+ //#region utils os / is running in linux graphics capable environment
2174
2452
  UtilsOs.isRunningInLinuxGraphicsCapableEnvironment = () => {
2175
2453
  /* */
2176
2454
  /* */
@@ -2181,24 +2459,34 @@ var UtilsOs;
2181
2459
  /* */
2182
2460
  return (void 0);
2183
2461
  };
2462
+ //#endregion
2463
+ //#region utils os / is running in cli mode
2184
2464
  /**
2185
2465
  * Check whether the current process is running in CLI mode.
2186
2466
  */
2187
2467
  UtilsOs.isRunningInCliMode = () => {
2468
+ //#region @browser
2188
2469
  return false;
2470
+ //#endregion
2189
2471
  /* */
2190
2472
  /* */
2191
2473
  return (void 0);
2192
2474
  };
2475
+ //#endregion
2476
+ //#region utils os / is running in mocha test
2193
2477
  /**
2194
2478
  * Check whether the current process is running in mocha test.
2195
2479
  */
2196
2480
  UtilsOs.isRunningInMochaTest = () => {
2481
+ //#region @browser
2197
2482
  return false;
2483
+ //#endregion
2198
2484
  /* */
2199
2485
  /* */
2200
2486
  return (void 0);
2201
2487
  };
2488
+ //#endregion
2489
+ //#region utils os / is port in use
2202
2490
  const isPortInUseOnHost = (port, host) => {
2203
2491
  /* */
2204
2492
  /* */
@@ -2249,16 +2537,26 @@ var UtilsOs;
2249
2537
  /* */
2250
2538
  return (void 0);
2251
2539
  };
2540
+ //#endregion
2252
2541
  })(UtilsOs || (UtilsOs = {}));
2542
+ //#endregion
2543
+ //#region utils string
2253
2544
  var UtilsString;
2254
2545
  (function (UtilsString) {
2546
+ //#region utils string / kebab case no split numbers
2255
2547
  UtilsString.kebabCaseNoSplitNumbers = (input) => {
2256
2548
  return (input
2549
+ // Match spaces or any kind of whitespace and replace with a hyphen
2257
2550
  .replace(/\s+/g, '-')
2551
+ // Match uppercase letters and replace them with a hyphen and the lowercase version of the letter
2258
2552
  .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
2553
+ // Convert everything to lowercase
2259
2554
  .toLowerCase());
2260
2555
  };
2556
+ //#endregion
2261
2557
  })(UtilsString || (UtilsString = {}));
2558
+ //#endregion
2559
+ //#region utils migrations
2262
2560
  /**
2263
2561
  * Taon migration utilities
2264
2562
  */
@@ -2266,6 +2564,7 @@ var UtilsMigrations;
2266
2564
  (function (UtilsMigrations) {
2267
2565
  UtilsMigrations.getTimestampFromClassName = (className) => {
2268
2566
  const [maybeTimestamp1, maybeTimestamp2] = className.split('_') || [];
2567
+ // console.log({ maybeTimestamp1, maybeTimestamp2 });
2269
2568
  const timestamp1 = parseInt(maybeTimestamp1);
2270
2569
  const timestamp2 = parseInt(maybeTimestamp2);
2271
2570
  const timestamp = !_.isNaN(timestamp1) ? timestamp1 : timestamp2;
@@ -2291,8 +2590,12 @@ var UtilsMigrations;
2291
2590
  return value >= minTimestamp && value <= maxTimestamp;
2292
2591
  };
2293
2592
  })(UtilsMigrations || (UtilsMigrations = {}));
2593
+ //#endregion
2594
+ //#region utils terminal
2294
2595
  var UtilsTerminal;
2295
2596
  (function (UtilsTerminal) {
2597
+ //#endregion
2598
+ //#region wait
2296
2599
  UtilsTerminal.wait = (second) => {
2297
2600
  return new Promise((resolve, reject) => {
2298
2601
  setTimeout(() => {
@@ -2300,6 +2603,8 @@ var UtilsTerminal;
2300
2603
  }, second * 1000);
2301
2604
  });
2302
2605
  };
2606
+ //#endregion
2607
+ //#region clear
2303
2608
  UtilsTerminal.clearConsole = () => {
2304
2609
  /* */
2305
2610
  /* */
@@ -2314,6 +2619,8 @@ var UtilsTerminal;
2314
2619
  /* */
2315
2620
  return (void 0);
2316
2621
  };
2622
+ //#endregion
2623
+ //#region transform choices
2317
2624
  const transformChoices = (choices) => {
2318
2625
  /* */
2319
2626
  /* */
@@ -2334,6 +2641,8 @@ var UtilsTerminal;
2334
2641
  /* */
2335
2642
  return (void 0);
2336
2643
  };
2644
+ //#endregion
2645
+ //#region multiselect
2337
2646
  UtilsTerminal.multiselect = async (options) => {
2338
2647
  /* */
2339
2648
  /* */
@@ -2419,6 +2728,8 @@ var UtilsTerminal;
2419
2728
  /* */
2420
2729
  return (void 0);
2421
2730
  };
2731
+ //#endregion
2732
+ //#region select and execute
2422
2733
  /**
2423
2734
  * Similar to select but executes action if provided
2424
2735
  * @returns selected and executed value
@@ -2466,6 +2777,8 @@ var UtilsTerminal;
2466
2777
  /* */
2467
2778
  return (void 0);
2468
2779
  };
2780
+ //#endregion
2781
+ //#region select and execute
2469
2782
  /**
2470
2783
  * Similar to select but executes action if provided
2471
2784
  * @returns selected and executed value
@@ -2508,6 +2821,8 @@ var UtilsTerminal;
2508
2821
  /* */
2509
2822
  return (void 0);
2510
2823
  };
2824
+ //#endregion
2825
+ //#region select
2511
2826
  UtilsTerminal.select = async (options) => {
2512
2827
  /* */
2513
2828
  /* */
@@ -2571,11 +2886,15 @@ var UtilsTerminal;
2571
2886
  /* */
2572
2887
  return (void 0);
2573
2888
  };
2889
+ //#endregion
2890
+ //#region pipe enter to stdin
2574
2891
  UtilsTerminal.pipeEnterToStdin = () => {
2575
2892
  /* */
2576
2893
  /* */
2577
2894
  return (void 0);
2578
2895
  };
2896
+ //#endregion
2897
+ //#region input
2579
2898
  UtilsTerminal.input = async ({ defaultValue, question, required, // TODO something is werid with required
2580
2899
  }) => {
2581
2900
  /* */
@@ -2596,6 +2915,8 @@ var UtilsTerminal;
2596
2915
  /* */
2597
2916
  return (void 0);
2598
2917
  };
2918
+ //#endregion
2919
+ //#region confirm
2599
2920
  UtilsTerminal.confirm = async (options) => {
2600
2921
  /* */
2601
2922
  /* */
@@ -2678,6 +2999,8 @@ var UtilsTerminal;
2678
2999
  /* */
2679
3000
  return (void 0);
2680
3001
  };
3002
+ //#endregion
3003
+ //#region press any key to continue
2681
3004
  UtilsTerminal.pressAnyKeyToContinueAsync = (options) => {
2682
3005
  /* */
2683
3006
  /* */
@@ -2699,6 +3022,8 @@ var UtilsTerminal;
2699
3022
  /* */
2700
3023
  return (void 0);
2701
3024
  };
3025
+ //#endregion
3026
+ //#region press any key
2702
3027
  /**
2703
3028
  * @deprecated use UtilsTerminal.pressAnyKeyToContinueAsync()
2704
3029
  */
@@ -2732,6 +3057,8 @@ var UtilsTerminal;
2732
3057
  /* */
2733
3058
  return (void 0);
2734
3059
  };
3060
+ //#endregion
3061
+ //#region preview long list as select
2735
3062
  UtilsTerminal.previewLongList = async (list, listName = 'List') => {
2736
3063
  /* */
2737
3064
  /* */
@@ -2752,6 +3079,8 @@ var UtilsTerminal;
2752
3079
  /* */
2753
3080
  return (void 0);
2754
3081
  };
3082
+ //#endregion
3083
+ //#region preview long list with 'less' (git log like)
2755
3084
  /**
2756
3085
  * Displays a long list in the console using a pager like `less`.
2757
3086
  * Returns a Promise that resolves when the user exits the pager.
@@ -2786,9 +3115,9 @@ var UtilsTerminal;
2786
3115
  /* */
2787
3116
  return (void 0);
2788
3117
  };
3118
+ //#endregion
2789
3119
  })(UtilsTerminal || (UtilsTerminal = {}));
2790
- ;
2791
- ({}); // @--end-of-file-for-module=tnp-core lib/utils.ts
3120
+ //#endregion
2792
3121
 
2793
3122
  class HelpersIsomorphic {
2794
3123
  /**
@@ -2838,9 +3167,8 @@ class HelpersIsomorphic {
2838
3167
  }).length > 0);
2839
3168
  }
2840
3169
  }
2841
- ;
2842
- ({}); // @--end-of-file-for-module=tnp-core lib/helpers-isomorphic.ts
2843
3170
 
3171
+ // TODO handle global.testMode ?
2844
3172
  const KEY = {
2845
3173
  LAST_ERROR: Symbol(),
2846
3174
  LAST_INFO: Symbol(),
@@ -2890,12 +3218,16 @@ const KEY_IMPORTANTCE = {
2890
3218
  /* */
2891
3219
  /* */
2892
3220
  const LIMIT = 10;
3221
+ //#region transformData
2893
3222
  /**
2894
3223
  * @param details any data to be transformed
2895
3224
  * @returns string ready to be displayed
2896
3225
  */
2897
3226
  const transformData = (details) => {
2898
3227
  if (typeof details === 'object') {
3228
+ // if (Array.isArray(details)) {
3229
+ // return details.join('\n');
3230
+ // }
2899
3231
  try {
2900
3232
  const json = JSON.stringify(details, null, 2);
2901
3233
  details = json;
@@ -2906,6 +3238,7 @@ const transformData = (details) => {
2906
3238
  }
2907
3239
  return details;
2908
3240
  };
3241
+ //#endregion
2909
3242
  class HelpersMessages extends HelpersIsomorphic {
2910
3243
  msgCacheClear() {
2911
3244
  /* */
@@ -2916,6 +3249,7 @@ class HelpersMessages extends HelpersIsomorphic {
2916
3249
  }
2917
3250
  renderError(err) {
2918
3251
  if (this.isBrowser) {
3252
+ // TODO for FE
2919
3253
  console.error(err);
2920
3254
  }
2921
3255
  else {
@@ -2942,9 +3276,11 @@ class HelpersMessages extends HelpersIsomorphic {
2942
3276
  */
2943
3277
  stopApplication(details) {
2944
3278
  if (this.isBrowser) {
3279
+ //#region @browser
2945
3280
  document.body.innerHTML =
2946
3281
  '<h1>Application has encountered an error and stopped.</h1>';
2947
3282
  document.body.style.pointerEvents = 'none';
3283
+ //#endregion
2948
3284
  /* */
2949
3285
  /* */
2950
3286
  /* */
@@ -2956,10 +3292,12 @@ class HelpersMessages extends HelpersIsomorphic {
2956
3292
  Helpers.error(error, true, true);
2957
3293
  }
2958
3294
  error(details, noExit = false, noTrace = false) {
3295
+ //#region browser mode
2959
3296
  if (Helpers.isBrowser) {
2960
3297
  console.error(details);
2961
3298
  return;
2962
3299
  }
3300
+ //#endregion
2963
3301
  /* */
2964
3302
  /* */
2965
3303
  /* */
@@ -3011,6 +3349,8 @@ class HelpersMessages extends HelpersIsomorphic {
3011
3349
  /* */
3012
3350
  /* */
3013
3351
  }
3352
+ //#endregion
3353
+ //#region info
3014
3354
  info(details, repeatable = false) {
3015
3355
  /* */
3016
3356
  /* */
@@ -3057,6 +3397,8 @@ class HelpersMessages extends HelpersIsomorphic {
3057
3397
  /* */
3058
3398
  /* */
3059
3399
  }
3400
+ //#endregion
3401
+ //#region info
3060
3402
  success(details) {
3061
3403
  if (Helpers.isBrowser) {
3062
3404
  console.info(details);
@@ -3100,6 +3442,7 @@ class HelpersMessages extends HelpersIsomorphic {
3100
3442
  /* */
3101
3443
  /* */
3102
3444
  }
3445
+ //#endregion
3103
3446
  /**
3104
3447
  *
3105
3448
  * @param details
@@ -3159,6 +3502,7 @@ class HelpersMessages extends HelpersIsomorphic {
3159
3502
  /* */
3160
3503
  /* */
3161
3504
  }
3505
+ //#endregion
3162
3506
  taskDone(details, isLessImportant = false) {
3163
3507
  if (Helpers.isBrowser) {
3164
3508
  console.info(details);
@@ -3217,11 +3561,15 @@ class HelpersMessages extends HelpersIsomorphic {
3217
3561
  /* */
3218
3562
  /* */
3219
3563
  }
3564
+ //#endregion
3220
3565
  get isVerboseMode() {
3566
+ //#region @browser
3221
3567
  return true; // TODO what it means in browser
3568
+ //#endregion
3222
3569
  /* */
3223
3570
  /* */
3224
3571
  }
3572
+ //#region log
3225
3573
  /**
3226
3574
  * log messages only available in verbose mode
3227
3575
  */
@@ -3281,6 +3629,7 @@ class HelpersMessages extends HelpersIsomorphic {
3281
3629
  /* */
3282
3630
  /* */
3283
3631
  }
3632
+ //#endregion
3284
3633
  /**
3285
3634
  * Logs not visible in normal use of taon-cli
3286
3635
  */
@@ -3314,6 +3663,7 @@ class HelpersMessages extends HelpersIsomorphic {
3314
3663
  /* */
3315
3664
  return (void 0);
3316
3665
  }
3666
+ //#endregion
3317
3667
  /**
3318
3668
  * Logs not visible in normal use of taon-cli
3319
3669
  */
@@ -3325,6 +3675,7 @@ class HelpersMessages extends HelpersIsomorphic {
3325
3675
  /* */
3326
3676
  return (void 0);
3327
3677
  }
3678
+ //#region warn
3328
3679
  warn(details, trace = false) {
3329
3680
  if (Helpers.isBrowser) {
3330
3681
  console.warn(details);
@@ -3384,9 +3735,8 @@ class HelpersMessages extends HelpersIsomorphic {
3384
3735
  /* */
3385
3736
  }
3386
3737
  }
3387
- ;
3388
- ({}); // @--end-of-file-for-module=tnp-core lib/helpers-messages.ts
3389
3738
 
3739
+ //#region import
3390
3740
  /* */
3391
3741
  /* */
3392
3742
  /* */
@@ -3404,11 +3754,17 @@ class HelpersMessages extends HelpersIsomorphic {
3404
3754
  /* */
3405
3755
  /* */
3406
3756
  /* */
3757
+ //#region @browser
3407
3758
  const encoding = 'utf8';
3408
3759
  /* */
3409
3760
  /* */
3410
3761
  const WEBSQL_PROC_MOCK_PROCESSES_PID = {};
3411
3762
  const WEBSQL_PROC_MOCK_PROCESSES_PPID = {};
3763
+ //#endregion
3764
+ // TODO UNCOMMENT
3765
+ // const globalProcessStdout = {};
3766
+ // const globalProcessStder = {};
3767
+ // const maxProcessHistoryLinesChekc = 20;
3412
3768
  class HelpersCore extends HelpersMessages {
3413
3769
  static get InstanceCore() {
3414
3770
  if (!HelpersCore._instanceCore) {
@@ -3436,8 +3792,12 @@ class HelpersCore extends HelpersMessages {
3436
3792
  /* */
3437
3793
  /* */
3438
3794
  /* */
3795
+ //#endregion
3796
+ //#region constructor
3439
3797
  constructor() {
3440
3798
  super();
3799
+ //#endregion
3800
+ //#region fields / getters
3441
3801
  /* */
3442
3802
  /* */
3443
3803
  this.bigMaxBuffer = 2024 * 500;
@@ -3445,30 +3805,40 @@ class HelpersCore extends HelpersMessages {
3445
3805
  /* */
3446
3806
  /* */
3447
3807
  }
3808
+ //#endregion
3809
+ //#region methods / is wsl
3448
3810
  /**
3449
3811
  * @deprecated use UtilsOs.isRunningInsideWsl()
3450
3812
  */
3451
3813
  get isWsl() {
3452
3814
  return UtilsOs.isRunningInWsl();
3453
3815
  }
3816
+ //#endregion
3817
+ //#region methods / is running in docker
3454
3818
  /**
3455
3819
  * @deprecated use UtilsOs.isRunningInDocker
3456
3820
  */
3457
3821
  isRunningInDocker() {
3458
3822
  return UtilsOs.isRunningInDocker();
3459
3823
  }
3824
+ //#endregion
3825
+ //#region methods / is running in docker
3460
3826
  /**
3461
3827
  * @deprecated use UtilsOs.isRunningInLinuxGraphicEnvironment
3462
3828
  */
3463
3829
  isRunningInLinuxGraphicsCapableEnvironment() {
3464
3830
  return UtilsOs.isRunningInLinuxGraphicsCapableEnvironment();
3465
3831
  }
3832
+ //#endregion
3833
+ //#region clear console
3466
3834
  /**
3467
3835
  * @deprecated use UtilsTerminal.clearConsole
3468
3836
  */
3469
3837
  clearConsole() {
3470
3838
  return UtilsTerminal.clearConsole();
3471
3839
  }
3840
+ //#endregion
3841
+ //#region methods / electron ipc renderer
3472
3842
  /**
3473
3843
  * @deprecated
3474
3844
  * get electron browser ipc renderer
@@ -3476,11 +3846,17 @@ class HelpersCore extends HelpersMessages {
3476
3846
  get ipcRenderer() {
3477
3847
  /* */
3478
3848
  /* */
3849
+ //#region @browser
3479
3850
  if (!this.isElectron) {
3480
3851
  return;
3481
3852
  }
3482
3853
  return void 0;
3854
+ // return (window as any).require('electron')
3855
+ // .ipcRenderer as typeof ipcRenderer;
3856
+ //#endregion
3483
3857
  }
3858
+ //#endregion
3859
+ //#region methods / electron webframe
3484
3860
  /**
3485
3861
  * get electron web frame
3486
3862
  */
@@ -3488,11 +3864,16 @@ class HelpersCore extends HelpersMessages {
3488
3864
  //typeof webFrame
3489
3865
  /* */
3490
3866
  /* */
3867
+ //#region @browser
3491
3868
  if (!this.isElectron) {
3492
3869
  return;
3493
3870
  }
3494
3871
  return void 0;
3872
+ // return (window as any).require('electron').webFrame as typeof webFrame;
3873
+ //#endregion
3495
3874
  }
3875
+ //#endregion
3876
+ //#region methods / electron ipc renderer
3496
3877
  /**
3497
3878
  * @deprecated
3498
3879
  * get electron backend ipc main proces
@@ -3505,6 +3886,8 @@ class HelpersCore extends HelpersMessages {
3505
3886
  /* */
3506
3887
  return (void 0);
3507
3888
  }
3889
+ //#endregion
3890
+ //#region methods / get electron window
3508
3891
  getElectronWindow({ allowRunningInsecureContent = true, } = {}) {
3509
3892
  /* */
3510
3893
  /* */
@@ -3523,16 +3906,22 @@ class HelpersCore extends HelpersMessages {
3523
3906
  /* */
3524
3907
  return (void 0);
3525
3908
  }
3909
+ //#endregion
3910
+ //#region methods / media from type
3526
3911
  mediaTypeFromSrc(src) {
3527
3912
  const ext = path.extname(src);
3528
3913
  const media = CoreModels.mimeTypes[ext];
3529
3914
  return _.first(media?.split('/'));
3530
3915
  }
3916
+ //#endregion
3917
+ //#region methods / sleep
3531
3918
  sleep(seconds = 1) {
3532
3919
  /* */
3533
3920
  /* */
3534
3921
  return (void 0);
3535
3922
  }
3923
+ //#endregion
3924
+ //#region methods / remove if exists
3536
3925
  removeIfExists(absoluteFileOrFolderPath) {
3537
3926
  /* */
3538
3927
  /* */
@@ -3554,12 +3943,16 @@ class HelpersCore extends HelpersMessages {
3554
3943
  /* */
3555
3944
  return (void 0);
3556
3945
  }
3946
+ //#endregion
3947
+ //#region methods / relative
3557
3948
  /**
3558
3949
  * path.relative that return cross platform path
3559
3950
  */
3560
3951
  relative(cwd, to) {
3561
3952
  return crossPlatformPath(path.relative(cwd, to));
3562
3953
  }
3954
+ //#endregion
3955
+ //#region methods / remove file if exists
3563
3956
  removeFileIfExists(absoluteFilePath) {
3564
3957
  /* */
3565
3958
  /* */
@@ -3576,6 +3969,8 @@ class HelpersCore extends HelpersMessages {
3576
3969
  /* */
3577
3970
  return (void 0);
3578
3971
  }
3972
+ //#endregion
3973
+ //#region methods / remove folder if exists
3579
3974
  removeFolderIfExists(absoluteFolderPath) {
3580
3975
  /* */
3581
3976
  /* */
@@ -3593,6 +3988,8 @@ class HelpersCore extends HelpersMessages {
3593
3988
  /* */
3594
3989
  return (void 0);
3595
3990
  }
3991
+ //#endregion
3992
+ //#region methods / remove empty line from string
3596
3993
  /**
3597
3994
  * leave max 1 empty line
3598
3995
  */
@@ -3603,20 +4000,25 @@ class HelpersCore extends HelpersMessages {
3603
4000
  .filter(line => {
3604
4001
  if (line.trim() === '') {
3605
4002
  if (previousWasEmpty) {
4003
+ // Skip this line because the previous line was also empty
3606
4004
  return false;
3607
4005
  }
3608
4006
  else {
4007
+ // Allow this line, but set flag that next empty line should be skipped
3609
4008
  previousWasEmpty = true;
3610
4009
  return true;
3611
4010
  }
3612
4011
  }
3613
4012
  else {
4013
+ // Reset flag if the line is not empty
3614
4014
  previousWasEmpty = false;
3615
4015
  return true;
3616
4016
  }
3617
4017
  })
3618
4018
  .join('\n');
3619
4019
  }
4020
+ //#endregion
4021
+ //#region methods / try remove empty dir
3620
4022
  /**
3621
4023
  * @deprecated
3622
4024
  */
@@ -3659,6 +4061,8 @@ class HelpersCore extends HelpersMessages {
3659
4061
  /* */
3660
4062
  return (void 0);
3661
4063
  }
4064
+ //#endregion
4065
+ //#region methods / remove file or folder
3662
4066
  remove(fileOrFolderPathOrPatter, exactFolder = false) {
3663
4067
  /* */
3664
4068
  /* */
@@ -3672,6 +4076,8 @@ class HelpersCore extends HelpersMessages {
3672
4076
  /* */
3673
4077
  return (void 0);
3674
4078
  }
4079
+ //#endregion
4080
+ //#region methods / clean exit process
3675
4081
  /* */
3676
4082
  /* */
3677
4083
  /* */
@@ -3682,6 +4088,8 @@ class HelpersCore extends HelpersMessages {
3682
4088
  /* */
3683
4089
  /* */
3684
4090
  /* */
4091
+ //#endregion
4092
+ //#region methods / is running in git bash
3685
4093
  get isRunningInGitBash() {
3686
4094
  /* */
3687
4095
  /* */
@@ -3693,11 +4101,15 @@ class HelpersCore extends HelpersMessages {
3693
4101
  /* */
3694
4102
  return (void 0);
3695
4103
  }
4104
+ //#endregion
4105
+ //#region methods / check if projects is running in supported terminal
3696
4106
  /**
3697
4107
  * Check if the current shell is supported by Taon framework.
3698
4108
  */
3699
4109
  get isSupportedTaonTerminal() {
4110
+ //#region @browser
3700
4111
  return false;
4112
+ //#endregion
3701
4113
  /* */
3702
4114
  /* */
3703
4115
  /* */
@@ -3710,18 +4122,25 @@ class HelpersCore extends HelpersMessages {
3710
4122
  /* */
3711
4123
  return (void 0);
3712
4124
  }
4125
+ //#endregion
4126
+ //#region methods / check if function is class
3713
4127
  /**
3714
4128
  * check if function is class
3715
4129
  */
3716
4130
  isClass(funcOrClass) {
3717
4131
  let isClass = false;
3718
4132
  if (typeof funcOrClass === 'function') {
4133
+ // Check if it has a prototype property
4134
+ // console.log('Object.getOwnPropertyNames(funcOrClass.prototype)', Object.getOwnPropertyNames(funcOrClass.prototype).filter(f => f !== 'constructor'))
3719
4135
  isClass =
3720
4136
  !!funcOrClass.prototype &&
3721
4137
  Object.getOwnPropertyNames(funcOrClass.prototype).filter(f => f !== 'constructor').length > 0;
3722
4138
  }
4139
+ // console.log('is class: ' + isClass, funcOrClass)
3723
4140
  return isClass;
3724
4141
  }
4142
+ //#endregion
4143
+ //#region methods / is blob
3725
4144
  /**
3726
4145
  * check if data is nodejs/browser blob
3727
4146
  *
@@ -3729,8 +4148,11 @@ class HelpersCore extends HelpersMessages {
3729
4148
  * @returns
3730
4149
  */
3731
4150
  isBlob(maybeBlob) {
4151
+ // TODO is this needed hmmmm
3732
4152
  return maybeBlob instanceof Blob; // || toString.call(maybeBlob) === '[object Blob]';
3733
4153
  }
4154
+ //#endregion
4155
+ //#region methods / is buffer
3734
4156
  /**
3735
4157
  * Check if data is nodejs buffer
3736
4158
  *
@@ -3741,33 +4163,62 @@ class HelpersCore extends HelpersMessages {
3741
4163
  /* */
3742
4164
  /* */
3743
4165
  /* */
4166
+ //#endregion
4167
+ //#region methods / remove slash at the end of string
3744
4168
  removeSlashAtEnd(s) {
3745
4169
  s = s?.endsWith(`/`) ? s.slice(0, s.length - 1) : s;
3746
4170
  return s;
3747
4171
  }
4172
+ //#endregion
4173
+ //#region methods / remove slash at the begin of string
3748
4174
  removeSlashAtBegin(s) {
3749
4175
  s = s?.startsWith(`/`) ? s.slice(1) : s;
3750
4176
  return s;
3751
4177
  }
4178
+ //#endregion
4179
+ //#region methods / stringify object pretty format
3752
4180
  /**
3753
4181
  * stringify to pretty json string
3754
4182
  */
3755
4183
  stringify(inputObject) {
4184
+ // if (_.isString(inputObject)) {
4185
+ // return inputObject;
4186
+ // }
4187
+ // if (_.isObject(inputObject)) {
4188
+ // config.log(inputObject)
4189
+ // Helpers.error(`[tnp-helpers] trying to stringify not a object`, false, true);
4190
+ // }
3756
4191
  return JSON.stringify(inputObject, null, 2);
3757
4192
  }
4193
+ //#endregion
4194
+ //#region methods / run sync or async
3758
4195
  async runSyncOrAsync(fnOrOptions) {
3759
4196
  if (_.isUndefined(fnOrOptions)) {
3760
4197
  return void 0;
3761
4198
  }
3762
4199
  let promisOrValue;
4200
+ // const optionsMode = _.isObject(fnOrOptions)
4201
+ // && !_.isArray(fnOrOptions)
4202
+ // && !_.isFunction(fnOrOptions)
4203
+ // && !_.isNil(fnOrOptions)
4204
+ // ;
4205
+ // if (optionsMode) {
3763
4206
  const { functionFn, context, arrayOfParams } = fnOrOptions;
3764
4207
  promisOrValue = functionFn.apply(context, arrayOfParams);
4208
+ // } else {
3765
4209
  // // @ts-ignore
4210
+ // promisOrValue = _.isArray(fnOrOptions) ? fnOrOptions[1][fnOrOptions[0]](...firstArg) : fnOrOptions(...firstArg);
4211
+ // }
4212
+ // let wasPromise = false;
3766
4213
  if (promisOrValue instanceof Promise) {
4214
+ // wasPromise = true;
3767
4215
  promisOrValue = Promise.resolve(promisOrValue);
3768
4216
  }
4217
+ // console.log('was promis ', wasPromise)
3769
4218
  return promisOrValue;
3770
4219
  }
4220
+ //#endregion
4221
+ //#region methods / create symlink
3771
4222
  /* */
3772
4223
  /* */
3773
4224
  /* */
@@ -4006,6 +4457,8 @@ class HelpersCore extends HelpersMessages {
4006
4457
  /* */
4007
4458
  /* */
4008
4459
  /* */
4460
+ //#endregion
4461
+ //#region methods / mkdirp
4009
4462
  /* */
4010
4463
  /* */
4011
4464
  /* */
@@ -4056,6 +4509,8 @@ class HelpersCore extends HelpersMessages {
4056
4509
  /* */
4057
4510
  /* */
4058
4511
  /* */
4512
+ //#endregion
4513
+ //#region methods / is symlink that matches url
4059
4514
  /**
4060
4515
  * symlink may have existed or unexisted destiantion url
4061
4516
  * @param destUrl M
@@ -4096,6 +4551,8 @@ class HelpersCore extends HelpersMessages {
4096
4551
  /* */
4097
4552
  return (void 0);
4098
4553
  }
4554
+ //#endregion
4555
+ //#region methods / is symlink file existed or unexisted
4099
4556
  isSymlinkFileExitedOrUnexisted(filePath) {
4100
4557
  /* */
4101
4558
  /* */
@@ -4109,6 +4566,8 @@ class HelpersCore extends HelpersMessages {
4109
4566
  /* */
4110
4567
  return (void 0);
4111
4568
  }
4569
+ //#endregion
4570
+ //#region methods / is unexisted link
4112
4571
  /**
4113
4572
  * If symbolnk link that target file does not exits
4114
4573
  */
@@ -4135,6 +4594,8 @@ class HelpersCore extends HelpersMessages {
4135
4594
  /* */
4136
4595
  return (void 0);
4137
4596
  }
4597
+ //#endregion
4598
+ //#region methods / is exited symlink
4138
4599
  /**
4139
4600
  * @param existedLink check if source of link exists
4140
4601
  */
@@ -4163,6 +4624,8 @@ class HelpersCore extends HelpersMessages {
4163
4624
  /* */
4164
4625
  return (void 0);
4165
4626
  }
4627
+ //#endregion
4628
+ //#region methods / path contain link
4166
4629
  /* */
4167
4630
  /* */
4168
4631
  /* */
@@ -4181,6 +4644,8 @@ class HelpersCore extends HelpersMessages {
4181
4644
  /* */
4182
4645
  /* */
4183
4646
  /* */
4647
+ //#endregion
4648
+ //#region methods / exists
4184
4649
  exists(folderOrFilePath) {
4185
4650
  /* */
4186
4651
  /* */
@@ -4208,6 +4673,8 @@ class HelpersCore extends HelpersMessages {
4208
4673
  /* */
4209
4674
  return (void 0);
4210
4675
  }
4676
+ //#endregion
4677
+ //#region methods / fix command
4211
4678
  /**
4212
4679
  * this is HACK for running procesess inside processes
4213
4680
  */
@@ -4223,7 +4690,10 @@ class HelpersCore extends HelpersMessages {
4223
4690
  }
4224
4691
  return command;
4225
4692
  }
4693
+ //#endregion
4694
+ //#region methods / command
4226
4695
  command(command) {
4696
+ // console.log({ command })
4227
4697
  command = Helpers._fixCommand(command);
4228
4698
  return {
4229
4699
  /* */
@@ -4281,6 +4751,8 @@ class HelpersCore extends HelpersMessages {
4281
4751
  /* */
4282
4752
  };
4283
4753
  }
4754
+ //#endregion
4755
+ //#region methods / wait
4284
4756
  /**
4285
4757
  * @deprecated use UtilsTerminal.wait
4286
4758
  */
@@ -4290,6 +4762,8 @@ class HelpersCore extends HelpersMessages {
4290
4762
  async timeout(seconds) {
4291
4763
  return await Helpers.wait(seconds);
4292
4764
  }
4765
+ //#endregion
4766
+ //#region methods / command output as string async
4293
4767
  /* */
4294
4768
  /* */
4295
4769
  /* */
@@ -4325,6 +4799,8 @@ class HelpersCore extends HelpersMessages {
4325
4799
  /* */
4326
4800
  /* */
4327
4801
  /* */
4802
+ //#endregion
4803
+ //#region methods / command output as string
4328
4804
  /* */
4329
4805
  /* */
4330
4806
  /* */
@@ -4368,6 +4844,8 @@ class HelpersCore extends HelpersMessages {
4368
4844
  /* */
4369
4845
  /* */
4370
4846
  /* */
4847
+ //#endregion
4848
+ //#region methods / kill process by port
4371
4849
  async killProcessByPort(portOrPortsToKill, options) {
4372
4850
  /* */
4373
4851
  /* */
@@ -4415,9 +4893,13 @@ class HelpersCore extends HelpersMessages {
4415
4893
  /* */
4416
4894
  return (void 0);
4417
4895
  }
4896
+ //#endregion
4897
+ //#region methods / kill on port
4418
4898
  async killOnPort(portOrPortsToKill, options) {
4419
4899
  return await Helpers.killProcessByPort(portOrPortsToKill, options);
4420
4900
  }
4901
+ //#endregion
4902
+ //#region methods / kill process
4421
4903
  killProcess(byPid) {
4422
4904
  /* */
4423
4905
  /* */
@@ -4447,8 +4929,11 @@ class HelpersCore extends HelpersMessages {
4447
4929
  /* */
4448
4930
  /* */
4449
4931
  }
4932
+ //#endregion
4933
+ //#region methods / run
4450
4934
  run(command, options) {
4451
4935
  command = Helpers._fixCommand(command);
4936
+ // console.log({ command })
4452
4937
  /* */
4453
4938
  /* */
4454
4939
  /* */
@@ -4462,6 +4947,7 @@ class HelpersCore extends HelpersMessages {
4462
4947
  * start command as synchronous nodej proces
4463
4948
  */
4464
4949
  sync() {
4950
+ // TODO buffer
4465
4951
  /* */
4466
4952
  /* */
4467
4953
  /* */
@@ -4499,7 +4985,12 @@ class HelpersCore extends HelpersMessages {
4499
4985
  * start command as asynchronous nodej proces
4500
4986
  * @param detach (default: false) - if true process will be detached
4501
4987
  */
4502
- async(detach = false, mockFun) {
4988
+ async(detach = false,
4989
+ //#region @browser
4990
+ mockFun) {
4991
+ //#region websqlFunc
4992
+ //#region mock of process
4993
+ //#region @browser
4503
4994
  if (mockFun) {
4504
4995
  const subStdoutSub = new Subject();
4505
4996
  const subStderSub = new Subject();
@@ -4582,11 +5073,14 @@ class HelpersCore extends HelpersMessages {
4582
5073
  });
4583
5074
  return procDummy;
4584
5075
  }
5076
+ //#endregion
5077
+ //#endregion
4585
5078
  /* */
4586
5079
  /* */
4587
5080
  /* */
4588
5081
  /* */
4589
5082
  return (void 0);
5083
+ //#endregion
4590
5084
  },
4591
5085
  /**
4592
5086
  * start command as asynchronous nodej proces inside promise
@@ -4799,6 +5293,8 @@ class HelpersCore extends HelpersMessages {
4799
5293
  },
4800
5294
  };
4801
5295
  }
5296
+ //#endregion
5297
+ //#region methods / question yest no
4802
5298
  /**
4803
5299
  * @deprecated use UtilsTerminal.confirm
4804
5300
  */
@@ -4812,6 +5308,8 @@ class HelpersCore extends HelpersMessages {
4812
5308
  /* */
4813
5309
  return (void 0);
4814
5310
  }
5311
+ //#endregion
5312
+ //#region methods / get stdio
4815
5313
  /* */
4816
5314
  /* */
4817
5315
  /* */
@@ -4838,6 +5336,8 @@ class HelpersCore extends HelpersMessages {
4838
5336
  /* */
4839
5337
  /* */
4840
5338
  /* */
5339
+ //#endregion
5340
+ //#region methods / run sync in
4841
5341
  /* */
4842
5342
  /* */
4843
5343
  /* */
@@ -4847,6 +5347,8 @@ class HelpersCore extends HelpersMessages {
4847
5347
  /* */
4848
5348
  /* */
4849
5349
  /* */
5350
+ //#endregion
5351
+ //#region methods / run async in
4850
5352
  /* */
4851
5353
  /* */
4852
5354
  /* */
@@ -4916,6 +5418,8 @@ class HelpersCore extends HelpersMessages {
4916
5418
  /* */
4917
5419
  /* */
4918
5420
  /* */
5421
+ //#endregion
5422
+ //#region methods / log process
4919
5423
  /* */
4920
5424
  /* */
4921
5425
  /* */
@@ -5016,6 +5520,8 @@ class HelpersCore extends HelpersMessages {
5016
5520
  /* */
5017
5521
  /* */
5018
5522
  /* */
5523
+ //#endregion
5524
+ //#region methods / check process
5019
5525
  /* */
5020
5526
  /* */
5021
5527
  /* */
@@ -5031,6 +5537,8 @@ class HelpersCore extends HelpersMessages {
5031
5537
  /* */
5032
5538
  /* */
5033
5539
  /* */
5540
+ //#endregion
5541
+ //#region methods / modify line by line
5034
5542
  /* */
5035
5543
  /* */
5036
5544
  /* */
@@ -5084,6 +5592,8 @@ class HelpersCore extends HelpersMessages {
5084
5592
  /* */
5085
5593
  /* */
5086
5594
  /* */
5595
+ //#endregion
5596
+ //#region methods / is folder
5087
5597
  /* */
5088
5598
  /* */
5089
5599
  /* */
@@ -5092,6 +5602,8 @@ class HelpersCore extends HelpersMessages {
5092
5602
  /* */
5093
5603
  /* */
5094
5604
  /* */
5605
+ //#endregion
5606
+ //#region methods / values
5095
5607
  /**
5096
5608
  * Quick fix for object values
5097
5609
  * @deprecated
@@ -5109,6 +5621,8 @@ class HelpersCore extends HelpersMessages {
5109
5621
  }
5110
5622
  return [];
5111
5623
  }
5624
+ //#endregion
5625
+ //#region methods / is file
5112
5626
  /**
5113
5627
  * does not make sense
5114
5628
  * @deprecated
@@ -5122,6 +5636,8 @@ class HelpersCore extends HelpersMessages {
5122
5636
  /* */
5123
5637
  return (void 0);
5124
5638
  }
5639
+ //#endregion
5640
+ //#region methods / read file
5125
5641
  async tryReadFile(absoluteFilePath, // @ts-ignore
5126
5642
  defaultValueWhenNotExists = void 0, notTrim = false) {
5127
5643
  /* */
@@ -5179,10 +5695,10 @@ class HelpersCore extends HelpersMessages {
5179
5695
  /* */
5180
5696
  /* */
5181
5697
  /* */
5182
- /* */
5183
- /* */
5184
5698
  return (void 0);
5185
5699
  }
5700
+ //#endregion
5701
+ //#region methods / read json
5186
5702
  /**
5187
5703
  * read json from absolute path
5188
5704
  * @returns json object
@@ -5221,6 +5737,8 @@ class HelpersCore extends HelpersMessages {
5221
5737
  /* */
5222
5738
  return (void 0);
5223
5739
  }
5740
+ //#endregion
5741
+ //#region methods / parse
5224
5742
  /* */
5225
5743
  /* */
5226
5744
  /* */
@@ -5236,6 +5754,8 @@ class HelpersCore extends HelpersMessages {
5236
5754
  /* */
5237
5755
  /* */
5238
5756
  /* */
5757
+ //#endregion
5758
+ //#region methods / compilation wrapper
5239
5759
  /* */
5240
5760
  /* */
5241
5761
  /* */
@@ -5260,6 +5780,8 @@ class HelpersCore extends HelpersMessages {
5260
5780
  /* */
5261
5781
  /* */
5262
5782
  /* */
5783
+ //#endregion
5784
+ //#region methods / replace in line
5263
5785
  replaceLinesInFile(absoluteFilePath, lineReplaceFn) {
5264
5786
  /* */
5265
5787
  /* */
@@ -5268,6 +5790,8 @@ class HelpersCore extends HelpersMessages {
5268
5790
  /* */
5269
5791
  /* */
5270
5792
  }
5793
+ //#endregion
5794
+ //#region methods / write file
5271
5795
  /* */
5272
5796
  /* */
5273
5797
  /* */
@@ -5357,6 +5881,8 @@ class HelpersCore extends HelpersMessages {
5357
5881
  /* */
5358
5882
  /* */
5359
5883
  /* */
5884
+ //#endregion
5885
+ //#region methods / write json
5360
5886
  /* */
5361
5887
  /* */
5362
5888
  /* */
@@ -5425,6 +5951,8 @@ class HelpersCore extends HelpersMessages {
5425
5951
  /* */
5426
5952
  /* */
5427
5953
  /* */
5954
+ //#endregion
5955
+ //#region methods / folders from
5428
5956
  /* */
5429
5957
  /* */
5430
5958
  /* */
@@ -5473,6 +6001,8 @@ class HelpersCore extends HelpersMessages {
5473
6001
  /* */
5474
6002
  /* */
5475
6003
  /* */
6004
+ //#endregion
6005
+ //#region methods / links from
5476
6006
  /* */
5477
6007
  /* */
5478
6008
  /* */
@@ -5508,6 +6038,8 @@ class HelpersCore extends HelpersMessages {
5508
6038
  /* */
5509
6039
  /* */
5510
6040
  /* */
6041
+ //#endregion
6042
+ //#region methods / links to folders from path
5511
6043
  /* */
5512
6044
  /* */
5513
6045
  /* */
@@ -5541,6 +6073,8 @@ class HelpersCore extends HelpersMessages {
5541
6073
  /* */
5542
6074
  /* */
5543
6075
  /* */
6076
+ //#endregion
6077
+ //#region methods / files from
5544
6078
  /* */
5545
6079
  /* */
5546
6080
  /* */
@@ -5590,6 +6124,8 @@ class HelpersCore extends HelpersMessages {
5590
6124
  /* */
5591
6125
  /* */
5592
6126
  /* */
6127
+ //#endregion
6128
+ //#region methods / open folder in file explorer
5593
6129
  /* */
5594
6130
  /* */
5595
6131
  /* */
@@ -5610,22 +6146,20 @@ class HelpersCore extends HelpersMessages {
5610
6146
  /* */
5611
6147
  /* */
5612
6148
  /* */
6149
+ //#endregion
6150
+ //#region methods / hide node warnings
5613
6151
  hideNodeWarnings() {
5614
6152
  /* */
5615
6153
  /* */
5616
6154
  /* */
5617
6155
  }
5618
6156
  }
5619
- ;
5620
- ({}); // @--end-of-file-for-module=tnp-core lib/helpers.ts
5621
6157
 
5622
6158
  const CoreConfig = {
5623
6159
  message: {
5624
6160
  globalSystemToolMode: 'globalSystemToolMode',
5625
6161
  },
5626
6162
  };
5627
- ;
5628
- ({}); // @--end-of-file-for-module=tnp-core lib/core-config.ts
5629
6163
 
5630
6164
  class PROGRESS_DATA {
5631
6165
  constructor() {
@@ -5650,6 +6184,7 @@ class PROGRESS_DATA {
5650
6184
  if (checkSplit) {
5651
6185
  const split = chunk.split(/\r\n|\n|\r/);
5652
6186
  if (split.length > 1) {
6187
+ // console.log('split founded', split)
5653
6188
  split.forEach(s => {
5654
6189
  res = res.concat(this.resolveFrom(s, callbackOnFounded, false));
5655
6190
  });
@@ -5677,8 +6212,6 @@ class PROGRESS_DATA {
5677
6212
  return res;
5678
6213
  }
5679
6214
  }
5680
- ;
5681
- ({}); // @--end-of-file-for-module=tnp-core lib/progress-data.ts
5682
6215
 
5683
6216
  /* */
5684
6217
  /* */
@@ -5697,8 +6230,6 @@ class CLI {
5697
6230
  /* */
5698
6231
  static { this.chalk = chalk; }
5699
6232
  }
5700
- ;
5701
- ({}); // @--end-of-file-for-module=tnp-core lib/core-cli.ts
5702
6233
 
5703
6234
  /**
5704
6235
  * TODO slowly refactor this.. only actually globally needed are:
@@ -5776,12 +6307,8 @@ const requiredForDev = {
5776
6307
  /* */
5777
6308
  ],
5778
6309
  };
5779
- ;
5780
- ({}); // @--end-of-file-for-module=tnp-core lib/required-global-npm-packages.ts
5781
6310
 
5782
6311
  let Helpers = HelpersCore.InstanceCore;
5783
- ;
5784
- ({}); // @--end-of-file-for-module=tnp-core lib/index.ts
5785
6312
 
5786
6313
  /**
5787
6314
  * Generated bundle index. Do not edit.