Skip to content

Commit

Permalink
docs: update pretty-ms & do dynamic import 'cause 11ty is dumb
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrl committed May 19, 2024
1 parent 66c939c commit 971bcff
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 78 deletions.
4 changes: 3 additions & 1 deletion .docs/lib/FileFetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const os = require("os");
const phin = require("phin");

const a = require("./Ansi.js");
const pretty_ms = require("pretty-ms");
var pretty_ms = null;

class FileFetcher {
#cache = [];
Expand All @@ -32,6 +32,8 @@ class FileFetcher {

async download_file(url) {
const time_start = new Date();
if(pretty_ms === null)
pretty_ms = (await import("pretty-ms")).default;

if(this.#pkg_obj === null) {
this.#pkg_obj = JSON.parse(await fs.promises.readFile(
Expand Down
3 changes: 2 additions & 1 deletion .docs/lib/HTMLPicture.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const os = require(`os`);
const fs = require("fs");
const path = require("path");

const pretty_ms = require("pretty-ms");
const debug = require("debug")("image");
const imagickal = require("imagickal");
const htmlentities = require("html-entities");
Expand Down Expand Up @@ -144,6 +143,7 @@ async function picture(source_image, alt, target_dir, urlpath, formats = "__AUTO
}

var picture_memoize = null;
var pretty_ms;

async function setup_memoize() {
const pMemoize = (await import("p-memoize")).default;
Expand All @@ -152,5 +152,6 @@ async function setup_memoize() {

module.exports = async function(...args) {
if(picture_memoize === null) await setup_memoize();
pretty_ms = (await import("pretty-ms")).default;
return await picture_memoize(...args);
};
175 changes: 104 additions & 71 deletions .docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions .docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
"clean-css": "^5.3.2",
"columnify": "^1.6.0",
"debug": "^4.3.4",
"html-entities": "^2.4.0",
"html-entities": "^2.5.2",
"html-minifier-terser": "^7.0.0-beta.0",
"imagickal": "^5.0.1",
"keen-slider": "^6.8.6",
"markdown-it-github-alerts": "^0.2.0",
"markdown-it-github-alerts": "^0.3.0",
"markdown-it-prism": "^2.3.0",
"moondoc": "^1.1.0",
"p-memoize": "^7.1.1",
"p-queue": "^7.3.4",
"phin": "^3.7.0",
"p-queue": "^8.0.1",
"phin": "^3.7.1",
"photoswipe": "^5.4.3",
"pretty-ms": "^7.0.1"
"pretty-ms": "^9.0.0"
}
}

0 comments on commit 971bcff

Please sign in to comment.