@modern-js/plugin-proxy 2.27.0 → 2.28.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,12 @@
1
1
  # @modern-js/plugin-proxy
2
2
 
3
+ ## 2.28.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [00b58a7]
8
+ - @modern-js/utils@2.28.0
9
+
3
10
  ## 2.27.0
4
11
 
5
12
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -24,41 +24,41 @@ const proxyPlugin = () => {
24
24
  let proxyServer;
25
25
  return {
26
26
  name: "@modern-js/plugin-proxy",
27
- setup: (api) => {
28
- return {
29
- validateSchema() {
30
- return [
31
- {
32
- target: "dev.proxy",
33
- schema: {
34
- typeof: [
35
- "string",
36
- "object"
37
- ]
38
- }
27
+ setup: (api) => ({
28
+ validateSchema() {
29
+ return [
30
+ {
31
+ target: "dev.proxy",
32
+ schema: {
33
+ typeof: [
34
+ "string",
35
+ "object"
36
+ ]
39
37
  }
40
- ];
41
- },
42
- async afterDev() {
43
- const { dev } = api.useResolvedConfigContext();
44
- const { internalDirectory } = api.useAppContext();
45
- if (!(dev === null || dev === void 0 ? void 0 : dev.proxy)) {
46
- return;
47
38
  }
48
- const rule = (0, _createProxyRule.createProxyRule)(internalDirectory, dev.proxy);
49
- if (!proxyServer) {
50
- proxyServer = new _whistleProxy.default({
51
- port: 8899,
52
- rule
53
- });
54
- await proxyServer.start();
55
- }
56
- },
57
- beforeExit() {
58
- proxyServer === null || proxyServer === void 0 ? void 0 : proxyServer.close();
39
+ ];
40
+ },
41
+ async afterDev() {
42
+ var _dev;
43
+ const { dev } = api.useResolvedConfigContext();
44
+ const { internalDirectory } = api.useAppContext();
45
+ if (!((_dev = dev) === null || _dev === void 0 ? void 0 : _dev.proxy)) {
46
+ return;
47
+ }
48
+ const rule = (0, _createProxyRule.createProxyRule)(internalDirectory, dev.proxy);
49
+ if (!proxyServer) {
50
+ proxyServer = new _whistleProxy.default({
51
+ port: 8899,
52
+ rule
53
+ });
54
+ await proxyServer.start();
59
55
  }
60
- };
61
- }
56
+ },
57
+ beforeExit() {
58
+ var _proxyServer;
59
+ (_proxyServer = proxyServer) === null || _proxyServer === void 0 ? void 0 : _proxyServer.close();
60
+ }
61
+ })
62
62
  };
63
63
  };
64
64
  const _default = proxyPlugin;
package/dist/esm/index.js CHANGED
@@ -4,41 +4,41 @@ export const proxyPlugin = () => {
4
4
  let proxyServer;
5
5
  return {
6
6
  name: "@modern-js/plugin-proxy",
7
- setup: (api) => {
8
- return {
9
- validateSchema() {
10
- return [
11
- {
12
- target: "dev.proxy",
13
- schema: {
14
- typeof: [
15
- "string",
16
- "object"
17
- ]
18
- }
7
+ setup: (api) => ({
8
+ validateSchema() {
9
+ return [
10
+ {
11
+ target: "dev.proxy",
12
+ schema: {
13
+ typeof: [
14
+ "string",
15
+ "object"
16
+ ]
19
17
  }
20
- ];
21
- },
22
- async afterDev() {
23
- const { dev } = api.useResolvedConfigContext();
24
- const { internalDirectory } = api.useAppContext();
25
- if (!(dev === null || dev === void 0 ? void 0 : dev.proxy)) {
26
- return;
27
18
  }
28
- const rule = createProxyRule(internalDirectory, dev.proxy);
29
- if (!proxyServer) {
30
- proxyServer = new WhistleProxy({
31
- port: 8899,
32
- rule
33
- });
34
- await proxyServer.start();
35
- }
36
- },
37
- beforeExit() {
38
- proxyServer === null || proxyServer === void 0 ? void 0 : proxyServer.close();
19
+ ];
20
+ },
21
+ async afterDev() {
22
+ var _dev;
23
+ const { dev } = api.useResolvedConfigContext();
24
+ const { internalDirectory } = api.useAppContext();
25
+ if (!((_dev = dev) === null || _dev === void 0 ? void 0 : _dev.proxy)) {
26
+ return;
27
+ }
28
+ const rule = createProxyRule(internalDirectory, dev.proxy);
29
+ if (!proxyServer) {
30
+ proxyServer = new WhistleProxy({
31
+ port: 8899,
32
+ rule
33
+ });
34
+ await proxyServer.start();
39
35
  }
40
- };
41
- }
36
+ },
37
+ beforeExit() {
38
+ var _proxyServer;
39
+ (_proxyServer = proxyServer) === null || _proxyServer === void 0 ? void 0 : _proxyServer.close();
40
+ }
41
+ })
42
42
  };
43
43
  };
44
44
  export default proxyPlugin;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.27.0",
18
+ "version": "2.28.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -36,16 +36,16 @@
36
36
  "dependencies": {
37
37
  "whistle": "^2.7.18",
38
38
  "@swc/helpers": "0.5.1",
39
- "@modern-js/utils": "2.27.0"
39
+ "@modern-js/utils": "2.28.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/jest": "^29",
43
43
  "@types/node": "^14",
44
44
  "typescript": "^5",
45
45
  "jest": "^29",
46
- "@scripts/build": "2.27.0",
47
- "@scripts/jest-config": "2.27.0",
48
- "@modern-js/core": "2.27.0"
46
+ "@scripts/build": "2.28.0",
47
+ "@modern-js/core": "2.28.0",
48
+ "@scripts/jest-config": "2.28.0"
49
49
  },
50
50
  "sideEffects": false,
51
51
  "publishConfig": {