From 68a0b19846d0e9ee448d86eae1199cd4efcec103 Mon Sep 17 00:00:00 2001 From: Till Schneidereit Date: Fri, 21 Mar 2025 12:47:58 +0100 Subject: [PATCH 1/2] Update to latest StarlingMonkey Pulls in https://github.com/bytecodealliance/StarlingMonkey/pull/231 --- StarlingMonkey | 2 +- src/componentize.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/StarlingMonkey b/StarlingMonkey index 53044ec8..30756b20 160000 --- a/StarlingMonkey +++ b/StarlingMonkey @@ -1 +1 @@ -Subproject commit 53044ec8f1d64f968fa45fe9afeef3993c92d10b +Subproject commit 30756b20b2b6d6ab108e21029fdacd83f2967f27 diff --git a/src/componentize.js b/src/componentize.js index 63187900..e4c361f0 100644 --- a/src/componentize.js +++ b/src/componentize.js @@ -215,9 +215,15 @@ export async function componentize(opts, // component to be relative to the current working directory. // This only works in wizer, not in weval, because the latter doesn't // support --mapdir. - if (!opts.enableAot && workspacePrefix.startsWith(cwd())) { - workspacePrefix = cwd(); - sourcePath = sourcePath.slice(workspacePrefix.length + 1); + if (!opts.enableAot) { + if (!useOriginalSourceFile) { + workspacePrefix = sourceDir; + sourcePath = sourceName; + } + if (workspacePrefix.startsWith(cwd())) { + workspacePrefix = cwd(); + sourcePath = sourcePath.slice(workspacePrefix.length + 1); + } } let args = `--initializer-script-path ${initializerPath} ${sourcePath}`; runtimeArgs = runtimeArgs ? `${runtimeArgs} ${args}` : args; From 0b21ff8c5c872f4fa2f9b6ba726513189b2d2c25 Mon Sep 17 00:00:00 2001 From: Till Schneidereit Date: Fri, 21 Mar 2025 16:28:41 +0100 Subject: [PATCH 2/2] Strip path prefix Since for weval we can't map the build dir to something else, we instruct StarlingMonkey to strip the path prefix instead, achieving stack traces that don't depend on source location. --- src/componentize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/componentize.js b/src/componentize.js index e4c361f0..cf1dce94 100644 --- a/src/componentize.js +++ b/src/componentize.js @@ -225,7 +225,7 @@ export async function componentize(opts, sourcePath = sourcePath.slice(workspacePrefix.length + 1); } } - let args = `--initializer-script-path ${initializerPath} ${sourcePath}`; + let args = `--initializer-script-path ${initializerPath} --strip-path-prefix ${workspacePrefix}/ ${sourcePath}`; runtimeArgs = runtimeArgs ? `${runtimeArgs} ${args}` : args; let preopens = [`--dir ${sourceDir}`]; if (opts.enableAot) {