@kensio/colophon 2.3.0 → 2.5.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 +107 -798
- package/dist/background/gradient.d.ts +12 -0
- package/dist/background/gradient.d.ts.map +1 -0
- package/dist/background/gradient.js +21 -0
- package/dist/background/gradient.js.map +1 -0
- package/dist/background/image.d.ts +14 -0
- package/dist/background/image.d.ts.map +1 -0
- package/dist/background/image.js +36 -0
- package/dist/background/image.js.map +1 -0
- package/dist/background/index.d.ts +13 -0
- package/dist/background/index.d.ts.map +1 -0
- package/dist/background/index.js +27 -0
- package/dist/background/index.js.map +1 -0
- package/dist/background/mesh.d.ts +12 -0
- package/dist/background/mesh.d.ts.map +1 -0
- package/dist/background/mesh.js +43 -0
- package/dist/background/mesh.js.map +1 -0
- package/dist/background.d.ts +7 -2
- package/dist/background.d.ts.map +1 -1
- package/dist/background.js +44 -1
- package/dist/background.js.map +1 -1
- package/dist/cli/args.d.ts +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/config.d.ts +1 -1
- package/dist/cli/config.js +1 -1
- package/dist/config/defaults.d.ts +8 -7
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +8 -8
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +14 -5
- package/dist/config/index.js.map +1 -1
- package/dist/config/resolve.d.ts +7 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +16 -0
- package/dist/config/resolve.js.map +1 -1
- package/dist/config/size.d.ts +7 -1
- package/dist/config/size.d.ts.map +1 -1
- package/dist/config/size.js +22 -9
- package/dist/config/size.js.map +1 -1
- package/dist/content/props.d.ts +2 -2
- package/dist/content/props.js +2 -2
- package/dist/content/slug.d.ts +5 -5
- package/dist/content/slug.js +6 -6
- package/dist/content/slug.js.map +1 -1
- package/dist/content/walk.d.ts +1 -1
- package/dist/content/walk.js +1 -1
- package/dist/fonts/index.d.ts +3 -2
- package/dist/fonts/index.d.ts.map +1 -1
- package/dist/fonts/index.js +3 -2
- package/dist/fonts/index.js.map +1 -1
- package/dist/fonts/resolve.js +1 -1
- package/dist/generate/extra.js +4 -4
- package/dist/generate/extra.js.map +1 -1
- package/dist/generate/options.d.ts +1 -1
- package/dist/generate/outputs.d.ts +4 -4
- package/dist/generate/outputs.js +4 -4
- package/dist/highlight/language.d.ts +2 -3
- package/dist/highlight/language.d.ts.map +1 -1
- package/dist/highlight/language.js +3 -4
- package/dist/highlight/language.js.map +1 -1
- package/dist/highlight/normalise.d.ts +2 -2
- package/dist/highlight/normalise.js +2 -2
- package/dist/image/index.d.ts +18 -0
- package/dist/image/index.d.ts.map +1 -0
- package/dist/image/index.js +42 -0
- package/dist/image/index.js.map +1 -0
- package/dist/image/jpeg.d.ts +10 -0
- package/dist/image/jpeg.d.ts.map +1 -0
- package/dist/image/jpeg.js +57 -0
- package/dist/image/jpeg.js.map +1 -0
- package/dist/image/load.d.ts +4 -0
- package/dist/image/load.d.ts.map +1 -0
- package/dist/image/load.js +60 -0
- package/dist/image/load.js.map +1 -0
- package/dist/image/media.d.ts +10 -0
- package/dist/image/media.d.ts.map +1 -0
- package/dist/image/media.js +37 -0
- package/dist/image/media.js.map +1 -0
- package/dist/image/resolve.d.ts +13 -0
- package/dist/image/resolve.d.ts.map +1 -0
- package/dist/image/resolve.js +38 -0
- package/dist/image/resolve.js.map +1 -0
- package/dist/image/size.d.ts +22 -0
- package/dist/image/size.d.ts.map +1 -0
- package/dist/image/size.js +60 -0
- package/dist/image/size.js.map +1 -0
- package/dist/image/svg.d.ts +12 -0
- package/dist/image/svg.d.ts.map +1 -0
- package/dist/image/svg.js +61 -0
- package/dist/image/svg.js.map +1 -0
- package/dist/image/uri.d.ts +9 -0
- package/dist/image/uri.d.ts.map +1 -0
- package/dist/image/uri.js +22 -0
- package/dist/image/uri.js.map +1 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/layout/block.d.ts +37 -0
- package/dist/layout/block.d.ts.map +1 -0
- package/dist/layout/block.js +26 -0
- package/dist/layout/block.js.map +1 -0
- package/dist/layout/box.d.ts +20 -0
- package/dist/layout/box.d.ts.map +1 -0
- package/dist/layout/box.js +61 -0
- package/dist/layout/box.js.map +1 -0
- package/dist/layout/distribute.d.ts +15 -0
- package/dist/layout/distribute.d.ts.map +1 -0
- package/dist/layout/distribute.js +30 -0
- package/dist/layout/distribute.js.map +1 -0
- package/dist/layout/image.d.ts +42 -0
- package/dist/layout/image.d.ts.map +1 -0
- package/dist/layout/image.js +34 -0
- package/dist/layout/image.js.map +1 -0
- package/dist/layout/index.d.ts +40 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +30 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/lines.d.ts +45 -0
- package/dist/layout/lines.d.ts.map +1 -0
- package/dist/layout/lines.js +71 -0
- package/dist/layout/lines.js.map +1 -0
- package/dist/layout/measure.d.ts +11 -0
- package/dist/layout/measure.d.ts.map +1 -0
- package/dist/layout/measure.js +11 -0
- package/dist/layout/measure.js.map +1 -0
- package/dist/layout/panel.d.ts +20 -0
- package/dist/layout/panel.d.ts.map +1 -0
- package/dist/layout/panel.js +22 -0
- package/dist/layout/panel.js.map +1 -0
- package/dist/layout/row.d.ts +15 -0
- package/dist/layout/row.d.ts.map +1 -0
- package/dist/layout/row.js +20 -0
- package/dist/layout/row.js.map +1 -0
- package/dist/layout/scrim.d.ts +23 -0
- package/dist/layout/scrim.d.ts.map +1 -0
- package/dist/layout/scrim.js +38 -0
- package/dist/layout/scrim.js.map +1 -0
- package/dist/layout/stack.d.ts +14 -0
- package/dist/layout/stack.d.ts.map +1 -0
- package/dist/layout/stack.js +19 -0
- package/dist/layout/stack.js.map +1 -0
- package/dist/layout/types.d.ts +49 -0
- package/dist/layout/types.d.ts.map +1 -0
- package/dist/layout/types.js +2 -0
- package/dist/layout/types.js.map +1 -0
- package/dist/manifest/build.d.ts +1 -1
- package/dist/manifest/build.js +1 -1
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.js +1 -1
- package/dist/manifest/order.d.ts +1 -1
- package/dist/manifest/order.js +1 -1
- package/dist/manifest/page.d.ts +2 -2
- package/dist/manifest/page.js +3 -3
- package/dist/measure/estimate.d.ts +10 -0
- package/dist/measure/estimate.d.ts.map +1 -0
- package/dist/measure/estimate.js +58 -0
- package/dist/measure/estimate.js.map +1 -0
- package/dist/measure/faces.d.ts +15 -0
- package/dist/measure/faces.d.ts.map +1 -0
- package/dist/measure/faces.js +70 -0
- package/dist/measure/faces.js.map +1 -0
- package/dist/measure/index.d.ts +16 -0
- package/dist/measure/index.d.ts.map +1 -0
- package/dist/measure/index.js +0 -0
- package/dist/measure/index.js.map +1 -0
- package/dist/measure/runs.d.ts +17 -0
- package/dist/measure/runs.d.ts.map +1 -0
- package/dist/measure/runs.js +39 -0
- package/dist/measure/runs.js.map +1 -0
- package/dist/measure/select.d.ts +13 -0
- package/dist/measure/select.d.ts.map +1 -0
- package/dist/measure/select.js +47 -0
- package/dist/measure/select.js.map +1 -0
- package/dist/meta/tags.d.ts +6 -6
- package/dist/meta/tags.js +6 -6
- package/dist/meta/url.d.ts +4 -4
- package/dist/meta/url.js +4 -4
- package/dist/placement/check.d.ts +1 -1
- package/dist/placement/check.js +1 -1
- package/dist/placement/index.js +1 -1
- package/dist/placement/relative.d.ts +3 -3
- package/dist/placement/relative.js +3 -3
- package/dist/pool.d.ts +2 -2
- package/dist/pool.js +3 -3
- package/dist/pool.js.map +1 -1
- package/dist/props.d.ts +7 -0
- package/dist/props.d.ts.map +1 -0
- package/dist/props.js +17 -0
- package/dist/props.js.map +1 -0
- package/dist/render/svg.d.ts +4 -2
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render/svg.js +28 -6
- package/dist/render/svg.js.map +1 -1
- package/dist/stamp/config-digest.d.ts.map +1 -1
- package/dist/stamp/config-digest.js +21 -1
- package/dist/stamp/config-digest.js.map +1 -1
- package/dist/stamp/index.js +2 -2
- package/dist/stamp/index.js.map +1 -1
- package/dist/stamp/read.d.ts +1 -1
- package/dist/stamp/read.js +4 -4
- package/dist/templates/attribution.d.ts +17 -0
- package/dist/templates/attribution.d.ts.map +1 -0
- package/dist/templates/attribution.js +39 -0
- package/dist/templates/attribution.js.map +1 -0
- package/dist/templates/banner/badge-props.d.ts +16 -0
- package/dist/templates/banner/badge-props.d.ts.map +1 -0
- package/dist/templates/banner/badge-props.js +58 -0
- package/dist/templates/banner/badge-props.js.map +1 -0
- package/dist/templates/banner/badge.d.ts.map +1 -1
- package/dist/templates/banner/badge.js +3 -6
- package/dist/templates/banner/badge.js.map +1 -1
- package/dist/templates/banner/index.d.ts +3 -0
- package/dist/templates/banner/index.d.ts.map +1 -1
- package/dist/templates/banner/index.js +41 -37
- package/dist/templates/banner/index.js.map +1 -1
- package/dist/templates/banner/lines.d.ts +7 -12
- package/dist/templates/banner/lines.d.ts.map +1 -1
- package/dist/templates/banner/lines.js +23 -34
- package/dist/templates/banner/lines.js.map +1 -1
- package/dist/templates/banner/version.d.ts +9 -0
- package/dist/templates/banner/version.d.ts.map +1 -0
- package/dist/templates/banner/version.js +21 -0
- package/dist/templates/banner/version.js.map +1 -0
- package/dist/templates/card/index.d.ts +4 -1
- package/dist/templates/card/index.d.ts.map +1 -1
- package/dist/templates/card/index.js +37 -25
- package/dist/templates/card/index.js.map +1 -1
- package/dist/templates/card/lines.d.ts +17 -13
- package/dist/templates/card/lines.d.ts.map +1 -1
- package/dist/templates/card/lines.js +24 -20
- package/dist/templates/card/lines.js.map +1 -1
- package/dist/templates/code/chrome.d.ts +7 -3
- package/dist/templates/code/chrome.d.ts.map +1 -1
- package/dist/templates/code/chrome.js +12 -11
- package/dist/templates/code/chrome.js.map +1 -1
- package/dist/templates/code/clip.d.ts +1 -1
- package/dist/templates/code/clip.js +1 -1
- package/dist/templates/code/fit.d.ts +2 -2
- package/dist/templates/code/fit.d.ts.map +1 -1
- package/dist/templates/code/fit.js +4 -4
- package/dist/templates/code/fit.js.map +1 -1
- package/dist/templates/code/index.d.ts.map +1 -1
- package/dist/templates/code/index.js +7 -6
- package/dist/templates/code/index.js.map +1 -1
- package/dist/templates/code/layout.d.ts +1 -1
- package/dist/templates/code/layout.d.ts.map +1 -1
- package/dist/templates/code/layout.js +6 -6
- package/dist/templates/code/layout.js.map +1 -1
- package/dist/templates/code/panel.d.ts +13 -0
- package/dist/templates/code/panel.d.ts.map +1 -1
- package/dist/templates/code/panel.js +34 -2
- package/dist/templates/code/panel.js.map +1 -1
- package/dist/templates/code/plate.d.ts +3 -1
- package/dist/templates/code/plate.d.ts.map +1 -1
- package/dist/templates/code/plate.js +11 -9
- package/dist/templates/code/plate.js.map +1 -1
- package/dist/templates/code/spans.js +1 -1
- package/dist/templates/code/spans.js.map +1 -1
- package/dist/templates/code/width.d.ts +10 -0
- package/dist/templates/code/width.d.ts.map +1 -0
- package/dist/templates/code/width.js +26 -0
- package/dist/templates/code/width.js.map +1 -0
- package/dist/templates/footer.d.ts +8 -0
- package/dist/templates/footer.d.ts.map +1 -1
- package/dist/templates/footer.js +11 -1
- package/dist/templates/footer.js.map +1 -1
- package/dist/templates/index.d.ts +1 -1
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/logo.d.ts +15 -0
- package/dist/templates/logo.d.ts.map +1 -0
- package/dist/templates/logo.js +30 -0
- package/dist/templates/logo.js.map +1 -0
- package/dist/templates/measure.d.ts +11 -0
- package/dist/templates/measure.d.ts.map +1 -0
- package/dist/templates/measure.js +11 -0
- package/dist/templates/measure.js.map +1 -0
- package/dist/templates/props.d.ts +2 -2
- package/dist/templates/props.js +2 -2
- package/dist/templates/text.d.ts +37 -0
- package/dist/templates/text.d.ts.map +1 -0
- package/dist/templates/text.js +26 -0
- package/dist/templates/text.js.map +1 -0
- package/dist/text/break.d.ts +11 -0
- package/dist/text/break.d.ts.map +1 -0
- package/dist/text/break.js +30 -0
- package/dist/text/break.js.map +1 -0
- package/dist/text/fit.d.ts +30 -0
- package/dist/text/fit.d.ts.map +1 -0
- package/dist/text/fit.js +29 -0
- package/dist/text/fit.js.map +1 -0
- package/dist/text/index.d.ts +5 -3
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +3 -2
- package/dist/text/index.js.map +1 -1
- package/dist/text/wrap.d.ts +17 -7
- package/dist/text/wrap.d.ts.map +1 -1
- package/dist/text/wrap.js +25 -17
- package/dist/text/wrap.js.map +1 -1
- package/dist/texture/grain.d.ts +17 -0
- package/dist/texture/grain.d.ts.map +1 -0
- package/dist/texture/grain.js +29 -0
- package/dist/texture/grain.js.map +1 -0
- package/dist/texture/index.d.ts +11 -0
- package/dist/texture/index.d.ts.map +1 -0
- package/dist/texture/index.js +20 -0
- package/dist/texture/index.js.map +1 -0
- package/dist/texture/pattern.d.ts +17 -0
- package/dist/texture/pattern.d.ts.map +1 -0
- package/dist/texture/pattern.js +45 -0
- package/dist/texture/pattern.js.map +1 -0
- package/dist/texture/resolve.d.ts +16 -0
- package/dist/texture/resolve.d.ts.map +1 -0
- package/dist/texture/resolve.js +20 -0
- package/dist/texture/resolve.js.map +1 -0
- package/dist/theme/index.d.ts +27 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +41 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/presets.d.ts +38 -0
- package/dist/theme/presets.d.ts.map +1 -0
- package/dist/theme/presets.js +150 -0
- package/dist/theme/presets.js.map +1 -0
- package/dist/types.d.ts +281 -46
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/background.d.ts +12 -0
- package/dist/validate/background.d.ts.map +1 -0
- package/dist/validate/background.js +53 -0
- package/dist/validate/background.js.map +1 -0
- package/dist/validate/collect.d.ts +9 -0
- package/dist/validate/collect.d.ts.map +1 -0
- package/dist/validate/collect.js +34 -0
- package/dist/validate/collect.js.map +1 -0
- package/dist/validate/index.d.ts +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +3 -20
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/keys.d.ts +35 -2
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +92 -3
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/overrides.d.ts.map +1 -1
- package/dist/validate/overrides.js +5 -1
- package/dist/validate/overrides.js.map +1 -1
- package/dist/validate/suggest.d.ts.map +1 -1
- package/dist/validate/suggest.js +21 -3
- package/dist/validate/suggest.js.map +1 -1
- package/dist/validate/texture.d.ts +11 -0
- package/dist/validate/texture.d.ts.map +1 -0
- package/dist/validate/texture.js +34 -0
- package/dist/validate/texture.js.map +1 -0
- package/dist/validate/values.d.ts +10 -10
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +21 -31
- package/dist/validate/values.js.map +1 -1
- package/package.json +7 -1
package/dist/config/size.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import { themePalette } from "../theme/index.js";
|
|
1
2
|
import { DEFAULT_COLORS } from "./defaults.js";
|
|
2
3
|
import { resolveConfig } from "./index.js";
|
|
3
4
|
/**
|
|
4
5
|
* Merge a size's colour overrides onto the config's.
|
|
5
6
|
*
|
|
6
|
-
* A size may name any single shade, so the merge starts from
|
|
7
|
-
*
|
|
8
|
-
* instead would hand `resolveColors` a lone `foreground`, and its
|
|
9
|
-
* bare `brand` colours the whole gradient would then flatten the
|
|
10
|
-
* gradient
|
|
7
|
+
* A size may name any single shade, so the merge starts from a full palette:
|
|
8
|
+
* the config's, else the theme in force, else the neutral default. Starting
|
|
9
|
+
* from nothing instead would hand `resolveColors` a lone `foreground`, and its
|
|
10
|
+
* rule that a bare `brand` colours the whole gradient would then flatten the
|
|
11
|
+
* default gradient, so a size asking only for darker text would silently lose
|
|
12
|
+
* it. Taking the theme's palette matters for the same reason: without it a
|
|
13
|
+
* size changing one shade of a themed config would drop the other three back
|
|
14
|
+
* to the default indigo.
|
|
11
15
|
*/
|
|
12
|
-
function mergeColors(base, overrides) {
|
|
13
|
-
return { ...(base ?? DEFAULT_COLORS), ...overrides };
|
|
16
|
+
function mergeColors(base, theme, overrides) {
|
|
17
|
+
return { ...(base ?? themePalette(theme) ?? DEFAULT_COLORS), ...overrides };
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
20
|
* Apply a size's own overrides to a config and resolve the result: the config
|
|
@@ -18,7 +22,7 @@ function mergeColors(base, overrides) {
|
|
|
18
22
|
*
|
|
19
23
|
* The overrides are folded into the user config and the whole thing resolved
|
|
20
24
|
* again, rather than patched onto an already-resolved config, so that anything
|
|
21
|
-
* derived stays consistent
|
|
25
|
+
* derived stays consistent. A size that overrides `colors.brand` gets the
|
|
22
26
|
* default gradient rebuilt around its brand, exactly as a config setting the
|
|
23
27
|
* same colour at the top level would.
|
|
24
28
|
*
|
|
@@ -28,19 +32,28 @@ function mergeColors(base, overrides) {
|
|
|
28
32
|
* different keys, so half of one over half of another is not a background at
|
|
29
33
|
* all, and `badge` carries a required `text` that a partial override could not
|
|
30
34
|
* supply.
|
|
35
|
+
*
|
|
36
|
+
* A size's `theme` replaces the config's, and then applies exactly as it would
|
|
37
|
+
* at the top level: as defaults, under anything the config names outright. So
|
|
38
|
+
* a config with its own `background` keeps it whatever theme a size asks for,
|
|
39
|
+
* and a size wanting the whole look of one has the same answer a config does,
|
|
40
|
+
* which is to stop naming the fields it wants the theme to fill in.
|
|
31
41
|
*/
|
|
32
42
|
export function resolveConfigForSize(config, size) {
|
|
33
43
|
const base = config ?? {};
|
|
34
44
|
return resolveConfig({
|
|
35
45
|
...base,
|
|
46
|
+
...(size.theme !== undefined && { theme: size.theme }),
|
|
36
47
|
...(size.colors !== undefined && {
|
|
37
|
-
colors: mergeColors(base.colors, size.colors),
|
|
48
|
+
colors: mergeColors(base.colors, size.theme ?? base.theme, size.colors),
|
|
38
49
|
}),
|
|
50
|
+
...(size.texture !== undefined && { texture: size.texture }),
|
|
39
51
|
...(size.code !== undefined && { code: { ...base.code, ...size.code } }),
|
|
40
52
|
...(size.background !== undefined && { background: size.background }),
|
|
41
53
|
...(size.fontFamily !== undefined && { fontFamily: size.fontFamily }),
|
|
42
54
|
...(size.footer !== undefined && { footer: size.footer }),
|
|
43
55
|
...(size.badge !== undefined && { badge: size.badge }),
|
|
56
|
+
...(size.logo !== undefined && { logo: size.logo }),
|
|
44
57
|
});
|
|
45
58
|
}
|
|
46
59
|
//# sourceMappingURL=size.js.map
|
package/dist/config/size.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"size.js","sourceRoot":"","sources":["../../src/config/size.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"size.js","sourceRoot":"","sources":["../../src/config/size.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,SAAS,WAAW,CAClB,IAA6B,EAC7B,KAA4B,EAC5B,SAA+B;IAE/B,OAAO,EAAE,GAAG,CAAC,IAAI,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC;AAC9E,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAkC,EAClC,IAAgB;IAEhB,MAAM,IAAI,GAAG,MAAM,IAAI,EAAE,CAAC;IAE1B,OAAO,aAAa,CAAC;QACnB,GAAG,IAAI;QACP,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI;YAC/B,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;SACxE,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACxE,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QACzD,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;KACpD,CAAC,CAAC;AACL,CAAC"}
|
package/dist/content/props.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ export declare function coerceString(value: unknown): string | undefined;
|
|
|
4
4
|
/**
|
|
5
5
|
* Extract {@link MetaImageProps} from a parsed frontmatter object, or return
|
|
6
6
|
* `undefined` if this file should be skipped (nothing to build props from, or
|
|
7
|
-
* no usable template). Pure
|
|
7
|
+
* no usable template). Pure, with no filesystem access.
|
|
8
8
|
*
|
|
9
9
|
* Props can come from two places: the post's own props object, and a project's
|
|
10
10
|
* `props` mapper reading the frontmatter it already has. Where both speak the
|
|
11
|
-
* post wins, field by field
|
|
11
|
+
* post wins, field by field. The mapper describes the site's usual shape, and
|
|
12
12
|
* a post that says otherwise is saying so on purpose.
|
|
13
13
|
*/
|
|
14
14
|
export declare function extractProps(frontmatter: Record<string, unknown>, options?: Pick<ContentOptions, "propsKey" | "templateField" | "defaultTemplate" | "props">): MetaImageProps | undefined;
|
package/dist/content/props.js
CHANGED
|
@@ -20,11 +20,11 @@ const namedFields = new Set(["template", "title", "subtitle", "version"]);
|
|
|
20
20
|
/**
|
|
21
21
|
* Extract {@link MetaImageProps} from a parsed frontmatter object, or return
|
|
22
22
|
* `undefined` if this file should be skipped (nothing to build props from, or
|
|
23
|
-
* no usable template). Pure
|
|
23
|
+
* no usable template). Pure, with no filesystem access.
|
|
24
24
|
*
|
|
25
25
|
* Props can come from two places: the post's own props object, and a project's
|
|
26
26
|
* `props` mapper reading the frontmatter it already has. Where both speak the
|
|
27
|
-
* post wins, field by field
|
|
27
|
+
* post wins, field by field. The mapper describes the site's usual shape, and
|
|
28
28
|
* a post that says otherwise is saying so on purpose.
|
|
29
29
|
*/
|
|
30
30
|
export function extractProps(frontmatter, options = {}) {
|
package/dist/content/slug.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import type { SlugStrategy } from "../types.js";
|
|
|
3
3
|
* Derive a slug from a content file's path, relative to the root of the walk.
|
|
4
4
|
*
|
|
5
5
|
* `basename` gives the filename without extension, or the parent directory for
|
|
6
|
-
* `index
|
|
7
|
-
* `route` keeps the directories, so a site addressed by route gets a slug
|
|
8
|
-
* matches the address rather than just its last segment.
|
|
6
|
+
* `index.*`, which is the page-bundle convention where an image sits beside its
|
|
7
|
+
* post. `route` keeps the directories, so a site addressed by route gets a slug
|
|
8
|
+
* that matches the address rather than just its last segment.
|
|
9
9
|
*
|
|
10
10
|
* The path must be relative to the content root for `route` to mean anything;
|
|
11
11
|
* `basename` reads the same either way.
|
|
@@ -14,8 +14,8 @@ export declare function slugFromPath(contentPath: string, strategy?: SlugStrateg
|
|
|
14
14
|
/**
|
|
15
15
|
* Reject a slug that would name a file outside the tree it came from.
|
|
16
16
|
*
|
|
17
|
-
* A slug is a filename, and may carry directories under the `route` strategy
|
|
18
|
-
*
|
|
17
|
+
* A slug is a filename, and may carry directories under the `route` strategy.
|
|
18
|
+
* But a declared one is written by hand, and `slug: ../../../tmp/x` would have
|
|
19
19
|
* `generate` create directories and write an image there. Nothing derived from
|
|
20
20
|
* a path can look like this, so the check only ever fires on frontmatter.
|
|
21
21
|
*/
|
package/dist/content/slug.js
CHANGED
|
@@ -3,9 +3,9 @@ import path from "node:path";
|
|
|
3
3
|
* Derive a slug from a content file's path, relative to the root of the walk.
|
|
4
4
|
*
|
|
5
5
|
* `basename` gives the filename without extension, or the parent directory for
|
|
6
|
-
* `index
|
|
7
|
-
* `route` keeps the directories, so a site addressed by route gets a slug
|
|
8
|
-
* matches the address rather than just its last segment.
|
|
6
|
+
* `index.*`, which is the page-bundle convention where an image sits beside its
|
|
7
|
+
* post. `route` keeps the directories, so a site addressed by route gets a slug
|
|
8
|
+
* that matches the address rather than just its last segment.
|
|
9
9
|
*
|
|
10
10
|
* The path must be relative to the content root for `route` to mean anything;
|
|
11
11
|
* `basename` reads the same either way.
|
|
@@ -25,15 +25,15 @@ export function slugFromPath(contentPath, strategy = "basename") {
|
|
|
25
25
|
}
|
|
26
26
|
const route = base === "index" ? directory : path.join(directory, base);
|
|
27
27
|
// `path.dirname` of a root-level file is ".", which as a route is the site
|
|
28
|
-
// root
|
|
28
|
+
// root, and the one place there is no directory name to fall back on.
|
|
29
29
|
const normalised = route === "." ? "index" : route.split(path.sep).join("/");
|
|
30
30
|
return normalised;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Reject a slug that would name a file outside the tree it came from.
|
|
34
34
|
*
|
|
35
|
-
* A slug is a filename, and may carry directories under the `route` strategy
|
|
36
|
-
*
|
|
35
|
+
* A slug is a filename, and may carry directories under the `route` strategy.
|
|
36
|
+
* But a declared one is written by hand, and `slug: ../../../tmp/x` would have
|
|
37
37
|
* `generate` create directories and write an image there. Nothing derived from
|
|
38
38
|
* a path can look like this, so the check only ever fires on frontmatter.
|
|
39
39
|
*/
|
package/dist/content/slug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../src/content/slug.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAC1B,WAAmB,EACnB,QAAQ,GAAiB,UAAU;IAEnC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE5C,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC5B,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,0EAA0E;QAC1E,0EAA0E;QAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACxC,OAAO,MAAM,KAAK,EAAE,IAAI,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;IACzD,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACxE,2EAA2E;IAC3E,
|
|
1
|
+
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../src/content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,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IACzC,MAAM,UAAU,GACd,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3D,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE1B,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,iBAAiB,IAAI,QAAQ,WAAW,gCAAgC;YACtE,mEAAmE;YACnE,YAAY,CACf,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/content/walk.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface WalkOptions extends ContentOptions {
|
|
|
10
10
|
/**
|
|
11
11
|
* Walk a content tree, read each file's frontmatter with `gray-matter`, and
|
|
12
12
|
* return the files that image props can be built for. This is the host-project
|
|
13
|
-
* concern
|
|
13
|
+
* concern of finding content and reading frontmatter, kept separate from
|
|
14
14
|
* rendering.
|
|
15
15
|
*/
|
|
16
16
|
export declare function walkContent(options: WalkOptions): Promise<ContentFile[]>;
|
package/dist/content/walk.js
CHANGED
|
@@ -24,7 +24,7 @@ async function collectContentFiles(dir, extensions) {
|
|
|
24
24
|
/**
|
|
25
25
|
* Walk a content tree, read each file's frontmatter with `gray-matter`, and
|
|
26
26
|
* return the files that image props can be built for. This is the host-project
|
|
27
|
-
* concern
|
|
27
|
+
* concern of finding content and reading frontmatter, kept separate from
|
|
28
28
|
* rendering.
|
|
29
29
|
*/
|
|
30
30
|
export async function walkContent(options) {
|
package/dist/fonts/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ export { fontFilePaths } from "./materialise.js";
|
|
|
3
3
|
export { resolveFonts } from "./resolve.js";
|
|
4
4
|
/**
|
|
5
5
|
* The family the rasteriser should fall back to when a `font-family` names
|
|
6
|
-
* something it has not loaded
|
|
7
|
-
* the same wherever the build runs rather than whichever font
|
|
6
|
+
* something it has not loaded. It is the first declared family, so the
|
|
7
|
+
* fallback is the same wherever the build runs rather than whichever font
|
|
8
|
+
* loaded first.
|
|
8
9
|
*/
|
|
9
10
|
export declare function fallbackFamily(fonts: readonly FontSource[]): string | undefined;
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,MAAM,GAAG,SAAS,CAEpB"}
|
package/dist/fonts/index.js
CHANGED
|
@@ -2,8 +2,9 @@ export { fontFilePaths } from "./materialise.js";
|
|
|
2
2
|
export { resolveFonts } from "./resolve.js";
|
|
3
3
|
/**
|
|
4
4
|
* The family the rasteriser should fall back to when a `font-family` names
|
|
5
|
-
* something it has not loaded
|
|
6
|
-
* the same wherever the build runs rather than whichever font
|
|
5
|
+
* something it has not loaded. It is the first declared family, so the
|
|
6
|
+
* fallback is the same wherever the build runs rather than whichever font
|
|
7
|
+
* loaded first.
|
|
7
8
|
*/
|
|
8
9
|
export function fallbackFamily(fonts) {
|
|
9
10
|
return fonts.find((font) => font.family !== undefined)?.family;
|
package/dist/fonts/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA4B;IAE5B,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,EAAE,MAAM,CAAC;AACjE,CAAC"}
|
package/dist/fonts/resolve.js
CHANGED
|
@@ -7,7 +7,7 @@ function label(index) {
|
|
|
7
7
|
* Validate one font source and make its path absolute.
|
|
8
8
|
*
|
|
9
9
|
* The rasteriser ignores a font file it cannot read and renders the text in
|
|
10
|
-
* whatever else it has loaded
|
|
10
|
+
* whatever else it has loaded, or, with system fonts off, renders no text at
|
|
11
11
|
* all. A typo in a path would therefore show up as a blank image rather than
|
|
12
12
|
* an error, so the path is checked here instead.
|
|
13
13
|
*/
|
package/dist/generate/extra.js
CHANGED
|
@@ -8,7 +8,7 @@ import { isRecord } from "../validate/check.js";
|
|
|
8
8
|
* JavaScript with nothing checking it, and neither omission fails anywhere
|
|
9
9
|
* near the config: a missing `output` surfaces as a complaint about an
|
|
10
10
|
* argument to `path`, and missing props as a property read on `undefined`.
|
|
11
|
-
* Key validation is no help either
|
|
11
|
+
* Key validation is no help either, since it is the option that is not there.
|
|
12
12
|
*/
|
|
13
13
|
function checkImage(image, index) {
|
|
14
14
|
// The types say what should be here; this exists for when it is not.
|
|
@@ -48,9 +48,9 @@ export function extraJobs(config, resolved, stamper) {
|
|
|
48
48
|
// relative path against the working directory anyway, and the build log
|
|
49
49
|
// reads better saying what the config said.
|
|
50
50
|
outputPath: image.output,
|
|
51
|
-
// An extra names its own path,
|
|
52
|
-
//
|
|
53
|
-
//
|
|
51
|
+
// An extra names its own path, and the placement maps posts to paths, so
|
|
52
|
+
// it has nothing to say about where this one is served, nor about hashing
|
|
53
|
+
// a filename it did not choose.
|
|
54
54
|
url: undefined,
|
|
55
55
|
stamp: stamper.stamp(image.props, size),
|
|
56
56
|
config: resolveConfigForSize(config, size),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extra.js","sourceRoot":"","sources":["../../src/generate/extra.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD;;;;;;;;GAQG;AACH,SAAS,UAAU,CAAC,KAAiB,EAAE,KAAa;IAClD,qEAAqE;IACrE,MAAM,QAAQ,GAAG,KAGhB,CAAC;IACF,MAAM,KAAK,GAAG,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;IAExC,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,gDAAgD,CAAC,CAAC;IAC5E,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,+CAA+C,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CACvB,MAAkC,EAClC,QAAwB,EACxB,OAAgB;IAEhB,2EAA2E;IAC3E,MAAM,CAAC,SAAS,GAAG,YAA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;;;;GAUG;AACH,MAAM,UAAU,SAAS,CACvB,MAAkC,EAClC,QAAwB,EACxB,OAAgB;IAEhB,2EAA2E;IAC3E,MAAM,CAAC,SAAS,GAAG,YAAY,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IAErD,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAChD,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,SAAS,CAAC;QAErC,OAAO;YACL,WAAW,EAAE,SAAS;YACtB,wDAAwD;YACxD,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI;YACJ,wEAAwE;YACxE,wEAAwE;YACxE,4CAA4C;YAC5C,UAAU,EAAE,KAAK,CAAC,MAAM;YACxB,yEAAyE;YACzE,0EAA0E;YAC1E,gCAAgC;YAChC,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC;YACvC,MAAM,EAAE,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC;SAC3C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -7,7 +7,7 @@ export interface GeneratedImage {
|
|
|
7
7
|
/**
|
|
8
8
|
* The content file this image came from, relative to the content root.
|
|
9
9
|
* `undefined` for a config `extra` image: there is no post behind it, and
|
|
10
|
-
* naming one
|
|
10
|
+
* naming one after its output path would quietly break anything grouping
|
|
11
11
|
* results by the post they belong to.
|
|
12
12
|
*/
|
|
13
13
|
readonly contentPath: string | undefined;
|
|
@@ -2,8 +2,8 @@ import type { RenderJob } from "./job.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Reject a manifest written over one of the images it describes.
|
|
4
4
|
*
|
|
5
|
-
* The manifest is written last, so it wins: the image is replaced by JSON,
|
|
6
|
-
*
|
|
5
|
+
* The manifest is written last, so it wins: the image is replaced by JSON,
|
|
6
|
+
* losing its stamp with it, and rendered again on every build afterwards. It is
|
|
7
7
|
* the same collision as two images sharing a path, so it is answered here,
|
|
8
8
|
* where a path is already compared the way the filesystem would.
|
|
9
9
|
*/
|
|
@@ -16,8 +16,8 @@ export declare function assertManifestIsNotAnImage(manifestPath: string | undefi
|
|
|
16
16
|
* renders both again, for ever.
|
|
17
17
|
*
|
|
18
18
|
* Every job is checked, posts included. That used to be older ground worth
|
|
19
|
-
* leaving alone
|
|
20
|
-
* slug
|
|
19
|
+
* leaving alone, since two posts collided only if they shared a directory and
|
|
20
|
+
* a slug. But `public-dir` gathers a whole tree into one directory, where every
|
|
21
21
|
* post sharing a basename with another lands on it. Naming both sides is what
|
|
22
22
|
* makes that worth reporting: the path alone does not say which two posts.
|
|
23
23
|
*
|
package/dist/generate/outputs.js
CHANGED
|
@@ -22,8 +22,8 @@ function describe(job) {
|
|
|
22
22
|
/**
|
|
23
23
|
* Reject a manifest written over one of the images it describes.
|
|
24
24
|
*
|
|
25
|
-
* The manifest is written last, so it wins: the image is replaced by JSON,
|
|
26
|
-
*
|
|
25
|
+
* The manifest is written last, so it wins: the image is replaced by JSON,
|
|
26
|
+
* losing its stamp with it, and rendered again on every build afterwards. It is
|
|
27
27
|
* the same collision as two images sharing a path, so it is answered here,
|
|
28
28
|
* where a path is already compared the way the filesystem would.
|
|
29
29
|
*/
|
|
@@ -47,8 +47,8 @@ export function assertManifestIsNotAnImage(manifestPath, jobs) {
|
|
|
47
47
|
* renders both again, for ever.
|
|
48
48
|
*
|
|
49
49
|
* Every job is checked, posts included. That used to be older ground worth
|
|
50
|
-
* leaving alone
|
|
51
|
-
* slug
|
|
50
|
+
* leaving alone, since two posts collided only if they shared a directory and
|
|
51
|
+
* a slug. But `public-dir` gathers a whole tree into one directory, where every
|
|
52
52
|
* post sharing a basename with another lands on it. Naming both sides is what
|
|
53
53
|
* makes that worth reporting: the path alone does not say which two posts.
|
|
54
54
|
*
|
|
@@ -6,9 +6,8 @@ import type { BundledLanguage, BundledTheme, SpecialLanguage } from "shiki";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function resolveLanguage(language: string): BundledLanguage | SpecialLanguage;
|
|
8
8
|
/**
|
|
9
|
-
* Validate a configured theme name.
|
|
10
|
-
*
|
|
11
|
-
* failing on.
|
|
9
|
+
* Validate a configured theme name. Languages come from post frontmatter and
|
|
10
|
+
* fall back quietly, but a bad theme is a config mistake worth failing on.
|
|
12
11
|
*/
|
|
13
12
|
export declare function resolveTheme(theme: string): BundledTheme;
|
|
14
13
|
//# sourceMappingURL=language.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../src/highlight/language.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAsB5E;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,GACf,eAAe,GAAG,eAAe,CAOnC;AAED
|
|
1
|
+
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../src/highlight/language.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAsB5E;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,GACf,eAAe,GAAG,eAAe,CAOnC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAQxD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { bundledLanguages, bundledThemes } from "shiki";
|
|
2
2
|
/**
|
|
3
3
|
* Language names that differ between Pygments (which the original Python
|
|
4
|
-
* script used) and Shiki. Everything else is passed through
|
|
4
|
+
* script used) and Shiki. Everything else is passed through, since Shiki
|
|
5
5
|
* understands `bash`, `python`, `typescript`, `yaml`, `toml`, `sql`, `json`,
|
|
6
6
|
* `js` and `text`.
|
|
7
7
|
*/
|
|
@@ -29,9 +29,8 @@ export function resolveLanguage(language) {
|
|
|
29
29
|
: plainText;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* Validate a configured theme name.
|
|
33
|
-
*
|
|
34
|
-
* failing on.
|
|
32
|
+
* Validate a configured theme name. Languages come from post frontmatter and
|
|
33
|
+
* fall back quietly, but a bad theme is a config mistake worth failing on.
|
|
35
34
|
*/
|
|
36
35
|
export function resolveTheme(theme) {
|
|
37
36
|
if (!Object.hasOwn(bundledThemes, theme)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language.js","sourceRoot":"","sources":["../../src/highlight/language.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExD;;;;;GAKG;AACH,MAAM,eAAe,GAAgC,IAAI,GAAG,CAAC;IAC3D,CAAC,iBAAiB,EAAE,YAAY,CAAC;IACjC,CAAC,aAAa,EAAE,YAAY,CAAC;IAC7B,CAAC,YAAY,EAAE,YAAY,CAAC;IAC5B,CAAC,UAAU,EAAE,KAAK,CAAC;IACnB,CAAC,SAAS,EAAE,cAAc,CAAC;IAC3B,CAAC,eAAe,EAAE,cAAc,CAAC;IACjC,CAAC,MAAM,EAAE,WAAW,CAAC;IACrB,CAAC,OAAO,EAAE,WAAW,CAAC;CACvB,CAAC,CAAC;AAEH,MAAM,SAAS,GAAoB,WAAW,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAgB;IAEhB,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACjD,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC;IAE9D,OAAO,MAAM,CAA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/B,CAAC"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
export declare function expandTabs(text: string, tabSize: number): string;
|
|
5
5
|
/**
|
|
6
6
|
* Strip the indentation common to every non-blank line. A snippet lifted out
|
|
7
|
-
* of a nested block would otherwise spend its width
|
|
8
|
-
* the landscape sizes
|
|
7
|
+
* of a nested block would otherwise spend its width, the scarce dimension on
|
|
8
|
+
* the landscape sizes, on indentation that carries no meaning once the
|
|
9
9
|
* surrounding code is gone.
|
|
10
10
|
*/
|
|
11
11
|
export declare function dedent(text: string): string;
|
|
@@ -7,8 +7,8 @@ export function expandTabs(text, tabSize) {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Strip the indentation common to every non-blank line. A snippet lifted out
|
|
10
|
-
* of a nested block would otherwise spend its width
|
|
11
|
-
* the landscape sizes
|
|
10
|
+
* of a nested block would otherwise spend its width, the scarce dimension on
|
|
11
|
+
* the landscape sizes, on indentation that carries no meaning once the
|
|
12
12
|
* surrounding code is gone.
|
|
13
13
|
*/
|
|
14
14
|
export function dedent(text) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ImageAsset, MetaImageProps, ResolvedConfig } from "../types.js";
|
|
2
|
+
export { loadImage } from "./load.js";
|
|
3
|
+
export { resolveImageSource, resolveOptionalImage } from "./resolve.js";
|
|
4
|
+
/** Every image one rendering needs, loaded and ready to draw. */
|
|
5
|
+
export interface LoadedImages {
|
|
6
|
+
readonly logo: ImageAsset | undefined;
|
|
7
|
+
readonly avatar: ImageAsset | undefined;
|
|
8
|
+
readonly background: ImageAsset | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Load the logo, the background photo and the post's avatar for one image.
|
|
12
|
+
*
|
|
13
|
+
* Reading files is the renderer's job rather than the template's. A template
|
|
14
|
+
* stays a synchronous function over values it was handed, and the bytes of a
|
|
15
|
+
* logo are read once for a whole build rather than once per image.
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadImages(config: ResolvedConfig, props: MetaImageProps): Promise<LoadedImages>;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/image/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,cAAc,EACd,cAAc,EACf,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAExE,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;CAC7C;AAgCD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,YAAY,CAAC,CAWvB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { loadImage } from "./load.js";
|
|
2
|
+
import { resolveImageSource } from "./resolve.js";
|
|
3
|
+
import { bytesFromDataUri } from "./uri.js";
|
|
4
|
+
export { loadImage } from "./load.js";
|
|
5
|
+
export { resolveImageSource, resolveOptionalImage } from "./resolve.js";
|
|
6
|
+
/**
|
|
7
|
+
* Load an image named by a prop, which is a `data:` URI or a path to a file.
|
|
8
|
+
*
|
|
9
|
+
* A path is resolved from the working directory, as `fonts` and `logo` are.
|
|
10
|
+
* Resolving it against the post instead would be friendlier for a page bundle
|
|
11
|
+
* and wrong for everything else, and a build has one working directory but
|
|
12
|
+
* many content directories.
|
|
13
|
+
*/
|
|
14
|
+
async function loadProp(value, label) {
|
|
15
|
+
if (value === undefined || value === "") {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const source = value.startsWith("data:")
|
|
19
|
+
? { data: bytesFromDataUri(value, label) }
|
|
20
|
+
: resolveImageSource({ path: value }, label);
|
|
21
|
+
return loadImage(source, label);
|
|
22
|
+
}
|
|
23
|
+
async function loadOptional(source, label) {
|
|
24
|
+
return source === undefined ? undefined : loadImage(source, label);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Load the logo, the background photo and the post's avatar for one image.
|
|
28
|
+
*
|
|
29
|
+
* Reading files is the renderer's job rather than the template's. A template
|
|
30
|
+
* stays a synchronous function over values it was handed, and the bytes of a
|
|
31
|
+
* logo are read once for a whole build rather than once per image.
|
|
32
|
+
*/
|
|
33
|
+
export async function loadImages(config, props) {
|
|
34
|
+
const background = config.background.type === "image" ? config.background.source : undefined;
|
|
35
|
+
const [logo, avatar, backgroundImage] = await Promise.all([
|
|
36
|
+
loadOptional(config.logo, "logo"),
|
|
37
|
+
loadProp(props.avatar, "props.avatar"),
|
|
38
|
+
loadOptional(background, "background.source"),
|
|
39
|
+
]);
|
|
40
|
+
return { logo, avatar, background: backgroundImage };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/image/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AASxE;;;;;;;GAOG;AACH,KAAK,UAAU,QAAQ,CACrB,KAAyB,EACzB,KAAa;IAEb,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAgB,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;QACnD,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;QAC1C,CAAC,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IAE/C,OAAO,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC;AAED,KAAK,UAAU,YAAY,CACzB,MAA+B,EAC/B,KAAa;IAEb,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAsB,EACtB,KAAqB;IAErB,MAAM,UAAU,GACd,MAAM,CAAC,UAAU,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAE5E,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACxD,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;QACjC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC;QACtC,YAAY,CAAC,UAAU,EAAE,mBAAmB,CAAC;KAC9C,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Extent } from "./size.js";
|
|
2
|
+
/**
|
|
3
|
+
* The dimensions of a JPEG, by walking its segments to the frame header.
|
|
4
|
+
*
|
|
5
|
+
* Unlike every other format here, a JPEG does not state its size at a fixed
|
|
6
|
+
* offset: the frame header comes after however many comment, quantisation and
|
|
7
|
+
* application segments the encoder felt like writing.
|
|
8
|
+
*/
|
|
9
|
+
export declare function jpegExtent(bytes: Uint8Array): Extent | undefined;
|
|
10
|
+
//# sourceMappingURL=jpeg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jpeg.d.ts","sourceRoot":"","sources":["../../src/image/jpeg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAkBxC;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CA2ChE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** Markers that carry no payload, so nothing follows them to skip over. */
|
|
2
|
+
const standalone = new Set([0xd8, 0xd9, 0x01]);
|
|
3
|
+
/** The frame headers, which are the segments that state the image size. */
|
|
4
|
+
function isFrameHeader(marker) {
|
|
5
|
+
// 0xC4, 0xC8 and 0xCC sit in the same range and are tables rather than
|
|
6
|
+
// frames, which is the whole subtlety of reading a JPEG header.
|
|
7
|
+
return (marker >= 0xc0 &&
|
|
8
|
+
marker <= 0xcf &&
|
|
9
|
+
marker !== 0xc4 &&
|
|
10
|
+
marker !== 0xc8 &&
|
|
11
|
+
marker !== 0xcc);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The dimensions of a JPEG, by walking its segments to the frame header.
|
|
15
|
+
*
|
|
16
|
+
* Unlike every other format here, a JPEG does not state its size at a fixed
|
|
17
|
+
* offset: the frame header comes after however many comment, quantisation and
|
|
18
|
+
* application segments the encoder felt like writing.
|
|
19
|
+
*/
|
|
20
|
+
export function jpegExtent(bytes) {
|
|
21
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
22
|
+
let offset = 2;
|
|
23
|
+
while (offset + 4 < bytes.length) {
|
|
24
|
+
if (bytes[offset] !== 0xff) {
|
|
25
|
+
// Anything between segments is skipped a byte at a time rather than
|
|
26
|
+
// read as a length, since a length taken from the middle of one would
|
|
27
|
+
// jump somewhere arbitrary.
|
|
28
|
+
offset += 1;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const marker = bytes[offset + 1] ?? 0;
|
|
32
|
+
if (marker === 0xff) {
|
|
33
|
+
// A marker may be preceded by any number of `0xff` fill bytes, so this
|
|
34
|
+
// is the first of them rather than a marker of its own.
|
|
35
|
+
offset += 1;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (standalone.has(marker)) {
|
|
39
|
+
offset += 2;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (isFrameHeader(marker)) {
|
|
43
|
+
// The dimensions run to offset + 8, further than the loop guarantees, so
|
|
44
|
+
// a file truncated inside its own frame header is unmeasurable rather
|
|
45
|
+
// than a read past the end of the buffer.
|
|
46
|
+
return offset + 8 < bytes.length
|
|
47
|
+
? {
|
|
48
|
+
width: view.getUint16(offset + 7),
|
|
49
|
+
height: view.getUint16(offset + 5),
|
|
50
|
+
}
|
|
51
|
+
: undefined;
|
|
52
|
+
}
|
|
53
|
+
offset += 2 + view.getUint16(offset + 2);
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=jpeg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jpeg.js","sourceRoot":"","sources":["../../src/image/jpeg.ts"],"names":[],"mappings":"AAEA,2EAA2E;AAC3E,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE/C,2EAA2E;AAC3E,SAAS,aAAa,CAAC,MAAc;IACnC,uEAAuE;IACvE,gEAAgE;IAChE,OAAO,CACL,MAAM,IAAI,IAAI;QACd,MAAM,IAAI,IAAI;QACd,MAAM,KAAK,IA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