tnp-core 21.0.159 → 21.0.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/VERIFIED-BUILD-DATA.jsonc +3 -3
- package/bin/start.js +36 -36
- package/browser/README.md +24 -24
- package/browser/fesm2022/tnp-core-browser.mjs +1896 -1601
- package/browser/fesm2022/tnp-core-browser.mjs.map +1 -1
- package/browser/package.json +1 -1
- package/browser/types/tnp-core-browser.d.ts +362 -189
- package/browser-prod/README.md +24 -24
- package/browser-prod/fesm2022/tnp-core-browser-prod.mjs +1331 -1045
- package/browser-prod/fesm2022/tnp-core-browser-prod.mjs.map +1 -1
- package/browser-prod/package.json +1 -1
- package/browser-prod/types/tnp-core-browser-prod.d.ts +357 -190
- package/browser-prod.split-namespaces.json +54 -14
- package/cli.backend.js +1 -0
- package/cli.backend.js.map +1 -1
- package/lib/axios-fetch.d.ts +11 -0
- package/lib/axios-fetch.js +61 -12
- package/lib/axios-fetch.js.map +1 -1
- package/lib/axios-simple-cookie-jar.d.ts +6 -0
- package/lib/axios-simple-cookie-jar.js +34 -0
- package/lib/axios-simple-cookie-jar.js.map +1 -0
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/core-cli.js +9 -9
- package/lib/core-cli.js.map +1 -1
- package/lib/core-imports.js +2 -3
- package/lib/core-imports.js.map +1 -1
- package/lib/core-models.d.ts +37 -187
- package/lib/core-models.js +13 -202
- package/lib/core-models.js.map +1 -1
- package/lib/helpers.js +28 -26
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/node-path-mock.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/taon-state-machine.d.ts +4 -1
- package/lib/taon-state-machine.js +5 -2
- package/lib/taon-state-machine.js.map +1 -1
- package/lib/utils-env.d.ts +101 -0
- package/lib/utils-env.js +126 -0
- package/lib/utils-env.js.map +1 -0
- package/lib/utils-env.test.d.ts +1 -0
- package/lib/utils-etc-hosts.js +6 -6
- package/lib/utils-etc-hosts.js.map +1 -1
- package/lib/utils-files-folders.js +58 -57
- package/lib/utils-files-folders.js.map +1 -1
- package/lib/utils-http.d.ts +189 -0
- package/lib/utils-http.js +155 -0
- package/lib/utils-http.js.map +1 -0
- package/lib/utils-jwt.d.ts +12 -0
- package/lib/utils-jwt.js +150 -0
- package/lib/utils-jwt.js.map +1 -0
- package/lib/utils-jwt.test.d.ts +1 -0
- package/lib/utils-network.js +2 -2
- package/lib/utils-network.js.map +1 -1
- package/lib/utils-os.d.ts +16 -0
- package/lib/utils-os.js +68 -28
- package/lib/utils-os.js.map +1 -1
- package/lib/utils-process-logger.js +3 -3
- package/lib/utils-process-logger.js.map +1 -1
- package/lib/utils-process.js +2 -0
- package/lib/utils-process.js.map +1 -1
- package/lib/utils-terminal.js +11 -10
- package/lib/utils-terminal.js.map +1 -1
- package/lib/utils.js +8 -8
- package/lib/utils.js.map +1 -1
- package/lib-esm/app.electron.js +1 -0
- package/lib-esm/app.electron.js.map +1 -1
- package/lib-esm/app.hosts.js +1 -0
- package/lib-esm/app.hosts.js.map +1 -1
- package/lib-esm/app.js +1 -0
- package/lib-esm/app.js.map +1 -1
- package/lib-esm/app.vscode.js +1 -0
- package/lib-esm/app.vscode.js.map +1 -1
- package/lib-esm/cli.backend.js +1 -0
- package/lib-esm/cli.backend.js.map +1 -1
- package/lib-esm/lib/axios-fetch.d.ts +11 -0
- package/lib-esm/lib/axios-fetch.js +60 -12
- package/lib-esm/lib/axios-fetch.js.map +1 -1
- package/lib-esm/lib/axios-simple-cookie-jar.d.ts +6 -0
- package/lib-esm/lib/axios-simple-cookie-jar.js +30 -0
- package/lib-esm/lib/axios-simple-cookie-jar.js.map +1 -0
- package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib-esm/lib/build-info._auto-generated_.js +1 -1
- package/lib-esm/lib/core-cli.js +1 -1
- package/lib-esm/lib/core-cli.js.map +1 -1
- package/lib-esm/lib/core-imports.js +3 -3
- package/lib-esm/lib/core-imports.js.map +1 -1
- package/lib-esm/lib/core-models.d.ts +37 -187
- package/lib-esm/lib/core-models.js +13 -202
- package/lib-esm/lib/core-models.js.map +1 -1
- package/lib-esm/lib/helpers.js +3 -1
- package/lib-esm/lib/helpers.js.map +1 -1
- package/lib-esm/lib/index.d.ts +5 -1
- package/lib-esm/lib/index.js +5 -1
- package/lib-esm/lib/index.js.map +1 -1
- package/lib-esm/lib/node-path-mock.js.map +1 -1
- package/lib-esm/lib/taon-state-machine.d.ts +4 -1
- package/lib-esm/lib/taon-state-machine.js +5 -2
- package/lib-esm/lib/taon-state-machine.js.map +1 -1
- package/lib-esm/lib/utils-env.d.ts +101 -0
- package/lib-esm/lib/utils-env.js +123 -0
- package/lib-esm/lib/utils-env.js.map +1 -0
- package/lib-esm/lib/utils-etc-hosts.js +1 -1
- package/lib-esm/lib/utils-etc-hosts.js.map +1 -1
- package/lib-esm/lib/utils-files-folders.js +2 -1
- package/lib-esm/lib/utils-files-folders.js.map +1 -1
- package/lib-esm/lib/utils-http.d.ts +189 -0
- package/lib-esm/lib/utils-http.js +152 -0
- package/lib-esm/lib/utils-http.js.map +1 -0
- package/lib-esm/lib/utils-jwt.d.ts +12 -0
- package/lib-esm/lib/utils-jwt.js +147 -0
- package/lib-esm/lib/utils-jwt.js.map +1 -0
- package/lib-esm/lib/utils-network.js +1 -1
- package/lib-esm/lib/utils-network.js.map +1 -1
- package/lib-esm/lib/utils-os.d.ts +16 -0
- package/lib-esm/lib/utils-os.js +68 -28
- package/lib-esm/lib/utils-os.js.map +1 -1
- package/lib-esm/lib/utils-process-logger.js +1 -1
- package/lib-esm/lib/utils-process-logger.js.map +1 -1
- package/lib-esm/lib/utils-process.js +2 -0
- package/lib-esm/lib/utils-process.js.map +1 -1
- package/lib-esm/lib/utils-terminal.js +2 -1
- package/lib-esm/lib/utils-terminal.js.map +1 -1
- package/lib-esm/lib/utils.js +1 -1
- package/lib-esm/lib/utils.js.map +1 -1
- package/lib-prod/axios-fetch.d.ts +11 -0
- package/lib-prod/axios-fetch.js +60 -12
- package/lib-prod/axios-fetch.js.map +1 -1
- package/lib-prod/axios-simple-cookie-jar.d.ts +6 -0
- package/lib-prod/axios-simple-cookie-jar.js +30 -0
- package/lib-prod/axios-simple-cookie-jar.js.map +1 -0
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/core-cli.js +1 -1
- package/lib-prod/core-cli.js.map +1 -1
- package/lib-prod/core-imports.js +2 -3
- package/lib-prod/core-imports.js.map +1 -1
- package/lib-prod/core-models.d.ts +37 -187
- package/lib-prod/core-models.js +13 -201
- package/lib-prod/core-models.js.map +1 -1
- package/lib-prod/global-task-manager.js.map +1 -1
- package/lib-prod/helpers.js +3 -1
- package/lib-prod/helpers.js.map +1 -1
- package/lib-prod/index.d.ts +5 -1
- package/lib-prod/index.js +5 -1
- package/lib-prod/index.js.map +1 -1
- package/lib-prod/node-path-mock.js.map +1 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/start-cli.js.map +1 -1
- package/lib-prod/taon-state-machine.d.ts +4 -1
- package/lib-prod/taon-state-machine.js +5 -2
- package/lib-prod/taon-state-machine.js.map +1 -1
- package/lib-prod/utils-binary.js.map +1 -1
- package/lib-prod/utils-cli.js.map +1 -1
- package/lib-prod/utils-env.d.ts +99 -0
- package/lib-prod/utils-env.js +120 -0
- package/lib-prod/utils-env.js.map +1 -0
- package/lib-prod/utils-etc-hosts.js +1 -1
- package/lib-prod/utils-etc-hosts.js.map +1 -1
- package/lib-prod/utils-files-folders.js +2 -1
- package/lib-prod/utils-files-folders.js.map +1 -1
- package/lib-prod/utils-http.d.ts +187 -0
- package/lib-prod/utils-http.js +149 -0
- package/lib-prod/utils-http.js.map +1 -0
- package/lib-prod/utils-jwt.d.ts +10 -0
- package/lib-prod/utils-jwt.js +143 -0
- package/lib-prod/utils-jwt.js.map +1 -0
- package/lib-prod/utils-network.js +1 -1
- package/lib-prod/utils-network.js.map +1 -1
- package/lib-prod/utils-os.d.ts +16 -0
- package/lib-prod/utils-os.js +68 -28
- package/lib-prod/utils-os.js.map +1 -1
- package/lib-prod/utils-process-logger.js +1 -1
- package/lib-prod/utils-process-logger.js.map +1 -1
- package/lib-prod/utils-process.js +2 -0
- package/lib-prod/utils-process.js.map +1 -1
- package/lib-prod/utils-sudo.js.map +1 -1
- package/lib-prod/utils-terminal.js +2 -1
- package/lib-prod/utils-terminal.js.map +1 -1
- package/lib-prod/utils.js +1 -1
- package/lib-prod/utils.js.map +1 -1
- package/lib-prod.split-namespaces.json +54 -14
- package/package.json +1 -1
- package/websql/README.md +24 -24
- package/websql/fesm2022/tnp-core-websql.mjs +1913 -1618
- package/websql/fesm2022/tnp-core-websql.mjs.map +1 -1
- package/websql/package.json +1 -1
- package/websql/types/tnp-core-websql.d.ts +362 -189
- package/websql-prod/README.md +24 -24
- package/websql-prod/fesm2022/tnp-core-websql-prod.mjs +1339 -1053
- package/websql-prod/fesm2022/tnp-core-websql-prod.mjs.map +1 -1
- package/websql-prod/package.json +1 -1
- package/websql-prod/types/tnp-core-websql-prod.d.ts +357 -190
- package/websql-prod.split-namespaces.json +54 -14
|
@@ -308,8 +308,8 @@ import { format } from 'date-fns';
|
|
|
308
308
|
import * as json5 from 'json5';
|
|
309
309
|
export { json5 };
|
|
310
310
|
export { Injectable, inject, signal } from '@angular/core';
|
|
311
|
-
import { Subject, BehaviorSubject } from 'rxjs';
|
|
312
311
|
import 'reflect-metadata';
|
|
312
|
+
import { Subject, BehaviorSubject } from 'rxjs';
|
|
313
313
|
import { parse, printParseErrorCode, modify, applyEdits } from 'jsonc-parser';
|
|
314
314
|
|
|
315
315
|
let isBrowser = false;
|
|
@@ -1372,9 +1372,9 @@ const crossPlatformPath = (pathStringOrPathParts) => {
|
|
|
1372
1372
|
}
|
|
1373
1373
|
if (hasNonAscii) {
|
|
1374
1374
|
const allNonAscii = pathStringOrPathParts.match(/[^\u0000-\u0080]+/g) || '';
|
|
1375
|
-
|
|
1375
|
+
console.warn(`[taon-core][crossPlatformPath]: path below contains non-ascii characters (${allNonAscii}):
|
|
1376
1376
|
"${pathStringOrPathParts}"`);
|
|
1377
|
-
|
|
1377
|
+
console.warn(pathStringOrPathParts);
|
|
1378
1378
|
}
|
|
1379
1379
|
pathStringOrPathParts = (pathStringOrPathParts || '')
|
|
1380
1380
|
.replace(/\\/g, '/')
|
|
@@ -1403,133 +1403,9 @@ const crossPlatformPath = (pathStringOrPathParts) => {
|
|
|
1403
1403
|
};
|
|
1404
1404
|
//#endregion
|
|
1405
1405
|
|
|
1406
|
-
var
|
|
1407
|
-
(function (
|
|
1408
|
-
|
|
1409
|
-
let ReleaseVersionTypeEnum;
|
|
1410
|
-
(function (ReleaseVersionTypeEnum) {
|
|
1411
|
-
ReleaseVersionTypeEnum["MAJOR"] = "major";
|
|
1412
|
-
ReleaseVersionTypeEnum["MINOR"] = "minor";
|
|
1413
|
-
ReleaseVersionTypeEnum["PATCH"] = "patch";
|
|
1414
|
-
})(ReleaseVersionTypeEnum = CoreModels.ReleaseVersionTypeEnum || (CoreModels.ReleaseVersionTypeEnum = {}));
|
|
1415
|
-
CoreModels.NpmSpecialVersions = [
|
|
1416
|
-
'latest',
|
|
1417
|
-
'next',
|
|
1418
|
-
'beta',
|
|
1419
|
-
'alpha',
|
|
1420
|
-
'rc',
|
|
1421
|
-
'lts',
|
|
1422
|
-
];
|
|
1423
|
-
//#endregion
|
|
1424
|
-
//#region environment name
|
|
1425
|
-
let EnvironmentName;
|
|
1426
|
-
(function (EnvironmentName) {
|
|
1427
|
-
/**
|
|
1428
|
-
* Default environment, typically for artifact without application
|
|
1429
|
-
* or for storing common data
|
|
1430
|
-
*/
|
|
1431
|
-
EnvironmentName["__"] = "__";
|
|
1432
|
-
/**
|
|
1433
|
-
* Local development environment, typically the developer's machine.
|
|
1434
|
-
*/
|
|
1435
|
-
EnvironmentName["LOCALHOST"] = "localhost";
|
|
1436
|
-
/**
|
|
1437
|
-
* Development environment used by engineers to deploy and test new features.
|
|
1438
|
-
*/
|
|
1439
|
-
EnvironmentName["DEV"] = "dev";
|
|
1440
|
-
/**
|
|
1441
|
-
* Staging environment used for final validations before production.
|
|
1442
|
-
*/
|
|
1443
|
-
EnvironmentName["STAGE"] = "stage";
|
|
1444
|
-
/**
|
|
1445
|
-
* Production environment serving live users.
|
|
1446
|
-
*/
|
|
1447
|
-
EnvironmentName["PROD"] = "prod";
|
|
1448
|
-
/**
|
|
1449
|
-
* Cloudflare full backend/frontend deployment
|
|
1450
|
-
*/
|
|
1451
|
-
EnvironmentName["CLOUDFLARE"] = "cloudflare";
|
|
1452
|
-
/**
|
|
1453
|
-
* Taon cloud full backend/frontend deployment
|
|
1454
|
-
*/
|
|
1455
|
-
EnvironmentName["CLOUD"] = "cloud";
|
|
1456
|
-
/**
|
|
1457
|
-
* Automated test environment for running unit, integration, or automated tests.
|
|
1458
|
-
*/
|
|
1459
|
-
EnvironmentName["TEST"] = "test";
|
|
1460
|
-
/**
|
|
1461
|
-
* Quality assurance environment designated for manual and exploratory testing.
|
|
1462
|
-
*/
|
|
1463
|
-
EnvironmentName["QA"] = "qa";
|
|
1464
|
-
/**
|
|
1465
|
-
* Sandbox environment for experimenting and integration without affecting other environments.
|
|
1466
|
-
*/
|
|
1467
|
-
EnvironmentName["SANDBOX"] = "sandbox";
|
|
1468
|
-
/**
|
|
1469
|
-
* User Acceptance Testing environment where clients or stakeholders validate the release candidate.
|
|
1470
|
-
*/
|
|
1471
|
-
EnvironmentName["UAT"] = "uat";
|
|
1472
|
-
/**
|
|
1473
|
-
* Pre-production environment, closely mirroring production for final testing and validation.
|
|
1474
|
-
*/
|
|
1475
|
-
EnvironmentName["PREPROD"] = "preprod";
|
|
1476
|
-
/**
|
|
1477
|
-
* Demonstration environment specifically configured for client presentations and demos.
|
|
1478
|
-
*/
|
|
1479
|
-
EnvironmentName["DEMO"] = "demo";
|
|
1480
|
-
/**
|
|
1481
|
-
* Documentation environment for hosting and managing project documentation.
|
|
1482
|
-
*/
|
|
1483
|
-
EnvironmentName["DOCS"] = "docs";
|
|
1484
|
-
/**
|
|
1485
|
-
* Demonstration environment ONLY html files, typically used for static pages or documentation.
|
|
1486
|
-
* This environment is not intended for dynamic content or server-side processing.
|
|
1487
|
-
* Perfect to github pages or similar.
|
|
1488
|
-
* It is not intended for production use and should not be used for any critical applications or services.
|
|
1489
|
-
*/
|
|
1490
|
-
EnvironmentName["STATIC_PAGES"] = "static-pages";
|
|
1491
|
-
/**
|
|
1492
|
-
* Continuous Integration environment used by CI/CD pipelines for automated builds and deployments.
|
|
1493
|
-
*/
|
|
1494
|
-
EnvironmentName["CI"] = "ci";
|
|
1495
|
-
/**
|
|
1496
|
-
* Training environment dedicated to internal team onboarding and training activities.
|
|
1497
|
-
*/
|
|
1498
|
-
EnvironmentName["TRAINING"] = "training";
|
|
1499
|
-
/**
|
|
1500
|
-
* Staging environment used for final validations before production.
|
|
1501
|
-
*/
|
|
1502
|
-
EnvironmentName["STAGING"] = "staging";
|
|
1503
|
-
})(EnvironmentName = CoreModels.EnvironmentName || (CoreModels.EnvironmentName = {}));
|
|
1504
|
-
CoreModels.EnvironmentNameArr = Object.values(EnvironmentName);
|
|
1505
|
-
function splitEnv(value) {
|
|
1506
|
-
if (!value) {
|
|
1507
|
-
return {
|
|
1508
|
-
envName: value,
|
|
1509
|
-
envNumber: undefined,
|
|
1510
|
-
};
|
|
1511
|
-
}
|
|
1512
|
-
const match = value.match(/^(.+?)(\d+)?$/);
|
|
1513
|
-
if (!match) {
|
|
1514
|
-
return {
|
|
1515
|
-
envName: value,
|
|
1516
|
-
envNumber: undefined,
|
|
1517
|
-
};
|
|
1518
|
-
}
|
|
1519
|
-
return {
|
|
1520
|
-
envName: match[1],
|
|
1521
|
-
envNumber: match[2] !== undefined ? Number(match[2]) : undefined,
|
|
1522
|
-
};
|
|
1523
|
-
}
|
|
1524
|
-
CoreModels.splitEnv = splitEnv;
|
|
1525
|
-
CoreModels.GitConnectionArr = ['https', 'ssh'];
|
|
1526
|
-
CoreModels.ImageFileExtensionArr = [
|
|
1527
|
-
'jpg',
|
|
1528
|
-
'jpeg',
|
|
1529
|
-
'png',
|
|
1530
|
-
'svg',
|
|
1531
|
-
];
|
|
1532
|
-
CoreModels.HttpMethodArr = [
|
|
1406
|
+
var UtilsHttp;
|
|
1407
|
+
(function (UtilsHttp) {
|
|
1408
|
+
UtilsHttp.HttpMethodArr = [
|
|
1533
1409
|
'get',
|
|
1534
1410
|
'post',
|
|
1535
1411
|
'put',
|
|
@@ -1539,18 +1415,54 @@ var CoreModels;
|
|
|
1539
1415
|
'jsonp',
|
|
1540
1416
|
];
|
|
1541
1417
|
//#endregion
|
|
1542
|
-
//#region
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1418
|
+
//#region get status text
|
|
1419
|
+
function getStatusText(code) {
|
|
1420
|
+
const map = {
|
|
1421
|
+
200: 'OK',
|
|
1422
|
+
201: 'Created',
|
|
1423
|
+
202: 'Accepted',
|
|
1424
|
+
204: 'No Content',
|
|
1425
|
+
301: 'Moved Permanently',
|
|
1426
|
+
302: 'Found',
|
|
1427
|
+
304: 'Not Modified',
|
|
1428
|
+
400: 'Bad Request',
|
|
1429
|
+
401: 'Unauthorized',
|
|
1430
|
+
403: 'Forbidden',
|
|
1431
|
+
404: 'Not Found',
|
|
1432
|
+
409: 'Conflict',
|
|
1433
|
+
422: 'Unprocessable Entity',
|
|
1434
|
+
500: 'Internal Server Error',
|
|
1435
|
+
502: 'Bad Gateway',
|
|
1436
|
+
503: 'Service Unavailable',
|
|
1437
|
+
};
|
|
1438
|
+
return map[code] || String(code);
|
|
1439
|
+
}
|
|
1440
|
+
UtilsHttp.getStatusText = getStatusText;
|
|
1441
|
+
//#endregion
|
|
1442
|
+
//#region get mimie type
|
|
1443
|
+
function mimeType(type) {
|
|
1444
|
+
if (type.includes('/')) {
|
|
1445
|
+
return type;
|
|
1446
|
+
}
|
|
1447
|
+
const map = {
|
|
1448
|
+
json: 'application/json',
|
|
1449
|
+
html: 'text/html; charset=utf-8',
|
|
1450
|
+
text: 'text/plain; charset=utf-8',
|
|
1451
|
+
txt: 'text/plain; charset=utf-8',
|
|
1452
|
+
xml: 'application/xml',
|
|
1453
|
+
js: 'application/javascript',
|
|
1454
|
+
css: 'text/css',
|
|
1455
|
+
pdf: 'application/pdf',
|
|
1456
|
+
};
|
|
1457
|
+
return map[type.toLowerCase()] || type;
|
|
1458
|
+
}
|
|
1459
|
+
UtilsHttp.mimeType = mimeType;
|
|
1550
1460
|
//#endregion
|
|
1551
|
-
//#region mime types
|
|
1552
|
-
|
|
1553
|
-
|
|
1461
|
+
//#region mime types
|
|
1462
|
+
/**
|
|
1463
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
|
1464
|
+
*/
|
|
1465
|
+
UtilsHttp.mimeTypes = {
|
|
1554
1466
|
'.aac': 'audio/aac',
|
|
1555
1467
|
'.abw': 'application/x-abiword',
|
|
1556
1468
|
'.arc': 'application/x-freearc',
|
|
@@ -1628,7 +1540,8 @@ var CoreModels;
|
|
|
1628
1540
|
'.3g2': 'video/3gpp2',
|
|
1629
1541
|
'.7z': 'application/x-7z-compressed',
|
|
1630
1542
|
};
|
|
1631
|
-
|
|
1543
|
+
UtilsHttp.MimeTypesObj = UtilsHttp.mimeTypes;
|
|
1544
|
+
UtilsHttp.MediaTypeAllArr = [
|
|
1632
1545
|
'text',
|
|
1633
1546
|
'image',
|
|
1634
1547
|
'audio',
|
|
@@ -1639,7 +1552,56 @@ var CoreModels;
|
|
|
1639
1552
|
'message',
|
|
1640
1553
|
'model',
|
|
1641
1554
|
];
|
|
1642
|
-
|
|
1555
|
+
//#endregion
|
|
1556
|
+
})(UtilsHttp || (UtilsHttp = {}));
|
|
1557
|
+
|
|
1558
|
+
var CoreModels;
|
|
1559
|
+
(function (CoreModels) {
|
|
1560
|
+
CoreModels.InstalationTypeArr = ['-g', '--save', '--save-dev'];
|
|
1561
|
+
let ReleaseVersionTypeEnum;
|
|
1562
|
+
(function (ReleaseVersionTypeEnum) {
|
|
1563
|
+
ReleaseVersionTypeEnum["MAJOR"] = "major";
|
|
1564
|
+
ReleaseVersionTypeEnum["MINOR"] = "minor";
|
|
1565
|
+
ReleaseVersionTypeEnum["PATCH"] = "patch";
|
|
1566
|
+
})(ReleaseVersionTypeEnum = CoreModels.ReleaseVersionTypeEnum || (CoreModels.ReleaseVersionTypeEnum = {}));
|
|
1567
|
+
CoreModels.NpmSpecialVersions = [
|
|
1568
|
+
'latest',
|
|
1569
|
+
'next',
|
|
1570
|
+
'beta',
|
|
1571
|
+
'alpha',
|
|
1572
|
+
'rc',
|
|
1573
|
+
'lts',
|
|
1574
|
+
];
|
|
1575
|
+
CoreModels.GitConnectionArr = ['https', 'ssh'];
|
|
1576
|
+
CoreModels.ImageFileExtensionArr = [
|
|
1577
|
+
'jpg',
|
|
1578
|
+
'jpeg',
|
|
1579
|
+
'png',
|
|
1580
|
+
'svg',
|
|
1581
|
+
];
|
|
1582
|
+
/**
|
|
1583
|
+
* @deprecated use tilsHttp.HttpMethodArr
|
|
1584
|
+
*/
|
|
1585
|
+
CoreModels.HttpMethodArr = UtilsHttp.HttpMethodArr;
|
|
1586
|
+
//#endregion
|
|
1587
|
+
//#region base project type arr
|
|
1588
|
+
CoreModels.BaseProjectTypeArr = [
|
|
1589
|
+
'typescript',
|
|
1590
|
+
'angular',
|
|
1591
|
+
'angular-lib',
|
|
1592
|
+
'unknown',
|
|
1593
|
+
'unknown-npm-project',
|
|
1594
|
+
];
|
|
1595
|
+
//#endregion
|
|
1596
|
+
//#region mime types / content type
|
|
1597
|
+
/**
|
|
1598
|
+
* @deprecated use UtilsHttp.mimeTypes
|
|
1599
|
+
*/
|
|
1600
|
+
CoreModels.mimeTypes = UtilsHttp.mimeTypes;
|
|
1601
|
+
/**
|
|
1602
|
+
* @deprecated use UtilsHttp.MediaTypeAllArr
|
|
1603
|
+
*/
|
|
1604
|
+
CoreModels.MediaTypeAllArr = UtilsHttp.MediaTypeAllArr;
|
|
1643
1605
|
CoreModels.BuildWatcherTypeArr = [
|
|
1644
1606
|
'browser-watcher',
|
|
1645
1607
|
'websql-watcher',
|
|
@@ -2330,32 +2292,15 @@ const taonActionFromParent = 'taon-action-from-parent';
|
|
|
2330
2292
|
|
|
2331
2293
|
//#region imports
|
|
2332
2294
|
//#endregion
|
|
2333
|
-
var
|
|
2334
|
-
(function (
|
|
2335
|
-
//#region utils
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
// '**/.git',
|
|
2343
|
-
// `**/${dotTaonFolder}/**/*.*`,
|
|
2344
|
-
`**/${dotTaonFolder}/**`,
|
|
2345
|
-
// `**/${dotTaonFolder}`,
|
|
2346
|
-
// `**/${dotTnpFolder}/**/*.*`,
|
|
2347
|
-
`**/${dotTnpFolder}/**`,
|
|
2348
|
-
// `**/${dotTnpFolder}`,
|
|
2349
|
-
'**/tmp-*',
|
|
2350
|
-
// `**/tmp-*/**/*.*`,
|
|
2351
|
-
'**/tmp-*/**',
|
|
2352
|
-
];
|
|
2353
|
-
//#endregion
|
|
2354
|
-
//#region utils files folders sync / read file
|
|
2355
|
-
UtilsFilesFoldersSync.readFile = (absoluteFilePath, // @ts-ignore
|
|
2356
|
-
options) => {
|
|
2357
|
-
/* */
|
|
2358
|
-
/* */
|
|
2295
|
+
var UtilsProcess;
|
|
2296
|
+
(function (UtilsProcess) {
|
|
2297
|
+
//#region utils process / start async child process command until
|
|
2298
|
+
/**
|
|
2299
|
+
* This let you start child process and resolve promise when some
|
|
2300
|
+
* condition is met. It is useful for example when you want to start
|
|
2301
|
+
* process and wait until some output is in stdout or stderr.
|
|
2302
|
+
*/
|
|
2303
|
+
UtilsProcess.startAsyncChildProcessCommandUntil = async (command, options) => {
|
|
2359
2304
|
/* */
|
|
2360
2305
|
/* */
|
|
2361
2306
|
/* */
|
|
@@ -2396,11 +2341,6 @@ var UtilsFilesFoldersSync;
|
|
|
2396
2341
|
/* */
|
|
2397
2342
|
/* */
|
|
2398
2343
|
/* */
|
|
2399
|
-
return (void 0);
|
|
2400
|
-
};
|
|
2401
|
-
//#endregion
|
|
2402
|
-
//#region utils files folders sync / write file
|
|
2403
|
-
UtilsFilesFoldersSync.writeFile = (absoluteFilePath, input, options) => {
|
|
2404
2344
|
/* */
|
|
2405
2345
|
/* */
|
|
2406
2346
|
/* */
|
|
@@ -2430,6 +2370,11 @@ var UtilsFilesFoldersSync;
|
|
|
2430
2370
|
/* */
|
|
2431
2371
|
/* */
|
|
2432
2372
|
/* */
|
|
2373
|
+
return (void 0);
|
|
2374
|
+
};
|
|
2375
|
+
//#endregion
|
|
2376
|
+
//#region utils process / get git bash path
|
|
2377
|
+
UtilsProcess.getGitBashPath = () => {
|
|
2433
2378
|
/* */
|
|
2434
2379
|
/* */
|
|
2435
2380
|
/* */
|
|
@@ -2448,6 +2393,15 @@ var UtilsFilesFoldersSync;
|
|
|
2448
2393
|
/* */
|
|
2449
2394
|
/* */
|
|
2450
2395
|
/* */
|
|
2396
|
+
return (void 0);
|
|
2397
|
+
};
|
|
2398
|
+
//#endregion
|
|
2399
|
+
//#region utils process / start process in new graphical terminal window
|
|
2400
|
+
/**
|
|
2401
|
+
* TODO IMPLEMENT
|
|
2402
|
+
* start async node process
|
|
2403
|
+
*/
|
|
2404
|
+
UtilsProcess.startInNewTerminalWindow = (command, options) => {
|
|
2451
2405
|
/* */
|
|
2452
2406
|
/* */
|
|
2453
2407
|
/* */
|
|
@@ -2508,12 +2462,6 @@ var UtilsFilesFoldersSync;
|
|
|
2508
2462
|
/* */
|
|
2509
2463
|
/* */
|
|
2510
2464
|
/* */
|
|
2511
|
-
/* */
|
|
2512
|
-
/* */
|
|
2513
|
-
return (void 0);
|
|
2514
|
-
};
|
|
2515
|
-
//#region utils files folders sync / walk fs tree
|
|
2516
|
-
const walkFsTree = (root, options) => {
|
|
2517
2465
|
/* */
|
|
2518
2466
|
/* */
|
|
2519
2467
|
/* */
|
|
@@ -2565,6 +2513,14 @@ var UtilsFilesFoldersSync;
|
|
|
2565
2513
|
/* */
|
|
2566
2514
|
/* */
|
|
2567
2515
|
/* */
|
|
2516
|
+
return (void 0);
|
|
2517
|
+
};
|
|
2518
|
+
//#endregion
|
|
2519
|
+
//#region utils process / get bash or shell name
|
|
2520
|
+
UtilsProcess.getBashOrShellName = () => {
|
|
2521
|
+
//#region @browser
|
|
2522
|
+
return 'browser';
|
|
2523
|
+
//#endregion
|
|
2568
2524
|
/* */
|
|
2569
2525
|
/* */
|
|
2570
2526
|
/* */
|
|
@@ -2597,6 +2553,14 @@ var UtilsFilesFoldersSync;
|
|
|
2597
2553
|
/* */
|
|
2598
2554
|
/* */
|
|
2599
2555
|
/* */
|
|
2556
|
+
return (void 0);
|
|
2557
|
+
};
|
|
2558
|
+
//#endregion
|
|
2559
|
+
//#region utils process / get current process and child processes usage
|
|
2560
|
+
/**
|
|
2561
|
+
* Get CPU and memory usage for a single PID.
|
|
2562
|
+
*/
|
|
2563
|
+
UtilsProcess.getUsageForPid = async (pid) => {
|
|
2600
2564
|
/* */
|
|
2601
2565
|
/* */
|
|
2602
2566
|
/* */
|
|
@@ -2621,11 +2585,14 @@ var UtilsFilesFoldersSync;
|
|
|
2621
2585
|
return (void 0);
|
|
2622
2586
|
};
|
|
2623
2587
|
//#endregion
|
|
2624
|
-
//#region utils
|
|
2588
|
+
//#region utils process / get child PIDs
|
|
2625
2589
|
/**
|
|
2626
|
-
*
|
|
2590
|
+
* Return a list of direct child PIDs for the given PID on a Unix-like system.
|
|
2591
|
+
* Uses `ps -o pid= --ppid <pid>` to find child processes.
|
|
2627
2592
|
*/
|
|
2628
|
-
|
|
2593
|
+
async function getChildPidsUnix(pid) {
|
|
2594
|
+
/* */
|
|
2595
|
+
/* */
|
|
2629
2596
|
/* */
|
|
2630
2597
|
/* */
|
|
2631
2598
|
/* */
|
|
@@ -2641,13 +2608,15 @@ var UtilsFilesFoldersSync;
|
|
|
2641
2608
|
/* */
|
|
2642
2609
|
/* */
|
|
2643
2610
|
return (void 0);
|
|
2644
|
-
}
|
|
2611
|
+
}
|
|
2645
2612
|
//#endregion
|
|
2646
|
-
//#region utils
|
|
2613
|
+
//#region utils process / get child PIDs on Windows
|
|
2647
2614
|
/**
|
|
2648
|
-
*
|
|
2615
|
+
* Return a list of direct child PIDs for the given PID on Windows.
|
|
2616
|
+
* Uses `wmic process where (ParentProcessId=<pid>) get ProcessId` to find child processes.
|
|
2649
2617
|
*/
|
|
2650
|
-
|
|
2618
|
+
async function getChildPidsWindows(pid) {
|
|
2619
|
+
/* */
|
|
2651
2620
|
/* */
|
|
2652
2621
|
/* */
|
|
2653
2622
|
/* */
|
|
@@ -2662,19 +2631,33 @@ var UtilsFilesFoldersSync;
|
|
|
2662
2631
|
/* */
|
|
2663
2632
|
/* */
|
|
2664
2633
|
/* */
|
|
2665
|
-
return (void 0);
|
|
2666
|
-
};
|
|
2667
|
-
//#endregion
|
|
2668
|
-
//#endregion
|
|
2669
|
-
UtilsFilesFoldersSync.copyFolder = (sourceDir, destinationDir, options) => {
|
|
2670
2634
|
/* */
|
|
2671
2635
|
/* */
|
|
2636
|
+
return (void 0);
|
|
2637
|
+
}
|
|
2638
|
+
//#endregion
|
|
2639
|
+
//#region utils process / get child PIDs once
|
|
2640
|
+
/**
|
|
2641
|
+
* Cross-platform function to list *direct* child PIDs of a given PID.
|
|
2642
|
+
* Uses the appropriate command depending on `process.platform`.
|
|
2643
|
+
*/
|
|
2644
|
+
async function getChildPidsOnce(pid) {
|
|
2672
2645
|
/* */
|
|
2673
2646
|
/* */
|
|
2674
2647
|
/* */
|
|
2675
2648
|
/* */
|
|
2676
2649
|
/* */
|
|
2677
2650
|
/* */
|
|
2651
|
+
return (void 0);
|
|
2652
|
+
}
|
|
2653
|
+
UtilsProcess.getChildPidsOnce = getChildPidsOnce;
|
|
2654
|
+
//#endregion
|
|
2655
|
+
//#region utils process / get current process and child usage
|
|
2656
|
+
/**
|
|
2657
|
+
* Get CPU and memory usage for the current process (the Node.js process itself),
|
|
2658
|
+
* plus any child processes spawned by it.
|
|
2659
|
+
*/
|
|
2660
|
+
UtilsProcess.getCurrentProcessAndChildUsage = async () => {
|
|
2678
2661
|
/* */
|
|
2679
2662
|
/* */
|
|
2680
2663
|
/* */
|
|
@@ -2688,10 +2671,6 @@ var UtilsFilesFoldersSync;
|
|
|
2688
2671
|
/* */
|
|
2689
2672
|
/* */
|
|
2690
2673
|
/* */
|
|
2691
|
-
return (void 0);
|
|
2692
|
-
};
|
|
2693
|
-
//#region utils files folders sync / copy
|
|
2694
|
-
UtilsFilesFoldersSync.copy = (sourceDir, destinationDir, options) => {
|
|
2695
2674
|
/* */
|
|
2696
2675
|
/* */
|
|
2697
2676
|
/* */
|
|
@@ -2704,6 +2683,15 @@ var UtilsFilesFoldersSync;
|
|
|
2704
2683
|
/* */
|
|
2705
2684
|
/* */
|
|
2706
2685
|
/* */
|
|
2686
|
+
return (void 0);
|
|
2687
|
+
};
|
|
2688
|
+
//#endregion
|
|
2689
|
+
//#region utils process / kill all java processes
|
|
2690
|
+
/**
|
|
2691
|
+
* Kills all running Java processes cross‑platform.
|
|
2692
|
+
* @returns Promise<boolean> true if processes were killed, false if none found
|
|
2693
|
+
*/
|
|
2694
|
+
UtilsProcess.killAllJava = async () => {
|
|
2707
2695
|
/* */
|
|
2708
2696
|
/* */
|
|
2709
2697
|
/* */
|
|
@@ -2731,6 +2719,11 @@ var UtilsFilesFoldersSync;
|
|
|
2731
2719
|
/* */
|
|
2732
2720
|
/* */
|
|
2733
2721
|
/* */
|
|
2722
|
+
return (void 0);
|
|
2723
|
+
};
|
|
2724
|
+
//#endregion
|
|
2725
|
+
//#region utils process / kill process by pid or child process
|
|
2726
|
+
UtilsProcess.killProcess = async (pidOrProcess) => {
|
|
2734
2727
|
/* */
|
|
2735
2728
|
/* */
|
|
2736
2729
|
/* */
|
|
@@ -2757,6 +2750,15 @@ var UtilsFilesFoldersSync;
|
|
|
2757
2750
|
/* */
|
|
2758
2751
|
/* */
|
|
2759
2752
|
/* */
|
|
2753
|
+
return (void 0);
|
|
2754
|
+
};
|
|
2755
|
+
//#endregion
|
|
2756
|
+
//#region utils process / kill process on port
|
|
2757
|
+
UtilsProcess.killProcessOnPort = async (port) => {
|
|
2758
|
+
if (!port || isNaN(port) || UtilsOs.isBrowser) {
|
|
2759
|
+
Helpers.warn(`[UtilsProcess.killProcessOnPort]: Invalid port number: ${port}`);
|
|
2760
|
+
return false;
|
|
2761
|
+
}
|
|
2760
2762
|
/* */
|
|
2761
2763
|
/* */
|
|
2762
2764
|
/* */
|
|
@@ -2813,6 +2815,16 @@ var UtilsFilesFoldersSync;
|
|
|
2813
2815
|
/* */
|
|
2814
2816
|
/* */
|
|
2815
2817
|
/* */
|
|
2818
|
+
return (void 0);
|
|
2819
|
+
};
|
|
2820
|
+
//#endregion
|
|
2821
|
+
//#region utils process / kill all other node processes except itself
|
|
2822
|
+
/**
|
|
2823
|
+
* Kills all Node.js processes except the current process.
|
|
2824
|
+
* Works on Windows, macOS, and Linux.
|
|
2825
|
+
* @returns {number} Number of processes killed
|
|
2826
|
+
*/
|
|
2827
|
+
UtilsProcess.killAllOtherNodeProcesses = async () => {
|
|
2816
2828
|
/* */
|
|
2817
2829
|
/* */
|
|
2818
2830
|
/* */
|
|
@@ -2875,6 +2887,37 @@ var UtilsFilesFoldersSync;
|
|
|
2875
2887
|
/* */
|
|
2876
2888
|
/* */
|
|
2877
2889
|
/* */
|
|
2890
|
+
return (void 0);
|
|
2891
|
+
};
|
|
2892
|
+
//#endregion
|
|
2893
|
+
//#region utils process / is node version ok
|
|
2894
|
+
UtilsProcess.isNodeVersionOk = (options) => {
|
|
2895
|
+
if (!globalThis || !globalThis.process || !globalThis.process.version) {
|
|
2896
|
+
return false;
|
|
2897
|
+
}
|
|
2898
|
+
options = options || {};
|
|
2899
|
+
options.required = options.required || '18.0.0';
|
|
2900
|
+
const current = globalThis.process.version.replace(/^v/, '');
|
|
2901
|
+
const [curMajor, curMinor, curPatch] = current.split('.').map(Number);
|
|
2902
|
+
const [reqMajor, reqMinor, reqPatch] = options.required
|
|
2903
|
+
.replace(/^v/, '')
|
|
2904
|
+
.split('.')
|
|
2905
|
+
.map(Number);
|
|
2906
|
+
const ok = curMajor > reqMajor ||
|
|
2907
|
+
(curMajor === reqMajor && curMinor > reqMinor) ||
|
|
2908
|
+
(curMajor === reqMajor && curMinor === reqMinor && curPatch >= reqPatch);
|
|
2909
|
+
if (options?.log) {
|
|
2910
|
+
console.log(ok
|
|
2911
|
+
? `✅ Node.js version OK (required ≥ ${options.required}, current ${current})`
|
|
2912
|
+
: `❌ Node.js version too low (required ≥ ${options.required}, current ${current})`);
|
|
2913
|
+
}
|
|
2914
|
+
if (options?.throwErrorIfNotOk && !ok) {
|
|
2915
|
+
throw new Error(`Node.js version too low (required ≥ ${options.required}, current ${current})`);
|
|
2916
|
+
}
|
|
2917
|
+
return ok;
|
|
2918
|
+
};
|
|
2919
|
+
//#endregion
|
|
2920
|
+
UtilsProcess.getPathOfExecutable = async (command) => {
|
|
2878
2921
|
/* */
|
|
2879
2922
|
/* */
|
|
2880
2923
|
/* */
|
|
@@ -2893,14 +2936,95 @@ var UtilsFilesFoldersSync;
|
|
|
2893
2936
|
/* */
|
|
2894
2937
|
/* */
|
|
2895
2938
|
/* */
|
|
2939
|
+
return (void 0);
|
|
2940
|
+
};
|
|
2941
|
+
})(UtilsProcess || (UtilsProcess = {}));
|
|
2942
|
+
|
|
2943
|
+
//#region imports
|
|
2944
|
+
//#endregion
|
|
2945
|
+
var UtilsOs;
|
|
2946
|
+
(function (UtilsOs) {
|
|
2947
|
+
//#region utils os / is running in browser
|
|
2948
|
+
/**
|
|
2949
|
+
* check if script is running in client browser
|
|
2950
|
+
* (websql model -> is also considered as browser
|
|
2951
|
+
* because it is running in browser)
|
|
2952
|
+
*/
|
|
2953
|
+
UtilsOs.isRunningInBrowser = () => {
|
|
2896
2954
|
/* */
|
|
2897
2955
|
/* */
|
|
2956
|
+
return true;
|
|
2957
|
+
};
|
|
2958
|
+
//#endregion
|
|
2959
|
+
//#region utils os / is running in node
|
|
2960
|
+
/**
|
|
2961
|
+
* check if script is running in nodejs
|
|
2962
|
+
* (backend script or electron script)
|
|
2963
|
+
*/
|
|
2964
|
+
UtilsOs.isRunningInNode = () => {
|
|
2898
2965
|
/* */
|
|
2899
2966
|
/* */
|
|
2967
|
+
return false;
|
|
2968
|
+
};
|
|
2969
|
+
//#endregion
|
|
2970
|
+
//#region utils os / is running in websql
|
|
2971
|
+
/**
|
|
2972
|
+
* check if script is running special
|
|
2973
|
+
* browser mode that has sql.js backend
|
|
2974
|
+
* and executes sql queries in browser
|
|
2975
|
+
*/
|
|
2976
|
+
UtilsOs.isRunningInWebSQL = () => {
|
|
2900
2977
|
/* */
|
|
2901
2978
|
/* */
|
|
2902
2979
|
/* */
|
|
2903
2980
|
/* */
|
|
2981
|
+
return false;
|
|
2982
|
+
};
|
|
2983
|
+
//#endregion
|
|
2984
|
+
//#region utils os / is running in ssr mode
|
|
2985
|
+
UtilsOs.isRunningInSSRMode = () => {
|
|
2986
|
+
return typeof globalThis.window === 'undefined';
|
|
2987
|
+
};
|
|
2988
|
+
//#endregion
|
|
2989
|
+
//#region utils os / is running in electron
|
|
2990
|
+
/**
|
|
2991
|
+
* check whether the current process is running inside
|
|
2992
|
+
* Cloudflare worker
|
|
2993
|
+
*/
|
|
2994
|
+
UtilsOs.isRunningInCloudflareWorker = () => {
|
|
2995
|
+
return isCloudflareWorker;
|
|
2996
|
+
};
|
|
2997
|
+
//#endregion
|
|
2998
|
+
//#region utils os / is running in electron
|
|
2999
|
+
/**
|
|
3000
|
+
* check whether the current process is running inside
|
|
3001
|
+
* Electron backend or browser.
|
|
3002
|
+
*/
|
|
3003
|
+
UtilsOs.isRunningInElectron = () => {
|
|
3004
|
+
// Electron main or renderer (most reliable)
|
|
3005
|
+
if (typeof process !== 'undefined' && process?.versions?.electron) {
|
|
3006
|
+
return true;
|
|
3007
|
+
}
|
|
3008
|
+
// Renderer with nodeIntegration
|
|
3009
|
+
if (typeof globalThis !== 'undefined' &&
|
|
3010
|
+
globalThis?.process?.type === 'renderer') {
|
|
3011
|
+
return true;
|
|
3012
|
+
}
|
|
3013
|
+
// Renderer with nodeIntegration disabled
|
|
3014
|
+
if (typeof navigator === 'object' &&
|
|
3015
|
+
typeof navigator.userAgent === 'string' &&
|
|
3016
|
+
/Electron/i.test(navigator.userAgent)) {
|
|
3017
|
+
return true;
|
|
3018
|
+
}
|
|
3019
|
+
return false;
|
|
3020
|
+
};
|
|
3021
|
+
//#endregion
|
|
3022
|
+
//#region utils os / is running in vscode extension
|
|
3023
|
+
/**
|
|
3024
|
+
* Check whether the current process is running inside
|
|
3025
|
+
* a Visual Studio Code extension.
|
|
3026
|
+
*/
|
|
3027
|
+
UtilsOs.isRunningInVscodeExtension = () => {
|
|
2904
3028
|
/* */
|
|
2905
3029
|
/* */
|
|
2906
3030
|
/* */
|
|
@@ -2910,10 +3034,20 @@ var UtilsFilesFoldersSync;
|
|
|
2910
3034
|
/* */
|
|
2911
3035
|
/* */
|
|
2912
3036
|
return (void 0);
|
|
3037
|
+
return false;
|
|
2913
3038
|
};
|
|
2914
3039
|
//#endregion
|
|
2915
|
-
//#region utils
|
|
2916
|
-
|
|
3040
|
+
//#region utils os / is running in wsl
|
|
3041
|
+
/**
|
|
3042
|
+
* Check wether the current process is running inside
|
|
3043
|
+
* windows subsystem for linux (WSL).
|
|
3044
|
+
*/
|
|
3045
|
+
UtilsOs.isRunningInWsl = () => {
|
|
3046
|
+
//#region @browser
|
|
3047
|
+
return false;
|
|
3048
|
+
//#endregion
|
|
3049
|
+
/* */
|
|
3050
|
+
/* */
|
|
2917
3051
|
/* */
|
|
2918
3052
|
/* */
|
|
2919
3053
|
/* */
|
|
@@ -2928,6 +3062,12 @@ var UtilsFilesFoldersSync;
|
|
|
2928
3062
|
/* */
|
|
2929
3063
|
/* */
|
|
2930
3064
|
/* */
|
|
3065
|
+
/* */
|
|
3066
|
+
return (void 0);
|
|
3067
|
+
};
|
|
3068
|
+
//#endregion
|
|
3069
|
+
//#region utils os / is running in windows / powershell / cmd / gitbash
|
|
3070
|
+
UtilsOs.isRunningInWindowsPowerShell = () => {
|
|
2931
3071
|
/* */
|
|
2932
3072
|
/* */
|
|
2933
3073
|
/* */
|
|
@@ -2938,11 +3078,6 @@ var UtilsFilesFoldersSync;
|
|
|
2938
3078
|
/* */
|
|
2939
3079
|
/* */
|
|
2940
3080
|
/* */
|
|
2941
|
-
return (void 0);
|
|
2942
|
-
};
|
|
2943
|
-
//#endregion
|
|
2944
|
-
//#region utils files folders sync / filter only copy
|
|
2945
|
-
UtilsFilesFoldersSync.filterOnlyCopy = (basePathFoldersOnlyToInclude, projectOrBasepath) => {
|
|
2946
3081
|
/* */
|
|
2947
3082
|
/* */
|
|
2948
3083
|
/* */
|
|
@@ -2964,11 +3099,6 @@ var UtilsFilesFoldersSync;
|
|
|
2964
3099
|
/* */
|
|
2965
3100
|
/* */
|
|
2966
3101
|
/* */
|
|
2967
|
-
return (void 0);
|
|
2968
|
-
};
|
|
2969
|
-
//#endregion
|
|
2970
|
-
//#region utils files folders sync / copy file
|
|
2971
|
-
UtilsFilesFoldersSync.copyFile = (sourcePath, destinationPath, options) => {
|
|
2972
3102
|
/* */
|
|
2973
3103
|
/* */
|
|
2974
3104
|
/* */
|
|
@@ -2979,12 +3109,19 @@ var UtilsFilesFoldersSync;
|
|
|
2979
3109
|
/* */
|
|
2980
3110
|
/* */
|
|
2981
3111
|
/* */
|
|
3112
|
+
/* */
|
|
3113
|
+
return (void 0);
|
|
3114
|
+
};
|
|
3115
|
+
UtilsOs.isRunningInWindowsCmd = () => {
|
|
2982
3116
|
/* */
|
|
2983
3117
|
/* */
|
|
2984
3118
|
/* */
|
|
2985
3119
|
/* */
|
|
2986
3120
|
/* */
|
|
2987
3121
|
/* */
|
|
3122
|
+
return (void 0);
|
|
3123
|
+
};
|
|
3124
|
+
UtilsOs.isRunningInWindowsGitBash = () => {
|
|
2988
3125
|
/* */
|
|
2989
3126
|
/* */
|
|
2990
3127
|
/* */
|
|
@@ -2993,6 +3130,14 @@ var UtilsFilesFoldersSync;
|
|
|
2993
3130
|
/* */
|
|
2994
3131
|
/* */
|
|
2995
3132
|
/* */
|
|
3133
|
+
return (void 0);
|
|
3134
|
+
};
|
|
3135
|
+
//#endregion
|
|
3136
|
+
//#region utils os / is running in docker
|
|
3137
|
+
UtilsOs.isRunningInDocker = () => {
|
|
3138
|
+
//#region @browser
|
|
3139
|
+
return false;
|
|
3140
|
+
//#endregion
|
|
2996
3141
|
/* */
|
|
2997
3142
|
/* */
|
|
2998
3143
|
/* */
|
|
@@ -3038,6 +3183,14 @@ var UtilsFilesFoldersSync;
|
|
|
3038
3183
|
/* */
|
|
3039
3184
|
/* */
|
|
3040
3185
|
/* */
|
|
3186
|
+
return (void 0);
|
|
3187
|
+
};
|
|
3188
|
+
//#endregion
|
|
3189
|
+
//#region utils os / is running in linux distro
|
|
3190
|
+
/**
|
|
3191
|
+
* check what linux you are running
|
|
3192
|
+
*/
|
|
3193
|
+
UtilsOs.isRunningInLinuxDistro = (linuxType) => {
|
|
3041
3194
|
/* */
|
|
3042
3195
|
/* */
|
|
3043
3196
|
/* */
|
|
@@ -3064,6 +3217,13 @@ var UtilsFilesFoldersSync;
|
|
|
3064
3217
|
/* */
|
|
3065
3218
|
/* */
|
|
3066
3219
|
/* */
|
|
3220
|
+
//#region @browser
|
|
3221
|
+
return false;
|
|
3222
|
+
//#endregion
|
|
3223
|
+
};
|
|
3224
|
+
//#endregion
|
|
3225
|
+
//#region utils os / is running in linux graphics capable environment
|
|
3226
|
+
UtilsOs.isRunningInLinuxGraphicsCapableEnvironment = () => {
|
|
3067
3227
|
/* */
|
|
3068
3228
|
/* */
|
|
3069
3229
|
/* */
|
|
@@ -3074,22 +3234,48 @@ var UtilsFilesFoldersSync;
|
|
|
3074
3234
|
return (void 0);
|
|
3075
3235
|
};
|
|
3076
3236
|
//#endregion
|
|
3077
|
-
//#region utils
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
*
|
|
3082
|
-
* This method is messing with parcel watcher
|
|
3083
|
-
* (moved files are not detected)
|
|
3084
|
-
*/
|
|
3085
|
-
UtilsFilesFoldersSync.move = (from, to, options) => {
|
|
3237
|
+
//#region utils os / is running in os with graphics capable environment
|
|
3238
|
+
UtilsOs.isRunningInOsWithGraphicsCapableEnvironment = () => {
|
|
3239
|
+
/* */
|
|
3240
|
+
/* */
|
|
3086
3241
|
/* */
|
|
3087
3242
|
/* */
|
|
3088
3243
|
/* */
|
|
3089
3244
|
/* */
|
|
3090
3245
|
/* */
|
|
3091
3246
|
/* */
|
|
3247
|
+
return (void 0);
|
|
3248
|
+
};
|
|
3249
|
+
//#endregion
|
|
3250
|
+
//#region utils os / is running in cli mode
|
|
3251
|
+
/**
|
|
3252
|
+
* Check whether the current process is running in CLI mode.
|
|
3253
|
+
*/
|
|
3254
|
+
UtilsOs.isRunningInCliMode = () => {
|
|
3255
|
+
//#region @browser
|
|
3256
|
+
return false;
|
|
3257
|
+
//#endregion
|
|
3258
|
+
/* */
|
|
3259
|
+
/* */
|
|
3260
|
+
return (void 0);
|
|
3261
|
+
};
|
|
3262
|
+
//#endregion
|
|
3263
|
+
//#region utils os / is running in mocha test
|
|
3264
|
+
/**
|
|
3265
|
+
* Check whether the current process is running in mocha test.
|
|
3266
|
+
*/
|
|
3267
|
+
UtilsOs.isRunningInMochaTest = () => {
|
|
3268
|
+
//#region @browser
|
|
3269
|
+
return false;
|
|
3270
|
+
//#endregion
|
|
3271
|
+
/* */
|
|
3272
|
+
/* */
|
|
3092
3273
|
/* */
|
|
3274
|
+
return (void 0);
|
|
3275
|
+
};
|
|
3276
|
+
//#endregion
|
|
3277
|
+
//#region utils os / is port in use
|
|
3278
|
+
const isPortInUseOnHost = (port, host) => {
|
|
3093
3279
|
/* */
|
|
3094
3280
|
/* */
|
|
3095
3281
|
/* */
|
|
@@ -3115,6 +3301,16 @@ var UtilsFilesFoldersSync;
|
|
|
3115
3301
|
/* */
|
|
3116
3302
|
/* */
|
|
3117
3303
|
/* */
|
|
3304
|
+
return (void 0);
|
|
3305
|
+
};
|
|
3306
|
+
/**
|
|
3307
|
+
* Checks if a given port is already in use (bound by another process).
|
|
3308
|
+
*
|
|
3309
|
+
* @param port - The port number to check.
|
|
3310
|
+
* @param host - The hostname or IP address to bind to (default: '127.0.0.1').
|
|
3311
|
+
* @returns Promise<boolean> - Resolves to `true` if the port is in use, otherwise `false`.
|
|
3312
|
+
*/
|
|
3313
|
+
UtilsOs.isPortInUse = async (port, options) => {
|
|
3118
3314
|
/* */
|
|
3119
3315
|
/* */
|
|
3120
3316
|
/* */
|
|
@@ -3128,6 +3324,18 @@ var UtilsFilesFoldersSync;
|
|
|
3128
3324
|
/* */
|
|
3129
3325
|
/* */
|
|
3130
3326
|
/* */
|
|
3327
|
+
return (void 0);
|
|
3328
|
+
};
|
|
3329
|
+
//#endregion
|
|
3330
|
+
//#region utils os / is docker available
|
|
3331
|
+
/**
|
|
3332
|
+
* Check if docker is available on this system
|
|
3333
|
+
* and it is running (daemon active)
|
|
3334
|
+
*/
|
|
3335
|
+
UtilsOs.isDockerAvailable = async () => {
|
|
3336
|
+
if (UtilsOs.isBrowser) {
|
|
3337
|
+
return false;
|
|
3338
|
+
}
|
|
3131
3339
|
/* */
|
|
3132
3340
|
/* */
|
|
3133
3341
|
/* */
|
|
@@ -3160,39 +3368,96 @@ var UtilsFilesFoldersSync;
|
|
|
3160
3368
|
return (void 0);
|
|
3161
3369
|
};
|
|
3162
3370
|
//#endregion
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
*/
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3371
|
+
//#region utils os / open folder in file explorer
|
|
3372
|
+
UtilsOs.openFolderInFileExplorer = (folderPath) => {
|
|
3373
|
+
/* */
|
|
3374
|
+
/* */
|
|
3375
|
+
/* */
|
|
3376
|
+
/* */
|
|
3377
|
+
/* */
|
|
3378
|
+
/* */
|
|
3379
|
+
/* */
|
|
3380
|
+
/* */
|
|
3381
|
+
/* */
|
|
3382
|
+
/* */
|
|
3383
|
+
/* */
|
|
3384
|
+
/* */
|
|
3385
|
+
/* */
|
|
3386
|
+
/* */
|
|
3387
|
+
/* */
|
|
3388
|
+
/* */
|
|
3389
|
+
/* */
|
|
3390
|
+
/* */
|
|
3391
|
+
/* */
|
|
3392
|
+
/* */
|
|
3393
|
+
/* */
|
|
3394
|
+
/* */
|
|
3395
|
+
/* */
|
|
3396
|
+
/* */
|
|
3397
|
+
/* */
|
|
3183
3398
|
/* */
|
|
3184
3399
|
/* */
|
|
3185
3400
|
/* */
|
|
3186
3401
|
/* */
|
|
3187
3402
|
/* */
|
|
3188
3403
|
return (void 0);
|
|
3404
|
+
//#region @browser
|
|
3405
|
+
console.warn(`UtilsOs.openFolderInFileExplorer is not supported in browser mode`);
|
|
3406
|
+
//#endregion
|
|
3189
3407
|
};
|
|
3190
3408
|
//#endregion
|
|
3191
|
-
//#region utils
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3409
|
+
//#region utils os / get real home directory
|
|
3410
|
+
UtilsOs.getRealHomeDir = () => {
|
|
3411
|
+
//#region @browser
|
|
3412
|
+
return '';
|
|
3413
|
+
//#endregion
|
|
3414
|
+
/* */
|
|
3415
|
+
/* */
|
|
3416
|
+
/* */
|
|
3417
|
+
/* */
|
|
3418
|
+
/* */
|
|
3419
|
+
/* */
|
|
3420
|
+
/* */
|
|
3421
|
+
/* */
|
|
3422
|
+
/* */
|
|
3423
|
+
/* */
|
|
3424
|
+
/* */
|
|
3425
|
+
/* */
|
|
3426
|
+
/* */
|
|
3427
|
+
/* */
|
|
3428
|
+
/* */
|
|
3429
|
+
/* */
|
|
3430
|
+
/* */
|
|
3431
|
+
/* */
|
|
3432
|
+
/* */
|
|
3433
|
+
/* */
|
|
3434
|
+
/* */
|
|
3435
|
+
/* */
|
|
3436
|
+
/* */
|
|
3437
|
+
/* */
|
|
3438
|
+
/* */
|
|
3439
|
+
/* */
|
|
3440
|
+
/* */
|
|
3441
|
+
/* */
|
|
3442
|
+
/* */
|
|
3443
|
+
/* */
|
|
3444
|
+
/* */
|
|
3445
|
+
/* */
|
|
3446
|
+
/* */
|
|
3447
|
+
/* */
|
|
3448
|
+
/* */
|
|
3449
|
+
/* */
|
|
3450
|
+
/* */
|
|
3451
|
+
/* */
|
|
3452
|
+
/* */
|
|
3453
|
+
/* */
|
|
3454
|
+
/* */
|
|
3455
|
+
/* */
|
|
3456
|
+
/* */
|
|
3457
|
+
/* */
|
|
3458
|
+
/* */
|
|
3459
|
+
/* */
|
|
3460
|
+
/* */
|
|
3196
3461
|
/* */
|
|
3197
3462
|
/* */
|
|
3198
3463
|
/* */
|
|
@@ -3200,10 +3465,38 @@ var UtilsFilesFolders;
|
|
|
3200
3465
|
/* */
|
|
3201
3466
|
return (void 0);
|
|
3202
3467
|
};
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3468
|
+
const MANAGED_TEMP_FOLDER_NAME = '__temp__folders__with__exp__date';
|
|
3469
|
+
const TEMP_METADATA_FILE_NAME = '__temp_folder_metadata__.json';
|
|
3470
|
+
UtilsOs.getTempFolder = (options = {}) => {
|
|
3471
|
+
/* */
|
|
3472
|
+
/* */
|
|
3473
|
+
/* */
|
|
3474
|
+
/* */
|
|
3475
|
+
/* */
|
|
3476
|
+
/* */
|
|
3477
|
+
/* */
|
|
3478
|
+
/* */
|
|
3479
|
+
/* */
|
|
3480
|
+
/* */
|
|
3481
|
+
/* */
|
|
3482
|
+
/* */
|
|
3483
|
+
/* */
|
|
3484
|
+
/* */
|
|
3485
|
+
/* */
|
|
3486
|
+
/* */
|
|
3487
|
+
/* */
|
|
3488
|
+
/* */
|
|
3489
|
+
/* */
|
|
3490
|
+
/* */
|
|
3491
|
+
/* */
|
|
3492
|
+
/* */
|
|
3493
|
+
/* */
|
|
3494
|
+
/* */
|
|
3495
|
+
/* */
|
|
3496
|
+
/* */
|
|
3497
|
+
/* */
|
|
3498
|
+
/* */
|
|
3499
|
+
/* */
|
|
3207
3500
|
/* */
|
|
3208
3501
|
/* */
|
|
3209
3502
|
/* */
|
|
@@ -3261,167 +3554,8 @@ var UtilsFilesFolders;
|
|
|
3261
3554
|
/* */
|
|
3262
3555
|
/* */
|
|
3263
3556
|
return (void 0);
|
|
3264
|
-
}
|
|
3265
|
-
//#endregion
|
|
3266
|
-
//#region utils files folders operations / read file
|
|
3267
|
-
/**
|
|
3268
|
-
* TODO @IN_PROGRESS
|
|
3269
|
-
*/
|
|
3270
|
-
const readFileAsync = async (absoluteFilePath, options) => {
|
|
3271
|
-
return void 0;
|
|
3272
|
-
};
|
|
3273
|
-
/* */
|
|
3274
|
-
/* */
|
|
3275
|
-
/**
|
|
3276
|
-
* TODO @IN_PROGRESS
|
|
3277
|
-
*/
|
|
3278
|
-
const writeFileAsync = async (absoluteFilePath, input, options) => {
|
|
3279
|
-
return void 0;
|
|
3280
|
-
};
|
|
3281
|
-
//#endregion
|
|
3282
|
-
//#region utils files folders operations / is existed symlink
|
|
3283
|
-
/**
|
|
3284
|
-
* TODO @IN_PROGRESS
|
|
3285
|
-
*/
|
|
3286
|
-
const isExistedSymlink = async (absoluteFilePath) => {
|
|
3287
|
-
return void 0;
|
|
3288
|
-
};
|
|
3289
|
-
//#endregion
|
|
3290
|
-
//#region utils files folders operations / is un existed link
|
|
3291
|
-
/**
|
|
3292
|
-
* TODO @IN_PROGRESS
|
|
3293
|
-
*/
|
|
3294
|
-
const isUnExistedLink = async (absoluteFilePath) => {
|
|
3295
|
-
return void 0;
|
|
3296
3557
|
};
|
|
3297
|
-
|
|
3298
|
-
})(UtilsFilesFolders || (UtilsFilesFolders = {}));
|
|
3299
|
-
|
|
3300
|
-
var UtilsJson;
|
|
3301
|
-
(function (UtilsJson) {
|
|
3302
|
-
//#region get attributes from jsonc or json5 file
|
|
3303
|
-
/**
|
|
3304
|
-
* ! TODO handle packages like zone.js with dot
|
|
3305
|
-
* Get attributes from jsonc or json5 file
|
|
3306
|
-
* @param jsonDeepPath lodash path to property in json ex. deep.path.to.prop
|
|
3307
|
-
* @param fileContent jsonc or json5 - json with comments
|
|
3308
|
-
* @returns array of attributes
|
|
3309
|
-
*/
|
|
3310
|
-
UtilsJson.getAtrributiesFromJsonWithComments = (jsonDeepPath, // lodash path to property in json ex. deep.path.to.prop
|
|
3311
|
-
fileContent) => {
|
|
3312
|
-
const lines = fileContent.split('\n');
|
|
3313
|
-
// split path to parts but keep part if is for example 'sql.js
|
|
3314
|
-
const pathParts = jsonDeepPath.split('.').reduce((a, b) => {
|
|
3315
|
-
if (a.length === 0) {
|
|
3316
|
-
return [b];
|
|
3317
|
-
}
|
|
3318
|
-
const last = a[a.length - 1];
|
|
3319
|
-
if ((last.startsWith(`['`) && b.endsWith(`']`)) ||
|
|
3320
|
-
(last.startsWith(`["`) && b.endsWith(`"]`))) {
|
|
3321
|
-
a[a.length - 1] = [last, b].join('.');
|
|
3322
|
-
}
|
|
3323
|
-
else {
|
|
3324
|
-
a.push(b);
|
|
3325
|
-
}
|
|
3326
|
-
return a;
|
|
3327
|
-
}, []);
|
|
3328
|
-
// console.log({ pathParts });
|
|
3329
|
-
// const pathParts = jsonDeepPath.split('.');
|
|
3330
|
-
// const keyName = pathParts.pop()!.replace(/^\["(.+)"\]$/, '$1');
|
|
3331
|
-
const keyName = pathParts.pop().replace(/^\["(.+)"\]$/, '$1');
|
|
3332
|
-
let currentPath = '';
|
|
3333
|
-
let attributes = [];
|
|
3334
|
-
let collectedComments = [];
|
|
3335
|
-
for (const line of lines) {
|
|
3336
|
-
const trimmedLine = line.trim();
|
|
3337
|
-
if (trimmedLine.startsWith('//')) {
|
|
3338
|
-
// Collect comments
|
|
3339
|
-
collectedComments.push(trimmedLine);
|
|
3340
|
-
// trimmedLine.startsWith('//pizda') &&
|
|
3341
|
-
// console.log('pushlin line', { trimmedLine });
|
|
3342
|
-
}
|
|
3343
|
-
else if (trimmedLine.startsWith('"') || trimmedLine.startsWith("'")) {
|
|
3344
|
-
// Extract the key from the line
|
|
3345
|
-
const match = trimmedLine.match(/["']([^"']+)["']\s*:/);
|
|
3346
|
-
// console.log({ match0: match && match[0], match1: match && match[1] });
|
|
3347
|
-
if (match) {
|
|
3348
|
-
const key = match[1];
|
|
3349
|
-
currentPath = currentPath
|
|
3350
|
-
? `${currentPath}.${key.includes('.') ? `['${key}']` : key}`
|
|
3351
|
-
: key;
|
|
3352
|
-
// console.log({ key });
|
|
3353
|
-
// Check if the current path matches the jsonDeepPath
|
|
3354
|
-
if ((currentPath.endsWith(keyName) &&
|
|
3355
|
-
!currentPath.endsWith('/' + keyName)) ||
|
|
3356
|
-
currentPath.endsWith(`['${keyName}']`)) {
|
|
3357
|
-
// console.log('extract attributes', {
|
|
3358
|
-
// keyName,
|
|
3359
|
-
// collectedCommentsLength: collectedComments.length,
|
|
3360
|
-
// });
|
|
3361
|
-
// Process the collected comments to extract attributes
|
|
3362
|
-
attributes = extractAttributesFromComments(collectedComments);
|
|
3363
|
-
break;
|
|
3364
|
-
}
|
|
3365
|
-
// Reset collected comments as they only relate to the next key
|
|
3366
|
-
collectedComments = [];
|
|
3367
|
-
}
|
|
3368
|
-
}
|
|
3369
|
-
}
|
|
3370
|
-
return attributes;
|
|
3371
|
-
};
|
|
3372
|
-
//#endregion
|
|
3373
|
-
//#region get attributes from comment
|
|
3374
|
-
UtilsJson.getAttributiesFromComment = (comment, attributes = []) => {
|
|
3375
|
-
// Match @name=value OR @name
|
|
3376
|
-
// Values can be "..." or '...' or unquoted token without @
|
|
3377
|
-
const attrRegex = /@(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s@]+)))?/g;
|
|
3378
|
-
let match;
|
|
3379
|
-
while ((match = attrRegex.exec(comment)) !== null) {
|
|
3380
|
-
const [, name, doubleQuoted, singleQuoted, unquoted] = match;
|
|
3381
|
-
const value = doubleQuoted ?? singleQuoted ?? unquoted;
|
|
3382
|
-
const existingAttribute = attributes.find(attr => attr.name === `@${name}`);
|
|
3383
|
-
if (existingAttribute) {
|
|
3384
|
-
if (value !== undefined) {
|
|
3385
|
-
if (Array.isArray(existingAttribute.value)) {
|
|
3386
|
-
existingAttribute.value.push(value);
|
|
3387
|
-
}
|
|
3388
|
-
else {
|
|
3389
|
-
existingAttribute.value = [existingAttribute.value, value];
|
|
3390
|
-
}
|
|
3391
|
-
}
|
|
3392
|
-
}
|
|
3393
|
-
else {
|
|
3394
|
-
attributes.push({
|
|
3395
|
-
name: `@${name}`,
|
|
3396
|
-
value: value !== undefined ? value : true,
|
|
3397
|
-
});
|
|
3398
|
-
}
|
|
3399
|
-
}
|
|
3400
|
-
// Normalize single values not to be arrays
|
|
3401
|
-
attributes.forEach(attr => {
|
|
3402
|
-
if (Array.isArray(attr.value) && attr.value.length === 1) {
|
|
3403
|
-
attr.value = attr.value[0];
|
|
3404
|
-
}
|
|
3405
|
-
});
|
|
3406
|
-
return attributes;
|
|
3407
|
-
};
|
|
3408
|
-
//#endregion
|
|
3409
|
-
//#region extract attributes from comments
|
|
3410
|
-
const extractAttributesFromComments = (comments) => {
|
|
3411
|
-
const attributes = [];
|
|
3412
|
-
// console.log({ comments });
|
|
3413
|
-
for (const comment of comments) {
|
|
3414
|
-
UtilsJson.getAttributiesFromComment(comment, attributes);
|
|
3415
|
-
}
|
|
3416
|
-
return attributes;
|
|
3417
|
-
};
|
|
3418
|
-
//#endregion
|
|
3419
|
-
//#region read json
|
|
3420
|
-
/**
|
|
3421
|
-
* read json from absolute path
|
|
3422
|
-
* @returns json object
|
|
3423
|
-
*/
|
|
3424
|
-
UtilsJson.readJson = (absoluteFilePath, defaultValue = {}, useJson5 = false) => {
|
|
3558
|
+
function getSystemTempFolder() {
|
|
3425
3559
|
/* */
|
|
3426
3560
|
/* */
|
|
3427
3561
|
/* */
|
|
@@ -3442,55 +3576,98 @@ var UtilsJson;
|
|
|
3442
3576
|
/* */
|
|
3443
3577
|
/* */
|
|
3444
3578
|
return (void 0);
|
|
3445
|
-
}
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3579
|
+
}
|
|
3580
|
+
function cleanupExpiredTempFolders(managedTempRoot) {
|
|
3581
|
+
/* */
|
|
3582
|
+
/* */
|
|
3583
|
+
/* */
|
|
3584
|
+
/* */
|
|
3585
|
+
/* */
|
|
3586
|
+
/* */
|
|
3587
|
+
/* */
|
|
3588
|
+
/* */
|
|
3589
|
+
/* */
|
|
3590
|
+
/* */
|
|
3591
|
+
/* */
|
|
3592
|
+
/* */
|
|
3593
|
+
/* */
|
|
3594
|
+
/* */
|
|
3595
|
+
/* */
|
|
3596
|
+
/* */
|
|
3597
|
+
/* */
|
|
3598
|
+
/* */
|
|
3599
|
+
/* */
|
|
3600
|
+
/* */
|
|
3601
|
+
/* */
|
|
3602
|
+
/* */
|
|
3603
|
+
/* */
|
|
3604
|
+
/* */
|
|
3605
|
+
/* */
|
|
3606
|
+
/* */
|
|
3607
|
+
/* */
|
|
3608
|
+
/* */
|
|
3609
|
+
/* */
|
|
3610
|
+
/* */
|
|
3611
|
+
/* */
|
|
3612
|
+
/* */
|
|
3613
|
+
/* */
|
|
3614
|
+
/* */
|
|
3615
|
+
/* */
|
|
3616
|
+
/* */
|
|
3617
|
+
/* */
|
|
3618
|
+
/* */
|
|
3619
|
+
/* */
|
|
3620
|
+
/* */
|
|
3621
|
+
/* */
|
|
3622
|
+
/* */
|
|
3623
|
+
/* */
|
|
3624
|
+
/* */
|
|
3449
3625
|
/* */
|
|
3450
3626
|
/* */
|
|
3451
3627
|
return (void 0);
|
|
3452
|
-
}
|
|
3628
|
+
}
|
|
3629
|
+
function sanitizeTempFolderPrefix(prefix) {
|
|
3630
|
+
/* */
|
|
3631
|
+
/* */
|
|
3632
|
+
/* */
|
|
3633
|
+
/* */
|
|
3634
|
+
/* */
|
|
3635
|
+
/* */
|
|
3636
|
+
/* */
|
|
3637
|
+
return (void 0);
|
|
3638
|
+
}
|
|
3639
|
+
UtilsOs.EditorArr = [
|
|
3640
|
+
'code',
|
|
3641
|
+
'codium',
|
|
3642
|
+
'cursor',
|
|
3643
|
+
'theia',
|
|
3644
|
+
'idea',
|
|
3645
|
+
'idea64',
|
|
3646
|
+
];
|
|
3453
3647
|
//#endregion
|
|
3454
|
-
//#region
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
* foo..bar
|
|
3473
|
-
* .foo
|
|
3474
|
-
* foo.
|
|
3475
|
-
* foo[]
|
|
3476
|
-
* foo[abc]
|
|
3477
|
-
* foo[asd].bar
|
|
3478
|
-
*/
|
|
3479
|
-
const validPathRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*(?:\[\d+\])*(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*(?:\[\d+\])*)*$/;
|
|
3480
|
-
if (!validPathRegex.test(path)) {
|
|
3481
|
-
throw new Error(`Invalid lodash path: "${path}"`);
|
|
3482
|
-
}
|
|
3483
|
-
const forbiddenKeys = ['__proto__', 'prototype', 'constructor'];
|
|
3484
|
-
const parts = path.replace(/\[(\d+)\]/g, '.$1').split('.');
|
|
3485
|
-
const forbiddenKey = parts.find(part => forbiddenKeys.includes(part));
|
|
3486
|
-
if (forbiddenKey) {
|
|
3487
|
-
throw new Error(`Invalid lodash path: forbidden key "${forbiddenKey}" in "${path}"`);
|
|
3488
|
-
}
|
|
3489
|
-
return path;
|
|
3648
|
+
//#region utils os / editor processes
|
|
3649
|
+
UtilsOs.EDITOR_PROCESSES = {
|
|
3650
|
+
code: ['code', 'Code'],
|
|
3651
|
+
codium: ['codium', 'VSCodium'],
|
|
3652
|
+
cursor: ['cursor', 'Cursor'],
|
|
3653
|
+
theia: ['theia', 'TheiaIDE'],
|
|
3654
|
+
'code-oss': [
|
|
3655
|
+
'code',
|
|
3656
|
+
'Code',
|
|
3657
|
+
'codium',
|
|
3658
|
+
'VSCodium',
|
|
3659
|
+
'cursor',
|
|
3660
|
+
'Cursor',
|
|
3661
|
+
'theia',
|
|
3662
|
+
'TheiaIDE',
|
|
3663
|
+
],
|
|
3664
|
+
idea: ['idea', 'idea64', 'IntelliJ IDEA'],
|
|
3665
|
+
idea64: ['idea64', 'idea', 'IntelliJ IDEA'],
|
|
3490
3666
|
};
|
|
3491
3667
|
//#endregion
|
|
3492
|
-
//#region
|
|
3493
|
-
|
|
3668
|
+
//#region utils os / kill procesesses
|
|
3669
|
+
const killProcesses = (names) => {
|
|
3670
|
+
/* */
|
|
3494
3671
|
/* */
|
|
3495
3672
|
/* */
|
|
3496
3673
|
/* */
|
|
@@ -3504,6 +3681,12 @@ var UtilsJson;
|
|
|
3504
3681
|
/* */
|
|
3505
3682
|
/* */
|
|
3506
3683
|
/* */
|
|
3684
|
+
/* */
|
|
3685
|
+
return (void 0);
|
|
3686
|
+
};
|
|
3687
|
+
//#endregion
|
|
3688
|
+
//#region utils os / kill all editors
|
|
3689
|
+
UtilsOs.killAllEditor = (editor) => {
|
|
3507
3690
|
/* */
|
|
3508
3691
|
/* */
|
|
3509
3692
|
/* */
|
|
@@ -3513,8 +3696,8 @@ var UtilsJson;
|
|
|
3513
3696
|
return (void 0);
|
|
3514
3697
|
};
|
|
3515
3698
|
//#endregion
|
|
3516
|
-
//#region
|
|
3517
|
-
|
|
3699
|
+
//#region utils os / detect editor
|
|
3700
|
+
UtilsOs.detectEditor = (options) => {
|
|
3518
3701
|
/* */
|
|
3519
3702
|
/* */
|
|
3520
3703
|
/* */
|
|
@@ -3537,595 +3720,165 @@ var UtilsJson;
|
|
|
3537
3720
|
/* */
|
|
3538
3721
|
/* */
|
|
3539
3722
|
/* */
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
*/
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3723
|
+
/* */
|
|
3724
|
+
/* */
|
|
3725
|
+
/* */
|
|
3726
|
+
/* */
|
|
3727
|
+
/* */
|
|
3728
|
+
/* */
|
|
3729
|
+
/* */
|
|
3730
|
+
/* */
|
|
3731
|
+
/* */
|
|
3732
|
+
/* */
|
|
3733
|
+
/* */
|
|
3734
|
+
/* */
|
|
3735
|
+
/* */
|
|
3736
|
+
/* */
|
|
3737
|
+
/* */
|
|
3738
|
+
/* */
|
|
3739
|
+
/* */
|
|
3740
|
+
/* */
|
|
3741
|
+
/* */
|
|
3742
|
+
/* */
|
|
3743
|
+
/* */
|
|
3744
|
+
/* */
|
|
3745
|
+
/* */
|
|
3746
|
+
/* */
|
|
3747
|
+
/* */
|
|
3748
|
+
/* */
|
|
3749
|
+
/* */
|
|
3750
|
+
/* */
|
|
3751
|
+
return (void 0);
|
|
3752
|
+
};
|
|
3753
|
+
//#endregion
|
|
3754
|
+
//#region utils os / get editor keybinding path
|
|
3755
|
+
UtilsOs.getEditorKeybindingPath = (editor) => {
|
|
3756
|
+
/* */
|
|
3757
|
+
/* */
|
|
3758
|
+
/* */
|
|
3759
|
+
/* */
|
|
3760
|
+
/* */
|
|
3761
|
+
/* */
|
|
3762
|
+
/* */
|
|
3763
|
+
/* */
|
|
3764
|
+
/* */
|
|
3765
|
+
/* */
|
|
3766
|
+
/* */
|
|
3767
|
+
/* */
|
|
3768
|
+
/* */
|
|
3769
|
+
/* */
|
|
3770
|
+
/* */
|
|
3771
|
+
/* */
|
|
3772
|
+
/* */
|
|
3773
|
+
/* */
|
|
3774
|
+
/* */
|
|
3775
|
+
/* */
|
|
3776
|
+
/* */
|
|
3777
|
+
/* */
|
|
3778
|
+
/* */
|
|
3779
|
+
/* */
|
|
3780
|
+
/* */
|
|
3781
|
+
/* */
|
|
3782
|
+
/* */
|
|
3783
|
+
/* */
|
|
3784
|
+
/* */
|
|
3785
|
+
/* */
|
|
3786
|
+
/* */
|
|
3787
|
+
/* */
|
|
3788
|
+
/* */
|
|
3789
|
+
/* */
|
|
3790
|
+
/* */
|
|
3791
|
+
/* */
|
|
3792
|
+
/* */
|
|
3793
|
+
/* */
|
|
3794
|
+
/* */
|
|
3795
|
+
/* */
|
|
3796
|
+
/* */
|
|
3797
|
+
/* */
|
|
3798
|
+
/* */
|
|
3799
|
+
return (void 0);
|
|
3800
|
+
};
|
|
3801
|
+
//#endregion
|
|
3802
|
+
//#region utils os / get editor settings json path
|
|
3803
|
+
UtilsOs.getEditorSettingsJsonPath = (editor, platform = process.platform, env = process.env) => {
|
|
3804
|
+
/* */
|
|
3805
|
+
/* */
|
|
3806
|
+
/* */
|
|
3807
|
+
/* */
|
|
3808
|
+
/* */
|
|
3809
|
+
/* */
|
|
3810
|
+
/* */
|
|
3811
|
+
/* */
|
|
3812
|
+
/* */
|
|
3813
|
+
/* */
|
|
3814
|
+
/* */
|
|
3815
|
+
/* */
|
|
3816
|
+
/* */
|
|
3817
|
+
/* */
|
|
3818
|
+
/* */
|
|
3819
|
+
/* */
|
|
3820
|
+
/* */
|
|
3821
|
+
/* */
|
|
3822
|
+
/* */
|
|
3823
|
+
/* */
|
|
3824
|
+
/* */
|
|
3825
|
+
/* */
|
|
3826
|
+
/* */
|
|
3827
|
+
/* */
|
|
3828
|
+
/* */
|
|
3829
|
+
/* */
|
|
3830
|
+
/* */
|
|
3831
|
+
/* */
|
|
3832
|
+
/* */
|
|
3833
|
+
/* */
|
|
3834
|
+
/* */
|
|
3835
|
+
/* */
|
|
3836
|
+
/* */
|
|
3837
|
+
/* */
|
|
3838
|
+
/* */
|
|
3839
|
+
/* */
|
|
3840
|
+
/* */
|
|
3841
|
+
/* */
|
|
3842
|
+
/* */
|
|
3843
|
+
/* */
|
|
3844
|
+
/* */
|
|
3845
|
+
/* */
|
|
3846
|
+
/* */
|
|
3847
|
+
/* */
|
|
3848
|
+
/* */
|
|
3849
|
+
/* */
|
|
3850
|
+
/* */
|
|
3851
|
+
/* */
|
|
3852
|
+
return (void 0);
|
|
3853
|
+
};
|
|
3854
|
+
//#endregion
|
|
3855
|
+
//#region utils os / is running in node debugger
|
|
3856
|
+
UtilsOs.isRunningNodeDebugger = () => {
|
|
3857
|
+
//#region @browser
|
|
3858
|
+
return false;
|
|
3859
|
+
//#endregion
|
|
3860
|
+
/* */
|
|
3861
|
+
/* */
|
|
3862
|
+
return (void 0);
|
|
3863
|
+
};
|
|
3864
|
+
//#endregion
|
|
3865
|
+
//#region utils os / is [...]
|
|
3866
|
+
// console.log('kurwa')
|
|
3867
|
+
UtilsOs.isNodeVersionOk = (options) => UtilsProcess.isNodeVersionOk(options);
|
|
3868
|
+
UtilsOs.isElectron = UtilsOs.isRunningInElectron();
|
|
3869
|
+
UtilsOs.isBrowser = UtilsOs.isRunningInBrowser();
|
|
3870
|
+
UtilsOs.isNode = UtilsOs.isRunningInNode();
|
|
3871
|
+
UtilsOs.isWebSQL = UtilsOs.isRunningInWebSQL();
|
|
3872
|
+
UtilsOs.isVscodeExtension = UtilsOs.isRunningInVscodeExtension();
|
|
3873
|
+
UtilsOs.isSSRMode = UtilsOs.isRunningInSSRMode();
|
|
3874
|
+
let isRunningInWindowsTmp = false;
|
|
3652
3875
|
/* */
|
|
3653
3876
|
/* */
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
/* */
|
|
3660
|
-
/* */
|
|
3661
|
-
/* */
|
|
3662
|
-
/* */
|
|
3663
|
-
/* */
|
|
3664
|
-
/* */
|
|
3665
|
-
/* */
|
|
3666
|
-
/* */
|
|
3667
|
-
/* */
|
|
3668
|
-
/* */
|
|
3669
|
-
/* */
|
|
3670
|
-
/* */
|
|
3671
|
-
/* */
|
|
3672
|
-
/* */
|
|
3673
|
-
/* */
|
|
3674
|
-
/* */
|
|
3675
|
-
/* */
|
|
3676
|
-
/* */
|
|
3677
|
-
/* */
|
|
3678
|
-
/* */
|
|
3679
|
-
/* */
|
|
3680
|
-
/* */
|
|
3681
|
-
/* */
|
|
3682
|
-
/* */
|
|
3683
|
-
/* */
|
|
3684
|
-
/* */
|
|
3685
|
-
/* */
|
|
3686
|
-
/* */
|
|
3687
|
-
/* */
|
|
3688
|
-
/* */
|
|
3689
|
-
/* */
|
|
3690
|
-
/* */
|
|
3691
|
-
/* */
|
|
3692
|
-
/* */
|
|
3693
|
-
/* */
|
|
3694
|
-
/* */
|
|
3695
|
-
/* */
|
|
3696
|
-
/* */
|
|
3697
|
-
/* */
|
|
3698
|
-
/* */
|
|
3699
|
-
/* */
|
|
3700
|
-
/* */
|
|
3701
|
-
/* */
|
|
3702
|
-
/* */
|
|
3703
|
-
/* */
|
|
3704
|
-
/* */
|
|
3705
|
-
/* */
|
|
3706
|
-
/* */
|
|
3707
|
-
/* */
|
|
3708
|
-
/* */
|
|
3709
|
-
/* */
|
|
3710
|
-
/* */
|
|
3711
|
-
/* */
|
|
3712
|
-
/* */
|
|
3713
|
-
/* */
|
|
3714
|
-
/* */
|
|
3715
|
-
/* */
|
|
3716
|
-
/* */
|
|
3717
|
-
/* */
|
|
3718
|
-
/* */
|
|
3719
|
-
/* */
|
|
3720
|
-
/* */
|
|
3721
|
-
/* */
|
|
3722
|
-
/* */
|
|
3723
|
-
/* */
|
|
3724
|
-
/* */
|
|
3725
|
-
/* */
|
|
3726
|
-
/* */
|
|
3727
|
-
/* */
|
|
3728
|
-
/* */
|
|
3729
|
-
/* */
|
|
3730
|
-
/* */
|
|
3731
|
-
/* */
|
|
3732
|
-
/* */
|
|
3733
|
-
/* */
|
|
3734
|
-
/* */
|
|
3735
|
-
/* */
|
|
3736
|
-
/* */
|
|
3737
|
-
/* */
|
|
3738
|
-
/* */
|
|
3739
|
-
/* */
|
|
3740
|
-
/* */
|
|
3741
|
-
/* */
|
|
3742
|
-
/* */
|
|
3743
|
-
/* */
|
|
3744
|
-
/* */
|
|
3745
|
-
/* */
|
|
3746
|
-
/* */
|
|
3747
|
-
/* */
|
|
3748
|
-
/* */
|
|
3749
|
-
/* */
|
|
3750
|
-
/* */
|
|
3751
|
-
/* */
|
|
3752
|
-
/* */
|
|
3753
|
-
/* */
|
|
3754
|
-
/* */
|
|
3755
|
-
/* */
|
|
3756
|
-
/* */
|
|
3757
|
-
/* */
|
|
3758
|
-
/* */
|
|
3759
|
-
/* */
|
|
3760
|
-
/* */
|
|
3761
|
-
/* */
|
|
3762
|
-
/* */
|
|
3763
|
-
/* */
|
|
3764
|
-
/* */
|
|
3765
|
-
/* */
|
|
3766
|
-
/* */
|
|
3767
|
-
/* */
|
|
3768
|
-
/* */
|
|
3769
|
-
/* */
|
|
3770
|
-
/* */
|
|
3771
|
-
/* */
|
|
3772
|
-
/* */
|
|
3773
|
-
/* */
|
|
3774
|
-
/* */
|
|
3775
|
-
/* */
|
|
3776
|
-
/* */
|
|
3777
|
-
/* */
|
|
3778
|
-
/* */
|
|
3779
|
-
/* */
|
|
3780
|
-
/* */
|
|
3781
|
-
/* */
|
|
3782
|
-
/* */
|
|
3783
|
-
/* */
|
|
3784
|
-
/* */
|
|
3785
|
-
/* */
|
|
3786
|
-
/* */
|
|
3787
|
-
/* */
|
|
3788
|
-
/* */
|
|
3789
|
-
/* */
|
|
3790
|
-
/* */
|
|
3791
|
-
/* */
|
|
3792
|
-
/* */
|
|
3793
|
-
/* */
|
|
3794
|
-
/* */
|
|
3795
|
-
/* */
|
|
3796
|
-
/* */
|
|
3797
|
-
/* */
|
|
3798
|
-
/* */
|
|
3799
|
-
/* */
|
|
3800
|
-
/* */
|
|
3801
|
-
/* */
|
|
3802
|
-
/* */
|
|
3803
|
-
/* */
|
|
3804
|
-
/* */
|
|
3805
|
-
/* */
|
|
3806
|
-
/* */
|
|
3807
|
-
/* */
|
|
3808
|
-
/* */
|
|
3809
|
-
/* */
|
|
3810
|
-
/* */
|
|
3811
|
-
/* */
|
|
3812
|
-
/* */
|
|
3813
|
-
/* */
|
|
3814
|
-
/* */
|
|
3815
|
-
/* */
|
|
3816
|
-
/* */
|
|
3817
|
-
/* */
|
|
3818
|
-
/* */
|
|
3819
|
-
/* */
|
|
3820
|
-
/* */
|
|
3821
|
-
/* */
|
|
3822
|
-
/* */
|
|
3823
|
-
/* */
|
|
3824
|
-
/* */
|
|
3825
|
-
/* */
|
|
3826
|
-
/* */
|
|
3827
|
-
/* */
|
|
3828
|
-
/* */
|
|
3829
|
-
/* */
|
|
3830
|
-
/* */
|
|
3831
|
-
/* */
|
|
3832
|
-
/* */
|
|
3833
|
-
/* */
|
|
3834
|
-
/* */
|
|
3835
|
-
/* */
|
|
3836
|
-
/* */
|
|
3837
|
-
/* */
|
|
3838
|
-
/* */
|
|
3839
|
-
/* */
|
|
3840
|
-
/* */
|
|
3841
|
-
/* */
|
|
3842
|
-
/* */
|
|
3843
|
-
/* */
|
|
3844
|
-
/* */
|
|
3845
|
-
/* */
|
|
3846
|
-
/* */
|
|
3847
|
-
/* */
|
|
3848
|
-
/* */
|
|
3849
|
-
/* */
|
|
3850
|
-
/* */
|
|
3851
|
-
/* */
|
|
3852
|
-
/* */
|
|
3853
|
-
/* */
|
|
3854
|
-
/* */
|
|
3855
|
-
/* */
|
|
3856
|
-
/* */
|
|
3857
|
-
/* */
|
|
3858
|
-
/* */
|
|
3859
|
-
/* */
|
|
3860
|
-
/* */
|
|
3861
|
-
/* */
|
|
3862
|
-
/* */
|
|
3863
|
-
/* */
|
|
3864
|
-
/* */
|
|
3865
|
-
/* */
|
|
3866
|
-
/* */
|
|
3867
|
-
/* */
|
|
3868
|
-
/* */
|
|
3869
|
-
/* */
|
|
3870
|
-
/* */
|
|
3871
|
-
/* */
|
|
3872
|
-
/* */
|
|
3873
|
-
/* */
|
|
3874
|
-
/* */
|
|
3875
|
-
/* */
|
|
3876
|
-
/* */
|
|
3877
|
-
/* */
|
|
3878
|
-
/* */
|
|
3879
|
-
/* */
|
|
3880
|
-
/* */
|
|
3881
|
-
/* */
|
|
3882
|
-
/* */
|
|
3883
|
-
/* */
|
|
3884
|
-
/* */
|
|
3885
|
-
/* */
|
|
3886
|
-
/* */
|
|
3887
|
-
/* */
|
|
3888
|
-
/* */
|
|
3889
|
-
/* */
|
|
3890
|
-
/* */
|
|
3891
|
-
/* */
|
|
3892
|
-
/* */
|
|
3893
|
-
/* */
|
|
3894
|
-
/* */
|
|
3895
|
-
/* */
|
|
3896
|
-
/* */
|
|
3897
|
-
/* */
|
|
3898
|
-
/* */
|
|
3899
|
-
/* */
|
|
3900
|
-
/* */
|
|
3901
|
-
/* */
|
|
3902
|
-
/* */
|
|
3903
|
-
/* */
|
|
3904
|
-
/* */
|
|
3905
|
-
/* */
|
|
3906
|
-
/* */
|
|
3907
|
-
/* */
|
|
3908
|
-
/* */
|
|
3909
|
-
/* */
|
|
3910
|
-
/* */
|
|
3911
|
-
/* */
|
|
3912
|
-
/* */
|
|
3913
|
-
/* */
|
|
3914
|
-
/* */
|
|
3915
|
-
/* */
|
|
3916
|
-
/* */
|
|
3917
|
-
/* */
|
|
3918
|
-
/* */
|
|
3919
|
-
/* */
|
|
3920
|
-
/* */
|
|
3921
|
-
/* */
|
|
3922
|
-
/* */
|
|
3923
|
-
/* */
|
|
3924
|
-
/* */
|
|
3925
|
-
/* */
|
|
3926
|
-
/* */
|
|
3927
|
-
/* */
|
|
3928
|
-
/* */
|
|
3929
|
-
/* */
|
|
3930
|
-
/* */
|
|
3931
|
-
/* */
|
|
3932
|
-
return (void 0);
|
|
3933
|
-
};
|
|
3934
|
-
//#endregion
|
|
3935
|
-
|
|
3936
|
-
//#region imports
|
|
3937
|
-
//#endregion
|
|
3938
|
-
var UtilsProcess;
|
|
3939
|
-
(function (UtilsProcess) {
|
|
3940
|
-
//#region utils process / start async child process command until
|
|
3941
|
-
/**
|
|
3942
|
-
* This let you start child process and resolve promise when some
|
|
3943
|
-
* condition is met. It is useful for example when you want to start
|
|
3944
|
-
* process and wait until some output is in stdout or stderr.
|
|
3945
|
-
*/
|
|
3946
|
-
UtilsProcess.startAsyncChildProcessCommandUntil = async (command, options) => {
|
|
3947
|
-
/* */
|
|
3948
|
-
/* */
|
|
3949
|
-
/* */
|
|
3950
|
-
/* */
|
|
3951
|
-
/* */
|
|
3952
|
-
/* */
|
|
3953
|
-
/* */
|
|
3954
|
-
/* */
|
|
3955
|
-
/* */
|
|
3956
|
-
/* */
|
|
3957
|
-
/* */
|
|
3958
|
-
/* */
|
|
3959
|
-
/* */
|
|
3960
|
-
/* */
|
|
3961
|
-
/* */
|
|
3962
|
-
/* */
|
|
3963
|
-
/* */
|
|
3964
|
-
/* */
|
|
3965
|
-
/* */
|
|
3966
|
-
/* */
|
|
3967
|
-
/* */
|
|
3968
|
-
/* */
|
|
3969
|
-
/* */
|
|
3970
|
-
/* */
|
|
3971
|
-
/* */
|
|
3972
|
-
/* */
|
|
3973
|
-
/* */
|
|
3974
|
-
/* */
|
|
3975
|
-
/* */
|
|
3976
|
-
/* */
|
|
3977
|
-
/* */
|
|
3978
|
-
/* */
|
|
3979
|
-
/* */
|
|
3980
|
-
/* */
|
|
3981
|
-
/* */
|
|
3982
|
-
/* */
|
|
3983
|
-
/* */
|
|
3984
|
-
/* */
|
|
3985
|
-
/* */
|
|
3986
|
-
/* */
|
|
3987
|
-
/* */
|
|
3988
|
-
/* */
|
|
3989
|
-
/* */
|
|
3990
|
-
/* */
|
|
3991
|
-
/* */
|
|
3992
|
-
/* */
|
|
3993
|
-
/* */
|
|
3994
|
-
/* */
|
|
3995
|
-
/* */
|
|
3996
|
-
/* */
|
|
3997
|
-
/* */
|
|
3998
|
-
/* */
|
|
3999
|
-
/* */
|
|
4000
|
-
/* */
|
|
4001
|
-
/* */
|
|
4002
|
-
/* */
|
|
4003
|
-
/* */
|
|
4004
|
-
/* */
|
|
4005
|
-
/* */
|
|
4006
|
-
/* */
|
|
4007
|
-
/* */
|
|
4008
|
-
/* */
|
|
4009
|
-
/* */
|
|
4010
|
-
/* */
|
|
4011
|
-
/* */
|
|
4012
|
-
/* */
|
|
4013
|
-
/* */
|
|
4014
|
-
/* */
|
|
4015
|
-
/* */
|
|
4016
|
-
return (void 0);
|
|
4017
|
-
};
|
|
4018
|
-
//#endregion
|
|
4019
|
-
//#region utils process / get git bash path
|
|
4020
|
-
UtilsProcess.getGitBashPath = () => {
|
|
4021
|
-
/* */
|
|
4022
|
-
/* */
|
|
4023
|
-
/* */
|
|
4024
|
-
/* */
|
|
4025
|
-
/* */
|
|
4026
|
-
/* */
|
|
4027
|
-
/* */
|
|
4028
|
-
/* */
|
|
4029
|
-
/* */
|
|
4030
|
-
/* */
|
|
4031
|
-
/* */
|
|
4032
|
-
/* */
|
|
4033
|
-
/* */
|
|
4034
|
-
/* */
|
|
4035
|
-
/* */
|
|
4036
|
-
/* */
|
|
4037
|
-
/* */
|
|
4038
|
-
/* */
|
|
4039
|
-
return (void 0);
|
|
4040
|
-
};
|
|
4041
|
-
//#endregion
|
|
4042
|
-
//#region utils process / start process in new graphical terminal window
|
|
4043
|
-
/**
|
|
4044
|
-
* TODO IMPLEMENT
|
|
4045
|
-
* start async node process
|
|
4046
|
-
*/
|
|
4047
|
-
UtilsProcess.startInNewTerminalWindow = (command, options) => {
|
|
4048
|
-
/* */
|
|
4049
|
-
/* */
|
|
4050
|
-
/* */
|
|
4051
|
-
/* */
|
|
4052
|
-
/* */
|
|
4053
|
-
/* */
|
|
4054
|
-
/* */
|
|
4055
|
-
/* */
|
|
4056
|
-
/* */
|
|
4057
|
-
/* */
|
|
4058
|
-
/* */
|
|
4059
|
-
/* */
|
|
4060
|
-
/* */
|
|
4061
|
-
/* */
|
|
4062
|
-
/* */
|
|
4063
|
-
/* */
|
|
4064
|
-
/* */
|
|
4065
|
-
/* */
|
|
4066
|
-
/* */
|
|
4067
|
-
/* */
|
|
4068
|
-
/* */
|
|
4069
|
-
/* */
|
|
4070
|
-
/* */
|
|
4071
|
-
/* */
|
|
4072
|
-
/* */
|
|
4073
|
-
/* */
|
|
4074
|
-
/* */
|
|
4075
|
-
/* */
|
|
4076
|
-
/* */
|
|
4077
|
-
/* */
|
|
4078
|
-
/* */
|
|
4079
|
-
/* */
|
|
4080
|
-
/* */
|
|
4081
|
-
/* */
|
|
4082
|
-
/* */
|
|
4083
|
-
/* */
|
|
4084
|
-
/* */
|
|
4085
|
-
/* */
|
|
4086
|
-
/* */
|
|
4087
|
-
/* */
|
|
4088
|
-
/* */
|
|
4089
|
-
/* */
|
|
4090
|
-
/* */
|
|
4091
|
-
/* */
|
|
4092
|
-
/* */
|
|
4093
|
-
/* */
|
|
4094
|
-
/* */
|
|
4095
|
-
/* */
|
|
4096
|
-
/* */
|
|
4097
|
-
/* */
|
|
4098
|
-
/* */
|
|
4099
|
-
/* */
|
|
4100
|
-
/* */
|
|
4101
|
-
/* */
|
|
4102
|
-
/* */
|
|
4103
|
-
/* */
|
|
4104
|
-
/* */
|
|
4105
|
-
/* */
|
|
4106
|
-
/* */
|
|
4107
|
-
/* */
|
|
4108
|
-
/* */
|
|
4109
|
-
/* */
|
|
4110
|
-
/* */
|
|
4111
|
-
/* */
|
|
4112
|
-
/* */
|
|
4113
|
-
/* */
|
|
4114
|
-
/* */
|
|
4115
|
-
/* */
|
|
4116
|
-
/* */
|
|
4117
|
-
/* */
|
|
4118
|
-
/* */
|
|
4119
|
-
/* */
|
|
4120
|
-
/* */
|
|
4121
|
-
/* */
|
|
4122
|
-
/* */
|
|
4123
|
-
/* */
|
|
4124
|
-
/* */
|
|
4125
|
-
/* */
|
|
4126
|
-
/* */
|
|
4127
|
-
/* */
|
|
4128
|
-
/* */
|
|
3877
|
+
UtilsOs.isRunningInWindows = isRunningInWindowsTmp;
|
|
3878
|
+
//#endregion
|
|
3879
|
+
//#region utils os / command exists
|
|
3880
|
+
//#region helpers
|
|
3881
|
+
const fileNotExists = async (commandName) => {
|
|
4129
3882
|
/* */
|
|
4130
3883
|
/* */
|
|
4131
3884
|
/* */
|
|
@@ -4133,6 +3886,9 @@ var UtilsProcess;
|
|
|
4133
3886
|
/* */
|
|
4134
3887
|
/* */
|
|
4135
3888
|
/* */
|
|
3889
|
+
return (void 0);
|
|
3890
|
+
};
|
|
3891
|
+
const fileNotExistsSync = (commandName) => {
|
|
4136
3892
|
/* */
|
|
4137
3893
|
/* */
|
|
4138
3894
|
/* */
|
|
@@ -4140,6 +3896,9 @@ var UtilsProcess;
|
|
|
4140
3896
|
/* */
|
|
4141
3897
|
/* */
|
|
4142
3898
|
/* */
|
|
3899
|
+
return (void 0);
|
|
3900
|
+
};
|
|
3901
|
+
const localExecutable = async (commandName) => {
|
|
4143
3902
|
/* */
|
|
4144
3903
|
/* */
|
|
4145
3904
|
/* */
|
|
@@ -4147,6 +3906,9 @@ var UtilsProcess;
|
|
|
4147
3906
|
/* */
|
|
4148
3907
|
/* */
|
|
4149
3908
|
/* */
|
|
3909
|
+
return (void 0);
|
|
3910
|
+
};
|
|
3911
|
+
const localExecutableSync = (commandName) => {
|
|
4150
3912
|
/* */
|
|
4151
3913
|
/* */
|
|
4152
3914
|
/* */
|
|
@@ -4157,19 +3919,8 @@ var UtilsProcess;
|
|
|
4157
3919
|
return (void 0);
|
|
4158
3920
|
};
|
|
4159
3921
|
//#endregion
|
|
4160
|
-
//#region
|
|
4161
|
-
|
|
4162
|
-
//#region @browser
|
|
4163
|
-
return 'browser';
|
|
4164
|
-
//#endregion
|
|
4165
|
-
/* */
|
|
4166
|
-
/* */
|
|
4167
|
-
/* */
|
|
4168
|
-
/* */
|
|
4169
|
-
/* */
|
|
4170
|
-
/* */
|
|
4171
|
-
/* */
|
|
4172
|
-
/* */
|
|
3922
|
+
//#region command exists (Unix / Windows)
|
|
3923
|
+
const commandExistsUnix = async (commandName) => {
|
|
4173
3924
|
/* */
|
|
4174
3925
|
/* */
|
|
4175
3926
|
/* */
|
|
@@ -4185,6 +3936,9 @@ var UtilsProcess;
|
|
|
4185
3936
|
/* */
|
|
4186
3937
|
/* */
|
|
4187
3938
|
/* */
|
|
3939
|
+
return (void 0);
|
|
3940
|
+
};
|
|
3941
|
+
const commandExistsWindows = async (commandName) => {
|
|
4188
3942
|
/* */
|
|
4189
3943
|
/* */
|
|
4190
3944
|
/* */
|
|
@@ -4196,20 +3950,7 @@ var UtilsProcess;
|
|
|
4196
3950
|
/* */
|
|
4197
3951
|
return (void 0);
|
|
4198
3952
|
};
|
|
4199
|
-
|
|
4200
|
-
//#region utils process / get current process and child processes usage
|
|
4201
|
-
/**
|
|
4202
|
-
* Get CPU and memory usage for a single PID.
|
|
4203
|
-
*/
|
|
4204
|
-
UtilsProcess.getUsageForPid = async (pid) => {
|
|
4205
|
-
/* */
|
|
4206
|
-
/* */
|
|
4207
|
-
/* */
|
|
4208
|
-
/* */
|
|
4209
|
-
/* */
|
|
4210
|
-
/* */
|
|
4211
|
-
/* */
|
|
4212
|
-
/* */
|
|
3953
|
+
const commandExistsUnixSync = (commandName) => {
|
|
4213
3954
|
/* */
|
|
4214
3955
|
/* */
|
|
4215
3956
|
/* */
|
|
@@ -4225,22 +3966,7 @@ var UtilsProcess;
|
|
|
4225
3966
|
/* */
|
|
4226
3967
|
return (void 0);
|
|
4227
3968
|
};
|
|
4228
|
-
|
|
4229
|
-
//#region utils process / get child PIDs
|
|
4230
|
-
/**
|
|
4231
|
-
* Return a list of direct child PIDs for the given PID on a Unix-like system.
|
|
4232
|
-
* Uses `ps -o pid= --ppid <pid>` to find child processes.
|
|
4233
|
-
*/
|
|
4234
|
-
async function getChildPidsUnix(pid) {
|
|
4235
|
-
/* */
|
|
4236
|
-
/* */
|
|
4237
|
-
/* */
|
|
4238
|
-
/* */
|
|
4239
|
-
/* */
|
|
4240
|
-
/* */
|
|
4241
|
-
/* */
|
|
4242
|
-
/* */
|
|
4243
|
-
/* */
|
|
3969
|
+
const commandExistsWindowsSync = (commandName) => {
|
|
4244
3970
|
/* */
|
|
4245
3971
|
/* */
|
|
4246
3972
|
/* */
|
|
@@ -4249,20 +3975,10 @@ var UtilsProcess;
|
|
|
4249
3975
|
/* */
|
|
4250
3976
|
/* */
|
|
4251
3977
|
return (void 0);
|
|
4252
|
-
}
|
|
3978
|
+
};
|
|
4253
3979
|
//#endregion
|
|
4254
|
-
//#region
|
|
4255
|
-
|
|
4256
|
-
* Return a list of direct child PIDs for the given PID on Windows.
|
|
4257
|
-
* Uses `wmic process where (ParentProcessId=<pid>) get ProcessId` to find child processes.
|
|
4258
|
-
*/
|
|
4259
|
-
async function getChildPidsWindows(pid) {
|
|
4260
|
-
/* */
|
|
4261
|
-
/* */
|
|
4262
|
-
/* */
|
|
4263
|
-
/* */
|
|
4264
|
-
/* */
|
|
4265
|
-
/* */
|
|
3980
|
+
//#region exported API
|
|
3981
|
+
UtilsOs.commandExistsAsync = async (commandName) => {
|
|
4266
3982
|
/* */
|
|
4267
3983
|
/* */
|
|
4268
3984
|
/* */
|
|
@@ -4275,35 +3991,19 @@ var UtilsProcess;
|
|
|
4275
3991
|
/* */
|
|
4276
3992
|
/* */
|
|
4277
3993
|
return (void 0);
|
|
4278
|
-
}
|
|
4279
|
-
//#endregion
|
|
4280
|
-
//#region utils process / get child PIDs once
|
|
3994
|
+
};
|
|
4281
3995
|
/**
|
|
4282
|
-
*
|
|
4283
|
-
* Uses the appropriate command depending on `process.platform`.
|
|
3996
|
+
* @deprecated use commandExistsAsync
|
|
4284
3997
|
*/
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
/* */
|
|
4291
|
-
/* */
|
|
4292
|
-
return (void 0);
|
|
4293
|
-
}
|
|
4294
|
-
UtilsProcess.getChildPidsOnce = getChildPidsOnce;
|
|
3998
|
+
UtilsOs.commandExistsSync = (commandName) => {
|
|
3999
|
+
return UtilsOs.isRunningInWindows
|
|
4000
|
+
? commandExistsWindowsSync(commandName)
|
|
4001
|
+
: commandExistsUnixSync(commandName);
|
|
4002
|
+
};
|
|
4295
4003
|
//#endregion
|
|
4296
|
-
//#
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
* plus any child processes spawned by it.
|
|
4300
|
-
*/
|
|
4301
|
-
UtilsProcess.getCurrentProcessAndChildUsage = async () => {
|
|
4302
|
-
/* */
|
|
4303
|
-
/* */
|
|
4304
|
-
/* */
|
|
4305
|
-
/* */
|
|
4306
|
-
/* */
|
|
4004
|
+
//#endregion
|
|
4005
|
+
//#region utils os / python module exists
|
|
4006
|
+
UtilsOs.pipxPackageExists = (packageName) => {
|
|
4307
4007
|
/* */
|
|
4308
4008
|
/* */
|
|
4309
4009
|
/* */
|
|
@@ -4311,6 +4011,9 @@ var UtilsProcess;
|
|
|
4311
4011
|
/* */
|
|
4312
4012
|
/* */
|
|
4313
4013
|
/* */
|
|
4014
|
+
return (void 0);
|
|
4015
|
+
};
|
|
4016
|
+
UtilsOs.pipxNestedPackageExists = (mainPackageName, targetNestedFromMainPackage) => {
|
|
4314
4017
|
/* */
|
|
4315
4018
|
/* */
|
|
4316
4019
|
/* */
|
|
@@ -4326,22 +4029,12 @@ var UtilsProcess;
|
|
|
4326
4029
|
/* */
|
|
4327
4030
|
return (void 0);
|
|
4328
4031
|
};
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
UtilsProcess.killAllJava = async () => {
|
|
4336
|
-
/* */
|
|
4337
|
-
/* */
|
|
4338
|
-
/* */
|
|
4339
|
-
/* */
|
|
4340
|
-
/* */
|
|
4341
|
-
/* */
|
|
4342
|
-
/* */
|
|
4343
|
-
/* */
|
|
4344
|
-
/* */
|
|
4032
|
+
const normalizeModuleName = (name) => {
|
|
4033
|
+
return name.replace(/-/g, '_');
|
|
4034
|
+
};
|
|
4035
|
+
UtilsOs.pythonModuleExists = async (moduleName,
|
|
4036
|
+
// pythonPath = process.platform === 'win32' ? 'python' : 'python3',
|
|
4037
|
+
pythonPath = 'python3') => {
|
|
4345
4038
|
/* */
|
|
4346
4039
|
/* */
|
|
4347
4040
|
/* */
|
|
@@ -4363,43 +4056,27 @@ var UtilsProcess;
|
|
|
4363
4056
|
return (void 0);
|
|
4364
4057
|
};
|
|
4365
4058
|
//#endregion
|
|
4366
|
-
//#region utils
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
/* */
|
|
4373
|
-
/* */
|
|
4374
|
-
/* */
|
|
4375
|
-
/* */
|
|
4376
|
-
/* */
|
|
4377
|
-
/* */
|
|
4378
|
-
/* */
|
|
4379
|
-
/* */
|
|
4380
|
-
/* */
|
|
4381
|
-
/* */
|
|
4382
|
-
/* */
|
|
4383
|
-
/* */
|
|
4384
|
-
/* */
|
|
4385
|
-
/* */
|
|
4386
|
-
/* */
|
|
4387
|
-
/* */
|
|
4388
|
-
/* */
|
|
4389
|
-
/* */
|
|
4059
|
+
//#region utils terminal / draw horizontal line
|
|
4060
|
+
UtilsOs.drawHorizontalLine = (row = 0) => {
|
|
4061
|
+
//#region @browser
|
|
4062
|
+
const widthBrowserConsole = row || 80;
|
|
4063
|
+
console.log('-'.repeat(widthBrowserConsole));
|
|
4064
|
+
//#endregion
|
|
4390
4065
|
/* */
|
|
4391
4066
|
/* */
|
|
4392
4067
|
/* */
|
|
4393
4068
|
/* */
|
|
4394
|
-
return (void 0);
|
|
4395
4069
|
};
|
|
4396
4070
|
//#endregion
|
|
4397
|
-
//#region utils
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4071
|
+
//#region utils terminal / draw vertical line
|
|
4072
|
+
UtilsOs.drawVerticalLine = (col = 0) => {
|
|
4073
|
+
//#region @browser
|
|
4074
|
+
const heightBrowserConsole = 20;
|
|
4075
|
+
const line = Array.from({ length: heightBrowserConsole })
|
|
4076
|
+
.map(() => '|')
|
|
4077
|
+
.join('\n');
|
|
4078
|
+
console.log(line);
|
|
4079
|
+
//#endregion
|
|
4403
4080
|
/* */
|
|
4404
4081
|
/* */
|
|
4405
4082
|
/* */
|
|
@@ -4409,6 +4086,10 @@ var UtilsProcess;
|
|
|
4409
4086
|
/* */
|
|
4410
4087
|
/* */
|
|
4411
4088
|
/* */
|
|
4089
|
+
};
|
|
4090
|
+
//#endregion
|
|
4091
|
+
//#region utils os / get inotify watch count (linux)
|
|
4092
|
+
async function getInotifyWatchCount() {
|
|
4412
4093
|
/* */
|
|
4413
4094
|
/* */
|
|
4414
4095
|
/* */
|
|
@@ -4453,19 +4134,32 @@ var UtilsProcess;
|
|
|
4453
4134
|
/* */
|
|
4454
4135
|
/* */
|
|
4455
4136
|
/* */
|
|
4137
|
+
return (void 0);
|
|
4138
|
+
}
|
|
4139
|
+
UtilsOs.getInotifyWatchCount = getInotifyWatchCount;
|
|
4140
|
+
//#endregion
|
|
4141
|
+
//#region utils os / send notification
|
|
4142
|
+
UtilsOs.sendNotification = async (opt) => {
|
|
4143
|
+
//#region prepare variables
|
|
4144
|
+
const platform = os.platform();
|
|
4145
|
+
const defaultTimeoutMs = 3000;
|
|
4146
|
+
opt = _.cloneDeep(opt);
|
|
4147
|
+
const consoleNotification = `
|
|
4148
|
+
|
|
4149
|
+
> NOTIFICATION
|
|
4150
|
+
${opt.appName ?? 'App'} / ${opt.title}
|
|
4151
|
+
${opt.subtitle ? opt.subtitle + '\n' : ''}${opt.body ?? ''}
|
|
4152
|
+
|
|
4153
|
+
`;
|
|
4154
|
+
//#endregion
|
|
4155
|
+
//#region @browser
|
|
4156
|
+
UtilsOs.drawVerticalLine();
|
|
4157
|
+
console.log(consoleNotification);
|
|
4158
|
+
UtilsOs.drawVerticalLine();
|
|
4159
|
+
//#endregion
|
|
4456
4160
|
/* */
|
|
4457
4161
|
/* */
|
|
4458
4162
|
/* */
|
|
4459
|
-
return (void 0);
|
|
4460
|
-
};
|
|
4461
|
-
//#endregion
|
|
4462
|
-
//#region utils process / kill all other node processes except itself
|
|
4463
|
-
/**
|
|
4464
|
-
* Kills all Node.js processes except the current process.
|
|
4465
|
-
* Works on Windows, macOS, and Linux.
|
|
4466
|
-
* @returns {number} Number of processes killed
|
|
4467
|
-
*/
|
|
4468
|
-
UtilsProcess.killAllOtherNodeProcesses = async () => {
|
|
4469
4163
|
/* */
|
|
4470
4164
|
/* */
|
|
4471
4165
|
/* */
|
|
@@ -4528,37 +4222,6 @@ var UtilsProcess;
|
|
|
4528
4222
|
/* */
|
|
4529
4223
|
/* */
|
|
4530
4224
|
/* */
|
|
4531
|
-
return (void 0);
|
|
4532
|
-
};
|
|
4533
|
-
//#endregion
|
|
4534
|
-
//#region utils process / is node version ok
|
|
4535
|
-
UtilsProcess.isNodeVersionOk = (options) => {
|
|
4536
|
-
if (!globalThis || !globalThis.process || !globalThis.process.version) {
|
|
4537
|
-
return false;
|
|
4538
|
-
}
|
|
4539
|
-
options = options || {};
|
|
4540
|
-
options.required = options.required || '18.0.0';
|
|
4541
|
-
const current = globalThis.process.version.replace(/^v/, '');
|
|
4542
|
-
const [curMajor, curMinor, curPatch] = current.split('.').map(Number);
|
|
4543
|
-
const [reqMajor, reqMinor, reqPatch] = options.required
|
|
4544
|
-
.replace(/^v/, '')
|
|
4545
|
-
.split('.')
|
|
4546
|
-
.map(Number);
|
|
4547
|
-
const ok = curMajor > reqMajor ||
|
|
4548
|
-
(curMajor === reqMajor && curMinor > reqMinor) ||
|
|
4549
|
-
(curMajor === reqMajor && curMinor === reqMinor && curPatch >= reqPatch);
|
|
4550
|
-
if (options?.log) {
|
|
4551
|
-
console.log(ok
|
|
4552
|
-
? `✅ Node.js version OK (required ≥ ${options.required}, current ${current})`
|
|
4553
|
-
: `❌ Node.js version too low (required ≥ ${options.required}, current ${current})`);
|
|
4554
|
-
}
|
|
4555
|
-
if (options?.throwErrorIfNotOk && !ok) {
|
|
4556
|
-
throw new Error(`Node.js version too low (required ≥ ${options.required}, current ${current})`);
|
|
4557
|
-
}
|
|
4558
|
-
return ok;
|
|
4559
|
-
};
|
|
4560
|
-
//#endregion
|
|
4561
|
-
UtilsProcess.getPathOfExecutable = async (command) => {
|
|
4562
4225
|
/* */
|
|
4563
4226
|
/* */
|
|
4564
4227
|
/* */
|
|
@@ -4577,95 +4240,14 @@ var UtilsProcess;
|
|
|
4577
4240
|
/* */
|
|
4578
4241
|
/* */
|
|
4579
4242
|
/* */
|
|
4580
|
-
return (void 0);
|
|
4581
|
-
};
|
|
4582
|
-
})(UtilsProcess || (UtilsProcess = {}));
|
|
4583
|
-
|
|
4584
|
-
//#region imports
|
|
4585
|
-
//#endregion
|
|
4586
|
-
var UtilsOs;
|
|
4587
|
-
(function (UtilsOs) {
|
|
4588
|
-
//#region utils os / is running in browser
|
|
4589
|
-
/**
|
|
4590
|
-
* check if script is running in client browser
|
|
4591
|
-
* (websql model -> is also considered as browser
|
|
4592
|
-
* because it is running in browser)
|
|
4593
|
-
*/
|
|
4594
|
-
UtilsOs.isRunningInBrowser = () => {
|
|
4595
4243
|
/* */
|
|
4596
4244
|
/* */
|
|
4597
|
-
return true;
|
|
4598
|
-
};
|
|
4599
|
-
//#endregion
|
|
4600
|
-
//#region utils os / is running in node
|
|
4601
|
-
/**
|
|
4602
|
-
* check if script is running in nodejs
|
|
4603
|
-
* (backend script or electron script)
|
|
4604
|
-
*/
|
|
4605
|
-
UtilsOs.isRunningInNode = () => {
|
|
4606
4245
|
/* */
|
|
4607
4246
|
/* */
|
|
4608
|
-
return false;
|
|
4609
|
-
};
|
|
4610
|
-
//#endregion
|
|
4611
|
-
//#region utils os / is running in websql
|
|
4612
|
-
/**
|
|
4613
|
-
* check if script is running special
|
|
4614
|
-
* browser mode that has sql.js backend
|
|
4615
|
-
* and executes sql queries in browser
|
|
4616
|
-
*/
|
|
4617
|
-
UtilsOs.isRunningInWebSQL = () => {
|
|
4618
4247
|
/* */
|
|
4619
4248
|
/* */
|
|
4620
4249
|
/* */
|
|
4621
4250
|
/* */
|
|
4622
|
-
return false;
|
|
4623
|
-
};
|
|
4624
|
-
//#endregion
|
|
4625
|
-
//#region utils os / is running in ssr mode
|
|
4626
|
-
UtilsOs.isRunningInSSRMode = () => {
|
|
4627
|
-
return typeof globalThis.window === 'undefined';
|
|
4628
|
-
};
|
|
4629
|
-
//#endregion
|
|
4630
|
-
//#region utils os / is running in electron
|
|
4631
|
-
/**
|
|
4632
|
-
* check whether the current process is running inside
|
|
4633
|
-
* Cloudflare worker
|
|
4634
|
-
*/
|
|
4635
|
-
UtilsOs.isRunningInCloudflareWorker = () => {
|
|
4636
|
-
return isCloudflareWorker;
|
|
4637
|
-
};
|
|
4638
|
-
//#endregion
|
|
4639
|
-
//#region utils os / is running in electron
|
|
4640
|
-
/**
|
|
4641
|
-
* check whether the current process is running inside
|
|
4642
|
-
* Electron backend or browser.
|
|
4643
|
-
*/
|
|
4644
|
-
UtilsOs.isRunningInElectron = () => {
|
|
4645
|
-
// Electron main or renderer (most reliable)
|
|
4646
|
-
if (typeof process !== 'undefined' && process?.versions?.electron) {
|
|
4647
|
-
return true;
|
|
4648
|
-
}
|
|
4649
|
-
// Renderer with nodeIntegration
|
|
4650
|
-
if (typeof globalThis !== 'undefined' &&
|
|
4651
|
-
globalThis?.process?.type === 'renderer') {
|
|
4652
|
-
return true;
|
|
4653
|
-
}
|
|
4654
|
-
// Renderer with nodeIntegration disabled
|
|
4655
|
-
if (typeof navigator === 'object' &&
|
|
4656
|
-
typeof navigator.userAgent === 'string' &&
|
|
4657
|
-
/Electron/i.test(navigator.userAgent)) {
|
|
4658
|
-
return true;
|
|
4659
|
-
}
|
|
4660
|
-
return false;
|
|
4661
|
-
};
|
|
4662
|
-
//#endregion
|
|
4663
|
-
//#region utils os / is running in vscode extension
|
|
4664
|
-
/**
|
|
4665
|
-
* Check whether the current process is running inside
|
|
4666
|
-
* a Visual Studio Code extension.
|
|
4667
|
-
*/
|
|
4668
|
-
UtilsOs.isRunningInVscodeExtension = () => {
|
|
4669
4251
|
/* */
|
|
4670
4252
|
/* */
|
|
4671
4253
|
/* */
|
|
@@ -4674,19 +4256,6 @@ var UtilsOs;
|
|
|
4674
4256
|
/* */
|
|
4675
4257
|
/* */
|
|
4676
4258
|
/* */
|
|
4677
|
-
return (void 0);
|
|
4678
|
-
return false;
|
|
4679
|
-
};
|
|
4680
|
-
//#endregion
|
|
4681
|
-
//#region utils os / is running in wsl
|
|
4682
|
-
/**
|
|
4683
|
-
* Check wether the current process is running inside
|
|
4684
|
-
* windows subsystem for linux (WSL).
|
|
4685
|
-
*/
|
|
4686
|
-
UtilsOs.isRunningInWsl = () => {
|
|
4687
|
-
//#region @browser
|
|
4688
|
-
return false;
|
|
4689
|
-
//#endregion
|
|
4690
4259
|
/* */
|
|
4691
4260
|
/* */
|
|
4692
4261
|
/* */
|
|
@@ -4695,6 +4264,12 @@ var UtilsOs;
|
|
|
4695
4264
|
/* */
|
|
4696
4265
|
/* */
|
|
4697
4266
|
/* */
|
|
4267
|
+
};
|
|
4268
|
+
//#endregion
|
|
4269
|
+
//#region utils os / safe exit program clean up fn
|
|
4270
|
+
let isCleaning = false;
|
|
4271
|
+
function safeExitProgramCleanUp(cleanFn) {
|
|
4272
|
+
/* */
|
|
4698
4273
|
/* */
|
|
4699
4274
|
/* */
|
|
4700
4275
|
/* */
|
|
@@ -4704,11 +4279,6 @@ var UtilsOs;
|
|
|
4704
4279
|
/* */
|
|
4705
4280
|
/* */
|
|
4706
4281
|
/* */
|
|
4707
|
-
return (void 0);
|
|
4708
|
-
};
|
|
4709
|
-
//#endregion
|
|
4710
|
-
//#region utils os / is running in windows / powershell / cmd / gitbash
|
|
4711
|
-
UtilsOs.isRunningInWindowsPowerShell = () => {
|
|
4712
4282
|
/* */
|
|
4713
4283
|
/* */
|
|
4714
4284
|
/* */
|
|
@@ -4752,17 +4322,18 @@ var UtilsOs;
|
|
|
4752
4322
|
/* */
|
|
4753
4323
|
/* */
|
|
4754
4324
|
return (void 0);
|
|
4755
|
-
}
|
|
4756
|
-
UtilsOs.
|
|
4325
|
+
}
|
|
4326
|
+
UtilsOs.safeExitProgramCleanUp = safeExitProgramCleanUp;
|
|
4327
|
+
//#endregion
|
|
4328
|
+
//#region utils os / where package locationd
|
|
4329
|
+
UtilsOs.whichOrWherePackageLocated = (packageName) => {
|
|
4330
|
+
/* */
|
|
4757
4331
|
/* */
|
|
4758
4332
|
/* */
|
|
4759
4333
|
/* */
|
|
4760
4334
|
/* */
|
|
4761
4335
|
/* */
|
|
4762
4336
|
/* */
|
|
4763
|
-
return (void 0);
|
|
4764
|
-
};
|
|
4765
|
-
UtilsOs.isRunningInWindowsGitBash = () => {
|
|
4766
4337
|
/* */
|
|
4767
4338
|
/* */
|
|
4768
4339
|
/* */
|
|
@@ -4771,14 +4342,6 @@ var UtilsOs;
|
|
|
4771
4342
|
/* */
|
|
4772
4343
|
/* */
|
|
4773
4344
|
/* */
|
|
4774
|
-
return (void 0);
|
|
4775
|
-
};
|
|
4776
|
-
//#endregion
|
|
4777
|
-
//#region utils os / is running in docker
|
|
4778
|
-
UtilsOs.isRunningInDocker = () => {
|
|
4779
|
-
//#region @browser
|
|
4780
|
-
return false;
|
|
4781
|
-
//#endregion
|
|
4782
4345
|
/* */
|
|
4783
4346
|
/* */
|
|
4784
4347
|
/* */
|
|
@@ -4802,6 +4365,63 @@ var UtilsOs;
|
|
|
4802
4365
|
/* */
|
|
4803
4366
|
/* */
|
|
4804
4367
|
/* */
|
|
4368
|
+
/* */
|
|
4369
|
+
/* */
|
|
4370
|
+
return (void 0);
|
|
4371
|
+
};
|
|
4372
|
+
//#endregion
|
|
4373
|
+
})(UtilsOs || (UtilsOs = {}));
|
|
4374
|
+
//#region taon repo path in user dir fn
|
|
4375
|
+
const taonRepoPathUserInUserDirFn = () => {
|
|
4376
|
+
/* */
|
|
4377
|
+
/* */
|
|
4378
|
+
/* */
|
|
4379
|
+
/* */
|
|
4380
|
+
/* */
|
|
4381
|
+
/* */
|
|
4382
|
+
return (void 0);
|
|
4383
|
+
return '';
|
|
4384
|
+
};
|
|
4385
|
+
//#endregion
|
|
4386
|
+
//#region taon repo path for global template fn
|
|
4387
|
+
const taonBasePathToGlobalDockerTemplatesFn = () => {
|
|
4388
|
+
/* */
|
|
4389
|
+
/* */
|
|
4390
|
+
/* */
|
|
4391
|
+
/* */
|
|
4392
|
+
/* */
|
|
4393
|
+
/* */
|
|
4394
|
+
return (void 0);
|
|
4395
|
+
return '';
|
|
4396
|
+
};
|
|
4397
|
+
//#endregion
|
|
4398
|
+
|
|
4399
|
+
//#region imports
|
|
4400
|
+
//#endregion
|
|
4401
|
+
var UtilsFilesFoldersSync;
|
|
4402
|
+
(function (UtilsFilesFoldersSync) {
|
|
4403
|
+
//#region utils files folders sync / ignore folder files patterns
|
|
4404
|
+
UtilsFilesFoldersSync.IGNORE_FOLDERS_FILES_PATTERNS = [
|
|
4405
|
+
// '**/node_modules/**/*.*',
|
|
4406
|
+
'**/node_modules/**',
|
|
4407
|
+
// '**/node_modules',
|
|
4408
|
+
// '**/git/**/*.*',
|
|
4409
|
+
'**/.git/**/**',
|
|
4410
|
+
// '**/.git',
|
|
4411
|
+
// `**/${dotTaonFolder}/**/*.*`,
|
|
4412
|
+
`**/${dotTaonFolder}/**`,
|
|
4413
|
+
// `**/${dotTaonFolder}`,
|
|
4414
|
+
// `**/${dotTnpFolder}/**/*.*`,
|
|
4415
|
+
`**/${dotTnpFolder}/**`,
|
|
4416
|
+
// `**/${dotTnpFolder}`,
|
|
4417
|
+
'**/tmp-*',
|
|
4418
|
+
// `**/tmp-*/**/*.*`,
|
|
4419
|
+
'**/tmp-*/**',
|
|
4420
|
+
];
|
|
4421
|
+
//#endregion
|
|
4422
|
+
//#region utils files folders sync / read file
|
|
4423
|
+
UtilsFilesFoldersSync.readFile = (absoluteFilePath, // @ts-ignore
|
|
4424
|
+
options) => {
|
|
4805
4425
|
/* */
|
|
4806
4426
|
/* */
|
|
4807
4427
|
/* */
|
|
@@ -4824,11 +4444,6 @@ var UtilsOs;
|
|
|
4824
4444
|
/* */
|
|
4825
4445
|
/* */
|
|
4826
4446
|
/* */
|
|
4827
|
-
return (void 0);
|
|
4828
|
-
};
|
|
4829
|
-
//#endregion
|
|
4830
|
-
//#region utils os / is running in linux graphics capable environment
|
|
4831
|
-
UtilsOs.isRunningInLinuxGraphicsCapableEnvironment = () => {
|
|
4832
4447
|
/* */
|
|
4833
4448
|
/* */
|
|
4834
4449
|
/* */
|
|
@@ -4836,11 +4451,6 @@ var UtilsOs;
|
|
|
4836
4451
|
/* */
|
|
4837
4452
|
/* */
|
|
4838
4453
|
/* */
|
|
4839
|
-
return (void 0);
|
|
4840
|
-
};
|
|
4841
|
-
//#endregion
|
|
4842
|
-
//#region utils os / is running in os with graphics capable environment
|
|
4843
|
-
UtilsOs.isRunningInOsWithGraphicsCapableEnvironment = () => {
|
|
4844
4454
|
/* */
|
|
4845
4455
|
/* */
|
|
4846
4456
|
/* */
|
|
@@ -4849,38 +4459,16 @@ var UtilsOs;
|
|
|
4849
4459
|
/* */
|
|
4850
4460
|
/* */
|
|
4851
4461
|
/* */
|
|
4852
|
-
return (void 0);
|
|
4853
|
-
};
|
|
4854
|
-
//#endregion
|
|
4855
|
-
//#region utils os / is running in cli mode
|
|
4856
|
-
/**
|
|
4857
|
-
* Check whether the current process is running in CLI mode.
|
|
4858
|
-
*/
|
|
4859
|
-
UtilsOs.isRunningInCliMode = () => {
|
|
4860
|
-
//#region @browser
|
|
4861
|
-
return false;
|
|
4862
|
-
//#endregion
|
|
4863
4462
|
/* */
|
|
4864
4463
|
/* */
|
|
4865
|
-
return (void 0);
|
|
4866
|
-
};
|
|
4867
|
-
//#endregion
|
|
4868
|
-
//#region utils os / is running in mocha test
|
|
4869
|
-
/**
|
|
4870
|
-
* Check whether the current process is running in mocha test.
|
|
4871
|
-
*/
|
|
4872
|
-
UtilsOs.isRunningInMochaTest = () => {
|
|
4873
|
-
//#region @browser
|
|
4874
|
-
return false;
|
|
4875
|
-
//#endregion
|
|
4876
4464
|
/* */
|
|
4877
4465
|
/* */
|
|
4878
4466
|
/* */
|
|
4879
4467
|
return (void 0);
|
|
4880
4468
|
};
|
|
4881
4469
|
//#endregion
|
|
4882
|
-
//#region utils
|
|
4883
|
-
|
|
4470
|
+
//#region utils files folders sync / write file
|
|
4471
|
+
UtilsFilesFoldersSync.writeFile = (absoluteFilePath, input, options) => {
|
|
4884
4472
|
/* */
|
|
4885
4473
|
/* */
|
|
4886
4474
|
/* */
|
|
@@ -4906,16 +4494,6 @@ var UtilsOs;
|
|
|
4906
4494
|
/* */
|
|
4907
4495
|
/* */
|
|
4908
4496
|
/* */
|
|
4909
|
-
return (void 0);
|
|
4910
|
-
};
|
|
4911
|
-
/**
|
|
4912
|
-
* Checks if a given port is already in use (bound by another process).
|
|
4913
|
-
*
|
|
4914
|
-
* @param port - The port number to check.
|
|
4915
|
-
* @param host - The hostname or IP address to bind to (default: '127.0.0.1').
|
|
4916
|
-
* @returns Promise<boolean> - Resolves to `true` if the port is in use, otherwise `false`.
|
|
4917
|
-
*/
|
|
4918
|
-
UtilsOs.isPortInUse = async (port, options) => {
|
|
4919
4497
|
/* */
|
|
4920
4498
|
/* */
|
|
4921
4499
|
/* */
|
|
@@ -4929,18 +4507,6 @@ var UtilsOs;
|
|
|
4929
4507
|
/* */
|
|
4930
4508
|
/* */
|
|
4931
4509
|
/* */
|
|
4932
|
-
return (void 0);
|
|
4933
|
-
};
|
|
4934
|
-
//#endregion
|
|
4935
|
-
//#region utils os / is docker available
|
|
4936
|
-
/**
|
|
4937
|
-
* Check if docker is available on this system
|
|
4938
|
-
* and it is running (daemon active)
|
|
4939
|
-
*/
|
|
4940
|
-
UtilsOs.isDockerAvailable = async () => {
|
|
4941
|
-
if (UtilsOs.isBrowser) {
|
|
4942
|
-
return false;
|
|
4943
|
-
}
|
|
4944
4510
|
/* */
|
|
4945
4511
|
/* */
|
|
4946
4512
|
/* */
|
|
@@ -4970,11 +4536,6 @@ var UtilsOs;
|
|
|
4970
4536
|
/* */
|
|
4971
4537
|
/* */
|
|
4972
4538
|
/* */
|
|
4973
|
-
return (void 0);
|
|
4974
|
-
};
|
|
4975
|
-
//#endregion
|
|
4976
|
-
//#region utils os / open folder in file explorer
|
|
4977
|
-
UtilsOs.openFolderInFileExplorer = (folderPath) => {
|
|
4978
4539
|
/* */
|
|
4979
4540
|
/* */
|
|
4980
4541
|
/* */
|
|
@@ -5005,17 +4566,6 @@ var UtilsOs;
|
|
|
5005
4566
|
/* */
|
|
5006
4567
|
/* */
|
|
5007
4568
|
/* */
|
|
5008
|
-
return (void 0);
|
|
5009
|
-
//#region @browser
|
|
5010
|
-
console.warn(`UtilsOs.openFolderInFileExplorer is not supported in browser mode`);
|
|
5011
|
-
//#endregion
|
|
5012
|
-
};
|
|
5013
|
-
//#endregion
|
|
5014
|
-
//#region utils os / get real home directory
|
|
5015
|
-
UtilsOs.getRealHomeDir = () => {
|
|
5016
|
-
//#region @browser
|
|
5017
|
-
return '';
|
|
5018
|
-
//#endregion
|
|
5019
4569
|
/* */
|
|
5020
4570
|
/* */
|
|
5021
4571
|
/* */
|
|
@@ -5028,6 +4578,10 @@ var UtilsOs;
|
|
|
5028
4578
|
/* */
|
|
5029
4579
|
/* */
|
|
5030
4580
|
/* */
|
|
4581
|
+
return (void 0);
|
|
4582
|
+
};
|
|
4583
|
+
//#region utils files folders sync / walk fs tree
|
|
4584
|
+
const walkFsTree = (root, options) => {
|
|
5031
4585
|
/* */
|
|
5032
4586
|
/* */
|
|
5033
4587
|
/* */
|
|
@@ -5068,11 +4622,6 @@ var UtilsOs;
|
|
|
5068
4622
|
/* */
|
|
5069
4623
|
/* */
|
|
5070
4624
|
/* */
|
|
5071
|
-
return (void 0);
|
|
5072
|
-
};
|
|
5073
|
-
const MANAGED_TEMP_FOLDER_NAME = '__temp__folders__with__exp__date';
|
|
5074
|
-
const TEMP_METADATA_FILE_NAME = '__temp_folder_metadata__.json';
|
|
5075
|
-
UtilsOs.getTempFolder = (options = {}) => {
|
|
5076
4625
|
/* */
|
|
5077
4626
|
/* */
|
|
5078
4627
|
/* */
|
|
@@ -5139,7 +4688,12 @@ var UtilsOs;
|
|
|
5139
4688
|
/* */
|
|
5140
4689
|
return (void 0);
|
|
5141
4690
|
};
|
|
5142
|
-
|
|
4691
|
+
//#endregion
|
|
4692
|
+
//#region utils files folders sync / get files from
|
|
4693
|
+
/**
|
|
4694
|
+
* return absolute paths for files inside folder or link to folder
|
|
4695
|
+
*/
|
|
4696
|
+
UtilsFilesFoldersSync.getFilesFrom = (folderOrLinkToFolder, options) => {
|
|
5143
4697
|
/* */
|
|
5144
4698
|
/* */
|
|
5145
4699
|
/* */
|
|
@@ -5154,14 +4708,19 @@ var UtilsOs;
|
|
|
5154
4708
|
/* */
|
|
5155
4709
|
/* */
|
|
5156
4710
|
/* */
|
|
4711
|
+
return (void 0);
|
|
4712
|
+
};
|
|
4713
|
+
//#endregion
|
|
4714
|
+
//#region utils files and folder sync / get folders from
|
|
4715
|
+
/**
|
|
4716
|
+
* return absolute paths for folders inside folder or link to folder
|
|
4717
|
+
*/
|
|
4718
|
+
UtilsFilesFoldersSync.getFoldersFrom = (folderOrLinkToFolder, options) => {
|
|
5157
4719
|
/* */
|
|
5158
4720
|
/* */
|
|
5159
4721
|
/* */
|
|
5160
4722
|
/* */
|
|
5161
4723
|
/* */
|
|
5162
|
-
return (void 0);
|
|
5163
|
-
}
|
|
5164
|
-
function cleanupExpiredTempFolders(managedTempRoot) {
|
|
5165
4724
|
/* */
|
|
5166
4725
|
/* */
|
|
5167
4726
|
/* */
|
|
@@ -5171,6 +4730,11 @@ var UtilsOs;
|
|
|
5171
4730
|
/* */
|
|
5172
4731
|
/* */
|
|
5173
4732
|
/* */
|
|
4733
|
+
return (void 0);
|
|
4734
|
+
};
|
|
4735
|
+
//#endregion
|
|
4736
|
+
//#endregion
|
|
4737
|
+
UtilsFilesFoldersSync.copyFolder = (sourceDir, destinationDir, options) => {
|
|
5174
4738
|
/* */
|
|
5175
4739
|
/* */
|
|
5176
4740
|
/* */
|
|
@@ -5190,6 +4754,12 @@ var UtilsOs;
|
|
|
5190
4754
|
/* */
|
|
5191
4755
|
/* */
|
|
5192
4756
|
/* */
|
|
4757
|
+
/* */
|
|
4758
|
+
/* */
|
|
4759
|
+
return (void 0);
|
|
4760
|
+
};
|
|
4761
|
+
//#region utils files folders sync / copy
|
|
4762
|
+
UtilsFilesFoldersSync.copy = (sourceDir, destinationDir, options) => {
|
|
5193
4763
|
/* */
|
|
5194
4764
|
/* */
|
|
5195
4765
|
/* */
|
|
@@ -5208,9 +4778,6 @@ var UtilsOs;
|
|
|
5208
4778
|
/* */
|
|
5209
4779
|
/* */
|
|
5210
4780
|
/* */
|
|
5211
|
-
return (void 0);
|
|
5212
|
-
}
|
|
5213
|
-
function sanitizeTempFolderPrefix(prefix) {
|
|
5214
4781
|
/* */
|
|
5215
4782
|
/* */
|
|
5216
4783
|
/* */
|
|
@@ -5218,39 +4785,6 @@ var UtilsOs;
|
|
|
5218
4785
|
/* */
|
|
5219
4786
|
/* */
|
|
5220
4787
|
/* */
|
|
5221
|
-
return (void 0);
|
|
5222
|
-
}
|
|
5223
|
-
UtilsOs.EditorArr = [
|
|
5224
|
-
'code',
|
|
5225
|
-
'codium',
|
|
5226
|
-
'cursor',
|
|
5227
|
-
'theia',
|
|
5228
|
-
'idea',
|
|
5229
|
-
'idea64',
|
|
5230
|
-
];
|
|
5231
|
-
//#endregion
|
|
5232
|
-
//#region utils os / editor processes
|
|
5233
|
-
UtilsOs.EDITOR_PROCESSES = {
|
|
5234
|
-
code: ['code', 'Code'],
|
|
5235
|
-
codium: ['codium', 'VSCodium'],
|
|
5236
|
-
cursor: ['cursor', 'Cursor'],
|
|
5237
|
-
theia: ['theia', 'TheiaIDE'],
|
|
5238
|
-
'code-oss': [
|
|
5239
|
-
'code',
|
|
5240
|
-
'Code',
|
|
5241
|
-
'codium',
|
|
5242
|
-
'VSCodium',
|
|
5243
|
-
'cursor',
|
|
5244
|
-
'Cursor',
|
|
5245
|
-
'theia',
|
|
5246
|
-
'TheiaIDE',
|
|
5247
|
-
],
|
|
5248
|
-
idea: ['idea', 'idea64', 'IntelliJ IDEA'],
|
|
5249
|
-
idea64: ['idea64', 'idea', 'IntelliJ IDEA'],
|
|
5250
|
-
};
|
|
5251
|
-
//#endregion
|
|
5252
|
-
//#region utils os / kill procesesses
|
|
5253
|
-
const killProcesses = (names) => {
|
|
5254
4788
|
/* */
|
|
5255
4789
|
/* */
|
|
5256
4790
|
/* */
|
|
@@ -5266,22 +4800,12 @@ var UtilsOs;
|
|
|
5266
4800
|
/* */
|
|
5267
4801
|
/* */
|
|
5268
4802
|
/* */
|
|
5269
|
-
return (void 0);
|
|
5270
|
-
};
|
|
5271
|
-
//#endregion
|
|
5272
|
-
//#region utils os / kill all editors
|
|
5273
|
-
UtilsOs.killAllEditor = (editor) => {
|
|
5274
4803
|
/* */
|
|
5275
4804
|
/* */
|
|
5276
4805
|
/* */
|
|
5277
4806
|
/* */
|
|
5278
4807
|
/* */
|
|
5279
4808
|
/* */
|
|
5280
|
-
return (void 0);
|
|
5281
|
-
};
|
|
5282
|
-
//#endregion
|
|
5283
|
-
//#region utils os / detect editor
|
|
5284
|
-
UtilsOs.detectEditor = (options) => {
|
|
5285
4809
|
/* */
|
|
5286
4810
|
/* */
|
|
5287
4811
|
/* */
|
|
@@ -5332,11 +4856,6 @@ var UtilsOs;
|
|
|
5332
4856
|
/* */
|
|
5333
4857
|
/* */
|
|
5334
4858
|
/* */
|
|
5335
|
-
return (void 0);
|
|
5336
|
-
};
|
|
5337
|
-
//#endregion
|
|
5338
|
-
//#region utils os / get editor keybinding path
|
|
5339
|
-
UtilsOs.getEditorKeybindingPath = (editor) => {
|
|
5340
4859
|
/* */
|
|
5341
4860
|
/* */
|
|
5342
4861
|
/* */
|
|
@@ -5380,11 +4899,6 @@ var UtilsOs;
|
|
|
5380
4899
|
/* */
|
|
5381
4900
|
/* */
|
|
5382
4901
|
/* */
|
|
5383
|
-
return (void 0);
|
|
5384
|
-
};
|
|
5385
|
-
//#endregion
|
|
5386
|
-
//#region utils os / get editor settings json path
|
|
5387
|
-
UtilsOs.getEditorSettingsJsonPath = (editor, platform = process.platform, env = process.env) => {
|
|
5388
4902
|
/* */
|
|
5389
4903
|
/* */
|
|
5390
4904
|
/* */
|
|
@@ -5433,36 +4947,8 @@ var UtilsOs;
|
|
|
5433
4947
|
/* */
|
|
5434
4948
|
/* */
|
|
5435
4949
|
/* */
|
|
5436
|
-
return (void 0);
|
|
5437
|
-
};
|
|
5438
|
-
//#endregion
|
|
5439
|
-
//#region utils os / is running in node debugger
|
|
5440
|
-
UtilsOs.isRunningNodeDebugger = () => {
|
|
5441
|
-
//#region @browser
|
|
5442
|
-
return false;
|
|
5443
|
-
//#endregion
|
|
5444
4950
|
/* */
|
|
5445
4951
|
/* */
|
|
5446
|
-
return (void 0);
|
|
5447
|
-
};
|
|
5448
|
-
//#endregion
|
|
5449
|
-
//#region utils os / is [...]
|
|
5450
|
-
// console.log('kurwa')
|
|
5451
|
-
UtilsOs.isNodeVersionOk = (options) => UtilsProcess.isNodeVersionOk(options);
|
|
5452
|
-
UtilsOs.isElectron = UtilsOs.isRunningInElectron();
|
|
5453
|
-
UtilsOs.isBrowser = UtilsOs.isRunningInBrowser();
|
|
5454
|
-
UtilsOs.isNode = UtilsOs.isRunningInNode();
|
|
5455
|
-
UtilsOs.isWebSQL = UtilsOs.isRunningInWebSQL();
|
|
5456
|
-
UtilsOs.isVscodeExtension = UtilsOs.isRunningInVscodeExtension();
|
|
5457
|
-
UtilsOs.isSSRMode = UtilsOs.isRunningInSSRMode();
|
|
5458
|
-
let isRunningInWindowsTmp = false;
|
|
5459
|
-
/* */
|
|
5460
|
-
/* */
|
|
5461
|
-
UtilsOs.isRunningInWindows = isRunningInWindowsTmp;
|
|
5462
|
-
//#endregion
|
|
5463
|
-
//#region utils os / command exists
|
|
5464
|
-
//#region helpers
|
|
5465
|
-
const fileNotExists = async (commandName) => {
|
|
5466
4952
|
/* */
|
|
5467
4953
|
/* */
|
|
5468
4954
|
/* */
|
|
@@ -5470,9 +4956,6 @@ var UtilsOs;
|
|
|
5470
4956
|
/* */
|
|
5471
4957
|
/* */
|
|
5472
4958
|
/* */
|
|
5473
|
-
return (void 0);
|
|
5474
|
-
};
|
|
5475
|
-
const fileNotExistsSync = (commandName) => {
|
|
5476
4959
|
/* */
|
|
5477
4960
|
/* */
|
|
5478
4961
|
/* */
|
|
@@ -5480,9 +4963,6 @@ var UtilsOs;
|
|
|
5480
4963
|
/* */
|
|
5481
4964
|
/* */
|
|
5482
4965
|
/* */
|
|
5483
|
-
return (void 0);
|
|
5484
|
-
};
|
|
5485
|
-
const localExecutable = async (commandName) => {
|
|
5486
4966
|
/* */
|
|
5487
4967
|
/* */
|
|
5488
4968
|
/* */
|
|
@@ -5490,9 +4970,6 @@ var UtilsOs;
|
|
|
5490
4970
|
/* */
|
|
5491
4971
|
/* */
|
|
5492
4972
|
/* */
|
|
5493
|
-
return (void 0);
|
|
5494
|
-
};
|
|
5495
|
-
const localExecutableSync = (commandName) => {
|
|
5496
4973
|
/* */
|
|
5497
4974
|
/* */
|
|
5498
4975
|
/* */
|
|
@@ -5503,8 +4980,8 @@ var UtilsOs;
|
|
|
5503
4980
|
return (void 0);
|
|
5504
4981
|
};
|
|
5505
4982
|
//#endregion
|
|
5506
|
-
//#region
|
|
5507
|
-
|
|
4983
|
+
//#region utils files folders sync / filter dont copy
|
|
4984
|
+
UtilsFilesFoldersSync.filterDontCopy = (basePathFoldersTosSkip, projectOrBasepath) => {
|
|
5508
4985
|
/* */
|
|
5509
4986
|
/* */
|
|
5510
4987
|
/* */
|
|
@@ -5520,9 +4997,6 @@ var UtilsOs;
|
|
|
5520
4997
|
/* */
|
|
5521
4998
|
/* */
|
|
5522
4999
|
/* */
|
|
5523
|
-
return (void 0);
|
|
5524
|
-
};
|
|
5525
|
-
const commandExistsWindows = async (commandName) => {
|
|
5526
5000
|
/* */
|
|
5527
5001
|
/* */
|
|
5528
5002
|
/* */
|
|
@@ -5534,7 +5008,10 @@ var UtilsOs;
|
|
|
5534
5008
|
/* */
|
|
5535
5009
|
return (void 0);
|
|
5536
5010
|
};
|
|
5537
|
-
|
|
5011
|
+
//#endregion
|
|
5012
|
+
//#region utils files folders sync / filter only copy
|
|
5013
|
+
UtilsFilesFoldersSync.filterOnlyCopy = (basePathFoldersOnlyToInclude, projectOrBasepath) => {
|
|
5014
|
+
/* */
|
|
5538
5015
|
/* */
|
|
5539
5016
|
/* */
|
|
5540
5017
|
/* */
|
|
@@ -5548,9 +5025,6 @@ var UtilsOs;
|
|
|
5548
5025
|
/* */
|
|
5549
5026
|
/* */
|
|
5550
5027
|
/* */
|
|
5551
|
-
return (void 0);
|
|
5552
|
-
};
|
|
5553
|
-
const commandExistsWindowsSync = (commandName) => {
|
|
5554
5028
|
/* */
|
|
5555
5029
|
/* */
|
|
5556
5030
|
/* */
|
|
@@ -5561,12 +5035,8 @@ var UtilsOs;
|
|
|
5561
5035
|
return (void 0);
|
|
5562
5036
|
};
|
|
5563
5037
|
//#endregion
|
|
5564
|
-
//#region
|
|
5565
|
-
|
|
5566
|
-
/* */
|
|
5567
|
-
/* */
|
|
5568
|
-
/* */
|
|
5569
|
-
/* */
|
|
5038
|
+
//#region utils files folders sync / copy file
|
|
5039
|
+
UtilsFilesFoldersSync.copyFile = (sourcePath, destinationPath, options) => {
|
|
5570
5040
|
/* */
|
|
5571
5041
|
/* */
|
|
5572
5042
|
/* */
|
|
@@ -5574,20 +5044,6 @@ var UtilsOs;
|
|
|
5574
5044
|
/* */
|
|
5575
5045
|
/* */
|
|
5576
5046
|
/* */
|
|
5577
|
-
return (void 0);
|
|
5578
|
-
};
|
|
5579
|
-
/**
|
|
5580
|
-
* @deprecated use commandExistsAsync
|
|
5581
|
-
*/
|
|
5582
|
-
UtilsOs.commandExistsSync = (commandName) => {
|
|
5583
|
-
return UtilsOs.isRunningInWindows
|
|
5584
|
-
? commandExistsWindowsSync(commandName)
|
|
5585
|
-
: commandExistsUnixSync(commandName);
|
|
5586
|
-
};
|
|
5587
|
-
//#endregion
|
|
5588
|
-
//#endregion
|
|
5589
|
-
//#region utils os / python module exists
|
|
5590
|
-
UtilsOs.pipxPackageExists = (packageName) => {
|
|
5591
5047
|
/* */
|
|
5592
5048
|
/* */
|
|
5593
5049
|
/* */
|
|
@@ -5595,9 +5051,6 @@ var UtilsOs;
|
|
|
5595
5051
|
/* */
|
|
5596
5052
|
/* */
|
|
5597
5053
|
/* */
|
|
5598
|
-
return (void 0);
|
|
5599
|
-
};
|
|
5600
|
-
UtilsOs.pipxNestedPackageExists = (mainPackageName, targetNestedFromMainPackage) => {
|
|
5601
5054
|
/* */
|
|
5602
5055
|
/* */
|
|
5603
5056
|
/* */
|
|
@@ -5611,14 +5064,6 @@ var UtilsOs;
|
|
|
5611
5064
|
/* */
|
|
5612
5065
|
/* */
|
|
5613
5066
|
/* */
|
|
5614
|
-
return (void 0);
|
|
5615
|
-
};
|
|
5616
|
-
const normalizeModuleName = (name) => {
|
|
5617
|
-
return name.replace(/-/g, '_');
|
|
5618
|
-
};
|
|
5619
|
-
UtilsOs.pythonModuleExists = async (moduleName,
|
|
5620
|
-
// pythonPath = process.platform === 'win32' ? 'python' : 'python3',
|
|
5621
|
-
pythonPath = 'python3') => {
|
|
5622
5067
|
/* */
|
|
5623
5068
|
/* */
|
|
5624
5069
|
/* */
|
|
@@ -5637,30 +5082,10 @@ var UtilsOs;
|
|
|
5637
5082
|
/* */
|
|
5638
5083
|
/* */
|
|
5639
5084
|
/* */
|
|
5640
|
-
return (void 0);
|
|
5641
|
-
};
|
|
5642
|
-
//#endregion
|
|
5643
|
-
//#region utils terminal / draw horizontal line
|
|
5644
|
-
UtilsOs.drawHorizontalLine = (row = 0) => {
|
|
5645
|
-
//#region @browser
|
|
5646
|
-
const widthBrowserConsole = row || 80;
|
|
5647
|
-
console.log('-'.repeat(widthBrowserConsole));
|
|
5648
|
-
//#endregion
|
|
5649
5085
|
/* */
|
|
5650
5086
|
/* */
|
|
5651
5087
|
/* */
|
|
5652
5088
|
/* */
|
|
5653
|
-
};
|
|
5654
|
-
//#endregion
|
|
5655
|
-
//#region utils terminal / draw vertical line
|
|
5656
|
-
UtilsOs.drawVerticalLine = (col = 0) => {
|
|
5657
|
-
//#region @browser
|
|
5658
|
-
const heightBrowserConsole = 20;
|
|
5659
|
-
const line = Array.from({ length: heightBrowserConsole })
|
|
5660
|
-
.map(() => '|')
|
|
5661
|
-
.join('\n');
|
|
5662
|
-
console.log(line);
|
|
5663
|
-
//#endregion
|
|
5664
5089
|
/* */
|
|
5665
5090
|
/* */
|
|
5666
5091
|
/* */
|
|
@@ -5670,10 +5095,6 @@ var UtilsOs;
|
|
|
5670
5095
|
/* */
|
|
5671
5096
|
/* */
|
|
5672
5097
|
/* */
|
|
5673
|
-
};
|
|
5674
|
-
//#endregion
|
|
5675
|
-
//#region utils os / get inotify watch count (linux)
|
|
5676
|
-
async function getInotifyWatchCount() {
|
|
5677
5098
|
/* */
|
|
5678
5099
|
/* */
|
|
5679
5100
|
/* */
|
|
@@ -5719,28 +5140,18 @@ var UtilsOs;
|
|
|
5719
5140
|
/* */
|
|
5720
5141
|
/* */
|
|
5721
5142
|
return (void 0);
|
|
5722
|
-
}
|
|
5723
|
-
UtilsOs.getInotifyWatchCount = getInotifyWatchCount;
|
|
5143
|
+
};
|
|
5724
5144
|
//#endregion
|
|
5725
|
-
//#region utils
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
${opt.subtitle ? opt.subtitle + '\n' : ''}${opt.body ?? ''}
|
|
5736
|
-
|
|
5737
|
-
`;
|
|
5738
|
-
//#endregion
|
|
5739
|
-
//#region @browser
|
|
5740
|
-
UtilsOs.drawVerticalLine();
|
|
5741
|
-
console.log(consoleNotification);
|
|
5742
|
-
UtilsOs.drawVerticalLine();
|
|
5743
|
-
//#endregion
|
|
5145
|
+
//#region utils files folders sync / move
|
|
5146
|
+
/**
|
|
5147
|
+
* @deprecated use .copy and then .remove on
|
|
5148
|
+
* source folder..
|
|
5149
|
+
*
|
|
5150
|
+
* This method is messing with parcel watcher
|
|
5151
|
+
* (moved files are not detected)
|
|
5152
|
+
*/
|
|
5153
|
+
UtilsFilesFoldersSync.move = (from, to, options) => {
|
|
5154
|
+
/* */
|
|
5744
5155
|
/* */
|
|
5745
5156
|
/* */
|
|
5746
5157
|
/* */
|
|
@@ -5813,16 +5224,54 @@ ${opt.subtitle ? opt.subtitle + '\n' : ''}${opt.body ?? ''}
|
|
|
5813
5224
|
/* */
|
|
5814
5225
|
/* */
|
|
5815
5226
|
/* */
|
|
5227
|
+
/* */
|
|
5228
|
+
return (void 0);
|
|
5229
|
+
};
|
|
5230
|
+
//#endregion
|
|
5231
|
+
})(UtilsFilesFoldersSync || (UtilsFilesFoldersSync = {}));
|
|
5232
|
+
/**
|
|
5233
|
+
* TODO @LAST @IN_PROGRESS
|
|
5234
|
+
* - utils for files and folders operations
|
|
5235
|
+
* - export when ready
|
|
5236
|
+
* - should be ready for everything async refactor
|
|
5237
|
+
*/
|
|
5238
|
+
var UtilsFilesFolders;
|
|
5239
|
+
(function (UtilsFilesFolders) {
|
|
5240
|
+
//#region utils files folders / ignore folder files patterns
|
|
5241
|
+
/**
|
|
5242
|
+
* Patterns that should be always ignored
|
|
5243
|
+
*/
|
|
5244
|
+
UtilsFilesFolders.IGNORE_FOLDERS_FILES_PATTERNS = UtilsFilesFoldersSync.IGNORE_FOLDERS_FILES_PATTERNS;
|
|
5245
|
+
//#endregion
|
|
5246
|
+
//#region utils files folders operations / remove file or folder or link
|
|
5247
|
+
/**
|
|
5248
|
+
* remove file or folder or link
|
|
5249
|
+
*/
|
|
5250
|
+
const remove = async (absolutePath, options) => {
|
|
5816
5251
|
/* */
|
|
5817
5252
|
/* */
|
|
5818
5253
|
/* */
|
|
5819
5254
|
/* */
|
|
5820
5255
|
/* */
|
|
5256
|
+
return (void 0);
|
|
5257
|
+
};
|
|
5258
|
+
//#endregion
|
|
5259
|
+
//#region utils files folders operations / remove file or folder or link
|
|
5260
|
+
/**
|
|
5261
|
+
* remove file or folder or link
|
|
5262
|
+
*/
|
|
5263
|
+
const removeByPattern = async (globPattern, options) => {
|
|
5821
5264
|
/* */
|
|
5822
5265
|
/* */
|
|
5823
5266
|
/* */
|
|
5824
5267
|
/* */
|
|
5825
5268
|
/* */
|
|
5269
|
+
return (void 0);
|
|
5270
|
+
};
|
|
5271
|
+
//#endregion
|
|
5272
|
+
//#region utils files folders operations / get files from
|
|
5273
|
+
async function getFilesFromAsync(folderOrLinkToFolder, options = {}) {
|
|
5274
|
+
return null;
|
|
5826
5275
|
/* */
|
|
5827
5276
|
/* */
|
|
5828
5277
|
/* */
|
|
@@ -5848,11 +5297,6 @@ ${opt.subtitle ? opt.subtitle + '\n' : ''}${opt.body ?? ''}
|
|
|
5848
5297
|
/* */
|
|
5849
5298
|
/* */
|
|
5850
5299
|
/* */
|
|
5851
|
-
};
|
|
5852
|
-
//#endregion
|
|
5853
|
-
//#region utils os / safe exit program clean up fn
|
|
5854
|
-
let isCleaning = false;
|
|
5855
|
-
function safeExitProgramCleanUp(cleanFn) {
|
|
5856
5300
|
/* */
|
|
5857
5301
|
/* */
|
|
5858
5302
|
/* */
|
|
@@ -5884,6 +5328,168 @@ ${opt.subtitle ? opt.subtitle + '\n' : ''}${opt.body ?? ''}
|
|
|
5884
5328
|
/* */
|
|
5885
5329
|
/* */
|
|
5886
5330
|
/* */
|
|
5331
|
+
return (void 0);
|
|
5332
|
+
}
|
|
5333
|
+
//#endregion
|
|
5334
|
+
//#region utils files folders operations / read file
|
|
5335
|
+
/**
|
|
5336
|
+
* TODO @IN_PROGRESS
|
|
5337
|
+
*/
|
|
5338
|
+
const readFileAsync = async (absoluteFilePath, options) => {
|
|
5339
|
+
return void 0;
|
|
5340
|
+
};
|
|
5341
|
+
/* */
|
|
5342
|
+
/* */
|
|
5343
|
+
/**
|
|
5344
|
+
* TODO @IN_PROGRESS
|
|
5345
|
+
*/
|
|
5346
|
+
const writeFileAsync = async (absoluteFilePath, input, options) => {
|
|
5347
|
+
return void 0;
|
|
5348
|
+
};
|
|
5349
|
+
//#endregion
|
|
5350
|
+
//#region utils files folders operations / is existed symlink
|
|
5351
|
+
/**
|
|
5352
|
+
* TODO @IN_PROGRESS
|
|
5353
|
+
*/
|
|
5354
|
+
const isExistedSymlink = async (absoluteFilePath) => {
|
|
5355
|
+
return void 0;
|
|
5356
|
+
};
|
|
5357
|
+
//#endregion
|
|
5358
|
+
//#region utils files folders operations / is un existed link
|
|
5359
|
+
/**
|
|
5360
|
+
* TODO @IN_PROGRESS
|
|
5361
|
+
*/
|
|
5362
|
+
const isUnExistedLink = async (absoluteFilePath) => {
|
|
5363
|
+
return void 0;
|
|
5364
|
+
};
|
|
5365
|
+
//#endregion
|
|
5366
|
+
})(UtilsFilesFolders || (UtilsFilesFolders = {}));
|
|
5367
|
+
|
|
5368
|
+
var UtilsJson;
|
|
5369
|
+
(function (UtilsJson) {
|
|
5370
|
+
//#region get attributes from jsonc or json5 file
|
|
5371
|
+
/**
|
|
5372
|
+
* ! TODO handle packages like zone.js with dot
|
|
5373
|
+
* Get attributes from jsonc or json5 file
|
|
5374
|
+
* @param jsonDeepPath lodash path to property in json ex. deep.path.to.prop
|
|
5375
|
+
* @param fileContent jsonc or json5 - json with comments
|
|
5376
|
+
* @returns array of attributes
|
|
5377
|
+
*/
|
|
5378
|
+
UtilsJson.getAtrributiesFromJsonWithComments = (jsonDeepPath, // lodash path to property in json ex. deep.path.to.prop
|
|
5379
|
+
fileContent) => {
|
|
5380
|
+
const lines = fileContent.split('\n');
|
|
5381
|
+
// split path to parts but keep part if is for example 'sql.js
|
|
5382
|
+
const pathParts = jsonDeepPath.split('.').reduce((a, b) => {
|
|
5383
|
+
if (a.length === 0) {
|
|
5384
|
+
return [b];
|
|
5385
|
+
}
|
|
5386
|
+
const last = a[a.length - 1];
|
|
5387
|
+
if ((last.startsWith(`['`) && b.endsWith(`']`)) ||
|
|
5388
|
+
(last.startsWith(`["`) && b.endsWith(`"]`))) {
|
|
5389
|
+
a[a.length - 1] = [last, b].join('.');
|
|
5390
|
+
}
|
|
5391
|
+
else {
|
|
5392
|
+
a.push(b);
|
|
5393
|
+
}
|
|
5394
|
+
return a;
|
|
5395
|
+
}, []);
|
|
5396
|
+
// console.log({ pathParts });
|
|
5397
|
+
// const pathParts = jsonDeepPath.split('.');
|
|
5398
|
+
// const keyName = pathParts.pop()!.replace(/^\["(.+)"\]$/, '$1');
|
|
5399
|
+
const keyName = pathParts.pop().replace(/^\["(.+)"\]$/, '$1');
|
|
5400
|
+
let currentPath = '';
|
|
5401
|
+
let attributes = [];
|
|
5402
|
+
let collectedComments = [];
|
|
5403
|
+
for (const line of lines) {
|
|
5404
|
+
const trimmedLine = line.trim();
|
|
5405
|
+
if (trimmedLine.startsWith('//')) {
|
|
5406
|
+
// Collect comments
|
|
5407
|
+
collectedComments.push(trimmedLine);
|
|
5408
|
+
// trimmedLine.startsWith('//pizda') &&
|
|
5409
|
+
// console.log('pushlin line', { trimmedLine });
|
|
5410
|
+
}
|
|
5411
|
+
else if (trimmedLine.startsWith('"') || trimmedLine.startsWith("'")) {
|
|
5412
|
+
// Extract the key from the line
|
|
5413
|
+
const match = trimmedLine.match(/["']([^"']+)["']\s*:/);
|
|
5414
|
+
// console.log({ match0: match && match[0], match1: match && match[1] });
|
|
5415
|
+
if (match) {
|
|
5416
|
+
const key = match[1];
|
|
5417
|
+
currentPath = currentPath
|
|
5418
|
+
? `${currentPath}.${key.includes('.') ? `['${key}']` : key}`
|
|
5419
|
+
: key;
|
|
5420
|
+
// console.log({ key });
|
|
5421
|
+
// Check if the current path matches the jsonDeepPath
|
|
5422
|
+
if ((currentPath.endsWith(keyName) &&
|
|
5423
|
+
!currentPath.endsWith('/' + keyName)) ||
|
|
5424
|
+
currentPath.endsWith(`['${keyName}']`)) {
|
|
5425
|
+
// console.log('extract attributes', {
|
|
5426
|
+
// keyName,
|
|
5427
|
+
// collectedCommentsLength: collectedComments.length,
|
|
5428
|
+
// });
|
|
5429
|
+
// Process the collected comments to extract attributes
|
|
5430
|
+
attributes = extractAttributesFromComments(collectedComments);
|
|
5431
|
+
break;
|
|
5432
|
+
}
|
|
5433
|
+
// Reset collected comments as they only relate to the next key
|
|
5434
|
+
collectedComments = [];
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
return attributes;
|
|
5439
|
+
};
|
|
5440
|
+
//#endregion
|
|
5441
|
+
//#region get attributes from comment
|
|
5442
|
+
UtilsJson.getAttributiesFromComment = (comment, attributes = []) => {
|
|
5443
|
+
// Match @name=value OR @name
|
|
5444
|
+
// Values can be "..." or '...' or unquoted token without @
|
|
5445
|
+
const attrRegex = /@(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s@]+)))?/g;
|
|
5446
|
+
let match;
|
|
5447
|
+
while ((match = attrRegex.exec(comment)) !== null) {
|
|
5448
|
+
const [, name, doubleQuoted, singleQuoted, unquoted] = match;
|
|
5449
|
+
const value = doubleQuoted ?? singleQuoted ?? unquoted;
|
|
5450
|
+
const existingAttribute = attributes.find(attr => attr.name === `@${name}`);
|
|
5451
|
+
if (existingAttribute) {
|
|
5452
|
+
if (value !== undefined) {
|
|
5453
|
+
if (Array.isArray(existingAttribute.value)) {
|
|
5454
|
+
existingAttribute.value.push(value);
|
|
5455
|
+
}
|
|
5456
|
+
else {
|
|
5457
|
+
existingAttribute.value = [existingAttribute.value, value];
|
|
5458
|
+
}
|
|
5459
|
+
}
|
|
5460
|
+
}
|
|
5461
|
+
else {
|
|
5462
|
+
attributes.push({
|
|
5463
|
+
name: `@${name}`,
|
|
5464
|
+
value: value !== undefined ? value : true,
|
|
5465
|
+
});
|
|
5466
|
+
}
|
|
5467
|
+
}
|
|
5468
|
+
// Normalize single values not to be arrays
|
|
5469
|
+
attributes.forEach(attr => {
|
|
5470
|
+
if (Array.isArray(attr.value) && attr.value.length === 1) {
|
|
5471
|
+
attr.value = attr.value[0];
|
|
5472
|
+
}
|
|
5473
|
+
});
|
|
5474
|
+
return attributes;
|
|
5475
|
+
};
|
|
5476
|
+
//#endregion
|
|
5477
|
+
//#region extract attributes from comments
|
|
5478
|
+
const extractAttributesFromComments = (comments) => {
|
|
5479
|
+
const attributes = [];
|
|
5480
|
+
// console.log({ comments });
|
|
5481
|
+
for (const comment of comments) {
|
|
5482
|
+
UtilsJson.getAttributiesFromComment(comment, attributes);
|
|
5483
|
+
}
|
|
5484
|
+
return attributes;
|
|
5485
|
+
};
|
|
5486
|
+
//#endregion
|
|
5487
|
+
//#region read json
|
|
5488
|
+
/**
|
|
5489
|
+
* read json from absolute path
|
|
5490
|
+
* @returns json object
|
|
5491
|
+
*/
|
|
5492
|
+
UtilsJson.readJson = (absoluteFilePath, defaultValue = {}, useJson5 = false) => {
|
|
5887
5493
|
/* */
|
|
5888
5494
|
/* */
|
|
5889
5495
|
/* */
|
|
@@ -5903,14 +5509,57 @@ ${opt.subtitle ? opt.subtitle + '\n' : ''}${opt.body ?? ''}
|
|
|
5903
5509
|
/* */
|
|
5904
5510
|
/* */
|
|
5905
5511
|
/* */
|
|
5512
|
+
return (void 0);
|
|
5513
|
+
};
|
|
5514
|
+
//#endregion
|
|
5515
|
+
//#region read json with comments
|
|
5516
|
+
UtilsJson.readJsonWithComments = (absoluteFilePath, defaultValue = {}) => {
|
|
5906
5517
|
/* */
|
|
5907
5518
|
/* */
|
|
5908
5519
|
return (void 0);
|
|
5909
|
-
}
|
|
5910
|
-
UtilsOs.safeExitProgramCleanUp = safeExitProgramCleanUp;
|
|
5520
|
+
};
|
|
5911
5521
|
//#endregion
|
|
5912
|
-
//#region
|
|
5913
|
-
|
|
5522
|
+
//#region lodash path validation
|
|
5523
|
+
UtilsJson.validateLodashPath = (lodashGetPath) => {
|
|
5524
|
+
if (_.isArray(lodashGetPath)) {
|
|
5525
|
+
lodashGetPath = lodashGetPath.join('.');
|
|
5526
|
+
}
|
|
5527
|
+
if (!_.isString(lodashGetPath)) {
|
|
5528
|
+
throw new Error(`Invalid lodash path: path cannot be empty.`);
|
|
5529
|
+
}
|
|
5530
|
+
const path = lodashGetPath.trim();
|
|
5531
|
+
/**
|
|
5532
|
+
* Allowed:
|
|
5533
|
+
* foo
|
|
5534
|
+
* foo.bar
|
|
5535
|
+
* foo.bar.baz
|
|
5536
|
+
* foo[0].bar
|
|
5537
|
+
* foo.bar[123].baz
|
|
5538
|
+
*
|
|
5539
|
+
* Rejected:
|
|
5540
|
+
* foo..bar
|
|
5541
|
+
* .foo
|
|
5542
|
+
* foo.
|
|
5543
|
+
* foo[]
|
|
5544
|
+
* foo[abc]
|
|
5545
|
+
* foo[asd].bar
|
|
5546
|
+
*/
|
|
5547
|
+
const validPathRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*(?:\[\d+\])*(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*(?:\[\d+\])*)*$/;
|
|
5548
|
+
if (!validPathRegex.test(path)) {
|
|
5549
|
+
throw new Error(`Invalid lodash path: "${path}"`);
|
|
5550
|
+
}
|
|
5551
|
+
const forbiddenKeys = ['__proto__', 'prototype', 'constructor'];
|
|
5552
|
+
const parts = path.replace(/\[(\d+)\]/g, '.$1').split('.');
|
|
5553
|
+
const forbiddenKey = parts.find(part => forbiddenKeys.includes(part));
|
|
5554
|
+
if (forbiddenKey) {
|
|
5555
|
+
throw new Error(`Invalid lodash path: forbidden key "${forbiddenKey}" in "${path}"`);
|
|
5556
|
+
}
|
|
5557
|
+
return path;
|
|
5558
|
+
};
|
|
5559
|
+
//#endregion
|
|
5560
|
+
//#region get value
|
|
5561
|
+
UtilsJson.getValue = (filepath, lodashGetPath, options) => {
|
|
5562
|
+
/* */
|
|
5914
5563
|
/* */
|
|
5915
5564
|
/* */
|
|
5916
5565
|
/* */
|
|
@@ -5929,6 +5578,11 @@ ${opt.subtitle ? opt.subtitle + '\n' : ''}${opt.body ?? ''}
|
|
|
5929
5578
|
/* */
|
|
5930
5579
|
/* */
|
|
5931
5580
|
/* */
|
|
5581
|
+
return (void 0);
|
|
5582
|
+
};
|
|
5583
|
+
//#endregion
|
|
5584
|
+
//#region set value
|
|
5585
|
+
UtilsJson.setValue = (filepath, lodashGetPath, value, options) => {
|
|
5932
5586
|
/* */
|
|
5933
5587
|
/* */
|
|
5934
5588
|
/* */
|
|
@@ -5954,20 +5608,389 @@ ${opt.subtitle ? opt.subtitle + '\n' : ''}${opt.body ?? ''}
|
|
|
5954
5608
|
return (void 0);
|
|
5955
5609
|
};
|
|
5956
5610
|
//#endregion
|
|
5957
|
-
})(
|
|
5611
|
+
})(UtilsJson || (UtilsJson = {}));
|
|
5612
|
+
|
|
5613
|
+
//#region utils process / start async
|
|
5958
5614
|
//#endregion
|
|
5959
|
-
|
|
5615
|
+
/**
|
|
5616
|
+
* TODO IMPLEMENT
|
|
5617
|
+
* start async node process
|
|
5618
|
+
*/
|
|
5619
|
+
const startAsync = async (command, cwd, options) => {
|
|
5620
|
+
/* */
|
|
5621
|
+
/* */
|
|
5622
|
+
/* */
|
|
5623
|
+
/* */
|
|
5624
|
+
/* */
|
|
5625
|
+
/* */
|
|
5626
|
+
/* */
|
|
5627
|
+
/* */
|
|
5628
|
+
/* */
|
|
5629
|
+
/* */
|
|
5630
|
+
/* */
|
|
5631
|
+
/* */
|
|
5632
|
+
/* */
|
|
5633
|
+
/* */
|
|
5634
|
+
/* */
|
|
5635
|
+
/* */
|
|
5636
|
+
/* */
|
|
5637
|
+
/* */
|
|
5638
|
+
/* */
|
|
5639
|
+
/* */
|
|
5640
|
+
/* */
|
|
5641
|
+
/* */
|
|
5642
|
+
/* */
|
|
5643
|
+
/* */
|
|
5644
|
+
/* */
|
|
5645
|
+
/* */
|
|
5646
|
+
/* */
|
|
5647
|
+
/* */
|
|
5648
|
+
/* */
|
|
5649
|
+
/* */
|
|
5650
|
+
/* */
|
|
5651
|
+
/* */
|
|
5652
|
+
/* */
|
|
5653
|
+
/* */
|
|
5654
|
+
/* */
|
|
5655
|
+
/* */
|
|
5656
|
+
/* */
|
|
5657
|
+
/* */
|
|
5658
|
+
/* */
|
|
5659
|
+
/* */
|
|
5660
|
+
/* */
|
|
5661
|
+
/* */
|
|
5662
|
+
/* */
|
|
5663
|
+
/* */
|
|
5664
|
+
/* */
|
|
5665
|
+
/* */
|
|
5666
|
+
/* */
|
|
5667
|
+
/* */
|
|
5668
|
+
/* */
|
|
5669
|
+
/* */
|
|
5670
|
+
/* */
|
|
5671
|
+
/* */
|
|
5672
|
+
/* */
|
|
5673
|
+
/* */
|
|
5674
|
+
/* */
|
|
5675
|
+
/* */
|
|
5676
|
+
/* */
|
|
5677
|
+
/* */
|
|
5678
|
+
/* */
|
|
5679
|
+
/* */
|
|
5680
|
+
/* */
|
|
5681
|
+
/* */
|
|
5682
|
+
/* */
|
|
5683
|
+
/* */
|
|
5684
|
+
/* */
|
|
5685
|
+
/* */
|
|
5686
|
+
/* */
|
|
5687
|
+
/* */
|
|
5688
|
+
/* */
|
|
5689
|
+
/* */
|
|
5690
|
+
/* */
|
|
5691
|
+
/* */
|
|
5692
|
+
/* */
|
|
5693
|
+
/* */
|
|
5694
|
+
/* */
|
|
5695
|
+
/* */
|
|
5696
|
+
/* */
|
|
5697
|
+
/* */
|
|
5698
|
+
/* */
|
|
5699
|
+
/* */
|
|
5700
|
+
/* */
|
|
5701
|
+
/* */
|
|
5702
|
+
/* */
|
|
5703
|
+
/* */
|
|
5704
|
+
/* */
|
|
5705
|
+
/* */
|
|
5706
|
+
/* */
|
|
5707
|
+
/* */
|
|
5708
|
+
/* */
|
|
5709
|
+
/* */
|
|
5710
|
+
/* */
|
|
5711
|
+
/* */
|
|
5712
|
+
/* */
|
|
5713
|
+
/* */
|
|
5714
|
+
/* */
|
|
5715
|
+
/* */
|
|
5716
|
+
/* */
|
|
5717
|
+
/* */
|
|
5718
|
+
/* */
|
|
5719
|
+
/* */
|
|
5720
|
+
/* */
|
|
5721
|
+
/* */
|
|
5722
|
+
/* */
|
|
5723
|
+
/* */
|
|
5724
|
+
/* */
|
|
5725
|
+
/* */
|
|
5726
|
+
/* */
|
|
5727
|
+
/* */
|
|
5728
|
+
/* */
|
|
5729
|
+
/* */
|
|
5730
|
+
/* */
|
|
5731
|
+
/* */
|
|
5732
|
+
/* */
|
|
5733
|
+
/* */
|
|
5734
|
+
/* */
|
|
5735
|
+
/* */
|
|
5736
|
+
/* */
|
|
5737
|
+
/* */
|
|
5738
|
+
/* */
|
|
5739
|
+
/* */
|
|
5740
|
+
/* */
|
|
5741
|
+
/* */
|
|
5742
|
+
/* */
|
|
5743
|
+
/* */
|
|
5744
|
+
/* */
|
|
5745
|
+
/* */
|
|
5746
|
+
/* */
|
|
5747
|
+
/* */
|
|
5748
|
+
/* */
|
|
5749
|
+
/* */
|
|
5750
|
+
/* */
|
|
5751
|
+
/* */
|
|
5752
|
+
/* */
|
|
5753
|
+
/* */
|
|
5754
|
+
/* */
|
|
5755
|
+
/* */
|
|
5756
|
+
/* */
|
|
5757
|
+
/* */
|
|
5758
|
+
/* */
|
|
5759
|
+
/* */
|
|
5760
|
+
/* */
|
|
5761
|
+
/* */
|
|
5762
|
+
/* */
|
|
5763
|
+
/* */
|
|
5764
|
+
/* */
|
|
5765
|
+
/* */
|
|
5766
|
+
/* */
|
|
5767
|
+
/* */
|
|
5768
|
+
/* */
|
|
5769
|
+
/* */
|
|
5770
|
+
/* */
|
|
5771
|
+
/* */
|
|
5772
|
+
/* */
|
|
5773
|
+
/* */
|
|
5774
|
+
/* */
|
|
5775
|
+
/* */
|
|
5776
|
+
/* */
|
|
5777
|
+
/* */
|
|
5778
|
+
/* */
|
|
5779
|
+
/* */
|
|
5780
|
+
/* */
|
|
5781
|
+
/* */
|
|
5782
|
+
/* */
|
|
5783
|
+
/* */
|
|
5784
|
+
/* */
|
|
5785
|
+
/* */
|
|
5786
|
+
/* */
|
|
5787
|
+
/* */
|
|
5788
|
+
/* */
|
|
5789
|
+
/* */
|
|
5790
|
+
/* */
|
|
5791
|
+
/* */
|
|
5792
|
+
/* */
|
|
5793
|
+
/* */
|
|
5794
|
+
/* */
|
|
5795
|
+
/* */
|
|
5796
|
+
/* */
|
|
5797
|
+
/* */
|
|
5798
|
+
/* */
|
|
5799
|
+
/* */
|
|
5800
|
+
/* */
|
|
5801
|
+
/* */
|
|
5802
|
+
/* */
|
|
5803
|
+
/* */
|
|
5804
|
+
/* */
|
|
5805
|
+
/* */
|
|
5806
|
+
/* */
|
|
5807
|
+
/* */
|
|
5808
|
+
/* */
|
|
5809
|
+
/* */
|
|
5810
|
+
/* */
|
|
5811
|
+
/* */
|
|
5812
|
+
/* */
|
|
5813
|
+
/* */
|
|
5814
|
+
/* */
|
|
5815
|
+
/* */
|
|
5816
|
+
/* */
|
|
5817
|
+
/* */
|
|
5818
|
+
/* */
|
|
5819
|
+
/* */
|
|
5820
|
+
/* */
|
|
5821
|
+
/* */
|
|
5822
|
+
/* */
|
|
5823
|
+
/* */
|
|
5824
|
+
/* */
|
|
5825
|
+
/* */
|
|
5826
|
+
/* */
|
|
5827
|
+
/* */
|
|
5828
|
+
/* */
|
|
5829
|
+
/* */
|
|
5830
|
+
/* */
|
|
5831
|
+
/* */
|
|
5832
|
+
/* */
|
|
5833
|
+
/* */
|
|
5834
|
+
/* */
|
|
5835
|
+
/* */
|
|
5836
|
+
/* */
|
|
5837
|
+
/* */
|
|
5838
|
+
/* */
|
|
5839
|
+
/* */
|
|
5840
|
+
/* */
|
|
5841
|
+
/* */
|
|
5842
|
+
/* */
|
|
5843
|
+
/* */
|
|
5844
|
+
/* */
|
|
5845
|
+
/* */
|
|
5846
|
+
/* */
|
|
5847
|
+
/* */
|
|
5848
|
+
/* */
|
|
5849
|
+
/* */
|
|
5850
|
+
/* */
|
|
5851
|
+
/* */
|
|
5852
|
+
/* */
|
|
5853
|
+
/* */
|
|
5854
|
+
/* */
|
|
5855
|
+
/* */
|
|
5856
|
+
/* */
|
|
5857
|
+
/* */
|
|
5858
|
+
/* */
|
|
5859
|
+
/* */
|
|
5860
|
+
/* */
|
|
5861
|
+
/* */
|
|
5862
|
+
/* */
|
|
5863
|
+
/* */
|
|
5864
|
+
/* */
|
|
5865
|
+
/* */
|
|
5866
|
+
/* */
|
|
5867
|
+
/* */
|
|
5868
|
+
/* */
|
|
5869
|
+
/* */
|
|
5870
|
+
/* */
|
|
5871
|
+
/* */
|
|
5872
|
+
/* */
|
|
5873
|
+
/* */
|
|
5874
|
+
/* */
|
|
5875
|
+
/* */
|
|
5876
|
+
/* */
|
|
5877
|
+
/* */
|
|
5878
|
+
/* */
|
|
5879
|
+
/* */
|
|
5880
|
+
/* */
|
|
5881
|
+
/* */
|
|
5882
|
+
/* */
|
|
5883
|
+
/* */
|
|
5884
|
+
/* */
|
|
5885
|
+
/* */
|
|
5886
|
+
/* */
|
|
5887
|
+
/* */
|
|
5888
|
+
/* */
|
|
5889
|
+
/* */
|
|
5890
|
+
/* */
|
|
5891
|
+
/* */
|
|
5892
|
+
/* */
|
|
5893
|
+
/* */
|
|
5894
|
+
/* */
|
|
5895
|
+
/* */
|
|
5896
|
+
/* */
|
|
5897
|
+
/* */
|
|
5898
|
+
/* */
|
|
5899
|
+
/* */
|
|
5900
|
+
/* */
|
|
5901
|
+
/* */
|
|
5902
|
+
/* */
|
|
5903
|
+
/* */
|
|
5904
|
+
/* */
|
|
5905
|
+
/* */
|
|
5906
|
+
/* */
|
|
5907
|
+
/* */
|
|
5908
|
+
/* */
|
|
5909
|
+
/* */
|
|
5910
|
+
/* */
|
|
5911
|
+
/* */
|
|
5912
|
+
/* */
|
|
5913
|
+
/* */
|
|
5914
|
+
/* */
|
|
5915
|
+
/* */
|
|
5916
|
+
/* */
|
|
5917
|
+
/* */
|
|
5918
|
+
/* */
|
|
5919
|
+
/* */
|
|
5920
|
+
/* */
|
|
5921
|
+
/* */
|
|
5922
|
+
/* */
|
|
5923
|
+
/* */
|
|
5924
|
+
/* */
|
|
5925
|
+
/* */
|
|
5926
|
+
/* */
|
|
5927
|
+
/* */
|
|
5928
|
+
/* */
|
|
5929
|
+
/* */
|
|
5930
|
+
/* */
|
|
5931
|
+
/* */
|
|
5932
|
+
/* */
|
|
5933
|
+
/* */
|
|
5934
|
+
/* */
|
|
5935
|
+
/* */
|
|
5936
|
+
/* */
|
|
5937
|
+
/* */
|
|
5938
|
+
/* */
|
|
5939
|
+
/* */
|
|
5940
|
+
/* */
|
|
5941
|
+
/* */
|
|
5942
|
+
/* */
|
|
5943
|
+
/* */
|
|
5944
|
+
/* */
|
|
5945
|
+
/* */
|
|
5946
|
+
/* */
|
|
5947
|
+
/* */
|
|
5948
|
+
/* */
|
|
5949
|
+
/* */
|
|
5950
|
+
/* */
|
|
5951
|
+
/* */
|
|
5952
|
+
/* */
|
|
5953
|
+
/* */
|
|
5954
|
+
/* */
|
|
5955
|
+
/* */
|
|
5956
|
+
/* */
|
|
5957
|
+
/* */
|
|
5958
|
+
/* */
|
|
5959
|
+
/* */
|
|
5960
|
+
/* */
|
|
5961
|
+
/* */
|
|
5962
|
+
/* */
|
|
5963
|
+
/* */
|
|
5964
|
+
/* */
|
|
5965
|
+
/* */
|
|
5966
|
+
/* */
|
|
5967
|
+
/* */
|
|
5968
|
+
/* */
|
|
5969
|
+
/* */
|
|
5970
|
+
/* */
|
|
5971
|
+
/* */
|
|
5972
|
+
/* */
|
|
5973
|
+
/* */
|
|
5974
|
+
/* */
|
|
5975
|
+
/* */
|
|
5976
|
+
/* */
|
|
5977
|
+
/* */
|
|
5978
|
+
/* */
|
|
5979
|
+
/* */
|
|
5980
|
+
/* */
|
|
5981
|
+
/* */
|
|
5982
|
+
/* */
|
|
5983
|
+
/* */
|
|
5984
|
+
/* */
|
|
5985
|
+
/* */
|
|
5986
|
+
/* */
|
|
5987
|
+
/* */
|
|
5960
5988
|
/* */
|
|
5961
5989
|
/* */
|
|
5962
5990
|
/* */
|
|
5963
5991
|
/* */
|
|
5964
5992
|
/* */
|
|
5965
5993
|
/* */
|
|
5966
|
-
return (void 0);
|
|
5967
|
-
return '';
|
|
5968
|
-
};
|
|
5969
|
-
//#endregion
|
|
5970
|
-
const taonBasePathToGlobalDockerTemplatesFn = () => {
|
|
5971
5994
|
/* */
|
|
5972
5995
|
/* */
|
|
5973
5996
|
/* */
|
|
@@ -5975,8 +5998,8 @@ const taonBasePathToGlobalDockerTemplatesFn = () => {
|
|
|
5975
5998
|
/* */
|
|
5976
5999
|
/* */
|
|
5977
6000
|
return (void 0);
|
|
5978
|
-
return '';
|
|
5979
6001
|
};
|
|
6002
|
+
//#endregion
|
|
5980
6003
|
|
|
5981
6004
|
//#region imports
|
|
5982
6005
|
//#endregion
|
|
@@ -7105,7 +7128,7 @@ var UtilsTerminal;
|
|
|
7105
7128
|
UtilsTerminal.fetchAndDisplay = fetchAndDisplay;
|
|
7106
7129
|
})(UtilsTerminal || (UtilsTerminal = {}));
|
|
7107
7130
|
|
|
7108
|
-
|
|
7131
|
+
//#region imports
|
|
7109
7132
|
const WEBSQL_PROC_MOCK_PROCESSES_PID = {};
|
|
7110
7133
|
const WEBSQL_PROC_MOCK_PROCESSES_PPID = {};
|
|
7111
7134
|
const KEY = {
|
|
@@ -13544,7 +13567,10 @@ class TaonStateMachine {
|
|
|
13544
13567
|
constructor(config) {
|
|
13545
13568
|
this.config = config;
|
|
13546
13569
|
this._currentValue = config.defaultValue;
|
|
13547
|
-
this.currentStateSubject = new BehaviorSubject(
|
|
13570
|
+
this.currentStateSubject = new BehaviorSubject({
|
|
13571
|
+
previousState: config.defaultValue,
|
|
13572
|
+
currentState: config.defaultValue,
|
|
13573
|
+
});
|
|
13548
13574
|
this.currentState$ = this.currentStateSubject.asObservable();
|
|
13549
13575
|
}
|
|
13550
13576
|
get debugMode() {
|
|
@@ -13578,12 +13604,282 @@ class TaonStateMachine {
|
|
|
13578
13604
|
}
|
|
13579
13605
|
this._currentValue = nextState;
|
|
13580
13606
|
// Notify observers only after successful transition.
|
|
13581
|
-
this.currentStateSubject.next(nextState);
|
|
13607
|
+
this.currentStateSubject.next({ previousState, currentState: nextState });
|
|
13582
13608
|
void this.config.effect?.(nextState, previousState, this.debugMode);
|
|
13583
13609
|
return true;
|
|
13584
13610
|
}
|
|
13585
13611
|
}
|
|
13586
13612
|
|
|
13613
|
+
var UtilsEnv;
|
|
13614
|
+
(function (UtilsEnv) {
|
|
13615
|
+
let EnvironmentName;
|
|
13616
|
+
(function (EnvironmentName) {
|
|
13617
|
+
/**
|
|
13618
|
+
* Default environment, typically for artifact without application
|
|
13619
|
+
* or for storing common data
|
|
13620
|
+
*/
|
|
13621
|
+
EnvironmentName["__"] = "__";
|
|
13622
|
+
/**
|
|
13623
|
+
* Local development environment, typically the developer's machine.
|
|
13624
|
+
*/
|
|
13625
|
+
EnvironmentName["LOCALHOST"] = "localhost";
|
|
13626
|
+
/**
|
|
13627
|
+
* Development environment used by engineers to deploy and test new features.
|
|
13628
|
+
*/
|
|
13629
|
+
EnvironmentName["DEV"] = "dev";
|
|
13630
|
+
/**
|
|
13631
|
+
* Staging environment used for final validations before production.
|
|
13632
|
+
*/
|
|
13633
|
+
EnvironmentName["STAGE"] = "stage";
|
|
13634
|
+
/**
|
|
13635
|
+
* Production environment serving live users.
|
|
13636
|
+
*/
|
|
13637
|
+
EnvironmentName["PROD"] = "prod";
|
|
13638
|
+
/**
|
|
13639
|
+
* Cloudflare full backend/frontend deployment
|
|
13640
|
+
*/
|
|
13641
|
+
EnvironmentName["CLOUDFLARE"] = "cloudflare";
|
|
13642
|
+
/**
|
|
13643
|
+
* Taon cloud full backend/frontend deployment
|
|
13644
|
+
*/
|
|
13645
|
+
EnvironmentName["CLOUD"] = "cloud";
|
|
13646
|
+
/**
|
|
13647
|
+
* Automated test environment for running unit, integration, or automated tests.
|
|
13648
|
+
*/
|
|
13649
|
+
EnvironmentName["TEST"] = "test";
|
|
13650
|
+
/**
|
|
13651
|
+
* Quality assurance environment designated for manual and exploratory testing.
|
|
13652
|
+
*/
|
|
13653
|
+
EnvironmentName["QA"] = "qa";
|
|
13654
|
+
/**
|
|
13655
|
+
* Sandbox environment for experimenting and integration without affecting other environments.
|
|
13656
|
+
*/
|
|
13657
|
+
EnvironmentName["SANDBOX"] = "sandbox";
|
|
13658
|
+
/**
|
|
13659
|
+
* User Acceptance Testing environment where clients or stakeholders validate the release candidate.
|
|
13660
|
+
*/
|
|
13661
|
+
EnvironmentName["UAT"] = "uat";
|
|
13662
|
+
/**
|
|
13663
|
+
* Pre-production environment, closely mirroring production for final testing and validation.
|
|
13664
|
+
*/
|
|
13665
|
+
EnvironmentName["PREPROD"] = "preprod";
|
|
13666
|
+
/**
|
|
13667
|
+
* Demonstration environment specifically configured for client presentations and demos.
|
|
13668
|
+
*/
|
|
13669
|
+
EnvironmentName["DEMO"] = "demo";
|
|
13670
|
+
/**
|
|
13671
|
+
* Documentation environment for hosting and managing project documentation.
|
|
13672
|
+
*/
|
|
13673
|
+
EnvironmentName["DOCS"] = "docs";
|
|
13674
|
+
/**
|
|
13675
|
+
* Demonstration environment ONLY html files, typically used for static pages or documentation.
|
|
13676
|
+
* This environment is not intended for dynamic content or server-side processing.
|
|
13677
|
+
* Perfect to github pages or similar.
|
|
13678
|
+
* It is not intended for production use and should not be used for any critical applications or services.
|
|
13679
|
+
*/
|
|
13680
|
+
EnvironmentName["STATIC_PAGES"] = "static-pages";
|
|
13681
|
+
/**
|
|
13682
|
+
* Continuous Integration environment used by CI/CD pipelines for automated builds and deployments.
|
|
13683
|
+
*/
|
|
13684
|
+
EnvironmentName["CI"] = "ci";
|
|
13685
|
+
/**
|
|
13686
|
+
* Training environment dedicated to internal team onboarding and training activities.
|
|
13687
|
+
*/
|
|
13688
|
+
EnvironmentName["TRAINING"] = "training";
|
|
13689
|
+
/**
|
|
13690
|
+
* Staging environment used for final validations before production.
|
|
13691
|
+
*/
|
|
13692
|
+
EnvironmentName["STAGING"] = "staging";
|
|
13693
|
+
})(EnvironmentName = UtilsEnv.EnvironmentName || (UtilsEnv.EnvironmentName = {}));
|
|
13694
|
+
UtilsEnv.EnvironmentNameArr = Object.values(EnvironmentName);
|
|
13695
|
+
function getTsFileName({ artifactName, envName, envNumber, }) {
|
|
13696
|
+
return `env.${artifactName}.${envName}${envNumber ?? ''}.ts`;
|
|
13697
|
+
}
|
|
13698
|
+
UtilsEnv.getTsFileName = getTsFileName;
|
|
13699
|
+
/**
|
|
13700
|
+
* @returns envName, envNumber from string that is container
|
|
13701
|
+
* environment. Examples:
|
|
13702
|
+
* - env.angular-node-app.dev.ts > envName: 'dev' , envNumber: undefined
|
|
13703
|
+
* - env.angular-node-app.dev0.ts > envName: 'dev' , envNumber: 0
|
|
13704
|
+
* - env.angular-node-app.dev3.ts > envName: 'dev' , envNumber: 3
|
|
13705
|
+
* - env.prod.ts > envName: 'prod' , envNumber: undefined
|
|
13706
|
+
* - env.prod2.tsx > envName: 'prod' , envNumber: 2
|
|
13707
|
+
* - prod4 > envName: 'prod' , envNumber: 4
|
|
13708
|
+
*/
|
|
13709
|
+
function splitEnv(value) {
|
|
13710
|
+
if (!value) {
|
|
13711
|
+
return {
|
|
13712
|
+
envName: value,
|
|
13713
|
+
envNumber: undefined,
|
|
13714
|
+
};
|
|
13715
|
+
}
|
|
13716
|
+
value = value.replace(/\.tsx?$/, '');
|
|
13717
|
+
if (value.startsWith('env.')) {
|
|
13718
|
+
value = value.split('.').pop();
|
|
13719
|
+
}
|
|
13720
|
+
const match = value.match(/^(.+?)(\d+)?$/);
|
|
13721
|
+
if (!match) {
|
|
13722
|
+
return {
|
|
13723
|
+
envName: value,
|
|
13724
|
+
envNumber: undefined,
|
|
13725
|
+
};
|
|
13726
|
+
}
|
|
13727
|
+
return {
|
|
13728
|
+
envName: match[1],
|
|
13729
|
+
envNumber: match[2] !== undefined ? Number(match[2]) : undefined,
|
|
13730
|
+
};
|
|
13731
|
+
}
|
|
13732
|
+
UtilsEnv.splitEnv = splitEnv;
|
|
13733
|
+
//#endregion
|
|
13734
|
+
})(UtilsEnv || (UtilsEnv = {}));
|
|
13735
|
+
|
|
13736
|
+
var UtilsJwt;
|
|
13737
|
+
(function (UtilsJwt) {
|
|
13738
|
+
const encoder = new TextEncoder();
|
|
13739
|
+
const decoder = new TextDecoder();
|
|
13740
|
+
//#region base64 url encode
|
|
13741
|
+
function base64UrlEncode(input) {
|
|
13742
|
+
const bytes = typeof input === 'string' ? encoder.encode(input) : input;
|
|
13743
|
+
let binary = '';
|
|
13744
|
+
for (const byte of bytes) {
|
|
13745
|
+
binary += String.fromCharCode(byte);
|
|
13746
|
+
}
|
|
13747
|
+
return btoa(binary)
|
|
13748
|
+
.replace(/\+/g, '-')
|
|
13749
|
+
.replace(/\//g, '_')
|
|
13750
|
+
.replace(/=+$/g, '');
|
|
13751
|
+
}
|
|
13752
|
+
//#endregion
|
|
13753
|
+
//#region base64 url decode
|
|
13754
|
+
function base64UrlDecode(input) {
|
|
13755
|
+
const base64 = input.replace(/-/g, '+').replace(/_/g, '/');
|
|
13756
|
+
const padded = base64 + '='.repeat((4 - (base64.length % 4)) % 4);
|
|
13757
|
+
const binary = atob(padded);
|
|
13758
|
+
const bytes = new Uint8Array(binary.length);
|
|
13759
|
+
for (let i = 0; i < binary.length; i++) {
|
|
13760
|
+
bytes[i] = binary.charCodeAt(i);
|
|
13761
|
+
}
|
|
13762
|
+
return bytes;
|
|
13763
|
+
}
|
|
13764
|
+
//#endregion
|
|
13765
|
+
//#region parse expires in
|
|
13766
|
+
function parseExpiresIn(expiresIn) {
|
|
13767
|
+
if (typeof expiresIn === 'number') {
|
|
13768
|
+
return expiresIn;
|
|
13769
|
+
}
|
|
13770
|
+
const match = expiresIn.match(/^(\d+)(s|m|h|d)$/);
|
|
13771
|
+
if (!match) {
|
|
13772
|
+
throw new Error(`Invalid expiresIn: ${expiresIn}`);
|
|
13773
|
+
}
|
|
13774
|
+
const value = Number(match[1]);
|
|
13775
|
+
switch (match[2]) {
|
|
13776
|
+
case 's':
|
|
13777
|
+
return value;
|
|
13778
|
+
case 'm':
|
|
13779
|
+
return value * 60;
|
|
13780
|
+
case 'h':
|
|
13781
|
+
return value * 60 * 60;
|
|
13782
|
+
case 'd':
|
|
13783
|
+
return value * 60 * 60 * 24;
|
|
13784
|
+
default:
|
|
13785
|
+
throw new Error(`Invalid expiresIn: ${expiresIn}`);
|
|
13786
|
+
}
|
|
13787
|
+
}
|
|
13788
|
+
//#endregion
|
|
13789
|
+
//#region create hmac key
|
|
13790
|
+
async function createHmacKey(secret, usage) {
|
|
13791
|
+
return crypto.subtle.importKey('raw', encoder.encode(secret), {
|
|
13792
|
+
name: 'HMAC',
|
|
13793
|
+
hash: 'SHA-256',
|
|
13794
|
+
}, false, [usage]);
|
|
13795
|
+
}
|
|
13796
|
+
//#endregion
|
|
13797
|
+
//#region sign
|
|
13798
|
+
async function sign(payload, secret, options) {
|
|
13799
|
+
const now = Math.floor(Date.now() / 1000);
|
|
13800
|
+
const header = {
|
|
13801
|
+
alg: 'HS256',
|
|
13802
|
+
typ: 'JWT',
|
|
13803
|
+
};
|
|
13804
|
+
const finalPayload = {
|
|
13805
|
+
...payload,
|
|
13806
|
+
iat: now,
|
|
13807
|
+
exp: now + parseExpiresIn(options.expiresIn),
|
|
13808
|
+
};
|
|
13809
|
+
const encodedHeader = base64UrlEncode(JSON.stringify(header));
|
|
13810
|
+
const encodedPayload = base64UrlEncode(JSON.stringify(finalPayload));
|
|
13811
|
+
const unsignedToken = `${encodedHeader}.${encodedPayload}`;
|
|
13812
|
+
const key = await createHmacKey(secret, 'sign');
|
|
13813
|
+
const signature = await crypto.subtle.sign('HMAC', key, encoder.encode(unsignedToken));
|
|
13814
|
+
return `${unsignedToken}.` + base64UrlEncode(new Uint8Array(signature));
|
|
13815
|
+
}
|
|
13816
|
+
UtilsJwt.sign = sign;
|
|
13817
|
+
//#endregion
|
|
13818
|
+
//#region decode
|
|
13819
|
+
function decode(token) {
|
|
13820
|
+
const parts = token.split('.');
|
|
13821
|
+
if (parts.length !== 3) {
|
|
13822
|
+
throw new Error('Invalid JWT');
|
|
13823
|
+
}
|
|
13824
|
+
try {
|
|
13825
|
+
const payloadBytes = base64UrlDecode(parts[1]);
|
|
13826
|
+
return JSON.parse(decoder.decode(payloadBytes));
|
|
13827
|
+
}
|
|
13828
|
+
catch {
|
|
13829
|
+
throw new Error('Invalid JWT payload');
|
|
13830
|
+
}
|
|
13831
|
+
}
|
|
13832
|
+
UtilsJwt.decode = decode;
|
|
13833
|
+
//#endregion
|
|
13834
|
+
//#region verify
|
|
13835
|
+
async function verify(token, secret) {
|
|
13836
|
+
const parts = token.split('.');
|
|
13837
|
+
if (parts.length !== 3) {
|
|
13838
|
+
throw new Error('Invalid JWT');
|
|
13839
|
+
}
|
|
13840
|
+
const [encodedHeader, encodedPayload, encodedSignature] = parts;
|
|
13841
|
+
//#region validate header
|
|
13842
|
+
let header;
|
|
13843
|
+
try {
|
|
13844
|
+
header = JSON.parse(decoder.decode(base64UrlDecode(encodedHeader)));
|
|
13845
|
+
}
|
|
13846
|
+
catch {
|
|
13847
|
+
throw new Error('Invalid JWT header');
|
|
13848
|
+
}
|
|
13849
|
+
if (header.alg !== 'HS256') {
|
|
13850
|
+
throw new Error(`Unsupported JWT algorithm: ${header.alg}`);
|
|
13851
|
+
}
|
|
13852
|
+
//#endregion
|
|
13853
|
+
//#region verify signature
|
|
13854
|
+
const unsignedToken = `${encodedHeader}.${encodedPayload}`;
|
|
13855
|
+
const signature = base64UrlDecode(encodedSignature);
|
|
13856
|
+
const key = await createHmacKey(secret, 'verify');
|
|
13857
|
+
const valid = await crypto.subtle.verify('HMAC', key, signature, encoder.encode(unsignedToken));
|
|
13858
|
+
if (!valid) {
|
|
13859
|
+
throw new Error('Invalid JWT signature');
|
|
13860
|
+
}
|
|
13861
|
+
//#endregion
|
|
13862
|
+
//#region decode payload
|
|
13863
|
+
let payload;
|
|
13864
|
+
try {
|
|
13865
|
+
payload = JSON.parse(decoder.decode(base64UrlDecode(encodedPayload)));
|
|
13866
|
+
}
|
|
13867
|
+
catch {
|
|
13868
|
+
throw new Error('Invalid JWT payload');
|
|
13869
|
+
}
|
|
13870
|
+
//#endregion
|
|
13871
|
+
//#region validate expiration
|
|
13872
|
+
if (typeof payload.exp === 'number' &&
|
|
13873
|
+
Math.floor(Date.now() / 1000) >= payload.exp) {
|
|
13874
|
+
throw new Error('JWT expired');
|
|
13875
|
+
}
|
|
13876
|
+
//#endregion
|
|
13877
|
+
return payload;
|
|
13878
|
+
}
|
|
13879
|
+
UtilsJwt.verify = verify;
|
|
13880
|
+
//#endregion
|
|
13881
|
+
})(UtilsJwt || (UtilsJwt = {}));
|
|
13882
|
+
|
|
13587
13883
|
const jsoncFormattingOptions = {
|
|
13588
13884
|
insertSpaces: true,
|
|
13589
13885
|
tabSize: 2,
|
|
@@ -13728,7 +14024,6 @@ const requiredForDev = {
|
|
|
13728
14024
|
],
|
|
13729
14025
|
};
|
|
13730
14026
|
|
|
13731
|
-
//#region imports
|
|
13732
14027
|
//#endregion
|
|
13733
14028
|
class CLI {
|
|
13734
14029
|
static { this.chalk = chalk; }
|
|
@@ -14115,5 +14410,5 @@ var index = {};
|
|
|
14115
14410
|
* Generated bundle index. Do not edit.
|
|
14116
14411
|
*/
|
|
14117
14412
|
|
|
14118
|
-
export { $, BaselineSiteJoinprefix, CLI, CoreConfig, CoreModels, DbBinaryFormatEnum, ExecAsyncVscodeError, FilePathMetaData, FilesNames, GlobalLibTypeName, GlobalStorage, GlobalTaskManager, GlobalTaskManagerClass, Helpers, LibTypeArr, LibTypeEnum, PREFIXES, REGEX_REGION, TAGS, TaonStateMachine, Utils, UtilsBinary, UtilsCli, UtilsCliClassMethod, UtilsDotFile, UtilsEtcHosts, UtilsExecProc, UtilsFilesFolders, UtilsFilesFoldersSync, UtilsI18n, UtilsJson, UtilsMdDocs, UtilsMessages, UtilsMigrations, UtilsNetwork, UtilsOs, UtilsProcess, UtilsProcessLogger, UtilsProgress, UtilsProjects, UtilsStdinStdoutLogger, UtilsString, UtilsStringRegex, UtilsSudo, UtilsTerminal, UtilsTime, UtilsWaitNotifier, UtilsYaml, _, appRelatedFiles, areTrustedForPatchUpdate, axios, backendNodejsOnlyFiles, backendWebsqlNodejsFiles, baseTaonDevProjectsNames, chalk, child_process, chokidar, config, crossPlatformPath, dateformat, dockerTemplates, dotTaonFolder, dotTnpFolder, encoding, execAsyncVscode, extAllowedToExportAndReplaceTSJSCodeFiles, extAllowedToReplace, extForSassLikeFiles, extForStyles, extTemplatesFiles, fg, fileName, filesNotAllowedToClean, folderName, frameworkName, frameworkNameBe, frontEndOnly, frontendFiles, fse, glob, globalSpinner, http, https, isCloudflareWorker, isElevated, micromatch, mkdirp, ncp, notAllowedNames, notAllowedProjectNames, notNeededForExportFiles, os, path, ps, psList, requireDefault, requiredForDev, rimraf, spawn, startAsync, stateServiceSuffix, taonActionFromParent, taonBasePathToGlobalDockerTemplatesFn, taonContainers, taonCutNextLineCut, taonPackageName, taonProjects, taonRepoPathUserInUserDirFn, taonSkipCut, tempFoldersName, tnpPackageName, updateJsoncContent, urlRepoTaon, urlRepoTaonContainers, win32Path };
|
|
14413
|
+
export { $, BaselineSiteJoinprefix, CLI, CoreConfig, CoreModels, DbBinaryFormatEnum, ExecAsyncVscodeError, FilePathMetaData, FilesNames, GlobalLibTypeName, GlobalStorage, GlobalTaskManager, GlobalTaskManagerClass, Helpers, LibTypeArr, LibTypeEnum, PREFIXES, REGEX_REGION, TAGS, TaonStateMachine, Utils, UtilsBinary, UtilsCli, UtilsCliClassMethod, UtilsDotFile, UtilsEnv, UtilsEtcHosts, UtilsExecProc, UtilsFilesFolders, UtilsFilesFoldersSync, UtilsHttp, UtilsI18n, UtilsJson, UtilsJwt, UtilsMdDocs, UtilsMessages, UtilsMigrations, UtilsNetwork, UtilsOs, UtilsProcess, UtilsProcessLogger, UtilsProgress, UtilsProjects, UtilsStdinStdoutLogger, UtilsString, UtilsStringRegex, UtilsSudo, UtilsTerminal, UtilsTime, UtilsWaitNotifier, UtilsYaml, _, appRelatedFiles, areTrustedForPatchUpdate, axios, backendNodejsOnlyFiles, backendWebsqlNodejsFiles, baseTaonDevProjectsNames, chalk, child_process, chokidar, config, crossPlatformPath, dateformat, dockerTemplates, dotTaonFolder, dotTnpFolder, encoding, execAsyncVscode, extAllowedToExportAndReplaceTSJSCodeFiles, extAllowedToReplace, extForSassLikeFiles, extForStyles, extTemplatesFiles, fg, fileName, filesNotAllowedToClean, folderName, frameworkName, frameworkNameBe, frontEndOnly, frontendFiles, fse, glob, globalSpinner, http, https, isCloudflareWorker, isElevated, micromatch, mkdirp, ncp, notAllowedNames, notAllowedProjectNames, notNeededForExportFiles, os, path, ps, psList, requireDefault, requiredForDev, rimraf, spawn, startAsync, stateServiceSuffix, taonActionFromParent, taonBasePathToGlobalDockerTemplatesFn, taonContainers, taonCutNextLineCut, taonPackageName, taonProjects, taonRepoPathUserInUserDirFn, taonSkipCut, tempFoldersName, tnpPackageName, updateJsoncContent, urlRepoTaon, urlRepoTaonContainers, win32Path };
|
|
14119
14414
|
//# sourceMappingURL=tnp-core-browser.mjs.map
|