-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaces RequireJS to SystemJS. #8050
Conversation
Personally I feel that support for older browsers are now seriously holding us back from using many of the really nice new features in ES6, and I would wholeheartedly support increasing the minimum requirements for using PDF.js. My suggestion is that version Such a requirement would mean that most, if not all, compatibility code could be removed; furthermore it'd also reduce the support burden since we'd no longer need to add any new compatibility hacks (which would be nice, given the limited number of regular PDF.js contributors). |
We can use a transpiler (like babel) to support old browsers and still have all the shiny new stuff. |
fcf059b
to
9c9d903
Compare
/botio test |
examples/svgviewer/viewer.js
Outdated
require(['pdfjs/display/api', 'pdfjs/display/svg', 'pdfjs/display/global'], | ||
function (api, svg, global) { | ||
// In production, the bundled pdf.js shall be used instead of SystemJS. | ||
SystemJS.config({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this now that we have systemjs.config.js
that seems to define this correctly? Compare to examples/helloworld/hello.js
that also doesn't have this.
@@ -15,21 +15,20 @@ | |||
|
|||
'use strict'; | |||
|
|||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change necessary? Shouldn't this block be moved to compatibility.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's needed only for requirejs (and probably for SystemJS as well) -- our tests were failing without it. Since we are not using src/worker_loader.js in the production anyway, I decided to remove the pre-processor from here.
systemjs.config.js
Outdated
@@ -0,0 +1,45 @@ | |||
/* Copyright 2012 Mozilla Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this to 2017.
systemjs.config.js
Outdated
if (typeof document !== 'undefined') { | ||
baseLocation = new URL('./', document.currentScript.src); | ||
} else if (typeof location !== 'undefined') { | ||
// Probably worker -- walking subfolders until we will reach root. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: one space too much here in the indentation
test/test_slave.html
Outdated
SystemJS.import('pdfjs/display/global'), | ||
SystemJS.import('pdfjs/shared/util')]) | ||
.then(function (modules) { | ||
var pdfjsSharedUtil = modules[4]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can get rid of this intermediate variable and make the next line window.pdfjsSharedUtil = modules[4];
directly. The intermediate variable doesn't provide more clarity about what's happening.
test/unit/jasmine-boot.js
Outdated
'pdfjs-test': '..'}}); | ||
require(['pdfjs/display/global', 'pdfjs-test/unit/annotation_spec', | ||
Promise.all([ | ||
'pdfjs/display/global', 'pdfjs-test/unit/annotation_spec', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation is inconsistent with the rest of the files. I'd prefer if we keep the same indentation as we do for other files here as well, i.e., indent with two spaces (I don't mind the diff being a few lines larger).
web/viewer.js
Outdated
Promise.all([SystemJS.import('pdfjs-web/app'), | ||
SystemJS.import('pdfjs-web/pdf_print_service')]) | ||
.then(function (modules) { | ||
var web = modules[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we call this variable app
instead? It's a bit confusing because web
for me refers to the entire web
folder, whereas app
is clearly only app.js
.
9c9d903
to
5b50e0d
Compare
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/d1d29810130162e/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/d1d29810130162e/output.txt Total script time: 2.16 mins Published |
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/199f213dbd9f162/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 1 Live output at: http://54.215.176.217:8877/296868ca9d08d8e/output.txt |
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/296868ca9d08d8e/output.txt Total script time: 22.10 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/199f213dbd9f162/output.txt Total script time: 29.85 mins
|
Thank you for working on this! |
Replaces RequireJS to SystemJS.
Removes RequireJS dependency since it will be hard to adapt ES6 module transpilers. It will be easier with SystemJS. Questions to resolve: