Skip to content

Commit 84b5cd8

Browse files
committed
Fix CI and clean warnings
1 parent 9ece4b1 commit 84b5cd8

35 files changed

+1914
-1808
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ extra_features = ["worker", "snapshot_builder"]
5858
# (See [NodePermissions])
5959
node_experimental = [
6060
"deno_node", "deno_resolver", "node_resolver", "deno_npm", "deno_semver", "deno_napi", "deno_runtime", "deno_process", "deno_package_json",
61+
"deno_bundle_runtime",
6162
"checksum", "sys_traits", "all_extensions"
6263
]
6364

@@ -118,7 +119,7 @@ web_stub = ["webidl", "base64-simd"]
118119
web = [
119120
"deno_web", "deno_tls", "deno_fetch", "deno_net", "dep:http", "deno_permissions", "deno_telemetry", "deno_fs",
120121
"webidl", "console", "url", "crypto", "url_import", "fs_import",
121-
"hyper-util", "rustls"
122+
"hyper-util", "rustls", "sys_traits"
122123
]
123124

124125
# [https://gpuweb.github.io/gpuweb/]
@@ -197,6 +198,7 @@ deno_permissions = { version = "^0.85.0", optional = true }
197198

198199
deno_broadcast_channel = { version = "^0.216.0", optional = true }
199200

201+
deno_bundle_runtime = { version = "^0.13.0", optional = true }
200202
deno_cache = { version = "^0.159.0", optional = true }
201203
deno_console = { version = "^0.222.0", optional = true }
202204
deno_cron = { version = "^0.106.0", optional = true }
@@ -245,7 +247,7 @@ deno_npm = { version = "^0.42.2", optional = true }
245247
deno_process = { version = "^0.41.0", optional = true }
246248
deno_package_json = { version = "^0.28.0", optional = true }
247249
checksum = { version = "0.2.1", optional = true }
248-
sys_traits = { version = "=0.1.17", optional = true }
250+
sys_traits = { version = "=0.1.17", optional = true, features = ["libc", "real", "winapi"] }
249251

250252
[dev-dependencies]
251253
version-sync = "0.9.5"

examples/custom_import_logic.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ impl ImportProvider for MyImportProvider {
7878
specifier: &ModuleSpecifier,
7979
_referrer: Option<&ModuleSpecifier>,
8080
_is_dyn_import: bool,
81-
_requested_module_type: deno_core::RequestedModuleType,
8281
) -> Option<Result<String, ModuleLoaderError>> {
8382
match specifier.scheme() {
8483
//
@@ -102,7 +101,10 @@ impl ImportProvider for MyImportProvider {
102101

103102
fn main() -> Result<(), rustyscript::Error> {
104103
let mut import_provider = MyImportProvider::default();
105-
import_provider.add_redirect("mod_assert", "https://deno.land/std@0.224.0/assert/mod.ts")?;
104+
import_provider.add_redirect(
105+
"mod_assert",
106+
"https://deno.land/std@0.224.0/assert/assert.ts",
107+
)?;
106108
import_provider.add_static_module("my-module", "export const foo = 1");
107109

108110
let mut runtime = Runtime::new(RuntimeOptions {
@@ -113,10 +115,10 @@ fn main() -> Result<(), rustyscript::Error> {
113115
let module = Module::new(
114116
"custom_imports.js",
115117
"
116-
import { assertEquals } from 'redirect:mod_assert';
118+
import { assert } from 'redirect:mod_assert';
117119
import { foo } from 'static:my-module';
118120
119-
assertEquals(1, foo)
121+
assert(foo === 1);
120122
",
121123
);
122124

src/async_bridge.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ impl TokioRuntime {
2929
///
3030
/// This runs the given future on the current thread, blocking until it is complete, and yielding its resolved result. Any tasks or timers which the future spawns internally will be executed on the runtime.
3131
///
32-
/// When this is used on a `current_thread` runtime, only the [`Runtime::block_on`] method can drive the IO and timer drivers, but the `Handle::block_on` method cannot drive them.
33-
/// This means that, when using this method on a `current_thread` runtime, anything that relies on IO or timers will not work unless there is another thread currently calling [`Runtime::block_on`] on the same runtime.
32+
/// When this is used on a `current_thread` runtime, only the [`tokio::runtime::Runtime::block_on`] method can drive the IO and timer drivers, but the `Handle::block_on` method cannot drive them.
33+
/// This means that, when using this method on a `current_thread` runtime, anything that relies on IO or timers will not work unless there is another thread currently calling [`tokio::runtime::Runtime::block_on`] on the same runtime.
3434
pub fn block_on<F, T>(&self, f: F) -> T
3535
where
3636
F: std::future::Future<Output = T>,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "ext:deno_web/01_broadcast_channel.js";

src/ext/broadcast_channel/mod.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,29 @@ extension!(
1414
esm = [ dir "src/ext/broadcast_channel", "init_broadcast_channel.js" ],
1515
);
1616

17+
extension!(
18+
deno_broadcast_channel,
19+
deps = [deno_web],
20+
esm = [ dir "src/ext/broadcast_channel", "01_broadcast_channel.js" ],
21+
);
22+
1723
impl ExtensionTrait<()> for init_broadcast_channel {
1824
fn init((): ()) -> Extension {
1925
init_broadcast_channel::init()
2026
}
2127
}
2228

29+
impl ExtensionTrait<()> for deno_broadcast_channel {
30+
fn init((): ()) -> Extension {
31+
deno_broadcast_channel::init()
32+
}
33+
}
34+
2335
// Note: broadcast_channel functionality is now integrated into deno_web
2436
// No separate initialization is needed as it's handled by deno_web extension
2537
pub fn extensions(_channel: InMemoryBroadcastChannel, is_snapshot: bool) -> Vec<Extension> {
26-
vec![init_broadcast_channel::build((), is_snapshot)]
38+
vec![
39+
deno_broadcast_channel::build((), is_snapshot),
40+
init_broadcast_channel::build((), is_snapshot),
41+
]
2742
}

src/ext/console/init_console.js

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,38 @@
11
import * as _console from 'ext:deno_web/01_console.js';
22

3-
import { applyToGlobal, nonEnumerable } from 'ext:rustyscript/rustyscript.js';
4-
applyToGlobal({
5-
console: nonEnumerable(
6-
new _console.Console((msg, level) => globalThis.Deno.core.print(msg, level > 1)),
7-
),
8-
});
3+
import { applyToGlobal, nonEnumerable } from 'ext:rustyscript/rustyscript.js';
4+
5+
const consoleInstance = new _console.Console((msg, level) =>
6+
globalThis.Deno.core.print(msg, level > 1),
7+
);
8+
for (const name of [
9+
"log",
10+
"debug",
11+
"info",
12+
"warn",
13+
"error",
14+
"dir",
15+
"dirxml",
16+
"assert",
17+
"clear",
18+
"count",
19+
"countReset",
20+
"group",
21+
"groupCollapsed",
22+
"groupEnd",
23+
"table",
24+
"time",
25+
"timeEnd",
26+
"timeLog",
27+
"trace",
28+
]) {
29+
const value = consoleInstance[name];
30+
if (typeof value === "function") {
31+
consoleInstance[name] = value.bind(consoleInstance);
32+
}
33+
}
34+
applyToGlobal({
35+
console: nonEnumerable(consoleInstance),
36+
});
937

1038
globalThis.Deno.inspect = _console.inspect;

src/ext/console/mod.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
use deno_core::{extension, Extension};
2-
3-
use super::ExtensionTrait;
4-
5-
extension!(
6-
init_console,
7-
deps = [rustyscript, deno_web],
8-
esm_entry_point = "ext:init_console/init_console.js",
9-
esm = [ dir "src/ext/console", "init_console.js" ],
10-
);
11-
impl ExtensionTrait<()> for init_console {
12-
fn init((): ()) -> Extension {
13-
deno_terminal::colors::set_use_color(true);
14-
init_console::init()
15-
}
16-
}
17-
pub fn extensions(is_snapshot: bool) -> Vec<Extension> {
18-
vec![<init_console as ExtensionTrait<()>>::build((), is_snapshot)]
19-
}
20-
1+
use deno_core::{extension, Extension};
2+
3+
use super::ExtensionTrait;
4+
5+
extension!(
6+
init_console,
7+
deps = [rustyscript, deno_web],
8+
esm_entry_point = "ext:init_console/init_console.js",
9+
esm = [ dir "src/ext/console", "init_console.js" ],
10+
);
11+
impl ExtensionTrait<()> for init_console {
12+
fn init((): ()) -> Extension {
13+
deno_terminal::colors::set_use_color(true);
14+
init_console::init()
15+
}
16+
}
17+
pub fn extensions(is_snapshot: bool) -> Vec<Extension> {
18+
vec![<init_console as ExtensionTrait<()>>::build((), is_snapshot)]
19+
}

src/ext/io/tty_unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ fn console_size_from_fd(fd: std::os::unix::prelude::RawFd) -> Result<ConsoleSize
203203
// SAFETY: libc calls
204204
unsafe {
205205
let mut size: libc::winsize = std::mem::zeroed();
206-
if libc::ioctl(fd, libc::TIOCGWINSZ, &mut size as *mut _) != 0 {
206+
if libc::ioctl(fd, libc::TIOCGWINSZ, std::ptr::from_mut(&mut size)) != 0 {
207207
return Err(Error::last_os_error());
208208
}
209209
Ok(ConsoleSize {

0 commit comments

Comments
 (0)