@modern-js/runtime 1.0.0-alpha.5 → 1.0.0-rc.10

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,14 +1,127 @@
1
1
  # @modern-js/runtime
2
2
 
3
- ## 1.0.0-alpha.3
3
+ ## 1.0.0-rc.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 224f7fe: fix server route match
8
+ - 204c626: feat: initial
9
+ - Updated dependencies [224f7fe]
10
+ - Updated dependencies [204c626]
11
+ - @modern-js/core@1.0.0-rc.10
12
+ - @modern-js/plugin-router@1.0.0-rc.10
13
+ - @modern-js/plugin-ssr@1.0.0-rc.10
14
+ - @modern-js/plugin-state@1.0.0-rc.10
15
+ - @modern-js/runtime-core@1.0.0-rc.10
16
+ - @modern-js/bff-runtime@1.0.0-rc.10
17
+ - @modern-js/utils@1.0.0-rc.10
18
+
19
+ ## 1.0.0-rc.9
20
+
21
+ ### Patch Changes
22
+
23
+ - 224f7fe: fix server route match
24
+ - 204c626: feat: initial
25
+ - Updated dependencies [224f7fe]
26
+ - Updated dependencies [204c626]
27
+ - @modern-js/core@1.0.0-rc.9
28
+ - @modern-js/plugin-router@1.0.0-rc.9
29
+ - @modern-js/plugin-ssr@1.0.0-rc.9
30
+ - @modern-js/plugin-state@1.0.0-rc.9
31
+ - @modern-js/runtime-core@1.0.0-rc.9
32
+ - @modern-js/bff-runtime@1.0.0-rc.9
33
+ - @modern-js/utils@1.0.0-rc.9
34
+
35
+ ## 1.0.0-rc.8
36
+
37
+ ### Patch Changes
38
+
39
+ - 224f7fe: fix server route match
40
+ - 204c626: feat: initial
41
+ - Updated dependencies [224f7fe]
42
+ - Updated dependencies [204c626]
43
+ - @modern-js/core@1.0.0-rc.8
44
+ - @modern-js/plugin-router@1.0.0-rc.8
45
+ - @modern-js/plugin-ssr@1.0.0-rc.8
46
+ - @modern-js/plugin-state@1.0.0-rc.8
47
+ - @modern-js/runtime-core@1.0.0-rc.8
48
+ - @modern-js/bff-runtime@1.0.0-rc.8
49
+ - @modern-js/utils@1.0.0-rc.8
50
+
51
+ ## 1.0.0-rc.7
52
+
53
+ ### Patch Changes
54
+
55
+ - 224f7fe: fix server route match
56
+ - 204c626: feat: initial
57
+ - Updated dependencies [224f7fe]
58
+ - Updated dependencies [204c626]
59
+ - @modern-js/core@1.0.0-rc.7
60
+ - @modern-js/plugin-router@1.0.0-rc.7
61
+ - @modern-js/plugin-ssr@1.0.0-rc.7
62
+ - @modern-js/plugin-state@1.0.0-rc.7
63
+ - @modern-js/runtime-core@1.0.0-rc.7
64
+ - @modern-js/bff-runtime@1.0.0-rc.7
65
+ - @modern-js/utils@1.0.0-rc.7
66
+
67
+ ## 1.0.0-rc.6
68
+
69
+ ### Patch Changes
70
+
71
+ - 224f7fe: fix server route match
72
+ - 204c626: feat: initial
73
+ - Updated dependencies [224f7fe]
74
+ - Updated dependencies [204c626]
75
+ - @modern-js/core@1.0.0-rc.6
76
+ - @modern-js/plugin-router@1.0.0-rc.6
77
+ - @modern-js/plugin-ssr@1.0.0-rc.6
78
+ - @modern-js/plugin-state@1.0.0-rc.6
79
+ - @modern-js/runtime-core@1.0.0-rc.6
80
+ - @modern-js/bff-runtime@1.0.0-rc.6
81
+ - @modern-js/utils@1.0.0-rc.6
82
+
83
+ ## 1.0.0-rc.5
84
+
85
+ ### Patch Changes
86
+
87
+ - 224f7fe: fix server route match
88
+ - 204c626: feat: initial
89
+ - Updated dependencies [224f7fe]
90
+ - Updated dependencies [204c626]
91
+ - @modern-js/core@1.0.0-rc.5
92
+ - @modern-js/plugin-router@1.0.0-rc.5
93
+ - @modern-js/plugin-ssr@1.0.0-rc.5
94
+ - @modern-js/plugin-state@1.0.0-rc.5
95
+ - @modern-js/runtime-core@1.0.0-rc.5
96
+ - @modern-js/bff-runtime@1.0.0-rc.5
97
+ - @modern-js/utils@1.0.0-rc.5
98
+
99
+ ## 1.0.0-rc.4
100
+
101
+ ### Patch Changes
102
+
103
+ - fix server route match
104
+ - 204c626: feat: initial
105
+ - Updated dependencies [undefined]
106
+ - Updated dependencies [204c626]
107
+ - @modern-js/core@1.0.0-rc.4
108
+ - @modern-js/plugin-router@1.0.0-rc.4
109
+ - @modern-js/plugin-ssr@1.0.0-rc.4
110
+ - @modern-js/plugin-state@1.0.0-rc.4
111
+ - @modern-js/runtime-core@1.0.0-rc.4
112
+ - @modern-js/bff-runtime@1.0.0-rc.4
113
+ - @modern-js/utils@1.0.0-rc.4
114
+
115
+ ## 1.0.0-rc.3
116
+
4
117
  ### Patch Changes
5
118
 
6
119
  - feat: initial
7
120
  - Updated dependencies [undefined]
8
- - @modern-js/plugin-state@1.0.0-alpha.3
9
- - @modern-js/core@1.0.0-alpha.3
10
- - @modern-js/plugin-router@1.0.0-alpha.3
11
- - @modern-js/plugin-ssr@1.0.0-alpha.3
12
- - @modern-js/runtime-core@1.0.0-alpha.3
13
- - @modern-js/bff-runtime@1.0.0-alpha.3
14
- - @modern-js/utils@1.0.0-alpha.3
121
+ - @modern-js/core@1.0.0-rc.3
122
+ - @modern-js/plugin-router@1.0.0-rc.3
123
+ - @modern-js/plugin-ssr@1.0.0-rc.3
124
+ - @modern-js/plugin-state@1.0.0-rc.3
125
+ - @modern-js/bff-runtime@1.0.0-rc.3
126
+ - @modern-js/utils@1.0.0-rc.3
127
+ - @modern-js/runtime-core@1.0.0-rc.3
@@ -1,20 +1,46 @@
1
- import { createPlugin, usePlugins } from '@modern-js/core';
2
- import { PLUGIN_SCHEMAS } from '@modern-js/utils'; // eslint-disable-next-line react-hooks/rules-of-hooks
1
+ import path from 'path';
2
+ import { createPlugin, usePlugins, useAppContext } from '@modern-js/core';
3
+ import { PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
4
+
5
+ const useInternalDirectory = () => {
6
+ try {
7
+ return useAppContext().internalDirectory;
8
+ } catch (_unused) {
9
+ return path.join(process.cwd(), 'node_modules/.modern-js');
10
+ }
11
+ }; // eslint-disable-next-line react-hooks/rules-of-hooks
12
+
3
13
 
4
14
  usePlugins([require.resolve('@modern-js/plugin-state/cli'), require.resolve('@modern-js/plugin-router/cli'), require.resolve('@modern-js/plugin-ssr/cli')]);
5
- export default createPlugin(() => ({
6
- config() {
7
- return {
8
- runtime: {},
9
- runtimeByEntries: {}
10
- };
11
- },
15
+ export default createPlugin(() => {
16
+ let runtimeExportsUtils = {};
17
+ return {
18
+ config() {
19
+ // eslint-disable-next-line react-hooks/rules-of-hooks
20
+ const dir = useInternalDirectory();
21
+ runtimeExportsUtils = createRuntimeExportsUtils(dir, 'index');
22
+ return {
23
+ runtime: {},
24
+ runtimeByEntries: {},
25
+ source: {
26
+ alias: {
27
+ '@modern-js/runtime$': runtimeExportsUtils.getPath()
28
+ }
29
+ }
30
+ };
31
+ },
12
32
 
13
- validateSchema() {
14
- return PLUGIN_SCHEMAS['@modern-js/runtime'];
15
- }
33
+ validateSchema() {
34
+ return PLUGIN_SCHEMAS['@modern-js/runtime'];
35
+ },
36
+
37
+ addRuntimeExports() {
38
+ const runtimePackage = path.resolve(__dirname, '../../../../');
39
+ runtimeExportsUtils.addExport(`export * from '${runtimePackage}'`);
40
+ }
16
41
 
17
- }), {
42
+ };
43
+ }, {
18
44
  name: '@modern-js/runtime',
19
45
  post: ['@modern-js/plugin-router', '@modern-js/plugin-ssr', '@modern-js/plugin-state']
20
46
  });
@@ -1 +1,2 @@
1
+ import '@modern-js/plugin-state/type';
1
2
  export * from '@modern-js/plugin-state';
@@ -5,26 +5,55 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _core = require("@modern-js/core");
9
11
 
10
12
  var _utils = require("@modern-js/utils");
11
13
 
12
- // eslint-disable-next-line react-hooks/rules-of-hooks
13
- (0, _core.usePlugins)([require.resolve('@modern-js/plugin-state/cli'), require.resolve('@modern-js/plugin-router/cli'), require.resolve('@modern-js/plugin-ssr/cli')]);
14
-
15
- var _default = (0, _core.createPlugin)(() => ({
16
- config() {
17
- return {
18
- runtime: {},
19
- runtimeByEntries: {}
20
- };
21
- },
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
15
 
23
- validateSchema() {
24
- return _utils.PLUGIN_SCHEMAS['@modern-js/runtime'];
16
+ const useInternalDirectory = () => {
17
+ try {
18
+ return (0, _core.useAppContext)().internalDirectory;
19
+ } catch (_unused) {
20
+ return _path.default.join(process.cwd(), 'node_modules/.modern-js');
25
21
  }
22
+ }; // eslint-disable-next-line react-hooks/rules-of-hooks
23
+
24
+
25
+ (0, _core.usePlugins)([require.resolve('@modern-js/plugin-state/cli'), require.resolve('@modern-js/plugin-router/cli'), require.resolve('@modern-js/plugin-ssr/cli')]);
26
26
 
27
- }), {
27
+ var _default = (0, _core.createPlugin)(() => {
28
+ let runtimeExportsUtils = {};
29
+ return {
30
+ config() {
31
+ // eslint-disable-next-line react-hooks/rules-of-hooks
32
+ const dir = useInternalDirectory();
33
+ runtimeExportsUtils = (0, _utils.createRuntimeExportsUtils)(dir, 'index');
34
+ return {
35
+ runtime: {},
36
+ runtimeByEntries: {},
37
+ source: {
38
+ alias: {
39
+ '@modern-js/runtime$': runtimeExportsUtils.getPath()
40
+ }
41
+ }
42
+ };
43
+ },
44
+
45
+ validateSchema() {
46
+ return _utils.PLUGIN_SCHEMAS['@modern-js/runtime'];
47
+ },
48
+
49
+ addRuntimeExports() {
50
+ const runtimePackage = _path.default.resolve(__dirname, '../../../../');
51
+
52
+ runtimeExportsUtils.addExport(`export * from '${runtimePackage}'`);
53
+ }
54
+
55
+ };
56
+ }, {
28
57
  name: '@modern-js/runtime',
29
58
  post: ['@modern-js/plugin-router', '@modern-js/plugin-ssr', '@modern-js/plugin-state']
30
59
  });
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ require("@modern-js/plugin-state/type");
8
+
7
9
  var _pluginState = require("@modern-js/plugin-state");
8
10
 
9
11
  Object.keys(_pluginState).forEach(function (key) {
@@ -1,17 +1,40 @@
1
- import { createPlugin, usePlugins } from '@modern-js/core';
2
- import { PLUGIN_SCHEMAS } from '@modern-js/utils'; // eslint-disable-next-line react-hooks/rules-of-hooks
1
+ import path from 'path';
2
+ import { createPlugin, usePlugins, useAppContext } from '@modern-js/core';
3
+ import { PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
4
+
5
+ var useInternalDirectory = function useInternalDirectory() {
6
+ try {
7
+ return useAppContext().internalDirectory;
8
+ } catch (_unused) {
9
+ return path.join(process.cwd(), 'node_modules/.modern-js');
10
+ }
11
+ }; // eslint-disable-next-line react-hooks/rules-of-hooks
12
+
3
13
 
4
14
  usePlugins([require.resolve('@modern-js/plugin-state/cli'), require.resolve('@modern-js/plugin-router/cli'), require.resolve('@modern-js/plugin-ssr/cli')]);
5
15
  export default createPlugin(function () {
16
+ var runtimeExportsUtils = {};
6
17
  return {
7
18
  config: function config() {
19
+ // eslint-disable-next-line react-hooks/rules-of-hooks
20
+ var dir = useInternalDirectory();
21
+ runtimeExportsUtils = createRuntimeExportsUtils(dir, 'index');
8
22
  return {
9
23
  runtime: {},
10
- runtimeByEntries: {}
24
+ runtimeByEntries: {},
25
+ source: {
26
+ alias: {
27
+ '@modern-js/runtime$': runtimeExportsUtils.getPath()
28
+ }
29
+ }
11
30
  };
12
31
  },
13
32
  validateSchema: function validateSchema() {
14
33
  return PLUGIN_SCHEMAS['@modern-js/runtime'];
34
+ },
35
+ addRuntimeExports: function addRuntimeExports() {
36
+ var runtimePackage = path.resolve(__dirname, '../../../../');
37
+ runtimeExportsUtils.addExport("export * from '".concat(runtimePackage, "'"));
15
38
  }
16
39
  };
17
40
  }, {
@@ -1 +1,2 @@
1
+ import '@modern-js/plugin-state/type';
1
2
  export * from '@modern-js/plugin-state';
@@ -1 +1,2 @@
1
+ import '@modern-js/plugin-state/type';
1
2
  export * from '@modern-js/plugin-state';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@modern-js/runtime",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-rc.10",
4
4
  "jsnext:source": "./src/index.ts",
5
- "types": "./dist/types/index.d.ts",
5
+ "types": "./type.d.ts",
6
6
  "main": "./dist/js/node/index.js",
7
7
  "module": "./dist/js/treeshaking/index.js",
8
8
  "jsnext:modern": "./dist/js/modern/index.js",
@@ -68,7 +68,7 @@
68
68
  "typesVersions": {
69
69
  "*": {
70
70
  ".": [
71
- "./dist/types/index.d.ts"
71
+ "./type.d.ts"
72
72
  ],
73
73
  "loadable": [
74
74
  "./dist/types/exports/loadable.d.ts"
@@ -89,20 +89,20 @@
89
89
  "./dist/types/exports/router.d.ts"
90
90
  ],
91
91
  "model": [
92
- "./dist/types/exports/model.d.ts"
92
+ "./types/model.d.ts"
93
93
  ]
94
94
  }
95
95
  },
96
96
  "dependencies": {
97
97
  "@babel/runtime": "^7",
98
98
  "@loadable/component": "^5.15.0",
99
- "@modern-js/bff-runtime": "1.0.0-alpha.5",
100
- "@modern-js/core": "1.0.0-alpha.5",
101
- "@modern-js/plugin-router": "1.0.0-alpha.5",
102
- "@modern-js/plugin-ssr": "1.0.0-alpha.5",
103
- "@modern-js/plugin-state": "1.0.0-alpha.5",
104
- "@modern-js/runtime-core": "1.0.0-alpha.5",
105
- "@modern-js/utils": "1.0.0-alpha.5",
99
+ "@modern-js/bff-runtime": "^1.0.0-rc.10",
100
+ "@modern-js/core": "^1.0.0-rc.10",
101
+ "@modern-js/plugin-router": "^1.0.0-rc.10",
102
+ "@modern-js/plugin-ssr": "^1.0.0-rc.10",
103
+ "@modern-js/plugin-state": "^1.0.0-rc.10",
104
+ "@modern-js/runtime-core": "^1.0.0-rc.10",
105
+ "@modern-js/utils": "^1.0.0-rc.10",
106
106
  "@types/loadable__component": "^5.13.4",
107
107
  "@types/react-helmet": "^6.1.2",
108
108
  "@types/styled-components": "^5.1.13",
@@ -115,11 +115,15 @@
115
115
  "@types/react": "^17",
116
116
  "@types/react-dom": "^17",
117
117
  "typescript": "^4",
118
- "@modern-js/plugin-testing": "^1.0.0-alpha.3",
119
- "@modern-js/module-tools": "^1.0.0-alpha.3"
118
+ "@modern-js/plugin-testing": "^1.0.0-rc.10",
119
+ "@modern-js/module-tools": "^1.0.0-rc.10"
120
120
  },
121
121
  "sideEffects": false,
122
122
  "modernConfig": {},
123
+ "publishConfig": {
124
+ "registry": "https://registry.npmjs.org/",
125
+ "access": "public"
126
+ },
123
127
  "scripts": {
124
128
  "new": "modern new",
125
129
  "build": "modern build",
package/src/cli/index.ts CHANGED
@@ -1,5 +1,14 @@
1
- import { createPlugin, usePlugins } from '@modern-js/core';
2
- import { PLUGIN_SCHEMAS } from '@modern-js/utils';
1
+ import path from 'path';
2
+ import { createPlugin, usePlugins, useAppContext } from '@modern-js/core';
3
+ import { PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
4
+
5
+ const useInternalDirectory = () => {
6
+ try {
7
+ return useAppContext().internalDirectory;
8
+ } catch {
9
+ return path.join(process.cwd(), 'node_modules/.modern-js');
10
+ }
11
+ };
3
12
 
4
13
  // eslint-disable-next-line react-hooks/rules-of-hooks
5
14
  usePlugins([
@@ -9,17 +18,37 @@ usePlugins([
9
18
  ]);
10
19
 
11
20
  export default createPlugin(
12
- () => ({
13
- config() {
14
- return {
15
- runtime: {},
16
- runtimeByEntries: {},
17
- };
18
- },
19
- validateSchema() {
20
- return PLUGIN_SCHEMAS['@modern-js/runtime'];
21
- },
22
- }),
21
+ () => {
22
+ let runtimeExportsUtils: ReturnType<typeof createRuntimeExportsUtils> =
23
+ {} as any;
24
+
25
+ return {
26
+ config() {
27
+ // eslint-disable-next-line react-hooks/rules-of-hooks
28
+ const dir = useInternalDirectory();
29
+
30
+ runtimeExportsUtils = createRuntimeExportsUtils(dir, 'index');
31
+
32
+ return {
33
+ runtime: {},
34
+ runtimeByEntries: {},
35
+ source: {
36
+ alias: {
37
+ '@modern-js/runtime$': runtimeExportsUtils.getPath(),
38
+ },
39
+ },
40
+ };
41
+ },
42
+ validateSchema() {
43
+ return PLUGIN_SCHEMAS['@modern-js/runtime'];
44
+ },
45
+ addRuntimeExports() {
46
+ const runtimePackage = path.resolve(__dirname, '../../../../');
47
+
48
+ runtimeExportsUtils.addExport(`export * from '${runtimePackage}'`);
49
+ },
50
+ };
51
+ },
23
52
  {
24
53
  name: '@modern-js/runtime',
25
54
  post: [
@@ -1 +1,3 @@
1
+ import '@modern-js/plugin-state/type';
2
+
1
3
  export * from '@modern-js/plugin-state';
package/type.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ declare module '@modern-js/runtime' {
2
+ export * from './dist/types';
3
+ }
4
+
5
+ export * from './dist/types';
@@ -0,0 +1,3 @@
1
+ import '@modern-js/plugin-state/type';
2
+
3
+ export * from '../dist/types/exports/model';