@nasl/cli 0.1.10 → 0.1.12

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/index.mjs CHANGED
@@ -13396,7 +13396,7 @@ function fastLogToFile(entry, suffix, content) {
13396
13396
  const hourInDir = parseInt(timeInDir.slice(0, 2), 10);
13397
13397
  // 跨天则累加 24 小时
13398
13398
  const hourStr = (now.hour() >= hourInDir ? now.hour() : Math.ceil(hourInDir / 24) * 24 + now.hour()).toString().padStart(2, '0');
13399
- const entryName = sysPath.basename(Array.isArray(entry) ? entry[0] || '*' : entry).replace(/[\[\]\(\)\{\}\*\+\-\?\|\^\$\,\/\#\:\\\s]+/g, '_');
13399
+ const entryName = sysPath.basename(Array.isArray(entry) ? entry[0] || '*' : entry).replace(/[\[\]\(\)\{\}\+\-\*\?\|\^\$\#\:\,\\\/\s]+/g, '_');
13400
13400
  const filePath = sysPath.resolve(logDir, `${hourStr}${now.format('mmss_SSS')}-${entryName}-${suffix}`);
13401
13401
  libExports.outputFileSync(filePath, content);
13402
13402
  }
@@ -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, `-_-${suffix}`);
13408
+ const filePath = sysPath.resolve(logDir, `__-${suffix}`);
13409
13409
  libExports.outputFileSync(filePath, content, { flag: 'a' });
13410
13410
  }
13411
13411
  }
@@ -13490,7 +13490,14 @@ class ConsoleLogger extends BaseLogger {
13490
13490
  }
13491
13491
  }
13492
13492
  exit(code) {
13493
- process.exit(code);
13493
+ if (process.argv[1]?.endsWith('/nasl')) { // 添加保险措施,避免在非 CLI 环境下退出
13494
+ process.exit(code);
13495
+ }
13496
+ else {
13497
+ if (code)
13498
+ throw new Error(`Error with code: ${code}`);
13499
+ return undefined;
13500
+ }
13494
13501
  }
13495
13502
  }
13496
13503
  class ConsoleLoggerWithoutExit extends ConsoleLogger {
@@ -13674,6 +13681,9 @@ function extractDeps(content) {
13674
13681
  else if (/\.enums\.(\w+)\.(\w+)/.test(dep)) {
13675
13682
  dep = dep.replace(/\.enums\.(\w+).+$/, '.enums.$1');
13676
13683
  }
13684
+ else if (/app\.dataSources\.\w+\.entities\.\w+\.\w+$/.test(dep)) {
13685
+ continue; // 应该是写法有问题,跳过让后面的 checker 做检查
13686
+ }
13677
13687
  dep = `${dep}.${dep.includes('.views.') ? 'tsx' : 'ts'}`;
13678
13688
  deps.add(dep);
13679
13689
  }
@@ -34669,6 +34679,8 @@ async function startWebpackDevServer(outDir, options, logger) {
34669
34679
  webpackArgs += ' --no-open';
34670
34680
  if (options?.hot === false)
34671
34681
  webpackArgs += ' --no-hot';
34682
+ if (options?.publicPath)
34683
+ webpackArgs += ` --output-public-path "${options.publicPath}"`;
34672
34684
  logger?.info(webpackArgs);
34673
34685
  // 使用 spawn 而不是 spawnSync,以便进程可以常驻
34674
34686
  const webpackProcess = spawn(webpackArgs, {