-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: resolve PDF.js build for browser context
- Loading branch information
1 parent
66a2fc7
commit 325d450
Showing
9 changed files
with
88 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
export * from './text' | ||
export * from './image' | ||
import { decodePDFText as _decodePDFText } from './text' | ||
import { getImagesFromPage as _getImagesFromPage } from './image' | ||
import { resolvePDFJSNodeImports } from './utils' | ||
|
||
export const decodePDFText: typeof _decodePDFText = async (...args) => { | ||
await resolvePDFJSNodeImports() | ||
return await _decodePDFText(...args) | ||
} | ||
|
||
export const getImagesFromPage: typeof _getImagesFromPage = async (...args) => { | ||
await resolvePDFJSNodeImports() | ||
return await _getImagesFromPage(...args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import type { | ||
decodePDFText as _decodePDFText, | ||
getImagesFromPage as _getImagesFromPage, | ||
} from './index.node' | ||
import { decodePDFText as _decodePDFText } from './text' | ||
import { getImagesFromPage as _getImagesFromPage } from './image' | ||
import { resolvePDFJSWebImports } from './utils' | ||
|
||
export const decodePDFText: typeof _decodePDFText = async () => { | ||
throw new Error('Not supported in browser context yet') | ||
export const decodePDFText: typeof _decodePDFText = async (...args) => { | ||
await resolvePDFJSWebImports() | ||
return await _decodePDFText(...args) | ||
} | ||
|
||
export const getImagesFromPage: typeof _getImagesFromPage = async () => { | ||
throw new Error('Not supported in browser context yet') | ||
export const getImagesFromPage: typeof _getImagesFromPage = async (...args) => { | ||
await resolvePDFJSWebImports() | ||
return await _getImagesFromPage(...args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { decodePDFText as _decodePDFText } from './text' | ||
import type { getImagesFromPage as _getImagesFromPage } from './image' | ||
|
||
export const decodePDFText: typeof _decodePDFText = async () => { | ||
throw new Error('Not implemented in worker context yet') | ||
} | ||
|
||
export const getImagesFromPage: typeof _getImagesFromPage = async () => { | ||
throw new Error('Not implemented in worker context yet') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters