@lcap/nasl-unified-frontend-generator 4.0.0-rc.5 → 4.0.1-rc.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 +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +140 -164
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +136 -160
- package/dist/index.mjs.map +1 -1
- package/dist/playground.d.mts +1 -1
- package/dist/playground.d.ts +1 -1
- package/dist/playground.js +140 -164
- package/dist/playground.js.map +1 -1
- package/dist/playground.mjs +136 -160
- package/dist/playground.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import { Container as Container20 } from "inversify";
|
|
|
20
20
|
|
|
21
21
|
// src/plugins/vue/vue3/vue3-preset-plugin.ts
|
|
22
22
|
import "@abraham/reflection";
|
|
23
|
-
import { inject as
|
|
23
|
+
import { inject as inject15, injectable as injectable30 } from "inversify";
|
|
24
24
|
|
|
25
25
|
// src/service-metakind.ts
|
|
26
26
|
var ServiceMetaKind = {
|
|
@@ -2383,7 +2383,8 @@ query: {`;
|
|
|
2383
2383
|
let url2 = "`";
|
|
2384
2384
|
const viewArr = s3.genViewArr();
|
|
2385
2385
|
if (Array.isArray(viewArr) && viewArr.length) {
|
|
2386
|
-
|
|
2386
|
+
const prefixPath = s3.frontend?.prefixPath;
|
|
2387
|
+
url2 += `${prefixPath}/${viewArr.join("/")}`;
|
|
2387
2388
|
const { completeArguments } = s3;
|
|
2388
2389
|
if (completeArguments.length) {
|
|
2389
2390
|
const node = s3.viewNode;
|
|
@@ -4331,40 +4332,40 @@ var metadataPlugin = makePlugin({
|
|
|
4331
4332
|
// src/hack/material-config/material.config.js
|
|
4332
4333
|
var materials = {
|
|
4333
4334
|
framework: {
|
|
4334
|
-
version: "2.0.
|
|
4335
|
+
version: "2.0.1",
|
|
4335
4336
|
core: "@lcap/basic-template",
|
|
4336
4337
|
pc: [
|
|
4337
4338
|
{
|
|
4338
4339
|
frameworkKind: "vue2",
|
|
4339
4340
|
name: "@lcap/pc-template",
|
|
4340
|
-
version: "2.0.
|
|
4341
|
+
version: "2.0.1"
|
|
4341
4342
|
},
|
|
4342
4343
|
{
|
|
4343
4344
|
frameworkKind: "react",
|
|
4344
4345
|
name: "@lcap/pc-template-react",
|
|
4345
|
-
version: "2.0.
|
|
4346
|
+
version: "2.0.1"
|
|
4346
4347
|
},
|
|
4347
4348
|
{
|
|
4348
4349
|
frameworkKind: "vue3",
|
|
4349
4350
|
name: "@lcap/pc-template-vue3",
|
|
4350
|
-
version: "2.0.
|
|
4351
|
+
version: "2.0.1"
|
|
4351
4352
|
}
|
|
4352
4353
|
],
|
|
4353
4354
|
h5: [
|
|
4354
4355
|
{
|
|
4355
4356
|
frameworkKind: "vue2",
|
|
4356
4357
|
name: "@lcap/mobile-template",
|
|
4357
|
-
version: "2.0.
|
|
4358
|
+
version: "2.0.1"
|
|
4358
4359
|
},
|
|
4359
4360
|
{
|
|
4360
4361
|
frameworkKind: "react",
|
|
4361
4362
|
name: "@lcap/mobile-template-react",
|
|
4362
|
-
version: "2.0.
|
|
4363
|
+
version: "2.0.1"
|
|
4363
4364
|
},
|
|
4364
4365
|
{
|
|
4365
4366
|
frameworkKind: "vue3",
|
|
4366
4367
|
name: "@lcap/mobile-template-vue3",
|
|
4367
|
-
version: "2.0.
|
|
4368
|
+
version: "2.0.1"
|
|
4368
4369
|
}
|
|
4369
4370
|
]
|
|
4370
4371
|
},
|
|
@@ -4438,29 +4439,6 @@ var coreVersion = materials.framework.version;
|
|
|
4438
4439
|
function getPredefinedMaterialConfig() {
|
|
4439
4440
|
return materials;
|
|
4440
4441
|
}
|
|
4441
|
-
function getPredefinedLibConstants() {
|
|
4442
|
-
if (!reactUi || !vue3Ui) {
|
|
4443
|
-
throw new Error("not found");
|
|
4444
|
-
}
|
|
4445
|
-
if (reactUi.name !== "@lcap/pc-react-ui") {
|
|
4446
|
-
throw new Error("cannot find @lcap/pc-react-ui in material.config.js");
|
|
4447
|
-
}
|
|
4448
|
-
return {
|
|
4449
|
-
reactUI: {
|
|
4450
|
-
kind: "standard",
|
|
4451
|
-
name: reactUi.name,
|
|
4452
|
-
version: reactUi.version
|
|
4453
|
-
},
|
|
4454
|
-
vue3Ui: {
|
|
4455
|
-
kind: "standard",
|
|
4456
|
-
name: vue3Ui.name,
|
|
4457
|
-
version: vue3Ui.version
|
|
4458
|
-
},
|
|
4459
|
-
basicTemplate: {
|
|
4460
|
-
version: coreVersion
|
|
4461
|
-
}
|
|
4462
|
-
};
|
|
4463
|
-
}
|
|
4464
4442
|
var getPredefinedMaterialByTags = (() => {
|
|
4465
4443
|
const materialConfig = getPredefinedMaterialConfig();
|
|
4466
4444
|
let allMaterials = [];
|
|
@@ -4484,12 +4462,14 @@ var getPredefinedMaterialByTags = (() => {
|
|
|
4484
4462
|
materialConfig.ui.pc.forEach((item) => {
|
|
4485
4463
|
allMaterials.push({
|
|
4486
4464
|
...item,
|
|
4465
|
+
kind: "standard",
|
|
4487
4466
|
tags: ["ui", "pc", item.frameworkKind, item.libName]
|
|
4488
4467
|
});
|
|
4489
4468
|
});
|
|
4490
4469
|
materialConfig.ui.h5.forEach((item) => {
|
|
4491
4470
|
allMaterials.push({
|
|
4492
4471
|
...item,
|
|
4472
|
+
kind: "standard",
|
|
4493
4473
|
tags: ["ui", "h5", item.frameworkKind, item.libName]
|
|
4494
4474
|
});
|
|
4495
4475
|
});
|
|
@@ -4649,7 +4629,10 @@ function bindAttrToIR(b) {
|
|
|
4649
4629
|
throw new Error("string\u4E0D\u53EF\u4E3Async");
|
|
4650
4630
|
}
|
|
4651
4631
|
if (b.i18nKey && b.value && b.frontend?.i18nInfo?.enabled) {
|
|
4652
|
-
|
|
4632
|
+
const frameworkKind = b.frontend?.frameworkKind;
|
|
4633
|
+
if (!["vue3"].includes(frameworkKind)) {
|
|
4634
|
+
b.type = "dynamic";
|
|
4635
|
+
}
|
|
4653
4636
|
const wrapperExpr = CallFunction4.from(
|
|
4654
4637
|
{
|
|
4655
4638
|
calleeNamespace: "$i18n",
|
|
@@ -4753,7 +4736,7 @@ function bindEventToAction(b) {
|
|
|
4753
4736
|
kind: "standalone"
|
|
4754
4737
|
};
|
|
4755
4738
|
}
|
|
4756
|
-
var DefaultComponentLibraryName =
|
|
4739
|
+
var DefaultComponentLibraryName = getPredefinedMaterialByTags(["ui", "pc", "react"])?.name;
|
|
4757
4740
|
function getReferencedLibComponent(e) {
|
|
4758
4741
|
const tag = e.tag;
|
|
4759
4742
|
if (tag.startsWith("BS")) {
|
|
@@ -5419,8 +5402,8 @@ var NASLAppIRBuilderPlugin = class {
|
|
|
5419
5402
|
});
|
|
5420
5403
|
logger5.debug({ extensionPackages });
|
|
5421
5404
|
const frameworkKind = frontend.frameworkKind;
|
|
5422
|
-
const
|
|
5423
|
-
return [...extensionPackages,
|
|
5405
|
+
const uiLib = getPredefinedMaterialByTags(["ui", frontend.type, frameworkKind]);
|
|
5406
|
+
return [...extensionPackages, uiLib];
|
|
5424
5407
|
};
|
|
5425
5408
|
var buildConfigs = buildConfigs2, collectPackages = collectPackages2;
|
|
5426
5409
|
config.debug && breakpoint2.genBreakpoints(app);
|
|
@@ -6789,10 +6772,9 @@ function extractAppLevelFrontendDeps(app) {
|
|
|
6789
6772
|
}
|
|
6790
6773
|
function extractFrontendLevelDeps(frontend) {
|
|
6791
6774
|
const deps = [];
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
deps.push(getPredefinedLibConstants().vue3Ui);
|
|
6775
|
+
const uiLib = getPredefinedMaterialByTags(["ui", frontend.type, frontend.frameworkKind]);
|
|
6776
|
+
if (uiLib) {
|
|
6777
|
+
deps.push(uiLib);
|
|
6796
6778
|
}
|
|
6797
6779
|
return deps;
|
|
6798
6780
|
}
|
|
@@ -6965,11 +6947,11 @@ async function downloadDependenciesToLcapModules(feDeps, fs, config) {
|
|
|
6965
6947
|
}
|
|
6966
6948
|
let packageJson = fs.read("/package.json")?.toString();
|
|
6967
6949
|
packageJson = JSON.parse(packageJson);
|
|
6968
|
-
if (!packageJson.
|
|
6969
|
-
packageJson.
|
|
6950
|
+
if (!packageJson.lcap_modules) {
|
|
6951
|
+
packageJson.lcap_modules = {};
|
|
6970
6952
|
}
|
|
6971
6953
|
downloadedDeps.forEach(({ pkgName, targetPath }) => {
|
|
6972
|
-
packageJson.
|
|
6954
|
+
packageJson.lcap_modules[pkgName] = `.${targetPath}`;
|
|
6973
6955
|
});
|
|
6974
6956
|
fs.write("/package.json", JSON.stringify(packageJson, null, 2));
|
|
6975
6957
|
logger13.info("\u4E0B\u8F7D\u524D\u7AEF\u4F9D\u8D56\u5E93\u5230 lcap_modules \u76EE\u5F55\u5B8C\u6210");
|
|
@@ -7044,7 +7026,7 @@ BundlerConfigDataPlugin = __decorateClass([
|
|
|
7044
7026
|
__decorateParam(0, inject8(ServiceMetaKind.FrontendBundlerConfig))
|
|
7045
7027
|
], BundlerConfigDataPlugin);
|
|
7046
7028
|
|
|
7047
|
-
// src/plugins/misc/bundler/
|
|
7029
|
+
// src/plugins/misc/bundler/rspack-config-plugin.ts
|
|
7048
7030
|
import "@abraham/reflection";
|
|
7049
7031
|
import { injectable as injectable17, inject as inject9 } from "inversify";
|
|
7050
7032
|
var RspackConfigPlugin = class {
|
|
@@ -7068,9 +7050,16 @@ var RspackConfigPlugin = class {
|
|
|
7068
7050
|
`chunks: '${this.frontendPerformancePlugin?.performanceOptions?.chunks}'`
|
|
7069
7051
|
);
|
|
7070
7052
|
}
|
|
7053
|
+
rspackConfigSource = rspackConfigSource.replace(`const backendUrl = '';`, `const backendUrl = '${backendUrl}'`).replace(`const publicPath = '';`, `const publicPath = '${publicPath}';`).replace(`sourceMap: false,`, `sourceMap: ${config.env === "dev"},`).replace("alias: {}", `alias: {${aliasMapStr}}`).replace("const isDev = false", `const isDev = ${config.env === "dev"}`);
|
|
7054
|
+
if (config.needCompileViews && config.needCompileViews.length > 0 && config.cacheChunksMapCode) {
|
|
7055
|
+
rspackConfigSource = rspackConfigSource.replace("isIncremental: false", "isIncremental: true").replace("chunksMap: ''", `chunksMap: \`${config.cacheChunksMapCode}\``);
|
|
7056
|
+
}
|
|
7057
|
+
if (config.isExport) {
|
|
7058
|
+
rspackConfigSource = rspackConfigSource.replace(/\/\/ LcapPlugin start\s+new LcapPlugin\(\{[\s\S]*?\}\),\s+\/\/ LcapPlugin end/g, "");
|
|
7059
|
+
}
|
|
7071
7060
|
fs.write(
|
|
7072
7061
|
"/rspack.config.js",
|
|
7073
|
-
rspackConfigSource
|
|
7062
|
+
rspackConfigSource
|
|
7074
7063
|
);
|
|
7075
7064
|
}
|
|
7076
7065
|
}
|
|
@@ -7278,49 +7267,12 @@ EntrypointPlugin = __decorateClass([
|
|
|
7278
7267
|
__decorateParam(0, inject11(ServiceMetaKind.MicroFrontendManager))
|
|
7279
7268
|
], EntrypointPlugin);
|
|
7280
7269
|
|
|
7281
|
-
// src/plugins/misc/bundler/vite-config-plugin.ts
|
|
7282
|
-
import "@abraham/reflection";
|
|
7283
|
-
import { injectable as injectable20, inject as inject12 } from "inversify";
|
|
7284
|
-
var ViteConfigPlugin = class {
|
|
7285
|
-
constructor(bundlerConfigDataPlugin) {
|
|
7286
|
-
this.bundlerConfigDataPlugin = bundlerConfigDataPlugin;
|
|
7287
|
-
}
|
|
7288
|
-
async configBundlerConfig(app, frontend, config, fs, frameworkKind) {
|
|
7289
|
-
const isDev = config.env === "dev";
|
|
7290
|
-
const { backendUrl, publicPath, aliasMapStr, dependenciesStr } = await this.bundlerConfigDataPlugin.getBundlerConfigData(
|
|
7291
|
-
app,
|
|
7292
|
-
frontend,
|
|
7293
|
-
config,
|
|
7294
|
-
fs,
|
|
7295
|
-
frameworkKind
|
|
7296
|
-
);
|
|
7297
|
-
const viteConfigSource = fs.read("/vite.config.ts")?.toString();
|
|
7298
|
-
if (viteConfigSource) {
|
|
7299
|
-
fs.write(
|
|
7300
|
-
"/vite.config.ts",
|
|
7301
|
-
viteConfigSource.replace(`const backendUrl = ''`, `const backendUrl = '${backendUrl}'`).replace(`const publicPath = ''`, `const publicPath = '${publicPath}'`).replace(`const isDev = false`, `const isDev = ${isDev}`).replace("alias: {}", `alias: {${aliasMapStr}}`).replace(
|
|
7302
|
-
"optimizeDeps: { include: [], },",
|
|
7303
|
-
`optimizeDeps: { include: [${dependenciesStr}], },`
|
|
7304
|
-
)
|
|
7305
|
-
);
|
|
7306
|
-
}
|
|
7307
|
-
}
|
|
7308
|
-
static install(c) {
|
|
7309
|
-
c.bind(ServiceMetaKind.FrontendBundlerFileConfig).to(ViteConfigPlugin).inSingletonScope();
|
|
7310
|
-
return c;
|
|
7311
|
-
}
|
|
7312
|
-
};
|
|
7313
|
-
ViteConfigPlugin = __decorateClass([
|
|
7314
|
-
injectable20(),
|
|
7315
|
-
__decorateParam(0, inject12(BundlerConfigDataPlugin))
|
|
7316
|
-
], ViteConfigPlugin);
|
|
7317
|
-
|
|
7318
7270
|
// src/plugins/vue/vue3/vue3-application-assembler-plugin.ts
|
|
7319
|
-
import { inject as
|
|
7271
|
+
import { inject as inject14, injectable as injectable29 } from "inversify";
|
|
7320
7272
|
|
|
7321
7273
|
// src/plugins/vue/common/vue-router-plugin.ts
|
|
7322
7274
|
import { kebab2Pascal as kebab2Pascal2 } from "@lcap/nasl-utils";
|
|
7323
|
-
import { injectable as
|
|
7275
|
+
import { injectable as injectable20 } from "inversify";
|
|
7324
7276
|
var VueRouterPlugin = class {
|
|
7325
7277
|
extractImportIR(routes, componentPathManager) {
|
|
7326
7278
|
const nameMangler = new NameMangler();
|
|
@@ -7353,17 +7305,26 @@ var VueRouterPlugin = class {
|
|
|
7353
7305
|
}
|
|
7354
7306
|
routeToCode(routes, componentPathManager, config) {
|
|
7355
7307
|
function serializeVueRoute(r, isRoot = false) {
|
|
7356
|
-
const
|
|
7308
|
+
const { accumulativePath, thisLevelPath } = r;
|
|
7309
|
+
const path = isRoot ? accumulativePath : thisLevelPath ?? "/";
|
|
7310
|
+
const basePath = config.basePath;
|
|
7357
7311
|
if (r.kind === "normal") {
|
|
7358
7312
|
const children = r.children?.map((i) => serializeVueRoute(i)).filter(isNotNil) ?? [];
|
|
7359
7313
|
const childrenStr = children.join(",\n");
|
|
7360
7314
|
const componentCode = `component: ${r.elementMangledName ?? r.elementTemplate.identifier}`;
|
|
7361
|
-
return `{path: "${
|
|
7315
|
+
return `{path: "${path}", meta: ${JSON.stringify(
|
|
7362
7316
|
r.meta
|
|
7363
7317
|
)}, children: [${childrenStr}], ${componentCode} }`;
|
|
7364
7318
|
} else if (r.kind === "redirect") {
|
|
7365
7319
|
if (["vue3"].includes(config.frameworkKind) && path === "*") {
|
|
7366
|
-
return `{ path: "/:pathMatch(.*)*", redirect: ${JSON.stringify(r.redirect)} }`;
|
|
7320
|
+
return `{ path: "/:pathMatch(.*)*", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
|
|
7321
|
+
}
|
|
7322
|
+
if (["vue3"].includes(config.frameworkKind) && path === "/") {
|
|
7323
|
+
let result = `{ path: "/", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
|
|
7324
|
+
if (basePath !== "/") {
|
|
7325
|
+
result += `, { path: "${basePath}", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
|
|
7326
|
+
}
|
|
7327
|
+
return result;
|
|
7367
7328
|
}
|
|
7368
7329
|
return `{ path: "${path}", redirect: to => to.path.replace(/\\/$/, '') + '/' + ${JSON.stringify(r.redirect)} }`;
|
|
7369
7330
|
}
|
|
@@ -7385,11 +7346,11 @@ var VueRouterPlugin = class {
|
|
|
7385
7346
|
}
|
|
7386
7347
|
};
|
|
7387
7348
|
VueRouterPlugin = __decorateClass([
|
|
7388
|
-
|
|
7349
|
+
injectable20()
|
|
7389
7350
|
], VueRouterPlugin);
|
|
7390
7351
|
|
|
7391
7352
|
// src/plugins/vue/vue3/vue3-codegen-plugin.ts
|
|
7392
|
-
import { injectable as
|
|
7353
|
+
import { injectable as injectable21 } from "inversify";
|
|
7393
7354
|
import { kebab2Pascal as kebab2Pascal3 } from "@lcap/nasl-utils";
|
|
7394
7355
|
import { flatten as flatten2 } from "lodash";
|
|
7395
7356
|
var Vue3CodegenPlugin = class {
|
|
@@ -7437,11 +7398,11 @@ var Vue3CodegenPlugin = class {
|
|
|
7437
7398
|
}
|
|
7438
7399
|
};
|
|
7439
7400
|
Vue3CodegenPlugin = __decorateClass([
|
|
7440
|
-
|
|
7401
|
+
injectable21()
|
|
7441
7402
|
], Vue3CodegenPlugin);
|
|
7442
7403
|
|
|
7443
7404
|
// src/plugins/vue/vue3/vue3-entry-builder-plugin.ts
|
|
7444
|
-
import { injectable as
|
|
7405
|
+
import { injectable as injectable22, inject as inject12 } from "inversify";
|
|
7445
7406
|
var Vue3EntryBuilderPlugin = class {
|
|
7446
7407
|
constructor(microFrontendManager) {
|
|
7447
7408
|
this.microFrontendManager = microFrontendManager;
|
|
@@ -7483,12 +7444,12 @@ var Vue3EntryBuilderPlugin = class {
|
|
|
7483
7444
|
}
|
|
7484
7445
|
};
|
|
7485
7446
|
Vue3EntryBuilderPlugin = __decorateClass([
|
|
7486
|
-
|
|
7487
|
-
__decorateParam(0,
|
|
7447
|
+
injectable22(),
|
|
7448
|
+
__decorateParam(0, inject12(ServiceMetaKind.MicroFrontendManager))
|
|
7488
7449
|
], Vue3EntryBuilderPlugin);
|
|
7489
7450
|
|
|
7490
7451
|
// src/plugins/vue/vue3/vue3-libraries-builder-plugin.ts
|
|
7491
|
-
import { injectable as
|
|
7452
|
+
import { injectable as injectable23 } from "inversify";
|
|
7492
7453
|
var Vue3LibrariesBuilderPlugin = class {
|
|
7493
7454
|
/**
|
|
7494
7455
|
* 构建依赖库导入文件
|
|
@@ -7497,10 +7458,13 @@ var Vue3LibrariesBuilderPlugin = class {
|
|
|
7497
7458
|
*/
|
|
7498
7459
|
async buildLibrariesImport(ir, config) {
|
|
7499
7460
|
const importArr = [];
|
|
7461
|
+
const exportArr = [];
|
|
7500
7462
|
const standardLib = ir.packages.find((x) => x.kind === "standard");
|
|
7501
7463
|
if (standardLib) {
|
|
7502
7464
|
const formattedName = kebab2Pascal(standardLib.name.split("/").at(-1));
|
|
7503
|
-
importArr.push(`
|
|
7465
|
+
importArr.push(`import * as ${formattedName} from '${standardLib.name}';`);
|
|
7466
|
+
exportArr.push(`export { ${formattedName} };`);
|
|
7467
|
+
exportArr.push(`window.lcapStandardUI = ${formattedName};`);
|
|
7504
7468
|
const isPackageZipExists = await judgePackageZipExists(standardLib, config.STATIC_URL);
|
|
7505
7469
|
importArr.push(
|
|
7506
7470
|
`import '${standardLib.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
|
|
@@ -7511,14 +7475,14 @@ var Vue3LibrariesBuilderPlugin = class {
|
|
|
7511
7475
|
const formattedName = kebab2Pascal(ext.name.split("/").at(-1));
|
|
7512
7476
|
const isPackageZipExists = await judgePackageZipExists(ext, config.STATIC_URL);
|
|
7513
7477
|
const prefix = isPackageZipExists ? "" : "@extension/";
|
|
7514
|
-
|
|
7478
|
+
exportArr.push(`export * as ${formattedName} from '${prefix}${ext.name}';`);
|
|
7515
7479
|
if (ext.hasCss) {
|
|
7516
7480
|
importArr.push(
|
|
7517
7481
|
`import '${prefix}${ext.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
|
|
7518
7482
|
);
|
|
7519
7483
|
}
|
|
7520
7484
|
}
|
|
7521
|
-
return new ReactFileDescription("libraries.ts", [], [], [importArr.join("\n")]);
|
|
7485
|
+
return new ReactFileDescription("libraries.ts", [], [], [[...importArr, ...exportArr].join("\n")]);
|
|
7522
7486
|
}
|
|
7523
7487
|
static install(c) {
|
|
7524
7488
|
c.bind(Vue3LibrariesBuilderPlugin).toSelf();
|
|
@@ -7526,11 +7490,11 @@ var Vue3LibrariesBuilderPlugin = class {
|
|
|
7526
7490
|
}
|
|
7527
7491
|
};
|
|
7528
7492
|
Vue3LibrariesBuilderPlugin = __decorateClass([
|
|
7529
|
-
|
|
7493
|
+
injectable23()
|
|
7530
7494
|
], Vue3LibrariesBuilderPlugin);
|
|
7531
7495
|
|
|
7532
7496
|
// src/plugins/vue/vue3/vue3-meta-data-builder-plugin.ts
|
|
7533
|
-
import { injectable as
|
|
7497
|
+
import { injectable as injectable24 } from "inversify";
|
|
7534
7498
|
var Vue3MetaDataBuilderPlugin = class {
|
|
7535
7499
|
/**
|
|
7536
7500
|
* 构建依赖库导入文件
|
|
@@ -7551,7 +7515,7 @@ var Vue3MetaDataBuilderPlugin = class {
|
|
|
7551
7515
|
}
|
|
7552
7516
|
};
|
|
7553
7517
|
Vue3MetaDataBuilderPlugin = __decorateClass([
|
|
7554
|
-
|
|
7518
|
+
injectable24()
|
|
7555
7519
|
], Vue3MetaDataBuilderPlugin);
|
|
7556
7520
|
function stringifyMetaData(obj) {
|
|
7557
7521
|
if (typeof obj === "object" && obj !== null) {
|
|
@@ -7585,7 +7549,7 @@ function stringifyMetaData(obj) {
|
|
|
7585
7549
|
}
|
|
7586
7550
|
|
|
7587
7551
|
// src/plugins/vue/vue3/vue3-components-index-builder-plugin.ts
|
|
7588
|
-
import { injectable as
|
|
7552
|
+
import { injectable as injectable25 } from "inversify";
|
|
7589
7553
|
var Vue3ComponentsIndexBuilderPlugin = class {
|
|
7590
7554
|
/**
|
|
7591
7555
|
* 构建业务组件导出入口文件
|
|
@@ -7615,11 +7579,11 @@ var Vue3ComponentsIndexBuilderPlugin = class {
|
|
|
7615
7579
|
}
|
|
7616
7580
|
};
|
|
7617
7581
|
Vue3ComponentsIndexBuilderPlugin = __decorateClass([
|
|
7618
|
-
|
|
7582
|
+
injectable25()
|
|
7619
7583
|
], Vue3ComponentsIndexBuilderPlugin);
|
|
7620
7584
|
|
|
7621
7585
|
// src/plugins/vue/vue3/vue3-client-lazyload-template-builder-plugin .ts
|
|
7622
|
-
import { injectable as
|
|
7586
|
+
import { injectable as injectable26, inject as inject13 } from "inversify";
|
|
7623
7587
|
var Vue3ClientLazyloadTemplateBuilderPlugin = class {
|
|
7624
7588
|
constructor(microFrontendManager) {
|
|
7625
7589
|
this.microFrontendManager = microFrontendManager;
|
|
@@ -7632,32 +7596,19 @@ var Vue3ClientLazyloadTemplateBuilderPlugin = class {
|
|
|
7632
7596
|
const isDebug = ir.configs.config.debug;
|
|
7633
7597
|
const entryScript = this.microFrontendManager.produceScript(ir);
|
|
7634
7598
|
return new ReactFileDescription(
|
|
7635
|
-
"../client-lazyload-template.
|
|
7599
|
+
"../client-lazyload-template.js",
|
|
7636
7600
|
[],
|
|
7637
7601
|
[],
|
|
7638
7602
|
[
|
|
7639
|
-
`
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
);` : ""}
|
|
7649
|
-
const lazyLoadCommand = \`
|
|
7650
|
-
\${JSON.stringify(jsAssets)}.forEach(asset => window.LazyLoad.js(asset));
|
|
7651
|
-
window.LazyLoad.css(\${JSON.stringify(cssAssets)});
|
|
7652
|
-
\`;
|
|
7653
|
-
return \`(function(){
|
|
7654
|
-
function loadAssets(){
|
|
7655
|
-
\${lazyLoadCommand};
|
|
7656
|
-
}
|
|
7657
|
-
${entryScript};
|
|
7658
|
-
})();\`;
|
|
7659
|
-
}
|
|
7660
|
-
`
|
|
7603
|
+
`const extraJS = [];
|
|
7604
|
+
const extraCSS = [];
|
|
7605
|
+
const entryCode = \`${entryScript}\`;
|
|
7606
|
+
|
|
7607
|
+
module.exports = {
|
|
7608
|
+
extraJS,
|
|
7609
|
+
extraCSS,
|
|
7610
|
+
entryCode,
|
|
7611
|
+
}`
|
|
7661
7612
|
]
|
|
7662
7613
|
);
|
|
7663
7614
|
}
|
|
@@ -7667,12 +7618,12 @@ var Vue3ClientLazyloadTemplateBuilderPlugin = class {
|
|
|
7667
7618
|
}
|
|
7668
7619
|
};
|
|
7669
7620
|
Vue3ClientLazyloadTemplateBuilderPlugin = __decorateClass([
|
|
7670
|
-
|
|
7671
|
-
__decorateParam(0,
|
|
7621
|
+
injectable26(),
|
|
7622
|
+
__decorateParam(0, inject13(ServiceMetaKind.MicroFrontendManager))
|
|
7672
7623
|
], Vue3ClientLazyloadTemplateBuilderPlugin);
|
|
7673
7624
|
|
|
7674
7625
|
// src/plugins/vue/vue3/vue3-platform-builder-plugin.ts
|
|
7675
|
-
import { injectable as
|
|
7626
|
+
import { injectable as injectable27 } from "inversify";
|
|
7676
7627
|
var Vue3PlatformBuilderPlugin = class {
|
|
7677
7628
|
/**
|
|
7678
7629
|
* 构建平台配置文件
|
|
@@ -7706,11 +7657,11 @@ var Vue3PlatformBuilderPlugin = class {
|
|
|
7706
7657
|
}
|
|
7707
7658
|
};
|
|
7708
7659
|
Vue3PlatformBuilderPlugin = __decorateClass([
|
|
7709
|
-
|
|
7660
|
+
injectable27()
|
|
7710
7661
|
], Vue3PlatformBuilderPlugin);
|
|
7711
7662
|
|
|
7712
7663
|
// src/plugins/vue/vue3/vue3-entry-css-plugin.ts
|
|
7713
|
-
import { injectable as
|
|
7664
|
+
import { injectable as injectable28 } from "inversify";
|
|
7714
7665
|
var Vue3EntryCssPlugin = class {
|
|
7715
7666
|
/**
|
|
7716
7667
|
* 构建依赖库导入文件
|
|
@@ -7727,7 +7678,7 @@ var Vue3EntryCssPlugin = class {
|
|
|
7727
7678
|
}
|
|
7728
7679
|
};
|
|
7729
7680
|
Vue3EntryCssPlugin = __decorateClass([
|
|
7730
|
-
|
|
7681
|
+
injectable28()
|
|
7731
7682
|
], Vue3EntryCssPlugin);
|
|
7732
7683
|
|
|
7733
7684
|
// src/plugins/vue/vue3/vue3-application-assembler-plugin.ts
|
|
@@ -7744,7 +7695,7 @@ var ComponentPathManager = class {
|
|
|
7744
7695
|
}
|
|
7745
7696
|
};
|
|
7746
7697
|
ComponentPathManager = __decorateClass([
|
|
7747
|
-
|
|
7698
|
+
injectable29()
|
|
7748
7699
|
], ComponentPathManager);
|
|
7749
7700
|
var Vue3ApplicationAssemblerPlugin = class {
|
|
7750
7701
|
constructor(vue3CodegenPlugin, routesExtactor, routerBuilder, entryBuilder, librariesBuilder, entryCssBuilder, componentsIndexBuilder, clientLazyloadTemplateBuilder, platformBuilder, metaDataBuilder) {
|
|
@@ -7767,15 +7718,16 @@ var Vue3ApplicationAssemblerPlugin = class {
|
|
|
7767
7718
|
const bizComponents = ir.bizComponents.flatMap((x) => {
|
|
7768
7719
|
return this.vue3CodegenPlugin.genFiles(x, manager);
|
|
7769
7720
|
});
|
|
7770
|
-
let
|
|
7771
|
-
if (!/\/$/.test(
|
|
7772
|
-
|
|
7721
|
+
let basePath = ir.configs.basePlatformConfig.basePath;
|
|
7722
|
+
if (!/\/$/.test(basePath)) {
|
|
7723
|
+
basePath += "/";
|
|
7773
7724
|
}
|
|
7774
|
-
const routesObjects = this.routesExtactor.extractRoute(ir.views,
|
|
7725
|
+
const routesObjects = this.routesExtactor.extractRoute(ir.views, basePath, {
|
|
7775
7726
|
lazy: true
|
|
7776
7727
|
});
|
|
7777
7728
|
const router = this.routerBuilder.routeToCode(routesObjects.routes, manager, {
|
|
7778
|
-
frameworkKind: "vue3"
|
|
7729
|
+
frameworkKind: "vue3",
|
|
7730
|
+
basePath
|
|
7779
7731
|
});
|
|
7780
7732
|
const routerFile = new ReactFileDescription("router.ts", router.imports, [], [router.code]);
|
|
7781
7733
|
const libraries = await this.librariesBuilder.buildLibrariesImport(ir, config);
|
|
@@ -7799,17 +7751,17 @@ var Vue3ApplicationAssemblerPlugin = class {
|
|
|
7799
7751
|
}
|
|
7800
7752
|
};
|
|
7801
7753
|
Vue3ApplicationAssemblerPlugin = __decorateClass([
|
|
7802
|
-
|
|
7803
|
-
__decorateParam(0,
|
|
7804
|
-
__decorateParam(1,
|
|
7805
|
-
__decorateParam(2,
|
|
7806
|
-
__decorateParam(3,
|
|
7807
|
-
__decorateParam(4,
|
|
7808
|
-
__decorateParam(5,
|
|
7809
|
-
__decorateParam(6,
|
|
7810
|
-
__decorateParam(7,
|
|
7811
|
-
__decorateParam(8,
|
|
7812
|
-
__decorateParam(9,
|
|
7754
|
+
injectable29(),
|
|
7755
|
+
__decorateParam(0, inject14(Vue3CodegenPlugin)),
|
|
7756
|
+
__decorateParam(1, inject14(RoutesExtractionPlugin)),
|
|
7757
|
+
__decorateParam(2, inject14(VueRouterPlugin)),
|
|
7758
|
+
__decorateParam(3, inject14(Vue3EntryBuilderPlugin)),
|
|
7759
|
+
__decorateParam(4, inject14(Vue3LibrariesBuilderPlugin)),
|
|
7760
|
+
__decorateParam(5, inject14(Vue3EntryCssPlugin)),
|
|
7761
|
+
__decorateParam(6, inject14(Vue3ComponentsIndexBuilderPlugin)),
|
|
7762
|
+
__decorateParam(7, inject14(Vue3ClientLazyloadTemplateBuilderPlugin)),
|
|
7763
|
+
__decorateParam(8, inject14(Vue3PlatformBuilderPlugin)),
|
|
7764
|
+
__decorateParam(9, inject14(Vue3MetaDataBuilderPlugin))
|
|
7813
7765
|
], Vue3ApplicationAssemblerPlugin);
|
|
7814
7766
|
|
|
7815
7767
|
// src/plugins/vue/vue3/vue3-preset-plugin.ts
|
|
@@ -7828,6 +7780,30 @@ var Vue3PresetPlugin = class {
|
|
|
7828
7780
|
const app = deserializeAppWhileKeepTypeAnnotation(appJson);
|
|
7829
7781
|
const frontend = app.findNodeByPath(instruction.frontend.nodePath);
|
|
7830
7782
|
const ir = this.irBuilder.buildIR(app, frontend, instruction.config);
|
|
7783
|
+
const needCompileViews = instruction.config?.needCompileViews ?? [];
|
|
7784
|
+
const isIncremental = needCompileViews.length > 0;
|
|
7785
|
+
if (isIncremental) {
|
|
7786
|
+
const filterChildComponents = (view, needCompileViews2) => {
|
|
7787
|
+
if (!view.childComponents?.length) {
|
|
7788
|
+
return;
|
|
7789
|
+
}
|
|
7790
|
+
view.childComponents = view.childComponents.filter((child) => {
|
|
7791
|
+
if (needCompileViews2.includes(child.__raw.nodePath)) {
|
|
7792
|
+
filterChildComponents(child, needCompileViews2);
|
|
7793
|
+
return true;
|
|
7794
|
+
}
|
|
7795
|
+
return false;
|
|
7796
|
+
});
|
|
7797
|
+
};
|
|
7798
|
+
ir.views = ir.views.filter((view) => {
|
|
7799
|
+
if (needCompileViews.includes(view.__raw.nodePath)) {
|
|
7800
|
+
filterChildComponents(view, needCompileViews);
|
|
7801
|
+
return true;
|
|
7802
|
+
}
|
|
7803
|
+
return false;
|
|
7804
|
+
});
|
|
7805
|
+
ir.bizComponents = [];
|
|
7806
|
+
}
|
|
7831
7807
|
const assembledApplication = await this.applicationAssembler.assemble(ir, instruction.config);
|
|
7832
7808
|
const finalizedFiles = await this.projectOrganizer.organize({
|
|
7833
7809
|
baseDir: instruction.baseDir,
|
|
@@ -7864,7 +7840,7 @@ var Vue3PresetPlugin = class {
|
|
|
7864
7840
|
c.bind(ServiceMetaKind.ProjectOrganizer).to(ProjectOrganizerPlugin);
|
|
7865
7841
|
c.bind(ServiceMetaKind.FileSystemProvider).to(FileSystemPlugin).inSingletonScope();
|
|
7866
7842
|
c = BundlerConfigDataPlugin.install(c);
|
|
7867
|
-
c =
|
|
7843
|
+
c = RspackConfigPlugin.install(c);
|
|
7868
7844
|
c = FrontendBundlerConfigPlugin.install(c);
|
|
7869
7845
|
c = FrontendPerformancePlugin.install(c);
|
|
7870
7846
|
c = NpmPackageJSONManagerPlugin.install(c);
|
|
@@ -7881,12 +7857,12 @@ var Vue3PresetPlugin = class {
|
|
|
7881
7857
|
}
|
|
7882
7858
|
};
|
|
7883
7859
|
Vue3PresetPlugin = __decorateClass([
|
|
7884
|
-
|
|
7885
|
-
__decorateParam(0,
|
|
7886
|
-
__decorateParam(1,
|
|
7887
|
-
__decorateParam(2,
|
|
7888
|
-
__decorateParam(3,
|
|
7889
|
-
__decorateParam(4,
|
|
7860
|
+
injectable30(),
|
|
7861
|
+
__decorateParam(0, inject15(ServiceMetaKind.IRBuilder)),
|
|
7862
|
+
__decorateParam(1, inject15(ServiceMetaKind.FileSystemProvider)),
|
|
7863
|
+
__decorateParam(2, inject15(NpmPackageJSONManagerPlugin)),
|
|
7864
|
+
__decorateParam(3, inject15(ServiceMetaKind.ProjectOrganizer)),
|
|
7865
|
+
__decorateParam(4, inject15(Vue3ApplicationAssemblerPlugin))
|
|
7890
7866
|
], Vue3PresetPlugin);
|
|
7891
7867
|
|
|
7892
7868
|
// src/default-container.ts
|
|
@@ -8061,7 +8037,7 @@ async function compileNASLToReactDist(app, frontend, config, http) {
|
|
|
8061
8037
|
}
|
|
8062
8038
|
|
|
8063
8039
|
// src/plugins/misc/program-analysis/analyzer-manager-plugin.ts
|
|
8064
|
-
import { injectable as
|
|
8040
|
+
import { injectable as injectable31 } from "inversify";
|
|
8065
8041
|
|
|
8066
8042
|
// src/plugins/misc/program-analysis/analysis/async-analysis.ts
|
|
8067
8043
|
function buildAsyncAnalyzer() {
|
|
@@ -8188,11 +8164,11 @@ var AnalyzerManagerPlugin = class {
|
|
|
8188
8164
|
}
|
|
8189
8165
|
};
|
|
8190
8166
|
AnalyzerManagerPlugin = __decorateClass([
|
|
8191
|
-
|
|
8167
|
+
injectable31()
|
|
8192
8168
|
], AnalyzerManagerPlugin);
|
|
8193
8169
|
|
|
8194
8170
|
// src/plugins/misc/name-mangler/name-mangler-manager-plugin.ts
|
|
8195
|
-
import { injectable as
|
|
8171
|
+
import { injectable as injectable32 } from "inversify";
|
|
8196
8172
|
|
|
8197
8173
|
// src/plugins/misc/name-mangler/name-mangler.ts
|
|
8198
8174
|
var NameMangler2 = class _NameMangler {
|
|
@@ -8259,7 +8235,7 @@ var NameManglerManagerPlugin = class {
|
|
|
8259
8235
|
}
|
|
8260
8236
|
};
|
|
8261
8237
|
NameManglerManagerPlugin = __decorateClass([
|
|
8262
|
-
|
|
8238
|
+
injectable32()
|
|
8263
8239
|
], NameManglerManagerPlugin);
|
|
8264
8240
|
export {
|
|
8265
8241
|
AnalyzerManagerPlugin,
|