@modern-js/plugin-testing 2.35.1 → 2.37.0
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/dist/cjs/base/config/index.js +41 -22
- package/dist/cjs/base/config/patches/assetsModule.js +34 -7
- package/dist/cjs/base/config/patches/filemock.js +21 -8
- package/dist/cjs/base/config/patches/index.js +28 -11
- package/dist/cjs/base/config/patches/transformer.js +36 -9
- package/dist/cjs/base/config/resolver.js +24 -6
- package/dist/cjs/base/config/testConfigOperator.js +32 -15
- package/dist/cjs/base/config/transformer/babelTransformer.js +35 -18
- package/dist/cjs/base/hook.js +32 -23
- package/dist/cjs/base/index.js +41 -34
- package/dist/cjs/base/runJest.js +48 -29
- package/dist/cjs/base/types/index.js +15 -3
- package/dist/cjs/base/utils.js +46 -28
- package/dist/cjs/cli/bff/app.js +33 -25
- package/dist/cjs/cli/bff/constant.js +24 -7
- package/dist/cjs/cli/bff/index.js +46 -27
- package/dist/cjs/cli/bff/mockAPI.js +40 -18
- package/dist/cjs/cli/bff/setup.js +33 -15
- package/dist/cjs/cli/bff/utils/index.js +38 -12
- package/dist/cjs/cli/index.js +56 -40
- package/dist/cjs/cli/test.js +37 -15
- package/dist/cjs/constant.js +24 -7
- package/dist/cjs/index.js +22 -6
- package/dist/cjs/runtime-testing/app.js +38 -17
- package/dist/cjs/runtime-testing/base.js +38 -11
- package/dist/cjs/runtime-testing/bff.js +38 -12
- package/dist/cjs/runtime-testing/customRender.js +36 -14
- package/dist/cjs/runtime-testing/index.js +22 -5
- package/dist/cjs/runtime-testing/reduck.js +49 -32
- package/dist/cjs/runtime-testing/resolvePlugins.js +21 -8
- package/dist/esm/base/config/index.js +6 -2
- package/dist/esm/base/config/patches/assetsModule.js +4 -1
- package/dist/esm/base/config/patches/filemock.js +4 -1
- package/dist/esm/base/config/patches/index.js +4 -1
- package/dist/esm/base/config/patches/transformer.js +4 -1
- package/dist/esm/base/config/resolver.js +31 -22
- package/dist/esm/base/config/testConfigOperator.js +3 -1
- package/dist/esm/base/config/transformer/babelTransformer.js +6 -8
- package/dist/esm/base/hook.js +8 -3
- package/dist/esm/base/index.js +13 -5
- package/dist/esm/base/runJest.js +6 -2
- package/dist/esm/base/types/index.js +0 -1
- package/dist/esm/base/utils.js +8 -3
- package/dist/esm/cli/bff/app.js +10 -5
- package/dist/esm/cli/bff/constant.js +4 -1
- package/dist/esm/cli/bff/index.js +15 -11
- package/dist/esm/cli/bff/mockAPI.js +4 -1
- package/dist/esm/cli/bff/setup.js +2 -2
- package/dist/esm/cli/bff/utils/index.js +4 -1
- package/dist/esm/cli/index.js +10 -4
- package/dist/esm/cli/test.js +4 -1
- package/dist/esm/constant.js +4 -1
- package/dist/esm/runtime-testing/app.js +4 -1
- package/dist/esm/runtime-testing/base.js +4 -1
- package/dist/esm/runtime-testing/bff.js +3 -1
- package/dist/esm/runtime-testing/customRender.js +4 -1
- package/dist/esm/runtime-testing/reduck.js +10 -4
- package/dist/esm/runtime-testing/resolvePlugins.js +4 -1
- package/dist/esm-node/base/config/index.js +6 -2
- package/dist/esm-node/base/config/patches/assetsModule.js +4 -1
- package/dist/esm-node/base/config/patches/filemock.js +4 -1
- package/dist/esm-node/base/config/patches/index.js +4 -1
- package/dist/esm-node/base/config/patches/transformer.js +4 -1
- package/dist/esm-node/base/config/resolver.js +29 -20
- package/dist/esm-node/base/config/testConfigOperator.js +3 -1
- package/dist/esm-node/base/config/transformer/babelTransformer.js +6 -8
- package/dist/esm-node/base/hook.js +8 -3
- package/dist/esm-node/base/index.js +13 -5
- package/dist/esm-node/base/runJest.js +6 -2
- package/dist/esm-node/base/types/index.js +0 -1
- package/dist/esm-node/base/utils.js +8 -3
- package/dist/esm-node/cli/bff/app.js +7 -2
- package/dist/esm-node/cli/bff/constant.js +4 -1
- package/dist/esm-node/cli/bff/index.js +6 -2
- package/dist/esm-node/cli/bff/mockAPI.js +4 -1
- package/dist/esm-node/cli/bff/utils/index.js +4 -1
- package/dist/esm-node/cli/index.js +10 -4
- package/dist/esm-node/cli/test.js +4 -1
- package/dist/esm-node/constant.js +4 -1
- package/dist/esm-node/runtime-testing/app.js +4 -1
- package/dist/esm-node/runtime-testing/base.js +4 -1
- package/dist/esm-node/runtime-testing/bff.js +3 -1
- package/dist/esm-node/runtime-testing/customRender.js +4 -1
- package/dist/esm-node/runtime-testing/reduck.js +10 -4
- package/dist/esm-node/runtime-testing/resolvePlugins.js +5 -2
- package/package.json +14 -13
|
@@ -5,16 +5,16 @@ import effectsPlugin from "@modern-js-reduck/plugin-effects";
|
|
|
5
5
|
import autoActionsPlugin from "@modern-js-reduck/plugin-auto-actions";
|
|
6
6
|
import immerPlugin from "@modern-js-reduck/plugin-immutable";
|
|
7
7
|
import { MODERNJS_CONFIG_KEY } from "../constant";
|
|
8
|
-
|
|
8
|
+
var effects = function() {
|
|
9
9
|
return effectsPlugin;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
var immer = function() {
|
|
12
12
|
return immerPlugin;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
var autoActions = function() {
|
|
15
15
|
return autoActionsPlugin;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
var createStore = function(props) {
|
|
18
18
|
var createStatePlugins = function() {
|
|
19
19
|
var _modernConfig_runtime;
|
|
20
20
|
var modernConfig = global[MODERNJS_CONFIG_KEY];
|
|
@@ -36,3 +36,9 @@ export var createStore = function(props) {
|
|
|
36
36
|
});
|
|
37
37
|
return originCreateStore(config);
|
|
38
38
|
};
|
|
39
|
+
export {
|
|
40
|
+
autoActions,
|
|
41
|
+
createStore,
|
|
42
|
+
effects,
|
|
43
|
+
immer
|
|
44
|
+
};
|
|
@@ -3,7 +3,7 @@ var allowedFeatures = [
|
|
|
3
3
|
"router",
|
|
4
4
|
"state"
|
|
5
5
|
];
|
|
6
|
-
|
|
6
|
+
function resolvePlugins(features) {
|
|
7
7
|
var plugins = [];
|
|
8
8
|
if (!features) {
|
|
9
9
|
return plugins;
|
|
@@ -16,3 +16,6 @@ export default function resolvePlugins(features) {
|
|
|
16
16
|
});
|
|
17
17
|
return plugins;
|
|
18
18
|
}
|
|
19
|
+
export {
|
|
20
|
+
resolvePlugins as default
|
|
21
|
+
};
|
|
@@ -8,5 +8,9 @@ const patchConfig = async (testOperator) => {
|
|
|
8
8
|
await applyPatches(testOperator);
|
|
9
9
|
return testOperator.jestConfig;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
export {
|
|
11
|
+
const DEFAULT_RESOLVER_PATH = require.resolve("./resolver");
|
|
12
|
+
export {
|
|
13
|
+
DEFAULT_RESOLVER_PATH,
|
|
14
|
+
getJestUtils,
|
|
15
|
+
patchConfig
|
|
16
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const patchAssetsModule = (testOperator) => {
|
|
2
2
|
testOperator.mergeJestConfig({
|
|
3
3
|
moduleNameMapper: {
|
|
4
4
|
"\\.(css|less|scss|sass)$": require.resolve("identity-obj-proxy"),
|
|
@@ -6,3 +6,6 @@ export const patchAssetsModule = (testOperator) => {
|
|
|
6
6
|
}
|
|
7
7
|
});
|
|
8
8
|
};
|
|
9
|
+
export {
|
|
10
|
+
patchAssetsModule
|
|
11
|
+
};
|
|
@@ -8,7 +8,7 @@ const resolveTsCompilerOptions = () => {
|
|
|
8
8
|
tsCompilerOptions.jsx = "react-jsx";
|
|
9
9
|
return tsCompilerOptions;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
const patchTransformer = (testOperator) => {
|
|
12
12
|
const { transformer } = testOperator.testConfig;
|
|
13
13
|
if (transformer === "babel-jest") {
|
|
14
14
|
testOperator.mergeJestConfig({
|
|
@@ -29,3 +29,6 @@ export const patchTransformer = (testOperator) => {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
+
export {
|
|
33
|
+
patchTransformer
|
|
34
|
+
};
|
|
@@ -1,22 +1,31 @@
|
|
|
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
|
+
};
|
|
1
5
|
import enhanceResolve from "enhanced-resolve";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
var require_resolver = __commonJS({
|
|
7
|
+
"src/base/config/resolver.ts"(exports, module) {
|
|
8
|
+
const resolver = enhanceResolve.create.sync({
|
|
9
|
+
conditionNames: [
|
|
10
|
+
"require",
|
|
11
|
+
"node",
|
|
12
|
+
"default"
|
|
13
|
+
],
|
|
14
|
+
extensions: [
|
|
15
|
+
".js",
|
|
16
|
+
".json",
|
|
17
|
+
".node",
|
|
18
|
+
".ts",
|
|
19
|
+
".tsx"
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
const shouldResolveByEnhance = (url) => /^@[^/]+\/[^/]+\/.*/.test(url);
|
|
23
|
+
module.exports = function(request, options) {
|
|
24
|
+
if (shouldResolveByEnhance(request)) {
|
|
25
|
+
return resolver(options.basedir, request);
|
|
26
|
+
}
|
|
27
|
+
return options.defaultResolver(request, options);
|
|
28
|
+
};
|
|
20
29
|
}
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
});
|
|
31
|
+
export default require_resolver();
|
|
@@ -2,15 +2,13 @@ var _babelJest_createTransformer;
|
|
|
2
2
|
import babelJest from "babel-jest";
|
|
3
3
|
const babelTransformer = (_babelJest_createTransformer = babelJest.createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(babelJest, {
|
|
4
4
|
presets: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
{
|
|
8
|
-
appDirectory: process.cwd(),
|
|
9
|
-
modules: "cjs"
|
|
10
|
-
}
|
|
11
|
-
]
|
|
5
|
+
require.resolve("@rsbuild/babel-preset/node"),
|
|
6
|
+
require.resolve("@babel/preset-react")
|
|
12
7
|
],
|
|
13
8
|
configFile: false,
|
|
14
9
|
babelrc: false
|
|
15
10
|
});
|
|
16
|
-
|
|
11
|
+
var babelTransformer_default = babelTransformer;
|
|
12
|
+
export {
|
|
13
|
+
babelTransformer_default as default
|
|
14
|
+
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { createAsyncPipeline, createParallelWorkflow } from "@modern-js/plugin";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const jestConfigHook = createAsyncPipeline();
|
|
3
|
+
const afterTestHook = createParallelWorkflow();
|
|
4
|
+
const testingHooks = {
|
|
5
5
|
jestConfig: createAsyncPipeline(),
|
|
6
6
|
afterTest: createParallelWorkflow()
|
|
7
7
|
};
|
|
8
|
+
export {
|
|
9
|
+
afterTestHook,
|
|
10
|
+
jestConfigHook,
|
|
11
|
+
testingHooks
|
|
12
|
+
};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { runTest, runJest } from "./runJest";
|
|
2
|
+
import { getModuleNameMapper } from "./utils";
|
|
3
|
+
import { DEFAULT_RESOLVER_PATH } from "./config";
|
|
4
|
+
import { TestConfigOperator } from "./config/testConfigOperator";
|
|
5
|
+
import { testingHooks } from "./hook";
|
|
6
6
|
export * from "./types";
|
|
7
|
+
export {
|
|
8
|
+
DEFAULT_RESOLVER_PATH,
|
|
9
|
+
TestConfigOperator,
|
|
10
|
+
getModuleNameMapper,
|
|
11
|
+
runJest,
|
|
12
|
+
runTest,
|
|
13
|
+
testingHooks
|
|
14
|
+
};
|
|
@@ -38,7 +38,7 @@ const readResultsAndExit = (result, globalConfig) => {
|
|
|
38
38
|
}, 1e3).unref();
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
async function runJest(config, pwd = process.cwd()) {
|
|
42
42
|
try {
|
|
43
43
|
const argvConfig = await buildArgv(process.argv.slice(2), config);
|
|
44
44
|
const { results, globalConfig } = await runCLI(argvConfig, [
|
|
@@ -50,7 +50,7 @@ export async function runJest(config, pwd = process.cwd()) {
|
|
|
50
50
|
process.exit(1);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
async function runTest(api, config, pwd = process.cwd()) {
|
|
54
54
|
process.env.NODE_ENV = "test";
|
|
55
55
|
const jestUtils = getJestUtils(config);
|
|
56
56
|
await patchConfig(jestUtils);
|
|
@@ -64,3 +64,7 @@ export async function runTest(api, config, pwd = process.cwd()) {
|
|
|
64
64
|
await runJest(finalConfig, pwd);
|
|
65
65
|
await hookRunners.afterTest();
|
|
66
66
|
}
|
|
67
|
+
export {
|
|
68
|
+
runJest,
|
|
69
|
+
runTest
|
|
70
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { createDebugger } from "@modern-js/utils";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const debug = createDebugger("test");
|
|
5
|
+
const readCompilerOptions = (pwd = process.cwd(), filename = "tsconfig.json") => {
|
|
6
6
|
let tsConfig = {};
|
|
7
7
|
let extendedCompilerOptions = {};
|
|
8
8
|
let tsconfigFile = "";
|
|
@@ -25,7 +25,7 @@ export const readCompilerOptions = (pwd = process.cwd(), filename = "tsconfig.js
|
|
|
25
25
|
...tsConfig.compilerOptions
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
const getModuleNameMapper = (alias) => Object.keys(alias).reduce((memo, cur) => {
|
|
29
29
|
const aliasValue = Array.isArray(alias[cur]) ? alias[cur] : [
|
|
30
30
|
alias[cur]
|
|
31
31
|
];
|
|
@@ -42,3 +42,8 @@ export const getModuleNameMapper = (alias) => Object.keys(alias).reduce((memo, c
|
|
|
42
42
|
memo[key] = value;
|
|
43
43
|
return memo;
|
|
44
44
|
}, {});
|
|
45
|
+
export {
|
|
46
|
+
debug,
|
|
47
|
+
getModuleNameMapper,
|
|
48
|
+
readCompilerOptions
|
|
49
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "async_hooks";
|
|
2
2
|
import { Server } from "@modern-js/prod-server";
|
|
3
3
|
const store = new AsyncLocalStorage();
|
|
4
|
-
|
|
4
|
+
const isInHandler = () => Boolean(store.getStore());
|
|
5
5
|
let server = null;
|
|
6
6
|
const createApp = async (pwd, config, plugins, routes) => {
|
|
7
7
|
if (!server) {
|
|
@@ -30,4 +30,9 @@ const closeServer = async () => {
|
|
|
30
30
|
}
|
|
31
31
|
await server.close();
|
|
32
32
|
};
|
|
33
|
-
export {
|
|
33
|
+
export {
|
|
34
|
+
closeServer,
|
|
35
|
+
createApp,
|
|
36
|
+
getApp,
|
|
37
|
+
isInHandler
|
|
38
|
+
};
|
|
@@ -3,7 +3,7 @@ import { isApiOnly } from "@modern-js/utils";
|
|
|
3
3
|
import { getModuleNameMapper, DEFAULT_RESOLVER_PATH } from "../../base";
|
|
4
4
|
import { bff_info_key } from "./constant";
|
|
5
5
|
import { isBFFProject } from "./utils";
|
|
6
|
-
|
|
6
|
+
const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, utils }) => {
|
|
7
7
|
var _userConfig_source;
|
|
8
8
|
const bffConfig = {
|
|
9
9
|
rootDir: path.join(pwd, "./api"),
|
|
@@ -89,7 +89,7 @@ export const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, ut
|
|
|
89
89
|
}
|
|
90
90
|
utils.setJestConfig(commonConfig);
|
|
91
91
|
};
|
|
92
|
-
|
|
92
|
+
const testingBffPlugin = () => ({
|
|
93
93
|
name: "@modern-js/testing-plugin-bff",
|
|
94
94
|
setup(api) {
|
|
95
95
|
return {
|
|
@@ -112,3 +112,7 @@ export const testingBffPlugin = () => ({
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
|
+
export {
|
|
116
|
+
setJestConfigForBFF,
|
|
117
|
+
testingBffPlugin
|
|
118
|
+
};
|
|
@@ -45,7 +45,7 @@ const mock_getParamsAndPayload = (args) => {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
var mockAPI_default = (mockApiInfosByFile) => {
|
|
49
49
|
const files = Object.keys(mockApiInfosByFile);
|
|
50
50
|
files.forEach((mockedFile) => {
|
|
51
51
|
jest.mock(mockedFile, () => {
|
|
@@ -100,3 +100,6 @@ export default (mockApiInfosByFile) => {
|
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
|
+
export {
|
|
104
|
+
mockAPI_default as default
|
|
105
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { chalk } from "@modern-js/utils";
|
|
3
|
-
|
|
3
|
+
const isBFFProject = (pwd) => {
|
|
4
4
|
try {
|
|
5
5
|
const packageJson = require(path.join(pwd, "./package.json"));
|
|
6
6
|
const { dependencies, devDependencies } = packageJson;
|
|
@@ -15,3 +15,6 @@ export const isBFFProject = (pwd) => {
|
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
+
export {
|
|
19
|
+
isBFFProject
|
|
20
|
+
};
|
|
@@ -4,13 +4,13 @@ import { testingHooks, getModuleNameMapper, DEFAULT_RESOLVER_PATH } from "../bas
|
|
|
4
4
|
import { MODERNJS_CONFIG_KEY } from "../constant";
|
|
5
5
|
import { testingBffPlugin } from "./bff";
|
|
6
6
|
import test from "./test";
|
|
7
|
-
|
|
7
|
+
const mergeUserJestConfig = (testUtils) => {
|
|
8
8
|
const resolveJestConfig = testUtils.testConfig.jest;
|
|
9
9
|
if (resolveJestConfig && typeof resolveJestConfig !== "function") {
|
|
10
10
|
testUtils.mergeJestConfig(resolveJestConfig);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
const getJestTransformEsModulesRegStr = () => {
|
|
14
14
|
const esmModulesInPnpm = [
|
|
15
15
|
"@modern-js\\+runtime@",
|
|
16
16
|
"@modern-js\\+plugin@",
|
|
@@ -26,7 +26,7 @@ export const getJestTransformEsModulesRegStr = () => {
|
|
|
26
26
|
];
|
|
27
27
|
return `node_modules/(?!(\\.pnpm/(${esmModulesInPnpm.join("|")}))|(${esmModules.join("|")}))`;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
const testingPlugin = () => {
|
|
30
30
|
const bffPlugin = testingBffPlugin();
|
|
31
31
|
return {
|
|
32
32
|
name: "@modern-js/plugin-testing",
|
|
@@ -136,4 +136,10 @@ export const testingPlugin = () => {
|
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
};
|
|
139
|
-
|
|
139
|
+
var cli_default = testingPlugin;
|
|
140
|
+
export {
|
|
141
|
+
cli_default as default,
|
|
142
|
+
getJestTransformEsModulesRegStr,
|
|
143
|
+
mergeUserJestConfig,
|
|
144
|
+
testingPlugin
|
|
145
|
+
};
|
|
@@ -3,10 +3,10 @@ import effectsPlugin from "@modern-js-reduck/plugin-effects";
|
|
|
3
3
|
import autoActionsPlugin from "@modern-js-reduck/plugin-auto-actions";
|
|
4
4
|
import immerPlugin from "@modern-js-reduck/plugin-immutable";
|
|
5
5
|
import { MODERNJS_CONFIG_KEY } from "../constant";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const effects = () => effectsPlugin;
|
|
7
|
+
const immer = () => immerPlugin;
|
|
8
|
+
const autoActions = () => autoActionsPlugin;
|
|
9
|
+
const createStore = (props) => {
|
|
10
10
|
const createStatePlugins = () => {
|
|
11
11
|
var _modernConfig_runtime;
|
|
12
12
|
const modernConfig = global[MODERNJS_CONFIG_KEY];
|
|
@@ -29,3 +29,9 @@ export const createStore = (props) => {
|
|
|
29
29
|
};
|
|
30
30
|
return originCreateStore(config);
|
|
31
31
|
};
|
|
32
|
+
export {
|
|
33
|
+
autoActions,
|
|
34
|
+
createStore,
|
|
35
|
+
effects,
|
|
36
|
+
immer
|
|
37
|
+
};
|
|
@@ -2,14 +2,14 @@ const allowedFeatures = [
|
|
|
2
2
|
"router",
|
|
3
3
|
"state"
|
|
4
4
|
];
|
|
5
|
-
|
|
5
|
+
function resolvePlugins(features) {
|
|
6
6
|
const plugins = [];
|
|
7
7
|
if (!features) {
|
|
8
8
|
return plugins;
|
|
9
9
|
}
|
|
10
10
|
Object.keys(features).forEach((feature) => {
|
|
11
11
|
if (allowedFeatures.includes(feature)) {
|
|
12
|
-
const curPluginRes = require(
|
|
12
|
+
const curPluginRes = require("@modern-js/runtime/plugins")[feature]({
|
|
13
13
|
...features[feature]
|
|
14
14
|
});
|
|
15
15
|
plugins.push(curPluginRes);
|
|
@@ -17,3 +17,6 @@ export default function resolvePlugins(features) {
|
|
|
17
17
|
});
|
|
18
18
|
return plugins;
|
|
19
19
|
}
|
|
20
|
+
export {
|
|
21
|
+
resolvePlugins as default
|
|
22
|
+
};
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.37.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",
|
|
@@ -111,10 +111,12 @@
|
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@babel/core": "^7.22.15",
|
|
113
113
|
"@babel/preset-env": "^7.22.15",
|
|
114
|
+
"@babel/preset-react": "^7.22.15",
|
|
114
115
|
"@modern-js-reduck/plugin-auto-actions": "^1.1.10",
|
|
115
116
|
"@modern-js-reduck/plugin-effects": "^1.1.10",
|
|
116
117
|
"@modern-js-reduck/plugin-immutable": "^1.1.10",
|
|
117
118
|
"@modern-js-reduck/store": "^1.1.10",
|
|
119
|
+
"@rsbuild/babel-preset": "0.0.7",
|
|
118
120
|
"@testing-library/jest-dom": "^5.14.1",
|
|
119
121
|
"@testing-library/react": "^13.4.0",
|
|
120
122
|
"@types/testing-library__jest-dom": "^5.14.3",
|
|
@@ -129,17 +131,16 @@
|
|
|
129
131
|
"ts-jest": "^29.1.0",
|
|
130
132
|
"yargs": "^17.0.1",
|
|
131
133
|
"@swc/helpers": "0.5.1",
|
|
132
|
-
"@modern-js/babel-
|
|
133
|
-
"@modern-js/
|
|
134
|
-
"@modern-js/
|
|
135
|
-
"@modern-js/
|
|
136
|
-
"@modern-js/
|
|
137
|
-
"@modern-js/types": "2.35.1"
|
|
134
|
+
"@modern-js/babel-compiler": "2.37.0",
|
|
135
|
+
"@modern-js/utils": "2.37.0",
|
|
136
|
+
"@modern-js/plugin": "2.37.0",
|
|
137
|
+
"@modern-js/prod-server": "2.37.0",
|
|
138
|
+
"@modern-js/types": "2.37.0"
|
|
138
139
|
},
|
|
139
140
|
"peerDependencies": {
|
|
140
141
|
"react": ">=17",
|
|
141
142
|
"react-dom": ">=17",
|
|
142
|
-
"@modern-js/runtime": "^2.
|
|
143
|
+
"@modern-js/runtime": "^2.37.0"
|
|
143
144
|
},
|
|
144
145
|
"peerDependenciesMeta": {
|
|
145
146
|
"@modern-js/runtime": {
|
|
@@ -154,11 +155,11 @@
|
|
|
154
155
|
"@types/node": "^14",
|
|
155
156
|
"@types/yargs": "^17.0.2",
|
|
156
157
|
"typescript": "^5",
|
|
157
|
-
"@modern-js/core": "2.
|
|
158
|
-
"@modern-js/runtime": "2.
|
|
159
|
-
"@modern-js/bff-core": "2.
|
|
160
|
-
"@scripts/
|
|
161
|
-
"@scripts/
|
|
158
|
+
"@modern-js/core": "2.37.0",
|
|
159
|
+
"@modern-js/runtime": "2.37.0",
|
|
160
|
+
"@modern-js/bff-core": "2.37.0",
|
|
161
|
+
"@scripts/build": "2.37.0",
|
|
162
|
+
"@scripts/jest-config": "2.37.0"
|
|
162
163
|
},
|
|
163
164
|
"sideEffects": false,
|
|
164
165
|
"publishConfig": {
|