@omnia/tooling 8.0.256-dev → 8.0.258-dev
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,21 @@
|
|
1
1
|
'use strict';
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.ResolvablePromise = exports.TaskStage = void 0;
|
4
|
+
exports.registerTSConfig = registerTSConfig;
|
5
|
+
exports.registerTsNode = registerTsNode;
|
6
|
+
exports.getConfig = getConfig;
|
7
|
+
exports.getExtensionInfo = getExtensionInfo;
|
8
|
+
exports.getEnviromentInfo = getEnviromentInfo;
|
9
|
+
exports.registerServeTask = registerServeTask;
|
10
|
+
exports.getRegisteredServeTasks = getRegisteredServeTasks;
|
11
|
+
exports.getCleanTasks = getCleanTasks;
|
12
|
+
exports.registerBuildTask = registerBuildTask;
|
13
|
+
exports.getRegisteredBuildTasks = getRegisteredBuildTasks;
|
14
|
+
exports.registerCleanTask = registerCleanTask;
|
15
|
+
exports.loadFile = loadFile;
|
16
|
+
exports.getTSConfig = getTSConfig;
|
17
|
+
exports.getWebpackResolveModules = getWebpackResolveModules;
|
18
|
+
exports.getWebpackResolveAlias = getWebpackResolveAlias;
|
4
19
|
const tslib_1 = require("tslib");
|
5
20
|
var fs = require('fs'), path = require('path');
|
6
21
|
const utils = tslib_1.__importStar(require("./utils"));
|
@@ -30,30 +45,24 @@ var _webpackResolveAlias = null;
|
|
30
45
|
function registerServeTask(serveTask) {
|
31
46
|
_registeredServeTasks.push(serveTask);
|
32
47
|
}
|
33
|
-
exports.registerServeTask = registerServeTask;
|
34
48
|
function getRegisteredServeTasks() {
|
35
49
|
return _registeredServeTasks;
|
36
50
|
}
|
37
|
-
exports.getRegisteredServeTasks = getRegisteredServeTasks;
|
38
51
|
function registerCleanTask(cleanTask) {
|
39
52
|
_registeredCleanTasks.push(cleanTask);
|
40
53
|
}
|
41
|
-
exports.registerCleanTask = registerCleanTask;
|
42
54
|
function getCleanTasks() {
|
43
55
|
return _registeredCleanTasks;
|
44
56
|
}
|
45
|
-
exports.getCleanTasks = getCleanTasks;
|
46
57
|
/**
|
47
58
|
* buildTask: {type: BeforeBuild|AfterBuild, order:number(default 100 for extension), task: () -> promise }
|
48
59
|
*/
|
49
60
|
function registerBuildTask(buildTask) {
|
50
61
|
_registeredBuildTasks.push(buildTask);
|
51
62
|
}
|
52
|
-
exports.registerBuildTask = registerBuildTask;
|
53
63
|
function getRegisteredBuildTasks() {
|
54
64
|
return _registeredBuildTasks;
|
55
65
|
}
|
56
|
-
exports.getRegisteredBuildTasks = getRegisteredBuildTasks;
|
57
66
|
function getExtensionInfo() {
|
58
67
|
var result = {};
|
59
68
|
var filePath = utils.root('extension.json');
|
@@ -67,7 +76,6 @@ function getExtensionInfo() {
|
|
67
76
|
}
|
68
77
|
return result;
|
69
78
|
}
|
70
|
-
exports.getExtensionInfo = getExtensionInfo;
|
71
79
|
function getTSConfig() {
|
72
80
|
if (_tsconfig === null) {
|
73
81
|
let filePath = utils.root('tsconfig.json');
|
@@ -82,7 +90,6 @@ function getTSConfig() {
|
|
82
90
|
}
|
83
91
|
return _tsconfig;
|
84
92
|
}
|
85
|
-
exports.getTSConfig = getTSConfig;
|
86
93
|
function getWebpackResolveModules() {
|
87
94
|
if (_webpackResolveModules === null) {
|
88
95
|
_webpackResolveModules = ['node_modules'];
|
@@ -93,7 +100,6 @@ function getWebpackResolveModules() {
|
|
93
100
|
}
|
94
101
|
return _webpackResolveModules;
|
95
102
|
}
|
96
|
-
exports.getWebpackResolveModules = getWebpackResolveModules;
|
97
103
|
function getWebpackResolveAlias() {
|
98
104
|
if (_webpackResolveAlias === null) {
|
99
105
|
_webpackResolveAlias = {};
|
@@ -113,7 +119,6 @@ function getWebpackResolveAlias() {
|
|
113
119
|
}
|
114
120
|
return _webpackResolveAlias;
|
115
121
|
}
|
116
|
-
exports.getWebpackResolveAlias = getWebpackResolveAlias;
|
117
122
|
function getEnviromentInfo() {
|
118
123
|
var result = {};
|
119
124
|
var filePath = utils.root('environment.json');
|
@@ -127,7 +132,6 @@ function getEnviromentInfo() {
|
|
127
132
|
}
|
128
133
|
return result;
|
129
134
|
}
|
130
|
-
exports.getEnviromentInfo = getEnviromentInfo;
|
131
135
|
function getConfig(path) {
|
132
136
|
var filePath = (process.cwd().replace(/\\/g, "/") + "/" + path).replace(/\/\//g, "/");
|
133
137
|
if (fs.existsSync(filePath)) {
|
@@ -140,7 +144,6 @@ function getConfig(path) {
|
|
140
144
|
}
|
141
145
|
return null;
|
142
146
|
}
|
143
|
-
exports.getConfig = getConfig;
|
144
147
|
function loadFile(path) {
|
145
148
|
var filePath = (process.cwd() + "/" + path).replace(/\\/g, "/").replace(/\/\//g, "/");
|
146
149
|
if (fs.existsSync(filePath)) {
|
@@ -153,7 +156,6 @@ function loadFile(path) {
|
|
153
156
|
}
|
154
157
|
return null;
|
155
158
|
}
|
156
|
-
exports.loadFile = loadFile;
|
157
159
|
function registerTsNode() {
|
158
160
|
registerTSConfig();
|
159
161
|
//const { register } = require('esbuild-register/dist/node')
|
@@ -166,7 +168,6 @@ function registerTsNode() {
|
|
166
168
|
// files: false
|
167
169
|
//});
|
168
170
|
}
|
169
|
-
exports.registerTsNode = registerTsNode;
|
170
171
|
function registerTSConfig() {
|
171
172
|
let tsConfigOptions = getTSConfig();
|
172
173
|
if (tsConfigOptions && tsConfigOptions.compilerOptions && tsConfigOptions.compilerOptions.baseUrl) {
|
@@ -176,7 +177,6 @@ function registerTSConfig() {
|
|
176
177
|
});
|
177
178
|
}
|
178
179
|
}
|
179
|
-
exports.registerTSConfig = registerTSConfig;
|
180
180
|
class ResolvablePromise {
|
181
181
|
constructor() {
|
182
182
|
this._resolved = false;
|
@@ -1,7 +1,12 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
'use strict';
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.
|
4
|
+
exports.isServing = exports.utils = exports.core = void 0;
|
5
|
+
exports.build = build;
|
6
|
+
exports.clean = clean;
|
7
|
+
exports.serve = serve;
|
8
|
+
exports.run = run;
|
9
|
+
exports.registerEsbuild = registerEsbuild;
|
5
10
|
const tslib_1 = require("tslib");
|
6
11
|
const figlet_1 = tslib_1.__importDefault(require("figlet"));
|
7
12
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
@@ -14,7 +19,7 @@ const del_1 = tslib_1.__importDefault(require("del"));
|
|
14
19
|
tslib_1.__exportStar(require("./core"), exports);
|
15
20
|
tslib_1.__exportStar(require("./utils"), exports);
|
16
21
|
tslib_1.__exportStar(require("./replacement"), exports);
|
17
|
-
const TYPESCRIPT_VERSION = '5.
|
22
|
+
const TYPESCRIPT_VERSION = '5.5.4';
|
18
23
|
const argv = (0, minimist_1.default)(process.argv.slice(2));
|
19
24
|
const command = argv._[0];
|
20
25
|
const path = require('path'), semver = require("semver"), fs = require('fs'), processPath = process.cwd().replace(/\\/g, "/"), nodeSupportedVersion = '>=12.18.4';
|
@@ -26,7 +31,6 @@ function build(cb) {
|
|
26
31
|
initTasks();
|
27
32
|
triggerBuild(cb);
|
28
33
|
}
|
29
|
-
exports.build = build;
|
30
34
|
function clean(greeting = true) {
|
31
35
|
return new Promise((resolve, reject) => {
|
32
36
|
if (greeting) {
|
@@ -41,7 +45,6 @@ function clean(greeting = true) {
|
|
41
45
|
});
|
42
46
|
});
|
43
47
|
}
|
44
|
-
exports.clean = clean;
|
45
48
|
function serve() {
|
46
49
|
printLogo();
|
47
50
|
printVersion();
|
@@ -49,7 +52,6 @@ function serve() {
|
|
49
52
|
initTasks();
|
50
53
|
triggerServe();
|
51
54
|
}
|
52
|
-
exports.serve = serve;
|
53
55
|
function validateNodeSupportVersion() {
|
54
56
|
if (!semver.satisfies(process.version, nodeSupportedVersion)) {
|
55
57
|
throw new Error(`Your dev environment is running NodeJS version ${process.version} which does`
|
@@ -182,11 +184,9 @@ async function run() {
|
|
182
184
|
console.log(chalk_1.default.cyan(`omniafx v${require('@omnia/tooling/package.json').version}`));
|
183
185
|
}
|
184
186
|
}
|
185
|
-
exports.run = run;
|
186
187
|
function registerEsbuild(options = null) {
|
187
188
|
return require('./esbuild-register.custom').register(options || {});
|
188
189
|
}
|
189
|
-
exports.registerEsbuild = registerEsbuild;
|
190
190
|
function validate() {
|
191
191
|
let tsVersion = require('typescript/package.json').version;
|
192
192
|
if (tsVersion !== TYPESCRIPT_VERSION) {
|
@@ -1,6 +1,22 @@
|
|
1
1
|
'use strict';
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.LogTypes =
|
3
|
+
exports.LogTypes = void 0;
|
4
|
+
exports.generateguid = generateguid;
|
5
|
+
exports.asyncForEach = asyncForEach;
|
6
|
+
exports.ensureTraillingSlash = ensureTraillingSlash;
|
7
|
+
exports.registerLogToClient = registerLogToClient;
|
8
|
+
exports.rewriteFile = rewriteFile;
|
9
|
+
exports.getCurrentDateTime = getCurrentDateTime;
|
10
|
+
exports.timeWatch = timeWatch;
|
11
|
+
exports.root = root;
|
12
|
+
exports.isValidGuid = isValidGuid;
|
13
|
+
exports.isNull = isNull;
|
14
|
+
exports.isNullOrEmpty = isNullOrEmpty;
|
15
|
+
exports.getDirectories = getDirectories;
|
16
|
+
exports.getguid = getguid;
|
17
|
+
exports.getFileName = getFileName;
|
18
|
+
exports.logTime = logTime;
|
19
|
+
exports.log = log;
|
4
20
|
let path = require('path'), fs = require('fs'), timestamp = require('console-timestamp'), chalk = require('chalk'), _timer = {};
|
5
21
|
let _logToClientHandler = null;
|
6
22
|
var LogTypes;
|
@@ -20,7 +36,6 @@ function rewriteFile(args) {
|
|
20
36
|
var body = rewrite(args);
|
21
37
|
fs.writeFileSync(fullPath, body, 'utf8');
|
22
38
|
}
|
23
|
-
exports.rewriteFile = rewriteFile;
|
24
39
|
function escapeRegExp(str) {
|
25
40
|
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
26
41
|
}
|
@@ -62,7 +77,6 @@ function getCurrentDateTime() {
|
|
62
77
|
var d = new Date();
|
63
78
|
return d.getFullYear() + "-" + d.getMonth() + "-" + d.getDate() + " " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
|
64
79
|
}
|
65
|
-
exports.getCurrentDateTime = getCurrentDateTime;
|
66
80
|
function flatArrayFiles(listFiles) {
|
67
81
|
var flatFiles = "";
|
68
82
|
for (var i = 0; i < listFiles.length; i++) {
|
@@ -79,14 +93,12 @@ function timeWatch(timerId, callBack, msWait) {
|
|
79
93
|
}
|
80
94
|
_timer[timerId] = setTimeout(callBack, msWait);
|
81
95
|
}
|
82
|
-
exports.timeWatch = timeWatch;
|
83
96
|
// Helper functions
|
84
97
|
var ROOT = process.cwd();
|
85
98
|
function root(args) {
|
86
99
|
args = Array.prototype.slice.call(arguments, 0);
|
87
100
|
return path.join.apply(path, [ROOT].concat(args));
|
88
101
|
}
|
89
|
-
exports.root = root;
|
90
102
|
/**
|
91
103
|
* Generate relatively-safe guid
|
92
104
|
*/
|
@@ -99,7 +111,6 @@ function generateguid() {
|
|
99
111
|
});
|
100
112
|
return uuid;
|
101
113
|
}
|
102
|
-
exports.generateguid = generateguid;
|
103
114
|
;
|
104
115
|
function isValidGuid(value) {
|
105
116
|
if (!isNullOrEmpty(value)) {
|
@@ -108,23 +119,19 @@ function isValidGuid(value) {
|
|
108
119
|
}
|
109
120
|
return false;
|
110
121
|
}
|
111
|
-
exports.isValidGuid = isValidGuid;
|
112
122
|
function isNull(obj) {
|
113
123
|
if (obj === 0 || obj === false)
|
114
124
|
return false;
|
115
125
|
return (!obj || typeof obj === "undefined" || obj === null);
|
116
126
|
}
|
117
|
-
exports.isNull = isNull;
|
118
127
|
function isNullOrEmpty(obj) {
|
119
128
|
return isNull(obj) || obj === "";
|
120
129
|
}
|
121
|
-
exports.isNullOrEmpty = isNullOrEmpty;
|
122
130
|
function getDirectories(path) {
|
123
131
|
return fs.readdirSync(path).filter(function (file) {
|
124
132
|
return fs.statSync(path + '/' + file).isDirectory();
|
125
133
|
});
|
126
134
|
}
|
127
|
-
exports.getDirectories = getDirectories;
|
128
135
|
function getguid(value) {
|
129
136
|
if (value) {
|
130
137
|
let matchs = value.match(/([A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12})/i);
|
@@ -133,7 +140,6 @@ function getguid(value) {
|
|
133
140
|
}
|
134
141
|
return null;
|
135
142
|
}
|
136
|
-
exports.getguid = getguid;
|
137
143
|
function getFileName(source) {
|
138
144
|
if (source) {
|
139
145
|
let extension = path.extname(source);
|
@@ -141,7 +147,6 @@ function getFileName(source) {
|
|
141
147
|
}
|
142
148
|
return null;
|
143
149
|
}
|
144
|
-
exports.getFileName = getFileName;
|
145
150
|
function log(message, type = LogTypes.HeadLine, writeToClient = false) {
|
146
151
|
if (type === LogTypes.HeadLine) {
|
147
152
|
console.log(timestamp('[hh:mm:ss] ') + chalk.cyan(message));
|
@@ -159,25 +164,20 @@ function log(message, type = LogTypes.HeadLine, writeToClient = false) {
|
|
159
164
|
_logToClientHandler(message.toString(), type);
|
160
165
|
}
|
161
166
|
}
|
162
|
-
exports.log = log;
|
163
167
|
function logTime(message, start) {
|
164
168
|
if (start === null)
|
165
169
|
log(message + " after " + (new Date().getTime() - firstLoadedTime) + "ms TOTAL", LogTypes.HeadLine);
|
166
170
|
else
|
167
171
|
log(message + " after " + (new Date().getTime() - start) + "ms", LogTypes.HeadLine);
|
168
172
|
}
|
169
|
-
exports.logTime = logTime;
|
170
173
|
function registerLogToClient(handler) {
|
171
174
|
_logToClientHandler = handler;
|
172
175
|
}
|
173
|
-
exports.registerLogToClient = registerLogToClient;
|
174
176
|
function ensureTraillingSlash(path) {
|
175
177
|
return path.replace(/\/$|$/, '/');
|
176
178
|
}
|
177
|
-
exports.ensureTraillingSlash = ensureTraillingSlash;
|
178
179
|
async function asyncForEach(array, callback) {
|
179
180
|
for (let index = 0; index < array.length; index++) {
|
180
181
|
await callback(array[index], index, array);
|
181
182
|
}
|
182
183
|
}
|
183
|
-
exports.asyncForEach = asyncForEach;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@omnia/tooling",
|
3
3
|
"license": "MIT",
|
4
|
-
"version": "8.0.
|
4
|
+
"version": "8.0.258-dev",
|
5
5
|
"description": "Provide basic stuffs extensible for omnia extension.",
|
6
6
|
"scripts": {
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
@@ -26,7 +26,7 @@
|
|
26
26
|
},
|
27
27
|
"main": "index.js",
|
28
28
|
"dependencies": {
|
29
|
-
"@omnia/types": "8.0.
|
29
|
+
"@omnia/types": "8.0.258-dev",
|
30
30
|
"@types/node": "18.13.0",
|
31
31
|
"tslib": "2.6.2",
|
32
32
|
"typescript": "5.3.3",
|