Skip to content

Commit

Permalink
Revert "build: update deno dependencies (not the latest version) to r…
Browse files Browse the repository at this point in the history
…educe th…" (#99)

This reverts commit a46843d.
  • Loading branch information
kylewlacy authored Jul 18, 2024
1 parent a46843d commit c41bd20
Show file tree
Hide file tree
Showing 8 changed files with 302 additions and 257 deletions.
485 changes: 270 additions & 215 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.32.1", features = ["transpiling"] }
deno_core = "0.237.0"
deno_ast = { version = "0.28.0", features = ["transpiling"] }
deno_core = "0.201.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.146.0"
serde_v8 = "0.112.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: 13 additions & 17 deletions crates/brioche-core/src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,11 @@ deno_core::extension!(brioche_rt,
},
);

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

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

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

#[deno_core::op2(async)]
#[serde]
#[deno_core::op]
pub async fn op_brioche_get_static(
state: Rc<RefCell<OpState>>,
#[string] url: String,
#[serde] static_: StaticQuery,
) -> Result<Recipe, deno_core::error::AnyError> {
url: String,
static_: StaticQuery,
) -> anyhow::Result<Recipe> {
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: 11 additions & 17 deletions crates/brioche-core/src/script/compiler_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,11 @@ fn brioche_compiler_host_state(state: Rc<RefCell<OpState>>) -> anyhow::Result<Br
Ok(compiler_host)
}

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

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

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

let specifier: BriocheModuleSpecifier = path.parse()?;
Expand All @@ -298,12 +294,11 @@ pub fn op_brioche_file_exists(
Ok(result.is_some())
}

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

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

#[deno_core::op2]
#[string]
#[deno_core::op]
pub fn op_brioche_resolve_module(
state: Rc<RefCell<OpState>>,
#[string] specifier: &str,
#[string] referrer: &str,
specifier: &str,
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::op2]
fn op_brioche_console(#[serde] level: ConsoleLevel, #[string] message: String) {
#[deno_core::op]
fn op_brioche_console(level: ConsoleLevel, 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 c41bd20

Please sign in to comment.