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",
@@ -711,9 +652,6 @@ class HelpersIsomorphic {
711
652
  /* */
712
653
  /* */
713
654
  /* */
714
- /* \/\/ import \{ config \} from 'tnp\-config'; */
715
- /* \/\/ import \{ PROGRESS_DATA \} from 'tnp\-models'; */
716
- /* \/\/ TODO handle global\.testMode \? */
717
655
  const KEY = {
718
656
  LAST_ERROR: Symbol(),
719
657
  LAST_INFO: Symbol(),
@@ -764,34 +702,6 @@ const KEY_IMPORTANTCE = {
764
702
  /* */
765
703
  /* */
766
704
  const LIMIT = 10;
767
- /* \/\/ export class Log \{ */
768
- /* \/\/ private static _instance: Log; */
769
- /* \/\/ public Instance\(\) \{ */
770
- /* \/\/ if \(!Log\._instance\) \{ */
771
- /* \/\/ Log\._instance = new Log\(\); */
772
- /* \/\/ \} */
773
- /* \/\/ return Log\._instance; */
774
- /* \/\/ \} */
775
- /* \/\/ create\(name: string, level\?: Level\) \{ */
776
- /* \/\/ if \(level === void 0\) \{ */
777
- /* \/\/ level = Level\.DATA; */
778
- /* \/\/ \} */
779
- /* \/\/ return \{ */
780
- /* \/\/ d\(details: string, debugLevel\?: number\) \{ */
781
- /* \/\/ return Helpers\.log\(`\[\$\{name\}\] \$\{details\}`, debugLevel\) */
782
- /* \/\/ \}, */
783
- /* \/\/ i\(details: string\) \{ */
784
- /* \/\/ return Helpers\.info\(`\[\$\{name\}\] \$\{details\}`\) */
785
- /* \/\/ \}, */
786
- /* \/\/ w\(details: string, noExit = false, noTrace = false\) \{ */
787
- /* \/\/ return Helpers\.error\(`\[\$\{name\}\] \$\{details\}`, noExit, noTrace\); */
788
- /* \/\/ \}, */
789
- /* \/\/ er\(details: string, \) \{ */
790
- /* \/\/ return Helpers\.info\(`\[\$\{name\}\] \$\{details\}`\) */
791
- /* \/\/ \}, */
792
- /* \/\/ \} */
793
- /* \/\/ \} */
794
- /* \/\/ \} */
795
705
  class HelpersMessages extends HelpersIsomorphic {
796
706
  msgCacheClear() {
797
707
  /* */
@@ -805,7 +715,6 @@ class HelpersMessages extends HelpersIsomorphic {
805
715
  /* */
806
716
  /* */
807
717
  /* */
808
- /* \/\/ TODO for FE */
809
718
  console.error(err);
810
719
  }
811
720
  error(details, noExit = false, noTrace = false) {
@@ -1309,7 +1218,6 @@ class HelpersCore extends HelpersMessages {
1309
1218
  * @returns
1310
1219
  */
1311
1220
  isBlob(maybeBlob) {
1312
- /* \/\/ TODO is this needed hmmmm */
1313
1221
  return maybeBlob instanceof Blob; // || toString.call(maybeBlob) === '[object Blob]';
1314
1222
  }
1315
1223
  /**
@@ -1334,13 +1242,6 @@ class HelpersCore extends HelpersMessages {
1334
1242
  * stringify to pretty json string
1335
1243
  */
1336
1244
  stringify(inputObject) {
1337
- /* \/\/ if \(_\.isString\(inputObject\)\) \{ */
1338
- /* \/\/ return inputObject; */
1339
- /* \/\/ \} */
1340
- /* \/\/ if \(_\.isObject\(inputObject\)\) \{ */
1341
- /* \/\/ config\.log\(inputObject\) */
1342
- /* \/\/ Helpers\.error\(`\[tnp\-helpers\] trying to stringify not a object`, false, true\); */
1343
- /* \/\/ \} */
1344
1245
  return JSON.stringify(inputObject, null, 2);
1345
1246
  }
1346
1247
  async runSyncOrAsync(fnOrOptions, ...firstArg) {
@@ -1360,12 +1261,9 @@ class HelpersCore extends HelpersMessages {
1360
1261
  // @ts-ignore
1361
1262
  promisOrValue = _.isArray(fnOrOptions) ? fnOrOptions[1][fnOrOptions[0]](...firstArg) : fnOrOptions(...firstArg);
1362
1263
  }
1363
- /* \/\/ let wasPromise = false; */
1364
1264
  if (promisOrValue instanceof Promise) {
1365
- /* \/\/ wasPromise = true; */
1366
1265
  promisOrValue = Promise.resolve(promisOrValue);
1367
1266
  }
1368
- /* \/\/ console\.log\('was promis ', wasPromise\) */
1369
1267
  return promisOrValue;
1370
1268
  }
1371
1269
  /* */
@@ -1691,9 +1589,7 @@ class HelpersCore extends HelpersMessages {
1691
1589
  /* */
1692
1590
  /* */
1693
1591
  /* */
1694
- exists(folderOrFilePath
1695
- /* \/\/ , allowUnexistedLinks = false */
1696
- ) {
1592
+ exists(folderOrFilePath) {
1697
1593
  /* */
1698
1594
  /* */
1699
1595
  /* */
@@ -1730,7 +1626,6 @@ class HelpersCore extends HelpersMessages {
1730
1626
  return command;
1731
1627
  }
1732
1628
  command(command) {
1733
- /* \/\/ console\.log\(\{ command \}\) */
1734
1629
  command = Helpers._fixCommand(command);
1735
1630
  return {
1736
1631
  /* */
@@ -1897,7 +1792,6 @@ class HelpersCore extends HelpersMessages {
1897
1792
  }
1898
1793
  run(command, options) {
1899
1794
  command = Helpers._fixCommand(command);
1900
- /* \/\/ console\.log\(\{ command \}\) */
1901
1795
  /* */
1902
1796
  /* */
1903
1797
  /* */
@@ -2534,7 +2428,6 @@ class PROGRESS_DATA {
2534
2428
  if (checkSplit) {
2535
2429
  const split = chunk.split(/\r\n|\n|\r/);
2536
2430
  if (split.length > 1) {
2537
- /* \/\/ console\.log\('split founded', split\) */
2538
2431
  split.forEach(s => {
2539
2432
  res = res.concat(this.resolveFrom(s, callbackOnFounded, false));
2540
2433
  });
@@ -2636,7 +2529,6 @@ var Utils;
2636
2529
  if (!m) {
2637
2530
  throw new Error(`[firedev-framework][base64toBlob] Not a base64 blob [${base64Data}]`);
2638
2531
  }
2639
- /* \/\/ tslint:disable\-next\-line:prefer\-const */
2640
2532
  var [__, contenttype, filebase64] = m;
2641
2533
  content_type = contenttype;
2642
2534
  file_base64 = filebase64;
@@ -2652,7 +2544,6 @@ var Utils;
2652
2544
  const begin = sliceIndex * sliceSize;
2653
2545
  const end = Math.min(begin + sliceSize, bytesLength);
2654
2546
  const bytes = new Array(end - begin);
2655
- /* \/\/ tslint:disable\-next\-line:one\-variable\-per\-declaration */
2656
2547
  for (let offset = begin, i = 0; offset < end; ++i, ++offset) {
2657
2548
  bytes[i] = byteCharacters[offset].charCodeAt(0);
2658
2549
  }
@@ -2788,16 +2679,10 @@ var Utils;
2788
2679
  }
2789
2680
  binary.blobToText = blobToText;
2790
2681
  async function textToFile(text, fileRelativePathOrName) {
2791
- /* \/\/ console\.log\(\{ path \}\) */
2792
2682
  const ext = path.extname(fileRelativePathOrName);
2793
2683
  const type = mimeTypes[ext];
2794
2684
  const blob = new Blob([text], { type });
2795
2685
  const file = await blobToFile(blob, fileRelativePathOrName);
2796
- /* \/\/ console\.log\(\{ */
2797
- /* \/\/ ext, */
2798
- /* \/\/ blob, file */
2799
- /* \/\/ \}\); */
2800
- /* \/\/ debugger */
2801
2686
  return file;
2802
2687
  }
2803
2688
  binary.textToFile = textToFile;
@@ -2835,12 +2720,7 @@ var Utils;
2835
2720
  * @returns
2836
2721
  */
2837
2722
  function numValue(pixelsCss) {
2838
- /* \/\/ tslint:disable\-next\-line:radix */
2839
- return parseInt(pixelsCss
2840
- .replace('px', '')
2841
- /* \/\/ \.replace\('pt', ''\) TOOD handle other types */
2842
- /* \/\/ \.replace\('1rem', ''\) \/\/ to */
2843
- );
2723
+ return parseInt(pixelsCss?.toString()?.replace('px', ''));
2844
2724
  }
2845
2725
  css.numValue = numValue;
2846
2726
  })(css = Utils.css || (Utils.css = {}));