| | |
| | | sourceMapSupport.install(options) |
| | | import path from "path" |
| | | import { PerfTimer } from "./util/perf" |
| | | import { rimraf } from "rimraf" |
| | | import { rm } from "fs/promises" |
| | | import { GlobbyFilterFunction, isGitIgnored } from "globby" |
| | | import chalk from "chalk" |
| | | import { styleText } from "util" |
| | | import { parseMarkdown } from "./processors/parse" |
| | | import { filterContent } from "./processors/filter" |
| | | import { emitContent } from "./processors/emit" |
| | |
| | | import { randomIdNonSecure } from "./util/random" |
| | | import { ChangeEvent } from "./plugins/types" |
| | | import { minimatch } from "minimatch" |
| | | import { FileTrieNode } from "./util/fileTrie" |
| | | |
| | | type ContentMap = Map< |
| | | FilePath, |
| | |
| | | |
| | | const release = await mut.acquire() |
| | | perf.addEvent("clean") |
| | | await rimraf(path.join(output, "*"), { glob: true }) |
| | | await rm(output, { recursive: true, force: true }) |
| | | console.log(`Cleaned output directory \`${output}\` in ${perf.timeSince("clean")}`) |
| | | |
| | | perf.addEvent("glob") |
| | |
| | | const filteredContent = filterContent(ctx, parsedFiles) |
| | | |
| | | await emitContent(ctx, filteredContent) |
| | | console.log(chalk.green(`Done processing ${markdownPaths.length} files in ${perf.timeSince()}`)) |
| | | console.log( |
| | | styleText("green", `Done processing ${markdownPaths.length} files in ${perf.timeSince()}`), |
| | | ) |
| | | release() |
| | | |
| | | if (argv.watch) { |
| | |
| | | ctx, |
| | | mut, |
| | | contentMap, |
| | | ignored: (path) => { |
| | | if (gitIgnoredMatcher(path)) return true |
| | | const pathStr = path.toString() |
| | | ignored: (fp) => { |
| | | const pathStr = toPosixPath(fp.toString()) |
| | | if (pathStr.startsWith(".git/")) return true |
| | | if (gitIgnoredMatcher(pathStr)) return true |
| | | for (const pattern of cfg.configuration.ignorePatterns) { |
| | | if (minimatch(pathStr, pattern)) { |
| | | return true |
| | |
| | | |
| | | const perf = new PerfTimer() |
| | | perf.addEvent("rebuild") |
| | | console.log(chalk.yellow("Detected change, rebuilding...")) |
| | | console.log(styleText("yellow", "Detected change, rebuilding...")) |
| | | |
| | | // update changesSinceLastBuild |
| | | for (const change of changes) { |
| | |
| | | } |
| | | |
| | | console.log(`Emitted ${emittedFiles} files to \`${argv.output}\` in ${perf.timeSince("rebuild")}`) |
| | | console.log(chalk.green(`Done rebuilding in ${perf.timeSince()}`)) |
| | | console.log(styleText("green", `Done rebuilding in ${perf.timeSince()}`)) |
| | | changes.splice(0, numChangesInBuild) |
| | | clientRefresh() |
| | | release() |