@silicajs/core 0.1.0
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 +10 -0
- package/dist/chunk-L565TMI5.js +1045 -0
- package/dist/chunk-L565TMI5.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +469 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.d.ts +25 -0
- package/dist/runtime.js +33 -0
- package/dist/runtime.js.map +1 -0
- package/dist/theme-Cd1tqolh.d.ts +235 -0
- package/dist/theme.d.ts +4 -0
- package/dist/theme.js +1 -0
- package/dist/theme.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import React, { ReactNode, ComponentType, AnchorHTMLAttributes, HTMLAttributes } from 'react';
|
|
2
|
+
import { SearchRecord } from '@silicajs/search';
|
|
3
|
+
import { ObsidianLinkTarget } from '@silicajs/remark-obsidian';
|
|
4
|
+
|
|
5
|
+
declare const filePathBrand: unique symbol;
|
|
6
|
+
declare const fullSlugBrand: unique symbol;
|
|
7
|
+
declare const simpleSlugBrand: unique symbol;
|
|
8
|
+
declare const relativeUrlBrand: unique symbol;
|
|
9
|
+
type FilePath = string & {
|
|
10
|
+
readonly [filePathBrand]: "FilePath";
|
|
11
|
+
};
|
|
12
|
+
type FullSlug = string & {
|
|
13
|
+
readonly [fullSlugBrand]: "FullSlug";
|
|
14
|
+
};
|
|
15
|
+
type SimpleSlug = string & {
|
|
16
|
+
readonly [simpleSlugBrand]: "SimpleSlug";
|
|
17
|
+
};
|
|
18
|
+
type RelativeURL = string & {
|
|
19
|
+
readonly [relativeUrlBrand]: "RelativeURL";
|
|
20
|
+
};
|
|
21
|
+
type SlugifyOptions = {
|
|
22
|
+
numericPrefixes?: boolean;
|
|
23
|
+
};
|
|
24
|
+
declare function asFilePath(value: string): FilePath;
|
|
25
|
+
declare function asFullSlug(value: string): FullSlug;
|
|
26
|
+
declare function asSimpleSlug(value: string): SimpleSlug;
|
|
27
|
+
declare function asRelativeURL(value: string): RelativeURL;
|
|
28
|
+
declare function normalizePath(value: string): string;
|
|
29
|
+
declare function slugifySegment(segment: string, options?: SlugifyOptions): string;
|
|
30
|
+
declare function normalizeSlug(value: string, options?: SlugifyOptions): string;
|
|
31
|
+
declare function slugifyFilePath(filePath: FilePath | string, contentDir?: string, options?: SlugifyOptions): FullSlug;
|
|
32
|
+
declare function simplifySlug(slug: FullSlug | string): SimpleSlug;
|
|
33
|
+
declare function slugToHref(slug: FullSlug | string): string;
|
|
34
|
+
declare function hrefToSlug(href: string): FullSlug;
|
|
35
|
+
declare function pathToRoot(slug: FullSlug | string): RelativeURL;
|
|
36
|
+
declare function resolveRelative(currentSlug: FullSlug | string, target: string, options?: SlugifyOptions): FullSlug;
|
|
37
|
+
declare function resolveWikiLink(currentSlug: FullSlug | string, target: string, allSlugs: readonly string[], strategy?: "absolute" | "relative" | "shortest", options?: SlugifyOptions): FullSlug | undefined;
|
|
38
|
+
declare function joinSegments(...segments: string[]): string;
|
|
39
|
+
|
|
40
|
+
type ThemeConfig = "default" | string | {
|
|
41
|
+
name: string;
|
|
42
|
+
options?: Record<string, unknown>;
|
|
43
|
+
};
|
|
44
|
+
type SilicaAuthConfig = {
|
|
45
|
+
provider?: "google";
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
allowedDomains?: string[];
|
|
48
|
+
allowedEmails?: string[];
|
|
49
|
+
};
|
|
50
|
+
type SilicaConfig = {
|
|
51
|
+
title?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
baseUrl?: string;
|
|
54
|
+
contentDir?: string;
|
|
55
|
+
theme?: ThemeConfig;
|
|
56
|
+
auth?: SilicaAuthConfig | false;
|
|
57
|
+
wikilinks?: {
|
|
58
|
+
strategy?: "absolute" | "relative" | "shortest";
|
|
59
|
+
strict?: boolean;
|
|
60
|
+
};
|
|
61
|
+
tags?: {
|
|
62
|
+
inline?: boolean;
|
|
63
|
+
};
|
|
64
|
+
ordering?: {
|
|
65
|
+
numericPrefixes?: boolean;
|
|
66
|
+
};
|
|
67
|
+
filters?: {
|
|
68
|
+
removeDrafts?: boolean;
|
|
69
|
+
explicitPublish?: boolean;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
type ResolvedSilicaConfig = {
|
|
73
|
+
projectRoot: string;
|
|
74
|
+
title: string;
|
|
75
|
+
description: string;
|
|
76
|
+
baseUrl?: string;
|
|
77
|
+
contentDir: string;
|
|
78
|
+
theme: ThemeConfig;
|
|
79
|
+
auth?: SilicaAuthConfig;
|
|
80
|
+
wikilinks: {
|
|
81
|
+
strategy: "absolute" | "relative" | "shortest";
|
|
82
|
+
strict: boolean;
|
|
83
|
+
};
|
|
84
|
+
tags: {
|
|
85
|
+
inline: boolean;
|
|
86
|
+
};
|
|
87
|
+
ordering: {
|
|
88
|
+
numericPrefixes: boolean;
|
|
89
|
+
};
|
|
90
|
+
filters: {
|
|
91
|
+
removeDrafts: boolean;
|
|
92
|
+
explicitPublish: boolean;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
type TocItem = {
|
|
96
|
+
id: string;
|
|
97
|
+
text: string;
|
|
98
|
+
depth: number;
|
|
99
|
+
};
|
|
100
|
+
type ManifestEntry = {
|
|
101
|
+
slug: string;
|
|
102
|
+
title: string;
|
|
103
|
+
menuLabel: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
tags: string[];
|
|
106
|
+
file: string;
|
|
107
|
+
relativeFile: string;
|
|
108
|
+
sortKey?: string;
|
|
109
|
+
created?: string;
|
|
110
|
+
modified?: string;
|
|
111
|
+
frontmatter: Record<string, unknown>;
|
|
112
|
+
};
|
|
113
|
+
type Manifest = {
|
|
114
|
+
version: 1;
|
|
115
|
+
generatedAt: string;
|
|
116
|
+
contentDir: string;
|
|
117
|
+
allSlugs: string[];
|
|
118
|
+
entries: ManifestEntry[];
|
|
119
|
+
bySlug: Record<string, ManifestEntry>;
|
|
120
|
+
};
|
|
121
|
+
type Graph = {
|
|
122
|
+
version: 1;
|
|
123
|
+
links: Record<string, string[]>;
|
|
124
|
+
backlinks: Record<string, string[]>;
|
|
125
|
+
brokenLinks: BrokenLink[];
|
|
126
|
+
};
|
|
127
|
+
type BrokenLink = {
|
|
128
|
+
source: string;
|
|
129
|
+
target: string;
|
|
130
|
+
};
|
|
131
|
+
type RenderContext = {
|
|
132
|
+
slug: FullSlug | string;
|
|
133
|
+
allSlugs: string[];
|
|
134
|
+
assetBaseUrl?: string;
|
|
135
|
+
resolveEmbed?: (target: ObsidianLinkTarget) => Promise<string | undefined> | string | undefined;
|
|
136
|
+
embedDepth?: number;
|
|
137
|
+
maxEmbedDepth?: number;
|
|
138
|
+
wikilinkStrategy?: "absolute" | "relative" | "shortest";
|
|
139
|
+
tags?: {
|
|
140
|
+
inline?: boolean;
|
|
141
|
+
};
|
|
142
|
+
ordering?: {
|
|
143
|
+
numericPrefixes?: boolean;
|
|
144
|
+
};
|
|
145
|
+
components?: MarkdownComponents;
|
|
146
|
+
};
|
|
147
|
+
type SilicaCalloutProps = HTMLAttributes<HTMLElement> & {
|
|
148
|
+
"data-callout"?: string;
|
|
149
|
+
"data-callout-title"?: string;
|
|
150
|
+
"data-callout-foldable"?: string;
|
|
151
|
+
"data-callout-open"?: string;
|
|
152
|
+
};
|
|
153
|
+
type SilicaCodeBlockProps = HTMLAttributes<HTMLElement> & {
|
|
154
|
+
"data-language"?: string;
|
|
155
|
+
"data-language-label"?: string;
|
|
156
|
+
};
|
|
157
|
+
type SilicaEmbedProps = HTMLAttributes<HTMLElement> & {
|
|
158
|
+
"data-embed-kind"?: string;
|
|
159
|
+
"data-embed-target"?: string;
|
|
160
|
+
src?: string;
|
|
161
|
+
};
|
|
162
|
+
type SilicaMermaidProps = HTMLAttributes<HTMLElement> & {
|
|
163
|
+
"data-source"?: string;
|
|
164
|
+
};
|
|
165
|
+
type MarkdownComponents = {
|
|
166
|
+
a?: ComponentType<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
167
|
+
"silica-callout"?: ComponentType<SilicaCalloutProps>;
|
|
168
|
+
"silica-code-block"?: ComponentType<SilicaCodeBlockProps>;
|
|
169
|
+
"silica-embed"?: ComponentType<SilicaEmbedProps>;
|
|
170
|
+
"silica-mermaid"?: ComponentType<SilicaMermaidProps>;
|
|
171
|
+
};
|
|
172
|
+
type RenderResult = {
|
|
173
|
+
content: ReactNode;
|
|
174
|
+
frontmatter: Record<string, unknown>;
|
|
175
|
+
toc: TocItem[];
|
|
176
|
+
links: string[];
|
|
177
|
+
brokenLinks: BrokenLink[];
|
|
178
|
+
plainText: string;
|
|
179
|
+
title?: string;
|
|
180
|
+
description?: string;
|
|
181
|
+
tags: string[];
|
|
182
|
+
};
|
|
183
|
+
type AnalyzeResult = Omit<RenderResult, "content">;
|
|
184
|
+
type PrecomputeResult = {
|
|
185
|
+
manifest: Manifest;
|
|
186
|
+
graph: Graph;
|
|
187
|
+
searchRecords: SearchRecord[];
|
|
188
|
+
buildId: string;
|
|
189
|
+
brokenLinks: BrokenLink[];
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
type ThemeNavigationEntry = {
|
|
193
|
+
slug: string;
|
|
194
|
+
title: string;
|
|
195
|
+
sortKey?: string;
|
|
196
|
+
};
|
|
197
|
+
type ThemeLayoutConfig = {
|
|
198
|
+
title: string;
|
|
199
|
+
description: string;
|
|
200
|
+
baseUrl?: string;
|
|
201
|
+
authEnabled: boolean;
|
|
202
|
+
};
|
|
203
|
+
type ThemeProviderComponent = (props: {
|
|
204
|
+
children: React.ReactNode;
|
|
205
|
+
}) => React.ReactNode;
|
|
206
|
+
type ThemeLayoutProps = {
|
|
207
|
+
navigation: {
|
|
208
|
+
entries: ThemeNavigationEntry[];
|
|
209
|
+
};
|
|
210
|
+
config: ThemeLayoutConfig;
|
|
211
|
+
children: React.ReactNode;
|
|
212
|
+
Provider?: ThemeProviderComponent;
|
|
213
|
+
};
|
|
214
|
+
type ThemePage = {
|
|
215
|
+
slug: string;
|
|
216
|
+
title: string;
|
|
217
|
+
description?: string;
|
|
218
|
+
content: React.ReactNode;
|
|
219
|
+
frontmatter: Record<string, unknown>;
|
|
220
|
+
toc: TocItem[];
|
|
221
|
+
entry: ManifestEntry;
|
|
222
|
+
};
|
|
223
|
+
type ThemePageProps = {
|
|
224
|
+
page: ThemePage;
|
|
225
|
+
graph: Graph;
|
|
226
|
+
manifest: Manifest;
|
|
227
|
+
config: ResolvedSilicaConfig;
|
|
228
|
+
};
|
|
229
|
+
type SilicaTheme = {
|
|
230
|
+
Layout: (props: ThemeLayoutProps) => React.ReactNode;
|
|
231
|
+
PageRenderer: (props: ThemePageProps) => React.ReactNode;
|
|
232
|
+
components?: MarkdownComponents;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export { type AnalyzeResult as A, type BrokenLink as B, normalizePath as C, normalizeSlug as D, pathToRoot as E, type FilePath as F, type Graph as G, resolveRelative as H, resolveWikiLink as I, simplifySlug as J, slugToHref as K, slugifyFilePath as L, type Manifest as M, slugifySegment as N, type PrecomputeResult as P, type RelativeURL as R, type SilicaAuthConfig as S, type ThemeConfig as T, type FullSlug as a, type ManifestEntry as b, type MarkdownComponents as c, type RenderContext as d, type RenderResult as e, type ResolvedSilicaConfig as f, type SilicaCalloutProps as g, type SilicaCodeBlockProps as h, type SilicaConfig as i, type SilicaEmbedProps as j, type SilicaMermaidProps as k, type SilicaTheme as l, type SimpleSlug as m, type ThemeLayoutConfig as n, type ThemeLayoutProps as o, type ThemeNavigationEntry as p, type ThemePage as q, type ThemePageProps as r, type ThemeProviderComponent as s, type TocItem as t, asFilePath as u, asFullSlug as v, asRelativeURL as w, asSimpleSlug as x, hrefToSlug as y, joinSegments as z };
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
export { c as MarkdownComponents, g as SilicaCalloutProps, h as SilicaCodeBlockProps, j as SilicaEmbedProps, k as SilicaMermaidProps, l as SilicaTheme, n as ThemeLayoutConfig, o as ThemeLayoutProps, p as ThemeNavigationEntry, q as ThemePage, r as ThemePageProps, s as ThemeProviderComponent } from './theme-Cd1tqolh.js';
|
|
3
|
+
import '@silicajs/search';
|
|
4
|
+
import '@silicajs/remark-obsidian';
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@silicajs/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Markdown pipeline, slug system, and precompute artifacts for Silica.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./runtime": {
|
|
16
|
+
"types": "./dist/runtime.d.ts",
|
|
17
|
+
"import": "./dist/runtime.js"
|
|
18
|
+
},
|
|
19
|
+
"./theme": {
|
|
20
|
+
"types": "./dist/theme.d.ts",
|
|
21
|
+
"import": "./dist/theme.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"lint": "tsc --noEmit"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@shikijs/rehype": "^4.1.0",
|
|
35
|
+
"@silicajs/remark-obsidian": "^0.1.0",
|
|
36
|
+
"@silicajs/search": "^0.1.0",
|
|
37
|
+
"fast-glob": "^3.3.3",
|
|
38
|
+
"fs-extra": "^11.3.5",
|
|
39
|
+
"github-slugger": "^2.0.0",
|
|
40
|
+
"gray-matter": "^4.0.3",
|
|
41
|
+
"hast-util-to-string": "^3.0.1",
|
|
42
|
+
"jiti": "^2.7.0",
|
|
43
|
+
"katex": "^0.17.0",
|
|
44
|
+
"rehype-autolink-headings": "^7.1.0",
|
|
45
|
+
"rehype-katex": "^7.0.1",
|
|
46
|
+
"rehype-raw": "^7.0.0",
|
|
47
|
+
"rehype-react": "^8.0.0",
|
|
48
|
+
"rehype-sanitize": "^6.0.0",
|
|
49
|
+
"rehype-slug": "^6.0.0",
|
|
50
|
+
"rehype-stringify": "^10.0.1",
|
|
51
|
+
"remark-frontmatter": "^5.0.0",
|
|
52
|
+
"remark-gfm": "^4.0.1",
|
|
53
|
+
"remark-math": "^6.0.0",
|
|
54
|
+
"remark-parse": "^11.0.0",
|
|
55
|
+
"remark-rehype": "^11.1.2",
|
|
56
|
+
"shiki": "^4.1.0",
|
|
57
|
+
"unified": "^11.0.5",
|
|
58
|
+
"unist-util-visit": "^5.1.0",
|
|
59
|
+
"zod": "^4.4.3"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"react": "^19.2.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"react": "^19.2.6",
|
|
66
|
+
"react-dom": "^19.2.6"
|
|
67
|
+
}
|
|
68
|
+
}
|