@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/naslc.mjs
CHANGED
|
@@ -37432,7 +37432,11 @@ async function scanEntryFiles(projectRoot, patterns, logger) {
|
|
|
37432
37432
|
*/
|
|
37433
37433
|
function extractDeps(content) {
|
|
37434
37434
|
const deps = new Set();
|
|
37435
|
-
|
|
37435
|
+
// 预处理:移除注释,避免注释影响依赖分析
|
|
37436
|
+
let processedContent = content
|
|
37437
|
+
.replace(/\/\/.*$/gm, '') // 移除单行注释 // ...
|
|
37438
|
+
.replace(/\/\*[\s\S]*?\*\//g, ''); // 移除多行注释 /* ... */
|
|
37439
|
+
const allMatches = processedContent.matchAll(/app\.\w+\.[\w.]+/g); // 起码要2个点
|
|
37436
37440
|
for (const match of allMatches) {
|
|
37437
37441
|
let dep = match[0];
|
|
37438
37442
|
if (/Entity$|Entity\./.test(dep)) {
|
|
@@ -37452,9 +37456,14 @@ function extractDeps(content) {
|
|
|
37452
37456
|
/**
|
|
37453
37457
|
* 提取页面文件的签名,移除函数体
|
|
37454
37458
|
* @param content 页面文件内容
|
|
37455
|
-
* @
|
|
37459
|
+
* @param hasSubViews 是否有子页面
|
|
37460
|
+
* @returns 只包含签名的内容,或者返回 ElRouterView 的实现
|
|
37456
37461
|
*/
|
|
37457
|
-
function replaceViewAsSignature(content) {
|
|
37462
|
+
function replaceViewAsSignature(content, hasSubViews = false) {
|
|
37463
|
+
if (hasSubViews) {
|
|
37464
|
+
// 如果有子页面,替换为返回 ElRouterView 的函数
|
|
37465
|
+
return content.replace(/export function ((\w+)\([^)]*\)) \{[\s\S]+$/, 'export function $1 {\n return <ElRouterView />\n}');
|
|
37466
|
+
}
|
|
37458
37467
|
return content.replace(/export function ((\w+)\([^)]*\)) \{[\s\S]+$/, 'export declare function $1;');
|
|
37459
37468
|
}
|
|
37460
37469
|
/**
|
|
@@ -37483,7 +37492,15 @@ function processFileDeps(pathRelativeToSrc, srcDir, matchedFileSet, processedFil
|
|
|
37483
37492
|
const pathWithoutExt = pathRelativeToSrc.slice(0, -4);
|
|
37484
37493
|
const isEntryParent = Array.from(matchedFileSet).some((filePath) => filePath.startsWith(pathWithoutExt));
|
|
37485
37494
|
if (!isEntryParent) {
|
|
37486
|
-
|
|
37495
|
+
// 检查是否有子页面(路径更长的页面文件)
|
|
37496
|
+
const subViewPattern = `${pathWithoutExt}.views.*.tsx`;
|
|
37497
|
+
const subViews = globby.sync([subViewPattern], {
|
|
37498
|
+
cwd: srcDir,
|
|
37499
|
+
onlyFiles: true,
|
|
37500
|
+
absolute: false,
|
|
37501
|
+
});
|
|
37502
|
+
const hasSubViews = subViews.length > 0;
|
|
37503
|
+
fileInfo.content = replaceViewAsSignature(fileInfo.content, hasSubViews);
|
|
37487
37504
|
}
|
|
37488
37505
|
}
|
|
37489
37506
|
processedFileMap.set(pathRelativeToSrc, fileInfo);
|
|
@@ -37680,7 +37697,7 @@ async function tryCompile(entry, options) {
|
|
|
37680
37697
|
}
|
|
37681
37698
|
}
|
|
37682
37699
|
|
|
37683
|
-
var version = "0.1.
|
|
37700
|
+
var version = "0.1.14";
|
|
37684
37701
|
var pkg = {
|
|
37685
37702
|
version: version};
|
|
37686
37703
|
|