mock-service-cli-ultra 4.9.2 → 4.10.0

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/README.md CHANGED
@@ -94,10 +94,10 @@ npx mock-service-cli [options] [path]
94
94
  | `--spa-fallback <path>` | 单目录模式显式启用 SPA 回退 | - |
95
95
  | `--static-config <file>` | 使用自包含 JSON 配置启动静态服务器 | - |
96
96
  | `-w` 或 `--open` | 自动打开可用的 Web 页面或 API 概览页 | false |
97
- | `--watch-depth <n>` | 限制静态服务器文件监听递归深度(非负整数) | 无限 |
98
- | `--watch-interval <n>` | 设置静态服务器轮询间隔(毫秒;仅 Windows Node 24+ 轮询模式生效) | 250 |
99
- | `--no-watch` | 关闭静态服务器的文件监听与 live-reload(纯静态托管大目录) | false |
100
- | `--no-os-hidden` | 跳过 Windows 系统隐藏属性判定(attrib/PowerShell) | false |
97
+ | `--watch-depth <n>` | 限制静态服务器文件监听递归深度(非负整数,需配合 `--watch`) | 无限 |
98
+ | `--watch-interval <n>` | 轮询间隔(毫秒;仅 Windows Node 24+,需配合 `--watch`) | 250 |
99
+ | `--watch` | 开启静态服务器的文件监听与 live-reload(默认关闭) | false |
100
+ | `--windows-hidden` | 读取 Windows 系统隐藏属性(attrib/PowerShell)判定隐藏项 | false |
101
101
  | `-e` 或 `--explorer` | 启用文件浏览器服务器,指定要浏览的目录 | ./ |
102
102
  | `--edit` | 启用文件浏览器的新建、重命名、删除和上传操作 | false |
103
103
  | `--auth <password>` | 为文件浏览器启用密码认证(仅可搭配 `--explorer`) | - |
@@ -135,10 +135,10 @@ mock-service-cli -R --static-config ./static-server.json
135
135
  mock-service-cli --static-config ./static-server.json
136
136
  ```
137
137
 
138
- 静态服务器会监听资源变化并向 HTML 页面注入热更新客户端:CSS 文件更新时替换样式表,其余变更刷新页面。
138
+ 静态服务器默认**不监听**资源变化;传入 `--watch` 才监听并注入热更新客户端:CSS 文件更新时替换样式表,其余变更刷新页面。
139
139
  默认不打开浏览器;使用 `-w/--open` 可自动打开静态服务器页面。也可在配置中设置 `"open": true` 或提供页面路径。完整配置字段和示例见
140
140
  [`docs/static-server.config.example.json`](./docs/static-server.config.example.json):支持忽略规则、SPA 回退、挂载目录、代理、HTTPS、CORS、响应头和自定义浏览器命令。
141
- `watch.enabled` 默认 `true`,设为 `false` 可完全关闭文件监听与 live-reload(纯静态托管大目录时不注入热更新脚本、不启动 watcher)。`watch.depth` 可限制 chokidar 递归监听层数;未设置时为无限深度,大目录建议显式设置有限值。Windows Node 24+ 使用轮询监听,`watch.interval`(默认 250ms)可放宽轮询周期以降低大目录开销。命令行 `--watch-depth <n>`、`--watch-interval <n>`、`--no-watch` 优先于配置文件。
141
+ `watch.enabled` 默认 `false`,设为 `true` 或传入 `--watch` 可启用;`watch.depth` 限制 chokidar 递归层数(默认无限,大目录建议设有限值),`watch.interval` 为 Windows Node 24+ 轮询周期(默认 250ms)。命令行 `--watch`、`--watch-depth <n>`、`--watch-interval <n>` 优先于配置文件。
142
142
  配置文件只在顶层保留服务器级字段。所有应用都放在 `mounts` 中,并可独立设置 `directory`、`spaFallback`、`proxy`、`cors`、`headers`、`requestHeaders` 和 `secure`。mount 未设置 `path` 时默认挂载到 `/`;`directory` 可省略,但该应用必须配置至少一条代理。代理键使用完整公开路径,例如 `/api/app`。
143
143
  `headers` 是发送给客户端的响应头。`requestHeaders` 是发送给该应用全部代理上游的请求头;也可放在单个 `proxy` 规则中,覆盖或追加 mount 级请求头。代理规则使用 `{ "target": "http://...", "rewrite": true }`;`rewrite` 为 true 时只移除匹配的完整代理前缀并保留剩余路径和 query string。应用级 `secure` 控制其代理 HTTPS 目标的证书校验,默认 `false`。配置模式不接受 `--proxy-options`、`--rewrite` 或 `--spa-fallback`。
144
144
  未设置 `spaFallback` 时,应用目录会显示可点击的目录索引;可直接访问其中的 HTML 文件。mount 未命中的路由不会继续进入其他应用的 SPA fallback。
@@ -192,9 +192,7 @@ mock-service-cli -e ./ --host
192
192
  mock-service-cli -e ./ --host ./allowed-ips.txt
193
193
  ```
194
194
 
195
- 静态服务器目录索引与文件浏览器默认把点号命名文件、以及(Windows 上)带系统隐藏属性的文件视为隐藏项。
196
- 传入 `--no-os-hidden` 可跳过系统隐藏属性判定、仅按点号命名判定(利于规避个别属性误判与探测开销),
197
- 对静态服务器目录索引与文件浏览器同时生效。
195
+ 静态服务器目录索引与文件浏览器默认只按点号命名判定隐藏项;传入 `--windows-hidden` 才会额外读取 Windows 系统隐藏属性。
198
196
 
199
197
  默认情况下,Mock、SPA、Static 和 File Explorer 服务只监听 `127.0.0.1`。
200
198
  `--host` 会使这些服务监听所有 IPv4 网卡,请仅在可信网络中使用。传入白名单文件时,服务仍监听全部 IPv4 网卡,
package/dist/meta.json CHANGED
@@ -1041,7 +1041,7 @@
1041
1041
  "format": "cjs"
1042
1042
  },
1043
1043
  "src/lib/utils.js": {
1044
- "bytes": 22595,
1044
+ "bytes": 22646,
1045
1045
  "imports": [
1046
1046
  {
1047
1047
  "path": "fs",
@@ -1092,8 +1092,13 @@
1092
1092
  ],
1093
1093
  "format": "cjs"
1094
1094
  },
1095
+ "src/lib/processShutdown.js": {
1096
+ "bytes": 1358,
1097
+ "imports": [],
1098
+ "format": "cjs"
1099
+ },
1095
1100
  "src/bin/mock-service-cli": {
1096
- "bytes": 15146,
1101
+ "bytes": 16589,
1097
1102
  "imports": [
1098
1103
  {
1099
1104
  "path": "node_modules/colors/safe.js",
@@ -1130,6 +1135,11 @@
1130
1135
  "kind": "require-call",
1131
1136
  "original": "../lib/packageInfo"
1132
1137
  },
1138
+ {
1139
+ "path": "src/lib/processShutdown.js",
1140
+ "kind": "require-call",
1141
+ "original": "../lib/processShutdown"
1142
+ },
1133
1143
  {
1134
1144
  "path": "child_process",
1135
1145
  "kind": "require-call",
@@ -7425,7 +7435,7 @@
7425
7435
  "format": "cjs"
7426
7436
  },
7427
7437
  "src/lib/staticServer.js": {
7428
- "bytes": 39069,
7438
+ "bytes": 39068,
7429
7439
  "imports": [
7430
7440
  {
7431
7441
  "path": "node_modules/express/index.js",
@@ -7483,14 +7493,14 @@
7483
7493
  "original": "portfinder"
7484
7494
  },
7485
7495
  {
7486
- "path": "src/lib/utils.js",
7496
+ "path": "src/lib/processShutdown.js",
7487
7497
  "kind": "require-call",
7488
- "original": "./utils"
7498
+ "original": "./processShutdown"
7489
7499
  },
7490
7500
  {
7491
- "path": "readline",
7501
+ "path": "src/lib/utils.js",
7492
7502
  "kind": "require-call",
7493
- "external": true
7503
+ "original": "./utils"
7494
7504
  }
7495
7505
  ],
7496
7506
  "format": "cjs"
@@ -8215,7 +8225,7 @@
8215
8225
  "format": "cjs"
8216
8226
  },
8217
8227
  "src/lib/fileExplorerServer.js": {
8218
- "bytes": 26437,
8228
+ "bytes": 26443,
8219
8229
  "imports": [
8220
8230
  {
8221
8231
  "path": "node_modules/express/index.js",
@@ -8283,12 +8293,12 @@
8283
8293
  "original": "./archiveService"
8284
8294
  },
8285
8295
  {
8286
- "path": "http",
8296
+ "path": "src/lib/processShutdown.js",
8287
8297
  "kind": "require-call",
8288
- "external": true
8298
+ "original": "./processShutdown"
8289
8299
  },
8290
8300
  {
8291
- "path": "readline",
8301
+ "path": "http",
8292
8302
  "kind": "require-call",
8293
8303
  "external": true
8294
8304
  }
@@ -9379,11 +9389,6 @@
9379
9389
  "kind": "require-call",
9380
9390
  "external": true
9381
9391
  },
9382
- {
9383
- "path": "readline",
9384
- "kind": "require-call",
9385
- "external": true
9386
- },
9387
9392
  {
9388
9393
  "path": "stream",
9389
9394
  "kind": "require-call",
@@ -9558,11 +9563,6 @@
9558
9563
  "path": "http",
9559
9564
  "kind": "require-call",
9560
9565
  "external": true
9561
- },
9562
- {
9563
- "path": "readline",
9564
- "kind": "require-call",
9565
- "external": true
9566
9566
  }
9567
9567
  ],
9568
9568
  "exports": [],
@@ -9742,8 +9742,11 @@
9742
9742
  "src/lib/packageInfo.js": {
9743
9743
  "bytesInOutput": 429
9744
9744
  },
9745
+ "src/lib/processShutdown.js": {
9746
+ "bytesInOutput": 928
9747
+ },
9745
9748
  "src/bin/mock-service-cli": {
9746
- "bytesInOutput": 11804
9749
+ "bytesInOutput": 12856
9747
9750
  },
9748
9751
  "node_modules/depd/index.js": {
9749
9752
  "bytesInOutput": 6779
@@ -10859,7 +10862,7 @@
10859
10862
  "bytesInOutput": 11845
10860
10863
  },
10861
10864
  "src/lib/staticServer.js": {
10862
- "bytesInOutput": 29860
10865
+ "bytesInOutput": 29934
10863
10866
  },
10864
10867
  "node_modules/busboy/lib/utils.js": {
10865
10868
  "bytesInOutput": 8707
@@ -10982,13 +10985,13 @@
10982
10985
  "bytesInOutput": 7774
10983
10986
  },
10984
10987
  "src/lib/fileExplorerServer.js": {
10985
- "bytesInOutput": 19410
10988
+ "bytesInOutput": 19484
10986
10989
  },
10987
10990
  "src/runtime.js": {
10988
10991
  "bytesInOutput": 507
10989
10992
  }
10990
10993
  },
10991
- "bytes": 1746997
10994
+ "bytes": 1749125
10992
10995
  }
10993
10996
  }
10994
10997
  }