@modern-js/plugin-koa 1.1.4-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,6 +1,31 @@
1
1
  # @modern-js/plugin-koa
2
2
 
3
- ## 1.1.4-rc.0
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - ad107726: feat: new action support apppend type define
8
+
9
+ ## 1.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 5a4c557e: feat: support bff test
14
+
15
+ ### Patch Changes
16
+
17
+ - a70a62f5: fix: runtime path is broken in development environment
18
+ - Updated dependencies [90eeb72c]
19
+ - Updated dependencies [e04914ce]
20
+ - Updated dependencies [5a4c557e]
21
+ - Updated dependencies [e04914ce]
22
+ - Updated dependencies [ca7dcb32]
23
+ - Updated dependencies [ecb344dc]
24
+ - @modern-js/core@1.2.0
25
+ - @modern-js/server-plugin@1.1.3
26
+ - @modern-js/utils@1.1.5
27
+
28
+ ## 1.1.4
4
29
 
5
30
  ### Patch Changes
6
31
 
@@ -12,12 +37,8 @@
12
37
  - Updated dependencies [d73ff455]
13
38
  - Updated dependencies [d73ff455]
14
39
  - Updated dependencies [d73ff455]
15
- - @modern-js/utils@1.1.4-rc.0
16
- - @modern-js/core@1.1.4-rc.0
17
- - @modern-js/bff-utils@1.1.2-rc.0
18
- - @modern-js/server-plugin@1.1.2
19
- - @modern-js/adapter-helpers@1.1.1
20
- - @modern-js/bff-runtime@1.1.2-rc.0
40
+ - @modern-js/utils@1.1.4
41
+ - @modern-js/core@1.1.4
21
42
 
22
43
  ## 1.1.2
23
44
 
@@ -16,7 +16,7 @@ export default createPlugin(() => {
16
16
 
17
17
  let relativeRuntimePath = path.join('../', path.relative(appDirectory, serverRuntimePath));
18
18
 
19
- if (process.env.NODE_ENV === 'development') {
19
+ if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
20
20
  relativeRuntimePath = `./${path.relative(appDirectory, serverRuntimePath)}`;
21
21
  }
22
22
 
@@ -30,7 +30,7 @@ var _default = (0, _core.createPlugin)(() => {
30
30
 
31
31
  let relativeRuntimePath = path.join('../', path.relative(appDirectory, serverRuntimePath));
32
32
 
33
- if (process.env.NODE_ENV === 'development') {
33
+ if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
34
34
  relativeRuntimePath = `./${path.relative(appDirectory, serverRuntimePath)}`;
35
35
  }
36
36
 
package/package.json CHANGED
@@ -11,26 +11,31 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.1.4-rc.0",
14
+ "version": "1.2.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
18
18
  "module": "./dist/js/treeshaking/index.js",
19
19
  "jsnext:modern": "./dist/js/modern/index.js",
20
20
  "exports": {
21
+ "./types": "./types.d.ts",
21
22
  ".": {
22
23
  "node": {
24
+ "jsnext:source": "./src/index.ts",
23
25
  "import": "./dist/js/modern/index.js",
24
26
  "require": "./dist/js/node/index.js"
25
27
  },
26
28
  "default": "./dist/js/treeshaking/index.js"
27
29
  },
28
- "./cli": "./dist/js/node/cli/index.js"
30
+ "./cli": {
31
+ "jsnext:source": "./src/cli/index.ts",
32
+ "default": "./dist/js/node/cli/index.js"
33
+ }
29
34
  },
30
35
  "dependencies": {
31
36
  "@babel/runtime": "^7.15.3",
32
37
  "@modern-js/adapter-helpers": "^1.1.1",
33
- "@modern-js/utils": "^1.1.4-rc.0",
38
+ "@modern-js/utils": "^1.1.5",
34
39
  "formidable": "^1.2.2",
35
40
  "koa-body": "^4.2.0",
36
41
  "koa-router": "^10.0.0",
@@ -47,12 +52,12 @@
47
52
  "@types/type-is": "^1.6.3",
48
53
  "supertest": "^6.1.6",
49
54
  "typescript": "^4",
50
- "@modern-js/bff-runtime": "^1.1.2-rc.0",
51
- "@modern-js/bff-utils": "^1.1.2-rc.0",
52
- "@modern-js/core": "^1.1.4-rc.0",
53
- "@modern-js/server-plugin": "^1.1.2",
54
- "@modern-js/plugin-testing": "^1.1.1",
55
- "@modern-js/module-tools": "^1.1.1"
55
+ "@modern-js/bff-runtime": "^1.1.1",
56
+ "@modern-js/bff-utils": "^1.1.1",
57
+ "@modern-js/core": "^1.2.0",
58
+ "@modern-js/server-plugin": "^1.1.3",
59
+ "@modern-js/plugin-testing": "^1.2.2",
60
+ "@modern-js/module-tools": "^1.1.5"
56
61
  },
57
62
  "modernConfig": {
58
63
  "output": {
@@ -60,10 +65,10 @@
60
65
  }
61
66
  },
62
67
  "peerDependencies": {
63
- "@modern-js/bff-utils": "^1.1.2-rc.0",
64
- "@modern-js/core": "^1.1.4-rc.0",
65
- "@modern-js/server-plugin": "^1.1.2",
66
- "@modern-js/bff-runtime": "^1.1.2-rc.0",
68
+ "@modern-js/bff-utils": "^1.1.1",
69
+ "@modern-js/core": "^1.2.0",
70
+ "@modern-js/server-plugin": "^1.1.3",
71
+ "@modern-js/bff-runtime": "^1.1.1",
67
72
  "koa": "^2.13.3"
68
73
  },
69
74
  "publishConfig": {
@@ -73,7 +78,7 @@
73
78
  "scripts": {
74
79
  "new": "modern new",
75
80
  "build": "modern build",
76
- "test": "modern test"
81
+ "test": "modern test --passWithNoTests"
77
82
  },
78
83
  "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"
79
84
  }
package/src/cli/index.ts CHANGED
@@ -25,7 +25,10 @@ export default createPlugin(
25
25
  path.relative(appDirectory, serverRuntimePath),
26
26
  );
27
27
 
28
- if (process.env.NODE_ENV === 'development') {
28
+ if (
29
+ process.env.NODE_ENV === 'development' ||
30
+ process.env.NODE_ENV === 'test'
31
+ ) {
29
32
  relativeRuntimePath = `./${path.relative(
30
33
  appDirectory,
31
34
  serverRuntimePath,
@@ -1,5 +1,5 @@
1
1
  import { match } from '@modern-js/bff-runtime';
2
- import { useContext } from '@/context';
2
+ import { useContext } from '../../../../../src/context';
3
3
 
4
4
  export const get = ({ query }: { query: Record<string, unknown> }) => ({
5
5
  query,
@@ -1,5 +1,5 @@
1
1
  import { match } from '@modern-js/bff-runtime';
2
- import { useContext } from '@/context';
2
+ import { useContext } from '../../../../../../src/context';
3
3
 
4
4
  export const get = ({ query }: { query: Record<string, unknown> }) => ({
5
5
  query,
@@ -1,6 +1,6 @@
1
1
  import * as path from 'path';
2
2
  import request from 'supertest';
3
- import Koa, { Context, Next } from 'koa';
3
+ import Koa from 'koa';
4
4
  import { serverManager } from '@modern-js/server-plugin';
5
5
  import Router from 'koa-router';
6
6
  import koaBody from 'koa-body';
@@ -111,11 +111,11 @@ describe('add middlewares', () => {
111
111
 
112
112
  test('should works', async () => {
113
113
  const foo = 'foo';
114
- const fakeMiddleware = jest.fn(async (ctx: Context, next: Next) => {
114
+ const fakeMiddleware = jest.fn(async (ctx: any, next: any) => {
115
115
  await next();
116
116
  ctx.body = foo;
117
117
  });
118
- const fakeMiddleware2 = jest.fn(async (ctx: Context, next: Next) => {
118
+ const fakeMiddleware2 = jest.fn(async (ctx: any, next: any) => {
119
119
  await next();
120
120
  });
121
121
 
@@ -7,8 +7,6 @@
7
7
  "isolatedModules": true,
8
8
  "sourceMap": true
9
9
  },
10
- "paths": {
11
- "@/*": ["../src/*"]
12
- },
10
+ "paths": {},
13
11
  "exclude": ["src/__test__/fixtures/**"]
14
12
  }