@johnhenry/sitefile 0.0.0-stage → 0.0.1
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 +152 -0
- package/LICENSE +21 -0
- package/README.md +513 -2
- package/lib/src/archive-writers.d.ts +31 -0
- package/lib/src/archive-writers.js +197 -0
- package/lib/src/attest.d.ts +126 -0
- package/lib/src/attest.js +220 -0
- package/lib/src/bake.d.ts +74 -0
- package/lib/src/bake.js +372 -0
- package/lib/src/base-image.d.ts +76 -0
- package/lib/src/base-image.js +138 -0
- package/lib/src/build-args.d.ts +26 -0
- package/lib/src/build-args.js +164 -0
- package/lib/src/cache-limit.d.ts +54 -0
- package/lib/src/cache-limit.js +239 -0
- package/lib/src/casefold-data.d.ts +2 -0
- package/lib/src/casefold-data.js +217 -0
- package/lib/src/cbor.d.ts +39 -0
- package/lib/src/cbor.js +174 -0
- package/lib/src/checklinks.d.ts +42 -0
- package/lib/src/checklinks.js +120 -0
- package/lib/src/cli/bake.d.ts +2 -0
- package/lib/src/cli/bake.js +179 -0
- package/lib/src/cli/build-image.d.ts +21 -0
- package/lib/src/cli/build-image.js +42 -0
- package/lib/src/cli/cache.d.ts +8 -0
- package/lib/src/cli/cache.js +119 -0
- package/lib/src/cli/common.d.ts +29 -0
- package/lib/src/cli/common.js +100 -0
- package/lib/src/cli/git-context.d.ts +18 -0
- package/lib/src/cli/git-context.js +48 -0
- package/lib/src/cli/images.d.ts +6 -0
- package/lib/src/cli/images.js +285 -0
- package/lib/src/cli/index.d.ts +10 -0
- package/lib/src/cli/index.js +95 -0
- package/lib/src/cli/network.d.ts +34 -0
- package/lib/src/cli/network.js +56 -0
- package/lib/src/cli/outdated.d.ts +5 -0
- package/lib/src/cli/outdated.js +99 -0
- package/lib/src/cli/registry.d.ts +2 -0
- package/lib/src/cli/registry.js +127 -0
- package/lib/src/cli/serve-worker.d.ts +2 -0
- package/lib/src/cli/serve-worker.js +42 -0
- package/lib/src/cli/servers.d.ts +15 -0
- package/lib/src/cli/servers.js +467 -0
- package/lib/src/cli/vendor.d.ts +2 -0
- package/lib/src/cli/vendor.js +97 -0
- package/lib/src/cli/watch.d.ts +26 -0
- package/lib/src/cli/watch.js +81 -0
- package/lib/src/cli.d.ts +12 -0
- package/lib/src/cli.js +522 -0
- package/lib/src/csv.d.ts +27 -0
- package/lib/src/csv.js +117 -0
- package/lib/src/deflate.d.ts +76 -0
- package/lib/src/deflate.js +604 -0
- package/lib/src/digest.d.ts +3 -0
- package/lib/src/digest.js +7 -0
- package/lib/src/errors.d.ts +56 -0
- package/lib/src/errors.js +29 -0
- package/lib/src/executor.d.ts +393 -0
- package/lib/src/executor.js +2201 -0
- package/lib/src/explain.d.ts +64 -0
- package/lib/src/explain.js +445 -0
- package/lib/src/export-formats.d.ts +23 -0
- package/lib/src/export-formats.js +63 -0
- package/lib/src/exporter.d.ts +103 -0
- package/lib/src/exporter.js +676 -0
- package/lib/src/fingerprint.d.ts +40 -0
- package/lib/src/fingerprint.js +168 -0
- package/lib/src/frontmatter.d.ts +22 -0
- package/lib/src/frontmatter.js +45 -0
- package/lib/src/index.d.ts +13 -0
- package/lib/src/index.js +13 -0
- package/lib/src/language/ast.d.ts +360 -0
- package/lib/src/language/ast.js +57 -0
- package/lib/src/language/parser.d.ts +3 -0
- package/lib/src/language/parser.js +612 -0
- package/lib/src/language/scanner.d.ts +110 -0
- package/lib/src/language/scanner.js +449 -0
- package/lib/src/language/validate.d.ts +13 -0
- package/lib/src/language/validate.js +367 -0
- package/lib/src/links.d.ts +79 -0
- package/lib/src/links.js +583 -0
- package/lib/src/lint.d.ts +10 -0
- package/lib/src/lint.js +223 -0
- package/lib/src/markdown.d.ts +29 -0
- package/lib/src/markdown.js +612 -0
- package/lib/src/media.d.ts +82 -0
- package/lib/src/media.js +650 -0
- package/lib/src/memo.d.ts +57 -0
- package/lib/src/memo.js +93 -0
- package/lib/src/oci.d.ts +178 -0
- package/lib/src/oci.js +380 -0
- package/lib/src/outdated.d.ts +46 -0
- package/lib/src/outdated.js +195 -0
- package/lib/src/pages.d.ts +10 -0
- package/lib/src/pages.js +54 -0
- package/lib/src/paths.d.ts +39 -0
- package/lib/src/paths.js +101 -0
- package/lib/src/planner.d.ts +297 -0
- package/lib/src/planner.js +410 -0
- package/lib/src/plugins/cache.d.ts +96 -0
- package/lib/src/plugins/cache.js +325 -0
- package/lib/src/plugins/exec.d.ts +51 -0
- package/lib/src/plugins/exec.js +144 -0
- package/lib/src/plugins/host.d.ts +75 -0
- package/lib/src/plugins/host.js +277 -0
- package/lib/src/plugins/wasm.d.ts +23 -0
- package/lib/src/plugins/wasm.js +249 -0
- package/lib/src/profile.d.ts +42 -0
- package/lib/src/profile.js +68 -0
- package/lib/src/ref.d.ts +40 -0
- package/lib/src/ref.js +79 -0
- package/lib/src/registry-auth.d.ts +32 -0
- package/lib/src/registry-auth.js +151 -0
- package/lib/src/registry-cache.d.ts +71 -0
- package/lib/src/registry-cache.js +333 -0
- package/lib/src/registry-ops.d.ts +51 -0
- package/lib/src/registry-ops.js +248 -0
- package/lib/src/registry.d.ts +115 -0
- package/lib/src/registry.js +524 -0
- package/lib/src/render.d.ts +134 -0
- package/lib/src/render.js +576 -0
- package/lib/src/resources/archive.d.ts +11 -0
- package/lib/src/resources/archive.js +306 -0
- package/lib/src/resources/bundle-data.d.ts +16 -0
- package/lib/src/resources/bundle-data.js +50 -0
- package/lib/src/resources/convert.d.ts +12 -0
- package/lib/src/resources/convert.js +63 -0
- package/lib/src/resources/documents.d.ts +35 -0
- package/lib/src/resources/documents.js +122 -0
- package/lib/src/resources/git.d.ts +103 -0
- package/lib/src/resources/git.js +720 -0
- package/lib/src/resources/https.d.ts +74 -0
- package/lib/src/resources/https.js +413 -0
- package/lib/src/resources/ignore.d.ts +33 -0
- package/lib/src/resources/ignore.js +119 -0
- package/lib/src/resources/local.d.ts +64 -0
- package/lib/src/resources/local.js +248 -0
- package/lib/src/resources/lockfile.d.ts +52 -0
- package/lib/src/resources/lockfile.js +172 -0
- package/lib/src/resources/netpolicy.d.ts +6 -0
- package/lib/src/resources/netpolicy.js +82 -0
- package/lib/src/resources/network.d.ts +70 -0
- package/lib/src/resources/network.js +304 -0
- package/lib/src/resources/types.d.ts +69 -0
- package/lib/src/resources/types.js +13 -0
- package/lib/src/resources/vendor.d.ts +94 -0
- package/lib/src/resources/vendor.js +296 -0
- package/lib/src/resources/wbn-reader.d.ts +44 -0
- package/lib/src/resources/wbn-reader.js +302 -0
- package/lib/src/schema.d.ts +25 -0
- package/lib/src/schema.js +169 -0
- package/lib/src/secrets.d.ts +21 -0
- package/lib/src/secrets.js +103 -0
- package/lib/src/serve-rules.d.ts +29 -0
- package/lib/src/serve-rules.js +123 -0
- package/lib/src/server.d.ts +45 -0
- package/lib/src/server.js +246 -0
- package/lib/src/servers.d.ts +85 -0
- package/lib/src/servers.js +225 -0
- package/lib/src/site.d.ts +60 -0
- package/lib/src/site.js +169 -0
- package/lib/src/store.d.ts +151 -0
- package/lib/src/store.js +596 -0
- package/lib/src/tree.d.ts +50 -0
- package/lib/src/tree.js +134 -0
- package/lib/src/values.d.ts +7 -0
- package/lib/src/values.js +37 -0
- package/lib/src/vendor.d.ts +19 -0
- package/lib/src/vendor.js +145 -0
- package/lib/src/watch.d.ts +44 -0
- package/lib/src/watch.js +137 -0
- package/lib/src/wbn.d.ts +26 -0
- package/lib/src/wbn.js +241 -0
- package/lib/src/yaml.d.ts +34 -0
- package/lib/src/yaml.js +562 -0
- package/package.json +59 -4
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { Tree } from './tree.js';
|
|
2
|
+
export interface ExportOptions {
|
|
3
|
+
/** The build context. The destination may never be, or contain, it. */
|
|
4
|
+
readonly contextDir: string;
|
|
5
|
+
/** Replace a non-empty destination outside the context. */
|
|
6
|
+
readonly force?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* TEST-ONLY. Awaited after the temp tree is fully written and immediately
|
|
9
|
+
* before the final re-validation and swap, so tests can deterministically
|
|
10
|
+
* simulate a concurrent change to the destination. Not exposed by the CLI.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
readonly beforeSwap?: () => Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Watch mode (directory exports only): what the previous export of this session left on
|
|
16
|
+
* disk. When the destination still holds exactly that, only the files that changed are
|
|
17
|
+
* written ({@link ExportState}); either way the export is recorded for the next one.
|
|
18
|
+
*/
|
|
19
|
+
readonly incremental?: ExportState;
|
|
20
|
+
/**
|
|
21
|
+
* TEST-ONLY. Incremental export: awaited after the changed files are staged, before any
|
|
22
|
+
* of them is moved into the destination. @internal
|
|
23
|
+
*/
|
|
24
|
+
readonly beforeApply?: () => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export interface ExportResult {
|
|
27
|
+
/** Real absolute path the tree was written to. */
|
|
28
|
+
readonly outDir: string;
|
|
29
|
+
readonly files: number;
|
|
30
|
+
/** Set when only the changes were applied in place (incremental export). */
|
|
31
|
+
readonly incremental?: {
|
|
32
|
+
readonly written: number;
|
|
33
|
+
readonly removed: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The temp directory starts empty and the tree has no two paths equal under
|
|
38
|
+
* case folding, so EEXIST/ENOTDIR/EISDIR here means the destination file
|
|
39
|
+
* system treats two different tree paths as one name (a folding or
|
|
40
|
+
* normalization rule wider than Sitefile's). Report the artifact path, not the
|
|
41
|
+
* temp path.
|
|
42
|
+
*/
|
|
43
|
+
export declare function occupied(e: unknown, p: string): unknown;
|
|
44
|
+
/** Matches the exporter's temporary (`tmp`) and backup (`old`) sibling names. */
|
|
45
|
+
export declare const TEMP_PREFIX_PATTERN: RegExp;
|
|
46
|
+
/** True if `name` is a temp/backup sibling the exporter creates for `outBasename`. */
|
|
47
|
+
export declare function isExporterTempName(name: string, outBasename: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Materialize `tree` as a directory at `outDir`. Files are written into a
|
|
50
|
+
* fresh temporary sibling, which is then swapped in; on failure the previous
|
|
51
|
+
* destination (if any) is left in place.
|
|
52
|
+
*/
|
|
53
|
+
export declare function exportDirectory(tree: Tree, outDir: string, options: ExportOptions): Promise<ExportResult>;
|
|
54
|
+
/** What a watch session's last directory export left on disk; see {@link ExportOptions.incremental}. */
|
|
55
|
+
export declare class ExportState {
|
|
56
|
+
/** @internal */
|
|
57
|
+
snapshot: Snapshot | undefined;
|
|
58
|
+
/** Forget the last export: the next one rewrites everything. */
|
|
59
|
+
clear(): void;
|
|
60
|
+
}
|
|
61
|
+
interface Stamp {
|
|
62
|
+
readonly dev: number;
|
|
63
|
+
readonly ino: number;
|
|
64
|
+
readonly size: number;
|
|
65
|
+
readonly mtimeMs: number;
|
|
66
|
+
readonly ctimeMs: number;
|
|
67
|
+
readonly mode: number;
|
|
68
|
+
}
|
|
69
|
+
interface Recorded {
|
|
70
|
+
readonly digest: string;
|
|
71
|
+
readonly mode: number;
|
|
72
|
+
readonly stamp: Stamp;
|
|
73
|
+
}
|
|
74
|
+
interface Snapshot {
|
|
75
|
+
readonly outReal: string;
|
|
76
|
+
readonly outId: FileId;
|
|
77
|
+
readonly parentId: FileId;
|
|
78
|
+
/** Artifact path (`/a/b.html`) → what was written there. */
|
|
79
|
+
readonly files: ReadonlyMap<string, Recorded>;
|
|
80
|
+
/** Every directory below the destination (`/a`, `/a/b`). */
|
|
81
|
+
readonly dirs: ReadonlySet<string>;
|
|
82
|
+
}
|
|
83
|
+
export interface ExportFileResult {
|
|
84
|
+
/** Real absolute path of the file that was written. */
|
|
85
|
+
readonly outFile: string;
|
|
86
|
+
readonly bytes: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Write `data` as a single file at `outFile` (zip, tar, tgz, wbn). Same
|
|
90
|
+
* destination rules as {@link exportDirectory}: never the filesystem root, the
|
|
91
|
+
* home directory, the build context or a parent of it; never through a symlink;
|
|
92
|
+
* a directory is refused; an existing file outside the context needs
|
|
93
|
+
* `force`. The bytes go to a temporary sibling that is renamed into place after
|
|
94
|
+
* the parent and destination are re-validated; only that exact temp file (by
|
|
95
|
+
* dev/ino) is ever deleted, and nothing already at `outFile` is removed except
|
|
96
|
+
* by the replacing rename.
|
|
97
|
+
*/
|
|
98
|
+
export declare function exportFile(data: Uint8Array, outFile: string, options: ExportOptions): Promise<ExportFileResult>;
|
|
99
|
+
interface FileId {
|
|
100
|
+
readonly dev: number | bigint;
|
|
101
|
+
readonly ino: number | bigint;
|
|
102
|
+
}
|
|
103
|
+
export {};
|