@johnhenry/sitefile 0.0.2 → 0.0.3
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/CHANGELOG.md +467 -0
- package/README.md +55 -6
- package/lib/src/archive-writers.d.ts +12 -2
- package/lib/src/archive-writers.js +53 -10
- package/lib/src/canonical.d.ts +16 -0
- package/lib/src/canonical.js +46 -0
- package/lib/src/car.d.ts +34 -0
- package/lib/src/car.js +203 -0
- package/lib/src/checklinks.js +8 -2
- package/lib/src/cli/bake.js +4 -3
- package/lib/src/cli/build-image.d.ts +1 -0
- package/lib/src/cli/build-image.js +1 -0
- package/lib/src/cli/common.js +4 -1
- package/lib/src/cli/hosts.d.ts +5 -0
- package/lib/src/cli/hosts.js +78 -0
- package/lib/src/cli/images.js +23 -5
- package/lib/src/cli/import-config.d.ts +2 -0
- package/lib/src/cli/import-config.js +56 -0
- package/lib/src/cli/index.d.ts +3 -1
- package/lib/src/cli/index.js +31 -2
- package/lib/src/cli/integrity.d.ts +2 -0
- package/lib/src/cli/integrity.js +77 -0
- package/lib/src/cli/network.d.ts +7 -0
- package/lib/src/cli/network.js +14 -3
- package/lib/src/cli/serve-keys.d.ts +39 -0
- package/lib/src/cli/serve-keys.js +106 -0
- package/lib/src/cli/serve-worker.js +46 -8
- package/lib/src/cli/servers.d.ts +124 -1
- package/lib/src/cli/servers.js +705 -62
- package/lib/src/cli/up.d.ts +2 -0
- package/lib/src/cli/up.js +193 -0
- package/lib/src/cli/watch.d.ts +14 -1
- package/lib/src/cli/watch.js +20 -3
- package/lib/src/cli.js +138 -18
- package/lib/src/csp.d.ts +17 -0
- package/lib/src/csp.js +52 -0
- package/lib/src/dictionary.d.ts +16 -0
- package/lib/src/dictionary.js +89 -0
- package/lib/src/epub.d.ts +5 -0
- package/lib/src/epub.js +113 -0
- package/lib/src/errors.d.ts +22 -9
- package/lib/src/errors.js +20 -1
- package/lib/src/executor.d.ts +31 -1
- package/lib/src/executor.js +192 -22
- package/lib/src/explain.js +33 -3
- package/lib/src/export-for.d.ts +42 -0
- package/lib/src/export-for.js +466 -0
- package/lib/src/export-formats.d.ts +2 -2
- package/lib/src/export-formats.js +52 -2
- package/lib/src/fingerprint.d.ts +3 -1
- package/lib/src/fingerprint.js +32 -5
- package/lib/src/host-config.d.ts +34 -0
- package/lib/src/host-config.js +645 -0
- package/lib/src/hosts.d.ts +47 -0
- package/lib/src/hosts.js +106 -0
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/integrity.d.ts +115 -0
- package/lib/src/integrity.js +273 -0
- package/lib/src/language/ast.d.ts +116 -3
- package/lib/src/language/ast.js +7 -1
- package/lib/src/language/parser.js +176 -7
- package/lib/src/language/validate.js +21 -0
- package/lib/src/links.d.ts +33 -0
- package/lib/src/links.js +271 -3
- package/lib/src/lint.d.ts +1 -1
- package/lib/src/lint.js +26 -1
- package/lib/src/mime-data.d.ts +2 -0
- package/lib/src/mime-data.js +92 -0
- package/lib/src/oci.d.ts +20 -2
- package/lib/src/oci.js +70 -28
- package/lib/src/outdated.d.ts +3 -0
- package/lib/src/outdated.js +4 -4
- package/lib/src/planner.d.ts +69 -2
- package/lib/src/planner.js +150 -8
- package/lib/src/plugins/cache.d.ts +11 -0
- package/lib/src/plugins/cache.js +29 -0
- package/lib/src/plugins/host.d.ts +51 -2
- package/lib/src/plugins/host.js +141 -16
- package/lib/src/plugins/wasm.js +1 -3
- package/lib/src/portable.d.ts +8 -0
- package/lib/src/portable.js +47 -0
- package/lib/src/precache.d.ts +33 -0
- package/lib/src/precache.js +75 -0
- package/lib/src/precompress.d.ts +19 -0
- package/lib/src/precompress.js +35 -0
- package/lib/src/qr.d.ts +18 -0
- package/lib/src/qr.js +372 -0
- package/lib/src/registry-ops.js +4 -2
- package/lib/src/reload-client.d.ts +2 -0
- package/lib/src/reload-client.js +304 -0
- package/lib/src/resources/archive.d.ts +36 -0
- package/lib/src/resources/archive.js +338 -67
- package/lib/src/resources/convert.js +3 -1
- package/lib/src/resources/https.d.ts +9 -1
- package/lib/src/resources/https.js +36 -0
- package/lib/src/resources/network.d.ts +25 -3
- package/lib/src/resources/network.js +77 -6
- package/lib/src/secrets.d.ts +12 -3
- package/lib/src/secrets.js +18 -5
- package/lib/src/serve-auth.d.ts +32 -0
- package/lib/src/serve-auth.js +112 -0
- package/lib/src/serve-rules.d.ts +83 -7
- package/lib/src/serve-rules.js +264 -53
- package/lib/src/server.d.ts +437 -10
- package/lib/src/server.js +1236 -52
- package/lib/src/servers-file.d.ts +36 -0
- package/lib/src/servers-file.js +101 -0
- package/lib/src/servers.d.ts +109 -7
- package/lib/src/servers.js +151 -29
- package/lib/src/single-file.d.ts +12 -0
- package/lib/src/single-file.js +147 -0
- package/lib/src/site.d.ts +54 -0
- package/lib/src/site.js +204 -6
- package/lib/src/store.js +9 -5
- package/lib/src/swbn.d.ts +10 -0
- package/lib/src/swbn.js +86 -0
- package/lib/src/toml.d.ts +17 -0
- package/lib/src/toml.js +323 -0
- package/lib/src/wacz.d.ts +6 -0
- package/lib/src/wacz.js +96 -0
- package/lib/src/warc.d.ts +28 -0
- package/lib/src/warc.js +252 -0
- package/lib/src/watch.d.ts +12 -1
- package/lib/src/watch.js +67 -1
- package/lib/src/wbn.d.ts +9 -1
- package/lib/src/wbn.js +23 -33
- package/lib/src/zstd.d.ts +4 -0
- package/lib/src/zstd.js +328 -0
- package/package.json +1 -1
package/lib/src/epub.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { writeZip } from './archive-writers.js';
|
|
2
|
+
import { SitefileError } from './errors.js';
|
|
3
|
+
import { encodePath } from './links.js';
|
|
4
|
+
import { makeFile, Tree } from './tree.js';
|
|
5
|
+
import { mimeTypeFor } from './wbn.js';
|
|
6
|
+
/**
|
|
7
|
+
* `EXPORT … AS epub` (issue #209): the tree as an EPUB 3 publication.
|
|
8
|
+
*
|
|
9
|
+
* The zip holds `mimetype` first (stored, no extra field, as the OCF container requires), then
|
|
10
|
+
* `META-INF/container.xml`, the package document `EPUB/package.opf` and the site's files under
|
|
11
|
+
* `EPUB/` (all deflated as other zips). The spine is every `.xhtml`/`.html` page in path order,
|
|
12
|
+
* `/index.xhtml` or `/index.html` first; pages must be well-formed XHTML for reading systems and
|
|
13
|
+
* epubcheck. A site file `/nav.xhtml` is the navigation document; otherwise one is generated that lists
|
|
14
|
+
* the spine pages by their `<title>`. Metadata: the title and language of the first page (`<title>`,
|
|
15
|
+
* `<html lang>`; default `Untitled` and `en`), an identifier derived from the tree digest, and
|
|
16
|
+
* `dcterms:modified` from `SOURCE_DATE_EPOCH` (default the Unix epoch), so the file is deterministic.
|
|
17
|
+
* `_redirects` and `_headers` are left out.
|
|
18
|
+
*/
|
|
19
|
+
const enc = new TextEncoder();
|
|
20
|
+
const dec = new TextDecoder();
|
|
21
|
+
const SKIP = new Set(['/_redirects', '/_headers']);
|
|
22
|
+
const isPage = (p) => /\.x?html?$/i.test(p);
|
|
23
|
+
function mediaType(p) {
|
|
24
|
+
if (isPage(p))
|
|
25
|
+
return 'application/xhtml+xml';
|
|
26
|
+
return mimeTypeFor(p).split(';')[0].trim();
|
|
27
|
+
}
|
|
28
|
+
function escapeXml(s) {
|
|
29
|
+
return s.replace(/&(?![A-Za-z]+;|#[0-9]+;|#x[0-9A-Fa-f]+;)/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
30
|
+
}
|
|
31
|
+
function titleOf(bytes) {
|
|
32
|
+
const m = /<title(?:\s[^>]*)?>([^<]*)<\/title>/i.exec(dec.decode(bytes));
|
|
33
|
+
const t = m?.[1]?.replace(/\s+/g, ' ').trim();
|
|
34
|
+
return t ? t : undefined;
|
|
35
|
+
}
|
|
36
|
+
function langOf(bytes) {
|
|
37
|
+
const m = /<html\b[^>]*?\s(?:xml:)?lang\s*=\s*"([A-Za-z0-9-]+)"/i.exec(dec.decode(bytes));
|
|
38
|
+
return m?.[1];
|
|
39
|
+
}
|
|
40
|
+
function isoOf(epoch) {
|
|
41
|
+
return epoch === undefined ? '1970-01-01T00:00:00Z' : new Date(epoch * 1000).toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
42
|
+
}
|
|
43
|
+
/** `urn:uuid:` (version 8) from a `sha256:<hex>` digest. */
|
|
44
|
+
function uuidOf(digest) {
|
|
45
|
+
const h = digest.slice('sha256:'.length);
|
|
46
|
+
const variant = ((parseInt(h.slice(16, 17), 16) & 3) | 8).toString(16);
|
|
47
|
+
return `urn:uuid:${h.slice(0, 8)}-${h.slice(8, 12)}-8${h.slice(13, 16)}-${variant}${h.slice(17, 20)}-${h.slice(20, 32)}`;
|
|
48
|
+
}
|
|
49
|
+
/** The files of the EPUB container (paths as zip entries, with a leading `/`). */
|
|
50
|
+
export function epubTree(tree, epoch) {
|
|
51
|
+
const files = tree.entries().filter(([p]) => !SKIP.has(p));
|
|
52
|
+
if (tree.get('/package.opf'))
|
|
53
|
+
throw new SitefileError('E_CONFLICT', "epub export: '/package.opf' is written by the export; rename the site's file");
|
|
54
|
+
const pages = files.filter(([p]) => isPage(p) && p !== '/nav.xhtml');
|
|
55
|
+
const front = pages.findIndex(([p]) => p === '/index.xhtml' || p === '/index.html');
|
|
56
|
+
if (front > 0)
|
|
57
|
+
pages.unshift(...pages.splice(front, 1));
|
|
58
|
+
if (pages.length === 0)
|
|
59
|
+
throw new SitefileError('E_EXPORT', 'epub export: the tree has no .xhtml or .html page to read');
|
|
60
|
+
const first = pages[0][1].bytes;
|
|
61
|
+
const title = escapeXml(titleOf(first) ?? 'Untitled');
|
|
62
|
+
const lang = langOf(first) ?? 'en';
|
|
63
|
+
const ids = new Map(files.map(([p], i) => [p, `f${i + 1}`]));
|
|
64
|
+
const href = (p) => encodePath(p.slice(1));
|
|
65
|
+
const siteNav = tree.get('/nav.xhtml') !== undefined;
|
|
66
|
+
const items = files.map(([p]) => ` <item id="${ids.get(p)}" href="${href(p)}" media-type="${mediaType(p)}"${p === '/nav.xhtml' ? ' properties="nav"' : ''}/>\n`);
|
|
67
|
+
if (!siteNav)
|
|
68
|
+
items.unshift(' <item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>\n');
|
|
69
|
+
const opf = '<?xml version="1.0" encoding="UTF-8"?>\n' +
|
|
70
|
+
`<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="uid" xml:lang="${lang}">\n` +
|
|
71
|
+
' <metadata xmlns:dc="http://purl.org/dc/elements/1.1/">\n' +
|
|
72
|
+
` <dc:identifier id="uid">${uuidOf(tree.digest())}</dc:identifier>\n` +
|
|
73
|
+
` <dc:title>${title}</dc:title>\n` +
|
|
74
|
+
` <dc:language>${lang}</dc:language>\n` +
|
|
75
|
+
` <meta property="dcterms:modified">${isoOf(epoch)}</meta>\n` +
|
|
76
|
+
' </metadata>\n' +
|
|
77
|
+
' <manifest>\n' +
|
|
78
|
+
items.join('') +
|
|
79
|
+
' </manifest>\n' +
|
|
80
|
+
' <spine>\n' +
|
|
81
|
+
pages.map(([p]) => ` <itemref idref="${ids.get(p)}"/>\n`).join('') +
|
|
82
|
+
' </spine>\n' +
|
|
83
|
+
'</package>\n';
|
|
84
|
+
const container = '<?xml version="1.0" encoding="UTF-8"?>\n' +
|
|
85
|
+
'<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">\n' +
|
|
86
|
+
' <rootfiles>\n' +
|
|
87
|
+
' <rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/>\n' +
|
|
88
|
+
' </rootfiles>\n' +
|
|
89
|
+
'</container>\n';
|
|
90
|
+
const out = [
|
|
91
|
+
['/mimetype', makeFile(enc.encode('application/epub+zip'), 'epub')],
|
|
92
|
+
['/META-INF/container.xml', makeFile(enc.encode(container), 'epub')],
|
|
93
|
+
['/EPUB/package.opf', makeFile(enc.encode(opf), 'epub')],
|
|
94
|
+
];
|
|
95
|
+
if (!siteNav) {
|
|
96
|
+
const nav = '<?xml version="1.0" encoding="UTF-8"?>\n' +
|
|
97
|
+
'<!DOCTYPE html>\n' +
|
|
98
|
+
`<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="${lang}" lang="${lang}">\n` +
|
|
99
|
+
`<head><title>${title}</title></head>\n` +
|
|
100
|
+
`<body>\n<nav epub:type="toc" id="toc">\n<h1>${title}</h1>\n<ol>\n` +
|
|
101
|
+
pages.map(([p, n]) => `<li><a href="${href(p)}">${escapeXml(titleOf(n.bytes) ?? p.slice(1))}</a></li>\n`).join('') +
|
|
102
|
+
'</ol>\n</nav>\n</body>\n</html>\n';
|
|
103
|
+
out.push(['/EPUB/nav.xhtml', makeFile(enc.encode(nav), 'epub')]);
|
|
104
|
+
}
|
|
105
|
+
for (const [p, n] of files)
|
|
106
|
+
out.push([`/EPUB${p}`, n]);
|
|
107
|
+
return Tree.fromFiles(out);
|
|
108
|
+
}
|
|
109
|
+
/** `EXPORT … AS epub`: the EPUB file. */
|
|
110
|
+
export function writeEpub(tree, epoch) {
|
|
111
|
+
return writeZip(epubTree(tree, epoch), { epoch }, ['/mimetype']);
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=epub.js.map
|
package/lib/src/errors.d.ts
CHANGED
|
@@ -10,7 +10,9 @@ export interface SourceSpan {
|
|
|
10
10
|
*/
|
|
11
11
|
export type ErrorCode = 'E_SYNTAX' | 'E_UNKNOWN_INSTRUCTION' | 'E_UNSUPPORTED' | 'E_VALIDATION' | 'E_UNDEFINED' | 'E_DUPLICATE' | 'E_MISSING_ARG' | 'E_TYPE' | 'E_PATH' | 'E_PATH_ESCAPE' | 'E_NOT_FOUND' | 'E_UNSUPPORTED_FILE' | 'E_HARDLINK'
|
|
12
12
|
/** Two paths equal under Unicode simple case folding, or two context names equal after NFC. */
|
|
13
|
-
| 'E_PATH_COLLISION'
|
|
13
|
+
| 'E_PATH_COLLISION'
|
|
14
|
+
/** An exported path other systems or hosts cannot hold, under --strict-paths. */
|
|
15
|
+
| 'E_PATH_PORTABLE' | 'E_CONFLICT' | 'E_PROTOCOL' | 'E_SSRF_BLOCKED' | 'E_HOST_BLOCKED' | 'E_FETCH' | 'E_FETCH_STATUS' | 'E_FETCH_TIMEOUT' | 'E_TOO_LARGE' | 'E_REDIRECT' | 'E_INTEGRITY' | 'E_LOCK_MISMATCH' | 'E_LOCK_MISSING'
|
|
14
16
|
/** A remote input (IMPORT URL or BASE image) has no pin, under --strict-pins. */
|
|
15
17
|
| 'E_UNPINNED'
|
|
16
18
|
/** A malformed or unsupported Git smart HTTP response or packfile (git+https IMPORT, Git URL contexts). */
|
|
@@ -26,19 +28,30 @@ export type ErrorCode = 'E_SYNTAX' | 'E_UNKNOWN_INSTRUCTION' | 'E_UNSUPPORTED' |
|
|
|
26
28
|
/** The build was stopped by its embedder (the Rust library's `CancelToken`; see docs/RUST.md). */
|
|
27
29
|
| 'E_CANCELLED';
|
|
28
30
|
/**
|
|
29
|
-
* The permission a build needs
|
|
30
|
-
*
|
|
31
|
-
*
|
|
31
|
+
* The permission a build needs, so callers need not parse the message. Carried by:
|
|
32
|
+
* - the `E_UNSUPPORTED` error of a JavaScript PLUGIN (`--allow-plugin <name>`) or a TOOL
|
|
33
|
+
* (`--allow-exec <name>`) that was not allowed;
|
|
34
|
+
* - the `E_HOST_BLOCKED` error of a host that matches no allow-hosts rule (`--allow-hosts <host>`;
|
|
35
|
+
* a deny-hosts match carries none, since no flag overrides it);
|
|
36
|
+
* - in strict network mode, the `E_HOST_BLOCKED` error of an `IMPORT … SECRET` whose secret may not be
|
|
37
|
+
* sent to the import's host (`--allow-secret-host <id>=<host>`).
|
|
32
38
|
*/
|
|
33
39
|
export interface Needs {
|
|
34
|
-
readonly kind: 'plugin' | 'tool';
|
|
35
|
-
/** The declared PLUGIN or TOOL name
|
|
40
|
+
readonly kind: 'plugin' | 'tool' | 'host' | 'secret-host';
|
|
41
|
+
/** The declared PLUGIN or TOOL name, the host, or `<secret id>=<host>`. */
|
|
36
42
|
readonly name: string;
|
|
37
|
-
/** The flag that grants it. */
|
|
38
|
-
readonly flag: '--allow-plugin' | '--allow-exec';
|
|
43
|
+
/** The flag that grants it (its value is `name`). */
|
|
44
|
+
readonly flag: '--allow-plugin' | '--allow-exec' | '--allow-hosts' | '--allow-secret-host';
|
|
39
45
|
}
|
|
40
46
|
export declare function needsPlugin(name: string): Needs;
|
|
41
47
|
export declare function needsTool(name: string): Needs;
|
|
48
|
+
export declare function needsHost(host: string): Needs;
|
|
49
|
+
export declare function needsSecretHost(id: string, host: string): Needs;
|
|
50
|
+
/**
|
|
51
|
+
* The `--json` form of a failed command (printed on stdout, next to the `error[CODE]:` line on stderr):
|
|
52
|
+
* `{ "error": { code, message, span, needs } }`, with `span` and `needs` null when absent.
|
|
53
|
+
*/
|
|
54
|
+
export declare function errorJson(e: SitefileError): string;
|
|
42
55
|
export interface SitefileErrorOptions extends ErrorOptions {
|
|
43
56
|
/** What must be allowed (permission errors only). */
|
|
44
57
|
readonly needs?: Needs;
|
|
@@ -48,7 +61,7 @@ export declare class SitefileError extends Error {
|
|
|
48
61
|
readonly span: SourceSpan | undefined;
|
|
49
62
|
/** The message without the location prefix. */
|
|
50
63
|
readonly detail: string;
|
|
51
|
-
/** For a permission error (`E_UNSUPPORTED` at a PLUGIN or TOOL line): what must be allowed. Not part of the message. */
|
|
64
|
+
/** For a permission error (`E_UNSUPPORTED` at a PLUGIN or TOOL line, `E_HOST_BLOCKED`): what must be allowed. Not part of the message. */
|
|
52
65
|
readonly needs: Needs | undefined;
|
|
53
66
|
constructor(code: ErrorCode, detail: string, span?: SourceSpan, options?: SitefileErrorOptions);
|
|
54
67
|
}
|
package/lib/src/errors.js
CHANGED
|
@@ -4,12 +4,31 @@ export function needsPlugin(name) {
|
|
|
4
4
|
export function needsTool(name) {
|
|
5
5
|
return { kind: 'tool', name, flag: '--allow-exec' };
|
|
6
6
|
}
|
|
7
|
+
export function needsHost(host) {
|
|
8
|
+
return { kind: 'host', name: host, flag: '--allow-hosts' };
|
|
9
|
+
}
|
|
10
|
+
export function needsSecretHost(id, host) {
|
|
11
|
+
return { kind: 'secret-host', name: `${id}=${host}`, flag: '--allow-secret-host' };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The `--json` form of a failed command (printed on stdout, next to the `error[CODE]:` line on stderr):
|
|
15
|
+
* `{ "error": { code, message, span, needs } }`, with `span` and `needs` null when absent.
|
|
16
|
+
*/
|
|
17
|
+
export function errorJson(e) {
|
|
18
|
+
const error = {
|
|
19
|
+
code: e.code,
|
|
20
|
+
message: e.message,
|
|
21
|
+
span: e.span ? { file: e.span.file, line: e.span.line, column: e.span.column } : null,
|
|
22
|
+
needs: e.needs ? { kind: e.needs.kind, name: e.needs.name, flag: e.needs.flag } : null,
|
|
23
|
+
};
|
|
24
|
+
return JSON.stringify({ error }, null, 2) + '\n';
|
|
25
|
+
}
|
|
7
26
|
export class SitefileError extends Error {
|
|
8
27
|
code;
|
|
9
28
|
span;
|
|
10
29
|
/** The message without the location prefix. */
|
|
11
30
|
detail;
|
|
12
|
-
/** For a permission error (`E_UNSUPPORTED` at a PLUGIN or TOOL line): what must be allowed. Not part of the message. */
|
|
31
|
+
/** For a permission error (`E_UNSUPPORTED` at a PLUGIN or TOOL line, `E_HOST_BLOCKED`): what must be allowed. Not part of the message. */
|
|
13
32
|
needs;
|
|
14
33
|
constructor(code, detail, span, options) {
|
|
15
34
|
super(span ? `${formatSpan(span)}: ${detail}` : detail, options);
|
package/lib/src/executor.d.ts
CHANGED
|
@@ -38,6 +38,11 @@ export interface BuildOptions {
|
|
|
38
38
|
readonly fetchPolicy?: Partial<FetchPolicy>;
|
|
39
39
|
/** Limits for extracting archives imported AS tree. */
|
|
40
40
|
readonly archiveLimits?: Partial<ArchiveLimits>;
|
|
41
|
+
/**
|
|
42
|
+
* Keep OS metadata (`__MACOSX/`, `._*`, `.DS_Store`, `Thumbs.db`, `desktop.ini`, `Icon\r`) in archives
|
|
43
|
+
* imported AS tree, like the CLI's `--keep-os-metadata`. Default false: they are dropped with a warning.
|
|
44
|
+
*/
|
|
45
|
+
readonly keepOsMetadata?: boolean;
|
|
41
46
|
/** Lockfile path, or false to disable. Default: `Sitefile.lock` next to the Sitefile. */
|
|
42
47
|
readonly lockfile?: string | false;
|
|
43
48
|
/** Fail instead of adding or changing lockfile entries. */
|
|
@@ -55,10 +60,22 @@ export interface BuildOptions {
|
|
|
55
60
|
* INTEGRITY nor a lockfile entry, or the BASE image is neither `@sha256:`-pinned nor locked.
|
|
56
61
|
*/
|
|
57
62
|
readonly strictPins?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* `EXPORT … FOR <host>`: leave out, with a warning, the REDIRECT and HEADER rules the host cannot express
|
|
65
|
+
* (default: they are E_EXPORT errors).
|
|
66
|
+
*/
|
|
67
|
+
readonly lossy?: boolean;
|
|
68
|
+
/** `--strict-paths`: exported paths Windows or GitHub Pages cannot hold are E_PATH_PORTABLE, not warnings. */
|
|
69
|
+
readonly strictPaths?: boolean;
|
|
58
70
|
/** Maximum imports resolved at once (default 4). */
|
|
59
71
|
readonly concurrency?: number;
|
|
60
72
|
/** Plugin process limits (per-call timeout, maximum result size). */
|
|
61
73
|
readonly pluginPolicy?: Partial<PluginPolicy>;
|
|
74
|
+
/**
|
|
75
|
+
* `--node` / `SITEFILE_NODE`: the absolute path of the Node binary JavaScript plugins run on
|
|
76
|
+
* (default: the Node running sitefile). Checked to be at least MIN_NODE before the first plugin starts.
|
|
77
|
+
*/
|
|
78
|
+
readonly node?: string;
|
|
62
79
|
/** Permit hard-linked files in the context (you assert they are safe). Default false. */
|
|
63
80
|
readonly allowHardlinks?: boolean;
|
|
64
81
|
/**
|
|
@@ -190,6 +207,11 @@ export declare function imageLockKey(b: ImageStageBase): string;
|
|
|
190
207
|
*/
|
|
191
208
|
export declare function checkPins(p: Plan, lock: Lockfile | undefined, baseRef: string | undefined): Pins;
|
|
192
209
|
export interface ExportTarget {
|
|
210
|
+
/**
|
|
211
|
+
* `--experimental-dictionary`: the previous build's files. The export gets `.dcz` deltas against them
|
|
212
|
+
* and `Use-As-Dictionary` headers (src/dictionary.ts).
|
|
213
|
+
*/
|
|
214
|
+
readonly dictionaryFrom?: Tree;
|
|
193
215
|
/** Overrides the Sitefile's EXPORT format. */
|
|
194
216
|
readonly format?: ExportFormat;
|
|
195
217
|
/** Overrides the Sitefile's EXPORT ... BASE (wbn). */
|
|
@@ -198,7 +220,9 @@ export interface ExportTarget {
|
|
|
198
220
|
readonly ociRoot?: string;
|
|
199
221
|
/** oci: site layer encoding (overrides EXPORT ... COMPRESSION; default gzip). */
|
|
200
222
|
readonly ociCompression?: OciCompression;
|
|
201
|
-
/**
|
|
223
|
+
/** oci: split the site's files over this many layers (`--oci-layers`, default 1). */
|
|
224
|
+
readonly ociLayers?: number;
|
|
225
|
+
/** wbn: `gzip` wraps the bundle in gzip; warc: each record is a gzip member (overrides EXPORT ... COMPRESSION; default none). */
|
|
202
226
|
readonly wbnCompression?: OciCompression;
|
|
203
227
|
/** Extra OCI config labels. */
|
|
204
228
|
readonly imageLabels?: Readonly<Record<string, string>>;
|
|
@@ -211,6 +235,8 @@ export interface ExportTarget {
|
|
|
211
235
|
}
|
|
212
236
|
export interface ExportedBuild extends BuildResult {
|
|
213
237
|
readonly format: ExportFormat;
|
|
238
|
+
/** `--experimental-dictionary`: the paths that got a `.dcz` delta. */
|
|
239
|
+
readonly dictionaryDeltas?: readonly string[];
|
|
214
240
|
/** Real path written: a directory for `directory`, otherwise the archive file. */
|
|
215
241
|
readonly outDir: string;
|
|
216
242
|
/** Archive size in bytes (archive formats only). */
|
|
@@ -219,6 +245,10 @@ export interface ExportedBuild extends BuildResult {
|
|
|
219
245
|
readonly fileDigest?: string;
|
|
220
246
|
/** oci: the image's manifest digest (its image ID). */
|
|
221
247
|
readonly manifestDigest?: string;
|
|
248
|
+
/** car: the root CID (CIDv1, base32). */
|
|
249
|
+
readonly rootCid?: string;
|
|
250
|
+
/** swbn: the Web Bundle ID (the Isolated Web App is `isolated-app://<id>/`). */
|
|
251
|
+
readonly webBundleId?: string;
|
|
222
252
|
/** Watch mode: set when the directory export applied only the changes (src/exporter.ts). */
|
|
223
253
|
readonly incremental?: {
|
|
224
254
|
readonly written: number;
|