@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 +17 -4
- package/dist/bin/nasl.mjs.map +1 -1
- package/dist/bin/naslc.mjs +17 -4
- package/dist/bin/naslc.mjs.map +1 -1
- package/dist/index.mjs +16 -3
- package/dist/index.mjs.map +1 -1
- package/out/services/resolve.d.ts.map +1 -1
- package/out/services/resolve.js +16 -3
- package/out/services/resolve.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -13692,9 +13692,14 @@ function extractDeps(content) {
|
|
|
13692
13692
|
/**
|
|
13693
13693
|
* 提取页面文件的签名,移除函数体
|
|
13694
13694
|
* @param content 页面文件内容
|
|
13695
|
-
* @
|
|
13695
|
+
* @param hasSubViews 是否有子页面
|
|
13696
|
+
* @returns 只包含签名的内容,或者返回 ElRouterView 的实现
|
|
13696
13697
|
*/
|
|
13697
|
-
function replaceViewAsSignature(content) {
|
|
13698
|
+
function replaceViewAsSignature(content, hasSubViews = false) {
|
|
13699
|
+
if (hasSubViews) {
|
|
13700
|
+
// 如果有子页面,替换为返回 ElRouterView 的函数
|
|
13701
|
+
return content.replace(/export function ((\w+)\([^)]*\)) \{[\s\S]+$/, 'export function $1 {\n return <ElRouterView />\n}');
|
|
13702
|
+
}
|
|
13698
13703
|
return content.replace(/export function ((\w+)\([^)]*\)) \{[\s\S]+$/, 'export declare function $1;');
|
|
13699
13704
|
}
|
|
13700
13705
|
/**
|
|
@@ -13723,7 +13728,15 @@ function processFileDeps(pathRelativeToSrc, srcDir, matchedFileSet, processedFil
|
|
|
13723
13728
|
const pathWithoutExt = pathRelativeToSrc.slice(0, -4);
|
|
13724
13729
|
const isEntryParent = Array.from(matchedFileSet).some((filePath) => filePath.startsWith(pathWithoutExt));
|
|
13725
13730
|
if (!isEntryParent) {
|
|
13726
|
-
|
|
13731
|
+
// 检查是否有子页面(路径更长的页面文件)
|
|
13732
|
+
const subViewPattern = `${pathWithoutExt}.views.*.tsx`;
|
|
13733
|
+
const subViews = globby.sync([subViewPattern], {
|
|
13734
|
+
cwd: srcDir,
|
|
13735
|
+
onlyFiles: true,
|
|
13736
|
+
absolute: false,
|
|
13737
|
+
});
|
|
13738
|
+
const hasSubViews = subViews.length > 0;
|
|
13739
|
+
fileInfo.content = replaceViewAsSignature(fileInfo.content, hasSubViews);
|
|
13727
13740
|
}
|
|
13728
13741
|
}
|
|
13729
13742
|
processedFileMap.set(pathRelativeToSrc, fileInfo);
|