dsh-pocket 1.0.6 → 1.0.7
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/lib/push.mjs +4 -1
- package/package.json +1 -1
package/lib/push.mjs
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
14
14
|
import { homedir } from 'node:os';
|
|
15
15
|
import { join, dirname } from 'node:path';
|
|
16
|
+
import { createRequire } from 'node:module';
|
|
17
|
+
|
|
18
|
+
const require = createRequire(import.meta.url);
|
|
16
19
|
|
|
17
20
|
const DATA_REL = join('dsh-pocket', 'push');
|
|
18
21
|
const VAPID_FILE = 'vapid.json';
|
|
@@ -20,7 +23,7 @@ const SUBS_FILE = 'subscriptions.json';
|
|
|
20
23
|
const SETTINGS_FILE = 'settings.json';
|
|
21
24
|
|
|
22
25
|
function defaultWebPush() {
|
|
23
|
-
//
|
|
26
|
+
// web-push 是 CJS,ESM 里必须经 createRequire 加载
|
|
24
27
|
return require('web-push');
|
|
25
28
|
}
|
|
26
29
|
|
package/package.json
CHANGED