@dogsbay/ssg 0.0.0-stage → 0.2.0-beta.129
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/LICENSE +201 -0
- package/NOTICE +17 -0
- package/README.md +39 -2
- package/dist/package/THIRD-PARTY-NOTICES.txt +589 -0
- package/dist/package/browser.mjs +4690 -0
- package/dist/package/chunks/chunk-3BM23K4O.mjs +84 -0
- package/dist/package/chunks/chunk-UZZEKSEQ.mjs +47 -0
- package/dist/package/chunks/katex-assets-7BGR6WCR.mjs +7 -0
- package/dist/package/chunks/prebuilt-css-default-MOOPVBZ5.mjs +2161 -0
- package/dist/package/chunks/prebuilt-css-mintlify-HAG54PAM.mjs +2161 -0
- package/dist/package/chunks/tailwind-fallback-KPRFHW3C.mjs +7 -0
- package/dist/package/chunks/topicmap-PY3WDCSI.mjs +53 -0
- package/dist/package/client.mjs +683 -0
- package/dist/package/css.mjs +421 -0
- package/dist/package/types/client/data-script.d.ts +6 -0
- package/dist/package/types/client/elements.d.ts +16 -0
- package/dist/package/types/client/highlight.d.ts +1 -0
- package/dist/package/types/client/image-zoom.d.ts +2 -0
- package/dist/package/types/client/mount.d.ts +27 -0
- package/dist/package/types/client/pagefind.d.ts +14 -0
- package/dist/package/types/client/search.d.ts +13 -0
- package/dist/package/types/client/targets.d.ts +6 -0
- package/dist/package/types/core/blog.d.ts +53 -0
- package/dist/package/types/core/build.d.ts +283 -0
- package/dist/package/types/core/canonical.d.ts +63 -0
- package/dist/package/types/core/config.d.ts +286 -0
- package/dist/package/types/core/detach.d.ts +55 -0
- package/dist/package/types/core/dev.d.ts +63 -0
- package/dist/package/types/core/diagrams.d.ts +93 -0
- package/dist/package/types/core/links.d.ts +39 -0
- package/dist/package/types/core/merman.d.ts +28 -0
- package/dist/package/types/core/nav.d.ts +35 -0
- package/dist/package/types/core/paths.d.ts +24 -0
- package/dist/package/types/core/pele.d.ts +15 -0
- package/dist/package/types/core/preprocess.d.ts +14 -0
- package/dist/package/types/core/resolve.d.ts +95 -0
- package/dist/package/types/core/site-files.d.ts +121 -0
- package/dist/package/types/core/strings.d.ts +1 -0
- package/dist/package/types/core/taxonomy.d.ts +39 -0
- package/dist/package/types/core/topicmap.d.ts +28 -0
- package/dist/package/types/core/yaml.d.ts +1 -0
- package/dist/package/types/generated/assets.d.ts +7 -0
- package/dist/package/types/generated/css-assets.d.ts +2 -0
- package/dist/package/types/generated/katex-assets.d.ts +3 -0
- package/dist/package/types/generated/prebuilt-css-default.d.ts +1 -0
- package/dist/package/types/generated/prebuilt-css-mintlify.d.ts +1 -0
- package/dist/package/types/package/browser.d.ts +29 -0
- package/dist/package/types/package/client.d.ts +17 -0
- package/dist/package/types/package/css.d.ts +6 -0
- package/dist/package/types/package/prebuilt.d.ts +2 -0
- package/dist/package/types/theme/classes.d.ts +7 -0
- package/dist/package/types/theme/compose.d.ts +99 -0
- package/dist/package/types/theme/css-build.d.ts +16 -0
- package/dist/package/types/theme/docs-layout/link-icons.d.ts +33 -0
- package/dist/package/types/theme/docs-layout/tag-list-data.d.ts +126 -0
- package/dist/package/types/theme/page.d.ts +34 -0
- package/dist/package/types/theme/pagefind.d.ts +10 -0
- package/dist/package/types/theme/regions.d.ts +84 -0
- package/dist/package/types/theme/seo.d.ts +57 -0
- package/package.json +92 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// src/core/detach.ts
|
|
2
|
+
function detach(s) {
|
|
3
|
+
return JSON.parse(JSON.stringify(s));
|
|
4
|
+
}
|
|
5
|
+
function isRef(c) {
|
|
6
|
+
return typeof c === "object" && c !== null && c.ref === true;
|
|
7
|
+
}
|
|
8
|
+
function isLazyText(c) {
|
|
9
|
+
return typeof c === "object" && c !== null && c.lazyText === true;
|
|
10
|
+
}
|
|
11
|
+
function isStream(c) {
|
|
12
|
+
return typeof c === "object" && c !== null && c.stream === true;
|
|
13
|
+
}
|
|
14
|
+
async function joinStream(s) {
|
|
15
|
+
let out = "";
|
|
16
|
+
for await (const c of s.chunks()) out += c;
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
var TextCache = class {
|
|
20
|
+
constructor(maxChars) {
|
|
21
|
+
this.maxChars = maxChars;
|
|
22
|
+
}
|
|
23
|
+
m = /* @__PURE__ */ new Map();
|
|
24
|
+
size = 0;
|
|
25
|
+
get(key) {
|
|
26
|
+
const v = this.m.get(key);
|
|
27
|
+
if (v !== void 0) {
|
|
28
|
+
this.m.delete(key);
|
|
29
|
+
this.m.set(key, v);
|
|
30
|
+
}
|
|
31
|
+
return v;
|
|
32
|
+
}
|
|
33
|
+
set(key, value) {
|
|
34
|
+
if (value.length > this.maxChars / 4 || this.m.has(key)) return;
|
|
35
|
+
this.m.set(key, value);
|
|
36
|
+
this.size += value.length;
|
|
37
|
+
while (this.size > this.maxChars) {
|
|
38
|
+
const [k, v] = this.m.entries().next().value;
|
|
39
|
+
this.m.delete(k);
|
|
40
|
+
this.size -= v.length;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Forget one entry (a file that changed on disk). */
|
|
44
|
+
delete(key) {
|
|
45
|
+
const v = this.m.get(key);
|
|
46
|
+
if (v === void 0) return;
|
|
47
|
+
this.m.delete(key);
|
|
48
|
+
this.size -= v.length;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/theme/classes.ts
|
|
53
|
+
import { FOREIGN_END, FOREIGN_START, unesc } from "@dogsbay/render-html/html";
|
|
54
|
+
var FOREIGN_BLOCK = new RegExp(`${FOREIGN_START}[\\s\\S]*?${FOREIGN_END}`, "g");
|
|
55
|
+
var seenValues = /* @__PURE__ */ new WeakMap();
|
|
56
|
+
var SEEN_MAX_CHARS = 1e6;
|
|
57
|
+
function collectClasses(html, into) {
|
|
58
|
+
if (html.includes(FOREIGN_START)) html = html.replace(FOREIGN_BLOCK, "");
|
|
59
|
+
let seen = seenValues.get(into);
|
|
60
|
+
if (!seen) seenValues.set(into, seen = { values: /* @__PURE__ */ new Set(), chars: 0 });
|
|
61
|
+
for (const m of html.matchAll(/\sclass\s*=\s*(?:"([^"]*)"|'([^']*)')/g)) {
|
|
62
|
+
const value = m[1] ?? m[2];
|
|
63
|
+
if (seen.values.has(value)) continue;
|
|
64
|
+
if (seen.chars + value.length <= SEEN_MAX_CHARS) {
|
|
65
|
+
seen.values.add(detach(value));
|
|
66
|
+
seen.chars += value.length;
|
|
67
|
+
}
|
|
68
|
+
for (const tok of value.split(/\s+/)) {
|
|
69
|
+
if (!tok) continue;
|
|
70
|
+
const name = unesc(tok);
|
|
71
|
+
if (!into.has(name)) into.add(detach(name));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
detach,
|
|
78
|
+
isRef,
|
|
79
|
+
isLazyText,
|
|
80
|
+
isStream,
|
|
81
|
+
joinStream,
|
|
82
|
+
TextCache,
|
|
83
|
+
collectClasses
|
|
84
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/core/paths.ts
|
|
2
|
+
function normalize(p) {
|
|
3
|
+
const abs = p.startsWith("/");
|
|
4
|
+
const out = [];
|
|
5
|
+
for (const seg of p.split("/")) {
|
|
6
|
+
if (seg === "" || seg === ".") continue;
|
|
7
|
+
if (seg === "..") {
|
|
8
|
+
if (out.length && out[out.length - 1] !== "..") out.pop();
|
|
9
|
+
else if (!abs) out.push("..");
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
out.push(seg);
|
|
13
|
+
}
|
|
14
|
+
return (abs ? "/" : "") + out.join("/");
|
|
15
|
+
}
|
|
16
|
+
function dirname(p) {
|
|
17
|
+
const i = p.lastIndexOf("/");
|
|
18
|
+
return i <= 0 ? p.startsWith("/") ? "/" : "" : p.slice(0, i);
|
|
19
|
+
}
|
|
20
|
+
function relative(fromDir, to) {
|
|
21
|
+
const a = fromDir ? normalize(fromDir).split("/") : [];
|
|
22
|
+
const b = to ? normalize(to).split("/") : [];
|
|
23
|
+
let i = 0;
|
|
24
|
+
while (i < a.length && i < b.length && a[i] === b[i]) i++;
|
|
25
|
+
const up = a.slice(i).map(() => "..");
|
|
26
|
+
return [...up, ...b.slice(i)].join("/");
|
|
27
|
+
}
|
|
28
|
+
function rootPrefix(file) {
|
|
29
|
+
const depth = file.split("/").length - 1;
|
|
30
|
+
return "../".repeat(depth);
|
|
31
|
+
}
|
|
32
|
+
function isExternal(href) {
|
|
33
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
|
|
34
|
+
}
|
|
35
|
+
function splitHref(href) {
|
|
36
|
+
const i = href.search(/[?#]/);
|
|
37
|
+
return i < 0 ? { path: href, suffix: "" } : { path: href.slice(0, i), suffix: href.slice(i) };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
normalize,
|
|
42
|
+
dirname,
|
|
43
|
+
relative,
|
|
44
|
+
rootPrefix,
|
|
45
|
+
isExternal,
|
|
46
|
+
splitHref
|
|
47
|
+
};
|