@kensio/colophon 2.8.0 → 2.10.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/dist/content/props.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ export declare function coerceString(value: unknown): string | undefined;
|
|
|
10
10
|
* `props` mapper reading the frontmatter it already has. Where both speak the
|
|
11
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
|
+
*
|
|
14
|
+
* The title has a third place to come from, which is the post's own top-level
|
|
15
|
+
* `title`, used where neither of the other two set one.
|
|
13
16
|
*/
|
|
14
17
|
export declare function extractProps(frontmatter: Record<string, unknown>, options?: Pick<ContentOptions, "propsKey" | "templateField" | "defaultTemplate" | "props">): MetaImageProps | undefined;
|
|
15
18
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/content/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlE,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAc/D;AASD
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/content/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlE,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAc/D;AASD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,OAAO,GAAE,IAAI,CACX,cAAc,EACd,UAAU,GAAG,eAAe,GAAG,iBAAiB,GAAG,OAAO,CACtD,GACL,cAAc,GAAG,SAAS,CA0D5B"}
|
package/dist/content/props.js
CHANGED
|
@@ -26,6 +26,9 @@ const namedFields = new Set(["template", "title", "subtitle", "version"]);
|
|
|
26
26
|
* `props` mapper reading the frontmatter it already has. Where both speak the
|
|
27
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
|
+
*
|
|
30
|
+
* The title has a third place to come from, which is the post's own top-level
|
|
31
|
+
* `title`, used where neither of the other two set one.
|
|
29
32
|
*/
|
|
30
33
|
export function extractProps(frontmatter, options = {}) {
|
|
31
34
|
const propsKey = options.propsKey ?? defaultPropsKey;
|
|
@@ -49,9 +52,17 @@ export function extractProps(frontmatter, options = {}) {
|
|
|
49
52
|
if (template === undefined) {
|
|
50
53
|
return undefined;
|
|
51
54
|
}
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
+
// A post that says nothing about its title gets the one it already has, so
|
|
56
|
+
// the common case of an image titled after its post needs no props for it.
|
|
57
|
+
//
|
|
58
|
+
// This is the last word rather than the first: the props block wins, then
|
|
59
|
+
// the mapper, then this. It also cannot opt a post in. A post with no props
|
|
60
|
+
// block and no mapper has already been skipped above, so a top-level title
|
|
61
|
+
// never turns a file that wanted no image into one that gets an image.
|
|
62
|
+
//
|
|
63
|
+
// Title is optional even so. Templates such as `code` describe the image
|
|
64
|
+
// entirely from their own fields, and a post carrying neither still renders.
|
|
65
|
+
const title = coerceString(record["title"]) ?? coerceString(frontmatter["title"]);
|
|
55
66
|
const subtitle = coerceString(record["subtitle"]);
|
|
56
67
|
const version = coerceString(record["version"]);
|
|
57
68
|
const extras = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../src/content/props.ts"],"names":[],"mappings":"AAEA,MAAM,eAAe,GAAG,gBAAgB,CAAC;AACzC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAExC,qEAAqE;AACrE,MAAM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AO,CAAC,CAAC,IAAI,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhD,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,GAAG,KAAK,aAAa,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO;QACL,GAAG,MAAM;QACT,QAAQ;QACR,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;QACrC,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC3C,GAAG,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"homepage": "https://github.com/KensioSoftware/colophon#readme",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
|
-
"version": "2.
|
|
11
|
+
"version": "2.10.0",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"main": "./dist/index.js",
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"eslint-plugin-jsdoc": "^63.0.13",
|
|
88
88
|
"eslint-plugin-no-secrets": "^2.3.3",
|
|
89
89
|
"eslint-plugin-security": "^4.0.1",
|
|
90
|
-
"eslint-plugin-unicorn": "^
|
|
90
|
+
"eslint-plugin-unicorn": "^70.0.0",
|
|
91
91
|
"fta-cli": "^3.0.0",
|
|
92
92
|
"globals": "^17.7.0",
|
|
93
93
|
"jiti": "^2.7.0",
|