@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.js CHANGED
@@ -103,11 +103,11 @@ var import_axios2 = __toESM(require("axios"));
103
103
  var import_lodash9 = require("lodash");
104
104
 
105
105
  // src/default-container.ts
106
- var import_inversify32 = require("inversify");
106
+ var import_inversify31 = require("inversify");
107
107
 
108
108
  // src/plugins/vue/vue3/vue3-preset-plugin.ts
109
- var import_reflection7 = require("@abraham/reflection");
110
- var import_inversify31 = require("inversify");
109
+ var import_reflection6 = require("@abraham/reflection");
110
+ var import_inversify30 = require("inversify");
111
111
 
112
112
  // src/service-metakind.ts
113
113
  var ServiceMetaKind = {
@@ -2343,7 +2343,8 @@ query: {`;
2343
2343
  let url2 = "`";
2344
2344
  const viewArr = s3.genViewArr();
2345
2345
  if (Array.isArray(viewArr) && viewArr.length) {
2346
- url2 += `/${viewArr.join("/")}`;
2346
+ const prefixPath = s3.frontend?.prefixPath;
2347
+ url2 += `${prefixPath}/${viewArr.join("/")}`;
2347
2348
  const { completeArguments } = s3;
2348
2349
  if (completeArguments.length) {
2349
2350
  const node = s3.viewNode;
@@ -4291,40 +4292,40 @@ var metadataPlugin = makePlugin({
4291
4292
  // src/hack/material-config/material.config.js
4292
4293
  var materials = {
4293
4294
  framework: {
4294
- version: "2.0.0",
4295
+ version: "2.0.1",
4295
4296
  core: "@lcap/basic-template",
4296
4297
  pc: [
4297
4298
  {
4298
4299
  frameworkKind: "vue2",
4299
4300
  name: "@lcap/pc-template",
4300
- version: "2.0.0"
4301
+ version: "2.0.1"
4301
4302
  },
4302
4303
  {
4303
4304
  frameworkKind: "react",
4304
4305
  name: "@lcap/pc-template-react",
4305
- version: "2.0.0"
4306
+ version: "2.0.1"
4306
4307
  },
4307
4308
  {
4308
4309
  frameworkKind: "vue3",
4309
4310
  name: "@lcap/pc-template-vue3",
4310
- version: "2.0.0"
4311
+ version: "2.0.1"
4311
4312
  }
4312
4313
  ],
4313
4314
  h5: [
4314
4315
  {
4315
4316
  frameworkKind: "vue2",
4316
4317
  name: "@lcap/mobile-template",
4317
- version: "2.0.0"
4318
+ version: "2.0.1"
4318
4319
  },
4319
4320
  {
4320
4321
  frameworkKind: "react",
4321
4322
  name: "@lcap/mobile-template-react",
4322
- version: "2.0.0"
4323
+ version: "2.0.1"
4323
4324
  },
4324
4325
  {
4325
4326
  frameworkKind: "vue3",
4326
4327
  name: "@lcap/mobile-template-vue3",
4327
- version: "2.0.0"
4328
+ version: "2.0.1"
4328
4329
  }
4329
4330
  ]
4330
4331
  },
@@ -4398,29 +4399,6 @@ var coreVersion = materials.framework.version;
4398
4399
  function getPredefinedMaterialConfig() {
4399
4400
  return materials;
4400
4401
  }
4401
- function getPredefinedLibConstants() {
4402
- if (!reactUi || !vue3Ui) {
4403
- throw new Error("not found");
4404
- }
4405
- if (reactUi.name !== "@lcap/pc-react-ui") {
4406
- throw new Error("cannot find @lcap/pc-react-ui in material.config.js");
4407
- }
4408
- return {
4409
- reactUI: {
4410
- kind: "standard",
4411
- name: reactUi.name,
4412
- version: reactUi.version
4413
- },
4414
- vue3Ui: {
4415
- kind: "standard",
4416
- name: vue3Ui.name,
4417
- version: vue3Ui.version
4418
- },
4419
- basicTemplate: {
4420
- version: coreVersion
4421
- }
4422
- };
4423
- }
4424
4402
  var getPredefinedMaterialByTags = (() => {
4425
4403
  const materialConfig = getPredefinedMaterialConfig();
4426
4404
  let allMaterials = [];
@@ -4444,12 +4422,14 @@ var getPredefinedMaterialByTags = (() => {
4444
4422
  materialConfig.ui.pc.forEach((item) => {
4445
4423
  allMaterials.push({
4446
4424
  ...item,
4425
+ kind: "standard",
4447
4426
  tags: ["ui", "pc", item.frameworkKind, item.libName]
4448
4427
  });
4449
4428
  });
4450
4429
  materialConfig.ui.h5.forEach((item) => {
4451
4430
  allMaterials.push({
4452
4431
  ...item,
4432
+ kind: "standard",
4453
4433
  tags: ["ui", "h5", item.frameworkKind, item.libName]
4454
4434
  });
4455
4435
  });
@@ -4609,7 +4589,10 @@ function bindAttrToIR(b) {
4609
4589
  throw new Error("string\u4E0D\u53EF\u4E3Async");
4610
4590
  }
4611
4591
  if (b.i18nKey && b.value && b.frontend?.i18nInfo?.enabled) {
4612
- b.type = "dynamic";
4592
+ const frameworkKind = b.frontend?.frameworkKind;
4593
+ if (!["vue3"].includes(frameworkKind)) {
4594
+ b.type = "dynamic";
4595
+ }
4613
4596
  const wrapperExpr = import_nasl_concepts9.CallFunction.from(
4614
4597
  {
4615
4598
  calleeNamespace: "$i18n",
@@ -4713,7 +4696,7 @@ function bindEventToAction(b) {
4713
4696
  kind: "standalone"
4714
4697
  };
4715
4698
  }
4716
- var DefaultComponentLibraryName = getPredefinedLibConstants().reactUI.name;
4699
+ var DefaultComponentLibraryName = getPredefinedMaterialByTags(["ui", "pc", "react"])?.name;
4717
4700
  function getReferencedLibComponent(e) {
4718
4701
  const tag = e.tag;
4719
4702
  if (tag.startsWith("BS")) {
@@ -5379,8 +5362,8 @@ var NASLAppIRBuilderPlugin = class {
5379
5362
  });
5380
5363
  logger5.debug({ extensionPackages });
5381
5364
  const frameworkKind = frontend.frameworkKind;
5382
- const libs = getPredefinedLibConstants();
5383
- return [...extensionPackages, frameworkKind === "vue3" ? libs.vue3Ui : libs.reactUI];
5365
+ const uiLib = getPredefinedMaterialByTags(["ui", frontend.type, frameworkKind]);
5366
+ return [...extensionPackages, uiLib];
5384
5367
  };
5385
5368
  var buildConfigs = buildConfigs2, collectPackages = collectPackages2;
5386
5369
  config.debug && breakpoint2.genBreakpoints(app);
@@ -6749,10 +6732,9 @@ function extractAppLevelFrontendDeps(app) {
6749
6732
  }
6750
6733
  function extractFrontendLevelDeps(frontend) {
6751
6734
  const deps = [];
6752
- if (frontend.frameworkKind === "react") {
6753
- deps.push(getPredefinedLibConstants().reactUI);
6754
- } else if (frontend.frameworkKind === "vue3") {
6755
- deps.push(getPredefinedLibConstants().vue3Ui);
6735
+ const uiLib = getPredefinedMaterialByTags(["ui", frontend.type, frontend.frameworkKind]);
6736
+ if (uiLib) {
6737
+ deps.push(uiLib);
6756
6738
  }
6757
6739
  return deps;
6758
6740
  }
@@ -6925,11 +6907,11 @@ async function downloadDependenciesToLcapModules(feDeps, fs, config) {
6925
6907
  }
6926
6908
  let packageJson = fs.read("/package.json")?.toString();
6927
6909
  packageJson = JSON.parse(packageJson);
6928
- if (!packageJson.dependencies) {
6929
- packageJson.dependencies = {};
6910
+ if (!packageJson.lcap_modules) {
6911
+ packageJson.lcap_modules = {};
6930
6912
  }
6931
6913
  downloadedDeps.forEach(({ pkgName, targetPath }) => {
6932
- packageJson.dependencies[pkgName] = `.${targetPath}`;
6914
+ packageJson.lcap_modules[pkgName] = `.${targetPath}`;
6933
6915
  });
6934
6916
  fs.write("/package.json", JSON.stringify(packageJson, null, 2));
6935
6917
  logger13.info("\u4E0B\u8F7D\u524D\u7AEF\u4F9D\u8D56\u5E93\u5230 lcap_modules \u76EE\u5F55\u5B8C\u6210");
@@ -7004,7 +6986,7 @@ BundlerConfigDataPlugin = __decorateClass([
7004
6986
  __decorateParam(0, (0, import_inversify16.inject)(ServiceMetaKind.FrontendBundlerConfig))
7005
6987
  ], BundlerConfigDataPlugin);
7006
6988
 
7007
- // src/plugins/misc/bundler/respack-config-plugin.ts
6989
+ // src/plugins/misc/bundler/rspack-config-plugin.ts
7008
6990
  var import_reflection4 = require("@abraham/reflection");
7009
6991
  var import_inversify17 = require("inversify");
7010
6992
  var RspackConfigPlugin = class {
@@ -7028,9 +7010,16 @@ var RspackConfigPlugin = class {
7028
7010
  `chunks: '${this.frontendPerformancePlugin?.performanceOptions?.chunks}'`
7029
7011
  );
7030
7012
  }
7013
+ 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"}`);
7014
+ if (config.needCompileViews && config.needCompileViews.length > 0 && config.cacheChunksMapCode) {
7015
+ rspackConfigSource = rspackConfigSource.replace("isIncremental: false", "isIncremental: true").replace("chunksMap: ''", `chunksMap: \`${config.cacheChunksMapCode}\``);
7016
+ }
7017
+ if (config.isExport) {
7018
+ rspackConfigSource = rspackConfigSource.replace(/\/\/ LcapPlugin start\s+new LcapPlugin\(\{[\s\S]*?\}\),\s+\/\/ LcapPlugin end/g, "");
7019
+ }
7031
7020
  fs.write(
7032
7021
  "/rspack.config.js",
7033
- rspackConfigSource.replace(`const backendUrl = '';`, `const backendUrl = '${backendUrl}'`).replace(`const publicPath = '';`, `const publicPath = '${publicPath}';`).replace(`sourceMap: false,`, `sourceMap: ${config.env === "dev"},`).replace("alias: {}", `alias: {${aliasMapStr}}`)
7022
+ rspackConfigSource
7034
7023
  );
7035
7024
  }
7036
7025
  }
@@ -7238,49 +7227,12 @@ EntrypointPlugin = __decorateClass([
7238
7227
  __decorateParam(0, (0, import_inversify19.inject)(ServiceMetaKind.MicroFrontendManager))
7239
7228
  ], EntrypointPlugin);
7240
7229
 
7241
- // src/plugins/misc/bundler/vite-config-plugin.ts
7242
- var import_reflection6 = require("@abraham/reflection");
7243
- var import_inversify20 = require("inversify");
7244
- var ViteConfigPlugin = class {
7245
- constructor(bundlerConfigDataPlugin) {
7246
- this.bundlerConfigDataPlugin = bundlerConfigDataPlugin;
7247
- }
7248
- async configBundlerConfig(app, frontend, config, fs, frameworkKind) {
7249
- const isDev = config.env === "dev";
7250
- const { backendUrl, publicPath, aliasMapStr, dependenciesStr } = await this.bundlerConfigDataPlugin.getBundlerConfigData(
7251
- app,
7252
- frontend,
7253
- config,
7254
- fs,
7255
- frameworkKind
7256
- );
7257
- const viteConfigSource = fs.read("/vite.config.ts")?.toString();
7258
- if (viteConfigSource) {
7259
- fs.write(
7260
- "/vite.config.ts",
7261
- 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(
7262
- "optimizeDeps: { include: [], },",
7263
- `optimizeDeps: { include: [${dependenciesStr}], },`
7264
- )
7265
- );
7266
- }
7267
- }
7268
- static install(c) {
7269
- c.bind(ServiceMetaKind.FrontendBundlerFileConfig).to(ViteConfigPlugin).inSingletonScope();
7270
- return c;
7271
- }
7272
- };
7273
- ViteConfigPlugin = __decorateClass([
7274
- (0, import_inversify20.injectable)(),
7275
- __decorateParam(0, (0, import_inversify20.inject)(BundlerConfigDataPlugin))
7276
- ], ViteConfigPlugin);
7277
-
7278
7230
  // src/plugins/vue/vue3/vue3-application-assembler-plugin.ts
7279
- var import_inversify30 = require("inversify");
7231
+ var import_inversify29 = require("inversify");
7280
7232
 
7281
7233
  // src/plugins/vue/common/vue-router-plugin.ts
7282
7234
  var import_nasl_utils2 = require("@lcap/nasl-utils");
7283
- var import_inversify21 = require("inversify");
7235
+ var import_inversify20 = require("inversify");
7284
7236
  var VueRouterPlugin = class {
7285
7237
  extractImportIR(routes, componentPathManager) {
7286
7238
  const nameMangler = new NameMangler();
@@ -7313,17 +7265,26 @@ var VueRouterPlugin = class {
7313
7265
  }
7314
7266
  routeToCode(routes, componentPathManager, config) {
7315
7267
  function serializeVueRoute(r, isRoot = false) {
7316
- const path = r.thisLevelPath ?? "/";
7268
+ const { accumulativePath, thisLevelPath } = r;
7269
+ const path = isRoot ? accumulativePath : thisLevelPath ?? "/";
7270
+ const basePath = config.basePath;
7317
7271
  if (r.kind === "normal") {
7318
7272
  const children = r.children?.map((i) => serializeVueRoute(i)).filter(isNotNil) ?? [];
7319
7273
  const childrenStr = children.join(",\n");
7320
7274
  const componentCode = `component: ${r.elementMangledName ?? r.elementTemplate.identifier}`;
7321
- return `{path: "${isRoot ? r.accumulativePath : path}", meta: ${JSON.stringify(
7275
+ return `{path: "${path}", meta: ${JSON.stringify(
7322
7276
  r.meta
7323
7277
  )}, children: [${childrenStr}], ${componentCode} }`;
7324
7278
  } else if (r.kind === "redirect") {
7325
7279
  if (["vue3"].includes(config.frameworkKind) && path === "*") {
7326
- return `{ path: "/:pathMatch(.*)*", redirect: ${JSON.stringify(r.redirect)} }`;
7280
+ return `{ path: "/:pathMatch(.*)*", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
7281
+ }
7282
+ if (["vue3"].includes(config.frameworkKind) && path === "/") {
7283
+ let result = `{ path: "/", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
7284
+ if (basePath !== "/") {
7285
+ result += `, { path: "${basePath}", redirect: ${JSON.stringify(basePath + r.redirect)} }`;
7286
+ }
7287
+ return result;
7327
7288
  }
7328
7289
  return `{ path: "${path}", redirect: to => to.path.replace(/\\/$/, '') + '/' + ${JSON.stringify(r.redirect)} }`;
7329
7290
  }
@@ -7345,11 +7306,11 @@ var VueRouterPlugin = class {
7345
7306
  }
7346
7307
  };
7347
7308
  VueRouterPlugin = __decorateClass([
7348
- (0, import_inversify21.injectable)()
7309
+ (0, import_inversify20.injectable)()
7349
7310
  ], VueRouterPlugin);
7350
7311
 
7351
7312
  // src/plugins/vue/vue3/vue3-codegen-plugin.ts
7352
- var import_inversify22 = require("inversify");
7313
+ var import_inversify21 = require("inversify");
7353
7314
  var import_nasl_utils3 = require("@lcap/nasl-utils");
7354
7315
  var import_lodash8 = require("lodash");
7355
7316
  var Vue3CodegenPlugin = class {
@@ -7397,11 +7358,11 @@ var Vue3CodegenPlugin = class {
7397
7358
  }
7398
7359
  };
7399
7360
  Vue3CodegenPlugin = __decorateClass([
7400
- (0, import_inversify22.injectable)()
7361
+ (0, import_inversify21.injectable)()
7401
7362
  ], Vue3CodegenPlugin);
7402
7363
 
7403
7364
  // src/plugins/vue/vue3/vue3-entry-builder-plugin.ts
7404
- var import_inversify23 = require("inversify");
7365
+ var import_inversify22 = require("inversify");
7405
7366
  var Vue3EntryBuilderPlugin = class {
7406
7367
  constructor(microFrontendManager) {
7407
7368
  this.microFrontendManager = microFrontendManager;
@@ -7443,12 +7404,12 @@ var Vue3EntryBuilderPlugin = class {
7443
7404
  }
7444
7405
  };
7445
7406
  Vue3EntryBuilderPlugin = __decorateClass([
7446
- (0, import_inversify23.injectable)(),
7447
- __decorateParam(0, (0, import_inversify23.inject)(ServiceMetaKind.MicroFrontendManager))
7407
+ (0, import_inversify22.injectable)(),
7408
+ __decorateParam(0, (0, import_inversify22.inject)(ServiceMetaKind.MicroFrontendManager))
7448
7409
  ], Vue3EntryBuilderPlugin);
7449
7410
 
7450
7411
  // src/plugins/vue/vue3/vue3-libraries-builder-plugin.ts
7451
- var import_inversify24 = require("inversify");
7412
+ var import_inversify23 = require("inversify");
7452
7413
  var Vue3LibrariesBuilderPlugin = class {
7453
7414
  /**
7454
7415
  * 构建依赖库导入文件
@@ -7457,10 +7418,13 @@ var Vue3LibrariesBuilderPlugin = class {
7457
7418
  */
7458
7419
  async buildLibrariesImport(ir, config) {
7459
7420
  const importArr = [];
7421
+ const exportArr = [];
7460
7422
  const standardLib = ir.packages.find((x) => x.kind === "standard");
7461
7423
  if (standardLib) {
7462
7424
  const formattedName = kebab2Pascal(standardLib.name.split("/").at(-1));
7463
- importArr.push(`export * as ${formattedName} from '${standardLib.name}';`);
7425
+ importArr.push(`import * as ${formattedName} from '${standardLib.name}';`);
7426
+ exportArr.push(`export { ${formattedName} };`);
7427
+ exportArr.push(`window.lcapStandardUI = ${formattedName};`);
7464
7428
  const isPackageZipExists = await judgePackageZipExists(standardLib, config.STATIC_URL);
7465
7429
  importArr.push(
7466
7430
  `import '${standardLib.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
@@ -7471,14 +7435,14 @@ var Vue3LibrariesBuilderPlugin = class {
7471
7435
  const formattedName = kebab2Pascal(ext.name.split("/").at(-1));
7472
7436
  const isPackageZipExists = await judgePackageZipExists(ext, config.STATIC_URL);
7473
7437
  const prefix = isPackageZipExists ? "" : "@extension/";
7474
- importArr.push(`export * as ${formattedName} from '${prefix}${ext.name}';`);
7438
+ exportArr.push(`export * as ${formattedName} from '${prefix}${ext.name}';`);
7475
7439
  if (ext.hasCss) {
7476
7440
  importArr.push(
7477
7441
  `import '${prefix}${ext.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
7478
7442
  );
7479
7443
  }
7480
7444
  }
7481
- return new ReactFileDescription("libraries.ts", [], [], [importArr.join("\n")]);
7445
+ return new ReactFileDescription("libraries.ts", [], [], [[...importArr, ...exportArr].join("\n")]);
7482
7446
  }
7483
7447
  static install(c) {
7484
7448
  c.bind(Vue3LibrariesBuilderPlugin).toSelf();
@@ -7486,11 +7450,11 @@ var Vue3LibrariesBuilderPlugin = class {
7486
7450
  }
7487
7451
  };
7488
7452
  Vue3LibrariesBuilderPlugin = __decorateClass([
7489
- (0, import_inversify24.injectable)()
7453
+ (0, import_inversify23.injectable)()
7490
7454
  ], Vue3LibrariesBuilderPlugin);
7491
7455
 
7492
7456
  // src/plugins/vue/vue3/vue3-meta-data-builder-plugin.ts
7493
- var import_inversify25 = require("inversify");
7457
+ var import_inversify24 = require("inversify");
7494
7458
  var Vue3MetaDataBuilderPlugin = class {
7495
7459
  /**
7496
7460
  * 构建依赖库导入文件
@@ -7511,7 +7475,7 @@ var Vue3MetaDataBuilderPlugin = class {
7511
7475
  }
7512
7476
  };
7513
7477
  Vue3MetaDataBuilderPlugin = __decorateClass([
7514
- (0, import_inversify25.injectable)()
7478
+ (0, import_inversify24.injectable)()
7515
7479
  ], Vue3MetaDataBuilderPlugin);
7516
7480
  function stringifyMetaData(obj) {
7517
7481
  if (typeof obj === "object" && obj !== null) {
@@ -7545,7 +7509,7 @@ function stringifyMetaData(obj) {
7545
7509
  }
7546
7510
 
7547
7511
  // src/plugins/vue/vue3/vue3-components-index-builder-plugin.ts
7548
- var import_inversify26 = require("inversify");
7512
+ var import_inversify25 = require("inversify");
7549
7513
  var Vue3ComponentsIndexBuilderPlugin = class {
7550
7514
  /**
7551
7515
  * 构建业务组件导出入口文件
@@ -7575,11 +7539,11 @@ var Vue3ComponentsIndexBuilderPlugin = class {
7575
7539
  }
7576
7540
  };
7577
7541
  Vue3ComponentsIndexBuilderPlugin = __decorateClass([
7578
- (0, import_inversify26.injectable)()
7542
+ (0, import_inversify25.injectable)()
7579
7543
  ], Vue3ComponentsIndexBuilderPlugin);
7580
7544
 
7581
7545
  // src/plugins/vue/vue3/vue3-client-lazyload-template-builder-plugin .ts
7582
- var import_inversify27 = require("inversify");
7546
+ var import_inversify26 = require("inversify");
7583
7547
  var Vue3ClientLazyloadTemplateBuilderPlugin = class {
7584
7548
  constructor(microFrontendManager) {
7585
7549
  this.microFrontendManager = microFrontendManager;
@@ -7592,32 +7556,19 @@ var Vue3ClientLazyloadTemplateBuilderPlugin = class {
7592
7556
  const isDebug = ir.configs.config.debug;
7593
7557
  const entryScript = this.microFrontendManager.produceScript(ir);
7594
7558
  return new ReactFileDescription(
7595
- "../client-lazyload-template.ts",
7559
+ "../client-lazyload-template.js",
7596
7560
  [],
7597
7561
  [],
7598
7562
  [
7599
- `
7600
- export default function (templateParameters, publicPath) {
7601
- const { files } = templateParameters
7602
- const jsAssets = files.js?.map((x) => publicPath + x.fileName) ?? []
7603
- const cssAssets = files.css?.map((x) => publicPath + x.fileName) ?? []
7604
- // \u5982\u679C\u662Fdebug\u6A21\u5F0F\uFF0C\u52A0\u8F7D\u65AD\u70B9\u8C03\u8BD5\u5668
7605
- ${isDebug ? `jsAssets.push(
7606
- '${ir.configs.config.STATIC_URL}/packages/vue@2/dist/vue.min.js',
7607
- '${ir.configs.config.STATIC_URL}/packages/@lcap/breakpoint-client@1.0.0/dist/index.js?time=${Date.now()}',
7608
- );` : ""}
7609
- const lazyLoadCommand = \`
7610
- \${JSON.stringify(jsAssets)}.forEach(asset => window.LazyLoad.js(asset));
7611
- window.LazyLoad.css(\${JSON.stringify(cssAssets)});
7612
- \`;
7613
- return \`(function(){
7614
- function loadAssets(){
7615
- \${lazyLoadCommand};
7616
- }
7617
- ${entryScript};
7618
- })();\`;
7619
- }
7620
- `
7563
+ `const extraJS = [];
7564
+ const extraCSS = [];
7565
+ const entryCode = \`${entryScript}\`;
7566
+
7567
+ module.exports = {
7568
+ extraJS,
7569
+ extraCSS,
7570
+ entryCode,
7571
+ }`
7621
7572
  ]
7622
7573
  );
7623
7574
  }
@@ -7627,12 +7578,12 @@ var Vue3ClientLazyloadTemplateBuilderPlugin = class {
7627
7578
  }
7628
7579
  };
7629
7580
  Vue3ClientLazyloadTemplateBuilderPlugin = __decorateClass([
7630
- (0, import_inversify27.injectable)(),
7631
- __decorateParam(0, (0, import_inversify27.inject)(ServiceMetaKind.MicroFrontendManager))
7581
+ (0, import_inversify26.injectable)(),
7582
+ __decorateParam(0, (0, import_inversify26.inject)(ServiceMetaKind.MicroFrontendManager))
7632
7583
  ], Vue3ClientLazyloadTemplateBuilderPlugin);
7633
7584
 
7634
7585
  // src/plugins/vue/vue3/vue3-platform-builder-plugin.ts
7635
- var import_inversify28 = require("inversify");
7586
+ var import_inversify27 = require("inversify");
7636
7587
  var Vue3PlatformBuilderPlugin = class {
7637
7588
  /**
7638
7589
  * 构建平台配置文件
@@ -7666,11 +7617,11 @@ var Vue3PlatformBuilderPlugin = class {
7666
7617
  }
7667
7618
  };
7668
7619
  Vue3PlatformBuilderPlugin = __decorateClass([
7669
- (0, import_inversify28.injectable)()
7620
+ (0, import_inversify27.injectable)()
7670
7621
  ], Vue3PlatformBuilderPlugin);
7671
7622
 
7672
7623
  // src/plugins/vue/vue3/vue3-entry-css-plugin.ts
7673
- var import_inversify29 = require("inversify");
7624
+ var import_inversify28 = require("inversify");
7674
7625
  var Vue3EntryCssPlugin = class {
7675
7626
  /**
7676
7627
  * 构建依赖库导入文件
@@ -7687,7 +7638,7 @@ var Vue3EntryCssPlugin = class {
7687
7638
  }
7688
7639
  };
7689
7640
  Vue3EntryCssPlugin = __decorateClass([
7690
- (0, import_inversify29.injectable)()
7641
+ (0, import_inversify28.injectable)()
7691
7642
  ], Vue3EntryCssPlugin);
7692
7643
 
7693
7644
  // src/plugins/vue/vue3/vue3-application-assembler-plugin.ts
@@ -7704,7 +7655,7 @@ var ComponentPathManager = class {
7704
7655
  }
7705
7656
  };
7706
7657
  ComponentPathManager = __decorateClass([
7707
- (0, import_inversify30.injectable)()
7658
+ (0, import_inversify29.injectable)()
7708
7659
  ], ComponentPathManager);
7709
7660
  var Vue3ApplicationAssemblerPlugin = class {
7710
7661
  constructor(vue3CodegenPlugin, routesExtactor, routerBuilder, entryBuilder, librariesBuilder, entryCssBuilder, componentsIndexBuilder, clientLazyloadTemplateBuilder, platformBuilder, metaDataBuilder) {
@@ -7727,15 +7678,16 @@ var Vue3ApplicationAssemblerPlugin = class {
7727
7678
  const bizComponents = ir.bizComponents.flatMap((x) => {
7728
7679
  return this.vue3CodegenPlugin.genFiles(x, manager);
7729
7680
  });
7730
- let routePrefix = ir.configs.frontendDesc.path;
7731
- if (!/\/$/.test(routePrefix)) {
7732
- routePrefix += "/";
7681
+ let basePath = ir.configs.basePlatformConfig.basePath;
7682
+ if (!/\/$/.test(basePath)) {
7683
+ basePath += "/";
7733
7684
  }
7734
- const routesObjects = this.routesExtactor.extractRoute(ir.views, routePrefix, {
7685
+ const routesObjects = this.routesExtactor.extractRoute(ir.views, basePath, {
7735
7686
  lazy: true
7736
7687
  });
7737
7688
  const router = this.routerBuilder.routeToCode(routesObjects.routes, manager, {
7738
- frameworkKind: "vue3"
7689
+ frameworkKind: "vue3",
7690
+ basePath
7739
7691
  });
7740
7692
  const routerFile = new ReactFileDescription("router.ts", router.imports, [], [router.code]);
7741
7693
  const libraries = await this.librariesBuilder.buildLibrariesImport(ir, config);
@@ -7759,17 +7711,17 @@ var Vue3ApplicationAssemblerPlugin = class {
7759
7711
  }
7760
7712
  };
7761
7713
  Vue3ApplicationAssemblerPlugin = __decorateClass([
7762
- (0, import_inversify30.injectable)(),
7763
- __decorateParam(0, (0, import_inversify30.inject)(Vue3CodegenPlugin)),
7764
- __decorateParam(1, (0, import_inversify30.inject)(RoutesExtractionPlugin)),
7765
- __decorateParam(2, (0, import_inversify30.inject)(VueRouterPlugin)),
7766
- __decorateParam(3, (0, import_inversify30.inject)(Vue3EntryBuilderPlugin)),
7767
- __decorateParam(4, (0, import_inversify30.inject)(Vue3LibrariesBuilderPlugin)),
7768
- __decorateParam(5, (0, import_inversify30.inject)(Vue3EntryCssPlugin)),
7769
- __decorateParam(6, (0, import_inversify30.inject)(Vue3ComponentsIndexBuilderPlugin)),
7770
- __decorateParam(7, (0, import_inversify30.inject)(Vue3ClientLazyloadTemplateBuilderPlugin)),
7771
- __decorateParam(8, (0, import_inversify30.inject)(Vue3PlatformBuilderPlugin)),
7772
- __decorateParam(9, (0, import_inversify30.inject)(Vue3MetaDataBuilderPlugin))
7714
+ (0, import_inversify29.injectable)(),
7715
+ __decorateParam(0, (0, import_inversify29.inject)(Vue3CodegenPlugin)),
7716
+ __decorateParam(1, (0, import_inversify29.inject)(RoutesExtractionPlugin)),
7717
+ __decorateParam(2, (0, import_inversify29.inject)(VueRouterPlugin)),
7718
+ __decorateParam(3, (0, import_inversify29.inject)(Vue3EntryBuilderPlugin)),
7719
+ __decorateParam(4, (0, import_inversify29.inject)(Vue3LibrariesBuilderPlugin)),
7720
+ __decorateParam(5, (0, import_inversify29.inject)(Vue3EntryCssPlugin)),
7721
+ __decorateParam(6, (0, import_inversify29.inject)(Vue3ComponentsIndexBuilderPlugin)),
7722
+ __decorateParam(7, (0, import_inversify29.inject)(Vue3ClientLazyloadTemplateBuilderPlugin)),
7723
+ __decorateParam(8, (0, import_inversify29.inject)(Vue3PlatformBuilderPlugin)),
7724
+ __decorateParam(9, (0, import_inversify29.inject)(Vue3MetaDataBuilderPlugin))
7773
7725
  ], Vue3ApplicationAssemblerPlugin);
7774
7726
 
7775
7727
  // src/plugins/vue/vue3/vue3-preset-plugin.ts
@@ -7788,6 +7740,30 @@ var Vue3PresetPlugin = class {
7788
7740
  const app = deserializeAppWhileKeepTypeAnnotation(appJson);
7789
7741
  const frontend = app.findNodeByPath(instruction.frontend.nodePath);
7790
7742
  const ir = this.irBuilder.buildIR(app, frontend, instruction.config);
7743
+ const needCompileViews = instruction.config?.needCompileViews ?? [];
7744
+ const isIncremental = needCompileViews.length > 0;
7745
+ if (isIncremental) {
7746
+ const filterChildComponents = (view, needCompileViews2) => {
7747
+ if (!view.childComponents?.length) {
7748
+ return;
7749
+ }
7750
+ view.childComponents = view.childComponents.filter((child) => {
7751
+ if (needCompileViews2.includes(child.__raw.nodePath)) {
7752
+ filterChildComponents(child, needCompileViews2);
7753
+ return true;
7754
+ }
7755
+ return false;
7756
+ });
7757
+ };
7758
+ ir.views = ir.views.filter((view) => {
7759
+ if (needCompileViews.includes(view.__raw.nodePath)) {
7760
+ filterChildComponents(view, needCompileViews);
7761
+ return true;
7762
+ }
7763
+ return false;
7764
+ });
7765
+ ir.bizComponents = [];
7766
+ }
7791
7767
  const assembledApplication = await this.applicationAssembler.assemble(ir, instruction.config);
7792
7768
  const finalizedFiles = await this.projectOrganizer.organize({
7793
7769
  baseDir: instruction.baseDir,
@@ -7824,7 +7800,7 @@ var Vue3PresetPlugin = class {
7824
7800
  c.bind(ServiceMetaKind.ProjectOrganizer).to(ProjectOrganizerPlugin);
7825
7801
  c.bind(ServiceMetaKind.FileSystemProvider).to(FileSystemPlugin).inSingletonScope();
7826
7802
  c = BundlerConfigDataPlugin.install(c);
7827
- c = ViteConfigPlugin.install(c);
7803
+ c = RspackConfigPlugin.install(c);
7828
7804
  c = FrontendBundlerConfigPlugin.install(c);
7829
7805
  c = FrontendPerformancePlugin.install(c);
7830
7806
  c = NpmPackageJSONManagerPlugin.install(c);
@@ -7841,20 +7817,20 @@ var Vue3PresetPlugin = class {
7841
7817
  }
7842
7818
  };
7843
7819
  Vue3PresetPlugin = __decorateClass([
7844
- (0, import_inversify31.injectable)(),
7845
- __decorateParam(0, (0, import_inversify31.inject)(ServiceMetaKind.IRBuilder)),
7846
- __decorateParam(1, (0, import_inversify31.inject)(ServiceMetaKind.FileSystemProvider)),
7847
- __decorateParam(2, (0, import_inversify31.inject)(NpmPackageJSONManagerPlugin)),
7848
- __decorateParam(3, (0, import_inversify31.inject)(ServiceMetaKind.ProjectOrganizer)),
7849
- __decorateParam(4, (0, import_inversify31.inject)(Vue3ApplicationAssemblerPlugin))
7820
+ (0, import_inversify30.injectable)(),
7821
+ __decorateParam(0, (0, import_inversify30.inject)(ServiceMetaKind.IRBuilder)),
7822
+ __decorateParam(1, (0, import_inversify30.inject)(ServiceMetaKind.FileSystemProvider)),
7823
+ __decorateParam(2, (0, import_inversify30.inject)(NpmPackageJSONManagerPlugin)),
7824
+ __decorateParam(3, (0, import_inversify30.inject)(ServiceMetaKind.ProjectOrganizer)),
7825
+ __decorateParam(4, (0, import_inversify30.inject)(Vue3ApplicationAssemblerPlugin))
7850
7826
  ], Vue3PresetPlugin);
7851
7827
 
7852
7828
  // src/default-container.ts
7853
7829
  function makeDefaultContainer(kind = "react") {
7854
7830
  if (kind === "react") {
7855
- return ReactPresetPlugin.install(new import_inversify32.Container());
7831
+ return ReactPresetPlugin.install(new import_inversify31.Container());
7856
7832
  } else if (kind === "vue3") {
7857
- return Vue3PresetPlugin.install(new import_inversify32.Container());
7833
+ return Vue3PresetPlugin.install(new import_inversify31.Container());
7858
7834
  } else {
7859
7835
  throw new Error(`\u672A\u5B9E\u73B0${kind}\u7684\u9ED8\u8BA4\u5BB9\u5668`);
7860
7836
  }
@@ -8021,7 +7997,7 @@ async function compileNASLToReactDist(app, frontend, config, http) {
8021
7997
  }
8022
7998
 
8023
7999
  // src/plugins/misc/program-analysis/analyzer-manager-plugin.ts
8024
- var import_inversify33 = require("inversify");
8000
+ var import_inversify32 = require("inversify");
8025
8001
 
8026
8002
  // src/plugins/misc/program-analysis/analysis/async-analysis.ts
8027
8003
  function buildAsyncAnalyzer() {
@@ -8148,11 +8124,11 @@ var AnalyzerManagerPlugin = class {
8148
8124
  }
8149
8125
  };
8150
8126
  AnalyzerManagerPlugin = __decorateClass([
8151
- (0, import_inversify33.injectable)()
8127
+ (0, import_inversify32.injectable)()
8152
8128
  ], AnalyzerManagerPlugin);
8153
8129
 
8154
8130
  // src/plugins/misc/name-mangler/name-mangler-manager-plugin.ts
8155
- var import_inversify34 = require("inversify");
8131
+ var import_inversify33 = require("inversify");
8156
8132
 
8157
8133
  // src/plugins/misc/name-mangler/name-mangler.ts
8158
8134
  var NameMangler2 = class _NameMangler {
@@ -8219,7 +8195,7 @@ var NameManglerManagerPlugin = class {
8219
8195
  }
8220
8196
  };
8221
8197
  NameManglerManagerPlugin = __decorateClass([
8222
- (0, import_inversify34.injectable)()
8198
+ (0, import_inversify33.injectable)()
8223
8199
  ], NameManglerManagerPlugin);
8224
8200
  // Annotate the CommonJS export names for ESM import in node:
8225
8201
  0 && (module.exports = {