mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Remove pdfjs-dist split test
GitOrigin-RevId: 39c8a54921c2b541a5bbe3670e1baa6fd9d5f745
This commit is contained in:
parent
90904e876c
commit
5e7f4feeb8
7 changed files with 49 additions and 165 deletions
74
package-lock.json
generated
74
package-lock.json
generated
|
@ -31585,26 +31585,7 @@
|
||||||
"resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
|
||||||
"integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10="
|
"integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10="
|
||||||
},
|
},
|
||||||
"node_modules/pdfjs-dist213": {
|
"node_modules/pdfjs-dist": {
|
||||||
"name": "pdfjs-dist",
|
|
||||||
"version": "2.13.216",
|
|
||||||
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.13.216.tgz",
|
|
||||||
"integrity": "sha512-qn/9a/3IHIKZarTK6ajeeFXBkG15Lg1Fx99PxU09PAU2i874X8mTcHJYyDJxu7WDfNhV6hM7bRQBZU384anoqQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"web-streams-polyfill": "^3.2.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"worker-loader": "^3.0.8"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"worker-loader": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/pdfjs-dist401": {
|
|
||||||
"name": "pdfjs-dist",
|
|
||||||
"version": "4.5.136",
|
"version": "4.5.136",
|
||||||
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-4.5.136.tgz",
|
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-4.5.136.tgz",
|
||||||
"integrity": "sha512-V1BALcAN/FmxBEShLxoP73PlQZAZtzlaNfRbRhJrKvXzjLC5VaIlBAQUJuWP8iaYUmIdmdLHmt3E2TBglxOm3w==",
|
"integrity": "sha512-V1BALcAN/FmxBEShLxoP73PlQZAZtzlaNfRbRhJrKvXzjLC5VaIlBAQUJuWP8iaYUmIdmdLHmt3E2TBglxOm3w==",
|
||||||
|
@ -40806,28 +40787,6 @@
|
||||||
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
|
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/worker-loader": {
|
|
||||||
"version": "3.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-3.0.8.tgz",
|
|
||||||
"integrity": "sha512-XQyQkIFeRVC7f7uRhFdNMe/iJOdO6zxAaR3EWbDp45v3mDhrTi+++oswKNxShUNjPC/1xUp5DB29YKLhFo129g==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
|
||||||
"loader-utils": "^2.0.0",
|
|
||||||
"schema-utils": "^3.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10.13.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/webpack"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"webpack": "^4.0.0 || ^5.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/workerpool": {
|
"node_modules/workerpool": {
|
||||||
"version": "6.2.1",
|
"version": "6.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
|
||||||
|
@ -43979,8 +43938,7 @@
|
||||||
"mock-fs": "^5.1.2",
|
"mock-fs": "^5.1.2",
|
||||||
"nvd3": "^1.8.6",
|
"nvd3": "^1.8.6",
|
||||||
"overleaf-editor-core": "*",
|
"overleaf-editor-core": "*",
|
||||||
"pdfjs-dist213": "npm:pdfjs-dist@2.13.216",
|
"pdfjs-dist": "4.5.136",
|
||||||
"pdfjs-dist401": "npm:pdfjs-dist@4.5.136",
|
|
||||||
"pirates": "^4.0.1",
|
"pirates": "^4.0.1",
|
||||||
"postcss": "^8.4.31",
|
"postcss": "^8.4.31",
|
||||||
"postcss-loader": "^7.3.3",
|
"postcss-loader": "^7.3.3",
|
||||||
|
@ -52539,8 +52497,7 @@
|
||||||
"passport-local": "^1.0.0",
|
"passport-local": "^1.0.0",
|
||||||
"passport-oauth2": "^1.5.0",
|
"passport-oauth2": "^1.5.0",
|
||||||
"passport-orcid": "0.0.4",
|
"passport-orcid": "0.0.4",
|
||||||
"pdfjs-dist213": "npm:pdfjs-dist@2.13.216",
|
"pdfjs-dist": "4.5.136",
|
||||||
"pdfjs-dist401": "npm:pdfjs-dist@4.5.136",
|
|
||||||
"pirates": "^4.0.1",
|
"pirates": "^4.0.1",
|
||||||
"postcss": "^8.4.31",
|
"postcss": "^8.4.31",
|
||||||
"postcss-loader": "^7.3.3",
|
"postcss-loader": "^7.3.3",
|
||||||
|
@ -72104,17 +72061,8 @@
|
||||||
"resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
|
||||||
"integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10="
|
"integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10="
|
||||||
},
|
},
|
||||||
"pdfjs-dist213": {
|
"pdfjs-dist": {
|
||||||
"version": "npm:pdfjs-dist@2.13.216",
|
"version": "4.5.136",
|
||||||
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.13.216.tgz",
|
|
||||||
"integrity": "sha512-qn/9a/3IHIKZarTK6ajeeFXBkG15Lg1Fx99PxU09PAU2i874X8mTcHJYyDJxu7WDfNhV6hM7bRQBZU384anoqQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"web-streams-polyfill": "^3.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pdfjs-dist401": {
|
|
||||||
"version": "npm:pdfjs-dist@4.5.136",
|
|
||||||
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-4.5.136.tgz",
|
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-4.5.136.tgz",
|
||||||
"integrity": "sha512-V1BALcAN/FmxBEShLxoP73PlQZAZtzlaNfRbRhJrKvXzjLC5VaIlBAQUJuWP8iaYUmIdmdLHmt3E2TBglxOm3w==",
|
"integrity": "sha512-V1BALcAN/FmxBEShLxoP73PlQZAZtzlaNfRbRhJrKvXzjLC5VaIlBAQUJuWP8iaYUmIdmdLHmt3E2TBglxOm3w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
@ -78824,18 +78772,6 @@
|
||||||
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
|
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"worker-loader": {
|
|
||||||
"version": "3.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-3.0.8.tgz",
|
|
||||||
"integrity": "sha512-XQyQkIFeRVC7f7uRhFdNMe/iJOdO6zxAaR3EWbDp45v3mDhrTi+++oswKNxShUNjPC/1xUp5DB29YKLhFo129g==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
|
||||||
"peer": true,
|
|
||||||
"requires": {
|
|
||||||
"loader-utils": "^2.0.0",
|
|
||||||
"schema-utils": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"workerpool": {
|
"workerpool": {
|
||||||
"version": "6.2.1",
|
"version": "6.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
|
||||||
|
|
|
@ -330,7 +330,6 @@ const _ProjectController = {
|
||||||
'pdf-caching-prefetch-large',
|
'pdf-caching-prefetch-large',
|
||||||
'pdf-caching-prefetching',
|
'pdf-caching-prefetching',
|
||||||
'pdf-presentation-mode',
|
'pdf-presentation-mode',
|
||||||
'pdfjs-40',
|
|
||||||
'revert-file',
|
'revert-file',
|
||||||
'revert-project',
|
'revert-project',
|
||||||
'review-panel-redesign',
|
'review-panel-redesign',
|
||||||
|
@ -734,7 +733,6 @@ const _ProjectController = {
|
||||||
wsUrl,
|
wsUrl,
|
||||||
showSupport: Features.hasFeature('support'),
|
showSupport: Features.hasFeature('support'),
|
||||||
showTemplatesServerPro,
|
showTemplatesServerPro,
|
||||||
pdfjsVariant: splitTestAssignments['pdfjs-40'].variant,
|
|
||||||
debugPdfDetach,
|
debugPdfDetach,
|
||||||
showSymbolPalette,
|
showSymbolPalette,
|
||||||
symbolPaletteAvailable: Features.hasFeature('symbol-palette'),
|
symbolPaletteAvailable: Features.hasFeature('symbol-palette'),
|
||||||
|
|
|
@ -17,7 +17,6 @@ meta(name="ol-compilesUserContentDomain" content=settings.compilesUserContentDom
|
||||||
meta(name="ol-useShareJsHash" data-type="boolean" content=true)
|
meta(name="ol-useShareJsHash" data-type="boolean" content=true)
|
||||||
meta(name="ol-wsUrl" data-type="string" content=wsUrl)
|
meta(name="ol-wsUrl" data-type="string" content=wsUrl)
|
||||||
meta(name="ol-wsRetryHandshake" data-type="json" content=settings.wsRetryHandshake)
|
meta(name="ol-wsRetryHandshake" data-type="json" content=settings.wsRetryHandshake)
|
||||||
meta(name="ol-pdfjsVariant" content=pdfjsVariant)
|
|
||||||
meta(name="ol-debugPdfDetach" data-type="boolean" content=debugPdfDetach)
|
meta(name="ol-debugPdfDetach" data-type="boolean" content=debugPdfDetach)
|
||||||
meta(name="ol-showSymbolPalette" data-type="boolean" content=showSymbolPalette)
|
meta(name="ol-showSymbolPalette" data-type="boolean" content=showSymbolPalette)
|
||||||
meta(name="ol-symbolPaletteAvailable" data-type="boolean" content=symbolPaletteAvailable)
|
meta(name="ol-symbolPaletteAvailable" data-type="boolean" content=symbolPaletteAvailable)
|
||||||
|
|
|
@ -41,8 +41,7 @@ const buildConfig = () => {
|
||||||
)
|
)
|
||||||
|
|
||||||
// add entrypoints under '/' for pdfjs workers
|
// add entrypoints under '/' for pdfjs workers
|
||||||
addWorker('pdfjs-dist213', 'pdfjs-dist213/legacy/build/pdf.worker.js')
|
addWorker('pdfjs-dist', 'pdfjs-dist/legacy/build/pdf.worker.mjs')
|
||||||
addWorker('pdfjs-dist401', 'pdfjs-dist401/legacy/build/pdf.worker.mjs')
|
|
||||||
|
|
||||||
return webpackConfig
|
return webpackConfig
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,76 +5,33 @@ import 'core-js/stable/global-this' // polyfill for globalThis (used by pdf.js)
|
||||||
import 'core-js/stable/promise/all-settled' // polyfill for Promise.allSettled (used by pdf.js)
|
import 'core-js/stable/promise/all-settled' // polyfill for Promise.allSettled (used by pdf.js)
|
||||||
import 'core-js/stable/structured-clone' // polyfill for global.StructuredClone (used by pdf.js)
|
import 'core-js/stable/structured-clone' // polyfill for global.StructuredClone (used by pdf.js)
|
||||||
import 'core-js/stable/array/at' // polyfill for Array.prototype.at (used by pdf.js)
|
import 'core-js/stable/array/at' // polyfill for Array.prototype.at (used by pdf.js)
|
||||||
import getMeta from '@/utils/meta'
|
|
||||||
import { createWorker } from '@/utils/worker'
|
import { createWorker } from '@/utils/worker'
|
||||||
|
|
||||||
async function importPDFJS401() {
|
|
||||||
const cMapUrl = '/js/pdfjs-dist401/cmaps/'
|
|
||||||
const standardFontDataUrl = '/fonts/pdfjs-dist401/'
|
|
||||||
const imageResourcesPath = '/images/pdfjs-dist401/'
|
|
||||||
|
|
||||||
// ensure that PDF.js is loaded before importing the viewer
|
|
||||||
const PDFJS = await import('pdfjs-dist401/legacy/build/pdf')
|
|
||||||
|
|
||||||
const [PDFJSViewer] = await Promise.all([
|
|
||||||
import('pdfjs-dist401/legacy/web/pdf_viewer'),
|
|
||||||
import('pdfjs-dist401/legacy/web/pdf_viewer.css'),
|
|
||||||
])
|
|
||||||
|
|
||||||
createWorker(() => {
|
|
||||||
PDFJS.GlobalWorkerOptions.workerPort = new Worker(
|
|
||||||
new URL('pdfjs-dist401/legacy/build/pdf.worker.mjs', import.meta.url) // NOTE: .mjs extension
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
|
||||||
PDFJS,
|
|
||||||
PDFJSViewer,
|
|
||||||
cMapUrl,
|
|
||||||
imageResourcesPath,
|
|
||||||
standardFontDataUrl,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function importPDFJS213() {
|
|
||||||
const cMapUrl = '/js/pdfjs-dist213/cmaps/'
|
|
||||||
const standardFontDataUrl = '/fonts/pdfjs-dist213/'
|
|
||||||
const imageResourcesPath = '/images/pdfjs-dist213/'
|
|
||||||
|
|
||||||
// ensure that PDF.js is loaded before importing the viewer
|
|
||||||
const PDFJS = await import('pdfjs-dist213/legacy/build/pdf')
|
|
||||||
|
|
||||||
const [PDFJSViewer] = await Promise.all([
|
|
||||||
import('pdfjs-dist213/legacy/web/pdf_viewer'),
|
|
||||||
import('pdfjs-dist213/legacy/web/pdf_viewer.css'),
|
|
||||||
])
|
|
||||||
|
|
||||||
createWorker(() => {
|
|
||||||
PDFJS.GlobalWorkerOptions.workerPort = new Worker(
|
|
||||||
new URL('pdfjs-dist213/legacy/build/pdf.worker.js', import.meta.url)
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
|
||||||
PDFJS,
|
|
||||||
PDFJSViewer,
|
|
||||||
cMapUrl,
|
|
||||||
imageResourcesPath,
|
|
||||||
standardFontDataUrl,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function importPDFJS() {
|
async function importPDFJS() {
|
||||||
const variant = getMeta('ol-pdfjsVariant') || 'default'
|
const cMapUrl = '/js/pdfjs-dist/cmaps/'
|
||||||
|
const standardFontDataUrl = '/fonts/pdfjs-dist/'
|
||||||
|
const imageResourcesPath = '/images/pdfjs-dist/'
|
||||||
|
|
||||||
// NOTE: split test variants must have at least 3 characters
|
// ensure that PDF.js is loaded before importing the viewer
|
||||||
switch (variant) {
|
const PDFJS = await import('pdfjs-dist/legacy/build/pdf')
|
||||||
case '213':
|
|
||||||
case 'default':
|
|
||||||
return importPDFJS213()
|
|
||||||
|
|
||||||
case '401':
|
const [PDFJSViewer] = await Promise.all([
|
||||||
return importPDFJS401()
|
import('pdfjs-dist/legacy/web/pdf_viewer'),
|
||||||
|
import('pdfjs-dist/legacy/web/pdf_viewer.css'),
|
||||||
|
])
|
||||||
|
|
||||||
|
createWorker(() => {
|
||||||
|
PDFJS.GlobalWorkerOptions.workerPort = new Worker(
|
||||||
|
new URL('pdfjs-dist/legacy/build/pdf.worker.mjs', import.meta.url) // NOTE: .mjs extension
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
PDFJS,
|
||||||
|
PDFJSViewer,
|
||||||
|
cMapUrl,
|
||||||
|
imageResourcesPath,
|
||||||
|
standardFontDataUrl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,8 +323,7 @@
|
||||||
"mock-fs": "^5.1.2",
|
"mock-fs": "^5.1.2",
|
||||||
"nvd3": "^1.8.6",
|
"nvd3": "^1.8.6",
|
||||||
"overleaf-editor-core": "*",
|
"overleaf-editor-core": "*",
|
||||||
"pdfjs-dist213": "npm:pdfjs-dist@2.13.216",
|
"pdfjs-dist": "4.5.136",
|
||||||
"pdfjs-dist401": "npm:pdfjs-dist@4.5.136",
|
|
||||||
"pirates": "^4.0.1",
|
"pirates": "^4.0.1",
|
||||||
"postcss": "^8.4.31",
|
"postcss": "^8.4.31",
|
||||||
"postcss-loader": "^7.3.3",
|
"postcss-loader": "^7.3.3",
|
||||||
|
|
|
@ -66,10 +66,9 @@ function getModuleDirectory(moduleName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mathjaxDir = getModuleDirectory('mathjax')
|
const mathjaxDir = getModuleDirectory('mathjax')
|
||||||
|
const pdfjsDir = getModuleDirectory('pdfjs-dist')
|
||||||
const dictionariesDir = getModuleDirectory('@overleaf/dictionaries')
|
const dictionariesDir = getModuleDirectory('@overleaf/dictionaries')
|
||||||
|
|
||||||
const pdfjsVersions = ['pdfjs-dist213', 'pdfjs-dist401']
|
|
||||||
|
|
||||||
const vendorDir = path.join(__dirname, 'frontend/js/vendor')
|
const vendorDir = path.join(__dirname, 'frontend/js/vendor')
|
||||||
|
|
||||||
const MATHJAX_VERSION = require('mathjax/package.json').version
|
const MATHJAX_VERSION = require('mathjax/package.json').version
|
||||||
|
@ -131,7 +130,7 @@ module.exports = {
|
||||||
// Only compile application files and specific dependencies
|
// Only compile application files and specific dependencies
|
||||||
// (other npm and vendored dependencies must be in ES5 already)
|
// (other npm and vendored dependencies must be in ES5 already)
|
||||||
exclude: [
|
exclude: [
|
||||||
/node_modules\/(?!(react-dnd|chart\.js|@uppy|pdfjs-dist401|react-resizable-panels)\/)/,
|
/node_modules\/(?!(react-dnd|chart\.js|@uppy|pdfjs-dist|react-resizable-panels)\/)/,
|
||||||
vendorDir,
|
vendorDir,
|
||||||
],
|
],
|
||||||
use: [
|
use: [
|
||||||
|
@ -326,9 +325,9 @@ module.exports = {
|
||||||
jQuery: 'jquery',
|
jQuery: 'jquery',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Copy the required files for loading MathJax from MathJax NPM package
|
|
||||||
new CopyPlugin({
|
new CopyPlugin({
|
||||||
patterns: [
|
patterns: [
|
||||||
|
// Copy the required files for loading MathJax from MathJax NPM package
|
||||||
// https://www.npmjs.com/package/mathjax#user-content-hosting-your-own-copy-of-the-mathjax-components
|
// https://www.npmjs.com/package/mathjax#user-content-hosting-your-own-copy-of-the-mathjax-components
|
||||||
{
|
{
|
||||||
from: 'es5/tex-svg-full.js',
|
from: 'es5/tex-svg-full.js',
|
||||||
|
@ -372,26 +371,23 @@ module.exports = {
|
||||||
toType: 'dir',
|
toType: 'dir',
|
||||||
context: `${dictionariesDir}/dictionaries`,
|
context: `${dictionariesDir}/dictionaries`,
|
||||||
},
|
},
|
||||||
...pdfjsVersions.flatMap(version => {
|
// Copy CMap files (used to provide support for non-Latin characters),
|
||||||
const dir = getModuleDirectory(version)
|
// fonts and images from pdfjs-dist package to build output.
|
||||||
|
|
||||||
// Copy CMap files (used to provide support for non-Latin characters)
|
|
||||||
// and static images from pdfjs-dist package to build output.
|
|
||||||
|
|
||||||
return [
|
|
||||||
{ from: `cmaps`, to: `js/${version}/cmaps`, context: dir },
|
|
||||||
{
|
{
|
||||||
from: `standard_fonts`,
|
from: 'cmaps',
|
||||||
to: `fonts/${version}`,
|
to: 'js/pdfjs-dist/cmaps',
|
||||||
context: dir,
|
context: pdfjsDir,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: `legacy/web/images`,
|
from: 'standard_fonts',
|
||||||
to: `images/${version}`,
|
to: 'fonts/pdfjs-dist',
|
||||||
context: dir,
|
context: pdfjsDir,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: 'legacy/web/images',
|
||||||
|
to: 'images/pdfjs-dist',
|
||||||
|
context: pdfjsDir,
|
||||||
},
|
},
|
||||||
]
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue