@modern-js/runtime 1.1.1 → 1.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # @modern-js/runtime
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cfe11628: Make Modern.js self bootstraping
8
+
9
+ ### Patch Changes
10
+
11
+ - 146dcd85: modify server framework plugin hook types and hook context
12
+ - 146dcd85: modify server framework plugin hook types
13
+ - 146dcd85: fix test case in babel compiler
14
+ - Updated dependencies [2da09c69]
15
+ - Updated dependencies [5597289b]
16
+ - Updated dependencies [fc71e36f]
17
+ - Updated dependencies [146dcd85]
18
+ - Updated dependencies [a2cb9abc]
19
+ - Updated dependencies [c3d46ee4]
20
+ - Updated dependencies [cfe11628]
21
+ - Updated dependencies [146dcd85]
22
+ - Updated dependencies [146dcd85]
23
+ - @modern-js/utils@1.2.0
24
+ - @modern-js/plugin-ssr@1.2.0
25
+ - @modern-js/create-request@1.2.0
26
+ - @modern-js/core@1.3.0
27
+ - @modern-js/bff-runtime@1.2.0
28
+ - @modern-js/runtime-core@1.2.0
29
+ - @modern-js/plugin-router@1.2.0
30
+ - @modern-js/plugin-state@1.2.0
31
+
32
+ ## 1.1.3
33
+
34
+ ### Patch Changes
35
+
36
+ - b8deff8b: feat: add isBrowser in runtime context
37
+ - Updated dependencies [e63591cc]
38
+ - @modern-js/plugin-router@1.1.3
39
+ - @modern-js/runtime-core@1.1.4
40
+
41
+ ## 1.1.2
42
+
43
+ ### Patch Changes
44
+
45
+ - e51b1db3: feat: support custom sdk, interceptor, headers for bff request
46
+ - Updated dependencies [e51b1db3]
47
+ - Updated dependencies [4a281912]
48
+ - Updated dependencies [4a281912]
49
+ - Updated dependencies [b7fb82ec]
50
+ - Updated dependencies [eb026119]
51
+ - @modern-js/plugin-ssr@1.1.3
52
+ - @modern-js/create-request@1.1.2
53
+ - @modern-js/runtime-core@1.1.3
54
+ - @modern-js/plugin-router@1.1.2
55
+ - @modern-js/plugin-state@1.1.4
56
+ - @modern-js/utils@1.1.6
57
+
3
58
  ## 1.1.1
4
59
 
5
60
  ### Patch Changes
@@ -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.1",
14
+ "version": "1.2.0",
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,41 +103,45 @@
82
103
  },
83
104
  "dependencies": {
84
105
  "@babel/runtime": "^7",
106
+ "@modern-js/plugin-router": "^1.2.0",
107
+ "@modern-js/plugin-ssr": "^1.2.0",
108
+ "@modern-js/plugin-state": "^1.2.0",
109
+ "@modern-js/runtime-core": "^1.2.0",
110
+ "@modern-js/utils": "^1.2.0",
111
+ "@modern-js/bff-runtime": "^1.2.0",
112
+ "@modern-js/create-request": "^1.2.0",
85
113
  "@loadable/component": "^5.15.0",
86
- "@modern-js/bff-runtime": "^1.1.1",
87
- "@modern-js/plugin-router": "^1.1.1",
88
- "@modern-js/plugin-ssr": "^1.1.1",
89
- "@modern-js/plugin-state": "^1.1.2",
90
- "@modern-js/runtime-core": "^1.1.1",
91
- "@modern-js/utils": "^1.1.2",
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.0",
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.2",
105
- "@modern-js/plugin-testing": "^1.1.0",
106
- "@modern-js/module-tools": "^1.1.0"
128
+ "jest": "^27",
129
+ "@scripts/jest-config": "0.0.0"
107
130
  },
108
131
  "peerDependencies": {
109
- "@modern-js/core": "^1.1.2"
132
+ "@modern-js/core": "^1.3.0"
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"
121
- }
144
+ "test": "jest --passWithNoTests"
145
+ },
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"
122
147
  }
@@ -0,0 +1 @@
1
+ export { configure } from '@modern-js/create-request';
@@ -1 +1,2 @@
1
1
  export * from '@modern-js/bff-runtime';
2
+ export const hook = (attacher: any) => attacher;
@@ -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
  }