@modern-js/bff-core 2.7.1-alpha.1 → 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.
@@ -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);
@@ -55,4 +55,4 @@ export type ExtractInputType<T> = { [key in keyof T]: T[key] extends Operator<an
55
55
  export type ExtractOuputType<T> = { [key in keyof T]: T[key] extends Operator<any, any> ? NonNullable<T[key]['outputType']> : void };
56
56
  export type ArrayToObject<T, R = {}> = T extends [infer First, ...infer Rest] ? First extends PromiseLike<infer PromiseValue> ? PromiseValue : First extends object ? Merge<First, ArrayToObject<Rest, R>> : ArrayToObject<Rest, R> : R;
57
57
  export type AsyncFunction = (...args: any[]) => Promise<any>;
58
- export declare const httpMethods: HttpMethod[];
58
+ export declare const httpMethods: HttpMethod[];
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.7.1-alpha.1",
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",