@modern-js/plugin-testing 2.19.1 → 2.20.1-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/base/config/resolver.js +2 -6
- package/dist/cjs/base/config/testConfigOperator.js +5 -17
- package/dist/cjs/base/config/transformer/babelTransformer.js +2 -6
- package/dist/cjs/base/index.js +2 -14
- package/dist/cjs/base/runJest.js +2 -6
- package/dist/cjs/base/utils.js +3 -7
- package/dist/cjs/cli/bff/index.js +5 -6
- package/dist/cjs/cli/bff/mockAPI.js +3 -42
- package/dist/cjs/cli/bff/setup.js +3 -7
- package/dist/cjs/cli/bff/utils/index.js +2 -6
- package/dist/cjs/cli/index.js +4 -8
- package/dist/cjs/cli/test.js +2 -6
- package/dist/cjs/index.js +2 -14
- package/dist/cjs/runtime-testing/app.js +5 -21
- package/dist/cjs/runtime-testing/base.js +4 -20
- package/dist/cjs/runtime-testing/customRender.js +3 -7
- package/dist/cjs/runtime-testing/index.js +3 -15
- package/dist/cjs/runtime-testing/reduck.js +4 -8
- package/dist/cjs/runtime-testing/request.js +2 -6
- package/dist/esm/base/config/index.js +3 -132
- package/dist/esm/base/config/patches/index.js +4 -133
- package/dist/esm/base/config/testConfigOperator.js +4 -50
- package/dist/esm/base/runJest.js +5 -134
- package/dist/esm/base/utils.js +1 -28
- package/dist/esm/cli/bff/app.js +4 -133
- package/dist/esm/cli/bff/index.js +9 -161
- package/dist/esm/cli/bff/mockAPI.js +4 -100
- package/dist/esm/cli/bff/setup.js +4 -133
- package/dist/esm/cli/bff/utils/index.js +1 -28
- package/dist/esm/cli/index.js +5 -146
- package/dist/esm/cli/test.js +3 -132
- package/dist/esm/runtime-testing/app.js +4 -50
- package/dist/esm/runtime-testing/customRender.js +1 -28
- package/dist/esm/runtime-testing/reduck.js +2 -52
- package/dist/esm/runtime-testing/request.js +2 -44
- package/dist/esm/runtime-testing/resolvePlugins.js +1 -28
- package/dist/esm-node/base/config/testConfigOperator.js +1 -13
- package/dist/esm-node/cli/bff/index.js +3 -0
- package/dist/esm-node/runtime-testing/app.js +1 -13
- package/dist/js/modern/base/config/index.js +36 -0
- package/dist/js/modern/base/config/patches/assetsModule.js +11 -0
- package/dist/js/modern/base/config/patches/filemock.js +4 -0
- package/dist/js/modern/base/config/patches/index.js +34 -0
- package/dist/js/modern/base/config/patches/transformer.js +38 -0
- package/dist/js/modern/base/config/resolver.js +21 -0
- package/dist/js/modern/base/config/testConfigOperator.js +69 -0
- package/dist/js/modern/base/config/transformer/babelTransformer.js +19 -0
- package/dist/js/modern/base/hook.js +12 -0
- package/dist/js/modern/base/index.js +14 -0
- package/dist/js/modern/base/runJest.js +102 -0
- package/dist/js/modern/base/types/index.js +0 -0
- package/dist/js/modern/base/utils.js +66 -0
- package/dist/js/modern/cli/bff/app.js +58 -0
- package/dist/js/modern/cli/bff/constant.js +4 -0
- package/dist/js/modern/cli/bff/index.js +149 -0
- package/dist/js/modern/cli/bff/mockAPI.js +109 -0
- package/dist/js/modern/cli/bff/setup.js +75 -0
- package/dist/js/modern/cli/bff/utils/index.js +37 -0
- package/dist/js/modern/cli/index.js +115 -0
- package/dist/js/modern/cli/test.js +61 -0
- package/dist/js/modern/constant.js +4 -0
- package/dist/js/modern/index.js +3 -0
- package/dist/js/modern/runtime-testing/app.js +48 -0
- package/dist/js/modern/runtime-testing/base.js +7 -0
- package/dist/js/modern/runtime-testing/customRender.js +25 -0
- package/dist/js/modern/runtime-testing/index.js +2 -0
- package/dist/js/modern/runtime-testing/reduck.js +55 -0
- package/dist/js/modern/runtime-testing/request.js +16 -0
- package/dist/js/modern/runtime-testing/resolvePlugins.js +33 -0
- package/dist/js/node/base/config/index.js +67 -0
- package/dist/js/node/base/config/patches/assetsModule.js +40 -0
- package/dist/js/node/base/config/patches/filemock.js +25 -0
- package/dist/js/node/base/config/patches/index.js +57 -0
- package/dist/js/node/base/config/patches/transformer.js +67 -0
- package/dist/js/node/base/config/resolver.js +30 -0
- package/dist/js/node/base/config/testConfigOperator.js +90 -0
- package/dist/js/node/base/config/transformer/babelTransformer.js +46 -0
- package/dist/js/node/base/hook.js +37 -0
- package/dist/js/node/base/index.js +43 -0
- package/dist/js/node/base/runJest.js +132 -0
- package/dist/js/node/base/types/index.js +15 -0
- package/dist/js/node/base/utils.js +95 -0
- package/dist/js/node/cli/bff/app.js +84 -0
- package/dist/js/node/cli/bff/constant.js +27 -0
- package/dist/js/node/cli/bff/index.js +173 -0
- package/dist/js/node/cli/bff/mockAPI.js +134 -0
- package/dist/js/node/cli/bff/setup.js +84 -0
- package/dist/js/node/cli/bff/utils/index.js +64 -0
- package/dist/js/node/cli/index.js +135 -0
- package/dist/js/node/cli/test.js +88 -0
- package/dist/js/node/constant.js +27 -0
- package/dist/js/node/index.js +19 -0
- package/dist/js/node/runtime-testing/app.js +73 -0
- package/dist/js/node/runtime-testing/base.js +38 -0
- package/dist/js/node/runtime-testing/customRender.js +50 -0
- package/dist/js/node/runtime-testing/index.js +18 -0
- package/dist/js/node/runtime-testing/reduck.js +85 -0
- package/dist/js/node/runtime-testing/request.js +45 -0
- package/dist/js/node/runtime-testing/resolvePlugins.js +52 -0
- package/dist/js/treeshaking/base/config/index.js +154 -0
- package/dist/js/treeshaking/base/config/patches/assetsModule.js +9 -0
- package/dist/js/treeshaking/base/config/patches/filemock.js +2 -0
- package/dist/js/treeshaking/base/config/patches/index.js +225 -0
- package/dist/js/treeshaking/base/config/patches/transformer.js +36 -0
- package/dist/js/treeshaking/base/config/resolver.js +37 -0
- package/dist/js/treeshaking/base/config/testConfigOperator.js +127 -0
- package/dist/js/treeshaking/base/config/transformer/babelTransformer.js +17 -0
- package/dist/js/treeshaking/base/hook.js +8 -0
- package/dist/js/treeshaking/base/index.js +7 -0
- package/dist/js/treeshaking/base/runJest.js +292 -0
- package/dist/js/treeshaking/base/types/index.js +1 -0
- package/dist/js/treeshaking/base/utils.js +76 -0
- package/dist/js/treeshaking/cli/bff/app.js +200 -0
- package/dist/js/treeshaking/cli/bff/constant.js +2 -0
- package/dist/js/treeshaking/cli/bff/index.js +297 -0
- package/dist/js/treeshaking/cli/bff/mockAPI.js +188 -0
- package/dist/js/treeshaking/cli/bff/setup.js +192 -0
- package/dist/js/treeshaking/cli/bff/utils/index.js +47 -0
- package/dist/js/treeshaking/cli/index.js +255 -0
- package/dist/js/treeshaking/cli/test.js +180 -0
- package/dist/js/treeshaking/constant.js +2 -0
- package/dist/js/treeshaking/index.js +3 -0
- package/dist/js/treeshaking/runtime-testing/app.js +90 -0
- package/dist/js/treeshaking/runtime-testing/base.js +4 -0
- package/dist/js/treeshaking/runtime-testing/customRender.js +41 -0
- package/dist/js/treeshaking/runtime-testing/index.js +2 -0
- package/dist/js/treeshaking/runtime-testing/reduck.js +89 -0
- package/dist/js/treeshaking/runtime-testing/request.js +51 -0
- package/dist/js/treeshaking/runtime-testing/resolvePlugins.js +46 -0
- package/dist/types/base/config/index.d.ts +0 -1
- package/dist/types/base/config/patches/assetsModule.d.ts +0 -1
- package/dist/types/base/config/patches/filemock.d.ts +0 -1
- package/dist/types/base/config/patches/transformer.d.ts +0 -1
- package/dist/types/base/config/testConfigOperator.d.ts +0 -2
- package/dist/types/base/runJest.d.ts +0 -2
- package/dist/types/base/utils.d.ts +0 -1
- package/dist/types/cli/bff/index.d.ts +0 -2
- package/dist/types/cli/bff/mockAPI.d.ts +0 -1
- package/dist/types/cli/index.d.ts +0 -2
- package/dist/types/runtime-testing/app.d.ts +0 -3
- package/dist/types/runtime-testing/customRender.d.ts +0 -2
- package/package.json +18 -18
@@ -0,0 +1,27 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var constant_exports = {};
|
19
|
+
__export(constant_exports, {
|
20
|
+
MODERNJS_CONFIG_KEY: () => MODERNJS_CONFIG_KEY
|
21
|
+
});
|
22
|
+
module.exports = __toCommonJS(constant_exports);
|
23
|
+
const MODERNJS_CONFIG_KEY = "__modernjs_config__";
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
25
|
+
0 && (module.exports = {
|
26
|
+
MODERNJS_CONFIG_KEY
|
27
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
7
|
+
for (let key of __getOwnPropNames(from))
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
10
|
+
}
|
11
|
+
return to;
|
12
|
+
};
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
+
var src_exports = {};
|
16
|
+
module.exports = __toCommonJS(src_exports);
|
17
|
+
var import_extend_expect = require("@testing-library/jest-dom/extend-expect");
|
18
|
+
var import_jest_dom = require("@testing-library/jest-dom");
|
19
|
+
__reExport(src_exports, require("./runtime-testing"), module.exports);
|
@@ -0,0 +1,73 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
10
|
+
var __spreadValues = (a, b) => {
|
11
|
+
for (var prop in b || (b = {}))
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
if (__getOwnPropSymbols)
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
16
|
+
if (__propIsEnum.call(b, prop))
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
18
|
+
}
|
19
|
+
return a;
|
20
|
+
};
|
21
|
+
var __export = (target, all) => {
|
22
|
+
for (var name in all)
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
24
|
+
};
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
27
|
+
for (let key of __getOwnPropNames(from))
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
30
|
+
}
|
31
|
+
return to;
|
32
|
+
};
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
35
|
+
mod
|
36
|
+
));
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
38
|
+
var app_exports = {};
|
39
|
+
__export(app_exports, {
|
40
|
+
default: () => app_default
|
41
|
+
});
|
42
|
+
module.exports = __toCommonJS(app_exports);
|
43
|
+
var import_runtime = require("@modern-js/runtime");
|
44
|
+
var import_constant = require("../constant");
|
45
|
+
var import_resolvePlugins = __toESM(require("./resolvePlugins"));
|
46
|
+
class ModernRuntime {
|
47
|
+
constructor(options) {
|
48
|
+
this.options = options;
|
49
|
+
}
|
50
|
+
init(options) {
|
51
|
+
this.options = options;
|
52
|
+
}
|
53
|
+
createApp(props) {
|
54
|
+
var _a, _b;
|
55
|
+
const { entry, children } = props || {};
|
56
|
+
let runtimeFeatures = (_a = this.options) == null ? void 0 : _a.runtime;
|
57
|
+
if (entry) {
|
58
|
+
runtimeFeatures = __spreadValues(__spreadValues({}, runtimeFeatures || {}), (_b = this.options.runtimeByEntries) == null ? void 0 : _b[entry]);
|
59
|
+
}
|
60
|
+
const Component = () => {
|
61
|
+
if (!children) {
|
62
|
+
return null;
|
63
|
+
}
|
64
|
+
return children;
|
65
|
+
};
|
66
|
+
return (0, import_runtime.createApp)({
|
67
|
+
plugins: (0, import_resolvePlugins.default)(runtimeFeatures || {})
|
68
|
+
})(Component);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
var app_default = new ModernRuntime(global[import_constant.MODERNJS_CONFIG_KEY] || {});
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
73
|
+
0 && (module.exports = {});
|
@@ -0,0 +1,38 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
|
+
mod
|
23
|
+
));
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
25
|
+
var base_exports = {};
|
26
|
+
__export(base_exports, {
|
27
|
+
renderApp: () => import_customRender.default,
|
28
|
+
testBff: () => import_request.request
|
29
|
+
});
|
30
|
+
module.exports = __toCommonJS(base_exports);
|
31
|
+
var import_customRender = __toESM(require("./customRender"));
|
32
|
+
__reExport(base_exports, require("@testing-library/react"), module.exports);
|
33
|
+
var import_request = require("./request");
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
35
|
+
0 && (module.exports = {
|
36
|
+
renderApp,
|
37
|
+
testBff
|
38
|
+
});
|
@@ -0,0 +1,50 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
10
|
+
var __spreadValues = (a, b) => {
|
11
|
+
for (var prop in b || (b = {}))
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
if (__getOwnPropSymbols)
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
16
|
+
if (__propIsEnum.call(b, prop))
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
18
|
+
}
|
19
|
+
return a;
|
20
|
+
};
|
21
|
+
var __export = (target, all) => {
|
22
|
+
for (var name in all)
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
24
|
+
};
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
27
|
+
for (let key of __getOwnPropNames(from))
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
30
|
+
}
|
31
|
+
return to;
|
32
|
+
};
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
35
|
+
mod
|
36
|
+
));
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
38
|
+
var customRender_exports = {};
|
39
|
+
__export(customRender_exports, {
|
40
|
+
default: () => customRender_default
|
41
|
+
});
|
42
|
+
module.exports = __toCommonJS(customRender_exports);
|
43
|
+
var import_react = __toESM(require("react"));
|
44
|
+
var import_react2 = require("@testing-library/react");
|
45
|
+
var import_app = __toESM(require("./app"));
|
46
|
+
const WrapModernProviders = (props) => import_react.default.createElement(import_app.default.createApp(props));
|
47
|
+
const customRender = (ui, options) => (0, import_react2.render)(ui, __spreadValues({ wrapper: WrapModernProviders }, options));
|
48
|
+
var customRender_default = customRender;
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
50
|
+
0 && (module.exports = {});
|
@@ -0,0 +1,18 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
7
|
+
for (let key of __getOwnPropNames(from))
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
10
|
+
}
|
11
|
+
return to;
|
12
|
+
};
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
+
var runtime_testing_exports = {};
|
16
|
+
module.exports = __toCommonJS(runtime_testing_exports);
|
17
|
+
__reExport(runtime_testing_exports, require("./base"), module.exports);
|
18
|
+
__reExport(runtime_testing_exports, require("./reduck"), module.exports);
|
@@ -0,0 +1,85 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __defProps = Object.defineProperties;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
12
|
+
var __spreadValues = (a, b) => {
|
13
|
+
for (var prop in b || (b = {}))
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
if (__getOwnPropSymbols)
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
18
|
+
if (__propIsEnum.call(b, prop))
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
20
|
+
}
|
21
|
+
return a;
|
22
|
+
};
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
24
|
+
var __export = (target, all) => {
|
25
|
+
for (var name in all)
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
27
|
+
};
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
30
|
+
for (let key of __getOwnPropNames(from))
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
33
|
+
}
|
34
|
+
return to;
|
35
|
+
};
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
38
|
+
mod
|
39
|
+
));
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
41
|
+
var reduck_exports = {};
|
42
|
+
__export(reduck_exports, {
|
43
|
+
autoActions: () => autoActions,
|
44
|
+
createStore: () => createStore,
|
45
|
+
effects: () => effects,
|
46
|
+
immer: () => immer
|
47
|
+
});
|
48
|
+
module.exports = __toCommonJS(reduck_exports);
|
49
|
+
var import_store = require("@modern-js-reduck/store");
|
50
|
+
var import_plugin_effects = __toESM(require("@modern-js-reduck/plugin-effects"));
|
51
|
+
var import_plugin_auto_actions = __toESM(require("@modern-js-reduck/plugin-auto-actions"));
|
52
|
+
var import_plugin_immutable = __toESM(require("@modern-js-reduck/plugin-immutable"));
|
53
|
+
var import_constant = require("../constant");
|
54
|
+
const effects = () => import_plugin_effects.default;
|
55
|
+
const immer = () => import_plugin_immutable.default;
|
56
|
+
const autoActions = () => import_plugin_auto_actions.default;
|
57
|
+
const createStore = (props) => {
|
58
|
+
const createStatePlugins = () => {
|
59
|
+
var _a;
|
60
|
+
const modernConfig = global[import_constant.MODERNJS_CONFIG_KEY];
|
61
|
+
const stateConfig = (_a = modernConfig == null ? void 0 : modernConfig.runtime) == null ? void 0 : _a.state;
|
62
|
+
const plugins = [];
|
63
|
+
if ((stateConfig == null ? void 0 : stateConfig.effects) !== false) {
|
64
|
+
plugins.push(effects());
|
65
|
+
}
|
66
|
+
if ((stateConfig == null ? void 0 : stateConfig.autoActions) !== false) {
|
67
|
+
plugins.push(autoActions());
|
68
|
+
}
|
69
|
+
if ((stateConfig == null ? void 0 : stateConfig.immer) !== false) {
|
70
|
+
plugins.push(immer());
|
71
|
+
}
|
72
|
+
return ((props == null ? void 0 : props.plugins) || []).concat(plugins);
|
73
|
+
};
|
74
|
+
const config = __spreadProps(__spreadValues({}, props || {}), {
|
75
|
+
plugins: createStatePlugins()
|
76
|
+
});
|
77
|
+
return (0, import_store.createStore)(config);
|
78
|
+
};
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
80
|
+
0 && (module.exports = {
|
81
|
+
autoActions,
|
82
|
+
createStore,
|
83
|
+
effects,
|
84
|
+
immer
|
85
|
+
});
|
@@ -0,0 +1,45 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var request_exports = {};
|
25
|
+
__export(request_exports, {
|
26
|
+
request: () => request
|
27
|
+
});
|
28
|
+
module.exports = __toCommonJS(request_exports);
|
29
|
+
var import_supertest = __toESM(require("supertest"));
|
30
|
+
var import_app = require("../cli/bff/app");
|
31
|
+
function request(...args) {
|
32
|
+
const [fn, ...extraArgs] = args;
|
33
|
+
const app = (0, import_app.getApp)();
|
34
|
+
if (!fn) {
|
35
|
+
return (0, import_supertest.default)(app);
|
36
|
+
}
|
37
|
+
fn.returnHttp = true;
|
38
|
+
const res = fn(...extraArgs);
|
39
|
+
fn.returnHttp = false;
|
40
|
+
return res;
|
41
|
+
}
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
43
|
+
0 && (module.exports = {
|
44
|
+
request
|
45
|
+
});
|
@@ -0,0 +1,52 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
+
var __spreadValues = (a, b) => {
|
9
|
+
for (var prop in b || (b = {}))
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
12
|
+
if (__getOwnPropSymbols)
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
14
|
+
if (__propIsEnum.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
}
|
17
|
+
return a;
|
18
|
+
};
|
19
|
+
var __export = (target, all) => {
|
20
|
+
for (var name in all)
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
22
|
+
};
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
25
|
+
for (let key of __getOwnPropNames(from))
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
28
|
+
}
|
29
|
+
return to;
|
30
|
+
};
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
32
|
+
var resolvePlugins_exports = {};
|
33
|
+
__export(resolvePlugins_exports, {
|
34
|
+
default: () => resolvePlugins
|
35
|
+
});
|
36
|
+
module.exports = __toCommonJS(resolvePlugins_exports);
|
37
|
+
const allowedFeatures = ["router", "state"];
|
38
|
+
function resolvePlugins(features) {
|
39
|
+
const plugins = [];
|
40
|
+
if (!features) {
|
41
|
+
return plugins;
|
42
|
+
}
|
43
|
+
Object.keys(features).forEach((feature) => {
|
44
|
+
if (allowedFeatures.includes(feature)) {
|
45
|
+
const curPluginRes = require(`@modern-js/runtime/plugins`)[feature](__spreadValues({}, features[feature]));
|
46
|
+
plugins.push(curPluginRes);
|
47
|
+
}
|
48
|
+
});
|
49
|
+
return plugins;
|
50
|
+
}
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
52
|
+
0 && (module.exports = {});
|
@@ -0,0 +1,154 @@
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
2
|
+
try {
|
3
|
+
var info = gen[key](arg);
|
4
|
+
var value = info.value;
|
5
|
+
} catch (error) {
|
6
|
+
reject(error);
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
if (info.done) {
|
10
|
+
resolve(value);
|
11
|
+
} else {
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
function _asyncToGenerator(fn) {
|
16
|
+
return function() {
|
17
|
+
var self = this, args = arguments;
|
18
|
+
return new Promise(function(resolve, reject) {
|
19
|
+
var gen = fn.apply(self, args);
|
20
|
+
function _next(value) {
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
22
|
+
}
|
23
|
+
function _throw(err) {
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
25
|
+
}
|
26
|
+
_next(undefined);
|
27
|
+
});
|
28
|
+
};
|
29
|
+
}
|
30
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
31
|
+
var f, y, t, g, _ = {
|
32
|
+
label: 0,
|
33
|
+
sent: function() {
|
34
|
+
if (t[0] & 1) throw t[1];
|
35
|
+
return t[1];
|
36
|
+
},
|
37
|
+
trys: [],
|
38
|
+
ops: []
|
39
|
+
};
|
40
|
+
return(g = {
|
41
|
+
next: verb(0),
|
42
|
+
"throw": verb(1),
|
43
|
+
"return": verb(2)
|
44
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
45
|
+
return this;
|
46
|
+
}), g);
|
47
|
+
function verb(n) {
|
48
|
+
return function(v) {
|
49
|
+
return step([
|
50
|
+
n,
|
51
|
+
v
|
52
|
+
]);
|
53
|
+
};
|
54
|
+
}
|
55
|
+
function step(op) {
|
56
|
+
if (f) throw new TypeError("Generator is already executing.");
|
57
|
+
while(_)try {
|
58
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
59
|
+
if (y = 0, t) op = [
|
60
|
+
op[0] & 2,
|
61
|
+
t.value
|
62
|
+
];
|
63
|
+
switch(op[0]){
|
64
|
+
case 0:
|
65
|
+
case 1:
|
66
|
+
t = op;
|
67
|
+
break;
|
68
|
+
case 4:
|
69
|
+
_.label++;
|
70
|
+
return {
|
71
|
+
value: op[1],
|
72
|
+
done: false
|
73
|
+
};
|
74
|
+
case 5:
|
75
|
+
_.label++;
|
76
|
+
y = op[1];
|
77
|
+
op = [
|
78
|
+
0
|
79
|
+
];
|
80
|
+
continue;
|
81
|
+
case 7:
|
82
|
+
op = _.ops.pop();
|
83
|
+
_.trys.pop();
|
84
|
+
continue;
|
85
|
+
default:
|
86
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
87
|
+
_ = 0;
|
88
|
+
continue;
|
89
|
+
}
|
90
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
91
|
+
_.label = op[1];
|
92
|
+
break;
|
93
|
+
}
|
94
|
+
if (op[0] === 6 && _.label < t[1]) {
|
95
|
+
_.label = t[1];
|
96
|
+
t = op;
|
97
|
+
break;
|
98
|
+
}
|
99
|
+
if (t && _.label < t[2]) {
|
100
|
+
_.label = t[2];
|
101
|
+
_.ops.push(op);
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
if (t[2]) _.ops.pop();
|
105
|
+
_.trys.pop();
|
106
|
+
continue;
|
107
|
+
}
|
108
|
+
op = body.call(thisArg, _);
|
109
|
+
} catch (e) {
|
110
|
+
op = [
|
111
|
+
6,
|
112
|
+
e
|
113
|
+
];
|
114
|
+
y = 0;
|
115
|
+
} finally{
|
116
|
+
f = t = 0;
|
117
|
+
}
|
118
|
+
if (op[0] & 5) throw op[1];
|
119
|
+
return {
|
120
|
+
value: op[0] ? op[1] : void 0,
|
121
|
+
done: true
|
122
|
+
};
|
123
|
+
}
|
124
|
+
};
|
125
|
+
import { applyPatches } from "./patches";
|
126
|
+
import { TestConfigOperator } from "./testConfigOperator";
|
127
|
+
var getJestUtils = function(testConfig) {
|
128
|
+
var testOperator = new TestConfigOperator(testConfig);
|
129
|
+
return testOperator;
|
130
|
+
};
|
131
|
+
var patchConfig = function() {
|
132
|
+
var _ref = _asyncToGenerator(function(testOperator) {
|
133
|
+
return __generator(this, function(_state) {
|
134
|
+
switch(_state.label){
|
135
|
+
case 0:
|
136
|
+
return [
|
137
|
+
4,
|
138
|
+
applyPatches(testOperator)
|
139
|
+
];
|
140
|
+
case 1:
|
141
|
+
_state.sent();
|
142
|
+
return [
|
143
|
+
2,
|
144
|
+
testOperator.jestConfig
|
145
|
+
];
|
146
|
+
}
|
147
|
+
});
|
148
|
+
});
|
149
|
+
return function patchConfig(testOperator) {
|
150
|
+
return _ref.apply(this, arguments);
|
151
|
+
};
|
152
|
+
}();
|
153
|
+
var DEFAULT_RESOLVER_PATH = require.resolve("./resolver");
|
154
|
+
export { DEFAULT_RESOLVER_PATH, getJestUtils, patchConfig };
|
@@ -0,0 +1,9 @@
|
|
1
|
+
var patchAssetsModule = function(testOperator) {
|
2
|
+
testOperator.mergeJestConfig({
|
3
|
+
moduleNameMapper: {
|
4
|
+
"\\.(css|less|scss|sass)$": require.resolve("identity-obj-proxy"),
|
5
|
+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": require.resolve("./filemock.js")
|
6
|
+
}
|
7
|
+
});
|
8
|
+
};
|
9
|
+
export { patchAssetsModule };
|