| | |
| | | import { ProcessedContent } from '../plugins/vfile' |
| | | import { PerfTimer } from '../perf' |
| | | import { read } from 'to-vfile' |
| | | import { FilePath, ServerSlug, slugifyFilePath } from '../path' |
| | | import { FilePath, QUARTZ, ServerSlug, slugifyFilePath } from '../path' |
| | | import path from 'path' |
| | | import os from 'os' |
| | | import workerpool, { Promise as WorkerPromise } from 'workerpool' |
| | | import { QuartzTransformerPluginInstance } from '../plugins/types' |
| | | import { QuartzLogger } from '../log' |
| | | import chalk from 'chalk' |
| | | import { trace } from '../trace' |
| | | |
| | | export type QuartzProcessor = Processor<MDRoot, HTMLRoot, void> |
| | | export function createProcessor(transformers: QuartzTransformerPluginInstance[]): QuartzProcessor { |
| | |
| | | const fp = "./quartz/worker.ts" |
| | | return esbuild.build({ |
| | | entryPoints: [fp], |
| | | outfile: path.join("quartz", cacheFile), |
| | | outfile: path.join(QUARTZ, cacheFile), |
| | | bundle: true, |
| | | keepNames: true, |
| | | platform: "node", |
| | |
| | | console.log(`[process] ${fp} -> ${file.data.slug}`) |
| | | } |
| | | } catch (err) { |
| | | console.log(chalk.red(`\nFailed to process \`${fp}\`: `) + err) |
| | | trace(`\nFailed to process \`${fp}\``, err as Error) |
| | | process.exit(1) |
| | | } |
| | | } |