@modern-js/plugin-testing 2.4.1-beta.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +40 -6
- package/dist/{js/node → cjs}/base/config/index.js +7 -23
- package/dist/{js/node → cjs}/base/config/patches/assetsModule.js +4 -0
- package/dist/{js/node → cjs}/base/config/patches/index.js +6 -26
- package/dist/{js/node → cjs}/base/config/patches/transformer.js +4 -0
- package/dist/{js/node → cjs}/base/config/resolver.js +4 -0
- package/dist/{js/node → cjs}/base/config/testConfigOperator.js +1 -15
- package/dist/{js/node → cjs}/base/config/transformer/babelTransformer.js +4 -0
- package/dist/{js/node → cjs}/base/runJest.js +28 -48
- package/dist/{js/node → cjs}/base/utils.js +8 -15
- package/dist/{js/node → cjs}/cli/bff/app.js +6 -26
- package/dist/{js/node → cjs}/cli/bff/index.js +26 -49
- package/dist/{js/node → cjs}/cli/bff/mockAPI.js +9 -16
- package/dist/{js/node → cjs}/cli/bff/setup.js +10 -26
- package/dist/{js/node → cjs}/cli/bff/utils/index.js +5 -15
- package/dist/{js/node → cjs}/cli/index.js +13 -26
- package/dist/{js/node → cjs}/cli/test.js +8 -24
- package/dist/{js/node → cjs}/runtime-testing/app.js +8 -15
- package/dist/{js/node → cjs}/runtime-testing/base.js +4 -0
- package/dist/{js/node → cjs}/runtime-testing/customRender.js +5 -15
- package/dist/{js/node → cjs}/runtime-testing/reduck.js +7 -19
- package/dist/{js/node → cjs}/runtime-testing/request.js +4 -0
- package/dist/{js/node → cjs}/runtime-testing/resolvePlugins.js +3 -15
- package/dist/{js/treeshaking → esm}/cli/index.js +3 -0
- package/dist/esm-node/base/config/index.js +16 -0
- package/dist/esm-node/base/config/patches/index.js +14 -0
- package/dist/{js/modern → esm-node}/base/config/testConfigOperator.js +1 -17
- package/dist/esm-node/base/runJest.js +78 -0
- package/dist/{js/modern → esm-node}/base/utils.js +4 -17
- package/dist/esm-node/cli/bff/app.js +38 -0
- package/dist/{js/modern → esm-node}/cli/bff/index.js +22 -51
- package/dist/{js/modern → esm-node}/cli/bff/mockAPI.js +5 -18
- package/dist/esm-node/cli/bff/setup.js +46 -0
- package/dist/esm-node/cli/bff/utils/index.js +21 -0
- package/dist/{js/modern → esm-node}/cli/index.js +9 -26
- package/dist/{js/modern → esm-node}/cli/test.js +4 -24
- package/dist/esm-node/runtime-testing/app.js +35 -0
- package/dist/esm-node/runtime-testing/customRender.js +9 -0
- package/dist/{js/modern → esm-node}/runtime-testing/reduck.js +3 -21
- package/dist/esm-node/runtime-testing/resolvePlugins.js +19 -0
- package/package.json +25 -26
- package/dist/js/modern/base/config/index.js +0 -36
- package/dist/js/modern/base/config/patches/index.js +0 -34
- package/dist/js/modern/base/runJest.js +0 -102
- package/dist/js/modern/cli/bff/app.js +0 -58
- package/dist/js/modern/cli/bff/setup.js +0 -75
- package/dist/js/modern/cli/bff/utils/index.js +0 -37
- package/dist/js/modern/runtime-testing/app.js +0 -48
- package/dist/js/modern/runtime-testing/customRender.js +0 -25
- package/dist/js/modern/runtime-testing/resolvePlugins.js +0 -33
- /package/dist/{js/node → cjs}/base/config/patches/filemock.js +0 -0
- /package/dist/{js/node → cjs}/base/hook.js +0 -0
- /package/dist/{js/node → cjs}/base/index.js +0 -0
- /package/dist/{js/node → cjs}/base/types/index.js +0 -0
- /package/dist/{js/node → cjs}/cli/bff/constant.js +0 -0
- /package/dist/{js/node → cjs}/constant.js +0 -0
- /package/dist/{js/node → cjs}/index.js +0 -0
- /package/dist/{js/node → cjs}/runtime-testing/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/config/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/config/patches/assetsModule.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/config/patches/filemock.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/config/patches/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/config/patches/transformer.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/config/resolver.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/config/testConfigOperator.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/config/transformer/babelTransformer.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/hook.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/runJest.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/types/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/base/utils.js +0 -0
- /package/dist/{js/treeshaking → esm}/cli/bff/app.js +0 -0
- /package/dist/{js/treeshaking → esm}/cli/bff/constant.js +0 -0
- /package/dist/{js/treeshaking → esm}/cli/bff/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/cli/bff/mockAPI.js +0 -0
- /package/dist/{js/treeshaking → esm}/cli/bff/setup.js +0 -0
- /package/dist/{js/treeshaking → esm}/cli/bff/utils/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/cli/test.js +0 -0
- /package/dist/{js/treeshaking → esm}/constant.js +0 -0
- /package/dist/{js/treeshaking → esm}/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime-testing/app.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime-testing/base.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime-testing/customRender.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime-testing/index.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime-testing/reduck.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime-testing/request.js +0 -0
- /package/dist/{js/treeshaking → esm}/runtime-testing/resolvePlugins.js +0 -0
- /package/dist/{js/modern → esm-node}/base/config/patches/assetsModule.js +0 -0
- /package/dist/{js/modern → esm-node}/base/config/patches/filemock.js +0 -0
- /package/dist/{js/modern → esm-node}/base/config/patches/transformer.js +0 -0
- /package/dist/{js/modern → esm-node}/base/config/resolver.js +0 -0
- /package/dist/{js/modern → esm-node}/base/config/transformer/babelTransformer.js +0 -0
- /package/dist/{js/modern → esm-node}/base/hook.js +0 -0
- /package/dist/{js/modern → esm-node}/base/index.js +0 -0
- /package/dist/{js/modern → esm-node}/base/types/index.js +0 -0
- /package/dist/{js/modern → esm-node}/cli/bff/constant.js +0 -0
- /package/dist/{js/modern → esm-node}/constant.js +0 -0
- /package/dist/{js/modern → esm-node}/index.js +0 -0
- /package/dist/{js/modern → esm-node}/runtime-testing/base.js +0 -0
- /package/dist/{js/modern → esm-node}/runtime-testing/index.js +0 -0
- /package/dist/{js/modern → esm-node}/runtime-testing/request.js +0 -0
@@ -1,34 +0,0 @@
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
2
|
-
return new Promise((resolve, reject) => {
|
3
|
-
var fulfilled = (value) => {
|
4
|
-
try {
|
5
|
-
step(generator.next(value));
|
6
|
-
} catch (e) {
|
7
|
-
reject(e);
|
8
|
-
}
|
9
|
-
};
|
10
|
-
var rejected = (value) => {
|
11
|
-
try {
|
12
|
-
step(generator.throw(value));
|
13
|
-
} catch (e) {
|
14
|
-
reject(e);
|
15
|
-
}
|
16
|
-
};
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
19
|
-
});
|
20
|
-
};
|
21
|
-
import { patchTransformer } from "./transformer";
|
22
|
-
import { patchAssetsModule } from "./assetsModule";
|
23
|
-
const _applyPatches = (patches2, testOperator) => __async(void 0, null, function* () {
|
24
|
-
for (const patch of patches2) {
|
25
|
-
yield patch(testOperator);
|
26
|
-
}
|
27
|
-
});
|
28
|
-
const patches = [patchTransformer, patchAssetsModule];
|
29
|
-
const applyPatches = (testConfig) => __async(void 0, null, function* () {
|
30
|
-
yield _applyPatches(patches, testConfig);
|
31
|
-
});
|
32
|
-
export {
|
33
|
-
applyPatches
|
34
|
-
};
|
@@ -1,102 +0,0 @@
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
2
|
-
return new Promise((resolve, reject) => {
|
3
|
-
var fulfilled = (value) => {
|
4
|
-
try {
|
5
|
-
step(generator.next(value));
|
6
|
-
} catch (e) {
|
7
|
-
reject(e);
|
8
|
-
}
|
9
|
-
};
|
10
|
-
var rejected = (value) => {
|
11
|
-
try {
|
12
|
-
step(generator.throw(value));
|
13
|
-
} catch (e) {
|
14
|
-
reject(e);
|
15
|
-
}
|
16
|
-
};
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
19
|
-
});
|
20
|
-
};
|
21
|
-
import yargs from "yargs/yargs";
|
22
|
-
import { runCLI } from "jest";
|
23
|
-
import { chalk } from "@modern-js/utils";
|
24
|
-
import { getJestUtils, patchConfig } from "./config";
|
25
|
-
import { debug } from "./utils";
|
26
|
-
const buildArgv = (rawArgv, config) => __async(void 0, null, function* () {
|
27
|
-
const argv = yield yargs(rawArgv).argv;
|
28
|
-
const result = {
|
29
|
-
$0: argv.$0,
|
30
|
-
_: argv._.slice(1)
|
31
|
-
};
|
32
|
-
Object.keys(argv).forEach((key) => {
|
33
|
-
if (key.includes("-") || key === "_") {
|
34
|
-
return;
|
35
|
-
}
|
36
|
-
result[key] = argv[key];
|
37
|
-
});
|
38
|
-
if (config) {
|
39
|
-
result.config = JSON.stringify(config);
|
40
|
-
}
|
41
|
-
return result;
|
42
|
-
});
|
43
|
-
const readResultsAndExit = (result, globalConfig) => {
|
44
|
-
const code = !result || result.success ? 0 : globalConfig.testFailureExitCode;
|
45
|
-
process.on("exit", () => {
|
46
|
-
if (typeof code === "number" && code !== 0) {
|
47
|
-
process.exitCode = code;
|
48
|
-
}
|
49
|
-
});
|
50
|
-
if (globalConfig.forceExit) {
|
51
|
-
if (!globalConfig.detectOpenHandles) {
|
52
|
-
console.warn(
|
53
|
-
`${chalk.bold(
|
54
|
-
"Force exiting Jest: "
|
55
|
-
)}Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?`
|
56
|
-
);
|
57
|
-
}
|
58
|
-
process.exit(code);
|
59
|
-
} else if (!globalConfig.detectOpenHandles) {
|
60
|
-
setTimeout(() => {
|
61
|
-
console.warn(
|
62
|
-
chalk.yellow.bold(
|
63
|
-
"Jest did not exit one second after the test run has completed.\n\n"
|
64
|
-
) + chalk.yellow(
|
65
|
-
"This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue."
|
66
|
-
)
|
67
|
-
);
|
68
|
-
}, 1e3).unref();
|
69
|
-
}
|
70
|
-
};
|
71
|
-
function runJest(_0) {
|
72
|
-
return __async(this, arguments, function* (config, pwd = process.cwd()) {
|
73
|
-
try {
|
74
|
-
const argvConfig = yield buildArgv(process.argv.slice(2), config);
|
75
|
-
const { results, globalConfig } = yield runCLI(argvConfig, [pwd]);
|
76
|
-
readResultsAndExit(results, globalConfig);
|
77
|
-
} catch (e) {
|
78
|
-
console.error(chalk.red((e == null ? void 0 : e.stack) || e));
|
79
|
-
process.exit(1);
|
80
|
-
}
|
81
|
-
});
|
82
|
-
}
|
83
|
-
function runTest(_0, _1) {
|
84
|
-
return __async(this, arguments, function* (api, config, pwd = process.cwd()) {
|
85
|
-
process.env.NODE_ENV = "test";
|
86
|
-
const jestUtils = getJestUtils(config);
|
87
|
-
yield patchConfig(jestUtils);
|
88
|
-
jestUtils.setJestUserConfig();
|
89
|
-
const hookRunners = api.useHookRunners();
|
90
|
-
const testConfigOperator = yield hookRunners.jestConfig(jestUtils, {
|
91
|
-
onLast: (input) => input
|
92
|
-
});
|
93
|
-
const finalConfig = testConfigOperator.getFinalConfig();
|
94
|
-
debug("Jest config:", finalConfig);
|
95
|
-
yield runJest(finalConfig, pwd);
|
96
|
-
yield hookRunners.afterTest();
|
97
|
-
});
|
98
|
-
}
|
99
|
-
export {
|
100
|
-
runJest,
|
101
|
-
runTest
|
102
|
-
};
|
@@ -1,58 +0,0 @@
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
2
|
-
return new Promise((resolve, reject) => {
|
3
|
-
var fulfilled = (value) => {
|
4
|
-
try {
|
5
|
-
step(generator.next(value));
|
6
|
-
} catch (e) {
|
7
|
-
reject(e);
|
8
|
-
}
|
9
|
-
};
|
10
|
-
var rejected = (value) => {
|
11
|
-
try {
|
12
|
-
step(generator.throw(value));
|
13
|
-
} catch (e) {
|
14
|
-
reject(e);
|
15
|
-
}
|
16
|
-
};
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
19
|
-
});
|
20
|
-
};
|
21
|
-
import { AsyncLocalStorage } from "async_hooks";
|
22
|
-
import { Server } from "@modern-js/prod-server";
|
23
|
-
const store = new AsyncLocalStorage();
|
24
|
-
const isInHandler = () => Boolean(store.getStore());
|
25
|
-
let server = null;
|
26
|
-
const createApp = (pwd, config, plugins, routes) => __async(void 0, null, function* () {
|
27
|
-
if (!server) {
|
28
|
-
config.output.path = "./";
|
29
|
-
server = new Server({
|
30
|
-
apiOnly: true,
|
31
|
-
pwd,
|
32
|
-
config,
|
33
|
-
internalPlugins: plugins,
|
34
|
-
routes
|
35
|
-
});
|
36
|
-
yield server.init();
|
37
|
-
}
|
38
|
-
const app = server.getRequestHandler();
|
39
|
-
return app;
|
40
|
-
});
|
41
|
-
const getApp = () => {
|
42
|
-
if (!server) {
|
43
|
-
throw new Error("please createApp first");
|
44
|
-
}
|
45
|
-
return server.getRequestHandler();
|
46
|
-
};
|
47
|
-
const closeServer = () => __async(void 0, null, function* () {
|
48
|
-
if (!server) {
|
49
|
-
throw new Error("please createApp first");
|
50
|
-
}
|
51
|
-
yield server.close();
|
52
|
-
});
|
53
|
-
export {
|
54
|
-
closeServer,
|
55
|
-
createApp,
|
56
|
-
getApp,
|
57
|
-
isInHandler
|
58
|
-
};
|
@@ -1,75 +0,0 @@
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
2
|
-
var __commonJS = (cb, mod) => function __require() {
|
3
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
4
|
-
};
|
5
|
-
var __async = (__this, __arguments, generator) => {
|
6
|
-
return new Promise((resolve, reject) => {
|
7
|
-
var fulfilled = (value) => {
|
8
|
-
try {
|
9
|
-
step(generator.next(value));
|
10
|
-
} catch (e) {
|
11
|
-
reject(e);
|
12
|
-
}
|
13
|
-
};
|
14
|
-
var rejected = (value) => {
|
15
|
-
try {
|
16
|
-
step(generator.throw(value));
|
17
|
-
} catch (e) {
|
18
|
-
reject(e);
|
19
|
-
}
|
20
|
-
};
|
21
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
22
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
23
|
-
});
|
24
|
-
};
|
25
|
-
import path from "path";
|
26
|
-
import { ApiRouter } from "@modern-js/bff-core";
|
27
|
-
import { bff_info_key } from "./constant";
|
28
|
-
import mockAPI from "./mockAPI";
|
29
|
-
import { createApp, closeServer } from "./app";
|
30
|
-
var require_setup = __commonJS({
|
31
|
-
"src/cli/bff/setup.ts"(exports) {
|
32
|
-
let uped = false;
|
33
|
-
const setup = () => {
|
34
|
-
var _a, _b;
|
35
|
-
if (uped) {
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
uped = true;
|
39
|
-
const bff_info = global[bff_info_key];
|
40
|
-
const prefix = (_b = (_a = bff_info == null ? void 0 : bff_info.modernUserConfig) == null ? void 0 : _a.bff) == null ? void 0 : _b.prefix;
|
41
|
-
const apiRouter = new ApiRouter({
|
42
|
-
apiDir: path.join(bff_info.appDir, "./api"),
|
43
|
-
prefix
|
44
|
-
});
|
45
|
-
const apiInfos = apiRouter.getApiHandlers();
|
46
|
-
const apiInfosByFile = apiInfos.reduce(
|
47
|
-
(res, apiInfo) => {
|
48
|
-
if (!res[apiInfo.filename]) {
|
49
|
-
res[apiInfo.filename] = [];
|
50
|
-
}
|
51
|
-
res[apiInfo.filename].push(apiInfo);
|
52
|
-
return res;
|
53
|
-
},
|
54
|
-
{}
|
55
|
-
);
|
56
|
-
let app = null;
|
57
|
-
beforeAll(() => __async(exports, null, function* () {
|
58
|
-
if (!app) {
|
59
|
-
app = yield createApp(
|
60
|
-
bff_info.appDir,
|
61
|
-
bff_info.modernUserConfig,
|
62
|
-
bff_info.plugins,
|
63
|
-
bff_info.routes
|
64
|
-
);
|
65
|
-
}
|
66
|
-
}));
|
67
|
-
afterAll(() => __async(exports, null, function* () {
|
68
|
-
yield closeServer();
|
69
|
-
}));
|
70
|
-
mockAPI(apiInfosByFile);
|
71
|
-
};
|
72
|
-
setup();
|
73
|
-
}
|
74
|
-
});
|
75
|
-
export default require_setup();
|
@@ -1,37 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
-
var __spreadValues = (a, b) => {
|
7
|
-
for (var prop in b || (b = {}))
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
10
|
-
if (__getOwnPropSymbols)
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
-
if (__propIsEnum.call(b, prop))
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
14
|
-
}
|
15
|
-
return a;
|
16
|
-
};
|
17
|
-
import path from "path";
|
18
|
-
import { chalk } from "@modern-js/utils";
|
19
|
-
const isBFFProject = (pwd) => {
|
20
|
-
try {
|
21
|
-
const packageJson = require(path.join(pwd, "./package.json"));
|
22
|
-
const { dependencies, devDependencies } = packageJson;
|
23
|
-
const isBFF = Object.keys(__spreadValues(__spreadValues({}, dependencies), devDependencies)).some(
|
24
|
-
(dependency) => dependency.includes("plugin-bff")
|
25
|
-
);
|
26
|
-
const isMWA = Object.keys(devDependencies).some(
|
27
|
-
(devDependency) => devDependency.includes("app-tools")
|
28
|
-
);
|
29
|
-
return isMWA && isBFF;
|
30
|
-
} catch (error) {
|
31
|
-
console.log(chalk.red(error));
|
32
|
-
return false;
|
33
|
-
}
|
34
|
-
};
|
35
|
-
export {
|
36
|
-
isBFFProject
|
37
|
-
};
|
@@ -1,48 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
-
var __spreadValues = (a, b) => {
|
7
|
-
for (var prop in b || (b = {}))
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
10
|
-
if (__getOwnPropSymbols)
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
-
if (__propIsEnum.call(b, prop))
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
14
|
-
}
|
15
|
-
return a;
|
16
|
-
};
|
17
|
-
import { createApp } from "@modern-js/runtime";
|
18
|
-
import { MODERNJS_CONFIG_KEY } from "../constant";
|
19
|
-
import resolvePlugins from "./resolvePlugins";
|
20
|
-
class ModernRuntime {
|
21
|
-
constructor(options) {
|
22
|
-
this.options = options;
|
23
|
-
}
|
24
|
-
init(options) {
|
25
|
-
this.options = options;
|
26
|
-
}
|
27
|
-
createApp(props) {
|
28
|
-
var _a, _b;
|
29
|
-
const { entry, children } = props || {};
|
30
|
-
let runtimeFeatures = (_a = this.options) == null ? void 0 : _a.runtime;
|
31
|
-
if (entry) {
|
32
|
-
runtimeFeatures = __spreadValues(__spreadValues({}, runtimeFeatures || {}), (_b = this.options.runtimeByEntries) == null ? void 0 : _b[entry]);
|
33
|
-
}
|
34
|
-
const Component = () => {
|
35
|
-
if (!children) {
|
36
|
-
return null;
|
37
|
-
}
|
38
|
-
return children;
|
39
|
-
};
|
40
|
-
return createApp({
|
41
|
-
plugins: resolvePlugins(runtimeFeatures || {})
|
42
|
-
})(Component);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
var app_default = new ModernRuntime(global[MODERNJS_CONFIG_KEY] || {});
|
46
|
-
export {
|
47
|
-
app_default as default
|
48
|
-
};
|
@@ -1,25 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
-
var __spreadValues = (a, b) => {
|
7
|
-
for (var prop in b || (b = {}))
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
10
|
-
if (__getOwnPropSymbols)
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
-
if (__propIsEnum.call(b, prop))
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
14
|
-
}
|
15
|
-
return a;
|
16
|
-
};
|
17
|
-
import React from "react";
|
18
|
-
import { render } from "@testing-library/react";
|
19
|
-
import app from "./app";
|
20
|
-
const WrapModernProviders = (props) => React.createElement(app.createApp(props));
|
21
|
-
const customRender = (ui, options) => render(ui, __spreadValues({ wrapper: WrapModernProviders }, options));
|
22
|
-
var customRender_default = customRender;
|
23
|
-
export {
|
24
|
-
customRender_default as default
|
25
|
-
};
|
@@ -1,33 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
-
var __spreadValues = (a, b) => {
|
7
|
-
for (var prop in b || (b = {}))
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
10
|
-
if (__getOwnPropSymbols)
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
-
if (__propIsEnum.call(b, prop))
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
14
|
-
}
|
15
|
-
return a;
|
16
|
-
};
|
17
|
-
const allowedFeatures = ["router", "state"];
|
18
|
-
function resolvePlugins(features) {
|
19
|
-
const plugins = [];
|
20
|
-
if (!features) {
|
21
|
-
return plugins;
|
22
|
-
}
|
23
|
-
Object.keys(features).forEach((feature) => {
|
24
|
-
if (allowedFeatures.includes(feature)) {
|
25
|
-
const curPluginRes = require(`@modern-js/runtime/plugins`)[feature](__spreadValues({}, features[feature]));
|
26
|
-
plugins.push(curPluginRes);
|
27
|
-
}
|
28
|
-
});
|
29
|
-
return plugins;
|
30
|
-
}
|
31
|
-
export {
|
32
|
-
resolvePlugins as default
|
33
|
-
};
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|