tnp-core 18.0.47 → 18.0.50
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 +1 -1
- package/assets/shared/shared_folder_info.txt +1 -1
- package/browser/esm2022/lib/core-imports.mjs +66 -5
- package/browser/esm2022/lib/core-models.mjs +51 -48
- package/browser/esm2022/lib/helpers-messages.mjs +9 -4
- package/browser/esm2022/lib/helpers.mjs +152 -369
- package/browser/esm2022/lib/utils.mjs +521 -8
- package/browser/fesm2022/tnp-core.mjs +1469 -1105
- package/browser/fesm2022/tnp-core.mjs.map +1 -1
- package/browser/lib/core-imports.d.ts +41 -1
- package/browser/lib/core-models.d.ts +51 -83
- package/browser/lib/helpers-messages.d.ts +6 -3
- package/browser/lib/helpers.d.ts +22 -0
- package/browser/lib/utils.d.ts +48 -0
- package/cli.backend.d.ts +1 -0
- package/cli.backend.js +15 -2
- package/cli.backend.js.map +1 -1
- package/client/esm2022/lib/core-imports.mjs +66 -5
- package/client/esm2022/lib/core-models.mjs +51 -48
- package/client/esm2022/lib/helpers-messages.mjs +9 -4
- package/client/esm2022/lib/helpers.mjs +152 -369
- package/client/esm2022/lib/utils.mjs +521 -8
- package/client/fesm2022/tnp-core.mjs +1469 -1105
- package/client/fesm2022/tnp-core.mjs.map +1 -1
- package/client/lib/core-imports.d.ts +41 -1
- package/client/lib/core-models.d.ts +51 -83
- package/client/lib/helpers-messages.d.ts +6 -3
- package/client/lib/helpers.d.ts +22 -0
- package/client/lib/utils.d.ts +48 -0
- package/index.js +15 -2
- package/index.js.map +1 -1
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/command-exists.js +20 -20
- package/lib/command-exists.js.map +1 -1
- package/lib/core-cli.js +49 -66
- package/lib/core-cli.js.map +1 -1
- package/lib/core-config.js.map +1 -1
- package/lib/core-imports.d.ts +41 -20
- package/lib/core-imports.js +202 -78
- package/lib/core-imports.js.map +1 -1
- package/lib/core-models.d.ts +51 -83
- package/lib/core-models.js +52 -47
- package/lib/core-models.js.map +1 -1
- package/lib/framework-name.js +2 -2
- package/lib/framework-name.js.map +1 -1
- package/lib/helpers-isomorphic.js +33 -52
- package/lib/helpers-isomorphic.js.map +1 -1
- package/lib/helpers-messages.d.ts +6 -3
- package/lib/helpers-messages.js +79 -102
- package/lib/helpers-messages.js.map +1 -1
- package/lib/helpers.d.ts +21 -3
- package/lib/helpers.js +718 -967
- package/lib/helpers.js.map +1 -1
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.js +23 -10
- package/lib/index.js.map +1 -1
- package/lib/node-chalk-mock.js +2 -2
- package/lib/node-chalk-mock.js.map +1 -1
- package/lib/node-path-mock.js +2 -2
- package/lib/node-path-mock.js.map +1 -1
- package/lib/progress-data.js +21 -23
- package/lib/progress-data.js.map +1 -1
- package/lib/public-api.js +19 -6
- package/lib/public-api.js.map +1 -1
- package/lib/required-global-npm-packages.js.map +1 -1
- package/lib/required.d.ts +44 -0
- package/lib/safe-types/glob.d.ts +102 -0
- package/lib/safe-types/minimatch/assert-valid-pattern.d.ts +1 -0
- package/lib/safe-types/minimatch/ast.d.ts +17 -0
- package/lib/safe-types/minimatch/brace-expressions.d.ts +7 -0
- package/lib/safe-types/minimatch/escape.d.ts +11 -0
- package/lib/safe-types/minimatch/index.d copy.d.ts +93 -0
- package/lib/safe-types/minimatch/index.d.ts +93 -0
- package/lib/safe-types/minimatch/unescapd.d.ts +16 -0
- package/lib/safe-types/minimatch/unescape.d.ts +16 -0
- package/lib/safe-types/minimatch.d.ts +0 -0
- package/lib/safe-types/rimraf.d.ts +28 -0
- package/lib/utils.d.ts +48 -1
- package/lib/utils.js +1252 -1146
- package/lib/utils.js.map +1 -1
- package/migrations/index.js +15 -2
- package/migrations/index.js.map +1 -1
- package/migrations/migrations_index._auto-generated_.js.map +1 -1
- package/package.json +26 -89
- package/src.d.ts +1 -1
- package/taon.jsonc +48 -58
- package/tmp-environment.json +8 -403
- package/websql/esm2022/lib/core-imports.mjs +66 -5
- package/websql/esm2022/lib/core-models.mjs +51 -48
- package/websql/esm2022/lib/helpers-messages.mjs +9 -4
- package/websql/esm2022/lib/helpers.mjs +152 -369
- package/websql/esm2022/lib/utils.mjs +521 -8
- package/websql/fesm2022/tnp-core.mjs +1466 -1102
- package/websql/fesm2022/tnp-core.mjs.map +1 -1
- package/websql/lib/core-imports.d.ts +41 -1
- package/websql/lib/core-models.d.ts +51 -83
- package/websql/lib/helpers-messages.d.ts +6 -3
- package/websql/lib/helpers.d.ts +22 -0
- package/websql/lib/utils.d.ts +48 -0
- package/browser/package.json +0 -25
- package/websql/package.json +0 -25
package/lib/core-cli.js
CHANGED
@@ -1,88 +1,87 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.CLI = void 0;
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
var framework_name_1 = require("./framework-name");
|
4
|
+
const core_imports_1 = require("./core-imports");
|
5
|
+
const index_1 = require("./index");
|
6
|
+
const framework_name_1 = require("./framework-name");
|
8
7
|
//#region @backend
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
const core_imports_2 = require("./core-imports");
|
9
|
+
const command_exists_1 = require("./command-exists");
|
10
|
+
const commandExistsSync = command_exists_1.checkSyncIfCommandExists;
|
11
|
+
const check = require('check-node-version');
|
13
12
|
// @ts-ignore
|
14
|
-
|
15
|
-
|
13
|
+
const is_elevated_1 = require("is-elevated");
|
14
|
+
const required_global_npm_packages_1 = require("./required-global-npm-packages");
|
16
15
|
//#endregion
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
class CLI {
|
17
|
+
//#region @backend
|
18
|
+
static isElevated = is_elevated_1.default;
|
19
|
+
static commandExistsSync = commandExistsSync;
|
20
|
+
//#endregion
|
21
|
+
static chalk = core_imports_1.chalk;
|
20
22
|
//#region @backend
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
globalDependencies.npm.forEach(function (pkg) {
|
23
|
+
static installEnvironment(globalDependencies = required_global_npm_packages_1.requiredForDev) {
|
24
|
+
index_1.Helpers.info(`[taon-cli] INSTALLING GLOBAL ENVIRONMENT FOR TAON... it will take a few minutes`);
|
25
|
+
const missingNpm = [];
|
26
|
+
globalDependencies.npm.forEach(pkg => {
|
26
27
|
if (!commandExistsSync(pkg.name)) {
|
27
28
|
missingNpm.push(pkg);
|
28
29
|
}
|
29
30
|
});
|
30
31
|
if (missingNpm.length > 0) {
|
31
|
-
|
32
|
-
.map(
|
33
|
-
|
34
|
-
return pkg.version ?
|
32
|
+
const toInstall = missingNpm
|
33
|
+
.map(pkg => {
|
34
|
+
const n = pkg.installName ? pkg.installName : pkg.name;
|
35
|
+
return pkg.version ? `${n}@${pkg.version}` : n;
|
35
36
|
})
|
36
37
|
.join(' ');
|
37
38
|
index_1.Helpers.info('Installing missing dependencies...');
|
38
|
-
|
39
|
+
const cmd = `npm install -g -f ${toInstall}`;
|
39
40
|
index_1.Helpers.run(cmd, { output: (framework_name_1.frameworkName === 'tnp'), biggerBuffer: true }).sync();
|
40
41
|
}
|
41
|
-
index_1.Helpers.info(
|
42
|
-
}
|
42
|
+
index_1.Helpers.info(`[taon-cli] INSTALLING GLOBAL ENVIRONMENT FOR TAON...done`);
|
43
|
+
}
|
43
44
|
//#endregion
|
44
45
|
//#region @backend
|
45
46
|
/**
|
46
47
|
* Check if global system tools are available for isomorphic app development
|
47
48
|
*/
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
globalDependencies.npm.forEach(function (pkg) {
|
49
|
+
static checkEnvironment(globalDependencies = required_global_npm_packages_1.requiredForDev) {
|
50
|
+
const missingNpm = [];
|
51
|
+
globalDependencies.npm.forEach(pkg => {
|
52
52
|
if (!commandExistsSync(pkg.name)) {
|
53
53
|
missingNpm.push(pkg);
|
54
54
|
}
|
55
55
|
});
|
56
56
|
if (missingNpm.length > 0) {
|
57
|
-
|
58
|
-
.map(
|
59
|
-
|
60
|
-
return pkg.version ?
|
57
|
+
const toInstall = missingNpm
|
58
|
+
.map(pkg => {
|
59
|
+
const n = pkg.installName ? pkg.installName : pkg.name;
|
60
|
+
return pkg.version ? `${n}@${pkg.version}` : n;
|
61
61
|
})
|
62
62
|
.join(' ');
|
63
|
-
index_1.Helpers.error(
|
64
|
-
|
65
|
-
index_1.Helpers.error(
|
63
|
+
index_1.Helpers.error(`Missing npm dependencies.`, true, true);
|
64
|
+
const cmd = `npm install -g ${toInstall}`;
|
65
|
+
index_1.Helpers.error(`Please run: ${core_imports_1.chalk.green(cmd)}`, false, true);
|
66
66
|
}
|
67
|
-
globalDependencies.programs.forEach(
|
67
|
+
globalDependencies.programs.forEach(p => {
|
68
68
|
if (!commandExistsSync(p.name)) {
|
69
|
-
index_1.Helpers.error(core_imports_1.chalk.red(
|
70
|
-
index_1.Helpers.error(
|
69
|
+
index_1.Helpers.error(core_imports_1.chalk.red(`Missing command line tool "${p.name}".`), false, false);
|
70
|
+
index_1.Helpers.error(`Please install it from: ${core_imports_1.chalk.green(p.website)}`, false, false);
|
71
71
|
}
|
72
72
|
});
|
73
73
|
try {
|
74
|
-
core_imports_2.child_process.execSync(
|
74
|
+
core_imports_2.child_process.execSync(`check-node-version --node ">= 13"`, { stdio: [0, 1, 2] });
|
75
75
|
}
|
76
76
|
catch (error) {
|
77
77
|
process.exit(0);
|
78
78
|
}
|
79
|
-
}
|
79
|
+
}
|
80
80
|
//#endregion
|
81
81
|
//#region @backend
|
82
|
-
|
83
|
-
return new Promise(
|
84
|
-
check({ node:
|
85
|
-
var e_1, _a;
|
82
|
+
minimalNodeVersionExistsGlobal(minimalNode) {
|
83
|
+
return new Promise((resolve) => {
|
84
|
+
check({ node: `>= ${minimalNode}`, }, (error, result) => {
|
86
85
|
if (error) {
|
87
86
|
index_1.Helpers.error(error, true, true);
|
88
87
|
resolve(false);
|
@@ -93,32 +92,16 @@ var CLI = /** @class */ (function () {
|
|
93
92
|
}
|
94
93
|
else {
|
95
94
|
index_1.Helpers.error("[taon-cli] Some package version(s) failed!", true, true);
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
if (!result.versions[packageName].isSatisfied) {
|
100
|
-
index_1.Helpers.error("[taon-cli] Missing ".concat(packageName, "."), true, true);
|
101
|
-
}
|
95
|
+
for (const packageName of Object.keys(result.versions)) {
|
96
|
+
if (!result.versions[packageName].isSatisfied) {
|
97
|
+
index_1.Helpers.error(`[taon-cli] Missing ${packageName}.`, true, true);
|
102
98
|
}
|
103
99
|
}
|
104
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
105
|
-
finally {
|
106
|
-
try {
|
107
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
108
|
-
}
|
109
|
-
finally { if (e_1) throw e_1.error; }
|
110
|
-
}
|
111
100
|
resolve(false);
|
112
101
|
}
|
113
102
|
});
|
114
103
|
});
|
115
|
-
}
|
116
|
-
|
117
|
-
CLI.isElevated = is_elevated_1.default;
|
118
|
-
CLI.commandExistsSync = commandExistsSync;
|
119
|
-
//#endregion
|
120
|
-
CLI.chalk = core_imports_1.chalk;
|
121
|
-
return CLI;
|
122
|
-
}());
|
104
|
+
}
|
105
|
+
}
|
123
106
|
exports.CLI = CLI;
|
124
107
|
//# sourceMappingURL=core-cli.js.map
|
package/lib/core-cli.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"core-cli.js","sourceRoot":"","sources":[""],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"core-cli.js","sourceRoot":"","sources":["/Users/dfilipiak/npm/taon-dev/tnp-core/src/lib/core-cli.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AACvC,mCAAkC;AAClC,qDAAiD;AACjD,kBAAkB;AAElB,iDAA+C;AAE/C,qDAA4D;AAE5D,MAAM,iBAAiB,GAAG,yCAAwB,CAAC;AACnD,MAAM,KAAK,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC5C,aAAa;AACb,6CAAqC;AACrC,iFA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C,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;4BAC9C,eAAO,CAAC,KAAK,CAAC,sBAAsB,WAAW,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;wBAClE,CAAC;oBACH,CAAC;oBACD,OAAO,CAAC,KAAK,CAAC,CAAC;gBACjB,CAAC;YACH,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;;AAtGH,kBAyGC"}
|
package/lib/core-config.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"core-config.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACxB,OAAO,EAAE;QACP,oBAAoB,EAAE,sBAAsB;KAC7C;CACF,CAAC"}
|
1
|
+
{"version":3,"file":"core-config.js","sourceRoot":"","sources":["/Users/dfilipiak/npm/taon-dev/tnp-core/src/lib/core-config.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACxB,OAAO,EAAE;QACP,oBAAoB,EAAE,sBAAsB;KAC7C;CACF,CAAC"}
|
package/lib/core-imports.d.ts
CHANGED
@@ -1,20 +1,3 @@
|
|
1
|
-
import * as os from 'os';
|
2
|
-
import * as child_process from 'child_process';
|
3
|
-
import * as http from 'http';
|
4
|
-
import * as https from 'https';
|
5
|
-
import * as net from 'net';
|
6
|
-
import * as spawn from 'cross-spawn';
|
7
|
-
import * as glob from 'glob';
|
8
|
-
import * as fg from 'fast-glob';
|
9
|
-
import { minimatch } from 'minimatch';
|
10
|
-
import * as fse from 'fs-extra';
|
11
|
-
import * as rimraf from 'rimraf';
|
12
|
-
import * as chokidar from 'chokidar';
|
13
|
-
import * as mkdirp from 'mkdirp';
|
14
|
-
import * as ncp from 'copy-paste';
|
15
|
-
import * as ps from 'ps-node';
|
16
|
-
import * as psList from 'ps-list';
|
17
|
-
import * as fkill from 'fkill';
|
18
1
|
import * as _ from 'lodash';
|
19
2
|
import * as q from 'q';
|
20
3
|
import * as moment from 'moment';
|
@@ -23,10 +6,49 @@ import { Chalk } from 'chalk';
|
|
23
6
|
import * as json5 from 'json5';
|
24
7
|
import type jQueryType from 'jquery';
|
25
8
|
import type * as pathBaseType from 'path';
|
9
|
+
import type * as globBaseType from 'glob';
|
10
|
+
import type * as fseBaseType from 'fs-extra';
|
11
|
+
import type * as osBaseType from 'os';
|
12
|
+
import type * as child_processType from 'child_process';
|
13
|
+
import type * as httpBaseType from 'http';
|
14
|
+
import type * as httpsBaseType from 'https';
|
15
|
+
import type * as fkillBaseType from 'fkill';
|
16
|
+
import type * as psListBaseType from 'ps-list';
|
17
|
+
import type * as netBaseType from 'net';
|
18
|
+
import type * as spawnBaseType from 'cross-spawn';
|
19
|
+
import type * as fgBaseType from 'fast-glob';
|
20
|
+
import type { minimatch as minimatchBaseType } from 'minimatch';
|
21
|
+
import type * as rimrafBaseType from 'rimraf';
|
22
|
+
import type * as chokidarBaseType from 'chokidar';
|
23
|
+
import type * as mkdirpBaseType from 'mkdirp';
|
24
|
+
import type * as ncpBaseType from 'copy-paste';
|
25
|
+
import type * as psBaseType from 'ps-node';
|
26
26
|
declare let $: jQueryType;
|
27
27
|
declare let path: typeof pathBaseType;
|
28
28
|
declare let chalk: Chalk;
|
29
|
-
declare
|
29
|
+
declare let glob: typeof globBaseType;
|
30
|
+
declare let fse: typeof fseBaseType;
|
31
|
+
declare let os: typeof osBaseType;
|
32
|
+
declare let child_process: typeof child_processType;
|
33
|
+
declare let http: typeof httpBaseType;
|
34
|
+
declare let https: typeof httpsBaseType;
|
35
|
+
/**
|
36
|
+
* check if the current process is elevated
|
37
|
+
* - sudo in unix/macos
|
38
|
+
* - admin in windows
|
39
|
+
*/
|
40
|
+
declare let isElevated: () => Promise<boolean>;
|
41
|
+
declare let fkill: typeof fkillBaseType;
|
42
|
+
declare let psList: typeof psListBaseType;
|
43
|
+
declare let net: typeof netBaseType;
|
44
|
+
declare let spawn: typeof spawnBaseType;
|
45
|
+
declare let minimatch: typeof minimatchBaseType;
|
46
|
+
declare let rimraf: typeof rimrafBaseType;
|
47
|
+
declare let chokidar: typeof chokidarBaseType;
|
48
|
+
declare let mkdirp: typeof mkdirpBaseType;
|
49
|
+
declare let ncp: typeof ncpBaseType;
|
50
|
+
declare let ps: typeof psBaseType;
|
51
|
+
declare let fg: typeof fgBaseType;
|
30
52
|
/**
|
31
53
|
* transform unix path to win32 path
|
32
54
|
*/
|
@@ -35,5 +57,4 @@ declare const win32Path: (p: string) => string;
|
|
35
57
|
* This funciton will replace // to /
|
36
58
|
*/
|
37
59
|
declare const crossPlatformPath: (pathStringOrPathParts: string | string[]) => string;
|
38
|
-
export { _, q, moment, dateformat, crossPlatformPath, win32Path, path, chalk, json5, $, };
|
39
|
-
export { spawn, glob, minimatch, fg, isElevated, chokidar, mkdirp, ncp, fse, os, child_process, http, https, rimraf, net, ps, fkill, psList, };
|
60
|
+
export { _, q, moment, dateformat, crossPlatformPath, win32Path, path, chalk, json5, $, glob, fse, os, child_process, http, https, isElevated, fkill, psList, spawn, minimatch, fg, chokidar, mkdirp, ncp, rimraf, net, ps, };
|
package/lib/core-imports.js
CHANGED
@@ -1,79 +1,65 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
|
5
|
-
var tslib_1 = require("tslib");
|
6
|
-
//#region imports
|
7
|
-
var forceTrace = false;
|
3
|
+
exports.ps = exports.net = exports.rimraf = exports.ncp = exports.mkdirp = exports.chokidar = exports.fg = exports.minimatch = exports.spawn = exports.psList = exports.fkill = exports.isElevated = exports.https = exports.http = exports.child_process = exports.os = exports.fse = exports.glob = exports.$ = exports.json5 = exports.chalk = exports.path = exports.win32Path = exports.crossPlatformPath = exports.dateformat = exports.moment = exports.q = exports._ = void 0;
|
4
|
+
let forceTrace = false;
|
8
5
|
//#region @backend
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
var chokidar = require("chokidar");
|
35
|
-
exports.chokidar = chokidar;
|
36
|
-
var mkdirp = require("mkdirp");
|
37
|
-
exports.mkdirp = mkdirp;
|
38
|
-
var ncp = require("copy-paste");
|
39
|
-
exports.ncp = ncp;
|
40
|
-
var ps = require("ps-node");
|
41
|
-
exports.ps = ps;
|
42
|
-
var psList = require("ps-list");
|
43
|
-
exports.psList = psList;
|
44
|
-
var fkill = require("fkill");
|
45
|
-
exports.fkill = fkill;
|
46
|
-
var isRoot = require('is-root');
|
47
|
-
var isAdmin = require('is-admin');
|
48
|
-
forceTrace = global.hideLog === false;
|
6
|
+
const fseBase = require("fs-extra");
|
7
|
+
const osBase = require("os");
|
8
|
+
const pathBase = require("path");
|
9
|
+
const chalk_1 = require("chalk");
|
10
|
+
const cheerio = require("cheerio");
|
11
|
+
const child_processBase = require("child_process");
|
12
|
+
const httpBase = require("http");
|
13
|
+
const httpsBase = require("https");
|
14
|
+
const isRootBase = require('is-root');
|
15
|
+
const isAdminBase = require('is-admin');
|
16
|
+
const isElevatedBase = async () => {
|
17
|
+
return process.platform === 'win32' ? isAdminBase() : isRootBase();
|
18
|
+
};
|
19
|
+
const fkillBase = require("fkill");
|
20
|
+
const psListBase = require("ps-list");
|
21
|
+
const netBase = require("net");
|
22
|
+
const spawnBase = require("cross-spawn");
|
23
|
+
const globBase = require("glob");
|
24
|
+
const fgBase = require("fast-glob");
|
25
|
+
const minimatch_1 = require("minimatch");
|
26
|
+
const rimrafBase = require("rimraf");
|
27
|
+
const chokidarBase = require("chokidar");
|
28
|
+
const mkdirpBase = require("mkdirp");
|
29
|
+
const ncpBase = require("copy-paste");
|
30
|
+
const psBase = require("ps-node");
|
49
31
|
//#endregion
|
50
32
|
/* */
|
51
33
|
/* */
|
52
34
|
/* */
|
53
35
|
/* */
|
54
|
-
|
36
|
+
const _ = require("lodash");
|
55
37
|
exports._ = _;
|
56
|
-
|
38
|
+
const q = require("q");
|
57
39
|
exports.q = q;
|
58
|
-
|
40
|
+
const moment = require("moment");
|
59
41
|
exports.moment = moment;
|
60
|
-
|
42
|
+
const dateformat = require("dateformat");
|
61
43
|
exports.dateformat = dateformat;
|
62
|
-
|
44
|
+
const json5 = require("json5");
|
63
45
|
exports.json5 = json5;
|
46
|
+
const index_1 = require("./index");
|
47
|
+
//#region constants
|
48
|
+
//#region @backend
|
49
|
+
forceTrace = global.hideLog === false;
|
50
|
+
//#endregion
|
64
51
|
//#endregion
|
65
|
-
var index_1 = require("./index");
|
66
52
|
//#region set up browser mocks
|
67
|
-
//#region mock jquery
|
68
|
-
|
53
|
+
//#region set up browser mocks / mock jquery
|
54
|
+
let $;
|
69
55
|
/* */
|
70
56
|
/* */
|
71
57
|
//#region @backend
|
72
58
|
exports.$ = $ = cheerio;
|
73
59
|
//#endregion
|
74
60
|
//#endregion
|
75
|
-
//#region mock path
|
76
|
-
|
61
|
+
//#region set up browser mocks / mock path
|
62
|
+
let path = void 0;
|
77
63
|
exports.path = path;
|
78
64
|
// #region @backend
|
79
65
|
exports.path = path = pathBase;
|
@@ -82,8 +68,8 @@ exports.path = path = pathBase;
|
|
82
68
|
/* */
|
83
69
|
/* */
|
84
70
|
//#endregion
|
85
|
-
//#region mock chalk
|
86
|
-
|
71
|
+
//#region set up browser mocks / mock chalk
|
72
|
+
let chalk = void 0;
|
87
73
|
exports.chalk = chalk;
|
88
74
|
// #region @backend
|
89
75
|
exports.chalk = chalk = chalk_1.default;
|
@@ -92,40 +78,178 @@ exports.chalk = chalk = chalk_1.default;
|
|
92
78
|
/* */
|
93
79
|
/* */
|
94
80
|
//#endregion
|
81
|
+
//#region set up browser mocks / mock glob
|
82
|
+
let glob = void 0;
|
83
|
+
exports.glob = glob;
|
84
|
+
//#region @backend
|
85
|
+
exports.glob = glob = globBase;
|
86
|
+
//#endregion
|
87
|
+
/* */
|
88
|
+
/* */
|
89
|
+
//#endregion
|
90
|
+
//#region set up browser mocks / mock fse
|
91
|
+
let fse = void 0;
|
92
|
+
exports.fse = fse;
|
93
|
+
//#region @backend
|
94
|
+
exports.fse = fse = fseBase;
|
95
|
+
//#endregion
|
96
|
+
/* */
|
97
|
+
/* */
|
98
|
+
//#endregion
|
99
|
+
//#region set up browser mocks / mock os
|
100
|
+
let os = void 0;
|
101
|
+
exports.os = os;
|
102
|
+
//#region @backend
|
103
|
+
exports.os = os = osBase;
|
104
|
+
//#endregion
|
105
|
+
/* */
|
106
|
+
/* */
|
107
|
+
//#endregion
|
108
|
+
//#region set up browser mocks / mock child_process
|
109
|
+
let child_process = void 0;
|
110
|
+
exports.child_process = child_process;
|
111
|
+
//#region @backend
|
112
|
+
exports.child_process = child_process = child_processBase;
|
113
|
+
//#endregion
|
114
|
+
//#endregion
|
115
|
+
//#region set up browser mocks / mock http
|
116
|
+
let http = void 0;
|
117
|
+
exports.http = http;
|
118
|
+
//#region @backend
|
119
|
+
exports.http = http = httpBase;
|
120
|
+
//#endregion
|
121
|
+
//#endregion
|
122
|
+
//#region set up browser mocks / mock https
|
123
|
+
let https = void 0;
|
124
|
+
exports.https = https;
|
125
|
+
//#region @backend
|
126
|
+
exports.https = https = httpsBase;
|
127
|
+
//#endregion
|
128
|
+
//#endregion
|
129
|
+
//#region set up browser mocks / mock isRoot
|
130
|
+
let isRoot = void 0;
|
131
|
+
//#region @backend
|
132
|
+
isRoot = isRootBase;
|
133
|
+
//#endregion
|
95
134
|
//#endregion
|
96
|
-
//#region
|
135
|
+
//#region set up browser mocks / mock isAdmin
|
136
|
+
let isAdmin = void 0;
|
97
137
|
//#region @backend
|
98
|
-
|
99
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
100
|
-
return tslib_1.__generator(this, function (_a) {
|
101
|
-
return [2 /*return*/, process.platform === 'win32' ? isAdmin() : isRoot()];
|
102
|
-
});
|
103
|
-
});
|
104
|
-
}
|
138
|
+
isAdmin = isAdminBase;
|
105
139
|
//#endregion
|
106
140
|
//#endregion
|
141
|
+
//#region set up browser mocks / mock isElevated
|
142
|
+
/**
|
143
|
+
* check if the current process is elevated
|
144
|
+
* - sudo in unix/macos
|
145
|
+
* - admin in windows
|
146
|
+
*/
|
147
|
+
let isElevated = void 0;
|
148
|
+
exports.isElevated = isElevated;
|
149
|
+
//#region @backend
|
150
|
+
exports.isElevated = isElevated = isElevatedBase;
|
151
|
+
//#endregion
|
152
|
+
//#endregion
|
153
|
+
//#region set up browser mocks / mock fkill
|
154
|
+
let fkill = void 0;
|
155
|
+
exports.fkill = fkill;
|
156
|
+
//#region @backend
|
157
|
+
exports.fkill = fkill = fkillBase;
|
158
|
+
//#endregion
|
159
|
+
//#endregion
|
160
|
+
//#region set up browser mocks / mock psList
|
161
|
+
let psList = void 0;
|
162
|
+
exports.psList = psList;
|
163
|
+
//#region @backend
|
164
|
+
exports.psList = psList = psListBase;
|
165
|
+
//#endregion
|
166
|
+
//#endregion
|
167
|
+
//#region set up browser mocks / mock net
|
168
|
+
let net = void 0;
|
169
|
+
exports.net = net;
|
170
|
+
//#region @backend
|
171
|
+
exports.net = net = netBase;
|
172
|
+
//#endregion
|
173
|
+
//#endregion
|
174
|
+
//#region set up browser mocks / mock spawn
|
175
|
+
let spawn = void 0;
|
176
|
+
exports.spawn = spawn;
|
177
|
+
//#region @backend
|
178
|
+
exports.spawn = spawn = spawnBase;
|
179
|
+
//#endregion
|
180
|
+
//#endregion
|
181
|
+
//#region set up browser mocks / mock minimatch
|
182
|
+
let minimatch = void 0;
|
183
|
+
exports.minimatch = minimatch;
|
184
|
+
//#region @backend
|
185
|
+
exports.minimatch = minimatch = minimatch_1.minimatch;
|
186
|
+
//#endregion
|
187
|
+
//#endregion
|
188
|
+
//#region set up browser mocks / mock rimraf
|
189
|
+
let rimraf = void 0;
|
190
|
+
exports.rimraf = rimraf;
|
191
|
+
//#region @backend
|
192
|
+
exports.rimraf = rimraf = rimrafBase;
|
193
|
+
//#endregion
|
194
|
+
//#endregion
|
195
|
+
//#region set up browser mocks / mock chokidar
|
196
|
+
let chokidar = void 0;
|
197
|
+
exports.chokidar = chokidar;
|
198
|
+
//#region @backend
|
199
|
+
exports.chokidar = chokidar = chokidarBase;
|
200
|
+
//#endregion
|
201
|
+
//#endregion
|
202
|
+
//#region set up browser mocks / mock mkdirp
|
203
|
+
let mkdirp = void 0;
|
204
|
+
exports.mkdirp = mkdirp;
|
205
|
+
//#region @backend
|
206
|
+
exports.mkdirp = mkdirp = mkdirpBase;
|
207
|
+
//#endregion
|
208
|
+
//#endregion
|
209
|
+
//#region set up browser mocks / mock ncp
|
210
|
+
let ncp = void 0;
|
211
|
+
exports.ncp = ncp;
|
212
|
+
//#region @backend
|
213
|
+
exports.ncp = ncp = ncpBase;
|
214
|
+
//#endregion
|
215
|
+
//#endregion
|
216
|
+
//#region set up browser mocks / mock ps
|
217
|
+
let ps = void 0;
|
218
|
+
exports.ps = ps;
|
219
|
+
//#region @backend
|
220
|
+
exports.ps = ps = psBase;
|
221
|
+
//#endregion
|
222
|
+
//#endregion
|
223
|
+
//#region set up browser mocks / mock fg
|
224
|
+
let fg = void 0;
|
225
|
+
exports.fg = fg;
|
226
|
+
//#region @backend
|
227
|
+
exports.fg = fg = fgBase;
|
228
|
+
//#endregion
|
229
|
+
//#endregion
|
230
|
+
//#endregion
|
231
|
+
//#region crossPlatformPath
|
107
232
|
//#region transform unix path to win32 path
|
108
233
|
/**
|
109
234
|
* transform unix path to win32 path
|
110
235
|
*/
|
111
|
-
|
236
|
+
const win32Path = (p) => {
|
112
237
|
//#region @backend
|
113
238
|
if (process.platform !== 'win32') {
|
114
239
|
return p;
|
115
240
|
}
|
116
241
|
//#endregion
|
117
242
|
if (/^\/[a-z]\//.test(p)) {
|
118
|
-
p = p.replace(/^\/[a-z]\//,
|
243
|
+
p = p.replace(/^\/[a-z]\//, `${p.charAt(1).toUpperCase()}:/`);
|
119
244
|
}
|
120
245
|
return path.win32.normalize(p);
|
121
246
|
};
|
122
247
|
exports.win32Path = win32Path;
|
123
248
|
//#endregion
|
124
|
-
//#region crossPlatformPath
|
125
249
|
/**
|
126
250
|
* This funciton will replace // to /
|
127
251
|
*/
|
128
|
-
|
252
|
+
const crossPlatformPath = (pathStringOrPathParts) => {
|
129
253
|
if (Array.isArray(pathStringOrPathParts)) {
|
130
254
|
pathStringOrPathParts = pathStringOrPathParts.join('/');
|
131
255
|
}
|
@@ -137,30 +261,31 @@ var crossPlatformPath = function (pathStringOrPathParts) {
|
|
137
261
|
/^[A-Z]\:/.test(pathStringOrPathParts)) {
|
138
262
|
pathStringOrPathParts = _.lowerFirst(pathStringOrPathParts);
|
139
263
|
}
|
140
|
-
|
141
|
-
|
264
|
+
const isExtendedLengthPath = /^\\\\\?\\/.test(pathStringOrPathParts);
|
265
|
+
const hasNonAscii = /[^\u0000-\u0080]+/.test(pathStringOrPathParts); // eslint-disable-line no-control-regex
|
142
266
|
if (isExtendedLengthPath) {
|
143
|
-
console.warn(
|
267
|
+
console.warn(`[taon-core][crossPlatformPath]: Path starts with \\\\,
|
268
|
+
this is not supported in crossPlatformPath`);
|
144
269
|
if (forceTrace) {
|
145
|
-
console.trace(
|
270
|
+
console.trace(`path: "${pathStringOrPathParts}"`);
|
146
271
|
}
|
147
272
|
}
|
148
273
|
if (hasNonAscii) {
|
149
|
-
|
150
|
-
index_1.Helpers.logWarn(
|
274
|
+
const allNonAscii = pathStringOrPathParts.match(/[^\u0000-\u0080]+/g) || '';
|
275
|
+
index_1.Helpers.logWarn(`[taon-core][crossPlatformPath]: Path contains non-ascii characters: ${allNonAscii}`);
|
151
276
|
index_1.Helpers.logWarn(pathStringOrPathParts);
|
152
277
|
}
|
153
278
|
pathStringOrPathParts = (pathStringOrPathParts || '')
|
154
279
|
.replace(/\\/g, '/')
|
155
280
|
.replace(/\/\//g, '/')
|
156
281
|
.replace(/\/\//g, '/'); // TODO probably not needed
|
157
|
-
|
282
|
+
let isWindows = false;
|
158
283
|
//#region @backend
|
159
284
|
if (process.platform === 'win32') {
|
160
285
|
isWindows = true;
|
161
286
|
}
|
162
287
|
//#endregion
|
163
|
-
|
288
|
+
const regexWinPath1 = /^(\/)[a-zA-Z]\:/;
|
164
289
|
// handle supported gitbash path
|
165
290
|
// (nodejs require need to use /c/ instead of c:/)
|
166
291
|
if (isWindows && regexWinPath1.test(pathStringOrPathParts)) {
|
@@ -178,5 +303,4 @@ var crossPlatformPath = function (pathStringOrPathParts) {
|
|
178
303
|
};
|
179
304
|
exports.crossPlatformPath = crossPlatformPath;
|
180
305
|
//#endregion
|
181
|
-
//#endregion
|
182
306
|
//# sourceMappingURL=core-imports.js.map
|