@vertesia/converters 1.6.0-dev.20260923.085325Z → 1.6.0-dev.20261004.085740Z
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/package.json +6 -5
- package/src/image.test.ts +0 -23
- package/src/mutool.test.ts +0 -12
- package/src/pandoc.test.ts +0 -12
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/converters",
|
|
3
|
-
"version": "1.6.0-dev.
|
|
3
|
+
"version": "1.6.0-dev.20261004.085740Z",
|
|
4
4
|
"description": "Image and content converters",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"lib",
|
|
10
|
-
"src"
|
|
10
|
+
"src",
|
|
11
|
+
"!src/**/*.test.*"
|
|
11
12
|
],
|
|
12
13
|
"license": "Apache-2.0",
|
|
13
14
|
"exports": {
|
|
@@ -42,13 +43,13 @@
|
|
|
42
43
|
"mutool",
|
|
43
44
|
"typescript"
|
|
44
45
|
],
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "b51b6dc9262f81f55e2424d1e57190060f6068d7",
|
|
46
47
|
"scripts": {
|
|
47
48
|
"lint": "biome lint src",
|
|
48
49
|
"test": "vitest run",
|
|
49
|
-
"typecheck:test": "tsc -p tsconfig.test.json --noEmit",
|
|
50
|
+
"typecheck:test": "tsc --checkers 1 -p tsconfig.test.json --noEmit",
|
|
50
51
|
"clean:lib": "rimraf ./lib ./tsconfig.tsbuildinfo",
|
|
51
|
-
"build": "pnpm run clean:lib && tsc -p tsconfig.json",
|
|
52
|
+
"build": "pnpm run clean:lib && tsc --checkers 1 -p tsconfig.json",
|
|
52
53
|
"clean": "rimraf ./node_modules ./lib ./tsconfig.tsbuildinfo"
|
|
53
54
|
}
|
|
54
55
|
}
|
package/src/image.test.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import sharp, { type FormatEnum } from 'sharp';
|
|
4
|
-
import { expect, test } from 'vitest';
|
|
5
|
-
import { createImageTransformer } from './image.js';
|
|
6
|
-
|
|
7
|
-
test('should resize an image to a maximum height or width', async () => {
|
|
8
|
-
const max_hw = 1596;
|
|
9
|
-
const format: keyof FormatEnum = 'jpeg';
|
|
10
|
-
const imageFile = fs.readFileSync(path.join(__dirname, '../fixtures', 'cat-picture.jpg'));
|
|
11
|
-
|
|
12
|
-
const sh = createImageTransformer(imageFile, { max_hw, format });
|
|
13
|
-
|
|
14
|
-
const buffer = await sh.toBuffer();
|
|
15
|
-
const metadata = await sharp(buffer).metadata();
|
|
16
|
-
|
|
17
|
-
console.log(metadata);
|
|
18
|
-
//await sh.toFile('./cat-picture.jpg');
|
|
19
|
-
|
|
20
|
-
expect(metadata.width).to.be.lessThanOrEqual(max_hw);
|
|
21
|
-
expect(metadata.height).to.be.lessThanOrEqual(max_hw);
|
|
22
|
-
expect(metadata.format).to.equal(format);
|
|
23
|
-
});
|
package/src/mutool.test.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { expect, test } from 'vitest';
|
|
4
|
-
import { pdfToText } from './mutool.js';
|
|
5
|
-
|
|
6
|
-
test('[mutool] should convert pdf to text', async () => {
|
|
7
|
-
const pdf = fs.readFileSync(path.join(__dirname, '../fixtures', 'test-pdf2.pdf'));
|
|
8
|
-
const buf = Buffer.from(pdf);
|
|
9
|
-
console.log('Running mutoolPdfToText');
|
|
10
|
-
const result: string = await pdfToText(buf);
|
|
11
|
-
expect(result).toContain('its attentive Ambassadors');
|
|
12
|
-
});
|
package/src/pandoc.test.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { Readable } from 'node:stream';
|
|
4
|
-
import { expect, test } from 'vitest';
|
|
5
|
-
import { manyToMarkdown } from './pandoc.js';
|
|
6
|
-
|
|
7
|
-
// Add more test cases for other file types (ODT, DOCX) if needed
|
|
8
|
-
test('should convert docx to markdown', async () => {
|
|
9
|
-
const docx: Buffer = fs.readFileSync(path.join(__dirname, '../fixtures', 'us-ciia.docx'));
|
|
10
|
-
const result = await manyToMarkdown(Readable.from(docx), 'docx');
|
|
11
|
-
expect(result).to.include('confidential');
|
|
12
|
-
});
|