@teqfw/di 0.11.0 → 0.12.1
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/RELEASE.md
CHANGED
package/package.json
CHANGED
|
@@ -27,9 +27,11 @@ TeqFw_Di_Back_Api_Dto_Plugin_Desc.REPLACE = 'replace';
|
|
|
27
27
|
* @memberOf TeqFw_Di_Back_Api_Dto_Plugin_Desc
|
|
28
28
|
*/
|
|
29
29
|
export class Factory {
|
|
30
|
+
static namespace = NS;
|
|
31
|
+
|
|
30
32
|
constructor(spec) {
|
|
31
33
|
/** @type {TeqFw_Di_Shared_Api_Dto_Plugin_Desc_Autoload.Factory} */
|
|
32
|
-
const fAutoload = spec['TeqFw_Di_Shared_Api_Dto_Plugin_Desc_Autoload
|
|
34
|
+
const fAutoload = spec['TeqFw_Di_Shared_Api_Dto_Plugin_Desc_Autoload.Factory$'];
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
* @param {*} data
|
|
@@ -37,7 +39,7 @@ export class Factory {
|
|
|
37
39
|
*/
|
|
38
40
|
this.create = function (data = null) {
|
|
39
41
|
|
|
40
|
-
//
|
|
42
|
+
// FUNCS
|
|
41
43
|
function parseReplace(data) {
|
|
42
44
|
const res = {};
|
|
43
45
|
if (typeof data === 'object')
|
|
@@ -55,7 +57,7 @@ export class Factory {
|
|
|
55
57
|
return res;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
// MAIN
|
|
60
|
+
// MAIN
|
|
59
61
|
const res = new TeqFw_Di_Back_Api_Dto_Plugin_Desc();
|
|
60
62
|
res.autoload = fAutoload.create(data?.autoload);
|
|
61
63
|
res.replace = parseReplace(data?.replace);
|
|
@@ -66,4 +68,3 @@ export class Factory {
|
|
|
66
68
|
|
|
67
69
|
// freeze DTO class to deny attributes changes and pin namespace
|
|
68
70
|
Object.freeze(TeqFw_Di_Back_Api_Dto_Plugin_Desc);
|
|
69
|
-
Object.defineProperty(Factory, 'name', {value: `${NS}.${Factory.constructor.name}`});
|
|
@@ -15,15 +15,15 @@ const TEQFW = 'teqfw.json';
|
|
|
15
15
|
export default class TeqFw_Di_Back_Plugin_Scanner {
|
|
16
16
|
|
|
17
17
|
constructor(spec) {
|
|
18
|
-
//
|
|
18
|
+
// DEPS
|
|
19
19
|
/** @type {TeqFw_Di_Back_Defaults} */
|
|
20
20
|
const DEF = spec['TeqFw_Di_Back_Defaults$'];
|
|
21
21
|
/** @type {TeqFw_Di_Back_Api_Dto_Plugin_Desc.Factory} */
|
|
22
|
-
const fDesc = spec['TeqFw_Di_Back_Api_Dto_Plugin_Desc
|
|
22
|
+
const fDesc = spec['TeqFw_Di_Back_Api_Dto_Plugin_Desc.Factory$'];
|
|
23
23
|
/** @type {TeqFw_Di_Shared_Api_Dto_Plugin_Desc_Autoload.Factory} */
|
|
24
|
-
const fAutoload = spec['TeqFw_Di_Shared_Api_Dto_Plugin_Desc_Autoload
|
|
24
|
+
const fAutoload = spec['TeqFw_Di_Shared_Api_Dto_Plugin_Desc_Autoload.Factory$'];
|
|
25
25
|
|
|
26
|
-
//
|
|
26
|
+
// INSTANCE METHODS
|
|
27
27
|
|
|
28
28
|
this.getDescriptors = async function (path) {
|
|
29
29
|
const result = [];
|
|
@@ -75,9 +75,9 @@ export default class TeqFw_Di_Back_Plugin_Scanner {
|
|
|
75
75
|
* @return {Promise<Object.<string, TeqFw_Di_Back_Api_Dto_Scanned>>} Object-to-path map for found plugins
|
|
76
76
|
*/
|
|
77
77
|
async scanFilesystem(path) {
|
|
78
|
-
//
|
|
78
|
+
// FUNCS
|
|
79
79
|
function readData(path) {
|
|
80
|
-
//
|
|
80
|
+
// FUNCS
|
|
81
81
|
/**
|
|
82
82
|
* Check existence of JSON file, read content, parse JSON and return data.
|
|
83
83
|
*
|
|
@@ -106,7 +106,7 @@ export default class TeqFw_Di_Back_Plugin_Scanner {
|
|
|
106
106
|
return result;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
// MAIN
|
|
109
|
+
// MAIN
|
|
110
110
|
let result = null;
|
|
111
111
|
const pathTeqfw = join(path, TEQFW);
|
|
112
112
|
const pathPkg = join(path, PACKAGE);
|
|
@@ -121,7 +121,7 @@ export default class TeqFw_Di_Back_Plugin_Scanner {
|
|
|
121
121
|
return result;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
// MAIN
|
|
124
|
+
// MAIN
|
|
125
125
|
const result = {};
|
|
126
126
|
// get scan data for root folder (application itself)
|
|
127
127
|
const dataRoot = readData(path);
|
|
@@ -28,6 +28,8 @@ TeqFw_Di_Shared_Api_Dto_Plugin_Desc_Autoload.PATH = 'path';
|
|
|
28
28
|
* @memberOf TeqFw_Di_Shared_Api_Dto_Plugin_Desc_Autoload
|
|
29
29
|
*/
|
|
30
30
|
export class Factory {
|
|
31
|
+
static namespace = NS;
|
|
32
|
+
|
|
31
33
|
constructor() {
|
|
32
34
|
/**
|
|
33
35
|
* @param {TeqFw_Di_Shared_Api_Dto_Plugin_Desc_Autoload|null} data
|
|
@@ -46,4 +48,3 @@ export class Factory {
|
|
|
46
48
|
|
|
47
49
|
// freeze DTO class to deny attributes changes and pin namespace
|
|
48
50
|
Object.freeze(TeqFw_Di_Shared_Api_Dto_Plugin_Desc_Autoload);
|
|
49
|
-
Object.defineProperty(Factory, 'name', {value: `${NS}.${Factory.constructor.name}`});
|
package/src/Shared/Container.mjs
CHANGED
|
@@ -62,7 +62,7 @@ export default class TeqFw_Di_Shared_Container {
|
|
|
62
62
|
*/
|
|
63
63
|
async function getObject(mainId, uplineDeps) {
|
|
64
64
|
|
|
65
|
-
//
|
|
65
|
+
// FUNCS
|
|
66
66
|
/**
|
|
67
67
|
* Add 'spec' proxy as fnConstruct argument and create new object and all deps.
|
|
68
68
|
*
|
|
@@ -73,7 +73,7 @@ export default class TeqFw_Di_Shared_Container {
|
|
|
73
73
|
function _useFactory(fnConstruct) {
|
|
74
74
|
// This promise will be resolved after all dependencies in spec proxy will be created.
|
|
75
75
|
return new Promise(function (resolve, reject) {
|
|
76
|
-
// MAIN
|
|
76
|
+
// MAIN
|
|
77
77
|
const constructorType = typeof fnConstruct;
|
|
78
78
|
if (constructorType === 'object') {
|
|
79
79
|
// `constructor` is an object, clone this fnConstruct and return cloned object
|
|
@@ -162,7 +162,7 @@ export default class TeqFw_Di_Shared_Container {
|
|
|
162
162
|
return orig;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
// MAIN
|
|
165
|
+
// MAIN
|
|
166
166
|
let result;
|
|
167
167
|
/** @type {TeqFw_Di_Shared_IdParser_Dto} */
|
|
168
168
|
const parsed = $parser.parse(mainId);
|
package/src/Shared/Resolver.mjs
CHANGED
|
@@ -12,9 +12,12 @@ const LOGICAL_NS = /^((([A-Z])[A-Za-z0-9_]*)?)$/;
|
|
|
12
12
|
*/
|
|
13
13
|
export default class TeqFw_Di_Shared_Resolver {
|
|
14
14
|
/** @type {TeqFw_Di_Shared_Resolver_LogicalNs} */
|
|
15
|
-
logicalNs = new LogicalNs()
|
|
15
|
+
logicalNs = new LogicalNs();
|
|
16
16
|
/** @type {TeqFw_Di_Shared_Resolver_FilepathNs} */
|
|
17
|
-
filepathNs = new FilepathNs()
|
|
17
|
+
filepathNs = new FilepathNs();
|
|
18
|
+
// TODO: this is a hotfix
|
|
19
|
+
/** @type {boolean} */
|
|
20
|
+
isWindows = false;
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Registry sources path mapping details for namespace.
|
|
@@ -50,6 +53,10 @@ export default class TeqFw_Di_Shared_Resolver {
|
|
|
50
53
|
// this is file path based namespace
|
|
51
54
|
result = this.filepathNs.resolveModuleId(moduleId);
|
|
52
55
|
}
|
|
56
|
+
// TODO: tmp fix for windows
|
|
57
|
+
if (this.isWindows) {
|
|
58
|
+
result = 'file://' + result.replace(/\//g, '\\');
|
|
59
|
+
}
|
|
53
60
|
return result;
|
|
54
61
|
}
|
|
55
62
|
|