|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
699 bytes
|
| Line | |
|---|
| 1 | import resolveUri from '@jridgewell/resolve-uri';
|
|---|
| 2 | import stripFilename from './strip-filename';
|
|---|
| 3 |
|
|---|
| 4 | type Resolve = (source: string | null) => string;
|
|---|
| 5 | export default function resolver(
|
|---|
| 6 | mapUrl: string | null | undefined,
|
|---|
| 7 | sourceRoot: string | undefined,
|
|---|
| 8 | ): Resolve {
|
|---|
| 9 | const from = stripFilename(mapUrl);
|
|---|
| 10 | // The sourceRoot is always treated as a directory, if it's not empty.
|
|---|
| 11 | // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
|
|---|
| 12 | // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
|
|---|
| 13 | const prefix = sourceRoot ? sourceRoot + '/' : '';
|
|---|
| 14 |
|
|---|
| 15 | return (source) => resolveUri(prefix + (source || ''), from);
|
|---|
| 16 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.