@modern-js/runtime 1.1.2-rc.0 → 1.2.1

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,23 +1,76 @@
1
1
  # @modern-js/runtime
2
2
 
3
- ## 1.1.2-rc.0
3
+ ## 1.2.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [d927bc83]
8
- - Updated dependencies [d73ff455]
9
- - Updated dependencies [9c1ab865]
10
- - Updated dependencies [d73ff455]
11
- - Updated dependencies [d73ff455]
12
- - Updated dependencies [d73ff455]
13
- - Updated dependencies [d73ff455]
14
- - @modern-js/utils@1.1.4-rc.0
15
- - @modern-js/core@1.1.4-rc.0
16
- - @modern-js/plugin-router@1.1.2-rc.0
17
- - @modern-js/plugin-ssr@1.1.2-rc.0
18
- - @modern-js/plugin-state@1.1.3-rc.0
19
- - @modern-js/runtime-core@1.1.2-rc.0
20
- - @modern-js/bff-runtime@1.1.2-rc.0
7
+ - 83166714: change .npmignore
8
+ - Updated dependencies [83166714]
9
+ - Updated dependencies [c3de9882]
10
+ - Updated dependencies [33ff48af]
11
+ - Updated dependencies [c74597bd]
12
+ - @modern-js/core@1.3.2
13
+ - @modern-js/plugin-router@1.2.1
14
+ - @modern-js/plugin-state@1.2.1
15
+ - @modern-js/runtime-core@1.2.1
16
+ - @modern-js/bff-runtime@1.2.1
17
+ - @modern-js/create-request@1.2.1
18
+ - @modern-js/utils@1.2.2
19
+
20
+ ## 1.2.0
21
+
22
+ ### Minor Changes
23
+
24
+ - cfe11628: Make Modern.js self bootstraping
25
+
26
+ ### Patch Changes
27
+
28
+ - 146dcd85: modify server framework plugin hook types and hook context
29
+ - 146dcd85: modify server framework plugin hook types
30
+ - 146dcd85: fix test case in babel compiler
31
+ - Updated dependencies [2da09c69]
32
+ - Updated dependencies [5597289b]
33
+ - Updated dependencies [fc71e36f]
34
+ - Updated dependencies [146dcd85]
35
+ - Updated dependencies [a2cb9abc]
36
+ - Updated dependencies [c3d46ee4]
37
+ - Updated dependencies [cfe11628]
38
+ - Updated dependencies [146dcd85]
39
+ - Updated dependencies [146dcd85]
40
+ - @modern-js/utils@1.2.0
41
+ - @modern-js/plugin-ssr@1.2.0
42
+ - @modern-js/create-request@1.2.0
43
+ - @modern-js/core@1.3.0
44
+ - @modern-js/bff-runtime@1.2.0
45
+ - @modern-js/runtime-core@1.2.0
46
+ - @modern-js/plugin-router@1.2.0
47
+ - @modern-js/plugin-state@1.2.0
48
+
49
+ ## 1.1.3
50
+
51
+ ### Patch Changes
52
+
53
+ - b8deff8b: feat: add isBrowser in runtime context
54
+ - Updated dependencies [e63591cc]
55
+ - @modern-js/plugin-router@1.1.3
56
+ - @modern-js/runtime-core@1.1.4
57
+
58
+ ## 1.1.2
59
+
60
+ ### Patch Changes
61
+
62
+ - e51b1db3: feat: support custom sdk, interceptor, headers for bff request
63
+ - Updated dependencies [e51b1db3]
64
+ - Updated dependencies [4a281912]
65
+ - Updated dependencies [4a281912]
66
+ - Updated dependencies [b7fb82ec]
67
+ - Updated dependencies [eb026119]
68
+ - @modern-js/plugin-ssr@1.1.3
69
+ - @modern-js/create-request@1.1.2
70
+ - @modern-js/runtime-core@1.1.3
71
+ - @modern-js/plugin-router@1.1.2
72
+ - @modern-js/plugin-state@1.1.4
73
+ - @modern-js/utils@1.1.6
21
74
 
22
75
  ## 1.1.1
23
76
 
@@ -0,0 +1 @@
1
+ export { configure } from '@modern-js/create-request';
@@ -1 +1,2 @@
1
- export * from '@modern-js/bff-runtime';
1
+ export * from '@modern-js/bff-runtime';
2
+ export const hook = attacher => attacher;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "configure", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _createRequest.configure;
10
+ }
11
+ });
12
+
13
+ var _createRequest = require("@modern-js/create-request");
@@ -3,11 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ hook: true
8
+ };
9
+ exports.hook = void 0;
6
10
 
7
11
  var _bffRuntime = require("@modern-js/bff-runtime");
8
12
 
9
13
  Object.keys(_bffRuntime).forEach(function (key) {
10
14
  if (key === "default" || key === "__esModule") return;
15
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
11
16
  if (key in exports && exports[key] === _bffRuntime[key]) return;
12
17
  Object.defineProperty(exports, key, {
13
18
  enumerable: true,
@@ -15,4 +20,8 @@ Object.keys(_bffRuntime).forEach(function (key) {
15
20
  return _bffRuntime[key];
16
21
  }
17
22
  });
18
- });
23
+ });
24
+
25
+ const hook = attacher => attacher;
26
+
27
+ exports.hook = hook;
@@ -0,0 +1 @@
1
+ export { configure } from '@modern-js/create-request';
@@ -1 +1,4 @@
1
- export * from '@modern-js/bff-runtime';
1
+ export * from '@modern-js/bff-runtime';
2
+ export var hook = function hook(attacher) {
3
+ return attacher;
4
+ };
@@ -0,0 +1 @@
1
+ export { configure } from '@modern-js/create-request';
@@ -1 +1,2 @@
1
- export * from '@modern-js/bff-runtime';
1
+ export * from '@modern-js/bff-runtime';
2
+ export declare const hook: (attacher: any) => any;
package/jest.config.js ADDED
@@ -0,0 +1,8 @@
1
+ const sharedConfig = require('@scripts/jest-config');
2
+
3
+ /** @type {import('@jest/types').Config.InitialOptions} */
4
+ module.exports = {
5
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
+ ...sharedConfig,
7
+ rootDir: __dirname,
8
+ };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.1.2-rc.0",
14
+ "version": "1.2.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./type.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -19,38 +19,56 @@
19
19
  "jsnext:modern": "./dist/js/modern/index.js",
20
20
  "exports": {
21
21
  ".": {
22
- "node": "./dist/js/node/index.js",
22
+ "node": {
23
+ "jsnext:source": "./src/index.ts",
24
+ "default": "./dist/js/node/index.js"
25
+ },
23
26
  "default": "./dist/js/treeshaking/index.js"
24
27
  },
25
28
  "./loadable": {
29
+ "jsnext:source": "./src/exports/loadable.ts",
26
30
  "node": "./dist/js/node/exports/loadable.js",
27
31
  "default": "./dist/js/treeshaking/exports/loadable.js"
28
32
  },
29
33
  "./head": {
34
+ "jsnext:source": "./src/exports/head.ts",
30
35
  "node": "./dist/js/node/exports/head.js",
31
36
  "default": "./dist/js/treeshaking/exports/head.js"
32
37
  },
33
38
  "./styled": {
39
+ "jsnext:source": "./src/exports/styled.ts",
34
40
  "node": "./dist/js/node/exports/styled.js",
35
41
  "default": "./dist/js/treeshaking/exports/styled.js"
36
42
  },
37
43
  "./server": {
44
+ "jsnext:source": "./src/exports/server.ts",
38
45
  "node": "./dist/js/node/exports/server.js",
39
46
  "default": "./dist/js/treeshaking/exports/server.js"
40
47
  },
41
48
  "./router": {
49
+ "jsnext:source": "./src/exports/router.ts",
42
50
  "node": "./dist/js/node/exports/router.js",
43
51
  "default": "./dist/js/treeshaking/exports/router.js"
44
52
  },
45
53
  "./ssr": {
54
+ "jsnext:source": "./src/exports/ssr.ts",
46
55
  "node": "./dist/js/node/exports/ssr.js",
47
56
  "default": "./dist/js/treeshaking/exports/ssr.js"
48
57
  },
49
58
  "./model": {
59
+ "jsnext:source": "./src/exports/model.ts",
50
60
  "node": "./dist/js/node/exports/model.js",
51
61
  "default": "./dist/js/treeshaking/exports/model.js"
52
62
  },
53
- "./cli": "./dist/js/node/cli/index.js"
63
+ "./request": {
64
+ "jsnext:source": "./src/exports/request.ts",
65
+ "node": "./dist/js/node/exports/request.js",
66
+ "default": "./dist/js/treeshaking/exports/request.js"
67
+ },
68
+ "./cli": {
69
+ "jsnext:source": "./src/cli/index.ts",
70
+ "default": "./dist/js/node/cli/index.js"
71
+ }
54
72
  },
55
73
  "typesVersions": {
56
74
  "*": {
@@ -75,6 +93,9 @@
75
93
  "router": [
76
94
  "./dist/types/exports/router.d.ts"
77
95
  ],
96
+ "request": [
97
+ "./dist/types/exports/request.d.ts"
98
+ ],
78
99
  "model": [
79
100
  "./types/model.d.ts"
80
101
  ]
@@ -82,42 +103,45 @@
82
103
  },
83
104
  "dependencies": {
84
105
  "@babel/runtime": "^7",
106
+ "@modern-js/plugin-router": "^1.2.1",
107
+ "@modern-js/plugin-ssr": "^1.2.0",
108
+ "@modern-js/plugin-state": "^1.2.1",
109
+ "@modern-js/runtime-core": "^1.2.1",
110
+ "@modern-js/utils": "^1.2.2",
111
+ "@modern-js/bff-runtime": "^1.2.1",
112
+ "@modern-js/create-request": "^1.2.1",
85
113
  "@loadable/component": "^5.15.0",
86
- "@modern-js/bff-runtime": "^1.1.2-rc.0",
87
- "@modern-js/plugin-router": "^1.1.2-rc.0",
88
- "@modern-js/plugin-ssr": "^1.1.2-rc.0",
89
- "@modern-js/plugin-state": "^1.1.3-rc.0",
90
- "@modern-js/runtime-core": "^1.1.2-rc.0",
91
- "@modern-js/utils": "^1.1.4-rc.0",
92
- "@types/loadable__component": "^5.13.4",
93
- "@types/react-helmet": "^6.1.2",
94
- "@types/styled-components": "^5.1.13",
95
114
  "react-helmet": "^6.1.0",
96
115
  "styled-components": "^5.3.1"
97
116
  },
98
117
  "devDependencies": {
118
+ "@modern-js/core": "^1.3.2",
119
+ "@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",
99
123
  "@types/jest": "^26",
100
124
  "@types/node": "^14",
101
125
  "@types/react": "^17",
102
126
  "@types/react-dom": "^17",
103
127
  "typescript": "^4",
104
- "@modern-js/core": "^1.1.4-rc.0",
105
- "@modern-js/plugin-testing": "^1.1.1",
106
- "@modern-js/module-tools": "^1.1.1"
128
+ "jest": "^27",
129
+ "@scripts/jest-config": "0.0.0"
107
130
  },
108
131
  "peerDependencies": {
109
- "@modern-js/core": "^1.1.4-rc.0"
132
+ "@modern-js/core": "^1.3.2"
110
133
  },
111
134
  "sideEffects": false,
112
135
  "modernConfig": {},
113
136
  "publishConfig": {
114
137
  "registry": "https://registry.npmjs.org/",
115
- "access": "public"
138
+ "access": "public",
139
+ "types": "./type.d.ts"
116
140
  },
117
141
  "scripts": {
118
142
  "new": "modern new",
119
143
  "build": "modern build",
120
- "test": "modern test --passWithNoTests"
144
+ "test": "jest --passWithNoTests"
121
145
  },
122
146
  "readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
123
147
  }
@@ -0,0 +1,11 @@
1
+ import { createApp, createPlugin, useRuntimeContext } from '../src';
2
+ import plugin from '../src/cli';
3
+
4
+ describe('plugin-runtime', () => {
5
+ it('default', () => {
6
+ expect(plugin).toBeDefined();
7
+ expect(createApp).toBeDefined();
8
+ expect(createPlugin).toBeDefined();
9
+ expect(useRuntimeContext).toBeDefined();
10
+ });
11
+ });
@@ -0,0 +1,10 @@
1
+ import { hook } from '../src/exports/server';
2
+
3
+ describe('runtime export', () => {
4
+ it('should return self after hook', () => {
5
+ const fn = () => {
6
+ // empty
7
+ };
8
+ expect(hook(fn)).toBe(fn);
9
+ });
10
+ });
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "@modern-js/tsconfig/base",
3
+ "compilerOptions": {
4
+ "declaration": false,
5
+ "jsx": "preserve",
6
+ "baseUrl": "./",
7
+ "noEmit": true,
8
+ "isolatedModules": true,
9
+ "sourceMap": true,
10
+ "types": ["node", "jest"]
11
+ },
12
+ "paths": {}
13
+ }
package/tsconfig.json CHANGED
@@ -5,9 +5,7 @@
5
5
  "jsx": "preserve",
6
6
  "baseUrl": "./",
7
7
  "isolatedModules": true,
8
- "paths": {
9
- "@/*": ["./src/*"]
10
- }
8
+ "paths": {}
11
9
  },
12
10
  "include": ["src"]
13
11
  }
@@ -1,3 +0,0 @@
1
- {
2
- "extends": ["@modern-js-app"]
3
- }
package/src/cli/index.ts DELETED
@@ -1,60 +0,0 @@
1
- import path from 'path';
2
- import { PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
3
- import { createPlugin, usePlugins, useAppContext } from '@modern-js/core';
4
-
5
- const useInternalDirectory = () => {
6
- try {
7
- return useAppContext().internalDirectory;
8
- } catch {
9
- return path.join(process.cwd(), 'node_modules/.modern-js');
10
- }
11
- };
12
-
13
- // eslint-disable-next-line react-hooks/rules-of-hooks
14
- usePlugins([
15
- require.resolve('@modern-js/plugin-state/cli'),
16
- require.resolve('@modern-js/plugin-router/cli'),
17
- require.resolve('@modern-js/plugin-ssr/cli'),
18
- ]);
19
-
20
- export default createPlugin(
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
- },
52
- {
53
- name: '@modern-js/runtime',
54
- post: [
55
- '@modern-js/plugin-router',
56
- '@modern-js/plugin-ssr',
57
- '@modern-js/plugin-state',
58
- ],
59
- },
60
- ) as any;
@@ -1 +0,0 @@
1
- declare module '@loadable/webpack-plugin';
@@ -1,5 +0,0 @@
1
- import head from 'react-helmet';
2
-
3
- export default head;
4
-
5
- export * from 'react-helmet';
@@ -1,5 +0,0 @@
1
- import loadable from '@loadable/component';
2
-
3
- export default loadable;
4
-
5
- export * from '@loadable/component';
@@ -1 +0,0 @@
1
- export * from '@modern-js/plugin-state';
@@ -1 +0,0 @@
1
- export * from '@modern-js/plugin-router';
@@ -1 +0,0 @@
1
- export * from '@modern-js/bff-runtime';
@@ -1 +0,0 @@
1
- export * from '@modern-js/plugin-ssr';
@@ -1,5 +0,0 @@
1
- import styled from '@modern-js/runtime-core/styled';
2
-
3
- export default styled;
4
-
5
- export * from '@modern-js/runtime-core/styled';
package/src/index.ts DELETED
@@ -1,12 +0,0 @@
1
- export type { RuntimeContext, TRuntimeContext } from '@modern-js/runtime-core';
2
- export {
3
- createApp,
4
- createPlugin,
5
- useLoader,
6
- bootstrap,
7
- RuntimeReactContext,
8
- registerPrefetch,
9
- defineConfig,
10
- registerInit,
11
- useRuntimeContext,
12
- } from '@modern-js/runtime-core';