@vtxdeo/protocol 2.0.6 → 3.2.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 +12 -45
- package/index.d.ts +2 -0
- package/package.json +7 -3
- package/wit/vtx.wit +13 -0
package/README.md
CHANGED
|
@@ -1,61 +1,28 @@
|
|
|
1
1
|
# @vtxdeo/protocol
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@vtxdeo/protocol)
|
|
4
4
|
|
|
5
|
-
**Official WIT interface definitions for VTX Project
|
|
5
|
+
**Official WIT interface definitions for VTX Project.**
|
|
6
6
|
|
|
7
|
-
This package contains the raw
|
|
7
|
+
This package contains the raw `.wit` definitions used by the VTX ecosystem. It is intended for use by build tools, CLIs, and SDKs that need to reference the official protocol contract.
|
|
8
|
+
|
|
9
|
+
> **Note**: This package does **not** contain the CLI tool or runtime bindings.
|
|
10
|
+
> * To build plugins, use the **VTX CLI**.
|
|
11
|
+
> * To write plugins, use the **VTX SDK**.
|
|
8
12
|
|
|
9
13
|
## Installation
|
|
10
14
|
|
|
11
15
|
```bash
|
|
12
|
-
npm install @
|
|
16
|
+
npm install @vtxdeo/protocol --save-dev
|
|
13
17
|
|
|
14
18
|
```
|
|
15
19
|
|
|
16
20
|
## Usage
|
|
17
21
|
|
|
18
|
-
### 1. Programmatic Usage (Build Scripts)
|
|
19
|
-
|
|
20
|
-
This package exports the absolute path to the `vtx.wit` file.
|
|
21
|
-
|
|
22
|
-
```javascript
|
|
23
|
-
import { witPath, witDir } from '@vtx/protocol';
|
|
24
|
-
// or: const { witPath } = require('@vtx/protocol');
|
|
25
|
-
|
|
26
|
-
console.log(witPath);
|
|
27
|
-
// Output example: /Users/dev/project/node_modules/@vtx/protocol/wit/vtx.wit
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### 2. Using with `jco` (CLI)
|
|
31
|
-
|
|
32
|
-
You can use the path directly in your CLI commands to componentize your application:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
# Example: Transpile JS to Component
|
|
36
|
-
jco componentize app.js \
|
|
37
|
-
--wit "$(node -p "require('@vtx/protocol').witPath")" \
|
|
38
|
-
--world plugin \
|
|
39
|
-
--out plugin.wasm
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 3. Using with `componentize-js` (API)
|
|
44
|
-
|
|
45
22
|
```javascript
|
|
46
|
-
|
|
47
|
-
import { witPath } from '@vtx/protocol';
|
|
48
|
-
import { readFile } from 'node:fs/promises';
|
|
49
|
-
|
|
50
|
-
const source = await readFile('app.js', 'utf8');
|
|
51
|
-
|
|
52
|
-
const { component } = await componentize(source, {
|
|
53
|
-
witPath: witPath, // Pass the path directly
|
|
54
|
-
world: 'plugin',
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
```
|
|
23
|
+
const { witPath, witDir } = require('@vtxdeo/protocol');
|
|
58
24
|
|
|
59
|
-
|
|
25
|
+
console.log(`Protocol definition is located at: ${witPath}`);
|
|
26
|
+
// Output: .../node_modules/@vtxdeo/protocol/wit/vtx.wit
|
|
60
27
|
|
|
61
|
-
|
|
28
|
+
```
|
package/index.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtxdeo/protocol",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "WIT definitions for VTX plugins",
|
|
3
|
+
"version": "3.2.1",
|
|
4
|
+
"description": "WIT interface definitions for VTX plugins",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
6
7
|
"files": [
|
|
7
8
|
"index.js",
|
|
9
|
+
"index.d.ts",
|
|
8
10
|
"wit/"
|
|
9
11
|
],
|
|
10
12
|
"scripts": {
|
|
11
13
|
"prepublishOnly": "cp -r ../../wit ./"
|
|
12
|
-
}
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {},
|
|
16
|
+
"devDependencies": {}
|
|
13
17
|
}
|
package/wit/vtx.wit
CHANGED
|
@@ -58,12 +58,25 @@ interface types {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
interface ffmpeg {
|
|
62
|
+
use stream-io.{buffer};
|
|
63
|
+
|
|
64
|
+
record transcode-params {
|
|
65
|
+
profile: string,
|
|
66
|
+
input-id: string,
|
|
67
|
+
args: list<string>,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
execute: func(params: transcode-params) -> result<buffer, string>;
|
|
71
|
+
}
|
|
72
|
+
|
|
61
73
|
world plugin {
|
|
62
74
|
use types.{http-request, http-response, manifest};
|
|
63
75
|
use auth-types.{user-context};
|
|
64
76
|
|
|
65
77
|
import stream-io;
|
|
66
78
|
import sql;
|
|
79
|
+
import ffmpeg;
|
|
67
80
|
|
|
68
81
|
export handle: func(req: http-request) -> http-response;
|
|
69
82
|
|