@modern-js/bff-core 3.1.1 → 3.1.3

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.
@@ -1,9 +1,9 @@
1
- import { resolve } from "path";
2
1
  import { ApiRouter } from "../router/index.mjs";
3
2
  import { Err, Ok } from "./result.mjs";
3
+ import * as __rspack_external_path from "path";
4
4
  const getPackageName = (appDir)=>{
5
5
  try {
6
- const packageJsonPath = resolve(appDir, './package.json');
6
+ const packageJsonPath = __rspack_external_path.resolve(appDir, './package.json');
7
7
  const packageJson = require(packageJsonPath);
8
8
  return packageJson.name;
9
9
  } catch (error) {
@@ -1,5 +1,3 @@
1
- export * from "./types.mjs";
2
- export * from "./constants.mjs";
3
1
  import path from "path";
4
2
  import { fs, logger } from "@modern-js/utils";
5
3
  import "reflect-metadata";
@@ -7,6 +5,8 @@ import { HttpMethod, OperatorType, TriggerType, httpMethods } from "../types.mjs
7
5
  import { INPUT_PARAMS_DECIDER, debug } from "../utils/index.mjs";
8
6
  import { API_FILE_RULES, FRAMEWORK_MODE_LAMBDA_DIR } from "./constants.mjs";
9
7
  import { getFiles, getPathFromFilename, requireHandlerModule, sortRoutes } from "./utils.mjs";
8
+ export * from "./types.mjs";
9
+ export * from "./constants.mjs";
10
10
  class ApiRouter {
11
11
  isExistLambda() {
12
12
  return this.existLambdaDir;
@@ -1,11 +1,11 @@
1
1
  import fs from "fs";
2
2
  import module_0 from "module";
3
- import { platform } from "os";
4
- import { isAbsolute, join, relative } from "path";
3
+ import * as __rspack_external_os from "os";
4
+ import * as __rspack_external_path from "path";
5
5
  const getRelativeRuntimePath = (appDirectory, serverRuntimePath)=>{
6
6
  let relativeRuntimePath = '';
7
- relativeRuntimePath = 'win32' === platform() ? `../${relative(appDirectory, serverRuntimePath)}` : join('../', relative(appDirectory, serverRuntimePath));
8
- if ('development' === process.env.NODE_ENV || 'test' === process.env.NODE_ENV) relativeRuntimePath = `./${relative(appDirectory, serverRuntimePath)}`;
7
+ relativeRuntimePath = 'win32' === __rspack_external_os.platform() ? `../${__rspack_external_path.relative(appDirectory, serverRuntimePath)}` : __rspack_external_path.join('../', __rspack_external_path.relative(appDirectory, serverRuntimePath));
8
+ if ('development' === process.env.NODE_ENV || 'test' === process.env.NODE_ENV) relativeRuntimePath = `./${__rspack_external_path.relative(appDirectory, serverRuntimePath)}`;
9
9
  return relativeRuntimePath;
10
10
  };
11
11
  const sortByLongestPrefix = (arr)=>arr.concat().sort((a, b)=>b.length - a.length);
@@ -22,7 +22,7 @@ const createMatchPath = (paths)=>{
22
22
  if (!Array.isArray(foundPaths)) foundPaths = [
23
23
  foundPaths
24
24
  ];
25
- foundPaths = foundPaths.filter((foundPath)=>isAbsolute(foundPath));
25
+ foundPaths = foundPaths.filter((foundPath)=>__rspack_external_path.isAbsolute(foundPath));
26
26
  for (const p of foundPaths){
27
27
  const foundPath = request.replace(found, p);
28
28
  if (fs.existsSync(foundPath)) return foundPath;
@@ -1,7 +1,7 @@
1
- import { AsyncLocalStorage } from "async_hooks";
1
+ import * as __rspack_external_async_hooks from "async_hooks";
2
2
  const createStorage = ()=>{
3
3
  let storage;
4
- if (void 0 !== AsyncLocalStorage) storage = new AsyncLocalStorage();
4
+ if (void 0 !== __rspack_external_async_hooks.AsyncLocalStorage) storage = new __rspack_external_async_hooks.AsyncLocalStorage();
5
5
  const run = (context, cb)=>{
6
6
  if (!storage) throw new Error(`Unable to use async_hook, please confirm the node version >= 12.17
7
7
  `);
@@ -1,11 +1,11 @@
1
1
  import __rslib_shim_module__ from "node:module";
2
2
  const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
3
- import { resolve } from "path";
4
3
  import { ApiRouter } from "../router/index.mjs";
5
4
  import { Err, Ok } from "./result.mjs";
5
+ import * as __rspack_external_path from "path";
6
6
  const getPackageName = (appDir)=>{
7
7
  try {
8
- const packageJsonPath = resolve(appDir, './package.json');
8
+ const packageJsonPath = __rspack_external_path.resolve(appDir, './package.json');
9
9
  const packageJson = require(packageJsonPath);
10
10
  return packageJson.name;
11
11
  } catch (error) {
@@ -1,6 +1,4 @@
1
1
  import "node:module";
2
- export * from "./types.mjs";
3
- export * from "./constants.mjs";
4
2
  import path from "path";
5
3
  import { fs, logger } from "@modern-js/utils";
6
4
  import "reflect-metadata";
@@ -8,6 +6,8 @@ import { HttpMethod, OperatorType, TriggerType, httpMethods } from "../types.mjs
8
6
  import { INPUT_PARAMS_DECIDER, debug } from "../utils/index.mjs";
9
7
  import { API_FILE_RULES, FRAMEWORK_MODE_LAMBDA_DIR } from "./constants.mjs";
10
8
  import { getFiles, getPathFromFilename, requireHandlerModule, sortRoutes } from "./utils.mjs";
9
+ export * from "./types.mjs";
10
+ export * from "./constants.mjs";
11
11
  class ApiRouter {
12
12
  isExistLambda() {
13
13
  return this.existLambdaDir;
@@ -1,12 +1,12 @@
1
1
  import "node:module";
2
2
  import fs from "fs";
3
3
  import module_0 from "module";
4
- import { platform } from "os";
5
- import { isAbsolute, join, relative } from "path";
4
+ import * as __rspack_external_os from "os";
5
+ import * as __rspack_external_path from "path";
6
6
  const getRelativeRuntimePath = (appDirectory, serverRuntimePath)=>{
7
7
  let relativeRuntimePath = '';
8
- relativeRuntimePath = 'win32' === platform() ? `../${relative(appDirectory, serverRuntimePath)}` : join('../', relative(appDirectory, serverRuntimePath));
9
- if ('development' === process.env.NODE_ENV || 'test' === process.env.NODE_ENV) relativeRuntimePath = `./${relative(appDirectory, serverRuntimePath)}`;
8
+ relativeRuntimePath = 'win32' === __rspack_external_os.platform() ? `../${__rspack_external_path.relative(appDirectory, serverRuntimePath)}` : __rspack_external_path.join('../', __rspack_external_path.relative(appDirectory, serverRuntimePath));
9
+ if ('development' === process.env.NODE_ENV || 'test' === process.env.NODE_ENV) relativeRuntimePath = `./${__rspack_external_path.relative(appDirectory, serverRuntimePath)}`;
10
10
  return relativeRuntimePath;
11
11
  };
12
12
  const sortByLongestPrefix = (arr)=>arr.concat().sort((a, b)=>b.length - a.length);
@@ -23,7 +23,7 @@ const createMatchPath = (paths)=>{
23
23
  if (!Array.isArray(foundPaths)) foundPaths = [
24
24
  foundPaths
25
25
  ];
26
- foundPaths = foundPaths.filter((foundPath)=>isAbsolute(foundPath));
26
+ foundPaths = foundPaths.filter((foundPath)=>__rspack_external_path.isAbsolute(foundPath));
27
27
  for (const p of foundPaths){
28
28
  const foundPath = request.replace(found, p);
29
29
  if (fs.existsSync(foundPath)) return foundPath;
@@ -1,8 +1,8 @@
1
1
  import "node:module";
2
- import { AsyncLocalStorage } from "async_hooks";
2
+ import * as __rspack_external_async_hooks from "async_hooks";
3
3
  const createStorage = ()=>{
4
4
  let storage;
5
- if (void 0 !== AsyncLocalStorage) storage = new AsyncLocalStorage();
5
+ if (void 0 !== __rspack_external_async_hooks.AsyncLocalStorage) storage = new __rspack_external_async_hooks.AsyncLocalStorage();
6
6
  const run = (context, cb)=>{
7
7
  if (!storage) throw new Error(`Unable to use async_hook, please confirm the node version >= 12.17
8
8
  `);
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.1.1",
18
+ "version": "3.1.3",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "main": "./dist/cjs/index.js",
21
21
  "exports": {
@@ -33,10 +33,10 @@
33
33
  "koa-compose": "^4.1.0",
34
34
  "reflect-metadata": "^0.2.2",
35
35
  "type-fest": "2.19.0",
36
- "@modern-js/utils": "3.1.1"
36
+ "@modern-js/utils": "3.1.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@rslib/core": "0.20.0",
39
+ "@rslib/core": "0.21.0",
40
40
  "@types/koa-compose": "^3.2.9",
41
41
  "@types/node": "^20",
42
42
  "ts-node": "^10.9.2",
@@ -44,7 +44,7 @@
44
44
  "typescript": "^5",
45
45
  "zod": "^3.25.76",
46
46
  "@modern-js/rslib": "2.68.10",
47
- "@modern-js/types": "3.1.1",
47
+ "@modern-js/types": "3.1.3",
48
48
  "@scripts/rstest-config": "2.66.0"
49
49
  },
50
50
  "peerDependencies": {