@rr0/cms 0.3.25 → 0.3.27

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.
@@ -34,7 +34,7 @@ export class DescriptionReplaceCommand {
34
34
  descriptionMeta.name = "description";
35
35
  descriptionMeta.content = file.meta.description;
36
36
  outDoc.head.append(descriptionMeta);
37
- context.file.contents = outDoc.documentElement.outerHTML;
37
+ context.file.contents = `<DOCTYPE ${outDoc.doctype.name}>${outDoc.documentElement.outerHTML}`;
38
38
  }
39
39
  }
40
40
  async contentStepEnd() {
@@ -7,7 +7,7 @@ import { imageSizeFromFile } from "image-size/fromFile";
7
7
  */
8
8
  export class ImageCommand extends DomReplaceCommand {
9
9
  constructor(outBaseDir, maxWidth, maxHeight, baseUrl = "") {
10
- super("img", undefined);
10
+ super("img:not(.raw)", undefined);
11
11
  this.outBaseDir = outBaseDir;
12
12
  this.maxWidth = maxWidth;
13
13
  this.maxHeight = maxHeight;
@@ -39,6 +39,7 @@ export declare class OpenGraphCommand implements ReplaceCommand<HtmlRR0Context>
39
39
  * @private
40
40
  */
41
41
  protected drawGradient(canvasCtx: CanvasRenderingContext2D, widthRatio: number, startColor?: string, endColor?: string): void;
42
+ readonly supportedFiles = "img[src$='.png'],img[src$='.jpg'],img[src$='.gif']";
42
43
  /**
43
44
  * Draw a height-scaled image on the right of the canvas.
44
45
  *
@@ -15,6 +15,7 @@ export class OpenGraphCommand {
15
15
  this.width = width;
16
16
  this.height = height;
17
17
  this.num = 0;
18
+ this.supportedFiles = "img[src$='.png'],img[src$='.jpg'],img[src$='.gif']";
18
19
  }
19
20
  async execute(context) {
20
21
  const title = context.file.title;
@@ -152,7 +153,7 @@ export class OpenGraphCommand {
152
153
  */
153
154
  async drawImage(context, canvasCtx, dy = 0) {
154
155
  const outDoc = context.file.document;
155
- const docImages = outDoc.documentElement.getElementsByTagName("img");
156
+ const docImages = outDoc.documentElement.querySelectorAll(this.supportedFiles);
156
157
  let widthRatio = 0.5;
157
158
  let imageIndex = 0;
158
159
  if (imageIndex < docImages.length) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@rr0/cms",
3
3
  "type": "module",
4
4
  "author": "Jérôme Beau <rr0@rr0.org> (https://rr0.org)",
5
- "version": "0.3.25",
5
+ "version": "0.3.27",
6
6
  "description": "RR0 Content Management System (CMS)",
7
7
  "exports": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "preview": "vite preview --host",
24
24
  "build": "rm -Rf dist && tsc --project tsconfig.prod.json",
25
25
  "prepublishOnly": "npm run build",
26
- "test": "testscripnpt",
26
+ "test": "testscript",
27
27
  "test-one": "rm -Rf out && tsx src/CMSGenerator.test.ts",
28
28
  "test-ci": "rm -Rf out && testscript"
29
29
  },
@@ -39,17 +39,17 @@
39
39
  "glob": "^11.0.1",
40
40
  "image-size": "^2.0.1",
41
41
  "jsdom": "^26.0.0",
42
- "netlify-cli": "^19.0.2",
43
- "selenium-webdriver": "^4.29.0",
42
+ "netlify-cli": "^19.0.3",
43
+ "selenium-webdriver": "^4.30.0",
44
44
  "ssg-api": "^1.16.15"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@javarome/testscript": "^0.13.1",
48
48
  "@types/jsdom": "^21.1.7",
49
- "@types/node": "^22.13.5",
49
+ "@types/node": "^22.13.11",
50
50
  "tsx": "4.19.3",
51
- "typescript": "^5.7.3",
52
- "vite": "^6.2.0"
51
+ "typescript": "^5.8.2",
52
+ "vite": "^6.2.2"
53
53
  },
54
54
  "keywords": [
55
55
  "cms",