@modern-js/plugin-koa 1.4.7 → 1.4.8-canary.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.
Files changed (72) hide show
  1. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/.wireit/6275696c64/stdout +9 -0
  2. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/modern/cli/index.js +60 -0
  3. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/modern/context.js +6 -0
  4. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/modern/index.js +3 -0
  5. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/modern/plugin.js +129 -0
  6. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/modern/registerRoutes.js +82 -0
  7. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/modern/runtime.js +1 -0
  8. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/node/cli/index.js +76 -0
  9. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/node/context.js +15 -0
  10. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/node/index.js +28 -0
  11. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/node/plugin.js +151 -0
  12. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/node/registerRoutes.js +97 -0
  13. package/.wireit/6275696c64/cache/5a7fd1190b57f273bbfc05fc04fa99ef67c54e4eac07712cccd97346c9903534/dist/js/node/runtime.js +13 -0
  14. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/modern/cli/index.js +60 -0
  15. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/modern/context.js +6 -0
  16. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/modern/index.js +3 -0
  17. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/modern/plugin.js +129 -0
  18. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/modern/registerRoutes.js +82 -0
  19. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/modern/runtime.js +1 -0
  20. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/node/cli/index.js +76 -0
  21. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/node/context.js +15 -0
  22. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/node/index.js +28 -0
  23. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/node/plugin.js +151 -0
  24. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/node/registerRoutes.js +97 -0
  25. package/.wireit/6275696c64/cache/a48cd57db6d78fbc9aca74c669a12325d8d6adee3602be60b39b7f0aee775e0e/dist/js/node/runtime.js +13 -0
  26. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/modern/cli/index.js +60 -0
  27. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/modern/context.js +6 -0
  28. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/modern/index.js +3 -0
  29. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/modern/plugin.js +129 -0
  30. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/modern/registerRoutes.js +82 -0
  31. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/modern/runtime.js +1 -0
  32. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/node/cli/index.js +76 -0
  33. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/node/context.js +15 -0
  34. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/node/index.js +28 -0
  35. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/node/plugin.js +151 -0
  36. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/node/registerRoutes.js +97 -0
  37. package/.wireit/6275696c64/cache/c2bcc9f69d6e88cab5556c7e21d2d96caf864704311f42923d5aac9d76903c09/dist/js/node/runtime.js +13 -0
  38. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/.wireit/6275696c64/stdout +9 -0
  39. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/modern/cli/index.js +62 -0
  40. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/modern/context.js +6 -0
  41. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/modern/index.js +3 -0
  42. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/modern/plugin.js +129 -0
  43. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/modern/registerRoutes.js +82 -0
  44. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/modern/runtime.js +1 -0
  45. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/node/cli/index.js +78 -0
  46. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/node/context.js +15 -0
  47. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/node/index.js +28 -0
  48. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/node/plugin.js +151 -0
  49. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/node/registerRoutes.js +97 -0
  50. package/.wireit/6275696c64/cache/c702551e9ac5f99417b3d7904cde2a76ea272e9a04c27fe6afd33e73b7c25856/dist/js/node/runtime.js +13 -0
  51. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/modern/cli/index.js +60 -0
  52. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/modern/context.js +6 -0
  53. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/modern/index.js +3 -0
  54. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/modern/plugin.js +129 -0
  55. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/modern/registerRoutes.js +82 -0
  56. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/modern/runtime.js +1 -0
  57. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/node/cli/index.js +76 -0
  58. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/node/context.js +15 -0
  59. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/node/index.js +28 -0
  60. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/node/plugin.js +151 -0
  61. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/node/registerRoutes.js +97 -0
  62. package/.wireit/6275696c64/cache/fceab7422ff46c3bc400017a31f179fd20fb88539c1968876d37bec188823945/dist/js/node/runtime.js +13 -0
  63. package/.wireit/6275696c64/lock +0 -0
  64. package/.wireit/6275696c64/state +1 -0
  65. package/.wireit/6275696c64/stdout +9 -0
  66. package/dist/js/modern/cli/index.js +8 -6
  67. package/dist/js/node/cli/index.js +7 -5
  68. package/package.json +28 -4
  69. package/.eslintrc.js +0 -7
  70. package/jest.config.js +0 -7
  71. package/modern.config.js +0 -2
  72. package/tsconfig.json +0 -10
@@ -1,5 +1,5 @@
1
1
  import * as path from 'path';
2
- import { createRuntimeExportsUtils } from '@modern-js/utils';
2
+ import { createRuntimeExportsUtils, TEST_ENV } from '@modern-js/utils';
3
3
  import { getRelativeRuntimePath } from '@modern-js/adapter-helpers';
4
4
  export default (() => ({
5
5
  name: '@modern-js/plugin-koa',
@@ -11,25 +11,27 @@ 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
18
17
  } = appContext;
19
18
  bffExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, 'server');
20
- const serverRuntimePath = bffExportsUtils.getPath();
21
- const relativeRuntimePath = getRelativeRuntimePath(appDirectory, serverRuntimePath);
19
+ let serverRuntimePath = bffExportsUtils.getPath(); // Basedir is not a fixed path when the test is executed,so server runtime path must be absolute path.
20
+
21
+ if (process.env.NODE_ENV !== TEST_ENV) {
22
+ serverRuntimePath = getRelativeRuntimePath(appDirectory, serverRuntimePath);
23
+ }
24
+
22
25
  return {
23
26
  source: {
24
27
  alias: {
25
- '@modern-js/runtime/server': relativeRuntimePath
28
+ '@modern-js/runtime/server': serverRuntimePath
26
29
  }
27
30
  }
28
31
  };
29
32
  },
30
33
 
31
34
  addRuntimeExports(input) {
32
- // eslint-disable-next-line react-hooks/rules-of-hooks
33
35
  const {
34
36
  appDirectory
35
37
  } = useAppContext();
@@ -25,25 +25,27 @@ 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
32
31
  } = appContext;
33
32
  bffExportsUtils = (0, _utils.createRuntimeExportsUtils)(appContext.internalDirectory, 'server');
34
- const serverRuntimePath = bffExportsUtils.getPath();
35
- const relativeRuntimePath = (0, _adapterHelpers.getRelativeRuntimePath)(appDirectory, serverRuntimePath);
33
+ let serverRuntimePath = bffExportsUtils.getPath(); // Basedir is not a fixed path when the test is executed,so server runtime path must be absolute path.
34
+
35
+ if (process.env.NODE_ENV !== _utils.TEST_ENV) {
36
+ serverRuntimePath = (0, _adapterHelpers.getRelativeRuntimePath)(appDirectory, serverRuntimePath);
37
+ }
38
+
36
39
  return {
37
40
  source: {
38
41
  alias: {
39
- '@modern-js/runtime/server': relativeRuntimePath
42
+ '@modern-js/runtime/server': serverRuntimePath
40
43
  }
41
44
  }
42
45
  };
43
46
  },
44
47
 
45
48
  addRuntimeExports(input) {
46
- // eslint-disable-next-line react-hooks/rules-of-hooks
47
49
  const {
48
50
  appDirectory
49
51
  } = useAppContext();
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.4.7",
14
+ "version": "1.4.8-canary.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -68,12 +68,36 @@
68
68
  },
69
69
  "publishConfig": {
70
70
  "registry": "https://registry.npmjs.org/",
71
- "access": "public"
71
+ "access": "public",
72
+ "types": "./dist/types/index.d.ts"
73
+ },
74
+ "wireit": {
75
+ "build": {
76
+ "command": "modern build",
77
+ "files": [
78
+ "src/**/*.ts",
79
+ "tsconfig.json",
80
+ "package.json"
81
+ ],
82
+ "output": [
83
+ "dist/**/*.js"
84
+ ]
85
+ },
86
+ "test": {
87
+ "command": "jest --passWithNoTests",
88
+ "files": [
89
+ "src/**/*.ts",
90
+ "tsconfig.json",
91
+ "package.json"
92
+ ],
93
+ "output": []
94
+ }
72
95
  },
73
96
  "scripts": {
74
97
  "new": "modern new",
75
- "build": "modern build",
76
- "test": "jest --passWithNoTests"
98
+ "dev": "modern build --watch",
99
+ "build": "wireit",
100
+ "test": "wireit"
77
101
  },
78
102
  "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
103
  }
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
- }