Make paths in resulting sourcemap absolute
This commit is contained in:
parent
133acb3e77
commit
6368707541
1 changed files with 5 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
import { resolve } from 'path'
|
||||||
import { spawn } from 'child_process'
|
import { spawn } from 'child_process'
|
||||||
|
|
||||||
// These are where I (yname) have my Rojo projects.
|
// These are where I (yname) have my Rojo projects.
|
||||||
|
@ -43,23 +44,23 @@ function getSourcemap(root: string): Promise<RojoSourcemap> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function prefixSourcemap(
|
function absoluteSourcemap(
|
||||||
sourcemap: RojoSourcemap,
|
sourcemap: RojoSourcemap,
|
||||||
prefix: string,
|
prefix: string,
|
||||||
): RojoSourcemap {
|
): RojoSourcemap {
|
||||||
return {
|
return {
|
||||||
name: sourcemap.name,
|
name: sourcemap.name,
|
||||||
className: sourcemap.className,
|
className: sourcemap.className,
|
||||||
filePaths: sourcemap.filePaths?.map((path) => `${prefix}/${path}`),
|
filePaths: sourcemap.filePaths?.map((path) => resolve(`${prefix}/${path}`)),
|
||||||
children: sourcemap.children?.map((child) =>
|
children: sourcemap.children?.map((child) =>
|
||||||
prefixSourcemap(child, prefix),
|
absoluteSourcemap(child, prefix),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getPrefixedSourcemap(root: string): Promise<RojoSourcemap> {
|
async function getPrefixedSourcemap(root: string): Promise<RojoSourcemap> {
|
||||||
const sourcemap = await getSourcemap(root)
|
const sourcemap = await getSourcemap(root)
|
||||||
const prefixed = prefixSourcemap(sourcemap, root)
|
const prefixed = absoluteSourcemap(sourcemap, root)
|
||||||
return prefixed
|
return prefixed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue