oxc/tasks/common/src/lib.rs
Dunqing 9ee962add8 feat(transformer): support from_babel_options in TransformOptions (#3301)
Move `BabelOptions` to Transformer. The `output.json` is a standard babel configuration. We can reuse BabelOptions to read [babel.config.json](https://babeljs.io/docs/configuration#babelconfigjson) or our configuration(maybe oxc.config.json)

The current `from_babel_options` implementation is copied from the `transform_options` in `test_case.rs`, which I'll completely reimplement next
2024-05-16 10:10:39 +00:00

20 lines
509 B
Rust

use std::path::{Path, PathBuf};
mod diff;
mod request;
mod snapshot;
mod test_file;
pub use crate::{request::agent, snapshot::Snapshot, test_file::*};
pub use diff::print_diff_in_terminal;
/// # Panics
/// Invalid Project Root
pub fn project_root() -> PathBuf {
project_root::get_project_root().unwrap()
}
/// Normalizes the path when on Windows to using forward slash delimiters.
pub fn normalize_path<P: AsRef<Path>>(path: P) -> String {
path.as_ref().display().to_string().replace('\\', "/")
}