tnp-core 16.5.7 → 16.5.9

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 (40) hide show
  1. package/assets/shared/shared_folder_info.txt +1 -1
  2. package/browser/esm2022/lib/core-models.mjs +1 -2
  3. package/browser/esm2022/lib/helpers-messages.mjs +1 -33
  4. package/browser/esm2022/lib/helpers.mjs +2 -17
  5. package/browser/esm2022/lib/node-chalk-mock.mjs +1 -3
  6. package/browser/esm2022/lib/node-path-mock.mjs +1 -57
  7. package/browser/esm2022/lib/progress-data.mjs +1 -2
  8. package/browser/esm2022/lib/utils.mjs +2 -15
  9. package/browser/fesm2022/tnp-core.mjs +2 -122
  10. package/browser/fesm2022/tnp-core.mjs.map +1 -1
  11. package/browser/lib/utils.d.ts +1 -1
  12. package/cli.backend.js +3 -3
  13. package/client/esm2022/lib/core-models.mjs +1 -2
  14. package/client/esm2022/lib/helpers-messages.mjs +1 -33
  15. package/client/esm2022/lib/helpers.mjs +2 -17
  16. package/client/esm2022/lib/node-chalk-mock.mjs +1 -3
  17. package/client/esm2022/lib/node-path-mock.mjs +1 -57
  18. package/client/esm2022/lib/progress-data.mjs +1 -2
  19. package/client/esm2022/lib/utils.mjs +2 -15
  20. package/client/fesm2022/tnp-core.mjs +2 -122
  21. package/client/fesm2022/tnp-core.mjs.map +1 -1
  22. package/client/lib/utils.d.ts +1 -1
  23. package/client/package.json +32 -32
  24. package/lib/node-chalk-mock.js +3 -3
  25. package/lib/node-path-mock.js +3 -3
  26. package/lib/utils.d.ts +1 -1
  27. package/lib/utils.js +2 -2
  28. package/lib/utils.js.map +1 -1
  29. package/package.json +2 -2
  30. package/tmp-environment.json +36 -36
  31. package/websql/esm2022/lib/core-models.mjs +1 -2
  32. package/websql/esm2022/lib/helpers-messages.mjs +1 -33
  33. package/websql/esm2022/lib/helpers.mjs +2 -17
  34. package/websql/esm2022/lib/node-chalk-mock.mjs +1 -3
  35. package/websql/esm2022/lib/node-path-mock.mjs +1 -57
  36. package/websql/esm2022/lib/progress-data.mjs +1 -2
  37. package/websql/esm2022/lib/utils.mjs +2 -15
  38. package/websql/fesm2022/tnp-core.mjs +2 -122
  39. package/websql/fesm2022/tnp-core.mjs.map +1 -1
  40. package/websql/lib/utils.d.ts +1 -1
@@ -26,7 +26,6 @@ function assertPath(path) {
26
26
  throw new TypeError('[firedev-core] Path must be a string. Received ' + JSON.stringify(path));
27
27
  }
28
28
  }
29
- /* \/\/ Resolves \. and \.\. elements in a path with directory names */
30
29
  function normalizeStringPosix(path, allowAboveRoot) {
31
30
  var res = '';
32
31
  var lastSegmentLength = 0;
@@ -42,7 +41,6 @@ function normalizeStringPosix(path, allowAboveRoot) {
42
41
  code = 47 /*/*/;
43
42
  if (code === 47 /*/*/) {
44
43
  if (lastSlash === i - 1 || dots === 1) {
45
- /* \/\/ NOOP */
46
44
  }
47
45
  else if (lastSlash !== i - 1 && dots === 2) {
48
46
  if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
@@ -109,7 +107,6 @@ function _format(sep, pathObject) {
109
107
  return dir + sep + base;
110
108
  }
111
109
  const path$1 = {
112
- /* \/\/ path\.resolve\(\[from \.\.\.\], to\) */
113
110
  resolve: function resolve(pathToResovle) {
114
111
  return pathToResovle;
115
112
  },
@@ -119,7 +116,6 @@ const path$1 = {
119
116
  return '.';
120
117
  var isAbsolute = pathArg.charCodeAt(0) === 47 /*/*/;
121
118
  var trailingSeparator = pathArg.charCodeAt(pathArg.length - 1) === 47 /*/*/;
122
- /* \/\/ Normalize the path */
123
119
  pathArg = normalizeStringPosix(pathArg, !isAbsolute);
124
120
  if (pathArg.length === 0 && !isAbsolute)
125
121
  pathArg = '.';
@@ -160,7 +156,6 @@ const path$1 = {
160
156
  to = path$1.resolve(to);
161
157
  if (from === to)
162
158
  return '';
163
- /* \/\/ Trim any leading backslashes */
164
159
  var fromStart = 1;
165
160
  for (; fromStart < from.length; ++fromStart) {
166
161
  if (from.charCodeAt(fromStart) !== 47 /*/*/)
@@ -168,7 +163,6 @@ const path$1 = {
168
163
  }
169
164
  var fromEnd = from.length;
170
165
  var fromLen = fromEnd - fromStart;
171
- /* \/\/ Trim any leading backslashes */
172
166
  var toStart = 1;
173
167
  for (; toStart < to.length; ++toStart) {
174
168
  if (to.charCodeAt(toStart) !== 47 /*/*/)
@@ -176,7 +170,6 @@ const path$1 = {
176
170
  }
177
171
  var toEnd = to.length;
178
172
  var toLen = toEnd - toStart;
179
- /* \/\/ Compare paths to find the longest common path from root */
180
173
  var length = fromLen < toLen ? fromLen : toLen;
181
174
  var lastCommonSep = -1;
182
175
  var i = 0;
@@ -184,25 +177,17 @@ const path$1 = {
184
177
  if (i === length) {
185
178
  if (toLen > length) {
186
179
  if (to.charCodeAt(toStart + i) === 47 /*/*/) {
187
- /* \/\/ We get here if `from` is the exact base path for `to`\. */
188
- /* \/\/ For example: from='\/foo\/bar'; to='\/foo\/bar\/baz' */
189
180
  return to.slice(toStart + i + 1);
190
181
  }
191
182
  else if (i === 0) {
192
- /* \/\/ We get here if `from` is the root */
193
- /* \/\/ For example: from='\/'; to='\/foo' */
194
183
  return to.slice(toStart + i);
195
184
  }
196
185
  }
197
186
  else if (fromLen > length) {
198
187
  if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
199
- /* \/\/ We get here if `to` is the exact base path for `from`\. */
200
- /* \/\/ For example: from='\/foo\/bar\/baz'; to='\/foo\/bar' */
201
188
  lastCommonSep = i;
202
189
  }
203
190
  else if (i === 0) {
204
- /* \/\/ We get here if `to` is the root\. */
205
- /* \/\/ For example: from='\/foo'; to='\/' */
206
191
  lastCommonSep = 0;
207
192
  }
208
193
  }
@@ -216,8 +201,6 @@ const path$1 = {
216
201
  lastCommonSep = i;
217
202
  }
218
203
  var out = '';
219
- /* \/\/ Generate the relative path based on the path difference between `to` */
220
- /* \/\/ and `from` */
221
204
  for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
222
205
  if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
223
206
  if (out.length === 0)
@@ -226,8 +209,6 @@ const path$1 = {
226
209
  out += '/..';
227
210
  }
228
211
  }
229
- /* \/\/ Lastly, append the rest of the destination \(`to`\) path that comes after */
230
- /* \/\/ the common path parts */
231
212
  if (out.length > 0)
232
213
  return out + to.slice(toStart + lastCommonSep);
233
214
  else {
@@ -257,7 +238,6 @@ const path$1 = {
257
238
  }
258
239
  }
259
240
  else {
260
- /* \/\/ We saw the first non\-path separator */
261
241
  matchedSlash = false;
262
242
  }
263
243
  }
@@ -283,8 +263,6 @@ const path$1 = {
283
263
  for (i = pathArg.length - 1; i >= 0; --i) {
284
264
  var code = pathArg.charCodeAt(i);
285
265
  if (code === 47 /*/*/) {
286
- /* \/\/ If we reached a path separator that was not part of a set of path */
287
- /* \/\/ separators at the end of the string, stop now */
288
266
  if (!matchedSlash) {
289
267
  start = i + 1;
290
268
  break;
@@ -292,23 +270,16 @@ const path$1 = {
292
270
  }
293
271
  else {
294
272
  if (firstNonSlashEnd === -1) {
295
- /* \/\/ We saw the first non\-path separator, remember this index in case */
296
- /* \/\/ we need it if the extension ends up not matching */
297
273
  matchedSlash = false;
298
274
  firstNonSlashEnd = i + 1;
299
275
  }
300
276
  if (extIdx >= 0) {
301
- /* \/\/ Try to match the explicit extension */
302
277
  if (code === ext.charCodeAt(extIdx)) {
303
278
  if (--extIdx === -1) {
304
- /* \/\/ We matched the extension, so mark this as the end of our path */
305
- /* \/\/ component */
306
279
  end = i;
307
280
  }
308
281
  }
309
282
  else {
310
- /* \/\/ Extension does not match, so our result is the entire path */
311
- /* \/\/ component */
312
283
  extIdx = -1;
313
284
  end = firstNonSlashEnd;
314
285
  }
@@ -324,16 +295,12 @@ const path$1 = {
324
295
  else {
325
296
  for (i = pathArg.length - 1; i >= 0; --i) {
326
297
  if (pathArg.charCodeAt(i) === 47 /*/*/) {
327
- /* \/\/ If we reached a path separator that was not part of a set of path */
328
- /* \/\/ separators at the end of the string, stop now */
329
298
  if (!matchedSlash) {
330
299
  start = i + 1;
331
300
  break;
332
301
  }
333
302
  }
334
303
  else if (end === -1) {
335
- /* \/\/ We saw the first non\-path separator, mark this as the end of our */
336
- /* \/\/ path component */
337
304
  matchedSlash = false;
338
305
  end = i + 1;
339
306
  }
@@ -349,14 +316,10 @@ const path$1 = {
349
316
  var startPart = 0;
350
317
  var end = -1;
351
318
  var matchedSlash = true;
352
- /* \/\/ Track the state of characters \(if any\) we see before our first dot and */
353
- /* \/\/ after any path separator we find */
354
319
  var preDotState = 0;
355
320
  for (var i = pathArg.length - 1; i >= 0; --i) {
356
321
  var code = pathArg.charCodeAt(i);
357
322
  if (code === 47 /*/*/) {
358
- /* \/\/ If we reached a path separator that was not part of a set of path */
359
- /* \/\/ separators at the end of the string, stop now */
360
323
  if (!matchedSlash) {
361
324
  startPart = i + 1;
362
325
  break;
@@ -364,28 +327,21 @@ const path$1 = {
364
327
  continue;
365
328
  }
366
329
  if (end === -1) {
367
- /* \/\/ We saw the first non\-path separator, mark this as the end of our */
368
- /* \/\/ extension */
369
330
  matchedSlash = false;
370
331
  end = i + 1;
371
332
  }
372
333
  if (code === 46 /*.*/) {
373
- /* \/\/ If this is our first dot, mark it as the start of our extension */
374
334
  if (startDot === -1)
375
335
  startDot = i;
376
336
  else if (preDotState !== 1)
377
337
  preDotState = 1;
378
338
  }
379
339
  else if (startDot !== -1) {
380
- /* \/\/ We saw a non\-dot and non\-path separator before our dot, so we should */
381
- /* \/\/ have a good chance at having a non\-empty extension */
382
340
  preDotState = -1;
383
341
  }
384
342
  }
385
343
  if (startDot === -1 || end === -1 ||
386
- /* \/\/ We saw a non\-dot character immediately before the dot */
387
344
  preDotState === 0 ||
388
- /* \/\/ The \(right\-most\) trimmed path component is exactly '\.\.' */
389
345
  preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
390
346
  return '';
391
347
  }
@@ -417,15 +373,10 @@ const path$1 = {
417
373
  var end = -1;
418
374
  var matchedSlash = true;
419
375
  var i = pathArg.length - 1;
420
- /* \/\/ Track the state of characters \(if any\) we see before our first dot and */
421
- /* \/\/ after any path separator we find */
422
376
  var preDotState = 0;
423
- /* \/\/ Get non\-dir info */
424
377
  for (; i >= start; --i) {
425
378
  code = pathArg.charCodeAt(i);
426
379
  if (code === 47 /*/*/) {
427
- /* \/\/ If we reached a path separator that was not part of a set of path */
428
- /* \/\/ separators at the end of the string, stop now */
429
380
  if (!matchedSlash) {
430
381
  startPart = i + 1;
431
382
  break;
@@ -433,28 +384,21 @@ const path$1 = {
433
384
  continue;
434
385
  }
435
386
  if (end === -1) {
436
- /* \/\/ We saw the first non\-path separator, mark this as the end of our */
437
- /* \/\/ extension */
438
387
  matchedSlash = false;
439
388
  end = i + 1;
440
389
  }
441
390
  if (code === 46 /*.*/) {
442
- /* \/\/ If this is our first dot, mark it as the start of our extension */
443
391
  if (startDot === -1)
444
392
  startDot = i;
445
393
  else if (preDotState !== 1)
446
394
  preDotState = 1;
447
395
  }
448
396
  else if (startDot !== -1) {
449
- /* \/\/ We saw a non\-dot and non\-path separator before our dot, so we should */
450
- /* \/\/ have a good chance at having a non\-empty extension */
451
397
  preDotState = -1;
452
398
  }
453
399
  }
454
400
  if (startDot === -1 || end === -1 ||
455
- /* \/\/ We saw a non\-dot character immediately before the dot */
456
401
  preDotState === 0 ||
457
- /* \/\/ The \(right\-most\) trimmed path component is exactly '\.\.' */
458
402
  preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
459
403
  if (end !== -1) {
460
404
  if (startPart === 0 && isAbsolute)
@@ -492,8 +436,6 @@ const path$1 = {
492
436
  ;
493
437
  ({}); // @--end-of-file-for-module=tnp-core lib/node-path-mock.ts
494
438
 
495
- /* \/\/ TODO finish this MOCK @LAST */
496
- /* \/\/ const c:Chalk = void 0; */
497
439
  const allObj = {
498
440
  black(a) {
499
441
  console.log(a);
@@ -579,7 +521,6 @@ const crossPlatformPath = (pathStringOrPathParts) => {
579
521
  };
580
522
  ({}); // @--end-of-file-for-module=tnp-core lib/core-imports.ts
581
523
 
582
- /* \/\/ https:\/\/developer\.mozilla\.org\/en\-US\/docs\/Web\/HTTP\/Basics_of_HTTP\/MIME_types\/Common_types */
583
524
  const mimeTypes = {
584
525
  ".aac": "audio/aac",
585
526
  ".abw": "application/x-abiword",
@@ -712,9 +653,6 @@ class HelpersIsomorphic {
712
653
  /* */
713
654
  /* */
714
655
  /* */
715
- /* \/\/ import \{ config \} from 'tnp\-config'; */
716
- /* \/\/ import \{ PROGRESS_DATA \} from 'tnp\-models'; */
717
- /* \/\/ TODO handle global\.testMode \? */
718
656
  const KEY = {
719
657
  LAST_ERROR: Symbol(),
720
658
  LAST_INFO: Symbol(),
@@ -765,34 +703,6 @@ const KEY_IMPORTANTCE = {
765
703
  /* */
766
704
  /* */
767
705
  const LIMIT = 10;
768
- /* \/\/ export class Log \{ */
769
- /* \/\/ private static _instance: Log; */
770
- /* \/\/ public Instance\(\) \{ */
771
- /* \/\/ if \(!Log\._instance\) \{ */
772
- /* \/\/ Log\._instance = new Log\(\); */
773
- /* \/\/ \} */
774
- /* \/\/ return Log\._instance; */
775
- /* \/\/ \} */
776
- /* \/\/ create\(name: string, level\?: Level\) \{ */
777
- /* \/\/ if \(level === void 0\) \{ */
778
- /* \/\/ level = Level\.DATA; */
779
- /* \/\/ \} */
780
- /* \/\/ return \{ */
781
- /* \/\/ d\(details: string, debugLevel\?: number\) \{ */
782
- /* \/\/ return Helpers\.log\(`\[\$\{name\}\] \$\{details\}`, debugLevel\) */
783
- /* \/\/ \}, */
784
- /* \/\/ i\(details: string\) \{ */
785
- /* \/\/ return Helpers\.info\(`\[\$\{name\}\] \$\{details\}`\) */
786
- /* \/\/ \}, */
787
- /* \/\/ w\(details: string, noExit = false, noTrace = false\) \{ */
788
- /* \/\/ return Helpers\.error\(`\[\$\{name\}\] \$\{details\}`, noExit, noTrace\); */
789
- /* \/\/ \}, */
790
- /* \/\/ er\(details: string, \) \{ */
791
- /* \/\/ return Helpers\.info\(`\[\$\{name\}\] \$\{details\}`\) */
792
- /* \/\/ \}, */
793
- /* \/\/ \} */
794
- /* \/\/ \} */
795
- /* \/\/ \} */
796
706
  class HelpersMessages extends HelpersIsomorphic {
797
707
  msgCacheClear() {
798
708
  /* */
@@ -806,7 +716,6 @@ class HelpersMessages extends HelpersIsomorphic {
806
716
  /* */
807
717
  /* */
808
718
  /* */
809
- /* \/\/ TODO for FE */
810
719
  console.error(err);
811
720
  }
812
721
  error(details, noExit = false, noTrace = false) {
@@ -1310,7 +1219,6 @@ class HelpersCore extends HelpersMessages {
1310
1219
  * @returns
1311
1220
  */
1312
1221
  isBlob(maybeBlob) {
1313
- /* \/\/ TODO is this needed hmmmm */
1314
1222
  return maybeBlob instanceof Blob; // || toString.call(maybeBlob) === '[object Blob]';
1315
1223
  }
1316
1224
  /**
@@ -1335,13 +1243,6 @@ class HelpersCore extends HelpersMessages {
1335
1243
  * stringify to pretty json string
1336
1244
  */
1337
1245
  stringify(inputObject) {
1338
- /* \/\/ if \(_\.isString\(inputObject\)\) \{ */
1339
- /* \/\/ return inputObject; */
1340
- /* \/\/ \} */
1341
- /* \/\/ if \(_\.isObject\(inputObject\)\) \{ */
1342
- /* \/\/ config\.log\(inputObject\) */
1343
- /* \/\/ Helpers\.error\(`\[tnp\-helpers\] trying to stringify not a object`, false, true\); */
1344
- /* \/\/ \} */
1345
1246
  return JSON.stringify(inputObject, null, 2);
1346
1247
  }
1347
1248
  async runSyncOrAsync(fnOrOptions, ...firstArg) {
@@ -1361,12 +1262,9 @@ class HelpersCore extends HelpersMessages {
1361
1262
  // @ts-ignore
1362
1263
  promisOrValue = _.isArray(fnOrOptions) ? fnOrOptions[1][fnOrOptions[0]](...firstArg) : fnOrOptions(...firstArg);
1363
1264
  }
1364
- /* \/\/ let wasPromise = false; */
1365
1265
  if (promisOrValue instanceof Promise) {
1366
- /* \/\/ wasPromise = true; */
1367
1266
  promisOrValue = Promise.resolve(promisOrValue);
1368
1267
  }
1369
- /* \/\/ console\.log\('was promis ', wasPromise\) */
1370
1268
  return promisOrValue;
1371
1269
  }
1372
1270
  /* */
@@ -1692,9 +1590,7 @@ class HelpersCore extends HelpersMessages {
1692
1590
  /* */
1693
1591
  /* */
1694
1592
  /* */
1695
- exists(folderOrFilePath
1696
- /* \/\/ , allowUnexistedLinks = false */
1697
- ) {
1593
+ exists(folderOrFilePath) {
1698
1594
  /* */
1699
1595
  /* */
1700
1596
  /* */
@@ -1731,7 +1627,6 @@ class HelpersCore extends HelpersMessages {
1731
1627
  return command;
1732
1628
  }
1733
1629
  command(command) {
1734
- /* \/\/ console\.log\(\{ command \}\) */
1735
1630
  command = Helpers._fixCommand(command);
1736
1631
  return {
1737
1632
  /* */
@@ -1900,7 +1795,6 @@ class HelpersCore extends HelpersMessages {
1900
1795
  }
1901
1796
  run(command, options) {
1902
1797
  command = Helpers._fixCommand(command);
1903
- /* \/\/ console\.log\(\{ command \}\) */
1904
1798
  /* */
1905
1799
  /* */
1906
1800
  /* */
@@ -2537,7 +2431,6 @@ class PROGRESS_DATA {
2537
2431
  if (checkSplit) {
2538
2432
  const split = chunk.split(/\r\n|\n|\r/);
2539
2433
  if (split.length > 1) {
2540
- /* \/\/ console\.log\('split founded', split\) */
2541
2434
  split.forEach(s => {
2542
2435
  res = res.concat(this.resolveFrom(s, callbackOnFounded, false));
2543
2436
  });
@@ -2639,7 +2532,6 @@ var Utils;
2639
2532
  if (!m) {
2640
2533
  throw new Error(`[firedev-framework][base64toBlob] Not a base64 blob [${base64Data}]`);
2641
2534
  }
2642
- /* \/\/ tslint:disable\-next\-line:prefer\-const */
2643
2535
  var [__, contenttype, filebase64] = m;
2644
2536
  content_type = contenttype;
2645
2537
  file_base64 = filebase64;
@@ -2655,7 +2547,6 @@ var Utils;
2655
2547
  const begin = sliceIndex * sliceSize;
2656
2548
  const end = Math.min(begin + sliceSize, bytesLength);
2657
2549
  const bytes = new Array(end - begin);
2658
- /* \/\/ tslint:disable\-next\-line:one\-variable\-per\-declaration */
2659
2550
  for (let offset = begin, i = 0; offset < end; ++i, ++offset) {
2660
2551
  bytes[i] = byteCharacters[offset].charCodeAt(0);
2661
2552
  }
@@ -2791,16 +2682,10 @@ var Utils;
2791
2682
  }
2792
2683
  binary.blobToText = blobToText;
2793
2684
  async function textToFile(text, fileRelativePathOrName) {
2794
- /* \/\/ console\.log\(\{ path \}\) */
2795
2685
  const ext = path.extname(fileRelativePathOrName);
2796
2686
  const type = mimeTypes[ext];
2797
2687
  const blob = new Blob([text], { type });
2798
2688
  const file = await blobToFile(blob, fileRelativePathOrName);
2799
- /* \/\/ console\.log\(\{ */
2800
- /* \/\/ ext, */
2801
- /* \/\/ blob, file */
2802
- /* \/\/ \}\); */
2803
- /* \/\/ debugger */
2804
2689
  return file;
2805
2690
  }
2806
2691
  binary.textToFile = textToFile;
@@ -2838,12 +2723,7 @@ var Utils;
2838
2723
  * @returns
2839
2724
  */
2840
2725
  function numValue(pixelsCss) {
2841
- /* \/\/ tslint:disable\-next\-line:radix */
2842
- return parseInt(pixelsCss
2843
- .replace('px', '')
2844
- /* \/\/ \.replace\('pt', ''\) TOOD handle other types */
2845
- /* \/\/ \.replace\('1rem', ''\) \/\/ to */
2846
- );
2726
+ return parseInt(pixelsCss?.toString()?.replace('px', ''));
2847
2727
  }
2848
2728
  css.numValue = numValue;
2849
2729
  })(css = Utils.css || (Utils.css = {}));