Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(oxc_napi): remove source_map - moved to its crate #7614

Merged
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
7 changes: 5 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ unicode-id-start = "1"
oxc-browserslist = "1.1.0"
oxc_index = "1.0.0"
oxc_resolver = "2.0.0"
oxc_sourcemap = "1"
oxc_sourcemap = "1.0.2"

aho-corasick = "1.1.3"
allocator-api2 = "0.2.18"
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ doctest = false

[dependencies]
oxc_isolated_declarations = { workspace = true }
oxc_sourcemap = { workspace = true }
oxc_sourcemap = { workspace = true, features = ["napi"] }
oxc_span = { workspace = true }
oxc_syntax = { workspace = true }
oxc_transformer = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_napi/src/isolated_declarations.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use napi_derive::napi;

use super::source_map::SourceMap;
use oxc_sourcemap::napi::SourceMap;

#[napi(object)]
pub struct IsolatedDeclarationsResult {
Expand Down
2 changes: 0 additions & 2 deletions crates/oxc_napi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
pub mod parse;

pub mod source_map;

pub mod isolated_declarations;

pub mod transform;
48 changes: 0 additions & 48 deletions crates/oxc_napi/src/source_map.rs

This file was deleted.

3 changes: 2 additions & 1 deletion crates/oxc_napi/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ use napi::Either;
use napi_derive::napi;
use rustc_hash::FxHashMap;

use oxc_sourcemap::napi::SourceMap;
use oxc_transformer::{EnvOptions, JsxRuntime, RewriteExtensionsMode};

use super::{isolated_declarations::IsolatedDeclarationsOptions, source_map::SourceMap};
use super::isolated_declarations::IsolatedDeclarationsOptions;

#[derive(Default)]
#[napi(object)]
Expand Down
1 change: 1 addition & 0 deletions napi/transform/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ doctest = false
[dependencies]
oxc = { workspace = true, features = ["full", "napi"] }
oxc_napi = { workspace = true }
oxc_sourcemap = { workspace = true, features = ["napi"] }

napi = { workspace = true }
napi-derive = { workspace = true }
Expand Down
6 changes: 2 additions & 4 deletions napi/transform/src/isolated_declaration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ use oxc::{
parser::Parser,
span::SourceType,
};
use oxc_napi::{
isolated_declarations::{IsolatedDeclarationsOptions, IsolatedDeclarationsResult},
source_map::SourceMap,
};
use oxc_napi::isolated_declarations::{IsolatedDeclarationsOptions, IsolatedDeclarationsResult};
use oxc_sourcemap::napi::SourceMap;

use crate::errors::wrap_diagnostics;

Expand Down
6 changes: 2 additions & 4 deletions napi/transform/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ use oxc::{
transformer::{InjectGlobalVariablesConfig, InjectImport, ReplaceGlobalDefinesConfig},
CompilerInterface,
};
use oxc_napi::{
source_map::SourceMap,
transform::{TransformOptions, TransformResult},
};
use oxc_napi::transform::{TransformOptions, TransformResult};
use oxc_sourcemap::napi::SourceMap;

use crate::errors::wrap_diagnostics;

Expand Down
2 changes: 1 addition & 1 deletion npm/oxc-parser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import oxc from 'oxc-parser';

const sourceText = "let foo: Foo = 'foo';";
// Filename extension is used to determine which dialect to parse source as.
const filename = "test.tsx";
const filename = 'test.tsx';

test(oxc.parseSync(filename, sourceText, options));
test(await oxc.parseAsync(filename, sourceText, options));
Expand Down
Loading