@nasl/cli 0.1.11 → 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 +20 -4
- package/dist/bin/nasl.mjs.map +1 -1
- package/dist/bin/naslc.mjs +20 -4
- package/dist/bin/naslc.mjs.map +1 -1
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/out/services/resolve.d.ts.map +1 -1
- package/out/services/resolve.js +19 -3
- package/out/services/resolve.js.map +1 -1
- package/out/utils/logger.js +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -13405,7 +13405,7 @@ function fastAppendLogToFile(suffix, content) {
|
|
|
13405
13405
|
if (process.env.NASL_CLI_LOG_DIR) {
|
|
13406
13406
|
const logDir = sysPath.resolve(process.env.NASL_CLI_LOG_DIR);
|
|
13407
13407
|
libExports.ensureDirSync(logDir);
|
|
13408
|
-
const filePath = sysPath.resolve(logDir,
|
|
13408
|
+
const filePath = sysPath.resolve(logDir, `__-${suffix}`);
|
|
13409
13409
|
libExports.outputFileSync(filePath, content, { flag: 'a' });
|
|
13410
13410
|
}
|
|
13411
13411
|
}
|
|
@@ -13681,6 +13681,9 @@ function extractDeps(content) {
|
|
|
13681
13681
|
else if (/\.enums\.(\w+)\.(\w+)/.test(dep)) {
|
|
13682
13682
|
dep = dep.replace(/\.enums\.(\w+).+$/, '.enums.$1');
|
|
13683
13683
|
}
|
|
13684
|
+
else if (/app\.dataSources\.\w+\.entities\.\w+\.\w+$/.test(dep)) {
|
|
13685
|
+
continue; // 应该是写法有问题,跳过让后面的 checker 做检查
|
|
13686
|
+
}
|
|
13684
13687
|
dep = `${dep}.${dep.includes('.views.') ? 'tsx' : 'ts'}`;
|
|
13685
13688
|
deps.add(dep);
|
|
13686
13689
|
}
|
|
@@ -13689,9 +13692,14 @@ function extractDeps(content) {
|
|
|
13689
13692
|
/**
|
|
13690
13693
|
* 提取页面文件的签名,移除函数体
|
|
13691
13694
|
* @param content 页面文件内容
|
|
13692
|
-
* @
|
|
13695
|
+
* @param hasSubViews 是否有子页面
|
|
13696
|
+
* @returns 只包含签名的内容,或者返回 ElRouterView 的实现
|
|
13693
13697
|
*/
|
|
13694
|
-
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
|
+
}
|
|
13695
13703
|
return content.replace(/export function ((\w+)\([^)]*\)) \{[\s\S]+$/, 'export declare function $1;');
|
|
13696
13704
|
}
|
|
13697
13705
|
/**
|
|
@@ -13720,7 +13728,15 @@ function processFileDeps(pathRelativeToSrc, srcDir, matchedFileSet, processedFil
|
|
|
13720
13728
|
const pathWithoutExt = pathRelativeToSrc.slice(0, -4);
|
|
13721
13729
|
const isEntryParent = Array.from(matchedFileSet).some((filePath) => filePath.startsWith(pathWithoutExt));
|
|
13722
13730
|
if (!isEntryParent) {
|
|
13723
|
-
|
|
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);
|
|
13724
13740
|
}
|
|
13725
13741
|
}
|
|
13726
13742
|
processedFileMap.set(pathRelativeToSrc, fileInfo);
|