@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/build/index.js CHANGED
@@ -8,6 +8,9 @@ import '@/index.css';
8
8
 
9
9
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
10
10
 
11
+ window.LcapMicro = window.LcapMicro || {};
12
+ window.LcapMicro.routePrefix = __webpack_public_path__;
13
+
11
14
  // 应用初始化
12
15
  class AppHandler {
13
16
  constructor() {}
package/dist/bin/nasl.mjs CHANGED
@@ -8198,7 +8198,7 @@ function fastLogToFile(entry, suffix, content) {
8198
8198
  const hourInDir = parseInt(timeInDir.slice(0, 2), 10);
8199
8199
  // 跨天则累加 24 小时
8200
8200
  const hourStr = (now.hour() >= hourInDir ? now.hour() : Math.ceil(hourInDir / 24) * 24 + now.hour()).toString().padStart(2, '0');
8201
- const entryName = sysPath.basename(Array.isArray(entry) ? entry[0] || '*' : entry).replace(/[\[\]\(\)\{\}\*\+\-\?\|\^\$\,\/\#\:\\\s]+/g, '_');
8201
+ const entryName = sysPath.basename(Array.isArray(entry) ? entry[0] || '*' : entry).replace(/[\[\]\(\)\{\}\+\-\*\?\|\^\$\#\:\,\\\/\s]+/g, '_');
8202
8202
  const filePath = sysPath.resolve(logDir, `${hourStr}${now.format('mmss_SSS')}-${entryName}-${suffix}`);
8203
8203
  libExports.outputFileSync(filePath, content);
8204
8204
  }
@@ -8284,7 +8284,14 @@ class ConsoleLogger extends BaseLogger {
8284
8284
  }
8285
8285
  }
8286
8286
  exit(code) {
8287
- process.exit(code);
8287
+ if (process.argv[1]?.endsWith('/nasl')) { // 添加保险措施,避免在非 CLI 环境下退出
8288
+ process.exit(code);
8289
+ }
8290
+ else {
8291
+ if (code)
8292
+ throw new Error(`Error with code: ${code}`);
8293
+ return undefined;
8294
+ }
8288
8295
  }
8289
8296
  }
8290
8297
  class ConsoleLoggerWithoutExit extends ConsoleLogger {
@@ -37998,6 +38005,8 @@ async function startWebpackDevServer(outDir, options, logger) {
37998
38005
  webpackArgs += ' --no-open';
37999
38006
  if (options?.hot === false)
38000
38007
  webpackArgs += ' --no-hot';
38008
+ if (options?.publicPath)
38009
+ webpackArgs += ` --output-public-path "${options.publicPath}"`;
38001
38010
  logger?.info(webpackArgs);
38002
38011
  // 使用 spawn 而不是 spawnSync,以便进程可以常驻
38003
38012
  const webpackProcess = spawn(webpackArgs, {
@@ -38036,7 +38045,7 @@ async function build(entry, options) {
38036
38045
  await justExecCommandSync(webpackArgs, outDir);
38037
38046
  }
38038
38047
 
38039
- var version = "0.1.10";
38048
+ var version = "0.1.11";
38040
38049
  var pkg = {
38041
38050
  version: version};
38042
38051
 
@@ -38094,6 +38103,7 @@ program
38094
38103
  .description('启动开发服务')
38095
38104
  .option('-p, --port <port>', '指定开发服务器端口号')
38096
38105
  .option('-h, --host <host>', '指定开发服务器主机名')
38106
+ .option('--public-path <public-path>', '指定公共路径')
38097
38107
  .option('--no-open', '不在浏览器中自动打开')
38098
38108
  .option('--no-hot', '禁用热模块替换 (HMR)')
38099
38109
  .action(async (entry, options) => {