@miniben90/x-win 3.4.1 → 3.5.1
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 +2 -2
- package/index.d.ts +4 -1
- package/index.js +25 -14
- package/package.json +31 -26
package/README.md
CHANGED
|
@@ -150,7 +150,7 @@ setTimeout(() => unsubscribeActiveWindow(c), 5000)
|
|
|
150
150
|
setTimeout(() => unsubscribeAllActiveWindow(), 10000)
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
### Get icon from `
|
|
153
|
+
### Get icon from `WindowInfo`
|
|
154
154
|
|
|
155
155
|
It is possible to get an icon from the `WindowInfo` class object using `getIcon` or `getIconAsync`, which will return an `IconInfo` struct.
|
|
156
156
|
The icon will be stored in `IconInfo.data` in base64 PNG format.
|
|
@@ -226,7 +226,7 @@ It is possible to get URL of browsers window for macOS and Windows.
|
|
|
226
226
|
| microsoft edge | ✅ |
|
|
227
227
|
| opera software - opera | ✅ |
|
|
228
228
|
| opera software - opera GX | ✅ |
|
|
229
|
-
| brave |
|
|
229
|
+
| brave | ✅ |
|
|
230
230
|
| vivaldi | |
|
|
231
231
|
| iron | |
|
|
232
232
|
| epic | |
|
package/index.d.ts
CHANGED
|
@@ -246,7 +246,10 @@ export interface ProcessInfo {
|
|
|
246
246
|
* ```
|
|
247
247
|
*
|
|
248
248
|
*/
|
|
249
|
-
export declare function subscribeActiveWindow(
|
|
249
|
+
export declare function subscribeActiveWindow(
|
|
250
|
+
callback: (error: Error | null, info: WindowInfo | undefined) => void,
|
|
251
|
+
interval?: number,
|
|
252
|
+
): number
|
|
250
253
|
|
|
251
254
|
/** * Uninstall "@mininben90/x-win" Gnome extension.
|
|
252
255
|
* This function will disable and remove extension files.
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// @ts-nocheck
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
-
const { readFileSync } = require('
|
|
6
|
+
const { readFileSync } = require('fs')
|
|
7
7
|
let nativeBinding = null
|
|
8
8
|
const loadErrors = []
|
|
9
9
|
|
|
@@ -33,7 +33,7 @@ const isMuslFromFilesystem = () => {
|
|
|
33
33
|
|
|
34
34
|
const isMuslFromReport = () => {
|
|
35
35
|
let report = null
|
|
36
|
-
if (typeof process.report
|
|
36
|
+
if (process.report && typeof process.report.getReport === 'function') {
|
|
37
37
|
process.report.excludeNetwork = true
|
|
38
38
|
report = process.report.getReport()
|
|
39
39
|
}
|
|
@@ -105,7 +105,7 @@ function requireNative() {
|
|
|
105
105
|
}
|
|
106
106
|
} else if (process.platform === 'win32') {
|
|
107
107
|
if (process.arch === 'x64') {
|
|
108
|
-
if (process.config
|
|
108
|
+
if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
|
|
109
109
|
try {
|
|
110
110
|
return require('./x-win.win32-x64-gnu.node')
|
|
111
111
|
} catch (e) {
|
|
@@ -525,23 +525,33 @@ function requireNative() {
|
|
|
525
525
|
|
|
526
526
|
nativeBinding = requireNative()
|
|
527
527
|
|
|
528
|
-
|
|
528
|
+
// NAPI_RS_FORCE_WASI is a tri-state flag:
|
|
529
|
+
// unset / any other value → native binding preferred, WASI is only a fallback
|
|
530
|
+
// 'true' → force WASI fallback even if native loaded
|
|
531
|
+
// 'error' → force WASI and throw if no WASI binding is found
|
|
532
|
+
// Treating any non-empty string as truthy (the historical behavior) meant
|
|
533
|
+
// NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
|
|
534
|
+
// the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
|
|
535
|
+
const forceWasi =
|
|
536
|
+
process.env.NAPI_RS_FORCE_WASI === 'true' || process.env.NAPI_RS_FORCE_WASI === 'error'
|
|
537
|
+
|
|
538
|
+
if (!nativeBinding || forceWasi) {
|
|
529
539
|
let wasiBinding = null
|
|
530
540
|
let wasiBindingError = null
|
|
531
541
|
try {
|
|
532
542
|
wasiBinding = require('./x-win.wasi.cjs')
|
|
533
543
|
nativeBinding = wasiBinding
|
|
534
544
|
} catch (err) {
|
|
535
|
-
if (
|
|
545
|
+
if (forceWasi) {
|
|
536
546
|
wasiBindingError = err
|
|
537
547
|
}
|
|
538
548
|
}
|
|
539
|
-
if (!nativeBinding ||
|
|
549
|
+
if (!nativeBinding || forceWasi) {
|
|
540
550
|
try {
|
|
541
551
|
wasiBinding = require('@miniben90/x-win-wasm32-wasi')
|
|
542
552
|
nativeBinding = wasiBinding
|
|
543
553
|
} catch (err) {
|
|
544
|
-
if (
|
|
554
|
+
if (forceWasi) {
|
|
545
555
|
if (!wasiBindingError) {
|
|
546
556
|
wasiBindingError = err
|
|
547
557
|
} else {
|
|
@@ -560,17 +570,18 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
560
570
|
|
|
561
571
|
if (!nativeBinding) {
|
|
562
572
|
if (loadErrors.length > 0) {
|
|
563
|
-
|
|
573
|
+
const error = new Error(
|
|
564
574
|
`Cannot find native binding. ` +
|
|
565
575
|
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
566
576
|
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
567
|
-
{
|
|
568
|
-
cause: loadErrors.reduce((err, cur) => {
|
|
569
|
-
cur.cause = err
|
|
570
|
-
return cur
|
|
571
|
-
}),
|
|
572
|
-
},
|
|
573
577
|
)
|
|
578
|
+
// assign instead of the `new Error(message, { cause })` options form,
|
|
579
|
+
// which Node < 16.9 silently ignores
|
|
580
|
+
error.cause = loadErrors.reduce((err, cur) => {
|
|
581
|
+
cur.cause = err
|
|
582
|
+
return cur
|
|
583
|
+
})
|
|
584
|
+
throw error
|
|
574
585
|
}
|
|
575
586
|
throw new Error(`Failed to load native binding`)
|
|
576
587
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miniben90/x-win",
|
|
3
3
|
"description": "This package allows you to retrieve precise information about active and open windows on Windows, MacOS, and Linux. You can obtain the position, size, title, and other memory of windows.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.1",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"universal-apple-darwin"
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"registry": "https://registry.npmjs.org/",
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
26
30
|
"author": {
|
|
27
31
|
"name": "BENKHADRA Hocine",
|
|
28
32
|
"email": "contact@benkhadra.com",
|
|
@@ -46,22 +50,22 @@
|
|
|
46
50
|
"open"
|
|
47
51
|
],
|
|
48
52
|
"devDependencies": {
|
|
49
|
-
"@emnapi/core": "^1.
|
|
50
|
-
"@emnapi/runtime": "^1.
|
|
51
|
-
"@napi-rs/cli": "^3.
|
|
53
|
+
"@emnapi/core": "^1.11.1",
|
|
54
|
+
"@emnapi/runtime": "^1.11.1",
|
|
55
|
+
"@napi-rs/cli": "^3.7.2",
|
|
52
56
|
"@oxc-node/core": "^0.1.0",
|
|
53
57
|
"@taplo/cli": "^0.7.0",
|
|
54
|
-
"@tybys/wasm-util": "^0.10.
|
|
55
|
-
"@types/node": "^25.
|
|
56
|
-
"ava": "^
|
|
58
|
+
"@tybys/wasm-util": "^0.10.3",
|
|
59
|
+
"@types/node": "^25.9.4",
|
|
60
|
+
"ava": "^8.0.1",
|
|
57
61
|
"chalk": "^5.6.2",
|
|
58
62
|
"husky": "^9.1.7",
|
|
59
|
-
"lint-staged": "^
|
|
60
|
-
"npm-run-all2": "^
|
|
61
|
-
"oxlint": "^1.
|
|
62
|
-
"prettier": "^3.8.
|
|
63
|
-
"tinybench": "^6.0.
|
|
64
|
-
"typescript": "^6.0.
|
|
63
|
+
"lint-staged": "^17.0.8",
|
|
64
|
+
"npm-run-all2": "^9.0.2",
|
|
65
|
+
"oxlint": "^1.71.0",
|
|
66
|
+
"prettier": "^3.8.4",
|
|
67
|
+
"tinybench": "^6.0.2",
|
|
68
|
+
"typescript": "^6.0.3"
|
|
65
69
|
},
|
|
66
70
|
"lint-staged": {
|
|
67
71
|
"*.@(js|ts|tsx)": [
|
|
@@ -75,9 +79,9 @@
|
|
|
75
79
|
]
|
|
76
80
|
},
|
|
77
81
|
"ava": {
|
|
78
|
-
"extensions":
|
|
79
|
-
"ts"
|
|
80
|
-
|
|
82
|
+
"extensions": [
|
|
83
|
+
"ts"
|
|
84
|
+
],
|
|
81
85
|
"workerThreads": false,
|
|
82
86
|
"timeout": "3m",
|
|
83
87
|
"failFast": true,
|
|
@@ -109,8 +113,9 @@
|
|
|
109
113
|
"format:toml": "taplo format",
|
|
110
114
|
"format:rs": "cargo fmt",
|
|
111
115
|
"lint": "oxlint .",
|
|
112
|
-
"prepublishOnly": "napi prepublish -t npm",
|
|
116
|
+
"prepublishOnly": "napi prepublish -t npm --no-gh-release",
|
|
113
117
|
"test": "ava",
|
|
118
|
+
"preversion": "napi build --platform && git add .",
|
|
114
119
|
"version": "napi version",
|
|
115
120
|
"prepare": "husky",
|
|
116
121
|
"clippy:rs": "cd ./x-win-rs && cargo clippy --all-features -- -D warnings",
|
|
@@ -122,15 +127,15 @@
|
|
|
122
127
|
"checkall": "yarn format && yarn lint && yarn clippy && yarn fmt",
|
|
123
128
|
"universalize": "napi universalize"
|
|
124
129
|
},
|
|
125
|
-
"packageManager": "yarn@4.
|
|
130
|
+
"packageManager": "yarn@4.17.0",
|
|
126
131
|
"optionalDependencies": {
|
|
127
|
-
"@miniben90/x-win-darwin-x64": "3.
|
|
128
|
-
"@miniben90/x-win-darwin-arm64": "3.
|
|
129
|
-
"@miniben90/x-win-linux-x64-gnu": "3.
|
|
130
|
-
"@miniben90/x-win-linux-x64-musl": "3.
|
|
131
|
-
"@miniben90/x-win-win32-ia32-msvc": "3.
|
|
132
|
-
"@miniben90/x-win-win32-x64-msvc": "3.
|
|
133
|
-
"@miniben90/x-win-win32-arm64-msvc": "3.
|
|
134
|
-
"@miniben90/x-win-darwin-universal": "3.
|
|
132
|
+
"@miniben90/x-win-darwin-x64": "3.5.1",
|
|
133
|
+
"@miniben90/x-win-darwin-arm64": "3.5.1",
|
|
134
|
+
"@miniben90/x-win-linux-x64-gnu": "3.5.1",
|
|
135
|
+
"@miniben90/x-win-linux-x64-musl": "3.5.1",
|
|
136
|
+
"@miniben90/x-win-win32-ia32-msvc": "3.5.1",
|
|
137
|
+
"@miniben90/x-win-win32-x64-msvc": "3.5.1",
|
|
138
|
+
"@miniben90/x-win-win32-arm64-msvc": "3.5.1",
|
|
139
|
+
"@miniben90/x-win-darwin-universal": "3.5.1"
|
|
135
140
|
}
|
|
136
141
|
}
|