summaryrefslogtreecommitdiff
path: root/ext/ffi
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-05 18:46:37 -0400
committerGitHub <noreply@github.com>2023-03-05 22:46:37 +0000
commit76b173b60c975fe7540d04aac5b7a40be67fe466 (patch)
tree0d1a58abce1b336e1e20ceeeeb7319030a3142b5 /ext/ffi
parent1ab16e2426819af2c534e8a99b98f244626de512 (diff)
refactor: move "pathFromURL" to deno_web extension (#18037)
This API is required by several extensions like "ext/node", "ext/ffi" and also FS APIs that we want to move to a separate crate. Because of that "pathFromURL" API was moved to "deno_web" extension so other extension crates can rely on it.
Diffstat (limited to 'ext/ffi')
-rw-r--r--ext/ffi/00_ffi.js5
-rw-r--r--ext/ffi/lib.rs1
2 files changed, 2 insertions, 4 deletions
diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js
index a63a027e8..a1b177122 100644
--- a/ext/ffi/00_ffi.js
+++ b/ext/ffi/00_ffi.js
@@ -2,7 +2,6 @@
const core = globalThis.Deno.core;
const ops = core.ops;
-const internals = globalThis.__bootstrap.internals;
const primordials = globalThis.__bootstrap.primordials;
const {
ArrayPrototypeMap,
@@ -28,6 +27,7 @@ const {
SymbolFor,
WeakMap,
} = primordials;
+import { pathFromURL } from "internal:deno_web/00_infra.js";
const promiseIdSymbol = SymbolFor("Deno.core.internalPromiseId");
@@ -542,9 +542,6 @@ class DynamicLibrary {
}
function dlopen(path, symbols) {
- // TODO(@crowlKats): remove me
- // URL support is progressively enhanced by util in `runtime/js`.
- const pathFromURL = internals.pathFromURL ?? ((p) => p);
return new DynamicLibrary(pathFromURL(path), symbols);
}
diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs
index b8e3ac503..38a5a7eb2 100644
--- a/ext/ffi/lib.rs
+++ b/ext/ffi/lib.rs
@@ -83,6 +83,7 @@ pub(crate) struct FfiState {
pub fn init<P: FfiPermissions + 'static>(unstable: bool) -> Extension {
Extension::builder(env!("CARGO_PKG_NAME"))
+ .dependencies(vec!["deno_web"])
.esm(include_js_files!("00_ffi.js",))
.ops(vec![
op_ffi_load::decl::<P>(),