Description
Hey JrS people!
I'm trying to implement a native binding much alike Node's require.resolve()
The tricky thing about the require.resolve
function is that when using a relative path, i.e. require.resolve('./thing.js')
the look up happens relative to the source file in which the require.resolve()
call was written.
I noticed that for the JerryScript debugger support, jerry_parse_named_resource
was added, which seemed promising at a glance. Unfortunately, the "resource name" is merely passed off to the debugger client and not kept around.
Any suggestions on how to solve this?
I guess I want an API like const jerry_char_t *jerry_get_current_resource_name(void);
that would return the currently executing resource name (or NULL
if no named resource is executing / it's not available).
For reference, V8 has a GetScriptName()
method on the StackFrame
class which is similar to what I'm looking for.