Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,26 @@ debug = "line-tables-only"
[profile.dev.package."*"]
debug = false

[profile.dev.package.biome_resolver_wasm]
opt-level = "s"
debug = true

[profile.dev.package.biome_wasm]
opt-level = "s"
debug = true

[profile.release.package.biome_resolver_wasm]
opt-level = 3
debug = false

[profile.release.package.biome_wasm]
opt-level = 3
debug = false

[profile.test.package.biome_resolver_wasm]
opt-level = "s"
debug = true

[profile.test.package.biome_wasm]
opt-level = "s"
debug = true
Expand Down
17 changes: 16 additions & 1 deletion crates/biome_package/src/node_js_package/tsconfig_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,22 @@ impl Manifest for TsConfigJson {
}

impl TsConfigJson {
fn parse(path: &Utf8Path, json: &str) -> (Self, Vec<Error>) {
/// Parses a `tsconfig.json` file from its content.
///
/// # Arguments
///
/// * `path` — absolute path to the `tsconfig.json` file. Used to resolve
/// relative paths inside the config (e.g. `baseUrl`, `paths`). Must be
/// an absolute path; passing a relative path will cause a panic inside
/// [`Self::initialise_paths`].
/// * `json` — the raw JSON (or JSONC) content of the file.
///
Comment on lines +72 to +76
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// relative paths inside the config (e.g. `baseUrl`, `paths`). Must be
/// an absolute path; passing a relative path will cause a panic inside
/// [`Self::initialise_paths`].
/// * `json` — the raw JSON (or JSONC) content of the file.
///
/// relative paths inside the config (e.g. `baseUrl`, `paths`). Must be
/// an absolute path.
/// * `json` — the raw JSON (or JSONC) content of the file.
///
/// # Panics
///
/// If the given `path` is not an absolute path.

/// # Returns
///
/// A tuple of `(TsConfigJson, Vec<Error>)`. If the `Vec` is non-empty,
/// the file contained parse errors and the returned struct may be partially
/// populated with default values.
pub fn parse(path: &Utf8Path, json: &str) -> (Self, Vec<Error>) {
let (tsconfig, diagnostics) = deserialize_from_json_str(
json,
JsonParserOptions::default()
Expand Down
39 changes: 39 additions & 0 deletions crates/biome_resolver_wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "biome_resolver_wasm"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
description = "WebAssembly bindings to the Biome resolver"
homepage.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
categories.workspace = true
publish = false

[package.metadata.wasm-pack.profile.profiling]
wasm-opt = false

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
biome_deserialize = { workspace = true }
biome_fs = { workspace = true }
biome_json_parser = { workspace = true }
biome_package = { workspace = true }
biome_resolver = { workspace = true }
camino = { workspace = true }
console_error_panic_hook = { version = "0.1.7", optional = true }
js-sys = "0.3.83"
serde = { workspace = true }
serde-wasm-bindgen = "0.6.5"
# IMPORTANT: if you update this package, you must update justfile and workflows
# so we install the same CLI version
wasm-bindgen = { version = "=0.2.106", features = ["serde-serialize"] }

[features]
default = ["console_error_panic_hook"]

[lints]
workspace = true
Loading