@riebeckite/core 0.0.14 → 0.0.16
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 +6 -5
- package/README_ja.md +9 -8
- package/dist/client.d.ts +2 -2
- package/dist/client.js +142 -1
- package/dist/index.d.ts +14 -6
- package/dist/index.js +2149 -439
- package/dist/src/content/affected_content.d.ts +1 -1
- package/dist/src/content/content_build_coordinator.d.ts +11 -3
- package/dist/src/content/content_build_state.d.ts +13 -2
- package/dist/src/content/content_dependency_tracker.d.ts +18 -0
- package/dist/src/content/content_entry_reader.d.ts +2 -0
- package/dist/src/content/content_index_builder.d.ts +2 -0
- package/dist/src/content/content_location_resolver.d.ts +7 -0
- package/dist/src/content/content_manager.d.ts +21 -0
- package/dist/src/content/content_persistent_cache.d.ts +43 -0
- package/dist/src/content/file_system_content_source.d.ts +2 -0
- package/dist/src/content/folder_entry.d.ts +36 -0
- package/dist/src/content/graph_layout.d.ts +20 -0
- package/dist/src/content/manifest_builder.d.ts +2 -1
- package/dist/src/content/output_dependency.d.ts +34 -0
- package/dist/src/content/publishing.d.ts +15 -0
- package/dist/src/pipeline.d.ts +10 -0
- package/dist/src/plugin/plugin_runtime.d.ts +7 -1
- package/dist/src/types/content_manifest.d.ts +19 -1
- package/dist/src/types/generated_output.d.ts +9 -0
- package/dist/src/types/navigation_config.d.ts +10 -0
- package/dist/src/types/output_dependency.d.ts +14 -0
- package/dist/src/types/plugin.d.ts +19 -0
- package/dist/src/types/plugin_page.d.ts +6 -0
- package/dist/src/types/plugin_pipeline.d.ts +1 -0
- package/dist/src/types/post_content.d.ts +2 -0
- package/dist/src/types/resolved_riebeckite_config.d.ts +6 -0
- package/dist/src/types/riebeckite_config.d.ts +6 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ export default defineConfig({
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
The content directory is resolved relative to the application root. See
|
|
40
|
-
[Configuration](../../docs/en/reference/configuration.md) for the full field list and the
|
|
40
|
+
[Configuration](../../docs/en/docs/reference/configuration.md) for the full field list and the
|
|
41
41
|
`projectRoot` / `appRoot` / `configRoot` / `contentRoot` resolution rules.
|
|
42
42
|
|
|
43
43
|
## Public API
|
|
@@ -88,7 +88,8 @@ The content directory is resolved relative to the application root. See
|
|
|
88
88
|
|
|
89
89
|
## See also
|
|
90
90
|
|
|
91
|
-
- [Framework Reference](../../docs/en/reference/README.md)
|
|
92
|
-
- [Content System](../../docs/en/framework/content-system.md)
|
|
93
|
-
- [Plugin System](../../docs/en/reference/plugin-api.md) / [Theme System](../../docs/en/reference/theme-api.md)
|
|
94
|
-
- [Architecture](../../docs/en/framework/architecture.md)
|
|
91
|
+
- [Framework Reference](../../docs/en/docs/reference/README.md)
|
|
92
|
+
- [Content System](../../docs/en/docs/framework/content-system.md)
|
|
93
|
+
- [Plugin System](../../docs/en/docs/reference/plugin-api.md) / [Theme System](../../docs/en/docs/reference/theme-api.md)
|
|
94
|
+
- [Architecture](../../docs/en/docs/framework/architecture.md)
|
|
95
|
+
|
package/README_ja.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @riebeckite/core
|
|
2
2
|
|
|
3
|
-
Riebeckite
|
|
3
|
+
Riebeckite の移植可能なフレームワーク本体です。設定、コンテンツソース、ContentManager、Markdown/HTML パイプライン、Plugin と Theme の拡張の約束、診断、可観測性を担います。
|
|
4
4
|
|
|
5
5
|
[English](./README.md)
|
|
6
6
|
|
|
7
7
|
## 概要
|
|
8
8
|
|
|
9
|
-
`@riebeckite/core`
|
|
9
|
+
`@riebeckite/core` はコンテンツの読み込みと解釈、および拡張が依存する取り決めを所有します。HonoX や Vite、特定の Plugin・Theme・アプリケーションには依存しません。依存の向きは常に Core へ向かい、その逆には向かいません。
|
|
10
10
|
|
|
11
11
|
サイトは `defineConfig` で Core を設定し、[`@riebeckite/honox`](../integrations/honox/README_ja.md) のような integration がビルドを実行します。Plugin と Theme は `definePlugin`、`defineTheme` が返すただのオブジェクトです。
|
|
12
12
|
|
|
@@ -29,7 +29,7 @@ export default defineConfig({
|
|
|
29
29
|
});
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
コンテンツディレクトリはアプリケーションルート基準で解決します。設定項目の全体と `projectRoot` / `appRoot` / `configRoot` / `contentRoot` の解決規則は [Configuration](../../docs/ja/reference/configuration.md) を参照してください。
|
|
32
|
+
コンテンツディレクトリはアプリケーションルート基準で解決します。設定項目の全体と `projectRoot` / `appRoot` / `configRoot` / `contentRoot` の解決規則は [Configuration](../../docs/ja/docs/reference/configuration.md) を参照してください。
|
|
33
33
|
|
|
34
34
|
## 公開 API
|
|
35
35
|
|
|
@@ -57,7 +57,7 @@ export default defineConfig({
|
|
|
57
57
|
- `defineEndpoint`、`createClientEntry`、`createStyleAsset`
|
|
58
58
|
- `Plugin*` のコンテキスト、アセット、エンドポイント、診断、SEO、パイプラインの型
|
|
59
59
|
|
|
60
|
-
### Theme
|
|
60
|
+
### Theme と設定
|
|
61
61
|
|
|
62
62
|
- `defineTheme` と `Theme*` の型
|
|
63
63
|
- `RiebeckiteConfig`、`ResolvedRiebeckiteConfig`、`SiteConfig`、`PostContent`、`PostFrontmatter`、`PublishStrategy`
|
|
@@ -69,7 +69,8 @@ export default defineConfig({
|
|
|
69
69
|
|
|
70
70
|
## 関連資料
|
|
71
71
|
|
|
72
|
-
- [Framework Reference](../../docs/ja/reference/README.md)
|
|
73
|
-
- [Content System](../../docs/ja/framework/content-system.md)
|
|
74
|
-
- [Plugin System](../../docs/ja/reference/plugin-api.md) / [Theme System](../../docs/ja/reference/theme-api.md)
|
|
75
|
-
- [Architecture](../../docs/ja/framework/architecture.md)
|
|
72
|
+
- [Framework Reference](../../docs/ja/docs/reference/README.md)
|
|
73
|
+
- [Content System](../../docs/ja/docs/framework/content-system.md)
|
|
74
|
+
- [Plugin System](../../docs/ja/docs/reference/plugin-api.md) / [Theme System](../../docs/ja/docs/reference/theme-api.md)
|
|
75
|
+
- [Architecture](../../docs/ja/docs/framework/architecture.md)
|
|
76
|
+
|
package/dist/client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { GraphEdge, GraphLayoutNode, LinkableGraphNode, RadialGraphLayoutOptions, } from "./src/content/graph_layout.js";
|
|
2
|
-
export { buildGraphEdges, layoutRadialGraph, } from "./src/content/graph_layout.js";
|
|
1
|
+
export type { ForceGraphLayoutOptions, ForceLayoutGuardOptions, GraphEdge, GraphLayoutNode, LinkableGraphNode, RadialGraphLayoutOptions, } from "./src/content/graph_layout.js";
|
|
2
|
+
export { buildGraphEdges, FORCE_LAYOUT_CONFIRM_NODE_COUNT, layoutForceGraph, layoutRadialGraph, shouldGuardForceLayout, } from "./src/content/graph_layout.js";
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// src/content/graph_layout.ts
|
|
2
|
+
var FORCE_LAYOUT_CONFIRM_NODE_COUNT = 500;
|
|
3
|
+
function shouldGuardForceLayout(options) {
|
|
4
|
+
return options.layout === "force" && options.mode === "global" && options.nodeCount >= FORCE_LAYOUT_CONFIRM_NODE_COUNT && !options.approved;
|
|
5
|
+
}
|
|
2
6
|
function buildGraphEdges(nodes, visibleSlugs = new Set(nodes.map((node) => node.slug))) {
|
|
3
7
|
const edges = /* @__PURE__ */ new Map();
|
|
4
8
|
for (const node of nodes) {
|
|
@@ -34,10 +38,147 @@ function layoutRadialGraph(nodes, options) {
|
|
|
34
38
|
});
|
|
35
39
|
return layout;
|
|
36
40
|
}
|
|
41
|
+
function layoutForceGraph(nodes, options) {
|
|
42
|
+
const safeOptions = resolveForceGraphLayoutOptions(options);
|
|
43
|
+
const layoutNodes = [...nodes].sort((a, b) => a.slug.localeCompare(b.slug));
|
|
44
|
+
const layout = createInitialLayout(layoutNodes, safeOptions);
|
|
45
|
+
const visibleSlugs = new Set(layoutNodes.map((node) => node.slug));
|
|
46
|
+
const edges = buildGraphEdges(layoutNodes, visibleSlugs).filter(
|
|
47
|
+
(edge) => edge.source !== edge.target
|
|
48
|
+
);
|
|
49
|
+
const velocities = new Map(
|
|
50
|
+
layoutNodes.map((node) => [node.slug, { x: 0, y: 0 }])
|
|
51
|
+
);
|
|
52
|
+
const centerX = safeOptions.width / 2;
|
|
53
|
+
const centerY = safeOptions.height / 2;
|
|
54
|
+
for (let iteration = 0; iteration < safeOptions.iterations; iteration++) {
|
|
55
|
+
const alpha = 1 - iteration / safeOptions.iterations;
|
|
56
|
+
applyRepulsion(
|
|
57
|
+
layoutNodes,
|
|
58
|
+
layout,
|
|
59
|
+
velocities,
|
|
60
|
+
safeOptions.repulsion * alpha
|
|
61
|
+
);
|
|
62
|
+
applyLinks(edges, layout, velocities, safeOptions.linkDistance, alpha);
|
|
63
|
+
applyCentering(layoutNodes, layout, velocities, centerX, centerY, alpha);
|
|
64
|
+
integrate(
|
|
65
|
+
layoutNodes,
|
|
66
|
+
layout,
|
|
67
|
+
velocities,
|
|
68
|
+
safeOptions,
|
|
69
|
+
safeOptions.damping
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return layout;
|
|
73
|
+
}
|
|
74
|
+
function resolveForceGraphLayoutOptions(options) {
|
|
75
|
+
const minNodeRadius = clampFinite(options.minNodeRadius ?? 8, 1, 64);
|
|
76
|
+
const maxNodeRadius = Math.max(
|
|
77
|
+
minNodeRadius,
|
|
78
|
+
clampFinite(options.maxNodeRadius ?? 14, minNodeRadius, 96)
|
|
79
|
+
);
|
|
80
|
+
return {
|
|
81
|
+
width: clampFinite(options.width, maxNodeRadius * 2, 2e4),
|
|
82
|
+
height: clampFinite(options.height, maxNodeRadius * 2, 2e4),
|
|
83
|
+
centerSlug: options.centerSlug,
|
|
84
|
+
linkDistance: clampFinite(options.linkDistance ?? 84, 1, 2e3),
|
|
85
|
+
repulsion: clampFinite(options.repulsion ?? 1800, 0, 1e5),
|
|
86
|
+
iterations: Math.round(clampFinite(options.iterations ?? 160, 0, 1e3)),
|
|
87
|
+
damping: clampFinite(options.damping ?? 0.82, 0, 1),
|
|
88
|
+
minNodeRadius,
|
|
89
|
+
maxNodeRadius
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function createInitialLayout(nodes, options) {
|
|
93
|
+
return layoutRadialGraph(nodes, {
|
|
94
|
+
width: options.width,
|
|
95
|
+
height: options.height,
|
|
96
|
+
centerSlug: options.centerSlug ?? nodes[0]?.slug ?? "",
|
|
97
|
+
radiusRatio: 0.28,
|
|
98
|
+
minNodeRadius: options.minNodeRadius,
|
|
99
|
+
maxNodeRadius: options.maxNodeRadius
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function applyRepulsion(nodes, layout, velocities, strength) {
|
|
103
|
+
for (let sourceIndex = 0; sourceIndex < nodes.length; sourceIndex++) {
|
|
104
|
+
for (let targetIndex = sourceIndex + 1; targetIndex < nodes.length; targetIndex++) {
|
|
105
|
+
const source = layout.get(nodes[sourceIndex]?.slug ?? "");
|
|
106
|
+
const target = layout.get(nodes[targetIndex]?.slug ?? "");
|
|
107
|
+
const sourceVelocity = velocities.get(nodes[sourceIndex]?.slug ?? "");
|
|
108
|
+
const targetVelocity = velocities.get(nodes[targetIndex]?.slug ?? "");
|
|
109
|
+
if (!source || !target || !sourceVelocity || !targetVelocity) continue;
|
|
110
|
+
const dx = target.x - source.x || 0.01;
|
|
111
|
+
const dy = target.y - source.y || 0.01;
|
|
112
|
+
const distanceSquared = Math.max(dx * dx + dy * dy, 64);
|
|
113
|
+
const force = strength / distanceSquared;
|
|
114
|
+
const distance = Math.sqrt(distanceSquared);
|
|
115
|
+
const fx = dx / distance * force;
|
|
116
|
+
const fy = dy / distance * force;
|
|
117
|
+
sourceVelocity.x -= fx;
|
|
118
|
+
sourceVelocity.y -= fy;
|
|
119
|
+
targetVelocity.x += fx;
|
|
120
|
+
targetVelocity.y += fy;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function applyLinks(edges, layout, velocities, linkDistance, alpha) {
|
|
125
|
+
for (const edge of edges) {
|
|
126
|
+
const source = layout.get(edge.source);
|
|
127
|
+
const target = layout.get(edge.target);
|
|
128
|
+
const sourceVelocity = velocities.get(edge.source);
|
|
129
|
+
const targetVelocity = velocities.get(edge.target);
|
|
130
|
+
if (!source || !target || !sourceVelocity || !targetVelocity) continue;
|
|
131
|
+
const dx = target.x - source.x || 0.01;
|
|
132
|
+
const dy = target.y - source.y || 0.01;
|
|
133
|
+
const distance = Math.max(Math.sqrt(dx * dx + dy * dy), 1);
|
|
134
|
+
const force = (distance - linkDistance) * 0.018 * alpha;
|
|
135
|
+
const fx = dx / distance * force;
|
|
136
|
+
const fy = dy / distance * force;
|
|
137
|
+
sourceVelocity.x += fx;
|
|
138
|
+
sourceVelocity.y += fy;
|
|
139
|
+
targetVelocity.x -= fx;
|
|
140
|
+
targetVelocity.y -= fy;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function applyCentering(nodes, layout, velocities, centerX, centerY, alpha) {
|
|
144
|
+
for (const node of nodes) {
|
|
145
|
+
const point = layout.get(node.slug);
|
|
146
|
+
const velocity = velocities.get(node.slug);
|
|
147
|
+
if (!point || !velocity) continue;
|
|
148
|
+
velocity.x += (centerX - point.x) * 4e-3 * alpha;
|
|
149
|
+
velocity.y += (centerY - point.y) * 4e-3 * alpha;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function integrate(nodes, layout, velocities, options, damping) {
|
|
153
|
+
for (const node of nodes) {
|
|
154
|
+
const point = layout.get(node.slug);
|
|
155
|
+
const velocity = velocities.get(node.slug);
|
|
156
|
+
if (!point || !velocity) continue;
|
|
157
|
+
velocity.x *= damping;
|
|
158
|
+
velocity.y *= damping;
|
|
159
|
+
point.x = clamp(
|
|
160
|
+
point.x + velocity.x,
|
|
161
|
+
point.radius,
|
|
162
|
+
options.width - point.radius
|
|
163
|
+
);
|
|
164
|
+
point.y = clamp(
|
|
165
|
+
point.y + velocity.y,
|
|
166
|
+
point.radius,
|
|
167
|
+
options.height - point.radius
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
37
171
|
function clamp(value, min, max) {
|
|
38
172
|
return Math.min(Math.max(value, min), max);
|
|
39
173
|
}
|
|
174
|
+
function clampFinite(value, min, max) {
|
|
175
|
+
if (!Number.isFinite(value)) return min;
|
|
176
|
+
return clamp(value, min, max);
|
|
177
|
+
}
|
|
40
178
|
export {
|
|
179
|
+
FORCE_LAYOUT_CONFIRM_NODE_COUNT,
|
|
41
180
|
buildGraphEdges,
|
|
42
|
-
|
|
181
|
+
layoutForceGraph,
|
|
182
|
+
layoutRadialGraph,
|
|
183
|
+
shouldGuardForceLayout
|
|
43
184
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -19,10 +19,16 @@ export { groupContentEntries, queryContentEntries, queryContentPage, resolveCont
|
|
|
19
19
|
export type { ContentSource, ContentSourceContent, ContentSourceEntry, ContentSourceMetadata, } from "./src/content/content_source.js";
|
|
20
20
|
export { getContentSourceEntry, readContentSourceEntry, } from "./src/content/content_source.js";
|
|
21
21
|
export { resolveContentStableId } from "./src/content/content_stable_id.js";
|
|
22
|
-
export { FileSystemContentSource } from "./src/content/file_system_content_source.js";
|
|
23
|
-
export type {
|
|
24
|
-
export {
|
|
22
|
+
export { FileSystemContentSource, INTERNAL_CONTENT_IGNORE_PATTERNS, isIgnoredContentPath, } from "./src/content/file_system_content_source.js";
|
|
23
|
+
export type { FolderEntryCandidate, FolderEntryKind, FolderEntryResolution, FolderEntryScope, FolderLocationResolution, ResolveFolderEntryOptions, } from "./src/content/folder_entry.js";
|
|
24
|
+
export { resolveFolderEntry, resolveFolderLocation, resolveGeneratedFolderLocation, resolvePublicFolderLocation, } from "./src/content/folder_entry.js";
|
|
25
|
+
export type { ForceGraphLayoutOptions, GraphEdge, GraphLayoutNode, LinkableGraphNode, RadialGraphLayoutOptions, } from "./src/content/graph_layout.js";
|
|
26
|
+
export { buildGraphEdges, layoutForceGraph, layoutRadialGraph, } from "./src/content/graph_layout.js";
|
|
25
27
|
export { IMAGE_EXTENSIONS } from "./src/content/image_extensions.js";
|
|
28
|
+
export type { OutputChangeSet, OutputDescriptor, OutputKind, } from "./src/content/output_dependency.js";
|
|
29
|
+
export { buildOutputInventory, determineOutputChanges, htmlOutputPath, } from "./src/content/output_dependency.js";
|
|
30
|
+
export type { PublishingResolutionOptions, PublishingVisibility, ResolvedPublishingState, } from "./src/content/publishing.js";
|
|
31
|
+
export { resolvePublishingBuildTime, resolvePublishingState, } from "./src/content/publishing.js";
|
|
26
32
|
export { readOnlyContentGraph } from "./src/content/read_only_content_graph.js";
|
|
27
33
|
export { createDeprecationDiagnostic, type DeprecationKind, type DeprecationNotice, formatDeprecationMessage, } from "./src/deprecation.js";
|
|
28
34
|
export type { LogContext, Logger, LogLevel, Observability, ObservabilityValue, TraceAttributes, TraceEvent, Tracer, TraceSink, TraceSpan, } from "./src/observability.js";
|
|
@@ -34,12 +40,14 @@ export { PluginDependencyError, type PluginDependencyErrorKind, } from "./src/pl
|
|
|
34
40
|
export type { CreatePluginMemoOptions, PluginMemo, } from "./src/plugin/plugin_memo.js";
|
|
35
41
|
export { createPluginMemo, stableStringify, } from "./src/plugin/plugin_memo.js";
|
|
36
42
|
export type { ConfigValidationIssue, PluginOptionsValidator, } from "./src/types/config_validation.js";
|
|
37
|
-
export type { ContentAsset, ContentBodySlot, ContentLink, ContentLinkKind, ContentLocationInput, ContentManifest, ContentManifestEntry, ContentManifestPluginClientEntry, ContentPublicLocation, ContentRedirect, } from "./src/types/content_manifest.js";
|
|
43
|
+
export type { ContentAsset, ContentBodySlot, ContentLink, ContentLinkKind, ContentLocationInput, ContentManifest, ContentManifestEntry, ContentManifestPluginClientEntry, ContentPublicLocation, ContentRedirect, FolderLocation, PluginPageRoute, } from "./src/types/content_manifest.js";
|
|
38
44
|
export { appendContentBodySlot } from "./src/types/content_manifest.js";
|
|
39
45
|
export type { Diagnostic, DiagnosticCode, DiagnosticSeverity, } from "./src/types/diagnostic.js";
|
|
40
|
-
export type { GeneratedOutput, GeneratedOutputContent, GeneratedOutputInput, GeneratedOutputSink, } from "./src/types/generated_output.js";
|
|
41
|
-
export { createUnavailableGeneratedOutputSink, normalizeGeneratedOutputPath, } from "./src/types/generated_output.js";
|
|
46
|
+
export type { ContentAssetOutputInput, GeneratedOutput, GeneratedOutputContent, GeneratedOutputInput, GeneratedOutputSink, } from "./src/types/generated_output.js";
|
|
47
|
+
export { createUnavailableGeneratedOutputSink, normalizeContentAssetOutputPath, normalizeGeneratedOutputPath, } from "./src/types/generated_output.js";
|
|
42
48
|
export type { JsonValue } from "./src/types/json_value.js";
|
|
49
|
+
export type { NavigationConfig, NavigationItem, } from "./src/types/navigation_config.js";
|
|
50
|
+
export type { OutputDependency } from "./src/types/output_dependency.js";
|
|
43
51
|
export type { PluginInput, ResolvedPluginMetadata, RiebeckitePlugin, } from "./src/types/plugin.js";
|
|
44
52
|
export { definePlugin, getResolvedPluginMetadata, resolvePlugins, } from "./src/types/plugin.js";
|
|
45
53
|
export type { PluginAsset, PluginAssetKind, PluginClientEntry, } from "./src/types/plugin_asset.js";
|