zova-cli-set-front 1.2.93 → 1.2.95
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/index.js +33 -12
- package/dist/lib/bean/cli.bin.buildRest.d.ts +3 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -252,14 +252,20 @@ class CliBinBuildRest extends BeanCliBase {
|
|
|
252
252
|
// Modules
|
|
253
253
|
const modules = [];
|
|
254
254
|
const bundleModules = [];
|
|
255
|
+
const sideEffectImportModuleNames = [];
|
|
255
256
|
for (const module of modulesMeta.modulesArray) {
|
|
256
|
-
|
|
257
|
+
const moduleName = module.info.fullName;
|
|
258
|
+
modules.push(`import '${moduleName}';`);
|
|
259
|
+
modules.push(`export * from '${moduleName}';`);
|
|
257
260
|
const moduleRoot = module.root.replaceAll('\\', '/');
|
|
258
261
|
if (moduleRoot.includes('/src/module/') || moduleRoot.includes('/src/suite/')) {
|
|
259
|
-
bundleModules.push(
|
|
262
|
+
bundleModules.push(moduleName);
|
|
263
|
+
} else {
|
|
264
|
+
sideEffectImportModuleNames.push(moduleName);
|
|
260
265
|
}
|
|
261
266
|
}
|
|
262
267
|
context.bundleModules = bundleModules;
|
|
268
|
+
context.sideEffectImportModuleNames = sideEffectImportModuleNames;
|
|
263
269
|
argv.Modules = modules.join('\n');
|
|
264
270
|
// Name/Version
|
|
265
271
|
argv.Name = bundleName;
|
|
@@ -297,7 +303,8 @@ class CliBinBuildRest extends BeanCliBase {
|
|
|
297
303
|
async _buildDts({
|
|
298
304
|
srcDir,
|
|
299
305
|
outDir,
|
|
300
|
-
bundleModules
|
|
306
|
+
bundleModules,
|
|
307
|
+
sideEffectImportModuleNames
|
|
301
308
|
}) {
|
|
302
309
|
// entry
|
|
303
310
|
const entry = path.join(srcDir, 'index.ts');
|
|
@@ -325,6 +332,15 @@ class CliBinBuildRest extends BeanCliBase {
|
|
|
325
332
|
}
|
|
326
333
|
// minify: true,
|
|
327
334
|
});
|
|
335
|
+
await this._injectDtsImports(outDir, sideEffectImportModuleNames);
|
|
336
|
+
}
|
|
337
|
+
async _injectDtsImports(outDir, sideEffectImportModuleNames) {
|
|
338
|
+
const fileIndex = path.join(outDir, 'index.d.mts');
|
|
339
|
+
let fileContent = (await fse.readFile(fileIndex)).toString();
|
|
340
|
+
const imports = sideEffectImportModuleNames.filter(moduleName => !fileContent.includes(`import "${moduleName}";`)).map(moduleName => `import "${moduleName}";`);
|
|
341
|
+
if (imports.length === 0) return;
|
|
342
|
+
fileContent = `${imports.join('\n')}\n${fileContent}`;
|
|
343
|
+
await fse.writeFile(fileIndex, fileContent);
|
|
328
344
|
}
|
|
329
345
|
async _build(buildContext) {
|
|
330
346
|
const {
|
|
@@ -369,7 +385,7 @@ async function _extractDeps(filePath) {
|
|
|
369
385
|
const pos = content.indexOf('//#region');
|
|
370
386
|
content = content.substring(0, pos);
|
|
371
387
|
const packageNames = new Set();
|
|
372
|
-
const re = /import\s+[\s\S]*?\s+from\s+['"]([^'"]+)['"]/g;
|
|
388
|
+
const re = /import\s+(?:[\s\S]*?\s+from\s+)?['"]([^'"]+)['"]/g;
|
|
373
389
|
let match;
|
|
374
390
|
while (true) {
|
|
375
391
|
match = re.exec(content);
|
|
@@ -1794,14 +1810,18 @@ export const OpenApiBaseURL = (sys: ZovaSys) => {
|
|
|
1794
1810
|
}
|
|
1795
1811
|
//
|
|
1796
1812
|
const contentTypes2 = contentTypes.join('\n');
|
|
1797
|
-
const
|
|
1798
|
-
|
|
1799
|
-
if (
|
|
1800
|
-
if (contentTypes2.includes('
|
|
1801
|
-
|
|
1813
|
+
const importsOpenapiValue = [];
|
|
1814
|
+
const importsOpenapiType = [];
|
|
1815
|
+
if (contentSignatures.length > 0) importsOpenapiValue.push('OpenApiBaseURL');
|
|
1816
|
+
if (contentTypes2.includes('components["schemas"]')) importsOpenapiType.push('components');
|
|
1817
|
+
if (contentTypes2.includes('paths[')) importsOpenapiType.push('paths');
|
|
1818
|
+
const contentImportsOpenapiValue = importsOpenapiValue.length > 0 ? `import { ${importsOpenapiValue.join(', ')} } from './openapi/index.js';` : '';
|
|
1819
|
+
const contentImportsOpenapiType = importsOpenapiType.length > 0 ? `import type { ${importsOpenapiType.join(', ')} } from './openapi/index.js';` : '';
|
|
1820
|
+
const contentImportsOpenapi = [contentImportsOpenapiValue, contentImportsOpenapiType].filter(item => !!item).join('\n');
|
|
1802
1821
|
// apiContent
|
|
1803
|
-
const apiContent = `import { Api, BeanApiBase
|
|
1804
|
-
|
|
1822
|
+
const apiContent = `import { Api, BeanApiBase } from 'zova-module-a-api';
|
|
1823
|
+
import type { IApiActionOptions } from 'zova-module-a-api';
|
|
1824
|
+
${contentImportsOpenapi}
|
|
1805
1825
|
|
|
1806
1826
|
${contentTypes2}
|
|
1807
1827
|
|
|
@@ -1836,7 +1856,8 @@ export class ApiMeta${apiName} extends BeanBase {
|
|
|
1836
1856
|
}
|
|
1837
1857
|
`;
|
|
1838
1858
|
const apiSchemaContent = `import { BeanBase } from 'zova';
|
|
1839
|
-
import { ApiSchema
|
|
1859
|
+
import { ApiSchema } from 'zova-module-a-api';
|
|
1860
|
+
import type { IApiSchemaOptions } from 'zova-module-a-api';
|
|
1840
1861
|
${contentImportsApiPath}
|
|
1841
1862
|
|
|
1842
1863
|
@ApiSchema()
|
|
@@ -16,12 +16,14 @@ interface IBinBuildRestContext {
|
|
|
16
16
|
srcDir: string;
|
|
17
17
|
outDir: string;
|
|
18
18
|
bundleModules?: string[];
|
|
19
|
+
sideEffectImportModuleNames?: string[];
|
|
19
20
|
}
|
|
20
21
|
export declare class CliBinBuildRest extends BeanCliBase {
|
|
21
22
|
execute(): Promise<void>;
|
|
22
23
|
_prepareResources(context: IBinBuildRestContext): Promise<void>;
|
|
23
24
|
_buildTs({ srcDir, outDir }: IBinBuildRestContext): Promise<void>;
|
|
24
|
-
_buildDts({ srcDir, outDir, bundleModules }: IBinBuildRestContext): Promise<void>;
|
|
25
|
+
_buildDts({ srcDir, outDir, bundleModules, sideEffectImportModuleNames, }: IBinBuildRestContext): Promise<void>;
|
|
26
|
+
_injectDtsImports(outDir: string, sideEffectImportModuleNames: string[]): Promise<void>;
|
|
25
27
|
_build(buildContext: IBinBuildRestContext): Promise<void>;
|
|
26
28
|
}
|
|
27
29
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-cli-set-front",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "1.2.95",
|
|
4
|
+
"gitHead": "7a711c5f09e0c1d3b0fda2084710297ea45b5d8e",
|
|
5
5
|
"description": "zova cli-set-front",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"framework",
|
|
@@ -36,21 +36,21 @@
|
|
|
36
36
|
"@babel/plugin-proposal-decorators": "^7.29.0",
|
|
37
37
|
"@babel/plugin-transform-class-properties": "^7.28.6",
|
|
38
38
|
"@babel/plugin-transform-typescript": "^7.28.6",
|
|
39
|
-
"@cabloy/cli": "^3.1.
|
|
39
|
+
"@cabloy/cli": "^3.1.28",
|
|
40
40
|
"@cabloy/extend": "^3.2.8",
|
|
41
|
-
"@cabloy/module-info": "^2.0.
|
|
41
|
+
"@cabloy/module-info": "^2.0.3",
|
|
42
42
|
"@cabloy/openapi-typescript": "^7.9.2",
|
|
43
|
-
"@cabloy/utils": "^2.1.
|
|
43
|
+
"@cabloy/utils": "^2.1.26",
|
|
44
44
|
"@cabloy/vite-plugin-babel": "^1.3.3",
|
|
45
45
|
"@cabloy/vue-babel-plugin-jsx": "^2.0.1",
|
|
46
46
|
"@cabloy/word-utils": "^2.1.14",
|
|
47
47
|
"@typescript/native-preview": "^7.0.0-dev.20260320.1",
|
|
48
48
|
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
|
49
49
|
"babel-plugin-transform-typescript-metadata": "^0.4.0",
|
|
50
|
-
"babel-plugin-zova-bean-module": "^1.2.
|
|
51
|
-
"babel-plugin-zova-bean-use": "^1.1.
|
|
52
|
-
"babel-plugin-zova-behavior": "^1.1.
|
|
53
|
-
"babel-plugin-zova-component": "^1.1.
|
|
50
|
+
"babel-plugin-zova-bean-module": "^1.2.15",
|
|
51
|
+
"babel-plugin-zova-bean-use": "^1.1.15",
|
|
52
|
+
"babel-plugin-zova-behavior": "^1.1.15",
|
|
53
|
+
"babel-plugin-zova-component": "^1.1.15",
|
|
54
54
|
"compressing": "^1.10.0",
|
|
55
55
|
"fs-extra": "^11.3.5",
|
|
56
56
|
"globby": "^14.1.0",
|
|
@@ -65,6 +65,6 @@
|
|
|
65
65
|
"vite": "^8.0.14",
|
|
66
66
|
"yaml": "^2.8.3",
|
|
67
67
|
"zova-openapi": "^1.1.17",
|
|
68
|
-
"zova-vite": "^1.1.
|
|
68
|
+
"zova-vite": "^1.1.43"
|
|
69
69
|
}
|
|
70
70
|
}
|