@corelauncher/rod 1.0.0 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corelauncher/rod",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Webview for bun based on tauri's tao and wry.",
5
5
  "keywords": [
6
6
  "corelauncher",
@@ -17,6 +17,8 @@
17
17
  "license": "MIT",
18
18
  "author": "CoreByte",
19
19
  "files": [
20
+ "LICENSE",
21
+ "README.md",
20
22
  "/src-ts/*",
21
23
  "/target/release/rod.dll"
22
24
  ],
package/src-ts/ffi.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  import { dlopen, FFIType, suffix } from "bun:ffi";
2
- import { join } from "node:path";
2
+ import { isPackaged } from "./utilities/npm";
3
3
 
4
- const path = join(import.meta.dir, "..", "target", "debug", `rod.${suffix}`);
4
+ let library: { default: string };
5
+ if (isPackaged()) {
6
+ library = await import(`../target/release/rod.${suffix}`);
7
+ } else {
8
+ library = await import(`../target/debug/rod.${suffix}`);
9
+ }
10
+ // const path = join(import.meta.dir, "..", "target", "debug", `rod.${suffix}`);
5
11
 
6
12
  const {
7
13
  symbols: {
@@ -77,7 +83,7 @@ const {
77
83
  rod_webview_reload,
78
84
  rod_webview_clear_all_browsing_data,
79
85
  },
80
- } = dlopen(path, {
86
+ } = dlopen(library.default, {
81
87
  // event loop
82
88
  rod_event_loop_create: {
83
89
  args: [],
@@ -0,0 +1,7 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ export function isPackaged() {
5
+ const modules = join(import.meta.dir, "..", "..", "node_modules");
6
+ return !existsSync(modules);
7
+ }