reverse query param hack to re-add sourcemap support
| | |
| | | "@types/node": "^20.1.2", |
| | | "@types/pretty-time": "^1.1.2", |
| | | "@types/serve-handler": "^6.1.1", |
| | | "@types/source-map-support": "^0.5.6", |
| | | "@types/workerpool": "^6.4.0", |
| | | "@types/ws": "^8.5.5", |
| | | "@types/yargs": "^17.0.24", |
| | |
| | | "@types/node": "*" |
| | | } |
| | | }, |
| | | "node_modules/@types/source-map-support": { |
| | | "version": "0.5.6", |
| | | "resolved": "https://registry.npmjs.org/@types/source-map-support/-/source-map-support-0.5.6.tgz", |
| | | "integrity": "sha512-b2nJ9YyXmkhGaa2b8VLM0kJ04xxwNyijcq12/kDoomCt43qbHBeK2SLNJ9iJmETaAj+bKUT05PQUu3Q66GvLhQ==", |
| | | "dev": true, |
| | | "dependencies": { |
| | | "source-map": "^0.6.0" |
| | | } |
| | | }, |
| | | "node_modules/@types/unist": { |
| | | "version": "2.0.6", |
| | | "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", |
| | |
| | | "@types/node": "^20.1.2", |
| | | "@types/pretty-time": "^1.1.2", |
| | | "@types/serve-handler": "^6.1.1", |
| | | "@types/source-map-support": "^0.5.6", |
| | | "@types/workerpool": "^6.4.0", |
| | | "@types/ws": "^8.5.5", |
| | | "@types/yargs": "^17.0.24", |
| | |
| | | outfile: path.join("quartz", cacheFile), |
| | | bundle: true, |
| | | keepNames: true, |
| | | minify: true, |
| | | minifyWhitespace: true, |
| | | minifySyntax: true, |
| | | platform: "node", |
| | | format: "esm", |
| | | jsx: "automatic", |
| | | jsxImportSource: "preact", |
| | | packages: "external", |
| | | metafile: true, |
| | | sourcemap: "inline", |
| | | sourcemap: true, |
| | | sourcesContent: false, |
| | | plugins: [ |
| | | sassPlugin({ |
| | |
| | | } |
| | | |
| | | // bypass module cache |
| | | // https://github.com/nodejs/modules/issues/307 |
| | | const { default: buildQuartz } = await import(cacheFile + `?update=${randomUUID()}`) |
| | | await buildQuartz(argv, clientRefresh) |
| | | clientRefresh() |
| | |
| | | import "source-map-support/register.js" |
| | | import sourceMapSupport from "source-map-support" |
| | | sourceMapSupport.install({ |
| | | retrieveSourceMap(source) { |
| | | // source map hack to get around query param |
| | | // import cache busting |
| | | if (source.includes(".quartz-cache")) { |
| | | let realSource = fileURLToPath(source.split("?", 2)[0] + '.map') |
| | | return { |
| | | map: fs.readFileSync(realSource, 'utf8') |
| | | } |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | }) |
| | | |
| | | import path from "path" |
| | | import { PerfTimer } from "./perf" |
| | | import { rimraf } from "rimraf" |
| | |
| | | import { Argv, BuildCtx } from "./ctx" |
| | | import { glob, toPosixPath } from "./glob" |
| | | import { trace } from "./trace" |
| | | import { fileURLToPath } from "url" |
| | | import fs from "fs" |
| | | |
| | | async function buildQuartz(argv: Argv, clientRefresh: () => void) { |
| | | const ctx: BuildCtx = { |