aura-basetools 0.20.0 → 0.21.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 +3 -3
- package/bin/aura-mcp.mjs +49 -14
- package/bin/aura.mjs +28 -4
- package/lib/encoding-memory.mjs +87 -0
- package/lib/encoding.mjs +410 -0
- package/lib/fs-provider.mjs +60 -6
- package/lib/ops.mjs +50 -14
- package/locator-lab/doc-structure.mjs +382 -0
- package/locator-lab/read-core.mjs +136 -12
- package/locator-lab/write-path.mjs +22 -3
- package/package.json +1 -1
- package/test/doctor-test.mjs +6 -0
- package/test/write-test.mjs +7 -2
package/test/write-test.mjs
CHANGED
|
@@ -169,10 +169,15 @@ say('B 覆写:整份替换,BOM / 既有行尾 / 尾换行精确')
|
|
|
169
169
|
const atMissing = json(run(['basetools', 'write', '--file', 'at-missing-out.txt', '--content', '@missing-content.txt']))
|
|
170
170
|
check(atMissing.ok === false && atMissing.code === 'USAGE' && !fs.existsSync(file('at-missing-out.txt')), 'B28 --content @不存在 ⇒ JSON 回执(不是 Node 栈)', JSON.stringify(atMissing).slice(0, 160))
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* 0.21 起非 UTF-8 **可写**:`caf\xe9` 被探测成 windows-1252,写回沿用同一编码。
|
|
174
|
+
* 旧断言(拒绝)对应的是“只支持 UTF-8”的年代;拒绝现在只在“不可逆/猜不准/表示不了”时发生,
|
|
175
|
+
* 那三条分别在 `encoding-test` 的 E 段与 `encoding-refusal-test` 里。
|
|
176
|
+
*/
|
|
172
177
|
fs.writeFileSync(file('latin1.txt'), Buffer.from([0x63, 0x61, 0x66, 0xe9, 0x0a]))
|
|
173
178
|
const nonUtf8 = json(run(['basetools', 'write', '--file', 'latin1.txt', '--content', 'x\n', '--allow-unobserved']))
|
|
174
|
-
check(nonUtf8.ok ===
|
|
175
|
-
check(fs.readFileSync(file('latin1.txt')).equals(Buffer.from([
|
|
179
|
+
check(nonUtf8.ok === true, 'B29 非 UTF-8(windows-1252)覆写成功(不再拒绝)', JSON.stringify(nonUtf8).slice(0, 160))
|
|
180
|
+
check(fs.readFileSync(file('latin1.txt')).equals(Buffer.from([0x78, 0x0a])), 'B30 非 UTF-8 覆写:用同一编码写回(ASCII 子集)')
|
|
176
181
|
|
|
177
182
|
fs.writeFileSync(file('stale-force.txt'), 'v1\n')
|
|
178
183
|
prime('stale-force.txt')
|