Skip to content

Commit 6160980

Browse files
committed
Update package exports and browser fields
Renamed and adjusted package.json export paths for consistency, added browser field to disable Node-specific modules, and bumped version to 2.3.9. Minor formatting changes in .vscode/extensions.json and test/pdf_data/image-test.ts. No functional changes to test or config files.
1 parent 0a2f3c1 commit 6160980

File tree

5 files changed

+59
-44
lines changed

5 files changed

+59
-44
lines changed

.vscode/extensions.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
{
2-
"recommendations": [
3-
"vitest.explorer",
4-
"biomejs.biome",
5-
"redhat.vscode-yaml",
6-
"ritwickdey.liveserver"
7-
]
2+
"recommendations": ["vitest.explorer", "biomejs.biome", "redhat.vscode-yaml", "ritwickdey.liveserver"]
83
}

package.json

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "pdf-parse",
3-
"version": "2.3.8",
3+
"version": "2.3.9",
44
"type": "module",
55
"main": "dist/cjs/index.cjs",
66
"module": "dist/esm/index.js",
77
"types": "dist/esm/index.d.ts",
8+
89
"exports": {
910
".": {
1011
"types": "./dist/esm/index.d.ts",
@@ -14,24 +15,26 @@
1415
},
1516
"./node": {
1617
"types": "./dist/esm/index.d.ts",
17-
"default": "./dist/node/index.cjs"
18+
"require": "./dist/node/index.cjs"
1819
},
19-
"./worker_source": {
20+
"./source": {
2021
"types": "./dist/worker/index.d.ts",
2122
"import": "./dist/worker/index.js",
2223
"require": "./dist/worker/index.cjs"
2324
},
24-
"./worker_path": {
25+
"./path": {
2526
"types": "./bin/worker.d.ts",
2627
"import": "./bin/worker.js",
2728
"require": "./bin/worker.cjs"
2829
}
2930
},
31+
3032
"description": "Pure TypeScript, cross-platform module for extracting text, images, and tabular data from PDFs. Run directly in your browser or in Node!",
3133
"homepage": "https://mehmet-kozan.github.io/pdf-parse/",
3234
"bugs": {
3335
"url": "https://github.com/mehmet-kozan/pdf-parse/issues"
3436
},
37+
3538
"keywords": [
3639
"pdf",
3740
"pdf-parse",
@@ -59,10 +62,12 @@
5962
"pdf-reader",
6063
"server-side-pdf-parsing"
6164
],
65+
6266
"repository": {
6367
"type": "git",
6468
"url": "git+https://github.com/mehmet-kozan/pdf-parse.git"
6569
},
70+
6671
"license": "Apache-2.0",
6772
"author": "Mehmet Kozan",
6873
"files": [
@@ -99,12 +104,15 @@
99104
"format:check": "biome check .",
100105
"pack": "npm pack --dry-run"
101106
},
107+
102108
"dependencies": {
103109
"pdfjs-dist": "^5.4.296"
104110
},
111+
105112
"optionalDependencies": {
106113
"@napi-rs/canvas": "^0.1.80"
107114
},
115+
108116
"devDependencies": {
109117
"@biomejs/biome": "^2.2.6",
110118
"@types/node": "^24.7.2",
@@ -117,13 +125,24 @@
117125
"vite-plugin-dts": "^4.5.4",
118126
"vitest": "^3.2.4"
119127
},
128+
120129
"publishConfig": {
121130
"access": "public",
122131
"provenance": true
123132
},
133+
124134
"engines": {
125135
"node": ">=20.16.0 <21 || >=22.3.0"
126136
},
137+
138+
"browser": {
139+
"canvas": false,
140+
"fs": false,
141+
"http": false,
142+
"https": false,
143+
"url": false
144+
},
145+
127146
"jsdelivr": "./dist/browser/pdf-parse.es.min.js",
128147
"unpkg": "./dist/browser/pdf-parse.es.min.js"
129148
}

test/pdf_data/image-test.ts

Lines changed: 3 additions & 2 deletions
Large diffs are not rendered by default.

test_integration/test_browserless/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ async function run() {
5454
}
5555
}
5656

57-
run();
57+
run();

vite.config.worker.ts

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@ import { defineConfig } from 'vite';
22
import dts from 'vite-plugin-dts';
33

44
export default defineConfig({
5-
build: {
6-
outDir: 'dist/worker',
7-
emptyOutDir: false,
8-
sourcemap: false,
9-
minify: false,
10-
target: 'es2022',
11-
lib: {
12-
entry: 'src_worker/index.ts',
13-
name: 'PdfParse',
14-
fileName: (format) => `index.${format === 'es' ? 'js' : 'cjs'}`,
15-
formats: ['es', 'cjs'],
16-
},
17-
},
18-
plugins: [
19-
dts({
20-
tsconfigPath: undefined, // tsconfig’tan include alma
21-
entryRoot: 'src_worker',
22-
outDir: 'dist/worker',
23-
include: ['src_worker/**/*.ts'], // sadece worker tipleri
24-
exclude: ['src/**', 'dist/**', 'test/**', 'node_modules/**'],
25-
insertTypesEntry: true,
26-
rollupTypes: false,
27-
compilerOptions: {
28-
declaration: true,
29-
emitDeclarationOnly: true,
30-
declarationMap: false,
31-
rootDir: 'src_worker',
32-
outDir: 'dist/worker',
33-
},
34-
}),
35-
],
5+
build: {
6+
outDir: 'dist/worker',
7+
emptyOutDir: false,
8+
sourcemap: false,
9+
minify: false,
10+
target: 'es2022',
11+
lib: {
12+
entry: 'src_worker/index.ts',
13+
name: 'PdfParse',
14+
fileName: (format) => `index.${format === 'es' ? 'js' : 'cjs'}`,
15+
formats: ['es', 'cjs'],
16+
},
17+
},
18+
plugins: [
19+
dts({
20+
tsconfigPath: undefined, // tsconfig’tan include alma
21+
entryRoot: 'src_worker',
22+
outDir: 'dist/worker',
23+
include: ['src_worker/**/*.ts'], // sadece worker tipleri
24+
exclude: ['src/**', 'dist/**', 'test/**', 'node_modules/**'],
25+
insertTypesEntry: true,
26+
rollupTypes: false,
27+
compilerOptions: {
28+
declaration: true,
29+
emitDeclarationOnly: true,
30+
declarationMap: false,
31+
rootDir: 'src_worker',
32+
outDir: 'dist/worker',
33+
},
34+
}),
35+
],
3636
});

0 commit comments

Comments
 (0)