Skip to content

Commit fbd9607

Browse files
committed
fix: use escape_default() when emitting JS string literal from Rust
1 parent b981b24 commit fbd9607

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

crates/cli/src/schema_loader.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ pub async fn load_schema_js(path: &Path) -> io::Result<LoadSchemaJsResult> {
2626
let res_json = run_node(&format!(
2727
r#"
2828
import {{ loadSchemaJs }} from "@nitrogql/core";
29-
import {{ stdout }} from "process";
3029
3130
const result = await loadSchemaJs("{}");
3231
export default result;
3332
"#,
34-
path.display()
33+
path.to_string_lossy().escape_default()
3534
))
3635
.await?;
3736
let parsed: LoadSchemaJsResult = serde_yaml::from_str(&res_json).expect("failed to parse JSON");

crates/config-file/src/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ import config from "{}";
120120
import {{ stdout }} from "process";
121121
export default config?.default ?? config;
122122
"#,
123-
path.display()
123+
path.to_string_lossy().escape_default()
124124
))
125125
.await
126126
}

0 commit comments

Comments
 (0)