tnp-core 21.0.25 → 21.0.27

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 (58) hide show
  1. package/browser/fesm2022/tnp-core-browser.mjs +191 -137
  2. package/browser/fesm2022/tnp-core-browser.mjs.map +1 -1
  3. package/browser/package.json +1 -1
  4. package/browser/types/tnp-core-browser.d.ts +14 -1
  5. package/cli.backend.js +2 -2
  6. package/lib/build-info._auto-generated_.d.ts +1 -1
  7. package/lib/build-info._auto-generated_.js +1 -1
  8. package/lib/command-exists.d.ts +2 -0
  9. package/lib/command-exists.js +116 -0
  10. package/lib/command-exists.js.map +1 -0
  11. package/lib/constants.d.ts +4 -0
  12. package/lib/constants.js +4 -0
  13. package/lib/constants.js.map +1 -1
  14. package/lib/core-models.d.ts +8 -0
  15. package/lib/core-models.js +8 -0
  16. package/lib/core-models.js.map +1 -1
  17. package/lib/env/env.angular-node-app.d.ts +2 -3
  18. package/lib/env/env.angular-node-app.js +4 -5
  19. package/lib/env/env.angular-node-app.js.map +1 -1
  20. package/lib/env/env.docs-webapp.d.ts +2 -3
  21. package/lib/env/env.docs-webapp.js +4 -5
  22. package/lib/env/env.docs-webapp.js.map +1 -1
  23. package/lib/env/env.electron-app.d.ts +2 -3
  24. package/lib/env/env.electron-app.js +4 -5
  25. package/lib/env/env.electron-app.js.map +1 -1
  26. package/lib/env/env.mobile-app.d.ts +2 -3
  27. package/lib/env/env.mobile-app.js +4 -5
  28. package/lib/env/env.mobile-app.js.map +1 -1
  29. package/lib/env/env.npm-lib-and-cli-tool.d.ts +2 -3
  30. package/lib/env/env.npm-lib-and-cli-tool.js +4 -5
  31. package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
  32. package/lib/env/env.vscode-plugin.d.ts +2 -3
  33. package/lib/env/env.vscode-plugin.js +4 -5
  34. package/lib/env/env.vscode-plugin.js.map +1 -1
  35. package/lib/env.backend.d.ts +34 -0
  36. package/lib/env.backend.js +40 -0
  37. package/lib/env.backend.js.map +1 -0
  38. package/lib/env.browser.d.ts +34 -0
  39. package/lib/helpers.js +6 -1
  40. package/lib/helpers.js.map +1 -1
  41. package/lib/index._auto-generated_.js +1 -1
  42. package/lib/index._auto-generated_.js.map +1 -1
  43. package/lib/node-chalk-mock.js +2 -2
  44. package/lib/node-path-mock.js +2 -2
  45. package/lib/progress-data.js +2 -1
  46. package/lib/progress-data.js.map +1 -1
  47. package/lib/required.d.ts +44 -0
  48. package/lib/required.js +76 -0
  49. package/lib/required.js.map +1 -0
  50. package/lib/utils.d.ts +2 -1
  51. package/lib/utils.js +39 -4
  52. package/lib/utils.js.map +1 -1
  53. package/package.json +1 -1
  54. package/tmp-environment.json +33 -0
  55. package/websql/fesm2022/tnp-core-websql.mjs +191 -137
  56. package/websql/fesm2022/tnp-core-websql.mjs.map +1 -1
  57. package/websql/package.json +1 -1
  58. package/websql/types/tnp-core-websql.d.ts +14 -1
@@ -965,6 +965,14 @@ var CoreModels;
965
965
  CoreModels.SPECIAL_APP_READY_MESSAGE = '$$$ APP_READY $$$';
966
966
  CoreModels.ClassNameStaticProperty = '$$className$$';
967
967
  CoreModels.TaonHttpErrorCustomProp = '$$taonError$$';
968
+ /**
969
+ * Absolute path to project children;
970
+ */
971
+ CoreModels.pathToChildren = 'path-to-children';
972
+ /**
973
+ * Absolute path to project parent;
974
+ */
975
+ CoreModels.parentLocation = 'parent-location';
968
976
  })(CoreModels || (CoreModels = {}));
969
977
 
970
978
  const taonContainers = 'taon-containers';
@@ -1295,6 +1303,10 @@ const TAGS = {
1295
1303
  CUT_CODE_IF_FALSE: '@cutCode' + 'IfFalse',
1296
1304
  COMMENT_REGION: `//${'#reg' + 'ion'}`,
1297
1305
  COMMENT_END_REGION: `//${'#end' + 'region'}`,
1306
+ APP_TS_GENERATED: `${'@app-ts-gene' + 'rated'}`,
1307
+ APP_TS_PLACEHOLDER_IMPORTS: `${'@place' + 'holder-for-imports'}`,
1308
+ APP_TS_PLACEHOLDER_ROUTES: `${'@place' + 'holder-for-routes'}`,
1309
+ APP_TS_PLACEHOLDER_CONTEXTS_INIT: `${'@place' + 'holder-for-contexts-init'}`,
1298
1310
  };
1299
1311
  const BaselineSiteJoinprefix = '__';
1300
1312
  const PREFIXES = {
@@ -2301,6 +2313,10 @@ var UtilsProcess;
2301
2313
  /* */
2302
2314
  /* */
2303
2315
  /* */
2316
+ /* */
2317
+ /* */
2318
+ /* */
2319
+ /* */
2304
2320
  return (void 0);
2305
2321
  };
2306
2322
  //#endregion
@@ -2813,6 +2829,7 @@ var UtilsProcess;
2813
2829
  /* */
2814
2830
  /* */
2815
2831
  /* */
2832
+ /* */
2816
2833
  return (void 0);
2817
2834
  };
2818
2835
  //#endregion
@@ -4318,6 +4335,14 @@ var UtilsOs;
4318
4335
  return (void 0);
4319
4336
  };
4320
4337
  //#endregion
4338
+ UtilsOs.isRunningNodeDebugger = () => {
4339
+ //#region @browser
4340
+ return false;
4341
+ //#endregion
4342
+ /* */
4343
+ /* */
4344
+ return (void 0);
4345
+ };
4321
4346
  UtilsOs.isNodeVersionOk = UtilsProcess.isNodeVersionOk;
4322
4347
  UtilsOs.isElectron = UtilsOs.isRunningInElectron();
4323
4348
  UtilsOs.isBrowser = UtilsOs.isRunningInBrowser();
@@ -4332,102 +4357,118 @@ var UtilsOs;
4332
4357
  //#region utils os / command exists
4333
4358
  //#region helpers
4334
4359
  const fileNotExists = async (commandName) => {
4335
- try {
4336
- await fse.access(commandName, fse.constants.F_OK);
4337
- return false;
4338
- }
4339
- catch {
4340
- return true;
4341
- }
4360
+ /* */
4361
+ /* */
4362
+ /* */
4363
+ /* */
4364
+ /* */
4365
+ /* */
4366
+ /* */
4367
+ return (void 0);
4342
4368
  };
4343
4369
  const fileNotExistsSync = (commandName) => {
4344
- try {
4345
- fse.accessSync(commandName, fse.constants.F_OK);
4346
- return false;
4347
- }
4348
- catch {
4349
- return true;
4350
- }
4370
+ /* */
4371
+ /* */
4372
+ /* */
4373
+ /* */
4374
+ /* */
4375
+ /* */
4376
+ /* */
4377
+ return (void 0);
4351
4378
  };
4352
4379
  const localExecutable = async (commandName) => {
4353
- try {
4354
- await fse.access(commandName, fse.constants.F_OK | fse.constants.X_OK);
4355
- return true;
4356
- }
4357
- catch {
4358
- return false;
4359
- }
4380
+ /* */
4381
+ /* */
4382
+ /* */
4383
+ /* */
4384
+ /* */
4385
+ /* */
4386
+ /* */
4387
+ return (void 0);
4360
4388
  };
4361
4389
  const localExecutableSync = (commandName) => {
4362
- try {
4363
- fse.accessSync(commandName, fse.constants.F_OK | fse.constants.X_OK);
4364
- return true;
4365
- }
4366
- catch {
4367
- return false;
4368
- }
4390
+ /* */
4391
+ /* */
4392
+ /* */
4393
+ /* */
4394
+ /* */
4395
+ /* */
4396
+ /* */
4397
+ return (void 0);
4369
4398
  };
4370
4399
  //#endregion
4371
4400
  //#region command exists (Unix / Windows)
4372
4401
  const commandExistsUnix = async (commandName) => {
4373
- const isFileMissing = await fileNotExists(commandName);
4374
- if (isFileMissing) {
4375
- try {
4376
- const stdout = child_process.execSync(`command -v ${commandName} 2>/dev/null && { echo >&1 '${commandName} found'; exit 0; }`, { encoding: 'utf-8' });
4377
- return !!stdout;
4378
- }
4379
- catch {
4380
- return false;
4381
- }
4382
- }
4383
- return await localExecutable(commandName);
4402
+ /* */
4403
+ /* */
4404
+ /* */
4405
+ /* */
4406
+ /* */
4407
+ /* */
4408
+ /* */
4409
+ /* */
4410
+ /* */
4411
+ /* */
4412
+ /* */
4413
+ /* */
4414
+ /* */
4415
+ /* */
4416
+ /* */
4417
+ return (void 0);
4384
4418
  };
4385
4419
  const commandExistsWindows = async (commandName) => {
4386
- try {
4387
- const stdout = await Helpers.commandOutputAsStringAsync(`where ${commandName}`);
4388
- return !!stdout;
4389
- }
4390
- catch {
4391
- return false;
4392
- }
4420
+ /* */
4421
+ /* */
4422
+ /* */
4423
+ /* */
4424
+ /* */
4425
+ /* */
4426
+ /* */
4427
+ /* */
4428
+ /* */
4429
+ return (void 0);
4393
4430
  };
4394
4431
  const commandExistsUnixSync = (commandName) => {
4395
- if (fileNotExistsSync(commandName)) {
4396
- try {
4397
- const stdout = child_process.execSync(`command -v ${commandName} 2>/dev/null && { echo >&1 '${commandName} found'; exit 0; }`, { encoding: 'utf-8' });
4398
- return !!stdout;
4399
- }
4400
- catch {
4401
- return false;
4402
- }
4403
- }
4404
- return localExecutableSync(commandName);
4432
+ /* */
4433
+ /* */
4434
+ /* */
4435
+ /* */
4436
+ /* */
4437
+ /* */
4438
+ /* */
4439
+ /* */
4440
+ /* */
4441
+ /* */
4442
+ /* */
4443
+ /* */
4444
+ /* */
4445
+ return (void 0);
4405
4446
  };
4406
4447
  const commandExistsWindowsSync = (commandName) => {
4407
- try {
4408
- const stdout = Helpers.commandOutputAsString(`where ${commandName}`);
4409
- return !!stdout;
4410
- }
4411
- catch {
4412
- return false;
4413
- }
4448
+ /* */
4449
+ /* */
4450
+ /* */
4451
+ /* */
4452
+ /* */
4453
+ /* */
4454
+ /* */
4455
+ return (void 0);
4414
4456
  };
4415
4457
  //#endregion
4416
4458
  //#region exported API
4417
4459
  UtilsOs.commandExistsAsync = async (commandName) => {
4418
- try {
4419
- if (UtilsOs.isRunningInWindows) {
4420
- return await commandExistsWindows(commandName);
4421
- }
4422
- else {
4423
- return await commandExistsUnix(commandName);
4424
- }
4425
- }
4426
- catch (error) {
4427
- if (frameworkName === 'tnp')
4428
- console.error(error);
4429
- return false;
4430
- }
4460
+ /* */
4461
+ /* */
4462
+ /* */
4463
+ /* */
4464
+ /* */
4465
+ /* */
4466
+ /* */
4467
+ /* */
4468
+ /* */
4469
+ /* */
4470
+ /* */
4471
+ return (void 0);
4431
4472
  };
4432
4473
  /**
4433
4474
  * @deprecated use commandExistsAsync
@@ -5166,6 +5207,7 @@ var UtilsTerminal;
5166
5207
  /* */
5167
5208
  /* */
5168
5209
  /* */
5210
+ /* */
5169
5211
  return (void 0);
5170
5212
  };
5171
5213
  //#endregion
@@ -5940,6 +5982,8 @@ var UtilsDotFile;
5940
5982
  /* */
5941
5983
  /* */
5942
5984
  /* */
5985
+ /* */
5986
+ /* */
5943
5987
  return (void 0);
5944
5988
  };
5945
5989
  //#endregion
@@ -6561,25 +6605,27 @@ var UtilsNetwork;
6561
6605
  * LAN → Wi-Fi → Other → Virtual
6562
6606
  */
6563
6607
  UtilsNetwork.getLocalIpAddresses = async () => {
6564
- const interfaces = os.networkInterfaces();
6565
- const all = [];
6566
- for (const [name, addrs] of Object.entries(interfaces)) {
6567
- if (!addrs)
6568
- continue;
6569
- for (const addr of addrs) {
6570
- if (addr.internal)
6571
- continue;
6572
- all.push({
6573
- interfaceName: name,
6574
- address: addr.address,
6575
- family: addr.family,
6576
- internal: addr.internal,
6577
- type: interfaceTypeFromName(name),
6578
- });
6579
- }
6580
- }
6581
- all.sort(sortByPriority);
6582
- return all;
6608
+ /* */
6609
+ /* */
6610
+ /* */
6611
+ /* */
6612
+ /* */
6613
+ /* */
6614
+ /* */
6615
+ /* */
6616
+ /* */
6617
+ /* */
6618
+ /* */
6619
+ /* */
6620
+ /* */
6621
+ /* */
6622
+ /* */
6623
+ /* */
6624
+ /* */
6625
+ /* */
6626
+ /* */
6627
+ /* */
6628
+ return (void 0);
6583
6629
  };
6584
6630
  //#endregion
6585
6631
  //#region utils network / get local public ip addresses / get first local active ip address
@@ -6587,8 +6633,12 @@ var UtilsNetwork;
6587
6633
  * Returns first active local ipv4 IP (LAN preferred over Wi-Fi).
6588
6634
  */
6589
6635
  UtilsNetwork.getFirstIpV4LocalActiveIpAddress = async () => {
6590
- const all = await UtilsNetwork.getLocalIpAddresses().then(a => a.filter(f => f.family === 'IPv4'));
6591
- return all.length > 0 ? all[0].address : null;
6636
+ /* */
6637
+ /* */
6638
+ /* */
6639
+ /* */
6640
+ /* */
6641
+ return (void 0);
6592
6642
  };
6593
6643
  //#endregion
6594
6644
  //#region utils network / get local public ip addresses / get current public ip address
@@ -6596,44 +6646,43 @@ var UtilsNetwork;
6596
6646
  * Returns current public IP address (or null if undetectable).
6597
6647
  */
6598
6648
  UtilsNetwork.getCurrentPublicIpAddress = async () => {
6599
- const urls = [
6600
- 'https://api.ipify.org?format=json',
6601
- 'https://ifconfig.me/ip',
6602
- 'https://icanhazip.com',
6603
- ];
6604
- for (const url of urls) {
6605
- try {
6606
- const ip = await new Promise((resolve, reject) => {
6607
- https
6608
- .get(url, res => {
6609
- let data = '';
6610
- res.on('data', chunk => (data += chunk));
6611
- res.on('end', () => {
6612
- try {
6613
- const match = data.match(/(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)/);
6614
- if (match)
6615
- resolve(match[1]);
6616
- else if (data.trim().length > 0)
6617
- resolve(data.trim());
6618
- else
6619
- reject(new Error('no ip found'));
6620
- }
6621
- catch (e) {
6622
- reject(e);
6623
- }
6624
- });
6625
- })
6626
- .on('error', reject)
6627
- .setTimeout(3000, () => reject(new Error('timeout')));
6628
- });
6629
- if (ip)
6630
- return ip;
6631
- }
6632
- catch {
6633
- // try next
6634
- }
6635
- }
6636
- return null;
6649
+ /* */
6650
+ /* */
6651
+ /* */
6652
+ /* */
6653
+ /* */
6654
+ /* */
6655
+ /* */
6656
+ /* */
6657
+ /* */
6658
+ /* */
6659
+ /* */
6660
+ /* */
6661
+ /* */
6662
+ /* */
6663
+ /* */
6664
+ /* */
6665
+ /* */
6666
+ /* */
6667
+ /* */
6668
+ /* */
6669
+ /* */
6670
+ /* */
6671
+ /* */
6672
+ /* */
6673
+ /* */
6674
+ /* */
6675
+ /* */
6676
+ /* */
6677
+ /* */
6678
+ /* */
6679
+ /* */
6680
+ /* */
6681
+ /* */
6682
+ /* */
6683
+ /* */
6684
+ /* */
6685
+ return (void 0);
6637
6686
  };
6638
6687
  //#endregion
6639
6688
  //#endregion
@@ -9032,7 +9081,7 @@ class HelpersCore extends HelpersMessages {
9032
9081
  exitSub.next(exitCode);
9033
9082
  subscribtions.forEach(s => s.unsubscribe());
9034
9083
  });
9035
- }).catch(e => {
9084
+ }).catch((e) => {
9036
9085
  console.error(e);
9037
9086
  console.error(`Something wrong with your mock funciton`);
9038
9087
  exitSub.next(1);
@@ -9812,6 +9861,10 @@ class HelpersCore extends HelpersMessages {
9812
9861
  /* */
9813
9862
  /* */
9814
9863
  /* */
9864
+ /* */
9865
+ /* */
9866
+ /* */
9867
+ /* */
9815
9868
  //#endregion
9816
9869
  //#region methods / folders from
9817
9870
  /* */
@@ -10088,7 +10141,8 @@ class PROGRESS_DATA {
10088
10141
  }
10089
10142
  }
10090
10143
  catch (err) {
10091
- Helpers.error(err, true, true);
10144
+ const errMsg = err instanceof Error ? err.message : String(err);
10145
+ Helpers.error(errMsg, true, true);
10092
10146
  Helpers.error(`ProgresssBarData: fail to parse "${progress}"`, true, true);
10093
10147
  }
10094
10148
  }