@modern-js/bff-core 1.0.1-beta.3 → 1.0.1-beta.4
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/dist/js/modern/router/index.js +0 -1
- package/dist/js/modern/router/utils.js +9 -0
- package/dist/js/node/router/index.js +0 -2
- package/dist/js/node/router/utils.js +9 -0
- package/dist/types/router/index.d.ts +0 -1
- package/dist/types/router/utils.d.ts +3 -2
- package/package.json +1 -1
- package/CHANGELOG.md +0 -224
|
@@ -3,7 +3,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { fs, logger } from '@modern-js/utils';
|
|
5
5
|
import 'reflect-metadata';
|
|
6
|
-
import 'esbuild-register';
|
|
7
6
|
import { HttpMethod, httpMethods, OperatorType, TriggerType } from "../types";
|
|
8
7
|
import { debug } from "../utils";
|
|
9
8
|
import { APIMode, FRAMEWORK_MODE_LAMBDA_DIR, API_FILE_RULES } from "./constants";
|
|
@@ -41,6 +41,14 @@ export const isHandler = input => input && typeof input === 'function';
|
|
|
41
41
|
const isFunction = input => input && {}.toString.call(input) === '[object Function]';
|
|
42
42
|
|
|
43
43
|
export const requireHandlerModule = modulePath => {
|
|
44
|
+
const {
|
|
45
|
+
register
|
|
46
|
+
} = require('esbuild-register/dist/node');
|
|
47
|
+
|
|
48
|
+
const {
|
|
49
|
+
unregister
|
|
50
|
+
} = register({});
|
|
51
|
+
|
|
44
52
|
const module = require(modulePath);
|
|
45
53
|
|
|
46
54
|
if (isFunction(module)) {
|
|
@@ -49,6 +57,7 @@ export const requireHandlerModule = modulePath => {
|
|
|
49
57
|
};
|
|
50
58
|
}
|
|
51
59
|
|
|
60
|
+
unregister();
|
|
52
61
|
return module;
|
|
53
62
|
};
|
|
54
63
|
export const sortRoutes = apiHandlers => {
|
|
@@ -60,6 +60,14 @@ exports.isHandler = isHandler;
|
|
|
60
60
|
const isFunction = input => input && {}.toString.call(input) === '[object Function]';
|
|
61
61
|
|
|
62
62
|
const requireHandlerModule = modulePath => {
|
|
63
|
+
const {
|
|
64
|
+
register
|
|
65
|
+
} = require('esbuild-register/dist/node');
|
|
66
|
+
|
|
67
|
+
const {
|
|
68
|
+
unregister
|
|
69
|
+
} = register({});
|
|
70
|
+
|
|
63
71
|
const module = require(modulePath);
|
|
64
72
|
|
|
65
73
|
if (isFunction(module)) {
|
|
@@ -68,6 +76,7 @@ const requireHandlerModule = modulePath => {
|
|
|
68
76
|
};
|
|
69
77
|
}
|
|
70
78
|
|
|
79
|
+
unregister();
|
|
71
80
|
return module;
|
|
72
81
|
};
|
|
73
82
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { MaybeAsync } from '@modern-js/bff-runtime';
|
|
2
1
|
import { APIHandlerInfo } from './types';
|
|
2
|
+
declare type MaybeAsync<I> = I | Promise<I>;
|
|
3
3
|
export declare type NormalHandler = (...args: any[]) => any;
|
|
4
4
|
export declare type Handler<I, O> = (input: I) => MaybeAsync<O>;
|
|
5
5
|
export declare const getFiles: (lambdaDir: string, rules: string | string[]) => string[];
|
|
6
6
|
export declare const getPathFromFilename: (baseDir: string, filename: string) => string;
|
|
7
7
|
export declare const isHandler: (input: any) => input is Handler<any, any>;
|
|
8
8
|
export declare const requireHandlerModule: (modulePath: string) => any;
|
|
9
|
-
export declare const sortRoutes: (apiHandlers: APIHandlerInfo[]) => APIHandlerInfo[];
|
|
9
|
+
export declare const sortRoutes: (apiHandlers: APIHandlerInfo[]) => APIHandlerInfo[];
|
|
10
|
+
export {};
|
package/package.json
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
# @modern-js/adapter-helpers
|
|
2
|
-
|
|
3
|
-
## 1.2.4
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- d32f35134: chore: add modern/jest/eslint/ts config files to .npmignore
|
|
8
|
-
|
|
9
|
-
## 1.2.3
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- 6cffe99d: chore:
|
|
14
|
-
remove react eslint rules for `modern-js` rule set.
|
|
15
|
-
add .eslintrc for each package to speed up linting
|
|
16
|
-
- 60f7d8bf: feat: add tests dir to npmignore
|
|
17
|
-
- befd9e5b: fix: compatible with babel-plugin-resolver's handling of relative paths on windows
|
|
18
|
-
- 3bf4f8b0: feat: support start api server only
|
|
19
|
-
|
|
20
|
-
## 1.2.2
|
|
21
|
-
|
|
22
|
-
### Patch Changes
|
|
23
|
-
|
|
24
|
-
- 55e18278: chore: remove unused dependencies and devDependencies
|
|
25
|
-
|
|
26
|
-
## 1.2.1
|
|
27
|
-
|
|
28
|
-
### Patch Changes
|
|
29
|
-
|
|
30
|
-
- 83166714: change .npmignore
|
|
31
|
-
|
|
32
|
-
## 1.2.0
|
|
33
|
-
|
|
34
|
-
### Minor Changes
|
|
35
|
-
|
|
36
|
-
- cfe11628: Make Modern.js self bootstraping
|
|
37
|
-
|
|
38
|
-
## 1.1.1
|
|
39
|
-
|
|
40
|
-
### Patch Changes
|
|
41
|
-
|
|
42
|
-
- 0fa83663: support more .env files
|
|
43
|
-
|
|
44
|
-
## 1.1.0
|
|
45
|
-
|
|
46
|
-
### Minor Changes
|
|
47
|
-
|
|
48
|
-
- 96119db2: Relese v1.1.0
|
|
49
|
-
|
|
50
|
-
## 1.0.0
|
|
51
|
-
|
|
52
|
-
### Patch Changes
|
|
53
|
-
|
|
54
|
-
- 224f7fe: fix server route match
|
|
55
|
-
- 30ac27c: feat: add generator package description
|
|
56
|
-
- 0fd196e: feat: fix bugs
|
|
57
|
-
- 204c626: feat: initial
|
|
58
|
-
- 63be0a5: fix: #118 #104
|
|
59
|
-
|
|
60
|
-
## 1.0.0-rc.23
|
|
61
|
-
|
|
62
|
-
### Patch Changes
|
|
63
|
-
|
|
64
|
-
- 224f7fe: fix server route match
|
|
65
|
-
- 30ac27c: feat: add generator package description
|
|
66
|
-
- 0fd196e: feat: fix bugs
|
|
67
|
-
- 204c626: feat: initial
|
|
68
|
-
- 63be0a5: fix: #118 #104
|
|
69
|
-
|
|
70
|
-
## 1.0.0-rc.22
|
|
71
|
-
|
|
72
|
-
### Patch Changes
|
|
73
|
-
|
|
74
|
-
- 224f7fe: fix server route match
|
|
75
|
-
- 30ac27c: feat: add generator package description
|
|
76
|
-
- 0fd196e: feat: fix bugs
|
|
77
|
-
- 204c626: feat: initial
|
|
78
|
-
- 63be0a5: fix: #118 #104
|
|
79
|
-
|
|
80
|
-
## 1.0.0-rc.21
|
|
81
|
-
|
|
82
|
-
### Patch Changes
|
|
83
|
-
|
|
84
|
-
- 224f7fe: fix server route match
|
|
85
|
-
- 30ac27c: feat: add generator package description
|
|
86
|
-
- 0fd196e: feat: fix bugs
|
|
87
|
-
- 204c626: feat: initial
|
|
88
|
-
- 63be0a5: fix: #118 #104
|
|
89
|
-
|
|
90
|
-
## 1.0.0-rc.20
|
|
91
|
-
|
|
92
|
-
### Patch Changes
|
|
93
|
-
|
|
94
|
-
- 224f7fe: fix server route match
|
|
95
|
-
- 30ac27c: feat: add generator package description
|
|
96
|
-
- feat: fix bugs
|
|
97
|
-
- 204c626: feat: initial
|
|
98
|
-
- 63be0a5: fix: #118 #104
|
|
99
|
-
|
|
100
|
-
## 1.0.0-rc.19
|
|
101
|
-
|
|
102
|
-
### Patch Changes
|
|
103
|
-
|
|
104
|
-
- 224f7fe: fix server route match
|
|
105
|
-
- 30ac27c: feat: add generator package description
|
|
106
|
-
- 204c626: feat: initial
|
|
107
|
-
- 63be0a5: fix: #118 #104
|
|
108
|
-
|
|
109
|
-
## 1.0.0-rc.18
|
|
110
|
-
|
|
111
|
-
### Patch Changes
|
|
112
|
-
|
|
113
|
-
- 224f7fe: fix server route match
|
|
114
|
-
- 30ac27c: feat: add generator package description
|
|
115
|
-
- 204c626: feat: initial
|
|
116
|
-
- 63be0a5: fix: #118 #104
|
|
117
|
-
|
|
118
|
-
## 1.0.0-rc.17
|
|
119
|
-
|
|
120
|
-
### Patch Changes
|
|
121
|
-
|
|
122
|
-
- 224f7fe: fix server route match
|
|
123
|
-
- 30ac27c: feat: add generator package description
|
|
124
|
-
- 204c626: feat: initial
|
|
125
|
-
- fix: #118 #104
|
|
126
|
-
|
|
127
|
-
## 1.0.0-rc.16
|
|
128
|
-
|
|
129
|
-
### Patch Changes
|
|
130
|
-
|
|
131
|
-
- 224f7fe: fix server route match
|
|
132
|
-
- 30ac27c: feat: add generator package description
|
|
133
|
-
- 204c626: feat: initial
|
|
134
|
-
|
|
135
|
-
## 1.0.0-rc.15
|
|
136
|
-
|
|
137
|
-
### Patch Changes
|
|
138
|
-
|
|
139
|
-
- 224f7fe: fix server route match
|
|
140
|
-
- 30ac27c: feat: add generator package description
|
|
141
|
-
- 204c626: feat: initial
|
|
142
|
-
|
|
143
|
-
## 1.0.0-rc.14
|
|
144
|
-
|
|
145
|
-
### Patch Changes
|
|
146
|
-
|
|
147
|
-
- 224f7fe: fix server route match
|
|
148
|
-
- 204c626: feat: initial
|
|
149
|
-
|
|
150
|
-
## 1.0.0-rc.13
|
|
151
|
-
|
|
152
|
-
### Patch Changes
|
|
153
|
-
|
|
154
|
-
- 224f7fe: fix server route match
|
|
155
|
-
- 204c626: feat: initial
|
|
156
|
-
|
|
157
|
-
## 1.0.0-rc.12
|
|
158
|
-
|
|
159
|
-
### Patch Changes
|
|
160
|
-
|
|
161
|
-
- 224f7fe: fix server route match
|
|
162
|
-
- 204c626: feat: initial
|
|
163
|
-
|
|
164
|
-
## 1.0.0-rc.11
|
|
165
|
-
|
|
166
|
-
### Patch Changes
|
|
167
|
-
|
|
168
|
-
- 224f7fe: fix server route match
|
|
169
|
-
- 204c626: feat: initial
|
|
170
|
-
|
|
171
|
-
## 1.0.0-rc.10
|
|
172
|
-
|
|
173
|
-
### Patch Changes
|
|
174
|
-
|
|
175
|
-
- 224f7fe: fix server route match
|
|
176
|
-
- 204c626: feat: initial
|
|
177
|
-
|
|
178
|
-
## 1.0.0-rc.9
|
|
179
|
-
|
|
180
|
-
### Patch Changes
|
|
181
|
-
|
|
182
|
-
- 224f7fe: fix server route match
|
|
183
|
-
- 204c626: feat: initial
|
|
184
|
-
|
|
185
|
-
## 1.0.0-rc.8
|
|
186
|
-
|
|
187
|
-
### Patch Changes
|
|
188
|
-
|
|
189
|
-
- 224f7fe: fix server route match
|
|
190
|
-
- 204c626: feat: initial
|
|
191
|
-
|
|
192
|
-
## 1.0.0-rc.7
|
|
193
|
-
|
|
194
|
-
### Patch Changes
|
|
195
|
-
|
|
196
|
-
- 224f7fe: fix server route match
|
|
197
|
-
- 204c626: feat: initial
|
|
198
|
-
|
|
199
|
-
## 1.0.0-rc.6
|
|
200
|
-
|
|
201
|
-
### Patch Changes
|
|
202
|
-
|
|
203
|
-
- 224f7fe: fix server route match
|
|
204
|
-
- 204c626: feat: initial
|
|
205
|
-
|
|
206
|
-
## 1.0.0-rc.5
|
|
207
|
-
|
|
208
|
-
### Patch Changes
|
|
209
|
-
|
|
210
|
-
- 224f7fe: fix server route match
|
|
211
|
-
- 204c626: feat: initial
|
|
212
|
-
|
|
213
|
-
## 1.0.0-rc.4
|
|
214
|
-
|
|
215
|
-
### Patch Changes
|
|
216
|
-
|
|
217
|
-
- fix server route match
|
|
218
|
-
- 204c626: feat: initial
|
|
219
|
-
|
|
220
|
-
## 1.0.0-rc.3
|
|
221
|
-
|
|
222
|
-
### Patch Changes
|
|
223
|
-
|
|
224
|
-
- feat: initial
|