@nasl/cli 0.1.12 → 0.1.13

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/bin/nasl.mjs CHANGED
@@ -37540,9 +37540,14 @@ function extractDeps(content) {
37540
37540
  /**
37541
37541
  * 提取页面文件的签名,移除函数体
37542
37542
  * @param content 页面文件内容
37543
- * @returns 只包含签名的内容
37543
+ * @param hasSubViews 是否有子页面
37544
+ * @returns 只包含签名的内容,或者返回 ElRouterView 的实现
37544
37545
  */
37545
- function replaceViewAsSignature(content) {
37546
+ function replaceViewAsSignature(content, hasSubViews = false) {
37547
+ if (hasSubViews) {
37548
+ // 如果有子页面,替换为返回 ElRouterView 的函数
37549
+ return content.replace(/export function ((\w+)\([^)]*\)) \{[\s\S]+$/, 'export function $1 {\n return <ElRouterView />\n}');
37550
+ }
37546
37551
  return content.replace(/export function ((\w+)\([^)]*\)) \{[\s\S]+$/, 'export declare function $1;');
37547
37552
  }
37548
37553
  /**
@@ -37571,7 +37576,15 @@ function processFileDeps(pathRelativeToSrc, srcDir, matchedFileSet, processedFil
37571
37576
  const pathWithoutExt = pathRelativeToSrc.slice(0, -4);
37572
37577
  const isEntryParent = Array.from(matchedFileSet).some((filePath) => filePath.startsWith(pathWithoutExt));
37573
37578
  if (!isEntryParent) {
37574
- fileInfo.content = replaceViewAsSignature(fileInfo.content);
37579
+ // 检查是否有子页面(路径更长的页面文件)
37580
+ const subViewPattern = `${pathWithoutExt}.views.*.tsx`;
37581
+ const subViews = globby.sync([subViewPattern], {
37582
+ cwd: srcDir,
37583
+ onlyFiles: true,
37584
+ absolute: false,
37585
+ });
37586
+ const hasSubViews = subViews.length > 0;
37587
+ fileInfo.content = replaceViewAsSignature(fileInfo.content, hasSubViews);
37575
37588
  }
37576
37589
  }
37577
37590
  processedFileMap.set(pathRelativeToSrc, fileInfo);
@@ -38048,7 +38061,7 @@ async function build(entry, options) {
38048
38061
  await justExecCommandSync(webpackArgs, outDir);
38049
38062
  }
38050
38063
 
38051
- var version = "0.1.12";
38064
+ var version = "0.1.13";
38052
38065
  var pkg = {
38053
38066
  version: version};
38054
38067