@flowscripter/template-bun-rust-library 1.0.25 → 1.1.0
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/.github/workflows/check-bun-dependencies.yml +3 -0
- package/.github/workflows/check-rust-dependencies.yml +3 -0
- package/.github/workflows/lint-pr-message.yml +2 -0
- package/.github/workflows/release-bun-rust-library.yml +7 -0
- package/.github/workflows/validate-bun-rust-library-pr.yml +2 -0
- package/Cargo.lock +3 -3
- package/Cargo.toml +3 -3
- package/README.md +5 -6
- package/bun.lock +6 -7
- package/package.json +14 -14
- package/src/lib-path.ts +4 -6
- package/src/lib.ts +6 -14
- package/tsconfig.json +3 -0
|
@@ -2,6 +2,13 @@ name: release-bun-rust-library
|
|
|
2
2
|
on:
|
|
3
3
|
push:
|
|
4
4
|
branches: [main]
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
issues: write
|
|
8
|
+
pull-requests: write
|
|
9
|
+
id-token: write
|
|
10
|
+
pages: write
|
|
11
|
+
packages: write
|
|
5
12
|
jobs:
|
|
6
13
|
call-release-bun-rust-library:
|
|
7
14
|
uses: flowscripter/.github/.github/workflows/release-bun-rust-library.yml@v1
|
package/Cargo.lock
CHANGED
|
@@ -4,13 +4,13 @@ version = 4
|
|
|
4
4
|
|
|
5
5
|
[[package]]
|
|
6
6
|
name = "flowscripter_template_bun_rust_library"
|
|
7
|
-
version = "1.0
|
|
7
|
+
version = "1.1.0"
|
|
8
8
|
dependencies = [
|
|
9
9
|
"flowscripter_template_rust_library",
|
|
10
10
|
]
|
|
11
11
|
|
|
12
12
|
[[package]]
|
|
13
13
|
name = "flowscripter_template_rust_library"
|
|
14
|
-
version = "1.1.
|
|
14
|
+
version = "1.1.12"
|
|
15
15
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
16
|
-
checksum = "
|
|
16
|
+
checksum = "efde44ad50aba46f123ab73240f242bdc47de1ae88ce4ef6765aeadda9564071"
|
package/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "flowscripter_template_bun_rust_library"
|
|
3
|
-
version ="1.0
|
|
3
|
+
version ="1.1.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
description = "Project template for a Rust library with Bun FFI bindings."
|
|
6
6
|
homepage = "https://github.com/flowscripter"
|
|
@@ -9,7 +9,7 @@ repository = "https://github.com/flowscripter/template-bun-rust-library"
|
|
|
9
9
|
exclude = [".github/"]
|
|
10
10
|
|
|
11
11
|
[lib]
|
|
12
|
-
crate-type = ["cdylib","lib"]
|
|
12
|
+
crate-type = ["cdylib", "lib"]
|
|
13
13
|
|
|
14
14
|
[dependencies]
|
|
15
|
-
flowscripter_template_rust_library = "1.1.
|
|
15
|
+
flowscripter_template_rust_library = "1.1.12"
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/flowscripter/template-bun-rust-library/releases)
|
|
4
4
|
[](https://github.com/flowscripter/template-bun-rust-library/actions/workflows/release-bun-rust-library.yml)
|
|
5
|
+
[](https://flowscripter.github.io/template-bun-rust-library/index.html)
|
|
6
|
+
[](https://docs.rs/flowscripter_template_bun_rust_library)
|
|
5
7
|
[](https://codecov.io/gh/flowscripter/template-bun-rust-library)
|
|
6
8
|
[](https://github.com/flowscripter/template-bun-rust-library/blob/main/LICENSE)
|
|
7
9
|
|
|
@@ -39,20 +41,17 @@ Test:
|
|
|
39
41
|
|
|
40
42
|
`cargo build --release && bun test`
|
|
41
43
|
|
|
42
|
-
**NOTE**: The following tasks use Deno as it excels at these and Bun does not
|
|
43
|
-
currently provide such functionality:
|
|
44
|
-
|
|
45
44
|
Format:
|
|
46
45
|
|
|
47
|
-
`
|
|
46
|
+
`bunx oxfmt`
|
|
48
47
|
|
|
49
48
|
Lint:
|
|
50
49
|
|
|
51
|
-
`cargo fmt &&
|
|
50
|
+
`cargo fmt && bunx oxlint index.ts src/ tests/`
|
|
52
51
|
|
|
53
52
|
Generate HTML API Documentation:
|
|
54
53
|
|
|
55
|
-
`
|
|
54
|
+
`bunx typedoc --readme none index.ts`
|
|
56
55
|
|
|
57
56
|
## Documentation
|
|
58
57
|
|
package/bun.lock
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"lockfileVersion": 1,
|
|
3
|
+
"configVersion": 0,
|
|
3
4
|
"workspaces": {
|
|
4
5
|
"": {
|
|
5
6
|
"name": "@flowscripter/template-bun-rust-library",
|
|
6
7
|
"devDependencies": {
|
|
7
|
-
"@types/bun": "^1.
|
|
8
|
+
"@types/bun": "^1.3.14",
|
|
8
9
|
},
|
|
9
10
|
"peerDependencies": {
|
|
10
|
-
"typescript": "^
|
|
11
|
+
"typescript": "^6.0.3",
|
|
11
12
|
},
|
|
12
13
|
},
|
|
13
14
|
},
|
|
14
15
|
"packages": {
|
|
15
|
-
"@types/bun": ["@types/bun@1.
|
|
16
|
+
"@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="],
|
|
16
17
|
|
|
17
18
|
"@types/node": ["@types/node@22.13.4", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-ywP2X0DYtX3y08eFVx5fNIw7/uIv8hYUKgXoK8oayJlLnKcRfEYCxWMVE1XagUdVtCJlZT1AU4LXEABW+L1Peg=="],
|
|
18
19
|
|
|
19
|
-
"
|
|
20
|
+
"bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
|
|
20
21
|
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
"typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],
|
|
22
|
+
"typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
|
|
24
23
|
|
|
25
24
|
"undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
|
|
26
25
|
}
|
package/package.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowscripter/template-bun-rust-library",
|
|
3
|
+
"version": "1.1.0",
|
|
3
4
|
"description": "Project template for a Rust library with Bun FFI bindings",
|
|
4
|
-
"homepage": "https://github.com/flowscripter/template-bun-rust-library#readme",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/flowscripter/template-bun-rust-library.git"
|
|
8
|
-
},
|
|
9
|
-
"license": "MIT",
|
|
10
5
|
"keywords": [
|
|
11
6
|
"bun",
|
|
12
7
|
"example",
|
|
8
|
+
"ffi",
|
|
13
9
|
"library",
|
|
14
|
-
"template",
|
|
15
10
|
"rust",
|
|
16
|
-
"
|
|
11
|
+
"template"
|
|
17
12
|
],
|
|
18
|
-
"
|
|
13
|
+
"homepage": "https://github.com/flowscripter/template-bun-rust-library#readme",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/flowscripter/template-bun-rust-library.git"
|
|
18
|
+
},
|
|
19
19
|
"type": "module",
|
|
20
|
-
"
|
|
21
|
-
"ffiLibBaseUri": "https://github.com/flowscripter/template-bun-rust-library/releases/download/v1.0.25",
|
|
20
|
+
"module": "index.ts",
|
|
22
21
|
"publishConfig": {
|
|
23
22
|
"access": "public"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
|
-
"@types/bun": "^1.
|
|
25
|
+
"@types/bun": "^1.3.14"
|
|
27
26
|
},
|
|
28
27
|
"peerDependencies": {
|
|
29
|
-
"typescript": "^
|
|
30
|
-
}
|
|
28
|
+
"typescript": "^6.0.3"
|
|
29
|
+
},
|
|
30
|
+
"ffiLibBaseUri": "https://github.com/flowscripter/template-bun-rust-library/releases/download/v1.1.0"
|
|
31
31
|
}
|
package/src/lib-path.ts
CHANGED
|
@@ -11,7 +11,7 @@ export async function getLibPath(libName: string) {
|
|
|
11
11
|
fullLibName = "lib" + fullLibName;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
// look
|
|
14
|
+
// look in release build location
|
|
15
15
|
const builtLibPath = path.join("target", "release", fullLibName);
|
|
16
16
|
|
|
17
17
|
console.debug(`builtLibPath: ${builtLibPath}`);
|
|
@@ -25,7 +25,7 @@ export async function getLibPath(libName: string) {
|
|
|
25
25
|
return builtLibPath;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
// look
|
|
28
|
+
// look in release installed location
|
|
29
29
|
const installedLibFolder = path.join(os.homedir(), ".flowscripter", "lib");
|
|
30
30
|
const installedLibPath = path.join(installedLibFolder, fullLibName);
|
|
31
31
|
const installedLibFile = Bun.file(installedLibPath);
|
|
@@ -40,7 +40,7 @@ export async function getLibPath(libName: string) {
|
|
|
40
40
|
|
|
41
41
|
console.debug(`packageJson.ffiLibBaseUri: ${packageJson.ffiLibBaseUri}`);
|
|
42
42
|
|
|
43
|
-
// look
|
|
43
|
+
// look in release download location
|
|
44
44
|
const remotePath = path.join(packageJson.ffiLibBaseUri, fullLibName);
|
|
45
45
|
|
|
46
46
|
console.debug(`remotePath: ${remotePath}`);
|
|
@@ -52,9 +52,7 @@ export async function getLibPath(libName: string) {
|
|
|
52
52
|
|
|
53
53
|
await Bun.write(installedLibPath, result);
|
|
54
54
|
} catch (e) {
|
|
55
|
-
console.error(
|
|
56
|
-
`Failed to download ${remotePath} to ${installedLibPath}: ${e}`,
|
|
57
|
-
);
|
|
55
|
+
console.error(`Failed to download ${remotePath} to ${installedLibPath}: ${e}`);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
return installedLibPath;
|
package/src/lib.ts
CHANGED
|
@@ -6,21 +6,13 @@ const libPath = await getLibPath("flowscripter_template_bun_rust_library");
|
|
|
6
6
|
console.debug(`dlopen libPath: ${libPath}`);
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
|
-
symbols: {
|
|
10
|
-
|
|
9
|
+
symbols: { add },
|
|
10
|
+
} = dlopen(libPath, {
|
|
11
|
+
add: {
|
|
12
|
+
args: [FFIType.i32, FFIType.i32],
|
|
13
|
+
returns: FFIType.i32,
|
|
11
14
|
},
|
|
12
|
-
}
|
|
13
|
-
libPath,
|
|
14
|
-
{
|
|
15
|
-
add: {
|
|
16
|
-
args: [
|
|
17
|
-
FFIType.i32,
|
|
18
|
-
FFIType.i32,
|
|
19
|
-
],
|
|
20
|
-
returns: FFIType.i32,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
);
|
|
15
|
+
});
|
|
24
16
|
|
|
25
17
|
/**
|
|
26
18
|
* Adds 2 and 2 and logs the result as "World 4"
|