@midwayjs/core 3.3.4 → 3.3.5
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.
|
@@ -15,6 +15,7 @@ export declare const FrameworkErrorEnum: {
|
|
|
15
15
|
readonly MISSING_IMPORTS: "MIDWAY_10011";
|
|
16
16
|
readonly UTIL_HTTP_TIMEOUT: "MIDWAY_10012";
|
|
17
17
|
readonly INCONSISTENT_VERSION: "MIDWAY_10013";
|
|
18
|
+
readonly INVALID_CONFIG: "MIDWAY_10014";
|
|
18
19
|
};
|
|
19
20
|
export declare class MidwayCommonError extends MidwayError {
|
|
20
21
|
constructor(message: string);
|
|
@@ -37,6 +38,9 @@ export declare class MidwayFeatureNotImplementedError extends MidwayError {
|
|
|
37
38
|
export declare class MidwayConfigMissingError extends MidwayError {
|
|
38
39
|
constructor(configKey: string);
|
|
39
40
|
}
|
|
41
|
+
export declare class MidwayInvalidConfigError extends MidwayError {
|
|
42
|
+
constructor(message?: string);
|
|
43
|
+
}
|
|
40
44
|
export declare class MidwayResolverMissingError extends MidwayError {
|
|
41
45
|
constructor(type: string);
|
|
42
46
|
}
|
package/dist/error/framework.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MidwayInconsistentVersionError = exports.MidwayUtilHttpClientTimeoutError = exports.MidwayMissingImportComponentError = exports.MidwaySingletonInjectRequestError = exports.MidwayUseWrongMethodError = exports.MidwayDuplicateRouteError = exports.MidwayResolverMissingError = exports.MidwayConfigMissingError = exports.MidwayFeatureNotImplementedError = exports.MidwayFeatureNoLongerSupportedError = exports.MidwayDefinitionNotFoundError = exports.MidwayParameterError = exports.MidwayCommonError = exports.FrameworkErrorEnum = void 0;
|
|
3
|
+
exports.MidwayInconsistentVersionError = exports.MidwayUtilHttpClientTimeoutError = exports.MidwayMissingImportComponentError = exports.MidwaySingletonInjectRequestError = exports.MidwayUseWrongMethodError = exports.MidwayDuplicateRouteError = exports.MidwayResolverMissingError = exports.MidwayInvalidConfigError = exports.MidwayConfigMissingError = exports.MidwayFeatureNotImplementedError = exports.MidwayFeatureNoLongerSupportedError = exports.MidwayDefinitionNotFoundError = exports.MidwayParameterError = exports.MidwayCommonError = exports.FrameworkErrorEnum = void 0;
|
|
4
4
|
const base_1 = require("./base");
|
|
5
5
|
exports.FrameworkErrorEnum = (0, base_1.registerErrorCode)('midway', {
|
|
6
6
|
UNKNOWN: 10000,
|
|
@@ -17,6 +17,7 @@ exports.FrameworkErrorEnum = (0, base_1.registerErrorCode)('midway', {
|
|
|
17
17
|
MISSING_IMPORTS: 10011,
|
|
18
18
|
UTIL_HTTP_TIMEOUT: 10012,
|
|
19
19
|
INCONSISTENT_VERSION: 10013,
|
|
20
|
+
INVALID_CONFIG: 10014,
|
|
20
21
|
});
|
|
21
22
|
class MidwayCommonError extends base_1.MidwayError {
|
|
22
23
|
constructor(message) {
|
|
@@ -67,6 +68,12 @@ class MidwayConfigMissingError extends base_1.MidwayError {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
exports.MidwayConfigMissingError = MidwayConfigMissingError;
|
|
71
|
+
class MidwayInvalidConfigError extends base_1.MidwayError {
|
|
72
|
+
constructor(message) {
|
|
73
|
+
super('Invalid config file \n' + message, exports.FrameworkErrorEnum.INVALID_CONFIG);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.MidwayInvalidConfigError = MidwayInvalidConfigError;
|
|
70
77
|
class MidwayResolverMissingError extends base_1.MidwayError {
|
|
71
78
|
constructor(type) {
|
|
72
79
|
super(`${type} resolver is not exists!`, exports.FrameworkErrorEnum.MISSING_RESOLVER);
|
|
@@ -18,6 +18,7 @@ const util = require("util");
|
|
|
18
18
|
const environmentService_1 = require("./environmentService");
|
|
19
19
|
const informationService_1 = require("./informationService");
|
|
20
20
|
const extend_1 = require("../util/extend");
|
|
21
|
+
const error_1 = require("../error");
|
|
21
22
|
const debug = util.debuglog('midway:debug');
|
|
22
23
|
let MidwayConfigService = class MidwayConfigService {
|
|
23
24
|
constructor() {
|
|
@@ -174,8 +175,11 @@ let MidwayConfigService = class MidwayConfigService {
|
|
|
174
175
|
let exports = typeof configFilename === 'string'
|
|
175
176
|
? require(configFilename)
|
|
176
177
|
: configFilename;
|
|
177
|
-
if (exports && exports
|
|
178
|
-
exports
|
|
178
|
+
if (exports && exports.default) {
|
|
179
|
+
if (Object.keys(exports).length > 1) {
|
|
180
|
+
throw new error_1.MidwayInvalidConfigError(`${configFilename} should not have both a default export and named export`);
|
|
181
|
+
}
|
|
182
|
+
exports = exports.default;
|
|
179
183
|
}
|
|
180
184
|
return exports;
|
|
181
185
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/core",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.5",
|
|
4
4
|
"description": "midway core",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=12"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "5a835008aaa26e1b3c7d99c525f4a9fdaa3e41d1"
|
|
49
49
|
}
|