@module-federation/error-codes 0.6.14
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +62 -0
- package/dist/index.esm.d.ts +1 -0
- package/dist/index.esm.js +49 -0
- package/dist/package.json +36 -0
- package/dist/src/desc.d.ts +22 -0
- package/dist/src/error-codes.d.ts +8 -0
- package/dist/src/getShortErrorMsg.d.ts +1 -0
- package/dist/src/index.d.ts +3 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 ScriptedAlchemy LLC (Zack Jackson) Zhou Shaw (zhouxiao)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# `@module-federation/error-codes`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const RUNTIME_001 = 'RUNTIME-001';
|
|
4
|
+
const RUNTIME_002 = 'RUNTIME-002';
|
|
5
|
+
const RUNTIME_003 = 'RUNTIME-003';
|
|
6
|
+
const RUNTIME_004 = 'RUNTIME-004';
|
|
7
|
+
const RUNTIME_005 = 'RUNTIME-005';
|
|
8
|
+
const RUNTIME_006 = 'RUNTIME-006';
|
|
9
|
+
const RUNTIME_007 = 'RUNTIME-007';
|
|
10
|
+
const TYPE_001 = 'TYPE-001';
|
|
11
|
+
|
|
12
|
+
const getDocsUrl = (errorCode)=>{
|
|
13
|
+
const type = errorCode.split('-')[0].toLowerCase();
|
|
14
|
+
return `https://module-federation.io/guide/troubleshooting/${type}/${errorCode}`;
|
|
15
|
+
};
|
|
16
|
+
const getShortErrorMsg = (errorCode, errorDescMap, args, originalErrorMsg)=>{
|
|
17
|
+
const msg = [
|
|
18
|
+
errorDescMap[errorCode]
|
|
19
|
+
];
|
|
20
|
+
args && msg.push(`args: ${JSON.stringify(args)}`);
|
|
21
|
+
msg.push(getDocsUrl(errorCode));
|
|
22
|
+
originalErrorMsg && msg.push(`Original Error Message:\n ${originalErrorMsg}`);
|
|
23
|
+
return msg.join('\n');
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function _extends() {
|
|
27
|
+
_extends = Object.assign || function assign(target) {
|
|
28
|
+
for(var i = 1; i < arguments.length; i++){
|
|
29
|
+
var source = arguments[i];
|
|
30
|
+
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
return _extends.apply(this, arguments);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const runtimeDescMap = {
|
|
38
|
+
[RUNTIME_001]: 'Failed to get remoteEntry exports.',
|
|
39
|
+
[RUNTIME_002]: 'The remote entry interface does not contain "init"',
|
|
40
|
+
[RUNTIME_003]: 'Failed to get manifest.',
|
|
41
|
+
[RUNTIME_004]: 'Failed to locate remote.',
|
|
42
|
+
[RUNTIME_005]: 'Invalid loadShareSync function call from bundler runtime',
|
|
43
|
+
[RUNTIME_006]: 'Invalid loadShareSync function call from runtime',
|
|
44
|
+
[RUNTIME_007]: 'Failed to get remote snapshot.'
|
|
45
|
+
};
|
|
46
|
+
const typeDescMap = {
|
|
47
|
+
[TYPE_001]: 'Failed to generate type declaration.'
|
|
48
|
+
};
|
|
49
|
+
const errorDescMap = _extends({}, runtimeDescMap, typeDescMap);
|
|
50
|
+
|
|
51
|
+
exports.RUNTIME_001 = RUNTIME_001;
|
|
52
|
+
exports.RUNTIME_002 = RUNTIME_002;
|
|
53
|
+
exports.RUNTIME_003 = RUNTIME_003;
|
|
54
|
+
exports.RUNTIME_004 = RUNTIME_004;
|
|
55
|
+
exports.RUNTIME_005 = RUNTIME_005;
|
|
56
|
+
exports.RUNTIME_006 = RUNTIME_006;
|
|
57
|
+
exports.RUNTIME_007 = RUNTIME_007;
|
|
58
|
+
exports.TYPE_001 = TYPE_001;
|
|
59
|
+
exports.errorDescMap = errorDescMap;
|
|
60
|
+
exports.getShortErrorMsg = getShortErrorMsg;
|
|
61
|
+
exports.runtimeDescMap = runtimeDescMap;
|
|
62
|
+
exports.typeDescMap = typeDescMap;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const RUNTIME_001 = 'RUNTIME-001';
|
|
2
|
+
const RUNTIME_002 = 'RUNTIME-002';
|
|
3
|
+
const RUNTIME_003 = 'RUNTIME-003';
|
|
4
|
+
const RUNTIME_004 = 'RUNTIME-004';
|
|
5
|
+
const RUNTIME_005 = 'RUNTIME-005';
|
|
6
|
+
const RUNTIME_006 = 'RUNTIME-006';
|
|
7
|
+
const RUNTIME_007 = 'RUNTIME-007';
|
|
8
|
+
const TYPE_001 = 'TYPE-001';
|
|
9
|
+
|
|
10
|
+
const getDocsUrl = (errorCode)=>{
|
|
11
|
+
const type = errorCode.split('-')[0].toLowerCase();
|
|
12
|
+
return `https://module-federation.io/guide/troubleshooting/${type}/${errorCode}`;
|
|
13
|
+
};
|
|
14
|
+
const getShortErrorMsg = (errorCode, errorDescMap, args, originalErrorMsg)=>{
|
|
15
|
+
const msg = [
|
|
16
|
+
errorDescMap[errorCode]
|
|
17
|
+
];
|
|
18
|
+
args && msg.push(`args: ${JSON.stringify(args)}`);
|
|
19
|
+
msg.push(getDocsUrl(errorCode));
|
|
20
|
+
originalErrorMsg && msg.push(`Original Error Message:\n ${originalErrorMsg}`);
|
|
21
|
+
return msg.join('\n');
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function _extends() {
|
|
25
|
+
_extends = Object.assign || function assign(target) {
|
|
26
|
+
for(var i = 1; i < arguments.length; i++){
|
|
27
|
+
var source = arguments[i];
|
|
28
|
+
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
return _extends.apply(this, arguments);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const runtimeDescMap = {
|
|
36
|
+
[RUNTIME_001]: 'Failed to get remoteEntry exports.',
|
|
37
|
+
[RUNTIME_002]: 'The remote entry interface does not contain "init"',
|
|
38
|
+
[RUNTIME_003]: 'Failed to get manifest.',
|
|
39
|
+
[RUNTIME_004]: 'Failed to locate remote.',
|
|
40
|
+
[RUNTIME_005]: 'Invalid loadShareSync function call from bundler runtime',
|
|
41
|
+
[RUNTIME_006]: 'Invalid loadShareSync function call from runtime',
|
|
42
|
+
[RUNTIME_007]: 'Failed to get remote snapshot.'
|
|
43
|
+
};
|
|
44
|
+
const typeDescMap = {
|
|
45
|
+
[TYPE_001]: 'Failed to generate type declaration.'
|
|
46
|
+
};
|
|
47
|
+
const errorDescMap = _extends({}, runtimeDescMap, typeDescMap);
|
|
48
|
+
|
|
49
|
+
export { RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, TYPE_001, errorDescMap, getShortErrorMsg, runtimeDescMap, typeDescMap };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@module-federation/error-codes",
|
|
3
|
+
"description": "Module Federation Error Codes",
|
|
4
|
+
"author": "zhanghang <hanric.zhang@gmail.com>",
|
|
5
|
+
"public": true,
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"version": "0.6.14",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"Module Federation",
|
|
11
|
+
"error codes"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"main": "./index.cjs.js",
|
|
21
|
+
"module": "./index.esm.js",
|
|
22
|
+
"types": "./dist/index.cjs.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": "./dist/index.esm.js",
|
|
26
|
+
"require": "./dist/index.cjs.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"typesVersions": {
|
|
30
|
+
"*": {
|
|
31
|
+
".": [
|
|
32
|
+
"./dist/index.cjs.d.ts"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const runtimeDescMap: {
|
|
2
|
+
"RUNTIME-001": string;
|
|
3
|
+
"RUNTIME-002": string;
|
|
4
|
+
"RUNTIME-003": string;
|
|
5
|
+
"RUNTIME-004": string;
|
|
6
|
+
"RUNTIME-005": string;
|
|
7
|
+
"RUNTIME-006": string;
|
|
8
|
+
"RUNTIME-007": string;
|
|
9
|
+
};
|
|
10
|
+
export declare const typeDescMap: {
|
|
11
|
+
"TYPE-001": string;
|
|
12
|
+
};
|
|
13
|
+
export declare const errorDescMap: {
|
|
14
|
+
"TYPE-001": string;
|
|
15
|
+
"RUNTIME-001": string;
|
|
16
|
+
"RUNTIME-002": string;
|
|
17
|
+
"RUNTIME-003": string;
|
|
18
|
+
"RUNTIME-004": string;
|
|
19
|
+
"RUNTIME-005": string;
|
|
20
|
+
"RUNTIME-006": string;
|
|
21
|
+
"RUNTIME-007": string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const RUNTIME_001 = "RUNTIME-001";
|
|
2
|
+
export declare const RUNTIME_002 = "RUNTIME-002";
|
|
3
|
+
export declare const RUNTIME_003 = "RUNTIME-003";
|
|
4
|
+
export declare const RUNTIME_004 = "RUNTIME-004";
|
|
5
|
+
export declare const RUNTIME_005 = "RUNTIME-005";
|
|
6
|
+
export declare const RUNTIME_006 = "RUNTIME-006";
|
|
7
|
+
export declare const RUNTIME_007 = "RUNTIME-007";
|
|
8
|
+
export declare const TYPE_001 = "TYPE-001";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getShortErrorMsg: (errorCode: string, errorDescMap: Record<string, string>, args?: Record<string, unknown>, originalErrorMsg?: string) => string;
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@module-federation/error-codes",
|
|
3
|
+
"description": "Module Federation Error Codes",
|
|
4
|
+
"author": "zhanghang <hanric.zhang@gmail.com>",
|
|
5
|
+
"public": true,
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"version": "0.6.14",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"Module Federation",
|
|
11
|
+
"error codes"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/index.cjs.js",
|
|
21
|
+
"module": "./dist/index.esm.js",
|
|
22
|
+
"types": "./dist/index.cjs.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": "./dist/index.esm.js",
|
|
26
|
+
"require": "./dist/index.cjs.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"typesVersions": {
|
|
30
|
+
"*": {
|
|
31
|
+
".": [
|
|
32
|
+
"./dist/index.cjs.d.ts"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|