@riebeckite/honox 0.0.34 → 0.0.36
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.d.ts +2 -1
- package/dist/index.js +1200 -1028
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +6 -0
- package/dist/server.js +4 -4
- package/dist/src/content_route.d.ts +2 -2
- package/dist/src/content_watch.d.ts +0 -2
- package/dist/src/routes.d.ts +1 -1
- package/dist/src/ssg/artifact_writer.d.ts +13 -0
- package/dist/src/ssg/build_output.d.ts +4 -0
- package/dist/src/ssg/inventory.d.ts +1 -0
- package/dist/src/ssg/output_cache.d.ts +5 -0
- package/dist/src/ssg/runner.d.ts +12 -0
- package/dist/src/ssg/standalone.d.ts +14 -0
- package/dist/src/ssg/types.d.ts +4 -2
- package/dist/src/ssg_plugin.d.ts +2 -2
- package/dist/src/vite_runner.d.ts +5 -0
- package/package.json +12 -10
- package/style.css +5 -1
- package/dist/src/development_inspector.d.ts +0 -3
package/dist/runtime.d.ts
CHANGED
package/dist/runtime.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// runtime.ts
|
|
2
|
+
import {
|
|
3
|
+
createDevelopmentTrace
|
|
4
|
+
} from "@riebeckite/core";
|
|
5
|
+
|
|
1
6
|
// src/resolved_config.ts
|
|
2
7
|
import path from "node:path";
|
|
3
8
|
function resolveHonoxConfig(config, appRoot) {
|
|
@@ -12,5 +17,6 @@ function resolveHonoxConfig(config, appRoot) {
|
|
|
12
17
|
};
|
|
13
18
|
}
|
|
14
19
|
export {
|
|
20
|
+
createDevelopmentTrace,
|
|
15
21
|
resolveHonoxConfig
|
|
16
22
|
};
|
package/dist/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getEntryLanguage, htmlOutputPath } from "@riebeckite/core";
|
|
|
3
3
|
async function resolveRiebeckiteRoute(content, pathname) {
|
|
4
4
|
const page = await content.resolvePage(pathname);
|
|
5
5
|
if (page) return { kind: "page", page };
|
|
6
|
-
return resolveContentRoute(await content.
|
|
6
|
+
return resolveContentRoute(await content.getRequestManifest(), pathname);
|
|
7
7
|
}
|
|
8
8
|
function applyRiebeckiteRouteContext(c, route) {
|
|
9
9
|
if (route.kind === "page") {
|
|
@@ -45,7 +45,7 @@ async function resolveRiebeckiteContentRequest(c, content, parameter = "slug") {
|
|
|
45
45
|
return resolveRouteRequest(c, content);
|
|
46
46
|
}
|
|
47
47
|
async function resolveRiebeckiteHomeRequest(c, content) {
|
|
48
|
-
const indexEntry = (await content.
|
|
48
|
+
const indexEntry = (await content.getRequestManifest()).bySlug.get("index");
|
|
49
49
|
if (indexEntry && indexEntry.permalink !== "/") {
|
|
50
50
|
return {
|
|
51
51
|
kind: "response",
|
|
@@ -119,7 +119,7 @@ function normalizeRequestPath(pathname) {
|
|
|
119
119
|
return trailingSlash ? `${path}/` : path;
|
|
120
120
|
}
|
|
121
121
|
function routeOutputPath(pathname) {
|
|
122
|
-
return htmlOutputPath(
|
|
122
|
+
return htmlOutputPath(pathname);
|
|
123
123
|
}
|
|
124
124
|
function decodeSegment(segment) {
|
|
125
125
|
try {
|
|
@@ -307,7 +307,7 @@ function createHomeRoute(options) {
|
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
309
|
async function renderContent(c, options, entry, post) {
|
|
310
|
-
const manifest = await options.content.
|
|
310
|
+
const manifest = await options.content.getRequestManifest();
|
|
311
311
|
const view = createPublicContentView(manifest);
|
|
312
312
|
const publicEntry = view.findRoutableBySlug(entry.slug);
|
|
313
313
|
if (!publicEntry) return c.notFound();
|
|
@@ -17,7 +17,7 @@ export type ResolvedRiebeckiteRoute = Exclude<ResolvedContentRoute, null> | {
|
|
|
17
17
|
* single HonoX adapter needed by a catch-all site route; plugins never add
|
|
18
18
|
* HonoX routes themselves.
|
|
19
19
|
*/
|
|
20
|
-
export declare function resolveRiebeckiteRoute(content: Pick<ContentManager, "resolvePage" | "
|
|
20
|
+
export declare function resolveRiebeckiteRoute(content: Pick<ContentManager, "resolvePage" | "getRequestManifest">, pathname: string): Promise<ResolvedRiebeckiteRoute>;
|
|
21
21
|
/**
|
|
22
22
|
* The resolved route request a Site consumes from a catch-all content route.
|
|
23
23
|
*
|
|
@@ -42,7 +42,7 @@ export type ResolvedContentRequest = {
|
|
|
42
42
|
* so the resolver owns their values instead of each route rebuilding them.
|
|
43
43
|
*/
|
|
44
44
|
export declare function applyRiebeckiteRouteContext(c: Context, route: Exclude<ResolvedRiebeckiteRoute, null>): void;
|
|
45
|
-
type RouteContent = Pick<ContentManager, "resolvePage" | "
|
|
45
|
+
type RouteContent = Pick<ContentManager, "resolvePage" | "getRequestManifest" | "getProcessedContent">;
|
|
46
46
|
/**
|
|
47
47
|
* Resolves a catch-all content request into what a Site should render.
|
|
48
48
|
*
|
|
@@ -6,7 +6,5 @@ type RiebeckiteContentWatchOptions = {
|
|
|
6
6
|
};
|
|
7
7
|
export declare function riebeckiteContentWatch(options: RiebeckiteContentWatchOptions): Plugin;
|
|
8
8
|
export declare function isSiteAssetPath(logicalPath: string): boolean;
|
|
9
|
-
export declare function isPathInsideDirectory(directory: string, file: string): boolean;
|
|
10
|
-
export declare function toLogicalPath(directory: string, file: string): string;
|
|
11
9
|
export declare function invalidateApplicationRuntime(server: Pick<ViteDevServer, "environments">, appRoot: string): number;
|
|
12
10
|
export {};
|
package/dist/src/routes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContentManager, ContentManifestEntry, PostContent, ResolvedRiebeckiteConfig } from "@riebeckite/core";
|
|
2
2
|
import type { Child } from "hono/jsx";
|
|
3
|
-
type RouteContent = Pick<ContentManager, "resolvePage" | "getManifest" | "getProcessedContent" | "getOutputChangeSet" | "getPagePaths">;
|
|
3
|
+
type RouteContent = Pick<ContentManager, "resolvePage" | "getManifest" | "getRequestManifest" | "getProcessedContent" | "getOutputChangeSet" | "getPagePaths">;
|
|
4
4
|
type RenderContent = (content: {
|
|
5
5
|
entry: ContentManifestEntry;
|
|
6
6
|
post: PostContent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type BuildArtifactWriter = {
|
|
2
|
+
readonly directory: string;
|
|
3
|
+
copyFrom(source: string): Promise<void>;
|
|
4
|
+
remove(path: string): Promise<void>;
|
|
5
|
+
write(path: string, data: string | Uint8Array): Promise<void>;
|
|
6
|
+
publish(): Promise<void>;
|
|
7
|
+
discard(): Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare function createBuildArtifactWriter(input: {
|
|
10
|
+
readonly outputDirectory: string;
|
|
11
|
+
readonly stagingDirectory?: string;
|
|
12
|
+
readonly clearStagingDirectory?: boolean;
|
|
13
|
+
}): Promise<BuildArtifactWriter>;
|
|
@@ -14,3 +14,7 @@ export declare function preserveClientBuildArtifacts(outDir: string): Promise<Cl
|
|
|
14
14
|
export declare function restoreClientBuildArtifacts(outDir: string, artifacts: ClientBuildArtifacts | undefined): Promise<void>;
|
|
15
15
|
export declare function discardClientBuildArtifacts(artifacts: ClientBuildArtifacts | undefined): Promise<void>;
|
|
16
16
|
export declare function collectBuildOutputPaths(directory: string, relativeDirectory?: string): Promise<string[]>;
|
|
17
|
+
export declare function verifyClientBuildArtifacts(input: {
|
|
18
|
+
readonly outDir: string;
|
|
19
|
+
readonly expectedInventory: Readonly<Record<string, string>>;
|
|
20
|
+
}): Promise<boolean>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { NoChangeFastPathOutputMetrics } from "./types.js";
|
|
2
2
|
export declare function computeAppFingerprint(root: string, configFile: string | undefined): Promise<string>;
|
|
3
|
+
export declare function computeBundleFingerprint(root: string, configFile: string | undefined): Promise<string>;
|
|
3
4
|
export declare function fingerprintDirectory(directory: string): Promise<string>;
|
|
4
5
|
export declare function fingerprintOutputDirectory(directory: string, relativeDirectory?: string, metrics?: NoChangeFastPathOutputMetrics): Promise<Record<string, string>>;
|
|
5
6
|
export declare function inventoriesEqual(left: Record<string, string>, right: Record<string, string>): boolean;
|
|
@@ -6,6 +6,7 @@ type OutputCacheEntry = {
|
|
|
6
6
|
export type OutputCacheState = {
|
|
7
7
|
version: 4;
|
|
8
8
|
appFingerprint?: string;
|
|
9
|
+
bundleFingerprint?: string;
|
|
9
10
|
clientManifestFingerprint?: string;
|
|
10
11
|
outputs: Record<string, OutputCacheEntry>;
|
|
11
12
|
finalOutputInventory?: Record<string, string>;
|
|
@@ -24,6 +25,10 @@ export declare function verifyNoChangeFastPath(input: {
|
|
|
24
25
|
export declare function loadOutputCache(path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<(OutputCacheState & {
|
|
25
26
|
fileSizeBytes?: number;
|
|
26
27
|
}) | undefined>;
|
|
28
|
+
export declare function loadOutputCacheMetadata(path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<(OutputCacheState & {
|
|
29
|
+
fileSizeBytes?: number;
|
|
30
|
+
}) | undefined>;
|
|
31
|
+
export declare function validateOutputCache(cache: OutputCacheState, path: string, timingsMs?: Record<string, number>, log?: (message: string) => void): Promise<boolean>;
|
|
27
32
|
export declare function saveOutputCache(path: string, state: OutputCacheState, outputDirectory: string, timingsMs?: Record<string, number>): Promise<string>;
|
|
28
33
|
export declare function decodeOutput(outputCachePath: string, entry: OutputCacheEntry): Promise<Uint8Array>;
|
|
29
34
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { toSSG } from "hono/ssg";
|
|
2
|
+
type ToSsgOptions = NonNullable<Parameters<typeof toSSG>[2]>;
|
|
3
|
+
export type SsgRunnerOptions = {
|
|
4
|
+
readonly app: Parameters<typeof toSSG>[0];
|
|
5
|
+
readonly outDir: string;
|
|
6
|
+
readonly write: (path: string, data: string | Uint8Array) => Promise<void>;
|
|
7
|
+
readonly plugins?: ToSsgOptions["plugins"];
|
|
8
|
+
readonly extensionMap?: Record<string, string>;
|
|
9
|
+
readonly incremental: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function runSsg(options: SsgRunnerOptions): Promise<import("hono/ssg").ToSSGResult>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ResolvedConfig } from "vite";
|
|
2
|
+
import type { SsgModule } from "./types.js";
|
|
3
|
+
export type StandaloneSsgBundle = {
|
|
4
|
+
readonly app: NonNullable<SsgModule["default"]>;
|
|
5
|
+
readonly module: SsgModule;
|
|
6
|
+
};
|
|
7
|
+
export declare function loadStandaloneSsgBundle(input: {
|
|
8
|
+
readonly root: string;
|
|
9
|
+
readonly entry: string;
|
|
10
|
+
readonly outputDirectory: string;
|
|
11
|
+
readonly clientOutputDirectory?: string;
|
|
12
|
+
readonly config?: Pick<ResolvedConfig, "define" | "oxc" | "plugins" | "resolve">;
|
|
13
|
+
}): Promise<StandaloneSsgBundle>;
|
|
14
|
+
export declare function isStandaloneSsgMode(mode: string): boolean;
|
package/dist/src/ssg/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OutputDescriptor } from "@riebeckite/core";
|
|
1
|
+
import type { BuildProvenance, ContentManifest, OutputDescriptor } from "@riebeckite/core";
|
|
2
2
|
import type { toSSG } from "hono/ssg";
|
|
3
3
|
export type GeneratedOutputAsset = {
|
|
4
4
|
type: "asset";
|
|
@@ -21,7 +21,7 @@ type SsgHtmlInspectorPlugin = {
|
|
|
21
21
|
export type SsgModule = {
|
|
22
22
|
default: Parameters<typeof toSSG>[0];
|
|
23
23
|
content?: {
|
|
24
|
-
getManifest(): Promise<{
|
|
24
|
+
getManifest(): Promise<ContentManifest & {
|
|
25
25
|
generatedOutputs?: readonly {
|
|
26
26
|
path: string;
|
|
27
27
|
content: string | Uint8Array;
|
|
@@ -54,6 +54,8 @@ export type SsgModule = {
|
|
|
54
54
|
removedOutputCount: number;
|
|
55
55
|
unchangedOutputCount: number;
|
|
56
56
|
}>;
|
|
57
|
+
getProvenance(): BuildProvenance | undefined;
|
|
58
|
+
attachFinalOutputArtifacts(buildId: string, fingerprints: Readonly<Record<string, string>>, cacheHits: ReadonlySet<string>): Promise<void>;
|
|
57
59
|
};
|
|
58
60
|
config?: {
|
|
59
61
|
plugins?: readonly SsgHtmlInspectorPlugin[];
|
package/dist/src/ssg_plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { toSSG } from "hono/ssg";
|
|
2
|
-
import {
|
|
1
|
+
import type { toSSG } from "hono/ssg";
|
|
2
|
+
import type { ConfigEnv, Plugin } from "vite";
|
|
3
3
|
export { emptyBuildOutputDirectory } from "./ssg/build_output.js";
|
|
4
4
|
export { createNoChangeFastPathOutputMetrics, decideOutputCacheRejection, loadOutputCache, saveOutputCache, verifyNoChangeFastPath, } from "./ssg/output_cache.js";
|
|
5
5
|
export type { NoChangeFastPathOutputMetrics, NoChangeFastPathResult, OutputCacheDecision, OutputCacheRejectionReason, } from "./ssg/types.js";
|
|
@@ -10,6 +10,7 @@ type HonoxApplicationOptions = {
|
|
|
10
10
|
};
|
|
11
11
|
onServerReady?: (urls: readonly string[]) => void | Promise<void>;
|
|
12
12
|
restartOnChange?: readonly string[];
|
|
13
|
+
reuseClientBuild?: boolean;
|
|
13
14
|
};
|
|
14
15
|
export type ResolvedHonoxApplication = {
|
|
15
16
|
config: ResolvedRiebeckiteConfig;
|
|
@@ -29,4 +30,8 @@ export declare class HonoxApplicationRootError extends Error {
|
|
|
29
30
|
export declare function resolveHonoxApplication(options: ResolveHonoxApplicationOptions): Promise<ResolvedHonoxApplication>;
|
|
30
31
|
export declare function startHonoxDevServer(options: HonoxApplicationOptions): Promise<void>;
|
|
31
32
|
export declare function buildHonoxApplication(options: HonoxApplicationOptions): Promise<void>;
|
|
33
|
+
export declare function canReuseClientBuild(input: {
|
|
34
|
+
readonly root: string;
|
|
35
|
+
readonly outputDirectory: string;
|
|
36
|
+
}): Promise<boolean>;
|
|
32
37
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/honox",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,19 +40,21 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/parser": "^7.29.3",
|
|
43
|
-
"@riebeckite/core": "0.0.
|
|
44
|
-
"@riebeckite/
|
|
45
|
-
"@riebeckite/node": "0.0.
|
|
46
|
-
"@riebeckite/plugin-color-mode": "0.0.
|
|
47
|
-
"@riebeckite/spa": "0.0.
|
|
48
|
-
"@riebeckite/ui": "0.0.
|
|
43
|
+
"@riebeckite/core": "0.0.36",
|
|
44
|
+
"@riebeckite/honox-inspector": "0.0.36",
|
|
45
|
+
"@riebeckite/node": "0.0.36",
|
|
46
|
+
"@riebeckite/plugin-color-mode": "0.0.36",
|
|
47
|
+
"@riebeckite/spa": "0.0.36",
|
|
48
|
+
"@riebeckite/ui": "0.0.36",
|
|
49
49
|
"esbuild": "^0.28.2",
|
|
50
50
|
"hono": "^4.12.25",
|
|
51
|
-
"honox": "0.1.
|
|
51
|
+
"honox": "0.1.62",
|
|
52
52
|
"vite": "^8.3.5"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@
|
|
55
|
+
"@d2lang/d2": "^0.1.34",
|
|
56
|
+
"@marp-team/marp-core": "^4.4.0",
|
|
57
|
+
"@riebeckite/test": "0.0.36",
|
|
56
58
|
"tsx": "^4.22.4"
|
|
57
59
|
},
|
|
58
60
|
"publishConfig": {
|
|
@@ -89,6 +91,6 @@
|
|
|
89
91
|
],
|
|
90
92
|
"scripts": {
|
|
91
93
|
"build": "node ../../../scripts/build_package.mjs",
|
|
92
|
-
"test": "node --import tsx --test \"test/*.test.ts\""
|
|
94
|
+
"test": "node --import tsx --test --test-concurrency=1 \"test/*.test.ts\""
|
|
93
95
|
}
|
|
94
96
|
}
|
package/style.css
CHANGED
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
html {
|
|
11
|
+
scrollbar-gutter: stable;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
body {
|
|
11
15
|
margin: 0;
|
|
12
16
|
}
|
|
@@ -266,7 +270,7 @@
|
|
|
266
270
|
|
|
267
271
|
.rb-source-fallback > pre {
|
|
268
272
|
overflow: auto;
|
|
269
|
-
margin: 0 0.75rem 0.75rem;
|
|
273
|
+
margin: 0.25rem 0.75rem 0.75rem;
|
|
270
274
|
padding: 0.75rem;
|
|
271
275
|
border: 1px solid var(--rb-color-border);
|
|
272
276
|
border-radius: 6px;
|