You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Source maps can have sourceRoot property; it's defined as a string that's prepended to every entry in the sources list. The specification doesn't put any constraints on this field; consequently, this can be a relative directory (eg. ..).
In my understanding, the intended semantics is that it's to be resolved relative to the URL of the source map itself, eg. given { sourceRoot: '..', sources: 'a.js' } and source map at file:///example/source.js.map the resolved source URL should be ../a.js => file:///a.js.
appmap-node does not handle this case correctly. Consider for example typeorm-0.3.20; metadata-args/MetadataArgsStorage.js.map contains:
However, when instrumenting the file, relevant location.path in transform() (as determined by the debugger) reads nonsensical ../home/divide/projects/tmp/NestJS-TypeORM-Example/node_modules/typeorm/metadata-args/src/metadata-args/MetadataArgsStorage.ts (note the working directory in this run is /home/divide/projects/tmp/NestJS-TypeORM-Example/).
(The path as indicated by the source map would be incorrect in any case (file:////home/divide/projects/tmp/NestJS-TypeORM-Example/src/metadata-args/MetadataArgsStorage.ts by my reading) which seems to be a bug in typeorm build, but that's beside the point.)
Source maps can have
sourceRoot
property; it's defined as a string that's prepended to every entry in thesources
list. The specification doesn't put any constraints on this field; consequently, this can be a relative directory (eg...
).In my understanding, the intended semantics is that it's to be resolved relative to the URL of the source map itself, eg. given
{ sourceRoot: '..', sources: 'a.js' }
and source map atfile:///example/source.js.map
the resolved source URL should be../a.js
=>file:///a.js
.appmap-node
does not handle this case correctly. Consider for example typeorm-0.3.20;metadata-args/MetadataArgsStorage.js.map
contains:However, when instrumenting the file, relevant
location.path
intransform()
(as determined by the debugger) reads nonsensical../home/divide/projects/tmp/NestJS-TypeORM-Example/node_modules/typeorm/metadata-args/src/metadata-args/MetadataArgsStorage.ts
(note the working directory in this run is/home/divide/projects/tmp/NestJS-TypeORM-Example/
).(The path as indicated by the source map would be incorrect in any case (
file:////home/divide/projects/tmp/NestJS-TypeORM-Example/src/metadata-args/MetadataArgsStorage.ts
by my reading) which seems to be a bug in typeorm build, but that's beside the point.)Note: I started working on this issue, here's a WIP branch: https://github.com/getappmap/appmap-node/tree/wip/source-map-relative-root
The text was updated successfully, but these errors were encountered: