@modern-js/plugin-proxy 1.0.0-rc.2 → 1.0.0-rc.20

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 ADDED
@@ -0,0 +1,229 @@
1
+ # @modern-js/plugin-proxy
2
+
3
+ ## 1.0.0-rc.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 224f7fe: fix server route match
8
+ - 30ac27c: feat: add generator package description
9
+ - feat: fix bugs
10
+ - 204c626: feat: initial
11
+ - 63be0a5: fix: #118 #104
12
+ - Updated dependencies [224f7fe]
13
+ - Updated dependencies [30ac27c]
14
+ - Updated dependencies [undefined]
15
+ - Updated dependencies [204c626]
16
+ - Updated dependencies [63be0a5]
17
+ - @modern-js/core@1.0.0-rc.20
18
+ - @modern-js/utils@1.0.0-rc.20
19
+
20
+ ## 1.0.0-rc.19
21
+
22
+ ### Patch Changes
23
+
24
+ - 224f7fe: fix server route match
25
+ - 30ac27c: feat: add generator package description
26
+ - 204c626: feat: initial
27
+ - 63be0a5: fix: #118 #104
28
+ - Updated dependencies [224f7fe]
29
+ - Updated dependencies [30ac27c]
30
+ - Updated dependencies [204c626]
31
+ - Updated dependencies [63be0a5]
32
+ - @modern-js/core@1.0.0-rc.19
33
+ - @modern-js/utils@1.0.0-rc.19
34
+
35
+ ## 1.0.0-rc.18
36
+
37
+ ### Patch Changes
38
+
39
+ - 224f7fe: fix server route match
40
+ - 30ac27c: feat: add generator package description
41
+ - 204c626: feat: initial
42
+ - 63be0a5: fix: #118 #104
43
+ - Updated dependencies [224f7fe]
44
+ - Updated dependencies [30ac27c]
45
+ - Updated dependencies [204c626]
46
+ - Updated dependencies [63be0a5]
47
+ - @modern-js/core@1.0.0-rc.18
48
+ - @modern-js/utils@1.0.0-rc.18
49
+
50
+ ## 1.0.0-rc.17
51
+
52
+ ### Patch Changes
53
+
54
+ - 224f7fe: fix server route match
55
+ - 30ac27c: feat: add generator package description
56
+ - 204c626: feat: initial
57
+ - fix: #118 #104
58
+ - Updated dependencies [224f7fe]
59
+ - Updated dependencies [30ac27c]
60
+ - Updated dependencies [204c626]
61
+ - Updated dependencies [undefined]
62
+ - @modern-js/core@1.0.0-rc.17
63
+ - @modern-js/utils@1.0.0-rc.17
64
+
65
+ ## 1.0.0-rc.16
66
+
67
+ ### Patch Changes
68
+
69
+ - 224f7fe: fix server route match
70
+ - 30ac27c: feat: add generator package description
71
+ - 204c626: feat: initial
72
+ - Updated dependencies [224f7fe]
73
+ - Updated dependencies [30ac27c]
74
+ - Updated dependencies [204c626]
75
+ - @modern-js/core@1.0.0-rc.16
76
+ - @modern-js/utils@1.0.0-rc.16
77
+
78
+ ## 1.0.0-rc.15
79
+
80
+ ### Patch Changes
81
+
82
+ - 224f7fe: fix server route match
83
+ - 30ac27c: feat: add generator package description
84
+ - 204c626: feat: initial
85
+ - Updated dependencies [224f7fe]
86
+ - Updated dependencies [30ac27c]
87
+ - Updated dependencies [204c626]
88
+ - @modern-js/core@1.0.0-rc.15
89
+ - @modern-js/utils@1.0.0-rc.15
90
+
91
+ ## 1.0.0-rc.14
92
+
93
+ ### Patch Changes
94
+
95
+ - 224f7fe: fix server route match
96
+ - 204c626: feat: initial
97
+ - Updated dependencies [224f7fe]
98
+ - Updated dependencies [204c626]
99
+ - @modern-js/core@1.0.0-rc.14
100
+ - @modern-js/utils@1.0.0-rc.14
101
+
102
+ ## 1.0.0-rc.13
103
+
104
+ ### Patch Changes
105
+
106
+ - 224f7fe: fix server route match
107
+ - 204c626: feat: initial
108
+ - Updated dependencies [224f7fe]
109
+ - Updated dependencies [204c626]
110
+ - @modern-js/core@1.0.0-rc.13
111
+ - @modern-js/utils@1.0.0-rc.13
112
+
113
+ ## 1.0.0-rc.12
114
+
115
+ ### Patch Changes
116
+
117
+ - 224f7fe: fix server route match
118
+ - 204c626: feat: initial
119
+ - Updated dependencies [224f7fe]
120
+ - Updated dependencies [204c626]
121
+ - @modern-js/core@1.0.0-rc.12
122
+ - @modern-js/plugin@1.0.0-rc.12
123
+ - @modern-js/utils@1.0.0-rc.12
124
+
125
+ ## 1.0.0-rc.11
126
+
127
+ ### Patch Changes
128
+
129
+ - 224f7fe: fix server route match
130
+ - 204c626: feat: initial
131
+ - Updated dependencies [224f7fe]
132
+ - Updated dependencies [204c626]
133
+ - @modern-js/core@1.0.0-rc.11
134
+ - @modern-js/plugin@1.0.0-rc.11
135
+ - @modern-js/utils@1.0.0-rc.11
136
+
137
+ ## 1.0.0-rc.10
138
+
139
+ ### Patch Changes
140
+
141
+ - 224f7fe: fix server route match
142
+ - 204c626: feat: initial
143
+ - Updated dependencies [224f7fe]
144
+ - Updated dependencies [204c626]
145
+ - @modern-js/core@1.0.0-rc.10
146
+ - @modern-js/plugin@1.0.0-rc.10
147
+ - @modern-js/utils@1.0.0-rc.10
148
+
149
+ ## 1.0.0-rc.9
150
+
151
+ ### Patch Changes
152
+
153
+ - 224f7fe: fix server route match
154
+ - 204c626: feat: initial
155
+ - Updated dependencies [224f7fe]
156
+ - Updated dependencies [204c626]
157
+ - @modern-js/core@1.0.0-rc.9
158
+ - @modern-js/plugin@1.0.0-rc.9
159
+ - @modern-js/utils@1.0.0-rc.9
160
+
161
+ ## 1.0.0-rc.8
162
+
163
+ ### Patch Changes
164
+
165
+ - 224f7fe: fix server route match
166
+ - 204c626: feat: initial
167
+ - Updated dependencies [224f7fe]
168
+ - Updated dependencies [204c626]
169
+ - @modern-js/core@1.0.0-rc.8
170
+ - @modern-js/plugin@1.0.0-rc.8
171
+ - @modern-js/utils@1.0.0-rc.8
172
+
173
+ ## 1.0.0-rc.7
174
+
175
+ ### Patch Changes
176
+
177
+ - 224f7fe: fix server route match
178
+ - 204c626: feat: initial
179
+ - Updated dependencies [224f7fe]
180
+ - Updated dependencies [204c626]
181
+ - @modern-js/core@1.0.0-rc.7
182
+ - @modern-js/plugin@1.0.0-rc.7
183
+ - @modern-js/utils@1.0.0-rc.7
184
+
185
+ ## 1.0.0-rc.6
186
+
187
+ ### Patch Changes
188
+
189
+ - 224f7fe: fix server route match
190
+ - 204c626: feat: initial
191
+ - Updated dependencies [224f7fe]
192
+ - Updated dependencies [204c626]
193
+ - @modern-js/core@1.0.0-rc.6
194
+ - @modern-js/plugin@1.0.0-rc.6
195
+ - @modern-js/utils@1.0.0-rc.6
196
+
197
+ ## 1.0.0-rc.5
198
+
199
+ ### Patch Changes
200
+
201
+ - 224f7fe: fix server route match
202
+ - 204c626: feat: initial
203
+ - Updated dependencies [224f7fe]
204
+ - Updated dependencies [204c626]
205
+ - @modern-js/core@1.0.0-rc.5
206
+ - @modern-js/plugin@1.0.0-rc.5
207
+ - @modern-js/utils@1.0.0-rc.5
208
+
209
+ ## 1.0.0-rc.4
210
+
211
+ ### Patch Changes
212
+
213
+ - fix server route match
214
+ - 204c626: feat: initial
215
+ - Updated dependencies [undefined]
216
+ - Updated dependencies [204c626]
217
+ - @modern-js/core@1.0.0-rc.4
218
+ - @modern-js/plugin@1.0.0-rc.4
219
+ - @modern-js/utils@1.0.0-rc.4
220
+
221
+ ## 1.0.0-rc.3
222
+
223
+ ### Patch Changes
224
+
225
+ - feat: initial
226
+ - Updated dependencies [undefined]
227
+ - @modern-js/core@1.0.0-rc.3
228
+ - @modern-js/plugin@1.0.0-rc.3
229
+ - @modern-js/utils@1.0.0-rc.3
package/README.md CHANGED
@@ -1,32 +1,24 @@
1
1
 
2
2
  <p align="center">
3
- <a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs.png" width="300" alt="Modern.js Logo" /></a>
3
+ <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>
4
+ </p>
5
+
6
+ <p align="center">
7
+ 现代 Web 工程体系
8
+ <br/>
9
+ <a href="https://modernjs.dev" target="blank">
10
+ modernjs.dev
11
+ </a>
4
12
  </p>
5
13
 
6
- <p align="center">现代 Web 工程体系</p>
7
14
 
8
- ## 背景
15
+ ## 参考链接
9
16
  - [迈入现代 Web 开发](https://zhuanlan.zhihu.com/p/386607009)
10
17
  - [现代 Web 开发者问卷调查报告](https://zhuanlan.zhihu.com/p/403206195)
18
+ - [字节跳动是如何落地微前端的](https://mp.weixin.qq.com/s/L9wbfNG5fTXF5bx7dcgj4Q)
11
19
 
12
- ## 计划
13
-
14
- Modern.js 的 1.0.0.rc 版已经发到 npm,目前在做测试改进,README 文档之后统一提供(现阶段加入测试和开发,可以发 [issue](https://github.com/modern-js-dev/modern.js/issues) 留微信联系),完整的文档站计划在10月14日上线
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
20
+ ## 近期计划
31
21
 
22
+ Modern.js 的 1.0.0.rc 版已经发到 npm,目前在做测试改进和文档建设。
32
23
 
24
+ README、完整的文档站、介绍等,都计划在 10 月 27 日上线。
@@ -10,14 +10,10 @@ export default createPlugin(() => ({
10
10
  async afterDev() {
11
11
  /* eslint-disable react-hooks/rules-of-hooks */
12
12
  const {
13
- value: {
14
- dev
15
- }
13
+ dev
16
14
  } = useResolvedConfigContext();
17
15
  const {
18
- value: {
19
- internalDirectory
20
- }
16
+ internalDirectory
21
17
  } = useAppContext();
22
18
  /* eslint-enable react-hooks/rules-of-hooks */
23
19
 
@@ -1,5 +1,4 @@
1
- import path from 'path';
2
- import { logger, fs } from '@modern-js/utils';
1
+ import { path, logger, fs } from '@modern-js/utils';
3
2
 
4
3
  const createWhistleProxyRule = (ruleDirectory, rules) => {
5
4
  const dest = path.resolve(ruleDirectory, 'proxy.rule.js');
@@ -1,7 +1,6 @@
1
- import path from 'path';
2
1
  import os from 'os';
3
2
  import http from 'http';
4
- import { fs, logger } from '@modern-js/utils';
3
+ import { path, fs, logger } from '@modern-js/utils';
5
4
  import execSync from "./execSync";
6
5
  const defaultCertDir = path.resolve(os.homedir(), './.whistle-proxy');
7
6
  export const defaultRootCA = path.resolve(defaultCertDir, './rootCA.crt');
@@ -1,5 +1,4 @@
1
- import path from 'path';
2
- import { logger } from '@modern-js/utils';
1
+ import { path, logger } from '@modern-js/utils';
3
2
  import execSync from "./execSync";
4
3
  import { isRootCAExists, generateRootCA, defaultRootCA, trustRootCA } from "./macCAManager";
5
4
 
@@ -23,14 +23,10 @@ var _default = (0, _core.createPlugin)(() => ({
23
23
  async afterDev() {
24
24
  /* eslint-disable react-hooks/rules-of-hooks */
25
25
  const {
26
- value: {
27
- dev
28
- }
26
+ dev
29
27
  } = (0, _core.useResolvedConfigContext)();
30
28
  const {
31
- value: {
32
- internalDirectory
33
- }
29
+ internalDirectory
34
30
  } = (0, _core.useAppContext)();
35
31
  /* eslint-enable react-hooks/rules-of-hooks */
36
32
 
@@ -5,14 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createProxyRule = 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 createWhistleProxyRule = (ruleDirectory, rules) => {
15
- const dest = _path.default.resolve(ruleDirectory, 'proxy.rule.js');
11
+ const dest = _utils.path.resolve(ruleDirectory, 'proxy.rule.js');
16
12
 
17
13
  let code = `/.*/ enable://intercept\n`;
18
14
 
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.generateRootCA = exports.isRootCAExists = exports.trustRootCA = exports.defaultRootCA = void 0;
7
-
8
- var _path = _interopRequireDefault(require("path"));
6
+ exports.trustRootCA = exports.isRootCAExists = exports.generateRootCA = exports.defaultRootCA = void 0;
9
7
 
10
8
  var _os = _interopRequireDefault(require("os"));
11
9
 
@@ -17,9 +15,9 @@ var _execSync = _interopRequireDefault(require("./execSync"));
17
15
 
18
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
17
 
20
- const defaultCertDir = _path.default.resolve(_os.default.homedir(), './.whistle-proxy');
18
+ const defaultCertDir = _utils.path.resolve(_os.default.homedir(), './.whistle-proxy');
21
19
 
22
- const defaultRootCA = _path.default.resolve(defaultCertDir, './rootCA.crt');
20
+ const defaultRootCA = _utils.path.resolve(defaultCertDir, './rootCA.crt');
23
21
 
24
22
  exports.defaultRootCA = defaultRootCA;
25
23
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.disableGlobalProxy = exports.enableGlobalProxy = void 0;
6
+ exports.enableGlobalProxy = exports.disableGlobalProxy = void 0;
7
7
 
8
8
  var _execSync = _interopRequireDefault(require("./execSync"));
9
9
 
@@ -5,8 +5,6 @@ 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
  var _execSync = _interopRequireDefault(require("./execSync"));
@@ -30,8 +28,8 @@ class WhistleProxy {
30
28
  this.port = config.port; // unused
31
29
  // this.mode = config.mode; // pureProxy|debug|multiEnv
32
30
 
33
- this.bin = _path.default.resolve(_path.default.dirname(require.resolve('whistle')), 'bin/whistle.js');
34
- this.certDir = _path.default.dirname(_macCAManager.defaultRootCA);
31
+ this.bin = _utils.path.resolve(_utils.path.dirname(require.resolve('whistle')), 'bin/whistle.js');
32
+ this.certDir = _utils.path.dirname(_macCAManager.defaultRootCA);
35
33
  }
36
34
 
37
35
  async installRootCA() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/plugin-proxy",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.0.0-rc.20",
4
4
  "jsnext:source": "./src/index.ts",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "main": "./dist/js/node/index.js",
@@ -21,17 +21,19 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@babel/runtime": "^7",
24
- "@modern-js/core": "^1.0.0-rc.2",
25
- "@modern-js/plugin": "^1.0.0-rc.2",
26
- "@modern-js/utils": "^1.0.0-rc.2",
24
+ "@modern-js/utils": "^1.0.0-rc.20",
27
25
  "whistle": "^2.7.18"
28
26
  },
29
27
  "devDependencies": {
30
28
  "@types/jest": "^26",
31
29
  "@types/node": "^14",
32
30
  "typescript": "^4",
33
- "@modern-js/plugin-testing": "^1.0.0-rc.2",
34
- "@modern-js/module-tools": "^1.0.0-rc.2"
31
+ "@modern-js/core": "^1.0.0-rc.20",
32
+ "@modern-js/plugin-testing": "^1.0.0-rc.20",
33
+ "@modern-js/module-tools": "^1.0.0-rc.20"
34
+ },
35
+ "peerDependencies": {
36
+ "@modern-js/core": "^1.0.0-rc.20"
35
37
  },
36
38
  "sideEffects": false,
37
39
  "modernConfig": {
@@ -39,6 +41,10 @@
39
41
  "packageMode": "node-js"
40
42
  }
41
43
  },
44
+ "publishConfig": {
45
+ "registry": "https://registry.npmjs.org/",
46
+ "access": "public"
47
+ },
42
48
  "scripts": {
43
49
  "new": "modern new",
44
50
  "build": "modern build",
package/src/index.ts CHANGED
@@ -14,12 +14,8 @@ export default createPlugin(
14
14
  },
15
15
  async afterDev() {
16
16
  /* eslint-disable react-hooks/rules-of-hooks */
17
- const {
18
- value: { dev },
19
- } = useResolvedConfigContext();
20
- const {
21
- value: { internalDirectory },
22
- } = useAppContext();
17
+ const { dev } = useResolvedConfigContext();
18
+ const { internalDirectory } = useAppContext();
23
19
  /* eslint-enable react-hooks/rules-of-hooks */
24
20
 
25
21
  if (!(dev as any).proxy) {
@@ -1,5 +1,4 @@
1
- import path from 'path';
2
- import { logger, fs } from '@modern-js/utils';
1
+ import { path, logger, fs } from '@modern-js/utils';
3
2
  import type { ProxyOptions } from '..';
4
3
 
5
4
  interface ProxyRule {
@@ -1,7 +1,6 @@
1
- import path from 'path';
2
1
  import os from 'os';
3
2
  import http from 'http';
4
- import { fs, logger } from '@modern-js/utils';
3
+ import { path, fs, logger } from '@modern-js/utils';
5
4
  import execSync from './execSync';
6
5
 
7
6
  const defaultCertDir = path.resolve(os.homedir(), './.whistle-proxy');
@@ -1,5 +1,4 @@
1
- import path from 'path';
2
- import { logger } from '@modern-js/utils';
1
+ import { path, logger } from '@modern-js/utils';
3
2
  import execSync from './execSync';
4
3
  import {
5
4
  isRootCAExists,