Skip to content

Commit

Permalink
Ensure that all import and require statements, in the entire code…
Browse files Browse the repository at this point in the history
…-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`.
  • Loading branch information
Snuffleupagus committed Jan 2, 2020
1 parent b833f84 commit 923f62e
Show file tree
Hide file tree
Showing 125 changed files with 433 additions and 423 deletions.
14 changes: 7 additions & 7 deletions src/core/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/core/bidi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/ccitt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/core/ccitt_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/core/cff_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/core/chunked_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions src/core/cmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/core/colorspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/core/core_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/core/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
22 changes: 11 additions & 11 deletions src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
42 changes: 21 additions & 21 deletions src/core/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -44,47 +44,47 @@ import {
isStream,
Name,
Ref,
} from "./primitives";
} from "./primitives.js";
import {
ErrorFont,
Font,
FontFlags,
getFontType,
IdentityToUnicodeMap,
ToUnicodeMap,
} from "./fonts";
} from "./fonts.js";
import {
getEncoding,
MacRomanEncoding,
StandardEncoding,
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 = {
Expand Down
10 changes: 5 additions & 5 deletions src/core/font_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
22 changes: 11 additions & 11 deletions src/core/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
string32,
unreachable,
warn,
} from "../shared/util";
} from "../shared/util.js";
import {
CFF,
CFFCharset,
Expand All @@ -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 = [
Expand Down
6 changes: 3 additions & 3 deletions src/core/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/core/glyphlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/core/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
/**
Expand Down
6 changes: 3 additions & 3 deletions src/core/image_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
6 changes: 3 additions & 3 deletions src/core/jbig2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/core/jbig2_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 923f62e

Please sign in to comment.