Skip to content

Commit

Permalink
build: update deno dependencies (not the latest version) to reduce th…
Browse files Browse the repository at this point in the history
…e possibility of regression due to breaking changes in the APIs (#93)

Signed-off-by: jaudiger <[email protected]>
  • Loading branch information
jaudiger authored Jul 17, 2024
1 parent 45411ff commit a46843d
Show file tree
Hide file tree
Showing 8 changed files with 257 additions and 302 deletions.
485 changes: 215 additions & 270 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions crates/brioche-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ bstr = { version = "1.8.0", features = ["serde"] }
cfg-if = "1.0.0"
console-subscriber = "0.3.0"
debug-ignore = "1.0.5"
deno_ast = { version = "0.28.0", features = ["transpiling"] }
deno_core = "0.201.0"
deno_ast = { version = "0.32.1", features = ["transpiling"] }
deno_core = "0.237.0"
directories = "5.0.1"
futures = "0.3.29"
globset = "0.4.14"
Expand All @@ -40,7 +40,7 @@ reqwest-retry = "0.6.0"
rust-embed = { version = "8.1.0", features = ["debug-embed", "interpolate-folder-path", "include-exclude"] }
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
serde_v8 = "0.112.0"
serde_v8 = "0.146.0"
serde_with = { version = "3.4.0", features = ["hex"] }
sha2 = "0.10.8"
sqlx = { version = "0.7.3", features = ["runtime-tokio-rustls", "sqlite", "macros", "migrate", "json"] }
Expand Down
30 changes: 17 additions & 13 deletions crates/brioche-core/src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,12 @@ deno_core::extension!(brioche_rt,
},
);

#[deno_core::op]
#[deno_core::op2(async)]
#[serde]
pub async fn op_brioche_bake_all(
state: Rc<RefCell<OpState>>,
recipes: Vec<WithMeta<Recipe>>,
) -> anyhow::Result<Vec<Artifact>> {
#[serde] recipes: Vec<WithMeta<Recipe>>,
) -> Result<Vec<Artifact>, deno_core::error::AnyError> {
let brioche = {
let state = state.try_borrow()?;
state
Expand All @@ -197,11 +198,12 @@ pub async fn op_brioche_bake_all(
Ok(results)
}

#[deno_core::op]
#[deno_core::op2(async)]
#[serde]
pub async fn op_brioche_create_proxy(
state: Rc<RefCell<OpState>>,
recipe: Recipe,
) -> anyhow::Result<Recipe> {
#[serde] recipe: Recipe,
) -> Result<Recipe, deno_core::error::AnyError> {
let brioche = {
let state = state.try_borrow()?;
state
Expand All @@ -215,11 +217,12 @@ pub async fn op_brioche_create_proxy(
}

// TODO: Return a Uint8Array instead of tick-encoding
#[deno_core::op]
#[deno_core::op2(async)]
#[serde]
pub async fn op_brioche_read_blob(
state: Rc<RefCell<OpState>>,
blob_hash: BlobHash,
) -> anyhow::Result<crate::encoding::TickEncode<Vec<u8>>> {
#[serde] blob_hash: BlobHash,
) -> Result<crate::encoding::TickEncode<Vec<u8>>, deno_core::error::AnyError> {
let brioche = {
let state = state.try_borrow()?;
state
Expand All @@ -237,12 +240,13 @@ pub async fn op_brioche_read_blob(
Ok(crate::encoding::TickEncode(bytes))
}

#[deno_core::op]
#[deno_core::op2(async)]
#[serde]
pub async fn op_brioche_get_static(
state: Rc<RefCell<OpState>>,
url: String,
static_: StaticQuery,
) -> anyhow::Result<Recipe> {
#[string] url: String,
#[serde] static_: StaticQuery,
) -> Result<Recipe, deno_core::error::AnyError> {
let (brioche, projects) = {
let state = state.try_borrow()?;
let brioche = state
Expand Down
2 changes: 1 addition & 1 deletion crates/brioche-core/src/script/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub async fn check(
let module_id = js_runtime.load_main_module(&main_module, None).await?;
let result = js_runtime.mod_evaluate(module_id);
js_runtime.run_event_loop(false).await?;
result.await??;
result.await?;

let module_namespace = js_runtime.get_module_namespace(module_id)?;

Expand Down
28 changes: 17 additions & 11 deletions crates/brioche-core/src/script/compiler_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,12 @@ fn brioche_compiler_host_state(state: Rc<RefCell<OpState>>) -> anyhow::Result<Br
Ok(compiler_host)
}

#[deno_core::op]
#[deno_core::op2]
#[serde]
pub fn op_brioche_file_read(
state: Rc<RefCell<OpState>>,
path: &str,
) -> anyhow::Result<Option<Arc<String>>> {
#[string] path: &str,
) -> Result<Option<Arc<String>>, deno_core::error::AnyError> {
let compiler_host = brioche_compiler_host_state(state)?;

let specifier: BriocheModuleSpecifier = path.parse()?;
Expand All @@ -284,8 +285,11 @@ pub fn op_brioche_file_read(
Ok(contents)
}

#[deno_core::op]
pub fn op_brioche_file_exists(state: Rc<RefCell<OpState>>, path: &str) -> anyhow::Result<bool> {
#[deno_core::op2(fast)]
pub fn op_brioche_file_exists(
state: Rc<RefCell<OpState>>,
#[string] path: &str,
) -> Result<bool, deno_core::error::AnyError> {
let compiler_host = brioche_compiler_host_state(state)?;

let specifier: BriocheModuleSpecifier = path.parse()?;
Expand All @@ -294,11 +298,12 @@ pub fn op_brioche_file_exists(state: Rc<RefCell<OpState>>, path: &str) -> anyhow
Ok(result.is_some())
}

#[deno_core::op]
#[deno_core::op2]
#[bigint]
pub fn op_brioche_file_version(
state: Rc<RefCell<OpState>>,
path: &str,
) -> anyhow::Result<Option<u64>> {
#[string] path: &str,
) -> Result<Option<u64>, deno_core::error::AnyError> {
let compiler_host = brioche_compiler_host_state(state)?;

let specifier: BriocheModuleSpecifier = path.parse()?;
Expand All @@ -307,11 +312,12 @@ pub fn op_brioche_file_version(
Ok(version)
}

#[deno_core::op]
#[deno_core::op2]
#[string]
pub fn op_brioche_resolve_module(
state: Rc<RefCell<OpState>>,
specifier: &str,
referrer: &str,
#[string] specifier: &str,
#[string] referrer: &str,
) -> Option<String> {
let compiler_host = brioche_compiler_host_state(state).ok()?;

Expand Down
2 changes: 1 addition & 1 deletion crates/brioche-core/src/script/evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub async fn evaluate(
let module_id = js_runtime.load_main_module(&main_module, None).await?;
let result = js_runtime.mod_evaluate(module_id);
js_runtime.run_event_loop(false).await?;
result.await??;
result.await?;

let module_namespace = js_runtime.get_module_namespace(module_id)?;

Expand Down
4 changes: 2 additions & 2 deletions crates/brioche-core/src/script/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ fn op_brioche_version() -> String {
crate::VERSION.to_string()
}

#[deno_core::op]
fn op_brioche_console(level: ConsoleLevel, message: String) {
#[deno_core::op2]
fn op_brioche_console(#[serde] level: ConsoleLevel, #[string] message: String) {
match level {
ConsoleLevel::Log => tracing::info!("{}", message),
ConsoleLevel::Debug => tracing::debug!("{}", message),
Expand Down
2 changes: 1 addition & 1 deletion crates/brioche-core/src/script/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ fn js_lsp_task(
let module_id = js_runtime.load_main_module(&main_module, None).await?;
let result = js_runtime.mod_evaluate(module_id);
js_runtime.run_event_loop(false).await?;
result.await??;
result.await?;

let module_namespace = js_runtime.get_module_namespace(module_id)?;

Expand Down

0 comments on commit a46843d

Please sign in to comment.