1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #11465 from Snuffleupagus/import-file-extension

Ensure that all `import` and `require` statements, in the entire code-base, have a `.js` file extension
This commit is contained in:
Tim van der Meij 2020-01-06 23:24:43 +01:00 committed by GitHub
commit 93aa613db7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
125 changed files with 453 additions and 443 deletions

View file

@ -27,13 +27,13 @@ import {
stringToPDFString,
Util,
warn,
} from "../shared/util";
import { Catalog, FileSpec, ObjectLoader } from "./obj";
import { Dict, isDict, isName, isRef, isStream } from "./primitives";
import { ColorSpace } from "./colorspace";
import { getInheritableProperty } from "./core_utils";
import { OperatorList } from "./operator_list";
import { Stream } from "./stream";
} from "../shared/util.js";
import { Catalog, FileSpec, ObjectLoader } from "./obj.js";
import { Dict, isDict, isName, isRef, isStream } from "./primitives.js";
import { ColorSpace } from "./colorspace.js";
import { getInheritableProperty } from "./core_utils.js";
import { OperatorList } from "./operator_list.js";
import { Stream } from "./stream.js";
class AnnotationFactory {
/**

View file

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { warn } from "../shared/util";
import { warn } from "../shared/util.js";
// Character types for symbols from 0000 to 00FF.
// Source: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt

View file

@ -25,7 +25,7 @@
* or -1 when EOF is reached.
*/
import { info } from "../shared/util";
import { info } from "../shared/util.js";
let CCITTFaxDecoder = (function CCITTFaxDecoder() {
const ccittEOL = -2;

View file

@ -13,9 +13,9 @@
* limitations under the License.
*/
import { Dict, isDict } from "./primitives";
import { CCITTFaxDecoder } from "./ccitt";
import { DecodeStream } from "./stream";
import { Dict, isDict } from "./primitives.js";
import { CCITTFaxDecoder } from "./ccitt.js";
import { DecodeStream } from "./stream.js";
var CCITTFaxStream = (function CCITTFaxStreamClosure() {
function CCITTFaxStream(str, maybeLength, params) {

View file

@ -20,13 +20,13 @@ import {
stringToBytes,
Util,
warn,
} from "../shared/util";
} from "../shared/util.js";
import {
ExpertCharset,
ExpertSubsetCharset,
ISOAdobeCharset,
} from "./charsets";
import { ExpertEncoding, StandardEncoding } from "./encodings";
} from "./charsets.js";
import { ExpertEncoding, StandardEncoding } from "./encodings.js";
// Maximum subroutine call depth of type 2 chartrings. Matches OTS.
var MAX_SUBR_NESTING = 10;

View file

@ -19,8 +19,8 @@ import {
arraysToBytes,
createPromiseCapability,
isEmptyObj,
} from "../shared/util";
import { MissingDataException } from "./core_utils";
} from "../shared/util.js";
import { MissingDataException } from "./core_utils.js";
class ChunkedStream {
constructor(length, chunkSize, manager) {

View file

@ -19,11 +19,11 @@ import {
isString,
unreachable,
warn,
} from "../shared/util";
import { isCmd, isEOF, isName, isStream } from "./primitives";
import { Lexer } from "./parser";
import { MissingDataException } from "./core_utils";
import { Stream } from "./stream";
} from "../shared/util.js";
import { isCmd, isEOF, isName, isStream } from "./primitives.js";
import { Lexer } from "./parser.js";
import { MissingDataException } from "./core_utils.js";
import { Stream } from "./stream.js";
var BUILT_IN_CMAPS = [
// << Start unicode maps.

View file

@ -21,8 +21,8 @@ import {
shadow,
unreachable,
warn,
} from "../shared/util";
import { isDict, isName, isStream } from "./primitives";
} from "../shared/util.js";
import { isDict, isName, isStream } from "./primitives.js";
/**
* Resizes an RGB image with 3 components.

View file

@ -14,7 +14,7 @@
*/
/* eslint no-var: error */
import { assert, BaseException, warn } from "../shared/util";
import { assert, BaseException, warn } from "../shared/util.js";
function getLookupTableFactory(initializer) {
let lookup;

View file

@ -22,9 +22,9 @@ import {
unreachable,
utf8StringToString,
warn,
} from "../shared/util";
import { isDict, isName, Name } from "./primitives";
import { DecryptStream } from "./stream";
} from "../shared/util.js";
import { isDict, isName, Name } from "./primitives.js";
import { DecryptStream } from "./stream.js";
var ARCFourCipher = (function ARCFourCipherClosure() {
function ARCFourCipher(key) {

View file

@ -31,22 +31,22 @@ import {
stringToPDFString,
Util,
warn,
} from "../shared/util";
import { Catalog, ObjectLoader, XRef } from "./obj";
import { Dict, isDict, isName, isStream, Ref } from "./primitives";
} from "../shared/util.js";
import { Catalog, ObjectLoader, XRef } from "./obj.js";
import { Dict, isDict, isName, isStream, Ref } from "./primitives.js";
import {
getInheritableProperty,
MissingDataException,
XRefEntryException,
XRefParseException,
} from "./core_utils";
import { NullStream, Stream, StreamsSequenceStream } from "./stream";
import { AnnotationFactory } from "./annotation";
import { calculateMD5 } from "./crypto";
import { Linearization } from "./parser";
import { OperatorList } from "./operator_list";
import { PartialEvaluator } from "./evaluator";
import { PDFFunctionFactory } from "./function";
} from "./core_utils.js";
import { NullStream, Stream, StreamsSequenceStream } from "./stream.js";
import { AnnotationFactory } from "./annotation.js";
import { calculateMD5 } from "./crypto.js";
import { Linearization } from "./parser.js";
import { OperatorList } from "./operator_list.js";
import { PartialEvaluator } from "./evaluator.js";
import { PDFFunctionFactory } from "./function.js";
const DEFAULT_USER_UNIT = 1.0;
const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];

View file

@ -32,8 +32,8 @@ import {
UNSUPPORTED_FEATURES,
Util,
warn,
} from "../shared/util";
import { CMapFactory, IdentityCMap } from "./cmap";
} from "../shared/util.js";
import { CMapFactory, IdentityCMap } from "./cmap.js";
import {
Cmd,
Dict,
@ -44,7 +44,7 @@ import {
isStream,
Name,
Ref,
} from "./primitives";
} from "./primitives.js";
import {
ErrorFont,
Font,
@ -52,7 +52,7 @@ import {
getFontType,
IdentityToUnicodeMap,
ToUnicodeMap,
} from "./fonts";
} from "./fonts.js";
import {
getEncoding,
MacRomanEncoding,
@ -60,31 +60,31 @@ import {
SymbolSetEncoding,
WinAnsiEncoding,
ZapfDingbatsEncoding,
} from "./encodings";
} from "./encodings.js";
import {
getNormalizedUnicodes,
getUnicodeForGlyph,
reverseIfRtl,
} from "./unicode";
} from "./unicode.js";
import {
getSerifFonts,
getStdFontMap,
getSymbolsFonts,
} from "./standard_fonts";
import { getTilingPatternIR, Pattern } from "./pattern";
import { Lexer, Parser } from "./parser";
import { bidi } from "./bidi";
import { ColorSpace } from "./colorspace";
import { DecodeStream } from "./stream";
import { getGlyphsUnicode } from "./glyphlist";
import { getLookupTableFactory } from "./core_utils";
import { getMetrics } from "./metrics";
import { isPDFFunction } from "./function";
import { JpegStream } from "./jpeg_stream";
import { MurmurHash3_64 } from "./murmurhash3";
import { NativeImageDecoder } from "./image_utils";
import { OperatorList } from "./operator_list";
import { PDFImage } from "./image";
} from "./standard_fonts.js";
import { getTilingPatternIR, Pattern } from "./pattern.js";
import { Lexer, Parser } from "./parser.js";
import { bidi } from "./bidi.js";
import { ColorSpace } from "./colorspace.js";
import { DecodeStream } from "./stream.js";
import { getGlyphsUnicode } from "./glyphlist.js";
import { getLookupTableFactory } from "./core_utils.js";
import { getMetrics } from "./metrics.js";
import { isPDFFunction } from "./function.js";
import { JpegStream } from "./jpeg_stream.js";
import { MurmurHash3_64 } from "./murmurhash3.js";
import { NativeImageDecoder } from "./image_utils.js";
import { OperatorList } from "./operator_list.js";
import { PDFImage } from "./image.js";
var PartialEvaluator = (function PartialEvaluatorClosure() {
const DefaultPartialEvaluatorOptions = {

View file

@ -19,11 +19,11 @@ import {
FormatError,
unreachable,
warn,
} from "../shared/util";
import { CFFParser } from "./cff_parser";
import { getGlyphsUnicode } from "./glyphlist";
import { StandardEncoding } from "./encodings";
import { Stream } from "./stream";
} from "../shared/util.js";
import { CFFParser } from "./cff_parser.js";
import { getGlyphsUnicode } from "./glyphlist.js";
import { StandardEncoding } from "./encodings.js";
import { Stream } from "./stream.js";
var FontRendererFactory = (function FontRendererFactoryClosure() {
function getLong(data, offset) {

View file

@ -27,7 +27,7 @@ import {
string32,
unreachable,
warn,
} from "../shared/util";
} from "../shared/util.js";
import {
CFF,
CFFCharset,
@ -39,32 +39,32 @@ import {
CFFStandardStrings,
CFFStrings,
CFFTopDict,
} from "./cff_parser";
import { getDingbatsGlyphsUnicode, getGlyphsUnicode } from "./glyphlist";
} from "./cff_parser.js";
import { getDingbatsGlyphsUnicode, getGlyphsUnicode } from "./glyphlist.js";
import {
getEncoding,
MacRomanEncoding,
StandardEncoding,
SymbolSetEncoding,
ZapfDingbatsEncoding,
} from "./encodings";
} from "./encodings.js";
import {
getGlyphMapForStandardFonts,
getNonStdFontMap,
getStdFontMap,
getSupplementalGlyphMapForArialBlack,
getSupplementalGlyphMapForCalibri,
} from "./standard_fonts";
} from "./standard_fonts.js";
import {
getUnicodeForGlyph,
getUnicodeRangeFor,
mapSpecialUnicodeValues,
} from "./unicode";
import { FontRendererFactory } from "./font_renderer";
import { IdentityCMap } from "./cmap";
import { MissingDataException } from "./core_utils";
import { Stream } from "./stream";
import { Type1Parser } from "./type1_parser";
} from "./unicode.js";
import { FontRendererFactory } from "./font_renderer.js";
import { IdentityCMap } from "./cmap.js";
import { MissingDataException } from "./core_utils.js";
import { Stream } from "./stream.js";
import { Type1Parser } from "./type1_parser.js";
// Unicode Private Use Areas:
const PRIVATE_USE_AREAS = [

View file

@ -20,9 +20,9 @@ import {
isEvalSupported,
shadow,
unreachable,
} from "../shared/util";
import { isDict, isStream } from "./primitives";
import { PostScriptLexer, PostScriptParser } from "./ps_parser";
} from "../shared/util.js";
import { isDict, isStream } from "./primitives.js";
import { PostScriptLexer, PostScriptParser } from "./ps_parser.js";
let IsEvalSupportedCached = {
get value() {

View file

@ -14,7 +14,7 @@
*/
/* no-babel-preset */
var getLookupTableFactory = require("./core_utils").getLookupTableFactory;
var getLookupTableFactory = require("./core_utils.js").getLookupTableFactory;
var getGlyphsUnicode = getLookupTableFactory(function(t) {
t["A"] = 0x0041;

View file

@ -13,12 +13,12 @@
* limitations under the License.
*/
import { assert, FormatError, ImageKind, info, warn } from "../shared/util";
import { isName, isStream, Name } from "./primitives";
import { ColorSpace } from "./colorspace";
import { DecodeStream } from "./stream";
import { JpegStream } from "./jpeg_stream";
import { JpxImage } from "./jpx";
import { assert, FormatError, ImageKind, info, warn } from "../shared/util.js";
import { isName, isStream, Name } from "./primitives.js";
import { ColorSpace } from "./colorspace.js";
import { DecodeStream } from "./stream.js";
import { JpegStream } from "./jpeg_stream.js";
import { JpxImage } from "./jpx.js";
var PDFImage = (function PDFImageClosure() {
/**

View file

@ -14,9 +14,9 @@
*/
/* eslint no-var: error */
import { ColorSpace } from "./colorspace";
import { JpegStream } from "./jpeg_stream";
import { Stream } from "./stream";
import { ColorSpace } from "./colorspace.js";
import { JpegStream } from "./jpeg_stream.js";
import { Stream } from "./stream.js";
class NativeImageDecoder {
constructor({

View file

@ -20,9 +20,9 @@ import {
readUint16,
readUint32,
shadow,
} from "../shared/util";
import { ArithmeticDecoder } from "./arithmetic_decoder";
import { CCITTFaxDecoder } from "./ccitt";
} from "../shared/util.js";
import { ArithmeticDecoder } from "./arithmetic_decoder.js";
import { CCITTFaxDecoder } from "./ccitt.js";
class Jbig2Error extends BaseException {
constructor(msg) {

View file

@ -13,10 +13,10 @@
* limitations under the License.
*/
import { isDict, isStream } from "./primitives";
import { DecodeStream } from "./stream";
import { Jbig2Image } from "./jbig2";
import { shadow } from "../shared/util";
import { isDict, isStream } from "./primitives.js";
import { DecodeStream } from "./stream.js";
import { Jbig2Image } from "./jbig2.js";
import { shadow } from "../shared/util.js";
/**
* For JBIG2's we use a library to decode these images and

View file

@ -13,10 +13,10 @@
* limitations under the License.
*/
import { createObjectURL, shadow } from "../shared/util";
import { DecodeStream } from "./stream";
import { isDict } from "./primitives";
import { JpegImage } from "./jpg";
import { createObjectURL, shadow } from "../shared/util.js";
import { DecodeStream } from "./stream.js";
import { isDict } from "./primitives.js";
import { JpegImage } from "./jpg.js";
/**
* Depending on the type of JPEG a JpegStream is handled in different ways. For

View file

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { assert, BaseException, warn } from "../shared/util";
import { assert, BaseException, warn } from "../shared/util.js";
class JpegError extends BaseException {
constructor(msg) {

View file

@ -20,8 +20,8 @@ import {
readUint16,
readUint32,
warn,
} from "../shared/util";
import { ArithmeticDecoder } from "./arithmetic_decoder";
} from "../shared/util.js";
import { ArithmeticDecoder } from "./arithmetic_decoder.js";
class JpxError extends BaseException {
constructor(msg) {

View file

@ -13,9 +13,9 @@
* limitations under the License.
*/
import { DecodeStream } from "./stream";
import { JpxImage } from "./jpx";
import { shadow } from "../shared/util";
import { DecodeStream } from "./stream.js";
import { JpxImage } from "./jpx.js";
import { shadow } from "../shared/util.js";
/**
* For JPEG 2000's we use a library to decode these images and

View file

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { getLookupTableFactory } from "./core_utils";
import { getLookupTableFactory } from "./core_utils.js";
// The Metrics object contains glyph widths (in glyph space units).
// As per PDF spec, for most fonts (Type 3 being an exception) a glyph

View file

@ -18,7 +18,7 @@
*/
/* eslint no-var: error */
import { isArrayBuffer, isString } from "../shared/util";
import { isArrayBuffer, isString } from "../shared/util.js";
const SEED = 0xc3d2e1f0;
// Workaround for missing math precision in JS.

View file

@ -30,7 +30,7 @@ import {
stringToUTF8String,
unreachable,
warn,
} from "../shared/util";
} from "../shared/util.js";
import {
clearPrimitiveCaches,
Cmd,
@ -44,16 +44,16 @@ import {
Ref,
RefSet,
RefSetCache,
} from "./primitives";
import { Lexer, Parser } from "./parser";
} from "./primitives.js";
import { Lexer, Parser } from "./parser.js";
import {
MissingDataException,
toRomanNumerals,
XRefEntryException,
XRefParseException,
} from "./core_utils";
import { CipherTransformFactory } from "./crypto";
import { ColorSpace } from "./colorspace";
} from "./core_utils.js";
import { CipherTransformFactory } from "./crypto.js";
import { ColorSpace } from "./colorspace.js";
function fetchDestination(dest) {
return isDict(dest) ? dest.get("D") : dest;

View file

@ -14,7 +14,7 @@
*/
/* eslint-disable no-unsanitized/method */
import { assert, ImageKind, OPS } from "../shared/util";
import { assert, ImageKind, OPS } from "../shared/util.js";
var QueueOptimizer = (function QueueOptimizerClosure() {
function addState(parentState, pattern, checkFn, iterateFn, processFn) {

View file

@ -22,7 +22,7 @@ import {
NullStream,
PredictorStream,
RunLengthStream,
} from "./stream";
} from "./stream.js";
import {
assert,
bytesToString,
@ -32,7 +32,7 @@ import {
isSpace,
StreamType,
warn,
} from "../shared/util";
} from "../shared/util.js";
import {
Cmd,
Dict,
@ -43,12 +43,12 @@ import {
isName,
Name,
Ref,
} from "./primitives";
import { CCITTFaxStream } from "./ccitt_stream";
import { Jbig2Stream } from "./jbig2_stream";
import { JpegStream } from "./jpeg_stream";
import { JpxStream } from "./jpx_stream";
import { MissingDataException } from "./core_utils";
} from "./primitives.js";
import { CCITTFaxStream } from "./ccitt_stream.js";
import { Jbig2Stream } from "./jbig2_stream.js";
import { JpegStream } from "./jpeg_stream.js";
import { JpxStream } from "./jpx_stream.js";
import { MissingDataException } from "./core_utils.js";
const MAX_LENGTH_TO_CACHE = 1000;
const MAX_ADLER32_LENGTH = 5552;

View file

@ -21,10 +21,10 @@ import {
UNSUPPORTED_FEATURES,
Util,
warn,
} from "../shared/util";
import { ColorSpace } from "./colorspace";
import { isStream } from "./primitives";
import { MissingDataException } from "./core_utils";
} from "../shared/util.js";
import { ColorSpace } from "./colorspace.js";
import { isStream } from "./primitives.js";
import { MissingDataException } from "./core_utils.js";
var ShadingType = {
FUNCTION_BASED: 1,

View file

@ -18,11 +18,11 @@ import {
shadow,
unreachable,
warn,
} from "../shared/util";
import { ChunkedStreamManager } from "./chunked_stream";
import { MissingDataException } from "./core_utils";
import { PDFDocument } from "./document";
import { Stream } from "./stream";
} from "../shared/util.js";
import { ChunkedStreamManager } from "./chunked_stream.js";
import { MissingDataException } from "./core_utils.js";
import { PDFDocument } from "./document.js";
import { Stream } from "./stream.js";
class BasePdfManager {
constructor() {

View file

@ -14,7 +14,7 @@
*/
/* uses XRef */
import { assert } from "../shared/util";
import { assert } from "../shared/util.js";
var EOF = {};

View file

@ -14,8 +14,8 @@
*/
/* eslint no-var: error */
import { FormatError, isSpace, shadow } from "../shared/util";
import { EOF } from "./primitives";
import { FormatError, isSpace, shadow } from "../shared/util.js";
import { EOF } from "./primitives.js";
class PostScriptParser {
constructor(lexer) {

View file

@ -14,7 +14,7 @@
*/
/* eslint no-var: error */
import { getLookupTableFactory } from "./core_utils";
import { getLookupTableFactory } from "./core_utils.js";
/**
* Hold a map of decoded fonts and of the standard fourteen Type1

View file

@ -24,8 +24,8 @@ import {
isSpace,
stringToBytes,
unreachable,
} from "../shared/util";
import { isDict } from "./primitives";
} from "../shared/util.js";
import { isDict } from "./primitives.js";
var Stream = (function StreamClosure() {
function Stream(arrayBuffer, start, length, dict) {

View file

@ -13,9 +13,9 @@
* limitations under the License.
*/
import { isSpace, warn } from "../shared/util";
import { getEncoding } from "./encodings";
import { Stream } from "./stream";
import { isSpace, warn } from "../shared/util.js";
import { getEncoding } from "./encodings.js";
import { Stream } from "./stream.js";
// Hinting is currently disabled due to unknown problems on windows
// in tracemonkey and various other pdfs with type1 fonts.

View file

@ -14,7 +14,7 @@
*/
/* no-babel-preset */
var getLookupTableFactory = require("./core_utils").getLookupTableFactory;
var getLookupTableFactory = require("./core_utils.js").getLookupTableFactory;
// Some characters, e.g. copyrightserif, are mapped to the private use area
// and might not be displayed using standard fonts. Mapping/hacking well-known

View file

@ -29,13 +29,13 @@ import {
UNSUPPORTED_FEATURES,
VerbosityLevel,
warn,
} from "../shared/util";
import { clearPrimitiveCaches, Ref } from "./primitives";
import { LocalPdfManager, NetworkPdfManager } from "./pdf_manager";
import { isNodeJS } from "../shared/is_node";
import { MessageHandler } from "../shared/message_handler";
import { PDFWorkerStream } from "./worker_stream";
import { XRefParseException } from "./core_utils";
} from "../shared/util.js";
import { clearPrimitiveCaches, Ref } from "./primitives.js";
import { LocalPdfManager, NetworkPdfManager } from "./pdf_manager.js";
import { isNodeJS } from "../shared/is_node.js";
import { MessageHandler } from "../shared/message_handler.js";
import { PDFWorkerStream } from "./worker_stream.js";
import { XRefParseException } from "./core_utils.js";
var WorkerTask = (function WorkerTaskClosure() {
function WorkerTask(name) {

View file

@ -14,7 +14,7 @@
*/
/* eslint no-var: error */
import { assert } from "../shared/util";
import { assert } from "../shared/util.js";
/** @implements {IPDFStream} */
class PDFWorkerStream {

View file

@ -20,7 +20,7 @@ import {
getFilenameFromUrl,
LinkTarget,
PDFDateString,
} from "./display_utils";
} from "./display_utils.js";
import {
AnnotationBorderStyleType,
AnnotationType,
@ -28,7 +28,7 @@ import {
unreachable,
Util,
warn,
} from "../shared/util";
} from "../shared/util.js";
/**
* @typedef {Object} AnnotationElementParameters

View file

@ -37,7 +37,7 @@ import {
UnknownErrorException,
unreachable,
warn,
} from "../shared/util";
} from "../shared/util.js";
import {
deprecated,
DOMCanvasFactory,
@ -47,16 +47,16 @@ import {
releaseImageResources,
RenderingCancelledException,
StatTimer,
} from "./display_utils";
import { FontFaceObject, FontLoader } from "./font_loader";
import { apiCompatibilityParams } from "./api_compatibility";
import { CanvasGraphics } from "./canvas";
import { GlobalWorkerOptions } from "./worker_options";
import { isNodeJS } from "../shared/is_node";
import { MessageHandler } from "../shared/message_handler";
import { Metadata } from "./metadata";
import { PDFDataTransportStream } from "./transport_stream";
import { WebGLContext } from "./webgl";
} from "./display_utils.js";
import { FontFaceObject, FontLoader } from "./font_loader.js";
import { apiCompatibilityParams } from "./api_compatibility.js";
import { CanvasGraphics } from "./canvas.js";
import { GlobalWorkerOptions } from "./worker_options.js";
import { isNodeJS } from "../shared/is_node.js";
import { MessageHandler } from "../shared/message_handler.js";
import { Metadata } from "./metadata.js";
import { PDFDataTransportStream } from "./transport_stream.js";
import { WebGLContext } from "./webgl.js";
const DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536
const RENDERING_CANCELLED_TIMEOUT = 100; // ms
@ -1635,7 +1635,7 @@ const PDFWorker = (function PDFWorkerClosure() {
if (typeof SystemJS !== "object") {
throw new Error("SystemJS must be used to load fake worker.");
}
const worker = await SystemJS.import("pdfjs/core/worker");
const worker = await SystemJS.import("pdfjs/core/worker.js");
return worker.WorkerMessageHandler;
}
if (

View file

@ -15,7 +15,7 @@
let compatibilityParams = Object.create(null);
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
const { isNodeJS } = require("../shared/is_node");
const { isNodeJS } = require("../shared/is_node.js");
const userAgent =
(typeof navigator !== "undefined" && navigator.userAgent) || "";

View file

@ -26,8 +26,8 @@ import {
unreachable,
Util,
warn,
} from "../shared/util";
import { getShadingPatternFromIR, TilingPattern } from "./pattern_helper";
} from "../shared/util.js";
import { getShadingPatternFromIR, TilingPattern } from "./pattern_helper.js";
// <canvas> contexts store most of the state we need natively.
// However, PDF needs a bit more state, which we store here.

View file

@ -23,7 +23,7 @@ import {
stringToBytes,
Util,
warn,
} from "../shared/util";
} from "../shared/util.js";
const DEFAULT_LINK_REL = "noopener noreferrer nofollow";
const SVG_NS = "http://www.w3.org/2000/svg";

View file

@ -18,13 +18,13 @@ import {
AbortException,
assert,
createPromiseCapability,
} from "../shared/util";
} from "../shared/util.js";
import {
createResponseStatusError,
extractFilenameFromHeader,
validateRangeRequestCapabilities,
validateResponseStatus,
} from "./network_utils";
} from "./network_utils.js";
function createFetchOptions(headers, withCredentials, abortController) {
return {

View file

@ -22,7 +22,7 @@ import {
unreachable,
UNSUPPORTED_FEATURES,
warn,
} from "../shared/util";
} from "../shared/util.js";
class BaseFontLoader {
constructor({ docId, onUnsupportedFeature }) {

View file

@ -13,8 +13,8 @@
* limitations under the License.
*/
import { assert } from "../shared/util";
import { SimpleXMLParser } from "./xml_parser";
import { assert } from "../shared/util.js";
import { SimpleXMLParser } from "./xml_parser.js";
class Metadata {
constructor(data) {

View file

@ -14,12 +14,16 @@
*/
/* eslint no-var: error */
import { assert, createPromiseCapability, stringToBytes } from "../shared/util";
import {
assert,
createPromiseCapability,
stringToBytes,
} from "../shared/util.js";
import {
createResponseStatusError,
extractFilenameFromHeader,
validateRangeRequestCapabilities,
} from "./network_utils";
} from "./network_utils.js";
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("FIREFOX || MOZCENTRAL")) {
throw new Error(

View file

@ -17,8 +17,8 @@ import {
assert,
MissingPDFException,
UnexpectedResponseException,
} from "../shared/util";
import { getFilenameFromContentDispositionHeader } from "./content_disposition";
} from "../shared/util.js";
import { getFilenameFromContentDispositionHeader } from "./content_disposition.js";
function validateRangeRequestCapabilities({
getResponseHeader,

View file

@ -24,11 +24,11 @@ import {
assert,
createPromiseCapability,
MissingPDFException,
} from "../shared/util";
} from "../shared/util.js";
import {
extractFilenameFromHeader,
validateRangeRequestCapabilities,
} from "./network_utils";
} from "./network_utils.js";
const fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//;

View file

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { FormatError, info, Util } from "../shared/util";
import { FormatError, info, Util } from "../shared/util.js";
var ShadingIRs = {};

View file

@ -25,9 +25,9 @@ import {
TextRenderingMode,
Util,
warn,
} from "../shared/util";
import { DOMSVGFactory } from "./display_utils";
import { isNodeJS } from "../shared/is_node";
} from "../shared/util.js";
import { DOMSVGFactory } from "./display_utils.js";
import { isNodeJS } from "../shared/is_node.js";
let SVGGraphics = function() {
throw new Error("Not implemented: SVGGraphics");

View file

@ -13,7 +13,11 @@
* limitations under the License.
*/
import { AbortException, createPromiseCapability, Util } from "../shared/util";
import {
AbortException,
createPromiseCapability,
Util,
} from "../shared/util.js";
/**
* Text layer render parameters.

View file

@ -14,7 +14,7 @@
*/
/* eslint no-var: error */
import { assert, createPromiseCapability } from "../shared/util";
import { assert, createPromiseCapability } from "../shared/util.js";
/** @implements {IPDFStream} */
class PDFDataTransportStream {

View file

@ -14,7 +14,7 @@
*/
/* eslint-disable no-multi-str */
import { shadow } from "../shared/util";
import { shadow } from "../shared/util.js";
class WebGLContext {
constructor({ enable = false }) {

View file

@ -12,12 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable no-unused-vars */
import { getVerbosityLevel, setVerbosityLevel } from "./shared/util";
import { Jbig2mage } from "./core/jbig2";
import { JpegImage } from "./core/jpg";
import { JpxImage } from "./core/jpx";
import { getVerbosityLevel, setVerbosityLevel } from "./shared/util.js";
import { Jbig2mage } from "./core/jbig2.js";
import { JpegImage } from "./core/jpg.js";
import { JpxImage } from "./core/jpx.js";
// To ensure that the standalone PDF.js image decoders have the same
// browser/environment compatibility as the regular PDF.js library,
@ -33,7 +32,9 @@ import { JpxImage } from "./core/jpx";
// - Promise
// - URL
// eslint-disable-next-line no-unused-vars
const pdfjsVersion = PDFJSDev.eval("BUNDLE_VERSION");
// eslint-disable-next-line no-unused-vars
const pdfjsBuild = PDFJSDev.eval("BUNDLE_BUILD");
export { Jbig2mage, JpegImage, JpxImage, getVerbosityLevel, setVerbosityLevel };

View file

@ -27,7 +27,7 @@ if (
}
globalThis._pdfjsCompatibilityChecked = true;
const { isNodeJS } = require("./is_node");
const { isNodeJS } = require("./is_node.js");
const hasDOM = typeof window === "object" && typeof document === "object";
const userAgent =
@ -148,7 +148,7 @@ if (
if (String.prototype.startsWith) {
return;
}
require("core-js/es/string/starts-with");
require("core-js/es/string/starts-with.js");
})();
// Provides support for String.prototype.endsWith in legacy browsers.
@ -157,7 +157,7 @@ if (
if (String.prototype.endsWith) {
return;
}
require("core-js/es/string/ends-with");
require("core-js/es/string/ends-with.js");
})();
// Provides support for String.prototype.includes in legacy browsers.
@ -166,7 +166,7 @@ if (
if (String.prototype.includes) {
return;
}
require("core-js/es/string/includes");
require("core-js/es/string/includes.js");
})();
// Provides support for Array.prototype.includes in legacy browsers.
@ -175,7 +175,7 @@ if (
if (Array.prototype.includes) {
return;
}
require("core-js/es/array/includes");
require("core-js/es/array/includes.js");
})();
// Provides support for Array.from in legacy browsers.
@ -184,7 +184,7 @@ if (
if (Array.from) {
return;
}
require("core-js/es/array/from");
require("core-js/es/array/from.js");
})();
// Provides support for Object.assign in legacy browsers.
@ -193,7 +193,7 @@ if (
if (Object.assign) {
return;
}
require("core-js/es/object/assign");
require("core-js/es/object/assign.js");
})();
// Provides support for Math.log2 in legacy browsers.
@ -202,7 +202,7 @@ if (
if (Math.log2) {
return;
}
Math.log2 = require("core-js/es/math/log2");
Math.log2 = require("core-js/es/math/log2.js");
})();
// Provides support for Number.isNaN in legacy browsers.
@ -211,7 +211,7 @@ if (
if (Number.isNaN) {
return;
}
Number.isNaN = require("core-js/es/number/is-nan");
Number.isNaN = require("core-js/es/number/is-nan.js");
})();
// Provides support for Number.isInteger in legacy browsers.
@ -220,7 +220,7 @@ if (
if (Number.isInteger) {
return;
}
Number.isInteger = require("core-js/es/number/is-integer");
Number.isInteger = require("core-js/es/number/is-integer.js");
})();
// Support: IE, Safari<11, Chrome<63
@ -237,7 +237,7 @@ if (
) {
return;
}
globalThis.Promise = require("core-js/es/promise/index");
globalThis.Promise = require("core-js/es/promise/index.js");
})();
// Support: IE
@ -252,7 +252,7 @@ if (
// builds.
return;
}
globalThis.URL = require("core-js/web/url");
globalThis.URL = require("core-js/web/url.js");
})();
// Support: IE, Node.js
@ -281,7 +281,7 @@ if (
if (isReadableStreamSupported) {
return;
}
globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill").ReadableStream;
globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
})();
// Support: IE<11, Safari<8, Chrome<36
@ -289,7 +289,7 @@ if (
if (globalThis.WeakMap) {
return;
}
globalThis.WeakMap = require("core-js/es/weak-map/index");
globalThis.WeakMap = require("core-js/es/weak-map/index.js");
})();
// Support: IE11
@ -297,7 +297,7 @@ if (
if (globalThis.WeakSet) {
return;
}
globalThis.WeakSet = require("core-js/es/weak-set/index");
globalThis.WeakSet = require("core-js/es/weak-set/index.js");
})();
// Provides support for String.codePointAt in legacy browsers.
@ -306,7 +306,7 @@ if (
if (String.prototype.codePointAt) {
return;
}
require("core-js/es/string/code-point-at");
require("core-js/es/string/code-point-at.js");
})();
// Provides support for String.fromCodePoint in legacy browsers.
@ -315,7 +315,7 @@ if (
if (String.fromCodePoint) {
return;
}
String.fromCodePoint = require("core-js/es/string/from-code-point");
String.fromCodePoint = require("core-js/es/string/from-code-point.js");
})();
// Support: IE
@ -323,7 +323,7 @@ if (
if (globalThis.Symbol) {
return;
}
require("core-js/es/symbol/index");
require("core-js/es/symbol/index.js");
})();
// Provides support for String.prototype.padStart in legacy browsers.
@ -332,7 +332,7 @@ if (
if (String.prototype.padStart) {
return;
}
require("core-js/es/string/pad-start");
require("core-js/es/string/pad-start.js");
})();
// Provides support for String.prototype.padEnd in legacy browsers.
@ -341,7 +341,7 @@ if (
if (String.prototype.padEnd) {
return;
}
require("core-js/es/string/pad-end");
require("core-js/es/string/pad-end.js");
})();
// Provides support for Object.values in legacy browsers.
@ -350,6 +350,6 @@ if (
if (Object.values) {
return;
}
Object.values = require("core-js/es/object/values");
Object.values = require("core-js/es/object/values.js");
})();
}

View file

@ -21,7 +21,7 @@ import {
MissingPDFException,
UnexpectedResponseException,
UnknownErrorException,
} from "./util";
} from "./util.js";
const CallbackKind = {
UNKNOWN: 0,

View file

@ -27,6 +27,6 @@ self.importScripts = (function(importScripts) {
importScripts("../node_modules/systemjs/dist/system.js");
importScripts("../systemjs.config.js");
SystemJS.import("pdfjs/core/worker").then(function() {
SystemJS.import("pdfjs/core/worker.js").then(function() {
// Worker is loaded at this point.
});