Skip to content

Commit

Permalink
fix: use escape_default() when emitting JS string literal from Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
uhyo committed Dec 28, 2024
1 parent b981b24 commit fbd9607
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions crates/cli/src/schema_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ pub async fn load_schema_js(path: &Path) -> io::Result<LoadSchemaJsResult> {
let res_json = run_node(&format!(
r#"
import {{ loadSchemaJs }} from "@nitrogql/core";
import {{ stdout }} from "process";
const result = await loadSchemaJs("{}");
export default result;
"#,
path.display()
path.to_string_lossy().escape_default()
))
.await?;
let parsed: LoadSchemaJsResult = serde_yaml::from_str(&res_json).expect("failed to parse JSON");
Expand Down
2 changes: 1 addition & 1 deletion crates/config-file/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ import config from "{}";
import {{ stdout }} from "process";
export default config?.default ?? config;
"#,
path.display()
path.to_string_lossy().escape_default()
))
.await
}

0 comments on commit fbd9607

Please sign in to comment.