@modern-js/bff-core 2.0.0-beta.0 → 2.0.0-beta.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.
@@ -7,19 +7,12 @@ var _exportNames = {
7
7
  ApiRouter: true
8
8
  };
9
9
  exports.ApiRouter = void 0;
10
-
11
10
  var _path = _interopRequireDefault(require("path"));
12
-
13
11
  var _utils = require("@modern-js/utils");
14
-
15
12
  require("reflect-metadata");
16
-
17
13
  var _types = require("../types");
18
-
19
14
  var _utils2 = require("../utils");
20
-
21
15
  var _constants = require("./constants");
22
-
23
16
  Object.keys(_constants).forEach(function (key) {
24
17
  if (key === "default" || key === "__esModule") return;
25
18
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -31,11 +24,8 @@ Object.keys(_constants).forEach(function (key) {
31
24
  }
32
25
  });
33
26
  });
34
-
35
27
  var _utils3 = require("./utils");
36
-
37
28
  var _types2 = require("./types");
38
-
39
29
  Object.keys(_types2).forEach(function (key) {
40
30
  if (key === "default" || key === "__esModule") return;
41
31
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -47,54 +37,40 @@ Object.keys(_types2).forEach(function (key) {
47
37
  }
48
38
  });
49
39
  });
50
-
51
40
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
52
-
53
41
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
54
-
55
42
  class ApiRouter {
56
43
  // lambdaDir is the dir which equal to the apiDir in function mode, and equal to the api/lambda dir in framework mode
44
+
57
45
  constructor({
58
46
  apiDir: _apiDir,
59
47
  lambdaDir: _lambdaDir,
60
48
  prefix
61
49
  }) {
62
50
  _defineProperty(this, "apiMode", void 0);
63
-
64
51
  _defineProperty(this, "apiDir", void 0);
65
-
66
52
  _defineProperty(this, "existLambdaDir", void 0);
67
-
68
53
  _defineProperty(this, "lambdaDir", void 0);
69
-
70
54
  _defineProperty(this, "prefix", void 0);
71
-
72
55
  _defineProperty(this, "apiFiles", []);
73
-
74
56
  _defineProperty(this, "getExactApiMode", apiDir => {
75
57
  const exist = this.createExistChecker(apiDir);
76
58
  const existLambdaDir = exist(_constants.FRAMEWORK_MODE_LAMBDA_DIR);
77
59
  const existAppDir = exist(_constants.FRAMEWORK_MODE_APP_DIR);
78
60
  const existAppFile = exist('app.ts') || exist('app.js');
79
-
80
61
  if (existLambdaDir || existAppDir || existAppFile) {
81
62
  return _constants.APIMode.FARMEWORK;
82
63
  }
83
-
84
64
  return _constants.APIMode.FUNCTION;
85
65
  });
86
-
87
66
  _defineProperty(this, "createExistChecker", base => target => _utils.fs.pathExistsSync(_path.default.resolve(base, target)));
88
-
89
67
  _defineProperty(this, "getExactLambdaDir", apiDir => {
90
68
  if (this.lambdaDir) {
91
69
  return this.lambdaDir;
92
70
  }
93
-
94
71
  const lambdaDir = this.apiMode === _constants.APIMode.FARMEWORK ? _path.default.join(apiDir, _constants.FRAMEWORK_MODE_LAMBDA_DIR) : apiDir;
95
72
  return lambdaDir;
96
73
  });
97
-
98
74
  this.validateAbsolute(_apiDir, 'apiDir');
99
75
  this.validateAbsolute(_lambdaDir, 'lambdaDir');
100
76
  this.prefix = this.initPrefix(prefix);
@@ -103,45 +79,34 @@ class ApiRouter {
103
79
  this.lambdaDir = _lambdaDir || this.getExactLambdaDir(this.apiDir);
104
80
  this.existLambdaDir = _utils.fs.existsSync(this.lambdaDir);
105
81
  }
106
-
107
82
  isExistLambda() {
108
83
  return this.existLambdaDir;
109
84
  }
110
-
111
85
  getApiMode() {
112
86
  return this.apiMode;
113
87
  }
114
-
115
88
  getLambdaDir() {
116
89
  return this.lambdaDir;
117
90
  }
118
-
119
91
  isApiFile(filename) {
120
92
  if (this.existLambdaDir) {
121
93
  return false;
122
94
  }
123
-
124
95
  if (!this.apiFiles.includes(filename)) {
125
96
  return false;
126
97
  }
127
-
128
98
  return true;
129
99
  }
130
-
131
100
  getSingleModuleHandlers(filename) {
132
101
  const moduleInfo = this.getModuleInfo(filename);
133
-
134
102
  if (moduleInfo) {
135
103
  return this.getModuleHandlerInfos(moduleInfo);
136
104
  }
137
-
138
105
  return null;
139
106
  }
140
-
141
107
  getHandlerInfo(filename, originFuncName, handler) {
142
108
  const httpMethod = this.getHttpMethod(originFuncName, handler);
143
109
  const routeName = this.getRouteName(filename, handler);
144
-
145
110
  if (httpMethod && routeName) {
146
111
  return {
147
112
  handler,
@@ -152,105 +117,80 @@ class ApiRouter {
152
117
  routePath: this.getRoutePath(this.prefix, routeName)
153
118
  };
154
119
  }
155
-
156
120
  return null;
157
- } // TODO: 性能提升,开发环境,判断下 lambda 目录修改时间
158
-
121
+ }
159
122
 
123
+ // TODO: 性能提升,开发环境,判断下 lambda 目录修改时间
160
124
  getSafeRoutePath(filename, handler) {
161
125
  this.loadApiFiles();
162
126
  this.validateValidApifile(filename);
163
127
  return this.getRouteName(filename, handler);
164
128
  }
165
-
166
129
  getRouteName(filename, handler) {
167
130
  if (handler) {
168
131
  const trigger = Reflect.getMetadata(_types.OperatorType.Trigger, handler);
169
-
170
132
  if (trigger && trigger.type === _types.TriggerType.Http) {
171
133
  if (!trigger.path) {
172
134
  throw new Error(`The http trigger ${trigger.name} needs to specify a path`);
173
135
  }
174
-
175
136
  return trigger.path;
176
137
  }
177
138
  }
178
-
179
139
  const routePath = (0, _utils3.getPathFromFilename)(this.lambdaDir, filename);
180
140
  return routePath;
181
141
  }
182
-
183
142
  getHttpMethod(originHandlerName, handler) {
184
143
  if (handler) {
185
144
  const trigger = Reflect.getMetadata(_types.OperatorType.Trigger, handler);
186
-
187
145
  if (trigger && _types.httpMethods.includes(trigger.method)) {
188
146
  return trigger.method;
189
147
  }
190
148
  }
191
-
192
149
  const upperName = originHandlerName.toUpperCase();
193
-
194
150
  switch (upperName) {
195
151
  case 'GET':
196
152
  return _types.HttpMethod.Get;
197
-
198
153
  case 'POST':
199
154
  return _types.HttpMethod.Post;
200
-
201
155
  case 'PUT':
202
156
  return _types.HttpMethod.Put;
203
-
204
157
  case 'DELETE':
205
158
  case 'DEL':
206
159
  return _types.HttpMethod.Delete;
207
-
208
160
  case 'CONNECT':
209
161
  return _types.HttpMethod.Connect;
210
-
211
162
  case 'TRACE':
212
163
  return _types.HttpMethod.Trace;
213
-
214
164
  case 'PATCH':
215
165
  return _types.HttpMethod.Patch;
216
-
217
166
  case 'OPTION':
218
167
  return _types.HttpMethod.Option;
219
-
220
168
  case 'DEFAULT':
221
169
  {
222
170
  return _types.HttpMethod.Get;
223
171
  }
224
-
225
172
  default:
226
173
  _utils.logger.warn(`Only api handlers are allowd to be exported, please remove the function ${originHandlerName} from exports`);
227
-
228
174
  return null;
229
175
  }
230
176
  }
231
-
232
177
  loadApiFiles() {
233
178
  if (!this.existLambdaDir) {
234
179
  return [];
235
- } // eslint-disable-next-line no-multi-assign
236
-
237
-
180
+ }
181
+ // eslint-disable-next-line no-multi-assign
238
182
  const apiFiles = this.apiFiles = (0, _utils3.getFiles)(this.lambdaDir, _constants.API_FILE_RULES);
239
183
  return apiFiles;
240
184
  }
241
-
242
185
  getApiFiles() {
243
186
  if (!this.existLambdaDir) {
244
187
  return [];
245
188
  }
246
-
247
189
  if (this.apiFiles.length > 0) {
248
190
  return this.apiFiles;
249
191
  }
250
-
251
192
  return this.loadApiFiles();
252
193
  }
253
-
254
194
  getApiHandlers() {
255
195
  const filenames = this.getApiFiles();
256
196
  const moduleInfos = this.getModuleInfos(filenames);
@@ -258,30 +198,25 @@ class ApiRouter {
258
198
  (0, _utils2.debug)('apiHandlers', apiHandlers.length, apiHandlers);
259
199
  return apiHandlers;
260
200
  }
201
+
261
202
  /**
262
203
  * 如果用户未传入或传入空串,默认为 /api
263
204
  * 如果传入 /,则 prefix 为 /
264
205
  */
265
-
266
-
267
206
  initPrefix(prefix) {
268
207
  if (prefix === '/') {
269
208
  return '';
270
209
  }
271
-
272
210
  return prefix || '/api';
273
211
  }
274
-
275
212
  validateAbsolute(filename, paramsName) {
276
213
  if (typeof filename === 'string' && !_path.default.isAbsolute(filename)) {
277
214
  throw new Error(`The ${paramsName} ${filename} is not a abolute path`);
278
215
  }
279
216
  }
280
-
281
217
  getModuleInfos(filenames) {
282
218
  return filenames.map(filename => this.getModuleInfo(filename)).filter(moduleInfo => Boolean(moduleInfo));
283
219
  }
284
-
285
220
  getModuleInfo(filename) {
286
221
  try {
287
222
  const module = (0, _utils3.requireHandlerModule)(filename);
@@ -298,12 +233,10 @@ class ApiRouter {
298
233
  }
299
234
  }
300
235
  }
301
-
302
236
  getHandlerInfos(moduleInfos) {
303
237
  let apiHandlers = [];
304
238
  moduleInfos.forEach(moduleInfo => {
305
239
  const handlerInfos = this.getModuleHandlerInfos(moduleInfo);
306
-
307
240
  if (handlerInfos) {
308
241
  apiHandlers = apiHandlers.concat(handlerInfos);
309
242
  }
@@ -311,7 +244,6 @@ class ApiRouter {
311
244
  const sortedHandlers = (0, _utils3.sortRoutes)(apiHandlers);
312
245
  return sortedHandlers;
313
246
  }
314
-
315
247
  getModuleHandlerInfos(moduleInfo) {
316
248
  const {
317
249
  module,
@@ -323,23 +255,17 @@ class ApiRouter {
323
255
  return handlerInfo;
324
256
  }).filter(handlerInfo => Boolean(handlerInfo));
325
257
  }
326
-
327
258
  validateValidApifile(filename) {
328
259
  if (!this.apiFiles.includes(filename)) {
329
260
  throw new Error(`The ${filename} is not a valid api file.`);
330
261
  }
331
262
  }
332
-
333
263
  getRoutePath(prefix, routeName) {
334
264
  const finalRouteName = routeName === '/' ? '' : routeName;
335
-
336
265
  if (prefix === '' && finalRouteName === '') {
337
266
  return '/';
338
267
  }
339
-
340
268
  return `${prefix}${finalRouteName}`;
341
269
  }
342
-
343
270
  }
344
-
345
271
  exports.ApiRouter = ApiRouter;
@@ -4,22 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.sortRoutes = exports.requireHandlerModule = exports.isHandler = exports.getPathFromFilename = exports.getFiles = void 0;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _utils = require("@modern-js/utils");
11
-
12
9
  var _constants = require("./constants");
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
11
  const getFiles = (lambdaDir, rules) => _utils.globby.sync(rules, {
17
12
  cwd: lambdaDir,
18
13
  gitignore: true
19
14
  }).map(file => _path.default.resolve(lambdaDir, file));
20
-
21
15
  exports.getFiles = getFiles;
22
-
23
16
  const getPathFromFilename = (baseDir, filename) => {
24
17
  const relativeName = filename.substring(baseDir.length);
25
18
  const relativePath = relativeName.split('.').slice(0, -1).join('.');
@@ -29,34 +22,25 @@ const getPathFromFilename = (baseDir, filename) => {
29
22
  return `:${item.substring(1, item.length - 1)}`;
30
23
  }
31
24
  }
32
-
33
25
  return item;
34
26
  });
35
27
  const name = nameSplit.join('/');
36
28
  const finalName = name.endsWith(_constants.INDEX_SUFFIX) ? name.substring(0, name.length - _constants.INDEX_SUFFIX.length) : name;
37
29
  return clearRouteName(finalName);
38
30
  };
39
-
40
31
  exports.getPathFromFilename = getPathFromFilename;
41
-
42
32
  const clearRouteName = routeName => {
43
33
  let finalRouteName = routeName.trim();
44
-
45
34
  if (!finalRouteName.startsWith('/')) {
46
35
  finalRouteName = `/${finalRouteName}`;
47
36
  }
48
-
49
37
  if (finalRouteName.length > 1 && finalRouteName.endsWith('/')) {
50
38
  finalRouteName = finalRouteName.substring(0, finalRouteName.length - 1);
51
39
  }
52
-
53
40
  return finalRouteName;
54
41
  };
55
-
56
42
  const isHandler = input => input && typeof input === 'function';
57
-
58
43
  exports.isHandler = isHandler;
59
-
60
44
  const enableRegister = requireFn => {
61
45
  // esbuild-register 做 unRegister 时,不会删除 register 添加的 require.extensions,导致第二次调用时 require.extensions['.ts'] 是 nodejs 默认 loader
62
46
  // 所以这里根据第一次调用时,require.extensions 有没有,来判断是否需要使用 esbuild-register
@@ -68,54 +52,45 @@ const enableRegister = requireFn => {
68
52
  existTsLoader = Boolean(require.extensions['.ts']);
69
53
  firstCall = false;
70
54
  }
71
-
72
55
  if (!existTsLoader) {
73
56
  const {
74
57
  register
75
58
  } = require('esbuild-register/dist/node');
76
-
77
59
  const {
78
60
  unregister
79
- } = register({});
61
+ } = register({
62
+ extensions: ['.ts']
63
+ });
80
64
  const requiredModule = requireFn(modulePath);
81
65
  unregister();
82
66
  return requiredModule;
83
67
  }
84
-
85
68
  const requiredModule = requireFn(modulePath);
86
69
  return requiredModule;
87
70
  };
88
71
  };
89
-
90
72
  const isFunction = input => input && {}.toString.call(input) === '[object Function]';
91
-
92
73
  const requireHandlerModule = enableRegister(modulePath => {
93
74
  // 测试环境不走缓存,因为缓存的 h andler 文件,会被 mockAPI 函数进行 mock,升级 jest28,setupFilesAfterEnv 能做异步操作的话,可解此问题
94
75
  const originRequire = process.env.NODE_ENV === 'test' ? jest.requireActual : require;
95
76
  const module = originRequire(modulePath);
96
-
97
77
  if (isFunction(module)) {
98
78
  return {
99
79
  default: module
100
80
  };
101
81
  }
102
-
103
82
  return module;
104
83
  });
105
84
  exports.requireHandlerModule = requireHandlerModule;
106
-
107
85
  const routeValue = routePath => {
108
86
  if (routePath.includes(':')) {
109
87
  return 11;
110
88
  }
111
-
112
89
  return 1;
113
90
  };
114
-
115
91
  const sortRoutes = apiHandlers => {
116
92
  return apiHandlers.sort((handlerA, handlerB) => {
117
93
  return routeValue(handlerA.routeName) - routeValue(handlerB.routeName);
118
94
  });
119
95
  };
120
-
121
96
  exports.sortRoutes = sortRoutes;
@@ -6,22 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.httpMethods = exports.TriggerType = exports.ResponseMetaType = exports.OperatorType = exports.HttpMethod = exports.HttpMetadata = void 0;
7
7
  let OperatorType;
8
8
  exports.OperatorType = OperatorType;
9
-
10
9
  (function (OperatorType) {
11
10
  OperatorType[OperatorType["Trigger"] = 0] = "Trigger";
12
11
  OperatorType[OperatorType["Middleware"] = 1] = "Middleware";
13
12
  })(OperatorType || (exports.OperatorType = OperatorType = {}));
14
-
15
13
  let TriggerType;
16
14
  exports.TriggerType = TriggerType;
17
-
18
15
  (function (TriggerType) {
19
16
  TriggerType[TriggerType["Http"] = 0] = "Http";
20
17
  })(TriggerType || (exports.TriggerType = TriggerType = {}));
21
-
22
18
  let HttpMetadata;
23
19
  exports.HttpMetadata = HttpMetadata;
24
-
25
20
  (function (HttpMetadata) {
26
21
  HttpMetadata["Method"] = "METHOD";
27
22
  HttpMetadata["Data"] = "DATA";
@@ -30,19 +25,15 @@ exports.HttpMetadata = HttpMetadata;
30
25
  HttpMetadata["Headers"] = "HEADERS";
31
26
  HttpMetadata["Response"] = "RESPONSE";
32
27
  })(HttpMetadata || (exports.HttpMetadata = HttpMetadata = {}));
33
-
34
28
  let ResponseMetaType;
35
29
  exports.ResponseMetaType = ResponseMetaType;
36
-
37
30
  (function (ResponseMetaType) {
38
31
  ResponseMetaType[ResponseMetaType["StatusCode"] = 0] = "StatusCode";
39
32
  ResponseMetaType[ResponseMetaType["Redirect"] = 1] = "Redirect";
40
33
  ResponseMetaType[ResponseMetaType["Headers"] = 2] = "Headers";
41
34
  })(ResponseMetaType || (exports.ResponseMetaType = ResponseMetaType = {}));
42
-
43
35
  let HttpMethod;
44
36
  exports.HttpMethod = HttpMethod;
45
-
46
37
  (function (HttpMethod) {
47
38
  HttpMethod["Get"] = "GET";
48
39
  HttpMethod["Post"] = "POST";
@@ -54,6 +45,5 @@ exports.HttpMethod = HttpMethod;
54
45
  HttpMethod["Option"] = "OPTION";
55
46
  HttpMethod["Head"] = "HEAD";
56
47
  })(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
57
-
58
48
  const httpMethods = Object.values(HttpMethod);
59
49
  exports.httpMethods = httpMethods;
@@ -4,24 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.registerPaths = exports.getRelativeRuntimePath = exports.createMatchPath = void 0;
7
-
8
7
  var path = _interopRequireWildcard(require("path"));
9
-
10
8
  var os = _interopRequireWildcard(require("os"));
11
-
12
9
  var _fs = _interopRequireDefault(require("fs"));
13
-
14
10
  var _module = _interopRequireDefault(require("module"));
15
-
16
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
14
  const getRelativeRuntimePath = (appDirectory, serverRuntimePath) => {
23
15
  let relativeRuntimePath = '';
24
-
25
16
  if (os.platform() === 'win32') {
26
17
  // isRelative function in babel-plugin-resolver plugin can't handle windows relative path correctly, see babel-plugin-resolver's utils.
27
18
  relativeRuntimePath = `../${path.relative(appDirectory, serverRuntimePath)}`;
@@ -29,20 +20,15 @@ const getRelativeRuntimePath = (appDirectory, serverRuntimePath) => {
29
20
  // Look up one level, because the artifacts after build have dist directories
30
21
  relativeRuntimePath = path.join('../', path.relative(appDirectory, serverRuntimePath));
31
22
  }
32
-
33
23
  if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
34
24
  relativeRuntimePath = `./${path.relative(appDirectory, serverRuntimePath)}`;
35
25
  }
36
-
37
26
  return relativeRuntimePath;
38
27
  };
39
-
40
28
  exports.getRelativeRuntimePath = getRelativeRuntimePath;
41
-
42
29
  const sortByLongestPrefix = arr => {
43
30
  return arr.concat().sort((a, b) => b.length - a.length);
44
31
  };
45
-
46
32
  const createMatchPath = paths => {
47
33
  const sortedKeys = sortByLongestPrefix(Object.keys(paths));
48
34
  const sortedPaths = {};
@@ -53,63 +39,48 @@ const createMatchPath = paths => {
53
39
  const found = Object.keys(sortedPaths).find(key => {
54
40
  return request.startsWith(key);
55
41
  });
56
-
57
42
  if (found) {
58
43
  let foundPaths = sortedPaths[found];
59
-
60
44
  if (!Array.isArray(foundPaths)) {
61
45
  foundPaths = [foundPaths];
62
46
  }
63
-
64
47
  foundPaths = foundPaths.filter(foundPath => path.isAbsolute(foundPath));
65
-
66
48
  for (const p of foundPaths) {
67
49
  const foundPath = request.replace(found, p);
68
-
69
50
  if (_fs.default.existsSync(foundPath)) {
70
51
  return foundPath;
71
52
  }
72
53
  }
73
-
74
54
  return request.replace(found, foundPaths[0]);
75
55
  }
76
-
77
56
  return null;
78
57
  };
79
- }; // every path must be a absolute path;
80
-
58
+ };
81
59
 
60
+ // every path must be a absolute path;
82
61
  exports.createMatchPath = createMatchPath;
83
-
84
62
  const registerPaths = paths => {
85
- const originalResolveFilename = _module.default._resolveFilename; // eslint-disable-next-line node/no-unsupported-features/node-builtins
86
-
63
+ const originalResolveFilename = _module.default._resolveFilename;
64
+ // eslint-disable-next-line node/no-unsupported-features/node-builtins
87
65
  const {
88
66
  builtinModules
89
67
  } = _module.default;
90
68
  const matchPath = createMatchPath(paths);
91
-
92
69
  _module.default._resolveFilename = function (request, _parent) {
93
70
  const isCoreModule = builtinModules.includes(request);
94
-
95
71
  if (!isCoreModule) {
96
72
  const matched = matchPath(request);
97
-
98
73
  if (matched) {
99
74
  // eslint-disable-next-line prefer-rest-params
100
75
  const modifiedArguments = [matched, ...[].slice.call(arguments, 1)]; // Passes all arguments. Even those that is not specified above.
101
-
102
76
  return originalResolveFilename.apply(this, modifiedArguments);
103
77
  }
104
- } // eslint-disable-next-line prefer-rest-params
105
-
106
-
78
+ }
79
+ // eslint-disable-next-line prefer-rest-params
107
80
  return originalResolveFilename.apply(this, arguments);
108
81
  };
109
-
110
82
  return () => {
111
83
  _module.default._resolveFilename = originalResolveFilename;
112
84
  };
113
85
  };
114
-
115
86
  exports.registerPaths = registerPaths;
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.debug = void 0;
7
-
8
7
  var _utils = require("@modern-js/utils");
9
-
10
8
  const debug = (0, _utils.createDebugger)('bff');
11
9
  exports.debug = debug;
@@ -12,9 +12,7 @@ Object.defineProperty(exports, "debug", {
12
12
  return _debug.debug;
13
13
  }
14
14
  });
15
-
16
15
  var _storage = require("./storage");
17
-
18
16
  Object.keys(_storage).forEach(function (key) {
19
17
  if (key === "default" || key === "__esModule") return;
20
18
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -26,9 +24,7 @@ Object.keys(_storage).forEach(function (key) {
26
24
  }
27
25
  });
28
26
  });
29
-
30
27
  var _alias = require("./alias");
31
-
32
28
  Object.keys(_alias).forEach(function (key) {
33
29
  if (key === "default" || key === "__esModule") return;
34
30
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -40,11 +36,8 @@ Object.keys(_alias).forEach(function (key) {
40
36
  }
41
37
  });
42
38
  });
43
-
44
39
  var _debug = require("./debug");
45
-
46
40
  var _meta = require("./meta");
47
-
48
41
  Object.keys(_meta).forEach(function (key) {
49
42
  if (key === "default" || key === "__esModule") return;
50
43
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -56,9 +49,7 @@ Object.keys(_meta).forEach(function (key) {
56
49
  }
57
50
  });
58
51
  });
59
-
60
52
  var _validate = require("./validate");
61
-
62
53
  Object.keys(_validate).forEach(function (key) {
63
54
  if (key === "default" || key === "__esModule") return;
64
55
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.isWithMetaHandler = exports.HANDLER_WITH_META = void 0;
7
7
  const HANDLER_WITH_META = 'HANDLER_WITH_META';
8
8
  exports.HANDLER_WITH_META = HANDLER_WITH_META;
9
-
10
9
  const isWithMetaHandler = handler => {
11
10
  return typeof handler === 'function' && handler[HANDLER_WITH_META];
12
11
  };
13
-
14
12
  exports.isWithMetaHandler = isWithMetaHandler;