authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-03-17 23:32:00-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-03-17 23:39:00-07:00
log3caa2f2be2dca66f2a3f44d3a85a4bf7c7270534
treeb624485e6b46ab0684a61b3aa00be40209928e74
parent6d7576c0766ee4fd023aae3db1fc4ca9f35e9791
signature Signed by SSH key SHA256:xbd+BjjhyBfwk7GVoURf9Yx0gzDerHbvYv7SddNWmAs

chore: use more canonical import names

- `@/file.ts` -> `#src/file.ts` matching Node.js standards - `lib` -> `@clo/lib` matching what i publish it as

65 files changed, 169 insertions(+), 209 deletions(-)

framework/backend/entry-node.ts+1-1
......@@ -42,4 +42,4 @@ import * as os from "os";
4242import * as url from "node:url";
4343import { serve } from "@hono/node-server";
4444import process from "node:process";
45import * as console from "lib/log.ts";
45import * as console from "@clo/lib/log.ts";
framework/bundle.ts+4-7
......@@ -37,7 +37,6 @@ export async function bundleClientJavaScript(
3737 }
3838
3939 const clientPlugins: esbuild.Plugin[] = [
40 projectRelativeResolution(),
4140 markoViaBuildCache(),
4241 {
4342 name: "mark css external",
......@@ -250,7 +249,6 @@ export async function bundleServerJavaScript({
250249 return view.file;
251250 },
252251 }),
253 projectRelativeResolution(),
254252 markoViaBuildCache(),
255253 {
256254 name: "replace client references",
......@@ -301,7 +299,7 @@ export async function bundleServerJavaScript({
301299 "globalThis.CLOVER_SERVER_ENTRY": JSON.stringify(entry),
302300 },
303301 external: Object.keys(pkg.dependencies).filter(
304 (x) => x !== "lib",
302 (x) => x !== "@clo/lib",
305303 ),
306304 });
307305 await trackEsbuild(io, metafile);
......@@ -391,7 +389,6 @@ import * as hot from "./hot.ts";
391389import {
392390 isIgnoredSource,
393391 markoViaBuildCache,
394 projectRelativeResolution,
395392 virtualFiles,
396393} from "./esbuild-support.ts";
397394import { Io, toAbs } from "./incremental.ts";
......@@ -400,6 +397,6 @@ import * as incr from "./incremental.ts";
400397import * as sg from "#sitegen";
401398import type { PageOrView } from "./generate.ts";
402399import type * as view from "#sitegen/view";
403import * as meta from "lib/render/meta.ts";
404import * as progress from "lib/progress.ts";
405import { ASSERT, UNWRAP } from "lib/assert.ts";
400import * as meta from "@clo/lib/render/meta.ts";
401import * as progress from "@clo/lib/progress.ts";
402import { ASSERT, UNWRAP } from "@clo/lib/assert.ts";
framework/css.ts+1-1
......@@ -116,4 +116,4 @@ import * as hot from "./hot.ts";
116116import * as path from "node:path";
117117import { virtualFiles } from "./esbuild-support.ts";
118118import type { Io } from "./incremental.ts";
119import { UNWRAP } from "lib/assert.ts";
119import { UNWRAP } from "@clo/lib/assert.ts";
framework/esbuild-support.ts+1-19
......@@ -61,24 +61,6 @@ export function banFiles(
6161 } satisfies esbuild.Plugin;
6262}
6363
64export function projectRelativeResolution(root = process.cwd() + "/src") {
65 return {
66 name: "project relative resolution ('@/' prefix)",
67 setup(b) {
68 b.onResolve({ filter: /^@\// }, ({ path: id }) => {
69 return {
70 path: path.resolve(root, id.slice(2)),
71 };
72 });
73 b.onResolve({ filter: /^#/ }, ({ path: id, importer }) => {
74 return {
75 path: hot.resolveFrom(importer, id),
76 };
77 });
78 },
79 } satisfies esbuild.Plugin;
80}
81
8264export function markoViaBuildCache(): esbuild.Plugin {
8365 return {
8466 name: "marko via build cache",
......@@ -112,7 +94,7 @@ export function isIgnoredSource(source: string) {
11294}
11395
11496import * as esbuild from "esbuild";
115import * as string from "lib/string.ts";
97import * as string from "@clo/lib/string.ts";
11698import * as path from "node:path";
11799import * as fs from "#sitegen/fs";
118100import * as hot from "./hot.ts";
framework/font.ts+5-5
......@@ -143,7 +143,7 @@ export async function fetchFont(name: string, sources: string[]) {
143143 : process.platform === "darwin"
144144 ? [
145145 "/Library/Fonts",
146 path.posix.join(home, "Library/Fonts"),
146 path.posix.join(home, "@clo/library/Fonts"),
147147 ]
148148 : [
149149 "/usr/share/fonts",
......@@ -211,10 +211,10 @@ import * as fs from "#sitegen/fs";
211211import * as os from "node:os";
212212import * as path from "node:path";
213213import * as sg from "#sitegen";
214import * as subprocess from "lib/subprocess.ts";
214import * as subprocess from "@clo/lib/subprocess.ts";
215215import * as incr from "./incremental.ts";
216216import * as crypto from "node:crypto";
217import * as async from "lib/async.ts";
218import * as error from "lib/error.ts";
217import * as async from "@clo/lib/async.ts";
218import * as error from "@clo/lib/error.ts";
219219import * as progress from "../lib/progress.ts";
220import { ASSERT } from "lib/assert.ts";
220import { ASSERT } from "@clo/lib/assert.ts";
framework/generate.ts+4-4
......@@ -414,12 +414,12 @@ export type PageOrView = PreparedPage | PreparedView;
414414import * as path from "node:path";
415415
416416import * as fs from "#sitegen/fs";
417import * as meta from "lib/render/meta.ts";
418import * as render from "lib/render.ts";
417import * as meta from "@clo/lib/render/meta.ts";
418import * as render from "@clo/lib/render.ts";
419419import * as sg from "#sitegen";
420420import type { FileItem } from "#sitegen";
421421import * as progress from "../lib/progress.ts";
422import * as error from "lib/error.ts";
422import * as error from "@clo/lib/error.ts";
423423
424424import SitegenWrap from "./sitegen-wrap.marko";
425425
......@@ -429,4 +429,4 @@ import * as fonts from "./font.ts";
429429import * as hot from "./hot.ts";
430430import * as incr from "./incremental.ts";
431431import { Io } from "./incremental.ts";
432import { ASSERT, UNWRAP } from "lib/assert.ts";
432import { ASSERT, UNWRAP } from "@clo/lib/assert.ts";
framework/hot.ts+1-20
......@@ -90,25 +90,6 @@ Module.prototype._compile = function (
9090 return result;
9191};
9292
93// Implement @/ prefix
94const ModuleUnderscoreResolveFilename = Module._resolveFilename;
95Module._resolveFilename = (...args) => {
96 if (args[0].startsWith("@/")) {
97 const replacedPath = "." + args[0].slice(1);
98 try {
99 return require.resolve(replacedPath, { paths: [projectSrc] });
100 } catch (err: any) {
101 if (
102 err.code === "MODULE_NOT_FOUND" &&
103 (err?.requireStack?.length ?? 0) <= 1
104 ) {
105 err.message.replace(replacedPath, args[0]);
106 }
107 }
108 }
109 return ModuleUnderscoreResolveFilename(...args);
110};
111
11293function loadEsbuild(module: NodeJS.Module, filepath: string) {
11394 return loadEsbuildCode(module, filepath, fs.readFileSync(filepath, "utf8"));
11495}
......@@ -323,4 +304,4 @@ import * as esbuild from "esbuild";
323304import { createRequire } from "node:module";
324305import * as self from "./hot.ts";
325306import { Buffer } from "node:buffer";
326import { UNWRAP } from "lib/assert.ts";
307import { UNWRAP } from "@clo/lib/assert.ts";
framework/incremental.ts+5-5
......@@ -728,7 +728,7 @@ const zstdCompress = util.promisify(zlib.zstdCompress);
728728import * as hot from "./hot.ts";
729729
730730import * as fs from "#sitegen/fs";
731import * as mime from "lib/mime.ts";
731import * as mime from "@clo/lib/mime.ts";
732732import * as manifest from "#sitegen/assets";
733733
734734import * as path from "node:path";
......@@ -736,9 +736,9 @@ import * as util from "node:util";
736736import * as crypto from "node:crypto";
737737import * as zlib from "node:zlib";
738738
739import * as progress from "lib/progress.ts";
740import * as stack from "lib/log/stack.ts";
741import { formatSize } from "@/file-viewer/format.ts";
739import * as progress from "@clo/lib/progress.ts";
740import * as stack from "@clo/lib/log/stack.ts";
741import { formatSize } from "#src/file-viewer/format.ts";
742742
743743import * as msgpackr from "msgpackr";
744import { ASSERT, UNWRAP } from "lib/assert.ts";
744import { ASSERT, UNWRAP } from "@clo/lib/assert.ts";
framework/lib/assets.ts+2-2
......@@ -285,5 +285,5 @@ import type { AssetKey as Key } from "../../.clover/ts/asset.d.ts";
285285import * as crypto from "node:crypto";
286286import * as zlib from "node:zlib";
287287import * as util from "node:util";
288import * as log from "lib/log.ts";
289import { ASSERT, UNWRAP } from "lib/assert.ts";
288import * as log from "@clo/lib/log.ts";
289import { ASSERT, UNWRAP } from "@clo/lib/assert.ts";
framework/lib/path.ts+2-2
......@@ -211,6 +211,6 @@ export class Path {
211211import * as path from "node:path";
212212import * as fs from "./fs.ts";
213213import * as util from "node:util";
214import * as error from "lib/error.ts";
214import * as error from "@clo/lib/error.ts";
215215import type { RmOptions } from "node:fs";
216import { ASSERT } from "lib/assert.ts";
216import { ASSERT } from "@clo/lib/assert.ts";
framework/lib/sitegen.ts+3-3
......@@ -100,7 +100,7 @@ export function joinScripts(scriptSources: string[]) {
100100
101101export { default as CloverScriptInclude } from "./add-script.marko";
102102
103import * as render from "lib/render.ts";
104import type * as meta from "lib/render/meta.ts";
103import * as render from "@clo/lib/render.ts";
104import type * as meta from "@clo/lib/render/meta.ts";
105105import type * as css from "../css.ts";
106import { UNWRAP } from "lib/assert.ts";
106import { UNWRAP } from "@clo/lib/assert.ts";
framework/lib/view.ts+3-3
......@@ -117,14 +117,14 @@ export function regenerate(tag: RegenKey) {
117117 }
118118}
119119
120import * as meta from "lib/render/meta.ts";
120import * as meta from "@clo/lib/render/meta.ts";
121121import type * as hono from "#hono";
122import * as render from "lib/render.ts";
122import * as render from "@clo/lib/render.ts";
123123import * as sg from "./sitegen.ts";
124124import * as asset from "./assets.ts";
125125import type {
126126 RegenKey,
127127 RegisteredViews as ViewMap,
128128} from "../../.clover/ts/view.d.ts";
129import { UNWRAP } from "lib/assert.ts";
129import { UNWRAP } from "@clo/lib/assert.ts";
130130import SitegenWrap from "../sitegen-wrap.marko";
framework/watch.ts+1-1
......@@ -170,4 +170,4 @@ import * as generate from "./generate.ts";
170170import * as incr from "./incremental.ts";
171171import * as path from "node:path";
172172import * as util from "node:util";
173import * as subprocess from "lib/subprocess.ts";
173import * as subprocess from "@clo/lib/subprocess.ts";
lib/deno.json+3-3
......@@ -29,11 +29,11 @@
2929 },
3030 "compilerOptions": {
3131 "jsx": "react-jsx",
32 "jsxImportSource": "lib/render"
32 "jsxImportSource": "@clo/lib/render"
3333 },
3434 "imports": {
35 "lib/render/jsx-runtime": "./render/jsx-runtime.ts",
36 "lib/render/jsx-dev-runtime": "./render/jsx-runtime.ts"
35 "@clo/lib/render/jsx-runtime": "./render/jsx-runtime.ts",
36 "@clo/lib/render/jsx-dev-runtime": "./render/jsx-runtime.ts"
3737 },
3838 "exclude": [
3939 "readme.npm.md",
lib/log/stack.ts+1-1
......@@ -19,7 +19,7 @@
1919 * }
2020 *
2121 * import * as fs from "node:fs";
22 * import * as stack from "lib/log/stack.ts";
22 * import * as stack from "@clo/lib/log/stack.ts";
2323 * ```
2424 *
2525 * @module
lib/mime.test.ts+1-1
......@@ -25,4 +25,4 @@ test("for", () => {
2525
2626import { test } from "node:test";
2727import assert from "node:assert";
28import * as mime from "lib/mime.ts";
28import * as mime from "@clo/lib/mime.ts";
lib/progress.ts+1-1
......@@ -74,7 +74,7 @@ export function start(text: string, opts?: StartOptions): Node {
7474 *
7575 * ```ts
7676 * await ffmpeg.spawn({
77 * cmd: ["-i", "hello.mov", "-c:v", "libsvtav1", "hello.mp4"],
77 * cmd: ["-i", "hello.mov", "-c:v", "@clo/libsvtav1", "hello.mp4"],
7878 * progress: progress.start("encode hello.mov"),
7979 * });
8080 * ```
lib/string/ansi.test.ts+1-1
......@@ -21,4 +21,4 @@ test("trimToWidth", () => {
2121
2222import { test } from "node:test";
2323import assert from "node:assert";
24import * as ansi from "lib/string/ansi.ts";
24import * as ansi from "@clo/lib/string/ansi.ts";
lib/subprocess/ffmpeg.ts+1-1
......@@ -13,7 +13,7 @@ export interface SpawnOptions {
1313 *
1414 * ```ts
1515 * await ffmpeg.spawn({
16 * cmd: ["-i", "hello.mov", "-c:v", "libsvtav1", "hello.mp4"],
16 * cmd: ["-i", "hello.mov", "-c:v", "@clo/libsvtav1", "hello.mp4"],
1717 * progress: progress.start("encode hello.mov"),
1818 * });
1919 * ```
package-lock.json+6-6
......@@ -5,6 +5,7 @@
55 "packages": {
66 "": {
77 "dependencies": {
8 "@clo/lib": "file:lib",
89 "@clo/markodown": "npm:@paperclover/markodown@rc",
910 "@hono/node-server": "1.14.3",
1011 "@marko/compiler": "^5.39.55",
......@@ -15,7 +16,6 @@
1516 "esbuild": "0.25.5",
1617 "hls.js": "1.6.5",
1718 "hono": "4.11.9",
18 "lib": "file:lib",
1919 "marko": "^5.38.24",
2020 "msgpackr": "1.11.5",
2121 "playwright": "1.58.2",
......@@ -26,7 +26,11 @@
2626 "vscode-textmate": "9.2.0"
2727 }
2828 },
29 "lib": {},
29 "@clo/lib": {},
30 "node_modules/@clo/lib": {
31 "resolved": "@clo/lib",
32 "link": true
33 },
3034 "node_modules/@clo/markodown": {
3135 "name": "@paperclover/markodown",
3236 "version": "1.0.0-rc.15",
......@@ -1077,10 +1081,6 @@
10771081 "lasso-caching-fs": "^1.0.0"
10781082 }
10791083 },
1080 "node_modules/lib": {
1081 "resolved": "lib",
1082 "link": true
1083 },
10841084 "node_modules/lie": {
10851085 "version": "3.1.1",
10861086 "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
package.json+2-1
......@@ -11,7 +11,7 @@
1111 "esbuild": "0.25.5",
1212 "hls.js": "1.6.5",
1313 "hono": "4.11.9",
14 "lib": "file:lib",
14 "@clo/lib": "file:lib",
1515 "marko": "^5.38.24",
1616 "msgpackr": "1.11.5",
1717 "playwright": "1.58.2",
......@@ -22,6 +22,7 @@
2222 "vscode-textmate": "9.2.0"
2323 },
2424 "imports": {
25 "#src/*": "./src/*",
2526 "#sitegen": "./framework/lib/sitegen.ts",
2627 "#sitegen/*": "./framework/lib/*.ts",
2728 "#jsx/jsx-runtime": "./lib/render/jsx-runtime.ts",
src/backend.ts+1-1
......@@ -64,4 +64,4 @@ import { logger } from "hono/logger";
6464import { trimTrailingSlash } from "hono/trailing-slash";
6565import * as assets from "#sitegen/assets";
6666import * as admin from "./admin.ts";
67import * as log from "lib/log.ts";
67import * as log from "@clo/lib/log.ts";
src/bin/deploy.ts+2-2
......@@ -55,7 +55,7 @@ export async function main() {
5555
5656import * as incr from "../../framework/incremental.ts";
5757import { generate } from "../../framework/generate.ts";
58import * as progress from "lib/progress.ts";
59import * as subprocess from "lib/subprocess.ts";
58import * as progress from "@clo/lib/progress.ts";
59import * as subprocess from "@clo/lib/subprocess.ts";
6060import * as rsync from "../file-viewer/rsync.ts";
6161import { Path } from "#sitegen/path";
src/bin/download-db.ts+1-1
......@@ -21,6 +21,6 @@ export async function main() {
2121 });
2222}
2323
24import * as progress from "lib/progress.ts";
24import * as progress from "@clo/lib/progress.ts";
2525import * as rsync from "../file-viewer/rsync.ts";
2626import { Path } from "#sitegen/path";
src/bin/package-lib.ts+2-2
......@@ -21,10 +21,10 @@ export async function updateJsrPackageExportsToAll(
2121}
2222
2323export async function main() {
24 const main = path.resolve("lib");
24 const main = path.resolve("@clo/lib");
2525 await updateJsrPackageExportsToAll(main, progress);
2626}
2727
28import * as progress from "lib/progress.ts";
28import * as progress from "@clo/lib/progress.ts";
2929import * as path from "node:path";
3030import * as fs from "node:fs/promises";
src/blog/drafts/webdev/marko-intro.markodown+7-7
......@@ -5,7 +5,7 @@ export const blog: BlogMeta = {
55 draft: true,
66};
77export const meta = formatBlogMeta(blob);
8export * as layout from "@/blog/layout.tsx";
8export * as layout from "#src/blog/layout.tsx";
99
1010I've been recently playing around [Marko], and after adding limited support
1111for it in my website generator, [sitegen], I instantly fell in love with how
......@@ -287,8 +287,8 @@ function Page() {
287287console.info(render.sync(<Page />).text);
288288
289289import * as render from "#engine/render";
290import QuestionRender from "@/q+a/tags/question.marko";
291import { Question } from "@/q+a/models/Question.ts";
290import QuestionRender from "#src/q+a/tags/question.marko";
291import { Question } from "#src/q+a/models/Question.ts";
292292```
293293
294294Here is the `question.marko` tag used to render [questions on the clover q+a](/q+a).
......@@ -328,12 +328,12 @@ export const transitionDate = 1735639200000;
328328// this singleton script will make all the '<time>' tags clickable.
329329client import "./clickable-links.client.ts";
330330
331import type { Question } from "@/q+a/models/Question.ts";
332import { formatQuestionTimestamp, formatQuestionISOTimestamp } from "@/q+a/format.ts";
333import { QuestionMarkdown } from "@/q+a/markdown.tsx";
331import type { Question } from "#src/q+a/models/Question.ts";
332import { formatQuestionTimestamp, formatQuestionISOTimestamp } from "#src/q+a/format.ts";
333import { QuestionMarkdown } from "#src/q+a/markdown.tsx";
334334```
335335
336336The integration is great, `client import` is quite a magical concept, and I've
337337tuned it to do the expected thing in my framework.
338338
339import { type BlogMeta, formatBlogMeta } from '@/blog/helpers.ts';
339import { type BlogMeta, formatBlogMeta } from '#src/blog/helpers.ts';
src/blog/localization.tsx+1-1
......@@ -31,4 +31,4 @@ export const languages: LanguageMap = {
3131 },
3232};
3333
34import * as render from "lib/render.ts";
34import * as render from "@clo/lib/render.ts";
src/blog/pages/webdev/one-year-next-app-router/en.mdo+1-1
......@@ -1,5 +1,5 @@
11---
2layout: "@/blog/tags/blog-layout.marko"
2layout: "#src/blog/tags/blog-layout.marko"
33meta:
44 title: One Year with Next.js App Router — Why We're Moving On
55 description: A critique of React Server Components and Next.js 15.
src/blog/pages/webdev/one-year-next-app-router/es.mdo+1-1
......@@ -1,5 +1,5 @@
11---
2layout: "@/blog/tags/blog-layout.marko"
2layout: "#src/blog/tags/blog-layout.marko"
33meta:
44 title: Un año con el enrutador de aplicación (App Router) de Next.js — por qué decidimos cambiar
55 description: Una crítica de los componentes de servidor de React y Next.js 15.
src/blog/pages/webdev/one-year-next-app-router/ko.mdo+1-1
......@@ -1,5 +1,5 @@
11---
2layout: "@/blog/tags/blog-layout.marko"
2layout: "#src/blog/tags/blog-layout.marko"
33meta:
44 title: Next.js 앱 라우터와 함께한 1년 — 우리가 떠나기로 한 이유
55 description: 리액트 서버 컴포넌트와 Next.js 15에 대한 비판
src/blog/tags/blog-layout.marko+1-1
......@@ -104,4 +104,4 @@ import * as markodown from "@clo/markodown";
104104import Heading from "./heading.marko";
105105import CodeBlock from "./code-block.marko";
106106import { Path } from "#sitegen/path";
107import { UNWRAP } from "lib/assert.ts";
107import { UNWRAP } from "@clo/lib/assert.ts";
src/blog/tags/code-block.marko+1-1
......@@ -12,4 +12,4 @@
1212</>
1313</figure>
1414
15import * as highlight from "@/file-viewer/highlight.ts";
15import * as highlight from "#src/file-viewer/highlight.ts";
src/file-viewer/backend.tsx+11-11
......@@ -313,17 +313,17 @@ function getPartialPage(c: Context, rawFilePath: string) {
313313
314314import { type Context, Hono } from "hono";
315315
316import * as render from "lib/render.ts";
316import * as render from "@clo/lib/render.ts";
317317import { etagMatches, serveAsset } from "#sitegen/assets";
318318import * as view from "#sitegen/view";
319import * as mime from "lib/mime.ts";
320
321import { getForFile, requireFriendAuth } from "@/friend-auth.ts";
322import { MediaFile, MediaFileKind } from "@/file-viewer/models/MediaFile.ts";
323import { FilePermissions } from "@/file-viewer/models/FilePermissions.ts";
324import { MediaPanel } from "@/file-viewer/views/clofi.tsx";
325import { Speedbump } from "@/file-viewer/cotyledon.tsx";
326import * as cache from "@/file-viewer/cache.ts";
327import * as derived from "@/file-viewer/models/derived.ts";
328import { UNWRAP } from "lib/assert.ts";
319import * as mime from "@clo/lib/mime.ts";
320
321import { getForFile, requireFriendAuth } from "#src/friend-auth.ts";
322import { MediaFile, MediaFileKind } from "#src/file-viewer/models/MediaFile.ts";
323import { FilePermissions } from "#src/file-viewer/models/FilePermissions.ts";
324import { MediaPanel } from "#src/file-viewer/views/clofi.tsx";
325import { Speedbump } from "#src/file-viewer/cotyledon.tsx";
326import * as cache from "#src/file-viewer/cache.ts";
327import * as derived from "#src/file-viewer/models/derived.ts";
328import { UNWRAP } from "@clo/lib/assert.ts";
329329import { escapeUri } from "./format.ts";
src/file-viewer/bin/file-scan.ts+13-13
......@@ -1024,13 +1024,13 @@ async function scrubLocationMetadata(
10241024
10251025const monthMilliseconds = 30 * 24 * 60 * 60 * 1000;
10261026
1027import * as async from "lib/async.ts";
1027import * as async from "@clo/lib/async.ts";
10281028import * as fs from "#sitegen/fs";
1029import * as subprocess from "lib/subprocess.ts";
1029import * as subprocess from "@clo/lib/subprocess.ts";
10301030import { Path } from "#sitegen/path";
10311031import * as queue from "../../../lib/queue.ts";
10321032import * as log from "../../../lib/log.ts";
1033import * as progress from "lib/progress.ts";
1033import * as progress from "@clo/lib/progress.ts";
10341034import * as ts from "../../../lib/ts.ts";
10351035
10361036import * as child_process from "node:child_process";
......@@ -1040,19 +1040,19 @@ import * as path from "node:path";
10401040import * as stream from "node:stream";
10411041import * as zlib from "node:zlib";
10421042
1043import { MediaFile, MediaFileKind } from "@/file-viewer/models/MediaFile.ts";
1044import { FilePermissions } from "@/file-viewer/models/FilePermissions.ts";
1043import { MediaFile, MediaFileKind } from "#src/file-viewer/models/MediaFile.ts";
1044import { FilePermissions } from "#src/file-viewer/models/FilePermissions.ts";
10451045import {
10461046 formatDate,
10471047 formatDurationLong,
10481048 formatSize,
1049} from "@/file-viewer/format.ts";
1050import * as rules from "@/file-viewer/rules.ts";
1051import * as highlight from "@/file-viewer/highlight.ts";
1052import * as ffmpeg from "lib/subprocess/ffmpeg.ts";
1053import * as rsync from "@/file-viewer/rsync.ts";
1054import * as derived from "@/file-viewer/models/derived.ts";
1055import * as transcodeRules from "@/file-viewer/transcode-rules.ts";
1049} from "#src/file-viewer/format.ts";
1050import * as rules from "#src/file-viewer/rules.ts";
1051import * as highlight from "#src/file-viewer/highlight.ts";
1052import * as ffmpeg from "@clo/lib/subprocess/ffmpeg.ts";
1053import * as rsync from "#src/file-viewer/rsync.ts";
1054import * as derived from "#src/file-viewer/models/derived.ts";
1055import * as transcodeRules from "#src/file-viewer/transcode-rules.ts";
10561056
10571057import { rawFileRoot as root } from "../paths.ts";
1058import { ASSERT, UNWRAP } from "lib/assert.ts";
1058import { ASSERT, UNWRAP } from "@clo/lib/assert.ts";
src/file-viewer/bin/file-trim.ts+1-1
......@@ -14,5 +14,5 @@ export async function main() {
1414 // TODO: delete unreferenced files
1515}
1616
17import * as log from "lib/log.ts";
17import * as log from "@clo/lib/log.ts";
1818import * as derived from "../models/derived.ts";
src/file-viewer/cache.ts+6-6
......@@ -600,17 +600,17 @@ async function writeStream(
600600import * as util from "node:util";
601601import * as fsCallbacks from "node:fs";
602602import * as fs from "#sitegen/fs";
603import * as async from "lib/async.ts";
604import * as error from "lib/error.ts";
603import * as async from "@clo/lib/async.ts";
604import * as error from "@clo/lib/error.ts";
605605import * as stream from "node:stream";
606606import * as crypto from "node:crypto";
607607import * as http from "node:http";
608608import * as https from "node:https";
609609import * as paths from "./paths.ts";
610import * as log from "lib/log.ts";
610import * as log from "@clo/lib/log.ts";
611611import { MediaFile } from "./models/MediaFile.ts";
612612import type { ReadableStream } from "node:stream/web";
613import { Lru } from "lib/Lru.ts";
613import { Lru } from "@clo/lib/Lru.ts";
614614import { Path } from "#sitegen/path";
615import { ASSERT, UNWRAP } from "lib/assert.ts";
616import * as ts from "lib/ts.ts";
615import { ASSERT, UNWRAP } from "@clo/lib/assert.ts";
616import * as ts from "@clo/lib/ts.ts";
src/file-viewer/format.ts+2-2
......@@ -287,5 +287,5 @@ export function formatDate(dateTime: Date) {
287287 }.${dateTime.getFullYear().toString().slice(2)}`;
288288}
289289
290import type { MediaFile } from "@/file-viewer/models/MediaFile.ts";
291import { escapeHtml } from "lib/render.ts";
290import type { MediaFile } from "#src/file-viewer/models/MediaFile.ts";
291import { escapeHtml } from "@clo/lib/render.ts";
src/file-viewer/highlight.ts+2-2
......@@ -215,9 +215,9 @@ export async function highlightCode(code: string, language: Language) {
215215// "tsx",
216216// );
217217//
218import * as async from "lib/async.ts";
218import * as async from "@clo/lib/async.ts";
219219import * as fs from "#sitegen/fs";
220220import * as path from "node:path";
221221import * as oniguruma from "vscode-oniguruma";
222222import * as textmate from "vscode-textmate";
223import * as render from "lib/render.ts";
223import * as render from "@clo/lib/render.ts";
src/file-viewer/models/MediaFile.ts+1-1
......@@ -464,4 +464,4 @@ const getDirectoriesToReindexQuery = db.prepare(`
464464import { getDb } from "#sitegen/sqlite";
465465import * as path from "node:path/posix";
466466import { FilePermissions } from "./FilePermissions.ts";
467import { ASSERT } from "lib/assert.ts";
467import { ASSERT } from "@clo/lib/assert.ts";
src/file-viewer/models/derived.ts+3-3
......@@ -217,6 +217,6 @@ import type { MediaFile } from "./MediaFile.ts";
217217import { Path } from "#sitegen/path";
218218import * as fs from "node:fs";
219219import * as crypto from "node:crypto";
220import * as queue from "lib/queue.ts";
221import * as progress from "lib/progress.ts";
222import { ASSERT } from "lib/assert.ts";
220import * as queue from "@clo/lib/queue.ts";
221import * as progress from "@clo/lib/progress.ts";
222import { ASSERT } from "@clo/lib/assert.ts";
src/file-viewer/pages/file.cotyledon-enterance.tsx+2-2
......@@ -1,6 +1,6 @@
1import { MediaFile } from "@/file-viewer/models/MediaFile.ts";
1import { MediaFile } from "#src/file-viewer/models/MediaFile.ts";
22import { addScript } from "#sitegen";
3import { Readme } from "@/file-viewer/cotyledon.tsx";
3import { Readme } from "#src/file-viewer/cotyledon.tsx";
44import { MediaPanel } from "../views/clofi.tsx";
55
66export const theme = {
src/file-viewer/rsync.ts+3-3
......@@ -183,7 +183,7 @@ export class Parse {
183183import * as child_process from "node:child_process";
184184import * as readline from "node:readline";
185185import events from "node:events";
186import * as progress from "lib/progress.ts";
187import { formatSize } from "@/file-viewer/format.ts";
188import { UNWRAP } from "lib/assert.ts";
186import * as progress from "@clo/lib/progress.ts";
187import { formatSize } from "#src/file-viewer/format.ts";
188import { UNWRAP } from "@clo/lib/assert.ts";
189189import { Path } from "#sitegen/path";
src/file-viewer/rules.ts+1-1
......@@ -153,5 +153,5 @@ const pathToCanvas = new Map<string, string>(Object.entries({
153153}));
154154
155155import type * as highlight from "./highlight.ts";
156import { MediaFile, MediaFileKind } from "@/file-viewer/models/MediaFile.ts";
156import { MediaFile, MediaFileKind } from "#src/file-viewer/models/MediaFile.ts";
157157import * as path from "node:path";
src/file-viewer/transcode-rules.ts+7-7
......@@ -73,7 +73,7 @@ export const imagePresets = [
7373 ext: ".avif",
7474 args: [
7575 "-c:v",
76 "libaom-av1",
76 "@clo/libaom-av1",
7777 "-crf",
7878 "30",
7979 "-pix_fmt",
......@@ -84,7 +84,7 @@ export const imagePresets = [
8484 ext: ".jxl",
8585 args: [
8686 "-c:v",
87 "libjxl",
87 "@clo/libjxl",
8888 "-distance",
8989 "0.8",
9090 "-effort",
......@@ -148,7 +148,7 @@ export function getAv1VideoArgs(
148148 const { preset, mbitMax, crf, maxHeight, depth } = av1;
149149 const cmd = [...videoInputArgs];
150150
151 cmd.push("-c:v", "libsvtav1");
151 cmd.push("-c:v", "@clo/libsvtav1");
152152 cmd.push(
153153 "-svtav1-params",
154154 [
......@@ -183,7 +183,7 @@ export function getOpusAudioArgs(
183183
184184 cmd.push("-vn");
185185
186 cmd.push("-c:a", "libopus");
186 cmd.push("-c:a", "@clo/libopus");
187187 cmd.push("-b:a", audioKbit + "k");
188188
189189 cmd.push("-y");
......@@ -264,7 +264,7 @@ export function getH264HlsArgs(
264264 const aIdx = i * 2 + 1;
265265 // deno-fmt-ignore
266266 cmd.push(
267 `-c:${vIdx}`, "libx264",
267 `-c:${vIdx}`, "@clo/libx264",
268268 `-b:v:${vIdx}`, preset.videoBitrate,
269269 `-filter:${vIdx}`, `scale=-2:min(${preset.maxHeight}\\,ih)`,
270270 `-c:${aIdx}`, "aac",
......@@ -285,7 +285,7 @@ export function getH264HlsArgs(
285285 hlsPresets.forEach((preset, i) => {
286286 // deno-fmt-ignore
287287 cmd.push(
288 `-c:v:${i}`, "libx264",
288 `-c:v:${i}`, "@clo/libx264",
289289 `-b:v:${i}`, preset.videoBitrate,
290290 `-filter:v:${i}`, `scale=-2:min(${preset.maxHeight}\\,ih)`,
291291 );
......@@ -314,4 +314,4 @@ export function getH264HlsArgs(
314314}
315315
316316import type { Path } from "#sitegen/path";
317import * as ffmpeg from "lib/subprocess/ffmpeg.ts";
317import * as ffmpeg from "@clo/lib/subprocess/ffmpeg.ts";
src/file-viewer/views/clofi.tsx+8-8
......@@ -925,7 +925,7 @@ CodeView.class = "code";
925925import "./clofi.css";
926926import assert from "node:assert";
927927import path, { dirname } from "node:path";
928import { MediaFile, MediaFileKind } from "@/file-viewer/models/MediaFile.ts";
928import { MediaFile, MediaFileKind } from "#src/file-viewer/models/MediaFile.ts";
929929import { addScript } from "#sitegen";
930930import {
931931 escapeUri,
......@@ -934,11 +934,11 @@ import {
934934 highlightConvo,
935935 highlightHashComments,
936936 highlightLinksInTextView,
937} from "@/file-viewer/format.ts";
938import { ForEveryone } from "@/file-viewer/cotyledon.tsx";
939import * as mime from "lib/mime.ts";
937} from "#src/file-viewer/format.ts";
938import { ForEveryone } from "#src/file-viewer/cotyledon.tsx";
939import * as mime from "@clo/lib/mime.ts";
940940import * as sort from "../sort.ts";
941import CloverVideo from "@/tags/clover-video.marko";
942import Image from "@/tags/image.tsx";
943import * as render from "lib/render.ts";
944import { UNWRAP } from "lib/assert.ts";
941import CloverVideo from "#src/tags/clover-video.marko";
942import Image from "#src/tags/image.tsx";
943import * as render from "@clo/lib/render.ts";
944import { UNWRAP } from "@clo/lib/assert.ts";
src/file-viewer/views/lofi.marko+3-3
......@@ -66,6 +66,6 @@ export { meta, theme } from "./clofi.tsx";
6666</div>
6767
6868import * as path from "node:path";
69import { escapeUri, formatDuration, formatSize, formatDate } from "@/file-viewer/format.ts";
70import { MediaFileKind } from "@/file-viewer/models/MediaFile.ts";
71import * as sort from "@/file-viewer/sort.ts";
69import { escapeUri, formatDuration, formatSize, formatDate } from "#src/file-viewer/format.ts";
70import { MediaFileKind } from "#src/file-viewer/models/MediaFile.ts";
71import * as sort from "#src/file-viewer/sort.ts";
src/q+a/image.tsx+2-2
......@@ -73,7 +73,7 @@ export async function getQuestionImage(
7373import * as crypto from "node:crypto";
7474import * as fs from "#sitegen/fs";
7575import * as path from "node:path";
76import { Question } from "@/q+a/models/Question.ts";
77import { RefCountedExpirable } from "lib/async.ts";
76import { Question } from "#src/q+a/models/Question.ts";
77import { RefCountedExpirable } from "@clo/lib/async.ts";
7878import * as view from "#sitegen/view";
7979import * as playwright from "playwright";
src/q+a/markdown.tsx+1-1
......@@ -76,6 +76,6 @@ export function renderMarkdown(source: string) {
7676}
7777
7878import * as markodown from "@clo/markodown";
79import * as render from "lib/render.ts";
79import * as render from "@clo/lib/render.ts";
8080import { artifactMap } from "./artifacts.ts";
8181import { formatQuestionTimestamp, questionIdToTimestamp } from "./format.ts";
src/q+a/pages/admin.q+a.marko+1-1
......@@ -23,4 +23,4 @@ export const regenerate = {
2323<MainPage admin />
2424
2525import MainPage from "./q+a.marko";
26import { PendingQuestion } from "@/q+a/models/PendingQuestion.ts";
26import { PendingQuestion } from "#src/q+a/models/PendingQuestion.ts";
src/q+a/pages/q+a.marko+1-1
......@@ -24,4 +24,4 @@ export const meta: Metadata = {
2424</footer>
2525</question-layout>
2626
27import { Question } from "@/q+a/models/Question.ts";
27import { Question } from "#src/q+a/models/Question.ts";
src/q+a/scripts/editor.client.tsx+2-2
......@@ -1,5 +1,5 @@
1import type { ScriptPayload } from "@/q+a/views/editor.marko";
2import QuestionRender from "@/q+a/tags/question.marko";
1import type { ScriptPayload } from "#src/q+a/views/editor.marko";
2import QuestionRender from "#src/q+a/tags/question.marko";
33
44declare const payload: ScriptPayload;
55const date = new Date(payload.date);
src/q+a/tags/question-layout.marko+1-1
......@@ -19,4 +19,4 @@ export const theme = {
1919};
2020
2121import { addScript } from "#sitegen";
22import * as render from "lib/render.ts";
22import * as render from "@clo/lib/render.ts";
src/q+a/tags/question.marko+3-3
......@@ -37,7 +37,7 @@ export const transitionDate = 1735639200000;
3737 client import "./clickable-links.client.ts";
3838</>
3939
40import type { Question } from "@/q+a/models/Question.ts";
41import { formatQuestionTimestamp, formatQuestionISOTimestamp } from "@/q+a/format.ts";
42import * as markdown from "@/q+a/markdown.tsx";
40import type { Question } from "#src/q+a/models/Question.ts";
41import { formatQuestionTimestamp, formatQuestionISOTimestamp } from "#src/q+a/format.ts";
42import * as markdown from "#src/q+a/markdown.tsx";
4343import { addScript as Script } from "#sitegen"
src/q+a/views/backend-inbox.marko+2-2
......@@ -1,9 +1,9 @@
11export { theme } from "../tags/question-layout.marko";
2import { PendingQuestion } from "@/q+a/models/PendingQuestion.ts";
2import { PendingQuestion } from "#src/q+a/models/PendingQuestion.ts";
33import {
44 formatQuestionISOTimestamp,
55 formatQuestionTimestamp,
6} from "@/q+a/format.ts";
6} from "#src/q+a/format.ts";
77export const meta = { title: 'question answer inbox' };
88
99<const/questions = PendingQuestion.getAll() />
src/q+a/views/editor.marko+2-2
......@@ -63,5 +63,5 @@ export interface ScriptPayload {
6363<html-script src="/js/q+a/scripts/editor.js" type="module" />
6464
6565import * as devalue from 'devalue';
66import { type PendingQuestion } from "@/q+a/models/PendingQuestion.ts";
67import { Question, QuestionType } from "@/q+a/models/Question.ts";
66import { type PendingQuestion } from "#src/q+a/models/PendingQuestion.ts";
67import { Question, QuestionType } from "#src/q+a/models/Question.ts";
src/q+a/views/image-embed.marko+1-1
......@@ -13,4 +13,4 @@ export interface Input {
1313 <question question=input.question />
1414</main>
1515
16import { Question } from '@/q+a/models/Question.ts';
16import { Question } from '#src/q+a/models/Question.ts';
src/q+a/views/permalink.marko+3-3
......@@ -52,6 +52,6 @@ server export function meta({ context, question }) {
5252<a href="/q+a">view more questions</a>
5353</question-layout>
5454
55import { Question, QuestionType } from '@/q+a/models/Question.ts';
56import { transitionDate } from "@/q+a/tags/question.marko";
57import { formatQuestionTimestamp } from "@/q+a/format.ts";
55import { Question, QuestionType } from '#src/q+a/models/Question.ts';
56import { transitionDate } from "#src/q+a/tags/question.marko";
57import { formatQuestionTimestamp } from "#src/q+a/format.ts";
src/site.ts+1-1
......@@ -123,6 +123,6 @@ export const fonts: sg.Font[] = [
123123];
124124
125125import * as path from "node:path";
126import type { Template as MetaTemplate } from "lib/render/meta.ts";
126import type { Template as MetaTemplate } from "@clo/lib/render/meta.ts";
127127import type * as sg from "#sitegen";
128128import { nasRoot } from "./file-viewer/paths.ts";
src/source-of-truth.dockerfile+1-1
......@@ -10,7 +10,7 @@ run npx esbuild --bundle \
1010 framework/backend/entry-node.ts \
1111 --platform=node \
1212 --format=esm \
13 --define:globalThis.CLOVER_SERVER_ENTRY='"@/source-of-truth.ts"' \
13 --define:globalThis.CLOVER_SERVER_ENTRY='"#src/source-of-truth.ts"' \
1414 --minify \
1515 --sourcemap=linked \
1616 --entry-names=index \
src/source-of-truth.ts+4-4
......@@ -104,13 +104,13 @@ const closeFile = util.promisify(fsCallbacks.close);
104104const fstat = util.promisify(fsCallbacks.fstat);
105105
106106import { Hono } from "#hono";
107import { MediaFile, MediaFileKind } from "@/file-viewer/models/MediaFile.ts";
108import { FilePermissions } from "@/file-viewer/models/FilePermissions.ts";
107import { MediaFile, MediaFileKind } from "#src/file-viewer/models/MediaFile.ts";
108import { FilePermissions } from "#src/file-viewer/models/FilePermissions.ts";
109109import * as path from "node:path";
110110import * as fs from "#sitegen/fs";
111111import * as fsCallbacks from "node:fs";
112112import * as util from "node:util";
113113import * as stream from "node:stream";
114import * as mime from "lib/mime.ts";
114import * as mime from "@clo/lib/mime.ts";
115115import { derivedFileRoot, rawFileRoot } from "./file-viewer/paths.ts";
116import { ASSERT, UNWRAP } from "lib/assert.ts";
116import { ASSERT, UNWRAP } from "@clo/lib/assert.ts";
src/tags/clover-video.marko+2-2
......@@ -69,5 +69,5 @@ export interface Input {
6969
7070client import "./clover-video.client.ts";
7171
72import { MediaFile } from "@/file-viewer/models/MediaFile.ts";
73import { UNWRAP, ASSERT } from "lib/assert.ts";
72import { MediaFile } from "#src/file-viewer/models/MediaFile.ts";
73import { UNWRAP, ASSERT } from "@clo/lib/assert.ts";
src/tags/image.tsx+5-5
......@@ -57,9 +57,9 @@ export default function Image(
5757 );
5858}
5959
60import * as transcodeRules from "@/file-viewer/transcode-rules.ts";
61import { MediaFile } from "@/file-viewer/models/MediaFile.ts";
62import { escapeUri } from "@/file-viewer/format.ts";
63import { UNWRAP } from "lib/assert.ts";
64import { extsVideo } from "@/file-viewer/rules.ts";
60import * as transcodeRules from "#src/file-viewer/transcode-rules.ts";
61import { MediaFile } from "#src/file-viewer/models/MediaFile.ts";
62import { escapeUri } from "#src/file-viewer/format.ts";
63import { UNWRAP } from "@clo/lib/assert.ts";
64import { extsVideo } from "#src/file-viewer/rules.ts";
6565import CloverVideo from "./clover-video.marko";
src/tags/photo-grid.tsx+2-2
......@@ -136,7 +136,7 @@ function mapSize(size: string | number) {
136136}
137137
138138import "./photo-grid.css";
139import { MediaFile } from "@/file-viewer/models/MediaFile.ts";
139import { MediaFile } from "#src/file-viewer/models/MediaFile.ts";
140140import Image from "./image.tsx";
141141import * as path from "node:path";
142import { ASSERT } from "lib/assert.ts";
142import { ASSERT } from "@clo/lib/assert.ts";
src/tags/questions-embed.marko+2-2
......@@ -12,5 +12,5 @@ export interface Input {
1212 </>
1313</div>
1414
15import QuestionRender from "@/q+a/tags/question.marko";
16import { Question } from "@/q+a/models/Question.ts";
15import QuestionRender from "#src/q+a/tags/question.marko";
16import { Question } from "#src/q+a/models/Question.ts";
tsconfig.json+2-3
......@@ -5,11 +5,10 @@
55 "incremental": true,
66 "jsx": "react-jsxdev",
77 "jsxImportSource": "#jsx",
8 "lib": ["esnext", "es2024", "dom", "dom.iterable"],
8 "@clo/lib": ["esnext", "es2024", "dom", "dom.iterable"],
99 "module": "nodenext",
1010 "noEmit": true,
1111 "outDir": ".clover/ts",
12 "paths": { "@/*": ["src/*"] },
1312 "rootDir": ".",
1413 "skipLibCheck": true,
1514 "strict": true,
......@@ -19,5 +18,5 @@
1918 "resolveJsonModule": true,
2019 "types": ["marko"]
2120 },
22 "include": ["lib/**/*", "src/**/*", "framework/**/*"]
21 "include": ["@clo/lib/**/*", "src/**/*", "framework/**/*"]
2322}