@modern-js/plugin-express 1.5.3 → 1.5.5-canary.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,5 +1,20 @@
1
1
  # @modern-js/plugin-express
2
2
 
3
+ ## 1.5.4
4
+
5
+ ### Patch Changes
6
+
7
+ - d32f35134: chore: add modern/jest/eslint/ts config files to .npmignore
8
+ - Updated dependencies [d32f35134]
9
+ - Updated dependencies [6ae4a34ae]
10
+ - Updated dependencies [b80229c79]
11
+ - Updated dependencies [948cc4436]
12
+ - @modern-js/adapter-helpers@1.2.4
13
+ - @modern-js/bff-runtime@1.2.3
14
+ - @modern-js/bff-utils@1.2.6
15
+ - @modern-js/types@1.5.3
16
+ - @modern-js/utils@1.7.3
17
+
3
18
  ## 1.5.3
4
19
 
5
20
  ### Patch Changes
@@ -11,7 +11,6 @@ export default (() => ({
11
11
  const runtimeModulePath = path.resolve(__dirname, '../runtime');
12
12
  return {
13
13
  config() {
14
- // eslint-disable-next-line react-hooks/rules-of-hooks
15
14
  const appContext = useAppContext();
16
15
  const {
17
16
  appDirectory
@@ -19,17 +18,27 @@ export default (() => ({
19
18
  bffExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, 'server');
20
19
  const serverRuntimePath = bffExportsUtils.getPath();
21
20
  const relativeRuntimePath = getRelativeRuntimePath(appDirectory, serverRuntimePath);
22
- return {
23
- source: {
24
- alias: {
25
- '@modern-js/runtime/server': relativeRuntimePath
21
+
22
+ if (process.env.NODE_ENV === 'production') {
23
+ return {
24
+ source: {
25
+ alias: {
26
+ '@modern-js/runtime/server': relativeRuntimePath
27
+ }
28
+ }
29
+ };
30
+ } else {
31
+ return {
32
+ source: {
33
+ alias: {
34
+ '@modern-js/runtime/server': serverRuntimePath
35
+ }
26
36
  }
27
- }
28
- };
37
+ };
38
+ }
29
39
  },
30
40
 
31
41
  addRuntimeExports(input) {
32
- // eslint-disable-next-line react-hooks/rules-of-hooks
33
42
  const {
34
43
  appDirectory
35
44
  } = useAppContext();
@@ -13,7 +13,6 @@ import { createDebugger } from '@modern-js/utils';
13
13
  const debug = createDebugger('express');
14
14
 
15
15
  const registerRoutes = app => {
16
- // eslint-disable-next-line react-hooks/rules-of-hooks
17
16
  const handlerInfos = useAPIHandlerInfos();
18
17
  sortDynamicRoutes(handlerInfos);
19
18
  debug('handlerInfos', handlerInfos);
@@ -53,7 +52,6 @@ const registerRoutes = app => {
53
52
  return await Promise.resolve();
54
53
  }
55
54
 
56
- res.status(200);
57
55
  return res.json(body);
58
56
  } catch (e) {
59
57
  return next(e);
@@ -25,7 +25,6 @@ var _default = () => ({
25
25
  const runtimeModulePath = path.resolve(__dirname, '../runtime');
26
26
  return {
27
27
  config() {
28
- // eslint-disable-next-line react-hooks/rules-of-hooks
29
28
  const appContext = useAppContext();
30
29
  const {
31
30
  appDirectory
@@ -33,17 +32,27 @@ var _default = () => ({
33
32
  bffExportsUtils = (0, _utils.createRuntimeExportsUtils)(appContext.internalDirectory, 'server');
34
33
  const serverRuntimePath = bffExportsUtils.getPath();
35
34
  const relativeRuntimePath = (0, _adapterHelpers.getRelativeRuntimePath)(appDirectory, serverRuntimePath);
36
- return {
37
- source: {
38
- alias: {
39
- '@modern-js/runtime/server': relativeRuntimePath
35
+
36
+ if (process.env.NODE_ENV === 'production') {
37
+ return {
38
+ source: {
39
+ alias: {
40
+ '@modern-js/runtime/server': relativeRuntimePath
41
+ }
42
+ }
43
+ };
44
+ } else {
45
+ return {
46
+ source: {
47
+ alias: {
48
+ '@modern-js/runtime/server': serverRuntimePath
49
+ }
40
50
  }
41
- }
42
- };
51
+ };
52
+ }
43
53
  },
44
54
 
45
55
  addRuntimeExports(input) {
46
- // eslint-disable-next-line react-hooks/rules-of-hooks
47
56
  const {
48
57
  appDirectory
49
58
  } = useAppContext();
@@ -28,7 +28,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
28
28
  const debug = (0, _utils.createDebugger)('express');
29
29
 
30
30
  const registerRoutes = app => {
31
- // eslint-disable-next-line react-hooks/rules-of-hooks
32
31
  const handlerInfos = (0, _bffUtils.useAPIHandlerInfos)();
33
32
  (0, _adapterHelpers.sortDynamicRoutes)(handlerInfos);
34
33
  debug('handlerInfos', handlerInfos);
@@ -68,7 +67,6 @@ const registerRoutes = app => {
68
67
  return await Promise.resolve();
69
68
  }
70
69
 
71
- res.status(200);
72
70
  return res.json(body);
73
71
  } catch (e) {
74
72
  return next(e);
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.5.3",
14
+ "version": "1.5.5-canary.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -34,27 +34,27 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@babel/runtime": "^7.15.3",
37
- "@modern-js/adapter-helpers": "^1.2.3",
38
- "@modern-js/bff-runtime": "^1.2.2",
39
- "@modern-js/bff-utils": "^1.2.5",
40
- "@modern-js/types": "^1.5.2",
41
- "@modern-js/utils": "^1.7.2",
37
+ "@modern-js/adapter-helpers": "^1.2.4",
38
+ "@modern-js/bff-runtime": "^1.2.3",
39
+ "@modern-js/bff-utils": "^1.2.6",
40
+ "@modern-js/types": "^1.5.3",
41
+ "@modern-js/utils": "^1.7.5",
42
42
  "cookie-parser": "^1.4.5",
43
43
  "finalhandler": "^1.1.2",
44
44
  "formidable": "^1.2.2",
45
45
  "type-is": "^1.6.18"
46
46
  },
47
47
  "devDependencies": {
48
- "@modern-js/core": "1.10.1",
49
- "@modern-js/server-core": "1.3.4",
50
- "@modern-js/server-utils": "1.2.5",
48
+ "@modern-js/core": "1.11.0",
49
+ "@modern-js/server-core": "1.3.5",
50
+ "@modern-js/server-utils": "1.2.9",
51
51
  "@scripts/build": "0.0.0",
52
52
  "@scripts/jest-config": "0.0.0",
53
53
  "@types/cookie-parser": "^1.4.2",
54
54
  "@types/express": "^4.17.13",
55
55
  "@types/finalhandler": "^1.1.1",
56
56
  "@types/formidable": "^1.2.3",
57
- "@types/jest": "^27.0.1",
57
+ "@types/jest": "^27",
58
58
  "@types/node": "^14",
59
59
  "@types/supertest": "^2.0.11",
60
60
  "@types/type-is": "^1.6.3",
@@ -73,12 +73,36 @@
73
73
  },
74
74
  "publishConfig": {
75
75
  "registry": "https://registry.npmjs.org/",
76
- "access": "public"
76
+ "access": "public",
77
+ "types": "./dist/types/index.d.ts"
78
+ },
79
+ "wireit": {
80
+ "build": {
81
+ "command": "modern build",
82
+ "files": [
83
+ "src/**/*",
84
+ "tsconfig.json",
85
+ "package.json"
86
+ ],
87
+ "output": [
88
+ "dist/**/*"
89
+ ]
90
+ },
91
+ "test": {
92
+ "command": "jest --passWithNoTests",
93
+ "files": [
94
+ "src/**/*",
95
+ "tsconfig.json",
96
+ "package.json",
97
+ "tests/**/*"
98
+ ],
99
+ "output": []
100
+ }
77
101
  },
78
102
  "scripts": {
79
103
  "new": "modern new",
80
- "build": "modern build",
81
- "test": "jest --passWithNoTests"
104
+ "build": "wireit",
105
+ "test": "wireit"
82
106
  },
83
107
  "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"
84
108
  }
package/.eslintrc.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- extends: ['@modern-js'],
3
- parserOptions: {
4
- project: require.resolve('./tsconfig.json'),
5
- },
6
- ignorePatterns: ['types.d.ts'],
7
- };
package/jest.config.js DELETED
@@ -1,7 +0,0 @@
1
- const sharedConfig = require('@scripts/jest-config');
2
-
3
- /** @type {import('@jest/types').Config.InitialOptions} */
4
- module.exports = {
5
- ...sharedConfig,
6
- rootDir: __dirname,
7
- };
package/modern.config.js DELETED
@@ -1,2 +0,0 @@
1
- /** @type {import('@modern-js/module-tools').UserConfig} */
2
- module.exports = {};
package/tsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "@modern-js/tsconfig/base",
3
- "compilerOptions": {
4
- "declaration": false,
5
- "jsx": "preserve",
6
- "baseUrl": "./",
7
- "isolatedModules": true
8
- },
9
- "include": ["src"]
10
- }