baiten3d 0.1.0 → 0.1.1
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/adapters/react/ReaderOverlays.d.ts +1 -1
- package/dist/adapters/react/index.js +1 -1
- package/dist/adapters/static/index.js +198 -193
- package/dist/domain/siteDataCodec.d.ts +10 -0
- package/dist/index.js +1 -1
- package/dist/{react-1yHcPcfO.js → react-CNogCJgk.js} +595 -556
- package/dist/site/assets/index-CjLqB61w.js +69 -0
- package/dist/site/index.html +1 -1
- package/package.json +3 -3
- package/dist/site/assets/index-BskadLOC.js +0 -69
|
@@ -3,26 +3,26 @@ import { basename as d, dirname as f, isAbsolute as p, join as m, relative as h,
|
|
|
3
3
|
import v from "yaml";
|
|
4
4
|
import { t as y } from "../../composeSite-CcP_4wa0.js";
|
|
5
5
|
import { n as b } from "../../rack-DndsEqJP.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { unified as
|
|
13
|
-
import { parse as
|
|
14
|
-
import { watch as
|
|
15
|
-
import { createServer as
|
|
16
|
-
import { tmpdir as
|
|
17
|
-
import { gzipSync as
|
|
18
|
-
import
|
|
6
|
+
import ee from "rehype-highlight";
|
|
7
|
+
import te, { defaultSchema as x } from "rehype-sanitize";
|
|
8
|
+
import ne from "rehype-stringify";
|
|
9
|
+
import re from "remark-gfm";
|
|
10
|
+
import ie from "remark-parse";
|
|
11
|
+
import S from "remark-rehype";
|
|
12
|
+
import { unified as C } from "unified";
|
|
13
|
+
import { parse as ae } from "parse5";
|
|
14
|
+
import { watch as oe } from "node:fs";
|
|
15
|
+
import { createServer as se } from "node:http";
|
|
16
|
+
import { tmpdir as ce } from "node:os";
|
|
17
|
+
import { gzipSync as le } from "node:zlib";
|
|
18
|
+
import ue from "mime-types";
|
|
19
19
|
// src/domain/siteDataCodec.ts
|
|
20
|
-
var
|
|
21
|
-
function
|
|
20
|
+
var de = 260;
|
|
21
|
+
function w(e) {
|
|
22
22
|
let { sheets: t, editions: n, ...r } = e;
|
|
23
23
|
return r;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function T(e, t) {
|
|
26
26
|
return {
|
|
27
27
|
slug: e.slug,
|
|
28
28
|
file: e.file,
|
|
@@ -32,7 +32,7 @@ function w(e, t) {
|
|
|
32
32
|
...e.author ? { author: e.author } : {},
|
|
33
33
|
publishedAt: e.publishedAt,
|
|
34
34
|
summary: e.summary,
|
|
35
|
-
body: t ? e.body.slice(0,
|
|
35
|
+
body: t ? e.body.slice(0, de) : "",
|
|
36
36
|
...e.heroImage ? { heroImage: e.heroImage } : {},
|
|
37
37
|
...e.heroCaption ? { heroCaption: e.heroCaption } : {},
|
|
38
38
|
...e.editionId ? { editionId: e.editionId } : {},
|
|
@@ -40,7 +40,7 @@ function w(e, t) {
|
|
|
40
40
|
...e.tags && e.tags.length > 0 ? { tags: e.tags } : {}
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function E(e) {
|
|
44
44
|
return {
|
|
45
45
|
id: e.id,
|
|
46
46
|
kind: e.kind,
|
|
@@ -50,20 +50,20 @@ function T(e) {
|
|
|
50
50
|
publishedAt: e.publishedAt,
|
|
51
51
|
...e.displayOnRack === void 0 ? {} : { displayOnRack: e.displayOnRack },
|
|
52
52
|
sheets: [],
|
|
53
|
-
leadArticle: e.leadArticle ?
|
|
53
|
+
leadArticle: e.leadArticle ? T(e.leadArticle, !0) : null,
|
|
54
54
|
articleCount: e.articleCount
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function fe(e, t) {
|
|
58
58
|
let n = e.publications.map((e) => {
|
|
59
|
-
let t = e.latestEdition?.leadArticle?.slug, n = e.editions.map((e) =>
|
|
59
|
+
let t = e.latestEdition?.leadArticle?.slug, n = e.editions.map((e) => E(e)), r = e.latestEdition ? n.find((t) => t.id === e.latestEdition?.id) ?? E(e.latestEdition) : null;
|
|
60
60
|
return {
|
|
61
|
-
config:
|
|
61
|
+
config: w(e.config),
|
|
62
62
|
writingMode: e.writingMode,
|
|
63
63
|
readingDirection: e.readingDirection,
|
|
64
64
|
editions: n,
|
|
65
65
|
latestEdition: r,
|
|
66
|
-
allArticles: e.allArticles.map((e, n) =>
|
|
66
|
+
allArticles: e.allArticles.map((e, n) => T(e, n === 0 || e.slug === t)),
|
|
67
67
|
sheets: []
|
|
68
68
|
};
|
|
69
69
|
});
|
|
@@ -80,7 +80,11 @@ function pe(e, t) {
|
|
|
80
80
|
editionRoutes: e.editionRoutes
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function pe(e, t) {
|
|
84
|
+
let n = !1, r = {};
|
|
85
|
+
return t.title !== e.title && (r.title = t.title, n = !0), t.subtitle !== e.subtitle && (r.subtitle = t.subtitle ?? null, n = !0), t.heroImage !== e.heroImage && (r.heroImage = t.heroImage ?? null, n = !0), t.heroCaption !== e.heroCaption && (r.heroCaption = t.heroCaption ?? null, n = !0), t.body !== e.body && (r.body = t.body, n = !0), t.bodyHtml !== e.bodyHtml && (r.bodyHtml = t.bodyHtml, n = !0), n ? r : void 0;
|
|
86
|
+
}
|
|
87
|
+
function me(e, t, n) {
|
|
84
88
|
let r = {}, i = (e) => (r[e.slug] || (r[e.slug] = e), e.slug), a = t.allArticles.map((e) => i(e)), o = t.editions.map((e) => {
|
|
85
89
|
let t = e.leadArticle ? i(e.leadArticle) : null, n = e.sheets.map((e) => ({
|
|
86
90
|
page: e.page,
|
|
@@ -89,10 +93,11 @@ function E(e, t, n) {
|
|
|
89
93
|
...e.columns === void 0 ? {} : { columns: e.columns },
|
|
90
94
|
...e.rows === void 0 ? {} : { rows: e.rows },
|
|
91
95
|
blocks: e.blocks.map((e) => {
|
|
92
|
-
let { article: t, ...n } = e;
|
|
96
|
+
let { article: t, ...n } = e, a = i(t), o = r[a], s = o ? pe(o, t) : void 0;
|
|
93
97
|
return {
|
|
94
98
|
...n,
|
|
95
|
-
articleSlug:
|
|
99
|
+
articleSlug: a,
|
|
100
|
+
...s ? { articleOverride: s } : {}
|
|
96
101
|
};
|
|
97
102
|
})
|
|
98
103
|
}));
|
|
@@ -121,7 +126,7 @@ function E(e, t, n) {
|
|
|
121
126
|
routes: e.routes.filter((e) => e.publicationId === t.config.id),
|
|
122
127
|
editionRoutes: e.editionRoutes.filter((e) => e.publicationId === t.config.id)
|
|
123
128
|
},
|
|
124
|
-
config:
|
|
129
|
+
config: w(t.config),
|
|
125
130
|
writingMode: t.writingMode,
|
|
126
131
|
readingDirection: t.readingDirection,
|
|
127
132
|
articles: r,
|
|
@@ -136,18 +141,18 @@ var D = class extends Error {
|
|
|
136
141
|
constructor(e, t) {
|
|
137
142
|
super(`${e}: ${t}`), this.name = "MarkdownParseError", this.filePath = e;
|
|
138
143
|
}
|
|
139
|
-
},
|
|
140
|
-
...
|
|
144
|
+
}, he = {
|
|
145
|
+
...x,
|
|
141
146
|
attributes: {
|
|
142
|
-
...
|
|
143
|
-
code: [...
|
|
147
|
+
...x.attributes,
|
|
148
|
+
code: [...x.attributes?.code ?? [], [
|
|
144
149
|
"className",
|
|
145
150
|
/^language-./,
|
|
146
151
|
/^hljs/
|
|
147
152
|
]],
|
|
148
|
-
span: [...
|
|
149
|
-
h2: [...
|
|
150
|
-
h3: [...
|
|
153
|
+
span: [...x.attributes?.span ?? [], ["className", /^hljs-/]],
|
|
154
|
+
h2: [...x.attributes?.h2 ?? [], "id"],
|
|
155
|
+
h3: [...x.attributes?.h3 ?? [], "id"],
|
|
151
156
|
figure: [
|
|
152
157
|
"className",
|
|
153
158
|
"dataFigureId",
|
|
@@ -157,7 +162,7 @@ var D = class extends Error {
|
|
|
157
162
|
div: ["className", "dataMermaid"]
|
|
158
163
|
},
|
|
159
164
|
tagNames: [
|
|
160
|
-
...
|
|
165
|
+
...x.tagNames ?? [],
|
|
161
166
|
"figure",
|
|
162
167
|
"figcaption"
|
|
163
168
|
]
|
|
@@ -186,40 +191,40 @@ function O(e, t) {
|
|
|
186
191
|
throw e instanceof D ? e : new D(t, `front matter の YAML 構文が不正です: ${e instanceof Error ? e.message : String(e)}`);
|
|
187
192
|
}
|
|
188
193
|
}
|
|
189
|
-
async function
|
|
190
|
-
let { data: r, content: i } = O(e, n), a =
|
|
194
|
+
async function ge(e, t, n) {
|
|
195
|
+
let { data: r, content: i } = O(e, n), a = ve(r.slug, t), { title: o, bodyWithoutH1: s } = ye(r.title, i, a), c = C().use(ie).use(re).use(S).use(ee, {
|
|
191
196
|
detect: !1,
|
|
192
197
|
ignoreMissing: !0
|
|
193
|
-
}).use(
|
|
198
|
+
}).use(te, he).use(ne), { html: l, headings: u, figures: d } = _e(String(await c.process(s))), f = j(r.summary) ?? j(r.description) ?? k(s);
|
|
194
199
|
return {
|
|
195
200
|
slug: a,
|
|
196
201
|
file: t,
|
|
197
202
|
title: o,
|
|
198
|
-
subtitle:
|
|
199
|
-
kicker:
|
|
200
|
-
author:
|
|
201
|
-
publishedAt:
|
|
202
|
-
updatedAt:
|
|
203
|
+
subtitle: j(r.subtitle),
|
|
204
|
+
kicker: j(r.kicker),
|
|
205
|
+
author: j(r.author),
|
|
206
|
+
publishedAt: M(r.publishedAt ?? r.date) ?? "2026-11-28",
|
|
207
|
+
updatedAt: M(r.updatedAt),
|
|
203
208
|
summary: f,
|
|
204
209
|
body: s.trim(),
|
|
205
210
|
bodyHtml: l,
|
|
206
211
|
headings: u,
|
|
207
212
|
figures: d,
|
|
208
|
-
heroImage:
|
|
209
|
-
heroCaption:
|
|
210
|
-
pages:
|
|
213
|
+
heroImage: j(r.heroImage ?? r.image),
|
|
214
|
+
heroCaption: j(r.heroCaption ?? r.imageCaption),
|
|
215
|
+
pages: Oe(r.pages),
|
|
211
216
|
paginateBy: r.paginateBy === "h2" ? "h2" : r.paginateBy === "none" ? "none" : void 0,
|
|
212
|
-
editionId:
|
|
213
|
-
editionKind:
|
|
217
|
+
editionId: j(r.editionId),
|
|
218
|
+
editionKind: N(r.editionKind),
|
|
214
219
|
pinned: r.pinned === !0 || r.featured === !0,
|
|
215
|
-
tags:
|
|
216
|
-
layout:
|
|
220
|
+
tags: P(r.tags),
|
|
221
|
+
layout: De(r.layout)
|
|
217
222
|
};
|
|
218
223
|
}
|
|
219
|
-
function
|
|
224
|
+
function _e(e) {
|
|
220
225
|
let t = [], n = [], r = 0, i = 0, a = e.replace(/<(h[23])>([\s\S]*?)<\/\1>/g, (e, n, i) => {
|
|
221
226
|
r += 1;
|
|
222
|
-
let a =
|
|
227
|
+
let a = A(i).trim(), o = `sec-${r}`;
|
|
223
228
|
return t.push({
|
|
224
229
|
id: o,
|
|
225
230
|
level: n === "h2" ? 2 : 3,
|
|
@@ -261,10 +266,10 @@ function ge(e) {
|
|
|
261
266
|
figures: n
|
|
262
267
|
};
|
|
263
268
|
}
|
|
264
|
-
function
|
|
269
|
+
function ve(e, t) {
|
|
265
270
|
return typeof e == "string" && e.trim().length > 0 ? e.trim() : t.replace(/\.md$/i, "").replace(/^\d+[-_]/, "").toLowerCase();
|
|
266
271
|
}
|
|
267
|
-
function
|
|
272
|
+
function ye(e, t, n) {
|
|
268
273
|
let r = t.match(/^#\s+(.+)\n*/);
|
|
269
274
|
if (typeof e == "string" && e.trim()) {
|
|
270
275
|
let n = r ? t.slice(r[0].length) : t;
|
|
@@ -281,77 +286,77 @@ function ve(e, t, n) {
|
|
|
281
286
|
bodyWithoutH1: t
|
|
282
287
|
};
|
|
283
288
|
}
|
|
284
|
-
function
|
|
289
|
+
function k(e) {
|
|
285
290
|
return (e.split("\n").map((e) => e.trim()).filter((e) => e.length > 0 && !e.startsWith("#") && !e.startsWith("```") && !e.startsWith("|") && !e.startsWith("!["))[0] ?? "").replace(/[*_`[\]()]/g, "").slice(0, 140);
|
|
286
291
|
}
|
|
287
|
-
function
|
|
292
|
+
function A(e) {
|
|
288
293
|
return e.replace(/<[^>]+>/g, "");
|
|
289
294
|
}
|
|
290
|
-
function
|
|
295
|
+
function j(e) {
|
|
291
296
|
if (typeof e != "string") return;
|
|
292
297
|
let t = e.trim();
|
|
293
298
|
return t.length > 0 ? t : void 0;
|
|
294
299
|
}
|
|
295
|
-
function j(e) {
|
|
296
|
-
return e instanceof Date && !Number.isNaN(e.getTime()) ? e.toISOString().slice(0, 10) : A(e);
|
|
297
|
-
}
|
|
298
300
|
function M(e) {
|
|
299
|
-
|
|
301
|
+
return e instanceof Date && !Number.isNaN(e.getTime()) ? e.toISOString().slice(0, 10) : j(e);
|
|
300
302
|
}
|
|
301
303
|
function N(e) {
|
|
304
|
+
if (e === "regular" || e === "special" || e === "extra") return e;
|
|
305
|
+
}
|
|
306
|
+
function P(e) {
|
|
302
307
|
if (!Array.isArray(e)) return;
|
|
303
308
|
let t = e.filter((e) => typeof e == "string" && e.trim() !== "");
|
|
304
309
|
return t.length > 0 ? t : void 0;
|
|
305
310
|
}
|
|
306
|
-
var
|
|
311
|
+
var be = /* @__PURE__ */ new Set([
|
|
307
312
|
"lead",
|
|
308
313
|
"feature",
|
|
309
314
|
"standard",
|
|
310
315
|
"column-box"
|
|
311
|
-
]),
|
|
316
|
+
]), xe = /* @__PURE__ */ new Set([
|
|
312
317
|
"plain",
|
|
313
318
|
"solid",
|
|
314
319
|
"ruled",
|
|
315
320
|
"photo-overlay",
|
|
316
321
|
"horizontal-banner"
|
|
317
|
-
]),
|
|
322
|
+
]), Se = /* @__PURE__ */ new Set(["vertical", "horizontal"]), Ce = /* @__PURE__ */ new Set([
|
|
318
323
|
"right",
|
|
319
324
|
"left",
|
|
320
325
|
"top-ribbon"
|
|
321
|
-
]),
|
|
326
|
+
]), we = /* @__PURE__ */ new Set([
|
|
322
327
|
"accent",
|
|
323
328
|
"highlight",
|
|
324
329
|
"sports-impact",
|
|
325
330
|
"sports-yellow",
|
|
326
331
|
"ink",
|
|
327
332
|
"paper"
|
|
328
|
-
]),
|
|
333
|
+
]), Te = /* @__PURE__ */ new Set([
|
|
329
334
|
"none",
|
|
330
335
|
"framed",
|
|
331
336
|
"double-frame",
|
|
332
337
|
"tinted"
|
|
333
|
-
]),
|
|
338
|
+
]), Ee = /* @__PURE__ */ new Set([
|
|
334
339
|
"top",
|
|
335
340
|
"side",
|
|
336
341
|
"full-bleed",
|
|
337
342
|
"none"
|
|
338
343
|
]);
|
|
339
|
-
function
|
|
344
|
+
function De(e) {
|
|
340
345
|
if (!e || typeof e != "object" || Array.isArray(e)) return;
|
|
341
346
|
let t = e, n = Array.isArray(t.span) && t.span.length === 2 && typeof t.span[0] == "number" && typeof t.span[1] == "number" ? t.span : void 0, r = typeof t.colSpan == "number" ? t.colSpan : n ? n[0] : void 0, i = typeof t.rowSpan == "number" ? t.rowSpan : n ? n[1] : void 0, a = {
|
|
342
|
-
role: F(t.role,
|
|
347
|
+
role: F(t.role, be),
|
|
343
348
|
colSpan: r,
|
|
344
349
|
rowSpan: i,
|
|
345
350
|
col: typeof t.col == "number" ? t.col : void 0,
|
|
346
351
|
row: typeof t.row == "number" ? t.row : void 0,
|
|
347
352
|
imageSpan: typeof t.imageSpan == "number" ? t.imageSpan : void 0,
|
|
348
|
-
imagePlacement: F(t.imagePlacement,
|
|
349
|
-
headlineStyle: F(t.headlineStyle,
|
|
350
|
-
headlineOrientation: F(t.headlineOrientation,
|
|
351
|
-
overlayPosition: F(t.overlayPosition,
|
|
352
|
-
overlayTone: F(t.overlayTone,
|
|
353
|
-
overlayBadge:
|
|
354
|
-
boxStyle: F(t.boxStyle,
|
|
353
|
+
imagePlacement: F(t.imagePlacement, Ee),
|
|
354
|
+
headlineStyle: F(t.headlineStyle, xe),
|
|
355
|
+
headlineOrientation: F(t.headlineOrientation, Se),
|
|
356
|
+
overlayPosition: F(t.overlayPosition, Ce),
|
|
357
|
+
overlayTone: F(t.overlayTone, we),
|
|
358
|
+
overlayBadge: j(t.overlayBadge),
|
|
359
|
+
boxStyle: F(t.boxStyle, Te),
|
|
355
360
|
tiers: typeof t.tiers == "number" && t.tiers >= 1 && t.tiers <= 4 ? Math.round(t.tiers) : void 0
|
|
356
361
|
};
|
|
357
362
|
return Object.values(a).some((e) => e !== void 0) ? a : void 0;
|
|
@@ -359,7 +364,7 @@ function Ee(e) {
|
|
|
359
364
|
function F(e, t) {
|
|
360
365
|
return typeof e == "string" && t.has(e) ? e : void 0;
|
|
361
366
|
}
|
|
362
|
-
function
|
|
367
|
+
function Oe(e) {
|
|
363
368
|
if (!Array.isArray(e)) return;
|
|
364
369
|
let t = [];
|
|
365
370
|
for (let n of e) if (typeof n == "string" && n.trim()) t.push({ src: n.trim() });
|
|
@@ -367,14 +372,14 @@ function De(e) {
|
|
|
367
372
|
let e = n;
|
|
368
373
|
typeof e.src == "string" && e.src.trim() && t.push({
|
|
369
374
|
src: e.src.trim(),
|
|
370
|
-
alt:
|
|
371
|
-
caption:
|
|
375
|
+
alt: j(e.alt),
|
|
376
|
+
caption: j(e.caption)
|
|
372
377
|
});
|
|
373
378
|
}
|
|
374
379
|
return t.length > 0 ? t : void 0;
|
|
375
380
|
}
|
|
376
381
|
// src/adapters/fs/loadArticlesDirectory.ts
|
|
377
|
-
var
|
|
382
|
+
var ke = /* @__PURE__ */ new Set([
|
|
378
383
|
"classic",
|
|
379
384
|
"bold",
|
|
380
385
|
"ledger",
|
|
@@ -383,36 +388,36 @@ var Oe = /* @__PURE__ */ new Set([
|
|
|
383
388
|
"sports",
|
|
384
389
|
"economic",
|
|
385
390
|
"culture"
|
|
386
|
-
]),
|
|
391
|
+
]), Ae = /* @__PURE__ */ new Set([
|
|
387
392
|
"classic-frame",
|
|
388
393
|
"solid-banner",
|
|
389
394
|
"minimal-rule"
|
|
390
|
-
]),
|
|
395
|
+
]), je = /* @__PURE__ */ new Set([
|
|
391
396
|
"none",
|
|
392
397
|
"diagonal",
|
|
393
398
|
"dots",
|
|
394
399
|
"lattice"
|
|
395
|
-
]),
|
|
400
|
+
]), Me = /* @__PURE__ */ new Set([
|
|
396
401
|
"monochrome",
|
|
397
402
|
"color",
|
|
398
403
|
"warm"
|
|
399
|
-
]), I = /* @__PURE__ */ new Set(["serif", "sans"]),
|
|
404
|
+
]), I = /* @__PURE__ */ new Set(["serif", "sans"]), Ne = /* @__PURE__ */ new Set([
|
|
400
405
|
"broadsheet",
|
|
401
406
|
"impact",
|
|
402
407
|
"ledger"
|
|
403
|
-
]),
|
|
408
|
+
]), Pe = /* @__PURE__ */ new Set(["vertical-rl", "horizontal-tb"]), Fe = /* @__PURE__ */ new Set(["rtl", "ltr"]), Ie = /* @__PURE__ */ new Set([
|
|
404
409
|
"matte",
|
|
405
410
|
"glossy",
|
|
406
411
|
"uncoated"
|
|
407
|
-
]),
|
|
412
|
+
]), Le = /* @__PURE__ */ new Set(["perfect", "saddle"]), Re = /* @__PURE__ */ new Set([
|
|
408
413
|
"bold-banner",
|
|
409
414
|
"editorial-serif",
|
|
410
415
|
"vertical-stamp"
|
|
411
|
-
]),
|
|
416
|
+
]), ze = /* @__PURE__ */ new Set([
|
|
412
417
|
"morning-table",
|
|
413
418
|
"cafe-table",
|
|
414
419
|
"night-desk"
|
|
415
|
-
]),
|
|
420
|
+
]), Be = /* @__PURE__ */ new Set(["newspaper", "magazine"]), Ve = /* @__PURE__ */ new Set([
|
|
416
421
|
"lead",
|
|
417
422
|
"feature",
|
|
418
423
|
"standard",
|
|
@@ -427,7 +432,7 @@ async function L(t) {
|
|
|
427
432
|
}
|
|
428
433
|
let r = await a(n, "utf8"), i = v.parse(r);
|
|
429
434
|
if (!i || typeof i != "object" || Array.isArray(i)) throw new D(n, "baiten.yml はキー・値のマップ形式で記述してください");
|
|
430
|
-
let o = i, s =
|
|
435
|
+
let o = i, s = He(o.navigation, n);
|
|
431
436
|
return {
|
|
432
437
|
...o,
|
|
433
438
|
navigation: s
|
|
@@ -444,7 +449,7 @@ function R(e, t, n) {
|
|
|
444
449
|
external: typeof r.external == "boolean" ? r.external : void 0
|
|
445
450
|
};
|
|
446
451
|
}
|
|
447
|
-
function
|
|
452
|
+
function He(e, t) {
|
|
448
453
|
if (e == null) return;
|
|
449
454
|
if (typeof e != "object" || Array.isArray(e)) throw new D(t, "navigation はオブジェクト形式で指定してください");
|
|
450
455
|
let n = e, r = n.parentLink !== void 0 && n.parentLink !== null ? R(n.parentLink, t, "navigation.parentLink") : void 0, i = Array.isArray(n.headerLinks) ? n.headerLinks.map((e, n) => R(e, t, `navigation.headerLinks[${n}]`)) : void 0, a;
|
|
@@ -462,12 +467,12 @@ function Ve(e, t) {
|
|
|
462
467
|
footer: a
|
|
463
468
|
};
|
|
464
469
|
}
|
|
465
|
-
async function
|
|
466
|
-
let n = g(e), r = (await
|
|
470
|
+
async function Ue(e, t = {}) {
|
|
471
|
+
let n = g(e), r = (await We(n)).filter((e) => e.isDirectory() && !e.name.startsWith(".") && e.name !== "assets").sort((e, t) => e.name.localeCompare(t.name));
|
|
467
472
|
if (r.length === 0) throw Error(`新聞社ディレクトリが見つかりません: ${n}(例: articles/it-news/index.md を作成してください)`);
|
|
468
473
|
let i = [], a = [];
|
|
469
474
|
for (let e of r) {
|
|
470
|
-
let t = e.name, { source: r, pubAssets: o } = await
|
|
475
|
+
let t = e.name, { source: r, pubAssets: o } = await Ge(t, m(n, t));
|
|
471
476
|
i.push(r), a.push(...o);
|
|
472
477
|
}
|
|
473
478
|
return {
|
|
@@ -478,30 +483,30 @@ async function He(e, t = {}) {
|
|
|
478
483
|
assets: a
|
|
479
484
|
};
|
|
480
485
|
}
|
|
481
|
-
async function
|
|
486
|
+
async function We(e) {
|
|
482
487
|
try {
|
|
483
488
|
return await o(e, { withFileTypes: !0 });
|
|
484
489
|
} catch {
|
|
485
490
|
throw Error(`記事ディレクトリを読み込めません: ${e}`);
|
|
486
491
|
}
|
|
487
492
|
}
|
|
488
|
-
async function
|
|
489
|
-
let n = (await o(t, { withFileTypes: !0 })).filter((e) => e.isFile() && e.name.endsWith(".md")).map((e) => e.name).sort((e, t) => e.localeCompare(t)), r = n.includes("index.md") ? "index.md" : null, i = r ? await
|
|
490
|
-
if (i.cover?.heroImage &&
|
|
493
|
+
async function Ge(e, t) {
|
|
494
|
+
let n = (await o(t, { withFileTypes: !0 })).filter((e) => e.isFile() && e.name.endsWith(".md")).map((e) => e.name).sort((e, t) => e.localeCompare(t)), r = n.includes("index.md") ? "index.md" : null, i = r ? await Ke(e, m(t, r)) : Ye(e), s = n.filter((e) => e !== "index.md"), c = [], l = [], u = /* @__PURE__ */ new Set();
|
|
495
|
+
if (i.cover?.heroImage && V(i.cover.heroImage)) {
|
|
491
496
|
let n = g(t, i.cover.heroImage);
|
|
492
|
-
await
|
|
497
|
+
await H(n, r ? m(t, r) : t, i.cover.heroImage), u.add(n), l.push({
|
|
493
498
|
publicationId: e,
|
|
494
499
|
relativePath: i.cover.heroImage.replace(/^\.\//, ""),
|
|
495
500
|
absolutePath: n
|
|
496
501
|
});
|
|
497
502
|
}
|
|
498
503
|
for (let n of s) {
|
|
499
|
-
let r = m(t, n), i = await
|
|
504
|
+
let r = m(t, n), i = await ge(await a(r, "utf8"), n, r);
|
|
500
505
|
c.push(i);
|
|
501
|
-
let o =
|
|
506
|
+
let o = Qe(i);
|
|
502
507
|
for (let n of o) {
|
|
503
508
|
let i = g(t, n);
|
|
504
|
-
await
|
|
509
|
+
await H(i, r, n), u.has(i) || (u.add(i), l.push({
|
|
505
510
|
publicationId: e,
|
|
506
511
|
relativePath: n.replace(/^\.\//, ""),
|
|
507
512
|
absolutePath: i
|
|
@@ -516,8 +521,8 @@ async function We(e, t) {
|
|
|
516
521
|
pubAssets: l
|
|
517
522
|
};
|
|
518
523
|
}
|
|
519
|
-
async function
|
|
520
|
-
let { data: n } = O(await a(t, "utf8"), t), r =
|
|
524
|
+
async function Ke(e, t) {
|
|
525
|
+
let { data: n } = O(await a(t, "utf8"), t), r = z(n.format, Be, "newspaper", t, "format"), i = z(n.theme, ke, "it-broadsheet", t, "theme"), o = z(n.scene, ze, "morning-table", t, "scene");
|
|
521
526
|
return {
|
|
522
527
|
id: e,
|
|
523
528
|
title: typeof n.title == "string" && n.title.trim() ? n.title.trim() : e,
|
|
@@ -525,55 +530,55 @@ async function Ge(e, t) {
|
|
|
525
530
|
format: r,
|
|
526
531
|
theme: i,
|
|
527
532
|
scene: o,
|
|
528
|
-
writingMode: n.writingMode === void 0 ? void 0 :
|
|
529
|
-
readingDirection: n.readingDirection === void 0 ? void 0 :
|
|
530
|
-
paperFinish: n.paperFinish === void 0 ? void 0 :
|
|
531
|
-
binding: n.binding === void 0 ? void 0 :
|
|
532
|
-
cover:
|
|
533
|
+
writingMode: n.writingMode === void 0 ? void 0 : z(n.writingMode, Pe, "horizontal-tb", t, "writingMode"),
|
|
534
|
+
readingDirection: n.readingDirection === void 0 ? void 0 : z(n.readingDirection, Fe, "ltr", t, "readingDirection"),
|
|
535
|
+
paperFinish: n.paperFinish === void 0 ? void 0 : z(n.paperFinish, Ie, "matte", t, "paperFinish"),
|
|
536
|
+
binding: n.binding === void 0 ? void 0 : z(n.binding, Le, "perfect", t, "binding"),
|
|
537
|
+
cover: qe(n.cover, t),
|
|
533
538
|
displayOnRack: typeof n.displayOnRack == "boolean" ? n.displayOnRack : void 0,
|
|
534
539
|
order: typeof n.order == "number" ? n.order : void 0,
|
|
535
540
|
description: typeof n.description == "string" ? n.description.trim() : void 0,
|
|
536
541
|
accentColor: typeof n.accentColor == "string" ? n.accentColor.trim() : void 0,
|
|
537
542
|
paperTint: typeof n.paperTint == "string" ? n.paperTint.trim() : void 0,
|
|
538
|
-
masthead:
|
|
539
|
-
photoTreatment: n.photoTreatment === void 0 ? void 0 :
|
|
540
|
-
headlineFont: n.headlineFont === void 0 ? void 0 :
|
|
541
|
-
kioskPreview: n.kioskPreview === void 0 ? void 0 :
|
|
543
|
+
masthead: Je(n.masthead, t),
|
|
544
|
+
photoTreatment: n.photoTreatment === void 0 ? void 0 : z(n.photoTreatment, Me, "monochrome", t, "photoTreatment"),
|
|
545
|
+
headlineFont: n.headlineFont === void 0 ? void 0 : z(n.headlineFont, I, "serif", t, "headlineFont"),
|
|
546
|
+
kioskPreview: n.kioskPreview === void 0 ? void 0 : z(n.kioskPreview, Ne, "broadsheet", t, "kioskPreview"),
|
|
542
547
|
startingIssueNumber: typeof n.startingIssueNumber == "number" ? n.startingIssueNumber : void 0,
|
|
543
548
|
articlesPerEdition: typeof n.articlesPerEdition == "number" ? n.articlesPerEdition : void 0,
|
|
544
|
-
sheets:
|
|
545
|
-
editions:
|
|
549
|
+
sheets: B(n.sheets, t),
|
|
550
|
+
editions: Ze(n.editions, t)
|
|
546
551
|
};
|
|
547
552
|
}
|
|
548
|
-
function
|
|
553
|
+
function qe(e, t) {
|
|
549
554
|
if (e == null) return;
|
|
550
555
|
if (typeof e != "object" || Array.isArray(e)) throw new D(t, "cover はオブジェクト形式で記述してください");
|
|
551
556
|
let n = e;
|
|
552
557
|
return {
|
|
553
558
|
heroImage: typeof n.image == "string" && n.image.trim() ? n.image.trim() : typeof n.heroImage == "string" && n.heroImage.trim() ? n.heroImage.trim() : void 0,
|
|
554
559
|
overlay: typeof n.overlay == "boolean" ? n.overlay : void 0,
|
|
555
|
-
logoStyle: n.logoStyle === void 0 ? void 0 :
|
|
560
|
+
logoStyle: n.logoStyle === void 0 ? void 0 : z(n.logoStyle, Re, "bold-banner", t, "cover.logoStyle"),
|
|
556
561
|
tagline: typeof n.tagline == "string" && n.tagline.trim() ? n.tagline.trim() : void 0,
|
|
557
562
|
sublines: Array.isArray(n.sublines) ? n.sublines.filter((e) => typeof e == "string" && e.trim() !== "").map((e) => e.trim()) : void 0,
|
|
558
563
|
badge: typeof n.badge == "string" && n.badge.trim() ? n.badge.trim() : void 0,
|
|
559
564
|
overlayColor: typeof n.overlayColor == "string" && n.overlayColor.trim() ? n.overlayColor.trim() : void 0
|
|
560
565
|
};
|
|
561
566
|
}
|
|
562
|
-
function
|
|
567
|
+
function Je(e, t) {
|
|
563
568
|
if (e == null) return;
|
|
564
569
|
if (typeof e != "object" || Array.isArray(e)) throw new D(t, "masthead はオブジェクト形式で記述してください");
|
|
565
570
|
let n = e;
|
|
566
571
|
return {
|
|
567
|
-
variant: n.variant === void 0 ? void 0 :
|
|
568
|
-
pattern: n.pattern === void 0 ? void 0 :
|
|
569
|
-
font: n.font === void 0 ? void 0 :
|
|
572
|
+
variant: n.variant === void 0 ? void 0 : z(n.variant, Ae, "classic-frame", t, "masthead.variant"),
|
|
573
|
+
pattern: n.pattern === void 0 ? void 0 : z(n.pattern, je, "none", t, "masthead.pattern"),
|
|
574
|
+
font: n.font === void 0 ? void 0 : z(n.font, I, "serif", t, "masthead.font"),
|
|
570
575
|
showPageLabel: typeof n.showPageLabel == "boolean" ? n.showPageLabel : void 0,
|
|
571
576
|
backgroundColor: typeof n.backgroundColor == "string" ? n.backgroundColor.trim() : void 0,
|
|
572
577
|
textColor: typeof n.textColor == "string" ? n.textColor.trim() : void 0,
|
|
573
578
|
borderColor: typeof n.borderColor == "string" ? n.borderColor.trim() : void 0
|
|
574
579
|
};
|
|
575
580
|
}
|
|
576
|
-
function
|
|
581
|
+
function Ye(e) {
|
|
577
582
|
return {
|
|
578
583
|
id: e,
|
|
579
584
|
title: e,
|
|
@@ -583,17 +588,17 @@ function qe(e) {
|
|
|
583
588
|
scene: "morning-table"
|
|
584
589
|
};
|
|
585
590
|
}
|
|
586
|
-
function
|
|
591
|
+
function z(e, t, n, r, i) {
|
|
587
592
|
if (e == null) return n;
|
|
588
593
|
if (typeof e == "string" && t.has(e)) return e;
|
|
589
594
|
throw new D(r, `${i} の値が不正です: ${String(e)}(許可: ${Array.from(t).join(", ")})`);
|
|
590
595
|
}
|
|
591
|
-
function
|
|
596
|
+
function B(e, t) {
|
|
592
597
|
if (e != null) {
|
|
593
598
|
if (!Array.isArray(e)) throw new D(t, "sheets は配列で指定してください");
|
|
594
599
|
return e.map((e, n) => {
|
|
595
600
|
if (!e || typeof e != "object") throw new D(t, `sheets[${n}] はオブジェクトで指定してください`);
|
|
596
|
-
let r = e, i = typeof r.page == "number" ? r.page : n + 1, a = (Array.isArray(r.blocks) ? r.blocks : []).map((e, r) =>
|
|
601
|
+
let r = e, i = typeof r.page == "number" ? r.page : n + 1, a = (Array.isArray(r.blocks) ? r.blocks : []).map((e, r) => Xe(e, t, `sheets[${n}].blocks[${r}]`));
|
|
597
602
|
return {
|
|
598
603
|
page: i,
|
|
599
604
|
template: typeof r.template == "string" ? r.template : void 0,
|
|
@@ -605,11 +610,11 @@ function V(e, t) {
|
|
|
605
610
|
});
|
|
606
611
|
}
|
|
607
612
|
}
|
|
608
|
-
function
|
|
613
|
+
function Xe(e, t, n) {
|
|
609
614
|
if (!e || typeof e != "object") throw new D(t, `${n} が不正です`);
|
|
610
615
|
let r = e;
|
|
611
616
|
if (typeof r.file != "string" || !r.file.trim()) throw new D(t, `${n}.file は必須です`);
|
|
612
|
-
let i = r.role === void 0 || r.role === null ? void 0 :
|
|
617
|
+
let i = r.role === void 0 || r.role === null ? void 0 : z(r.role, Ve, "standard", t, `${n}.role`), a;
|
|
613
618
|
if (Array.isArray(r.span) && r.span.length === 2) {
|
|
614
619
|
let [e, t] = r.span;
|
|
615
620
|
typeof e == "number" && typeof t == "number" && (a = [e, t]);
|
|
@@ -634,7 +639,7 @@ function Je(e, t, n) {
|
|
|
634
639
|
tiers: typeof r.tiers == "number" && r.tiers >= 1 && r.tiers <= 4 ? Math.round(r.tiers) : void 0
|
|
635
640
|
};
|
|
636
641
|
}
|
|
637
|
-
function
|
|
642
|
+
function Ze(e, t) {
|
|
638
643
|
if (e != null) {
|
|
639
644
|
if (!Array.isArray(e)) throw new D(t, "editions は配列で指定してください");
|
|
640
645
|
return e.map((e, n) => {
|
|
@@ -648,22 +653,22 @@ function Ye(e, t) {
|
|
|
648
653
|
publishedAt: typeof r.publishedAt == "string" ? r.publishedAt : "2026-11-28",
|
|
649
654
|
displayOnRack: typeof r.displayOnRack == "boolean" ? r.displayOnRack : void 0,
|
|
650
655
|
articles: Array.isArray(r.articles) ? r.articles.filter((e) => typeof e == "string") : void 0,
|
|
651
|
-
sheets:
|
|
656
|
+
sheets: B(r.sheets, t)
|
|
652
657
|
};
|
|
653
658
|
});
|
|
654
659
|
}
|
|
655
660
|
}
|
|
656
|
-
function
|
|
661
|
+
function Qe(e) {
|
|
657
662
|
let t = [];
|
|
658
|
-
e.heroImage &&
|
|
659
|
-
for (let n of e.pages ?? []) n.src &&
|
|
660
|
-
for (let n of e.figures ?? []) n.src &&
|
|
663
|
+
e.heroImage && V(e.heroImage) && t.push(e.heroImage);
|
|
664
|
+
for (let n of e.pages ?? []) n.src && V(n.src) && t.push(n.src);
|
|
665
|
+
for (let n of e.figures ?? []) n.src && V(n.src) && t.push(n.src);
|
|
661
666
|
return t;
|
|
662
667
|
}
|
|
663
|
-
function
|
|
668
|
+
function V(e) {
|
|
664
669
|
return !/^(https?:\/\/|data:|\/)/i.test(e);
|
|
665
670
|
}
|
|
666
|
-
async function
|
|
671
|
+
async function H(t, n, r) {
|
|
667
672
|
try {
|
|
668
673
|
await e(t);
|
|
669
674
|
} catch {
|
|
@@ -671,7 +676,7 @@ async function U(t, n, r) {
|
|
|
671
676
|
}
|
|
672
677
|
}
|
|
673
678
|
// src/adapters/fs/readHeadFile.ts
|
|
674
|
-
var
|
|
679
|
+
var $e = /* @__PURE__ */ new Set([
|
|
675
680
|
"author",
|
|
676
681
|
"baiten-root",
|
|
677
682
|
"description",
|
|
@@ -684,13 +689,13 @@ var Ze = /* @__PURE__ */ new Set([
|
|
|
684
689
|
"og:url",
|
|
685
690
|
"twitter:card",
|
|
686
691
|
"viewport"
|
|
687
|
-
]),
|
|
692
|
+
]), et = /* @__PURE__ */ new Set([
|
|
688
693
|
"link",
|
|
689
694
|
"meta",
|
|
690
695
|
"script",
|
|
691
696
|
"style"
|
|
692
|
-
]),
|
|
693
|
-
function
|
|
697
|
+
]), tt = "<!doctype html><html><head>\n";
|
|
698
|
+
function nt(e) {
|
|
694
699
|
let t = Object.fromEntries(e.attrs.map(({ name: e, value: t }) => [e.toLowerCase(), t]));
|
|
695
700
|
if (e.tagName === "title" || e.tagName === "base") return `<${e.tagName}>`;
|
|
696
701
|
if (e.tagName === "link") {
|
|
@@ -703,12 +708,12 @@ function et(e) {
|
|
|
703
708
|
if (t["http-equiv"]?.trim().toLowerCase() === "content-type") return "<meta http-equiv=\"content-type\">";
|
|
704
709
|
for (let e of ["name", "property"]) {
|
|
705
710
|
let n = t[e]?.trim().toLowerCase();
|
|
706
|
-
if (n &&
|
|
711
|
+
if (n && $e.has(n)) return `<meta ${e}="${n}">`;
|
|
707
712
|
}
|
|
708
713
|
}
|
|
709
714
|
}
|
|
710
|
-
function
|
|
711
|
-
let n = (e, n) => /* @__PURE__ */ Error(`${t}:${Math.max(1, e - 1)}: ${n}`), r =
|
|
715
|
+
function rt(e, t) {
|
|
716
|
+
let n = (e, n) => /* @__PURE__ */ Error(`${t}:${Math.max(1, e - 1)}: ${n}`), r = ae(`${tt}${e}</head><body></body></html>`, {
|
|
712
717
|
sourceCodeLocationInfo: !0,
|
|
713
718
|
onParseError(e) {
|
|
714
719
|
throw n(e.startLine, `Invalid HTML (${e.code}).`);
|
|
@@ -718,24 +723,24 @@ function tt(e, t) {
|
|
|
718
723
|
for (let e of r.childNodes) {
|
|
719
724
|
if (e.nodeName === "#comment" || e.nodeName === "#text" && "value" in e && !e.value.trim()) continue;
|
|
720
725
|
if (!("tagName" in e)) throw n(e.sourceCodeLocation?.startLine ?? 2, "Expected a meta, link, script, or style tag.");
|
|
721
|
-
let t = e.sourceCodeLocation?.startLine ?? 2, r =
|
|
726
|
+
let t = e.sourceCodeLocation?.startLine ?? 2, r = nt(e);
|
|
722
727
|
if (r) throw n(t, `${r} is managed by Baiten3D. Use the existing site and article settings.`);
|
|
723
|
-
if (!
|
|
728
|
+
if (!et.has(e.tagName)) throw n(t, "Expected a meta, link, script, or style tag.");
|
|
724
729
|
}
|
|
725
730
|
}
|
|
726
|
-
function
|
|
731
|
+
function U(e, t) {
|
|
727
732
|
let n = h(e, t);
|
|
728
733
|
return !p(n) && n.split(_)[0] !== "..";
|
|
729
734
|
}
|
|
730
|
-
async function
|
|
735
|
+
async function it(e, t) {
|
|
731
736
|
if (t === void 0) return "";
|
|
732
737
|
if (typeof t != "string" || !t.trim() || p(t) || /^[a-z][a-z\d+.-]*:/i.test(t)) throw Error("baiten.yml: headFile must be a relative path within the project.");
|
|
733
738
|
let n = `baiten.yml: headFile ${JSON.stringify(t)}`, r = await s(e), i = g(r, t), o = () => /* @__PURE__ */ Error(`${n}: Use a path within the project.`);
|
|
734
|
-
if (!
|
|
739
|
+
if (!U(r, i)) throw o();
|
|
735
740
|
let c = (e) => Error(`${n}: Cannot read the HTML file. Check that it exists and is readable.`, { cause: e }), u = await s(i).catch((e) => {
|
|
736
741
|
throw c(e);
|
|
737
742
|
});
|
|
738
|
-
if (!
|
|
743
|
+
if (!U(r, u)) throw o();
|
|
739
744
|
let d;
|
|
740
745
|
try {
|
|
741
746
|
if (!(await l(u)).isFile()) throw Error("Expected a file.");
|
|
@@ -743,12 +748,12 @@ async function nt(e, t) {
|
|
|
743
748
|
} catch (e) {
|
|
744
749
|
throw c(e);
|
|
745
750
|
}
|
|
746
|
-
return
|
|
751
|
+
return rt(d, n), d;
|
|
747
752
|
}
|
|
748
753
|
// src/adapters/static/buildStaticSite.ts
|
|
749
|
-
var
|
|
750
|
-
async function
|
|
751
|
-
let n = g(e.projectDir), i = await L(n), a = g(n, e.articlesDir ?? i.articlesDir ?? "articles"), o = g(n, e.outDir ?? i.outDir ?? "dist"), s =
|
|
754
|
+
var at = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><rect width=\"64\" height=\"64\" rx=\"12\" fill=\"#18191D\"/><rect x=\"11\" y=\"10\" width=\"42\" height=\"44\" rx=\"3\" fill=\"#EFECE4\"/><line x1=\"17\" y1=\"18\" x2=\"47\" y2=\"18\" stroke=\"#1C1B19\" stroke-width=\"2.5\"/><line x1=\"17\" y1=\"22\" x2=\"47\" y2=\"22\" stroke=\"#1C1B19\" stroke-width=\"1\"/><rect x=\"35\" y=\"27\" width=\"12\" height=\"21\" fill=\"#1C1B19\"/><line x1=\"17\" y1=\"29\" x2=\"31\" y2=\"29\" stroke=\"#1C1B19\" stroke-width=\"2\"/><line x1=\"17\" y1=\"36\" x2=\"31\" y2=\"36\" stroke=\"#1C1B19\" stroke-width=\"1.5\"/><line x1=\"17\" y1=\"43\" x2=\"31\" y2=\"43\" stroke=\"#1C1B19\" stroke-width=\"1.5\"/></svg>";
|
|
755
|
+
async function W(e) {
|
|
756
|
+
let n = g(e.projectDir), i = await L(n), a = g(n, e.articlesDir ?? i.articlesDir ?? "articles"), o = g(n, e.outDir ?? i.outDir ?? "dist"), s = mt(e.siteUrl ?? i.siteUrl), { site: l, assets: d } = await Ue(a, {
|
|
752
757
|
title: e.title ?? i.title ?? "本日の新聞",
|
|
753
758
|
description: e.description ?? i.description,
|
|
754
759
|
entryViewOverride: i.entryView,
|
|
@@ -759,54 +764,54 @@ async function G(e) {
|
|
|
759
764
|
recursive: !0,
|
|
760
765
|
force: !0
|
|
761
766
|
}), await r(o, { recursive: !0 });
|
|
762
|
-
let p = await
|
|
767
|
+
let p = await ft(e.runtimeDistDir, o);
|
|
763
768
|
for (let e of d) {
|
|
764
769
|
let n = m(o, e.publicationId, e.relativePath);
|
|
765
770
|
await r(f(n), { recursive: !0 }), await t(e.absolutePath, n);
|
|
766
771
|
}
|
|
767
|
-
await u(m(o, "favicon.svg"),
|
|
768
|
-
let h =
|
|
772
|
+
await u(m(o, "favicon.svg"), at, "utf8");
|
|
773
|
+
let h = ut(l);
|
|
769
774
|
await u(m(o, "search-index.json"), JSON.stringify(h), "utf8");
|
|
770
|
-
let _ =
|
|
775
|
+
let _ = fe(l, {
|
|
771
776
|
siteUrl: s ?? null,
|
|
772
777
|
entryZoomAnimation: i.entryZoomAnimation ?? !1
|
|
773
778
|
});
|
|
774
779
|
await u(m(o, "kiosk-data.json"), JSON.stringify(_), "utf8");
|
|
775
780
|
for (let e of l.publications) {
|
|
776
|
-
let t =
|
|
781
|
+
let t = me(l, e, {
|
|
777
782
|
siteUrl: s ?? null,
|
|
778
783
|
entryZoomAnimation: i.entryZoomAnimation ?? !1
|
|
779
784
|
}), n = m(o, e.config.id, "pub-data.json");
|
|
780
785
|
await r(f(n), { recursive: !0 }), await u(n, JSON.stringify(t), "utf8");
|
|
781
786
|
}
|
|
782
|
-
let v = e.skipHeadFile ? "" : await
|
|
787
|
+
let v = e.skipHeadFile ? "" : await it(n, e.headFile ?? i.headFile), y = [], b = {
|
|
783
788
|
site: l,
|
|
784
789
|
siteUrl: s,
|
|
785
790
|
runtimeAssets: p,
|
|
786
791
|
headMarkup: v,
|
|
787
792
|
liveReload: !!e.liveReload
|
|
788
793
|
};
|
|
789
|
-
await Z(o, "/", l.entryView === "front-page" && l.publications[0] ?
|
|
794
|
+
await Z(o, "/", l.entryView === "front-page" && l.publications[0] ? G(b, l.publications[0], "/") : ot(b)), y.push("/");
|
|
790
795
|
for (let e of l.publications) {
|
|
791
796
|
let t = `/${e.config.id}/`;
|
|
792
|
-
await Z(o, t,
|
|
797
|
+
await Z(o, t, G(b, e, t)), y.push(t);
|
|
793
798
|
let n = `/${e.config.id}/archive/`;
|
|
794
|
-
await Z(o, n,
|
|
799
|
+
await Z(o, n, q(b, e, n)), y.push(n);
|
|
795
800
|
for (let n of e.editions) {
|
|
796
801
|
let r = `/${e.config.id}/editions/${n.id}/`, i = e.latestEdition?.id === n.id;
|
|
797
|
-
await Z(o, r,
|
|
802
|
+
await Z(o, r, K(b, e, n, r, !1, i ? t : void 0)), i || y.push(r);
|
|
798
803
|
}
|
|
799
804
|
let r = /* @__PURE__ */ new Map();
|
|
800
805
|
for (let t of l.routes) t.publicationId === e.config.id && r.set(t.articleSlug, t);
|
|
801
806
|
for (let t of e.allArticles) {
|
|
802
807
|
let n = r.get(t.slug);
|
|
803
808
|
if (!n) continue;
|
|
804
|
-
let i =
|
|
809
|
+
let i = J(b, e, e.editions.find((e) => e.id === n.editionId) ?? e.latestEdition, t, n);
|
|
805
810
|
await Z(o, n.canonicalPath, i), y.push(n.canonicalPath);
|
|
806
811
|
}
|
|
807
812
|
}
|
|
808
813
|
if (s) {
|
|
809
|
-
let e =
|
|
814
|
+
let e = dt(s, y);
|
|
810
815
|
await u(m(o, "sitemap.xml"), e, "utf8");
|
|
811
816
|
}
|
|
812
817
|
return {
|
|
@@ -817,7 +822,7 @@ async function G(e) {
|
|
|
817
822
|
searchEntryCount: h.length
|
|
818
823
|
};
|
|
819
824
|
}
|
|
820
|
-
function
|
|
825
|
+
function ot(e) {
|
|
821
826
|
let { site: t } = e, n = t.publications.map((e) => {
|
|
822
827
|
let t = e.latestEdition?.leadArticle;
|
|
823
828
|
return `<article class="baiten-ssr-pub" data-pub="${$(e.config.id)}" data-theme="${$(e.config.theme)}">
|
|
@@ -828,7 +833,7 @@ function it(e) {
|
|
|
828
833
|
</a>
|
|
829
834
|
<p class="baiten-ssr-archive-link"><a href="./${$(e.config.id)}/archive/">全記事アーカイブ</a></p>
|
|
830
835
|
</article>`;
|
|
831
|
-
}).join("\n"), r = t.navigation, i = [...r?.parentLink ? [r.parentLink] : [], ...r?.headerLinks ?? []], a = i.length > 0 ? `<nav class="baiten-ssr-nav">${i.map((e) => `<a href="${$(e.href)}">${$(e.label)}</a>`).join(" ")}</nav>` : "", o = r?.footer?.text || (r?.footer?.links?.length ?? 0) > 0 ? `<footer class="baiten-ssr-footer">${r?.footer?.text ? `<p>${$(r.footer.text)}</p>` : ""}${(r?.footer?.links?.length ?? 0) > 0 ? `<nav>${(r?.footer?.links ?? []).map((e) => `<a href="${$(e.href)}">${$(e.label)}</a>`).join(" ")}</nav>` : ""}</footer>` : "", s =
|
|
836
|
+
}).join("\n"), r = t.navigation, i = [...r?.parentLink ? [r.parentLink] : [], ...r?.headerLinks ?? []], a = i.length > 0 ? `<nav class="baiten-ssr-nav">${i.map((e) => `<a href="${$(e.href)}">${$(e.label)}</a>`).join(" ")}</nav>` : "", o = r?.footer?.text || (r?.footer?.links?.length ?? 0) > 0 ? `<footer class="baiten-ssr-footer">${r?.footer?.text ? `<p>${$(r.footer.text)}</p>` : ""}${(r?.footer?.links?.length ?? 0) > 0 ? `<nav>${(r?.footer?.links ?? []).map((e) => `<a href="${$(e.href)}">${$(e.label)}</a>`).join(" ")}</nav>` : ""}</footer>` : "", s = lt(e), c = `<main class="baiten-ssr-stand">
|
|
832
837
|
<header>
|
|
833
838
|
${a}
|
|
834
839
|
<h1>${$(t.title)}</h1>
|
|
@@ -849,11 +854,11 @@ function it(e) {
|
|
|
849
854
|
body: c
|
|
850
855
|
});
|
|
851
856
|
}
|
|
852
|
-
function
|
|
857
|
+
function G(e, t, n) {
|
|
853
858
|
let r = t.latestEdition;
|
|
854
|
-
return r ?
|
|
859
|
+
return r ? K(e, t, r, n, !0) : q(e, t, n);
|
|
855
860
|
}
|
|
856
|
-
function
|
|
861
|
+
function K(e, t, n, r, i = !1, a) {
|
|
857
862
|
let o = Q(r), s = n.sheets.map((e) => {
|
|
858
863
|
let n = e.blocks.map((e) => {
|
|
859
864
|
let n = `${o}${t.config.id}/${e.article.slug}/`, r = e.article.heroImage ? `<img src="${o}${$(t.config.id)}/${$(e.article.heroImage)}" alt="${$(e.article.heroCaption ?? e.article.title)}" loading="lazy" width="640" height="480">` : "";
|
|
@@ -902,7 +907,7 @@ function q(e, t, n, r, i = !1, a) {
|
|
|
902
907
|
body: d
|
|
903
908
|
});
|
|
904
909
|
}
|
|
905
|
-
function
|
|
910
|
+
function q(e, t, n) {
|
|
906
911
|
let r = Q(n), i = new Map(e.site.routes.filter((e) => e.publicationId === t.config.id).map((e) => [e.articleSlug, e])), a = new Map(t.editions.map((e) => [e.id, e])), o = t.allArticles.map((e) => {
|
|
907
912
|
let n = i.get(e.slug), o = n ? a.get(n.editionId) : void 0, s = o?.label ?? "通常号";
|
|
908
913
|
return `<li data-edition-kind="${$(o?.kind ?? "regular")}">
|
|
@@ -936,8 +941,8 @@ function J(e, t, n) {
|
|
|
936
941
|
body: l
|
|
937
942
|
});
|
|
938
943
|
}
|
|
939
|
-
function
|
|
940
|
-
let a = Q(i.canonicalPath), o =
|
|
944
|
+
function J(e, t, n, r, i) {
|
|
945
|
+
let a = Q(i.canonicalPath), o = pt(r.bodyHtml ?? `<p>${$(r.body)}</p>`, `${a}${t.config.id}/`), s = r.heroImage ? `<figure class="baiten-figure baiten-figure--image"><img src="${a}${$(t.config.id)}/${$(r.heroImage)}" alt="${$(r.heroCaption ?? r.title)}" width="960" height="717">${r.heroCaption ? `<figcaption>${$(r.heroCaption)}</figcaption>` : ""}</figure>` : "", c = t.allArticles.filter((e) => e.slug !== r.slug).slice(0, 3).map((e) => `<li><a href="${a}${$(t.config.id)}/${$(e.slug)}/">${$(e.title)}</a> <time datetime="${$(e.publishedAt)}">${$(e.publishedAt)}</time></li>`).join("\n"), l = `${r.title} | ${t.config.title}`, u = r.summary || `${t.config.title}の記事`, d = `<main class="baiten-ssr-article" data-pub="${$(t.config.id)}" data-slug="${$(r.slug)}" data-theme="${$(t.config.theme)}" data-scene="${$(t.config.scene)}" dir="${t.readingDirection}">
|
|
941
946
|
<nav aria-label="パンくずリスト">
|
|
942
947
|
<ol>
|
|
943
948
|
<li><a href="${a}">売店</a></li>
|
|
@@ -961,7 +966,7 @@ function at(e, t, n, r, i) {
|
|
|
961
966
|
<div class="baiten-ssr-body">${o}</div>
|
|
962
967
|
</article>
|
|
963
968
|
${c ? `<aside aria-label="あわせて読む"><h2>あわせて読む</h2><ul>${c}</ul></aside>` : ""}
|
|
964
|
-
</main>`, f = [
|
|
969
|
+
</main>`, f = [st(e, t, r, i), ct(e, t, r, i)];
|
|
965
970
|
return Y(e, {
|
|
966
971
|
title: l,
|
|
967
972
|
description: u,
|
|
@@ -1023,7 +1028,7 @@ function Y(e, t) {
|
|
|
1023
1028
|
</html>
|
|
1024
1029
|
`;
|
|
1025
1030
|
}
|
|
1026
|
-
function
|
|
1031
|
+
function st(e, t, n, r) {
|
|
1027
1032
|
let i = e.siteUrl ? new URL(r.canonicalPath.replace(/^\//, ""), e.siteUrl).href : r.canonicalPath, a = n.heroImage && e.siteUrl ? new URL(`${t.config.id}/${n.heroImage}`, e.siteUrl).href : void 0;
|
|
1028
1033
|
return {
|
|
1029
1034
|
"@context": "https://schema.org",
|
|
@@ -1049,7 +1054,7 @@ function ot(e, t, n, r) {
|
|
|
1049
1054
|
}
|
|
1050
1055
|
};
|
|
1051
1056
|
}
|
|
1052
|
-
function
|
|
1057
|
+
function ct(e, t, n, r) {
|
|
1053
1058
|
let i = (t) => e.siteUrl ? new URL(t.replace(/^\//, ""), e.siteUrl).href : t;
|
|
1054
1059
|
return {
|
|
1055
1060
|
"@context": "https://schema.org",
|
|
@@ -1076,7 +1081,7 @@ function st(e, t, n, r) {
|
|
|
1076
1081
|
]
|
|
1077
1082
|
};
|
|
1078
1083
|
}
|
|
1079
|
-
function
|
|
1084
|
+
function lt(e) {
|
|
1080
1085
|
return {
|
|
1081
1086
|
"@context": "https://schema.org",
|
|
1082
1087
|
"@type": "WebSite",
|
|
@@ -1096,7 +1101,7 @@ function X(e, t, n, r) {
|
|
|
1096
1101
|
inLanguage: "ja"
|
|
1097
1102
|
};
|
|
1098
1103
|
}
|
|
1099
|
-
function
|
|
1104
|
+
function ut(e) {
|
|
1100
1105
|
let t = [], n = new Map(e.publications.map((e) => [e.config.id, e]));
|
|
1101
1106
|
for (let r of e.routes) {
|
|
1102
1107
|
let e = n.get(r.publicationId);
|
|
@@ -1122,14 +1127,14 @@ function lt(e) {
|
|
|
1122
1127
|
}
|
|
1123
1128
|
return t;
|
|
1124
1129
|
}
|
|
1125
|
-
function
|
|
1130
|
+
function dt(e, t) {
|
|
1126
1131
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
1127
1132
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
1128
1133
|
${Array.from(new Set(t)).sort((e, t) => e.localeCompare(t)).map((t) => ` <url><loc>${$(new URL(t.replace(/^\//, ""), e).href)}</loc></url>`).join("\n")}
|
|
1129
1134
|
</urlset>
|
|
1130
1135
|
`;
|
|
1131
1136
|
}
|
|
1132
|
-
async function
|
|
1137
|
+
async function ft(t, r) {
|
|
1133
1138
|
if (!t) return {
|
|
1134
1139
|
scripts: [],
|
|
1135
1140
|
styles: []
|
|
@@ -1167,10 +1172,10 @@ function Q(e) {
|
|
|
1167
1172
|
let t = e.replace(/^\/|\/$/g, "").split("/").filter(Boolean).length;
|
|
1168
1173
|
return t === 0 ? "./" : "../".repeat(t);
|
|
1169
1174
|
}
|
|
1170
|
-
function
|
|
1175
|
+
function pt(e, t) {
|
|
1171
1176
|
return e.replace(/(<img\s+[^>]*src=")(?!https?:\/\/|data:|\/)([^"]+)(")/gi, (e, n, r, i) => `${n}${t}${r.replace(/^\.\//, "")}${i}`);
|
|
1172
1177
|
}
|
|
1173
|
-
function
|
|
1178
|
+
function mt(e) {
|
|
1174
1179
|
if (!e?.trim()) return;
|
|
1175
1180
|
let t = e.trim();
|
|
1176
1181
|
return t.endsWith("/") ? t : `${t}/`;
|
|
@@ -1185,9 +1190,9 @@ function $(e) {
|
|
|
1185
1190
|
})[e] ?? e);
|
|
1186
1191
|
}
|
|
1187
1192
|
// src/adapters/static/serveStaticSite.ts
|
|
1188
|
-
async function
|
|
1189
|
-
let t = g(e.projectDir), n = await L(t), r = g(t, e.articlesDir ?? n.articlesDir ?? "articles"), a = e.outDir ?? await i(m(
|
|
1190
|
-
await
|
|
1193
|
+
async function ht(e) {
|
|
1194
|
+
let t = g(e.projectDir), n = await L(t), r = g(t, e.articlesDir ?? n.articlesDir ?? "articles"), a = e.outDir ?? await i(m(ce(), "baiten3d-preview-")), o = !e.outDir;
|
|
1195
|
+
await W({
|
|
1191
1196
|
...e,
|
|
1192
1197
|
projectDir: t,
|
|
1193
1198
|
articlesDir: r,
|
|
@@ -1195,10 +1200,10 @@ async function mt(e) {
|
|
|
1195
1200
|
skipHeadFile: !0,
|
|
1196
1201
|
liveReload: e.watchFiles !== !1
|
|
1197
1202
|
});
|
|
1198
|
-
let s = /* @__PURE__ */ new Set(), l = null, u = e.watchFiles === !1 ? null :
|
|
1203
|
+
let s = /* @__PURE__ */ new Set(), l = null, u = e.watchFiles === !1 ? null : oe(r, { recursive: !0 }, () => {
|
|
1199
1204
|
l && clearTimeout(l), l = setTimeout(async () => {
|
|
1200
1205
|
try {
|
|
1201
|
-
await
|
|
1206
|
+
await W({
|
|
1202
1207
|
...e,
|
|
1203
1208
|
projectDir: t,
|
|
1204
1209
|
articlesDir: r,
|
|
@@ -1211,8 +1216,8 @@ async function mt(e) {
|
|
|
1211
1216
|
console.error("[baiten3d] 再ビルドエラー:", e);
|
|
1212
1217
|
}
|
|
1213
1218
|
}, 150);
|
|
1214
|
-
}), d =
|
|
1215
|
-
|
|
1219
|
+
}), d = se((e, t) => {
|
|
1220
|
+
gt(e, t, a, s);
|
|
1216
1221
|
}), f = e.host ?? "127.0.0.1", p = e.port ?? 4173;
|
|
1217
1222
|
await new Promise((e, t) => {
|
|
1218
1223
|
d.once("error", t), d.listen(p, f, () => e());
|
|
@@ -1231,7 +1236,7 @@ async function mt(e) {
|
|
|
1231
1236
|
}
|
|
1232
1237
|
};
|
|
1233
1238
|
}
|
|
1234
|
-
async function
|
|
1239
|
+
async function gt(e, t, n, r) {
|
|
1235
1240
|
let i = (e.url ?? "/").split("?")[0] ?? "/";
|
|
1236
1241
|
if (i === "/__baiten_reload") {
|
|
1237
1242
|
t.writeHead(200, {
|
|
@@ -1246,14 +1251,14 @@ async function ht(e, t, n, r) {
|
|
|
1246
1251
|
t.writeHead(403), t.end("Forbidden");
|
|
1247
1252
|
return;
|
|
1248
1253
|
}
|
|
1249
|
-
let c = await
|
|
1254
|
+
let c = await _t(s);
|
|
1250
1255
|
if (!c) {
|
|
1251
1256
|
t.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" }), t.end("Not Found");
|
|
1252
1257
|
return;
|
|
1253
1258
|
}
|
|
1254
|
-
let l = await a(c), u =
|
|
1259
|
+
let l = await a(c), u = ue.contentType(d(c)) || "application/octet-stream", f = /\bgzip\b/.test(e.headers["accept-encoding"] ?? ""), p = /^(text\/|application\/(javascript|json|xml)|image\/svg\+xml)/.test(u);
|
|
1255
1260
|
if (f && p) {
|
|
1256
|
-
let e =
|
|
1261
|
+
let e = le(l);
|
|
1257
1262
|
t.writeHead(200, {
|
|
1258
1263
|
"Content-Type": u,
|
|
1259
1264
|
"Content-Encoding": "gzip",
|
|
@@ -1264,7 +1269,7 @@ async function ht(e, t, n, r) {
|
|
|
1264
1269
|
"Cache-Control": "no-cache"
|
|
1265
1270
|
}), t.end(l);
|
|
1266
1271
|
}
|
|
1267
|
-
async function
|
|
1272
|
+
async function _t(e) {
|
|
1268
1273
|
try {
|
|
1269
1274
|
let t = await l(e);
|
|
1270
1275
|
if (t.isFile()) return e;
|
|
@@ -1277,4 +1282,4 @@ async function gt(e) {
|
|
|
1277
1282
|
}
|
|
1278
1283
|
return null;
|
|
1279
1284
|
}
|
|
1280
|
-
export {
|
|
1285
|
+
export { W as buildStaticSite, ht as serveStaticSite };
|