Merge pull request #8462 from yurydelendik/rm=umd
Removes last UMDs from the modules.
This commit is contained in:
commit
1e6f49b129
7
external/builder/fixtures_esprima/importalias-expected.js
vendored
Normal file
7
external/builder/fixtures_esprima/importalias-expected.js
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { Test } from 'import-name';
|
||||||
|
import { Test2 } from './non-alias';
|
||||||
|
export {
|
||||||
|
Test3
|
||||||
|
} from 'import-name';
|
||||||
|
var Imp = require('import-name');
|
||||||
|
var Imp2 = require('./non-alias');
|
5
external/builder/fixtures_esprima/importalias.js
vendored
Normal file
5
external/builder/fixtures_esprima/importalias.js
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { Test } from 'import-alias';
|
||||||
|
import { Test2 } from './non-alias';
|
||||||
|
export { Test3 } from 'import-alias';
|
||||||
|
var Imp = require('import-alias');
|
||||||
|
var Imp2 = require('./non-alias');
|
@ -1,5 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
var aB = require('../a/b.js');
|
|
||||||
var cD = require('./d.js');
|
|
||||||
var opt;
|
|
||||||
opt(aB + cD);
|
|
14
external/builder/fixtures_esprima/umd.js
vendored
14
external/builder/fixtures_esprima/umd.js
vendored
@ -1,14 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
(function (root, factory) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
define('test', ['exports', 'a/b', 'c/d'], factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
|
||||||
factory(exports, require('../a/b.js'), require('./d.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.E = {}), root.aB, root.cD);
|
|
||||||
}
|
|
||||||
}(this, function (exports, aB, cD, opt) {
|
|
||||||
|
|
||||||
opt(aB + cD);
|
|
||||||
}));
|
|
95
external/builder/preprocessor2.js
vendored
95
external/builder/preprocessor2.js
vendored
@ -80,6 +80,14 @@ function handlePreprocessorAction(ctx, actionName, args, loc) {
|
|||||||
|
|
||||||
function postprocessNode(ctx, node) {
|
function postprocessNode(ctx, node) {
|
||||||
switch (node.type) {
|
switch (node.type) {
|
||||||
|
case 'ExportNamedDeclaration':
|
||||||
|
case 'ImportDeclaration':
|
||||||
|
if (node.source && node.source.type === 'Literal' &&
|
||||||
|
ctx.map && ctx.map[node.source.value]) {
|
||||||
|
var newValue = ctx.map[node.source.value];
|
||||||
|
node.source.value = node.source.raw = newValue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'IfStatement':
|
case 'IfStatement':
|
||||||
if (isLiteral(node.test, true)) {
|
if (isLiteral(node.test, true)) {
|
||||||
// if (true) stmt1; => stmt1
|
// if (true) stmt1; => stmt1
|
||||||
@ -165,6 +173,13 @@ function postprocessNode(ctx, node) {
|
|||||||
return handlePreprocessorAction(ctx, action,
|
return handlePreprocessorAction(ctx, action,
|
||||||
node.arguments, node.loc);
|
node.arguments, node.loc);
|
||||||
}
|
}
|
||||||
|
// require('string')
|
||||||
|
if (node.callee.type === 'Identifier' && node.callee.name === 'require' &&
|
||||||
|
node.arguments.length === 1 && node.arguments[0].type === 'Literal' &&
|
||||||
|
ctx.map && ctx.map[node.arguments[0].value]) {
|
||||||
|
var requireName = node.arguments[0];
|
||||||
|
requireName.value = requireName.raw = ctx.map[requireName.value];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'BlockStatement':
|
case 'BlockStatement':
|
||||||
var subExpressionIndex = 0;
|
var subExpressionIndex = 0;
|
||||||
@ -201,86 +216,6 @@ function postprocessNode(ctx, node) {
|
|||||||
block.body.pop();
|
block.body.pop();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Program':
|
|
||||||
// Checking for a function closure that looks like UMD header.
|
|
||||||
node.body.some(function (item, index) {
|
|
||||||
// Is it `(function (root, factory) { ? }(this, function (?) {?}));` ?
|
|
||||||
if (item.type !== 'ExpressionStatement' ||
|
|
||||||
item.expression.type !== 'CallExpression' ||
|
|
||||||
item.expression.callee.type !== 'FunctionExpression' ||
|
|
||||||
item.expression.callee.params.length !== 2 ||
|
|
||||||
item.expression.arguments.length !== 2 ||
|
|
||||||
item.expression.arguments[0].type !== 'ThisExpression' ||
|
|
||||||
item.expression.arguments[1].type !== 'FunctionExpression') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var init = item.expression.callee;
|
|
||||||
// Is init body looks like
|
|
||||||
// `if (?) { ? } else if (typeof exports !== 'undefined') { ? } ...`?
|
|
||||||
if (init.body.type !== 'BlockStatement' ||
|
|
||||||
init.body.body.length !== 1 ||
|
|
||||||
init.body.body[0].type !== 'IfStatement') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var initIf = init.body.body[0];
|
|
||||||
if (initIf.alternate.type !== 'IfStatement' ||
|
|
||||||
initIf.alternate.test.type !== 'BinaryExpression' ||
|
|
||||||
initIf.alternate.test.operator !== '!==' ||
|
|
||||||
initIf.alternate.test.left.type !== 'UnaryExpression' ||
|
|
||||||
initIf.alternate.test.left.operator !== 'typeof' ||
|
|
||||||
initIf.alternate.test.left.argument.type !== 'Identifier' ||
|
|
||||||
initIf.alternate.test.left.argument.name !== 'exports' ||
|
|
||||||
initIf.alternate.test.right.type !== 'Literal' ||
|
|
||||||
initIf.alternate.test.right.value !== 'undefined' ||
|
|
||||||
initIf.alternate.consequent.type !== 'BlockStatement') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var commonJsInit = initIf.alternate.consequent;
|
|
||||||
// Is commonJsInit `factory(exports, ...)` ?
|
|
||||||
if (commonJsInit.body.length !== 1 ||
|
|
||||||
commonJsInit.body[0].type !== 'ExpressionStatement' ||
|
|
||||||
commonJsInit.body[0].expression.type !== 'CallExpression' ||
|
|
||||||
commonJsInit.body[0].expression.callee.type !== 'Identifier') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var commonJsInitArgs = commonJsInit.body[0].expression.arguments;
|
|
||||||
if (commonJsInitArgs.length === 0 ||
|
|
||||||
commonJsInitArgs[0].type !== 'Identifier' ||
|
|
||||||
commonJsInitArgs[0].name !== 'exports') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var factory = item.expression.arguments[1];
|
|
||||||
// Is factory `function (exports, ....) { ? }` ?
|
|
||||||
if (factory.params.length === 0 ||
|
|
||||||
factory.params[0].type !== 'Identifier' ||
|
|
||||||
factory.params[0].name !== 'exports' ||
|
|
||||||
factory.body.type !== 'BlockStatement') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
var factoryParams = factory.params;
|
|
||||||
var factoryBody = factory.body;
|
|
||||||
|
|
||||||
// Remove closure and function and replacing parameters with vars.
|
|
||||||
node.body.splice(index, 1);
|
|
||||||
for (var i = 1, ii = factoryParams.length; i < ii; i++) {
|
|
||||||
var varNode = {
|
|
||||||
type: 'VariableDeclaration',
|
|
||||||
'declarations': [{
|
|
||||||
type: 'VariableDeclarator',
|
|
||||||
id: factoryParams[i],
|
|
||||||
init: commonJsInitArgs[i] || null,
|
|
||||||
loc: factoryParams[i].loc
|
|
||||||
}],
|
|
||||||
kind: 'var'
|
|
||||||
};
|
|
||||||
node.body.splice(index++, 0, varNode);
|
|
||||||
}
|
|
||||||
factoryBody.body.forEach(function (item) {
|
|
||||||
node.body.splice(index++, 0, item);
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
4
external/builder/test-fixtures_esprima.js
vendored
4
external/builder/test-fixtures_esprima.js
vendored
@ -24,8 +24,12 @@ files.forEach(function(expectationFilename) {
|
|||||||
OBJ: {obj: {i: 1}, j: 2},
|
OBJ: {obj: {i: 1}, j: 2},
|
||||||
TEXT: 'text'
|
TEXT: 'text'
|
||||||
};
|
};
|
||||||
|
var map = {
|
||||||
|
'import-alias': 'import-name',
|
||||||
|
};
|
||||||
var ctx = {
|
var ctx = {
|
||||||
defines: defines,
|
defines: defines,
|
||||||
|
map: map,
|
||||||
rootPath: __dirname + '/../..',
|
rootPath: __dirname + '/../..',
|
||||||
};
|
};
|
||||||
var out;
|
var out;
|
||||||
|
@ -142,6 +142,7 @@ function createWebpackConfig(defines, output) {
|
|||||||
alias: {
|
alias: {
|
||||||
'pdfjs': path.join(__dirname, 'src'),
|
'pdfjs': path.join(__dirname, 'src'),
|
||||||
'pdfjs-web': path.join(__dirname, 'web'),
|
'pdfjs-web': path.join(__dirname, 'web'),
|
||||||
|
'pdfjs-lib': path.join(__dirname, 'web/pdfjs'),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
devtool: enableSourceMaps ? 'source-map' : undefined,
|
devtool: enableSourceMaps ? 'source-map' : undefined,
|
||||||
@ -1008,7 +1009,10 @@ gulp.task('lib', ['buildnumber'], function () {
|
|||||||
LIB: true,
|
LIB: true,
|
||||||
BUNDLE_VERSION: versionInfo.version,
|
BUNDLE_VERSION: versionInfo.version,
|
||||||
BUNDLE_BUILD: versionInfo.commit
|
BUNDLE_BUILD: versionInfo.commit
|
||||||
})
|
}),
|
||||||
|
map: {
|
||||||
|
'pdfjs-lib': '../pdf'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
var licenseHeader = fs.readFileSync('./src/license_header.js').toString();
|
var licenseHeader = fs.readFileSync('./src/license_header.js').toString();
|
||||||
var preprocessor2 = require('./external/builder/preprocessor2.js');
|
var preprocessor2 = require('./external/builder/preprocessor2.js');
|
||||||
@ -1021,6 +1025,7 @@ gulp.task('lib', ['buildnumber'], function () {
|
|||||||
], {base: 'src/'}),
|
], {base: 'src/'}),
|
||||||
gulp.src([
|
gulp.src([
|
||||||
'web/*.js',
|
'web/*.js',
|
||||||
|
'!web/pdfjs.js',
|
||||||
'!web/viewer.js',
|
'!web/viewer.js',
|
||||||
'!web/compatibility.js',
|
'!web/compatibility.js',
|
||||||
], {base: '.'}),
|
], {base: '.'}),
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
/* Copyright 2015 Mozilla Foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function (root, factory) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
define('pdfjs/main_loader', ['exports', 'pdfjs/display/api',
|
|
||||||
'pdfjs/display/annotation_layer', 'pdfjs/display/text_layer',
|
|
||||||
'pdfjs/display/dom_utils', 'pdfjs/shared/util', 'pdfjs/display/svg',
|
|
||||||
'pdfjs/display/global'],
|
|
||||||
factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
|
||||||
factory(exports, require('./display/api.js'),
|
|
||||||
require('./display/annotation_layer.js'),
|
|
||||||
require('./display/text_layer.js'), require('./display/dom_utils.js'),
|
|
||||||
require('./shared/util.js'), require('./display/svg.js'),
|
|
||||||
require('./display/global.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.pdfjsMainLoader = {}), root.pdfjsDisplayAPI,
|
|
||||||
root.pdfjsDisplayAnnotationLayer, root.pdfjsDisplayTextLayer,
|
|
||||||
root.pdfjsDisplayDOMUtils, root.pdfjsSharedUtil, root.pdfjsDisplaySVG,
|
|
||||||
root.pdfjsDisplayGlobal);
|
|
||||||
}
|
|
||||||
}(this, function (exports, displayAPI, displayAnnotationLayer,
|
|
||||||
displayTextLayer, displayDOMUtils, sharedUtil,
|
|
||||||
displaySVG, displayGlobal) {
|
|
||||||
|
|
||||||
// Sync the exports below with ./pdf.js file/template.
|
|
||||||
exports.PDFJS = displayGlobal.PDFJS;
|
|
||||||
exports.build = displayAPI.build;
|
|
||||||
exports.version = displayAPI.version;
|
|
||||||
exports.getDocument = displayAPI.getDocument;
|
|
||||||
exports.PDFDataRangeTransport = displayAPI.PDFDataRangeTransport;
|
|
||||||
exports.LoopbackPort = displayAPI.LoopbackPort;
|
|
||||||
exports.PDFWorker = displayAPI.PDFWorker;
|
|
||||||
exports.renderTextLayer = displayTextLayer.renderTextLayer;
|
|
||||||
exports.AnnotationLayer = displayAnnotationLayer.AnnotationLayer;
|
|
||||||
exports.CustomStyle = displayDOMUtils.CustomStyle;
|
|
||||||
exports.createPromiseCapability = sharedUtil.createPromiseCapability;
|
|
||||||
exports.PasswordResponses = sharedUtil.PasswordResponses;
|
|
||||||
exports.InvalidPDFException = sharedUtil.InvalidPDFException;
|
|
||||||
exports.MissingPDFException = sharedUtil.MissingPDFException;
|
|
||||||
exports.SVGGraphics = displaySVG.SVGGraphics;
|
|
||||||
exports.NativeImageDecoding = sharedUtil.NativeImageDecoding;
|
|
||||||
exports.UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
|
|
||||||
exports.OPS = sharedUtil.OPS;
|
|
||||||
exports.UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
|
|
||||||
exports.isValidUrl = displayDOMUtils.isValidUrl;
|
|
||||||
exports.createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
|
|
||||||
exports.createObjectURL = sharedUtil.createObjectURL;
|
|
||||||
exports.removeNullCharacters = sharedUtil.removeNullCharacters;
|
|
||||||
exports.shadow = sharedUtil.shadow;
|
|
||||||
exports.createBlob = sharedUtil.createBlob;
|
|
||||||
exports.RenderingCancelledException =
|
|
||||||
displayDOMUtils.RenderingCancelledException;
|
|
||||||
exports.getFilenameFromUrl = displayDOMUtils.getFilenameFromUrl;
|
|
||||||
exports.addLinkAttributes = displayDOMUtils.addLinkAttributes;
|
|
||||||
exports.StatTimer = sharedUtil.StatTimer;
|
|
||||||
}));
|
|
@ -16,8 +16,10 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var pdfjsVersion = PDFJSDev.eval('BUNDLE_VERSION');
|
var pdfjsVersion =
|
||||||
var pdfjsBuild = PDFJSDev.eval('BUNDLE_BUILD');
|
typeof PDFJSDev !== 'undefined' ? PDFJSDev.eval('BUNDLE_VERSION') : void 0;
|
||||||
|
var pdfjsBuild =
|
||||||
|
typeof PDFJSDev !== 'undefined' ? PDFJSDev.eval('BUNDLE_BUILD') : void 0;
|
||||||
|
|
||||||
var pdfjsSharedUtil = require('./shared/util.js');
|
var pdfjsSharedUtil = require('./shared/util.js');
|
||||||
var pdfjsDisplayGlobal = require('./display/global.js');
|
var pdfjsDisplayGlobal = require('./display/global.js');
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
'pdfjs': new URL('src', baseLocation).href,
|
'pdfjs': new URL('src', baseLocation).href,
|
||||||
'pdfjs-web': new URL('web', baseLocation).href,
|
'pdfjs-web': new URL('web', baseLocation).href,
|
||||||
'pdfjs-test': new URL('test', baseLocation).href,
|
'pdfjs-test': new URL('test', baseLocation).href,
|
||||||
|
'pdfjs-lib': new URL('src/pdf', baseLocation).href,
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
'*': {
|
'*': {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AnnotationLayer } from './pdfjs';
|
import { AnnotationLayer } from 'pdfjs-lib';
|
||||||
import { mozL10n } from './ui_utils';
|
import { mozL10n } from './ui_utils';
|
||||||
import { SimpleLinkService } from './pdf_link_service';
|
import { SimpleLinkService } from './pdf_link_service';
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import {
|
|||||||
build, createBlob, getDocument, getFilenameFromUrl, InvalidPDFException,
|
build, createBlob, getDocument, getFilenameFromUrl, InvalidPDFException,
|
||||||
MissingPDFException, OPS, PDFJS, shadow, UnexpectedResponseException,
|
MissingPDFException, OPS, PDFJS, shadow, UnexpectedResponseException,
|
||||||
UNSUPPORTED_FEATURES, version,
|
UNSUPPORTED_FEATURES, version,
|
||||||
} from './pdfjs';
|
} from 'pdfjs-lib';
|
||||||
import { CursorTool, PDFCursorTools } from './pdf_cursor_tools';
|
import { CursorTool, PDFCursorTools } from './pdf_cursor_tools';
|
||||||
import { PDFRenderingQueue, RenderingStates } from './pdf_rendering_queue';
|
import { PDFRenderingQueue, RenderingStates } from './pdf_rendering_queue';
|
||||||
import { PDFSidebar, SidebarView } from './pdf_sidebar';
|
import { PDFSidebar, SidebarView } from './pdf_sidebar';
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import { DefaultExternalServices, PDFViewerApplication } from './app';
|
import { DefaultExternalServices, PDFViewerApplication } from './app';
|
||||||
import { BasePreferences } from './preferences';
|
import { BasePreferences } from './preferences';
|
||||||
import { DownloadManager } from './download_manager';
|
import { DownloadManager } from './download_manager';
|
||||||
import { PDFJS } from './pdfjs';
|
import { PDFJS } from 'pdfjs-lib';
|
||||||
|
|
||||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) {
|
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('CHROME')) {
|
||||||
throw new Error('Module "pdfjs-web/chromecom" shall not be used outside ' +
|
throw new Error('Module "pdfjs-web/chromecom" shall not be used outside ' +
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createObjectURL, createValidAbsoluteUrl, PDFJS } from './pdfjs';
|
import { createObjectURL, createValidAbsoluteUrl, PDFJS } from 'pdfjs-lib';
|
||||||
|
|
||||||
if (typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('CHROME || GENERIC')) {
|
if (typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('CHROME || GENERIC')) {
|
||||||
throw new Error('Module "pdfjs-web/download_manager" shall not be used ' +
|
throw new Error('Module "pdfjs-web/download_manager" shall not be used ' +
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import { CSS_UNITS } from './ui_utils';
|
import { CSS_UNITS } from './ui_utils';
|
||||||
import { PDFPrintServiceFactory } from './app';
|
import { PDFPrintServiceFactory } from './app';
|
||||||
import { shadow } from './pdfjs';
|
import { shadow } from 'pdfjs-lib';
|
||||||
|
|
||||||
// Creates a placeholder with div and canvas with right size for the page.
|
// Creates a placeholder with div and canvas with right size for the page.
|
||||||
function composePage(pdfDocument, pageNumber, size, printContainer) {
|
function composePage(pdfDocument, pageNumber, size, printContainer) {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createObjectURL, PDFDataRangeTransport, shadow } from './pdfjs';
|
import { createObjectURL, PDFDataRangeTransport, shadow } from 'pdfjs-lib';
|
||||||
import { BasePreferences } from './preferences';
|
import { BasePreferences } from './preferences';
|
||||||
import { PDFViewerApplication } from './app';
|
import { PDFViewerApplication } from './app';
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { mozL10n } from './ui_utils';
|
import { mozL10n } from './ui_utils';
|
||||||
import { PasswordResponses } from './pdfjs';
|
import { PasswordResponses } from 'pdfjs-lib';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} PasswordPromptOptions
|
* @typedef {Object} PasswordPromptOptions
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import {
|
import {
|
||||||
createObjectURL, createPromiseCapability, getFilenameFromUrl, PDFJS,
|
createObjectURL, createPromiseCapability, getFilenameFromUrl, PDFJS,
|
||||||
removeNullCharacters
|
removeNullCharacters
|
||||||
} from './pdfjs';
|
} from 'pdfjs-lib';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} PDFAttachmentViewerOptions
|
* @typedef {Object} PDFAttachmentViewerOptions
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { cloneObj, getPDFFileNameFromURL, mozL10n } from './ui_utils';
|
import { cloneObj, getPDFFileNameFromURL, mozL10n } from './ui_utils';
|
||||||
import { createPromiseCapability } from './pdfjs';
|
import { createPromiseCapability } from 'pdfjs-lib';
|
||||||
|
|
||||||
const DEFAULT_FIELD_CONTENT = '-';
|
const DEFAULT_FIELD_CONTENT = '-';
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createPromiseCapability } from './pdfjs';
|
import { createPromiseCapability } from 'pdfjs-lib';
|
||||||
import { scrollIntoView } from './ui_utils';
|
import { scrollIntoView } from './ui_utils';
|
||||||
|
|
||||||
var FindStates = {
|
var FindStates = {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
addLinkAttributes, PDFJS, removeNullCharacters
|
addLinkAttributes, PDFJS, removeNullCharacters
|
||||||
} from './pdfjs';
|
} from 'pdfjs-lib';
|
||||||
|
|
||||||
const DEFAULT_TITLE = '\u2013';
|
const DEFAULT_TITLE = '\u2013';
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
createPromiseCapability, CustomStyle, PDFJS, RenderingCancelledException,
|
createPromiseCapability, CustomStyle, PDFJS, RenderingCancelledException,
|
||||||
SVGGraphics
|
SVGGraphics
|
||||||
} from './pdfjs';
|
} from 'pdfjs-lib';
|
||||||
import { getGlobalEventBus } from './dom_events';
|
import { getGlobalEventBus } from './dom_events';
|
||||||
import { RenderingStates } from './pdf_rendering_queue';
|
import { RenderingStates } from './pdf_rendering_queue';
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import { CSS_UNITS, mozL10n } from './ui_utils';
|
import { CSS_UNITS, mozL10n } from './ui_utils';
|
||||||
import { PDFPrintServiceFactory, PDFViewerApplication } from './app';
|
import { PDFPrintServiceFactory, PDFViewerApplication } from './app';
|
||||||
import { PDFJS } from './pdfjs';
|
import { PDFJS } from 'pdfjs-lib';
|
||||||
|
|
||||||
let activeService = null;
|
let activeService = null;
|
||||||
let overlayManager = null;
|
let overlayManager = null;
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createPromiseCapability, RenderingCancelledException } from './pdfjs';
|
import {
|
||||||
|
createPromiseCapability, RenderingCancelledException
|
||||||
|
} from 'pdfjs-lib';
|
||||||
import { getOutputScale, mozL10n } from './ui_utils';
|
import { getOutputScale, mozL10n } from './ui_utils';
|
||||||
import { RenderingStates } from './pdf_rendering_queue';
|
import { RenderingStates } from './pdf_rendering_queue';
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createPromiseCapability, PDFJS } from './pdfjs';
|
import { createPromiseCapability, PDFJS } from 'pdfjs-lib';
|
||||||
import {
|
import {
|
||||||
CSS_UNITS, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, getVisibleElements,
|
CSS_UNITS, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, getVisibleElements,
|
||||||
MAX_AUTO_SCALE, RendererType, SCROLLBAR_PADDING, scrollIntoView,
|
MAX_AUTO_SCALE, RendererType, SCROLLBAR_PADDING, scrollIntoView,
|
||||||
|
23
web/pdfjs.js
23
web/pdfjs.js
@ -16,38 +16,15 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) {
|
|
||||||
var pdfjsLib;
|
var pdfjsLib;
|
||||||
// The if below protected by __pdfjsdev_webpack__ check from webpack parsing.
|
// The if below protected by __pdfjsdev_webpack__ check from webpack parsing.
|
||||||
if (typeof __pdfjsdev_webpack__ === 'undefined') {
|
if (typeof __pdfjsdev_webpack__ === 'undefined') {
|
||||||
if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) {
|
if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) {
|
||||||
pdfjsLib = window['pdfjs-dist/build/pdf'];
|
pdfjsLib = window['pdfjs-dist/build/pdf'];
|
||||||
} else if (typeof require === 'function') {
|
} else if (typeof require === 'function') {
|
||||||
if (PDFJSDev.test('LIB')) {
|
|
||||||
pdfjsLib = require('../pdf.js');
|
|
||||||
} else {
|
|
||||||
pdfjsLib = require('../build/pdf.js');
|
pdfjsLib = require('../build/pdf.js');
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Neither `require` nor `window` found');
|
throw new Error('Neither `require` nor `window` found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = pdfjsLib;
|
module.exports = pdfjsLib;
|
||||||
} else {
|
|
||||||
(function (root, factory) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
define('pdfjs-web/pdfjs', ['exports', 'pdfjs/main_loader'], factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
|
||||||
factory(exports, require('../src/main_loader.js'));
|
|
||||||
} else {
|
|
||||||
factory((root.pdfjsWebPDFJS = {}), root.pdfjsMainLoader);
|
|
||||||
}
|
|
||||||
}(this, function (exports, mainLoader) {
|
|
||||||
// Re-export all mainLoader members.
|
|
||||||
for (var i in mainLoader) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(mainLoader, i)) {
|
|
||||||
exports[i] = mainLoader[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getGlobalEventBus } from './dom_events';
|
import { getGlobalEventBus } from './dom_events';
|
||||||
import { renderTextLayer } from './pdfjs';
|
import { renderTextLayer } from 'pdfjs-lib';
|
||||||
|
|
||||||
var EXPAND_DIVS_TIMEOUT = 300; // ms
|
var EXPAND_DIVS_TIMEOUT = 300; // ms
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PDFJS } from './pdfjs';
|
import { PDFJS } from 'pdfjs-lib';
|
||||||
|
|
||||||
var CSS_UNITS = 96.0 / 72.0;
|
var CSS_UNITS = 96.0 / 72.0;
|
||||||
var DEFAULT_SCALE_VALUE = 'auto';
|
var DEFAULT_SCALE_VALUE = 'auto';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user