@piplfy/widget 0.0.1 → 0.0.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.
- package/lib/index.d.ts +13 -0
- package/lib/index.js +4070 -82
- package/lib/resolve.d.ts +1 -0
- package/lib/types.d.ts +11 -0
- package/package.json +8 -4
- package/lib/resolve.js +0 -51
package/lib/resolve.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveBinaryPath(): string;
|
package/lib/types.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piplfy/widget",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Piplfy Widget — native WebSocket bridge for Node.js applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
|
-
".":
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./lib/index.js",
|
|
11
|
+
"types": "./lib/index.d.ts"
|
|
12
|
+
},
|
|
9
13
|
"./schemas": "./lib/schemas.js"
|
|
10
14
|
},
|
|
11
15
|
"bin": {
|
|
@@ -17,8 +21,8 @@
|
|
|
17
21
|
"README.md"
|
|
18
22
|
],
|
|
19
23
|
"optionalDependencies": {
|
|
20
|
-
"@piplfy/widget-linux-x64": "0.0.
|
|
21
|
-
"@piplfy/widget-win32-x64": "0.0.
|
|
24
|
+
"@piplfy/widget-linux-x64": "0.0.2",
|
|
25
|
+
"@piplfy/widget-win32-x64": "0.0.2"
|
|
22
26
|
},
|
|
23
27
|
"peerDependencies": {
|
|
24
28
|
"zod": "^3.0.0 || ^4.0.0"
|
package/lib/resolve.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
|
|
5
|
-
const BINARY_NAME = "pwidget";
|
|
6
|
-
|
|
7
|
-
const PLATFORM_PACKAGES = {
|
|
8
|
-
"linux-x64": "@piplfy/widget-linux-x64",
|
|
9
|
-
"win32-x64": "@piplfy/widget-win32-x64",
|
|
10
|
-
// "darwin-x64": "@piplfy/widget-darwin-x64",
|
|
11
|
-
// "darwin-arm64": "@piplfy/widget-darwin-arm64",
|
|
12
|
-
// "linux-arm64": "@piplfy/widget-linux-arm64",
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Resuelve la ruta al binario nativo para la plataforma actual.
|
|
17
|
-
* Busca el paquete instalado vía optionalDependencies.
|
|
18
|
-
* @returns {string} Ruta absoluta al binario
|
|
19
|
-
*/
|
|
20
|
-
export function resolveBinaryPath() {
|
|
21
|
-
const platform = os.platform();
|
|
22
|
-
const arch = os.arch();
|
|
23
|
-
const key = `${platform}-${arch}`;
|
|
24
|
-
|
|
25
|
-
const packageName = PLATFORM_PACKAGES[key];
|
|
26
|
-
|
|
27
|
-
if (!packageName) {
|
|
28
|
-
const supported = Object.keys(PLATFORM_PACKAGES).join(", ");
|
|
29
|
-
throw new Error(
|
|
30
|
-
`@piplfy/widget: plataforma "${key}" no soportada.\n` +
|
|
31
|
-
`Plataformas soportadas: ${supported}`,
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const ext = platform === "win32" ? ".exe" : "";
|
|
36
|
-
const binaryFile = `${BINARY_NAME}${ext}`;
|
|
37
|
-
|
|
38
|
-
const require = createRequire(import.meta.url);
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
const packageDir = path.dirname(
|
|
42
|
-
require.resolve(`${packageName}/package.json`),
|
|
43
|
-
);
|
|
44
|
-
return path.join(packageDir, "bin", binaryFile);
|
|
45
|
-
} catch {
|
|
46
|
-
throw new Error(
|
|
47
|
-
`@piplfy/widget: no se encontró el paquete "${packageName}".\n` +
|
|
48
|
-
`Ejecutá: npm install ${packageName}`,
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
}
|