-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js.map
7 lines (7 loc) · 4.73 KB
/
index.js.map
1
2
3
4
5
6
7
{
"version": 3,
"sources": ["src/index.ts", "src/command/lessc.ts", "src/command/markdownc.ts", "src/command/pugc.ts"],
"sourcesContent": ["#!/usr/bin/env node\nimport { readFileSync } from \"fs\";\nimport path = require(\"path/posix\");\nconst program = require(\"commander\");\n\nimport { lessc } from \"./command/lessc\";\nimport { markdownc } from \"./command/markdownc\";\nimport { pugc } from \"./command/pugc\";\n\nconst packageInfo = () => {\n const p = path.join(__dirname, \"package.json\");\n return JSON.parse(readFileSync(p).toString());\n};\n\nprogram\n .name(\"bssg\")\n .description(\"Brad's Static Website Generator\")\n .version(packageInfo().version);\n\nprogram\n .command(\"lessc\")\n .description(\"compile a less file\")\n .argument(\"<input-file>\", \"less file to compile\")\n .action(lessc);\n\nprogram\n .command(\"markdownc\")\n .description(\"compile a markdown file\")\n .argument(\"<input-file>\", \"pug file to inject content into\")\n .argument(\"[extends-file]\", \"pug file to extend from\")\n .action(markdownc);\n\nprogram\n .command(\"pugc\")\n .description(\"compile a pug file\")\n .argument(\"<input-file>\", \"pug file to inject content into\")\n .argument(\"[locals-file]\", \"JSON file for locals\")\n .action(pugc);\n\nprogram.parse();\n", "import { readFile } from \"fs/promises\";\nimport { render } from \"less\";\n\nexport const lessc = async (inputFile: string) => {\n try {\n const buf = await readFile(inputFile);\n const output = await render(buf.toString());\n console.log(output.css);\n } catch (e: any) {\n console.error(e.message);\n process.exit(1);\n }\n};\n", "import { readFile } from \"fs/promises\";\nimport pretty = require(\"pretty\");\nimport { compileFile } from \"pug\";\nimport remarkParse = require(\"remark-parse\");\nimport remarkRehype = require(\"remark-rehype\");\nimport rehypeStringify = require(\"rehype-stringify\");\nimport unified = require(\"unified\");\n\nexport const markdownc = async (inputFile: string, extendsFile: string) => {\n const processor = unified()\n .use(remarkParse)\n .use(remarkRehype)\n .use(rehypeStringify);\n\n const buf = await readFile(inputFile);\n const converted = await processor.process(buf.toString());\n const htmlOutput = converted.contents as string;\n\n if (extendsFile) {\n const pugOutput = compileFile(extendsFile)();\n const combinedOutput = pugOutput.replace(\"BLOCK_CONTENT\", htmlOutput);\n const output = pretty(combinedOutput);\n console.log(output);\n } else {\n console.log(htmlOutput);\n }\n};\n", "import { readFile } from \"fs/promises\";\nimport pretty = require(\"pretty\");\nimport { compileFile } from \"pug\";\n\nconst getLocals = async (localsFile?: string) => {\n if (localsFile) {\n const buffer = await readFile(localsFile);\n return JSON.parse(buffer.toString());\n }\n\n return {};\n};\n\nexport const pugc = async (inputFile: string, localsFile: string) => {\n try {\n const locals = await getLocals(localsFile);\n const pugOutput = compileFile(inputFile)(locals);\n const output = pretty(pugOutput);\n console.log(output);\n } catch (e: any) {\n console.error(e.message);\n process.exit(1);\n }\n};\n"],
"mappings": ";aACA,MAA6B,cCD7B,MAAyB,uBACzB,EAAuB,wCAEV,EAAQ,KAAO,IAAsB,CAChD,GAAI,CACF,GAAM,GAAM,KAAM,eAAS,CAAS,EAC9B,EAAS,KAAM,aAAO,EAAI,SAAS,CAAC,EAC1C,QAAQ,IAAI,EAAO,GAAG,CACxB,OAAS,EAAP,CACA,QAAQ,MAAM,EAAE,OAAO,EACvB,QAAQ,KAAK,CAAC,CAChB,CACF,ECZA,MAAyB,uBAEzB,EAA4B,2CADrB,EAAS,QAAQ,kCAEjB,EAAc,QAAQ,wCACtB,EAAe,QAAQ,yCACvB,EAAkB,QAAQ,4CAC1B,EAAU,QAAQ,mCAEZ,EAAY,MAAO,EAAmB,IAAwB,CACzE,GAAM,GAAY,EAAQ,EACvB,IAAI,CAAW,EACf,IAAI,CAAY,EAChB,IAAI,CAAe,EAEhB,EAAM,KAAM,eAAS,CAAS,EAE9B,EAAa,AADD,MAAM,GAAU,QAAQ,EAAI,SAAS,CAAC,GAC3B,SAE7B,GAAI,EAAa,CAEf,GAAM,GAAiB,AADL,kBAAY,CAAW,EAAE,EACV,QAAQ,gBAAiB,CAAU,EA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