Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replaced resolve-url dependency per #773 (#774)
  • Loading branch information
Balearica committed Jun 2, 2023
1 parent a5f10d8 commit fd1c8b2
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 18 deletions.
12 changes: 0 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -70,7 +70,6 @@
"node-fetch": "^2.6.9",
"opencollective-postinstall": "^2.0.3",
"regenerator-runtime": "^0.13.3",
"resolve-url": "^0.2.1",
"tesseract.js-core": "^4.0.4",
"wasm-feature-detect": "^1.2.11",
"zlibjs": "^0.3.1"
Expand Down
3 changes: 2 additions & 1 deletion src/utils/resolvePaths.js
@@ -1,5 +1,6 @@
const isBrowser = require('./getEnvironment')('type') === 'browser';
const resolveURL = isBrowser ? require('resolve-url') : s => s; // eslint-disable-line

const resolveURL = isBrowser ? s => (new URL(s, window.location.href)).href : s => s; // eslint-disable-line

module.exports = (options) => {
const opts = { ...options };
Expand Down
2 changes: 1 addition & 1 deletion src/worker/browser/defaultOptions.js
@@ -1,4 +1,4 @@
const resolveURL = require('resolve-url');
const resolveURL = (s) => (new URL(s, window.location.href)).href;
const { version } = require('../../../package.json');
const defaultOptions = require('../../constants/defaultOptions');

Expand Down
4 changes: 1 addition & 3 deletions src/worker/browser/loadImage.js
@@ -1,5 +1,3 @@
const resolveURL = require('resolve-url');

/**
* readFromBlobOrFile
*
Expand Down Expand Up @@ -40,7 +38,7 @@ const loadImage = async (image) => {
.split('')
.map((c) => c.charCodeAt(0));
} else {
const resp = await fetch(resolveURL(image));
const resp = await fetch(image);
data = await resp.arrayBuffer();
}
} else if (typeof HTMLElement !== 'undefined' && image instanceof HTMLElement) {
Expand Down

0 comments on commit fd1c8b2

Please sign in to comment.