fix(deps): node-chartist is now an optional dependency and can be handled if missing
This commit is contained in:
468
package-lock.json
generated
468
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -50,7 +50,6 @@
|
|||||||
"marked": "^4.0.17",
|
"marked": "^4.0.17",
|
||||||
"memory-cache": "^0.2.0",
|
"memory-cache": "^0.2.0",
|
||||||
"minimatch": "^5.1.0",
|
"minimatch": "^5.1.0",
|
||||||
"node-chartist": "^1.0.5",
|
|
||||||
"node-fetch": "^3.2.6",
|
"node-fetch": "^3.2.6",
|
||||||
"open-graph-scraper": "^4.11.1",
|
"open-graph-scraper": "^4.11.1",
|
||||||
"png-js": "^1.0.0",
|
"png-js": "^1.0.0",
|
||||||
@@ -79,6 +78,7 @@
|
|||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"gifencoder": "^2.0.1",
|
"gifencoder": "^2.0.1",
|
||||||
"libxmljs2": "^0.30.1"
|
"libxmljs2": "^0.30.1",
|
||||||
|
"node-chartist": "^1.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import sharp from "sharp"
|
|||||||
import linguist from "linguist-js"
|
import linguist from "linguist-js"
|
||||||
import { marked } from "marked"
|
import { marked } from "marked"
|
||||||
import minimatch from "minimatch"
|
import minimatch from "minimatch"
|
||||||
import nodechartist from "node-chartist"
|
|
||||||
import fetch from "node-fetch"
|
import fetch from "node-fetch"
|
||||||
import opengraph from "open-graph-scraper"
|
import opengraph from "open-graph-scraper"
|
||||||
import os from "os"
|
import os from "os"
|
||||||
@@ -166,6 +165,7 @@ export function stripemojis(string) {
|
|||||||
/**Chartist */
|
/**Chartist */
|
||||||
export async function chartist() {
|
export async function chartist() {
|
||||||
const css = `<style data-optimizable="true">${await fs.readFile(paths.join(__module(import.meta.url), "../../../node_modules", "node-chartist/dist/main.css")).catch(_ => "")}</style>`
|
const css = `<style data-optimizable="true">${await fs.readFile(paths.join(__module(import.meta.url), "../../../node_modules", "node-chartist/dist/main.css")).catch(_ => "")}</style>`
|
||||||
|
const {default:nodechartist} = await import(url.pathToFileURL(paths.join(__module(import.meta.url), "../../../node_modules", "/node-chartist/lib/index.js")))
|
||||||
return (await nodechartist(...arguments))
|
return (await nodechartist(...arguments))
|
||||||
.replace(/class="ct-chart-line">/, `class="ct-chart-line">${css}`)
|
.replace(/class="ct-chart-line">/, `class="ct-chart-line">${css}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user