@bleedingdev/modern-js-plugin-bff-build-extensions 3.9.0-ultramodern.11 → 3.9.0-ultramodern.13
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/cjs/client-artifacts.js +7 -4
- package/dist/cjs/hono-client-codegen.js +7 -17
- package/dist/cjs/index.js +15 -8
- package/dist/esm/client-artifacts.mjs +8 -5
- package/dist/esm/hono-client-codegen.mjs +8 -8
- package/dist/esm/index.mjs +15 -8
- package/dist/esm-node/client-artifacts.mjs +8 -5
- package/dist/esm-node/hono-client-codegen.mjs +9 -10
- package/dist/esm-node/index.mjs +15 -8
- package/package.json +23 -23
- package/src/client-artifacts.ts +5 -7
- package/src/hono-client-codegen.ts +6 -10
- package/src/index.ts +8 -10
|
@@ -33,7 +33,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
33
33
|
});
|
|
34
34
|
const bff_core_namespaceObject = require("@modern-js/bff-core");
|
|
35
35
|
const node_namespaceObject = require("@modern-js/server-runtime-extensions/bff-policy/node");
|
|
36
|
-
const utils_namespaceObject = require("@modern-js/utils");
|
|
37
36
|
const BFF_REQUEST_RUNTIME = '@modern-js/runtime-extensions/request-policy';
|
|
38
37
|
function registerBffClientArtifacts(api, metadata) {
|
|
39
38
|
api.modifyBffClientArtifacts(async (context)=>{
|
|
@@ -68,11 +67,15 @@ function registerBffClientArtifacts(api, metadata) {
|
|
|
68
67
|
httpMethodDecider: generation.httpMethodDecider,
|
|
69
68
|
isBuild: true
|
|
70
69
|
});
|
|
71
|
-
const packageJson = await utils_namespaceObject.fs.readJSON(utils_namespaceObject.upath.join(generation.appDirectory, 'package.json'));
|
|
72
70
|
const operationContracts = generation.existLambda ? (0, node_namespaceObject.buildOperationContractMap)({
|
|
73
71
|
handlers: await router.getApiHandlers(),
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
...(0, node_namespaceObject.resolveOperationProducer)({
|
|
73
|
+
directories: [
|
|
74
|
+
generation.apiDirectory,
|
|
75
|
+
generation.appDirectory
|
|
76
|
+
],
|
|
77
|
+
requestId: generation.requestId || 'default'
|
|
78
|
+
})
|
|
76
79
|
}) : {};
|
|
77
80
|
metadata.set(generation, {
|
|
78
81
|
runtimeFramework: 'hono',
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
3
|
(()=>{
|
|
13
4
|
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
5
|
var define = (defs, kind)=>{
|
|
@@ -39,19 +30,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
39
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
40
31
|
modifyClient: ()=>modifyClient
|
|
41
32
|
});
|
|
42
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
43
|
-
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
44
33
|
const node_namespaceObject = require("@modern-js/server-runtime-extensions/bff-policy/node");
|
|
45
34
|
const REQUEST_RUNTIME = '@modern-js/runtime-extensions/request-policy';
|
|
46
35
|
const modifyClient = (draft, context)=>{
|
|
47
36
|
const { appDir, requestId } = context.options;
|
|
48
37
|
draft.requestCreator = context.options.requestCreator || REQUEST_RUNTIME;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
const { operationVersion, requestId: normalizedRequestId } = (0, node_namespaceObject.resolveOperationProducer)({
|
|
39
|
+
directories: [
|
|
40
|
+
context.options.apiDir,
|
|
41
|
+
appDir
|
|
42
|
+
],
|
|
43
|
+
requestId: requestId || 'default'
|
|
44
|
+
});
|
|
55
45
|
const operationContracts = (0, node_namespaceObject.buildOperationContractMap)({
|
|
56
46
|
handlers: [
|
|
57
47
|
...context.handlerInfos
|
package/dist/cjs/index.js
CHANGED
|
@@ -70,19 +70,26 @@ const bffPlugin = ()=>({
|
|
|
70
70
|
const nativePlugins = plugins.filter((plugin)=>'@modern-js/plugin-bff/server-plugin' === plugin.name);
|
|
71
71
|
if (1 !== nativePlugins.length) throw new Error('Expected exactly one native BFF server plugin.');
|
|
72
72
|
const native = nativePlugins[0];
|
|
73
|
-
const runtimeAdapters = native.options?.runtimeAdapters ?? {};
|
|
74
|
-
const effect = '@modern-js/plugin-bff-extensions/effect-adapter';
|
|
75
73
|
const honoRouteBinder = '@modern-js/plugin-bff-extensions/hono/node';
|
|
76
74
|
if (native.options?.honoRouteBinder !== void 0 && native.options.honoRouteBinder !== honoRouteBinder) throw new Error('The Hono BFF route binder is already configured.');
|
|
77
|
-
if (
|
|
75
|
+
if ('hono' !== runtimeFramework) {
|
|
76
|
+
plugins.splice(plugins.indexOf(native), 1, {
|
|
77
|
+
name: '@modern-js/plugin-bff-extensions/effect-server'
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
plugins
|
|
81
|
+
};
|
|
82
|
+
}
|
|
78
83
|
native.options = {
|
|
79
84
|
...native.options,
|
|
80
|
-
honoRouteBinder
|
|
81
|
-
runtimeAdapters: {
|
|
82
|
-
...runtimeAdapters,
|
|
83
|
-
effect
|
|
84
|
-
}
|
|
85
|
+
honoRouteBinder
|
|
85
86
|
};
|
|
87
|
+
native.includeEntries = [
|
|
88
|
+
...new Set([
|
|
89
|
+
...native.includeEntries ?? [],
|
|
90
|
+
honoRouteBinder
|
|
91
|
+
])
|
|
92
|
+
];
|
|
86
93
|
return {
|
|
87
94
|
plugins
|
|
88
95
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ApiRouter } from "@modern-js/bff-core";
|
|
2
|
-
import { buildOperationContractMap,
|
|
3
|
-
import { fs, upath } from "@modern-js/utils";
|
|
2
|
+
import { buildOperationContractMap, resolveOperationProducer } from "@modern-js/server-runtime-extensions/bff-policy/node";
|
|
4
3
|
const BFF_REQUEST_RUNTIME = '@modern-js/runtime-extensions/request-policy';
|
|
5
4
|
function registerBffClientArtifacts(api, metadata) {
|
|
6
5
|
api.modifyBffClientArtifacts(async (context)=>{
|
|
@@ -35,11 +34,15 @@ function registerBffClientArtifacts(api, metadata) {
|
|
|
35
34
|
httpMethodDecider: generation.httpMethodDecider,
|
|
36
35
|
isBuild: true
|
|
37
36
|
});
|
|
38
|
-
const packageJson = await fs.readJSON(upath.join(generation.appDirectory, 'package.json'));
|
|
39
37
|
const operationContracts = generation.existLambda ? buildOperationContractMap({
|
|
40
38
|
handlers: await router.getApiHandlers(),
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
...resolveOperationProducer({
|
|
40
|
+
directories: [
|
|
41
|
+
generation.apiDirectory,
|
|
42
|
+
generation.appDirectory
|
|
43
|
+
],
|
|
44
|
+
requestId: generation.requestId || 'default'
|
|
45
|
+
})
|
|
43
46
|
}) : {};
|
|
44
47
|
metadata.set(generation, {
|
|
45
48
|
runtimeFramework: 'hono',
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { buildOperationContractMap, createOperationSchemaHash, deriveOperationVersion } from "@modern-js/server-runtime-extensions/bff-policy/node";
|
|
1
|
+
import { buildOperationContractMap, createOperationSchemaHash, resolveOperationProducer } from "@modern-js/server-runtime-extensions/bff-policy/node";
|
|
3
2
|
const REQUEST_RUNTIME = '@modern-js/runtime-extensions/request-policy';
|
|
4
3
|
const modifyClient = (draft, context)=>{
|
|
5
4
|
const { appDir, requestId } = context.options;
|
|
6
5
|
draft.requestCreator = context.options.requestCreator || REQUEST_RUNTIME;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const { operationVersion, requestId: normalizedRequestId } = resolveOperationProducer({
|
|
7
|
+
directories: [
|
|
8
|
+
context.options.apiDir,
|
|
9
|
+
appDir
|
|
10
|
+
],
|
|
11
|
+
requestId: requestId || 'default'
|
|
12
|
+
});
|
|
13
13
|
const operationContracts = buildOperationContractMap({
|
|
14
14
|
handlers: [
|
|
15
15
|
...context.handlerInfos
|
package/dist/esm/index.mjs
CHANGED
|
@@ -37,19 +37,26 @@ const src_bffPlugin = ()=>({
|
|
|
37
37
|
const nativePlugins = plugins.filter((plugin)=>'@modern-js/plugin-bff/server-plugin' === plugin.name);
|
|
38
38
|
if (1 !== nativePlugins.length) throw new Error('Expected exactly one native BFF server plugin.');
|
|
39
39
|
const native = nativePlugins[0];
|
|
40
|
-
const runtimeAdapters = native.options?.runtimeAdapters ?? {};
|
|
41
|
-
const effect = '@modern-js/plugin-bff-extensions/effect-adapter';
|
|
42
40
|
const honoRouteBinder = '@modern-js/plugin-bff-extensions/hono/node';
|
|
43
41
|
if (native.options?.honoRouteBinder !== void 0 && native.options.honoRouteBinder !== honoRouteBinder) throw new Error('The Hono BFF route binder is already configured.');
|
|
44
|
-
if (
|
|
42
|
+
if ('hono' !== runtimeFramework) {
|
|
43
|
+
plugins.splice(plugins.indexOf(native), 1, {
|
|
44
|
+
name: '@modern-js/plugin-bff-extensions/effect-server'
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
plugins
|
|
48
|
+
};
|
|
49
|
+
}
|
|
45
50
|
native.options = {
|
|
46
51
|
...native.options,
|
|
47
|
-
honoRouteBinder
|
|
48
|
-
runtimeAdapters: {
|
|
49
|
-
...runtimeAdapters,
|
|
50
|
-
effect
|
|
51
|
-
}
|
|
52
|
+
honoRouteBinder
|
|
52
53
|
};
|
|
54
|
+
native.includeEntries = [
|
|
55
|
+
...new Set([
|
|
56
|
+
...native.includeEntries ?? [],
|
|
57
|
+
honoRouteBinder
|
|
58
|
+
])
|
|
59
|
+
];
|
|
53
60
|
return {
|
|
54
61
|
plugins
|
|
55
62
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { ApiRouter } from "@modern-js/bff-core";
|
|
3
|
-
import { buildOperationContractMap,
|
|
4
|
-
import { fs, upath } from "@modern-js/utils";
|
|
3
|
+
import { buildOperationContractMap, resolveOperationProducer } from "@modern-js/server-runtime-extensions/bff-policy/node";
|
|
5
4
|
const BFF_REQUEST_RUNTIME = '@modern-js/runtime-extensions/request-policy';
|
|
6
5
|
function registerBffClientArtifacts(api, metadata) {
|
|
7
6
|
api.modifyBffClientArtifacts(async (context)=>{
|
|
@@ -36,11 +35,15 @@ function registerBffClientArtifacts(api, metadata) {
|
|
|
36
35
|
httpMethodDecider: generation.httpMethodDecider,
|
|
37
36
|
isBuild: true
|
|
38
37
|
});
|
|
39
|
-
const packageJson = await fs.readJSON(upath.join(generation.appDirectory, 'package.json'));
|
|
40
38
|
const operationContracts = generation.existLambda ? buildOperationContractMap({
|
|
41
39
|
handlers: await router.getApiHandlers(),
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
...resolveOperationProducer({
|
|
41
|
+
directories: [
|
|
42
|
+
generation.apiDirectory,
|
|
43
|
+
generation.appDirectory
|
|
44
|
+
],
|
|
45
|
+
requestId: generation.requestId || 'default'
|
|
46
|
+
})
|
|
44
47
|
}) : {};
|
|
45
48
|
metadata.set(generation, {
|
|
46
49
|
runtimeFramework: 'hono',
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import node_path from "node:path";
|
|
4
|
-
import { buildOperationContractMap, createOperationSchemaHash, deriveOperationVersion } from "@modern-js/server-runtime-extensions/bff-policy/node";
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { buildOperationContractMap, createOperationSchemaHash, resolveOperationProducer } from "@modern-js/server-runtime-extensions/bff-policy/node";
|
|
5
3
|
const REQUEST_RUNTIME = '@modern-js/runtime-extensions/request-policy';
|
|
6
4
|
const modifyClient = (draft, context)=>{
|
|
7
5
|
const { appDir, requestId } = context.options;
|
|
8
6
|
draft.requestCreator = context.options.requestCreator || REQUEST_RUNTIME;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
const { operationVersion, requestId: normalizedRequestId } = resolveOperationProducer({
|
|
8
|
+
directories: [
|
|
9
|
+
context.options.apiDir,
|
|
10
|
+
appDir
|
|
11
|
+
],
|
|
12
|
+
requestId: requestId || 'default'
|
|
13
|
+
});
|
|
15
14
|
const operationContracts = buildOperationContractMap({
|
|
16
15
|
handlers: [
|
|
17
16
|
...context.handlerInfos
|
package/dist/esm-node/index.mjs
CHANGED
|
@@ -39,19 +39,26 @@ const src_bffPlugin = ()=>({
|
|
|
39
39
|
const nativePlugins = plugins.filter((plugin)=>'@modern-js/plugin-bff/server-plugin' === plugin.name);
|
|
40
40
|
if (1 !== nativePlugins.length) throw new Error('Expected exactly one native BFF server plugin.');
|
|
41
41
|
const native = nativePlugins[0];
|
|
42
|
-
const runtimeAdapters = native.options?.runtimeAdapters ?? {};
|
|
43
|
-
const effect = '@modern-js/plugin-bff-extensions/effect-adapter';
|
|
44
42
|
const honoRouteBinder = '@modern-js/plugin-bff-extensions/hono/node';
|
|
45
43
|
if (native.options?.honoRouteBinder !== void 0 && native.options.honoRouteBinder !== honoRouteBinder) throw new Error('The Hono BFF route binder is already configured.');
|
|
46
|
-
if (
|
|
44
|
+
if ('hono' !== runtimeFramework) {
|
|
45
|
+
plugins.splice(plugins.indexOf(native), 1, {
|
|
46
|
+
name: '@modern-js/plugin-bff-extensions/effect-server'
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
plugins
|
|
50
|
+
};
|
|
51
|
+
}
|
|
47
52
|
native.options = {
|
|
48
53
|
...native.options,
|
|
49
|
-
honoRouteBinder
|
|
50
|
-
runtimeAdapters: {
|
|
51
|
-
...runtimeAdapters,
|
|
52
|
-
effect
|
|
53
|
-
}
|
|
54
|
+
honoRouteBinder
|
|
54
55
|
};
|
|
56
|
+
native.includeEntries = [
|
|
57
|
+
...new Set([
|
|
58
|
+
...native.includeEntries ?? [],
|
|
59
|
+
honoRouteBinder
|
|
60
|
+
])
|
|
61
|
+
];
|
|
55
62
|
return {
|
|
56
63
|
plugins
|
|
57
64
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://github.com/BleedingDev/ultramodern.js/issues"
|
|
5
5
|
},
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"version": "3.9.0-ultramodern.
|
|
7
|
+
"version": "3.9.0-ultramodern.13",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
10
|
"src"
|
|
@@ -65,19 +65,19 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@modern-js/bff-core": "npm:@bleedingdev/modern-js-bff-core@3.9.0-ultramodern.
|
|
69
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.
|
|
70
|
-
"@modern-js/plugin-bff": "npm:@bleedingdev/modern-js-plugin-bff@3.9.0-ultramodern.
|
|
71
|
-
"@modern-js/plugin-bff-extensions": "npm:@bleedingdev/modern-js-plugin-bff-extensions@3.9.0-ultramodern.
|
|
72
|
-
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.
|
|
73
|
-
"@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.
|
|
74
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.
|
|
68
|
+
"@modern-js/bff-core": "npm:@bleedingdev/modern-js-bff-core@3.9.0-ultramodern.13",
|
|
69
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.13",
|
|
70
|
+
"@modern-js/plugin-bff": "npm:@bleedingdev/modern-js-plugin-bff@3.9.0-ultramodern.13",
|
|
71
|
+
"@modern-js/plugin-bff-extensions": "npm:@bleedingdev/modern-js-plugin-bff-extensions@3.9.0-ultramodern.13",
|
|
72
|
+
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.13",
|
|
73
|
+
"@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.13",
|
|
74
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.13",
|
|
75
75
|
"@swc/core": "1.16.2"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@effect/opentelemetry": "4.0.0-rc.
|
|
79
|
-
"@modern-js/app-tools": "3.9.0-ultramodern.
|
|
80
|
-
"effect": "4.0.0-rc.
|
|
78
|
+
"@effect/opentelemetry": "4.0.0-rc.117",
|
|
79
|
+
"@modern-js/app-tools": "3.9.0-ultramodern.13",
|
|
80
|
+
"effect": "4.0.0-rc.117"
|
|
81
81
|
},
|
|
82
82
|
"peerDependenciesMeta": {
|
|
83
83
|
"@effect/opentelemetry": {
|
|
@@ -88,21 +88,21 @@
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
|
-
"@effect/opentelemetry": "4.0.0-rc.
|
|
92
|
-
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.
|
|
93
|
-
"@modern-js/bff-effect": "npm:@bleedingdev/modern-js-bff-effect@3.9.0-ultramodern.
|
|
94
|
-
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.
|
|
95
|
-
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.
|
|
96
|
-
"@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.0-ultramodern.
|
|
97
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.
|
|
98
|
-
"@rsbuild/core": "2.2.
|
|
99
|
-
"@rslib/core": "1.0.
|
|
91
|
+
"@effect/opentelemetry": "4.0.0-rc.117",
|
|
92
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.13",
|
|
93
|
+
"@modern-js/bff-effect": "npm:@bleedingdev/modern-js-bff-effect@3.9.0-ultramodern.13",
|
|
94
|
+
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.13",
|
|
95
|
+
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.13",
|
|
96
|
+
"@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.0-ultramodern.13",
|
|
97
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.13",
|
|
98
|
+
"@rsbuild/core": "2.2.9",
|
|
99
|
+
"@rslib/core": "1.0.2",
|
|
100
100
|
"@scripts/rstest-config": "2.66.0",
|
|
101
|
-
"@types/node": "^26.
|
|
101
|
+
"@types/node": "^26.6.2",
|
|
102
102
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
103
|
-
"effect": "4.0.0-rc.
|
|
103
|
+
"effect": "npm:@bleedingdev/effect@4.0.0-rc.117",
|
|
104
104
|
"esbuild": "^0.28.2",
|
|
105
|
-
"zod": "
|
|
105
|
+
"zod": "npm:@bleedingdev/zod@4.6.5"
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
108
|
"dev": "rslib build --watch",
|
package/src/client-artifacts.ts
CHANGED
|
@@ -7,10 +7,9 @@ import { ApiRouter } from '@modern-js/bff-core';
|
|
|
7
7
|
import type { CLIPluginAPI } from '@modern-js/plugin';
|
|
8
8
|
import {
|
|
9
9
|
buildOperationContractMap,
|
|
10
|
-
deriveOperationVersion,
|
|
11
10
|
type OperationContractMap,
|
|
11
|
+
resolveOperationProducer,
|
|
12
12
|
} from '@modern-js/server-runtime-extensions/bff-policy/node';
|
|
13
|
-
import { fs, upath as path } from '@modern-js/utils';
|
|
14
13
|
|
|
15
14
|
export const BFF_REQUEST_RUNTIME =
|
|
16
15
|
'@modern-js/runtime-extensions/request-policy';
|
|
@@ -66,14 +65,13 @@ export function registerBffClientArtifacts(
|
|
|
66
65
|
httpMethodDecider: generation.httpMethodDecider,
|
|
67
66
|
isBuild: true,
|
|
68
67
|
});
|
|
69
|
-
const packageJson = await fs.readJSON(
|
|
70
|
-
path.join(generation.appDirectory, 'package.json'),
|
|
71
|
-
);
|
|
72
68
|
const operationContracts = generation.existLambda
|
|
73
69
|
? buildOperationContractMap({
|
|
74
70
|
handlers: await router.getApiHandlers(),
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
...resolveOperationProducer({
|
|
72
|
+
directories: [generation.apiDirectory, generation.appDirectory],
|
|
73
|
+
requestId: generation.requestId || 'default',
|
|
74
|
+
}),
|
|
77
75
|
})
|
|
78
76
|
: {};
|
|
79
77
|
metadata.set(generation, {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
1
|
import type { ClientCodegenPlugin } from '@modern-js/bff-core';
|
|
3
2
|
import {
|
|
4
3
|
buildOperationContractMap,
|
|
5
4
|
createOperationSchemaHash,
|
|
6
|
-
|
|
5
|
+
resolveOperationProducer,
|
|
7
6
|
} from '@modern-js/server-runtime-extensions/bff-policy/node';
|
|
8
7
|
|
|
9
8
|
const REQUEST_RUNTIME = '@modern-js/runtime-extensions/request-policy';
|
|
@@ -11,14 +10,11 @@ const REQUEST_RUNTIME = '@modern-js/runtime-extensions/request-policy';
|
|
|
11
10
|
export const modifyClient: ClientCodegenPlugin = (draft, context) => {
|
|
12
11
|
const { appDir, requestId } = context.options;
|
|
13
12
|
draft.requestCreator = context.options.requestCreator || REQUEST_RUNTIME;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
const operationVersion = deriveOperationVersion(version);
|
|
21
|
-
const normalizedRequestId = requestId || 'default';
|
|
13
|
+
const { operationVersion, requestId: normalizedRequestId } =
|
|
14
|
+
resolveOperationProducer({
|
|
15
|
+
directories: [context.options.apiDir, appDir],
|
|
16
|
+
requestId: requestId || 'default',
|
|
17
|
+
});
|
|
22
18
|
const operationContracts = buildOperationContractMap({
|
|
23
19
|
handlers: [...context.handlerInfos],
|
|
24
20
|
requestId: normalizedRequestId,
|
package/src/index.ts
CHANGED
|
@@ -50,8 +50,6 @@ export const bffPlugin = (): CliPlugin<AppTools> => ({
|
|
|
50
50
|
throw new Error('Expected exactly one native BFF server plugin.');
|
|
51
51
|
}
|
|
52
52
|
const native = nativePlugins[0]!;
|
|
53
|
-
const runtimeAdapters = native.options?.runtimeAdapters ?? {};
|
|
54
|
-
const effect = '@modern-js/plugin-bff-extensions/effect-adapter';
|
|
55
53
|
const honoRouteBinder = '@modern-js/plugin-bff-extensions/hono/node';
|
|
56
54
|
if (
|
|
57
55
|
native.options?.honoRouteBinder !== undefined &&
|
|
@@ -59,19 +57,19 @@ export const bffPlugin = (): CliPlugin<AppTools> => ({
|
|
|
59
57
|
) {
|
|
60
58
|
throw new Error('The Hono BFF route binder is already configured.');
|
|
61
59
|
}
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
'The Effect BFF runtime adapter is already configured.',
|
|
68
|
-
);
|
|
60
|
+
if (runtimeFramework !== 'hono') {
|
|
61
|
+
plugins.splice(plugins.indexOf(native), 1, {
|
|
62
|
+
name: '@modern-js/plugin-bff-extensions/effect-server',
|
|
63
|
+
});
|
|
64
|
+
return { plugins };
|
|
69
65
|
}
|
|
70
66
|
native.options = {
|
|
71
67
|
...native.options,
|
|
72
68
|
honoRouteBinder,
|
|
73
|
-
runtimeAdapters: { ...runtimeAdapters, effect },
|
|
74
69
|
};
|
|
70
|
+
native.includeEntries = [
|
|
71
|
+
...new Set([...(native.includeEntries ?? []), honoRouteBinder]),
|
|
72
|
+
];
|
|
75
73
|
return { plugins };
|
|
76
74
|
});
|
|
77
75
|
const metadata = new WeakMap<BffGeneration, BffGenerationMetadata>();
|