@xrystal/core 3.18.7 → 3.18.8
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/package.json +1 -1
- package/source/loader/configs/index.js +17 -11
- package/source/loader/system/index.d.ts +1 -0
- package/source/loader/system/index.js +1 -0
- package/x/tmp.yml +1 -1
- /package/source/utils/{models/classes/configs.project.d.ts → helpers/configs/index.d.ts} +0 -0
- /package/source/utils/{models/classes/configs.project.js → helpers/configs/index.js} +0 -0
package/package.json
CHANGED
|
@@ -10,18 +10,14 @@ export default class ConfigsService {
|
|
|
10
10
|
this.#systemService = systemService;
|
|
11
11
|
}
|
|
12
12
|
load = async ({}) => {
|
|
13
|
+
const cwd = process.cwd();
|
|
13
14
|
const tmp = this.#systemService.tmp;
|
|
14
15
|
const extendConfigs = tmp.configs.loaders.configs.loadPath;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
const fullPath = path.resolve(tmp.configs.rootFolderPath, extendConfigs);
|
|
23
|
-
importedModule = await import(pathToFileURL(fullPath).href);
|
|
24
|
-
}
|
|
16
|
+
const fullPath = extendConfigs.startsWith('@/')
|
|
17
|
+
? path.join(process.cwd(), extendConfigs.slice(2))
|
|
18
|
+
: path.resolve(tmp.configs.rootFolderPath, extendConfigs);
|
|
19
|
+
const fileUrl = pathToFileURL(fullPath).href;
|
|
20
|
+
const modulePromise = import(fileUrl);
|
|
25
21
|
this.config = {
|
|
26
22
|
worker: process.env.WORKER === 'true' ? true : false || false,
|
|
27
23
|
nodeEnv: process.env.NODE_ENV,
|
|
@@ -46,8 +42,18 @@ export default class ConfigsService {
|
|
|
46
42
|
secret: process.env.SECRET,
|
|
47
43
|
cwd,
|
|
48
44
|
env: process.env.NODE_ENV,
|
|
49
|
-
...importedModule.configs,
|
|
50
45
|
};
|
|
46
|
+
try {
|
|
47
|
+
const moduleData = await modulePromise;
|
|
48
|
+
const importedConfigs = moduleData?.default || moduleData?.configs || moduleData || {};
|
|
49
|
+
this.config = {
|
|
50
|
+
...this.config,
|
|
51
|
+
...(typeof importedConfigs === 'object' ? importedConfigs : {})
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
// error
|
|
56
|
+
}
|
|
51
57
|
};
|
|
52
58
|
setConfig(newConfigs) {
|
|
53
59
|
const mergedData = {
|
package/x/tmp.yml
CHANGED
|
File without changes
|
|
File without changes
|