feat: add native module support for desktop autocomplete

This commit is contained in:
CREDO23 2026-04-02 13:18:20 +02:00
parent 2a809d0418
commit f4d197f702
5 changed files with 71 additions and 3 deletions

1
surfsense_desktop/.npmrc Normal file
View file

@ -0,0 +1 @@
node-linker=hoisted

View file

@ -9,6 +9,16 @@ directories:
files:
- dist/**/*
- "!node_modules"
- node_modules/uiohook-napi/**/*
- "!node_modules/uiohook-napi/build"
- "!node_modules/uiohook-napi/src"
- "!node_modules/uiohook-napi/libuiohook"
- "!node_modules/uiohook-napi/binding.gyp"
- node_modules/node-gyp-build/**/*
- node_modules/node-mac-permissions/**/*
- "!node_modules/node-mac-permissions/build"
- "!node_modules/node-mac-permissions/src"
- "!node_modules/node-mac-permissions/binding.gyp"
- "!src"
- "!scripts"
- "!release"
@ -29,6 +39,9 @@ extraResources:
filter: ["**/*"]
asarUnpack:
- "**/*.node"
- "node_modules/uiohook-napi/**/*"
- "node_modules/node-gyp-build/**/*"
- "node_modules/node-mac-permissions/**/*"
mac:
icon: assets/icon.icns
category: public.app-category.productivity

View file

@ -11,12 +11,14 @@
"dist:mac": "pnpm build && electron-builder --mac --config electron-builder.yml",
"dist:win": "pnpm build && electron-builder --win --config electron-builder.yml",
"dist:linux": "pnpm build && electron-builder --linux --config electron-builder.yml",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"postinstall": "electron-rebuild"
},
"author": "MODSetter",
"license": "MIT",
"packageManager": "pnpm@10.24.0",
"devDependencies": {
"@electron/rebuild": "^4.0.3",
"@types/node": "^25.5.0",
"concurrently": "^9.2.1",
"dotenv": "^17.3.1",
@ -28,6 +30,8 @@
},
"dependencies": {
"electron-updater": "^6.8.3",
"get-port-please": "^3.2.0"
"get-port-please": "^3.2.0",
"node-mac-permissions": "^2.5.0",
"uiohook-napi": "^1.5.5"
}
}

View file

@ -14,7 +14,16 @@ importers:
get-port-please:
specifier: ^3.2.0
version: 3.2.0
node-mac-permissions:
specifier: ^2.5.0
version: 2.5.0
uiohook-napi:
specifier: ^1.5.5
version: 1.5.5
devDependencies:
'@electron/rebuild':
specifier: ^4.0.3
version: 4.0.3
'@types/node':
specifier: ^25.5.0
version: 25.5.0
@ -343,6 +352,7 @@ packages:
'@xmldom/xmldom@0.8.11':
resolution: {integrity: sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw==}
engines: {node: '>=10.0.0'}
deprecated: this version has critical issues, please update to the latest version
abbrev@3.0.1:
resolution: {integrity: sha512-AO2ac6pjRB3SJmGJo+v5/aK6Omggp6fsLrs6wN9bd35ulu4cCwaAU9+7ZhXjeqHVkaHThLuzH0nZr0YpCDhygg==}
@ -424,6 +434,9 @@ packages:
base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
bindings@1.5.0:
resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==}
bl@4.1.0:
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
@ -738,6 +751,9 @@ packages:
picomatch:
optional: true
file-uri-to-path@1.0.0:
resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==}
filelist@1.0.6:
resolution: {integrity: sha512-5giy2PkLYY1cP39p17Ech+2xlpTRL9HLspOfEgm0L6CwBXBTgsK5ou0JtzYuepxkaQ/tvhCFIJ5uXo0OrM2DxA==}
@ -1103,14 +1119,25 @@ packages:
node-addon-api@1.7.2:
resolution: {integrity: sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==}
node-addon-api@7.1.1:
resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==}
node-api-version@0.2.1:
resolution: {integrity: sha512-2xP/IGGMmmSQpI1+O/k72jF/ykvZ89JeuKX3TLJAYPDVLUalrshrLHkeVcCCZqG/eEa635cr8IBYzgnDvM2O8Q==}
node-gyp-build@4.8.4:
resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==}
hasBin: true
node-gyp@11.5.0:
resolution: {integrity: sha512-ra7Kvlhxn5V9Slyus0ygMa2h+UqExPqUIkfk7Pc8QTLT956JLSy51uWFwHtIYy0vI8cB4BDhc/S03+880My/LQ==}
engines: {node: ^18.17.0 || >=20.5.0}
hasBin: true
node-mac-permissions@2.5.0:
resolution: {integrity: sha512-zR8SVCaN3WqV1xwWd04XVAdzm3UTdjbxciLrZtB0Cc7F2Kd34AJfhPD4hm1HU0YH3oGUZO4X9OBLY5ijSTHsGw==}
os: [darwin]
nopt@8.1.0:
resolution: {integrity: sha512-ieGu42u/Qsa4TFktmaKEwM6MQH0pOWnaB3htzh0JRtx84+Mebc0cbZYN5bC+6WTZ4+77xrL9Pn5m7CV6VIkV7A==}
engines: {node: ^18.17.0 || >=20.5.0}
@ -1424,6 +1451,10 @@ packages:
engines: {node: '>=14.17'}
hasBin: true
uiohook-napi@1.5.5:
resolution: {integrity: sha512-oSlTdnECw2GBfsJPTbBQBeE4v/EXP0EZmX6BJq5nzH/JgFaBE8JpFwEA/kLhiEP7HxQw28FViWiYgdIZzWuuJQ==}
engines: {node: '>= 16'}
undici-types@7.16.0:
resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==}
@ -1923,6 +1954,10 @@ snapshots:
base64-js@1.5.1: {}
bindings@1.5.0:
dependencies:
file-uri-to-path: 1.0.0
bl@4.1.0:
dependencies:
buffer: 5.7.1
@ -2348,6 +2383,8 @@ snapshots:
optionalDependencies:
picomatch: 4.0.3
file-uri-to-path@1.0.0: {}
filelist@1.0.6:
dependencies:
minimatch: 5.1.9
@ -2739,10 +2776,14 @@ snapshots:
node-addon-api@1.7.2:
optional: true
node-addon-api@7.1.1: {}
node-api-version@0.2.1:
dependencies:
semver: 7.7.4
node-gyp-build@4.8.4: {}
node-gyp@11.5.0:
dependencies:
env-paths: 2.2.1
@ -2758,6 +2799,11 @@ snapshots:
transitivePeerDependencies:
- supports-color
node-mac-permissions@2.5.0:
dependencies:
bindings: 1.5.0
node-addon-api: 7.1.1
nopt@8.1.0:
dependencies:
abbrev: 3.0.1
@ -3064,6 +3110,10 @@ snapshots:
typescript@5.9.3: {}
uiohook-napi@1.5.5:
dependencies:
node-gyp-build: 4.8.4
undici-types@7.16.0: {}
undici-types@7.18.2: {}

View file

@ -104,7 +104,7 @@ async function buildElectron() {
bundle: true,
platform: 'node',
target: 'node18',
external: ['electron'],
external: ['electron', 'uiohook-napi', 'node-mac-permissions'],
sourcemap: true,
minify: false,
define: {