@modern-js/plugin-testing 2.27.0 → 2.29.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +34 -0
- package/dist/cjs/base/config/transformer/babelTransformer.js +2 -2
- package/dist/cjs/base/runJest.js +2 -1
- package/dist/cjs/cli/bff/index.js +2 -2
- package/dist/cjs/cli/bff/setup.js +3 -3
- package/dist/cjs/cli/test.js +3 -3
- package/dist/cjs/runtime-testing/reduck.js +6 -6
- package/dist/esm/base/config/transformer/babelTransformer.js +2 -2
- package/dist/esm/base/runJest.js +2 -2
- package/dist/esm/cli/bff/index.js +2 -2
- package/dist/esm/cli/bff/setup.js +3 -3
- package/dist/esm/cli/test.js +3 -3
- package/dist/esm/runtime-testing/reduck.js +6 -6
- package/dist/esm-node/base/config/transformer/babelTransformer.js +2 -2
- package/dist/esm-node/base/runJest.js +2 -1
- package/dist/esm-node/cli/bff/index.js +2 -2
- package/dist/esm-node/cli/bff/setup.js +3 -3
- package/dist/esm-node/cli/test.js +3 -3
- package/dist/esm-node/runtime-testing/reduck.js +6 -6
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,39 @@
|
|
1
1
|
# @modern-js/plugin-testing
|
2
2
|
|
3
|
+
## 2.29.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [e6b5355]
|
8
|
+
- Updated dependencies [16e5195]
|
9
|
+
- Updated dependencies [93db783]
|
10
|
+
- Updated dependencies [600bb0a]
|
11
|
+
- Updated dependencies [cba7675]
|
12
|
+
- Updated dependencies [fd3e71c]
|
13
|
+
- Updated dependencies [76ace5d]
|
14
|
+
- Updated dependencies [9a81e31]
|
15
|
+
- Updated dependencies [99052ea]
|
16
|
+
- Updated dependencies [1d71d2e]
|
17
|
+
- @modern-js/utils@2.29.0
|
18
|
+
- @modern-js/prod-server@2.29.0
|
19
|
+
- @modern-js/runtime@2.29.0
|
20
|
+
- @modern-js/babel-preset-app@2.29.0
|
21
|
+
- @modern-js/babel-compiler@2.29.0
|
22
|
+
- @modern-js/plugin@2.29.0
|
23
|
+
|
24
|
+
## 2.28.0
|
25
|
+
|
26
|
+
### Patch Changes
|
27
|
+
|
28
|
+
- Updated dependencies [6eae1e7]
|
29
|
+
- Updated dependencies [00b58a7]
|
30
|
+
- @modern-js/prod-server@2.28.0
|
31
|
+
- @modern-js/utils@2.28.0
|
32
|
+
- @modern-js/runtime@2.28.0
|
33
|
+
- @modern-js/babel-preset-app@2.28.0
|
34
|
+
- @modern-js/babel-compiler@2.28.0
|
35
|
+
- @modern-js/plugin@2.28.0
|
36
|
+
|
3
37
|
## 2.27.0
|
4
38
|
|
5
39
|
### Patch Changes
|
@@ -10,8 +10,8 @@ Object.defineProperty(exports, "default", {
|
|
10
10
|
});
|
11
11
|
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
12
12
|
const _babeljest = /* @__PURE__ */ _interop_require_default._(require("babel-jest"));
|
13
|
-
var _babelJest_createTransformer;
|
14
|
-
const babelTransformer = (_babelJest_createTransformer = _babeljest.default.createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(
|
13
|
+
var _babelJest_createTransformer, _babelJest;
|
14
|
+
const babelTransformer = (_babelJest_createTransformer = (_babelJest = _babeljest.default).createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(_babelJest, {
|
15
15
|
presets: [
|
16
16
|
[
|
17
17
|
require.resolve("@modern-js/babel-preset-app"),
|
package/dist/cjs/base/runJest.js
CHANGED
@@ -66,7 +66,8 @@ async function runJest(config, pwd = process.cwd()) {
|
|
66
66
|
]);
|
67
67
|
readResultsAndExit(results, globalConfig);
|
68
68
|
} catch (e) {
|
69
|
-
|
69
|
+
var _e;
|
70
|
+
console.error(_utils.chalk.red(((_e = e) === null || _e === void 0 ? void 0 : _e.stack) || e));
|
70
71
|
process.exit(1);
|
71
72
|
}
|
72
73
|
}
|
@@ -24,7 +24,7 @@ const _base = require("../../base");
|
|
24
24
|
const _constant = require("./constant");
|
25
25
|
const _utils1 = require("./utils");
|
26
26
|
const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, utils }) => {
|
27
|
-
var _userConfig_source;
|
27
|
+
var _userConfig_source, _userConfig;
|
28
28
|
const bffConfig = {
|
29
29
|
rootDir: _path.default.join(pwd, "./api"),
|
30
30
|
setupFilesAfterEnv: [
|
@@ -47,7 +47,7 @@ const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, utils })
|
|
47
47
|
}
|
48
48
|
};
|
49
49
|
const { jestConfig } = utils;
|
50
|
-
const alias = (userConfig === null ||
|
50
|
+
const alias = ((_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_source = _userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.alias) || {};
|
51
51
|
const aliasMapper = (0, _base.getModuleNameMapper)(alias);
|
52
52
|
const { moduleNameMapper } = jestConfig;
|
53
53
|
const transform = {
|
@@ -10,14 +10,14 @@ const _mockAPI = /* @__PURE__ */ _interop_require_default._(require("./mockAPI")
|
|
10
10
|
const _app = require("./app");
|
11
11
|
let uped = false;
|
12
12
|
const setup = () => {
|
13
|
-
var _bff_info_modernUserConfig,
|
13
|
+
var _bff_info_modernUserConfig_bff, _bff_info_modernUserConfig, _bff_info, _bff_info_modernUserConfig_bff1, _bff_info_modernUserConfig1, _bff_info1;
|
14
14
|
if (uped) {
|
15
15
|
return;
|
16
16
|
}
|
17
17
|
uped = true;
|
18
18
|
const bff_info = global[_constant.bff_info_key];
|
19
|
-
const prefix = bff_info === null ||
|
20
|
-
const httpMethodDecider = bff_info === null ||
|
19
|
+
const prefix = (_bff_info = bff_info) === null || _bff_info === void 0 ? void 0 : (_bff_info_modernUserConfig = _bff_info.modernUserConfig) === null || _bff_info_modernUserConfig === void 0 ? void 0 : (_bff_info_modernUserConfig_bff = _bff_info_modernUserConfig.bff) === null || _bff_info_modernUserConfig_bff === void 0 ? void 0 : _bff_info_modernUserConfig_bff.prefix;
|
20
|
+
const httpMethodDecider = (_bff_info1 = bff_info) === null || _bff_info1 === void 0 ? void 0 : (_bff_info_modernUserConfig1 = _bff_info1.modernUserConfig) === null || _bff_info_modernUserConfig1 === void 0 ? void 0 : (_bff_info_modernUserConfig_bff1 = _bff_info_modernUserConfig1.bff) === null || _bff_info_modernUserConfig_bff1 === void 0 ? void 0 : _bff_info_modernUserConfig_bff1.httpMethodDecider;
|
21
21
|
let app = null;
|
22
22
|
beforeAll(async () => {
|
23
23
|
const apiRouter = new _bffcore.ApiRouter({
|
package/dist/cjs/cli/test.js
CHANGED
@@ -13,15 +13,15 @@ const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
13
13
|
const _babelcompiler = require("@modern-js/babel-compiler");
|
14
14
|
const _base = require("../base");
|
15
15
|
const test = async (api) => {
|
16
|
-
var _userConfig_tools, _userConfig_tools1;
|
16
|
+
var _userConfig_tools, _userConfig, _userConfig_tools1, _userConfig1;
|
17
17
|
const userConfig = api.useResolvedConfigContext();
|
18
18
|
const appContext = api.useAppContext();
|
19
19
|
userConfig.testing = userConfig.testing || {};
|
20
|
-
const jest = userConfig.testing.jest || (userConfig === null ||
|
20
|
+
const jest = userConfig.testing.jest || ((_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_tools = _userConfig.tools) === null || _userConfig_tools === void 0 ? void 0 : _userConfig_tools.jest);
|
21
21
|
if (Array.isArray(jest)) {
|
22
22
|
userConfig.testing.jest = jest[0];
|
23
23
|
}
|
24
|
-
userConfig.testing.jest = userConfig.testing.jest || (userConfig === null ||
|
24
|
+
userConfig.testing.jest = userConfig.testing.jest || ((_userConfig1 = userConfig) === null || _userConfig1 === void 0 ? void 0 : (_userConfig_tools1 = _userConfig1.tools) === null || _userConfig_tools1 === void 0 ? void 0 : _userConfig_tools1.jest);
|
25
25
|
const runtimeExportsPath = _path.default.join(appContext.internalDirectory, ".runtime-exports");
|
26
26
|
await (0, _babelcompiler.compiler)({
|
27
27
|
sourceDir: runtimeExportsPath,
|
@@ -34,20 +34,20 @@ const immer = () => _pluginimmutable.default;
|
|
34
34
|
const autoActions = () => _pluginautoactions.default;
|
35
35
|
const createStore = (props) => {
|
36
36
|
const createStatePlugins = () => {
|
37
|
-
var _modernConfig_runtime;
|
37
|
+
var _modernConfig_runtime, _modernConfig, _stateConfig, _stateConfig1, _stateConfig2, _props;
|
38
38
|
const modernConfig = global[_constant.MODERNJS_CONFIG_KEY];
|
39
|
-
const stateConfig = modernConfig === null ||
|
39
|
+
const stateConfig = (_modernConfig = modernConfig) === null || _modernConfig === void 0 ? void 0 : (_modernConfig_runtime = _modernConfig.runtime) === null || _modernConfig_runtime === void 0 ? void 0 : _modernConfig_runtime.state;
|
40
40
|
const plugins = [];
|
41
|
-
if ((stateConfig === null ||
|
41
|
+
if (((_stateConfig = stateConfig) === null || _stateConfig === void 0 ? void 0 : _stateConfig.effects) !== false) {
|
42
42
|
plugins.push(effects());
|
43
43
|
}
|
44
|
-
if ((stateConfig === null ||
|
44
|
+
if (((_stateConfig1 = stateConfig) === null || _stateConfig1 === void 0 ? void 0 : _stateConfig1.autoActions) !== false) {
|
45
45
|
plugins.push(autoActions());
|
46
46
|
}
|
47
|
-
if ((stateConfig === null ||
|
47
|
+
if (((_stateConfig2 = stateConfig) === null || _stateConfig2 === void 0 ? void 0 : _stateConfig2.immer) !== false) {
|
48
48
|
plugins.push(immer());
|
49
49
|
}
|
50
|
-
return ((props === null ||
|
50
|
+
return (((_props = props) === null || _props === void 0 ? void 0 : _props.plugins) || []).concat(plugins);
|
51
51
|
};
|
52
52
|
const config = {
|
53
53
|
...props || {},
|
@@ -1,6 +1,6 @@
|
|
1
|
-
var _babelJest_createTransformer;
|
1
|
+
var _babelJest_createTransformer, _babelJest;
|
2
2
|
import babelJest from "babel-jest";
|
3
|
-
var babelTransformer = (_babelJest_createTransformer = babelJest.createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(
|
3
|
+
var babelTransformer = (_babelJest_createTransformer = (_babelJest = babelJest).createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(_babelJest, {
|
4
4
|
presets: [
|
5
5
|
[
|
6
6
|
require.resolve("@modern-js/babel-preset-app"),
|
package/dist/esm/base/runJest.js
CHANGED
@@ -64,7 +64,7 @@ export function runJest(config) {
|
|
64
64
|
}
|
65
65
|
function _runJest() {
|
66
66
|
_runJest = _async_to_generator(function(config) {
|
67
|
-
var pwd, argvConfig, _ref, results, globalConfig, e;
|
67
|
+
var pwd, argvConfig, _ref, results, globalConfig, e, _e;
|
68
68
|
var _arguments = arguments;
|
69
69
|
return _ts_generator(this, function(_state) {
|
70
70
|
switch (_state.label) {
|
@@ -99,7 +99,7 @@ function _runJest() {
|
|
99
99
|
];
|
100
100
|
case 4:
|
101
101
|
e = _state.sent();
|
102
|
-
console.error(chalk.red((e === null ||
|
102
|
+
console.error(chalk.red(((_e = e) === null || _e === void 0 ? void 0 : _e.stack) || e));
|
103
103
|
process.exit(1);
|
104
104
|
return [
|
105
105
|
3,
|
@@ -9,7 +9,7 @@ import { bff_info_key } from "./constant";
|
|
9
9
|
import { isBFFProject } from "./utils";
|
10
10
|
export var setJestConfigForBFF = function() {
|
11
11
|
var _ref = _async_to_generator(function(param) {
|
12
|
-
var pwd, userConfig, plugins, routes, utils, _userConfig_source, bffConfig, jestConfig, alias, aliasMapper, moduleNameMapper, transform, apiOnly, mergedModuleNameMapper, resolver, configFields, commonConfig;
|
12
|
+
var pwd, userConfig, plugins, routes, utils, _userConfig_source, _userConfig, bffConfig, jestConfig, alias, aliasMapper, moduleNameMapper, transform, apiOnly, mergedModuleNameMapper, resolver, configFields, commonConfig;
|
13
13
|
return _ts_generator(this, function(_state) {
|
14
14
|
switch (_state.label) {
|
15
15
|
case 0:
|
@@ -34,7 +34,7 @@ export var setJestConfigForBFF = function() {
|
|
34
34
|
})
|
35
35
|
};
|
36
36
|
jestConfig = utils.jestConfig;
|
37
|
-
alias = (userConfig === null ||
|
37
|
+
alias = ((_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_source = _userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.alias) || {};
|
38
38
|
aliasMapper = getModuleNameMapper(alias);
|
39
39
|
moduleNameMapper = jestConfig.moduleNameMapper;
|
40
40
|
transform = {
|
@@ -7,14 +7,14 @@ import mockAPI from "./mockAPI";
|
|
7
7
|
import { createApp, closeServer } from "./app";
|
8
8
|
var uped = false;
|
9
9
|
var setup = function() {
|
10
|
-
var _bff_info_modernUserConfig,
|
10
|
+
var _bff_info_modernUserConfig_bff, _bff_info_modernUserConfig, _bff_info, _bff_info_modernUserConfig_bff1, _bff_info_modernUserConfig1, _bff_info1;
|
11
11
|
if (uped) {
|
12
12
|
return;
|
13
13
|
}
|
14
14
|
uped = true;
|
15
15
|
var bff_info = global[bff_info_key];
|
16
|
-
var prefix = bff_info === null ||
|
17
|
-
var httpMethodDecider = bff_info === null ||
|
16
|
+
var prefix = (_bff_info = bff_info) === null || _bff_info === void 0 ? void 0 : (_bff_info_modernUserConfig = _bff_info.modernUserConfig) === null || _bff_info_modernUserConfig === void 0 ? void 0 : (_bff_info_modernUserConfig_bff = _bff_info_modernUserConfig.bff) === null || _bff_info_modernUserConfig_bff === void 0 ? void 0 : _bff_info_modernUserConfig_bff.prefix;
|
17
|
+
var httpMethodDecider = (_bff_info1 = bff_info) === null || _bff_info1 === void 0 ? void 0 : (_bff_info_modernUserConfig1 = _bff_info1.modernUserConfig) === null || _bff_info_modernUserConfig1 === void 0 ? void 0 : (_bff_info_modernUserConfig_bff1 = _bff_info_modernUserConfig1.bff) === null || _bff_info_modernUserConfig_bff1 === void 0 ? void 0 : _bff_info_modernUserConfig_bff1.httpMethodDecider;
|
18
18
|
var app = null;
|
19
19
|
beforeAll(/* @__PURE__ */ _async_to_generator(function() {
|
20
20
|
var apiRouter, apiInfos, apiInfosByFile;
|
package/dist/esm/cli/test.js
CHANGED
@@ -5,18 +5,18 @@ import { compiler } from "@modern-js/babel-compiler";
|
|
5
5
|
import { runTest } from "../base";
|
6
6
|
var test = function() {
|
7
7
|
var _ref = _async_to_generator(function(api) {
|
8
|
-
var _userConfig_tools, _userConfig_tools1, userConfig, appContext, jest, runtimeExportsPath;
|
8
|
+
var _userConfig_tools, _userConfig, _userConfig_tools1, _userConfig1, userConfig, appContext, jest, runtimeExportsPath;
|
9
9
|
return _ts_generator(this, function(_state) {
|
10
10
|
switch (_state.label) {
|
11
11
|
case 0:
|
12
12
|
userConfig = api.useResolvedConfigContext();
|
13
13
|
appContext = api.useAppContext();
|
14
14
|
userConfig.testing = userConfig.testing || {};
|
15
|
-
jest = userConfig.testing.jest || (userConfig === null ||
|
15
|
+
jest = userConfig.testing.jest || ((_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_tools = _userConfig.tools) === null || _userConfig_tools === void 0 ? void 0 : _userConfig_tools.jest);
|
16
16
|
if (Array.isArray(jest)) {
|
17
17
|
userConfig.testing.jest = jest[0];
|
18
18
|
}
|
19
|
-
userConfig.testing.jest = userConfig.testing.jest || (userConfig === null ||
|
19
|
+
userConfig.testing.jest = userConfig.testing.jest || ((_userConfig1 = userConfig) === null || _userConfig1 === void 0 ? void 0 : (_userConfig_tools1 = _userConfig1.tools) === null || _userConfig_tools1 === void 0 ? void 0 : _userConfig_tools1.jest);
|
20
20
|
runtimeExportsPath = path.join(appContext.internalDirectory, ".runtime-exports");
|
21
21
|
return [
|
22
22
|
4,
|
@@ -16,20 +16,20 @@ export var autoActions = function() {
|
|
16
16
|
};
|
17
17
|
export var createStore = function(props) {
|
18
18
|
var createStatePlugins = function() {
|
19
|
-
var _modernConfig_runtime;
|
19
|
+
var _modernConfig_runtime, _modernConfig, _stateConfig, _stateConfig1, _stateConfig2, _props;
|
20
20
|
var modernConfig = global[MODERNJS_CONFIG_KEY];
|
21
|
-
var stateConfig = modernConfig === null ||
|
21
|
+
var stateConfig = (_modernConfig = modernConfig) === null || _modernConfig === void 0 ? void 0 : (_modernConfig_runtime = _modernConfig.runtime) === null || _modernConfig_runtime === void 0 ? void 0 : _modernConfig_runtime.state;
|
22
22
|
var plugins = [];
|
23
|
-
if ((stateConfig === null ||
|
23
|
+
if (((_stateConfig = stateConfig) === null || _stateConfig === void 0 ? void 0 : _stateConfig.effects) !== false) {
|
24
24
|
plugins.push(effects());
|
25
25
|
}
|
26
|
-
if ((stateConfig === null ||
|
26
|
+
if (((_stateConfig1 = stateConfig) === null || _stateConfig1 === void 0 ? void 0 : _stateConfig1.autoActions) !== false) {
|
27
27
|
plugins.push(autoActions());
|
28
28
|
}
|
29
|
-
if ((stateConfig === null ||
|
29
|
+
if (((_stateConfig2 = stateConfig) === null || _stateConfig2 === void 0 ? void 0 : _stateConfig2.immer) !== false) {
|
30
30
|
plugins.push(immer());
|
31
31
|
}
|
32
|
-
return ((props === null ||
|
32
|
+
return (((_props = props) === null || _props === void 0 ? void 0 : _props.plugins) || []).concat(plugins);
|
33
33
|
};
|
34
34
|
var config = _object_spread_props(_object_spread({}, props || {}), {
|
35
35
|
plugins: createStatePlugins()
|
@@ -1,6 +1,6 @@
|
|
1
|
-
var _babelJest_createTransformer;
|
1
|
+
var _babelJest_createTransformer, _babelJest;
|
2
2
|
import babelJest from "babel-jest";
|
3
|
-
const babelTransformer = (_babelJest_createTransformer = babelJest.createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(
|
3
|
+
const babelTransformer = (_babelJest_createTransformer = (_babelJest = babelJest).createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(_babelJest, {
|
4
4
|
presets: [
|
5
5
|
[
|
6
6
|
require.resolve("@modern-js/babel-preset-app"),
|
@@ -46,7 +46,8 @@ export async function runJest(config, pwd = process.cwd()) {
|
|
46
46
|
]);
|
47
47
|
readResultsAndExit(results, globalConfig);
|
48
48
|
} catch (e) {
|
49
|
-
|
49
|
+
var _e;
|
50
|
+
console.error(chalk.red(((_e = e) === null || _e === void 0 ? void 0 : _e.stack) || e));
|
50
51
|
process.exit(1);
|
51
52
|
}
|
52
53
|
}
|
@@ -4,7 +4,7 @@ import { getModuleNameMapper, DEFAULT_RESOLVER_PATH } from "../../base";
|
|
4
4
|
import { bff_info_key } from "./constant";
|
5
5
|
import { isBFFProject } from "./utils";
|
6
6
|
export const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, utils }) => {
|
7
|
-
var _userConfig_source;
|
7
|
+
var _userConfig_source, _userConfig;
|
8
8
|
const bffConfig = {
|
9
9
|
rootDir: path.join(pwd, "./api"),
|
10
10
|
setupFilesAfterEnv: [
|
@@ -27,7 +27,7 @@ export const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, ut
|
|
27
27
|
}
|
28
28
|
};
|
29
29
|
const { jestConfig } = utils;
|
30
|
-
const alias = (userConfig === null ||
|
30
|
+
const alias = ((_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_source = _userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.alias) || {};
|
31
31
|
const aliasMapper = getModuleNameMapper(alias);
|
32
32
|
const { moduleNameMapper } = jestConfig;
|
33
33
|
const transform = {
|
@@ -5,14 +5,14 @@ import mockAPI from "./mockAPI";
|
|
5
5
|
import { createApp, closeServer } from "./app";
|
6
6
|
let uped = false;
|
7
7
|
const setup = () => {
|
8
|
-
var _bff_info_modernUserConfig,
|
8
|
+
var _bff_info_modernUserConfig_bff, _bff_info_modernUserConfig, _bff_info, _bff_info_modernUserConfig_bff1, _bff_info_modernUserConfig1, _bff_info1;
|
9
9
|
if (uped) {
|
10
10
|
return;
|
11
11
|
}
|
12
12
|
uped = true;
|
13
13
|
const bff_info = global[bff_info_key];
|
14
|
-
const prefix = bff_info === null ||
|
15
|
-
const httpMethodDecider = bff_info === null ||
|
14
|
+
const prefix = (_bff_info = bff_info) === null || _bff_info === void 0 ? void 0 : (_bff_info_modernUserConfig = _bff_info.modernUserConfig) === null || _bff_info_modernUserConfig === void 0 ? void 0 : (_bff_info_modernUserConfig_bff = _bff_info_modernUserConfig.bff) === null || _bff_info_modernUserConfig_bff === void 0 ? void 0 : _bff_info_modernUserConfig_bff.prefix;
|
15
|
+
const httpMethodDecider = (_bff_info1 = bff_info) === null || _bff_info1 === void 0 ? void 0 : (_bff_info_modernUserConfig1 = _bff_info1.modernUserConfig) === null || _bff_info_modernUserConfig1 === void 0 ? void 0 : (_bff_info_modernUserConfig_bff1 = _bff_info_modernUserConfig1.bff) === null || _bff_info_modernUserConfig_bff1 === void 0 ? void 0 : _bff_info_modernUserConfig_bff1.httpMethodDecider;
|
16
16
|
let app = null;
|
17
17
|
beforeAll(async () => {
|
18
18
|
const apiRouter = new ApiRouter({
|
@@ -2,15 +2,15 @@ import path from "path";
|
|
2
2
|
import { compiler } from "@modern-js/babel-compiler";
|
3
3
|
import { runTest } from "../base";
|
4
4
|
const test = async (api) => {
|
5
|
-
var _userConfig_tools, _userConfig_tools1;
|
5
|
+
var _userConfig_tools, _userConfig, _userConfig_tools1, _userConfig1;
|
6
6
|
const userConfig = api.useResolvedConfigContext();
|
7
7
|
const appContext = api.useAppContext();
|
8
8
|
userConfig.testing = userConfig.testing || {};
|
9
|
-
const jest = userConfig.testing.jest || (userConfig === null ||
|
9
|
+
const jest = userConfig.testing.jest || ((_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_tools = _userConfig.tools) === null || _userConfig_tools === void 0 ? void 0 : _userConfig_tools.jest);
|
10
10
|
if (Array.isArray(jest)) {
|
11
11
|
userConfig.testing.jest = jest[0];
|
12
12
|
}
|
13
|
-
userConfig.testing.jest = userConfig.testing.jest || (userConfig === null ||
|
13
|
+
userConfig.testing.jest = userConfig.testing.jest || ((_userConfig1 = userConfig) === null || _userConfig1 === void 0 ? void 0 : (_userConfig_tools1 = _userConfig1.tools) === null || _userConfig_tools1 === void 0 ? void 0 : _userConfig_tools1.jest);
|
14
14
|
const runtimeExportsPath = path.join(appContext.internalDirectory, ".runtime-exports");
|
15
15
|
await compiler({
|
16
16
|
sourceDir: runtimeExportsPath,
|
@@ -8,20 +8,20 @@ export const immer = () => immerPlugin;
|
|
8
8
|
export const autoActions = () => autoActionsPlugin;
|
9
9
|
export const createStore = (props) => {
|
10
10
|
const createStatePlugins = () => {
|
11
|
-
var _modernConfig_runtime;
|
11
|
+
var _modernConfig_runtime, _modernConfig, _stateConfig, _stateConfig1, _stateConfig2, _props;
|
12
12
|
const modernConfig = global[MODERNJS_CONFIG_KEY];
|
13
|
-
const stateConfig = modernConfig === null ||
|
13
|
+
const stateConfig = (_modernConfig = modernConfig) === null || _modernConfig === void 0 ? void 0 : (_modernConfig_runtime = _modernConfig.runtime) === null || _modernConfig_runtime === void 0 ? void 0 : _modernConfig_runtime.state;
|
14
14
|
const plugins = [];
|
15
|
-
if ((stateConfig === null ||
|
15
|
+
if (((_stateConfig = stateConfig) === null || _stateConfig === void 0 ? void 0 : _stateConfig.effects) !== false) {
|
16
16
|
plugins.push(effects());
|
17
17
|
}
|
18
|
-
if ((stateConfig === null ||
|
18
|
+
if (((_stateConfig1 = stateConfig) === null || _stateConfig1 === void 0 ? void 0 : _stateConfig1.autoActions) !== false) {
|
19
19
|
plugins.push(autoActions());
|
20
20
|
}
|
21
|
-
if ((stateConfig === null ||
|
21
|
+
if (((_stateConfig2 = stateConfig) === null || _stateConfig2 === void 0 ? void 0 : _stateConfig2.immer) !== false) {
|
22
22
|
plugins.push(immer());
|
23
23
|
}
|
24
|
-
return ((props === null ||
|
24
|
+
return (((_props = props) === null || _props === void 0 ? void 0 : _props.plugins) || []).concat(plugins);
|
25
25
|
};
|
26
26
|
const config = {
|
27
27
|
...props || {},
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.29.0",
|
19
19
|
"jsnext:source": "./src/cli/index.ts",
|
20
20
|
"types": "./dist/types/cli/index.d.ts",
|
21
21
|
"main": "./dist/cjs/cli/index.js",
|
@@ -129,16 +129,16 @@
|
|
129
129
|
"ts-jest": "^29.1.0",
|
130
130
|
"yargs": "^17.0.1",
|
131
131
|
"@swc/helpers": "0.5.1",
|
132
|
-
"@modern-js/babel-preset-app": "2.
|
133
|
-
"@modern-js/babel-compiler": "2.
|
134
|
-
"@modern-js/utils": "2.
|
135
|
-
"@modern-js/plugin": "2.
|
136
|
-
"@modern-js/prod-server": "2.
|
132
|
+
"@modern-js/babel-preset-app": "2.29.0",
|
133
|
+
"@modern-js/babel-compiler": "2.29.0",
|
134
|
+
"@modern-js/utils": "2.29.0",
|
135
|
+
"@modern-js/plugin": "2.29.0",
|
136
|
+
"@modern-js/prod-server": "2.29.0"
|
137
137
|
},
|
138
138
|
"peerDependencies": {
|
139
139
|
"react": ">=17",
|
140
140
|
"react-dom": ">=17",
|
141
|
-
"@modern-js/runtime": "^2.
|
141
|
+
"@modern-js/runtime": "^2.29.0"
|
142
142
|
},
|
143
143
|
"peerDependenciesMeta": {
|
144
144
|
"@modern-js/runtime": {
|
@@ -153,12 +153,12 @@
|
|
153
153
|
"@types/node": "^14",
|
154
154
|
"@types/yargs": "^17.0.2",
|
155
155
|
"typescript": "^5",
|
156
|
-
"@modern-js/core": "2.
|
157
|
-
"@modern-js/types": "2.
|
158
|
-
"@modern-js/runtime": "2.
|
159
|
-
"@modern-js/bff-core": "2.
|
160
|
-
"@scripts/build": "2.
|
161
|
-
"@scripts/jest-config": "2.
|
156
|
+
"@modern-js/core": "2.29.0",
|
157
|
+
"@modern-js/types": "2.29.0",
|
158
|
+
"@modern-js/runtime": "2.29.0",
|
159
|
+
"@modern-js/bff-core": "2.29.0",
|
160
|
+
"@scripts/build": "2.29.0",
|
161
|
+
"@scripts/jest-config": "2.29.0"
|
162
162
|
},
|
163
163
|
"sideEffects": false,
|
164
164
|
"publishConfig": {
|