dsh-notify-say 0.4.27 → 0.4.28
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-notify-say",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.28",
|
|
4
4
|
"description": "Desktop notifications for DSH Desktop that actually speak: Windows TTS out of the box (zero download), VOICEVOX voice packs optional, a selectable system-sound fallback, and an idle gate that waits for running subagents before saying the turn is done. Includes a settings-page GUI (sound source, per-event overrides, jump-back-to-session, cooldowns) and a self hot-reload for development.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,19 +28,23 @@ import { mkdtempSync, writeFileSync, mkdirSync, readFileSync, existsSync, statSy
|
|
|
28
28
|
import { tmpdir } from 'node:os';
|
|
29
29
|
import { join, resolve, dirname } from 'node:path';
|
|
30
30
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
31
|
-
// ⚠️ 不能静态 import registerHooks —— 它是 Node 22.15+ 才有的导出,
|
|
32
|
-
// Node 20 上会让整个测试文件加载失败(CI 首跑抓到)。
|
|
33
|
-
// 改为运行时按需取,取不到就跳过相关断言。
|
|
34
|
-
let _registerHooks;
|
|
35
|
-
async function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
// ⚠️ 不能静态 import registerHooks —— 它是 Node 22.15+ 才有的导出,
|
|
32
|
+
// Node 20 上会让整个测试文件加载失败(CI 首跑抓到)。
|
|
33
|
+
// 改为运行时按需取,取不到就跳过相关断言。
|
|
34
|
+
let _registerHooks;
|
|
35
|
+
async function hasRegisterHooks() {
|
|
36
|
+
return (await getRegisterHooks()) !== null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function getRegisterHooks() {
|
|
40
|
+
if (_registerHooks !== undefined) return _registerHooks;
|
|
41
|
+
try {
|
|
42
|
+
const mod = await import('node:module');
|
|
43
|
+
_registerHooks = typeof mod.registerHooks === 'function' ? mod.registerHooks : null;
|
|
44
|
+
} catch {
|
|
45
|
+
_registerHooks = null;
|
|
46
|
+
}
|
|
47
|
+
return _registerHooks;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
import { computeFingerprint } from '../lib/dev-reload.js';
|
|
@@ -91,7 +95,16 @@ test('R3: 代际 URL 得到新模块对象,但 fingerprint 相同(源码哈
|
|
|
91
95
|
assert.equal(b.fingerprint, c.fingerprint, '同理');
|
|
92
96
|
});
|
|
93
97
|
|
|
94
|
-
|
|
98
|
+
// ⚠️ 这条依赖 `registerHooks`(Node 22.15+)。
|
|
99
|
+
//
|
|
100
|
+
// Node 20 上代际穿透**本来就不会生效** —— 那是运行时能力缺失,
|
|
101
|
+
// 不是代码 bug。所以按能力 skip,而不是让它红。
|
|
102
|
+
//
|
|
103
|
+
// 注意:这里用 `{ skip: <bool|string> }` 而不是顶层 return,
|
|
104
|
+
// 这样在支持的版本上它会真的跑(不能因为"某些版本不支持"就永远不测)。
|
|
105
|
+
test('R4: enableFreshDependencies 让代际穿透到依赖(真实实现,非手写钩子)',
|
|
106
|
+
{ skip: !(await hasRegisterHooks()) && '需要 Node 22.15+ 的 module.registerHooks' },
|
|
107
|
+
async () => {
|
|
95
108
|
// ⚠️ 设计要点:必须调用**真实的** enableFreshDependencies,
|
|
96
109
|
// 而不是在测试里手写一份同构的 hook。
|
|
97
110
|
//
|