@modern-js/bff-core 3.1.0 → 3.1.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/dist/esm/client/generateClient.mjs +2 -2
- package/dist/esm/index.mjs +3 -4
- package/dist/esm/types.mjs +1 -1
- package/dist/esm/utils/alias.mjs +5 -5
- package/dist/esm/utils/index.mjs +1 -2
- package/dist/esm/utils/storage.mjs +2 -2
- package/dist/esm-node/client/generateClient.mjs +2 -2
- package/dist/esm-node/index.mjs +3 -4
- package/dist/esm-node/types.mjs +1 -1
- package/dist/esm-node/utils/alias.mjs +5 -5
- package/dist/esm-node/utils/index.mjs +1 -2
- package/dist/esm-node/utils/storage.mjs +2 -2
- package/package.json +5 -5
- /package/{rstest.config.ts → rstest.config.mts} +0 -0
|
@@ -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) {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Api } from "./api.mjs";
|
|
2
|
-
import { HttpError, ValidationError } from "./errors/http.mjs";
|
|
3
|
-
import { HANDLER_WITH_META, INPUT_PARAMS_DECIDER, createStorage, getRelativeRuntimePath, isInputParamsDeciderHandler, isWithMetaHandler, registerPaths } from "./utils/index.mjs";
|
|
4
1
|
export * from "./router/index.mjs";
|
|
5
2
|
export * from "./types.mjs";
|
|
6
3
|
export * from "./client/index.mjs";
|
|
7
4
|
export * from "./operators/http.mjs";
|
|
8
|
-
export { Api
|
|
5
|
+
export { Api } from "./api.mjs";
|
|
6
|
+
export { HttpError, ValidationError } from "./errors/http.mjs";
|
|
7
|
+
export { HANDLER_WITH_META, INPUT_PARAMS_DECIDER, createStorage, getRelativeRuntimePath, isInputParamsDeciderHandler, isWithMetaHandler, registerPaths } from "./utils/index.mjs";
|
package/dist/esm/types.mjs
CHANGED
|
@@ -36,4 +36,4 @@ var types_HttpMethod = /*#__PURE__*/ function(HttpMethod) {
|
|
|
36
36
|
return HttpMethod;
|
|
37
37
|
}({});
|
|
38
38
|
const httpMethods = Object.values(types_HttpMethod);
|
|
39
|
-
export { types_HttpMetadata as HttpMetadata, types_HttpMethod as HttpMethod, types_OperatorType as OperatorType, types_ResponseMetaType as ResponseMetaType, types_TriggerType as TriggerType
|
|
39
|
+
export { httpMethods, types_HttpMetadata as HttpMetadata, types_HttpMethod as HttpMethod, types_OperatorType as OperatorType, types_ResponseMetaType as ResponseMetaType, types_TriggerType as TriggerType };
|
package/dist/esm/utils/alias.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import module_0 from "module";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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;
|
package/dist/esm/utils/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
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) {
|
package/dist/esm-node/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { Api } from "./api.mjs";
|
|
3
|
-
import { HttpError, ValidationError } from "./errors/http.mjs";
|
|
4
|
-
import { HANDLER_WITH_META, INPUT_PARAMS_DECIDER, createStorage, getRelativeRuntimePath, isInputParamsDeciderHandler, isWithMetaHandler, registerPaths } from "./utils/index.mjs";
|
|
5
2
|
export * from "./router/index.mjs";
|
|
6
3
|
export * from "./types.mjs";
|
|
7
4
|
export * from "./client/index.mjs";
|
|
8
5
|
export * from "./operators/http.mjs";
|
|
9
|
-
export { Api
|
|
6
|
+
export { Api } from "./api.mjs";
|
|
7
|
+
export { HttpError, ValidationError } from "./errors/http.mjs";
|
|
8
|
+
export { HANDLER_WITH_META, INPUT_PARAMS_DECIDER, createStorage, getRelativeRuntimePath, isInputParamsDeciderHandler, isWithMetaHandler, registerPaths } from "./utils/index.mjs";
|
package/dist/esm-node/types.mjs
CHANGED
|
@@ -37,4 +37,4 @@ var types_HttpMethod = /*#__PURE__*/ function(HttpMethod) {
|
|
|
37
37
|
return HttpMethod;
|
|
38
38
|
}({});
|
|
39
39
|
const httpMethods = Object.values(types_HttpMethod);
|
|
40
|
-
export { types_HttpMetadata as HttpMetadata, types_HttpMethod as HttpMethod, types_OperatorType as OperatorType, types_ResponseMetaType as ResponseMetaType, types_TriggerType as TriggerType
|
|
40
|
+
export { httpMethods, types_HttpMetadata as HttpMetadata, types_HttpMethod as HttpMethod, types_OperatorType as OperatorType, types_ResponseMetaType as ResponseMetaType, types_TriggerType as TriggerType };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import module_0 from "module";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
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
|
|
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.
|
|
18
|
+
"version": "3.1.2",
|
|
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.
|
|
36
|
+
"@modern-js/utils": "3.1.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@rslib/core": "0.
|
|
39
|
+
"@rslib/core": "0.20.3",
|
|
40
40
|
"@types/koa-compose": "^3.2.9",
|
|
41
41
|
"@types/node": "^20",
|
|
42
42
|
"ts-node": "^10.9.2",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"typescript": "^5",
|
|
45
45
|
"zod": "^3.25.76",
|
|
46
46
|
"@modern-js/rslib": "2.68.10",
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
47
|
+
"@modern-js/types": "3.1.2",
|
|
48
|
+
"@scripts/rstest-config": "2.66.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"ts-node": "^10.9.2",
|
|
File without changes
|