@lumiastream/wakeword 1.1.5-alpha.1 → 1.1.5-alpha.2

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.
@@ -5,10 +5,13 @@ import { existsSync } from "node:fs";
5
5
 
6
6
  const here = dirname(fileURLToPath(import.meta.url));
7
7
 
8
+ const ASAR_TOKEN = "app.asar";
9
+ const ASAR_UNPACKED_TOKEN = "app.asar.unpacked";
10
+
8
11
  function unpacked(p) {
9
- return p.includes("app.asar")
10
- ? p.replace("app.asar", "app.asar.unpacked")
11
- : p;
12
+ if (!p || !p.includes(ASAR_TOKEN)) return p;
13
+ if (p.includes(ASAR_UNPACKED_TOKEN)) return p;
14
+ return p.replace(ASAR_TOKEN, ASAR_UNPACKED_TOKEN);
12
15
  }
13
16
 
14
17
  const exeName = { win32: "sox.exe", darwin: "soxmac", linux: "soxlinux" }[
package/lib/voice.js CHANGED
@@ -8,8 +8,9 @@ import readline from "node:readline";
8
8
  // Ensure native libs can load from app.asar.unpacked when packaged
9
9
  const maybeUnpackedPath = (libPath) => {
10
10
  if (typeof libPath !== "string") return libPath;
11
- if (!libPath.includes("app.asar")) return libPath;
12
- const unpacked = libPath.replace("app.asar", "app.asar.unpacked");
11
+ if (!libPath.includes(ASAR_TOKEN)) return libPath;
12
+ if (libPath.includes(ASAR_UNPACKED_TOKEN)) return libPath;
13
+ const unpacked = libPath.replace(ASAR_TOKEN, ASAR_UNPACKED_TOKEN);
13
14
  return existsSync(unpacked) ? unpacked : libPath;
14
15
  };
15
16
  const ensureWinBinOnPath = (libPath) => {
@@ -37,10 +38,13 @@ const { Model, Recognizer, setLogLevel } = await import("vosk-koffi");
37
38
  /* ------------------------------------------------------------------ */
38
39
  const here = dirname(fileURLToPath(import.meta.url));
39
40
 
41
+ const ASAR_TOKEN = "app.asar";
42
+ const ASAR_UNPACKED_TOKEN = "app.asar.unpacked";
43
+
40
44
  function unpacked(p) {
41
- return p.includes("app.asar")
42
- ? p.replace("app.asar", "app.asar.unpacked")
43
- : p;
45
+ if (!p || !p.includes(ASAR_TOKEN)) return p;
46
+ if (p.includes(ASAR_UNPACKED_TOKEN)) return p;
47
+ return p.replace(ASAR_TOKEN, ASAR_UNPACKED_TOKEN);
44
48
  }
45
49
 
46
50
  const UNKNOWN_TOKEN = "[unk]";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumiastream/wakeword",
3
- "version": "1.1.5-alpha.1",
3
+ "version": "1.1.5-alpha.2",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "files": [