mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
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`.
This commit is contained in:
parent
b833f84307
commit
36881e3770
125 changed files with 453 additions and 443 deletions
|
@ -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
|
||||
|
|
44
web/app.js
44
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());
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
import { apiCompatibilityParams } from "pdfjs-lib";
|
||||
import { viewerCompatibilityParams } from "./viewer_compatibility";
|
||||
import { viewerCompatibilityParams } from "./viewer_compatibility.js";
|
||||
|
||||
const OptionKind = {
|
||||
VIEWER: 0x02,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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" ||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NullL10n } from "./ui_utils";
|
||||
import { NullL10n } from "./ui_utils.js";
|
||||
import { PasswordResponses } from "pdfjs-lib";
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -19,7 +19,7 @@ import {
|
|||
getPDFFileNameFromURL,
|
||||
isPortraitOrientation,
|
||||
NullL10n,
|
||||
} from "./ui_utils";
|
||||
} from "./ui_utils.js";
|
||||
|
||||
const DEFAULT_FIELD_CONTENT = "-";
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { getGlobalEventBus, parseQueryString } from "./ui_utils";
|
||||
import { getGlobalEventBus, parseQueryString } from "./ui_utils.js";
|
||||
|
||||
/**
|
||||
* @typedef {Object} PDFLinkServiceOptions
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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."));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue