@modern-js/runtime 1.2.2 → 1.2.5
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 +53 -0
- package/dist/js/modern/cli/index.js +35 -37
- package/dist/js/node/cli/index.js +35 -35
- package/dist/js/treeshaking/cli/index.js +44 -46
- package/dist/types/cli/index.d.ts +3 -1
- package/jest.config.js +0 -1
- package/package.json +12 -16
- package/tests/index.test.ts +1 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @modern-js/runtime
|
|
2
2
|
|
|
3
|
+
## 1.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bebb39b6: chore: improve devDependencies and peerDependencies
|
|
8
|
+
- ff73a5cc: fix style-component bugs
|
|
9
|
+
- Updated dependencies [bebb39b6]
|
|
10
|
+
- Updated dependencies [132f7b53]
|
|
11
|
+
- Updated dependencies [c4a7e4a3]
|
|
12
|
+
- Updated dependencies [ff73a5cc]
|
|
13
|
+
- Updated dependencies [9d4a005b]
|
|
14
|
+
- @modern-js/plugin-router@1.2.8
|
|
15
|
+
- @modern-js/plugin-ssr@1.2.5
|
|
16
|
+
- @modern-js/plugin-state@1.2.3
|
|
17
|
+
- @modern-js/utils@1.3.7
|
|
18
|
+
|
|
19
|
+
## 1.2.4
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 94d02b35: feat(plugin-runtime): convert to new plugin
|
|
24
|
+
- 808cec13: fix(plugin-runtime): fix usePlugins error
|
|
25
|
+
- 681a1ff9: feat: remove unnecessary peerDependencies
|
|
26
|
+
- Updated dependencies [c2046f37]
|
|
27
|
+
- Updated dependencies [a2261fed]
|
|
28
|
+
- Updated dependencies [cee0efcc]
|
|
29
|
+
- Updated dependencies [94d02b35]
|
|
30
|
+
- Updated dependencies [57e8ce98]
|
|
31
|
+
- Updated dependencies [e31ce644]
|
|
32
|
+
- Updated dependencies [681a1ff9]
|
|
33
|
+
- Updated dependencies [e8bbc315]
|
|
34
|
+
- @modern-js/utils@1.3.6
|
|
35
|
+
- @modern-js/runtime-core@1.4.0
|
|
36
|
+
- @modern-js/plugin-router@1.2.6
|
|
37
|
+
- @modern-js/plugin-state@1.2.2
|
|
38
|
+
- @modern-js/plugin-ssr@1.2.4
|
|
39
|
+
|
|
40
|
+
## 1.2.3
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- 6891e4c2: add theme token some config logic
|
|
45
|
+
- 0cd8b592: fix: runtime head and loadable type not found
|
|
46
|
+
- Updated dependencies [b376c8d6]
|
|
47
|
+
- Updated dependencies [735b2a81]
|
|
48
|
+
- Updated dependencies [e62c4efd]
|
|
49
|
+
- Updated dependencies [5ed05e65]
|
|
50
|
+
- Updated dependencies [735b2a81]
|
|
51
|
+
- Updated dependencies [e2a8233f]
|
|
52
|
+
- @modern-js/core@1.4.2
|
|
53
|
+
- @modern-js/plugin-ssr@1.2.2
|
|
54
|
+
- @modern-js/runtime-core@1.2.3
|
|
55
|
+
|
|
3
56
|
## 1.2.2
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
|
@@ -1,44 +1,42 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { PLUGIN_SCHEMAS, createRuntimeExportsUtils, cleanRequireCache } from '@modern-js/utils';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
import PluginState from '@modern-js/plugin-state/cli';
|
|
4
|
+
import PluginRouter from '@modern-js/plugin-router/cli';
|
|
5
|
+
import PluginSSR from '@modern-js/plugin-ssr/cli';
|
|
6
|
+
export default (() => ({
|
|
7
|
+
name: '@modern-js/runtime',
|
|
8
|
+
post: ['@modern-js/plugin-router', '@modern-js/plugin-ssr', '@modern-js/plugin-state', '@modern-js/plugin-design-token'],
|
|
9
|
+
usePlugins: [PluginState(), PluginRouter(), PluginSSR()],
|
|
10
|
+
setup: api => {
|
|
11
|
+
let runtimeExportsUtils = {};
|
|
12
|
+
return {
|
|
13
|
+
config() {
|
|
14
|
+
const dir = api.useAppContext().internalDirectory;
|
|
15
|
+
runtimeExportsUtils = createRuntimeExportsUtils(dir, 'index');
|
|
16
|
+
return {
|
|
17
|
+
runtime: {},
|
|
18
|
+
runtimeByEntries: {},
|
|
19
|
+
source: {
|
|
20
|
+
alias: {
|
|
21
|
+
'@modern-js/runtime$': runtimeExportsUtils.getPath()
|
|
22
|
+
}
|
|
22
23
|
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
validateSchema() {
|
|
28
|
+
return PLUGIN_SCHEMAS['@modern-js/runtime'];
|
|
29
|
+
},
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
addRuntimeExports() {
|
|
32
|
+
const runtimePackage = path.resolve(__dirname, '../../../../');
|
|
33
|
+
runtimeExportsUtils.addExport(`export * from '${runtimePackage}'`);
|
|
34
|
+
},
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
async beforeRestart() {
|
|
37
|
+
cleanRequireCache([require.resolve('@modern-js/plugin-state/cli'), require.resolve('@modern-js/plugin-router/cli'), require.resolve('@modern-js/plugin-ssr/cli')]);
|
|
38
|
+
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
post: ['@modern-js/plugin-router', '@modern-js/plugin-ssr', '@modern-js/plugin-state']
|
|
44
|
-
});
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
@@ -9,51 +9,51 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
9
9
|
|
|
10
10
|
var _utils = require("@modern-js/utils");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _cli = _interopRequireDefault(require("@modern-js/plugin-state/cli"));
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const useInternalDirectory = () => (0, _core.useAppContext)().internalDirectory; // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
14
|
+
var _cli2 = _interopRequireDefault(require("@modern-js/plugin-router/cli"));
|
|
17
15
|
|
|
16
|
+
var _cli3 = _interopRequireDefault(require("@modern-js/plugin-ssr/cli"));
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
19
|
|
|
21
|
-
var _default = (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
var _default = () => ({
|
|
21
|
+
name: '@modern-js/runtime',
|
|
22
|
+
post: ['@modern-js/plugin-router', '@modern-js/plugin-ssr', '@modern-js/plugin-state', '@modern-js/plugin-design-token'],
|
|
23
|
+
usePlugins: [(0, _cli.default)(), (0, _cli2.default)(), (0, _cli3.default)()],
|
|
24
|
+
setup: api => {
|
|
25
|
+
let runtimeExportsUtils = {};
|
|
26
|
+
return {
|
|
27
|
+
config() {
|
|
28
|
+
const dir = api.useAppContext().internalDirectory;
|
|
29
|
+
runtimeExportsUtils = (0, _utils.createRuntimeExportsUtils)(dir, 'index');
|
|
30
|
+
return {
|
|
31
|
+
runtime: {},
|
|
32
|
+
runtimeByEntries: {},
|
|
33
|
+
source: {
|
|
34
|
+
alias: {
|
|
35
|
+
'@modern-js/runtime$': runtimeExportsUtils.getPath()
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
+
};
|
|
39
|
+
},
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
validateSchema() {
|
|
42
|
+
return _utils.PLUGIN_SCHEMAS['@modern-js/runtime'];
|
|
43
|
+
},
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
addRuntimeExports() {
|
|
46
|
+
const runtimePackage = _path.default.resolve(__dirname, '../../../../');
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
runtimeExportsUtils.addExport(`export * from '${runtimePackage}'`);
|
|
49
|
+
},
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
async beforeRestart() {
|
|
52
|
+
(0, _utils.cleanRequireCache)([require.resolve('@modern-js/plugin-state/cli'), require.resolve('@modern-js/plugin-router/cli'), require.resolve('@modern-js/plugin-ssr/cli')]);
|
|
53
|
+
}
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
name: '@modern-js/runtime',
|
|
56
|
-
post: ['@modern-js/plugin-router', '@modern-js/plugin-ssr', '@modern-js/plugin-state']
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
exports.default = _default;
|
|
@@ -6,56 +6,54 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
6
6
|
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { PLUGIN_SCHEMAS, createRuntimeExportsUtils, cleanRequireCache } from '@modern-js/utils';
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}; // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
usePlugins([require.resolve('@modern-js/plugin-state/cli'), require.resolve('@modern-js/plugin-router/cli'), require.resolve('@modern-js/plugin-ssr/cli')]);
|
|
17
|
-
export default createPlugin(function () {
|
|
18
|
-
var runtimeExportsUtils = {};
|
|
9
|
+
import PluginState from '@modern-js/plugin-state/cli';
|
|
10
|
+
import PluginRouter from '@modern-js/plugin-router/cli';
|
|
11
|
+
import PluginSSR from '@modern-js/plugin-ssr/cli';
|
|
12
|
+
export default (function () {
|
|
19
13
|
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
name: '@modern-js/runtime',
|
|
15
|
+
post: ['@modern-js/plugin-router', '@modern-js/plugin-ssr', '@modern-js/plugin-state', '@modern-js/plugin-design-token'],
|
|
16
|
+
usePlugins: [PluginState(), PluginRouter(), PluginSSR()],
|
|
17
|
+
setup: function setup(api) {
|
|
18
|
+
var runtimeExportsUtils = {};
|
|
24
19
|
return {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
config: function config() {
|
|
21
|
+
var dir = api.useAppContext().internalDirectory;
|
|
22
|
+
runtimeExportsUtils = createRuntimeExportsUtils(dir, 'index');
|
|
23
|
+
return {
|
|
24
|
+
runtime: {},
|
|
25
|
+
runtimeByEntries: {},
|
|
26
|
+
source: {
|
|
27
|
+
alias: {
|
|
28
|
+
'@modern-js/runtime$': runtimeExportsUtils.getPath()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
validateSchema: function validateSchema() {
|
|
34
|
+
return PLUGIN_SCHEMAS['@modern-js/runtime'];
|
|
35
|
+
},
|
|
36
|
+
addRuntimeExports: function addRuntimeExports() {
|
|
37
|
+
var runtimePackage = path.resolve(__dirname, '../../../../');
|
|
38
|
+
runtimeExportsUtils.addExport("export * from '".concat(runtimePackage, "'"));
|
|
39
|
+
},
|
|
40
|
+
beforeRestart: function beforeRestart() {
|
|
41
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
42
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
43
|
+
while (1) {
|
|
44
|
+
switch (_context.prev = _context.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
cleanRequireCache([require.resolve('@modern-js/plugin-state/cli'), require.resolve('@modern-js/plugin-router/cli'), require.resolve('@modern-js/plugin-ssr/cli')]);
|
|
47
|
+
|
|
48
|
+
case 1:
|
|
49
|
+
case "end":
|
|
50
|
+
return _context.stop();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, _callee);
|
|
54
|
+
}))();
|
|
31
55
|
}
|
|
32
56
|
};
|
|
33
|
-
},
|
|
34
|
-
validateSchema: function validateSchema() {
|
|
35
|
-
return PLUGIN_SCHEMAS['@modern-js/runtime'];
|
|
36
|
-
},
|
|
37
|
-
addRuntimeExports: function addRuntimeExports() {
|
|
38
|
-
var runtimePackage = path.resolve(__dirname, '../../../../');
|
|
39
|
-
runtimeExportsUtils.addExport("export * from '".concat(runtimePackage, "'"));
|
|
40
|
-
},
|
|
41
|
-
beforeRestart: function beforeRestart() {
|
|
42
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
43
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
44
|
-
while (1) {
|
|
45
|
-
switch (_context.prev = _context.next) {
|
|
46
|
-
case 0:
|
|
47
|
-
cleanRequireCache([require.resolve('@modern-js/plugin-state/cli'), require.resolve('@modern-js/plugin-router/cli'), require.resolve('@modern-js/plugin-ssr/cli')]);
|
|
48
|
-
|
|
49
|
-
case 1:
|
|
50
|
-
case "end":
|
|
51
|
-
return _context.stop();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}, _callee);
|
|
55
|
-
}))();
|
|
56
57
|
}
|
|
57
58
|
};
|
|
58
|
-
}, {
|
|
59
|
-
name: '@modern-js/runtime',
|
|
60
|
-
post: ['@modern-js/plugin-router', '@modern-js/plugin-ssr', '@modern-js/plugin-state']
|
|
61
59
|
});
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.2.
|
|
14
|
+
"version": "1.2.5",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./type.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -103,40 +103,36 @@
|
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
105
|
"@babel/runtime": "^7",
|
|
106
|
-
"@modern-js/plugin-router": "^1.2.
|
|
107
|
-
"@modern-js/plugin-ssr": "^1.2.
|
|
108
|
-
"@modern-js/plugin-state": "^1.2.
|
|
109
|
-
"@modern-js/runtime-core": "^1.
|
|
110
|
-
"@modern-js/utils": "^1.3.
|
|
106
|
+
"@modern-js/plugin-router": "^1.2.8",
|
|
107
|
+
"@modern-js/plugin-ssr": "^1.2.5",
|
|
108
|
+
"@modern-js/plugin-state": "^1.2.3",
|
|
109
|
+
"@modern-js/runtime-core": "^1.4.0",
|
|
110
|
+
"@modern-js/utils": "^1.3.7",
|
|
111
111
|
"@modern-js/bff-runtime": "^1.2.1",
|
|
112
112
|
"@modern-js/create-request": "^1.2.1",
|
|
113
113
|
"@loadable/component": "^5.15.0",
|
|
114
|
+
"@types/loadable__component": "^5.13.4",
|
|
115
|
+
"@types/react-helmet": "^6.1.2",
|
|
114
116
|
"react-helmet": "^6.1.0",
|
|
115
|
-
"
|
|
117
|
+
"react-side-effect": "^2.1.1"
|
|
116
118
|
},
|
|
117
119
|
"devDependencies": {
|
|
118
|
-
"@modern-js/core": "
|
|
120
|
+
"@modern-js/core": "1.6.1",
|
|
119
121
|
"@scripts/build": "0.0.0",
|
|
120
|
-
"@types/loadable__component": "^5.13.4",
|
|
121
|
-
"@types/react-helmet": "^6.1.2",
|
|
122
|
-
"@types/styled-components": "^5.1.13",
|
|
123
122
|
"@types/jest": "^26",
|
|
124
123
|
"@types/node": "^14",
|
|
125
124
|
"@types/react": "^17",
|
|
126
125
|
"@types/react-dom": "^17",
|
|
126
|
+
"react": "^17",
|
|
127
127
|
"typescript": "^4",
|
|
128
128
|
"jest": "^27",
|
|
129
129
|
"@scripts/jest-config": "0.0.0"
|
|
130
130
|
},
|
|
131
|
-
"peerDependencies": {
|
|
132
|
-
"@modern-js/core": "^1.4.0"
|
|
133
|
-
},
|
|
134
131
|
"sideEffects": false,
|
|
135
132
|
"modernConfig": {},
|
|
136
133
|
"publishConfig": {
|
|
137
134
|
"registry": "https://registry.npmjs.org/",
|
|
138
|
-
"access": "public"
|
|
139
|
-
"types": "./type.d.ts"
|
|
135
|
+
"access": "public"
|
|
140
136
|
},
|
|
141
137
|
"scripts": {
|
|
142
138
|
"new": "modern new",
|
package/tests/index.test.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { createApp
|
|
1
|
+
import { createApp } from '../src';
|
|
2
2
|
import plugin from '../src/cli';
|
|
3
3
|
|
|
4
4
|
describe('plugin-runtime', () => {
|
|
5
5
|
it('default', () => {
|
|
6
6
|
expect(plugin).toBeDefined();
|
|
7
7
|
expect(createApp).toBeDefined();
|
|
8
|
-
expect(createPlugin).toBeDefined();
|
|
9
|
-
expect(useRuntimeContext).toBeDefined();
|
|
10
|
-
|
|
11
|
-
const hooks = plugin.initializer();
|
|
12
|
-
expect(hooks.beforeRestart).toBeDefined();
|
|
13
8
|
});
|
|
14
9
|
});
|