Update Prettier to version 2.0
Please note that these changes were done automatically, using `gulp lint --fix`. Given that the major version number was increased, there's a fair number of (primarily whitespace) changes; please see https://prettier.io/blog/2020/03/21/2.0.0.html In order to reduce the size of these changes somewhat, this patch maintains the old "arrowParens" style for now (once mozilla-central updates Prettier we can simply choose the same formatting, assuming it will differ here).
This commit is contained in:
parent
a4dd081d7b
commit
426945b480
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"arrowParens": "avoid",
|
||||||
"endOfLine": "lf",
|
"endOfLine": "lf",
|
||||||
"printWidth": 80,
|
"printWidth": 80,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
|
@ -385,7 +385,9 @@ var PDFViewerApplication = {
|
|||||||
PDFViewerApplication.zoomOut();
|
PDFViewerApplication.zoomOut();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("pageNumber").addEventListener("click", function() {
|
document
|
||||||
|
.getElementById("pageNumber")
|
||||||
|
.addEventListener("click", function () {
|
||||||
this.select();
|
this.select();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -433,7 +435,9 @@ document.addEventListener(
|
|||||||
(function animationStartedClosure() {
|
(function animationStartedClosure() {
|
||||||
// The offsetParent is not set until the PDF.js iframe or object is visible.
|
// The offsetParent is not set until the PDF.js iframe or object is visible.
|
||||||
// Waiting for first animation.
|
// Waiting for first animation.
|
||||||
PDFViewerApplication.animationStartedPromise = new Promise(function(resolve) {
|
PDFViewerApplication.animationStartedPromise = new Promise(function (
|
||||||
|
resolve
|
||||||
|
) {
|
||||||
window.requestAnimationFrame(resolve);
|
window.requestAnimationFrame(resolve);
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
@ -73,10 +73,7 @@ function getHeaderFromHeaders(headers, headerName) {
|
|||||||
function isPdfFile(details) {
|
function isPdfFile(details) {
|
||||||
var header = getHeaderFromHeaders(details.responseHeaders, "content-type");
|
var header = getHeaderFromHeaders(details.responseHeaders, "content-type");
|
||||||
if (header) {
|
if (header) {
|
||||||
var headerValue = header.value
|
var headerValue = header.value.toLowerCase().split(";", 1)[0].trim();
|
||||||
.toLowerCase()
|
|
||||||
.split(";", 1)[0]
|
|
||||||
.trim();
|
|
||||||
if (headerValue === "application/pdf") {
|
if (headerValue === "application/pdf") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
5
external/builder/builder.js
vendored
5
external/builder/builder.js
vendored
@ -34,10 +34,7 @@ var fs = require("fs"),
|
|||||||
*/
|
*/
|
||||||
function preprocess(inFilename, outFilename, defines) {
|
function preprocess(inFilename, outFilename, defines) {
|
||||||
// TODO make this really read line by line.
|
// TODO make this really read line by line.
|
||||||
var lines = fs
|
var lines = fs.readFileSync(inFilename).toString().split("\n");
|
||||||
.readFileSync(inFilename)
|
|
||||||
.toString()
|
|
||||||
.split("\n");
|
|
||||||
var totalLines = lines.length;
|
var totalLines = lines.length;
|
||||||
var out = "";
|
var out = "";
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
5
external/webpack/pdfjsdev-loader.js
vendored
5
external/webpack/pdfjsdev-loader.js
vendored
@ -28,10 +28,7 @@ module.exports = function(source) {
|
|||||||
|
|
||||||
var filePath = this.resourcePath;
|
var filePath = this.resourcePath;
|
||||||
var context = this.rootContext;
|
var context = this.rootContext;
|
||||||
var sourcePath = path
|
var sourcePath = path.relative(context, filePath).split(path.sep).join("/");
|
||||||
.relative(context, filePath)
|
|
||||||
.split(path.sep)
|
|
||||||
.join("/");
|
|
||||||
|
|
||||||
var ctx = Object.create(this.query);
|
var ctx = Object.create(this.query);
|
||||||
ctx.sourceMap = true;
|
ctx.sourceMap = true;
|
||||||
|
@ -402,9 +402,7 @@ function replaceInFile(filePath, find, replacement) {
|
|||||||
|
|
||||||
function getTempFile(prefix, suffix) {
|
function getTempFile(prefix, suffix) {
|
||||||
mkdirp.sync(BUILD_DIR + "tmp/");
|
mkdirp.sync(BUILD_DIR + "tmp/");
|
||||||
var bytes = require("crypto")
|
var bytes = require("crypto").randomBytes(6).toString("hex");
|
||||||
.randomBytes(6)
|
|
||||||
.toString("hex");
|
|
||||||
var filePath = BUILD_DIR + "tmp/" + prefix + bytes + suffix;
|
var filePath = BUILD_DIR + "tmp/" + prefix + bytes + suffix;
|
||||||
fs.writeFileSync(filePath, "");
|
fs.writeFileSync(filePath, "");
|
||||||
return filePath;
|
return filePath;
|
||||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -11310,9 +11310,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"version": "1.19.1",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.4.tgz",
|
||||||
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
|
"integrity": "sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"prettier-linter-helpers": {
|
"prettier-linter-helpers": {
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
"mkdirp": "^1.0.3",
|
"mkdirp": "^1.0.3",
|
||||||
"postcss-calc": "^7.0.2",
|
"postcss-calc": "^7.0.2",
|
||||||
"postcss-css-variables": "^0.14.0",
|
"postcss-css-variables": "^0.14.0",
|
||||||
"prettier": "^1.19.1",
|
"prettier": "^2.0.4",
|
||||||
"rimraf": "^2.7.1",
|
"rimraf": "^2.7.1",
|
||||||
"streamqueue": "^1.1.2",
|
"streamqueue": "^1.1.2",
|
||||||
"systemjs": "^0.21.6",
|
"systemjs": "^0.21.6",
|
||||||
|
@ -934,7 +934,9 @@ var CMapFactory = (function CMapFactoryClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
|
function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
|
||||||
return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function(newCMap) {
|
return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (
|
||||||
|
newCMap
|
||||||
|
) {
|
||||||
cMap.useCMap = newCMap;
|
cMap.useCMap = newCMap;
|
||||||
// If there aren't any code space ranges defined clone all the parent ones
|
// If there aren't any code space ranges defined clone all the parent ones
|
||||||
// into this cMap.
|
// into this cMap.
|
||||||
|
@ -985,8 +985,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fontRef) {
|
if (!fontRef) {
|
||||||
const partialMsg = `Font "${fontName ||
|
const partialMsg = `Font "${
|
||||||
(font && font.toString())}" is not available`;
|
fontName || (font && font.toString())
|
||||||
|
}" is not available`;
|
||||||
|
|
||||||
if (!this.options.ignoreErrors && !this.parsingType3Font) {
|
if (!this.options.ignoreErrors && !this.parsingType3Font) {
|
||||||
warn(`${partialMsg}.`);
|
warn(`${partialMsg}.`);
|
||||||
|
@ -1069,9 +1069,7 @@ class Catalog {
|
|||||||
const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
|
const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
|
||||||
const regex = new RegExp(
|
const regex = new RegExp(
|
||||||
"^\\s*(" +
|
"^\\s*(" +
|
||||||
URL_OPEN_METHODS.join("|")
|
URL_OPEN_METHODS.join("|").split(".").join("\\.") +
|
||||||
.split(".")
|
|
||||||
.join("\\.") +
|
|
||||||
")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))",
|
")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))",
|
||||||
"i"
|
"i"
|
||||||
);
|
);
|
||||||
|
@ -666,7 +666,9 @@ const getGlyphMapForStandardFonts = getLookupTableFactory(function(t) {
|
|||||||
// The glyph map for ArialBlack differs slightly from the glyph map used for
|
// The glyph map for ArialBlack differs slightly from the glyph map used for
|
||||||
// other well-known standard fonts. Hence we use this (incomplete) CID to GID
|
// other well-known standard fonts. Hence we use this (incomplete) CID to GID
|
||||||
// mapping to adjust the glyph map for non-embedded ArialBlack fonts.
|
// mapping to adjust the glyph map for non-embedded ArialBlack fonts.
|
||||||
const getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function(t) {
|
const getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (
|
||||||
|
t
|
||||||
|
) {
|
||||||
t[227] = 322;
|
t[227] = 322;
|
||||||
t[264] = 261;
|
t[264] = 261;
|
||||||
t[291] = 346;
|
t[291] = 346;
|
||||||
|
@ -2856,9 +2856,7 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
|
|||||||
this._nextBound().catch(this.cancel.bind(this));
|
this._nextBound().catch(this.cancel.bind(this));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Promise.resolve()
|
Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this));
|
||||||
.then(this._nextBound)
|
|
||||||
.catch(this.cancel.bind(this));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,9 +162,9 @@ const defaultOptions = {
|
|||||||
cMapUrl: {
|
cMapUrl: {
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
value:
|
value:
|
||||||
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")
|
typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")
|
||||||
? "../external/bcmaps/"
|
? "../external/bcmaps/"
|
||||||
: "../web/cmaps/"),
|
: "../web/cmaps/",
|
||||||
kind: OptionKind.API,
|
kind: OptionKind.API,
|
||||||
},
|
},
|
||||||
disableAutoFetch: {
|
disableAutoFetch: {
|
||||||
@ -232,9 +232,9 @@ const defaultOptions = {
|
|||||||
workerSrc: {
|
workerSrc: {
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
value:
|
value:
|
||||||
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")
|
typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")
|
||||||
? "../src/worker_loader.js"
|
? "../src/worker_loader.js"
|
||||||
: "../build/pdf.worker.js"),
|
: "../build/pdf.worker.js",
|
||||||
kind: OptionKind.WORKER,
|
kind: OptionKind.WORKER,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -249,7 +249,7 @@ if (
|
|||||||
};
|
};
|
||||||
defaultOptions.locale = {
|
defaultOptions.locale = {
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
value: (typeof navigator !== "undefined" ? navigator.language : "en-US"),
|
value: typeof navigator !== "undefined" ? navigator.language : "en-US",
|
||||||
kind: OptionKind.VIEWER,
|
kind: OptionKind.VIEWER,
|
||||||
};
|
};
|
||||||
defaultOptions.printResolution = {
|
defaultOptions.printResolution = {
|
||||||
|
@ -340,8 +340,9 @@ class SecondaryToolbar {
|
|||||||
if (this.containerHeight === this.previousContainerHeight) {
|
if (this.containerHeight === this.previousContainerHeight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.toolbarButtonContainer.style.maxHeight = `${this.containerHeight -
|
this.toolbarButtonContainer.style.maxHeight = `${
|
||||||
SCROLLBAR_PADDING}px`;
|
this.containerHeight - SCROLLBAR_PADDING
|
||||||
|
}px`;
|
||||||
|
|
||||||
this.previousContainerHeight = this.containerHeight;
|
this.previousContainerHeight = this.containerHeight;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user