@modern-js/bff-core 2.7.1-alpha.0 → 2.7.1-alpha.2

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/README.md CHANGED
@@ -19,8 +19,8 @@ Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-sta
19
19
 
20
20
  ## Contributing
21
21
 
22
- Please read the [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md).
22
+ Please read the [Contributing Guide](https://github.com/web-infra-dev/modern.js/blob/main/CONTRIBUTING.md).
23
23
 
24
24
  ## License
25
25
 
26
- Modern.js is [MIT licensed](https://github.com/modern-js-dev/modern.js/blob/main/LICENSE).
26
+ Modern.js is [MIT licensed](https://github.com/web-infra-dev/modern.js/blob/main/LICENSE).
@@ -76,14 +76,23 @@ const enableRegister = (requireFn) => {
76
76
  firstCall = false;
77
77
  }
78
78
  if (!existTsLoader) {
79
- const {
80
- register
81
- } = require("esbuild-register/dist/node");
82
- const { unregister } = register({
83
- extensions: [".ts"]
79
+ const projectSearchDir = import_path.default.dirname(modulePath);
80
+ const tsNode = require("ts-node");
81
+ tsNode.register({
82
+ projectSearchDir,
83
+ scope: true,
84
+ transpileOnly: true,
85
+ ignore: ["(?:^|/)node_modules/"]
84
86
  });
87
+ const tsConfigPaths = require("tsconfig-paths");
88
+ const loaderRes = tsConfigPaths.loadConfig(projectSearchDir);
89
+ if (loaderRes.resultType === "success") {
90
+ tsConfigPaths.register({
91
+ baseUrl: loaderRes.absoluteBaseUrl,
92
+ paths: loaderRes.paths
93
+ });
94
+ }
85
95
  const requiredModule2 = requireFn(modulePath);
86
- unregister();
87
96
  return requiredModule2;
88
97
  }
89
98
  const requiredModule = requireFn(modulePath);
@@ -40,14 +40,23 @@ const enableRegister = (requireFn) => {
40
40
  firstCall = false;
41
41
  }
42
42
  if (!existTsLoader) {
43
- const {
44
- register
45
- } = require("esbuild-register/dist/node");
46
- const { unregister } = register({
47
- extensions: [".ts"]
43
+ const projectSearchDir = path.dirname(modulePath);
44
+ const tsNode = require("ts-node");
45
+ tsNode.register({
46
+ projectSearchDir,
47
+ scope: true,
48
+ transpileOnly: true,
49
+ ignore: ["(?:^|/)node_modules/"]
48
50
  });
51
+ const tsConfigPaths = require("tsconfig-paths");
52
+ const loaderRes = tsConfigPaths.loadConfig(projectSearchDir);
53
+ if (loaderRes.resultType === "success") {
54
+ tsConfigPaths.register({
55
+ baseUrl: loaderRes.absoluteBaseUrl,
56
+ paths: loaderRes.paths
57
+ });
58
+ }
49
59
  const requiredModule2 = requireFn(modulePath);
50
- unregister();
51
60
  return requiredModule2;
52
61
  }
53
62
  const requiredModule = requireFn(modulePath);
package/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "name": "@modern-js/bff-core",
3
3
  "description": "A Progressive React Framework for modern web development.",
4
4
  "homepage": "https://modernjs.dev",
5
- "bugs": "https://github.com/modern-js-dev/modern.js/issues",
6
- "repository": "modern-js-dev/modern.js",
5
+ "bugs": "https://github.com/web-infra-dev/modern.js/issues",
6
+ "repository": "web-infra-dev/modern.js",
7
7
  "license": "MIT",
8
8
  "keywords": [
9
9
  "react",
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.7.1-alpha.0",
14
+ "version": "2.7.1-alpha.2",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/cjs/index.js",
@@ -27,8 +27,6 @@
27
27
  "@babel/runtime": "^7.18.0",
28
28
  "@modern-js/bff-runtime": "2.7.0",
29
29
  "@modern-js/utils": "2.7.0",
30
- "esbuild": "0.15.7",
31
- "esbuild-register": "^3.3.3",
32
30
  "koa-compose": "^4.1.0",
33
31
  "reflect-metadata": "^0.1.13"
34
32
  },
@@ -40,12 +38,16 @@
40
38
  "@types/koa-compose": "^3.2.5",
41
39
  "@types/node": "^14",
42
40
  "jest": "^27",
41
+ "ts-node": "^10.9.1",
42
+ "tsconfig-paths": "^4.1.2",
43
43
  "type-fest": "2.15.0",
44
44
  "typescript": "^4",
45
45
  "zod": "^3.17.3"
46
46
  },
47
47
  "peerDependencies": {
48
- "zod": "^3.17.3"
48
+ "zod": "^3.17.3",
49
+ "ts-node": "^10.9.1",
50
+ "tsconfig-paths": "^4.1.2"
49
51
  },
50
52
  "peerDependenciesMeta": {
51
53
  "zod": {