@riebeckite/honox 0.0.26 → 0.0.28
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/dist/index.js +832 -784
- package/dist/src/ssg/build_output.d.ts +15 -0
- package/dist/src/ssg/diagnostics.d.ts +24 -0
- package/dist/src/ssg/file_system.d.ts +4 -0
- package/dist/src/ssg/inventory.d.ts +5 -0
- package/dist/src/ssg/output_cache.d.ts +29 -0
- package/dist/src/ssg/runtime_metrics.d.ts +4 -0
- package/dist/src/ssg/types.d.ts +122 -0
- package/dist/src/ssg_plugin.d.ts +3 -37
- package/package.json +5 -5
- package/style.css +14 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ClientBuildArtifacts = {
|
|
2
|
+
stagingDirectory: string;
|
|
3
|
+
paths: readonly string[];
|
|
4
|
+
manifestFingerprint: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const CLOUDFLARE_WORKER_ASSET_LIMIT: number;
|
|
7
|
+
export declare function findOversizedAssets(directory: string, relativeDirectory?: string): Promise<{
|
|
8
|
+
path: string;
|
|
9
|
+
size: number;
|
|
10
|
+
}[]>;
|
|
11
|
+
export declare function formatBytes(bytes: number): string;
|
|
12
|
+
export declare function emptyBuildOutputDirectory(outDir: string): Promise<void>;
|
|
13
|
+
export declare function preserveClientBuildArtifacts(outDir: string): Promise<ClientBuildArtifacts | undefined>;
|
|
14
|
+
export declare function restoreClientBuildArtifacts(outDir: string, artifacts: ClientBuildArtifacts | undefined): Promise<void>;
|
|
15
|
+
export declare function discardClientBuildArtifacts(artifacts: ClientBuildArtifacts | undefined): Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SsgModule } from "./types.js";
|
|
2
|
+
export declare function formatSsrNoExternal(): string;
|
|
3
|
+
export declare function logSsgDiagnostics(logger: {
|
|
4
|
+
info(message: string): void;
|
|
5
|
+
}, message: string): void;
|
|
6
|
+
export declare function logGeneratedHtmlAssetDiagnostics(logger: {
|
|
7
|
+
info(message: string): void;
|
|
8
|
+
}, pages: readonly {
|
|
9
|
+
path: string;
|
|
10
|
+
html: string;
|
|
11
|
+
}[]): void;
|
|
12
|
+
/**
|
|
13
|
+
* Runs post-SSG HTML inspections contributed by Core plugins. Structural rules
|
|
14
|
+
* that need the whole document (a11y, duplicate ids, anchors) cannot see the
|
|
15
|
+
* final page during the Core lifecycle, so `@riebeckite/honox` forwards every
|
|
16
|
+
* emitted HTML file to plugins that declare `inspectGeneratedHtml`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function inspectGeneratedHtmlPages(module: SsgModule, pages: readonly {
|
|
19
|
+
path: string;
|
|
20
|
+
html: string;
|
|
21
|
+
}[], log: {
|
|
22
|
+
warn: (message: string) => void;
|
|
23
|
+
info: (message: string) => void;
|
|
24
|
+
}): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function isMissingDirectoryError(error: unknown): boolean;
|
|
2
|
+
export declare function isNotFoundError(error: unknown): boolean;
|
|
3
|
+
export declare function isAbsolutePath(path: string): boolean;
|
|
4
|
+
export declare function resolveWithinDirectory(directory: string, relativePath: string, label: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NoChangeFastPathOutputMetrics } from "./types.js";
|
|
2
|
+
export declare function computeAppFingerprint(root: string, configFile: string | undefined): Promise<string>;
|
|
3
|
+
export declare function fingerprintDirectory(directory: string): Promise<string>;
|
|
4
|
+
export declare function fingerprintOutputDirectory(directory: string, relativeDirectory?: string, metrics?: NoChangeFastPathOutputMetrics): Promise<Record<string, string>>;
|
|
5
|
+
export declare function inventoriesEqual(left: Record<string, string>, right: Record<string, string>): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { NoChangeFastPathOutputMetrics, NoChangeFastPathResult, OutputCacheDecision, OutputCacheRejectionReason } from "./types.js";
|
|
2
|
+
export type OutputCacheEntry = {
|
|
3
|
+
cachePath: string;
|
|
4
|
+
checksum: string;
|
|
5
|
+
};
|
|
6
|
+
export type OutputCacheState = {
|
|
7
|
+
version: 4;
|
|
8
|
+
appFingerprint?: string;
|
|
9
|
+
clientManifestFingerprint?: string;
|
|
10
|
+
outputs: Record<string, OutputCacheEntry>;
|
|
11
|
+
finalOutputInventory?: Record<string, string>;
|
|
12
|
+
publicDirectory?: string;
|
|
13
|
+
publicFingerprint?: string;
|
|
14
|
+
configFile?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function decideOutputCacheRejection(decision: OutputCacheDecision): OutputCacheRejectionReason | undefined;
|
|
17
|
+
export declare function createNoChangeFastPathOutputMetrics(): NoChangeFastPathOutputMetrics;
|
|
18
|
+
export declare function verifyNoChangeFastPath(input: {
|
|
19
|
+
readonly root: string;
|
|
20
|
+
readonly outputDirectory: string;
|
|
21
|
+
readonly expectedOutputPaths: readonly string[];
|
|
22
|
+
readonly metrics?: NoChangeFastPathOutputMetrics;
|
|
23
|
+
}): Promise<NoChangeFastPathResult>;
|
|
24
|
+
export declare function loadOutputCache(path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<(OutputCacheState & {
|
|
25
|
+
fileSizeBytes?: number;
|
|
26
|
+
}) | undefined>;
|
|
27
|
+
export declare function saveOutputCache(path: string, state: OutputCacheState, outputDirectory: string, timingsMs?: Record<string, number>): Promise<string>;
|
|
28
|
+
export declare function decodeOutput(outputCachePath: string, entry: OutputCacheEntry): Promise<Uint8Array>;
|
|
29
|
+
export declare function waitForFaultInjection(point: string): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SsgOutputMetrics } from "./types.js";
|
|
2
|
+
export declare function measure<T>(timingsMs: Record<string, number> | undefined, name: string, fn: () => Promise<T>): Promise<T>;
|
|
3
|
+
export declare function measureSync<T>(timingsMs: Record<string, number> | undefined, name: string, fn: () => T): T;
|
|
4
|
+
export declare function writeSsgOutputMetrics(metrics: SsgOutputMetrics): Promise<void>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { toSSG } from "hono/ssg";
|
|
2
|
+
export type GeneratedOutputAsset = {
|
|
3
|
+
type: "asset";
|
|
4
|
+
fileName: string;
|
|
5
|
+
source: string | Uint8Array;
|
|
6
|
+
};
|
|
7
|
+
export type SsgGeneratedHtmlDiagnostic = {
|
|
8
|
+
severity: "info" | "warning" | "error";
|
|
9
|
+
message: string;
|
|
10
|
+
code?: string;
|
|
11
|
+
filePath?: string;
|
|
12
|
+
};
|
|
13
|
+
export type SsgHtmlInspectorPlugin = {
|
|
14
|
+
name?: string;
|
|
15
|
+
inspectGeneratedHtml?: (page: {
|
|
16
|
+
path: string;
|
|
17
|
+
html: string;
|
|
18
|
+
}) => readonly SsgGeneratedHtmlDiagnostic[];
|
|
19
|
+
};
|
|
20
|
+
export type SsgModule = {
|
|
21
|
+
default: Parameters<typeof toSSG>[0];
|
|
22
|
+
content?: {
|
|
23
|
+
getManifest(): Promise<{
|
|
24
|
+
generatedOutputs?: readonly {
|
|
25
|
+
path: string;
|
|
26
|
+
content: string | Uint8Array;
|
|
27
|
+
}[];
|
|
28
|
+
}>;
|
|
29
|
+
getProcessedContentCount(): number;
|
|
30
|
+
getReusedContentCount(): number;
|
|
31
|
+
getManifestHookMetrics(): {
|
|
32
|
+
manifestHooksExecuted: number;
|
|
33
|
+
manifestHooksReused: number;
|
|
34
|
+
manifestHookCacheHit: number;
|
|
35
|
+
manifestHookCacheMiss: number;
|
|
36
|
+
manifestHookDurationMs: number;
|
|
37
|
+
byPlugin: Record<string, {
|
|
38
|
+
executed: number;
|
|
39
|
+
reused: number;
|
|
40
|
+
cacheHit: number;
|
|
41
|
+
cacheMiss: number;
|
|
42
|
+
durationMs: number;
|
|
43
|
+
reason: string;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
getOutputChangeSet(): Promise<{
|
|
47
|
+
affected: readonly {
|
|
48
|
+
kind: string;
|
|
49
|
+
path: string;
|
|
50
|
+
}[];
|
|
51
|
+
removed: readonly {
|
|
52
|
+
kind: string;
|
|
53
|
+
path: string;
|
|
54
|
+
}[];
|
|
55
|
+
unchanged: readonly {
|
|
56
|
+
kind: string;
|
|
57
|
+
path: string;
|
|
58
|
+
}[];
|
|
59
|
+
fullRegenerationRequired: boolean;
|
|
60
|
+
candidateOutputCount: number;
|
|
61
|
+
affectedOutputCount: number;
|
|
62
|
+
removedOutputCount: number;
|
|
63
|
+
unchangedOutputCount: number;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
config?: {
|
|
67
|
+
plugins?: readonly SsgHtmlInspectorPlugin[];
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export type SsgOutputChangeSet = NonNullable<SsgModule["content"]> extends {
|
|
71
|
+
getOutputChangeSet(): Promise<infer T>;
|
|
72
|
+
} ? T : never;
|
|
73
|
+
export type SsgOutputMetrics = {
|
|
74
|
+
processedContentCount: number;
|
|
75
|
+
reusedContentCount: number;
|
|
76
|
+
candidateOutputCount: number;
|
|
77
|
+
affectedOutputCount: number;
|
|
78
|
+
removedOutputCount: number;
|
|
79
|
+
unchangedOutputCount: number;
|
|
80
|
+
renderedOutputCount: number;
|
|
81
|
+
emittedOutputCount: number;
|
|
82
|
+
reusedOutputCount: number;
|
|
83
|
+
deletedOutputCount: number;
|
|
84
|
+
shadowedOutputCount: number;
|
|
85
|
+
fullRegenerationRequired: boolean;
|
|
86
|
+
htmlOutputCount: number;
|
|
87
|
+
assetOutputCount: number;
|
|
88
|
+
cacheFileSizeBytes: number | null;
|
|
89
|
+
cacheEntriesRead: number;
|
|
90
|
+
cacheEntriesSerialized: number;
|
|
91
|
+
enumeratedRouteCount: number;
|
|
92
|
+
renderedRouteCount: number;
|
|
93
|
+
skippedRouteCount: number;
|
|
94
|
+
manifestHooksExecuted: number;
|
|
95
|
+
manifestHooksReused: number;
|
|
96
|
+
manifestHookCacheHit: number;
|
|
97
|
+
manifestHookCacheMiss: number;
|
|
98
|
+
manifestHookDurationMs: number;
|
|
99
|
+
manifestHookPlugins: Record<string, unknown>;
|
|
100
|
+
outputCacheDecision: OutputCacheDecision;
|
|
101
|
+
outputCacheRejectionReason: OutputCacheRejectionReason | null;
|
|
102
|
+
timingsMs: Record<string, number>;
|
|
103
|
+
};
|
|
104
|
+
export type OutputCacheRejectionReason = "change-set-unavailable" | "full-regeneration-required" | "output-cache-missing-or-invalid" | "app-fingerprint-changed" | "client-manifest-fingerprint-changed" | "unchanged-output-not-cached";
|
|
105
|
+
export type OutputCacheDecision = {
|
|
106
|
+
readonly changeSetPresent: boolean;
|
|
107
|
+
readonly changeSetRequiresFullRegeneration: boolean;
|
|
108
|
+
readonly outputCacheLoaded: boolean;
|
|
109
|
+
readonly appFingerprintMatch: boolean;
|
|
110
|
+
readonly clientManifestFingerprintMatch: boolean;
|
|
111
|
+
readonly uncoveredUnchangedCount: number;
|
|
112
|
+
};
|
|
113
|
+
export type NoChangeFastPathResult = {
|
|
114
|
+
readonly used: boolean;
|
|
115
|
+
readonly blockReason?: string;
|
|
116
|
+
};
|
|
117
|
+
export type NoChangeFastPathOutputMetrics = {
|
|
118
|
+
outputInventoryValidationDurationMs: number;
|
|
119
|
+
outputHashValidationDurationMs: number;
|
|
120
|
+
outputFilesHashed: number;
|
|
121
|
+
outputBytesHashed: number;
|
|
122
|
+
};
|
package/dist/src/ssg_plugin.d.ts
CHANGED
|
@@ -1,48 +1,14 @@
|
|
|
1
1
|
import { toSSG } from "hono/ssg";
|
|
2
2
|
import { type ConfigEnv, type Plugin } from "vite";
|
|
3
|
+
export { emptyBuildOutputDirectory } from "./ssg/build_output.js";
|
|
4
|
+
export { createNoChangeFastPathOutputMetrics, decideOutputCacheRejection, loadOutputCache, saveOutputCache, verifyNoChangeFastPath, } from "./ssg/output_cache.js";
|
|
5
|
+
export type { NoChangeFastPathOutputMetrics, NoChangeFastPathResult, OutputCacheDecision, OutputCacheRejectionReason, } from "./ssg/types.js";
|
|
3
6
|
type ToSsgOptions = NonNullable<Parameters<typeof toSSG>[2]>;
|
|
4
|
-
type OutputCacheEntry = {
|
|
5
|
-
cachePath: string;
|
|
6
|
-
checksum: string;
|
|
7
|
-
};
|
|
8
|
-
type OutputCacheState = {
|
|
9
|
-
version: 4;
|
|
10
|
-
appFingerprint?: string;
|
|
11
|
-
clientManifestFingerprint?: string;
|
|
12
|
-
outputs: Record<string, OutputCacheEntry>;
|
|
13
|
-
finalOutputInventory?: Record<string, string>;
|
|
14
|
-
publicDirectory?: string;
|
|
15
|
-
publicFingerprint?: string;
|
|
16
|
-
configFile?: string;
|
|
17
|
-
};
|
|
18
|
-
export type NoChangeFastPathResult = {
|
|
19
|
-
readonly used: boolean;
|
|
20
|
-
readonly blockReason?: string;
|
|
21
|
-
};
|
|
22
|
-
export type NoChangeFastPathOutputMetrics = {
|
|
23
|
-
outputInventoryValidationDurationMs: number;
|
|
24
|
-
outputHashValidationDurationMs: number;
|
|
25
|
-
outputFilesHashed: number;
|
|
26
|
-
outputBytesHashed: number;
|
|
27
|
-
};
|
|
28
|
-
export declare function createNoChangeFastPathOutputMetrics(): NoChangeFastPathOutputMetrics;
|
|
29
7
|
export type RiebeckiteSsgOptions = {
|
|
30
8
|
entry?: string;
|
|
31
9
|
plugins?: ToSsgOptions["plugins"];
|
|
32
10
|
extensionMap?: Record<string, string>;
|
|
33
11
|
};
|
|
34
12
|
export declare function riebeckiteSsg(options?: RiebeckiteSsgOptions): Plugin;
|
|
35
|
-
export declare function emptyBuildOutputDirectory(outDir: string): Promise<void>;
|
|
36
13
|
export declare function shouldApplyRiebeckiteSsg(_config: unknown, env: ConfigEnv): boolean;
|
|
37
14
|
export declare function findBuildOutputSiteCollisions(buildOutputPaths: Iterable<string>, siteOwnedOutputPaths: ReadonlySet<string>): readonly string[];
|
|
38
|
-
export declare function verifyNoChangeFastPath(input: {
|
|
39
|
-
readonly root: string;
|
|
40
|
-
readonly outputDirectory: string;
|
|
41
|
-
readonly expectedOutputPaths: readonly string[];
|
|
42
|
-
readonly metrics?: NoChangeFastPathOutputMetrics;
|
|
43
|
-
}): Promise<NoChangeFastPathResult>;
|
|
44
|
-
export declare function loadOutputCache(path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<(OutputCacheState & {
|
|
45
|
-
fileSizeBytes?: number;
|
|
46
|
-
}) | undefined>;
|
|
47
|
-
export declare function saveOutputCache(path: string, state: OutputCacheState, outputDirectory: string, timingsMs?: Record<string, number>): Promise<string>;
|
|
48
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/honox",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"hono": "^4.12.25",
|
|
45
45
|
"honox": "0.1.56",
|
|
46
46
|
"vite": "^8.0.9",
|
|
47
|
-
"@riebeckite/core": "0.0.
|
|
48
|
-
"@riebeckite/
|
|
49
|
-
"@riebeckite/
|
|
47
|
+
"@riebeckite/core": "0.0.28",
|
|
48
|
+
"@riebeckite/ui": "0.0.28",
|
|
49
|
+
"@riebeckite/plugin-color-mode": "0.0.28"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"tsx": "^4.22.4",
|
|
53
|
-
"@riebeckite/test": "0.0.
|
|
53
|
+
"@riebeckite/test": "0.0.28"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|