react-cheminfo 0.34.0 → 0.36.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 +28 -28
- package/bin/check-seo.mjs +333 -0
- package/lib/about/core/about.d.ts +1 -30
- package/lib/about/core/about.d.ts.map +1 -1
- package/lib/about/core/about.js +0 -16
- package/lib/about/core/about.js.map +1 -1
- package/lib/about/core/index.d.ts +0 -1
- package/lib/about/core/index.d.ts.map +1 -1
- package/lib/about/core/index.js +0 -1
- package/lib/about/core/index.js.map +1 -1
- package/lib/about/ui/AboutBuild.d.ts +2 -5
- package/lib/about/ui/AboutBuild.d.ts.map +1 -1
- package/lib/about/ui/AboutBuild.js +7 -19
- package/lib/about/ui/AboutBuild.js.map +1 -1
- package/lib/about/ui/AboutPage.d.ts +2 -2
- package/lib/about/ui/AboutPage.d.ts.map +1 -1
- package/lib/about/ui/AboutPage.js +3 -14
- package/lib/about/ui/AboutPage.js.map +1 -1
- package/lib/about/ui/AboutVersion.d.ts +0 -4
- package/lib/about/ui/AboutVersion.d.ts.map +1 -1
- package/lib/about/ui/AboutVersion.js +3 -31
- package/lib/about/ui/AboutVersion.js.map +1 -1
- package/lib/download/core/index.d.ts +0 -5
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +0 -3
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/ui/FigureDownload.d.ts +4 -55
- package/lib/download/ui/FigureDownload.d.ts.map +1 -1
- package/lib/download/ui/FigureDownload.js +6 -66
- package/lib/download/ui/FigureDownload.js.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.d.ts +16 -2
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +11 -30
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/figureDownloadHint.d.ts +30 -0
- package/lib/download/ui/figureDownloadHint.d.ts.map +1 -0
- package/lib/download/ui/figureDownloadHint.js +33 -0
- package/lib/download/ui/figureDownloadHint.js.map +1 -0
- package/lib/download/ui/index.d.ts +3 -10
- package/lib/download/ui/index.d.ts.map +1 -1
- package/lib/download/ui/index.js +1 -5
- package/lib/download/ui/index.js.map +1 -1
- package/lib/download/ui/useFigureActions.d.ts +50 -0
- package/lib/download/ui/useFigureActions.d.ts.map +1 -0
- package/lib/download/ui/useFigureActions.js +58 -0
- package/lib/download/ui/useFigureActions.js.map +1 -0
- package/lib/download/ui/useFigureDownload.d.ts +85 -0
- package/lib/download/ui/useFigureDownload.d.ts.map +1 -0
- package/lib/download/ui/useFigureDownload.js +75 -0
- package/lib/download/ui/useFigureDownload.js.map +1 -0
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +0 -40
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +0 -10
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/ir/core/irCommands.d.ts +2 -2
- package/lib/ir/core/irCommands.js +2 -2
- package/lib/ir/core/irCommands.js.map +1 -1
- package/lib/ir/ui/IrAboutDialog.d.ts.map +1 -1
- package/lib/ir/ui/IrAboutDialog.js +1 -1
- package/lib/ir/ui/IrAboutDialog.js.map +1 -1
- package/lib/ir/ui/IrCanvas.d.ts +6 -0
- package/lib/ir/ui/IrCanvas.d.ts.map +1 -1
- package/lib/ir/ui/IrCanvas.js +2 -2
- package/lib/ir/ui/IrCanvas.js.map +1 -1
- package/lib/ir/ui/IrShell.d.ts.map +1 -1
- package/lib/ir/ui/IrShell.js +16 -11
- package/lib/ir/ui/IrShell.js.map +1 -1
- package/lib/ir/ui/IrToolbar.d.ts +11 -1
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -1
- package/lib/ir/ui/IrToolbar.js +12 -2
- package/lib/ir/ui/IrToolbar.js.map +1 -1
- package/lib/ir/ui/index.d.ts +1 -0
- package/lib/ir/ui/index.d.ts.map +1 -1
- package/lib/ir/ui/index.js.map +1 -1
- package/lib/language/core/index.d.ts +2 -0
- package/lib/language/core/index.d.ts.map +1 -1
- package/lib/language/core/index.js +1 -0
- package/lib/language/core/index.js.map +1 -1
- package/lib/language/core/languagePath.d.ts +52 -0
- package/lib/language/core/languagePath.d.ts.map +1 -0
- package/lib/language/core/languagePath.js +65 -0
- package/lib/language/core/languagePath.js.map +1 -0
- package/lib/locales/de.json +2 -4
- package/lib/locales/en.json +2 -4
- package/lib/locales/es.json +2 -4
- package/lib/locales/fr.json +2 -4
- package/lib/locales/it.json +2 -4
- package/lib/overlay/ui/OverlayPanel.d.ts +6 -0
- package/lib/overlay/ui/OverlayPanel.d.ts.map +1 -1
- package/lib/overlay/ui/OverlayPanel.js +2 -2
- package/lib/overlay/ui/OverlayPanel.js.map +1 -1
- package/lib/overlay/ui/overlayPanelStyles.d.ts +2 -1
- package/lib/overlay/ui/overlayPanelStyles.d.ts.map +1 -1
- package/lib/overlay/ui/overlayPanelStyles.js +3 -1
- package/lib/overlay/ui/overlayPanelStyles.js.map +1 -1
- package/lib/periodic/ui/ElementCell.d.ts +0 -6
- package/lib/periodic/ui/ElementCell.d.ts.map +1 -1
- package/lib/periodic/ui/ElementCell.js +34 -30
- package/lib/periodic/ui/ElementCell.js.map +1 -1
- package/lib/periodic/ui/PeriodicTable.d.ts.map +1 -1
- package/lib/periodic/ui/PeriodicTable.js +12 -15
- package/lib/periodic/ui/PeriodicTable.js.map +1 -1
- package/lib/seo/core/alternates.d.ts +40 -0
- package/lib/seo/core/alternates.d.ts.map +1 -0
- package/lib/seo/core/alternates.js +42 -0
- package/lib/seo/core/alternates.js.map +1 -0
- package/lib/seo/core/index.d.ts +3 -0
- package/lib/seo/core/index.d.ts.map +1 -1
- package/lib/seo/core/index.js +2 -0
- package/lib/seo/core/index.js.map +1 -1
- package/lib/seo/core/noscript.d.ts +9 -0
- package/lib/seo/core/noscript.d.ts.map +1 -1
- package/lib/seo/core/noscript.js +7 -2
- package/lib/seo/core/noscript.js.map +1 -1
- package/lib/seo/core/pageMeta.d.ts +23 -0
- package/lib/seo/core/pageMeta.d.ts.map +1 -1
- package/lib/seo/core/pageMeta.js +52 -3
- package/lib/seo/core/pageMeta.js.map +1 -1
- package/lib/seo/core/pageProse.d.ts +76 -0
- package/lib/seo/core/pageProse.d.ts.map +1 -0
- package/lib/seo/core/pageProse.js +92 -0
- package/lib/seo/core/pageProse.js.map +1 -0
- package/lib/seo/core/routeProblems.d.ts +33 -0
- package/lib/seo/core/routeProblems.d.ts.map +1 -0
- package/lib/seo/core/routeProblems.js +89 -0
- package/lib/seo/core/routeProblems.js.map +1 -0
- package/lib/seo/core/routes.d.ts +14 -0
- package/lib/seo/core/routes.d.ts.map +1 -1
- package/lib/seo/core/routes.js.map +1 -1
- package/lib/seo/core/siteFiles.d.ts.map +1 -1
- package/lib/seo/core/siteFiles.js +2 -1
- package/lib/seo/core/siteFiles.js.map +1 -1
- package/lib/seo/vite/prerender.d.ts +13 -0
- package/lib/seo/vite/prerender.d.ts.map +1 -1
- package/lib/seo/vite/prerender.js +17 -10
- package/lib/seo/vite/prerender.js.map +1 -1
- package/package.json +2 -1
- package/src/about/core/about.ts +1 -51
- package/src/about/core/index.ts +0 -1
- package/src/about/ui/AboutBuild.tsx +8 -37
- package/src/about/ui/AboutPage.tsx +8 -64
- package/src/about/ui/AboutVersion.tsx +5 -45
- package/src/download/core/index.ts +0 -25
- package/src/download/ui/FigureDownload.tsx +11 -148
- package/src/download/ui/FigureDownloadPanel.tsx +46 -45
- package/src/download/ui/figureDownloadHint.ts +52 -0
- package/src/download/ui/index.ts +6 -10
- package/src/download/ui/useFigureActions.ts +113 -0
- package/src/download/ui/useFigureDownload.tsx +191 -0
- package/src/ecosystem/core/sites.ts +0 -40
- package/src/ecosystem/core/types.ts +0 -10
- package/src/ir/core/irCommands.ts +2 -2
- package/src/ir/ui/IrAboutDialog.tsx +0 -13
- package/src/ir/ui/IrCanvas.tsx +8 -2
- package/src/ir/ui/IrShell.tsx +23 -25
- package/src/ir/ui/IrToolbar.tsx +36 -6
- package/src/ir/ui/index.ts +1 -0
- package/src/language/core/index.ts +2 -0
- package/src/language/core/languagePath.ts +78 -0
- package/src/locales/de.json +2 -4
- package/src/locales/en.json +2 -4
- package/src/locales/es.json +2 -4
- package/src/locales/fr.json +2 -4
- package/src/locales/it.json +2 -4
- package/src/overlay/ui/OverlayPanel.tsx +8 -2
- package/src/overlay/ui/overlayPanelStyles.ts +3 -0
- package/src/periodic/ui/ElementCell.tsx +34 -37
- package/src/periodic/ui/PeriodicTable.tsx +12 -17
- package/src/seo/core/alternates.ts +65 -0
- package/src/seo/core/index.ts +3 -0
- package/src/seo/core/noscript.ts +18 -2
- package/src/seo/core/pageMeta.ts +74 -3
- package/src/seo/core/pageProse.ts +146 -0
- package/src/seo/core/routeProblems.ts +111 -0
- package/src/seo/core/routes.ts +14 -0
- package/src/seo/core/siteFiles.ts +2 -1
- package/src/seo/vite/prerender.ts +30 -11
- package/lib/about/core/repository.d.ts +0 -14
- package/lib/about/core/repository.d.ts.map +0 -1
- package/lib/about/core/repository.js +0 -21
- package/lib/about/core/repository.js.map +0 -1
- package/lib/download/core/exportStyles.d.ts +0 -22
- package/lib/download/core/exportStyles.d.ts.map +0 -1
- package/lib/download/core/exportStyles.js +0 -19
- package/lib/download/core/exportStyles.js.map +0 -1
- package/lib/download/core/imageResolution.d.ts +0 -88
- package/lib/download/core/imageResolution.d.ts.map +0 -1
- package/lib/download/core/imageResolution.js +0 -77
- package/lib/download/core/imageResolution.js.map +0 -1
- package/lib/download/core/pictureExport.d.ts +0 -93
- package/lib/download/core/pictureExport.d.ts.map +0 -1
- package/lib/download/core/pictureExport.js +0 -116
- package/lib/download/core/pictureExport.js.map +0 -1
- package/lib/download/ui/ExportDialogFrame.d.ts +0 -46
- package/lib/download/ui/ExportDialogFrame.d.ts.map +0 -1
- package/lib/download/ui/ExportDialogFrame.js +0 -24
- package/lib/download/ui/ExportDialogFrame.js.map +0 -1
- package/lib/download/ui/ExportImageDialog.d.ts +0 -47
- package/lib/download/ui/ExportImageDialog.d.ts.map +0 -1
- package/lib/download/ui/ExportImageDialog.js +0 -25
- package/lib/download/ui/ExportImageDialog.js.map +0 -1
- package/lib/download/ui/ExportNameField.d.ts +0 -29
- package/lib/download/ui/ExportNameField.d.ts.map +0 -1
- package/lib/download/ui/ExportNameField.js +0 -99
- package/lib/download/ui/ExportNameField.js.map +0 -1
- package/lib/download/ui/ExportPictureSection.d.ts +0 -38
- package/lib/download/ui/ExportPictureSection.d.ts.map +0 -1
- package/lib/download/ui/ExportPictureSection.js +0 -48
- package/lib/download/ui/ExportPictureSection.js.map +0 -1
- package/lib/download/ui/useDrawingBox.d.ts +0 -23
- package/lib/download/ui/useDrawingBox.d.ts.map +0 -1
- package/lib/download/ui/useDrawingBox.js +0 -21
- package/lib/download/ui/useDrawingBox.js.map +0 -1
- package/src/about/core/repository.ts +0 -22
- package/src/download/core/exportStyles.ts +0 -20
- package/src/download/core/imageResolution.ts +0 -118
- package/src/download/core/pictureExport.ts +0 -207
- package/src/download/ui/ExportDialogFrame.tsx +0 -86
- package/src/download/ui/ExportImageDialog.tsx +0 -91
- package/src/download/ui/ExportNameField.tsx +0 -148
- package/src/download/ui/ExportPictureSection.tsx +0 -142
- package/src/download/ui/useDrawingBox.ts +0 -37
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text a page is indexed on, written into the HTML before anything runs.
|
|
3
|
+
*
|
|
4
|
+
* A prerendered site writes one file per address, and each of them carried the
|
|
5
|
+
* same body: the site's crawl path, and nothing else. A search engine clusters
|
|
6
|
+
* pages by the text it is handed, so a hundred and eighteen element pages
|
|
7
|
+
* differing only in their title are a hundred and seventeen duplicates — and
|
|
8
|
+
* which one it keeps is not ours to choose. A page heavy enough that the
|
|
9
|
+
* renderer never gets to it is indexed on that body alone.
|
|
10
|
+
*
|
|
11
|
+
* So what a site writes here is the text its running app already shows, drawn
|
|
12
|
+
* from the same data: the prose is not written twice, it is written where the
|
|
13
|
+
* build can reach it. Text only, and escaped — the addresses a reader follows
|
|
14
|
+
* are the crawl path's business.
|
|
15
|
+
*/
|
|
16
|
+
/** A table of facts under the prose: the rows a page would show anyway. */
|
|
17
|
+
export interface PageTable {
|
|
18
|
+
/** Header cells, left to right. */
|
|
19
|
+
columns: readonly string[];
|
|
20
|
+
/** Body rows, each as many cells as there are columns. */
|
|
21
|
+
rows: ReadonlyArray<readonly string[]>;
|
|
22
|
+
/**
|
|
23
|
+
* The sentence under the table, saying where the numbers come from.
|
|
24
|
+
* @default undefined — the table stands on its own
|
|
25
|
+
*/
|
|
26
|
+
caption?: string;
|
|
27
|
+
}
|
|
28
|
+
/** One run of the page's text: a heading, prose, and the facts under it. */
|
|
29
|
+
export interface PageSection {
|
|
30
|
+
/**
|
|
31
|
+
* The heading it opens with, as an `h2`.
|
|
32
|
+
* @default undefined — the run carries no heading
|
|
33
|
+
*/
|
|
34
|
+
heading?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The paragraphs under it, each taken as written.
|
|
37
|
+
* @default undefined — no prose
|
|
38
|
+
*/
|
|
39
|
+
paragraphs?: readonly string[];
|
|
40
|
+
/**
|
|
41
|
+
* A list under the prose, one item per line.
|
|
42
|
+
* @default undefined — no list
|
|
43
|
+
*/
|
|
44
|
+
list?: readonly string[];
|
|
45
|
+
/**
|
|
46
|
+
* A table under the prose.
|
|
47
|
+
* @default undefined — no table
|
|
48
|
+
*/
|
|
49
|
+
table?: PageTable;
|
|
50
|
+
}
|
|
51
|
+
/** The whole of one page's text, as the page itself would say it. */
|
|
52
|
+
export interface PageContent extends PageSection {
|
|
53
|
+
/**
|
|
54
|
+
* The page's own name, written as its `h1`. It answers the title the page is
|
|
55
|
+
* indexed under, so a reader who searched for it reads the same words again.
|
|
56
|
+
*/
|
|
57
|
+
heading: string;
|
|
58
|
+
/**
|
|
59
|
+
* The runs under the opening prose, in reading order.
|
|
60
|
+
* @default undefined — the page is its opening prose
|
|
61
|
+
*/
|
|
62
|
+
sections?: readonly PageSection[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The page's text as HTML, everything below its heading.
|
|
66
|
+
*
|
|
67
|
+
* The heading itself is left to the caller, which already writes the one `h1`
|
|
68
|
+
* the page carries — `noscriptIndex` does.
|
|
69
|
+
* @param content - What the page says.
|
|
70
|
+
* @param indent - The indentation every line is written at.
|
|
71
|
+
* @default ' '
|
|
72
|
+
* @returns The HTML, opening with a newline, or `''` when the page says nothing
|
|
73
|
+
* below its heading.
|
|
74
|
+
*/
|
|
75
|
+
export declare function pageProseHtml(content: PageContent, indent?: string): string;
|
|
76
|
+
//# sourceMappingURL=pageProse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageProse.d.ts","sourceRoot":"","sources":["../../../src/seo/core/pageProse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,2EAA2E;AAC3E,MAAM,WAAW,SAAS;IACxB,mCAAmC;IACnC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,0DAA0D;IAC1D,IAAI,EAAE,aAAa,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IACvC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,qEAAqE;AACrE,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CACnC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAO,GAAG,MAAM,CAazE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text a page is indexed on, written into the HTML before anything runs.
|
|
3
|
+
*
|
|
4
|
+
* A prerendered site writes one file per address, and each of them carried the
|
|
5
|
+
* same body: the site's crawl path, and nothing else. A search engine clusters
|
|
6
|
+
* pages by the text it is handed, so a hundred and eighteen element pages
|
|
7
|
+
* differing only in their title are a hundred and seventeen duplicates — and
|
|
8
|
+
* which one it keeps is not ours to choose. A page heavy enough that the
|
|
9
|
+
* renderer never gets to it is indexed on that body alone.
|
|
10
|
+
*
|
|
11
|
+
* So what a site writes here is the text its running app already shows, drawn
|
|
12
|
+
* from the same data: the prose is not written twice, it is written where the
|
|
13
|
+
* build can reach it. Text only, and escaped — the addresses a reader follows
|
|
14
|
+
* are the crawl path's business.
|
|
15
|
+
*/
|
|
16
|
+
import { escapeText } from "../../share/core/escape.js";
|
|
17
|
+
/**
|
|
18
|
+
* The page's text as HTML, everything below its heading.
|
|
19
|
+
*
|
|
20
|
+
* The heading itself is left to the caller, which already writes the one `h1`
|
|
21
|
+
* the page carries — `noscriptIndex` does.
|
|
22
|
+
* @param content - What the page says.
|
|
23
|
+
* @param indent - The indentation every line is written at.
|
|
24
|
+
* @default ' '
|
|
25
|
+
* @returns The HTML, opening with a newline, or `''` when the page says nothing
|
|
26
|
+
* below its heading.
|
|
27
|
+
*/
|
|
28
|
+
export function pageProseHtml(content, indent = ' ') {
|
|
29
|
+
// The page's own heading is the caller's `h1`; what is left of its opening run
|
|
30
|
+
// is prose like any section's.
|
|
31
|
+
const opening = {
|
|
32
|
+
paragraphs: content.paragraphs,
|
|
33
|
+
list: content.list,
|
|
34
|
+
table: content.table,
|
|
35
|
+
};
|
|
36
|
+
const parts = [
|
|
37
|
+
sectionHtml(opening, indent),
|
|
38
|
+
...(content.sections ?? []).map((section) => sectionHtml(section, indent)),
|
|
39
|
+
];
|
|
40
|
+
return parts.join('');
|
|
41
|
+
}
|
|
42
|
+
function sectionHtml(section, indent) {
|
|
43
|
+
const lines = [];
|
|
44
|
+
if (section.heading !== undefined && section.heading.trim() !== '') {
|
|
45
|
+
lines.push(`${indent}<h2>${escapeText(section.heading)}</h2>`);
|
|
46
|
+
}
|
|
47
|
+
for (const paragraph of section.paragraphs ?? []) {
|
|
48
|
+
if (paragraph.trim() === '')
|
|
49
|
+
continue;
|
|
50
|
+
lines.push(`${indent}<p>${escapeText(paragraph)}</p>`);
|
|
51
|
+
}
|
|
52
|
+
const list = listHtml(section.list, indent);
|
|
53
|
+
if (list !== '')
|
|
54
|
+
lines.push(list);
|
|
55
|
+
const table = tableHtml(section.table, indent);
|
|
56
|
+
if (table !== '')
|
|
57
|
+
lines.push(table);
|
|
58
|
+
return lines.length === 0 ? '' : `\n${lines.join('\n')}`;
|
|
59
|
+
}
|
|
60
|
+
function listHtml(list, indent) {
|
|
61
|
+
// A list with no item is not a list: `<ul>` holds at least one `<li>`.
|
|
62
|
+
if (list === undefined || list.length === 0)
|
|
63
|
+
return '';
|
|
64
|
+
const items = list
|
|
65
|
+
.map((item) => `${indent} <li>${escapeText(item)}</li>`)
|
|
66
|
+
.join('\n');
|
|
67
|
+
return `${indent}<ul>\n${items}\n${indent}</ul>`;
|
|
68
|
+
}
|
|
69
|
+
function tableHtml(table, indent) {
|
|
70
|
+
// A table with no row says nothing, and an empty `<tbody>` is not markup a
|
|
71
|
+
// crawler is owed.
|
|
72
|
+
if (table === undefined || table.rows.length === 0)
|
|
73
|
+
return '';
|
|
74
|
+
const caption = table.caption === undefined || table.caption.trim() === ''
|
|
75
|
+
? ''
|
|
76
|
+
: `\n${indent} <caption>${escapeText(table.caption)}</caption>`;
|
|
77
|
+
const head = table.columns
|
|
78
|
+
.map((column) => `<th>${escapeText(column)}</th>`)
|
|
79
|
+
.join('');
|
|
80
|
+
const body = table.rows
|
|
81
|
+
.map((row) => `${indent} <tr>${row.map((cell) => `<td>${escapeText(cell)}</td>`).join('')}</tr>`)
|
|
82
|
+
.join('\n');
|
|
83
|
+
return `${indent}<table>${caption}
|
|
84
|
+
${indent} <thead>
|
|
85
|
+
${indent} <tr>${head}</tr>
|
|
86
|
+
${indent} </thead>
|
|
87
|
+
${indent} <tbody>
|
|
88
|
+
${body}
|
|
89
|
+
${indent} </tbody>
|
|
90
|
+
${indent}</table>`;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=pageProse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageProse.js","sourceRoot":"","sources":["../../../src/seo/core/pageProse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAqDxD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,OAAoB,EAAE,MAAM,GAAG,IAAI;IAC/D,+EAA+E;IAC/E,+BAA+B;IAC/B,MAAM,OAAO,GAAgB;QAC3B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;IACF,MAAM,KAAK,GAAG;QACZ,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;QAC5B,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KAC3E,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxB,CAAC;AAED,SAAS,WAAW,CAAC,OAAoB,EAAE,MAAc;IACvD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAA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,OAAO,GAAG,MAAM,SAAS,KAAK,KAAK,MAAM,OAAO,CAAC;AACnD,CAAC;AAED,SAAS,SAAS,CAAC,KAA4B,EAAE,MAAc;IAC7D,2EAA2E;IAC3E,mBAAmB;IACnB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9D,MAAM,OAAO,GACX,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE;QACxD,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,KAAK,MAAM,cAAc,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;IACrE,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO;SACvB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC;SACjD,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI;SACpB,GAAG,CACF,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CACxF;SACA,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,GAAG,MAAM,UAAU,OAAO;EACjC,MAAM;EACN,MAAM,WAAW,IAAI;EACrB,MAAM;EACN,MAAM;EACN,IAAI;EACJ,MAAM;EACN,MAAM,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What is wrong with the prose a site is indexed under.
|
|
3
|
+
*
|
|
4
|
+
* A route table is the only place a search result is written, and it is written
|
|
5
|
+
* once and read for years, so the limits that decide whether a result is
|
|
6
|
+
* readable are checked rather than trusted: a title Google cuts in half, a
|
|
7
|
+
* description too short to say anything or long enough to be clipped, two pages
|
|
8
|
+
* sharing a sentence — which is how a site asks to be deduplicated down to one
|
|
9
|
+
* result — and a snippet promising something the page does not carry.
|
|
10
|
+
*
|
|
11
|
+
* The paths are `assertRoutes`' business; this is about the words.
|
|
12
|
+
*/
|
|
13
|
+
import type { RouteMeta } from './routes.ts';
|
|
14
|
+
/**
|
|
15
|
+
* The phrase in a snippet that names something a site does not publish.
|
|
16
|
+
*
|
|
17
|
+
* Shared with the build-time checker, which reads the same sentences back out
|
|
18
|
+
* of the pages they were written into: one list of words, checked where they
|
|
19
|
+
* are authored and again where they landed.
|
|
20
|
+
* @param text - A title or a description.
|
|
21
|
+
* @returns The phrase, or `undefined` when there is none.
|
|
22
|
+
*/
|
|
23
|
+
export declare function withheldPhrase(text: string): string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Check the table a site is indexed under, before a build reads it.
|
|
26
|
+
*
|
|
27
|
+
* Returns the problems rather than throwing, so a site asserts an empty list in
|
|
28
|
+
* its own test and reads every one of them at once.
|
|
29
|
+
* @param routes - Every address the site answers.
|
|
30
|
+
* @returns One line per problem, empty when the table is fit to ship.
|
|
31
|
+
*/
|
|
32
|
+
export declare function routeProblems(routes: readonly RouteMeta[]): string[];
|
|
33
|
+
//# sourceMappingURL=routeProblems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeProblems.d.ts","sourceRoot":"","sources":["../../../src/seo/core/routeProblems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAiB7C;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,EAAE,CA2DpE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What is wrong with the prose a site is indexed under.
|
|
3
|
+
*
|
|
4
|
+
* A route table is the only place a search result is written, and it is written
|
|
5
|
+
* once and read for years, so the limits that decide whether a result is
|
|
6
|
+
* readable are checked rather than trusted: a title Google cuts in half, a
|
|
7
|
+
* description too short to say anything or long enough to be clipped, two pages
|
|
8
|
+
* sharing a sentence — which is how a site asks to be deduplicated down to one
|
|
9
|
+
* result — and a snippet promising something the page does not carry.
|
|
10
|
+
*
|
|
11
|
+
* The paths are `assertRoutes`' business; this is about the words.
|
|
12
|
+
*/
|
|
13
|
+
/** The longest title that survives a search result whole. */
|
|
14
|
+
const TITLE_LIMIT = 60;
|
|
15
|
+
/** The shortest description that says anything. */
|
|
16
|
+
const DESCRIPTION_MIN = 110;
|
|
17
|
+
/** The longest description a result shows without clipping it. */
|
|
18
|
+
const DESCRIPTION_MAX = 160;
|
|
19
|
+
/**
|
|
20
|
+
* What a site never says about itself, in the words it would say it in. A
|
|
21
|
+
* snippet naming a repository, a tracker or a licence is both a promise the
|
|
22
|
+
* page does not keep and a thing we do not publish.
|
|
23
|
+
*/
|
|
24
|
+
const WITHHELD = /\b(?:licence|license|licensing|open[ -]source|repositor(?:y|ies)|issue tracker|source code|report a (?:problem|bug|issue))\b/i;
|
|
25
|
+
/**
|
|
26
|
+
* The phrase in a snippet that names something a site does not publish.
|
|
27
|
+
*
|
|
28
|
+
* Shared with the build-time checker, which reads the same sentences back out
|
|
29
|
+
* of the pages they were written into: one list of words, checked where they
|
|
30
|
+
* are authored and again where they landed.
|
|
31
|
+
* @param text - A title or a description.
|
|
32
|
+
* @returns The phrase, or `undefined` when there is none.
|
|
33
|
+
*/
|
|
34
|
+
export function withheldPhrase(text) {
|
|
35
|
+
return WITHHELD.exec(text)?.[0];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check the table a site is indexed under, before a build reads it.
|
|
39
|
+
*
|
|
40
|
+
* Returns the problems rather than throwing, so a site asserts an empty list in
|
|
41
|
+
* its own test and reads every one of them at once.
|
|
42
|
+
* @param routes - Every address the site answers.
|
|
43
|
+
* @returns One line per problem, empty when the table is fit to ship.
|
|
44
|
+
*/
|
|
45
|
+
export function routeProblems(routes) {
|
|
46
|
+
const problems = [];
|
|
47
|
+
if (routes.length === 0) {
|
|
48
|
+
problems.push('the table is empty: a site answers at least one route.');
|
|
49
|
+
return problems;
|
|
50
|
+
}
|
|
51
|
+
const titles = new Map();
|
|
52
|
+
const descriptions = new Map();
|
|
53
|
+
for (const route of routes) {
|
|
54
|
+
const at = route.path;
|
|
55
|
+
if (route.title.trim() === '') {
|
|
56
|
+
problems.push(`${at}: the title is empty.`);
|
|
57
|
+
}
|
|
58
|
+
else if (route.title.length > TITLE_LIMIT) {
|
|
59
|
+
problems.push(`${at}: the title is ${route.title.length} characters, and the site name is appended to it — at most ${TITLE_LIMIT} survives a result whole.`);
|
|
60
|
+
}
|
|
61
|
+
const length = route.description.length;
|
|
62
|
+
if (length < DESCRIPTION_MIN) {
|
|
63
|
+
problems.push(`${at}: the description is ${length} characters — at least ${DESCRIPTION_MIN}, or the result says half of what the page is.`);
|
|
64
|
+
}
|
|
65
|
+
else if (length > DESCRIPTION_MAX) {
|
|
66
|
+
problems.push(`${at}: the description is ${length} characters — at most ${DESCRIPTION_MAX}, or the sentence is cut off in the result itself.`);
|
|
67
|
+
}
|
|
68
|
+
const titleFirst = titles.get(route.title);
|
|
69
|
+
if (titleFirst === undefined) {
|
|
70
|
+
titles.set(route.title, at);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
problems.push(`${at}: the title repeats the one at ${titleFirst}.`);
|
|
74
|
+
}
|
|
75
|
+
const descriptionFirst = descriptions.get(route.description);
|
|
76
|
+
if (descriptionFirst === undefined) {
|
|
77
|
+
descriptions.set(route.description, at);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
problems.push(`${at}: the description repeats the one at ${descriptionFirst}.`);
|
|
81
|
+
}
|
|
82
|
+
const withheld = withheldPhrase(route.title) ?? withheldPhrase(route.description);
|
|
83
|
+
if (withheld !== undefined) {
|
|
84
|
+
problems.push(`${at}: the snippet says "${withheld}" — a site names no repository, tracker or licence of ours.`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return problems;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=routeProblems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeProblems.js","sourceRoot":"","sources":["../../../src/seo/core/routeProblems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,6DAA6D;AAC7D,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,mDAAmD;AACnD,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,kEAAkE;AAClE,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;;;GAIG;AACH,MAAM,QAAQ,GACZ,+HAA+H,CAAC;AAElI;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,MAA4B;IACxD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;QACxE,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE/C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;QAEtB,IAAI,KAAK,CAAC,KAA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G,EAAE,wCAAwC,gBAAgB,GAAG,CACjE,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GACZ,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACnE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,QAAQ,CAAC,IAAI,CACX,GAAG,EAAE,uBAAuB,QAAQ,6DAA6D,CAClG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/lib/seo/core/routes.d.ts
CHANGED
|
@@ -27,6 +27,20 @@ export interface RouteMeta {
|
|
|
27
27
|
* @default undefined — the link stands on its own
|
|
28
28
|
*/
|
|
29
29
|
note?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether a search engine is meant to list the page.
|
|
32
|
+
*
|
|
33
|
+
* A maintenance screen — a curation queue, an import run, an admin table — is
|
|
34
|
+
* a real address a signed-in person opens, so it belongs in the table the
|
|
35
|
+
* router and the tab title read. It is not a result anybody wants: it says
|
|
36
|
+
* nothing a visitor searched for, and a chemist who lands on it has been sent
|
|
37
|
+
* to the wrong place. Such a route is left out of the sitemap and the page
|
|
38
|
+
* answers `noindex`, which is how a page is kept out of the index — never a
|
|
39
|
+
* `Disallow`, which only stops the crawl and still lets the address be listed
|
|
40
|
+
* from a link somewhere else.
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
indexed?: boolean;
|
|
30
44
|
/**
|
|
31
45
|
* Whether the route also answers every address beneath it, so a section
|
|
32
46
|
* carrying more pages than a table can hold — an entry per structure, per
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/seo/core/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,qDAAqD;AACrD,MAAM,WAAW,SAAS;IACxB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,6DA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;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,IAAI,EAAE,MAAM,GACX,SAAS,GAAG,SAAS,CAEvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,GAAG,EAAE,MAAM,EACX,QAAQ,SAAK,GACZ,SAAS,CAWX;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAIjE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,CAwB/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/seo/core/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,+EAA+E;AAC/E,gFAAgF;AAChF,qCAAqC;AACrC,MAAM,YAAY,GAAG,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/seo/core/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,+EAA+E;AAC/E,gFAAgF;AAChF,qCAAqC;AACrC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AA8C/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AAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IAC1B,gCAAgC;IAChC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"siteFiles.d.ts","sourceRoot":"","sources":["../../../src/seo/core/siteFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAKxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAO7C,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IAC1B,gCAAgC;IAChC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAiB5D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,CAEjE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAQ1D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAE7D"}
|
|
@@ -29,10 +29,11 @@ const HTTP_ORIGIN = /^https?:\/\//i;
|
|
|
29
29
|
*/
|
|
30
30
|
export function sitemapXml(options) {
|
|
31
31
|
const origin = originOf(options);
|
|
32
|
-
if (options.routes.
|
|
32
|
+
if (options.routes.every((route) => route.indexed === false)) {
|
|
33
33
|
throw new Error('a sitemap lists at least one address');
|
|
34
34
|
}
|
|
35
35
|
const entries = options.routes
|
|
36
|
+
.filter((route) => route.indexed !== false)
|
|
36
37
|
.map((route) => ` <url><loc>${escapeText(`${origin}${route.path}`)}</loc></url>`)
|
|
37
38
|
.join('\n');
|
|
38
39
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siteFiles.js","sourceRoot":"","sources":["../../../src/seo/core/siteFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIxD,+EAA+E;AAC/E,kFAAkF;AAClF,kEAAkE;AAClE,MAAM,WAAW,GAAG,eAAe,CAAC;AAiBpC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CAAC,OAAyB;IAClD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"siteFiles.js","sourceRoot":"","sources":["../../../src/seo/core/siteFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIxD,+EAA+E;AAC/E,kFAAkF;AAClF,kEAAkE;AAClE,MAAM,WAAW,GA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ACD,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAAyB;IACnD,OAAO,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import type { Plugin } from 'vite';
|
|
20
20
|
import type { SiteId, SiteRecord } from '../../ecosystem/core/sites.ts';
|
|
21
21
|
import type { NoscriptText } from '../core/noscript.ts';
|
|
22
|
+
import type { PageContent } from '../core/pageProse.ts';
|
|
22
23
|
import type { RobotsDisallow } from '../core/robots.ts';
|
|
23
24
|
import type { RouteMeta } from '../core/routes.ts';
|
|
24
25
|
/** What the build needs to know to write the site's addresses. */
|
|
@@ -77,6 +78,18 @@ export interface PrerenderOptions {
|
|
|
77
78
|
* @default true
|
|
78
79
|
*/
|
|
79
80
|
noscript?: boolean | NoscriptText;
|
|
81
|
+
/**
|
|
82
|
+
* What each page says for itself, above the crawl path: its own heading, its
|
|
83
|
+
* prose and the facts it would show anyway, read from the same data the app
|
|
84
|
+
* renders from.
|
|
85
|
+
*
|
|
86
|
+
* Without it every address ships the same body — the site's menu — and a
|
|
87
|
+
* search engine handed a hundred identical bodies keeps one of them. It is a
|
|
88
|
+
* function of the route rather than a field of it, so the prose stays out of
|
|
89
|
+
* the bundle the browser downloads: only the build ever calls it.
|
|
90
|
+
* @default undefined — every page carries the menu alone
|
|
91
|
+
*/
|
|
92
|
+
content?: (route: RouteMeta) => PageContent | undefined;
|
|
80
93
|
}
|
|
81
94
|
/**
|
|
82
95
|
* Prerender every routed address of a cheminfo site.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerender.d.ts","sourceRoot":"","sources":["../../../src/seo/vite/prerender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAE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AC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMnD,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IAC1B,qEAAqE;IACrE,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IAC7B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,aAAa,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC;IACxD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IAClC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,WAAW,GAAG,SAAS,CAAC;CACzD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CA4EnE"}
|
|
@@ -37,12 +37,12 @@ export function cheminfoPrerender(options) {
|
|
|
37
37
|
const { site, routes, origin, robots = [] } = options;
|
|
38
38
|
assertRoutes(routes);
|
|
39
39
|
const structuredData = structuredDataOf(options);
|
|
40
|
-
const crawlPath = crawlPathOf(options);
|
|
41
40
|
let out = 'dist';
|
|
42
41
|
let serve = false;
|
|
43
42
|
let logger = null;
|
|
44
|
-
const page = (template,
|
|
45
|
-
const head = fill(template, PAGE_HEAD_MARKER, `${pageHeadTags({ site, routes, origin, url })}${structuredData}`);
|
|
43
|
+
const page = (template, route) => {
|
|
44
|
+
const head = fill(template, PAGE_HEAD_MARKER, `${pageHeadTags({ site, routes, origin, url: route.path })}${structuredData}`);
|
|
45
|
+
const crawlPath = crawlPathOf(options, route);
|
|
46
46
|
return crawlPath === '' ? head : fill(head, PAGE_BODY_MARKER, crawlPath);
|
|
47
47
|
};
|
|
48
48
|
return {
|
|
@@ -56,22 +56,22 @@ export function cheminfoPrerender(options) {
|
|
|
56
56
|
// from the home route rather than shipped with its markers showing.
|
|
57
57
|
transformIndexHtml: {
|
|
58
58
|
order: 'post',
|
|
59
|
-
handler: (html) => serve ? page(html, homeRoute(routes)
|
|
59
|
+
handler: (html) => (serve ? page(html, homeRoute(routes)) : html),
|
|
60
60
|
},
|
|
61
61
|
closeBundle() {
|
|
62
62
|
if (serve)
|
|
63
63
|
return;
|
|
64
64
|
const template = readFileSync(join(out, 'index.html'), 'utf8');
|
|
65
|
-
const write = (
|
|
65
|
+
const write = (route, file) => {
|
|
66
66
|
mkdirSync(dirname(file), { recursive: true });
|
|
67
|
-
writeFileSync(file, page(template,
|
|
67
|
+
writeFileSync(file, page(template, route));
|
|
68
68
|
};
|
|
69
69
|
let root = false;
|
|
70
70
|
for (const route of routes) {
|
|
71
71
|
const address = trimTrailingSlash(route.path);
|
|
72
72
|
if (address === '/')
|
|
73
73
|
root = true;
|
|
74
|
-
write(route
|
|
74
|
+
write(route, address === '/'
|
|
75
75
|
? join(out, 'index.html')
|
|
76
76
|
: join(out, address.slice(1), 'index.html'));
|
|
77
77
|
}
|
|
@@ -79,7 +79,7 @@ export function cheminfoPrerender(options) {
|
|
|
79
79
|
// no root would otherwise leave the template vite built, and ship a site
|
|
80
80
|
// whose front page carries its markers instead of a head.
|
|
81
81
|
if (!root)
|
|
82
|
-
write(homeRoute(routes)
|
|
82
|
+
write(homeRoute(routes), join(out, 'index.html'));
|
|
83
83
|
writeFileSync(join(out, 'sitemap.xml'), sitemapXml({ site, routes, origin }));
|
|
84
84
|
if (robots !== false) {
|
|
85
85
|
writeFileSync(join(out, 'robots.txt'), robotsTxt({ site, routes, origin }, robots));
|
|
@@ -105,11 +105,18 @@ function structuredDataOf(options) {
|
|
|
105
105
|
currency,
|
|
106
106
|
})}`;
|
|
107
107
|
}
|
|
108
|
-
function crawlPathOf(options) {
|
|
108
|
+
function crawlPathOf(options, route) {
|
|
109
109
|
const { site, routes, origin, noscript = true } = options;
|
|
110
110
|
if (noscript === false)
|
|
111
111
|
return '';
|
|
112
|
+
const content = options.content?.(route);
|
|
112
113
|
const { routes: listed, ...prose } = noscript === true ? {} : noscript;
|
|
113
|
-
return noscriptIndex({
|
|
114
|
+
return noscriptIndex({
|
|
115
|
+
site,
|
|
116
|
+
origin,
|
|
117
|
+
...prose,
|
|
118
|
+
routes: listed ?? routes,
|
|
119
|
+
content,
|
|
120
|
+
});
|
|
114
121
|
}
|
|
115
122
|
//# sourceMappingURL=prerender.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerender.js","sourceRoot":"","sources":["../../../src/seo/vite/prerender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"prerender.js","sourceRoot":"","sources":["../../../src/seo/vite/prerender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAA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,MAAM;QACN,MAAM;QACN,QAAQ;QACR,eAAe;QACf,WAAW;QACX,mBAAmB;QACnB,QAAQ;KACT,CAAC,EAAE,CAAC;AACP,CAAC;AAED,SAAS,WAAW,CAAC,OAAyB,EAAE,KAAgB;IAC9D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAC1D,IAAI,QAAQ,KAAK,KAAK;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IACvE,OAAO,aAAa,CAAC;QACnB,IAAI;QACJ,MAAM;QACN,GAAG,KAAK;QACR,MAAM,EAAE,MAAM,IAAI,MAAM;QACxB,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cheminfo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React components, hooks and framework-free helpers shared by the cheminfo sites: site chrome, citations, sharing, routing, pedagogy, charts, and the structure, orbital and 3D molecule viewers",
|
|
6
6
|
"author": "Luc Patiny",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"bin": {
|
|
34
34
|
"cheminfo-check-deploy": "bin/check-deploy.mjs",
|
|
35
35
|
"cheminfo-check-messages": "bin/check-messages.mjs",
|
|
36
|
+
"cheminfo-check-seo": "bin/check-seo.mjs",
|
|
36
37
|
"cheminfo-check-tokens": "bin/check-tokens.mjs"
|
|
37
38
|
},
|
|
38
39
|
"files": [
|