@lcap/nasl-unified-frontend-generator 4.0.0-rc.4 → 4.0.1-rc.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.
@@ -2259,7 +2259,7 @@ import { Container as Container20 } from "inversify";
2259
2259
 
2260
2260
  // src/plugins/vue/vue3/vue3-preset-plugin.ts
2261
2261
  import "@abraham/reflection";
2262
- import { inject as inject16, injectable as injectable31 } from "inversify";
2262
+ import { inject as inject15, injectable as injectable30 } from "inversify";
2263
2263
 
2264
2264
  // src/service-metakind.ts
2265
2265
  var ServiceMetaKind = {
@@ -4622,7 +4622,8 @@ query: {`;
4622
4622
  let url2 = "`";
4623
4623
  const viewArr = s3.genViewArr();
4624
4624
  if (Array.isArray(viewArr) && viewArr.length) {
4625
- url2 += `/${viewArr.join("/")}`;
4625
+ const prefixPath = s3.frontend?.prefixPath;
4626
+ url2 += `${prefixPath}/${viewArr.join("/")}`;
4626
4627
  const { completeArguments } = s3;
4627
4628
  if (completeArguments.length) {
4628
4629
  const node = s3.viewNode;
@@ -6569,40 +6570,40 @@ var metadataPlugin = makePlugin({
6569
6570
  // src/hack/material-config/material.config.js
6570
6571
  var materials = {
6571
6572
  framework: {
6572
- version: "2.0.0",
6573
+ version: "2.0.1",
6573
6574
  core: "@lcap/basic-template",
6574
6575
  pc: [
6575
6576
  {
6576
6577
  frameworkKind: "vue2",
6577
6578
  name: "@lcap/pc-template",
6578
- version: "2.0.0"
6579
+ version: "2.0.1"
6579
6580
  },
6580
6581
  {
6581
6582
  frameworkKind: "react",
6582
6583
  name: "@lcap/pc-template-react",
6583
- version: "2.0.0"
6584
+ version: "2.0.1"
6584
6585
  },
6585
6586
  {
6586
6587
  frameworkKind: "vue3",
6587
6588
  name: "@lcap/pc-template-vue3",
6588
- version: "2.0.0"
6589
+ version: "2.0.1"
6589
6590
  }
6590
6591
  ],
6591
6592
  h5: [
6592
6593
  {
6593
6594
  frameworkKind: "vue2",
6594
6595
  name: "@lcap/mobile-template",
6595
- version: "2.0.0"
6596
+ version: "2.0.1"
6596
6597
  },
6597
6598
  {
6598
6599
  frameworkKind: "react",
6599
6600
  name: "@lcap/mobile-template-react",
6600
- version: "2.0.0"
6601
+ version: "2.0.1"
6601
6602
  },
6602
6603
  {
6603
6604
  frameworkKind: "vue3",
6604
6605
  name: "@lcap/mobile-template-vue3",
6605
- version: "2.0.0"
6606
+ version: "2.0.1"
6606
6607
  }
6607
6608
  ]
6608
6609
  },
@@ -6676,29 +6677,6 @@ var coreVersion = materials.framework.version;
6676
6677
  function getPredefinedMaterialConfig() {
6677
6678
  return materials;
6678
6679
  }
6679
- function getPredefinedLibConstants() {
6680
- if (!reactUi || !vue3Ui) {
6681
- throw new Error("not found");
6682
- }
6683
- if (reactUi.name !== "@lcap/pc-react-ui") {
6684
- throw new Error("cannot find @lcap/pc-react-ui in material.config.js");
6685
- }
6686
- return {
6687
- reactUI: {
6688
- kind: "standard",
6689
- name: reactUi.name,
6690
- version: reactUi.version
6691
- },
6692
- vue3Ui: {
6693
- kind: "standard",
6694
- name: vue3Ui.name,
6695
- version: vue3Ui.version
6696
- },
6697
- basicTemplate: {
6698
- version: coreVersion
6699
- }
6700
- };
6701
- }
6702
6680
  var getPredefinedMaterialByTags = (() => {
6703
6681
  const materialConfig = getPredefinedMaterialConfig();
6704
6682
  let allMaterials = [];
@@ -6722,12 +6700,14 @@ var getPredefinedMaterialByTags = (() => {
6722
6700
  materialConfig.ui.pc.forEach((item) => {
6723
6701
  allMaterials.push({
6724
6702
  ...item,
6703
+ kind: "standard",
6725
6704
  tags: ["ui", "pc", item.frameworkKind, item.libName]
6726
6705
  });
6727
6706
  });
6728
6707
  materialConfig.ui.h5.forEach((item) => {
6729
6708
  allMaterials.push({
6730
6709
  ...item,
6710
+ kind: "standard",
6731
6711
  tags: ["ui", "h5", item.frameworkKind, item.libName]
6732
6712
  });
6733
6713
  });
@@ -6887,7 +6867,10 @@ function bindAttrToIR(b) {
6887
6867
  throw new Error("string\u4E0D\u53EF\u4E3Async");
6888
6868
  }
6889
6869
  if (b.i18nKey && b.value && b.frontend?.i18nInfo?.enabled) {
6890
- b.type = "dynamic";
6870
+ const frameworkKind = b.frontend?.frameworkKind;
6871
+ if (!["vue3"].includes(frameworkKind)) {
6872
+ b.type = "dynamic";
6873
+ }
6891
6874
  const wrapperExpr = CallFunction4.from(
6892
6875
  {
6893
6876
  calleeNamespace: "$i18n",
@@ -6991,7 +6974,7 @@ function bindEventToAction(b) {
6991
6974
  kind: "standalone"
6992
6975
  };
6993
6976
  }
6994
- var DefaultComponentLibraryName = getPredefinedLibConstants().reactUI.name;
6977
+ var DefaultComponentLibraryName = getPredefinedMaterialByTags(["ui", "pc", "react"])?.name;
6995
6978
  function getReferencedLibComponent(e) {
6996
6979
  const tag = e.tag;
6997
6980
  if (tag.startsWith("BS")) {
@@ -7657,8 +7640,8 @@ var NASLAppIRBuilderPlugin = class {
7657
7640
  });
7658
7641
  logger5.debug({ extensionPackages });
7659
7642
  const frameworkKind = frontend.frameworkKind;
7660
- const libs = getPredefinedLibConstants();
7661
- return [...extensionPackages, frameworkKind === "vue3" ? libs.vue3Ui : libs.reactUI];
7643
+ const uiLib = getPredefinedMaterialByTags(["ui", frontend.type, frameworkKind]);
7644
+ return [...extensionPackages, uiLib];
7662
7645
  };
7663
7646
  var buildConfigs = buildConfigs2, collectPackages = collectPackages2;
7664
7647
  config2.debug && breakpoint2.genBreakpoints(app);
@@ -9027,10 +9010,9 @@ function extractAppLevelFrontendDeps(app) {
9027
9010
  }
9028
9011
  function extractFrontendLevelDeps(frontend) {
9029
9012
  const deps = [];
9030
- if (frontend.frameworkKind === "react") {
9031
- deps.push(getPredefinedLibConstants().reactUI);
9032
- } else if (frontend.frameworkKind === "vue3") {
9033
- deps.push(getPredefinedLibConstants().vue3Ui);
9013
+ const uiLib = getPredefinedMaterialByTags(["ui", frontend.type, frontend.frameworkKind]);
9014
+ if (uiLib) {
9015
+ deps.push(uiLib);
9034
9016
  }
9035
9017
  return deps;
9036
9018
  }
@@ -9282,7 +9264,7 @@ BundlerConfigDataPlugin = __decorateClass([
9282
9264
  __decorateParam(0, inject8(ServiceMetaKind.FrontendBundlerConfig))
9283
9265
  ], BundlerConfigDataPlugin);
9284
9266
 
9285
- // src/plugins/misc/bundler/respack-config-plugin.ts
9267
+ // src/plugins/misc/bundler/rspack-config-plugin.ts
9286
9268
  import "@abraham/reflection";
9287
9269
  import { injectable as injectable17, inject as inject9 } from "inversify";
9288
9270
  var RspackConfigPlugin = class {
@@ -9306,9 +9288,16 @@ var RspackConfigPlugin = class {
9306
9288
  `chunks: '${this.frontendPerformancePlugin?.performanceOptions?.chunks}'`
9307
9289
  );
9308
9290
  }
9291
+ 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"}`);
9292
+ if (config2.needCompileViews && config2.needCompileViews.length > 0 && config2.cacheChunksMapCode) {
9293
+ rspackConfigSource = rspackConfigSource.replace("isIncremental: false", "isIncremental: true").replace("chunksMap: ''", `chunksMap: \`${config2.cacheChunksMapCode}\``);
9294
+ }
9295
+ if (config2.isExport) {
9296
+ rspackConfigSource = rspackConfigSource.replace(/\/\/ LcapPlugin start\s+new LcapPlugin\(\{[\s\S]*?\}\),\s+\/\/ LcapPlugin end/g, "");
9297
+ }
9309
9298
  fs.write(
9310
9299
  "/rspack.config.js",
9311
- rspackConfigSource.replace(`const backendUrl = '';`, `const backendUrl = '${backendUrl}'`).replace(`const publicPath = '';`, `const publicPath = '${publicPath}';`).replace(`sourceMap: false,`, `sourceMap: ${config2.env === "dev"},`).replace("alias: {}", `alias: {${aliasMapStr}}`)
9300
+ rspackConfigSource
9312
9301
  );
9313
9302
  }
9314
9303
  }
@@ -9516,49 +9505,12 @@ EntrypointPlugin = __decorateClass([
9516
9505
  __decorateParam(0, inject11(ServiceMetaKind.MicroFrontendManager))
9517
9506
  ], EntrypointPlugin);
9518
9507
 
9519
- // src/plugins/misc/bundler/vite-config-plugin.ts
9520
- import "@abraham/reflection";
9521
- import { injectable as injectable20, inject as inject12 } from "inversify";
9522
- var ViteConfigPlugin = class {
9523
- constructor(bundlerConfigDataPlugin) {
9524
- this.bundlerConfigDataPlugin = bundlerConfigDataPlugin;
9525
- }
9526
- async configBundlerConfig(app, frontend, config2, fs, frameworkKind) {
9527
- const isDev = config2.env === "dev";
9528
- const { backendUrl, publicPath, aliasMapStr, dependenciesStr } = await this.bundlerConfigDataPlugin.getBundlerConfigData(
9529
- app,
9530
- frontend,
9531
- config2,
9532
- fs,
9533
- frameworkKind
9534
- );
9535
- const viteConfigSource = fs.read("/vite.config.ts")?.toString();
9536
- if (viteConfigSource) {
9537
- fs.write(
9538
- "/vite.config.ts",
9539
- 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(
9540
- "optimizeDeps: { include: [], },",
9541
- `optimizeDeps: { include: [${dependenciesStr}], },`
9542
- )
9543
- );
9544
- }
9545
- }
9546
- static install(c) {
9547
- c.bind(ServiceMetaKind.FrontendBundlerFileConfig).to(ViteConfigPlugin).inSingletonScope();
9548
- return c;
9549
- }
9550
- };
9551
- ViteConfigPlugin = __decorateClass([
9552
- injectable20(),
9553
- __decorateParam(0, inject12(BundlerConfigDataPlugin))
9554
- ], ViteConfigPlugin);
9555
-
9556
9508
  // src/plugins/vue/vue3/vue3-application-assembler-plugin.ts
9557
- import { inject as inject15, injectable as injectable30 } from "inversify";
9509
+ import { inject as inject14, injectable as injectable29 } from "inversify";
9558
9510
 
9559
9511
  // src/plugins/vue/common/vue-router-plugin.ts
9560
9512
  import { kebab2Pascal as kebab2Pascal2 } from "@lcap/nasl-utils";
9561
- import { injectable as injectable21 } from "inversify";
9513
+ import { injectable as injectable20 } from "inversify";
9562
9514
  var VueRouterPlugin = class {
9563
9515
  extractImportIR(routes, componentPathManager) {
9564
9516
  const nameMangler = new NameMangler();
@@ -9591,17 +9543,26 @@ var VueRouterPlugin = class {
9591
9543
  }
9592
9544
  routeToCode(routes, componentPathManager, config2) {
9593
9545
  function serializeVueRoute(r, isRoot = false) {
9594
- const path2 = r.thisLevelPath ?? "/";
9546
+ const { accumulativePath, thisLevelPath } = r;
9547
+ const path2 = isRoot ? accumulativePath : thisLevelPath ?? "/";
9548
+ const basePath = config2.basePath;
9595
9549
  if (r.kind === "normal") {
9596
9550
  const children = r.children?.map((i) => serializeVueRoute(i)).filter(isNotNil) ?? [];
9597
9551
  const childrenStr = children.join(",\n");
9598
9552
  const componentCode = `component: ${r.elementMangledName ?? r.elementTemplate.identifier}`;
9599
- return `{path: "${isRoot ? r.accumulativePath : path2}", meta: ${JSON.stringify(
9553
+ return `{path: "${path2}", meta: ${JSON.stringify(
9600
9554
  r.meta
9601
9555
  )}, children: [${childrenStr}], ${componentCode} }`;
9602
9556
  } else if (r.kind === "redirect") {
9603
9557
  if (["vue3"].includes(config2.frameworkKind) && path2 === "*") {
9604
- return `{ path: "/:pathMatch(.*)*", redirect: ${JSON.stringify(r.redirect)} }`;
9558
+ return `{ path: "/:pathMatch(.*)*", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
9559
+ }
9560
+ if (["vue3"].includes(config2.frameworkKind) && path2 === "/") {
9561
+ let result = `{ path: "/", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
9562
+ if (basePath !== "/") {
9563
+ result += `, { path: "${basePath}", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
9564
+ }
9565
+ return result;
9605
9566
  }
9606
9567
  return `{ path: "${path2}", redirect: to => to.path.replace(/\\/$/, '') + '/' + ${JSON.stringify(r.redirect)} }`;
9607
9568
  }
@@ -9623,11 +9584,11 @@ var VueRouterPlugin = class {
9623
9584
  }
9624
9585
  };
9625
9586
  VueRouterPlugin = __decorateClass([
9626
- injectable21()
9587
+ injectable20()
9627
9588
  ], VueRouterPlugin);
9628
9589
 
9629
9590
  // src/plugins/vue/vue3/vue3-codegen-plugin.ts
9630
- import { injectable as injectable22 } from "inversify";
9591
+ import { injectable as injectable21 } from "inversify";
9631
9592
  import { kebab2Pascal as kebab2Pascal3 } from "@lcap/nasl-utils";
9632
9593
  import { flatten as flatten2 } from "lodash";
9633
9594
  var Vue3CodegenPlugin = class {
@@ -9675,11 +9636,11 @@ var Vue3CodegenPlugin = class {
9675
9636
  }
9676
9637
  };
9677
9638
  Vue3CodegenPlugin = __decorateClass([
9678
- injectable22()
9639
+ injectable21()
9679
9640
  ], Vue3CodegenPlugin);
9680
9641
 
9681
9642
  // src/plugins/vue/vue3/vue3-entry-builder-plugin.ts
9682
- import { injectable as injectable23, inject as inject13 } from "inversify";
9643
+ import { injectable as injectable22, inject as inject12 } from "inversify";
9683
9644
  var Vue3EntryBuilderPlugin = class {
9684
9645
  constructor(microFrontendManager) {
9685
9646
  this.microFrontendManager = microFrontendManager;
@@ -9721,12 +9682,12 @@ var Vue3EntryBuilderPlugin = class {
9721
9682
  }
9722
9683
  };
9723
9684
  Vue3EntryBuilderPlugin = __decorateClass([
9724
- injectable23(),
9725
- __decorateParam(0, inject13(ServiceMetaKind.MicroFrontendManager))
9685
+ injectable22(),
9686
+ __decorateParam(0, inject12(ServiceMetaKind.MicroFrontendManager))
9726
9687
  ], Vue3EntryBuilderPlugin);
9727
9688
 
9728
9689
  // src/plugins/vue/vue3/vue3-libraries-builder-plugin.ts
9729
- import { injectable as injectable24 } from "inversify";
9690
+ import { injectable as injectable23 } from "inversify";
9730
9691
  var Vue3LibrariesBuilderPlugin = class {
9731
9692
  /**
9732
9693
  * 构建依赖库导入文件
@@ -9735,10 +9696,13 @@ var Vue3LibrariesBuilderPlugin = class {
9735
9696
  */
9736
9697
  async buildLibrariesImport(ir, config2) {
9737
9698
  const importArr = [];
9699
+ const exportArr = [];
9738
9700
  const standardLib = ir.packages.find((x) => x.kind === "standard");
9739
9701
  if (standardLib) {
9740
9702
  const formattedName = kebab2Pascal(standardLib.name.split("/").at(-1));
9741
- importArr.push(`export * as ${formattedName} from '${standardLib.name}';`);
9703
+ importArr.push(`import * as ${formattedName} from '${standardLib.name}';`);
9704
+ exportArr.push(`export { ${formattedName} };`);
9705
+ exportArr.push(`window.lcapStandardUI = ${formattedName};`);
9742
9706
  const isPackageZipExists = await judgePackageZipExists(standardLib, config2.STATIC_URL);
9743
9707
  importArr.push(
9744
9708
  `import '${standardLib.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
@@ -9749,14 +9713,14 @@ var Vue3LibrariesBuilderPlugin = class {
9749
9713
  const formattedName = kebab2Pascal(ext.name.split("/").at(-1));
9750
9714
  const isPackageZipExists = await judgePackageZipExists(ext, config2.STATIC_URL);
9751
9715
  const prefix = isPackageZipExists ? "" : "@extension/";
9752
- importArr.push(`export * as ${formattedName} from '${prefix}${ext.name}';`);
9716
+ exportArr.push(`export * as ${formattedName} from '${prefix}${ext.name}';`);
9753
9717
  if (ext.hasCss) {
9754
9718
  importArr.push(
9755
9719
  `import '${prefix}${ext.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
9756
9720
  );
9757
9721
  }
9758
9722
  }
9759
- return new ReactFileDescription("libraries.ts", [], [], [importArr.join("\n")]);
9723
+ return new ReactFileDescription("libraries.ts", [], [], [[...importArr, ...exportArr].join("\n")]);
9760
9724
  }
9761
9725
  static install(c) {
9762
9726
  c.bind(Vue3LibrariesBuilderPlugin).toSelf();
@@ -9764,11 +9728,11 @@ var Vue3LibrariesBuilderPlugin = class {
9764
9728
  }
9765
9729
  };
9766
9730
  Vue3LibrariesBuilderPlugin = __decorateClass([
9767
- injectable24()
9731
+ injectable23()
9768
9732
  ], Vue3LibrariesBuilderPlugin);
9769
9733
 
9770
9734
  // src/plugins/vue/vue3/vue3-meta-data-builder-plugin.ts
9771
- import { injectable as injectable25 } from "inversify";
9735
+ import { injectable as injectable24 } from "inversify";
9772
9736
  var Vue3MetaDataBuilderPlugin = class {
9773
9737
  /**
9774
9738
  * 构建依赖库导入文件
@@ -9789,7 +9753,7 @@ var Vue3MetaDataBuilderPlugin = class {
9789
9753
  }
9790
9754
  };
9791
9755
  Vue3MetaDataBuilderPlugin = __decorateClass([
9792
- injectable25()
9756
+ injectable24()
9793
9757
  ], Vue3MetaDataBuilderPlugin);
9794
9758
  function stringifyMetaData(obj) {
9795
9759
  if (typeof obj === "object" && obj !== null) {
@@ -9823,7 +9787,7 @@ function stringifyMetaData(obj) {
9823
9787
  }
9824
9788
 
9825
9789
  // src/plugins/vue/vue3/vue3-components-index-builder-plugin.ts
9826
- import { injectable as injectable26 } from "inversify";
9790
+ import { injectable as injectable25 } from "inversify";
9827
9791
  var Vue3ComponentsIndexBuilderPlugin = class {
9828
9792
  /**
9829
9793
  * 构建业务组件导出入口文件
@@ -9853,11 +9817,11 @@ var Vue3ComponentsIndexBuilderPlugin = class {
9853
9817
  }
9854
9818
  };
9855
9819
  Vue3ComponentsIndexBuilderPlugin = __decorateClass([
9856
- injectable26()
9820
+ injectable25()
9857
9821
  ], Vue3ComponentsIndexBuilderPlugin);
9858
9822
 
9859
9823
  // src/plugins/vue/vue3/vue3-client-lazyload-template-builder-plugin .ts
9860
- import { injectable as injectable27, inject as inject14 } from "inversify";
9824
+ import { injectable as injectable26, inject as inject13 } from "inversify";
9861
9825
  var Vue3ClientLazyloadTemplateBuilderPlugin = class {
9862
9826
  constructor(microFrontendManager) {
9863
9827
  this.microFrontendManager = microFrontendManager;
@@ -9870,32 +9834,19 @@ var Vue3ClientLazyloadTemplateBuilderPlugin = class {
9870
9834
  const isDebug = ir.configs.config.debug;
9871
9835
  const entryScript = this.microFrontendManager.produceScript(ir);
9872
9836
  return new ReactFileDescription(
9873
- "../client-lazyload-template.ts",
9837
+ "../client-lazyload-template.js",
9874
9838
  [],
9875
9839
  [],
9876
9840
  [
9877
- `
9878
- export default function (templateParameters, publicPath) {
9879
- const { files } = templateParameters
9880
- const jsAssets = files.js?.map((x) => publicPath + x.fileName) ?? []
9881
- const cssAssets = files.css?.map((x) => publicPath + x.fileName) ?? []
9882
- // \u5982\u679C\u662Fdebug\u6A21\u5F0F\uFF0C\u52A0\u8F7D\u65AD\u70B9\u8C03\u8BD5\u5668
9883
- ${isDebug ? `jsAssets.push(
9884
- '${ir.configs.config.STATIC_URL}/packages/vue@2/dist/vue.min.js',
9885
- '${ir.configs.config.STATIC_URL}/packages/@lcap/breakpoint-client@1.0.0/dist/index.js?time=${Date.now()}',
9886
- );` : ""}
9887
- const lazyLoadCommand = \`
9888
- \${JSON.stringify(jsAssets)}.forEach(asset => window.LazyLoad.js(asset));
9889
- window.LazyLoad.css(\${JSON.stringify(cssAssets)});
9890
- \`;
9891
- return \`(function(){
9892
- function loadAssets(){
9893
- \${lazyLoadCommand};
9894
- }
9895
- ${entryScript};
9896
- })();\`;
9897
- }
9898
- `
9841
+ `const extraJS = [];
9842
+ const extraCSS = [];
9843
+ const entryCode = \`${entryScript}\`;
9844
+
9845
+ module.exports = {
9846
+ extraJS,
9847
+ extraCSS,
9848
+ entryCode,
9849
+ }`
9899
9850
  ]
9900
9851
  );
9901
9852
  }
@@ -9905,12 +9856,12 @@ var Vue3ClientLazyloadTemplateBuilderPlugin = class {
9905
9856
  }
9906
9857
  };
9907
9858
  Vue3ClientLazyloadTemplateBuilderPlugin = __decorateClass([
9908
- injectable27(),
9909
- __decorateParam(0, inject14(ServiceMetaKind.MicroFrontendManager))
9859
+ injectable26(),
9860
+ __decorateParam(0, inject13(ServiceMetaKind.MicroFrontendManager))
9910
9861
  ], Vue3ClientLazyloadTemplateBuilderPlugin);
9911
9862
 
9912
9863
  // src/plugins/vue/vue3/vue3-platform-builder-plugin.ts
9913
- import { injectable as injectable28 } from "inversify";
9864
+ import { injectable as injectable27 } from "inversify";
9914
9865
  var Vue3PlatformBuilderPlugin = class {
9915
9866
  /**
9916
9867
  * 构建平台配置文件
@@ -9944,11 +9895,11 @@ var Vue3PlatformBuilderPlugin = class {
9944
9895
  }
9945
9896
  };
9946
9897
  Vue3PlatformBuilderPlugin = __decorateClass([
9947
- injectable28()
9898
+ injectable27()
9948
9899
  ], Vue3PlatformBuilderPlugin);
9949
9900
 
9950
9901
  // src/plugins/vue/vue3/vue3-entry-css-plugin.ts
9951
- import { injectable as injectable29 } from "inversify";
9902
+ import { injectable as injectable28 } from "inversify";
9952
9903
  var Vue3EntryCssPlugin = class {
9953
9904
  /**
9954
9905
  * 构建依赖库导入文件
@@ -9965,7 +9916,7 @@ var Vue3EntryCssPlugin = class {
9965
9916
  }
9966
9917
  };
9967
9918
  Vue3EntryCssPlugin = __decorateClass([
9968
- injectable29()
9919
+ injectable28()
9969
9920
  ], Vue3EntryCssPlugin);
9970
9921
 
9971
9922
  // src/plugins/vue/vue3/vue3-application-assembler-plugin.ts
@@ -9982,7 +9933,7 @@ var ComponentPathManager = class {
9982
9933
  }
9983
9934
  };
9984
9935
  ComponentPathManager = __decorateClass([
9985
- injectable30()
9936
+ injectable29()
9986
9937
  ], ComponentPathManager);
9987
9938
  var Vue3ApplicationAssemblerPlugin = class {
9988
9939
  constructor(vue3CodegenPlugin, routesExtactor, routerBuilder, entryBuilder, librariesBuilder, entryCssBuilder, componentsIndexBuilder, clientLazyloadTemplateBuilder, platformBuilder, metaDataBuilder) {
@@ -10005,15 +9956,16 @@ var Vue3ApplicationAssemblerPlugin = class {
10005
9956
  const bizComponents = ir.bizComponents.flatMap((x) => {
10006
9957
  return this.vue3CodegenPlugin.genFiles(x, manager);
10007
9958
  });
10008
- let routePrefix = ir.configs.frontendDesc.path;
10009
- if (!/\/$/.test(routePrefix)) {
10010
- routePrefix += "/";
9959
+ let basePath = ir.configs.basePlatformConfig.basePath;
9960
+ if (!/\/$/.test(basePath)) {
9961
+ basePath += "/";
10011
9962
  }
10012
- const routesObjects = this.routesExtactor.extractRoute(ir.views, routePrefix, {
9963
+ const routesObjects = this.routesExtactor.extractRoute(ir.views, basePath, {
10013
9964
  lazy: true
10014
9965
  });
10015
9966
  const router = this.routerBuilder.routeToCode(routesObjects.routes, manager, {
10016
- frameworkKind: "vue3"
9967
+ frameworkKind: "vue3",
9968
+ basePath
10017
9969
  });
10018
9970
  const routerFile = new ReactFileDescription("router.ts", router.imports, [], [router.code]);
10019
9971
  const libraries = await this.librariesBuilder.buildLibrariesImport(ir, config2);
@@ -10037,17 +9989,17 @@ var Vue3ApplicationAssemblerPlugin = class {
10037
9989
  }
10038
9990
  };
10039
9991
  Vue3ApplicationAssemblerPlugin = __decorateClass([
10040
- injectable30(),
10041
- __decorateParam(0, inject15(Vue3CodegenPlugin)),
10042
- __decorateParam(1, inject15(RoutesExtractionPlugin)),
10043
- __decorateParam(2, inject15(VueRouterPlugin)),
10044
- __decorateParam(3, inject15(Vue3EntryBuilderPlugin)),
10045
- __decorateParam(4, inject15(Vue3LibrariesBuilderPlugin)),
10046
- __decorateParam(5, inject15(Vue3EntryCssPlugin)),
10047
- __decorateParam(6, inject15(Vue3ComponentsIndexBuilderPlugin)),
10048
- __decorateParam(7, inject15(Vue3ClientLazyloadTemplateBuilderPlugin)),
10049
- __decorateParam(8, inject15(Vue3PlatformBuilderPlugin)),
10050
- __decorateParam(9, inject15(Vue3MetaDataBuilderPlugin))
9992
+ injectable29(),
9993
+ __decorateParam(0, inject14(Vue3CodegenPlugin)),
9994
+ __decorateParam(1, inject14(RoutesExtractionPlugin)),
9995
+ __decorateParam(2, inject14(VueRouterPlugin)),
9996
+ __decorateParam(3, inject14(Vue3EntryBuilderPlugin)),
9997
+ __decorateParam(4, inject14(Vue3LibrariesBuilderPlugin)),
9998
+ __decorateParam(5, inject14(Vue3EntryCssPlugin)),
9999
+ __decorateParam(6, inject14(Vue3ComponentsIndexBuilderPlugin)),
10000
+ __decorateParam(7, inject14(Vue3ClientLazyloadTemplateBuilderPlugin)),
10001
+ __decorateParam(8, inject14(Vue3PlatformBuilderPlugin)),
10002
+ __decorateParam(9, inject14(Vue3MetaDataBuilderPlugin))
10051
10003
  ], Vue3ApplicationAssemblerPlugin);
10052
10004
 
10053
10005
  // src/plugins/vue/vue3/vue3-preset-plugin.ts
@@ -10066,6 +10018,30 @@ var Vue3PresetPlugin = class {
10066
10018
  const app = deserializeAppWhileKeepTypeAnnotation(appJson);
10067
10019
  const frontend = app.findNodeByPath(instruction.frontend.nodePath);
10068
10020
  const ir = this.irBuilder.buildIR(app, frontend, instruction.config);
10021
+ const needCompileViews = instruction.config?.needCompileViews ?? [];
10022
+ const isIncremental = needCompileViews.length > 0;
10023
+ if (isIncremental) {
10024
+ const filterChildComponents = (view, needCompileViews2) => {
10025
+ if (!view.childComponents?.length) {
10026
+ return;
10027
+ }
10028
+ view.childComponents = view.childComponents.filter((child) => {
10029
+ if (needCompileViews2.includes(child.__raw.nodePath)) {
10030
+ filterChildComponents(child, needCompileViews2);
10031
+ return true;
10032
+ }
10033
+ return false;
10034
+ });
10035
+ };
10036
+ ir.views = ir.views.filter((view) => {
10037
+ if (needCompileViews.includes(view.__raw.nodePath)) {
10038
+ filterChildComponents(view, needCompileViews);
10039
+ return true;
10040
+ }
10041
+ return false;
10042
+ });
10043
+ ir.bizComponents = [];
10044
+ }
10069
10045
  const assembledApplication = await this.applicationAssembler.assemble(ir, instruction.config);
10070
10046
  const finalizedFiles = await this.projectOrganizer.organize({
10071
10047
  baseDir: instruction.baseDir,
@@ -10102,7 +10078,7 @@ var Vue3PresetPlugin = class {
10102
10078
  c.bind(ServiceMetaKind.ProjectOrganizer).to(ProjectOrganizerPlugin);
10103
10079
  c.bind(ServiceMetaKind.FileSystemProvider).to(FileSystemPlugin).inSingletonScope();
10104
10080
  c = BundlerConfigDataPlugin.install(c);
10105
- c = ViteConfigPlugin.install(c);
10081
+ c = RspackConfigPlugin.install(c);
10106
10082
  c = FrontendBundlerConfigPlugin.install(c);
10107
10083
  c = FrontendPerformancePlugin.install(c);
10108
10084
  c = NpmPackageJSONManagerPlugin.install(c);
@@ -10119,12 +10095,12 @@ var Vue3PresetPlugin = class {
10119
10095
  }
10120
10096
  };
10121
10097
  Vue3PresetPlugin = __decorateClass([
10122
- injectable31(),
10123
- __decorateParam(0, inject16(ServiceMetaKind.IRBuilder)),
10124
- __decorateParam(1, inject16(ServiceMetaKind.FileSystemProvider)),
10125
- __decorateParam(2, inject16(NpmPackageJSONManagerPlugin)),
10126
- __decorateParam(3, inject16(ServiceMetaKind.ProjectOrganizer)),
10127
- __decorateParam(4, inject16(Vue3ApplicationAssemblerPlugin))
10098
+ injectable30(),
10099
+ __decorateParam(0, inject15(ServiceMetaKind.IRBuilder)),
10100
+ __decorateParam(1, inject15(ServiceMetaKind.FileSystemProvider)),
10101
+ __decorateParam(2, inject15(NpmPackageJSONManagerPlugin)),
10102
+ __decorateParam(3, inject15(ServiceMetaKind.ProjectOrganizer)),
10103
+ __decorateParam(4, inject15(Vue3ApplicationAssemblerPlugin))
10128
10104
  ], Vue3PresetPlugin);
10129
10105
 
10130
10106
  // src/default-container.ts
@@ -10259,7 +10235,7 @@ async function compileAsProject(app, frontend, config2, container) {
10259
10235
  }
10260
10236
 
10261
10237
  // src/plugins/misc/program-analysis/analyzer-manager-plugin.ts
10262
- import { injectable as injectable32 } from "inversify";
10238
+ import { injectable as injectable31 } from "inversify";
10263
10239
 
10264
10240
  // src/plugins/misc/program-analysis/analysis/async-analysis.ts
10265
10241
  function buildAsyncAnalyzer() {
@@ -10386,11 +10362,11 @@ var AnalyzerManagerPlugin = class {
10386
10362
  }
10387
10363
  };
10388
10364
  AnalyzerManagerPlugin = __decorateClass([
10389
- injectable32()
10365
+ injectable31()
10390
10366
  ], AnalyzerManagerPlugin);
10391
10367
 
10392
10368
  // src/plugins/misc/name-mangler/name-mangler-manager-plugin.ts
10393
- import { injectable as injectable33 } from "inversify";
10369
+ import { injectable as injectable32 } from "inversify";
10394
10370
 
10395
10371
  // src/plugins/misc/name-mangler/name-mangler.ts
10396
10372
  var NameMangler2 = class _NameMangler {
@@ -10457,7 +10433,7 @@ var NameManglerManagerPlugin = class {
10457
10433
  }
10458
10434
  };
10459
10435
  NameManglerManagerPlugin = __decorateClass([
10460
- injectable33()
10436
+ injectable32()
10461
10437
  ], NameManglerManagerPlugin);
10462
10438
 
10463
10439
  // src/utils/sanity-check.ts