@north-light/crouter 0.3.248 → 0.3.249
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
package/runtime.lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/crouter",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.249",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@north-light/crouter",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.249",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
const SPAWN_TIMEOUT_MS = 3000;
|
|
3
|
-
function writers() {
|
|
4
|
-
if (process.platform === 'darwin')
|
|
5
|
-
return [['pbcopy', []]];
|
|
6
|
-
const wayland = Boolean(process.env.WAYLAND_DISPLAY)
|
|
7
|
-
|| process.env.XDG_SESSION_TYPE === 'wayland';
|
|
8
|
-
const xclip = ['xclip', ['-selection', 'clipboard']];
|
|
9
|
-
const wlcopy = ['wl-copy', []];
|
|
10
|
-
return wayland ? [wlcopy, xclip] : [xclip, wlcopy];
|
|
11
|
-
}
|
|
12
|
-
/** Write text to the system clipboard without throwing. */
|
|
13
|
-
export function writeClipboardText(text) {
|
|
14
|
-
for (const [command, args] of writers()) {
|
|
15
|
-
const result = spawnSync(command, args, {
|
|
16
|
-
input: text,
|
|
17
|
-
timeout: SPAWN_TIMEOUT_MS,
|
|
18
|
-
encoding: 'utf-8',
|
|
19
|
-
});
|
|
20
|
-
if (result.error)
|
|
21
|
-
continue;
|
|
22
|
-
if (result.status === 0)
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
return false;
|
|
26
|
-
}
|