Skip to content

Commit

Permalink
Updated require statements to reduce file size per #847 (#848)
Browse files Browse the repository at this point in the history
* Updated types to support all parameters per #831

* Updated require statements to reduce file size per #847
  • Loading branch information
Balearica committed Oct 29, 2023
1 parent 680d2e4 commit ac60509
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"no-control-regex": 0,
// Airbnb disallows ForOfStatement based on the bizarre belief that loops are not readable
// https://github.com/airbnb/javascript/issues/1271
"no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"]
"no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"],
// The `prefer-destructuring` rule causes issues
// https://github.com/naptha/tesseract.js/issues/847
"prefer-destructuring": 0
}
}
4 changes: 2 additions & 2 deletions src/worker-script/browser/getCore.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { simd } = require('wasm-feature-detect');
const { dependencies } = require('../../../package.json');
const coreVersion = require('../../../package.json').dependencies['tesseract.js-core'];

module.exports = async (lstmOnly, corePath, res) => {
if (typeof global.TesseractCore === 'undefined') {
Expand All @@ -9,7 +9,7 @@ module.exports = async (lstmOnly, corePath, res) => {

// If the user specifies a core path, we use that
// Otherwise, default to CDN
const corePathImport = corePath || `https://cdn.jsdelivr.net/npm/tesseract.js-core@v${dependencies['tesseract.js-core'].substring(1)}`;
const corePathImport = corePath || `https://cdn.jsdelivr.net/npm/tesseract.js-core@v${coreVersion.substring(1)}`;

// If a user specifies a specific JavaScript file, load that file.
// Otherwise, assume a directory has been provided, and load either
Expand Down
2 changes: 1 addition & 1 deletion src/worker/browser/defaultOptions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { version } = require('../../../package.json');
const version = require('../../../package.json').version;
const defaultOptions = require('../../constants/defaultOptions');

/*
Expand Down

0 comments on commit ac60509

Please sign in to comment.