@modern-js/runtime 1.4.1 → 1.4.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @modern-js/runtime
2
2
 
3
+ ## 1.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - b27d299: fix: runtime plugin module path
8
+
9
+ fix: 修复内置 runtime 插件模块导入路径
10
+
11
+ - Updated dependencies [4f1889d]
12
+ - @modern-js/utils@1.8.1
13
+ - @modern-js/webpack@1.12.3
14
+ - @modern-js/runtime-core@1.5.4
15
+
16
+ ## 1.4.2
17
+
18
+ ### Patch Changes
19
+
20
+ - b28372c: fix(runtime): fix model types for effects
21
+
22
+ fix(runtime): 修复因为 runtime 包合并导致的 model effects 类型不生效问题
23
+
24
+ - Updated dependencies [9a173a7]
25
+ - @modern-js/webpack@1.12.3
26
+ - @modern-js/runtime-core@1.5.4
27
+ - @modern-js/utils@1.8.0
28
+
3
29
  ## 1.4.1
4
30
 
5
31
  ### Patch Changes
@@ -4,7 +4,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
- import path from 'path';
8
7
  import { getEntryOptions, createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
9
8
  const PLUGIN_IDENTIFIER = 'router';
10
9
  const ROUTES_IDENTIFIER = 'routes';
@@ -14,7 +13,6 @@ export default (() => ({
14
13
  setup: api => {
15
14
  const runtimeConfigMap = new Map();
16
15
  let pluginsExportsUtils;
17
- const runtimeModulePath = path.resolve(__dirname, '../');
18
16
  return {
19
17
  config() {
20
18
  const appContext = api.useAppContext();
@@ -98,7 +96,7 @@ export default (() => ({
98
96
  },
99
97
 
100
98
  addRuntimeExports() {
101
- pluginsExportsUtils.addExport(`export { default as router } from '${runtimeModulePath}'`);
99
+ pluginsExportsUtils.addExport(`export { default as router } from '@modern-js/runtime/runtime-router'`);
102
100
  }
103
101
 
104
102
  };
@@ -1,4 +1,3 @@
1
- import path from 'path';
2
1
  import { getEntryOptions, SERVER_RENDER_FUNCTION_NAME, LOADABLE_STATS_FILE, isUseSSRBundle, createRuntimeExportsUtils, isSingleEntry } from '@modern-js/utils';
3
2
  const PLUGIN_IDENTIFIER = 'ssr';
4
3
  export default (() => ({
@@ -7,7 +6,6 @@ export default (() => ({
7
6
  setup: api => {
8
7
  const ssrConfigMap = new Map();
9
8
  let pluginsExportsUtils;
10
- const ssrModulePath = path.resolve(__dirname, '../');
11
9
  return {
12
10
  config() {
13
11
  const appContext = api.useAppContext();
@@ -57,7 +55,7 @@ export default (() => ({
57
55
  packageName,
58
56
  entrypoints
59
57
  } = api.useAppContext();
60
- pluginsExportsUtils.addExport(`export { default as ssr } from '${ssrModulePath}'`); // if use ssg then set ssr config to true
58
+ pluginsExportsUtils.addExport(`export { default as ssr } from '@modern-js/runtime/runtime-ssr'`); // if use ssg then set ssr config to true
61
59
 
62
60
  const ssrConfig = getEntryOptions(entryName, userConfig.server.ssr, userConfig.server.ssrByEntries, packageName);
63
61
  const ssgConfig = userConfig.output.ssg;
@@ -1,4 +1,3 @@
1
- import path from 'path';
2
1
  import { getEntryOptions, createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
3
2
  import "../types";
4
3
  const PLUGIN_IDENTIFIER = 'state';
@@ -8,7 +7,6 @@ export default (() => ({
8
7
  setup: api => {
9
8
  const stateConfigMap = new Map();
10
9
  let pluginsExportsUtils;
11
- const stateModulePath = path.resolve(__dirname, '../');
12
10
  return {
13
11
  config() {
14
12
  const appContext = api.useAppContext();
@@ -102,7 +100,7 @@ export default (() => ({
102
100
  },
103
101
 
104
102
  addRuntimeExports() {
105
- pluginsExportsUtils.addExport(`export { default as state } from '${stateModulePath}'`);
103
+ pluginsExportsUtils.addExport(`export { default as state } from '@modern-js/runtime/runtime-state'`);
106
104
  }
107
105
 
108
106
  };
@@ -5,12 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _utils = require("@modern-js/utils");
11
9
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
11
 
16
12
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -26,9 +22,6 @@ var _default = () => ({
26
22
  setup: api => {
27
23
  const runtimeConfigMap = new Map();
28
24
  let pluginsExportsUtils;
29
-
30
- const runtimeModulePath = _path.default.resolve(__dirname, '../');
31
-
32
25
  return {
33
26
  config() {
34
27
  const appContext = api.useAppContext();
@@ -112,7 +105,7 @@ var _default = () => ({
112
105
  },
113
106
 
114
107
  addRuntimeExports() {
115
- pluginsExportsUtils.addExport(`export { default as router } from '${runtimeModulePath}'`);
108
+ pluginsExportsUtils.addExport(`export { default as router } from '@modern-js/runtime/runtime-router'`);
116
109
  }
117
110
 
118
111
  };
@@ -5,12 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _utils = require("@modern-js/utils");
11
9
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  const PLUGIN_IDENTIFIER = 'ssr';
15
11
 
16
12
  var _default = () => ({
@@ -19,9 +15,6 @@ var _default = () => ({
19
15
  setup: api => {
20
16
  const ssrConfigMap = new Map();
21
17
  let pluginsExportsUtils;
22
-
23
- const ssrModulePath = _path.default.resolve(__dirname, '../');
24
-
25
18
  return {
26
19
  config() {
27
20
  const appContext = api.useAppContext();
@@ -71,7 +64,7 @@ var _default = () => ({
71
64
  packageName,
72
65
  entrypoints
73
66
  } = api.useAppContext();
74
- pluginsExportsUtils.addExport(`export { default as ssr } from '${ssrModulePath}'`); // if use ssg then set ssr config to true
67
+ pluginsExportsUtils.addExport(`export { default as ssr } from '@modern-js/runtime/runtime-ssr'`); // if use ssg then set ssr config to true
75
68
 
76
69
  const ssrConfig = (0, _utils.getEntryOptions)(entryName, userConfig.server.ssr, userConfig.server.ssrByEntries, packageName);
77
70
  const ssgConfig = userConfig.output.ssg;
@@ -5,14 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _utils = require("@modern-js/utils");
11
9
 
12
10
  require("../types");
13
11
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
12
  const PLUGIN_IDENTIFIER = 'state';
17
13
 
18
14
  var _default = () => ({
@@ -21,9 +17,6 @@ var _default = () => ({
21
17
  setup: api => {
22
18
  const stateConfigMap = new Map();
23
19
  let pluginsExportsUtils;
24
-
25
- const stateModulePath = _path.default.resolve(__dirname, '../');
26
-
27
20
  return {
28
21
  config() {
29
22
  const appContext = api.useAppContext();
@@ -117,7 +110,7 @@ var _default = () => ({
117
110
  },
118
111
 
119
112
  addRuntimeExports() {
120
- pluginsExportsUtils.addExport(`export { default as state } from '${stateModulePath}'`);
113
+ pluginsExportsUtils.addExport(`export { default as state } from '@modern-js/runtime/runtime-state'`);
121
114
  }
122
115
 
123
116
  };
@@ -1,5 +1,4 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import path from 'path';
3
2
  import { getEntryOptions, createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
4
3
  var PLUGIN_IDENTIFIER = 'router';
5
4
  var ROUTES_IDENTIFIER = 'routes';
@@ -10,7 +9,6 @@ export default (function () {
10
9
  setup: function setup(api) {
11
10
  var runtimeConfigMap = new Map();
12
11
  var pluginsExportsUtils;
13
- var runtimeModulePath = path.resolve(__dirname, '../');
14
12
  return {
15
13
  config: function config() {
16
14
  var appContext = api.useAppContext();
@@ -92,7 +90,7 @@ export default (function () {
92
90
  };
93
91
  },
94
92
  addRuntimeExports: function addRuntimeExports() {
95
- pluginsExportsUtils.addExport("export { default as router } from '".concat(runtimeModulePath, "'"));
93
+ pluginsExportsUtils.addExport("export { default as router } from '@modern-js/runtime/runtime-router'");
96
94
  }
97
95
  };
98
96
  }
@@ -1,4 +1,3 @@
1
- import path from 'path';
2
1
  import { getEntryOptions, SERVER_RENDER_FUNCTION_NAME, LOADABLE_STATS_FILE, isUseSSRBundle, createRuntimeExportsUtils, isSingleEntry } from '@modern-js/utils';
3
2
  var PLUGIN_IDENTIFIER = 'ssr';
4
3
  export default (function () {
@@ -8,7 +7,6 @@ export default (function () {
8
7
  setup: function setup(api) {
9
8
  var ssrConfigMap = new Map();
10
9
  var pluginsExportsUtils;
11
- var ssrModulePath = path.resolve(__dirname, '../');
12
10
  return {
13
11
  config: function config() {
14
12
  var appContext = api.useAppContext();
@@ -54,7 +52,7 @@ export default (function () {
54
52
  packageName = _api$useAppContext.packageName,
55
53
  entrypoints = _api$useAppContext.entrypoints;
56
54
 
57
- pluginsExportsUtils.addExport("export { default as ssr } from '".concat(ssrModulePath, "'")); // if use ssg then set ssr config to true
55
+ pluginsExportsUtils.addExport("export { default as ssr } from '@modern-js/runtime/runtime-ssr'"); // if use ssg then set ssr config to true
58
56
 
59
57
  var ssrConfig = getEntryOptions(entryName, userConfig.server.ssr, userConfig.server.ssrByEntries, packageName);
60
58
  var ssgConfig = userConfig.output.ssg;
@@ -1,4 +1,3 @@
1
- import path from 'path';
2
1
  import { getEntryOptions, createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
3
2
  import "../types";
4
3
  var PLUGIN_IDENTIFIER = 'state';
@@ -9,7 +8,6 @@ export default (function () {
9
8
  setup: function setup(api) {
10
9
  var stateConfigMap = new Map();
11
10
  var pluginsExportsUtils;
12
- var stateModulePath = path.resolve(__dirname, '../');
13
11
  return {
14
12
  config: function config() {
15
13
  var appContext = api.useAppContext();
@@ -92,7 +90,7 @@ export default (function () {
92
90
  return PLUGIN_SCHEMAS['@modern-js/plugin-state'];
93
91
  },
94
92
  addRuntimeExports: function addRuntimeExports() {
95
- pluginsExportsUtils.addExport("export { default as state } from '".concat(stateModulePath, "'"));
93
+ pluginsExportsUtils.addExport("export { default as state } from '@modern-js/runtime/runtime-state'");
96
94
  }
97
95
  };
98
96
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.4.1",
14
+ "version": "1.4.4",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./type.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -63,6 +63,21 @@
63
63
  "./cli": {
64
64
  "jsnext:source": "./src/cli/index.ts",
65
65
  "default": "./dist/js/node/cli/index.js"
66
+ },
67
+ "./runtime-router": {
68
+ "jsnext:source": "./src/router/index.ts",
69
+ "node": "./dist/js/node/router/index",
70
+ "default": "./dist/js/treeshaking/router/index.js"
71
+ },
72
+ "./runtime-state": {
73
+ "jsnext:source": "./src/state/index.ts",
74
+ "node": "./dist/js/node/state/index",
75
+ "default": "./dist/js/treeshaking/state/index.js"
76
+ },
77
+ "./runtime-ssr": {
78
+ "jsnext:source": "./src/ssr/index.ts",
79
+ "node": "./dist/js/node/ssr/index",
80
+ "default": "./dist/js/treeshaking/ssr/index.js"
66
81
  }
67
82
  },
68
83
  "typesVersions": {
@@ -90,13 +105,22 @@
90
105
  ],
91
106
  "model": [
92
107
  "./types/model.d.ts"
108
+ ],
109
+ "runtime-router": [
110
+ "./dist/types/router/index.d.ts"
111
+ ],
112
+ "runtime-state": [
113
+ "./dist/types/state/index.d.ts"
114
+ ],
115
+ "runtime-ssr": [
116
+ "./dist/types/ssr/index.d.ts"
93
117
  ]
94
118
  }
95
119
  },
96
120
  "dependencies": {
97
121
  "@babel/runtime": "^7.18.0",
98
122
  "@modern-js/runtime-core": "^1.5.4",
99
- "@modern-js/utils": "^1.8.0",
123
+ "@modern-js/utils": "^1.8.1",
100
124
  "@loadable/component": "^5.15.0",
101
125
  "@types/loadable__component": "^5.13.4",
102
126
  "@types/react-helmet": "^6.1.2",
@@ -106,7 +130,7 @@
106
130
  "@babel/core": "^7.18.0",
107
131
  "@loadable/babel-plugin": "^5.13.2",
108
132
  "@loadable/server": "^5.15.1",
109
- "@modern-js/webpack": "^1.12.2",
133
+ "@modern-js/webpack": "^1.12.3",
110
134
  "serialize-javascript": "^6.0.0",
111
135
  "history": "^4.7.9",
112
136
  "react-router-dom": "^5.1.2",
@@ -123,7 +147,7 @@
123
147
  "redux-logger": "^3.0.6"
124
148
  },
125
149
  "devDependencies": {
126
- "@modern-js/core": "1.13.1",
150
+ "@modern-js/core": "1.13.3",
127
151
  "@scripts/build": "0.0.0",
128
152
  "@types/jest": "^27",
129
153
  "@types/node": "^14",
@@ -132,8 +156,8 @@
132
156
  "react": "^17",
133
157
  "typescript": "^4",
134
158
  "jest": "^27",
135
- "@modern-js/types": "1.6.0",
136
- "@modern-js/utils": "1.8.0",
159
+ "@modern-js/types": "1.6.2",
160
+ "@modern-js/utils": "1.8.1",
137
161
  "@types/react-side-effect": "^1.1.1",
138
162
  "@types/loadable__webpack-plugin": "^5.7.3",
139
163
  "@types/serialize-javascript": "^5.0.1",
package/types/model.d.ts CHANGED
@@ -1,3 +1,6 @@
1
- import '../dist/types/state';
1
+ /// <reference types="@modern-js-reduck/plugin-auto-actions" />
2
+ /// <reference types="@modern-js-reduck/plugin-devtools" />
3
+ /// <reference types="@modern-js-reduck/plugin-effects" />
4
+ /// <reference types="@modern-js-reduck/plugin-immutable" />
2
5
 
3
6
  export * from '../dist/types/exports/model';
package/types/state.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /// <reference types="@modern-js-reduck/plugin-auto-actions" />
2
- /// <reference types="@modern-js-reduck/plugin-devtools" />
3
- /// <reference types="@modern-js-reduck/plugin-effects" />
4
- /// <reference types="@modern-js-reduck/plugin-immutable" />