Skip to content
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

Convert the files in the /src/shared folder to ES6 modules #8378

Merged
merged 1 commit into from
May 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions src/shared/compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,7 @@
/* eslint-disable no-extend-native */
/* globals VBArray, PDFJS, global */

'use strict';

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/shared/compatibility', ['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.pdfjsSharedCompatibility = {}));
}
}(this, function (exports) {

// Skip compatibility checks for the extensions and if we already run
// Skip compatibility checks for the extensions and if we already ran
// this module.
if ((typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) &&
Expand Down Expand Up @@ -1850,5 +1838,3 @@ PDFJS.compatibilityChecked = true;
})();

}

}));
150 changes: 70 additions & 80 deletions src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,7 @@
*/
/* globals global, process, __pdfjsdev_webpack__ */

'use strict';

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define('pdfjs/shared/util', ['exports', 'pdfjs/shared/compatibility'],
factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('./compatibility.js'));
} else {
factory((root.pdfjsSharedUtil = {}), root.pdfjsSharedCompatibility);
}
}(this, function (exports, compatibility) {
import './compatibility';

var globalScope = (typeof window !== 'undefined') ? window :
(typeof global !== 'undefined') ? global :
Expand Down Expand Up @@ -1363,71 +1352,72 @@ function loadJpegStream(id, imageUrl, objs) {
img.src = imageUrl;
}

exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
exports.OPS = OPS;
exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
exports.AnnotationFieldFlag = AnnotationFieldFlag;
exports.AnnotationFlag = AnnotationFlag;
exports.AnnotationType = AnnotationType;
exports.FontType = FontType;
exports.ImageKind = ImageKind;
exports.CMapCompressionType = CMapCompressionType;
exports.InvalidPDFException = InvalidPDFException;
exports.MessageHandler = MessageHandler;
exports.MissingDataException = MissingDataException;
exports.MissingPDFException = MissingPDFException;
exports.NotImplementedException = NotImplementedException;
exports.PageViewport = PageViewport;
exports.PasswordException = PasswordException;
exports.PasswordResponses = PasswordResponses;
exports.StatTimer = StatTimer;
exports.StreamType = StreamType;
exports.TextRenderingMode = TextRenderingMode;
exports.UnexpectedResponseException = UnexpectedResponseException;
exports.UnknownErrorException = UnknownErrorException;
exports.Util = Util;
exports.XRefParseException = XRefParseException;
exports.arrayByteLength = arrayByteLength;
exports.arraysToBytes = arraysToBytes;
exports.assert = assert;
exports.bytesToString = bytesToString;
exports.createBlob = createBlob;
exports.createPromiseCapability = createPromiseCapability;
exports.createObjectURL = createObjectURL;
exports.deprecated = deprecated;
exports.error = error;
exports.getLookupTableFactory = getLookupTableFactory;
exports.getVerbosityLevel = getVerbosityLevel;
exports.globalScope = globalScope;
exports.info = info;
exports.isArray = isArray;
exports.isArrayBuffer = isArrayBuffer;
exports.isBool = isBool;
exports.isEmptyObj = isEmptyObj;
exports.isInt = isInt;
exports.isNum = isNum;
exports.isString = isString;
exports.isSpace = isSpace;
exports.isNodeJS = isNodeJS;
exports.isSameOrigin = isSameOrigin;
exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
exports.isLittleEndian = isLittleEndian;
exports.isEvalSupported = isEvalSupported;
exports.loadJpegStream = loadJpegStream;
exports.log2 = log2;
exports.readInt8 = readInt8;
exports.readUint16 = readUint16;
exports.readUint32 = readUint32;
exports.removeNullCharacters = removeNullCharacters;
exports.setVerbosityLevel = setVerbosityLevel;
exports.shadow = shadow;
exports.string32 = string32;
exports.stringToBytes = stringToBytes;
exports.stringToPDFString = stringToPDFString;
exports.stringToUTF8String = stringToUTF8String;
exports.utf8StringToString = utf8StringToString;
exports.warn = warn;
}));
export {
FONT_IDENTITY_MATRIX,
IDENTITY_MATRIX,
OPS,
VERBOSITY_LEVELS,
UNSUPPORTED_FEATURES,
AnnotationBorderStyleType,
AnnotationFieldFlag,
AnnotationFlag,
AnnotationType,
FontType,
ImageKind,
CMapCompressionType,
InvalidPDFException,
MessageHandler,
MissingDataException,
MissingPDFException,
NotImplementedException,
PageViewport,
PasswordException,
PasswordResponses,
StatTimer,
StreamType,
TextRenderingMode,
UnexpectedResponseException,
UnknownErrorException,
Util,
XRefParseException,
arrayByteLength,
arraysToBytes,
assert,
bytesToString,
createBlob,
createPromiseCapability,
createObjectURL,
deprecated,
error,
getLookupTableFactory,
getVerbosityLevel,
globalScope,
info,
isArray,
isArrayBuffer,
isBool,
isEmptyObj,
isInt,
isNum,
isString,
isSpace,
isNodeJS,
isSameOrigin,
createValidAbsoluteUrl,
isLittleEndian,
isEvalSupported,
loadJpegStream,
log2,
readInt8,
readUint16,
readUint32,
removeNullCharacters,
setVerbosityLevel,
shadow,
string32,
stringToBytes,
stringToPDFString,
stringToUTF8String,
utf8StringToString,
warn,
};