@lcap/nasl-unified-frontend-generator 4.0.0-beta.8 → 4.0.0-creator.1
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +151 -84
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +166 -84
- package/dist/index.mjs.map +1 -1
- package/dist/playground.js +151 -84
- package/dist/playground.js.map +1 -1
- package/dist/playground.mjs +156 -84
- package/dist/playground.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _lcap_nasl_concepts from '@lcap/nasl-concepts';
|
|
2
|
-
import { App, Frontend, BaseNode,
|
|
2
|
+
import { App, Frontend, BaseNode, LogicItemNode, FrontendVariable, MicroApp, TypeAnnotation, DefaultValue, Logic, BindAttribute, BindDirective, BindEvent, BusinessComponent, View, ViewElement, ValidationRule, LogicItem, Identifier, Return, Variable, Param, BindStyle } from '@lcap/nasl-concepts';
|
|
3
3
|
import { AxiosInstance } from 'axios';
|
|
4
4
|
import { Container } from 'inversify';
|
|
5
5
|
import { Component } from '@lcap/nasl-types';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _lcap_nasl_concepts from '@lcap/nasl-concepts';
|
|
2
|
-
import { App, Frontend, BaseNode,
|
|
2
|
+
import { App, Frontend, BaseNode, LogicItemNode, FrontendVariable, MicroApp, TypeAnnotation, DefaultValue, Logic, BindAttribute, BindDirective, BindEvent, BusinessComponent, View, ViewElement, ValidationRule, LogicItem, Identifier, Return, Variable, Param, BindStyle } from '@lcap/nasl-concepts';
|
|
3
3
|
import { AxiosInstance } from 'axios';
|
|
4
4
|
import { Container } from 'inversify';
|
|
5
5
|
import { Component } from '@lcap/nasl-types';
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name in all)
|
|
10
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -37,6 +40,75 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
37
40
|
};
|
|
38
41
|
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
39
42
|
|
|
43
|
+
// src/plugins/templates/auto-reload.js
|
|
44
|
+
var auto_reload_exports = {};
|
|
45
|
+
__export(auto_reload_exports, {
|
|
46
|
+
default: () => auto_reload_default
|
|
47
|
+
});
|
|
48
|
+
var auto_reload_default;
|
|
49
|
+
var init_auto_reload = __esm({
|
|
50
|
+
"src/plugins/templates/auto-reload.js"() {
|
|
51
|
+
"use strict";
|
|
52
|
+
auto_reload_default = `
|
|
53
|
+
const dom = document.createElement('div');
|
|
54
|
+
dom.classList = "lcap-deploy-loading-container";
|
|
55
|
+
dom.style.display = 'none';
|
|
56
|
+
dom.innerHTML = "<div class='lcap-deploy-loading-icon'></div><div>\u6B63\u5728\u66F4\u65B0\u6700\u65B0\u53D1\u5E03\u5185\u5BB9...</div>";
|
|
57
|
+
document.getElementsByTagName('body')[0].appendChild(dom);
|
|
58
|
+
|
|
59
|
+
const style = document.createElement('style');
|
|
60
|
+
style.innerHTML = \`.lcap-deploy-loading-container {
|
|
61
|
+
width: 208px;
|
|
62
|
+
height: 40px;
|
|
63
|
+
background: rgba(48, 48, 48, 0.8);
|
|
64
|
+
box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
position: fixed;
|
|
67
|
+
top: 120px;
|
|
68
|
+
left: 50%;
|
|
69
|
+
margin-left: -104px;
|
|
70
|
+
color: #FFFFFF;
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
align-items: center;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.lcap-deploy-loading-icon{
|
|
77
|
+
width: 12px;
|
|
78
|
+
height: 12px;
|
|
79
|
+
margin-right: 10px;
|
|
80
|
+
animation: loading-animation 0.8s infinite linear;
|
|
81
|
+
border: 2px solid #f3f3f3;
|
|
82
|
+
border-top: 2px solid rgb(109, 108, 108);
|
|
83
|
+
border-right: 2px solid rgb(109, 108, 108);
|
|
84
|
+
border-bottom: 2px solid rgb(109, 108, 108);
|
|
85
|
+
border-radius: 50%;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@keyframes loading-animation{
|
|
89
|
+
0% {
|
|
90
|
+
transform: rotate(0deg);
|
|
91
|
+
}
|
|
92
|
+
100% {
|
|
93
|
+
transform: rotate(360deg);
|
|
94
|
+
}
|
|
95
|
+
}\`;
|
|
96
|
+
document.getElementsByTagName('body')[0].appendChild(style);
|
|
97
|
+
|
|
98
|
+
window.addEventListener('message', function (e) {
|
|
99
|
+
if(e.data ==="release-start"){
|
|
100
|
+
document.querySelector(".lcap-deploy-loading-container").style.display ="flex"
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if(e.data==="release-end"){
|
|
104
|
+
document.querySelector(".lcap-deploy-loading-container").style.display ="none"
|
|
105
|
+
window.location.reload();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
40
112
|
// src/index.ts
|
|
41
113
|
var src_exports = {};
|
|
42
114
|
__export(src_exports, {
|
|
@@ -1305,8 +1377,8 @@ var reactComponentLibHackPlugin = makePlugin({
|
|
|
1305
1377
|
}
|
|
1306
1378
|
|
|
1307
1379
|
Object.assign(utils, {
|
|
1308
|
-
jsonSerialize: JSON.stringify,
|
|
1309
|
-
jsonDeserialize: JSON.parse,
|
|
1380
|
+
jsonSerialize: utils.JsonSerialize || JSON.stringify,
|
|
1381
|
+
jsonDeserialize: utils.JsonDeserialize || JSON.parse,
|
|
1310
1382
|
});
|
|
1311
1383
|
|
|
1312
1384
|
const logging = {
|
|
@@ -4399,29 +4471,6 @@ var coreVersion = materials.framework.version;
|
|
|
4399
4471
|
function getPredefinedMaterialConfig() {
|
|
4400
4472
|
return materials;
|
|
4401
4473
|
}
|
|
4402
|
-
function getPredefinedLibConstants() {
|
|
4403
|
-
if (!reactUi || !vue3Ui) {
|
|
4404
|
-
throw new Error("not found");
|
|
4405
|
-
}
|
|
4406
|
-
if (reactUi.name !== "@lcap/pc-react-ui") {
|
|
4407
|
-
throw new Error("cannot find @lcap/pc-react-ui in material.config.js");
|
|
4408
|
-
}
|
|
4409
|
-
return {
|
|
4410
|
-
reactUI: {
|
|
4411
|
-
kind: "standard",
|
|
4412
|
-
name: reactUi.name,
|
|
4413
|
-
version: reactUi.version
|
|
4414
|
-
},
|
|
4415
|
-
vue3Ui: {
|
|
4416
|
-
kind: "standard",
|
|
4417
|
-
name: vue3Ui.name,
|
|
4418
|
-
version: vue3Ui.version
|
|
4419
|
-
},
|
|
4420
|
-
basicTemplate: {
|
|
4421
|
-
version: coreVersion
|
|
4422
|
-
}
|
|
4423
|
-
};
|
|
4424
|
-
}
|
|
4425
4474
|
var getPredefinedMaterialByTags = (() => {
|
|
4426
4475
|
const materialConfig = getPredefinedMaterialConfig();
|
|
4427
4476
|
let allMaterials = [];
|
|
@@ -4445,12 +4494,14 @@ var getPredefinedMaterialByTags = (() => {
|
|
|
4445
4494
|
materialConfig.ui.pc.forEach((item) => {
|
|
4446
4495
|
allMaterials.push({
|
|
4447
4496
|
...item,
|
|
4497
|
+
kind: "standard",
|
|
4448
4498
|
tags: ["ui", "pc", item.frameworkKind, item.libName]
|
|
4449
4499
|
});
|
|
4450
4500
|
});
|
|
4451
4501
|
materialConfig.ui.h5.forEach((item) => {
|
|
4452
4502
|
allMaterials.push({
|
|
4453
4503
|
...item,
|
|
4504
|
+
kind: "standard",
|
|
4454
4505
|
tags: ["ui", "h5", item.frameworkKind, item.libName]
|
|
4455
4506
|
});
|
|
4456
4507
|
});
|
|
@@ -4610,7 +4661,10 @@ function bindAttrToIR(b) {
|
|
|
4610
4661
|
throw new Error("string\u4E0D\u53EF\u4E3Async");
|
|
4611
4662
|
}
|
|
4612
4663
|
if (b.i18nKey && b.value && b.frontend?.i18nInfo?.enabled) {
|
|
4613
|
-
|
|
4664
|
+
const frameworkKind = b.frontend?.frameworkKind;
|
|
4665
|
+
if (!["vue3"].includes(frameworkKind)) {
|
|
4666
|
+
b.type = "dynamic";
|
|
4667
|
+
}
|
|
4614
4668
|
const wrapperExpr = import_nasl_concepts9.CallFunction.from(
|
|
4615
4669
|
{
|
|
4616
4670
|
calleeNamespace: "$i18n",
|
|
@@ -4714,7 +4768,7 @@ function bindEventToAction(b) {
|
|
|
4714
4768
|
kind: "standalone"
|
|
4715
4769
|
};
|
|
4716
4770
|
}
|
|
4717
|
-
var DefaultComponentLibraryName =
|
|
4771
|
+
var DefaultComponentLibraryName = getPredefinedMaterialByTags(["ui", "pc", "react"])?.name;
|
|
4718
4772
|
function getReferencedLibComponent(e) {
|
|
4719
4773
|
const tag = e.tag;
|
|
4720
4774
|
if (tag.startsWith("BS")) {
|
|
@@ -5380,8 +5434,8 @@ var NASLAppIRBuilderPlugin = class {
|
|
|
5380
5434
|
});
|
|
5381
5435
|
logger5.debug({ extensionPackages });
|
|
5382
5436
|
const frameworkKind = frontend.frameworkKind;
|
|
5383
|
-
const
|
|
5384
|
-
return [...extensionPackages,
|
|
5437
|
+
const uiLib = getPredefinedMaterialByTags(["ui", frontend.type, frameworkKind]);
|
|
5438
|
+
return [...extensionPackages, uiLib];
|
|
5385
5439
|
};
|
|
5386
5440
|
var buildConfigs = buildConfigs2, collectPackages = collectPackages2;
|
|
5387
5441
|
config.debug && breakpoint2.genBreakpoints(app);
|
|
@@ -6750,10 +6804,9 @@ function extractAppLevelFrontendDeps(app) {
|
|
|
6750
6804
|
}
|
|
6751
6805
|
function extractFrontendLevelDeps(frontend) {
|
|
6752
6806
|
const deps = [];
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
deps.push(getPredefinedLibConstants().vue3Ui);
|
|
6807
|
+
const uiLib = getPredefinedMaterialByTags(["ui", frontend.type, frontend.frameworkKind]);
|
|
6808
|
+
if (uiLib) {
|
|
6809
|
+
deps.push(uiLib);
|
|
6757
6810
|
}
|
|
6758
6811
|
return deps;
|
|
6759
6812
|
}
|
|
@@ -6926,11 +6979,11 @@ async function downloadDependenciesToLcapModules(feDeps, fs, config) {
|
|
|
6926
6979
|
}
|
|
6927
6980
|
let packageJson = fs.read("/package.json")?.toString();
|
|
6928
6981
|
packageJson = JSON.parse(packageJson);
|
|
6929
|
-
if (!packageJson.
|
|
6930
|
-
packageJson.
|
|
6982
|
+
if (!packageJson.lcap_modules) {
|
|
6983
|
+
packageJson.lcap_modules = {};
|
|
6931
6984
|
}
|
|
6932
6985
|
downloadedDeps.forEach(({ pkgName, targetPath }) => {
|
|
6933
|
-
packageJson.
|
|
6986
|
+
packageJson.lcap_modules[pkgName] = `.${targetPath}`;
|
|
6934
6987
|
});
|
|
6935
6988
|
fs.write("/package.json", JSON.stringify(packageJson, null, 2));
|
|
6936
6989
|
logger13.info("\u4E0B\u8F7D\u524D\u7AEF\u4F9D\u8D56\u5E93\u5230 lcap_modules \u76EE\u5F55\u5B8C\u6210");
|
|
@@ -7206,7 +7259,7 @@ export function loadAssets(){
|
|
|
7206
7259
|
generateEntry(ir) {
|
|
7207
7260
|
const entryScript = this.microFrontendManager.produceScript(ir);
|
|
7208
7261
|
const publicPathScript = this.microFrontendManager.producePublicPathScript(ir);
|
|
7209
|
-
|
|
7262
|
+
let code = `
|
|
7210
7263
|
export function startApp(){
|
|
7211
7264
|
if(window.LcapMicro){
|
|
7212
7265
|
// \u5DF2\u7ECF\u88AB\u52A0\u8F7D\u4E8E\u5FAE\u524D\u7AEF\u73AF\u5883
|
|
@@ -7217,6 +7270,11 @@ export function loadAssets(){
|
|
|
7217
7270
|
}
|
|
7218
7271
|
}
|
|
7219
7272
|
`;
|
|
7273
|
+
const { env, isExport } = ir.configs.config;
|
|
7274
|
+
if (!isExport && env === "dev") {
|
|
7275
|
+
const autoReloadScript = (init_auto_reload(), __toCommonJS(auto_reload_exports));
|
|
7276
|
+
code += autoReloadScript?.default || autoReloadScript;
|
|
7277
|
+
}
|
|
7220
7278
|
const imports = [
|
|
7221
7279
|
{
|
|
7222
7280
|
from: "../init"
|
|
@@ -7284,23 +7342,28 @@ var VueRouterPlugin = class {
|
|
|
7284
7342
|
}
|
|
7285
7343
|
routeToCode(routes, componentPathManager, config) {
|
|
7286
7344
|
function serializeVueRoute(r, isRoot = false) {
|
|
7287
|
-
const
|
|
7345
|
+
const { accumulativePath, thisLevelPath } = r;
|
|
7346
|
+
const path = isRoot ? accumulativePath : thisLevelPath ?? "/";
|
|
7347
|
+
const basePath = config.basePath;
|
|
7288
7348
|
if (r.kind === "normal") {
|
|
7289
7349
|
const children = r.children?.map((i) => serializeVueRoute(i)).filter(isNotNil) ?? [];
|
|
7290
7350
|
const childrenStr = children.join(",\n");
|
|
7291
7351
|
const componentCode = `component: ${r.elementMangledName ?? r.elementTemplate.identifier}`;
|
|
7292
|
-
return `{path: "${
|
|
7352
|
+
return `{path: "${path}", meta: ${JSON.stringify(
|
|
7293
7353
|
r.meta
|
|
7294
7354
|
)}, children: [${childrenStr}], ${componentCode} }`;
|
|
7295
7355
|
} else if (r.kind === "redirect") {
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7356
|
+
if (["vue3"].includes(config.frameworkKind) && path === "*") {
|
|
7357
|
+
return `{ path: "/:pathMatch(.*)*", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
|
|
7358
|
+
}
|
|
7359
|
+
if (["vue3"].includes(config.frameworkKind) && path === "/") {
|
|
7360
|
+
let result = `{ path: "/", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
|
|
7361
|
+
if (basePath !== "/") {
|
|
7362
|
+
result += `, { path: "${basePath}", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
|
|
7299
7363
|
}
|
|
7300
|
-
return
|
|
7301
|
-
}
|
|
7302
|
-
|
|
7303
|
-
return `{path: "${processedPath}", redirect: ${JSON.stringify(r.redirect)}}`;
|
|
7364
|
+
return result;
|
|
7365
|
+
}
|
|
7366
|
+
return `{ path: "${path}", redirect: to => to.path.replace(/\\/$/, '') + '/' + ${JSON.stringify(r.redirect)} }`;
|
|
7304
7367
|
}
|
|
7305
7368
|
notImplemented(r);
|
|
7306
7369
|
}
|
|
@@ -7389,7 +7452,7 @@ var Vue3EntryBuilderPlugin = class {
|
|
|
7389
7452
|
buildEntry(ir) {
|
|
7390
7453
|
const entryScript = this.microFrontendManager.produceScript(ir);
|
|
7391
7454
|
const publicPathScript = this.microFrontendManager.producePublicPathScript(ir);
|
|
7392
|
-
|
|
7455
|
+
let code = `
|
|
7393
7456
|
if(window.LcapMicro){
|
|
7394
7457
|
// \u5DF2\u7ECF\u88AB\u52A0\u8F7D\u4E8E\u5FAE\u524D\u7AEF\u73AF\u5883
|
|
7395
7458
|
renderApp();
|
|
@@ -7407,6 +7470,11 @@ var Vue3EntryBuilderPlugin = class {
|
|
|
7407
7470
|
from: "./public-path"
|
|
7408
7471
|
} : void 0
|
|
7409
7472
|
].filter(isNotNil);
|
|
7473
|
+
const { env, isExport } = ir.configs.config;
|
|
7474
|
+
if (!isExport && env === "dev") {
|
|
7475
|
+
const autoReloadScript = (init_auto_reload(), __toCommonJS(auto_reload_exports));
|
|
7476
|
+
code += autoReloadScript?.default || autoReloadScript;
|
|
7477
|
+
}
|
|
7410
7478
|
return [
|
|
7411
7479
|
new ReactFileDescription("main.ts", imports, [], [code]),
|
|
7412
7480
|
publicPathScript ? new ReactFileDescription("public-path.ts", [], [], [publicPathScript]) : void 0
|
|
@@ -7432,10 +7500,13 @@ var Vue3LibrariesBuilderPlugin = class {
|
|
|
7432
7500
|
*/
|
|
7433
7501
|
async buildLibrariesImport(ir, config) {
|
|
7434
7502
|
const importArr = [];
|
|
7503
|
+
const exportArr = [];
|
|
7435
7504
|
const standardLib = ir.packages.find((x) => x.kind === "standard");
|
|
7436
7505
|
if (standardLib) {
|
|
7437
7506
|
const formattedName = kebab2Pascal(standardLib.name.split("/").at(-1));
|
|
7438
|
-
importArr.push(`
|
|
7507
|
+
importArr.push(`import * as ${formattedName} from '${standardLib.name}';`);
|
|
7508
|
+
exportArr.push(`export { ${formattedName} };`);
|
|
7509
|
+
exportArr.push(`window.lcapStandardUI = ${formattedName};`);
|
|
7439
7510
|
const isPackageZipExists = await judgePackageZipExists(standardLib, config.STATIC_URL);
|
|
7440
7511
|
importArr.push(
|
|
7441
7512
|
`import '${standardLib.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
|
|
@@ -7446,14 +7517,14 @@ var Vue3LibrariesBuilderPlugin = class {
|
|
|
7446
7517
|
const formattedName = kebab2Pascal(ext.name.split("/").at(-1));
|
|
7447
7518
|
const isPackageZipExists = await judgePackageZipExists(ext, config.STATIC_URL);
|
|
7448
7519
|
const prefix = isPackageZipExists ? "" : "@extension/";
|
|
7449
|
-
|
|
7520
|
+
exportArr.push(`export * as ${formattedName} from '${prefix}${ext.name}';`);
|
|
7450
7521
|
if (ext.hasCss) {
|
|
7451
7522
|
importArr.push(
|
|
7452
7523
|
`import '${prefix}${ext.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
|
|
7453
7524
|
);
|
|
7454
7525
|
}
|
|
7455
7526
|
}
|
|
7456
|
-
return new ReactFileDescription("libraries.ts", [], [], [importArr.join("\n")]);
|
|
7527
|
+
return new ReactFileDescription("libraries.ts", [], [], [[...importArr, ...exportArr].join("\n")]);
|
|
7457
7528
|
}
|
|
7458
7529
|
static install(c) {
|
|
7459
7530
|
c.bind(Vue3LibrariesBuilderPlugin).toSelf();
|
|
@@ -7689,15 +7760,16 @@ var Vue3ApplicationAssemblerPlugin = class {
|
|
|
7689
7760
|
const bizComponents = ir.bizComponents.flatMap((x) => {
|
|
7690
7761
|
return this.vue3CodegenPlugin.genFiles(x, manager);
|
|
7691
7762
|
});
|
|
7692
|
-
let
|
|
7693
|
-
if (!/\/$/.test(
|
|
7694
|
-
|
|
7763
|
+
let basePath = ir.configs.basePlatformConfig.basePath;
|
|
7764
|
+
if (!/\/$/.test(basePath)) {
|
|
7765
|
+
basePath += "/";
|
|
7695
7766
|
}
|
|
7696
|
-
const routesObjects = this.routesExtactor.extractRoute(ir.views,
|
|
7767
|
+
const routesObjects = this.routesExtactor.extractRoute(ir.views, basePath, {
|
|
7697
7768
|
lazy: true
|
|
7698
7769
|
});
|
|
7699
7770
|
const router = this.routerBuilder.routeToCode(routesObjects.routes, manager, {
|
|
7700
|
-
frameworkKind: "vue3"
|
|
7771
|
+
frameworkKind: "vue3",
|
|
7772
|
+
basePath
|
|
7701
7773
|
});
|
|
7702
7774
|
const routerFile = new ReactFileDescription("router.ts", router.imports, [], [router.code]);
|
|
7703
7775
|
const libraries = await this.librariesBuilder.buildLibrariesImport(ir, config);
|
|
@@ -7750,6 +7822,30 @@ var Vue3PresetPlugin = class {
|
|
|
7750
7822
|
const app = deserializeAppWhileKeepTypeAnnotation(appJson);
|
|
7751
7823
|
const frontend = app.findNodeByPath(instruction.frontend.nodePath);
|
|
7752
7824
|
const ir = this.irBuilder.buildIR(app, frontend, instruction.config);
|
|
7825
|
+
const needCompileViews = instruction.config?.needCompileViews ?? [];
|
|
7826
|
+
const isIncremental = needCompileViews.length > 0;
|
|
7827
|
+
if (isIncremental) {
|
|
7828
|
+
const filterChildComponents = (view, needCompileViews2) => {
|
|
7829
|
+
if (!view.childComponents?.length) {
|
|
7830
|
+
return;
|
|
7831
|
+
}
|
|
7832
|
+
view.childComponents = view.childComponents.filter((child) => {
|
|
7833
|
+
if (needCompileViews2.includes(child.__raw.nodePath)) {
|
|
7834
|
+
filterChildComponents(child, needCompileViews2);
|
|
7835
|
+
return true;
|
|
7836
|
+
}
|
|
7837
|
+
return false;
|
|
7838
|
+
});
|
|
7839
|
+
};
|
|
7840
|
+
ir.views = ir.views.filter((view) => {
|
|
7841
|
+
if (needCompileViews.includes(view.__raw.nodePath)) {
|
|
7842
|
+
filterChildComponents(view, needCompileViews);
|
|
7843
|
+
return true;
|
|
7844
|
+
}
|
|
7845
|
+
return false;
|
|
7846
|
+
});
|
|
7847
|
+
ir.bizComponents = [];
|
|
7848
|
+
}
|
|
7753
7849
|
const assembledApplication = await this.applicationAssembler.assemble(ir, instruction.config);
|
|
7754
7850
|
const finalizedFiles = await this.projectOrganizer.organize({
|
|
7755
7851
|
baseDir: instruction.baseDir,
|
|
@@ -7827,35 +7923,6 @@ async function translateNASLToApp(app, frontend, config, baseDir = "./out", cont
|
|
|
7827
7923
|
const logger13 = Logger("\u7FFB\u8BD1\u8FC7\u7A0B");
|
|
7828
7924
|
logger13.debug({ config });
|
|
7829
7925
|
async function genCode() {
|
|
7830
|
-
const { needCompileViews = [] } = config;
|
|
7831
|
-
if (needCompileViews?.length > 0) {
|
|
7832
|
-
let traverseChildren2 = function(view, callback) {
|
|
7833
|
-
if (view.children?.length > 0) {
|
|
7834
|
-
view.children.forEach((childView) => {
|
|
7835
|
-
const deep = callback(childView);
|
|
7836
|
-
if (deep) {
|
|
7837
|
-
traverseChildren2(childView, callback);
|
|
7838
|
-
}
|
|
7839
|
-
});
|
|
7840
|
-
}
|
|
7841
|
-
};
|
|
7842
|
-
var traverseChildren = traverseChildren2;
|
|
7843
|
-
logger13.info("\u5F00\u59CB\u6309\u9700\u7FFB\u8BD1\u9875\u9762");
|
|
7844
|
-
frontend.views.forEach((view) => {
|
|
7845
|
-
if (!needCompileViews.includes(view.nodePath)) {
|
|
7846
|
-
view.delete();
|
|
7847
|
-
} else {
|
|
7848
|
-
traverseChildren2(view, (childView) => {
|
|
7849
|
-
if (!needCompileViews.includes(childView.nodePath)) {
|
|
7850
|
-
childView.delete();
|
|
7851
|
-
return false;
|
|
7852
|
-
}
|
|
7853
|
-
return true;
|
|
7854
|
-
});
|
|
7855
|
-
}
|
|
7856
|
-
});
|
|
7857
|
-
logger13.info("\u7ED3\u675F\u6309\u9700\u7FFB\u8BD1\u9875\u9762");
|
|
7858
|
-
}
|
|
7859
7926
|
logger13.info("\u5F00\u59CB\u7FFB\u8BD1");
|
|
7860
7927
|
try {
|
|
7861
7928
|
const codeList2 = await container.get(ServiceMetaKind.NASLTranspiler).transpile({
|