diff --git a/.escheckrc b/.escheckrc index 195d28b9fc..37003a295a 100644 --- a/.escheckrc +++ b/.escheckrc @@ -5,7 +5,6 @@ "not": [ "./dist/libraries/pdf.worker.js", "./dist/libraries/worker-bundle.js", - "./dist/libraries/wasm-gen/libarchive.js", "./dist/serviceworker.js" ] } diff --git a/package-lock.json b/package-lock.json index 5970722aea..4583404f5e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "jellyfin-apiclient": "1.11.0", "jquery": "3.7.1", "jstree": "3.3.16", - "libarchive.js": "1.3.0", + "libarchive.js": "2.0.2", "lodash-es": "4.17.21", "markdown-it": "14.1.0", "material-design-icons-iconfont": "6.7.0", @@ -8805,6 +8805,12 @@ "node": ">= 0.8" } }, + "node_modules/comlink": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/comlink/-/comlink-4.4.1.tgz", + "integrity": "sha512-+1dlx0aY5Jo1vHy/tSsIGpSkN4tS9rZSW8FIhG0JH/crs9wwweswIo/POr451r7bZww3hFbPAKnTpimzL/mm4Q==", + "license": "Apache-2.0" + }, "node_modules/commander": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", @@ -14969,9 +14975,13 @@ } }, "node_modules/libarchive.js": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/libarchive.js/-/libarchive.js-1.3.0.tgz", - "integrity": "sha512-EkQfRXt9DhWwj6BnEA2TNpOf4jTnzSTUPGgE+iFxcdNqjktY8GitbDeHnx8qZA0/IukNyyBUR3oQKRdYkO+HFg==" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/libarchive.js/-/libarchive.js-2.0.2.tgz", + "integrity": "sha512-JHb+P4suNSjvz/dMdRgOe7JAxluXJeialzSFkKHU5y0ZK+m175drPOaIYW6I9WXSDcPcQ13eCUgMnpgY0ggmoQ==", + "license": "MIT", + "dependencies": { + "comlink": "^4.4.1" + } }, "node_modules/lie": { "version": "3.1.1", @@ -32076,6 +32086,11 @@ "delayed-stream": "~1.0.0" } }, + "comlink": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/comlink/-/comlink-4.4.1.tgz", + "integrity": "sha512-+1dlx0aY5Jo1vHy/tSsIGpSkN4tS9rZSW8FIhG0JH/crs9wwweswIo/POr451r7bZww3hFbPAKnTpimzL/mm4Q==" + }, "commander": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", @@ -36528,9 +36543,12 @@ } }, "libarchive.js": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/libarchive.js/-/libarchive.js-1.3.0.tgz", - "integrity": "sha512-EkQfRXt9DhWwj6BnEA2TNpOf4jTnzSTUPGgE+iFxcdNqjktY8GitbDeHnx8qZA0/IukNyyBUR3oQKRdYkO+HFg==" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/libarchive.js/-/libarchive.js-2.0.2.tgz", + "integrity": "sha512-JHb+P4suNSjvz/dMdRgOe7JAxluXJeialzSFkKHU5y0ZK+m175drPOaIYW6I9WXSDcPcQ13eCUgMnpgY0ggmoQ==", + "requires": { + "comlink": "^4.4.1" + } }, "lie": { "version": "3.1.1", diff --git a/package.json b/package.json index 46210e6430..c1118dcf38 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "jellyfin-apiclient": "1.11.0", "jquery": "3.7.1", "jstree": "3.3.16", - "libarchive.js": "1.3.0", + "libarchive.js": "2.0.2", "lodash-es": "4.17.21", "markdown-it": "14.1.0", "material-design-icons-iconfont": "6.7.0", diff --git a/src/plugins/comicsPlayer/plugin.js b/src/plugins/comicsPlayer/plugin.js index dd0f77da60..172355e2f0 100644 --- a/src/plugins/comicsPlayer/plugin.js +++ b/src/plugins/comicsPlayer/plugin.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line import/named, import/namespace import { Archive } from 'libarchive.js'; import loading from '../../components/loading/loading'; import dialogHelper from '../../components/dialogHelper/dialogHelper'; diff --git a/webpack.common.js b/webpack.common.js index 734343813d..b58058f53f 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -4,12 +4,13 @@ const CopyPlugin = require('copy-webpack-plugin'); const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const { DefinePlugin } = require('webpack'); +const { DefinePlugin, IgnorePlugin } = require('webpack'); const packageJson = require('./package.json'); const Assets = [ 'native-promise-only/npo.js', 'libarchive.js/dist/worker-bundle.js', + 'libarchive.js/dist/libarchive.wasm', '@jellyfin/libass-wasm/dist/js/default.woff2', '@jellyfin/libass-wasm/dist/js/subtitles-octopus-worker.js', '@jellyfin/libass-wasm/dist/js/subtitles-octopus-worker.wasm', @@ -17,11 +18,6 @@ const Assets = [ 'pdfjs-dist/build/pdf.worker.js' ]; -const LibarchiveWasm = [ - 'libarchive.js/dist/wasm-gen/libarchive.js', - 'libarchive.js/dist/wasm-gen/libarchive.wasm' -]; - const DEV_MODE = process.env.NODE_ENV !== 'production'; let COMMIT_SHA = ''; try { @@ -103,13 +99,11 @@ const config = { }; }) }), - new CopyPlugin({ - patterns: LibarchiveWasm.map(asset => { - return { - from: path.resolve(__dirname, `./node_modules/${asset}`), - to: path.resolve(__dirname, './dist/libraries/wasm-gen') - }; - }) + // The libarchive.js worker-bundle is copied manually. + // If it is automatically bundled, escheck will fail since it uses import.meta.url. + new IgnorePlugin({ + resourceRegExp: /worker-bundle\.js$/, + contextRegExp: /libarchive.js/ }), new ForkTsCheckerWebpackPlugin({ typescript: {