tnp-core 18.0.46 → 18.0.49
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/README.md +24 -24
- package/browser/esm2022/lib/core-imports.mjs +65 -9
- package/browser/esm2022/lib/core-models.mjs +61 -9
- package/browser/esm2022/lib/helpers-messages.mjs +9 -4
- package/browser/esm2022/lib/helpers.mjs +164 -373
- package/browser/esm2022/lib/utils.mjs +769 -190
- package/browser/fesm2022/tnp-core.mjs +1548 -1062
- 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 +68 -38
- package/browser/lib/helpers-messages.d.ts +6 -3
- package/browser/lib/helpers.d.ts +22 -0
- package/browser/lib/utils.d.ts +77 -13
- package/cli.backend.d.ts +1 -0
- package/cli.backend.js +15 -2
- package/cli.backend.js.map +1 -1
- package/client/README.md +24 -24
- package/client/esm2022/lib/core-imports.mjs +65 -9
- package/client/esm2022/lib/core-models.mjs +61 -9
- package/client/esm2022/lib/helpers-messages.mjs +9 -4
- package/client/esm2022/lib/helpers.mjs +164 -373
- package/client/esm2022/lib/utils.mjs +769 -190
- package/client/fesm2022/tnp-core.mjs +1548 -1062
- 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 +68 -38
- package/client/lib/helpers-messages.d.ts +6 -3
- package/client/lib/helpers.d.ts +22 -0
- package/client/lib/utils.d.ts +77 -13
- 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 -25
- package/lib/core-imports.js +202 -80
- package/lib/core-imports.js.map +1 -1
- package/lib/core-models.d.ts +68 -38
- package/lib/core-models.js +62 -8
- 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 +723 -971
- 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 +89 -14
- package/lib/utils.js +1261 -1075
- 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 +25 -91
- package/src.d.ts +1 -1
- package/tmp-environment.json +8 -404
- package/websql/README.md +24 -24
- package/websql/esm2022/lib/core-imports.mjs +65 -9
- package/websql/esm2022/lib/core-models.mjs +61 -9
- package/websql/esm2022/lib/helpers-messages.mjs +9 -4
- package/websql/esm2022/lib/helpers.mjs +164 -373
- package/websql/esm2022/lib/utils.mjs +766 -187
- package/websql/fesm2022/tnp-core.mjs +1546 -1060
- 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 +68 -38
- package/websql/lib/helpers-messages.d.ts +6 -3
- package/websql/lib/helpers.d.ts +22 -0
- package/websql/lib/utils.d.ts +77 -13
- package/browser/package.json +0 -25
- package/taon.jsonc +0 -65
- 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,oBA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AAE,CAAC;wBACvD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,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,21 +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
|
-
import * as portfinder from 'portfinder';
|
19
1
|
import * as _ from 'lodash';
|
20
2
|
import * as q from 'q';
|
21
3
|
import * as moment from 'moment';
|
@@ -24,10 +6,49 @@ import { Chalk } from 'chalk';
|
|
24
6
|
import * as json5 from 'json5';
|
25
7
|
import type jQueryType from 'jquery';
|
26
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';
|
27
26
|
declare let $: jQueryType;
|
28
27
|
declare let path: typeof pathBaseType;
|
29
28
|
declare let chalk: Chalk;
|
30
|
-
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;
|
31
52
|
/**
|
32
53
|
* transform unix path to win32 path
|
33
54
|
*/
|
@@ -36,9 +57,4 @@ declare const win32Path: (p: string) => string;
|
|
36
57
|
* This funciton will replace // to /
|
37
58
|
*/
|
38
59
|
declare const crossPlatformPath: (pathStringOrPathParts: string | string[]) => string;
|
39
|
-
export { _, q, moment, dateformat, crossPlatformPath, win32Path, path, chalk, json5, $, };
|
40
|
-
export { spawn, glob, minimatch, fg, isElevated, chokidar, mkdirp, ncp, fse, os, child_process, http, https, rimraf, net, ps, fkill,
|
41
|
-
/**
|
42
|
-
* @deprecated use ports worker and taon app instead
|
43
|
-
*/
|
44
|
-
portfinder, 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,81 +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 portfinder = require("portfinder");
|
47
|
-
exports.portfinder = portfinder;
|
48
|
-
var isRoot = require('is-root');
|
49
|
-
var isAdmin = require('is-admin');
|
50
|
-
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");
|
51
31
|
//#endregion
|
52
32
|
/* */
|
53
33
|
/* */
|
54
34
|
/* */
|
55
35
|
/* */
|
56
|
-
|
36
|
+
const _ = require("lodash");
|
57
37
|
exports._ = _;
|
58
|
-
|
38
|
+
const q = require("q");
|
59
39
|
exports.q = q;
|
60
|
-
|
40
|
+
const moment = require("moment");
|
61
41
|
exports.moment = moment;
|
62
|
-
|
42
|
+
const dateformat = require("dateformat");
|
63
43
|
exports.dateformat = dateformat;
|
64
|
-
|
44
|
+
const json5 = require("json5");
|
65
45
|
exports.json5 = json5;
|
46
|
+
const index_1 = require("./index");
|
47
|
+
//#region constants
|
48
|
+
//#region @backend
|
49
|
+
forceTrace = global.hideLog === false;
|
50
|
+
//#endregion
|
66
51
|
//#endregion
|
67
|
-
var index_1 = require("./index");
|
68
52
|
//#region set up browser mocks
|
69
|
-
//#region mock jquery
|
70
|
-
|
53
|
+
//#region set up browser mocks / mock jquery
|
54
|
+
let $;
|
71
55
|
/* */
|
72
56
|
/* */
|
73
57
|
//#region @backend
|
74
58
|
exports.$ = $ = cheerio;
|
75
59
|
//#endregion
|
76
60
|
//#endregion
|
77
|
-
//#region mock path
|
78
|
-
|
61
|
+
//#region set up browser mocks / mock path
|
62
|
+
let path = void 0;
|
79
63
|
exports.path = path;
|
80
64
|
// #region @backend
|
81
65
|
exports.path = path = pathBase;
|
@@ -84,8 +68,8 @@ exports.path = path = pathBase;
|
|
84
68
|
/* */
|
85
69
|
/* */
|
86
70
|
//#endregion
|
87
|
-
//#region mock chalk
|
88
|
-
|
71
|
+
//#region set up browser mocks / mock chalk
|
72
|
+
let chalk = void 0;
|
89
73
|
exports.chalk = chalk;
|
90
74
|
// #region @backend
|
91
75
|
exports.chalk = chalk = chalk_1.default;
|
@@ -94,40 +78,178 @@ exports.chalk = chalk = chalk_1.default;
|
|
94
78
|
/* */
|
95
79
|
/* */
|
96
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
|
97
134
|
//#endregion
|
98
|
-
//#region
|
135
|
+
//#region set up browser mocks / mock isAdmin
|
136
|
+
let isAdmin = void 0;
|
99
137
|
//#region @backend
|
100
|
-
|
101
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
102
|
-
return tslib_1.__generator(this, function (_a) {
|
103
|
-
return [2 /*return*/, process.platform === 'win32' ? isAdmin() : isRoot()];
|
104
|
-
});
|
105
|
-
});
|
106
|
-
}
|
138
|
+
isAdmin = isAdminBase;
|
107
139
|
//#endregion
|
108
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
|
109
232
|
//#region transform unix path to win32 path
|
110
233
|
/**
|
111
234
|
* transform unix path to win32 path
|
112
235
|
*/
|
113
|
-
|
236
|
+
const win32Path = (p) => {
|
114
237
|
//#region @backend
|
115
238
|
if (process.platform !== 'win32') {
|
116
239
|
return p;
|
117
240
|
}
|
118
241
|
//#endregion
|
119
242
|
if (/^\/[a-z]\//.test(p)) {
|
120
|
-
p = p.replace(/^\/[a-z]\//,
|
243
|
+
p = p.replace(/^\/[a-z]\//, `${p.charAt(1).toUpperCase()}:/`);
|
121
244
|
}
|
122
245
|
return path.win32.normalize(p);
|
123
246
|
};
|
124
247
|
exports.win32Path = win32Path;
|
125
248
|
//#endregion
|
126
|
-
//#region crossPlatformPath
|
127
249
|
/**
|
128
250
|
* This funciton will replace // to /
|
129
251
|
*/
|
130
|
-
|
252
|
+
const crossPlatformPath = (pathStringOrPathParts) => {
|
131
253
|
if (Array.isArray(pathStringOrPathParts)) {
|
132
254
|
pathStringOrPathParts = pathStringOrPathParts.join('/');
|
133
255
|
}
|
@@ -139,30 +261,31 @@ var crossPlatformPath = function (pathStringOrPathParts) {
|
|
139
261
|
/^[A-Z]\:/.test(pathStringOrPathParts)) {
|
140
262
|
pathStringOrPathParts = _.lowerFirst(pathStringOrPathParts);
|
141
263
|
}
|
142
|
-
|
143
|
-
|
264
|
+
const isExtendedLengthPath = /^\\\\\?\\/.test(pathStringOrPathParts);
|
265
|
+
const hasNonAscii = /[^\u0000-\u0080]+/.test(pathStringOrPathParts); // eslint-disable-line no-control-regex
|
144
266
|
if (isExtendedLengthPath) {
|
145
|
-
console.warn(
|
267
|
+
console.warn(`[taon-core][crossPlatformPath]: Path starts with \\\\,
|
268
|
+
this is not supported in crossPlatformPath`);
|
146
269
|
if (forceTrace) {
|
147
|
-
console.trace(
|
270
|
+
console.trace(`path: "${pathStringOrPathParts}"`);
|
148
271
|
}
|
149
272
|
}
|
150
273
|
if (hasNonAscii) {
|
151
|
-
|
152
|
-
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}`);
|
153
276
|
index_1.Helpers.logWarn(pathStringOrPathParts);
|
154
277
|
}
|
155
278
|
pathStringOrPathParts = (pathStringOrPathParts || '')
|
156
279
|
.replace(/\\/g, '/')
|
157
280
|
.replace(/\/\//g, '/')
|
158
281
|
.replace(/\/\//g, '/'); // TODO probably not needed
|
159
|
-
|
282
|
+
let isWindows = false;
|
160
283
|
//#region @backend
|
161
284
|
if (process.platform === 'win32') {
|
162
285
|
isWindows = true;
|
163
286
|
}
|
164
287
|
//#endregion
|
165
|
-
|
288
|
+
const regexWinPath1 = /^(\/)[a-zA-Z]\:/;
|
166
289
|
// handle supported gitbash path
|
167
290
|
// (nodejs require need to use /c/ instead of c:/)
|
168
291
|
if (isWindows && regexWinPath1.test(pathStringOrPathParts)) {
|
@@ -180,5 +303,4 @@ var crossPlatformPath = function (pathStringOrPathParts) {
|
|
180
303
|
};
|
181
304
|
exports.crossPlatformPath = crossPlatformPath;
|
182
305
|
//#endregion
|
183
|
-
//#endregion
|
184
306
|
//# sourceMappingURL=core-imports.js.map
|