@allgemein/moduls 1.8.1 → 1.9.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/Constants.js +2 -5
- package/Constants.js.map +1 -1
- package/README.md +88 -0
- package/browser.d.ts +19 -19
- package/browser.js +6 -15
- package/browser.js.map +1 -1
- package/index.d.ts +5 -5
- package/index.js +5 -18
- package/index.js.map +1 -1
- package/loader/AbstractModuleHandle.d.ts +1 -1
- package/loader/AbstractModuleHandle.js +1 -5
- package/loader/AbstractModuleHandle.js.map +1 -1
- package/loader/AbstractModuleLoader.d.ts +5 -5
- package/loader/AbstractModuleLoader.js +7 -13
- package/loader/AbstractModuleLoader.js.map +1 -1
- package/loader/IModuleLoader.d.ts +1 -1
- package/loader/IModuleLoader.js +1 -2
- package/loader/IModuleOptions.d.ts +1 -1
- package/loader/IModuleOptions.js +1 -2
- package/loader/classes/ClassesHandle.d.ts +1 -1
- package/loader/classes/ClassesHandle.js +2 -6
- package/loader/classes/ClassesHandle.js.map +1 -1
- package/loader/classes/ClassesLoader.d.ts +8 -8
- package/loader/classes/ClassesLoader.js +36 -40
- package/loader/classes/ClassesLoader.js.map +1 -1
- package/loader/classes/IClassesLoader.js +1 -2
- package/loader/classes/IClassesOptions.d.ts +1 -1
- package/loader/classes/IClassesOptions.js +1 -2
- package/loader/require/IRequireLoader.d.ts +1 -1
- package/loader/require/IRequireLoader.js +1 -2
- package/loader/require/IRequireOptions.d.ts +2 -3
- package/loader/require/IRequireOptions.js +1 -2
- package/loader/require/RequireHandle.d.ts +1 -1
- package/loader/require/RequireHandle.js +2 -6
- package/loader/require/RequireHandle.js.map +1 -1
- package/loader/require/RequireLoader.d.ts +5 -5
- package/loader/require/RequireLoader.js +17 -21
- package/loader/require/RequireLoader.js.map +1 -1
- package/loader/settings/ISettingsLoader.js +1 -2
- package/loader/settings/ISettingsOptions.d.ts +1 -1
- package/loader/settings/ISettingsOptions.js +1 -2
- package/loader/settings/SettingsHandle.d.ts +1 -1
- package/loader/settings/SettingsHandle.js +2 -6
- package/loader/settings/SettingsHandle.js.map +1 -1
- package/loader/settings/SettingsLoader.d.ts +5 -5
- package/loader/settings/SettingsLoader.js +14 -18
- package/loader/settings/SettingsLoader.js.map +1 -1
- package/package.json +3 -2
- package/registry/Constants.d.ts +1 -1
- package/registry/Constants.js +3 -5
- package/registry/Constants.js.map +1 -1
- package/registry/ICache.js +1 -2
- package/registry/IModuleRegistry.d.ts +8 -8
- package/registry/IModuleRegistry.js +1 -2
- package/registry/IModuleRegistryOptions.d.ts +1 -1
- package/registry/IModuleRegistryOptions.js +1 -2
- package/registry/ISubModule.js +1 -2
- package/registry/ModuleDescriptor.d.ts +1 -1
- package/registry/ModuleDescriptor.js +4 -8
- package/registry/ModuleDescriptor.js.map +1 -1
- package/registry/ModuleRegistry.d.ts +11 -11
- package/registry/ModuleRegistry.js +45 -55
- package/registry/ModuleRegistry.js.map +1 -1
- package/utils/Helper.d.ts +6 -1
- package/utils/Helper.js +67 -58
- package/utils/Helper.js.map +1 -1
- package/utils/INpmlsOptions.js +1 -2
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { IModuleOptions } from
|
|
2
|
-
export
|
|
3
|
-
}
|
|
1
|
+
import { IModuleOptions } from '../IModuleOptions.js';
|
|
2
|
+
export type IRequireOptions = IModuleOptions;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.RequireHandle = void 0;
|
|
4
|
-
const AbstractModuleHandle_1 = require("../AbstractModuleHandle");
|
|
5
|
-
class RequireHandle extends AbstractModuleHandle_1.AbstractModuleHandle {
|
|
1
|
+
import { AbstractModuleHandle } from '../AbstractModuleHandle.js';
|
|
2
|
+
export class RequireHandle extends AbstractModuleHandle {
|
|
6
3
|
constructor() {
|
|
7
4
|
super(...arguments);
|
|
8
5
|
this.usesHooks = [];
|
|
9
6
|
this.exposesHooks = [];
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
exports.RequireHandle = RequireHandle;
|
|
13
9
|
//# sourceMappingURL=RequireHandle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequireHandle.js","sourceRoot":"","sources":["../../../../src/loader/require/RequireHandle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequireHandle.js","sourceRoot":"","sources":["../../../../src/loader/require/RequireHandle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAGhE,MAAM,OAAO,aAAc,SAAQ,oBAAoB;IAAvD;;QAIE,cAAS,GAAU,EAAE,CAAC;QAEtB,iBAAY,GAAU,EAAE,CAAC;IAI3B,CAAC;CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RequireHandle } from './RequireHandle';
|
|
2
|
-
import { AbstractModuleLoader } from '../AbstractModuleLoader';
|
|
3
|
-
import { ModuleDescriptor } from '../../registry/ModuleDescriptor';
|
|
4
|
-
import { IRequireOptions } from './IRequireOptions';
|
|
5
|
-
import { IRequireLoader } from './IRequireLoader';
|
|
1
|
+
import { RequireHandle } from './RequireHandle.js';
|
|
2
|
+
import { AbstractModuleLoader } from '../AbstractModuleLoader.js';
|
|
3
|
+
import { ModuleDescriptor } from '../../registry/ModuleDescriptor.js';
|
|
4
|
+
import { IRequireOptions } from './IRequireOptions.js';
|
|
5
|
+
import { IRequireLoader } from './IRequireLoader.js';
|
|
6
6
|
export declare class RequireLoader extends AbstractModuleLoader<RequireHandle, IRequireOptions> implements IRequireLoader {
|
|
7
7
|
protected loadOne(modul: ModuleDescriptor): Promise<RequireHandle>;
|
|
8
8
|
invokeHook(hook: string, ...args: any[]): Promise<any[]>;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const AbstractModuleLoader_1 = require("../AbstractModuleLoader");
|
|
8
|
-
const Helper_1 = require("../../utils/Helper");
|
|
9
|
-
class RequireLoader extends AbstractModuleLoader_1.AbstractModuleLoader {
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { filter, isFunction, isObject, map } from '@allgemein/base';
|
|
3
|
+
import { RequireHandle } from './RequireHandle.js';
|
|
4
|
+
import { AbstractModuleLoader } from '../AbstractModuleLoader.js';
|
|
5
|
+
import { Helper } from '../../utils/Helper.js';
|
|
6
|
+
export class RequireLoader extends AbstractModuleLoader {
|
|
10
7
|
async loadOne(modul) {
|
|
11
|
-
|
|
8
|
+
const handle = new RequireHandle(modul);
|
|
12
9
|
// necassary to extend the search directories of require
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (_module['paths'].indexOf(new_node_modules_dir)
|
|
10
|
+
const _module = this.registry.options().module;
|
|
11
|
+
const new_node_modules_dir = path.dirname(modul.path); // split.join(path.sep);
|
|
12
|
+
if (_module['paths'].indexOf(new_node_modules_dir) === -1) {
|
|
16
13
|
_module['paths'].unshift(new_node_modules_dir);
|
|
17
14
|
}
|
|
18
15
|
if (modul.internal) {
|
|
@@ -25,7 +22,7 @@ class RequireLoader extends AbstractModuleLoader_1.AbstractModuleLoader {
|
|
|
25
22
|
handle.exposesHooks = handle.ref.exposesHooks;
|
|
26
23
|
}
|
|
27
24
|
Object.getOwnPropertyNames(handle.ref).forEach(function (val, idx, array) {
|
|
28
|
-
if (handle.ref[val] &&
|
|
25
|
+
if (handle.ref[val] && isFunction(handle.ref[val]) && val !== 'exposesHooks' && val.match(/^on[A-Z]/)) {
|
|
29
26
|
let _val = val.replace('on', '');
|
|
30
27
|
_val = _val[0].toLowerCase() + _val.substring(1);
|
|
31
28
|
handle.usesHooks.push(_val);
|
|
@@ -35,24 +32,24 @@ class RequireLoader extends AbstractModuleLoader_1.AbstractModuleLoader {
|
|
|
35
32
|
}
|
|
36
33
|
async invokeHook(hook, ...args) {
|
|
37
34
|
let options = { concurrency: Infinity };
|
|
38
|
-
if (
|
|
35
|
+
if (isObject(hook)) {
|
|
39
36
|
options = hook;
|
|
40
37
|
hook = options.hook;
|
|
41
38
|
}
|
|
42
|
-
|
|
39
|
+
const handles = filter(this._handles, function (_x) {
|
|
43
40
|
return _x.usesHooks.indexOf(hook) > -1;
|
|
44
41
|
});
|
|
45
|
-
return await Promise.all(
|
|
42
|
+
return await Promise.all(map(handles, (handle) => {
|
|
46
43
|
let _args = [handle, hook];
|
|
47
44
|
_args = _args.concat(args);
|
|
48
45
|
return RequireLoader.handleCall.apply(null, _args);
|
|
49
46
|
}));
|
|
50
47
|
}
|
|
51
48
|
static async handleCall(handle, hook, ...args) {
|
|
52
|
-
|
|
49
|
+
const hookCall = 'on' + Helper.ucfirst(hook);
|
|
53
50
|
if (handle.usesHooks.indexOf(hook) > -1) {
|
|
54
51
|
return new Promise(function (res, rej) {
|
|
55
|
-
if (handle.ref[hookCall].length
|
|
52
|
+
if (handle.ref[hookCall].length === args.length) {
|
|
56
53
|
let result, err;
|
|
57
54
|
try {
|
|
58
55
|
result = handle.ref[hookCall].apply(handle.ref, args);
|
|
@@ -65,7 +62,7 @@ class RequireLoader extends AbstractModuleLoader_1.AbstractModuleLoader {
|
|
|
65
62
|
res(result);
|
|
66
63
|
}
|
|
67
64
|
}
|
|
68
|
-
else if (handle.ref[hookCall].length
|
|
65
|
+
else if (handle.ref[hookCall].length === (args.length + 1)) {
|
|
69
66
|
args.push(function (err, result) {
|
|
70
67
|
if (err) {
|
|
71
68
|
rej(err);
|
|
@@ -86,5 +83,4 @@ class RequireLoader extends AbstractModuleLoader_1.AbstractModuleLoader {
|
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
85
|
}
|
|
89
|
-
exports.RequireLoader = RequireLoader;
|
|
90
86
|
//# sourceMappingURL=RequireLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequireLoader.js","sourceRoot":"","sources":["../../../../src/loader/require/RequireLoader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":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CAAC;4BACN,GAAG,CAAC,MAAM,CAAC,CAAC;wBACd,CAAC;oBACH,CAAC,CAAC,CAAC;oBACH,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;gBAC/C,CAAC;qBAAM,CAAC;oBACN,GAAG,CAAC,IAAI,KAAK,CAAC,yBAAyB,GAAG,IAAI,GAAG,GAAG,GAAG,QAAQ,GAAG,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC/F,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IAEH,CAAC;CAGF"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SettingsHandle = void 0;
|
|
4
|
-
const AbstractModuleHandle_1 = require("../AbstractModuleHandle");
|
|
5
|
-
class SettingsHandle extends AbstractModuleHandle_1.AbstractModuleHandle {
|
|
1
|
+
import { AbstractModuleHandle } from '../AbstractModuleHandle.js';
|
|
2
|
+
export class SettingsHandle extends AbstractModuleHandle {
|
|
6
3
|
constructor() {
|
|
7
4
|
super(...arguments);
|
|
8
5
|
this.settings = {};
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.SettingsHandle = SettingsHandle;
|
|
12
8
|
//# sourceMappingURL=SettingsHandle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsHandle.js","sourceRoot":"","sources":["../../../../src/loader/settings/SettingsHandle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SettingsHandle.js","sourceRoot":"","sources":["../../../../src/loader/settings/SettingsHandle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAGhE,MAAM,OAAO,cAAe,SAAQ,oBAAoB;IAAxD;;QAEE,aAAQ,GAAQ,EAAE,CAAC;IAErB,CAAC;CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AbstractModuleLoader } from '../AbstractModuleLoader';
|
|
2
|
-
import { ModuleDescriptor } from '../../registry/ModuleDescriptor';
|
|
3
|
-
import { SettingsHandle } from './SettingsHandle';
|
|
4
|
-
import { ISettingsOptions } from './ISettingsOptions';
|
|
5
|
-
import { ISettingsLoader } from './ISettingsLoader';
|
|
1
|
+
import { AbstractModuleLoader } from '../AbstractModuleLoader.js';
|
|
2
|
+
import { ModuleDescriptor } from '../../registry/ModuleDescriptor.js';
|
|
3
|
+
import { SettingsHandle } from './SettingsHandle.js';
|
|
4
|
+
import { ISettingsOptions } from './ISettingsOptions.js';
|
|
5
|
+
import { ISettingsLoader } from './ISettingsLoader.js';
|
|
6
6
|
export declare class SettingsLoader extends AbstractModuleLoader<SettingsHandle, ISettingsOptions> implements ISettingsLoader {
|
|
7
7
|
getSettings(): any;
|
|
8
8
|
protected loadOne(modul: ModuleDescriptor): Promise<SettingsHandle>;
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const Helper_1 = require("../../utils/Helper");
|
|
8
|
-
const base_1 = require("@allgemein/base");
|
|
9
|
-
class SettingsLoader extends AbstractModuleLoader_1.AbstractModuleLoader {
|
|
1
|
+
import { get } from '@allgemein/base';
|
|
2
|
+
import { AbstractModuleLoader } from '../AbstractModuleLoader.js';
|
|
3
|
+
import { SettingsHandle } from './SettingsHandle.js';
|
|
4
|
+
import { Helper } from '../../utils/Helper.js';
|
|
5
|
+
import { PlatformUtils } from '@allgemein/base';
|
|
6
|
+
export class SettingsLoader extends AbstractModuleLoader {
|
|
10
7
|
getSettings() {
|
|
11
|
-
|
|
12
|
-
for (
|
|
8
|
+
const settings = {};
|
|
9
|
+
for (const x of this.handles()) {
|
|
13
10
|
settings[x.module.name] = x.settings;
|
|
14
11
|
}
|
|
15
12
|
return settings;
|
|
16
13
|
}
|
|
17
14
|
async loadOne(modul) {
|
|
18
15
|
let handle = null;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
handle = new
|
|
23
|
-
|
|
16
|
+
const filepath = PlatformUtils.join(modul.path, this._options.ref);
|
|
17
|
+
const ext = PlatformUtils.pathExtname(filepath, false);
|
|
18
|
+
if (PlatformUtils.fileExist(filepath)) {
|
|
19
|
+
handle = new SettingsHandle(modul);
|
|
20
|
+
const file = await Helper.readFile(filepath);
|
|
24
21
|
let settings = {};
|
|
25
22
|
switch (ext) {
|
|
26
23
|
case 'json':
|
|
@@ -30,12 +27,11 @@ class SettingsLoader extends AbstractModuleLoader_1.AbstractModuleLoader {
|
|
|
30
27
|
throw new Error('Cannot load settings from ' + ext);
|
|
31
28
|
}
|
|
32
29
|
if (this._options.path) {
|
|
33
|
-
settings =
|
|
30
|
+
settings = get(settings, this._options.path);
|
|
34
31
|
}
|
|
35
32
|
handle.settings = settings;
|
|
36
33
|
}
|
|
37
34
|
return handle;
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
|
-
exports.SettingsLoader = SettingsLoader;
|
|
41
37
|
//# sourceMappingURL=SettingsLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsLoader.js","sourceRoot":"","sources":["../../../../src/loader/settings/SettingsLoader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SettingsLoader.js","sourceRoot":"","sources":["../../../../src/loader/settings/SettingsLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAC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,GAAG,QAAQ,CAAC;QAC7B,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CAGF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allgemein/moduls",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "Commons-moduls handles and manages contextual moduls for complex and modular applications. ",
|
|
5
6
|
"main": "index.js",
|
|
6
7
|
"browser": "browser.js",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
},
|
|
25
26
|
"homepage": "https://github.com/allgemein-node/moduls#readme",
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@allgemein/base": "^1.
|
|
28
|
+
"@allgemein/base": "^1.10.1",
|
|
28
29
|
"@types/micromatch": "^4.0.9",
|
|
29
30
|
"glob": ">=11.0.0",
|
|
30
31
|
"reflect-metadata": "^0.2.2"
|
package/registry/Constants.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IModuleRegistryOptions } from './IModuleRegistryOptions';
|
|
1
|
+
import { IModuleRegistryOptions } from './IModuleRegistryOptions.js';
|
|
2
2
|
export declare const MODUL_REGISTRY_DEFAULT_OPTIONS: IModuleRegistryOptions;
|
package/registry/Constants.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.MODUL_REGISTRY_DEFAULT_OPTIONS = void 0;
|
|
4
|
-
exports.MODUL_REGISTRY_DEFAULT_OPTIONS = {
|
|
1
|
+
import { Helper } from '../utils/Helper.js';
|
|
2
|
+
export const MODUL_REGISTRY_DEFAULT_OPTIONS = {
|
|
5
3
|
paths: [],
|
|
6
4
|
pattern: [],
|
|
7
|
-
module:
|
|
5
|
+
module: Helper.createModule(import.meta.url),
|
|
8
6
|
handleErrorOnDuplicate: 'skip'
|
|
9
7
|
};
|
|
10
8
|
//# sourceMappingURL=Constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/registry/Constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/registry/Constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,MAAM,8BAA8B,GAA2B;IAEpE,KAAK,EAAE,EAAE;IAET,OAAO,EAAE,EAAE;IAEX,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC;IAE5C,sBAAsB,EAAE,MAAM;CAC/B,CAAC"}
|
package/registry/ICache.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ModuleDescriptor } from './ModuleDescriptor';
|
|
2
|
-
import { IRequireOptions } from '../loader/require/IRequireOptions';
|
|
3
|
-
import { IClassesOptions } from '../loader/classes/IClassesOptions';
|
|
4
|
-
import { ISettingsOptions } from '../loader/settings/ISettingsOptions';
|
|
5
|
-
import { IRequireLoader } from '../loader/require/IRequireLoader';
|
|
6
|
-
import { IClassesLoader } from '../loader/classes/IClassesLoader';
|
|
7
|
-
import { ISettingsLoader } from '../loader/settings/ISettingsLoader';
|
|
8
|
-
import { IModuleRegistryOptions } from './IModuleRegistryOptions';
|
|
1
|
+
import { ModuleDescriptor } from './ModuleDescriptor.js';
|
|
2
|
+
import { IRequireOptions } from '../loader/require/IRequireOptions.js';
|
|
3
|
+
import { IClassesOptions } from '../loader/classes/IClassesOptions.js';
|
|
4
|
+
import { ISettingsOptions } from '../loader/settings/ISettingsOptions.js';
|
|
5
|
+
import { IRequireLoader } from '../loader/require/IRequireLoader.js';
|
|
6
|
+
import { IClassesLoader } from '../loader/classes/IClassesLoader.js';
|
|
7
|
+
import { ISettingsLoader } from '../loader/settings/ISettingsLoader.js';
|
|
8
|
+
import { IModuleRegistryOptions } from './IModuleRegistryOptions.js';
|
|
9
9
|
export interface IModuleRegistry {
|
|
10
10
|
getModules(): ModuleDescriptor[];
|
|
11
11
|
getOptions(): IModuleRegistryOptions;
|
package/registry/ISubModule.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModuleDescriptor = void 0;
|
|
4
|
-
class ModuleDescriptor {
|
|
1
|
+
export class ModuleDescriptor {
|
|
5
2
|
constructor() {
|
|
6
3
|
this.id = ModuleDescriptor.INC++;
|
|
7
4
|
this.weight = 0;
|
|
@@ -25,7 +22,7 @@ class ModuleDescriptor {
|
|
|
25
22
|
this.child_modules = [];
|
|
26
23
|
}
|
|
27
24
|
static fromOptions(options) {
|
|
28
|
-
|
|
25
|
+
const m = new ModuleDescriptor();
|
|
29
26
|
m.name = options.name;
|
|
30
27
|
m.version = options.version || null;
|
|
31
28
|
m.path = options.path || null;
|
|
@@ -35,16 +32,15 @@ class ModuleDescriptor {
|
|
|
35
32
|
m.peerDependencies = options.peerDependencies || {};
|
|
36
33
|
m.child_modules = options.child_modules || [];
|
|
37
34
|
m.sub_modules = options.sub_modules || {};
|
|
38
|
-
return m; //merge(m,options)
|
|
35
|
+
return m; // merge(m,options)
|
|
39
36
|
}
|
|
40
37
|
getMain(sep = '/') {
|
|
41
|
-
|
|
38
|
+
const chain = [this.path];
|
|
42
39
|
if (this.main) {
|
|
43
40
|
chain.push(this.main.replace(/.\w+$/, ''));
|
|
44
41
|
}
|
|
45
42
|
return chain.join(sep);
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
|
-
exports.ModuleDescriptor = ModuleDescriptor;
|
|
49
45
|
ModuleDescriptor.INC = 0;
|
|
50
46
|
//# sourceMappingURL=ModuleDescriptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleDescriptor.js","sourceRoot":"","sources":["../../../src/registry/ModuleDescriptor.ts"],"names":[],"mappings":"
|
|
1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AC;QAC5C,CAAC,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;QACpD,CAAC,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;QAC9C,CAAC,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;QAC1C,OAAO,CAAC,CAAC,CAAC,mBAAmB;IAC/B,CAAC;IAED,OAAO,CAAC,GAAG,GAAW,GAAG;QACvB,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CACF;AAhEQ,oBAAG,GAAG,CAAC,AAAJ,CAAK"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ModuleDescriptor } from './ModuleDescriptor';
|
|
2
|
-
import { IModuleRegistryOptions } from './IModuleRegistryOptions';
|
|
3
|
-
import { IRequireOptions } from '../loader/require/IRequireOptions';
|
|
4
|
-
import { RequireLoader } from '../loader/require/RequireLoader';
|
|
5
|
-
import { ClassesLoader } from '../loader/classes/ClassesLoader';
|
|
6
|
-
import { IClassesOptions } from '../loader/classes/IClassesOptions';
|
|
7
|
-
import { ISettingsOptions } from '../loader/settings/ISettingsOptions';
|
|
8
|
-
import { SettingsLoader } from '../loader/settings/SettingsLoader';
|
|
9
|
-
import { IModuleRegistry } from './IModuleRegistry';
|
|
10
|
-
import { IModuleLoader } from '../loader/IModuleLoader';
|
|
1
|
+
import { ModuleDescriptor } from './ModuleDescriptor.js';
|
|
2
|
+
import { IModuleRegistryOptions } from './IModuleRegistryOptions.js';
|
|
3
|
+
import { IRequireOptions } from '../loader/require/IRequireOptions.js';
|
|
4
|
+
import { RequireLoader } from '../loader/require/RequireLoader.js';
|
|
5
|
+
import { ClassesLoader } from '../loader/classes/ClassesLoader.js';
|
|
6
|
+
import { IClassesOptions } from '../loader/classes/IClassesOptions.js';
|
|
7
|
+
import { ISettingsOptions } from '../loader/settings/ISettingsOptions.js';
|
|
8
|
+
import { SettingsLoader } from '../loader/settings/SettingsLoader.js';
|
|
9
|
+
import { IModuleRegistry } from './IModuleRegistry.js';
|
|
10
|
+
import { IModuleLoader } from '../loader/IModuleLoader.js';
|
|
11
11
|
export declare class ModuleRegistry implements IModuleRegistry {
|
|
12
12
|
private readonly _options;
|
|
13
13
|
private _modules;
|
|
@@ -20,7 +20,7 @@ export declare class ModuleRegistry implements IModuleRegistry {
|
|
|
20
20
|
/**
|
|
21
21
|
* Return the cache object
|
|
22
22
|
*/
|
|
23
|
-
getCache(): import("./ICache").ICache;
|
|
23
|
+
getCache(): import("./ICache.js").ICache;
|
|
24
24
|
options(): IModuleRegistryOptions;
|
|
25
25
|
getOptions(): IModuleRegistryOptions;
|
|
26
26
|
rebuild(): Promise<IModuleRegistry>;
|