@modern-js/plugin-bff 2.69.5 → 3.0.0-alpha.0

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.
Files changed (76) hide show
  1. package/dist/cjs/cli.js +256 -272
  2. package/dist/cjs/constants.js +43 -34
  3. package/dist/cjs/index.js +55 -19
  4. package/dist/cjs/loader.js +69 -65
  5. package/dist/cjs/runtime/create-request/index.js +39 -29
  6. package/dist/cjs/runtime/hono/adapter.js +128 -126
  7. package/dist/cjs/runtime/hono/index.js +78 -30
  8. package/dist/cjs/runtime/hono/operators.js +64 -67
  9. package/dist/cjs/server.js +159 -165
  10. package/dist/cjs/utils/clientGenerator.js +204 -206
  11. package/dist/cjs/utils/createHonoRoutes.js +128 -144
  12. package/dist/cjs/utils/crossProjectApiPlugin.js +91 -81
  13. package/dist/cjs/utils/pluginGenerator.js +66 -54
  14. package/dist/cjs/utils/runtimeGenerator.js +67 -45
  15. package/dist/esm/cli.mjs +214 -0
  16. package/dist/esm/constants.mjs +11 -0
  17. package/dist/esm/loader.mjs +39 -0
  18. package/dist/esm/runtime/create-request/{index.js → index.mjs} +1 -5
  19. package/dist/esm/runtime/hono/adapter.mjs +95 -0
  20. package/dist/{esm-node/runtime/hono/index.js → esm/runtime/hono/index.mjs} +2 -4
  21. package/dist/esm/runtime/hono/operators.mjs +31 -0
  22. package/dist/esm/server.mjs +122 -0
  23. package/dist/esm/utils/clientGenerator.mjs +175 -0
  24. package/dist/esm/utils/createHonoRoutes.mjs +91 -0
  25. package/dist/esm/utils/crossProjectApiPlugin.mjs +34 -0
  26. package/dist/esm/utils/pluginGenerator.mjs +29 -0
  27. package/dist/esm/utils/runtimeGenerator.mjs +43 -0
  28. package/dist/esm-node/cli.mjs +214 -0
  29. package/dist/esm-node/constants.mjs +11 -0
  30. package/dist/esm-node/index.mjs +1 -0
  31. package/dist/esm-node/loader.mjs +39 -0
  32. package/dist/esm-node/runtime/create-request/{index.js → index.mjs} +1 -5
  33. package/dist/esm-node/runtime/hono/adapter.mjs +95 -0
  34. package/dist/{esm/runtime/hono/index.js → esm-node/runtime/hono/index.mjs} +3 -5
  35. package/dist/esm-node/runtime/hono/operators.mjs +31 -0
  36. package/dist/esm-node/server.mjs +122 -0
  37. package/dist/esm-node/utils/clientGenerator.mjs +175 -0
  38. package/dist/esm-node/utils/createHonoRoutes.mjs +91 -0
  39. package/dist/esm-node/utils/crossProjectApiPlugin.mjs +34 -0
  40. package/dist/esm-node/utils/pluginGenerator.mjs +29 -0
  41. package/dist/esm-node/utils/runtimeGenerator.mjs +43 -0
  42. package/dist/types/loader.d.ts +2 -2
  43. package/dist/types/runtime/hono/adapter.d.ts +3 -3
  44. package/dist/types/server.d.ts +2 -2
  45. package/dist/types/utils/runtimeGenerator.d.ts +2 -1
  46. package/package.json +53 -31
  47. package/rslib.config.mts +4 -0
  48. package/dist/cjs/helper.js +0 -48
  49. package/dist/esm/cli.js +0 -425
  50. package/dist/esm/constants.js +0 -14
  51. package/dist/esm/helper.js +0 -13
  52. package/dist/esm/index.js +0 -1
  53. package/dist/esm/loader.js +0 -75
  54. package/dist/esm/runtime/hono/adapter.js +0 -243
  55. package/dist/esm/runtime/hono/operators.js +0 -79
  56. package/dist/esm/server.js +0 -258
  57. package/dist/esm/utils/clientGenerator.js +0 -517
  58. package/dist/esm/utils/createHonoRoutes.js +0 -319
  59. package/dist/esm/utils/crossProjectApiPlugin.js +0 -49
  60. package/dist/esm/utils/pluginGenerator.js +0 -94
  61. package/dist/esm/utils/runtimeGenerator.js +0 -55
  62. package/dist/esm-node/cli.js +0 -246
  63. package/dist/esm-node/constants.js +0 -14
  64. package/dist/esm-node/helper.js +0 -14
  65. package/dist/esm-node/loader.js +0 -49
  66. package/dist/esm-node/runtime/hono/adapter.js +0 -103
  67. package/dist/esm-node/runtime/hono/operators.js +0 -46
  68. package/dist/esm-node/server.js +0 -142
  69. package/dist/esm-node/utils/clientGenerator.js +0 -192
  70. package/dist/esm-node/utils/createHonoRoutes.js +0 -120
  71. package/dist/esm-node/utils/crossProjectApiPlugin.js +0 -47
  72. package/dist/esm-node/utils/pluginGenerator.js +0 -31
  73. package/dist/esm-node/utils/runtimeGenerator.js +0 -35
  74. package/dist/types/helper.d.ts +0 -2
  75. package/types.d.ts +0 -3
  76. /package/dist/{esm-node/index.js → esm/index.mjs} +0 -0
@@ -1,227 +1,225 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var clientGenerator_exports = {};
30
- __export(clientGenerator_exports, {
31
- copyFiles: () => copyFiles,
32
- default: () => clientGenerator_default,
33
- readDirectoryFiles: () => readDirectoryFiles
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
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ readDirectoryFiles: ()=>readDirectoryFiles,
37
+ copyFiles: ()=>copyFiles,
38
+ default: ()=>utils_clientGenerator
34
39
  });
35
- module.exports = __toCommonJS(clientGenerator_exports);
36
- var import_path = __toESM(require("path"));
37
- var import_bff_core = require("@modern-js/bff-core");
38
- var import_utils = require("@modern-js/utils");
39
- const API_DIR = "api";
40
- const PLUGIN_DIR = "plugin";
41
- const RUNTIME_DIR = "runtime";
42
- const CLIENT_DIR = "client";
40
+ const external_path_namespaceObject = require("path");
41
+ var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
42
+ const bff_core_namespaceObject = require("@modern-js/bff-core");
43
+ const utils_namespaceObject = require("@modern-js/utils");
44
+ const API_DIR = 'api';
45
+ const PLUGIN_DIR = 'plugin';
46
+ const RUNTIME_DIR = 'runtime';
47
+ const CLIENT_DIR = 'client';
43
48
  const EXPORT_PREFIX = `./${API_DIR}/`;
44
49
  const TYPE_PREFIX = `${API_DIR}/`;
45
- const toPosixPath = (p) => p.replace(/\\/g, "/");
46
- const posixJoin = (...args) => toPosixPath(import_path.default.join(...args));
50
+ const toPosixPath = (p)=>p.replace(/\\/g, '/');
51
+ const posixJoin = (...args)=>toPosixPath(external_path_default().join(...args));
47
52
  async function readDirectoryFiles(appDirectory, directory, relativeDistPath) {
48
- const filesList = [];
49
- async function readFiles(currentPath) {
50
- const entries = await import_utils.fs.readdir(currentPath, {
51
- withFileTypes: true
52
- });
53
- for (const entry of entries) {
54
- if (entry.name === "_app.ts")
55
- continue;
56
- const resourcePath = import_path.default.join(currentPath, entry.name);
57
- if (entry.isDirectory()) {
58
- await readFiles(resourcePath);
59
- } else {
60
- const source = await import_utils.fs.readFile(resourcePath, "utf8");
61
- const relativePath = import_path.default.relative(directory, resourcePath);
62
- const parsedPath = import_path.default.parse(relativePath);
63
- const targetDir = posixJoin(`./${relativeDistPath}/${CLIENT_DIR}`, parsedPath.dir, `${parsedPath.name}.js`);
64
- const name = parsedPath.name;
65
- const absTargetDir = import_path.default.resolve(targetDir);
66
- const relativePathFromAppDirectory = import_path.default.relative(appDirectory, currentPath);
67
- const typesFilePath = posixJoin(`./${relativeDistPath}`, relativePathFromAppDirectory, `${name}.d.ts`);
68
- const relativeTargetDistDir = `./${typesFilePath}`;
69
- const exportKey = toPosixPath(import_path.default.join(parsedPath.dir, name));
70
- filesList.push({
71
- resourcePath,
72
- source,
73
- targetDir,
74
- name,
75
- absTargetDir,
76
- relativeTargetDistDir,
77
- exportKey
53
+ const filesList = [];
54
+ async function readFiles(currentPath) {
55
+ const entries = await utils_namespaceObject.fs.readdir(currentPath, {
56
+ withFileTypes: true
78
57
  });
79
- }
58
+ for (const entry of entries){
59
+ if ('_app.ts' === entry.name) continue;
60
+ const resourcePath = external_path_default().join(currentPath, entry.name);
61
+ if (entry.isDirectory()) await readFiles(resourcePath);
62
+ else {
63
+ const source = await utils_namespaceObject.fs.readFile(resourcePath, 'utf8');
64
+ const relativePath = external_path_default().relative(directory, resourcePath);
65
+ const parsedPath = external_path_default().parse(relativePath);
66
+ const targetDir = posixJoin(`./${relativeDistPath}/${CLIENT_DIR}`, parsedPath.dir, `${parsedPath.name}.js`);
67
+ const name = parsedPath.name;
68
+ const absTargetDir = external_path_default().resolve(targetDir);
69
+ const relativePathFromAppDirectory = external_path_default().relative(appDirectory, currentPath);
70
+ const typesFilePath = posixJoin(`./${relativeDistPath}`, relativePathFromAppDirectory, `${name}.d.ts`);
71
+ const relativeTargetDistDir = `./${typesFilePath}`;
72
+ const exportKey = toPosixPath(external_path_default().join(parsedPath.dir, name));
73
+ filesList.push({
74
+ resourcePath,
75
+ source,
76
+ targetDir,
77
+ name,
78
+ absTargetDir,
79
+ relativeTargetDistDir,
80
+ exportKey
81
+ });
82
+ }
83
+ }
80
84
  }
81
- }
82
- await readFiles(directory);
83
- return filesList;
85
+ await readFiles(directory);
86
+ return filesList;
84
87
  }
85
- function mergePackageJson(packageJson, files, typesVersion, exports) {
86
- var _packageJson, _packageJson1;
87
- packageJson.files = [
88
- .../* @__PURE__ */ new Set([
89
- ...packageJson.files || [],
90
- ...files
91
- ])
92
- ];
93
- var _typesVersions;
94
- (_typesVersions = (_packageJson = packageJson).typesVersions) !== null && _typesVersions !== void 0 ? _typesVersions : _packageJson.typesVersions = {};
95
- const starTypes = packageJson.typesVersions["*"] || {};
96
- Object.keys(starTypes).forEach((k) => k.startsWith(TYPE_PREFIX) && delete starTypes[k]);
97
- packageJson.typesVersions["*"] = {
98
- ...starTypes,
99
- ...typesVersion["*"] || {}
100
- };
101
- var _exports;
102
- (_exports = (_packageJson1 = packageJson).exports) !== null && _exports !== void 0 ? _exports : _packageJson1.exports = {};
103
- Object.keys(packageJson.exports).forEach((k) => k.startsWith(EXPORT_PREFIX) && delete packageJson.exports[k]);
104
- Object.assign(packageJson.exports, exports);
88
+ function mergePackageJson(packageJson, files, typesVersion, exports1) {
89
+ packageJson.files = [
90
+ ...new Set([
91
+ ...packageJson.files || [],
92
+ ...files
93
+ ])
94
+ ];
95
+ packageJson.typesVersions ??= {};
96
+ const starTypes = packageJson.typesVersions['*'] || {};
97
+ Object.keys(starTypes).forEach((k)=>k.startsWith(TYPE_PREFIX) && delete starTypes[k]);
98
+ packageJson.typesVersions['*'] = {
99
+ ...starTypes,
100
+ ...typesVersion['*'] || {}
101
+ };
102
+ packageJson.exports ??= {};
103
+ Object.keys(packageJson.exports).forEach((k)=>k.startsWith(EXPORT_PREFIX) && delete packageJson.exports[k]);
104
+ Object.assign(packageJson.exports, exports1);
105
105
  }
106
106
  async function writeTargetFile(absTargetDir, content) {
107
- await import_utils.fs.mkdir(import_path.default.dirname(absTargetDir), {
108
- recursive: true
109
- });
110
- await import_utils.fs.writeFile(absTargetDir, content);
107
+ await utils_namespaceObject.fs.mkdir(external_path_default().dirname(absTargetDir), {
108
+ recursive: true
109
+ });
110
+ await utils_namespaceObject.fs.writeFile(absTargetDir, content);
111
111
  }
112
112
  async function setPackage(files, appDirectory, relativeDistPath) {
113
- try {
114
- const packagePath = import_path.default.resolve(appDirectory, "./package.json");
115
- const packageContent = await import_utils.fs.readFile(packagePath, "utf8");
116
- const packageJson = JSON.parse(packageContent);
117
- const addFiles = [
118
- posixJoin(relativeDistPath, CLIENT_DIR, "**", "*"),
119
- posixJoin(relativeDistPath, RUNTIME_DIR, "**", "*"),
120
- posixJoin(relativeDistPath, PLUGIN_DIR, "**", "*")
121
- ];
122
- const typesVersions = {
123
- "*": files.reduce((acc, file) => {
124
- const typeFilePath = toPosixPath(`./${file.targetDir}`).replace("js", "d.ts");
125
- return {
126
- ...acc,
127
- [toPosixPath(`${TYPE_PREFIX}${file.exportKey}`)]: [
128
- typeFilePath
129
- ]
113
+ try {
114
+ const packagePath = external_path_default().resolve(appDirectory, './package.json');
115
+ const packageContent = await utils_namespaceObject.fs.readFile(packagePath, 'utf8');
116
+ const packageJson = JSON.parse(packageContent);
117
+ const addFiles = [
118
+ posixJoin(relativeDistPath, CLIENT_DIR, '**', '*'),
119
+ posixJoin(relativeDistPath, RUNTIME_DIR, '**', '*'),
120
+ posixJoin(relativeDistPath, PLUGIN_DIR, '**', '*')
121
+ ];
122
+ const typesVersions = {
123
+ '*': files.reduce((acc, file)=>{
124
+ const typeFilePath = toPosixPath(`./${file.targetDir}`).replace('js', 'd.ts');
125
+ return {
126
+ ...acc,
127
+ [toPosixPath(`${TYPE_PREFIX}${file.exportKey}`)]: [
128
+ typeFilePath
129
+ ]
130
+ };
131
+ }, {
132
+ [`${API_DIR}/*`]: [
133
+ toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.d.ts`)
134
+ ],
135
+ [RUNTIME_DIR]: [
136
+ toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.d.ts`)
137
+ ],
138
+ [PLUGIN_DIR]: [
139
+ toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.d.ts`)
140
+ ]
141
+ })
130
142
  };
131
- }, {
132
- [`${API_DIR}/*`]: [
133
- toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.d.ts`)
134
- ],
135
- [RUNTIME_DIR]: [
136
- toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.d.ts`)
137
- ],
138
- [PLUGIN_DIR]: [
139
- toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.d.ts`)
140
- ]
141
- })
142
- };
143
- const exports = files.reduce((acc, file) => {
144
- const exportKey = `${EXPORT_PREFIX}${file.exportKey}`;
145
- const jsFilePath = toPosixPath(`./${file.targetDir}`);
146
- return {
147
- ...acc,
148
- [toPosixPath(exportKey)]: {
149
- import: jsFilePath,
150
- types: toPosixPath(jsFilePath.replace(/\.js$/, ".d.ts"))
151
- }
152
- };
153
- }, {
154
- [toPosixPath(`./${API_DIR}/*`)]: {
155
- import: toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.js`),
156
- types: toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.d.ts`)
157
- },
158
- [toPosixPath(`./${PLUGIN_DIR}`)]: {
159
- import: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.js`),
160
- require: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.js`),
161
- types: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.d.ts`)
162
- },
163
- [toPosixPath(`./${RUNTIME_DIR}`)]: {
164
- import: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.js`),
165
- require: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.js`),
166
- types: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.d.ts`)
167
- }
168
- });
169
- mergePackageJson(packageJson, addFiles, typesVersions, exports);
170
- await import_utils.fs.promises.writeFile(packagePath, JSON.stringify(packageJson, null, 2));
171
- } catch (error) {
172
- import_utils.logger.error(`package.json update failed: ${error}`);
173
- }
143
+ const exports1 = files.reduce((acc, file)=>{
144
+ const exportKey = `${EXPORT_PREFIX}${file.exportKey}`;
145
+ const jsFilePath = toPosixPath(`./${file.targetDir}`);
146
+ return {
147
+ ...acc,
148
+ [toPosixPath(exportKey)]: {
149
+ import: jsFilePath,
150
+ types: toPosixPath(jsFilePath.replace(/\.js$/, '.d.ts'))
151
+ }
152
+ };
153
+ }, {
154
+ [toPosixPath(`./${API_DIR}/*`)]: {
155
+ import: toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.js`),
156
+ types: toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.d.ts`)
157
+ },
158
+ [toPosixPath(`./${PLUGIN_DIR}`)]: {
159
+ import: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.js`),
160
+ require: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.js`),
161
+ types: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.d.ts`)
162
+ },
163
+ [toPosixPath(`./${RUNTIME_DIR}`)]: {
164
+ import: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.js`),
165
+ require: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.js`),
166
+ types: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.d.ts`)
167
+ }
168
+ });
169
+ mergePackageJson(packageJson, addFiles, typesVersions, exports1);
170
+ await utils_namespaceObject.fs.promises.writeFile(packagePath, JSON.stringify(packageJson, null, 2));
171
+ } catch (error) {
172
+ utils_namespaceObject.logger.error(`package.json update failed: ${error}`);
173
+ }
174
174
  }
175
175
  async function copyFiles(from, to) {
176
- if (await import_utils.fs.pathExists(from)) {
177
- await import_utils.fs.copy(toPosixPath(from), toPosixPath(to));
178
- }
176
+ if (await utils_namespaceObject.fs.pathExists(from)) await utils_namespaceObject.fs.copy(toPosixPath(from), toPosixPath(to));
179
177
  }
180
178
  async function clientGenerator(draftOptions) {
181
- const sourceList = await readDirectoryFiles(draftOptions.appDir, draftOptions.lambdaDir, draftOptions.relativeDistPath);
182
- const getClitentCode = async (resourcePath, source) => {
183
- const warning = `The file ${resourcePath} is not allowd to be imported in src directory, only API definition files are allowed.`;
184
- if (!draftOptions.existLambda) {
185
- import_utils.logger.warn(warning);
186
- return;
187
- }
188
- const options = {
189
- prefix: Array.isArray(draftOptions.prefix) ? draftOptions.prefix[0] : draftOptions.prefix,
190
- appDir: draftOptions.appDir,
191
- apiDir: draftOptions.apiDir,
192
- lambdaDir: draftOptions.lambdaDir,
193
- port: Number(draftOptions.port),
194
- source,
195
- resourcePath,
196
- target: "bundle",
197
- httpMethodDecider: draftOptions.httpMethodDecider,
198
- requestCreator: draftOptions.requestCreator
179
+ const sourceList = await readDirectoryFiles(draftOptions.appDir, draftOptions.lambdaDir, draftOptions.relativeDistPath);
180
+ const getClitentCode = async (resourcePath, source)=>{
181
+ const warning = `The file ${resourcePath} is not allowd to be imported in src directory, only API definition files are allowed.`;
182
+ if (!draftOptions.existLambda) return void utils_namespaceObject.logger.warn(warning);
183
+ const options = {
184
+ prefix: Array.isArray(draftOptions.prefix) ? draftOptions.prefix[0] : draftOptions.prefix,
185
+ appDir: draftOptions.appDir,
186
+ apiDir: draftOptions.apiDir,
187
+ lambdaDir: draftOptions.lambdaDir,
188
+ port: Number(draftOptions.port),
189
+ source,
190
+ resourcePath,
191
+ target: 'bundle',
192
+ httpMethodDecider: draftOptions.httpMethodDecider,
193
+ requestCreator: draftOptions.requestCreator
194
+ };
195
+ const { lambdaDir } = draftOptions;
196
+ if (!resourcePath.startsWith(lambdaDir)) return void utils_namespaceObject.logger.warn(warning);
197
+ const result = await (0, bff_core_namespaceObject.generateClient)(options);
198
+ return result;
199
199
  };
200
- const { lambdaDir } = draftOptions;
201
- if (!resourcePath.startsWith(lambdaDir)) {
202
- import_utils.logger.warn(warning);
203
- return;
204
- }
205
- const result = await (0, import_bff_core.generateClient)(options);
206
- return result;
207
- };
208
- try {
209
- for (const source of sourceList) {
210
- const code = await getClitentCode(source.resourcePath, source.source);
211
- if (code === null || code === void 0 ? void 0 : code.value) {
212
- await writeTargetFile(source.absTargetDir, code.value);
213
- await copyFiles(source.relativeTargetDistDir, source.targetDir.replace(`js`, "d.ts"));
214
- }
200
+ try {
201
+ for (const source of sourceList){
202
+ const code = await getClitentCode(source.resourcePath, source.source);
203
+ if (code?.value) {
204
+ await writeTargetFile(source.absTargetDir, code.value);
205
+ await copyFiles(source.relativeTargetDistDir, source.targetDir.replace("js", 'd.ts'));
206
+ }
207
+ }
208
+ utils_namespaceObject.logger.info("Client bundle generate succeed");
209
+ } catch (error) {
210
+ utils_namespaceObject.logger.error(`Client bundle generate failed: ${error}`);
215
211
  }
216
- import_utils.logger.info(`Client bundle generate succeed`);
217
- } catch (error) {
218
- import_utils.logger.error(`Client bundle generate failed: ${error}`);
219
- }
220
- setPackage(sourceList, draftOptions.appDir, draftOptions.relativeDistPath);
212
+ setPackage(sourceList, draftOptions.appDir, draftOptions.relativeDistPath);
221
213
  }
222
- var clientGenerator_default = clientGenerator;
223
- // Annotate the CommonJS export names for ESM import in node:
224
- 0 && (module.exports = {
225
- copyFiles,
226
- readDirectoryFiles
214
+ const utils_clientGenerator = clientGenerator;
215
+ exports.copyFiles = __webpack_exports__.copyFiles;
216
+ exports["default"] = __webpack_exports__["default"];
217
+ exports.readDirectoryFiles = __webpack_exports__.readDirectoryFiles;
218
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
219
+ "copyFiles",
220
+ "default",
221
+ "readDirectoryFiles"
222
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
223
+ Object.defineProperty(exports, '__esModule', {
224
+ value: true
227
225
  });