@flowscripter/template-bun-rust-library 1.0.26 → 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.
@@ -8,6 +8,7 @@ permissions:
8
8
  pull-requests: write
9
9
  id-token: write
10
10
  pages: write
11
+ packages: write
11
12
  jobs:
12
13
  call-release-bun-rust-library:
13
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.26"
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.10"
14
+ version = "1.1.12"
15
15
  source = "registry+https://github.com/rust-lang/crates.io-index"
16
- checksum = "976ac733ec768cafc5771dd98b6a08a0551dc0f7358ac0df2d40eb091f3ee977"
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.26"
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.10"
15
+ flowscripter_template_rust_library = "1.1.12"
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [![version](https://img.shields.io/github/v/release/flowscripter/template-bun-rust-library?sort=semver)](https://github.com/flowscripter/template-bun-rust-library/releases)
4
4
  [![build](https://img.shields.io/github/actions/workflow/status/flowscripter/template-bun-rust-library/release-bun-rust-library.yml)](https://github.com/flowscripter/template-bun-rust-library/actions/workflows/release-bun-rust-library.yml)
5
+ [![docs](https://img.shields.io/badge/docs-API-blue)](https://flowscripter.github.io/template-bun-rust-library/index.html)
6
+ [![rust doc](https://img.shields.io/docsrs/flowscripter_template_bun_rust_library)](https://docs.rs/flowscripter_template_bun_rust_library)
5
7
  [![coverage](https://codecov.io/gh/flowscripter/template-bun-rust-library/branch/main/graph/badge.svg?token=D4ISqIOY1p)](https://codecov.io/gh/flowscripter/template-bun-rust-library)
6
8
  [![license: MIT](https://img.shields.io/github/license/flowscripter/template-bun-rust-library)](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
- `deno fmt`
46
+ `bunx oxfmt`
48
47
 
49
48
  Lint:
50
49
 
51
- `cargo fmt && deno lint index.ts src/ tests/`
50
+ `cargo fmt && bunx oxlint index.ts src/ tests/`
52
51
 
53
52
  Generate HTML API Documentation:
54
53
 
55
- `deno doc --html --name=template-bun-rust-library index.ts`
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.2.5",
8
+ "@types/bun": "^1.3.14",
8
9
  },
9
10
  "peerDependencies": {
10
- "typescript": "^5.8.2",
11
+ "typescript": "^6.0.3",
11
12
  },
12
13
  },
13
14
  },
14
15
  "packages": {
15
- "@types/bun": ["@types/bun@1.2.5", "", { "dependencies": { "bun-types": "1.2.5" } }, "sha512-w2OZTzrZTVtbnJew1pdFmgV99H0/L+Pvw+z1P67HaR18MHOzYnTYOi6qzErhK8HyT+DB782ADVPPE92Xu2/Opg=="],
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
- "@types/ws": ["@types/ws@8.5.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw=="],
20
+ "bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
20
21
 
21
- "bun-types": ["bun-types@1.2.5", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-3oO6LVGGRRKI4kHINx5PIdIgnLRb7l/SprhzqXapmoYkFl5m4j6EvALvbDVuuBFaamB46Ap6HCUxIXNLCGy+tg=="],
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
- "ffi"
11
+ "template"
17
12
  ],
18
- "module": "index.ts",
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
- "version": "1.0.26",
21
- "ffiLibBaseUri": "https://github.com/flowscripter/template-bun-rust-library/releases/download/v1.0.26",
20
+ "module": "index.ts",
22
21
  "publishConfig": {
23
22
  "access": "public"
24
23
  },
25
24
  "devDependencies": {
26
- "@types/bun": "^1.2.5"
25
+ "@types/bun": "^1.3.14"
27
26
  },
28
27
  "peerDependencies": {
29
- "typescript": "^5.8.2"
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 for release build location in preference
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 for release installed location
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 for release download location
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
- add,
9
+ symbols: { add },
10
+ } = dlopen(libPath, {
11
+ add: {
12
+ args: [FFIType.i32, FFIType.i32],
13
+ returns: FFIType.i32,
11
14
  },
12
- } = dlopen(
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"
package/tsconfig.json CHANGED
@@ -14,6 +14,9 @@
14
14
  "verbatimModuleSyntax": true,
15
15
  "noEmit": true,
16
16
 
17
+ // Types
18
+ "types": ["bun", "node"],
19
+
17
20
  // Best practices
18
21
  "strict": true,
19
22
  "skipLibCheck": true,