denosaurs / plug Goto Github PK
View Code? Open in Web Editor NEW๐ Deno FFI helper module
Home Page: https://deno.land/x/plug
License: MIT License
๐ Deno FFI helper module
Home Page: https://deno.land/x/plug
License: MIT License
$ ../deno --unstable check -r --all https://deno.land/x/[email protected]/mod.ts
Check https://deno.land/x/[email protected]/mod.ts
error: TS2345 [ERROR]: Argument of type 'S' is not assignable to parameter of type 'Cast<S, [] | (S extends string | number | bigint | boolean ? S : never) | { [K in keyof S]: Cast<S[K], [] | (S[K] extends string | number | bigint | boolean ? S[K] : never) | { [K in keyof S[K]]: Cast<...>; }>; }>'.
Type 'ForeignLibraryInterface' is not assignable to type 'Cast<S, [] | (S extends string | number | bigint | boolean ? S : never) | { [K in keyof S]: Cast<S[K], [] | (S[K] extends string | number | bigint | boolean ? S[K] : never) | { [K in keyof S[K]]: Cast<...>; }>; }>'.
return Deno.dlopen(await download(options), symbols);
~~~~~~~
at https://deno.land/x/[email protected]/mod.ts:145:47
As the title says.
I imagine something will have to change in this repo to pull in the changes from https://github.com/denoland/deno/pull/12828/files
In certain cases, often involving dll hell or just downloading associated data and assets it would be nice to be able to specify a download for an archive and automatically unwrap it and cache the unwrapped contents then deleting the original archive to save space.
Formats with planned support:
Formats which may be supported if there is a need for it:
It needs deno apis shim, It worked for me using
When running the tests using the options
const options: Plug.Options = {
name: "test_plugin",
url: path,
cache: resolveTest("cache"),
};
instead of
const options: Plug.Options = {
name: "test_plugin",
urls: {
darwin: `${path}/libtest_plugin.dylib`,
windows: `${path}/test_plugin.dll`,
linux: `${path}/libtest_plugin.so`,
},
cache: resolveTest("cache"),
};
the results differ with around a second in delay per test. Using automatic url detection:
running 3 tests
test remote | prepare ... Check file:///F:/code/denosaurs/plug/test/remote.ts
/test_plugin/target/debug/test_plugin.dll
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
ok (2317ms)
test local | prepare | relative ... Check file:///F:/code/denosaurs/plug/test/local.ts
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
ok (2136ms)
test local | prepare | absolute ... Check file:///F:/code/denosaurs/plug/test/abs.ts
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
ok (2084ms)
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (6537ms)
normal:
running 3 tests
test remote | prepare ... Check file:///F:/code/denosaurs/plug/test/remote.ts
/test_plugin/target/debug/test_plugin.dll
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
ok (1192ms)
test local | prepare | relative ... Check file:///F:/code/denosaurs/plug/test/local.ts
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
ok (1001ms)
test local | prepare | absolute ... Check file:///F:/code/denosaurs/plug/test/abs.ts
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
Hello from plugin.
zero_copy[0]: test
zero_copy[1]: test
ok (969ms)
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (3165ms)
I've been making a couple of deno scripts, and using their stdout to feed other scripts. I noticed that the use of this library outputs messages to stdout and not stderr. Perhaps this should be changed?
Lines 255 to 259 in 7e85fa9
when the source file is read-only (chmod 0555)
then the cached file is also read-only
future calls to download fail
because the target file in cache is read-only
first call:
Copying file:///tmp/tmp.aGowOqCn9e/vscode/vscode-deno/libwebview.so
second call:
Copying file:///tmp/tmp.aGowOqCn9e/vscode/vscode-deno/libwebview.so
error: Uncaught (in promise) PermissionDenied: Permission denied (os error 13), copy '/tmp/tmp.aGowOqCn9e/vscode/vscode-deno/libwebview.so' -> '/home/user/.cache/deno/plug/file/a8eb18dc8f0f8199d82db2f57b5f04a3f527e44095eca509c3960f4760b36e4e.so'
await Deno.copyFile(fromFileUrl(url), cacheFilePath);
^
at async Object.copyFile (deno:runtime/js/30_fs.js:64:5)
at async download (https://deno.land/x/[email protected]/download.ts:257:9)
at async dlopen (https://deno.land/x/[email protected]/mod.ts:145:22)
at async file:///tmp/tmp.aGowOqCn9e/vscode/vscode-deno/webview_deno/src/ffi.ts:154:20
called from https://deno.land/x/webview
discuss: should preserve the execution bit of the original file? or just chmod 0644
all files?
Support for downloading compressed files in addition to archives (#25) would allow users to greatly decrease memory bandwidth and improve download times.
Formats with planned support:
Formats which may be supported if there is a need for it:
Like we do os support but for Deno.build.arch
Could we add a mechanism to detect the libc version and pick a shared lib accordingly? This is coming from a real use case to support sqlite shared lib binaries for both alpine linux and arch linux. One of which uses musl libc. You can find similar detection code in the official java sqlite library https://github.com/xerial/sqlite-jdbc/blob/3.39.3.0/src/main/java/org/sqlite/util/OSInfo.java#L117
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.