@foleo/cli 0.1.36 → 0.1.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/encoded-image-cache.d.ts +14 -0
- package/dist/encoded-image-cache.d.ts.map +1 -0
- package/dist/encoded-image-cache.js +123 -0
- package/dist/encoded-image-cache.js.map +1 -0
- package/dist/image-encoder.d.ts +16 -0
- package/dist/image-encoder.d.ts.map +1 -0
- package/dist/image-encoder.js +142 -0
- package/dist/image-encoder.js.map +1 -0
- package/dist/images.d.ts +85 -0
- package/dist/images.d.ts.map +1 -0
- package/dist/images.js +411 -0
- package/dist/images.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +987 -166
- package/dist/index.js.map +1 -1
- package/dist/workspaces.d.ts +13 -0
- package/dist/workspaces.d.ts.map +1 -0
- package/dist/workspaces.js +705 -0
- package/dist/workspaces.js.map +1 -0
- package/package.json +1 -1
- package/skills/foleo/SKILL.md +229 -6
package/README.md
CHANGED
|
@@ -82,3 +82,27 @@ npx -y @foleo/cli limits --json
|
|
|
82
82
|
No `html-delete`, `html-restore`, or `html-purge` commands exist.
|
|
83
83
|
|
|
84
84
|
The CLI stores its credential in macOS Keychain after login, and logging in again revokes the key it replaces. `npx -y @foleo/cli logout` revokes that key and removes it — if the revoke fails, it still removes it and exits with an error; `--no-revoke` only removes it from this machine. Neither touches `FOLEO_TOKEN`. Signing in to the Mac app does not sign in the CLI. Never write credentials into source files, prompts, artifacts, or repositories. See [https://foleo.app/agents.md](https://foleo.app/agents.md) for the concise agent contract.
|
|
85
|
+
|
|
86
|
+
### Interrupted publishing and large exports
|
|
87
|
+
|
|
88
|
+
Publish and update replay ambiguous connection failures and HTTP 502/504 with
|
|
89
|
+
one frozen request body and idempotency key. If recovery is exhausted, the JSON
|
|
90
|
+
error includes `context.idempotencyKey`, method, path and replay instructions.
|
|
91
|
+
Replay the original body and precondition with that key to retrieve its accepted
|
|
92
|
+
receipt; starting a new publish creates a different operation.
|
|
93
|
+
|
|
94
|
+
`foleo export` renews expired source download URLs and checks the source revision
|
|
95
|
+
and complete manifest before continuing. Files already downloaded and verified
|
|
96
|
+
are kept. A changed source fails before destination files are written.
|
|
97
|
+
|
|
98
|
+
HTML bundles accept **300 new files per publish/update** and **1,000 total
|
|
99
|
+
files** when shared storage can reuse enough of them. Image optimization's
|
|
100
|
+
variants count as new files. Legacy storage copies every entry, so its limit
|
|
101
|
+
is **300 total files**, including reused files. The CLI rejects first publishes
|
|
102
|
+
above 300 files locally; updates rely on the server's reuse plan. Session
|
|
103
|
+
creation rejects excess copy work with `413 bundle_new_files_limit`, including
|
|
104
|
+
`limit`, `count` and an actionable message, before any file upload. Reduce the
|
|
105
|
+
bundle or keep more files unchanged. `foleo limits --json` reports
|
|
106
|
+
`service.contentSizeLimits.htmlArtifact` (`maxNewFiles`, `maxLegacyFiles`,
|
|
107
|
+
`maxFiles`). Runtime inspection covers at most 200 HTML/CSS/JS files: `auto`
|
|
108
|
+
selects `open` beyond that budget; explicit `contained` refuses.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const IMAGE_CACHE_MAX_BYTES: number;
|
|
2
|
+
export declare const imageHash: (bytes: Uint8Array | string) => string;
|
|
3
|
+
export declare function imageCacheDirectory(): string;
|
|
4
|
+
/** Transactions are atomic, including eviction. SQLite's process locks avoid
|
|
5
|
+
* lock-file leases and never expose half-written bytes. Cache failures are misses. */
|
|
6
|
+
export declare class EncodedImageCache {
|
|
7
|
+
private maxBytes;
|
|
8
|
+
private db;
|
|
9
|
+
constructor(directory: string, maxBytes?: number);
|
|
10
|
+
get(key: string): Uint8Array | undefined;
|
|
11
|
+
put(key: string, bytes: Uint8Array): void;
|
|
12
|
+
close(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=encoded-image-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoded-image-cache.d.ts","sourceRoot":"","sources":["../src/encoded-image-cache.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,qBAAqB,QAAoB,CAAC;AACvD,eAAO,MAAM,SAAS,GAAI,OAAO,UAAU,GAAG,MAAM,KAAG,MACL,CAAC;AAEnD,wBAAgB,mBAAmB,IAAI,MAAM,CAQ5C;AAED;sFACsF;AACtF,qBAAa,iBAAiB;IAI1B,OAAO,CAAC,QAAQ;IAHlB,OAAO,CAAC,EAAE,CAA2B;gBAEnC,SAAS,EAAE,MAAM,EACT,QAAQ,SAAwB;IAmB1C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAqBxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI;IAwDzC,KAAK,IAAI,IAAI;CAQd"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdirSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
export const IMAGE_CACHE_MAX_BYTES = 256 * 1024 * 1024;
|
|
8
|
+
export const imageHash = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
9
|
+
export function imageCacheDirectory() {
|
|
10
|
+
return join(process.platform === "darwin"
|
|
11
|
+
? join(homedir(), "Library", "Caches")
|
|
12
|
+
: process.env.XDG_CACHE_HOME || join(homedir(), ".cache"), "foleo", "encoded-images");
|
|
13
|
+
}
|
|
14
|
+
/** Transactions are atomic, including eviction. SQLite's process locks avoid
|
|
15
|
+
* lock-file leases and never expose half-written bytes. Cache failures are misses. */
|
|
16
|
+
export class EncodedImageCache {
|
|
17
|
+
maxBytes;
|
|
18
|
+
db;
|
|
19
|
+
constructor(directory, maxBytes = IMAGE_CACHE_MAX_BYTES) {
|
|
20
|
+
this.maxBytes = maxBytes;
|
|
21
|
+
try {
|
|
22
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
23
|
+
const { DatabaseSync } = require("node:sqlite");
|
|
24
|
+
this.db = new DatabaseSync(join(directory, "variants.sqlite"));
|
|
25
|
+
this.db.exec(`PRAGMA busy_timeout=1000;
|
|
26
|
+
PRAGMA auto_vacuum=FULL;
|
|
27
|
+
PRAGMA max_page_count=${Math.max(32, Math.floor(maxBytes / 4096))};
|
|
28
|
+
CREATE TABLE IF NOT EXISTS variants (
|
|
29
|
+
key TEXT PRIMARY KEY, bytes BLOB NOT NULL, sha256 TEXT NOT NULL,
|
|
30
|
+
used INTEGER NOT NULL
|
|
31
|
+
);
|
|
32
|
+
CREATE INDEX IF NOT EXISTS variants_used ON variants(used);`);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
this.close();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
get(key) {
|
|
39
|
+
try {
|
|
40
|
+
const row = this.db
|
|
41
|
+
?.prepare("SELECT bytes, sha256 FROM variants WHERE key=?")
|
|
42
|
+
.get(key);
|
|
43
|
+
if (!row)
|
|
44
|
+
return undefined;
|
|
45
|
+
const bytes = row.bytes;
|
|
46
|
+
if (imageHash(bytes) !== row.sha256) {
|
|
47
|
+
this.db?.prepare("DELETE FROM variants WHERE key=?").run(key);
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
this.db
|
|
51
|
+
?.prepare("UPDATE variants SET used=(SELECT COALESCE(MAX(used),0)+1 FROM variants) WHERE key=?")
|
|
52
|
+
.run(key);
|
|
53
|
+
return Buffer.from(bytes);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
put(key, bytes) {
|
|
60
|
+
// Leave real room for the B-trees, checksums and overflow pages. Tiny test
|
|
61
|
+
// budgets already have the 32-page physical minimum as their headroom.
|
|
62
|
+
const payloadLimit = this.maxBytes < 128 * 1024
|
|
63
|
+
? this.maxBytes
|
|
64
|
+
: Math.floor(this.maxBytes * 0.75);
|
|
65
|
+
if (!this.db || bytes.byteLength > payloadLimit)
|
|
66
|
+
return;
|
|
67
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
68
|
+
try {
|
|
69
|
+
this.db.exec("BEGIN IMMEDIATE");
|
|
70
|
+
this.db
|
|
71
|
+
.prepare(`DELETE FROM variants WHERE key IN (
|
|
72
|
+
SELECT key FROM (SELECT key, SUM(length(bytes)) OVER (ORDER BY used DESC, rowid DESC) AS total FROM variants)
|
|
73
|
+
WHERE total > ?)`)
|
|
74
|
+
.run(payloadLimit - bytes.byteLength);
|
|
75
|
+
this.db
|
|
76
|
+
.prepare("INSERT OR REPLACE INTO variants VALUES (?,?,?,(SELECT COALESCE(MAX(used),0)+1 FROM variants))")
|
|
77
|
+
.run(key, bytes, imageHash(bytes));
|
|
78
|
+
this.db.exec("COMMIT");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
try {
|
|
83
|
+
this.db.exec("ROLLBACK");
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
/* cache only */
|
|
87
|
+
}
|
|
88
|
+
if (attempt !== 0 ||
|
|
89
|
+
!(error instanceof Error) ||
|
|
90
|
+
!error.message.includes("database or disk is full"))
|
|
91
|
+
return;
|
|
92
|
+
// SQLITE_FULL may roll its transaction back automatically. Evict in a
|
|
93
|
+
// separate committed transaction so FULL auto-vacuum returns pages before
|
|
94
|
+
// the single retry, including caches written by older versions.
|
|
95
|
+
try {
|
|
96
|
+
this.db.exec(`BEGIN IMMEDIATE;
|
|
97
|
+
DELETE FROM variants WHERE rowid IN (SELECT rowid FROM variants ORDER BY used, rowid
|
|
98
|
+
LIMIT (SELECT (COUNT(*) + 1) / 2 FROM variants));
|
|
99
|
+
COMMIT;`);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
try {
|
|
103
|
+
this.db.exec("ROLLBACK");
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
/* cache only */
|
|
107
|
+
}
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
close() {
|
|
114
|
+
try {
|
|
115
|
+
this.db?.close();
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
/* cache only */
|
|
119
|
+
}
|
|
120
|
+
this.db = undefined;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=encoded-image-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoded-image-cache.js","sourceRoot":"","sources":["../src/encoded-image-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AACvD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAU,EAAE,CAC9D,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEnD,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,CACT,OAAO,CAAC,QAAQ,KAAK,QAAQ;QAC3B,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC;QACtC,CAAC,CAAC,OAAO,C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MAAM,CAAC;oBACP,gBAAgB;gBAClB,CAAC;gBACD,IACE,OAAO,KAAK,CAAC;oBACb,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;oBACzB,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAC;oBAEnD,OAAO;gBACT,sEAAsE;gBACtE,0EAA0E;gBAC1E,gEAAgE;gBAChE,IAAI,CAAC;oBACH,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;;;kBAGL,CAAC,CAAC;gBACZ,CAAC;gBAAC,MAAM,CAAC;oBACP,IAAI,CAAC;wBACH,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBAC3B,CAAC;oBAAC,MAAM,CAAC;wBACP,gBAAgB;oBAClB,CAAC;oBACD,OAAO;gBACT,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,KAAK;QACH,IAAI,CAAC;YACH,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;QAAC,MAAM,CAAC;YACP,gBAAgB;QAClB,CAAC;QACD,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ImageFile, type ImageOptimization } from "./images.js";
|
|
2
|
+
export type ImageProcessRunner = (executable: string, args: string[], signal?: AbortSignal) => Promise<void | string>;
|
|
3
|
+
/** An aborted signal kills the child (SIGTERM), so an interrupt never waits on sips. */
|
|
4
|
+
export declare const runImageProcess: ImageProcessRunner;
|
|
5
|
+
export declare function optimizeImages(files: ImageFile[], runner?: ImageProcessRunner, cacheOptions?: {
|
|
6
|
+
directory: string;
|
|
7
|
+
encoderIdentity: string;
|
|
8
|
+
maxBytes?: number;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
files: ImageFile[];
|
|
11
|
+
imageOptimization: ImageOptimization;
|
|
12
|
+
pages: number;
|
|
13
|
+
}>;
|
|
14
|
+
export { isAvif } from "./images.js";
|
|
15
|
+
export type { ImageOptimization } from "./images.js";
|
|
16
|
+
//# sourceMappingURL=image-encoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-encoder.d.ts","sourceRoot":"","sources":["../src/image-encoder.ts"],"names":[],"mappings":"AAkBA,OAAO,EAML,KAAK,SAAS,EACd,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,kBAAkB,GAAG,CAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;AAC5B,wFAAwF;AACxF,eAAO,MAAM,eAAe,EAAE,kBAK1B,CAAC;AACL,wBAAsB,cAAc,CAClC,KAAK,EAAE,SAAS,EAAE,EAClB,MAAM,GAAE,kBAAoC,EAC5C,YAAY,CAAC,EAAE;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACA,OAAO,CAAC;IACT,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CA+JD;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { access, chmod, mkdtemp, readFile, rm, writeFile, } from "node:fs/promises";
|
|
4
|
+
import { tmpdir, release, version, arch } from "node:os";
|
|
5
|
+
import { EncodedImageCache, imageCacheDirectory, imageHash, } from "./encoded-image-cache.js";
|
|
6
|
+
import { basename, join } from "node:path";
|
|
7
|
+
import { LocalError } from "./errors.js";
|
|
8
|
+
import { IMAGE_ENCODER_CONCURRENCY, planImageOptimization, finishImageOptimization, isAvif, variantPath, } from "./images.js";
|
|
9
|
+
/** An aborted signal kills the child (SIGTERM), so an interrupt never waits on sips. */
|
|
10
|
+
export const runImageProcess = (executable, args, signal) => new Promise((resolve, reject) => {
|
|
11
|
+
execFile(executable, args, { signal }, (error, stdout) => error ? reject(error) : resolve(stdout));
|
|
12
|
+
});
|
|
13
|
+
export async function optimizeImages(files, runner = runImageProcess, cacheOptions) {
|
|
14
|
+
let encoderVersion;
|
|
15
|
+
try {
|
|
16
|
+
// The injected runner performs the same executable preflight in tests.
|
|
17
|
+
if (runner === runImageProcess)
|
|
18
|
+
await access("/usr/bin/sips", constants.X_OK);
|
|
19
|
+
encoderVersion = await runner("/usr/bin/sips", ["--version"]);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
throw new LocalError("image_encoder_unavailable", "Image optimization requires an executable /usr/bin/sips on macOS.");
|
|
23
|
+
}
|
|
24
|
+
const plan = planImageOptimization(files);
|
|
25
|
+
let osBuild = undefined;
|
|
26
|
+
if (runner === runImageProcess && plan.candidates.length) {
|
|
27
|
+
try {
|
|
28
|
+
osBuild = await runner("/usr/bin/sw_vers", ["-buildVersion"]);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
encoderVersion = undefined;
|
|
32
|
+
} // Encoding still works; do not cache an unknown build.
|
|
33
|
+
}
|
|
34
|
+
const encoderIdentity = cacheOptions?.encoderIdentity ??
|
|
35
|
+
(encoderVersion
|
|
36
|
+
? JSON.stringify([
|
|
37
|
+
"sips-avif-v1",
|
|
38
|
+
encoderVersion,
|
|
39
|
+
osBuild,
|
|
40
|
+
process.platform,
|
|
41
|
+
release(),
|
|
42
|
+
version(),
|
|
43
|
+
arch(),
|
|
44
|
+
])
|
|
45
|
+
: undefined);
|
|
46
|
+
const cache = encoderIdentity && plan.candidates.length
|
|
47
|
+
? new EncodedImageCache(cacheOptions?.directory ?? imageCacheDirectory(), cacheOptions?.maxBytes)
|
|
48
|
+
: undefined;
|
|
49
|
+
const { candidates } = plan;
|
|
50
|
+
const directory = await mkdtemp(join(tmpdir(), "foleo-images-"));
|
|
51
|
+
let interrupted = false;
|
|
52
|
+
const abort = new AbortController();
|
|
53
|
+
const interrupt = () => {
|
|
54
|
+
interrupted = true;
|
|
55
|
+
abort.abort();
|
|
56
|
+
};
|
|
57
|
+
process.on("SIGINT", interrupt);
|
|
58
|
+
process.on("SIGTERM", interrupt);
|
|
59
|
+
let result;
|
|
60
|
+
try {
|
|
61
|
+
await chmod(directory, 0o700);
|
|
62
|
+
const jobs = [];
|
|
63
|
+
const results = new Map();
|
|
64
|
+
for (const [i, { file, widths }] of candidates.entries()) {
|
|
65
|
+
const sourceHash = cache ? imageHash(file.bytes) : "";
|
|
66
|
+
const source = join(directory, `${i}-${basename(file.path)}`);
|
|
67
|
+
await writeFile(source, file.bytes);
|
|
68
|
+
const rows = widths.map((width) => ({
|
|
69
|
+
path: variantPath(file.path, width),
|
|
70
|
+
width,
|
|
71
|
+
data: undefined,
|
|
72
|
+
}));
|
|
73
|
+
results.set(file.path, rows);
|
|
74
|
+
rows.forEach((row) => jobs.push(async () => {
|
|
75
|
+
const key = cache
|
|
76
|
+
? imageHash(JSON.stringify([
|
|
77
|
+
encoderIdentity,
|
|
78
|
+
sourceHash,
|
|
79
|
+
basename(file.path).split(".").at(-1),
|
|
80
|
+
widths,
|
|
81
|
+
row.width,
|
|
82
|
+
"avif",
|
|
83
|
+
55,
|
|
84
|
+
]))
|
|
85
|
+
: undefined;
|
|
86
|
+
const cached = key ? cache?.get(key) : undefined;
|
|
87
|
+
if (cached && isAvif(cached)) {
|
|
88
|
+
row.data = cached;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const output = join(directory, `${i}-${row.width}.avif`);
|
|
92
|
+
try {
|
|
93
|
+
await runner("/usr/bin/sips", [
|
|
94
|
+
"-s",
|
|
95
|
+
"format",
|
|
96
|
+
"avif",
|
|
97
|
+
"-s",
|
|
98
|
+
"formatOptions",
|
|
99
|
+
"55",
|
|
100
|
+
"--resampleWidth",
|
|
101
|
+
String(row.width),
|
|
102
|
+
source,
|
|
103
|
+
"--out",
|
|
104
|
+
output,
|
|
105
|
+
], abort.signal);
|
|
106
|
+
const bytes = await readFile(output);
|
|
107
|
+
if (isAvif(bytes)) {
|
|
108
|
+
row.data = bytes;
|
|
109
|
+
if (key)
|
|
110
|
+
cache?.put(key, bytes);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
/* A failed variant cannot replace the fallback. */
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
let next = 0;
|
|
119
|
+
await Promise.all(Array.from({ length: Math.min(IMAGE_ENCODER_CONCURRENCY, jobs.length) }, async () => {
|
|
120
|
+
while (!interrupted && next < jobs.length)
|
|
121
|
+
await jobs[next++]();
|
|
122
|
+
}));
|
|
123
|
+
if (interrupted)
|
|
124
|
+
throw new LocalError("image_optimization_interrupted", "Image optimization interrupted; no upload started.");
|
|
125
|
+
result = finishImageOptimization(plan, candidates.map(({ file }) => results.get(file.path).map((row) => row.data)));
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
cache?.close();
|
|
129
|
+
try {
|
|
130
|
+
await rm(directory, { recursive: true, force: true });
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
process.removeListener("SIGINT", interrupt);
|
|
134
|
+
process.removeListener("SIGTERM", interrupt);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (interrupted)
|
|
138
|
+
throw new LocalError("image_optimization_interrupted", "Image optimization interrupted; no upload started.");
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
export { isAvif } from "./images.js";
|
|
142
|
+
//# sourceMappingURL=image-encoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-encoder.js","sourceRoot":"","sources":["../src/image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AE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/images.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export declare const HEAVY_IMAGE_BYTES: number;
|
|
2
|
+
export declare const HEAVY_IMAGE_WIDTH = 2560;
|
|
3
|
+
export declare const IMAGE_OPTIMIZATION_MIN_BYTES: number;
|
|
4
|
+
export declare const IMAGE_HEADER_BYTES: number;
|
|
5
|
+
export interface ImageInfo {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
animated?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ImageFile {
|
|
11
|
+
path: string;
|
|
12
|
+
bytes: Uint8Array;
|
|
13
|
+
}
|
|
14
|
+
export interface HeavyImage {
|
|
15
|
+
code: "image_heavy";
|
|
16
|
+
path: string;
|
|
17
|
+
bytes: number;
|
|
18
|
+
width?: number;
|
|
19
|
+
height?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function imageInfo(input: Uint8Array): ImageInfo | undefined;
|
|
22
|
+
export declare function auditImages(files: ImageFile[], handled?: Set<string>): HeavyImage[];
|
|
23
|
+
export declare function variantWidths(width: number): number[];
|
|
24
|
+
export declare function variantPath(path: string, width: number): string;
|
|
25
|
+
export interface ImageTag {
|
|
26
|
+
start: number;
|
|
27
|
+
end: number;
|
|
28
|
+
path: string;
|
|
29
|
+
src: string;
|
|
30
|
+
sizes: string;
|
|
31
|
+
}
|
|
32
|
+
/** Latin-1 keeps offsets in bytes; only the selected tag spans are replaced. */
|
|
33
|
+
export declare function imageTags(page: ImageFile): ImageTag[];
|
|
34
|
+
export interface ImageVariant {
|
|
35
|
+
path: string;
|
|
36
|
+
width: number;
|
|
37
|
+
bytes: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function rewriteImages(page: ImageFile, tags: ImageTag[], variants: Map<string, ImageVariant[]>): Uint8Array;
|
|
40
|
+
export interface ImageOptimization {
|
|
41
|
+
encoder: "sips-avif";
|
|
42
|
+
quality: 55;
|
|
43
|
+
images: {
|
|
44
|
+
path: string;
|
|
45
|
+
bytes: number;
|
|
46
|
+
width: number;
|
|
47
|
+
variants: ImageVariant[];
|
|
48
|
+
tags: number;
|
|
49
|
+
}[];
|
|
50
|
+
skipped: {
|
|
51
|
+
path: string;
|
|
52
|
+
reason: "path_exists" | "not_smaller" | "encode_failed";
|
|
53
|
+
}[];
|
|
54
|
+
addedFiles: number;
|
|
55
|
+
addedBytes: number;
|
|
56
|
+
}
|
|
57
|
+
export declare const IMAGE_ENCODER_CONCURRENCY = 4;
|
|
58
|
+
export declare function planImageOptimization(files: ImageFile[]): {
|
|
59
|
+
files: ImageFile[];
|
|
60
|
+
report: ImageOptimization;
|
|
61
|
+
pages: {
|
|
62
|
+
page: ImageFile;
|
|
63
|
+
tags: ImageTag[];
|
|
64
|
+
}[];
|
|
65
|
+
counts: Map<string, number>;
|
|
66
|
+
candidates: {
|
|
67
|
+
file: ImageFile;
|
|
68
|
+
info: ImageInfo;
|
|
69
|
+
widths: number[];
|
|
70
|
+
}[];
|
|
71
|
+
};
|
|
72
|
+
export type ImageOptimizationPlan = ReturnType<typeof planImageOptimization>;
|
|
73
|
+
/** Native adapters return one row per planned image, in planned width order. */
|
|
74
|
+
export declare function finishImageOptimization(plan: ImageOptimizationPlan, encoded: (Uint8Array | undefined)[][]): {
|
|
75
|
+
files: ImageFile[];
|
|
76
|
+
imageOptimization: ImageOptimization;
|
|
77
|
+
pages: number;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* `sips` has been seen to crash after writing (exit 139 with `-s format
|
|
81
|
+
* public.avif` on macOS 26.5), so a variant is only kept when its bytes open
|
|
82
|
+
* with an ISO-BMFF `ftyp` box branded `avif` or `avis`.
|
|
83
|
+
*/
|
|
84
|
+
export declare function isAvif(bytes: Uint8Array): boolean;
|
|
85
|
+
//# sourceMappingURL=images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":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