@stemy/ngx-utils 10.2.44 → 10.3.3
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 +27 -27
- package/bundles/stemy-ngx-utils.umd.js +5654 -5640
- package/bundles/stemy-ngx-utils.umd.js.map +1 -1
- package/bundles/stemy-ngx-utils.umd.min.js +1 -1
- package/bundles/stemy-ngx-utils.umd.min.js.map +1 -1
- package/esm2015/ngx-utils/common-types.js +111 -111
- package/esm2015/ngx-utils/components/dynamic-table/dynamic-table.component.js +139 -139
- package/esm2015/ngx-utils/components/pagination-menu/pagination-menu.component.js +96 -96
- package/esm2015/ngx-utils/components/unordered-list/unordered-list.component.js +51 -51
- package/esm2015/ngx-utils/directives/async-method.directive.js +58 -58
- package/esm2015/ngx-utils/directives/background.directive.js +51 -51
- package/esm2015/ngx-utils/directives/dynamic-table-template.directive.js +19 -19
- package/esm2015/ngx-utils/directives/global-template.directive.js +27 -27
- package/esm2015/ngx-utils/directives/icon.directive.js +59 -59
- package/esm2015/ngx-utils/directives/ngx-template-outlet.directive.js +88 -88
- package/esm2015/ngx-utils/directives/pagination-item.directive.js +33 -33
- package/esm2015/ngx-utils/directives/pagination.directive.js +76 -71
- package/esm2015/ngx-utils/directives/resource-if.directive.js +51 -51
- package/esm2015/ngx-utils/directives/sticky-class.directive.js +35 -35
- package/esm2015/ngx-utils/directives/sticky.directive.js +48 -48
- package/esm2015/ngx-utils/directives/unordered-list-item.directive.js +70 -70
- package/esm2015/ngx-utils/directives/unordered-list-template.directive.js +26 -26
- package/esm2015/ngx-utils/ngx-utils.module.js +232 -232
- package/esm2015/ngx-utils/pipes/chunk.pipe.js +21 -21
- package/esm2015/ngx-utils/pipes/entries.pipe.js +24 -24
- package/esm2015/ngx-utils/pipes/extra-item-properties.pipe.js +27 -27
- package/esm2015/ngx-utils/pipes/filter.pipe.js +38 -38
- package/esm2015/ngx-utils/pipes/find.pipe.js +25 -25
- package/esm2015/ngx-utils/pipes/format-number.pipe.js +19 -19
- package/esm2015/ngx-utils/pipes/get-offset.pipe.js +13 -13
- package/esm2015/ngx-utils/pipes/get-type.pipe.js +12 -12
- package/esm2015/ngx-utils/pipes/global-template.pipe.js +35 -35
- package/esm2015/ngx-utils/pipes/group-by.pipe.js +23 -23
- package/esm2015/ngx-utils/pipes/is-type.pipe.js +12 -12
- package/esm2015/ngx-utils/pipes/join.pipe.js +15 -15
- package/esm2015/ngx-utils/pipes/keys.pipe.js +18 -18
- package/esm2015/ngx-utils/pipes/map.pipe.js +25 -25
- package/esm2015/ngx-utils/pipes/max.pipe.js +22 -22
- package/esm2015/ngx-utils/pipes/min.pipe.js +22 -22
- package/esm2015/ngx-utils/pipes/reduce.pipe.js +26 -26
- package/esm2015/ngx-utils/pipes/remap.pipe.js +28 -28
- package/esm2015/ngx-utils/pipes/replace.pipe.js +12 -12
- package/esm2015/ngx-utils/pipes/reverse.pipe.js +20 -20
- package/esm2015/ngx-utils/pipes/round.pipe.js +19 -19
- package/esm2015/ngx-utils/pipes/safe-html.pipe.js +32 -32
- package/esm2015/ngx-utils/pipes/translate.pipe.js +81 -81
- package/esm2015/ngx-utils/pipes/values.pipe.js +18 -18
- package/esm2015/ngx-utils/plugins/resize-event.plugin.js +59 -59
- package/esm2015/ngx-utils/plugins/scroll-event.plugin.js +52 -52
- package/esm2015/ngx-utils/services/acl.service.js +78 -78
- package/esm2015/ngx-utils/services/api.service.js +35 -35
- package/esm2015/ngx-utils/services/auth.service.js +14 -14
- package/esm2015/ngx-utils/services/base-http.client.js +46 -46
- package/esm2015/ngx-utils/services/base-http.service.js +274 -274
- package/esm2015/ngx-utils/services/config.service.js +95 -95
- package/esm2015/ngx-utils/services/error-handler.service.js +49 -49
- package/esm2015/ngx-utils/services/events.service.js +24 -24
- package/esm2015/ngx-utils/services/formatter.service.js +44 -44
- package/esm2015/ngx-utils/services/global-template.service.js +35 -35
- package/esm2015/ngx-utils/services/icon.service.js +24 -24
- package/esm2015/ngx-utils/services/language.service.js +117 -117
- package/esm2015/ngx-utils/services/open-api.service.js +41 -41
- package/esm2015/ngx-utils/services/promise.service.js +49 -49
- package/esm2015/ngx-utils/services/state.service.js +143 -143
- package/esm2015/ngx-utils/services/static-language.service.js +144 -144
- package/esm2015/ngx-utils/services/storage.service.js +48 -48
- package/esm2015/ngx-utils/services/toaster.service.js +29 -29
- package/esm2015/ngx-utils/services/translated-url.serializer.js +70 -70
- package/esm2015/ngx-utils/services/universal.service.js +73 -73
- package/esm2015/ngx-utils/utils/ajax-request-handler.js +40 -40
- package/esm2015/ngx-utils/utils/array.utils.js +100 -90
- package/esm2015/ngx-utils/utils/auth.guard.js +153 -153
- package/esm2015/ngx-utils/utils/canvas.utils.js +388 -388
- package/esm2015/ngx-utils/utils/date.utils.js +28 -28
- package/esm2015/ngx-utils/utils/file.utils.js +90 -90
- package/esm2015/ngx-utils/utils/generic-value.js +20 -20
- package/esm2015/ngx-utils/utils/geometry.js +132 -132
- package/esm2015/ngx-utils/utils/initializer.js +17 -17
- package/esm2015/ngx-utils/utils/loader.utils.js +55 -55
- package/esm2015/ngx-utils/utils/math.utils.js +15 -15
- package/esm2015/ngx-utils/utils/object.utils.js +248 -248
- package/esm2015/ngx-utils/utils/observable.utils.js +63 -63
- package/esm2015/ngx-utils/utils/reflect.utils.js +33 -33
- package/esm2015/ngx-utils/utils/set.utils.js +20 -20
- package/esm2015/ngx-utils/utils/string.utils.js +28 -28
- package/esm2015/ngx-utils/utils/timer.utils.js +52 -52
- package/esm2015/ngx-utils/utils/unique.utils.js +24 -24
- package/esm2015/ngx-utils/utils/vector.js +77 -77
- package/esm2015/public_api.js +83 -83
- package/esm2015/stemy-ngx-utils.js +7 -7
- package/fesm2015/stemy-ngx-utils.js +4552 -4537
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/common-types.d.ts +284 -284
- package/ngx-utils/components/dynamic-table/dynamic-table.component.d.ts +43 -43
- package/ngx-utils/components/pagination-menu/pagination-menu.component.d.ts +28 -28
- package/ngx-utils/components/unordered-list/unordered-list.component.d.ts +22 -22
- package/ngx-utils/directives/async-method.directive.d.ts +16 -16
- package/ngx-utils/directives/background.directive.d.ts +14 -14
- package/ngx-utils/directives/dynamic-table-template.directive.d.ts +8 -8
- package/ngx-utils/directives/global-template.directive.d.ts +10 -10
- package/ngx-utils/directives/icon.directive.d.ts +20 -20
- package/ngx-utils/directives/ngx-template-outlet.directive.d.ts +14 -14
- package/ngx-utils/directives/pagination-item.directive.d.ts +12 -12
- package/ngx-utils/directives/pagination.directive.d.ts +22 -21
- package/ngx-utils/directives/resource-if.directive.d.ts +16 -16
- package/ngx-utils/directives/sticky-class.directive.d.ts +12 -12
- package/ngx-utils/directives/sticky.directive.d.ts +16 -16
- package/ngx-utils/directives/unordered-list-item.directive.d.ts +25 -25
- package/ngx-utils/directives/unordered-list-template.directive.d.ts +10 -10
- package/ngx-utils/ngx-utils.module.d.ts +76 -76
- package/ngx-utils/pipes/chunk.pipe.d.ts +4 -4
- package/ngx-utils/pipes/entries.pipe.d.ts +9 -9
- package/ngx-utils/pipes/extra-item-properties.pipe.d.ts +5 -5
- package/ngx-utils/pipes/filter.pipe.d.ts +5 -5
- package/ngx-utils/pipes/find.pipe.d.ts +5 -5
- package/ngx-utils/pipes/format-number.pipe.d.ts +7 -7
- package/ngx-utils/pipes/get-offset.pipe.d.ts +4 -4
- package/ngx-utils/pipes/get-type.pipe.d.ts +4 -4
- package/ngx-utils/pipes/global-template.pipe.d.ts +13 -13
- package/ngx-utils/pipes/group-by.pipe.d.ts +5 -5
- package/ngx-utils/pipes/is-type.pipe.d.ts +4 -4
- package/ngx-utils/pipes/join.pipe.d.ts +4 -4
- package/ngx-utils/pipes/keys.pipe.d.ts +4 -4
- package/ngx-utils/pipes/map.pipe.d.ts +5 -5
- package/ngx-utils/pipes/max.pipe.d.ts +4 -4
- package/ngx-utils/pipes/min.pipe.d.ts +4 -4
- package/ngx-utils/pipes/reduce.pipe.d.ts +5 -5
- package/ngx-utils/pipes/remap.pipe.d.ts +4 -4
- package/ngx-utils/pipes/replace.pipe.d.ts +4 -4
- package/ngx-utils/pipes/reverse.pipe.d.ts +4 -4
- package/ngx-utils/pipes/round.pipe.d.ts +7 -7
- package/ngx-utils/pipes/safe-html.pipe.d.ts +7 -7
- package/ngx-utils/pipes/translate.pipe.d.ts +15 -15
- package/ngx-utils/pipes/values.pipe.d.ts +4 -4
- package/ngx-utils/plugins/resize-event.plugin.d.ts +10 -10
- package/ngx-utils/plugins/scroll-event.plugin.d.ts +11 -11
- package/ngx-utils/services/acl.service.d.ts +12 -12
- package/ngx-utils/services/api.service.d.ts +14 -14
- package/ngx-utils/services/auth.service.d.ts +8 -8
- package/ngx-utils/services/base-http.client.d.ts +12 -12
- package/ngx-utils/services/base-http.service.d.ts +42 -42
- package/ngx-utils/services/config.service.d.ts +21 -21
- package/ngx-utils/services/error-handler.service.d.ts +10 -10
- package/ngx-utils/services/events.service.d.ts +11 -11
- package/ngx-utils/services/formatter.service.d.ts +12 -12
- package/ngx-utils/services/global-template.service.d.ts +16 -16
- package/ngx-utils/services/icon.service.d.ts +10 -10
- package/ngx-utils/services/language.service.d.ts +18 -18
- package/ngx-utils/services/open-api.service.d.ts +8 -8
- package/ngx-utils/services/promise.service.d.ts +15 -15
- package/ngx-utils/services/state.service.d.ts +41 -41
- package/ngx-utils/services/static-language.service.d.ts +41 -41
- package/ngx-utils/services/storage.service.d.ts +12 -12
- package/ngx-utils/services/toaster.service.d.ts +10 -10
- package/ngx-utils/services/translated-url.serializer.d.ts +16 -16
- package/ngx-utils/services/universal.service.d.ts +24 -24
- package/ngx-utils/utils/ajax-request-handler.d.ts +11 -11
- package/ngx-utils/utils/array.utils.d.ts +10 -9
- package/ngx-utils/utils/auth.guard.d.ts +26 -26
- package/ngx-utils/utils/canvas.utils.d.ts +13 -13
- package/ngx-utils/utils/date.utils.d.ts +8 -8
- package/ngx-utils/utils/file.utils.d.ts +14 -14
- package/ngx-utils/utils/generic-value.d.ts +8 -8
- package/ngx-utils/utils/geometry.d.ts +50 -50
- package/ngx-utils/utils/initializer.d.ts +11 -11
- package/ngx-utils/utils/loader.utils.d.ts +7 -7
- package/ngx-utils/utils/math.utils.d.ts +5 -5
- package/ngx-utils/utils/object.utils.d.ts +31 -31
- package/ngx-utils/utils/observable.utils.d.ts +12 -12
- package/ngx-utils/utils/reflect.utils.d.ts +9 -9
- package/ngx-utils/utils/set.utils.d.ts +4 -4
- package/ngx-utils/utils/string.utils.d.ts +7 -7
- package/ngx-utils/utils/timer.utils.d.ts +6 -6
- package/ngx-utils/utils/unique.utils.d.ts +5 -5
- package/ngx-utils/utils/vector.d.ts +23 -23
- package/package.json +1 -1
- package/public_api.d.ts +82 -82
- package/stemy-ngx-utils.d.ts +6 -6
- package/stemy-ngx-utils.metadata.json +1 -1
- package/tools/circular.js +116 -116
- package/tools/config.js +78 -78
- package/tools/icons.js +13 -13
package/tools/circular.js
CHANGED
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const args = process.argv.slice(2);
|
|
6
|
-
const basePath = args[0];
|
|
7
|
-
const scripts = [];
|
|
8
|
-
// Recursively find ts files in the given path
|
|
9
|
-
function readDir(dirPath) {
|
|
10
|
-
const paths = fs.readdirSync(dirPath);
|
|
11
|
-
paths.forEach(p => {
|
|
12
|
-
const subPath = path.join(dirPath, p);
|
|
13
|
-
const stats = fs.lstatSync(subPath);
|
|
14
|
-
if (stats.isDirectory()) {
|
|
15
|
-
readDir(subPath);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
if (path.extname(subPath) == ".ts" && path.basename(subPath).indexOf("spec.") < 0 && path.basename(subPath).indexOf("test.") < 0) {
|
|
19
|
-
scripts.push(subPath);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
const depMap = {};
|
|
24
|
-
let recursions = 0;
|
|
25
|
-
function matchSymbolReferences(scriptPath, content, symbol) {
|
|
26
|
-
const regex = new RegExp(": " + symbol + "(?:;|,|\\)| {)", "g");
|
|
27
|
-
const nl = "\n";
|
|
28
|
-
let match = regex.exec(content);
|
|
29
|
-
while (match !== null) {
|
|
30
|
-
let index = match.index;
|
|
31
|
-
const lines = content.substr(0, index).split(nl);
|
|
32
|
-
const line = lines.length;
|
|
33
|
-
while (lines.length > 1) {
|
|
34
|
-
index -= (lines.shift().length + nl.length);
|
|
35
|
-
}
|
|
36
|
-
index += nl.length + 2;
|
|
37
|
-
console.log("Circular dependency found!", symbol, scriptPath, `${line}:${index}`);
|
|
38
|
-
match = regex.exec(content);
|
|
39
|
-
recursions++;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function matchSymbols(scriptPath, content, regex) {
|
|
43
|
-
let match = regex.exec(content);
|
|
44
|
-
while (match !== null) {
|
|
45
|
-
matchSymbolReferences(scriptPath, content.substr(0, match.index), match[1]);
|
|
46
|
-
match = regex.exec(content);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function matchPropertyBindFunctions(scriptPath, content) {
|
|
50
|
-
const regex = /((?:[a-z]|[A-Z]|[0-9]|_|-|\.)*) = \((?:(?:[a-z]|[A-Z]|[0-9]|_|,|:)*)\): (?:(?:[a-z]|[A-Z]|[0-9]|_|-|\.)*) =>/g;
|
|
51
|
-
const nl = "\n";
|
|
52
|
-
let match = regex.exec(content);
|
|
53
|
-
while (match !== null) {
|
|
54
|
-
let index = match.index;
|
|
55
|
-
const lines = content.substr(0, index).split(nl);
|
|
56
|
-
const line = lines.length;
|
|
57
|
-
while (lines.length > 1) {
|
|
58
|
-
index -= (lines.shift().length + nl.length);
|
|
59
|
-
}
|
|
60
|
-
index += nl.length + 2;
|
|
61
|
-
console.log("Property bind function found!", match[1], scriptPath, `${line}:${index}`);
|
|
62
|
-
match = regex.exec(content);
|
|
63
|
-
recursions++;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function matchFileReferences(scriptDir, content, mapItem, regex) {
|
|
67
|
-
let match = regex.exec(content);
|
|
68
|
-
while (match !== null) {
|
|
69
|
-
const importedScript = path.join(scriptDir, match[1]);
|
|
70
|
-
mapItem.push(fs.existsSync(importedScript) ? path.join(importedScript, "index.ts") : `${importedScript}.ts`);
|
|
71
|
-
match = regex.exec(content);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function readScript(scriptPath) {
|
|
75
|
-
// Read file
|
|
76
|
-
const scriptDir = path.dirname(scriptPath);
|
|
77
|
-
const content = fs.readFileSync(scriptPath, "utf8");
|
|
78
|
-
const mapItem = depMap[scriptPath] || [];
|
|
79
|
-
// Find classes, interfaces
|
|
80
|
-
matchSymbols(scriptPath, content, /(?:class|interface) ((?:[a-z]|[A-Z]|[0-9]|_|-|\.)*) (?:(?:implements |extends )(?:(?:(?:[a-z]|[A-Z]|[0-9]|_|-|\.)*)(, | ))+){0,2}{/g);
|
|
81
|
-
// Find types
|
|
82
|
-
matchSymbols(scriptPath, content, /type ((?:[a-z]|[A-Z]|[0-9]|_|-|\.)*) =/g);
|
|
83
|
-
// Find property bind functions
|
|
84
|
-
matchPropertyBindFunctions(scriptPath, content);
|
|
85
|
-
// Find imports
|
|
86
|
-
matchFileReferences(scriptDir, content, mapItem, /import {(?:[a-z]|[A-Z]|[0-9]|_|-|\.|\*)*} from "(\..*)"/g);
|
|
87
|
-
// Find exports
|
|
88
|
-
matchFileReferences(scriptDir, content, mapItem, /export \* from "(\..*)"/g);
|
|
89
|
-
depMap[scriptPath] = mapItem;
|
|
90
|
-
}
|
|
91
|
-
function findRecursion(scriptPath, path, dependents, visitedFiles) {
|
|
92
|
-
dependents.forEach(dep => {
|
|
93
|
-
if (visitedFiles.has(dep))
|
|
94
|
-
return;
|
|
95
|
-
visitedFiles.add(dep);
|
|
96
|
-
const subPath = Array.from(path);
|
|
97
|
-
subPath.push(dep);
|
|
98
|
-
if (scriptPath == dep) {
|
|
99
|
-
console.log("Circular dependency found!", subPath.join(" -> "));
|
|
100
|
-
recursions++;
|
|
101
|
-
}
|
|
102
|
-
if (!depMap[dep])
|
|
103
|
-
return;
|
|
104
|
-
findRecursion(scriptPath, subPath, depMap[dep], visitedFiles);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
// Find ts files
|
|
108
|
-
readDir(basePath);
|
|
109
|
-
// Build depMap
|
|
110
|
-
scripts.forEach(readScript);
|
|
111
|
-
// Find recursions
|
|
112
|
-
Object.keys(depMap).forEach(scriptPath => findRecursion(scriptPath, [scriptPath], depMap[scriptPath], new Set()));
|
|
113
|
-
if (recursions == 0) {
|
|
114
|
-
console.log("No circular dependency found!");
|
|
115
|
-
}
|
|
116
|
-
// fs.writeFileSync(path.join(basePath, "deps.json"), JSON.stringify(depMap, null, 2));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const basePath = args[0];
|
|
7
|
+
const scripts = [];
|
|
8
|
+
// Recursively find ts files in the given path
|
|
9
|
+
function readDir(dirPath) {
|
|
10
|
+
const paths = fs.readdirSync(dirPath);
|
|
11
|
+
paths.forEach(p => {
|
|
12
|
+
const subPath = path.join(dirPath, p);
|
|
13
|
+
const stats = fs.lstatSync(subPath);
|
|
14
|
+
if (stats.isDirectory()) {
|
|
15
|
+
readDir(subPath);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (path.extname(subPath) == ".ts" && path.basename(subPath).indexOf("spec.") < 0 && path.basename(subPath).indexOf("test.") < 0) {
|
|
19
|
+
scripts.push(subPath);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const depMap = {};
|
|
24
|
+
let recursions = 0;
|
|
25
|
+
function matchSymbolReferences(scriptPath, content, symbol) {
|
|
26
|
+
const regex = new RegExp(": " + symbol + "(?:;|,|\\)| {)", "g");
|
|
27
|
+
const nl = "\n";
|
|
28
|
+
let match = regex.exec(content);
|
|
29
|
+
while (match !== null) {
|
|
30
|
+
let index = match.index;
|
|
31
|
+
const lines = content.substr(0, index).split(nl);
|
|
32
|
+
const line = lines.length;
|
|
33
|
+
while (lines.length > 1) {
|
|
34
|
+
index -= (lines.shift().length + nl.length);
|
|
35
|
+
}
|
|
36
|
+
index += nl.length + 2;
|
|
37
|
+
console.log("Circular dependency found!", symbol, scriptPath, `${line}:${index}`);
|
|
38
|
+
match = regex.exec(content);
|
|
39
|
+
recursions++;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function matchSymbols(scriptPath, content, regex) {
|
|
43
|
+
let match = regex.exec(content);
|
|
44
|
+
while (match !== null) {
|
|
45
|
+
matchSymbolReferences(scriptPath, content.substr(0, match.index), match[1]);
|
|
46
|
+
match = regex.exec(content);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function matchPropertyBindFunctions(scriptPath, content) {
|
|
50
|
+
const regex = /((?:[a-z]|[A-Z]|[0-9]|_|-|\.)*) = \((?:(?:[a-z]|[A-Z]|[0-9]|_|,|:)*)\): (?:(?:[a-z]|[A-Z]|[0-9]|_|-|\.)*) =>/g;
|
|
51
|
+
const nl = "\n";
|
|
52
|
+
let match = regex.exec(content);
|
|
53
|
+
while (match !== null) {
|
|
54
|
+
let index = match.index;
|
|
55
|
+
const lines = content.substr(0, index).split(nl);
|
|
56
|
+
const line = lines.length;
|
|
57
|
+
while (lines.length > 1) {
|
|
58
|
+
index -= (lines.shift().length + nl.length);
|
|
59
|
+
}
|
|
60
|
+
index += nl.length + 2;
|
|
61
|
+
console.log("Property bind function found!", match[1], scriptPath, `${line}:${index}`);
|
|
62
|
+
match = regex.exec(content);
|
|
63
|
+
recursions++;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function matchFileReferences(scriptDir, content, mapItem, regex) {
|
|
67
|
+
let match = regex.exec(content);
|
|
68
|
+
while (match !== null) {
|
|
69
|
+
const importedScript = path.join(scriptDir, match[1]);
|
|
70
|
+
mapItem.push(fs.existsSync(importedScript) ? path.join(importedScript, "index.ts") : `${importedScript}.ts`);
|
|
71
|
+
match = regex.exec(content);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function readScript(scriptPath) {
|
|
75
|
+
// Read file
|
|
76
|
+
const scriptDir = path.dirname(scriptPath);
|
|
77
|
+
const content = fs.readFileSync(scriptPath, "utf8");
|
|
78
|
+
const mapItem = depMap[scriptPath] || [];
|
|
79
|
+
// Find classes, interfaces
|
|
80
|
+
matchSymbols(scriptPath, content, /(?:class|interface) ((?:[a-z]|[A-Z]|[0-9]|_|-|\.)*) (?:(?:implements |extends )(?:(?:(?:[a-z]|[A-Z]|[0-9]|_|-|\.)*)(, | ))+){0,2}{/g);
|
|
81
|
+
// Find types
|
|
82
|
+
matchSymbols(scriptPath, content, /type ((?:[a-z]|[A-Z]|[0-9]|_|-|\.)*) =/g);
|
|
83
|
+
// Find property bind functions
|
|
84
|
+
matchPropertyBindFunctions(scriptPath, content);
|
|
85
|
+
// Find imports
|
|
86
|
+
matchFileReferences(scriptDir, content, mapItem, /import {(?:[a-z]|[A-Z]|[0-9]|_|-|\.|\*)*} from "(\..*)"/g);
|
|
87
|
+
// Find exports
|
|
88
|
+
matchFileReferences(scriptDir, content, mapItem, /export \* from "(\..*)"/g);
|
|
89
|
+
depMap[scriptPath] = mapItem;
|
|
90
|
+
}
|
|
91
|
+
function findRecursion(scriptPath, path, dependents, visitedFiles) {
|
|
92
|
+
dependents.forEach(dep => {
|
|
93
|
+
if (visitedFiles.has(dep))
|
|
94
|
+
return;
|
|
95
|
+
visitedFiles.add(dep);
|
|
96
|
+
const subPath = Array.from(path);
|
|
97
|
+
subPath.push(dep);
|
|
98
|
+
if (scriptPath == dep) {
|
|
99
|
+
console.log("Circular dependency found!", subPath.join(" -> "));
|
|
100
|
+
recursions++;
|
|
101
|
+
}
|
|
102
|
+
if (!depMap[dep])
|
|
103
|
+
return;
|
|
104
|
+
findRecursion(scriptPath, subPath, depMap[dep], visitedFiles);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// Find ts files
|
|
108
|
+
readDir(basePath);
|
|
109
|
+
// Build depMap
|
|
110
|
+
scripts.forEach(readScript);
|
|
111
|
+
// Find recursions
|
|
112
|
+
Object.keys(depMap).forEach(scriptPath => findRecursion(scriptPath, [scriptPath], depMap[scriptPath], new Set()));
|
|
113
|
+
if (recursions == 0) {
|
|
114
|
+
console.log("No circular dependency found!");
|
|
115
|
+
}
|
|
116
|
+
// fs.writeFileSync(path.join(basePath, "deps.json"), JSON.stringify(depMap, null, 2));
|
|
117
117
|
//# sourceMappingURL=circular.js.map
|
package/tools/config.js
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createConfig = exports.parseConfig = exports.isDate = exports.isPrimitive = void 0;
|
|
4
|
-
function isPrimitive(value) {
|
|
5
|
-
const type = typeof value;
|
|
6
|
-
return value == null || (type !== "object" && type !== "function");
|
|
7
|
-
}
|
|
8
|
-
exports.isPrimitive = isPrimitive;
|
|
9
|
-
function isDate(value) {
|
|
10
|
-
return null !== value && !isNaN(value) && "undefined" !== typeof value.getDate;
|
|
11
|
-
}
|
|
12
|
-
exports.isDate = isDate;
|
|
13
|
-
function convertValue(value, type) {
|
|
14
|
-
switch (type) {
|
|
15
|
-
case "boolean":
|
|
16
|
-
value = typeof value == "string" ? value.toLowerCase() : value;
|
|
17
|
-
return (value == "no" || value == "false" || value == "0") ? false : !!value;
|
|
18
|
-
case "number":
|
|
19
|
-
const val = parseFloat(value);
|
|
20
|
-
return isNaN(val) ? 0 : val;
|
|
21
|
-
}
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
function getFromEnv(path, alternatives, value) {
|
|
25
|
-
const name = path.replace(/\.?([A-Z|0-9]+)/g, function (x, y) {
|
|
26
|
-
return "_" + y.toLowerCase();
|
|
27
|
-
}).replace(/\./gi, "_").replace(/^_/, "").toUpperCase();
|
|
28
|
-
const alts = Array.from(alternatives[name] || []);
|
|
29
|
-
alts.unshift(name);
|
|
30
|
-
for (const envName of alts) {
|
|
31
|
-
const envValue = process.env[envName];
|
|
32
|
-
if (typeof envValue !== "undefined") {
|
|
33
|
-
const val = convertValue(envValue, typeof value);
|
|
34
|
-
console.log(name, envName, val);
|
|
35
|
-
return convertValue(envValue, typeof value);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
console.log(name, value);
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
41
|
-
function createConfigRecursive(target, source, path, alternatives) {
|
|
42
|
-
if (isPrimitive(source) || isDate(source)) {
|
|
43
|
-
return getFromEnv(path, alternatives, source);
|
|
44
|
-
}
|
|
45
|
-
if (Array.isArray(source)) {
|
|
46
|
-
target = Array.isArray(target) ? Array.from(target) : [];
|
|
47
|
-
source.forEach((item, index) => {
|
|
48
|
-
if (target.length > index)
|
|
49
|
-
target[index] = createConfigRecursive(target[index], item, !path ? `${index}` : `${path}.${index}`, alternatives);
|
|
50
|
-
else
|
|
51
|
-
target.push(createConfigRecursive(null, item, !path ? `${index}` : `${path}.${index}`, alternatives));
|
|
52
|
-
});
|
|
53
|
-
return target;
|
|
54
|
-
}
|
|
55
|
-
return Object.keys(source).reduce((result, key) => {
|
|
56
|
-
result[key] = createConfigRecursive(result[key], source[key], !path ? `${key}` : `${path}.${key}`, alternatives);
|
|
57
|
-
return result;
|
|
58
|
-
}, Object.assign({}, target));
|
|
59
|
-
}
|
|
60
|
-
function parseConfig(config) {
|
|
61
|
-
if (typeof config == "string") {
|
|
62
|
-
try {
|
|
63
|
-
config = JSON.parse(config);
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
return {};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return config;
|
|
70
|
-
}
|
|
71
|
-
exports.parseConfig = parseConfig;
|
|
72
|
-
function createConfig(config, alternatives) {
|
|
73
|
-
alternatives = alternatives || {};
|
|
74
|
-
console.log("Parsing config...");
|
|
75
|
-
return createConfigRecursive(null, parseConfig(config), "", alternatives);
|
|
76
|
-
}
|
|
77
|
-
exports.createConfig = createConfig;
|
|
78
|
-
exports.default = createConfig;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createConfig = exports.parseConfig = exports.isDate = exports.isPrimitive = void 0;
|
|
4
|
+
function isPrimitive(value) {
|
|
5
|
+
const type = typeof value;
|
|
6
|
+
return value == null || (type !== "object" && type !== "function");
|
|
7
|
+
}
|
|
8
|
+
exports.isPrimitive = isPrimitive;
|
|
9
|
+
function isDate(value) {
|
|
10
|
+
return null !== value && !isNaN(value) && "undefined" !== typeof value.getDate;
|
|
11
|
+
}
|
|
12
|
+
exports.isDate = isDate;
|
|
13
|
+
function convertValue(value, type) {
|
|
14
|
+
switch (type) {
|
|
15
|
+
case "boolean":
|
|
16
|
+
value = typeof value == "string" ? value.toLowerCase() : value;
|
|
17
|
+
return (value == "no" || value == "false" || value == "0") ? false : !!value;
|
|
18
|
+
case "number":
|
|
19
|
+
const val = parseFloat(value);
|
|
20
|
+
return isNaN(val) ? 0 : val;
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
function getFromEnv(path, alternatives, value) {
|
|
25
|
+
const name = path.replace(/\.?([A-Z|0-9]+)/g, function (x, y) {
|
|
26
|
+
return "_" + y.toLowerCase();
|
|
27
|
+
}).replace(/\./gi, "_").replace(/^_/, "").toUpperCase();
|
|
28
|
+
const alts = Array.from(alternatives[name] || []);
|
|
29
|
+
alts.unshift(name);
|
|
30
|
+
for (const envName of alts) {
|
|
31
|
+
const envValue = process.env[envName];
|
|
32
|
+
if (typeof envValue !== "undefined") {
|
|
33
|
+
const val = convertValue(envValue, typeof value);
|
|
34
|
+
console.log(name, envName, val);
|
|
35
|
+
return convertValue(envValue, typeof value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
console.log(name, value);
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
function createConfigRecursive(target, source, path, alternatives) {
|
|
42
|
+
if (isPrimitive(source) || isDate(source)) {
|
|
43
|
+
return getFromEnv(path, alternatives, source);
|
|
44
|
+
}
|
|
45
|
+
if (Array.isArray(source)) {
|
|
46
|
+
target = Array.isArray(target) ? Array.from(target) : [];
|
|
47
|
+
source.forEach((item, index) => {
|
|
48
|
+
if (target.length > index)
|
|
49
|
+
target[index] = createConfigRecursive(target[index], item, !path ? `${index}` : `${path}.${index}`, alternatives);
|
|
50
|
+
else
|
|
51
|
+
target.push(createConfigRecursive(null, item, !path ? `${index}` : `${path}.${index}`, alternatives));
|
|
52
|
+
});
|
|
53
|
+
return target;
|
|
54
|
+
}
|
|
55
|
+
return Object.keys(source).reduce((result, key) => {
|
|
56
|
+
result[key] = createConfigRecursive(result[key], source[key], !path ? `${key}` : `${path}.${key}`, alternatives);
|
|
57
|
+
return result;
|
|
58
|
+
}, Object.assign({}, target));
|
|
59
|
+
}
|
|
60
|
+
function parseConfig(config) {
|
|
61
|
+
if (typeof config == "string") {
|
|
62
|
+
try {
|
|
63
|
+
config = JSON.parse(config);
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return config;
|
|
70
|
+
}
|
|
71
|
+
exports.parseConfig = parseConfig;
|
|
72
|
+
function createConfig(config, alternatives) {
|
|
73
|
+
alternatives = alternatives || {};
|
|
74
|
+
console.log("Parsing config...");
|
|
75
|
+
return createConfigRecursive(null, parseConfig(config), "", alternatives);
|
|
76
|
+
}
|
|
77
|
+
exports.createConfig = createConfig;
|
|
78
|
+
exports.default = createConfig;
|
|
79
79
|
//# sourceMappingURL=config.js.map
|
package/tools/icons.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const args = process.argv.slice(2);
|
|
6
|
-
const svgPath = args[0];
|
|
7
|
-
const files = fs.readdirSync(svgPath);
|
|
8
|
-
const icons = {};
|
|
9
|
-
files.forEach(file => {
|
|
10
|
-
const content = fs.readFileSync(path.join(svgPath, file));
|
|
11
|
-
icons[file.replace(".svg", "")] = content.toString().replace(/\r?\n|\r/g, "");
|
|
12
|
-
});
|
|
13
|
-
fs.writeFileSync(args[1], "icons = " + JSON.stringify(icons) + ";");
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const svgPath = args[0];
|
|
7
|
+
const files = fs.readdirSync(svgPath);
|
|
8
|
+
const icons = {};
|
|
9
|
+
files.forEach(file => {
|
|
10
|
+
const content = fs.readFileSync(path.join(svgPath, file));
|
|
11
|
+
icons[file.replace(".svg", "")] = content.toString().replace(/\r?\n|\r/g, "");
|
|
12
|
+
});
|
|
13
|
+
fs.writeFileSync(args[1], "icons = " + JSON.stringify(icons) + ";");
|
|
14
14
|
//# sourceMappingURL=icons.js.map
|