From a109b1aeeb0f22f9c20f5c5a3312ca0d810e0d86 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Wed, 15 Oct 2025 23:36:01 -0700 Subject: [PATCH] chore(lib): promote `progress` as a top level module `lib/progress` --- framework/bundle.ts | 2 +- framework/font.ts | 2 +- framework/generate.ts | 2 +- framework/incremental.ts | 2 +- lib/deno.json | 7 ++++--- lib/log.ts | 2 +- lib/{log => }/progress.sample.ts | 2 +- lib/{log => }/progress.ts | 2 +- lib/readme.changes.md | 6 ++++++ lib/readme.md | 2 +- lib/subprocess/ffmpeg.ts | 4 ++-- readme.md | 2 +- src/deploy.ts | 2 +- src/file-viewer/bin/scan3.ts | 2 +- src/file-viewer/models/derived.ts | 2 +- src/file-viewer/rsync.ts | 2 +- src/package-lib.ts | 2 +- 17 files changed, 26 insertions(+), 19 deletions(-) rename lib/{log => }/progress.sample.ts (97%) rename lib/{log => }/progress.ts (99%) diff --git a/framework/bundle.ts b/framework/bundle.ts index 3a95c5ac440b1f88d031de7a96b1d3bf94abe898..603a2c407e47a41e8272927a5cdb882f2726ed4f 100644 --- a/framework/bundle.ts +++ b/framework/bundle.ts @@ -401,5 +401,5 @@ import * as sg from "#sitegen"; import type { PageOrView } from "./generate.ts"; import type * as view from "#sitegen/view"; import * as meta from "lib/render/meta.ts"; -import * as progress from "lib/log/progress.ts"; +import * as progress from "lib/progress.ts"; import { ASSERT, UNWRAP } from "lib/assert.ts"; diff --git a/framework/font.ts b/framework/font.ts index bc7e3594722facbe53b53bea51e179a927a2efb4..39953480d788c63c9b207cba91dcbe53756a7385 100644 --- a/framework/font.ts +++ b/framework/font.ts @@ -216,5 +216,5 @@ import * as incr from "./incremental.ts"; import * as crypto from "node:crypto"; import * as async from "lib/async.ts"; import * as error from "lib/error.ts"; -import * as progress from "../lib/log/progress.ts"; +import * as progress from "../lib/progress.ts"; import { ASSERT } from "lib/assert.ts"; diff --git a/framework/generate.ts b/framework/generate.ts index 4fa203076575b1aee1bf40ab0631de5ad420f6db..ccd29f9707cd7cdc859e27c2ff05fcce0f0ae291 100644 --- a/framework/generate.ts +++ b/framework/generate.ts @@ -401,7 +401,7 @@ import * as meta from "lib/render/meta.ts"; import * as render from "lib/render.ts"; import * as sg from "#sitegen"; import type { FileItem } from "#sitegen"; -import * as progress from "../lib/log/progress.ts"; +import * as progress from "../lib/progress.ts"; import * as bundle from "./bundle.ts"; import * as css from "./css.ts"; diff --git a/framework/incremental.ts b/framework/incremental.ts index 086640bde51f8b593dfc3f5621acbcc64d0c7706..a4468807c958e01ab90fe1b157916a5b554debe2 100644 --- a/framework/incremental.ts +++ b/framework/incremental.ts @@ -736,7 +736,7 @@ import * as util from "node:util"; import * as crypto from "node:crypto"; import * as zlib from "node:zlib"; -import * as progress from "lib/log/progress.ts"; +import * as progress from "lib/progress.ts"; import * as stack from "lib/log/stack.ts"; import { formatSize } from "@/file-viewer/format.ts"; diff --git a/lib/deno.json b/lib/deno.json index a8f612f26c6d11dca12a5692a56d5d52bceeb5f5..c30b6c44f84093bc7e6079bdf270a282ebbee992 100644 --- a/lib/deno.json +++ b/lib/deno.json @@ -1,7 +1,7 @@ { "name": "@clo/lib", "description": "high quality typescript libraries", - "version": "2.0.0", + "version": "3.0.0", "license": "MIT", "exports": { "./assert.ts": "./assert.ts", @@ -9,11 +9,11 @@ "./error.ts": "./error.ts", "./log.ts": "./log.ts", "./log/headless.ts": "./log/headless.ts", - "./log/progress.ts": "./log/progress.ts", "./log/stack.ts": "./log/stack.ts", "./Lru.ts": "./Lru.ts", "./mime.ts": "./mime.ts", "./node.ts": "./node.ts", + "./progress.ts": "./progress.ts", "./queue.ts": "./queue.ts", "./render.ts": "./render.ts", "./render/jsx-runtime.ts": "./render/jsx-runtime.ts", @@ -37,4 +37,5 @@ "readme.npm.md", "deno.lock" ] -} \ No newline at end of file +} + diff --git a/lib/log.ts b/lib/log.ts index 0fdcdd8b1286557a6e686c08427bd87604702031..2ac4ef49726dd87fd748e42c8e7d5558adbccaa5 100644 --- a/lib/log.ts +++ b/lib/log.ts @@ -1,6 +1,6 @@ /** * By using `lib/log.ts`, your application gets easy scoped logging as well as - * integration with terminal widgets such as `lib/log/progress.ts`. + * integration with terminal widgets such as `lib/progress.ts`. * * The pattern for using this module is to shadow the global `console` with a * local scope: diff --git a/lib/log/progress.sample.ts b/lib/progress.sample.ts similarity index 97% rename from lib/log/progress.sample.ts rename to lib/progress.sample.ts index 8386b420fb4b5e26d6c298c213494c4810c8269e..efc12ce0005393cbda11b7e41aea148fefb6dae6 100644 --- a/lib/log/progress.sample.ts +++ b/lib/progress.sample.ts @@ -69,5 +69,5 @@ function random() { return Math.floor(Math.random() * 9999999).toString(32); } -import * as progress from "lib/log/progress.ts"; +import * as progress from "lib/progress.ts"; import * as timers from "node:timers/promises"; diff --git a/lib/log/progress.ts b/lib/progress.ts similarity index 99% rename from lib/log/progress.ts rename to lib/progress.ts index 85c60bd81d79b0e58560d7c45cc7d8e1768b825b..3f7b824c9db23367c7c93c819e1a2ef66639d911 100644 --- a/lib/log/progress.ts +++ b/lib/progress.ts @@ -251,7 +251,7 @@ function formatProgress(now: number, list: Internal[]): string { return out.trimEnd(); } -/** These functions are used to test `lib/log/progress` */ +/** These functions are used to test `lib/progress` */ export namespace internals { export function node( text: string, diff --git a/lib/readme.changes.md b/lib/readme.changes.md index ab60a01103611a0691b1ddaa1895f750edeaf7b2..b55c93839a1dee23bc165b8a58e02aec7d2a2730 100644 --- a/lib/readme.changes.md +++ b/lib/readme.changes.md @@ -1,5 +1,11 @@ # notable changes in clover's typescript library +## v3 + +### breaking + +- promote `log/progress.ts` to top level `progress.ts` + ## v2 ### breaking diff --git a/lib/readme.md b/lib/readme.md index 53639743a37e9c312fdf9bf30df0d0167bfeb61e..52af8270fdf59f5a34120d0ecd12e5a61546cd75 100644 --- a/lib/readme.md +++ b/lib/readme.md @@ -19,11 +19,11 @@ depend on each other. there are no external dependencies; code is easy to audit. - `error.ts` - interop with the `unknown` type in error handlers - `log.ts` - logging, terminal i/o, interactive widgets - `log/headless.ts` - use `log` and `log/progress` without a tty -- `log/progress.ts` - progress bar, spinner, and tree - `log/stack.ts` - stack trace parse and formatter - `Lru.ts` - least recently used cache - `mime.ts` - trimmed database of ext -> mime types - `node.ts` - the Node.js javascript runtime +- `progress.ts` - cli progress bars, nesting status indication - `queue.ts` - priority queue with rescheduling - `render.ts` - html generation with extensions. - `render/jsx-runtime.ts` - integration with JSX syntax diff --git a/lib/subprocess/ffmpeg.ts b/lib/subprocess/ffmpeg.ts index ee09a4f2560e07e24d1964d142c2501330088809..518cbd5d422b046300575d2fe6237f80d5ffb97c 100644 --- a/lib/subprocess/ffmpeg.ts +++ b/lib/subprocess/ffmpeg.ts @@ -8,7 +8,7 @@ export interface SpawnOptions { /** * Spawn an instance of `ffmpeg` and bind it's live status to the given * `progress.Node`. Logs are routed through the progress node, and dismissed on - * exit. `lib/log/progress.ts` will buffer and colocate the logs when running + * exit. `lib/progress.ts` will buffer and colocate the logs when running * parallel jobs. * * await ffmpeg.spawn({ @@ -194,5 +194,5 @@ import * as readline from "node:readline"; import * as process from "node:process"; import events from "node:events"; import * as path from "node:path"; -import type * as progress from "lib/log/progress.ts"; +import type * as progress from "lib/progress.ts"; import * as string from "lib/string.ts"; diff --git a/readme.md b/readme.md index ab8687cb566dd35ddad250f3fcac538e9a6a5733..adc27fd6e60601d720c7fa67488cca008d10baaa 100644 --- a/readme.md +++ b/readme.md @@ -24,7 +24,7 @@ tools power . - Dynamic pages. Static pages can be regenerated (and cached) at runtime. - Font subsetting to reduce page bandwidth. - **General purpose typescript libraries.** (See [`./lib`](./lib/readme.md)) - - [Logging](./lib/log.ts) and [progress](./lib/log/progress.ts) indicators. + - [Logging](./lib/log.ts) and [progress](./lib/progress.ts) indicators. - [Priority Queue](./lib/queue.ts) with automatic reschedulability. - [Meta Tags](./framework/lib/meta.ts) and Open Graph generation. - Databases with a minimal SQLite wrapper. diff --git a/src/deploy.ts b/src/deploy.ts index a0182e53766f1a927d5a09ad1337e6c7c24f2488..1fe508bea73ad73a38abc3896167f6867b847054 100644 --- a/src/deploy.ts +++ b/src/deploy.ts @@ -55,7 +55,7 @@ export async function main() { import * as incr from "../framework/incremental.ts"; import { generate } from "../framework/generate.ts"; -import * as progress from "lib/log/progress.ts"; +import * as progress from "lib/progress.ts"; import * as subprocess from "lib/subprocess.ts"; import * as rsync from "./file-viewer/rsync.ts"; import { Path } from "#sitegen/path"; diff --git a/src/file-viewer/bin/scan3.ts b/src/file-viewer/bin/scan3.ts index cfa40cd0f561de7413870e17f09ccf3983734a98..2269fab2d30e54e9b895c4a260531f744094ef29 100644 --- a/src/file-viewer/bin/scan3.ts +++ b/src/file-viewer/bin/scan3.ts @@ -1015,7 +1015,7 @@ import * as subprocess from "lib/subprocess.ts"; import { Path } from "#sitegen/path"; import * as queue from "../../../lib/queue.ts"; import * as log from "../../../lib/log.ts"; -import * as progress from "../../../lib/log/progress.ts"; +import * as progress from "lib/progress.ts"; import * as ts from "../../../lib/ts.ts"; import * as child_process from "node:child_process"; diff --git a/src/file-viewer/models/derived.ts b/src/file-viewer/models/derived.ts index 6ed3f1f78bba31af11fcb3c852c6ed7f59acb1a1..cf90ef90bda5e3e13ec7e7fc22641495913198c9 100644 --- a/src/file-viewer/models/derived.ts +++ b/src/file-viewer/models/derived.ts @@ -200,5 +200,5 @@ import { Path } from "#sitegen/path"; import * as fs from "node:fs"; import * as crypto from "node:crypto"; import * as queue from "lib/queue.ts"; -import * as progress from "lib/log/progress.ts"; +import * as progress from "lib/progress.ts"; import { ASSERT } from "lib/assert.ts"; diff --git a/src/file-viewer/rsync.ts b/src/file-viewer/rsync.ts index 925695d1af872dac7ef7e846f0aba347cedc6830..535c517dfd3083ff964ee4f4ae77e099c1dce1e9 100644 --- a/src/file-viewer/rsync.ts +++ b/src/file-viewer/rsync.ts @@ -183,5 +183,5 @@ export class Parse { import * as child_process from "node:child_process"; import * as readline from "node:readline"; import events from "node:events"; -import * as progress from "lib/log/progress.ts"; +import * as progress from "lib/progress.ts"; import { formatSize } from "@/file-viewer/format.ts"; diff --git a/src/package-lib.ts b/src/package-lib.ts index c2cc080675f5dd313cb7f303709e9848dd9d4181..b26cde479d91bcbcb1e0ebf7d9009b7a1b0dc313 100644 --- a/src/package-lib.ts +++ b/src/package-lib.ts @@ -219,7 +219,7 @@ export function main() { ); } -import * as progress from "lib/log/progress.ts"; +import * as progress from "lib/progress.ts"; import * as path from "node:path"; import * as fs from "node:fs/promises"; import * as subprocess from "lib/subprocess.ts"; -- 2.54.0