@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/playground.d.mts
CHANGED
package/dist/playground.d.ts
CHANGED
package/dist/playground.js
CHANGED
|
@@ -2259,11 +2259,11 @@ var import_axios2 = __toESM(require("axios"));
|
|
|
2259
2259
|
var import_lodash9 = require("lodash");
|
|
2260
2260
|
|
|
2261
2261
|
// src/default-container.ts
|
|
2262
|
-
var
|
|
2262
|
+
var import_inversify31 = require("inversify");
|
|
2263
2263
|
|
|
2264
2264
|
// src/plugins/vue/vue3/vue3-preset-plugin.ts
|
|
2265
|
-
var
|
|
2266
|
-
var
|
|
2265
|
+
var import_reflection6 = require("@abraham/reflection");
|
|
2266
|
+
var import_inversify30 = require("inversify");
|
|
2267
2267
|
|
|
2268
2268
|
// src/service-metakind.ts
|
|
2269
2269
|
var ServiceMetaKind = {
|
|
@@ -4499,7 +4499,8 @@ query: {`;
|
|
|
4499
4499
|
let url2 = "`";
|
|
4500
4500
|
const viewArr = s3.genViewArr();
|
|
4501
4501
|
if (Array.isArray(viewArr) && viewArr.length) {
|
|
4502
|
-
|
|
4502
|
+
const prefixPath = s3.frontend?.prefixPath;
|
|
4503
|
+
url2 += `${prefixPath}/${viewArr.join("/")}`;
|
|
4503
4504
|
const { completeArguments } = s3;
|
|
4504
4505
|
if (completeArguments.length) {
|
|
4505
4506
|
const node = s3.viewNode;
|
|
@@ -6446,40 +6447,40 @@ var metadataPlugin = makePlugin({
|
|
|
6446
6447
|
// src/hack/material-config/material.config.js
|
|
6447
6448
|
var materials = {
|
|
6448
6449
|
framework: {
|
|
6449
|
-
version: "2.0.
|
|
6450
|
+
version: "2.0.1",
|
|
6450
6451
|
core: "@lcap/basic-template",
|
|
6451
6452
|
pc: [
|
|
6452
6453
|
{
|
|
6453
6454
|
frameworkKind: "vue2",
|
|
6454
6455
|
name: "@lcap/pc-template",
|
|
6455
|
-
version: "2.0.
|
|
6456
|
+
version: "2.0.1"
|
|
6456
6457
|
},
|
|
6457
6458
|
{
|
|
6458
6459
|
frameworkKind: "react",
|
|
6459
6460
|
name: "@lcap/pc-template-react",
|
|
6460
|
-
version: "2.0.
|
|
6461
|
+
version: "2.0.1"
|
|
6461
6462
|
},
|
|
6462
6463
|
{
|
|
6463
6464
|
frameworkKind: "vue3",
|
|
6464
6465
|
name: "@lcap/pc-template-vue3",
|
|
6465
|
-
version: "2.0.
|
|
6466
|
+
version: "2.0.1"
|
|
6466
6467
|
}
|
|
6467
6468
|
],
|
|
6468
6469
|
h5: [
|
|
6469
6470
|
{
|
|
6470
6471
|
frameworkKind: "vue2",
|
|
6471
6472
|
name: "@lcap/mobile-template",
|
|
6472
|
-
version: "2.0.
|
|
6473
|
+
version: "2.0.1"
|
|
6473
6474
|
},
|
|
6474
6475
|
{
|
|
6475
6476
|
frameworkKind: "react",
|
|
6476
6477
|
name: "@lcap/mobile-template-react",
|
|
6477
|
-
version: "2.0.
|
|
6478
|
+
version: "2.0.1"
|
|
6478
6479
|
},
|
|
6479
6480
|
{
|
|
6480
6481
|
frameworkKind: "vue3",
|
|
6481
6482
|
name: "@lcap/mobile-template-vue3",
|
|
6482
|
-
version: "2.0.
|
|
6483
|
+
version: "2.0.1"
|
|
6483
6484
|
}
|
|
6484
6485
|
]
|
|
6485
6486
|
},
|
|
@@ -6553,29 +6554,6 @@ var coreVersion = materials.framework.version;
|
|
|
6553
6554
|
function getPredefinedMaterialConfig() {
|
|
6554
6555
|
return materials;
|
|
6555
6556
|
}
|
|
6556
|
-
function getPredefinedLibConstants() {
|
|
6557
|
-
if (!reactUi || !vue3Ui) {
|
|
6558
|
-
throw new Error("not found");
|
|
6559
|
-
}
|
|
6560
|
-
if (reactUi.name !== "@lcap/pc-react-ui") {
|
|
6561
|
-
throw new Error("cannot find @lcap/pc-react-ui in material.config.js");
|
|
6562
|
-
}
|
|
6563
|
-
return {
|
|
6564
|
-
reactUI: {
|
|
6565
|
-
kind: "standard",
|
|
6566
|
-
name: reactUi.name,
|
|
6567
|
-
version: reactUi.version
|
|
6568
|
-
},
|
|
6569
|
-
vue3Ui: {
|
|
6570
|
-
kind: "standard",
|
|
6571
|
-
name: vue3Ui.name,
|
|
6572
|
-
version: vue3Ui.version
|
|
6573
|
-
},
|
|
6574
|
-
basicTemplate: {
|
|
6575
|
-
version: coreVersion
|
|
6576
|
-
}
|
|
6577
|
-
};
|
|
6578
|
-
}
|
|
6579
6557
|
var getPredefinedMaterialByTags = (() => {
|
|
6580
6558
|
const materialConfig = getPredefinedMaterialConfig();
|
|
6581
6559
|
let allMaterials = [];
|
|
@@ -6599,12 +6577,14 @@ var getPredefinedMaterialByTags = (() => {
|
|
|
6599
6577
|
materialConfig.ui.pc.forEach((item) => {
|
|
6600
6578
|
allMaterials.push({
|
|
6601
6579
|
...item,
|
|
6580
|
+
kind: "standard",
|
|
6602
6581
|
tags: ["ui", "pc", item.frameworkKind, item.libName]
|
|
6603
6582
|
});
|
|
6604
6583
|
});
|
|
6605
6584
|
materialConfig.ui.h5.forEach((item) => {
|
|
6606
6585
|
allMaterials.push({
|
|
6607
6586
|
...item,
|
|
6587
|
+
kind: "standard",
|
|
6608
6588
|
tags: ["ui", "h5", item.frameworkKind, item.libName]
|
|
6609
6589
|
});
|
|
6610
6590
|
});
|
|
@@ -6764,7 +6744,10 @@ function bindAttrToIR(b) {
|
|
|
6764
6744
|
throw new Error("string\u4E0D\u53EF\u4E3Async");
|
|
6765
6745
|
}
|
|
6766
6746
|
if (b.i18nKey && b.value && b.frontend?.i18nInfo?.enabled) {
|
|
6767
|
-
|
|
6747
|
+
const frameworkKind = b.frontend?.frameworkKind;
|
|
6748
|
+
if (!["vue3"].includes(frameworkKind)) {
|
|
6749
|
+
b.type = "dynamic";
|
|
6750
|
+
}
|
|
6768
6751
|
const wrapperExpr = import_nasl_concepts9.CallFunction.from(
|
|
6769
6752
|
{
|
|
6770
6753
|
calleeNamespace: "$i18n",
|
|
@@ -6868,7 +6851,7 @@ function bindEventToAction(b) {
|
|
|
6868
6851
|
kind: "standalone"
|
|
6869
6852
|
};
|
|
6870
6853
|
}
|
|
6871
|
-
var DefaultComponentLibraryName =
|
|
6854
|
+
var DefaultComponentLibraryName = getPredefinedMaterialByTags(["ui", "pc", "react"])?.name;
|
|
6872
6855
|
function getReferencedLibComponent(e) {
|
|
6873
6856
|
const tag = e.tag;
|
|
6874
6857
|
if (tag.startsWith("BS")) {
|
|
@@ -7534,8 +7517,8 @@ var NASLAppIRBuilderPlugin = class {
|
|
|
7534
7517
|
});
|
|
7535
7518
|
logger5.debug({ extensionPackages });
|
|
7536
7519
|
const frameworkKind = frontend.frameworkKind;
|
|
7537
|
-
const
|
|
7538
|
-
return [...extensionPackages,
|
|
7520
|
+
const uiLib = getPredefinedMaterialByTags(["ui", frontend.type, frameworkKind]);
|
|
7521
|
+
return [...extensionPackages, uiLib];
|
|
7539
7522
|
};
|
|
7540
7523
|
var buildConfigs = buildConfigs2, collectPackages = collectPackages2;
|
|
7541
7524
|
config2.debug && breakpoint2.genBreakpoints(app);
|
|
@@ -8904,10 +8887,9 @@ function extractAppLevelFrontendDeps(app) {
|
|
|
8904
8887
|
}
|
|
8905
8888
|
function extractFrontendLevelDeps(frontend) {
|
|
8906
8889
|
const deps = [];
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
deps.push(getPredefinedLibConstants().vue3Ui);
|
|
8890
|
+
const uiLib = getPredefinedMaterialByTags(["ui", frontend.type, frontend.frameworkKind]);
|
|
8891
|
+
if (uiLib) {
|
|
8892
|
+
deps.push(uiLib);
|
|
8911
8893
|
}
|
|
8912
8894
|
return deps;
|
|
8913
8895
|
}
|
|
@@ -9080,11 +9062,11 @@ async function downloadDependenciesToLcapModules(feDeps, fs, config2) {
|
|
|
9080
9062
|
}
|
|
9081
9063
|
let packageJson = fs.read("/package.json")?.toString();
|
|
9082
9064
|
packageJson = JSON.parse(packageJson);
|
|
9083
|
-
if (!packageJson.
|
|
9084
|
-
packageJson.
|
|
9065
|
+
if (!packageJson.lcap_modules) {
|
|
9066
|
+
packageJson.lcap_modules = {};
|
|
9085
9067
|
}
|
|
9086
9068
|
downloadedDeps.forEach(({ pkgName, targetPath }) => {
|
|
9087
|
-
packageJson.
|
|
9069
|
+
packageJson.lcap_modules[pkgName] = `.${targetPath}`;
|
|
9088
9070
|
});
|
|
9089
9071
|
fs.write("/package.json", JSON.stringify(packageJson, null, 2));
|
|
9090
9072
|
logger15.info("\u4E0B\u8F7D\u524D\u7AEF\u4F9D\u8D56\u5E93\u5230 lcap_modules \u76EE\u5F55\u5B8C\u6210");
|
|
@@ -9159,7 +9141,7 @@ BundlerConfigDataPlugin = __decorateClass([
|
|
|
9159
9141
|
__decorateParam(0, (0, import_inversify16.inject)(ServiceMetaKind.FrontendBundlerConfig))
|
|
9160
9142
|
], BundlerConfigDataPlugin);
|
|
9161
9143
|
|
|
9162
|
-
// src/plugins/misc/bundler/
|
|
9144
|
+
// src/plugins/misc/bundler/rspack-config-plugin.ts
|
|
9163
9145
|
var import_reflection4 = require("@abraham/reflection");
|
|
9164
9146
|
var import_inversify17 = require("inversify");
|
|
9165
9147
|
var RspackConfigPlugin = class {
|
|
@@ -9183,9 +9165,16 @@ var RspackConfigPlugin = class {
|
|
|
9183
9165
|
`chunks: '${this.frontendPerformancePlugin?.performanceOptions?.chunks}'`
|
|
9184
9166
|
);
|
|
9185
9167
|
}
|
|
9168
|
+
rspackConfigSource = rspackConfigSource.replace(`const backendUrl = '';`, `const backendUrl = '${backendUrl}'`).replace(`const publicPath = '';`, `const publicPath = '${publicPath}';`).replace(`sourceMap: false,`, `sourceMap: ${config2.env === "dev"},`).replace("alias: {}", `alias: {${aliasMapStr}}`).replace("const isDev = false", `const isDev = ${config2.env === "dev"}`);
|
|
9169
|
+
if (config2.needCompileViews && config2.needCompileViews.length > 0 && config2.cacheChunksMapCode) {
|
|
9170
|
+
rspackConfigSource = rspackConfigSource.replace("isIncremental: false", "isIncremental: true").replace("chunksMap: ''", `chunksMap: \`${config2.cacheChunksMapCode}\``);
|
|
9171
|
+
}
|
|
9172
|
+
if (config2.isExport) {
|
|
9173
|
+
rspackConfigSource = rspackConfigSource.replace(/\/\/ LcapPlugin start\s+new LcapPlugin\(\{[\s\S]*?\}\),\s+\/\/ LcapPlugin end/g, "");
|
|
9174
|
+
}
|
|
9186
9175
|
fs.write(
|
|
9187
9176
|
"/rspack.config.js",
|
|
9188
|
-
rspackConfigSource
|
|
9177
|
+
rspackConfigSource
|
|
9189
9178
|
);
|
|
9190
9179
|
}
|
|
9191
9180
|
}
|
|
@@ -9393,49 +9382,12 @@ EntrypointPlugin = __decorateClass([
|
|
|
9393
9382
|
__decorateParam(0, (0, import_inversify19.inject)(ServiceMetaKind.MicroFrontendManager))
|
|
9394
9383
|
], EntrypointPlugin);
|
|
9395
9384
|
|
|
9396
|
-
// src/plugins/misc/bundler/vite-config-plugin.ts
|
|
9397
|
-
var import_reflection6 = require("@abraham/reflection");
|
|
9398
|
-
var import_inversify20 = require("inversify");
|
|
9399
|
-
var ViteConfigPlugin = class {
|
|
9400
|
-
constructor(bundlerConfigDataPlugin) {
|
|
9401
|
-
this.bundlerConfigDataPlugin = bundlerConfigDataPlugin;
|
|
9402
|
-
}
|
|
9403
|
-
async configBundlerConfig(app, frontend, config2, fs, frameworkKind) {
|
|
9404
|
-
const isDev = config2.env === "dev";
|
|
9405
|
-
const { backendUrl, publicPath, aliasMapStr, dependenciesStr } = await this.bundlerConfigDataPlugin.getBundlerConfigData(
|
|
9406
|
-
app,
|
|
9407
|
-
frontend,
|
|
9408
|
-
config2,
|
|
9409
|
-
fs,
|
|
9410
|
-
frameworkKind
|
|
9411
|
-
);
|
|
9412
|
-
const viteConfigSource = fs.read("/vite.config.ts")?.toString();
|
|
9413
|
-
if (viteConfigSource) {
|
|
9414
|
-
fs.write(
|
|
9415
|
-
"/vite.config.ts",
|
|
9416
|
-
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(
|
|
9417
|
-
"optimizeDeps: { include: [], },",
|
|
9418
|
-
`optimizeDeps: { include: [${dependenciesStr}], },`
|
|
9419
|
-
)
|
|
9420
|
-
);
|
|
9421
|
-
}
|
|
9422
|
-
}
|
|
9423
|
-
static install(c) {
|
|
9424
|
-
c.bind(ServiceMetaKind.FrontendBundlerFileConfig).to(ViteConfigPlugin).inSingletonScope();
|
|
9425
|
-
return c;
|
|
9426
|
-
}
|
|
9427
|
-
};
|
|
9428
|
-
ViteConfigPlugin = __decorateClass([
|
|
9429
|
-
(0, import_inversify20.injectable)(),
|
|
9430
|
-
__decorateParam(0, (0, import_inversify20.inject)(BundlerConfigDataPlugin))
|
|
9431
|
-
], ViteConfigPlugin);
|
|
9432
|
-
|
|
9433
9385
|
// src/plugins/vue/vue3/vue3-application-assembler-plugin.ts
|
|
9434
|
-
var
|
|
9386
|
+
var import_inversify29 = require("inversify");
|
|
9435
9387
|
|
|
9436
9388
|
// src/plugins/vue/common/vue-router-plugin.ts
|
|
9437
9389
|
var import_nasl_utils2 = require("@lcap/nasl-utils");
|
|
9438
|
-
var
|
|
9390
|
+
var import_inversify20 = require("inversify");
|
|
9439
9391
|
var VueRouterPlugin = class {
|
|
9440
9392
|
extractImportIR(routes, componentPathManager) {
|
|
9441
9393
|
const nameMangler = new NameMangler();
|
|
@@ -9468,17 +9420,26 @@ var VueRouterPlugin = class {
|
|
|
9468
9420
|
}
|
|
9469
9421
|
routeToCode(routes, componentPathManager, config2) {
|
|
9470
9422
|
function serializeVueRoute(r, isRoot = false) {
|
|
9471
|
-
const
|
|
9423
|
+
const { accumulativePath, thisLevelPath } = r;
|
|
9424
|
+
const path2 = isRoot ? accumulativePath : thisLevelPath ?? "/";
|
|
9425
|
+
const basePath = config2.basePath;
|
|
9472
9426
|
if (r.kind === "normal") {
|
|
9473
9427
|
const children = r.children?.map((i) => serializeVueRoute(i)).filter(isNotNil) ?? [];
|
|
9474
9428
|
const childrenStr = children.join(",\n");
|
|
9475
9429
|
const componentCode = `component: ${r.elementMangledName ?? r.elementTemplate.identifier}`;
|
|
9476
|
-
return `{path: "${
|
|
9430
|
+
return `{path: "${path2}", meta: ${JSON.stringify(
|
|
9477
9431
|
r.meta
|
|
9478
9432
|
)}, children: [${childrenStr}], ${componentCode} }`;
|
|
9479
9433
|
} else if (r.kind === "redirect") {
|
|
9480
9434
|
if (["vue3"].includes(config2.frameworkKind) && path2 === "*") {
|
|
9481
|
-
return `{ path: "/:pathMatch(.*)*", redirect: ${JSON.stringify(r.redirect)} }`;
|
|
9435
|
+
return `{ path: "/:pathMatch(.*)*", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
|
|
9436
|
+
}
|
|
9437
|
+
if (["vue3"].includes(config2.frameworkKind) && path2 === "/") {
|
|
9438
|
+
let result = `{ path: "/", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
|
|
9439
|
+
if (basePath !== "/") {
|
|
9440
|
+
result += `, { path: "${basePath}", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
|
|
9441
|
+
}
|
|
9442
|
+
return result;
|
|
9482
9443
|
}
|
|
9483
9444
|
return `{ path: "${path2}", redirect: to => to.path.replace(/\\/$/, '') + '/' + ${JSON.stringify(r.redirect)} }`;
|
|
9484
9445
|
}
|
|
@@ -9500,11 +9461,11 @@ var VueRouterPlugin = class {
|
|
|
9500
9461
|
}
|
|
9501
9462
|
};
|
|
9502
9463
|
VueRouterPlugin = __decorateClass([
|
|
9503
|
-
(0,
|
|
9464
|
+
(0, import_inversify20.injectable)()
|
|
9504
9465
|
], VueRouterPlugin);
|
|
9505
9466
|
|
|
9506
9467
|
// src/plugins/vue/vue3/vue3-codegen-plugin.ts
|
|
9507
|
-
var
|
|
9468
|
+
var import_inversify21 = require("inversify");
|
|
9508
9469
|
var import_nasl_utils3 = require("@lcap/nasl-utils");
|
|
9509
9470
|
var import_lodash8 = require("lodash");
|
|
9510
9471
|
var Vue3CodegenPlugin = class {
|
|
@@ -9552,11 +9513,11 @@ var Vue3CodegenPlugin = class {
|
|
|
9552
9513
|
}
|
|
9553
9514
|
};
|
|
9554
9515
|
Vue3CodegenPlugin = __decorateClass([
|
|
9555
|
-
(0,
|
|
9516
|
+
(0, import_inversify21.injectable)()
|
|
9556
9517
|
], Vue3CodegenPlugin);
|
|
9557
9518
|
|
|
9558
9519
|
// src/plugins/vue/vue3/vue3-entry-builder-plugin.ts
|
|
9559
|
-
var
|
|
9520
|
+
var import_inversify22 = require("inversify");
|
|
9560
9521
|
var Vue3EntryBuilderPlugin = class {
|
|
9561
9522
|
constructor(microFrontendManager) {
|
|
9562
9523
|
this.microFrontendManager = microFrontendManager;
|
|
@@ -9598,12 +9559,12 @@ var Vue3EntryBuilderPlugin = class {
|
|
|
9598
9559
|
}
|
|
9599
9560
|
};
|
|
9600
9561
|
Vue3EntryBuilderPlugin = __decorateClass([
|
|
9601
|
-
(0,
|
|
9602
|
-
__decorateParam(0, (0,
|
|
9562
|
+
(0, import_inversify22.injectable)(),
|
|
9563
|
+
__decorateParam(0, (0, import_inversify22.inject)(ServiceMetaKind.MicroFrontendManager))
|
|
9603
9564
|
], Vue3EntryBuilderPlugin);
|
|
9604
9565
|
|
|
9605
9566
|
// src/plugins/vue/vue3/vue3-libraries-builder-plugin.ts
|
|
9606
|
-
var
|
|
9567
|
+
var import_inversify23 = require("inversify");
|
|
9607
9568
|
var Vue3LibrariesBuilderPlugin = class {
|
|
9608
9569
|
/**
|
|
9609
9570
|
* 构建依赖库导入文件
|
|
@@ -9612,10 +9573,13 @@ var Vue3LibrariesBuilderPlugin = class {
|
|
|
9612
9573
|
*/
|
|
9613
9574
|
async buildLibrariesImport(ir, config2) {
|
|
9614
9575
|
const importArr = [];
|
|
9576
|
+
const exportArr = [];
|
|
9615
9577
|
const standardLib = ir.packages.find((x) => x.kind === "standard");
|
|
9616
9578
|
if (standardLib) {
|
|
9617
9579
|
const formattedName = kebab2Pascal(standardLib.name.split("/").at(-1));
|
|
9618
|
-
importArr.push(`
|
|
9580
|
+
importArr.push(`import * as ${formattedName} from '${standardLib.name}';`);
|
|
9581
|
+
exportArr.push(`export { ${formattedName} };`);
|
|
9582
|
+
exportArr.push(`window.lcapStandardUI = ${formattedName};`);
|
|
9619
9583
|
const isPackageZipExists = await judgePackageZipExists(standardLib, config2.STATIC_URL);
|
|
9620
9584
|
importArr.push(
|
|
9621
9585
|
`import '${standardLib.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
|
|
@@ -9626,14 +9590,14 @@ var Vue3LibrariesBuilderPlugin = class {
|
|
|
9626
9590
|
const formattedName = kebab2Pascal(ext.name.split("/").at(-1));
|
|
9627
9591
|
const isPackageZipExists = await judgePackageZipExists(ext, config2.STATIC_URL);
|
|
9628
9592
|
const prefix = isPackageZipExists ? "" : "@extension/";
|
|
9629
|
-
|
|
9593
|
+
exportArr.push(`export * as ${formattedName} from '${prefix}${ext.name}';`);
|
|
9630
9594
|
if (ext.hasCss) {
|
|
9631
9595
|
importArr.push(
|
|
9632
9596
|
`import '${prefix}${ext.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
|
|
9633
9597
|
);
|
|
9634
9598
|
}
|
|
9635
9599
|
}
|
|
9636
|
-
return new ReactFileDescription("libraries.ts", [], [], [importArr.join("\n")]);
|
|
9600
|
+
return new ReactFileDescription("libraries.ts", [], [], [[...importArr, ...exportArr].join("\n")]);
|
|
9637
9601
|
}
|
|
9638
9602
|
static install(c) {
|
|
9639
9603
|
c.bind(Vue3LibrariesBuilderPlugin).toSelf();
|
|
@@ -9641,11 +9605,11 @@ var Vue3LibrariesBuilderPlugin = class {
|
|
|
9641
9605
|
}
|
|
9642
9606
|
};
|
|
9643
9607
|
Vue3LibrariesBuilderPlugin = __decorateClass([
|
|
9644
|
-
(0,
|
|
9608
|
+
(0, import_inversify23.injectable)()
|
|
9645
9609
|
], Vue3LibrariesBuilderPlugin);
|
|
9646
9610
|
|
|
9647
9611
|
// src/plugins/vue/vue3/vue3-meta-data-builder-plugin.ts
|
|
9648
|
-
var
|
|
9612
|
+
var import_inversify24 = require("inversify");
|
|
9649
9613
|
var Vue3MetaDataBuilderPlugin = class {
|
|
9650
9614
|
/**
|
|
9651
9615
|
* 构建依赖库导入文件
|
|
@@ -9666,7 +9630,7 @@ var Vue3MetaDataBuilderPlugin = class {
|
|
|
9666
9630
|
}
|
|
9667
9631
|
};
|
|
9668
9632
|
Vue3MetaDataBuilderPlugin = __decorateClass([
|
|
9669
|
-
(0,
|
|
9633
|
+
(0, import_inversify24.injectable)()
|
|
9670
9634
|
], Vue3MetaDataBuilderPlugin);
|
|
9671
9635
|
function stringifyMetaData(obj) {
|
|
9672
9636
|
if (typeof obj === "object" && obj !== null) {
|
|
@@ -9700,7 +9664,7 @@ function stringifyMetaData(obj) {
|
|
|
9700
9664
|
}
|
|
9701
9665
|
|
|
9702
9666
|
// src/plugins/vue/vue3/vue3-components-index-builder-plugin.ts
|
|
9703
|
-
var
|
|
9667
|
+
var import_inversify25 = require("inversify");
|
|
9704
9668
|
var Vue3ComponentsIndexBuilderPlugin = class {
|
|
9705
9669
|
/**
|
|
9706
9670
|
* 构建业务组件导出入口文件
|
|
@@ -9730,11 +9694,11 @@ var Vue3ComponentsIndexBuilderPlugin = class {
|
|
|
9730
9694
|
}
|
|
9731
9695
|
};
|
|
9732
9696
|
Vue3ComponentsIndexBuilderPlugin = __decorateClass([
|
|
9733
|
-
(0,
|
|
9697
|
+
(0, import_inversify25.injectable)()
|
|
9734
9698
|
], Vue3ComponentsIndexBuilderPlugin);
|
|
9735
9699
|
|
|
9736
9700
|
// src/plugins/vue/vue3/vue3-client-lazyload-template-builder-plugin .ts
|
|
9737
|
-
var
|
|
9701
|
+
var import_inversify26 = require("inversify");
|
|
9738
9702
|
var Vue3ClientLazyloadTemplateBuilderPlugin = class {
|
|
9739
9703
|
constructor(microFrontendManager) {
|
|
9740
9704
|
this.microFrontendManager = microFrontendManager;
|
|
@@ -9747,32 +9711,19 @@ var Vue3ClientLazyloadTemplateBuilderPlugin = class {
|
|
|
9747
9711
|
const isDebug = ir.configs.config.debug;
|
|
9748
9712
|
const entryScript = this.microFrontendManager.produceScript(ir);
|
|
9749
9713
|
return new ReactFileDescription(
|
|
9750
|
-
"../client-lazyload-template.
|
|
9714
|
+
"../client-lazyload-template.js",
|
|
9751
9715
|
[],
|
|
9752
9716
|
[],
|
|
9753
9717
|
[
|
|
9754
|
-
`
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
);` : ""}
|
|
9764
|
-
const lazyLoadCommand = \`
|
|
9765
|
-
\${JSON.stringify(jsAssets)}.forEach(asset => window.LazyLoad.js(asset));
|
|
9766
|
-
window.LazyLoad.css(\${JSON.stringify(cssAssets)});
|
|
9767
|
-
\`;
|
|
9768
|
-
return \`(function(){
|
|
9769
|
-
function loadAssets(){
|
|
9770
|
-
\${lazyLoadCommand};
|
|
9771
|
-
}
|
|
9772
|
-
${entryScript};
|
|
9773
|
-
})();\`;
|
|
9774
|
-
}
|
|
9775
|
-
`
|
|
9718
|
+
`const extraJS = [];
|
|
9719
|
+
const extraCSS = [];
|
|
9720
|
+
const entryCode = \`${entryScript}\`;
|
|
9721
|
+
|
|
9722
|
+
module.exports = {
|
|
9723
|
+
extraJS,
|
|
9724
|
+
extraCSS,
|
|
9725
|
+
entryCode,
|
|
9726
|
+
}`
|
|
9776
9727
|
]
|
|
9777
9728
|
);
|
|
9778
9729
|
}
|
|
@@ -9782,12 +9733,12 @@ var Vue3ClientLazyloadTemplateBuilderPlugin = class {
|
|
|
9782
9733
|
}
|
|
9783
9734
|
};
|
|
9784
9735
|
Vue3ClientLazyloadTemplateBuilderPlugin = __decorateClass([
|
|
9785
|
-
(0,
|
|
9786
|
-
__decorateParam(0, (0,
|
|
9736
|
+
(0, import_inversify26.injectable)(),
|
|
9737
|
+
__decorateParam(0, (0, import_inversify26.inject)(ServiceMetaKind.MicroFrontendManager))
|
|
9787
9738
|
], Vue3ClientLazyloadTemplateBuilderPlugin);
|
|
9788
9739
|
|
|
9789
9740
|
// src/plugins/vue/vue3/vue3-platform-builder-plugin.ts
|
|
9790
|
-
var
|
|
9741
|
+
var import_inversify27 = require("inversify");
|
|
9791
9742
|
var Vue3PlatformBuilderPlugin = class {
|
|
9792
9743
|
/**
|
|
9793
9744
|
* 构建平台配置文件
|
|
@@ -9821,11 +9772,11 @@ var Vue3PlatformBuilderPlugin = class {
|
|
|
9821
9772
|
}
|
|
9822
9773
|
};
|
|
9823
9774
|
Vue3PlatformBuilderPlugin = __decorateClass([
|
|
9824
|
-
(0,
|
|
9775
|
+
(0, import_inversify27.injectable)()
|
|
9825
9776
|
], Vue3PlatformBuilderPlugin);
|
|
9826
9777
|
|
|
9827
9778
|
// src/plugins/vue/vue3/vue3-entry-css-plugin.ts
|
|
9828
|
-
var
|
|
9779
|
+
var import_inversify28 = require("inversify");
|
|
9829
9780
|
var Vue3EntryCssPlugin = class {
|
|
9830
9781
|
/**
|
|
9831
9782
|
* 构建依赖库导入文件
|
|
@@ -9842,7 +9793,7 @@ var Vue3EntryCssPlugin = class {
|
|
|
9842
9793
|
}
|
|
9843
9794
|
};
|
|
9844
9795
|
Vue3EntryCssPlugin = __decorateClass([
|
|
9845
|
-
(0,
|
|
9796
|
+
(0, import_inversify28.injectable)()
|
|
9846
9797
|
], Vue3EntryCssPlugin);
|
|
9847
9798
|
|
|
9848
9799
|
// src/plugins/vue/vue3/vue3-application-assembler-plugin.ts
|
|
@@ -9859,7 +9810,7 @@ var ComponentPathManager = class {
|
|
|
9859
9810
|
}
|
|
9860
9811
|
};
|
|
9861
9812
|
ComponentPathManager = __decorateClass([
|
|
9862
|
-
(0,
|
|
9813
|
+
(0, import_inversify29.injectable)()
|
|
9863
9814
|
], ComponentPathManager);
|
|
9864
9815
|
var Vue3ApplicationAssemblerPlugin = class {
|
|
9865
9816
|
constructor(vue3CodegenPlugin, routesExtactor, routerBuilder, entryBuilder, librariesBuilder, entryCssBuilder, componentsIndexBuilder, clientLazyloadTemplateBuilder, platformBuilder, metaDataBuilder) {
|
|
@@ -9882,15 +9833,16 @@ var Vue3ApplicationAssemblerPlugin = class {
|
|
|
9882
9833
|
const bizComponents = ir.bizComponents.flatMap((x) => {
|
|
9883
9834
|
return this.vue3CodegenPlugin.genFiles(x, manager);
|
|
9884
9835
|
});
|
|
9885
|
-
let
|
|
9886
|
-
if (!/\/$/.test(
|
|
9887
|
-
|
|
9836
|
+
let basePath = ir.configs.basePlatformConfig.basePath;
|
|
9837
|
+
if (!/\/$/.test(basePath)) {
|
|
9838
|
+
basePath += "/";
|
|
9888
9839
|
}
|
|
9889
|
-
const routesObjects = this.routesExtactor.extractRoute(ir.views,
|
|
9840
|
+
const routesObjects = this.routesExtactor.extractRoute(ir.views, basePath, {
|
|
9890
9841
|
lazy: true
|
|
9891
9842
|
});
|
|
9892
9843
|
const router = this.routerBuilder.routeToCode(routesObjects.routes, manager, {
|
|
9893
|
-
frameworkKind: "vue3"
|
|
9844
|
+
frameworkKind: "vue3",
|
|
9845
|
+
basePath
|
|
9894
9846
|
});
|
|
9895
9847
|
const routerFile = new ReactFileDescription("router.ts", router.imports, [], [router.code]);
|
|
9896
9848
|
const libraries = await this.librariesBuilder.buildLibrariesImport(ir, config2);
|
|
@@ -9914,17 +9866,17 @@ var Vue3ApplicationAssemblerPlugin = class {
|
|
|
9914
9866
|
}
|
|
9915
9867
|
};
|
|
9916
9868
|
Vue3ApplicationAssemblerPlugin = __decorateClass([
|
|
9917
|
-
(0,
|
|
9918
|
-
__decorateParam(0, (0,
|
|
9919
|
-
__decorateParam(1, (0,
|
|
9920
|
-
__decorateParam(2, (0,
|
|
9921
|
-
__decorateParam(3, (0,
|
|
9922
|
-
__decorateParam(4, (0,
|
|
9923
|
-
__decorateParam(5, (0,
|
|
9924
|
-
__decorateParam(6, (0,
|
|
9925
|
-
__decorateParam(7, (0,
|
|
9926
|
-
__decorateParam(8, (0,
|
|
9927
|
-
__decorateParam(9, (0,
|
|
9869
|
+
(0, import_inversify29.injectable)(),
|
|
9870
|
+
__decorateParam(0, (0, import_inversify29.inject)(Vue3CodegenPlugin)),
|
|
9871
|
+
__decorateParam(1, (0, import_inversify29.inject)(RoutesExtractionPlugin)),
|
|
9872
|
+
__decorateParam(2, (0, import_inversify29.inject)(VueRouterPlugin)),
|
|
9873
|
+
__decorateParam(3, (0, import_inversify29.inject)(Vue3EntryBuilderPlugin)),
|
|
9874
|
+
__decorateParam(4, (0, import_inversify29.inject)(Vue3LibrariesBuilderPlugin)),
|
|
9875
|
+
__decorateParam(5, (0, import_inversify29.inject)(Vue3EntryCssPlugin)),
|
|
9876
|
+
__decorateParam(6, (0, import_inversify29.inject)(Vue3ComponentsIndexBuilderPlugin)),
|
|
9877
|
+
__decorateParam(7, (0, import_inversify29.inject)(Vue3ClientLazyloadTemplateBuilderPlugin)),
|
|
9878
|
+
__decorateParam(8, (0, import_inversify29.inject)(Vue3PlatformBuilderPlugin)),
|
|
9879
|
+
__decorateParam(9, (0, import_inversify29.inject)(Vue3MetaDataBuilderPlugin))
|
|
9928
9880
|
], Vue3ApplicationAssemblerPlugin);
|
|
9929
9881
|
|
|
9930
9882
|
// src/plugins/vue/vue3/vue3-preset-plugin.ts
|
|
@@ -9943,6 +9895,30 @@ var Vue3PresetPlugin = class {
|
|
|
9943
9895
|
const app = deserializeAppWhileKeepTypeAnnotation(appJson);
|
|
9944
9896
|
const frontend = app.findNodeByPath(instruction.frontend.nodePath);
|
|
9945
9897
|
const ir = this.irBuilder.buildIR(app, frontend, instruction.config);
|
|
9898
|
+
const needCompileViews = instruction.config?.needCompileViews ?? [];
|
|
9899
|
+
const isIncremental = needCompileViews.length > 0;
|
|
9900
|
+
if (isIncremental) {
|
|
9901
|
+
const filterChildComponents = (view, needCompileViews2) => {
|
|
9902
|
+
if (!view.childComponents?.length) {
|
|
9903
|
+
return;
|
|
9904
|
+
}
|
|
9905
|
+
view.childComponents = view.childComponents.filter((child) => {
|
|
9906
|
+
if (needCompileViews2.includes(child.__raw.nodePath)) {
|
|
9907
|
+
filterChildComponents(child, needCompileViews2);
|
|
9908
|
+
return true;
|
|
9909
|
+
}
|
|
9910
|
+
return false;
|
|
9911
|
+
});
|
|
9912
|
+
};
|
|
9913
|
+
ir.views = ir.views.filter((view) => {
|
|
9914
|
+
if (needCompileViews.includes(view.__raw.nodePath)) {
|
|
9915
|
+
filterChildComponents(view, needCompileViews);
|
|
9916
|
+
return true;
|
|
9917
|
+
}
|
|
9918
|
+
return false;
|
|
9919
|
+
});
|
|
9920
|
+
ir.bizComponents = [];
|
|
9921
|
+
}
|
|
9946
9922
|
const assembledApplication = await this.applicationAssembler.assemble(ir, instruction.config);
|
|
9947
9923
|
const finalizedFiles = await this.projectOrganizer.organize({
|
|
9948
9924
|
baseDir: instruction.baseDir,
|
|
@@ -9979,7 +9955,7 @@ var Vue3PresetPlugin = class {
|
|
|
9979
9955
|
c.bind(ServiceMetaKind.ProjectOrganizer).to(ProjectOrganizerPlugin);
|
|
9980
9956
|
c.bind(ServiceMetaKind.FileSystemProvider).to(FileSystemPlugin).inSingletonScope();
|
|
9981
9957
|
c = BundlerConfigDataPlugin.install(c);
|
|
9982
|
-
c =
|
|
9958
|
+
c = RspackConfigPlugin.install(c);
|
|
9983
9959
|
c = FrontendBundlerConfigPlugin.install(c);
|
|
9984
9960
|
c = FrontendPerformancePlugin.install(c);
|
|
9985
9961
|
c = NpmPackageJSONManagerPlugin.install(c);
|
|
@@ -9996,20 +9972,20 @@ var Vue3PresetPlugin = class {
|
|
|
9996
9972
|
}
|
|
9997
9973
|
};
|
|
9998
9974
|
Vue3PresetPlugin = __decorateClass([
|
|
9999
|
-
(0,
|
|
10000
|
-
__decorateParam(0, (0,
|
|
10001
|
-
__decorateParam(1, (0,
|
|
10002
|
-
__decorateParam(2, (0,
|
|
10003
|
-
__decorateParam(3, (0,
|
|
10004
|
-
__decorateParam(4, (0,
|
|
9975
|
+
(0, import_inversify30.injectable)(),
|
|
9976
|
+
__decorateParam(0, (0, import_inversify30.inject)(ServiceMetaKind.IRBuilder)),
|
|
9977
|
+
__decorateParam(1, (0, import_inversify30.inject)(ServiceMetaKind.FileSystemProvider)),
|
|
9978
|
+
__decorateParam(2, (0, import_inversify30.inject)(NpmPackageJSONManagerPlugin)),
|
|
9979
|
+
__decorateParam(3, (0, import_inversify30.inject)(ServiceMetaKind.ProjectOrganizer)),
|
|
9980
|
+
__decorateParam(4, (0, import_inversify30.inject)(Vue3ApplicationAssemblerPlugin))
|
|
10005
9981
|
], Vue3PresetPlugin);
|
|
10006
9982
|
|
|
10007
9983
|
// src/default-container.ts
|
|
10008
9984
|
function makeDefaultContainer(kind = "react") {
|
|
10009
9985
|
if (kind === "react") {
|
|
10010
|
-
return ReactPresetPlugin.install(new
|
|
9986
|
+
return ReactPresetPlugin.install(new import_inversify31.Container());
|
|
10011
9987
|
} else if (kind === "vue3") {
|
|
10012
|
-
return Vue3PresetPlugin.install(new
|
|
9988
|
+
return Vue3PresetPlugin.install(new import_inversify31.Container());
|
|
10013
9989
|
} else {
|
|
10014
9990
|
throw new Error(`\u672A\u5B9E\u73B0${kind}\u7684\u9ED8\u8BA4\u5BB9\u5668`);
|
|
10015
9991
|
}
|
|
@@ -10136,7 +10112,7 @@ async function compileAsProject(app, frontend, config2, container) {
|
|
|
10136
10112
|
}
|
|
10137
10113
|
|
|
10138
10114
|
// src/plugins/misc/program-analysis/analyzer-manager-plugin.ts
|
|
10139
|
-
var
|
|
10115
|
+
var import_inversify32 = require("inversify");
|
|
10140
10116
|
|
|
10141
10117
|
// src/plugins/misc/program-analysis/analysis/async-analysis.ts
|
|
10142
10118
|
function buildAsyncAnalyzer() {
|
|
@@ -10263,11 +10239,11 @@ var AnalyzerManagerPlugin = class {
|
|
|
10263
10239
|
}
|
|
10264
10240
|
};
|
|
10265
10241
|
AnalyzerManagerPlugin = __decorateClass([
|
|
10266
|
-
(0,
|
|
10242
|
+
(0, import_inversify32.injectable)()
|
|
10267
10243
|
], AnalyzerManagerPlugin);
|
|
10268
10244
|
|
|
10269
10245
|
// src/plugins/misc/name-mangler/name-mangler-manager-plugin.ts
|
|
10270
|
-
var
|
|
10246
|
+
var import_inversify33 = require("inversify");
|
|
10271
10247
|
|
|
10272
10248
|
// src/plugins/misc/name-mangler/name-mangler.ts
|
|
10273
10249
|
var NameMangler2 = class _NameMangler {
|
|
@@ -10334,7 +10310,7 @@ var NameManglerManagerPlugin = class {
|
|
|
10334
10310
|
}
|
|
10335
10311
|
};
|
|
10336
10312
|
NameManglerManagerPlugin = __decorateClass([
|
|
10337
|
-
(0,
|
|
10313
|
+
(0, import_inversify33.injectable)()
|
|
10338
10314
|
], NameManglerManagerPlugin);
|
|
10339
10315
|
|
|
10340
10316
|
// src/utils/sanity-check.ts
|