fix: babel evt-polyfill

fix: worker paths
fix: wasm paths
This commit is contained in:
ThaUnknown 2023-03-16 15:37:30 +01:00
parent 8848b75be0
commit a73b691653
4 changed files with 46 additions and 29 deletions

1
package-lock.json generated
View file

@ -25,6 +25,7 @@
"dompurify": "3.0.1", "dompurify": "3.0.1",
"epubjs": "0.4.2", "epubjs": "0.4.2",
"escape-html": "1.0.3", "escape-html": "1.0.3",
"event-target-polyfill": "0.0.3",
"fast-text-encoding": "1.0.6", "fast-text-encoding": "1.0.6",
"flv.js": "1.6.2", "flv.js": "1.6.2",
"headroom.js": "0.12.0", "headroom.js": "0.12.0",

View file

@ -84,6 +84,7 @@
"dompurify": "3.0.1", "dompurify": "3.0.1",
"epubjs": "0.4.2", "epubjs": "0.4.2",
"escape-html": "1.0.3", "escape-html": "1.0.3",
"event-target-polyfill": "0.0.3",
"fast-text-encoding": "1.0.6", "fast-text-encoding": "1.0.6",
"flv.js": "1.6.2", "flv.js": "1.6.2",
"headroom.js": "0.12.0", "headroom.js": "0.12.0",

View file

@ -1270,10 +1270,11 @@ function tryRemoveElement(elem) {
fonts: avaliableFonts, fonts: avaliableFonts,
fallbackFont: 'liberation sans', fallbackFont: 'liberation sans',
availableFonts: {'liberation sans': `${appRouter.baseUrl()}/libraries/default.woff2`}, availableFonts: {'liberation sans': `${appRouter.baseUrl()}/libraries/default.woff2`},
// Disabled eslint compat, but is safe as corejs3 polyfills URL
// eslint-disable-next-line compat/compat // eslint-disable-next-line compat/compat
workerUrl: `${appRouter.baseUrl()}/${new URL('jassub/dist/jassub-worker.js', import.meta.url)}`, workerUrl: `${appRouter.baseUrl()}${new URL('jassub/dist/jassub-worker.js', import.meta.url).pathname}`,
// eslint-disable-next-line compat/compat // eslint-disable-next-line compat/compat
legacyWorkerUrl: `${appRouter.baseUrl()}/${new URL('jassub/dist/jassub-worker-legacy.js', import.meta.url)}`, legacyWorkerUrl: `${appRouter.baseUrl()}${new URL('jassub/dist/jassub-worker-legacy.js', import.meta.url).pathname}`,
timeOffset: (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000, timeOffset: (this._currentPlayOptions.transcodingOffsetTicks || 0) / 10000000,
// new jassub options; override all, even defaults // new jassub options; override all, even defaults
blendMode: 'js', blendMode: 'js',
@ -1290,6 +1291,7 @@ function tryRemoveElement(elem) {
prescaleHeightLimit: 1080, prescaleHeightLimit: 1080,
maxRenderHeight: 2160 maxRenderHeight: 2160
}; };
import('event-target-polyfill').then(() => {
import('jassub').then(({ default: JASSUB }) => { import('jassub').then(({ default: JASSUB }) => {
Promise.all([ Promise.all([
apiClient.getNamedConfiguration('encoding'), apiClient.getNamedConfiguration('encoding'),
@ -1323,6 +1325,7 @@ function tryRemoveElement(elem) {
} }
}); });
}); });
});
} }
/** /**

View file

@ -8,10 +8,13 @@ const { DefinePlugin } = require('webpack');
const Assets = [ const Assets = [
'native-promise-only/npo.js', 'native-promise-only/npo.js',
'libarchive.js/dist/worker-bundle.js', 'libarchive.js/dist/worker-bundle.js',
'pdfjs-dist/build/pdf.worker.js'
];
const JassubWasm = [
'jassub/dist/jassub-worker.wasm', 'jassub/dist/jassub-worker.wasm',
'jassub/dist/jassub-worker-legacy.mem', 'jassub/dist/jassub-worker-legacy.mem',
'jassub/dist/default.woff2', 'jassub/dist/default.woff2'
'pdfjs-dist/build/pdf.worker.js'
]; ];
const LibarchiveWasm = [ const LibarchiveWasm = [
@ -80,6 +83,14 @@ const config = {
to: path.resolve(__dirname, './dist/libraries/wasm-gen') to: path.resolve(__dirname, './dist/libraries/wasm-gen')
}; };
}) })
}),
new CopyPlugin({
patterns: JassubWasm.map(asset => {
return {
from: path.resolve(__dirname, `./node_modules/${asset}`),
to: path.resolve(__dirname, './dist')
};
})
}) })
], ],
output: { output: {
@ -144,6 +155,7 @@ const config = {
{ {
test: /\.(js|jsx)$/, test: /\.(js|jsx)$/,
include: [ include: [
path.resolve(__dirname, 'node_modules/event-target-polyfill'),
path.resolve(__dirname, 'node_modules/rvfc-polyfill'), path.resolve(__dirname, 'node_modules/rvfc-polyfill'),
path.resolve(__dirname, 'node_modules/@jellyfin/sdk'), path.resolve(__dirname, 'node_modules/@jellyfin/sdk'),
path.resolve(__dirname, 'node_modules/@remix-run/router'), path.resolve(__dirname, 'node_modules/@remix-run/router'),