fix: apply deno preprocessor output to job args

The deno wrapper imports ./wm_envs.ts, but the job's import map sends every
other "./" specifier to the workspace's raw script endpoint, so a deno job
with a path failed with "Module not found .../raw/p/<folder>/wm_envs.ts"
before its preprocessor or main ran. Map ./wm_envs.ts to the job directory
like ./wrapper.ts and ./main.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-11-25 00:06:58 +01:00
co-authored by Claude Opus 5.5
parent a728082666
commit ef04fbf98c
+3 -1
View File
@@ -737,6 +737,7 @@ pub(crate) async fn build_import_map(
"{base_internal_url}": "{base_internal_url}/api/w/{w_id}/scripts/raw/p/",
"/": "{base_internal_url}/api/w/{w_id}/scripts/raw/p/",
"./wrapper.ts": "./wrapper.ts",
"./wm_envs.ts": "./wm_envs.ts",
"./main.ts": "./main.ts"{relative_mounts}
{extra_import_map}
}}
@@ -995,7 +996,8 @@ mod tests {
let map = std::fs::read_to_string(dir.path().join("import_map.json")).unwrap();
let map: serde_json::Value = serde_json::from_str(&map).unwrap();
let imports = map["imports"].as_object().unwrap();
assert_eq!(imports.len(), 5 + path.split('/').count());
assert_eq!(imports.len(), 6 + path.split('/').count());
assert_eq!(imports["./main.ts"], "./main.ts");
assert_eq!(imports["./wm_envs.ts"], "./wm_envs.ts");
}
}