mock-service-cli 4.9.0 → 4.9.1

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
@@ -93,8 +93,10 @@ npx mock-service-cli [options] [path]
93
93
  | `-R` 或 `--static-server` | 启用单目录静态服务器,指定静态资源目录 | - |
94
94
  | `--spa-fallback <path>` | 单目录模式显式启用 SPA 回退 | - |
95
95
  | `--static-config <file>` | 使用自包含 JSON 配置启动静态服务器 | - |
96
- | `-w` 或 `--open` | 自动打开可用的 Web 页面或 API 概览页 | false |
97
- | `--watch-depth <n>` | 限制静态服务器文件监听递归深度(非负整数) | 无限 |
96
+ | `-w` 或 `--open` | 自动打开可用的 Web 页面或 API 概览页 | false |
97
+ | `--watch-depth <n>` | 限制静态服务器文件监听递归深度(非负整数) | 无限 |
98
+ | `--watch-interval <n>` | 设置静态服务器轮询间隔(毫秒;仅 Windows Node 24+ 轮询模式生效) | 250 |
99
+ | `--no-watch` | 关闭静态服务器的文件监听与 live-reload(纯静态托管大目录) | false |
98
100
  | `-e` 或 `--explorer` | 启用文件浏览器服务器,指定要浏览的目录 | ./ |
99
101
  | `--edit` | 启用文件浏览器的新建、重命名、删除和上传操作 | false |
100
102
  | `--auth <password>` | 为文件浏览器启用密码认证(仅可搭配 `--explorer`) | - |
@@ -135,7 +137,7 @@ mock-service-cli --static-config ./static-server.json
135
137
  静态服务器会监听资源变化并向 HTML 页面注入热更新客户端:CSS 文件更新时替换样式表,其余变更刷新页面。
136
138
  默认不打开浏览器;使用 `-w/--open` 可自动打开静态服务器页面。也可在配置中设置 `"open": true` 或提供页面路径。完整配置字段和示例见
137
139
  [`docs/static-server.config.example.json`](./docs/static-server.config.example.json):支持忽略规则、SPA 回退、挂载目录、代理、HTTPS、CORS、响应头和自定义浏览器命令。
138
- `watch.depth` 可限制 chokidar 递归监听层数;未设置时为无限深度,大目录建议显式设置有限值。命令行 `--watch-depth <n>` 优先于配置文件。
140
+ `watch.enabled` 默认 `true`,设为 `false` 可完全关闭文件监听与 live-reload(纯静态托管大目录时不注入热更新脚本、不启动 watcher)。`watch.depth` 可限制 chokidar 递归监听层数;未设置时为无限深度,大目录建议显式设置有限值。Windows Node 24+ 使用轮询监听,`watch.interval`(默认 250ms)可放宽轮询周期以降低大目录开销。命令行 `--watch-depth <n>`、`--watch-interval <n>`、`--no-watch` 优先于配置文件。
139
141
  配置文件只在顶层保留服务器级字段。所有应用都放在 `mounts` 中,并可独立设置 `directory`、`spaFallback`、`proxy`、`cors`、`headers`、`requestHeaders` 和 `secure`。mount 未设置 `path` 时默认挂载到 `/`;`directory` 可省略,但该应用必须配置至少一条代理。代理键使用完整公开路径,例如 `/api/app`。
140
142
  `headers` 是发送给客户端的响应头。`requestHeaders` 是发送给该应用全部代理上游的请求头;也可放在单个 `proxy` 规则中,覆盖或追加 mount 级请求头。代理规则使用 `{ "target": "http://...", "rewrite": true }`;`rewrite` 为 true 时只移除匹配的完整代理前缀并保留剩余路径和 query string。应用级 `secure` 控制其代理 HTTPS 目标的证书校验,默认 `false`。配置模式不接受 `--proxy-options`、`--rewrite` 或 `--spa-fallback`。
141
143
  未设置 `spaFallback` 时,应用目录会显示可点击的目录索引;可直接访问其中的 HTML 文件。mount 未命中的路由不会继续进入其他应用的 SPA fallback。
@@ -232,7 +232,7 @@
232
232
  .modal-content {
233
233
  background: white;
234
234
  border-radius: 12px;
235
- max-width: 800px;
235
+ max-width: 85vw;
236
236
  width: 100%;
237
237
  max-height: 90vh;
238
238
  overflow-y: auto;
@@ -497,7 +497,7 @@
497
497
  let hasResults = false;
498
498
 
499
499
  Object.entries(apiData.groupedApis).forEach(([dir, apis]) => {
500
- const filteredApis = apis.filter(api =>
500
+ const filteredApis = apis.filter(api =>
501
501
  api.url.toLowerCase().includes(searchLower) ||
502
502
  api.method.toLowerCase().includes(searchLower)
503
503
  );
package/dist/meta.json CHANGED
@@ -1041,7 +1041,7 @@
1041
1041
  "format": "cjs"
1042
1042
  },
1043
1043
  "src/lib/utils.js": {
1044
- "bytes": 15764,
1044
+ "bytes": 20378,
1045
1045
  "imports": [
1046
1046
  {
1047
1047
  "path": "fs",
@@ -1093,7 +1093,7 @@
1093
1093
  "format": "cjs"
1094
1094
  },
1095
1095
  "src/bin/mock-service-cli": {
1096
- "bytes": 14310,
1096
+ "bytes": 14961,
1097
1097
  "imports": [
1098
1098
  {
1099
1099
  "path": "node_modules/colors/safe.js",
@@ -7425,7 +7425,7 @@
7425
7425
  "format": "cjs"
7426
7426
  },
7427
7427
  "src/lib/staticServer.js": {
7428
- "bytes": 35926,
7428
+ "bytes": 38819,
7429
7429
  "imports": [
7430
7430
  {
7431
7431
  "path": "node_modules/express/index.js",
@@ -8499,7 +8499,7 @@
8499
8499
  "format": "cjs"
8500
8500
  },
8501
8501
  "src/lib/fileExplorerServer.js": {
8502
- "bytes": 25942,
8502
+ "bytes": 26173,
8503
8503
  "imports": [
8504
8504
  {
8505
8505
  "path": "node_modules/express/index.js",
@@ -10076,13 +10076,13 @@
10076
10076
  "bytesInOutput": 4540
10077
10077
  },
10078
10078
  "src/lib/utils.js": {
10079
- "bytesInOutput": 8483
10079
+ "bytesInOutput": 11114
10080
10080
  },
10081
10081
  "src/lib/packageInfo.js": {
10082
10082
  "bytesInOutput": 429
10083
10083
  },
10084
10084
  "src/bin/mock-service-cli": {
10085
- "bytesInOutput": 11080
10085
+ "bytesInOutput": 11642
10086
10086
  },
10087
10087
  "node_modules/depd/index.js": {
10088
10088
  "bytesInOutput": 6779
@@ -11198,7 +11198,7 @@
11198
11198
  "bytesInOutput": 11845
11199
11199
  },
11200
11200
  "src/lib/staticServer.js": {
11201
- "bytesInOutput": 28120
11201
+ "bytesInOutput": 29740
11202
11202
  },
11203
11203
  "node_modules/busboy/lib/utils.js": {
11204
11204
  "bytesInOutput": 8707
@@ -11375,13 +11375,13 @@
11375
11375
  "bytesInOutput": 7774
11376
11376
  },
11377
11377
  "src/lib/fileExplorerServer.js": {
11378
- "bytesInOutput": 19196
11378
+ "bytesInOutput": 19290
11379
11379
  },
11380
11380
  "src/runtime.js": {
11381
11381
  "bytesInOutput": 507
11382
11382
  }
11383
11383
  },
11384
- "bytes": 1828488
11384
+ "bytes": 1833395
11385
11385
  }
11386
11386
  }
11387
11387
  }