@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.
Files changed (86) hide show
  1. package/dist/cjs/base/config/index.js +41 -22
  2. package/dist/cjs/base/config/patches/assetsModule.js +34 -7
  3. package/dist/cjs/base/config/patches/filemock.js +21 -8
  4. package/dist/cjs/base/config/patches/index.js +28 -11
  5. package/dist/cjs/base/config/patches/transformer.js +36 -9
  6. package/dist/cjs/base/config/resolver.js +24 -6
  7. package/dist/cjs/base/config/testConfigOperator.js +32 -15
  8. package/dist/cjs/base/config/transformer/babelTransformer.js +35 -18
  9. package/dist/cjs/base/hook.js +32 -23
  10. package/dist/cjs/base/index.js +41 -34
  11. package/dist/cjs/base/runJest.js +48 -29
  12. package/dist/cjs/base/types/index.js +15 -3
  13. package/dist/cjs/base/utils.js +46 -28
  14. package/dist/cjs/cli/bff/app.js +33 -25
  15. package/dist/cjs/cli/bff/constant.js +24 -7
  16. package/dist/cjs/cli/bff/index.js +46 -27
  17. package/dist/cjs/cli/bff/mockAPI.js +40 -18
  18. package/dist/cjs/cli/bff/setup.js +33 -15
  19. package/dist/cjs/cli/bff/utils/index.js +38 -12
  20. package/dist/cjs/cli/index.js +56 -40
  21. package/dist/cjs/cli/test.js +37 -15
  22. package/dist/cjs/constant.js +24 -7
  23. package/dist/cjs/index.js +22 -6
  24. package/dist/cjs/runtime-testing/app.js +38 -17
  25. package/dist/cjs/runtime-testing/base.js +38 -11
  26. package/dist/cjs/runtime-testing/bff.js +38 -12
  27. package/dist/cjs/runtime-testing/customRender.js +36 -14
  28. package/dist/cjs/runtime-testing/index.js +22 -5
  29. package/dist/cjs/runtime-testing/reduck.js +49 -32
  30. package/dist/cjs/runtime-testing/resolvePlugins.js +21 -8
  31. package/dist/esm/base/config/index.js +6 -2
  32. package/dist/esm/base/config/patches/assetsModule.js +4 -1
  33. package/dist/esm/base/config/patches/filemock.js +4 -1
  34. package/dist/esm/base/config/patches/index.js +4 -1
  35. package/dist/esm/base/config/patches/transformer.js +4 -1
  36. package/dist/esm/base/config/resolver.js +31 -22
  37. package/dist/esm/base/config/testConfigOperator.js +3 -1
  38. package/dist/esm/base/config/transformer/babelTransformer.js +6 -8
  39. package/dist/esm/base/hook.js +8 -3
  40. package/dist/esm/base/index.js +13 -5
  41. package/dist/esm/base/runJest.js +6 -2
  42. package/dist/esm/base/types/index.js +0 -1
  43. package/dist/esm/base/utils.js +8 -3
  44. package/dist/esm/cli/bff/app.js +10 -5
  45. package/dist/esm/cli/bff/constant.js +4 -1
  46. package/dist/esm/cli/bff/index.js +15 -11
  47. package/dist/esm/cli/bff/mockAPI.js +4 -1
  48. package/dist/esm/cli/bff/setup.js +2 -2
  49. package/dist/esm/cli/bff/utils/index.js +4 -1
  50. package/dist/esm/cli/index.js +10 -4
  51. package/dist/esm/cli/test.js +4 -1
  52. package/dist/esm/constant.js +4 -1
  53. package/dist/esm/runtime-testing/app.js +4 -1
  54. package/dist/esm/runtime-testing/base.js +4 -1
  55. package/dist/esm/runtime-testing/bff.js +3 -1
  56. package/dist/esm/runtime-testing/customRender.js +4 -1
  57. package/dist/esm/runtime-testing/reduck.js +10 -4
  58. package/dist/esm/runtime-testing/resolvePlugins.js +4 -1
  59. package/dist/esm-node/base/config/index.js +6 -2
  60. package/dist/esm-node/base/config/patches/assetsModule.js +4 -1
  61. package/dist/esm-node/base/config/patches/filemock.js +4 -1
  62. package/dist/esm-node/base/config/patches/index.js +4 -1
  63. package/dist/esm-node/base/config/patches/transformer.js +4 -1
  64. package/dist/esm-node/base/config/resolver.js +29 -20
  65. package/dist/esm-node/base/config/testConfigOperator.js +3 -1
  66. package/dist/esm-node/base/config/transformer/babelTransformer.js +6 -8
  67. package/dist/esm-node/base/hook.js +8 -3
  68. package/dist/esm-node/base/index.js +13 -5
  69. package/dist/esm-node/base/runJest.js +6 -2
  70. package/dist/esm-node/base/types/index.js +0 -1
  71. package/dist/esm-node/base/utils.js +8 -3
  72. package/dist/esm-node/cli/bff/app.js +7 -2
  73. package/dist/esm-node/cli/bff/constant.js +4 -1
  74. package/dist/esm-node/cli/bff/index.js +6 -2
  75. package/dist/esm-node/cli/bff/mockAPI.js +4 -1
  76. package/dist/esm-node/cli/bff/utils/index.js +4 -1
  77. package/dist/esm-node/cli/index.js +10 -4
  78. package/dist/esm-node/cli/test.js +4 -1
  79. package/dist/esm-node/constant.js +4 -1
  80. package/dist/esm-node/runtime-testing/app.js +4 -1
  81. package/dist/esm-node/runtime-testing/base.js +4 -1
  82. package/dist/esm-node/runtime-testing/bff.js +3 -1
  83. package/dist/esm-node/runtime-testing/customRender.js +4 -1
  84. package/dist/esm-node/runtime-testing/reduck.js +10 -4
  85. package/dist/esm-node/runtime-testing/resolvePlugins.js +5 -2
  86. 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
- export var effects = function() {
8
+ var effects = function() {
9
9
  return effectsPlugin;
10
10
  };
11
- export var immer = function() {
11
+ var immer = function() {
12
12
  return immerPlugin;
13
13
  };
14
- export var autoActions = function() {
14
+ var autoActions = function() {
15
15
  return autoActionsPlugin;
16
16
  };
17
- export var createStore = function(props) {
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
- export default function resolvePlugins(features) {
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
- export const DEFAULT_RESOLVER_PATH = require.resolve("./resolver");
12
- export { getJestUtils, patchConfig };
11
+ const DEFAULT_RESOLVER_PATH = require.resolve("./resolver");
12
+ export {
13
+ DEFAULT_RESOLVER_PATH,
14
+ getJestUtils,
15
+ patchConfig
16
+ };
@@ -1,4 +1,4 @@
1
- export const patchAssetsModule = (testOperator) => {
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
+ };
@@ -1 +1,4 @@
1
- export default "test-file-stub";
1
+ var filemock_default = "test-file-stub";
2
+ export {
3
+ filemock_default as default
4
+ };
@@ -9,6 +9,9 @@ const patches = [
9
9
  patchTransformer,
10
10
  patchAssetsModule
11
11
  ];
12
- export const applyPatches = async (testConfig) => {
12
+ const applyPatches = async (testConfig) => {
13
13
  await _applyPatches(patches, testConfig);
14
14
  };
15
+ export {
16
+ applyPatches
17
+ };
@@ -8,7 +8,7 @@ const resolveTsCompilerOptions = () => {
8
8
  tsCompilerOptions.jsx = "react-jsx";
9
9
  return tsCompilerOptions;
10
10
  };
11
- export const patchTransformer = (testOperator) => {
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
- const resolver = enhanceResolve.create.sync({
3
- conditionNames: [
4
- "require",
5
- "node",
6
- "default"
7
- ],
8
- extensions: [
9
- ".js",
10
- ".json",
11
- ".node",
12
- ".ts",
13
- ".tsx"
14
- ]
15
- });
16
- const shouldResolveByEnhance = (url) => /^@[^/]+\/[^/]+\/.*/.test(url);
17
- module.exports = function(request, options) {
18
- if (shouldResolveByEnhance(request)) {
19
- return resolver(options.basedir, request);
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
- return options.defaultResolver(request, options);
22
- };
30
+ });
31
+ export default require_resolver();
@@ -55,4 +55,6 @@ class TestConfigOperator {
55
55
  this.initial();
56
56
  }
57
57
  }
58
- export { TestConfigOperator };
58
+ export {
59
+ TestConfigOperator
60
+ };
@@ -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
- require.resolve("@modern-js/babel-preset-app"),
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
- export default babelTransformer;
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
- export const jestConfigHook = createAsyncPipeline();
3
- export const afterTestHook = createParallelWorkflow();
4
- export const testingHooks = {
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
- export { runTest, runJest } from "./runJest";
2
- export { getModuleNameMapper } from "./utils";
3
- export { DEFAULT_RESOLVER_PATH } from "./config";
4
- export { TestConfigOperator } from "./config/testConfigOperator";
5
- export { testingHooks } from "./hook";
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
- export async function runJest(config, pwd = process.cwd()) {
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
- export async function runTest(api, config, pwd = process.cwd()) {
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
- export const debug = createDebugger("test");
5
- export const readCompilerOptions = (pwd = process.cwd(), filename = "tsconfig.json") => {
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
- export const getModuleNameMapper = (alias) => Object.keys(alias).reduce((memo, cur) => {
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
- export const isInHandler = () => Boolean(store.getStore());
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 { createApp, getApp, closeServer };
33
+ export {
34
+ closeServer,
35
+ createApp,
36
+ getApp,
37
+ isInHandler
38
+ };
@@ -1 +1,4 @@
1
- export const bff_info_key = "modern_bff_info";
1
+ const bff_info_key = "modern_bff_info";
2
+ export {
3
+ bff_info_key
4
+ };
@@ -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
- export const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, utils }) => {
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
- export const testingBffPlugin = () => ({
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
- export default (mockApiInfosByFile) => {
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
- export const isBFFProject = (pwd) => {
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
- export const mergeUserJestConfig = (testUtils) => {
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
- export const getJestTransformEsModulesRegStr = () => {
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
- export const testingPlugin = () => {
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
- export default testingPlugin;
139
+ var cli_default = testingPlugin;
140
+ export {
141
+ cli_default as default,
142
+ getJestTransformEsModulesRegStr,
143
+ mergeUserJestConfig,
144
+ testingPlugin
145
+ };
@@ -29,4 +29,7 @@ const test = async (api) => {
29
29
  });
30
30
  await runTest(api, userConfig.testing);
31
31
  };
32
- export default test;
32
+ var test_default = test;
33
+ export {
34
+ test_default as default
35
+ };
@@ -1 +1,4 @@
1
- export const MODERNJS_CONFIG_KEY = "__modernjs_config__";
1
+ const MODERNJS_CONFIG_KEY = "__modernjs_config__";
2
+ export {
3
+ MODERNJS_CONFIG_KEY
4
+ };
@@ -32,4 +32,7 @@ class ModernRuntime {
32
32
  this.options = options;
33
33
  }
34
34
  }
35
- export default new ModernRuntime(global[MODERNJS_CONFIG_KEY] || {});
35
+ var app_default = new ModernRuntime(global[MODERNJS_CONFIG_KEY] || {});
36
+ export {
37
+ app_default as default
38
+ };
@@ -1,2 +1,5 @@
1
- export { default as renderApp } from "./customRender";
1
+ import { default as default2 } from "./customRender";
2
2
  export * from "@testing-library/react";
3
+ export {
4
+ default2 as renderApp
5
+ };
@@ -11,4 +11,6 @@ function request(...args) {
11
11
  fn.returnHttp = false;
12
12
  return res;
13
13
  }
14
- export { request as testBff };
14
+ export {
15
+ request as testBff
16
+ };
@@ -6,4 +6,7 @@ const customRender = (ui, options) => render(ui, {
6
6
  wrapper: WrapModernProviders,
7
7
  ...options
8
8
  });
9
- export default customRender;
9
+ var customRender_default = customRender;
10
+ export {
11
+ customRender_default as default
12
+ };
@@ -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
- export const effects = () => effectsPlugin;
7
- export const immer = () => immerPlugin;
8
- export const autoActions = () => autoActionsPlugin;
9
- export const createStore = (props) => {
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
- export default function resolvePlugins(features) {
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(`@modern-js/runtime/plugins`)[feature]({
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.35.1",
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-preset-app": "2.35.1",
133
- "@modern-js/babel-compiler": "2.35.1",
134
- "@modern-js/utils": "2.35.1",
135
- "@modern-js/plugin": "2.35.1",
136
- "@modern-js/prod-server": "2.35.1",
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.35.1"
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.35.1",
158
- "@modern-js/runtime": "2.35.1",
159
- "@modern-js/bff-core": "2.35.1",
160
- "@scripts/jest-config": "2.35.1",
161
- "@scripts/build": "2.35.1"
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": {