Updated require statements to reduce file size per #847 (#848)

* Updated types to support all parameters per #831

* Updated require statements to reduce file size per #847
master
Balearica 11 months ago committed by GitHub
parent 680d2e4e01
commit ac60509c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .eslintrc
  2. 4
      src/worker-script/browser/getCore.js
  3. 2
      src/worker/browser/defaultOptions.js

@ -15,6 +15,9 @@
"no-control-regex": 0, "no-control-regex": 0,
// Airbnb disallows ForOfStatement based on the bizarre belief that loops are not readable // Airbnb disallows ForOfStatement based on the bizarre belief that loops are not readable
// https://github.com/airbnb/javascript/issues/1271 // 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
} }
} }

@ -1,5 +1,5 @@
const { simd } = require('wasm-feature-detect'); 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) => { module.exports = async (lstmOnly, corePath, res) => {
if (typeof global.TesseractCore === 'undefined') { if (typeof global.TesseractCore === 'undefined') {
@ -9,7 +9,7 @@ module.exports = async (lstmOnly, corePath, res) => {
// If the user specifies a core path, we use that // If the user specifies a core path, we use that
// Otherwise, default to CDN // 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. // If a user specifies a specific JavaScript file, load that file.
// Otherwise, assume a directory has been provided, and load either // Otherwise, assume a directory has been provided, and load either

@ -1,4 +1,4 @@
const { version } = require('../../../package.json'); const version = require('../../../package.json').version;
const defaultOptions = require('../../constants/defaultOptions'); const defaultOptions = require('../../constants/defaultOptions');
/* /*

Loading…
Cancel
Save