This repository has been archived on 2024-09-06. You can view files and clone it, but cannot push or open issues or pull requests.
quartz-wiki/quartz/util/sourcemap.ts
2024-01-10 14:39:54 +08:00

19 lines
493 B
TypeScript

import fs from "fs"
import sourceMapSupport from "source-map-support"
import { fileURLToPath } from "url"
export const options: sourceMapSupport.Options = {
// source map hack to get around query param
// import cache busting
retrieveSourceMap(source) {
if (source.includes(".quartz-cache")) {
let realSource = fileURLToPath(source.split("?", 2)[0] + ".map")
return {
map: fs.readFileSync(realSource, "utf8"),
}
} else {
return null
}
},
}