@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.
- package/dist/cjs/cli.js +256 -272
- package/dist/cjs/constants.js +43 -34
- package/dist/cjs/index.js +55 -19
- package/dist/cjs/loader.js +69 -65
- package/dist/cjs/runtime/create-request/index.js +39 -29
- package/dist/cjs/runtime/hono/adapter.js +128 -126
- package/dist/cjs/runtime/hono/index.js +78 -30
- package/dist/cjs/runtime/hono/operators.js +64 -67
- package/dist/cjs/server.js +159 -165
- package/dist/cjs/utils/clientGenerator.js +204 -206
- package/dist/cjs/utils/createHonoRoutes.js +128 -144
- package/dist/cjs/utils/crossProjectApiPlugin.js +91 -81
- package/dist/cjs/utils/pluginGenerator.js +66 -54
- package/dist/cjs/utils/runtimeGenerator.js +67 -45
- package/dist/esm/cli.mjs +214 -0
- package/dist/esm/constants.mjs +11 -0
- package/dist/esm/loader.mjs +39 -0
- package/dist/esm/runtime/create-request/{index.js → index.mjs} +1 -5
- package/dist/esm/runtime/hono/adapter.mjs +95 -0
- package/dist/{esm-node/runtime/hono/index.js → esm/runtime/hono/index.mjs} +2 -4
- package/dist/esm/runtime/hono/operators.mjs +31 -0
- package/dist/esm/server.mjs +122 -0
- package/dist/esm/utils/clientGenerator.mjs +175 -0
- package/dist/esm/utils/createHonoRoutes.mjs +91 -0
- package/dist/esm/utils/crossProjectApiPlugin.mjs +34 -0
- package/dist/esm/utils/pluginGenerator.mjs +29 -0
- package/dist/esm/utils/runtimeGenerator.mjs +43 -0
- package/dist/esm-node/cli.mjs +214 -0
- package/dist/esm-node/constants.mjs +11 -0
- package/dist/esm-node/index.mjs +1 -0
- package/dist/esm-node/loader.mjs +39 -0
- package/dist/esm-node/runtime/create-request/{index.js → index.mjs} +1 -5
- package/dist/esm-node/runtime/hono/adapter.mjs +95 -0
- package/dist/{esm/runtime/hono/index.js → esm-node/runtime/hono/index.mjs} +3 -5
- package/dist/esm-node/runtime/hono/operators.mjs +31 -0
- package/dist/esm-node/server.mjs +122 -0
- package/dist/esm-node/utils/clientGenerator.mjs +175 -0
- package/dist/esm-node/utils/createHonoRoutes.mjs +91 -0
- package/dist/esm-node/utils/crossProjectApiPlugin.mjs +34 -0
- package/dist/esm-node/utils/pluginGenerator.mjs +29 -0
- package/dist/esm-node/utils/runtimeGenerator.mjs +43 -0
- package/dist/types/loader.d.ts +2 -2
- package/dist/types/runtime/hono/adapter.d.ts +3 -3
- package/dist/types/server.d.ts +2 -2
- package/dist/types/utils/runtimeGenerator.d.ts +2 -1
- package/package.json +53 -31
- package/rslib.config.mts +4 -0
- package/dist/cjs/helper.js +0 -48
- package/dist/esm/cli.js +0 -425
- package/dist/esm/constants.js +0 -14
- package/dist/esm/helper.js +0 -13
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -75
- package/dist/esm/runtime/hono/adapter.js +0 -243
- package/dist/esm/runtime/hono/operators.js +0 -79
- package/dist/esm/server.js +0 -258
- package/dist/esm/utils/clientGenerator.js +0 -517
- package/dist/esm/utils/createHonoRoutes.js +0 -319
- package/dist/esm/utils/crossProjectApiPlugin.js +0 -49
- package/dist/esm/utils/pluginGenerator.js +0 -94
- package/dist/esm/utils/runtimeGenerator.js +0 -55
- package/dist/esm-node/cli.js +0 -246
- package/dist/esm-node/constants.js +0 -14
- package/dist/esm-node/helper.js +0 -14
- package/dist/esm-node/loader.js +0 -49
- package/dist/esm-node/runtime/hono/adapter.js +0 -103
- package/dist/esm-node/runtime/hono/operators.js +0 -46
- package/dist/esm-node/server.js +0 -142
- package/dist/esm-node/utils/clientGenerator.js +0 -192
- package/dist/esm-node/utils/createHonoRoutes.js +0 -120
- package/dist/esm-node/utils/crossProjectApiPlugin.js +0 -47
- package/dist/esm-node/utils/pluginGenerator.js +0 -31
- package/dist/esm-node/utils/runtimeGenerator.js +0 -35
- package/dist/types/helper.d.ts +0 -2
- package/types.d.ts +0 -3
- /package/dist/{esm-node/index.js → esm/index.mjs} +0 -0
|
@@ -1,227 +1,225 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const API_DIR =
|
|
40
|
-
const PLUGIN_DIR =
|
|
41
|
-
const RUNTIME_DIR =
|
|
42
|
-
const CLIENT_DIR =
|
|
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)
|
|
46
|
-
const posixJoin = (...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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
83
|
-
return filesList;
|
|
85
|
+
await readFiles(directory);
|
|
86
|
+
return filesList;
|
|
84
87
|
}
|
|
85
|
-
function mergePackageJson(packageJson, files, typesVersion,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
]
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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
|
-
|
|
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
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
});
|