From 189369b7c939125557c77a514de19e55e07365b5 Mon Sep 17 00:00:00 2001 From: Victor Hugo <83098581+victorhdsp@users.noreply.github.com> Date: Wed, 21 Aug 2024 18:05:45 -0300 Subject: [PATCH] nova funcionalidade, create picture and add sources --- README.md | 2 +- lib/convert/convert.test.js | 4 +- lib/convert/convert.test.ts | 4 +- lib/convert/index.js | 4 +- lib/convert/index.ts | 4 +- lib/files/files.test.js | 14 +- lib/files/files.test.ts | 21 ++- lib/files/index.js | 17 ++- lib/files/index.ts | 17 ++- lib/sources/index.js | 53 ++++++++ lib/sources/index.ts | 31 +++++ lib/sources/sources.test.js | 52 ++++++++ lib/sources/sources.test.ts | 28 ++++ package-lock.json | 256 +++++++++++++++++++++++++++++++++++- package.json | 1 + 15 files changed, 491 insertions(+), 17 deletions(-) create mode 100644 lib/sources/index.js create mode 100644 lib/sources/index.ts create mode 100644 lib/sources/sources.test.js create mode 100644 lib/sources/sources.test.ts diff --git a/README.md b/README.md index f8f58b7..1dd85f1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ O projeto ainda está em desenvolvimento e as próximas atualizações serão vo - [x] Conversão dos arquivos para o formato web. - [x] Adicionar sinalização de que a aplicação esta rodando de forma constante. - [x] Criação de um backup das imagens para caso de problemas. -- [ ] Modificação dos arquivos estáticos do site, substituindo `` por `` com seus devidos ``. +- [x] Modificação dos arquivos estáticos do site, substituindo `` por `` com seus devidos ``. - [ ] Implementação em tempo real para JSX. - [ ] Utilização de inteligência artificial para construir os "alts", melhorando a acessibilidade e dando menos trabalho. diff --git a/lib/convert/convert.test.js b/lib/convert/convert.test.js index b4de7ee..cdbb802 100644 --- a/lib/convert/convert.test.js +++ b/lib/convert/convert.test.js @@ -21,7 +21,7 @@ describe("convertImages", () => { beforeEach(() => { jest.clearAllMocks(); // Limpa o estado dos mocks antes de cada teste }); - it("should convert images to png, webp, and avif", () => __awaiter(void 0, void 0, void 0, function* () { + it("should convert images to png, webp, avif and ignore other files", () => __awaiter(void 0, void 0, void 0, function* () { const mockSharp = sharp_1.default; const mockPng = jest.fn().mockReturnThis(); const mockWebp = jest.fn().mockReturnThis(); @@ -33,7 +33,7 @@ describe("convertImages", () => { webp: mockWebp.mockReturnValue({ toFile: mockToFile }), avif: mockAvif.mockReturnValue({ toFile: mockToFile }) }); - const files = ["image1.jpg", "image2.png"]; + const files = ["index.html", "image1.jpg", "image2.png"]; yield (0, index_1.convertImages)(files); expect(mockPng).toHaveBeenCalled(); expect(mockWebp).toHaveBeenCalled(); diff --git a/lib/convert/convert.test.ts b/lib/convert/convert.test.ts index b4e46c5..b8bd790 100644 --- a/lib/convert/convert.test.ts +++ b/lib/convert/convert.test.ts @@ -11,7 +11,7 @@ describe("convertImages", () => { jest.clearAllMocks(); // Limpa o estado dos mocks antes de cada teste }); - it("should convert images to png, webp, and avif", async () => { + it("should convert images to png, webp, avif and ignore other files", async () => { const mockSharp = sharp as unknown as jest.Mock; const mockPng = jest.fn().mockReturnThis(); @@ -26,7 +26,7 @@ describe("convertImages", () => { avif: mockAvif.mockReturnValue({ toFile: mockToFile }) }); - const files = ["image1.jpg", "image2.png"]; + const files = ["index.html", "image1.jpg", "image2.png"]; await convertImages(files); diff --git a/lib/convert/index.js b/lib/convert/index.js index ee058d0..a23307c 100644 --- a/lib/convert/index.js +++ b/lib/convert/index.js @@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.convertImages = convertImages; const fs_1 = require("fs"); const sharp_1 = __importDefault(require("sharp")); +const files_1 = require("../files"); function convertImage(file) { return __awaiter(this, void 0, void 0, function* () { const newFileName = file.replace(".", "_temp."); @@ -31,7 +32,8 @@ function convertImages(files) { return __awaiter(this, void 0, void 0, function* () { for (let i = 0; i < files.length; i++) { const file = files[i]; - yield convertImage(file); + if ((0, files_1.verifyTypeFile)(files_1.typeImages, file)) + yield convertImage(file); console.log("Convertendo imagem: ", file); } console.log("Todas as imagens foram convertidas."); diff --git a/lib/convert/index.ts b/lib/convert/index.ts index f6e11e0..6f26ac4 100644 --- a/lib/convert/index.ts +++ b/lib/convert/index.ts @@ -1,5 +1,6 @@ import { rmSync, renameSync } from "fs"; import sharp from "sharp"; +import { typeImages, verifyTypeFile } from "../files"; async function convertImage(file: string) { const newFileName = file.replace(".", "_temp."); @@ -15,7 +16,8 @@ async function convertImage(file: string) { export async function convertImages (files: string[]) { for (let i = 0; i < files.length; i++) { const file = files[i]; - await convertImage(file); + if (verifyTypeFile(typeImages, file)) + await convertImage(file); console.log("Convertendo imagem: ", file); } console.log("Todas as imagens foram convertidas."); diff --git a/lib/files/files.test.js b/lib/files/files.test.js index 19b9883..9b6396d 100644 --- a/lib/files/files.test.js +++ b/lib/files/files.test.js @@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -const node_process_1 = require("node:process"); const node_path_1 = __importDefault(require("node:path")); +const node_process_1 = require("node:process"); const node_fs_1 = require("node:fs"); const index_1 = require("./index"); describe("getForFiles", () => { @@ -20,6 +20,7 @@ describe("getForFiles", () => { console.log = jest.fn(); const result = (0, index_1.getForFiles)(tmpDir); expect(result).toEqual([ + node_path_1.default.join(tmpDir, "/404.html"), node_path_1.default.join(tmpDir, "/img/favicon.png"), node_path_1.default.join(tmpDir, "/img/home/aboutus.png"), node_path_1.default.join(tmpDir, "/img/home/contact.png"), @@ -34,7 +35,18 @@ describe("getForFiles", () => { node_path_1.default.join(tmpDir, "/img/home/portfolio/michelle-2.png"), node_path_1.default.join(tmpDir, "/img/home/portfolio/pamella-1.png"), node_path_1.default.join(tmpDir, "/img/home/portfolio/pamella-2.png"), + node_path_1.default.join(tmpDir, "/index.html"), ]); expect(console.log).toHaveBeenCalledWith("Todas as imagens foram selecionadas."); }); }); +describe("makeBackup", () => { + const testDir = node_path_1.default.join((0, node_process_1.cwd)(), "/tests/files/", "/out"); + it("Deve retornar o backup no history", () => { + const testHistory = node_path_1.default.join((0, node_process_1.cwd)(), "/history"); + (0, index_1.makeBackup)(testDir); + const history = (0, node_fs_1.readdirSync)(testHistory); + expect(history).toContain("out"); + (0, node_fs_1.rmSync)(node_path_1.default.join(testHistory, "/out"), { recursive: true }); + }); +}); diff --git a/lib/files/files.test.ts b/lib/files/files.test.ts index 6c48e77..8fd8941 100644 --- a/lib/files/files.test.ts +++ b/lib/files/files.test.ts @@ -1,7 +1,7 @@ -import { cwd } from "node:process"; import path from "node:path"; -import { cpSync, rmSync } from "node:fs"; -import { getForFiles } from "./index"; +import { cwd } from "node:process"; +import { cpSync, readdirSync, rmSync } from "node:fs"; +import { getForFiles, makeBackup } from "./index"; describe("getForFiles", () => { const testDir = path.join(cwd(), "/tests/files/", "/out"); @@ -20,6 +20,7 @@ describe("getForFiles", () => { const result = getForFiles(tmpDir); expect(result).toEqual([ + path.join(tmpDir, "/404.html"), path.join(tmpDir, "/img/favicon.png"), path.join(tmpDir, "/img/home/aboutus.png"), path.join(tmpDir, "/img/home/contact.png"), @@ -34,8 +35,22 @@ describe("getForFiles", () => { path.join(tmpDir, "/img/home/portfolio/michelle-2.png"), path.join(tmpDir, "/img/home/portfolio/pamella-1.png"), path.join(tmpDir, "/img/home/portfolio/pamella-2.png"), + path.join(tmpDir, "/index.html"), ]); expect(console.log).toHaveBeenCalledWith("Todas as imagens foram selecionadas."); }); +}); + +describe("makeBackup", () => { + const testDir = path.join(cwd(), "/tests/files/", "/out"); + + it("Deve retornar o backup no history", () => { + const testHistory = path.join(cwd(), "/history"); + makeBackup(testDir); + + const history = readdirSync(testHistory); + expect(history).toContain("out"); + rmSync(path.join(testHistory, "/out"), { recursive: true }); + }) }); \ No newline at end of file diff --git a/lib/files/index.js b/lib/files/index.js index a0e67df..8d4b454 100644 --- a/lib/files/index.js +++ b/lib/files/index.js @@ -3,16 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); +exports.typeMarking = exports.typeImages = void 0; +exports.verifyTypeFile = verifyTypeFile; exports.filter = filter; exports.getForFiles = getForFiles; exports.makeBackup = makeBackup; const node_fs_1 = require("node:fs"); const node_path_1 = __importDefault(require("node:path")); const node_process_1 = require("node:process"); +exports.typeImages = ["png", "jpg"]; +exports.typeMarking = ["html"]; +function verifyTypeFile(types, file) { + for (let i = 0; i < types.length; i++) + if (file.includes(types[i])) + return true; + return false; +} function filter(files) { return files.filter((file) => { - return file.includes("png") || - file.includes("jpg"); + if (verifyTypeFile(exports.typeImages, file)) + return true; + if (verifyTypeFile(exports.typeMarking, file)) + return true; + return false; }); } function getForFiles(dir) { diff --git a/lib/files/index.ts b/lib/files/index.ts index d314141..4562d2c 100644 --- a/lib/files/index.ts +++ b/lib/files/index.ts @@ -2,10 +2,23 @@ import { readdirSync, cpSync, rmSync, existsSync } from "node:fs"; import path from "node:path"; import { cwd } from "node:process"; +export const typeImages = ["png", "jpg"]; +export const typeMarking = ["html"]; + +export function verifyTypeFile(types: string[], file:string) { + for (let i = 0; i < types.length; i++) + if (file.includes(types[i])) return true; + return false; +} + export function filter(files:string[]) { return files.filter((file) => { - return file.includes("png") || - file.includes("jpg"); + if(verifyTypeFile(typeImages, file)) + return true; + if(verifyTypeFile(typeMarking, file)) + return true; + + return false; }) } diff --git a/lib/sources/index.js b/lib/sources/index.js new file mode 100644 index 0000000..c88caac --- /dev/null +++ b/lib/sources/index.js @@ -0,0 +1,53 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getTagsImage = getTagsImage; +const fs_1 = require("fs"); +const cheerio = __importStar(require("cheerio")); +function getTagsImage(file) { + const $ = cheerio.load((0, fs_1.readFileSync)(file, "utf8")); + $("img").each((index, img) => { + const filenameUntyped = img.attribs.src.split(".")[0]; + $(img).replaceWith(` + + + + ${img.attribs.alt} + + `); + }); + (0, fs_1.writeFileSync)(file, $.html()); +} diff --git a/lib/sources/index.ts b/lib/sources/index.ts new file mode 100644 index 0000000..3908241 --- /dev/null +++ b/lib/sources/index.ts @@ -0,0 +1,31 @@ +import { readFileSync, writeFileSync } from "fs"; +import { typeMarking, verifyTypeFile } from "../files"; +import * as cheerio from "cheerio"; + +export function getTagsImage(file:string) { + const $ = cheerio.load(readFileSync(file, "utf8")); + $("img").each((index, img) => { + const filenameUntyped = img.attribs.src.split(".")[0]; + + $(img).replaceWith(` + + + + ${img.attribs.alt} + + `) + }) + + writeFileSync(file, $.html()); +} \ No newline at end of file diff --git a/lib/sources/sources.test.js b/lib/sources/sources.test.js new file mode 100644 index 0000000..e2835b4 --- /dev/null +++ b/lib/sources/sources.test.js @@ -0,0 +1,52 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const node_fs_1 = require("node:fs"); +const node_path_1 = __importDefault(require("node:path")); +const node_process_1 = require("node:process"); +const cheerio = __importStar(require("cheerio")); +const _1 = require("."); +describe("Sources", () => { + const testDir = node_path_1.default.join((0, node_process_1.cwd)(), "/tests/files/", "/out"); + const tmpDir = node_path_1.default.join((0, node_process_1.cwd)(), "/tests/files/", "/tmp/sources"); + beforeEach(() => { + (0, node_fs_1.cpSync)(testDir, tmpDir, { recursive: true }); + }); + afterEach(() => { + (0, node_fs_1.rmSync)(tmpDir, { recursive: true }); + }); + it("Deve ter buscado os arquivos e adicionado os pictures", () => { + const file = node_path_1.default.join(tmpDir, "index.html"); + const $old = cheerio.loadBuffer((0, node_fs_1.readFileSync)(file)); + (0, _1.getTagsImage)(file); + const $new = cheerio.loadBuffer((0, node_fs_1.readFileSync)(file)); + expect($old("img").get().length).toBe($new("picture").get().length); + expect($old("img").get().length).toBe($new("img").get().length); + expect($old("img").get().length).toBe($new("source").get().length / 2); + }); +}); diff --git a/lib/sources/sources.test.ts b/lib/sources/sources.test.ts new file mode 100644 index 0000000..19dec3e --- /dev/null +++ b/lib/sources/sources.test.ts @@ -0,0 +1,28 @@ +import { cpSync, readFileSync, rmSync } from "node:fs"; +import path from "node:path"; +import { cwd } from "node:process"; +import * as cheerio from "cheerio"; +import { getTagsImage } from "."; + +describe("Sources", () => { + const testDir = path.join(cwd(), "/tests/files/", "/out"); + const tmpDir = path.join(cwd(), "/tests/files/", "/tmp/sources"); + + beforeEach(() => { + cpSync(testDir, tmpDir, { recursive: true }); + }); + + afterEach(() => { + rmSync(tmpDir, { recursive: true }); + }) + + it("Deve ter buscado os arquivos e adicionado os pictures", () => { + const file = path.join(tmpDir, "index.html"); + const $old = cheerio.loadBuffer(readFileSync(file)); + getTagsImage(file); + const $new = cheerio.loadBuffer(readFileSync(file)); + expect($old("img").get().length).toBe($new("picture").get().length) + expect($old("img").get().length).toBe($new("img").get().length) + expect($old("img").get().length).toBe($new("source").get().length / 2) + }); +}) diff --git a/package-lock.json b/package-lock.json index e5d3f0b..a4cd683 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,15 @@ { "name": "pixelite", - "version": "4.0.3", + "version": "4.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pixelite", - "version": "4.0.3", + "version": "4.1.0", "license": "MIT", "dependencies": { + "cheerio": "^1.0.0", "sharp": "^0.32.1" }, "bin": { @@ -1487,6 +1488,11 @@ "readable-stream": "^3.4.0" } }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1654,6 +1660,46 @@ "node": ">=10" } }, + "node_modules/cheerio": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0.tgz", + "integrity": "sha512-quS9HgjQpdaXOvsZz82Oz7uxtXiy6UIsIQcpBj7HRw2M63Skasm9qlDocAM7jNuaxdhpPU7c4kJN+gA5MCu4ww==", + "dependencies": { + "cheerio-select": "^2.1.0", + "dom-serializer": "^2.0.0", + "domhandler": "^5.0.3", + "domutils": "^3.1.0", + "encoding-sniffer": "^0.2.0", + "htmlparser2": "^9.1.0", + "parse5": "^7.1.2", + "parse5-htmlparser2-tree-adapter": "^7.0.0", + "parse5-parser-stream": "^7.1.2", + "undici": "^6.19.5", + "whatwg-mimetype": "^4.0.0" + }, + "engines": { + "node": ">=18.17" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", + "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", + "dependencies": { + "boolbase": "^1.0.0", + "css-select": "^5.1.0", + "css-what": "^6.1.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, "node_modules/chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", @@ -1800,6 +1846,32 @@ "node": ">= 8" } }, + "node_modules/css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, "node_modules/debug": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", @@ -1897,6 +1969,57 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, "node_modules/ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -1936,6 +2059,18 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/encoding-sniffer": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.0.tgz", + "integrity": "sha512-ju7Wq1kg04I3HtiYIOrUrdfdDvkyO9s5XM8QAj/bN61Yo/Vb4vgJxy5vi4Yxk01gWHbrofpPtpxM8bKger9jhg==", + "dependencies": { + "iconv-lite": "^0.6.3", + "whatwg-encoding": "^3.1.1" + }, + "funding": { + "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" + } + }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -1944,6 +2079,17 @@ "once": "^1.4.0" } }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -2262,6 +2408,24 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "node_modules/htmlparser2": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-9.1.0.tgz", + "integrity": "sha512-5zfg6mHUoaer/97TxnGpxmbR7zJtPwIYFMZ/H5ucTlPZhKvtum05yiPK3Mgai3a0DyVxv7qYqoweaEd2nrYQzQ==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.1.0", + "entities": "^4.5.0" + } + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -2271,6 +2435,17 @@ "node": ">=10.17.0" } }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -3315,6 +3490,17 @@ "node": ">=8" } }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3407,6 +3593,40 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz", + "integrity": "sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==", + "dependencies": { + "domhandler": "^5.0.2", + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-parser-stream": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", + "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", + "dependencies": { + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -3707,6 +3927,11 @@ } ] }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -4189,6 +4414,14 @@ "node": ">=14.17" } }, + "node_modules/undici": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.8.tgz", + "integrity": "sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==", + "engines": { + "node": ">=18.17" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -4269,6 +4502,25 @@ "makeerror": "1.0.12" } }, + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "engines": { + "node": ">=18" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index e9f518a..f758d50 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "license": "MIT", "preferGlobal": false, "dependencies": { + "cheerio": "^1.0.0", "sharp": "^0.32.1" }, "devDependencies": {