From 36881e3770ecb320351c650712dadfd3b335bcbd Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 2 Jan 2020 12:00:16 +0100 Subject: [PATCH] Ensure that all `import` and `require` statements, in the entire code-base, have a `.js` file extension In order to eventually get rid of SystemJS and start using native `import`s instead, we'll need to provide "complete" file identifiers since otherwise there'll be MIME type errors when attempting to use `import`. --- src/core/annotation.js | 14 +++--- src/core/bidi.js | 2 +- src/core/ccitt.js | 2 +- src/core/ccitt_stream.js | 6 +-- src/core/cff_parser.js | 6 +-- src/core/chunked_stream.js | 4 +- src/core/cmap.js | 10 ++-- src/core/colorspace.js | 4 +- src/core/core_utils.js | 2 +- src/core/crypto.js | 6 +-- src/core/document.js | 22 ++++---- src/core/evaluator.js | 42 ++++++++-------- src/core/font_renderer.js | 10 ++-- src/core/fonts.js | 22 ++++---- src/core/function.js | 6 +-- src/core/glyphlist.js | 2 +- src/core/image.js | 12 ++--- src/core/image_utils.js | 6 +-- src/core/jbig2.js | 6 +-- src/core/jbig2_stream.js | 8 +-- src/core/jpeg_stream.js | 8 +-- src/core/jpg.js | 2 +- src/core/jpx.js | 4 +- src/core/jpx_stream.js | 6 +-- src/core/metrics.js | 2 +- src/core/murmurhash3.js | 2 +- src/core/obj.js | 12 ++--- src/core/operator_list.js | 2 +- src/core/parser.js | 16 +++--- src/core/pattern.js | 8 +-- src/core/pdf_manager.js | 10 ++-- src/core/primitives.js | 2 +- src/core/ps_parser.js | 4 +- src/core/standard_fonts.js | 2 +- src/core/stream.js | 4 +- src/core/type1_parser.js | 6 +-- src/core/unicode.js | 2 +- src/core/worker.js | 14 +++--- src/core/worker_stream.js | 2 +- src/display/annotation_layer.js | 4 +- src/display/api.js | 24 ++++----- src/display/api_compatibility.js | 2 +- src/display/canvas.js | 4 +- src/display/display_utils.js | 2 +- src/display/fetch_stream.js | 4 +- src/display/font_loader.js | 2 +- src/display/metadata.js | 4 +- src/display/network.js | 8 ++- src/display/network_utils.js | 4 +- src/display/node_stream.js | 4 +- src/display/pattern_helper.js | 2 +- src/display/svg.js | 6 +-- src/display/text_layer.js | 6 ++- src/display/transport_stream.js | 2 +- src/display/webgl.js | 2 +- src/pdf.image_decoders.js | 11 ++-- src/shared/compatibility.js | 42 ++++++++-------- src/shared/message_handler.js | 2 +- src/worker_loader.js | 2 +- test/font/jasmine-boot.js | 8 +-- test/unit/annotation_spec.js | 12 ++--- test/unit/api_spec.js | 16 +++--- test/unit/bidi_spec.js | 2 +- test/unit/cff_parser_spec.js | 6 +-- test/unit/clitests_helper.js | 8 +-- test/unit/cmap_spec.js | 12 ++--- test/unit/colorspace_spec.js | 10 ++-- test/unit/core_utils_spec.js | 6 +-- test/unit/crypto_spec.js | 6 +-- test/unit/custom_spec.js | 8 +-- test/unit/display_svg_spec.js | 12 ++--- test/unit/display_utils_spec.js | 4 +- test/unit/document_spec.js | 2 +- test/unit/encodings_spec.js | 2 +- test/unit/evaluator_spec.js | 14 +++--- test/unit/fetch_stream_spec.js | 4 +- test/unit/function_spec.js | 6 +-- test/unit/jasmine-boot.js | 72 +++++++++++++-------------- test/unit/message_handler_spec.js | 6 +-- test/unit/metadata_spec.js | 4 +- test/unit/murmurhash3_spec.js | 2 +- test/unit/network_spec.js | 4 +- test/unit/network_utils_spec.js | 4 +- test/unit/node_stream_spec.js | 6 +-- test/unit/parser_spec.js | 8 +-- test/unit/pdf_find_controller_spec.js | 10 ++-- test/unit/pdf_find_utils_spec.js | 2 +- test/unit/pdf_history_spec.js | 2 +- test/unit/primitives_spec.js | 4 +- test/unit/stream_spec.js | 4 +- test/unit/test_utils.js | 8 +-- test/unit/type1_parser_spec.js | 6 +-- test/unit/ui_utils_spec.js | 6 +-- test/unit/unicode_spec.js | 4 +- test/unit/util_spec.js | 2 +- web/annotation_layer_builder.js | 4 +- web/app.js | 44 ++++++++-------- web/app_options.js | 2 +- web/base_viewer.js | 12 ++--- web/chromecom.js | 10 ++-- web/firefox_print_service.js | 6 +-- web/firefoxcom.js | 6 +-- web/genericcom.js | 8 +-- web/password_prompt.js | 2 +- web/pdf_cursor_tools.js | 2 +- web/pdf_document_properties.js | 2 +- web/pdf_find_bar.js | 4 +- web/pdf_find_controller.js | 4 +- web/pdf_history.js | 2 +- web/pdf_link_service.js | 2 +- web/pdf_page_view.js | 6 +-- web/pdf_presentation_mode.js | 2 +- web/pdf_print_service.js | 6 +-- web/pdf_sidebar.js | 4 +- web/pdf_sidebar_resizer.js | 2 +- web/pdf_single_page_viewer.js | 2 +- web/pdf_thumbnail_view.js | 4 +- web/pdf_thumbnail_viewer.js | 4 +- web/pdf_viewer.component.js | 5 +- web/pdf_viewer.js | 2 +- web/preferences.js | 2 +- web/secondary_toolbar.js | 6 +-- web/text_layer_builder.js | 2 +- web/toolbar.js | 2 +- web/viewer.js | 8 +-- 125 files changed, 453 insertions(+), 443 deletions(-) diff --git a/src/core/annotation.js b/src/core/annotation.js index 4297a5a04..2ef5ca64c 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -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 { /** diff --git a/src/core/bidi.js b/src/core/bidi.js index f0cad74b7..b81f55795 100644 --- a/src/core/bidi.js +++ b/src/core/bidi.js @@ -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 diff --git a/src/core/ccitt.js b/src/core/ccitt.js index 18f77069f..eaeb2f4ec 100644 --- a/src/core/ccitt.js +++ b/src/core/ccitt.js @@ -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; diff --git a/src/core/ccitt_stream.js b/src/core/ccitt_stream.js index 5dfc34c37..7b6b04a56 100644 --- a/src/core/ccitt_stream.js +++ b/src/core/ccitt_stream.js @@ -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) { diff --git a/src/core/cff_parser.js b/src/core/cff_parser.js index 20ec02d49..2877d3e92 100644 --- a/src/core/cff_parser.js +++ b/src/core/cff_parser.js @@ -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; diff --git a/src/core/chunked_stream.js b/src/core/chunked_stream.js index fede2e39a..9da75f2f2 100644 --- a/src/core/chunked_stream.js +++ b/src/core/chunked_stream.js @@ -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) { diff --git a/src/core/cmap.js b/src/core/cmap.js index a393afb5e..859e10dda 100644 --- a/src/core/cmap.js +++ b/src/core/cmap.js @@ -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. diff --git a/src/core/colorspace.js b/src/core/colorspace.js index e10bed18b..23d390033 100644 --- a/src/core/colorspace.js +++ b/src/core/colorspace.js @@ -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. diff --git a/src/core/core_utils.js b/src/core/core_utils.js index ad6be1a8e..2ae7c3318 100644 --- a/src/core/core_utils.js +++ b/src/core/core_utils.js @@ -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; diff --git a/src/core/crypto.js b/src/core/crypto.js index bc9b2b2c2..629c514f3 100644 --- a/src/core/crypto.js +++ b/src/core/crypto.js @@ -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) { diff --git a/src/core/document.js b/src/core/document.js index f241723fd..420fa00c3 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -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]; diff --git a/src/core/evaluator.js b/src/core/evaluator.js index c164de048..34147e921 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -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 = { diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js index b05e2eb4e..df6dadb81 100644 --- a/src/core/font_renderer.js +++ b/src/core/font_renderer.js @@ -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) { diff --git a/src/core/fonts.js b/src/core/fonts.js index 803512131..55fb0daed 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -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 = [ diff --git a/src/core/function.js b/src/core/function.js index fb27bf8b4..c4aba96d9 100644 --- a/src/core/function.js +++ b/src/core/function.js @@ -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() { diff --git a/src/core/glyphlist.js b/src/core/glyphlist.js index 2f95b584f..f9b6c58ab 100644 --- a/src/core/glyphlist.js +++ b/src/core/glyphlist.js @@ -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; diff --git a/src/core/image.js b/src/core/image.js index 1d27973f4..cc79389ed 100644 --- a/src/core/image.js +++ b/src/core/image.js @@ -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() { /** diff --git a/src/core/image_utils.js b/src/core/image_utils.js index 58210f7c5..d12862ddf 100644 --- a/src/core/image_utils.js +++ b/src/core/image_utils.js @@ -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({ diff --git a/src/core/jbig2.js b/src/core/jbig2.js index b70b1daa1..4e8412ca0 100644 --- a/src/core/jbig2.js +++ b/src/core/jbig2.js @@ -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) { diff --git a/src/core/jbig2_stream.js b/src/core/jbig2_stream.js index 86f007c8c..7572c28d3 100644 --- a/src/core/jbig2_stream.js +++ b/src/core/jbig2_stream.js @@ -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 diff --git a/src/core/jpeg_stream.js b/src/core/jpeg_stream.js index 9532ee681..a7b10310c 100644 --- a/src/core/jpeg_stream.js +++ b/src/core/jpeg_stream.js @@ -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 diff --git a/src/core/jpg.js b/src/core/jpg.js index ee83f3e48..5e0f15733 100644 --- a/src/core/jpg.js +++ b/src/core/jpg.js @@ -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) { diff --git a/src/core/jpx.js b/src/core/jpx.js index 63e3763bf..2cc560be6 100644 --- a/src/core/jpx.js +++ b/src/core/jpx.js @@ -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) { diff --git a/src/core/jpx_stream.js b/src/core/jpx_stream.js index c1f49cfad..ee41c8d37 100644 --- a/src/core/jpx_stream.js +++ b/src/core/jpx_stream.js @@ -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 diff --git a/src/core/metrics.js b/src/core/metrics.js index 3ad745a9b..63373bab2 100644 --- a/src/core/metrics.js +++ b/src/core/metrics.js @@ -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 diff --git a/src/core/murmurhash3.js b/src/core/murmurhash3.js index ecd4cecfe..cefec5fba 100644 --- a/src/core/murmurhash3.js +++ b/src/core/murmurhash3.js @@ -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. diff --git a/src/core/obj.js b/src/core/obj.js index 0e7a0d01c..51b957fd1 100644 --- a/src/core/obj.js +++ b/src/core/obj.js @@ -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; diff --git a/src/core/operator_list.js b/src/core/operator_list.js index f8b5dc779..72ee2413d 100644 --- a/src/core/operator_list.js +++ b/src/core/operator_list.js @@ -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) { diff --git a/src/core/parser.js b/src/core/parser.js index 0f9dc077e..2d42802e9 100644 --- a/src/core/parser.js +++ b/src/core/parser.js @@ -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; diff --git a/src/core/pattern.js b/src/core/pattern.js index 93396bd51..cf5e5cdc1 100644 --- a/src/core/pattern.js +++ b/src/core/pattern.js @@ -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, diff --git a/src/core/pdf_manager.js b/src/core/pdf_manager.js index b46406b8b..0ae629c63 100644 --- a/src/core/pdf_manager.js +++ b/src/core/pdf_manager.js @@ -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() { diff --git a/src/core/primitives.js b/src/core/primitives.js index f0540b040..f1cdd7317 100644 --- a/src/core/primitives.js +++ b/src/core/primitives.js @@ -14,7 +14,7 @@ */ /* uses XRef */ -import { assert } from "../shared/util"; +import { assert } from "../shared/util.js"; var EOF = {}; diff --git a/src/core/ps_parser.js b/src/core/ps_parser.js index 971162ba3..7cc6b3e82 100644 --- a/src/core/ps_parser.js +++ b/src/core/ps_parser.js @@ -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) { diff --git a/src/core/standard_fonts.js b/src/core/standard_fonts.js index 60774f34a..af930efd8 100644 --- a/src/core/standard_fonts.js +++ b/src/core/standard_fonts.js @@ -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 diff --git a/src/core/stream.js b/src/core/stream.js index b3033d8c2..1d1839c01 100644 --- a/src/core/stream.js +++ b/src/core/stream.js @@ -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) { diff --git a/src/core/type1_parser.js b/src/core/type1_parser.js index f714c0dda..d8f5884b2 100644 --- a/src/core/type1_parser.js +++ b/src/core/type1_parser.js @@ -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. diff --git a/src/core/unicode.js b/src/core/unicode.js index e0839378c..e97e87388 100644 --- a/src/core/unicode.js +++ b/src/core/unicode.js @@ -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 diff --git a/src/core/worker.js b/src/core/worker.js index 8fe05ab3b..12e46fe73 100644 --- a/src/core/worker.js +++ b/src/core/worker.js @@ -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) { diff --git a/src/core/worker_stream.js b/src/core/worker_stream.js index 5e39aa8f5..3f0922a21 100644 --- a/src/core/worker_stream.js +++ b/src/core/worker_stream.js @@ -14,7 +14,7 @@ */ /* eslint no-var: error */ -import { assert } from "../shared/util"; +import { assert } from "../shared/util.js"; /** @implements {IPDFStream} */ class PDFWorkerStream { diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index f983c89aa..4bc768f27 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -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 diff --git a/src/display/api.js b/src/display/api.js index 05cd487ab..3168b03b0 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -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 ( diff --git a/src/display/api_compatibility.js b/src/display/api_compatibility.js index 728aca654..293fc0fbc 100644 --- a/src/display/api_compatibility.js +++ b/src/display/api_compatibility.js @@ -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) || ""; diff --git a/src/display/canvas.js b/src/display/canvas.js index cdb63b884..96820bbff 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -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"; // contexts store most of the state we need natively. // However, PDF needs a bit more state, which we store here. diff --git a/src/display/display_utils.js b/src/display/display_utils.js index 1fa57b5d7..5c1f629a2 100644 --- a/src/display/display_utils.js +++ b/src/display/display_utils.js @@ -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"; diff --git a/src/display/fetch_stream.js b/src/display/fetch_stream.js index ad11ed886..1a88294ba 100644 --- a/src/display/fetch_stream.js +++ b/src/display/fetch_stream.js @@ -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 { diff --git a/src/display/font_loader.js b/src/display/font_loader.js index 80d9a82dd..c10a0ba5a 100644 --- a/src/display/font_loader.js +++ b/src/display/font_loader.js @@ -22,7 +22,7 @@ import { unreachable, UNSUPPORTED_FEATURES, warn, -} from "../shared/util"; +} from "../shared/util.js"; class BaseFontLoader { constructor({ docId, onUnsupportedFeature }) { diff --git a/src/display/metadata.js b/src/display/metadata.js index 2e839ded7..36745c4b6 100644 --- a/src/display/metadata.js +++ b/src/display/metadata.js @@ -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) { diff --git a/src/display/network.js b/src/display/network.js index b9b2a5936..abd5fb4e5 100644 --- a/src/display/network.js +++ b/src/display/network.js @@ -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( diff --git a/src/display/network_utils.js b/src/display/network_utils.js index 70ef79e03..9086580b6 100644 --- a/src/display/network_utils.js +++ b/src/display/network_utils.js @@ -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, diff --git a/src/display/node_stream.js b/src/display/node_stream.js index 79b7cce30..79e7a5067 100644 --- a/src/display/node_stream.js +++ b/src/display/node_stream.js @@ -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]:\//; diff --git a/src/display/pattern_helper.js b/src/display/pattern_helper.js index 755040c35..781e50a81 100644 --- a/src/display/pattern_helper.js +++ b/src/display/pattern_helper.js @@ -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 = {}; diff --git a/src/display/svg.js b/src/display/svg.js index 0ce92bf61..8c466446f 100644 --- a/src/display/svg.js +++ b/src/display/svg.js @@ -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"); diff --git a/src/display/text_layer.js b/src/display/text_layer.js index c6c290c1c..8cbaeded0 100644 --- a/src/display/text_layer.js +++ b/src/display/text_layer.js @@ -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. diff --git a/src/display/transport_stream.js b/src/display/transport_stream.js index 07bbe8a71..2226f6d1b 100644 --- a/src/display/transport_stream.js +++ b/src/display/transport_stream.js @@ -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 { diff --git a/src/display/webgl.js b/src/display/webgl.js index d48794d5f..4e8999dbb 100644 --- a/src/display/webgl.js +++ b/src/display/webgl.js @@ -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 }) { diff --git a/src/pdf.image_decoders.js b/src/pdf.image_decoders.js index 834ed8fc9..5b38ad936 100644 --- a/src/pdf.image_decoders.js +++ b/src/pdf.image_decoders.js @@ -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 }; diff --git a/src/shared/compatibility.js b/src/shared/compatibility.js index bd80cd229..a44a2e7e2 100644 --- a/src/shared/compatibility.js +++ b/src/shared/compatibility.js @@ -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"); })(); } diff --git a/src/shared/message_handler.js b/src/shared/message_handler.js index 8815e7451..58d6fbf86 100644 --- a/src/shared/message_handler.js +++ b/src/shared/message_handler.js @@ -21,7 +21,7 @@ import { MissingPDFException, UnexpectedResponseException, UnknownErrorException, -} from "./util"; +} from "./util.js"; const CallbackKind = { UNKNOWN: 0, diff --git a/src/worker_loader.js b/src/worker_loader.js index 2feeb7716..05f55c711 100644 --- a/src/worker_loader.js +++ b/src/worker_loader.js @@ -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. }); diff --git a/test/font/jasmine-boot.js b/test/font/jasmine-boot.js index 921553c2a..0325383dc 100644 --- a/test/font/jasmine-boot.js +++ b/test/font/jasmine-boot.js @@ -42,10 +42,10 @@ function initializePDFJS(callback) { Promise.all([ - SystemJS.import("pdfjs/core/fonts"), - SystemJS.import("pdfjs/core/stream"), - SystemJS.import("pdfjs/core/primitives"), - SystemJS.import("pdfjs/core/cmap"), + SystemJS.import("pdfjs/core/fonts.js"), + SystemJS.import("pdfjs/core/stream.js"), + SystemJS.import("pdfjs/core/primitives.js"), + SystemJS.import("pdfjs/core/cmap.js"), ]).then(function(modules) { var fonts = modules[0], stream = modules[1], diff --git a/test/unit/annotation_spec.js b/test/unit/annotation_spec.js index 6e23189db..59dba54ea 100644 --- a/test/unit/annotation_spec.js +++ b/test/unit/annotation_spec.js @@ -19,7 +19,7 @@ import { AnnotationFactory, getQuadPoints, MarkupAnnotation, -} from "../../src/core/annotation"; +} from "../../src/core/annotation.js"; import { AnnotationBorderStyleType, AnnotationFieldFlag, @@ -27,11 +27,11 @@ import { AnnotationType, stringToBytes, stringToUTF8String, -} from "../../src/shared/util"; -import { createIdFactory, XRefMock } from "./test_utils"; -import { Dict, Name, Ref } from "../../src/core/primitives"; -import { Lexer, Parser } from "../../src/core/parser"; -import { StringStream } from "../../src/core/stream"; +} from "../../src/shared/util.js"; +import { createIdFactory, XRefMock } from "./test_utils.js"; +import { Dict, Name, Ref } from "../../src/core/primitives.js"; +import { Lexer, Parser } from "../../src/core/parser.js"; +import { StringStream } from "../../src/core/stream.js"; describe("annotation", function() { class PDFManagerMock { diff --git a/test/unit/api_spec.js b/test/unit/api_spec.js index 6f4f12e0e..42ffa771d 100644 --- a/test/unit/api_spec.js +++ b/test/unit/api_spec.js @@ -19,7 +19,7 @@ import { NodeCanvasFactory, NodeFileReaderFactory, TEST_PDFS_PATH, -} from "./test_utils"; +} from "./test_utils.js"; import { createPromiseCapability, FontType, @@ -31,23 +31,23 @@ import { PasswordResponses, PermissionFlag, StreamType, -} from "../../src/shared/util"; +} from "../../src/shared/util.js"; import { DOMCanvasFactory, RenderingCancelledException, StatTimer, -} from "../../src/display/display_utils"; +} from "../../src/display/display_utils.js"; import { getDocument, PDFDataRangeTransport, PDFDocumentProxy, PDFPageProxy, PDFWorker, -} from "../../src/display/api"; -import { AutoPrintRegExp } from "../../web/ui_utils"; -import { GlobalWorkerOptions } from "../../src/display/worker_options"; -import { isNodeJS } from "../../src/shared/is_node"; -import { Metadata } from "../../src/display/metadata"; +} from "../../src/display/api.js"; +import { AutoPrintRegExp } from "../../web/ui_utils.js"; +import { GlobalWorkerOptions } from "../../src/display/worker_options.js"; +import { isNodeJS } from "../../src/shared/is_node.js"; +import { Metadata } from "../../src/display/metadata.js"; describe("api", function() { let basicApiFileName = "basicapi.pdf"; diff --git a/test/unit/bidi_spec.js b/test/unit/bidi_spec.js index 174064477..be2122ce7 100644 --- a/test/unit/bidi_spec.js +++ b/test/unit/bidi_spec.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { bidi } from "../../src/core/bidi"; +import { bidi } from "../../src/core/bidi.js"; describe("bidi", function() { it("should mark text as RTL if more than 30% of text is RTL", function() { diff --git a/test/unit/cff_parser_spec.js b/test/unit/cff_parser_spec.js index 43a3a228d..e3da8f6b7 100644 --- a/test/unit/cff_parser_spec.js +++ b/test/unit/cff_parser_spec.js @@ -19,9 +19,9 @@ import { CFFFDSelect, CFFParser, CFFStrings, -} from "../../src/core/cff_parser"; -import { SEAC_ANALYSIS_ENABLED } from "../../src/core/fonts"; -import { Stream } from "../../src/core/stream"; +} from "../../src/core/cff_parser.js"; +import { SEAC_ANALYSIS_ENABLED } from "../../src/core/fonts.js"; +import { Stream } from "../../src/core/stream.js"; describe("CFFParser", function() { function createWithNullProto(obj) { diff --git a/test/unit/clitests_helper.js b/test/unit/clitests_helper.js index f5ec64d6c..a57ef74a7 100644 --- a/test/unit/clitests_helper.js +++ b/test/unit/clitests_helper.js @@ -13,10 +13,10 @@ * limitations under the License. */ -import { setVerbosityLevel, VerbosityLevel } from "../../src/shared/util"; -import { isNodeJS } from "../../src/shared/is_node"; -import { PDFNodeStream } from "../../src/display/node_stream"; -import { setPDFNetworkStreamFactory } from "../../src/display/api"; +import { setVerbosityLevel, VerbosityLevel } from "../../src/shared/util.js"; +import { isNodeJS } from "../../src/shared/is_node.js"; +import { PDFNodeStream } from "../../src/display/node_stream.js"; +import { setPDFNetworkStreamFactory } from "../../src/display/api.js"; // Ensure that this script only runs in Node.js environments. if (!isNodeJS) { diff --git a/test/unit/cmap_spec.js b/test/unit/cmap_spec.js index fdd4f7231..b18cd73b9 100644 --- a/test/unit/cmap_spec.js +++ b/test/unit/cmap_spec.js @@ -13,12 +13,12 @@ * limitations under the License. */ -import { CMap, CMapFactory, IdentityCMap } from "../../src/core/cmap"; -import { DOMCMapReaderFactory } from "../../src/display/display_utils"; -import { isNodeJS } from "../../src/shared/is_node"; -import { Name } from "../../src/core/primitives"; -import { NodeCMapReaderFactory } from "./test_utils"; -import { StringStream } from "../../src/core/stream"; +import { CMap, CMapFactory, IdentityCMap } from "../../src/core/cmap.js"; +import { DOMCMapReaderFactory } from "../../src/display/display_utils.js"; +import { isNodeJS } from "../../src/shared/is_node.js"; +import { Name } from "../../src/core/primitives.js"; +import { NodeCMapReaderFactory } from "./test_utils.js"; +import { StringStream } from "../../src/core/stream.js"; var cMapUrl = { dom: "../../external/bcmaps/", diff --git a/test/unit/colorspace_spec.js b/test/unit/colorspace_spec.js index f670141de..71d6141d2 100644 --- a/test/unit/colorspace_spec.js +++ b/test/unit/colorspace_spec.js @@ -13,11 +13,11 @@ * limitations under the License. */ -import { Dict, Name, Ref } from "../../src/core/primitives"; -import { Stream, StringStream } from "../../src/core/stream"; -import { ColorSpace } from "../../src/core/colorspace"; -import { PDFFunctionFactory } from "../../src/core/function"; -import { XRefMock } from "./test_utils"; +import { Dict, Name, Ref } from "../../src/core/primitives.js"; +import { Stream, StringStream } from "../../src/core/stream.js"; +import { ColorSpace } from "../../src/core/colorspace.js"; +import { PDFFunctionFactory } from "../../src/core/function.js"; +import { XRefMock } from "./test_utils.js"; describe("colorspace", function() { describe("ColorSpace", function() { diff --git a/test/unit/core_utils_spec.js b/test/unit/core_utils_spec.js index 1de422e3b..a4184c9f8 100644 --- a/test/unit/core_utils_spec.js +++ b/test/unit/core_utils_spec.js @@ -13,12 +13,12 @@ * limitations under the License. */ -import { Dict, Ref } from "../../src/core/primitives"; +import { Dict, Ref } from "../../src/core/primitives.js"; import { getInheritableProperty, toRomanNumerals, -} from "../../src/core/core_utils"; -import { XRefMock } from "./test_utils"; +} from "../../src/core/core_utils.js"; +import { XRefMock } from "./test_utils.js"; describe("core_utils", function() { describe("getInheritableProperty", function() { diff --git a/test/unit/crypto_spec.js b/test/unit/crypto_spec.js index f9bcf16b1..03cd1c63e 100644 --- a/test/unit/crypto_spec.js +++ b/test/unit/crypto_spec.js @@ -24,13 +24,13 @@ import { CipherTransformFactory, PDF17, PDF20, -} from "../../src/core/crypto"; -import { Dict, Name } from "../../src/core/primitives"; +} from "../../src/core/crypto.js"; +import { Dict, Name } from "../../src/core/primitives.js"; import { PasswordException, PasswordResponses, stringToBytes, -} from "../../src/shared/util"; +} from "../../src/shared/util.js"; describe("crypto", function() { function hex2binary(s) { diff --git a/test/unit/custom_spec.js b/test/unit/custom_spec.js index f781f2110..61c3723aa 100644 --- a/test/unit/custom_spec.js +++ b/test/unit/custom_spec.js @@ -13,10 +13,10 @@ * limitations under the License. */ -import { buildGetDocumentParams, NodeCanvasFactory } from "./test_utils"; -import { DOMCanvasFactory } from "../../src/display/display_utils"; -import { getDocument } from "../../src/display/api"; -import { isNodeJS } from "../../src/shared/is_node"; +import { buildGetDocumentParams, NodeCanvasFactory } from "./test_utils.js"; +import { DOMCanvasFactory } from "../../src/display/display_utils.js"; +import { getDocument } from "../../src/display/api.js"; +import { isNodeJS } from "../../src/shared/is_node.js"; function getTopLeftPixel(canvasContext) { let imgData = canvasContext.getImageData(0, 0, 1, 1); diff --git a/test/unit/display_svg_spec.js b/test/unit/display_svg_spec.js index d31e2056b..b8475e72e 100644 --- a/test/unit/display_svg_spec.js +++ b/test/unit/display_svg_spec.js @@ -14,12 +14,12 @@ */ /* globals __non_webpack_require__ */ -import { setStubs, unsetStubs } from "../../examples/node/domstubs"; -import { buildGetDocumentParams } from "./test_utils"; -import { getDocument } from "../../src/display/api"; -import { isNodeJS } from "../../src/shared/is_node"; -import { NativeImageDecoding } from "../../src/shared/util"; -import { SVGGraphics } from "../../src/display/svg"; +import { setStubs, unsetStubs } from "../../examples/node/domstubs.js"; +import { buildGetDocumentParams } from "./test_utils.js"; +import { getDocument } from "../../src/display/api.js"; +import { isNodeJS } from "../../src/shared/is_node.js"; +import { NativeImageDecoding } from "../../src/shared/util.js"; +import { SVGGraphics } from "../../src/display/svg.js"; const XLINK_NS = "http://www.w3.org/1999/xlink"; diff --git a/test/unit/display_utils_spec.js b/test/unit/display_utils_spec.js index 469ff4412..c44c4e330 100644 --- a/test/unit/display_utils_spec.js +++ b/test/unit/display_utils_spec.js @@ -20,8 +20,8 @@ import { getFilenameFromUrl, isValidFetchUrl, PDFDateString, -} from "../../src/display/display_utils"; -import { isNodeJS } from "../../src/shared/is_node"; +} from "../../src/display/display_utils.js"; +import { isNodeJS } from "../../src/shared/is_node.js"; describe("display_utils", function() { describe("DOMCanvasFactory", function() { diff --git a/test/unit/document_spec.js b/test/unit/document_spec.js index 0f8021c10..bf18a8482 100644 --- a/test/unit/document_spec.js +++ b/test/unit/document_spec.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { createIdFactory } from "./test_utils"; +import { createIdFactory } from "./test_utils.js"; describe("document", function() { describe("Page", function() { diff --git a/test/unit/encodings_spec.js b/test/unit/encodings_spec.js index b0ce29487..85f10e45d 100644 --- a/test/unit/encodings_spec.js +++ b/test/unit/encodings_spec.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { getEncoding } from "../../src/core/encodings"; +import { getEncoding } from "../../src/core/encodings.js"; describe("encodings", function() { describe("getEncoding", function() { diff --git a/test/unit/evaluator_spec.js b/test/unit/evaluator_spec.js index c1c423a03..c1a0ee629 100644 --- a/test/unit/evaluator_spec.js +++ b/test/unit/evaluator_spec.js @@ -13,13 +13,13 @@ * limitations under the License. */ -import { createIdFactory, XRefMock } from "./test_utils"; -import { Dict, Name } from "../../src/core/primitives"; -import { FormatError, OPS } from "../../src/shared/util"; -import { Stream, StringStream } from "../../src/core/stream"; -import { OperatorList } from "../../src/core/operator_list"; -import { PartialEvaluator } from "../../src/core/evaluator"; -import { WorkerTask } from "../../src/core/worker"; +import { createIdFactory, XRefMock } from "./test_utils.js"; +import { Dict, Name } from "../../src/core/primitives.js"; +import { FormatError, OPS } from "../../src/shared/util.js"; +import { Stream, StringStream } from "../../src/core/stream.js"; +import { OperatorList } from "../../src/core/operator_list.js"; +import { PartialEvaluator } from "../../src/core/evaluator.js"; +import { WorkerTask } from "../../src/core/worker.js"; describe("evaluator", function() { function HandlerMock() { diff --git a/test/unit/fetch_stream_spec.js b/test/unit/fetch_stream_spec.js index 7b88f6372..1cafc9759 100644 --- a/test/unit/fetch_stream_spec.js +++ b/test/unit/fetch_stream_spec.js @@ -14,8 +14,8 @@ */ /* eslint no-var: error */ -import { AbortException } from "../../src/shared/util"; -import { PDFFetchStream } from "../../src/display/fetch_stream"; +import { AbortException } from "../../src/shared/util.js"; +import { PDFFetchStream } from "../../src/display/fetch_stream.js"; describe("fetch_stream", function() { const pdfUrl = new URL("../pdfs/tracemonkey.pdf", window.location).href; diff --git a/test/unit/function_spec.js b/test/unit/function_spec.js index 3af46e2b5..952600576 100644 --- a/test/unit/function_spec.js +++ b/test/unit/function_spec.js @@ -16,9 +16,9 @@ import { PostScriptCompiler, PostScriptEvaluator, -} from "../../src/core/function"; -import { PostScriptLexer, PostScriptParser } from "../../src/core/ps_parser"; -import { StringStream } from "../../src/core/stream"; +} from "../../src/core/function.js"; +import { PostScriptLexer, PostScriptParser } from "../../src/core/ps_parser.js"; +import { StringStream } from "../../src/core/stream.js"; describe("function", function() { beforeEach(function() { diff --git a/test/unit/jasmine-boot.js b/test/unit/jasmine-boot.js index 89953ea86..30982cb34 100644 --- a/test/unit/jasmine-boot.js +++ b/test/unit/jasmine-boot.js @@ -43,42 +43,42 @@ function initializePDFJS(callback) { Promise.all( [ - "pdfjs/display/api", - "pdfjs/display/worker_options", - "pdfjs/display/network", - "pdfjs/display/fetch_stream", - "pdfjs/shared/is_node", - "pdfjs-test/unit/annotation_spec", - "pdfjs-test/unit/api_spec", - "pdfjs-test/unit/bidi_spec", - "pdfjs-test/unit/cff_parser_spec", - "pdfjs-test/unit/cmap_spec", - "pdfjs-test/unit/colorspace_spec", - "pdfjs-test/unit/core_utils_spec", - "pdfjs-test/unit/crypto_spec", - "pdfjs-test/unit/custom_spec", - "pdfjs-test/unit/display_svg_spec", - "pdfjs-test/unit/display_utils_spec", - "pdfjs-test/unit/document_spec", - "pdfjs-test/unit/encodings_spec", - "pdfjs-test/unit/evaluator_spec", - "pdfjs-test/unit/function_spec", - "pdfjs-test/unit/fetch_stream_spec", - "pdfjs-test/unit/message_handler_spec", - "pdfjs-test/unit/metadata_spec", - "pdfjs-test/unit/murmurhash3_spec", - "pdfjs-test/unit/network_spec", - "pdfjs-test/unit/network_utils_spec", - "pdfjs-test/unit/parser_spec", - "pdfjs-test/unit/pdf_find_controller_spec", - "pdfjs-test/unit/pdf_find_utils_spec", - "pdfjs-test/unit/pdf_history_spec", - "pdfjs-test/unit/primitives_spec", - "pdfjs-test/unit/stream_spec", - "pdfjs-test/unit/type1_parser_spec", - "pdfjs-test/unit/ui_utils_spec", - "pdfjs-test/unit/unicode_spec", - "pdfjs-test/unit/util_spec", + "pdfjs/display/api.js", + "pdfjs/display/worker_options.js", + "pdfjs/display/network.js", + "pdfjs/display/fetch_stream.js", + "pdfjs/shared/is_node.js", + "pdfjs-test/unit/annotation_spec.js", + "pdfjs-test/unit/api_spec.js", + "pdfjs-test/unit/bidi_spec.js", + "pdfjs-test/unit/cff_parser_spec.js", + "pdfjs-test/unit/cmap_spec.js", + "pdfjs-test/unit/colorspace_spec.js", + "pdfjs-test/unit/core_utils_spec.js", + "pdfjs-test/unit/crypto_spec.js", + "pdfjs-test/unit/custom_spec.js", + "pdfjs-test/unit/display_svg_spec.js", + "pdfjs-test/unit/display_utils_spec.js", + "pdfjs-test/unit/document_spec.js", + "pdfjs-test/unit/encodings_spec.js", + "pdfjs-test/unit/evaluator_spec.js", + "pdfjs-test/unit/function_spec.js", + "pdfjs-test/unit/fetch_stream_spec.js", + "pdfjs-test/unit/message_handler_spec.js", + "pdfjs-test/unit/metadata_spec.js", + "pdfjs-test/unit/murmurhash3_spec.js", + "pdfjs-test/unit/network_spec.js", + "pdfjs-test/unit/network_utils_spec.js", + "pdfjs-test/unit/parser_spec.js", + "pdfjs-test/unit/pdf_find_controller_spec.js", + "pdfjs-test/unit/pdf_find_utils_spec.js", + "pdfjs-test/unit/pdf_history_spec.js", + "pdfjs-test/unit/primitives_spec.js", + "pdfjs-test/unit/stream_spec.js", + "pdfjs-test/unit/type1_parser_spec.js", + "pdfjs-test/unit/ui_utils_spec.js", + "pdfjs-test/unit/unicode_spec.js", + "pdfjs-test/unit/util_spec.js", ].map(function(moduleName) { return SystemJS.import(moduleName); }) diff --git a/test/unit/message_handler_spec.js b/test/unit/message_handler_spec.js index 6f092ed9f..fd8547da8 100644 --- a/test/unit/message_handler_spec.js +++ b/test/unit/message_handler_spec.js @@ -17,9 +17,9 @@ import { AbortException, createPromiseCapability, UnknownErrorException, -} from "../../src/shared/util"; -import { LoopbackPort } from "../../src/display/api"; -import { MessageHandler } from "../../src/shared/message_handler"; +} from "../../src/shared/util.js"; +import { LoopbackPort } from "../../src/display/api.js"; +import { MessageHandler } from "../../src/shared/message_handler.js"; describe("message_handler", function() { // Sleep function to wait for sometime, similar to setTimeout but faster. diff --git a/test/unit/metadata_spec.js b/test/unit/metadata_spec.js index 8b2004dd8..1b92847d8 100644 --- a/test/unit/metadata_spec.js +++ b/test/unit/metadata_spec.js @@ -13,8 +13,8 @@ * limitations under the License. */ -import { isEmptyObj } from "../../src/shared/util"; -import { Metadata } from "../../src/display/metadata"; +import { isEmptyObj } from "../../src/shared/util.js"; +import { Metadata } from "../../src/display/metadata.js"; describe("metadata", function() { it("should handle valid metadata", function() { diff --git a/test/unit/murmurhash3_spec.js b/test/unit/murmurhash3_spec.js index c9db463ee..cc874e109 100644 --- a/test/unit/murmurhash3_spec.js +++ b/test/unit/murmurhash3_spec.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { MurmurHash3_64 } from "../../src/core/murmurhash3"; +import { MurmurHash3_64 } from "../../src/core/murmurhash3.js"; describe("MurmurHash3_64", function() { it("instantiates without seed", function() { diff --git a/test/unit/network_spec.js b/test/unit/network_spec.js index 45b3e6d85..2a4bb9481 100644 --- a/test/unit/network_spec.js +++ b/test/unit/network_spec.js @@ -13,8 +13,8 @@ * limitations under the License. */ -import { AbortException } from "../../src/shared/util"; -import { PDFNetworkStream } from "../../src/display/network"; +import { AbortException } from "../../src/shared/util.js"; +import { PDFNetworkStream } from "../../src/display/network.js"; describe("network", function() { var pdf1 = new URL("../pdfs/tracemonkey.pdf", window.location).href; diff --git a/test/unit/network_utils_spec.js b/test/unit/network_utils_spec.js index e59c8219f..f3046c97d 100644 --- a/test/unit/network_utils_spec.js +++ b/test/unit/network_utils_spec.js @@ -18,11 +18,11 @@ import { extractFilenameFromHeader, validateRangeRequestCapabilities, validateResponseStatus, -} from "../../src/display/network_utils"; +} from "../../src/display/network_utils.js"; import { MissingPDFException, UnexpectedResponseException, -} from "../../src/shared/util"; +} from "../../src/shared/util.js"; describe("network_utils", function() { describe("validateRangeRequestCapabilities", function() { diff --git a/test/unit/node_stream_spec.js b/test/unit/node_stream_spec.js index 8772ee04f..8bdc58584 100644 --- a/test/unit/node_stream_spec.js +++ b/test/unit/node_stream_spec.js @@ -14,9 +14,9 @@ */ /* globals __non_webpack_require__ */ -import { AbortException, assert } from "../../src/shared/util"; -import { isNodeJS } from "../../src/shared/is_node"; -import { PDFNodeStream } from "../../src/display/node_stream"; +import { AbortException, assert } from "../../src/shared/util.js"; +import { isNodeJS } from "../../src/shared/is_node.js"; +import { PDFNodeStream } from "../../src/display/node_stream.js"; // Make sure that we only running this script is Node.js environments. assert(isNodeJS); diff --git a/test/unit/parser_spec.js b/test/unit/parser_spec.js index 2f874f98f..4687b2590 100644 --- a/test/unit/parser_spec.js +++ b/test/unit/parser_spec.js @@ -14,10 +14,10 @@ */ /* eslint no-var: error */ -import { Lexer, Linearization, Parser } from "../../src/core/parser"; -import { FormatError } from "../../src/shared/util"; -import { Name } from "../../src/core/primitives"; -import { StringStream } from "../../src/core/stream"; +import { Lexer, Linearization, Parser } from "../../src/core/parser.js"; +import { FormatError } from "../../src/shared/util.js"; +import { Name } from "../../src/core/primitives.js"; +import { StringStream } from "../../src/core/stream.js"; describe("parser", function() { describe("Parser", function() { diff --git a/test/unit/pdf_find_controller_spec.js b/test/unit/pdf_find_controller_spec.js index b0e7ff7b0..165b73f42 100644 --- a/test/unit/pdf_find_controller_spec.js +++ b/test/unit/pdf_find_controller_spec.js @@ -13,11 +13,11 @@ * limitations under the License. */ -import { buildGetDocumentParams } from "./test_utils"; -import { EventBus } from "../../web/ui_utils"; -import { getDocument } from "../../src/display/api"; -import { PDFFindController } from "../../web/pdf_find_controller"; -import { SimpleLinkService } from "../../web/pdf_link_service"; +import { buildGetDocumentParams } from "./test_utils.js"; +import { EventBus } from "../../web/ui_utils.js"; +import { getDocument } from "../../src/display/api.js"; +import { PDFFindController } from "../../web/pdf_find_controller.js"; +import { SimpleLinkService } from "../../web/pdf_link_service.js"; class MockLinkService extends SimpleLinkService { constructor() { diff --git a/test/unit/pdf_find_utils_spec.js b/test/unit/pdf_find_utils_spec.js index aa3d1e498..f05f14204 100644 --- a/test/unit/pdf_find_utils_spec.js +++ b/test/unit/pdf_find_utils_spec.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { CharacterType, getCharacterType } from "../../web/pdf_find_utils"; +import { CharacterType, getCharacterType } from "../../web/pdf_find_utils.js"; describe("pdf_find_utils", function() { describe("getCharacterType", function() { diff --git a/test/unit/pdf_history_spec.js b/test/unit/pdf_history_spec.js index a3ab3af3e..1f997498f 100644 --- a/test/unit/pdf_history_spec.js +++ b/test/unit/pdf_history_spec.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { isDestArraysEqual, isDestHashesEqual } from "../../web/pdf_history"; +import { isDestArraysEqual, isDestHashesEqual } from "../../web/pdf_history.js"; describe("pdf_history", function() { describe("isDestHashesEqual", function() { diff --git a/test/unit/primitives_spec.js b/test/unit/primitives_spec.js index 10df68eb0..bb54c2e7c 100644 --- a/test/unit/primitives_spec.js +++ b/test/unit/primitives_spec.js @@ -24,8 +24,8 @@ import { Name, Ref, RefSet, -} from "../../src/core/primitives"; -import { XRefMock } from "./test_utils"; +} from "../../src/core/primitives.js"; +import { XRefMock } from "./test_utils.js"; describe("primitives", function() { describe("Name", function() { diff --git a/test/unit/stream_spec.js b/test/unit/stream_spec.js index 1249d59b1..56cd46e3a 100644 --- a/test/unit/stream_spec.js +++ b/test/unit/stream_spec.js @@ -13,8 +13,8 @@ * limitations under the License. */ -import { PredictorStream, Stream } from "../../src/core/stream"; -import { Dict } from "../../src/core/primitives"; +import { PredictorStream, Stream } from "../../src/core/stream.js"; +import { Dict } from "../../src/core/primitives.js"; describe("stream", function() { beforeEach(function() { diff --git a/test/unit/test_utils.js b/test/unit/test_utils.js index dd6fabf11..bd2a9cc85 100644 --- a/test/unit/test_utils.js +++ b/test/unit/test_utils.js @@ -13,10 +13,10 @@ * limitations under the License. */ -import { assert, CMapCompressionType } from "../../src/shared/util"; -import { isNodeJS } from "../../src/shared/is_node"; -import { isRef } from "../../src/core/primitives"; -import { Page } from "../../src/core/document"; +import { assert, CMapCompressionType } from "../../src/shared/util.js"; +import { isNodeJS } from "../../src/shared/is_node.js"; +import { isRef } from "../../src/core/primitives.js"; +import { Page } from "../../src/core/document.js"; class DOMFileReaderFactory { static async fetch(params) { diff --git a/test/unit/type1_parser_spec.js b/test/unit/type1_parser_spec.js index 20672c6db..2426b1bd4 100644 --- a/test/unit/type1_parser_spec.js +++ b/test/unit/type1_parser_spec.js @@ -13,9 +13,9 @@ * limitations under the License. */ -import { SEAC_ANALYSIS_ENABLED } from "../../src/core/fonts"; -import { StringStream } from "../../src/core/stream"; -import { Type1Parser } from "../../src/core/type1_parser"; +import { SEAC_ANALYSIS_ENABLED } from "../../src/core/fonts.js"; +import { StringStream } from "../../src/core/stream.js"; +import { Type1Parser } from "../../src/core/type1_parser.js"; describe("Type1Parser", function() { it("splits tokens", function() { diff --git a/test/unit/ui_utils_spec.js b/test/unit/ui_utils_spec.js index 755b07383..ef4a74485 100644 --- a/test/unit/ui_utils_spec.js +++ b/test/unit/ui_utils_spec.js @@ -25,9 +25,9 @@ import { moveToEndOfArray, waitOnEventOrTimeout, WaitOnType, -} from "../../web/ui_utils"; -import { createObjectURL } from "../../src/shared/util"; -import { isNodeJS } from "../../src/shared/is_node"; +} from "../../web/ui_utils.js"; +import { createObjectURL } from "../../src/shared/util.js"; +import { isNodeJS } from "../../src/shared/is_node.js"; describe("ui_utils", function() { describe("binary search", function() { diff --git a/test/unit/unicode_spec.js b/test/unit/unicode_spec.js index fd0fbb9fb..fa8a45aea 100644 --- a/test/unit/unicode_spec.js +++ b/test/unit/unicode_spec.js @@ -16,14 +16,14 @@ import { getDingbatsGlyphsUnicode, getGlyphsUnicode, -} from "../../src/core/glyphlist"; +} from "../../src/core/glyphlist.js"; import { getNormalizedUnicodes, getUnicodeForGlyph, getUnicodeRangeFor, mapSpecialUnicodeValues, reverseIfRtl, -} from "../../src/core/unicode"; +} from "../../src/core/unicode.js"; describe("unicode", function() { describe("mapSpecialUnicodeValues", function() { diff --git a/test/unit/util_spec.js b/test/unit/util_spec.js index 216229d3d..f5b7daaa6 100644 --- a/test/unit/util_spec.js +++ b/test/unit/util_spec.js @@ -29,7 +29,7 @@ import { string32, stringToBytes, stringToPDFString, -} from "../../src/shared/util"; +} from "../../src/shared/util.js"; describe("util", function() { describe("bytesToString", function() { diff --git a/web/annotation_layer_builder.js b/web/annotation_layer_builder.js index 280de1027..44691ea6c 100644 --- a/web/annotation_layer_builder.js +++ b/web/annotation_layer_builder.js @@ -14,8 +14,8 @@ */ import { AnnotationLayer } from "pdfjs-lib"; -import { NullL10n } from "./ui_utils"; -import { SimpleLinkService } from "./pdf_link_service"; +import { NullL10n } from "./ui_utils.js"; +import { SimpleLinkService } from "./pdf_link_service.js"; /** * @typedef {Object} AnnotationLayerBuilderOptions diff --git a/web/app.js b/web/app.js index 1f55158e3..c08e5f70e 100644 --- a/web/app.js +++ b/web/app.js @@ -34,8 +34,8 @@ import { ScrollMode, SpreadMode, TextLayerMode, -} from "./ui_utils"; -import { AppOptions, OptionKind } from "./app_options"; +} from "./ui_utils.js"; +import { AppOptions, OptionKind } from "./app_options.js"; import { build, createObjectURL, @@ -53,25 +53,25 @@ import { UNSUPPORTED_FEATURES, version, } from "pdfjs-lib"; -import { CursorTool, PDFCursorTools } from "./pdf_cursor_tools"; -import { PDFRenderingQueue, RenderingStates } from "./pdf_rendering_queue"; -import { PDFSidebar, SidebarView } from "./pdf_sidebar"; -import { OverlayManager } from "./overlay_manager"; -import { PasswordPrompt } from "./password_prompt"; -import { PDFAttachmentViewer } from "./pdf_attachment_viewer"; -import { PDFDocumentProperties } from "./pdf_document_properties"; -import { PDFFindBar } from "./pdf_find_bar"; -import { PDFFindController } from "./pdf_find_controller"; -import { PDFHistory } from "./pdf_history"; -import { PDFLinkService } from "./pdf_link_service"; -import { PDFOutlineViewer } from "./pdf_outline_viewer"; -import { PDFPresentationMode } from "./pdf_presentation_mode"; -import { PDFSidebarResizer } from "./pdf_sidebar_resizer"; -import { PDFThumbnailViewer } from "./pdf_thumbnail_viewer"; -import { PDFViewer } from "./pdf_viewer"; -import { SecondaryToolbar } from "./secondary_toolbar"; -import { Toolbar } from "./toolbar"; -import { ViewHistory } from "./view_history"; +import { CursorTool, PDFCursorTools } from "./pdf_cursor_tools.js"; +import { PDFRenderingQueue, RenderingStates } from "./pdf_rendering_queue.js"; +import { PDFSidebar, SidebarView } from "./pdf_sidebar.js"; +import { OverlayManager } from "./overlay_manager.js"; +import { PasswordPrompt } from "./password_prompt.js"; +import { PDFAttachmentViewer } from "./pdf_attachment_viewer.js"; +import { PDFDocumentProperties } from "./pdf_document_properties.js"; +import { PDFFindBar } from "./pdf_find_bar.js"; +import { PDFFindController } from "./pdf_find_controller.js"; +import { PDFHistory } from "./pdf_history.js"; +import { PDFLinkService } from "./pdf_link_service.js"; +import { PDFOutlineViewer } from "./pdf_outline_viewer.js"; +import { PDFPresentationMode } from "./pdf_presentation_mode.js"; +import { PDFSidebarResizer } from "./pdf_sidebar_resizer.js"; +import { PDFThumbnailViewer } from "./pdf_thumbnail_viewer.js"; +import { PDFViewer } from "./pdf_viewer.js"; +import { SecondaryToolbar } from "./secondary_toolbar.js"; +import { Toolbar } from "./toolbar.js"; +import { ViewHistory } from "./view_history.js"; const DEFAULT_SCALE_DELTA = 1.1; const DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; // ms @@ -1769,7 +1769,7 @@ async function loadFakeWorker() { if (typeof SystemJS !== "object") { throw new Error("SystemJS must be used to load fake worker."); } - window.pdfjsWorker = await SystemJS.import("pdfjs/core/worker"); + window.pdfjsWorker = await SystemJS.import("pdfjs/core/worker.js"); return undefined; } return loadScript(PDFWorker.getWorkerSrc()); diff --git a/web/app_options.js b/web/app_options.js index c7a8fe7dd..0753178dc 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -14,7 +14,7 @@ */ import { apiCompatibilityParams } from "pdfjs-lib"; -import { viewerCompatibilityParams } from "./viewer_compatibility"; +import { viewerCompatibilityParams } from "./viewer_compatibility.js"; const OptionKind = { VIEWER: 0x02, diff --git a/web/base_viewer.js b/web/base_viewer.js index 632d67ac6..f93985899 100644 --- a/web/base_viewer.js +++ b/web/base_viewer.js @@ -36,13 +36,13 @@ import { UNKNOWN_SCALE, VERTICAL_PADDING, watchScroll, -} from "./ui_utils"; -import { PDFRenderingQueue, RenderingStates } from "./pdf_rendering_queue"; -import { AnnotationLayerBuilder } from "./annotation_layer_builder"; +} from "./ui_utils.js"; +import { PDFRenderingQueue, RenderingStates } from "./pdf_rendering_queue.js"; +import { AnnotationLayerBuilder } from "./annotation_layer_builder.js"; import { createPromiseCapability } from "pdfjs-lib"; -import { PDFPageView } from "./pdf_page_view"; -import { SimpleLinkService } from "./pdf_link_service"; -import { TextLayerBuilder } from "./text_layer_builder"; +import { PDFPageView } from "./pdf_page_view.js"; +import { SimpleLinkService } from "./pdf_link_service.js"; +import { TextLayerBuilder } from "./text_layer_builder.js"; const DEFAULT_CACHE_SIZE = 10; diff --git a/web/chromecom.js b/web/chromecom.js index eccdd8418..853f773e1 100644 --- a/web/chromecom.js +++ b/web/chromecom.js @@ -14,11 +14,11 @@ */ /* globals chrome */ -import { DefaultExternalServices, PDFViewerApplication } from "./app"; -import { AppOptions } from "./app_options"; -import { BasePreferences } from "./preferences"; -import { DownloadManager } from "./download_manager"; -import { GenericL10n } from "./genericl10n"; +import { DefaultExternalServices, PDFViewerApplication } from "./app.js"; +import { AppOptions } from "./app_options.js"; +import { BasePreferences } from "./preferences.js"; +import { DownloadManager } from "./download_manager.js"; +import { GenericL10n } from "./genericl10n.js"; if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("CHROME")) { throw new Error( diff --git a/web/firefox_print_service.js b/web/firefox_print_service.js index d2846a676..4e6be15ac 100644 --- a/web/firefox_print_service.js +++ b/web/firefox_print_service.js @@ -13,9 +13,9 @@ * limitations under the License. */ -import { AppOptions } from "./app_options"; -import { CSS_UNITS } from "./ui_utils"; -import { PDFPrintServiceFactory } from "./app"; +import { AppOptions } from "./app_options.js"; +import { CSS_UNITS } from "./ui_utils.js"; +import { PDFPrintServiceFactory } from "./app.js"; import { shadow } from "pdfjs-lib"; // Creates a placeholder with div and canvas with right size for the page. diff --git a/web/firefoxcom.js b/web/firefoxcom.js index 11c5ea575..83db636ce 100644 --- a/web/firefoxcom.js +++ b/web/firefoxcom.js @@ -15,9 +15,9 @@ import "../extensions/firefox/tools/l10n"; import { createObjectURL, PDFDataRangeTransport, shadow } from "pdfjs-lib"; -import { BasePreferences } from "./preferences"; -import { DEFAULT_SCALE_VALUE } from "./ui_utils"; -import { PDFViewerApplication } from "./app"; +import { BasePreferences } from "./preferences.js"; +import { DEFAULT_SCALE_VALUE } from "./ui_utils.js"; +import { PDFViewerApplication } from "./app.js"; if ( typeof PDFJSDev === "undefined" || diff --git a/web/genericcom.js b/web/genericcom.js index 3fc0eda00..fce57da66 100644 --- a/web/genericcom.js +++ b/web/genericcom.js @@ -13,10 +13,10 @@ * limitations under the License. */ -import { DefaultExternalServices, PDFViewerApplication } from "./app"; -import { BasePreferences } from "./preferences"; -import { DownloadManager } from "./download_manager"; -import { GenericL10n } from "./genericl10n"; +import { DefaultExternalServices, PDFViewerApplication } from "./app.js"; +import { BasePreferences } from "./preferences.js"; +import { DownloadManager } from "./download_manager.js"; +import { GenericL10n } from "./genericl10n.js"; if (typeof PDFJSDev !== "undefined" && !PDFJSDev.test("GENERIC")) { throw new Error( diff --git a/web/password_prompt.js b/web/password_prompt.js index 29fae9609..622f620d7 100644 --- a/web/password_prompt.js +++ b/web/password_prompt.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { NullL10n } from "./ui_utils"; +import { NullL10n } from "./ui_utils.js"; import { PasswordResponses } from "pdfjs-lib"; /** diff --git a/web/pdf_cursor_tools.js b/web/pdf_cursor_tools.js index e8b45f5b4..c9e23f996 100644 --- a/web/pdf_cursor_tools.js +++ b/web/pdf_cursor_tools.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { GrabToPan } from "./grab_to_pan"; +import { GrabToPan } from "./grab_to_pan.js"; const CursorTool = { SELECT: 0, // The default value. diff --git a/web/pdf_document_properties.js b/web/pdf_document_properties.js index 120806a70..10c00a879 100644 --- a/web/pdf_document_properties.js +++ b/web/pdf_document_properties.js @@ -19,7 +19,7 @@ import { getPDFFileNameFromURL, isPortraitOrientation, NullL10n, -} from "./ui_utils"; +} from "./ui_utils.js"; const DEFAULT_FIELD_CONTENT = "-"; diff --git a/web/pdf_find_bar.js b/web/pdf_find_bar.js index 1fa73768f..00811b268 100644 --- a/web/pdf_find_bar.js +++ b/web/pdf_find_bar.js @@ -13,8 +13,8 @@ * limitations under the License. */ -import { getGlobalEventBus, NullL10n } from "./ui_utils"; -import { FindState } from "./pdf_find_controller"; +import { getGlobalEventBus, NullL10n } from "./ui_utils.js"; +import { FindState } from "./pdf_find_controller.js"; const MATCHES_COUNT_LIMIT = 1000; diff --git a/web/pdf_find_controller.js b/web/pdf_find_controller.js index 7b7a06b3b..e92accdeb 100644 --- a/web/pdf_find_controller.js +++ b/web/pdf_find_controller.js @@ -13,9 +13,9 @@ * limitations under the License. */ -import { getGlobalEventBus, scrollIntoView } from "./ui_utils"; +import { getGlobalEventBus, scrollIntoView } from "./ui_utils.js"; import { createPromiseCapability } from "pdfjs-lib"; -import { getCharacterType } from "./pdf_find_utils"; +import { getCharacterType } from "./pdf_find_utils.js"; const FindState = { FOUND: 0, diff --git a/web/pdf_history.js b/web/pdf_history.js index 970966ace..cf1e35fed 100644 --- a/web/pdf_history.js +++ b/web/pdf_history.js @@ -18,7 +18,7 @@ import { isValidRotation, parseQueryString, waitOnEventOrTimeout, -} from "./ui_utils"; +} from "./ui_utils.js"; // Heuristic value used when force-resetting `this._blockHashChange`. const HASH_CHANGE_TIMEOUT = 1000; // milliseconds diff --git a/web/pdf_link_service.js b/web/pdf_link_service.js index bf4116625..dac4f9618 100644 --- a/web/pdf_link_service.js +++ b/web/pdf_link_service.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { getGlobalEventBus, parseQueryString } from "./ui_utils"; +import { getGlobalEventBus, parseQueryString } from "./ui_utils.js"; /** * @typedef {Object} PDFLinkServiceOptions diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index e2209bd7c..319d59977 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -23,14 +23,14 @@ import { RendererType, roundToDivide, TextLayerMode, -} from "./ui_utils"; +} from "./ui_utils.js"; import { createPromiseCapability, RenderingCancelledException, SVGGraphics, } from "pdfjs-lib"; -import { RenderingStates } from "./pdf_rendering_queue"; -import { viewerCompatibilityParams } from "./viewer_compatibility"; +import { RenderingStates } from "./pdf_rendering_queue.js"; +import { viewerCompatibilityParams } from "./viewer_compatibility.js"; /** * @typedef {Object} PDFPageViewOptions diff --git a/web/pdf_presentation_mode.js b/web/pdf_presentation_mode.js index f85deb2fe..b69ea7553 100644 --- a/web/pdf_presentation_mode.js +++ b/web/pdf_presentation_mode.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { normalizeWheelEventDelta } from "./ui_utils"; +import { normalizeWheelEventDelta } from "./ui_utils.js"; const DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms const DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms diff --git a/web/pdf_print_service.js b/web/pdf_print_service.js index 96613fc07..a41d0d7c8 100644 --- a/web/pdf_print_service.js +++ b/web/pdf_print_service.js @@ -13,9 +13,9 @@ * limitations under the License. */ -import { CSS_UNITS, NullL10n } from "./ui_utils"; -import { PDFPrintServiceFactory, PDFViewerApplication } from "./app"; -import { AppOptions } from "./app_options"; +import { CSS_UNITS, NullL10n } from "./ui_utils.js"; +import { PDFPrintServiceFactory, PDFViewerApplication } from "./app.js"; +import { AppOptions } from "./app_options.js"; let activeService = null; let overlayManager = null; diff --git a/web/pdf_sidebar.js b/web/pdf_sidebar.js index 3a735a5e6..a06d5a8aa 100644 --- a/web/pdf_sidebar.js +++ b/web/pdf_sidebar.js @@ -13,8 +13,8 @@ * limitations under the License. */ -import { NullL10n } from "./ui_utils"; -import { RenderingStates } from "./pdf_rendering_queue"; +import { NullL10n } from "./ui_utils.js"; +import { RenderingStates } from "./pdf_rendering_queue.js"; const UI_NOTIFICATION_CLASS = "pdfSidebarNotification"; diff --git a/web/pdf_sidebar_resizer.js b/web/pdf_sidebar_resizer.js index 0f85543d3..77b0a4516 100644 --- a/web/pdf_sidebar_resizer.js +++ b/web/pdf_sidebar_resizer.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { clamp, NullL10n } from "./ui_utils"; +import { clamp, NullL10n } from "./ui_utils.js"; const SIDEBAR_WIDTH_VAR = "--sidebar-width"; const SIDEBAR_MIN_WIDTH = 200; // pixels diff --git a/web/pdf_single_page_viewer.js b/web/pdf_single_page_viewer.js index 4fb78f7d9..e6dabb391 100644 --- a/web/pdf_single_page_viewer.js +++ b/web/pdf_single_page_viewer.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { BaseViewer } from "./base_viewer"; +import { BaseViewer } from "./base_viewer.js"; import { shadow } from "pdfjs-lib"; class PDFSinglePageViewer extends BaseViewer { diff --git a/web/pdf_thumbnail_view.js b/web/pdf_thumbnail_view.js index 9fe8b071c..5d8c9ae1f 100644 --- a/web/pdf_thumbnail_view.js +++ b/web/pdf_thumbnail_view.js @@ -17,8 +17,8 @@ import { createPromiseCapability, RenderingCancelledException, } from "pdfjs-lib"; -import { getOutputScale, NullL10n } from "./ui_utils"; -import { RenderingStates } from "./pdf_rendering_queue"; +import { getOutputScale, NullL10n } from "./ui_utils.js"; +import { RenderingStates } from "./pdf_rendering_queue.js"; const MAX_NUM_SCALING_STEPS = 3; const THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px diff --git a/web/pdf_thumbnail_viewer.js b/web/pdf_thumbnail_viewer.js index b2180dc36..b26255e59 100644 --- a/web/pdf_thumbnail_viewer.js +++ b/web/pdf_thumbnail_viewer.js @@ -19,8 +19,8 @@ import { NullL10n, scrollIntoView, watchScroll, -} from "./ui_utils"; -import { PDFThumbnailView } from "./pdf_thumbnail_view"; +} from "./ui_utils.js"; +import { PDFThumbnailView } from "./pdf_thumbnail_view.js"; const THUMBNAIL_SCROLL_MARGIN = -19; const THUMBNAIL_SELECTED_CLASS = "selected"; diff --git a/web/pdf_viewer.component.js b/web/pdf_viewer.component.js index 86ae6f373..513efaaf5 100644 --- a/web/pdf_viewer.component.js +++ b/web/pdf_viewer.component.js @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* eslint-disable no-unused-vars */ import { AnnotationLayerBuilder, @@ -34,10 +33,12 @@ import { GenericL10n } from "./genericl10n.js"; import { PDFFindController } from "./pdf_find_controller.js"; import { PDFHistory } from "./pdf_history.js"; import { PDFPageView } from "./pdf_page_view.js"; -import { PDFSinglePageViewer } from "./pdf_single_page_viewer"; +import { PDFSinglePageViewer } from "./pdf_single_page_viewer.js"; import { PDFViewer } from "./pdf_viewer.js"; +// 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"); // For backwards compatibility, ensure that events are re-dispatched to the DOM. diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index 9c718ce78..fcf0e1ac5 100644 --- a/web/pdf_viewer.js +++ b/web/pdf_viewer.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { BaseViewer } from "./base_viewer"; +import { BaseViewer } from "./base_viewer.js"; import { shadow } from "pdfjs-lib"; class PDFViewer extends BaseViewer { diff --git a/web/preferences.js b/web/preferences.js index f01b37406..17a072afa 100644 --- a/web/preferences.js +++ b/web/preferences.js @@ -23,7 +23,7 @@ function getDefaultPreferences() { } else { defaultPreferences = new Promise(function(resolve, reject) { if (typeof SystemJS === "object") { - SystemJS.import("./app_options").then(resolve, reject); + SystemJS.import("./app_options.js").then(resolve, reject); } else { reject(new Error("SystemJS must be used to load AppOptions.")); } diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js index f31916949..24048416a 100644 --- a/web/secondary_toolbar.js +++ b/web/secondary_toolbar.js @@ -13,9 +13,9 @@ * limitations under the License. */ -import { SCROLLBAR_PADDING, ScrollMode, SpreadMode } from "./ui_utils"; -import { CursorTool } from "./pdf_cursor_tools"; -import { PDFSinglePageViewer } from "./pdf_single_page_viewer"; +import { SCROLLBAR_PADDING, ScrollMode, SpreadMode } from "./ui_utils.js"; +import { CursorTool } from "./pdf_cursor_tools.js"; +import { PDFSinglePageViewer } from "./pdf_single_page_viewer.js"; /** * @typedef {Object} SecondaryToolbarOptions diff --git a/web/text_layer_builder.js b/web/text_layer_builder.js index fb1f23095..9b8d11953 100644 --- a/web/text_layer_builder.js +++ b/web/text_layer_builder.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { getGlobalEventBus } from "./ui_utils"; +import { getGlobalEventBus } from "./ui_utils.js"; import { renderTextLayer } from "pdfjs-lib"; const EXPAND_DIVS_TIMEOUT = 300; // ms diff --git a/web/toolbar.js b/web/toolbar.js index 76aaafed5..a5f3caef0 100644 --- a/web/toolbar.js +++ b/web/toolbar.js @@ -21,7 +21,7 @@ import { MIN_SCALE, noContextMenuHandler, NullL10n, -} from "./ui_utils"; +} from "./ui_utils.js"; const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading"; const SCALE_SELECT_CONTAINER_PADDING = 8; diff --git a/web/viewer.js b/web/viewer.js index d8d0359d2..0ae55e0ec 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -189,10 +189,10 @@ function webViewerLoad() { const config = getViewerConfiguration(); if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")) { Promise.all([ - SystemJS.import("pdfjs-web/app"), - SystemJS.import("pdfjs-web/app_options"), - SystemJS.import("pdfjs-web/genericcom"), - SystemJS.import("pdfjs-web/pdf_print_service"), + SystemJS.import("pdfjs-web/app.js"), + SystemJS.import("pdfjs-web/app_options.js"), + SystemJS.import("pdfjs-web/genericcom.js"), + SystemJS.import("pdfjs-web/pdf_print_service.js"), ]).then(function([app, appOptions, ...otherModules]) { window.PDFViewerApplication = app.PDFViewerApplication; window.PDFViewerApplicationOptions = appOptions.AppOptions;