@nasl/cli 0.1.10 → 0.1.11

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
  }
@@ -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 {
@@ -34669,6 +34676,8 @@ async function startWebpackDevServer(outDir, options, logger) {
34669
34676
  webpackArgs += ' --no-open';
34670
34677
  if (options?.hot === false)
34671
34678
  webpackArgs += ' --no-hot';
34679
+ if (options?.publicPath)
34680
+ webpackArgs += ` --output-public-path "${options.publicPath}"`;
34672
34681
  logger?.info(webpackArgs);
34673
34682
  // 使用 spawn 而不是 spawnSync,以便进程可以常驻
34674
34683
  const webpackProcess = spawn(webpackArgs, {