Merge pull request #11809 from Snuffleupagus/Prettier-2
Update Prettier to version 2.0
This commit is contained in:
commit
50bc4a18e8
@ -1,4 +1,5 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf",
|
||||
"printWidth": 80,
|
||||
"semi": true,
|
||||
|
@ -385,7 +385,9 @@ var PDFViewerApplication = {
|
||||
PDFViewerApplication.zoomOut();
|
||||
});
|
||||
|
||||
document.getElementById("pageNumber").addEventListener("click", function() {
|
||||
document
|
||||
.getElementById("pageNumber")
|
||||
.addEventListener("click", function () {
|
||||
this.select();
|
||||
});
|
||||
|
||||
@ -433,7 +435,9 @@ document.addEventListener(
|
||||
(function animationStartedClosure() {
|
||||
// The offsetParent is not set until the PDF.js iframe or object is visible.
|
||||
// Waiting for first animation.
|
||||
PDFViewerApplication.animationStartedPromise = new Promise(function(resolve) {
|
||||
PDFViewerApplication.animationStartedPromise = new Promise(function (
|
||||
resolve
|
||||
) {
|
||||
window.requestAnimationFrame(resolve);
|
||||
});
|
||||
})();
|
||||
|
@ -73,10 +73,7 @@ function getHeaderFromHeaders(headers, headerName) {
|
||||
function isPdfFile(details) {
|
||||
var header = getHeaderFromHeaders(details.responseHeaders, "content-type");
|
||||
if (header) {
|
||||
var headerValue = header.value
|
||||
.toLowerCase()
|
||||
.split(";", 1)[0]
|
||||
.trim();
|
||||
var headerValue = header.value.toLowerCase().split(";", 1)[0].trim();
|
||||
if (headerValue === "application/pdf") {
|
||||
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) {
|
||||
// TODO make this really read line by line.
|
||||
var lines = fs
|
||||
.readFileSync(inFilename)
|
||||
.toString()
|
||||
.split("\n");
|
||||
var lines = fs.readFileSync(inFilename).toString().split("\n");
|
||||
var totalLines = lines.length;
|
||||
var out = "";
|
||||
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 context = this.rootContext;
|
||||
var sourcePath = path
|
||||
.relative(context, filePath)
|
||||
.split(path.sep)
|
||||
.join("/");
|
||||
var sourcePath = path.relative(context, filePath).split(path.sep).join("/");
|
||||
|
||||
var ctx = Object.create(this.query);
|
||||
ctx.sourceMap = true;
|
||||
|
@ -402,9 +402,7 @@ function replaceInFile(filePath, find, replacement) {
|
||||
|
||||
function getTempFile(prefix, suffix) {
|
||||
mkdirp.sync(BUILD_DIR + "tmp/");
|
||||
var bytes = require("crypto")
|
||||
.randomBytes(6)
|
||||
.toString("hex");
|
||||
var bytes = require("crypto").randomBytes(6).toString("hex");
|
||||
var filePath = BUILD_DIR + "tmp/" + prefix + bytes + suffix;
|
||||
fs.writeFileSync(filePath, "");
|
||||
return filePath;
|
||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -11310,9 +11310,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "1.19.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
|
||||
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.4.tgz",
|
||||
"integrity": "sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier-linter-helpers": {
|
||||
|
@ -37,7 +37,7 @@
|
||||
"mkdirp": "^1.0.3",
|
||||
"postcss-calc": "^7.0.2",
|
||||
"postcss-css-variables": "^0.14.0",
|
||||
"prettier": "^1.19.1",
|
||||
"prettier": "^2.0.4",
|
||||
"rimraf": "^2.7.1",
|
||||
"streamqueue": "^1.1.2",
|
||||
"systemjs": "^0.21.6",
|
||||
|
@ -934,7 +934,9 @@ var CMapFactory = (function CMapFactoryClosure() {
|
||||
}
|
||||
|
||||
function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
|
||||
return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function(newCMap) {
|
||||
return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (
|
||||
newCMap
|
||||
) {
|
||||
cMap.useCMap = newCMap;
|
||||
// If there aren't any code space ranges defined clone all the parent ones
|
||||
// into this cMap.
|
||||
|
@ -985,8 +985,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
}
|
||||
}
|
||||
if (!fontRef) {
|
||||
const partialMsg = `Font "${fontName ||
|
||||
(font && font.toString())}" is not available`;
|
||||
const partialMsg = `Font "${
|
||||
fontName || (font && font.toString())
|
||||
}" is not available`;
|
||||
|
||||
if (!this.options.ignoreErrors && !this.parsingType3Font) {
|
||||
warn(`${partialMsg}.`);
|
||||
|
@ -1069,9 +1069,7 @@ class Catalog {
|
||||
const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
|
||||
const regex = new RegExp(
|
||||
"^\\s*(" +
|
||||
URL_OPEN_METHODS.join("|")
|
||||
.split(".")
|
||||
.join("\\.") +
|
||||
URL_OPEN_METHODS.join("|").split(".").join("\\.") +
|
||||
")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))",
|
||||
"i"
|
||||
);
|
||||
|
@ -666,7 +666,9 @@ const getGlyphMapForStandardFonts = getLookupTableFactory(function(t) {
|
||||
// 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
|
||||
// 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[264] = 261;
|
||||
t[291] = 346;
|
||||
|
@ -2856,9 +2856,7 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
|
||||
this._nextBound().catch(this.cancel.bind(this));
|
||||
});
|
||||
} else {
|
||||
Promise.resolve()
|
||||
.then(this._nextBound)
|
||||
.catch(this.cancel.bind(this));
|
||||
Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,9 +162,9 @@ const defaultOptions = {
|
||||
cMapUrl: {
|
||||
/** @type {string} */
|
||||
value:
|
||||
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")
|
||||
typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")
|
||||
? "../external/bcmaps/"
|
||||
: "../web/cmaps/"),
|
||||
: "../web/cmaps/",
|
||||
kind: OptionKind.API,
|
||||
},
|
||||
disableAutoFetch: {
|
||||
@ -232,9 +232,9 @@ const defaultOptions = {
|
||||
workerSrc: {
|
||||
/** @type {string} */
|
||||
value:
|
||||
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")
|
||||
typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")
|
||||
? "../src/worker_loader.js"
|
||||
: "../build/pdf.worker.js"),
|
||||
: "../build/pdf.worker.js",
|
||||
kind: OptionKind.WORKER,
|
||||
},
|
||||
};
|
||||
@ -249,7 +249,7 @@ if (
|
||||
};
|
||||
defaultOptions.locale = {
|
||||
/** @type {string} */
|
||||
value: (typeof navigator !== "undefined" ? navigator.language : "en-US"),
|
||||
value: typeof navigator !== "undefined" ? navigator.language : "en-US",
|
||||
kind: OptionKind.VIEWER,
|
||||
};
|
||||
defaultOptions.printResolution = {
|
||||
|
@ -340,8 +340,9 @@ class SecondaryToolbar {
|
||||
if (this.containerHeight === this.previousContainerHeight) {
|
||||
return;
|
||||
}
|
||||
this.toolbarButtonContainer.style.maxHeight = `${this.containerHeight -
|
||||
SCROLLBAR_PADDING}px`;
|
||||
this.toolbarButtonContainer.style.maxHeight = `${
|
||||
this.containerHeight - SCROLLBAR_PADDING
|
||||
}px`;
|
||||
|
||||
this.previousContainerHeight = this.containerHeight;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user