@mostajs/image 0.0.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog — @mostajs/image
2
+
3
+ **Auteur** : Dr Hamid MADANI <drmdh@msn.com>
4
+
5
+ ## 0.0.1 — 2026-06-14
6
+ - Scaffold initial (cas C). Registre de drivers façon dialectes.
7
+ - Processeur raster **sharp** : `info`, `resize`, `convert` (png/jpeg/webp/avif), `cropCenter`, `stripExif`.
8
+ - Extracteur d'images PDF **pdfjs** : `renderPages` (pdfjs-dist + @napi-rs/canvas) → PNG par page.
9
+ - Façade : `registerBuiltins`, `capabilities`, helpers raster + `resizeDataUrl`/`dataUrlSizeKB`, `pdfPagesToImages`.
10
+ - Drivers optionnels (lazy + sonde `available()`), dégradation gracieuse sans dépendance native.
11
+ - Tests `test-scripts/` (node:test) : **5/5**.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @mostajs/image
2
+
3
+ **Auteur** : Dr Hamid MADANI <drmdh@msn.com>
4
+ **Licence** : AGPL-3.0-or-later
5
+
6
+ Traitement d'image générique, **façon dialectes** (`@mostajs/orm`) : un registre de **processeurs raster** (resize / convert / crop / strip-EXIF — driver **Sharp**) et d'**extracteurs d'images de PDF** (rendu des pages — **pdfjs-dist** + **@napi-rs/canvas**). Tous les drivers sont **optionnels** (lazy + sonde `available()`) et **fs-free** (octets in → octets out).
7
+
8
+ > La **lecture de texte** dans une image (OCR) est le module séparé **`@mostajs/ocr`**. Un dialecte de lecture compose les deux : `pdfPagesToImages` (ici) → `ocrImages` (là-bas).
9
+
10
+ ## API
11
+
12
+ ```ts
13
+ import { registerBuiltins, capabilities, imageInfo, resizeImage, convertImage,
14
+ cropCenter, stripExif, resizeDataUrl, dataUrlSizeKB, pdfPagesToImages } from "@mostajs/image";
15
+
16
+ registerBuiltins(); // enregistre sharp + pdfjs (idempotent)
17
+ const caps = await capabilities(); // { process, pdfImages }
18
+
19
+ const small = await resizeImage(bytes, { width: 800, format: "webp", quality: 80 });
20
+ const jpeg = await convertImage(bytes, "jpeg", 85);
21
+ const clean = await stripExif(bytes); // vie privée
22
+ const pages = await pdfPagesToImages(pdfBytes, { scale: 2, maxPages: 5 }); // PDF scanné → PNG[]
23
+ ```
24
+
25
+ Drivers : `registerProcessor` / `registerPdfExtractor` pour brancher les vôtres (même contrat).
26
+
27
+ ## Dépendances (optionnelles)
28
+
29
+ | Capacité | Paquet | Sans lui |
30
+ |---|---|---|
31
+ | resize/convert/crop/EXIF | `sharp` | `capabilities().process = false`, helpers lèvent une erreur claire |
32
+ | rendu de pages PDF | `pdfjs-dist` + `@napi-rs/canvas` | `capabilities().pdfImages = false` |
@@ -0,0 +1,20 @@
1
+ import type { ImageBytes, ImageCapabilities, ImageInfo, PdfRenderOpts, RasterFormat, ResizeOpts } from "./types.js";
2
+ export * from "./types.js";
3
+ export { registerProcessor, getProcessor, listProcessors, activeProcessor, registerPdfExtractor, getPdfExtractor, listPdfExtractors, activePdfExtractor, _resetRegistries, } from "./registry.js";
4
+ export { makeSharpProcessor } from "./sharp-processor.js";
5
+ export { makePdfjsExtractor } from "./pdf-images.js";
6
+ /** Enregistre les drivers built-in (idempotent). À appeler une fois au démarrage. */
7
+ export declare function registerBuiltins(): void;
8
+ /** Capacités réellement disponibles (dépendances natives présentes ?). */
9
+ export declare function capabilities(): Promise<ImageCapabilities>;
10
+ export declare function imageInfo(bytes: ImageBytes): Promise<ImageInfo>;
11
+ export declare function resizeImage(bytes: ImageBytes, opts: ResizeOpts): Promise<ImageBytes>;
12
+ export declare function convertImage(bytes: ImageBytes, format: RasterFormat, quality?: number): Promise<ImageBytes>;
13
+ export declare function cropCenter(bytes: ImageBytes, w: number, h: number): Promise<ImageBytes>;
14
+ export declare function stripExif(bytes: ImageBytes): Promise<ImageBytes>;
15
+ /** Redimensionne une image data-URL/base64 et renvoie une data-URL (format de sortie au choix). */
16
+ export declare function resizeDataUrl(dataUrl: string, opts: ResizeOpts): Promise<string>;
17
+ /** Taille en Ko d'une image base64/data-URL (estimation décodée). */
18
+ export declare function dataUrlSizeKB(dataUrl: string): number;
19
+ export declare function pdfPagesToImages(pdfBytes: Uint8Array, opts?: PdfRenderOpts): Promise<ImageBytes[]>;
20
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @mostajs/image — façade publique. Enregistre les drivers built-in (sharp + pdfjs), expose le
3
+ * registre, des helpers de haut niveau (resize/convert/info, rendu de pages PDF) et la sonde de
4
+ * capacités. Tout est lazy : le module se charge sans aucune dépendance native installée.
5
+ *
6
+ * Composition typique (dialecte de lecture) :
7
+ * const pages = await pdfPagesToImages(pdfBytes); // @mostajs/image (rendu)
8
+ * const text = await ocrImages(pages); // @mostajs/ocr (reconnaissance)
9
+ *
10
+ * @author Dr Hamid MADANI <drmdh@msn.com>
11
+ * @license AGPL-3.0-or-later
12
+ */
13
+ import { registerProcessor, registerPdfExtractor, activeProcessor, activePdfExtractor, } from "./registry.js";
14
+ import { makeSharpProcessor } from "./sharp-processor.js";
15
+ import { makePdfjsExtractor } from "./pdf-images.js";
16
+ export * from "./types.js";
17
+ export { registerProcessor, getProcessor, listProcessors, activeProcessor, registerPdfExtractor, getPdfExtractor, listPdfExtractors, activePdfExtractor, _resetRegistries, } from "./registry.js";
18
+ export { makeSharpProcessor } from "./sharp-processor.js";
19
+ export { makePdfjsExtractor } from "./pdf-images.js";
20
+ let _registered = false;
21
+ /** Enregistre les drivers built-in (idempotent). À appeler une fois au démarrage. */
22
+ export function registerBuiltins() {
23
+ if (_registered)
24
+ return;
25
+ registerProcessor(makeSharpProcessor());
26
+ registerPdfExtractor(makePdfjsExtractor());
27
+ _registered = true;
28
+ }
29
+ /** Capacités réellement disponibles (dépendances natives présentes ?). */
30
+ export async function capabilities() {
31
+ return { process: !!(await activeProcessor()), pdfImages: !!(await activePdfExtractor()) };
32
+ }
33
+ function needProcessor() {
34
+ return activeProcessor().then((p) => {
35
+ if (!p)
36
+ throw new Error("aucun processeur d'image disponible (npm install sharp)");
37
+ return p;
38
+ });
39
+ }
40
+ // — Helpers raster (octets) —
41
+ export async function imageInfo(bytes) { return (await needProcessor()).info(bytes); }
42
+ export async function resizeImage(bytes, opts) { return (await needProcessor()).resize(bytes, opts); }
43
+ export async function convertImage(bytes, format, quality) { return (await needProcessor()).convert(bytes, format, quality); }
44
+ export async function cropCenter(bytes, w, h) { return (await needProcessor()).cropCenter(bytes, w, h); }
45
+ export async function stripExif(bytes) { return (await needProcessor()).stripExif(bytes); }
46
+ // — Helpers base64 / data-URL (reprend l'util historique parkmanager, désormais server-safe) —
47
+ const B64 = (b) => Buffer.from(b).toString("base64");
48
+ const fromDataUrl = (s) => {
49
+ const m = /^data:([^;]+);base64,(.*)$/s.exec(s.trim());
50
+ if (!m)
51
+ return { mime: "application/octet-stream", bytes: new Uint8Array(Buffer.from(s, "base64")) };
52
+ return { mime: m[1], bytes: new Uint8Array(Buffer.from(m[2], "base64")) };
53
+ };
54
+ /** Redimensionne une image data-URL/base64 et renvoie une data-URL (format de sortie au choix). */
55
+ export async function resizeDataUrl(dataUrl, opts) {
56
+ const { bytes } = fromDataUrl(dataUrl);
57
+ const out = await resizeImage(bytes, opts);
58
+ const fmt = opts.format ?? "png";
59
+ return `data:image/${fmt};base64,${B64(out)}`;
60
+ }
61
+ /** Taille en Ko d'une image base64/data-URL (estimation décodée). */
62
+ export function dataUrlSizeKB(dataUrl) {
63
+ const { bytes } = fromDataUrl(dataUrl);
64
+ return Math.round((bytes.length / 1024) * 10) / 10;
65
+ }
66
+ // — Helper PDF → images —
67
+ export async function pdfPagesToImages(pdfBytes, opts) {
68
+ const x = await activePdfExtractor();
69
+ if (!x)
70
+ throw new Error("rendu PDF indisponible (npm install pdfjs-dist @napi-rs/canvas)");
71
+ return x.renderPages(pdfBytes, opts);
72
+ }
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @mostajs/image — extracteur d'images PDF « pdfjs » : rend chaque page en PNG via
3
+ * pdfjs-dist (legacy ESM) + @napi-rs/canvas. Driver OPTIONNEL, lazy. fs-free.
4
+ *
5
+ * Sert notamment à transformer un PDF SCANNÉ (sans couche texte) en images, qu'un moteur
6
+ * OCR (@mostajs/ocr) peut ensuite lire.
7
+ *
8
+ * @author Dr Hamid MADANI <drmdh@msn.com>
9
+ * @license AGPL-3.0-or-later
10
+ */
11
+ import type { PdfImageExtractor } from "./types.js";
12
+ export declare function makePdfjsExtractor(): PdfImageExtractor;
13
+ //# sourceMappingURL=pdf-images.d.ts.map
@@ -0,0 +1,58 @@
1
+ let _pdfjs;
2
+ let _canvas;
3
+ async function loadPdfjs() {
4
+ if (_pdfjs !== undefined)
5
+ return _pdfjs;
6
+ try {
7
+ _pdfjs = await import("pdfjs-dist/legacy/build/pdf.mjs");
8
+ }
9
+ catch {
10
+ _pdfjs = null;
11
+ }
12
+ return _pdfjs;
13
+ }
14
+ async function loadCanvas() {
15
+ if (_canvas !== undefined)
16
+ return _canvas;
17
+ try {
18
+ _canvas = await import("@napi-rs/canvas");
19
+ }
20
+ catch {
21
+ _canvas = null;
22
+ }
23
+ return _canvas;
24
+ }
25
+ export function makePdfjsExtractor() {
26
+ return {
27
+ name: "pdfjs",
28
+ async available() { return (await loadPdfjs()) !== null && (await loadCanvas()) !== null; },
29
+ async renderPages(pdfBytes, opts) {
30
+ const pdfjs = await loadPdfjs();
31
+ const canvasMod = await loadCanvas();
32
+ if (!pdfjs || !canvasMod)
33
+ throw new Error("rendu PDF indisponible (npm install pdfjs-dist @napi-rs/canvas)");
34
+ const scale = opts?.scale ?? 2;
35
+ // copie défensive : pdfjs peut transférer/détacher le buffer d'entrée.
36
+ const data = new Uint8Array(pdfBytes);
37
+ const doc = await pdfjs.getDocument({ data, isEvalSupported: false, useSystemFonts: true }).promise;
38
+ const total = opts?.maxPages ? Math.min(opts.maxPages, doc.numPages) : doc.numPages;
39
+ const out = [];
40
+ try {
41
+ for (let i = 1; i <= total; i++) {
42
+ const page = await doc.getPage(i);
43
+ const viewport = page.getViewport({ scale });
44
+ const canvas = canvasMod.createCanvas(Math.ceil(viewport.width), Math.ceil(viewport.height));
45
+ const ctx = canvas.getContext("2d");
46
+ await page.render({ canvasContext: ctx, viewport }).promise;
47
+ out.push(new Uint8Array(canvas.toBuffer("image/png")));
48
+ page.cleanup();
49
+ }
50
+ }
51
+ finally {
52
+ await doc.destroy?.();
53
+ }
54
+ return out;
55
+ },
56
+ };
57
+ }
58
+ //# sourceMappingURL=pdf-images.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @mostajs/image — registres de drivers (façon dialects @mostajs/orm) : processeurs raster,
3
+ * moteurs OCR, extracteurs d'images PDF. Enregistrement idempotent par `name` ; sélection du
4
+ * premier driver DISPONIBLE (sonde `available()`).
5
+ *
6
+ * @author Dr Hamid MADANI <drmdh@msn.com>
7
+ * @license AGPL-3.0-or-later
8
+ */
9
+ import type { ImageProcessor, PdfImageExtractor } from "./types.js";
10
+ export declare function registerProcessor(p: ImageProcessor): void;
11
+ export declare function getProcessor(name: string): ImageProcessor | undefined;
12
+ export declare function listProcessors(): ImageProcessor[];
13
+ export declare function registerPdfExtractor(x: PdfImageExtractor): void;
14
+ export declare function getPdfExtractor(name: string): PdfImageExtractor | undefined;
15
+ export declare function listPdfExtractors(): PdfImageExtractor[];
16
+ export declare function activeProcessor(): Promise<ImageProcessor | undefined>;
17
+ export declare function activePdfExtractor(): Promise<PdfImageExtractor | undefined>;
18
+ /** Vide tous les registres (tests). */
19
+ export declare function _resetRegistries(): void;
20
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1,22 @@
1
+ const processors = new Map();
2
+ const pdfExtractors = new Map();
3
+ // — Processeurs raster —
4
+ export function registerProcessor(p) { processors.set(p.name, p); }
5
+ export function getProcessor(name) { return processors.get(name); }
6
+ export function listProcessors() { return [...processors.values()]; }
7
+ // — Extracteurs d'images PDF —
8
+ export function registerPdfExtractor(x) { pdfExtractors.set(x.name, x); }
9
+ export function getPdfExtractor(name) { return pdfExtractors.get(name); }
10
+ export function listPdfExtractors() { return [...pdfExtractors.values()]; }
11
+ /** Premier driver effectivement disponible (ou `undefined`). */
12
+ async function firstAvailable(list) {
13
+ for (const d of list)
14
+ if (await d.available())
15
+ return d;
16
+ return undefined;
17
+ }
18
+ export function activeProcessor() { return firstAvailable(listProcessors()); }
19
+ export function activePdfExtractor() { return firstAvailable(listPdfExtractors()); }
20
+ /** Vide tous les registres (tests). */
21
+ export function _resetRegistries() { processors.clear(); pdfExtractors.clear(); }
22
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @mostajs/image — processeur raster « sharp » (libvips). Driver OPTIONNEL, chargé en lazy :
3
+ * si `sharp` n'est pas installé, `available()` renvoie false et les autres registres prennent
4
+ * le relais. fs-free : Uint8Array in → Uint8Array out.
5
+ *
6
+ * @author Dr Hamid MADANI <drmdh@msn.com>
7
+ * @license AGPL-3.0-or-later
8
+ */
9
+ import type { ImageProcessor } from "./types.js";
10
+ export declare function makeSharpProcessor(): ImageProcessor;
11
+ //# sourceMappingURL=sharp-processor.d.ts.map
@@ -0,0 +1,66 @@
1
+ let _sharp;
2
+ async function loadSharp() {
3
+ if (_sharp !== undefined)
4
+ return _sharp;
5
+ try {
6
+ _sharp = (await import("sharp")).default;
7
+ }
8
+ catch {
9
+ _sharp = null;
10
+ }
11
+ return _sharp;
12
+ }
13
+ function applyFormat(pipe, format, quality) {
14
+ if (!format)
15
+ return pipe;
16
+ if (format === "jpeg")
17
+ return pipe.jpeg({ quality: quality ?? 80 });
18
+ if (format === "webp")
19
+ return pipe.webp({ quality: quality ?? 80 });
20
+ if (format === "avif")
21
+ return pipe.avif({ quality: quality ?? 50 });
22
+ return pipe.png();
23
+ }
24
+ export function makeSharpProcessor() {
25
+ return {
26
+ name: "sharp",
27
+ async available() { return (await loadSharp()) !== null; },
28
+ async info(bytes) {
29
+ const sharp = await loadSharp();
30
+ if (!sharp)
31
+ throw new Error("driver « sharp » indisponible (npm install sharp)");
32
+ const m = await sharp(bytes).metadata();
33
+ return { width: m.width ?? 0, height: m.height ?? 0, format: m.format ?? "", hasAlpha: !!m.hasAlpha };
34
+ },
35
+ async resize(bytes, opts) {
36
+ const sharp = await loadSharp();
37
+ if (!sharp)
38
+ throw new Error("driver « sharp » indisponible (npm install sharp)");
39
+ let pipe = sharp(bytes).rotate(); // respecte l'orientation EXIF avant strip
40
+ if (opts.width || opts.height)
41
+ pipe = pipe.resize({ width: opts.width, height: opts.height, fit: opts.fit ?? "inside", withoutEnlargement: true });
42
+ pipe = applyFormat(pipe, opts.format, opts.quality);
43
+ return new Uint8Array(await pipe.toBuffer());
44
+ },
45
+ async convert(bytes, format, quality) {
46
+ const sharp = await loadSharp();
47
+ if (!sharp)
48
+ throw new Error("driver « sharp » indisponible (npm install sharp)");
49
+ return new Uint8Array(await applyFormat(sharp(bytes), format, quality).toBuffer());
50
+ },
51
+ async cropCenter(bytes, width, height) {
52
+ const sharp = await loadSharp();
53
+ if (!sharp)
54
+ throw new Error("driver « sharp » indisponible (npm install sharp)");
55
+ return new Uint8Array(await sharp(bytes).resize({ width, height, fit: "cover", position: "centre" }).toBuffer());
56
+ },
57
+ async stripExif(bytes) {
58
+ const sharp = await loadSharp();
59
+ if (!sharp)
60
+ throw new Error("driver « sharp » indisponible (npm install sharp)");
61
+ // sharp ne propage PAS les métadonnées par défaut → re-encoder = EXIF supprimé.
62
+ return new Uint8Array(await sharp(bytes).rotate().toBuffer());
63
+ },
64
+ };
65
+ }
66
+ //# sourceMappingURL=sharp-processor.js.map
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @mostajs/image — types du registre de traitement d'image (façon dialectes @mostajs/orm).
3
+ *
4
+ * Deux familles de drivers, toutes OPTIONNELLES (lazy + sonde `available()`), toutes fs-free
5
+ * (octets in → octets out, aucune écriture disque) :
6
+ * • ImageProcessor — manipulation raster (resize/convert/crop/strip-EXIF) — driver « sharp ».
7
+ * • PdfImageExtractor — rendu des pages d'un PDF en images — driver « pdfjs ».
8
+ *
9
+ * La LECTURE de texte dans une image (OCR) est un module séparé : `@mostajs/ocr` (qu'un
10
+ * dialecte compose avec ce module : rendu des pages PDF ici → reconnaissance là-bas).
11
+ *
12
+ * @author Dr Hamid MADANI <drmdh@msn.com>
13
+ * @license AGPL-3.0-or-later
14
+ */
15
+ /** Données binaires d'une image (PNG/JPEG/WebP… selon `format`). */
16
+ export type ImageBytes = Uint8Array;
17
+ /** Formats raster pris en charge en sortie. */
18
+ export type RasterFormat = "png" | "jpeg" | "webp" | "avif";
19
+ /** Métadonnées d'une image. */
20
+ export interface ImageInfo {
21
+ width: number;
22
+ height: number;
23
+ format: string;
24
+ hasAlpha: boolean;
25
+ }
26
+ /** Options de redimensionnement (toutes optionnelles). */
27
+ export interface ResizeOpts {
28
+ width?: number;
29
+ height?: number;
30
+ /** « contain » garde le ratio (défaut), « cover » remplit + recadre, « fill » déforme. */
31
+ fit?: "contain" | "cover" | "fill" | "inside" | "outside";
32
+ /** Qualité 1..100 pour les formats avec perte (jpeg/webp/avif). */
33
+ quality?: number;
34
+ /** Convertir en ce format de sortie (sinon conserve l'entrée). */
35
+ format?: RasterFormat;
36
+ }
37
+ /** Driver de manipulation raster. */
38
+ export interface ImageProcessor {
39
+ readonly name: string;
40
+ /** Le driver sous-jacent est-il chargeable (dépendance présente) ? */
41
+ available(): Promise<boolean>;
42
+ info(bytes: ImageBytes): Promise<ImageInfo>;
43
+ resize(bytes: ImageBytes, opts: ResizeOpts): Promise<ImageBytes>;
44
+ convert(bytes: ImageBytes, format: RasterFormat, quality?: number): Promise<ImageBytes>;
45
+ /** Recadrage centré aux dimensions données. */
46
+ cropCenter(bytes: ImageBytes, width: number, height: number): Promise<ImageBytes>;
47
+ /** Supprime les métadonnées EXIF (vie privée). */
48
+ stripExif(bytes: ImageBytes): Promise<ImageBytes>;
49
+ }
50
+ /** Options de rendu de pages PDF. */
51
+ export interface PdfRenderOpts {
52
+ /** Échelle de rendu (défaut 2 = ~144 dpi, bon compromis OCR). */
53
+ scale?: number;
54
+ /** Limiter au nombre de pages (défaut : toutes). */
55
+ maxPages?: number;
56
+ }
57
+ /** Extracteur d'images d'un PDF (rendu des pages + images embarquées). */
58
+ export interface PdfImageExtractor {
59
+ readonly name: string;
60
+ available(): Promise<boolean>;
61
+ /** Rend chaque page en PNG (pour OCR de PDF scanné, aperçu…). */
62
+ renderPages(pdfBytes: Uint8Array, opts?: PdfRenderOpts): Promise<ImageBytes[]>;
63
+ }
64
+ /** Synthèse des capacités effectivement disponibles sur l'environnement courant. */
65
+ export interface ImageCapabilities {
66
+ process: boolean;
67
+ pdfImages: boolean;
68
+ }
69
+ //# sourceMappingURL=types.d.ts.map
package/dist/types.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @mostajs/image — types du registre de traitement d'image (façon dialectes @mostajs/orm).
3
+ *
4
+ * Deux familles de drivers, toutes OPTIONNELLES (lazy + sonde `available()`), toutes fs-free
5
+ * (octets in → octets out, aucune écriture disque) :
6
+ * • ImageProcessor — manipulation raster (resize/convert/crop/strip-EXIF) — driver « sharp ».
7
+ * • PdfImageExtractor — rendu des pages d'un PDF en images — driver « pdfjs ».
8
+ *
9
+ * La LECTURE de texte dans une image (OCR) est un module séparé : `@mostajs/ocr` (qu'un
10
+ * dialecte compose avec ce module : rendu des pages PDF ici → reconnaissance là-bas).
11
+ *
12
+ * @author Dr Hamid MADANI <drmdh@msn.com>
13
+ * @license AGPL-3.0-or-later
14
+ */
15
+ export {};
16
+ //# sourceMappingURL=types.js.map
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@mostajs/image",
3
+ "version": "0.0.1",
4
+ "description": "Traitement d'image générique façon DIALECTES (@mostajs/orm) : un registre de PROCESSEURS (resize/convert/crop/strip-EXIF — driver Sharp) et d'extracteurs d'images de PDF (rendu des pages — pdfjs-dist + @napi-rs/canvas). Drivers optionnels, lazy + installHint. fs-free (octets in / octets out). L'OCR est le module séparé @mostajs/ocr. Réutilisable.",
5
+ "author": "Dr Hamid MADANI <drmdh@msn.com>",
6
+ "license": "AGPL-3.0-or-later",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist/**/*.js",
19
+ "dist/**/*.d.ts",
20
+ "CHANGELOG.md",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "peerDependencies": {
25
+ "sharp": ">=0.33.0",
26
+ "pdfjs-dist": ">=4.0.0",
27
+ "@napi-rs/canvas": ">=0.1.0"
28
+ },
29
+ "peerDependenciesMeta": {
30
+ "sharp": {
31
+ "optional": true
32
+ },
33
+ "pdfjs-dist": {
34
+ "optional": true
35
+ },
36
+ "@napi-rs/canvas": {
37
+ "optional": true
38
+ }
39
+ },
40
+ "devDependencies": {
41
+ "typescript": "^5.6.0"
42
+ },
43
+ "keywords": [
44
+ "image",
45
+ "sharp",
46
+ "pdf",
47
+ "resize",
48
+ "convert",
49
+ "webp",
50
+ "exif",
51
+ "dialect",
52
+ "mostajs"
53
+ ],
54
+ "scripts": {
55
+ "build": "tsc -p tsconfig.json",
56
+ "test": "node --test test-scripts/"
57
+ }
58
+ }