@nasl/cli 0.1.12 → 0.1.14
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 +22 -5
- package/dist/bin/nasl.mjs.map +1 -1
- package/dist/bin/naslc.mjs +22 -5
- package/dist/bin/naslc.mjs.map +1 -1
- package/dist/index.mjs +21 -4
- package/dist/index.mjs.map +1 -1
- package/out/services/resolve.d.ts.map +1 -1
- package/out/services/resolve.js +21 -4
- package/out/services/resolve.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/nasl.mjs
CHANGED
|
@@ -37520,7 +37520,11 @@ async function scanEntryFiles(projectRoot, patterns, logger) {
|
|
|
37520
37520
|
*/
|
|
37521
37521
|
function extractDeps(content) {
|
|
37522
37522
|
const deps = new Set();
|
|
37523
|
-
|
|
37523
|
+
// 预处理:移除注释,避免注释影响依赖分析
|
|
37524
|
+
let processedContent = content
|
|
37525
|
+
.replace(/\/\/.*$/gm, '') // 移除单行注释 // ...
|
|
37526
|
+
.replace(/\/\*[\s\S]*?\*\//g, ''); // 移除多行注释 /* ... */
|
|
37527
|
+
const allMatches = processedContent.matchAll(/app\.\w+\.[\w.]+/g); // 起码要2个点
|
|
37524
37528
|
for (const match of allMatches) {
|
|
37525
37529
|
let dep = match[0];
|
|
37526
37530
|
if (/Entity$|Entity\./.test(dep)) {
|
|
@@ -37540,9 +37544,14 @@ function extractDeps(content) {
|
|
|
37540
37544
|
/**
|
|
37541
37545
|
* 提取页面文件的签名,移除函数体
|
|
37542
37546
|
* @param content 页面文件内容
|
|
37543
|
-
* @
|
|
37547
|
+
* @param hasSubViews 是否有子页面
|
|
37548
|
+
* @returns 只包含签名的内容,或者返回 ElRouterView 的实现
|
|
37544
37549
|
*/
|
|
37545
|
-
function replaceViewAsSignature(content) {
|
|
37550
|
+
function replaceViewAsSignature(content, hasSubViews = false) {
|
|
37551
|
+
if (hasSubViews) {
|
|
37552
|
+
// 如果有子页面,替换为返回 ElRouterView 的函数
|
|
37553
|
+
return content.replace(/export function ((\w+)\([^)]*\)) \{[\s\S]+$/, 'export function $1 {\n return <ElRouterView />\n}');
|
|
37554
|
+
}
|
|
37546
37555
|
return content.replace(/export function ((\w+)\([^)]*\)) \{[\s\S]+$/, 'export declare function $1;');
|
|
37547
37556
|
}
|
|
37548
37557
|
/**
|
|
@@ -37571,7 +37580,15 @@ function processFileDeps(pathRelativeToSrc, srcDir, matchedFileSet, processedFil
|
|
|
37571
37580
|
const pathWithoutExt = pathRelativeToSrc.slice(0, -4);
|
|
37572
37581
|
const isEntryParent = Array.from(matchedFileSet).some((filePath) => filePath.startsWith(pathWithoutExt));
|
|
37573
37582
|
if (!isEntryParent) {
|
|
37574
|
-
|
|
37583
|
+
// 检查是否有子页面(路径更长的页面文件)
|
|
37584
|
+
const subViewPattern = `${pathWithoutExt}.views.*.tsx`;
|
|
37585
|
+
const subViews = globby.sync([subViewPattern], {
|
|
37586
|
+
cwd: srcDir,
|
|
37587
|
+
onlyFiles: true,
|
|
37588
|
+
absolute: false,
|
|
37589
|
+
});
|
|
37590
|
+
const hasSubViews = subViews.length > 0;
|
|
37591
|
+
fileInfo.content = replaceViewAsSignature(fileInfo.content, hasSubViews);
|
|
37575
37592
|
}
|
|
37576
37593
|
}
|
|
37577
37594
|
processedFileMap.set(pathRelativeToSrc, fileInfo);
|
|
@@ -38048,7 +38065,7 @@ async function build(entry, options) {
|
|
|
38048
38065
|
await justExecCommandSync(webpackArgs, outDir);
|
|
38049
38066
|
}
|
|
38050
38067
|
|
|
38051
|
-
var version = "0.1.
|
|
38068
|
+
var version = "0.1.14";
|
|
38052
38069
|
var pkg = {
|
|
38053
38070
|
version: version};
|
|
38054
38071
|
|