@udixio/theme 1.0.0-beta.29 → 1.0.0-beta.30
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/dist/theme.cjs.development.js +22 -18
- package/dist/theme.cjs.development.js.map +1 -1
- package/dist/theme.cjs.production.min.js +1 -1
- package/dist/theme.cjs.production.min.js.map +1 -1
- package/dist/theme.esm.js +22 -18
- package/dist/theme.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/config/config.service.ts +28 -18
package/package.json
CHANGED
|
@@ -63,29 +63,39 @@ export class ConfigService {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
private getConfig(): ConfigInterface {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
if (
|
|
67
|
+
typeof process !== 'undefined' &&
|
|
68
|
+
process.release &&
|
|
69
|
+
process.release.name === 'node'
|
|
70
|
+
) {
|
|
71
|
+
const base = resolve(this.configPath);
|
|
72
|
+
const extensions = ['.js', '.ts', '.jms', '.jcs'];
|
|
73
|
+
let configImport = null;
|
|
69
74
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
for (const ext of extensions) {
|
|
76
|
+
const path = base + ext;
|
|
77
|
+
if (existsSync(path)) {
|
|
78
|
+
configImport = require(path);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
75
81
|
}
|
|
76
|
-
}
|
|
77
82
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
if (!configImport) {
|
|
84
|
+
throw new Error('Configuration file not found');
|
|
85
|
+
}
|
|
81
86
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
let config: unknown;
|
|
88
|
+
if ('default' in configImport) {
|
|
89
|
+
config = configImport.default;
|
|
90
|
+
} else {
|
|
91
|
+
config = configImport;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return config as ConfigInterface;
|
|
85
95
|
} else {
|
|
86
|
-
|
|
96
|
+
throw new Error(
|
|
97
|
+
'You must provide configuration object when using this library in a browser.'
|
|
98
|
+
);
|
|
87
99
|
}
|
|
88
|
-
|
|
89
|
-
return config as ConfigInterface;
|
|
90
100
|
}
|
|
91
101
|
}
|