Skip to content

Commit

Permalink
config
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jul 1, 2024
1 parent 3f748e0 commit 3b7749d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/relay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn relay_plugin_transform(program: Program, metadata: TransformPluginProgramMeta
};

let mut relay = relay(
config,
config.into(),
filename,
root_dir,
None,
Expand Down
9 changes: 6 additions & 3 deletions packages/relay/transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

//! TODO: Once refactoring next-swc is done, remove duplicated codes and import
//! packages directly
use std::path::{Path, PathBuf};
use std::{
path::{Path, PathBuf},
sync::Arc,
};

use once_cell::sync::Lazy;
use regex::Regex;
Expand Down Expand Up @@ -102,7 +105,7 @@ struct Relay {
root_dir: PathBuf,
pages_dir: Option<PathBuf>,
file_name: FileName,
config: Config,
config: Arc<Config>,
imports: Vec<RelayImport>,
unresolved_mark: Option<Mark>,
}
Expand Down Expand Up @@ -330,7 +333,7 @@ impl Relay {
}

pub fn relay(
config: Config,
config: Arc<Config>,
file_name: FileName,
root_dir: PathBuf,
pages_dir: Option<PathBuf>,
Expand Down
15 changes: 10 additions & 5 deletions packages/relay/transform/tests/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ fn fixture(input: PathBuf) {
language: RelayLanguageConfig::TypeScript,
eager_es_modules: false,
output_file_extension: OutputFileExtension::Undefined,
},
}
.into(),
FileName::Real("file.js".parse().unwrap()),
Default::default(),
None,
Expand All @@ -45,7 +46,8 @@ fn fixture_es_modules(input: PathBuf) {
language: RelayLanguageConfig::TypeScript,
eager_es_modules: true,
output_file_extension: OutputFileExtension::Undefined,
},
}
.into(),
FileName::Real("file.js".parse().unwrap()),
Default::default(),
None,
Expand All @@ -72,7 +74,8 @@ fn fixture_output_file_extension_javascript(input: PathBuf) {
language: RelayLanguageConfig::TypeScript,
eager_es_modules: true,
output_file_extension: OutputFileExtension::JavaScript,
},
}
.into(),
FileName::Real("file.js".parse().unwrap()),
Default::default(),
None,
Expand All @@ -99,7 +102,8 @@ fn fixture_output_file_extension_typescript(input: PathBuf) {
language: RelayLanguageConfig::JavaScript,
eager_es_modules: true,
output_file_extension: OutputFileExtension::TypeScript,
},
}
.into(),
FileName::Real("file.js".parse().unwrap()),
Default::default(),
None,
Expand Down Expand Up @@ -146,7 +150,8 @@ fn fixture_multi_projects(input: PathBuf) {
language: RelayLanguageConfig::JavaScript,
eager_es_modules: true,
output_file_extension: OutputFileExtension::TypeScript,
},
}
.into(),
FileName::Real(input.clone()),
Default::default(),
None,
Expand Down

0 comments on commit 3b7749d

Please sign in to comment.