@omnia/tooling 8.0.192-dev → 8.0.194-dev
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/internal-do-not-import-from-here/index.d.ts +1 -0
- package/internal-do-not-import-from-here/index.js +1 -0
- package/internal-do-not-import-from-here/replacement.d.ts +1 -0
- package/internal-do-not-import-from-here/replacement.js +36 -0
- package/internal-do-not-import-from-here/utils.d.ts +4 -3
- package/internal-do-not-import-from-here/utils.js +5 -5
- package/package.json +2 -2
@@ -13,6 +13,7 @@ exports.utils = utils;
|
|
13
13
|
const del_1 = tslib_1.__importDefault(require("del"));
|
14
14
|
tslib_1.__exportStar(require("./core"), exports);
|
15
15
|
tslib_1.__exportStar(require("./utils"), exports);
|
16
|
+
tslib_1.__exportStar(require("./replacement"), exports);
|
16
17
|
const TYPESCRIPT_VERSION = '5.3.3';
|
17
18
|
const argv = (0, minimist_1.default)(process.argv.slice(2));
|
18
19
|
const command = argv._[0];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function replaceTokens(content: string): string;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.replaceTokens = void 0;
|
4
|
+
globalThis["o$"] = {
|
5
|
+
enums: {}
|
6
|
+
};
|
7
|
+
function replaceTokens(content) {
|
8
|
+
return content.replace(new RegExp(`(o\\$.*)([a-z])`), function (token) {
|
9
|
+
if (token.indexOf("o$.") === 0) {
|
10
|
+
const result = getTokenValue(token);
|
11
|
+
if (typeof result === "string") {
|
12
|
+
return `"${result}"`;
|
13
|
+
}
|
14
|
+
return result;
|
15
|
+
}
|
16
|
+
return token;
|
17
|
+
});
|
18
|
+
}
|
19
|
+
exports.replaceTokens = replaceTokens;
|
20
|
+
function getTokenValue(token) {
|
21
|
+
const parts = token.split(".");
|
22
|
+
let value = globalThis;
|
23
|
+
parts.forEach(p => {
|
24
|
+
value = value[p];
|
25
|
+
});
|
26
|
+
// console.log(token, parts, value, (globalThis as any)["o$"])
|
27
|
+
return value;
|
28
|
+
}
|
29
|
+
function populateEnums(name) {
|
30
|
+
return {
|
31
|
+
value(data) {
|
32
|
+
globalThis["o$"].enums[name] = data;
|
33
|
+
}
|
34
|
+
};
|
35
|
+
}
|
36
|
+
globalThis["enum$"] = populateEnums;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { guid } from "@omnia/fx-models";
|
1
2
|
declare enum LogTypes {
|
2
3
|
Info = 1,
|
3
4
|
Warning = 2,
|
@@ -11,16 +12,16 @@ declare function root(args: any): any;
|
|
11
12
|
/**
|
12
13
|
* Generate relatively-safe guid
|
13
14
|
*/
|
14
|
-
export declare function
|
15
|
+
export declare function generateguid(): string;
|
15
16
|
declare function isValidGuid(value: any): boolean;
|
16
17
|
declare function isNull(obj: any): boolean;
|
17
18
|
declare function isNullOrEmpty(obj: any): boolean;
|
18
19
|
declare function getDirectories(path: any): any;
|
19
|
-
declare function
|
20
|
+
declare function getguid(value: string): guid;
|
20
21
|
declare function getFileName(source: string): any;
|
21
22
|
declare function log(message: any, type?: LogTypes, writeToClient?: boolean): void;
|
22
23
|
declare function logTime(message: string, start: number): void;
|
23
24
|
declare function registerLogToClient(handler: (message: string, logType?: LogTypes) => void): void;
|
24
25
|
declare function ensureTraillingSlash(path: string): string;
|
25
26
|
export declare function asyncForEach<T>(array: Array<T>, callback: (item: T, index?: number, items?: Array<T>) => Promise<void>): Promise<void>;
|
26
|
-
export { ensureTraillingSlash, registerLogToClient, rewriteFile, getCurrentDateTime, timeWatch, root, isValidGuid, isNull, isNullOrEmpty, getDirectories,
|
27
|
+
export { ensureTraillingSlash, registerLogToClient, rewriteFile, getCurrentDateTime, timeWatch, root, isValidGuid, isNull, isNullOrEmpty, getDirectories, getguid, getFileName, logTime, log, LogTypes };
|
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.LogTypes = exports.log = exports.logTime = exports.getFileName = exports.
|
3
|
+
exports.LogTypes = exports.log = exports.logTime = exports.getFileName = exports.getguid = exports.getDirectories = exports.isNullOrEmpty = exports.isNull = exports.isValidGuid = exports.root = exports.timeWatch = exports.getCurrentDateTime = exports.rewriteFile = exports.registerLogToClient = exports.ensureTraillingSlash = exports.asyncForEach = exports.generateguid = void 0;
|
4
4
|
let path = require('path'), fs = require('fs'), timestamp = require('console-timestamp'), chalk = require('chalk'), _timer = {};
|
5
5
|
let _logToClientHandler = null;
|
6
6
|
var LogTypes;
|
@@ -90,7 +90,7 @@ exports.root = root;
|
|
90
90
|
/**
|
91
91
|
* Generate relatively-safe guid
|
92
92
|
*/
|
93
|
-
function
|
93
|
+
function generateguid() {
|
94
94
|
var d = new Date().getTime();
|
95
95
|
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
96
96
|
var r = (d + Math.random() * 16) % 16 | 0;
|
@@ -99,7 +99,7 @@ function generateGuid() {
|
|
99
99
|
});
|
100
100
|
return uuid;
|
101
101
|
}
|
102
|
-
exports.
|
102
|
+
exports.generateguid = generateguid;
|
103
103
|
;
|
104
104
|
function isValidGuid(value) {
|
105
105
|
if (!isNullOrEmpty(value)) {
|
@@ -125,7 +125,7 @@ function getDirectories(path) {
|
|
125
125
|
});
|
126
126
|
}
|
127
127
|
exports.getDirectories = getDirectories;
|
128
|
-
function
|
128
|
+
function getguid(value) {
|
129
129
|
if (value) {
|
130
130
|
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);
|
131
131
|
if (matchs)
|
@@ -133,7 +133,7 @@ function getGuidValue(value) {
|
|
133
133
|
}
|
134
134
|
return null;
|
135
135
|
}
|
136
|
-
exports.
|
136
|
+
exports.getguid = getguid;
|
137
137
|
function getFileName(source) {
|
138
138
|
if (source) {
|
139
139
|
let extension = path.extname(source);
|
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.194-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.194-dev",
|
30
30
|
"@types/node": "18.13.0",
|
31
31
|
"tslib": "2.6.2",
|
32
32
|
"typescript": "5.3.3",
|