@iyowei/sweep-node-modules 0.5.0 → 0.5.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 +11 -11
- package/README.zh-CN.md +11 -11
- package/dist/codes.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/guard.d.ts +1 -1
- package/dist/index.js +5 -0
- package/dist/manifest.json +3 -3
- package/dist/runtime.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ The CLI package is a thin shell over the orchestration layer: parse → call →
|
|
|
100
100
|
|
|
101
101
|
### `createSweeper(options): Sweeper`
|
|
102
102
|
|
|
103
|
-
Creates the orchestrator: the whole chain behind one object.
|
|
103
|
+
Creates the orchestrator: the whole chain behind one object. A second instance costs next to nothing (factories do no scan- or delete-level IO).
|
|
104
104
|
|
|
105
105
|
- `options` `SweepOptions`:
|
|
106
106
|
- `roots` `string[]` (required, non-empty): scan roots, absolute paths.
|
|
@@ -139,8 +139,8 @@ The read-only pass: scan + measure + classify + device check + batch constructio
|
|
|
139
139
|
- `signal?` `AbortSignal`: cancellation signal, passed to each layer.
|
|
140
140
|
- Returns: `Promise<SweepPlan>`:
|
|
141
141
|
- `roots` / `exclude` / `include` / `policy`: the effective inputs, echoed for audit (the names have already been through `mergeNames`).
|
|
142
|
-
- `basis?` `SizeBasis`: the size basis of this run,
|
|
143
|
-
- `entries` `SweepEntry[]`: one entry per hit: `target` / `project` / `root` / `bytes?` / `basis?` / `kind` / `kindReason?` / `crossDevice?` / `unmeasuredCode?` / `unmeasuredReason?` / `inBatch`, plus `skipReason` and `skipNote` when out of the batch (the code and the human note travel on the entry, so a review table needs no join).
|
|
142
|
+
- `basis?` `SizeBasis`: the size basis of this run, present whenever the plan has any entries (it may differ from the per-entry bases when nothing was measured).
|
|
143
|
+
- `entries` `SweepEntry[]`: one entry per hit that still exists at measure time (a hit gone by then produces no entry; see `gone` in `SizeResult`): `target` / `project` / `root` / `bytes?` / `basis?` / `kind` / `kindReason?` / `crossDevice?` / `unmeasuredCode?` / `unmeasuredReason?` / `inBatch`, plus `skipReason` and `skipNote` when out of the batch (the code and the human note travel on the entry, so a review table needs no join).
|
|
144
144
|
- `batch` `string[]`: the targets that would be deleted, in list order.
|
|
145
145
|
- `skipped` `SkippedTarget[]`: every out-of-batch target with its `reason` and `note`.
|
|
146
146
|
- `warnings` `SweepWarning[]`: non-fatal scan / size warnings (`{ code, message, path?, errno? }`); `code` is a `SweepWarningCode`, the union of `ScanWarningCode` and `SizeWarningCode`.
|
|
@@ -160,7 +160,7 @@ Runs the read-only pass first (an old plan is never replayed: every fact is re-d
|
|
|
160
160
|
- Returns: `Promise<SweepReport>`:
|
|
161
161
|
- `status` `SweepRunStatus`: `'executed'` | `'rejected'` (whole batch) | `'nothing-to-do'` (empty batch).
|
|
162
162
|
- `plan` `SweepPlan`: the live plan this run actually used. If it differs from an earlier `plan()`, this one wins, and the delta is in `drift`.
|
|
163
|
-
- `validation?` `ValidationResult
|
|
163
|
+
- `validation?` `ValidationResult`: present once the run entered the guard (a whole-batch rejection has it, with zero deletions). `removal?` `RemovalResult`: the removal buckets (`removed` / `missing` / `failed` / `aborted`); absent when no removal was executed.
|
|
164
164
|
- `entries` `SweepOutcomeEntry[]`: one per plan entry, same order (the entry plus `outcome`).
|
|
165
165
|
- `stale` `string[]`: targets pulled out by `staleTargets: 'missing'`.
|
|
166
166
|
- `drift?` `SweepDrift`: `{ added, removed }`, present when `expectedBatch` was given.
|
|
@@ -270,7 +270,7 @@ const scan = await createScanner().scan({
|
|
|
270
270
|
- `basis` `SizeBasis`: `'disk-usage'` (the `du` fast path reports what the disk actually holds) or `'logical-bytes'` (the pure implementation reports logical bytes). One call, one basis; read it instead of guessing, before or after the call. Windows always measures `logical-bytes`.
|
|
271
271
|
- `warnings` `SweepWarning[]`: non-fatal size warnings (`code` is a `SizeWarningCode`).
|
|
272
272
|
- `unmeasured` `UnmeasuredEntry[]`: exists but cannot be measured (`{ target, code, reason }`, with `code` an `UnmeasuredCode`), ascending by `target`.
|
|
273
|
-
- `gone` `string[]`: no longer exists at measure time,
|
|
273
|
+
- `gone` `string[]`: no longer exists at measure time, ascending by `target` (all three buckets order this way).
|
|
274
274
|
|
|
275
275
|
Every input target lands in exactly one bucket, and there is no fourth case: `entries` (measured), `unmeasured` (exists but cannot be measured), `gone` (no longer exists at measure time). That identity is a contract, so no `'unknown'` fallback branch is needed.
|
|
276
276
|
|
|
@@ -561,7 +561,7 @@ In the `ok` case, `Config` carries `roots` (required) / `exclude` / `include`: a
|
|
|
561
561
|
#### `sanitizeOutputLine(text): string`
|
|
562
562
|
|
|
563
563
|
- `text` `string`
|
|
564
|
-
- Returns: `string`: `sanitizeLine` except that
|
|
564
|
+
- Returns: `string`: `sanitizeLine` except that the indentation at the very start of the input is kept (call it once per line to preserve per-line indentation, the tool's own hierarchy device); inner whitespace folds as usual.
|
|
565
565
|
|
|
566
566
|
`sanitizeLine` / `sanitizeOutputLine` are the single shared implementation of output sanitization. Run external data (paths, names) through these before it reaches any output surface; the CLI does, and no second implementation should exist.
|
|
567
567
|
|
|
@@ -586,7 +586,7 @@ One rule decides the channel: **failures that can be listed are returned; failur
|
|
|
586
586
|
### `isSweepError(value): value is SweepError`
|
|
587
587
|
|
|
588
588
|
- `value` `unknown`
|
|
589
|
-
- Returns: `value is SweepError`: a shape-based check (
|
|
589
|
+
- Returns: `value is SweepError`: a shape-based check (a `name` of `SweepError` plus a known `code`; the `Error` shape itself is not required), not a class check.
|
|
590
590
|
|
|
591
591
|
In packaged or multi-instance environments (where two copies of the library can coexist in one process), `instanceof SweepError` gives false negatives; use the shape-based guard there. Unexpected internal exceptions are not wrapped: they bubble unchanged.
|
|
592
592
|
|
|
@@ -633,8 +633,8 @@ Pass `onProgress` and / or `signal` to `plan` / `run`, or to any primitive that
|
|
|
633
633
|
Event kinds: `phase` (start / done per pipeline phase, `SweepPhase`: `scan` · `measure` · `classify` · `device` · `plan` · `validate` · `remove`), the primitive events (`hit` · `measured` · `unmeasured` · `skipped` · `removed` · `failed` · `aborted` · `warning`), and a terminal event: a `plan()` stream always ends with `plan-done` (carrying the full plan), a `run()` stream always ends with `done` (carrying the run status). Nothing follows a terminal event; on cancellation the stream ends with a throw instead.
|
|
634
634
|
|
|
635
635
|
- Callbacks run synchronously and are not awaited; a throwing callback bubbles and aborts the call (no swallowing).
|
|
636
|
-
- Events are high-frequency and not order-bound (concurrent completion order); results are order-bound (hits ascending
|
|
637
|
-
- Do not call the same `Sweeper` instance from inside a callback, and do not run two calls on one instance at once (reentrancy is undefined). Factories do no IO, so a second instance costs nothing.
|
|
636
|
+
- Events are high-frequency and not order-bound (concurrent completion order); results are order-bound (hits and the three size buckets ascending by `target`; removal buckets and `stale` keep input order).
|
|
637
|
+
- Do not call the same `Sweeper` instance from inside a callback, and do not run two calls on one instance at once (reentrancy is undefined). Factories do no scan- or delete-level IO (a size factory probes for `du` once), so a second instance costs next to nothing.
|
|
638
638
|
- Cancellation is checked between items and at phase boundaries; the call rejects with `SweepError('CANCELLED')`. Removal never interrupts a single `rm` midway (that would only manufacture a new half-deleted state): cancellation lands between targets, and the error carries `details.partial` with what was already done. Other phases carry `details.phase` and no partial results.
|
|
639
639
|
|
|
640
640
|
The library has no `watch()` async iterator: the CLI consumes callbacks directly, and that is the common case. The design doc carries a ~20-line bridge reference for editor-style hosts that want a `for await` loop.
|
|
@@ -652,9 +652,9 @@ The library has no `watch()` async iterator: the CLI consumes callbacks directly
|
|
|
652
652
|
|
|
653
653
|
## Data shapes and stability
|
|
654
654
|
|
|
655
|
-
- All domain data is plain objects and arrays: `JSON.stringify` is lossless (no classes, no `Map` / `Set`, no functions). The one class in the package is `SweepError`.
|
|
655
|
+
- All **persisted / audit** domain data is plain objects and arrays: `JSON.stringify` is lossless (no classes, no `Map` / `Set`, no functions). Query helpers (`SkipBook.hints`, `crossDeviceIndex()`) return `ReadonlyMap`; they are lookup surfaces, not audit data. The one class in the package is `SweepError`.
|
|
656
656
|
- Time-free by design: no timestamps on domain data (the only clock reading is `elapsedMs` on progress events). A shape written into today's JSONL audit reads back as tomorrow's decision input.
|
|
657
|
-
- Deterministic results: `hits` ascending by target
|
|
657
|
+
- Deterministic results: `hits` and the three size buckets ascending by target; removal buckets and `stale` keep input order; scan dedupes by real path. Event order is explicitly not promised.
|
|
658
658
|
- No side effects at import; no stdout / stderr writes; no TTY probing (the interactive wizard is a CLI-only surface).
|
|
659
659
|
|
|
660
660
|
| Tier | What | The promise |
|
package/README.zh-CN.md
CHANGED
|
@@ -100,7 +100,7 @@ CLI 包是编排层的薄壳: 解析 → 调用 → 渲染 → 确认。业务
|
|
|
100
100
|
|
|
101
101
|
### `createSweeper(options): Sweeper`
|
|
102
102
|
|
|
103
|
-
构造编排器:
|
|
103
|
+
构造编排器: 整条链收在一个对象之后。第二个实例不花什么成本 (工厂不做扫描 / 删除级 IO)。
|
|
104
104
|
|
|
105
105
|
- `options` `SweepOptions`:
|
|
106
106
|
- `roots` `string[]` (必填, 非空): 扫描根, 绝对路径。
|
|
@@ -139,8 +139,8 @@ const sweeper = createSweeper({
|
|
|
139
139
|
- `signal?` `AbortSignal`: 取消信号, 传给各层。
|
|
140
140
|
- Returns: `Promise<SweepPlan>`:
|
|
141
141
|
- `roots` / `exclude` / `include` / `policy`: 本次生效的输入, 回显供审计 (名单已过 `mergeNames`)。
|
|
142
|
-
- `basis?` `SizeBasis`: 本次运行的体积口径,
|
|
143
|
-
- `entries` `SweepEntry[]`:
|
|
142
|
+
- `basis?` `SizeBasis`: 本次运行的体积口径, 计划存在条目时即给出 (全未测到的一轮也会给出, 此时可能与逐条 `entry.basis` 不同值)。
|
|
143
|
+
- `entries` `SweepEntry[]`: 每个测量时仍在的命中一条 (已消失的命中不产生条目, 见 `SizeResult` 的 `gone`): `target` / `project` / `root` / `bytes?` / `basis?` / `kind` / `kindReason?` / `crossDevice?` / `unmeasuredCode?` / `unmeasuredReason?` / `inBatch`, 未进批者另带 `skipReason` 与 `skipNote` (码与话随条目携带, 复核表不必按 target 去 join)。
|
|
144
144
|
- `batch` `string[]`: 将进入删除的目标清单, 保清单顺序。
|
|
145
145
|
- `skipped` `SkippedTarget[]`: 全部批次外目标, 各带 `reason` 与 `note`。
|
|
146
146
|
- `warnings` `SweepWarning[]`: 扫描与体积的非致命告警 (`{ code, message, path?, errno? }`); `code` 为 `SweepWarningCode`, 即 `ScanWarningCode` 与 `SizeWarningCode` 的并集。
|
|
@@ -160,7 +160,7 @@ const plan = await sweeper.plan({ onProgress, signal });
|
|
|
160
160
|
- Returns: `Promise<SweepReport>`:
|
|
161
161
|
- `status` `SweepRunStatus`: `'executed'` | `'rejected'` (整批拒绝) | `'nothing-to-do'` (空批)。
|
|
162
162
|
- `plan` `SweepPlan`: 本次执行实际依据的实时计划; 与先前 `plan()` 不一致时以它为准, 差异另由 `drift` 给出。
|
|
163
|
-
- `validation?` `ValidationResult
|
|
163
|
+
- `validation?` `ValidationResult`: 进入安全闸后即给出 (整批拒绝也有, 伴随零删除)。`removal?` `RemovalResult`: 删除分桶 (`removed` / `missing` / `failed` / `aborted`); 未执行删除时缺省。
|
|
164
164
|
- `entries` `SweepOutcomeEntry[]`: 与 `plan.entries` 同序同长, 每条为条目加 `outcome`。
|
|
165
165
|
- `stale` `string[]`: 按 `staleTargets: 'missing'` 摘出的已消失目标。
|
|
166
166
|
- `drift?` `SweepDrift`: `{ added, removed }`, 提供了 `expectedBatch` 时给出。
|
|
@@ -270,7 +270,7 @@ const scan = await createScanner().scan({
|
|
|
270
270
|
- `basis` `SizeBasis`: `'disk-usage'` (`du` 快路径, 报磁盘占用) 或 `'logical-bytes'` (纯实现, 报逻辑字节); 一次调用恒一口径, 调用前后都可读, 不要猜它。win32 恒为 `logical-bytes`。
|
|
271
271
|
- `warnings` `SweepWarning[]`: 非致命体积告警 (`code` 为 `SizeWarningCode`)。
|
|
272
272
|
- `unmeasured` `UnmeasuredEntry[]`: 存在但测不到的目标 (`{ target, code, reason }`, `code` 为 `UnmeasuredCode`), 按 `target` 升序。
|
|
273
|
-
- `gone` `string[]`: 测量时已不存在,
|
|
273
|
+
- `gone` `string[]`: 测量时已不存在, 按 target 升序 (三桶同此口径)。
|
|
274
274
|
|
|
275
275
|
入参每个目标恒落在且仅落在一个桶, 无第四类: `entries` (测到了)、`unmeasured` (存在但测不到)、`gone` (测量时已不存在)。这条完备性恒等式是契约, 不必再造 `'unknown'` 兜底分支。
|
|
276
276
|
|
|
@@ -561,7 +561,7 @@ const outcome = await removeBatch(targets, { roots, staleTargets });
|
|
|
561
561
|
#### `sanitizeOutputLine(text): string`
|
|
562
562
|
|
|
563
563
|
- `text` `string`
|
|
564
|
-
- Returns: `string`: 即 `sanitizeLine`, 差别只有一处:
|
|
564
|
+
- Returns: `string`: 即 `sanitizeLine`, 差别只有一处: 保留入参整体开头的缩进 (逐行调用一次即得每行缩进; 工具自带的分级手段); 行内其余空白照常折叠。
|
|
565
565
|
|
|
566
566
|
`sanitizeLine` / `sanitizeOutputLine` 是全输出面共用的唯一实现。外部数据 (路径、名字) 进任何输出面前先过它们; CLI 就是这么做的, 也不要再写第二份。
|
|
567
567
|
|
|
@@ -586,7 +586,7 @@ const outcome = await removeBatch(targets, { roots, staleTargets });
|
|
|
586
586
|
### `isSweepError(value): value is SweepError`
|
|
587
587
|
|
|
588
588
|
- `value` `unknown`
|
|
589
|
-
- Returns: `value is SweepError`: 按形状判别 (
|
|
589
|
+
- Returns: `value is SweepError`: 按形状判别 (`name` 为 `SweepError` + 已知 `code`; 不要求 Error 形状本身), 不是类判别。
|
|
590
590
|
|
|
591
591
|
打包或多实例环境 (同一进程里可能并存两份库) 里, `instanceof SweepError` 会给出假阴; 跨实例场景一律用它。未预期的内部异常不作包装, 原样冒泡。
|
|
592
592
|
|
|
@@ -633,8 +633,8 @@ const outcome = await removeBatch(targets, { roots, staleTargets });
|
|
|
633
633
|
事件种类: `phase` (逐阶段 start / done, 阶段取 `SweepPhase` 全集: `scan` · `measure` · `classify` · `device` · `plan` · `validate` · `remove`), 原语事件 (`hit` · `measured` · `unmeasured` · `skipped` · `removed` · `failed` · `aborted` · `warning`), 以及终结事件: `plan()` 的流恒以 `plan-done` (携带完整计划) 收尾, `run()` 的流恒以 `done` (携带运行状态) 收尾。终结事件之后不再有任何事件; 取消时流以抛错收场, 终结事件不出现。
|
|
634
634
|
|
|
635
635
|
- 回调同步调用, 库不 await 其返回值; 回调抛错原样冒泡, 中断本次调用 (不吞错)。
|
|
636
|
-
- 事件高频且**不承诺顺序** (并发完成序); 结果承诺有序 (hits
|
|
637
|
-
- 不得在回调里再次调用同一个 `Sweeper` 实例, 也不要在一个实例上并发跑两次调用 (重入未定义);
|
|
636
|
+
- 事件高频且**不承诺顺序** (并发完成序); 结果承诺有序 (hits 与体积三桶按 target 升序; 删除分桶与 `stale` 保输入顺序)。
|
|
637
|
+
- 不得在回调里再次调用同一个 `Sweeper` 实例, 也不要在一个实例上并发跑两次调用 (重入未定义); 工厂不做扫描 / 删除级 IO (体积工厂只探测一次 `du`), 需要并发就建第二个实例。
|
|
638
638
|
- 取消检查落在条目之间与阶段边界; 取消以 `SweepError('CANCELLED')` 抛错。删除阶段绝不中断单条 `rm` 中途 (那只会新造半删状态): 取消落在条目之间, 错误里带 `details.partial` 给出已出桶的部分结果; 其余阶段只带 `details.phase`, 不返回部分结果。
|
|
639
639
|
|
|
640
640
|
库不提供 `watch()` 异步迭代入口: CLI 直接消费回调, 那是常态; 编辑器一类需要 `for await` 的宿主, 参考实现 (约 20 行) 写在设计文档里。
|
|
@@ -652,9 +652,9 @@ const outcome = await removeBatch(targets, { roots, staleTargets });
|
|
|
652
652
|
|
|
653
653
|
## 数据形态与稳定性
|
|
654
654
|
|
|
655
|
-
-
|
|
655
|
+
- **落盘 / 审计域**数据一律普通对象与数组: `JSON.stringify` 无损 (无类实例、无 `Map` / `Set`、无函数)。查询辅助 (`SkipBook.hints`、`crossDeviceIndex()`) 返回 `ReadonlyMap`, 属查询面、不属落盘域。包内唯一的类是 `SweepError`。
|
|
656
656
|
- 与时间无关: 域数据不带时间戳 (唯一的时钟读数是进度事件里的 `elapsedMs`)。今天写进 JSONL 审计的形状, 明天读回来仍是决策输入。
|
|
657
|
-
- 结果确定: `hits`
|
|
657
|
+
- 结果确定: `hits` 与体积三桶按 target 升序, 删除分桶与 `stale` 保输入顺序, 扫描按真实路径去重; 事件顺序明确不承诺。
|
|
658
658
|
- 导入零副作用; 零 stdout / stderr 写入; 不做 TTY 探测 (交互向导是 CLI 专属面)。
|
|
659
659
|
|
|
660
660
|
| 分级 | 内容 | 承诺 |
|
package/dist/codes.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 判别值与枚举的类型集: 错误码 / 告警码 / 跳过原因 / 体积口径 / 编排阶段。
|
|
3
3
|
*
|
|
4
4
|
* 契约基准: docs/designs/api-surface.md §3.2 与 §7.3。
|
|
5
|
-
* 命名规则: `<域>_<判定>`, 全大写蛇形; 域取自模块 (SCAN / SIZE / GUARD / REMOVE / CONFIG /
|
|
5
|
+
* 命名规则: `<域>_<判定>`, 全大写蛇形; 域取自模块 (SCAN / SIZE / GUARD / REMOVE / CONFIG / REVIEW; 另有无域项 INVALID_ARGUMENT 与 CANCELLED)。
|
|
6
6
|
* 硬纪律: **code 一经发布即冻结, 只增不改** (废弃走文档标注, 不回收取值);
|
|
7
7
|
* 且同一个 code 不得合并「处置方向相反」的语义 (调用方必须能不读 message 就决定下一步)。
|
|
8
8
|
*/
|
package/dist/config.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface Config {
|
|
|
16
16
|
* 语义与用户写的名单完全一致 (任意一级目录名命中即跳过), 只是默认值不再为空; 生效与覆盖规则:
|
|
17
17
|
* - 配置文件省略 `exclude` 字段时取本名单; 显式写出该字段 (含写空数组) 即以用户名单为准;
|
|
18
18
|
* - `init` 向导的排除一问以本名单为默认回填, 用户所见即所得;
|
|
19
|
-
* - 名单项在本次扫描零命中时不告警 (静默规则见 cli.ts 的 collectNameNotes): 名单依平台与用户
|
|
19
|
+
* - 名单项在本次扫描零命中时不告警 (静默规则见 CLI 包 cli.ts 的 collectNameNotes): 名单依平台与用户
|
|
20
20
|
* 环境而异, 逐项告警必然刷屏且无行动价值, 与用户手写名字拼错的情况不同。
|
|
21
21
|
*
|
|
22
22
|
* 保守取向: 宁可挡住个别同名的真实项目 (用户可从配置中删除该项), 也不漏放安装树。
|
package/dist/guard.d.ts
CHANGED
|
@@ -150,7 +150,7 @@ export declare function firstSymlinkOnRoot(root: string): Promise<string | null>
|
|
|
150
150
|
* options.roots = ['/work/zone'] (全链为真目录)
|
|
151
151
|
* 步骤 1 首项末段命中, 次项末段为 app 即拒; 首项 realpath 后仍在 zone 之下, 通过
|
|
152
152
|
* Output accepted = ['/work/zone/app/node_modules']
|
|
153
|
-
* rejected = [{ target: '/work/zone/app',
|
|
153
|
+
* rejected = [{ target: '/work/zone/app', message: '路径末段不是 node_modules' }]
|
|
154
154
|
*
|
|
155
155
|
* 分支对照 (根被换位): options.roots = ['/w'], 而 /w 已被换成指向 /evil 的符号链接 →
|
|
156
156
|
* anchors = [{ configured: '/w', real: '/evil', link: '/w' }];
|
package/dist/index.js
CHANGED
|
@@ -1131,6 +1131,11 @@ function createDuSizer(bin = findDu()) {
|
|
|
1131
1131
|
const failures = new Map;
|
|
1132
1132
|
let intact = true;
|
|
1133
1133
|
if (safeTargets.length > 0) {
|
|
1134
|
+
if (options?.signal?.aborted) {
|
|
1135
|
+
throw new SweepError("CANCELLED", "体积统计在批量统计前被取消", {
|
|
1136
|
+
phase: "measure"
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1134
1139
|
const { stdout, stderr } = await runDu(bin, safeTargets);
|
|
1135
1140
|
const assessment = assessDuOutput(stdout, safeTargets);
|
|
1136
1141
|
intact = assessment.intact;
|
package/dist/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"entry": "index.js",
|
|
4
|
-
"entrySha256": "
|
|
5
|
-
"commit": "
|
|
4
|
+
"entrySha256": "8b9a3b1299219ef256fcf271b99f20a9c7e1e0369cbbeed708f8004c053a1fc0",
|
|
5
|
+
"commit": "97a1b7e609a7c8fedd4741bea90525fd501b7678",
|
|
6
6
|
"dirty": false,
|
|
7
|
-
"builtAt": "2026-09-
|
|
7
|
+
"builtAt": "2026-09-30T07:08:54.449Z"
|
|
8
8
|
}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface SpawnResult {
|
|
|
16
16
|
* 命令不存在 (ENOENT) 时抛出含命令名的错误; 退出码非零原样返回, 不抛错。
|
|
17
17
|
* stderr 直通 (inherit) 而非捕获: 既避免管道缓冲填满导致子进程阻塞, 又让错误原样可见。
|
|
18
18
|
* 裸名与解析面: win32 上传入裸名会先搜当前工作目录 (CreateProcessW 与 libuv 的搜索序皆然,
|
|
19
|
-
* 见 bin/sweep-nm.mjs 文件头与行为契约 EC-08), 调用方须先自行解析为绝对路径再传入;
|
|
19
|
+
* 见 CLI 包 `bin/sweep-nm.mjs` 文件头与行为契约 EC-08), 调用方须先自行解析为绝对路径再传入;
|
|
20
20
|
* POSIX 侧 execvp 只搜 PATH, 裸名照常安全。
|
|
21
21
|
*/
|
|
22
22
|
export declare function spawnCapture(cmd: string, args: string[]): Promise<SpawnResult>;
|
package/dist/types.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export interface SizeResult {
|
|
|
91
91
|
/** 存在但无法测量的目标 (如权限不足), 按 target 升序 */
|
|
92
92
|
unmeasured: UnmeasuredEntry[];
|
|
93
93
|
/**
|
|
94
|
-
* 扫描命中、测量时已不存在 (BC-13) 的目标,
|
|
94
|
+
* 扫描命中、测量时已不存在 (BC-13) 的目标, 按 target 升序 (体积三桶同此口径)。
|
|
95
95
|
* 「不存在」既不产生字节也不属「存在但测不到」, 故单列一桶, 与 warnings 里的
|
|
96
96
|
* SIZE_TARGET_VANISHED 事件同源同判定 (事件供诊断, 本桶供划分)。
|
|
97
97
|
* 划分完备性: entries ∪ unmeasured ∪ gone 恰好构成入参的全划分, 三者两两不相交。
|
|
@@ -293,7 +293,7 @@ export interface SweepPlan {
|
|
|
293
293
|
include: string[];
|
|
294
294
|
/** 本计划所用的安全策略 */
|
|
295
295
|
policy: SweepPolicy;
|
|
296
|
-
/** 本次体积口径 (
|
|
296
|
+
/** 本次体积口径 (存在条目时给出; 全未测到时可与逐条 entry.basis 不同值; 无条目时缺省) */
|
|
297
297
|
basis?: SizeBasis;
|
|
298
298
|
/** 逐目标领域条目: 保扫描的 target 升序; 测量时已不存在的目标 (BC-13) 不产生条目 */
|
|
299
299
|
entries: SweepEntry[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyowei/sweep-node-modules",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Programmable API to sweep node_modules across workspace roots: scan, measure, and safely remove them from your own scripts and tools. 工作区级 node_modules 清理能力的可编程 API。",
|
|
5
5
|
"author": "iTonyYo (https://github.com/iTonyYo)",
|
|
6
6
|
"license": "MIT",
|