From 6f96fa9da8368080001143898f6c3ece60939359 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 1 Jul 2025 14:09:17 -0400 Subject: [PATCH] ESMify EPUB and uses --- chrome/content/zotero/{EPUB.jsm => EPUB.mjs} | 4 +--- chrome/content/zotero/xpcom/fulltext.js | 2 +- chrome/content/zotero/xpcom/recognizeDocument.js | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) rename chrome/content/zotero/{EPUB.jsm => EPUB.mjs} (99%) diff --git a/chrome/content/zotero/EPUB.jsm b/chrome/content/zotero/EPUB.mjs similarity index 99% rename from chrome/content/zotero/EPUB.jsm rename to chrome/content/zotero/EPUB.mjs index 71f12f19c1..631cc348bc 100644 --- a/chrome/content/zotero/EPUB.jsm +++ b/chrome/content/zotero/EPUB.mjs @@ -23,8 +23,6 @@ ***** END LICENSE BLOCK ***** */ -var EXPORTED_SYMBOLS = ["EPUB"]; - ChromeUtils.defineESModuleGetters(this, { Zotero: "chrome://zotero/content/zotero.mjs", }); @@ -38,7 +36,7 @@ const ZipReader = Components.Constructor( const DC_NS = 'http://purl.org/dc/elements/1.1/'; const OPF_NS = 'http://www.idpf.org/2007/opf'; -class EPUB { +export class EPUB { _zipReader; _contentOPF = null; diff --git a/chrome/content/zotero/xpcom/fulltext.js b/chrome/content/zotero/xpcom/fulltext.js index b593af610d..52ee6428a7 100644 --- a/chrome/content/zotero/xpcom/fulltext.js +++ b/chrome/content/zotero/xpcom/fulltext.js @@ -411,7 +411,7 @@ Zotero.Fulltext = Zotero.FullText = new function () { * @return {Promise} */ this.indexEPUB = async function (filePath, itemID, allText) { - const { EPUB } = ChromeUtils.import('chrome://zotero/content/EPUB.jsm'); + const { EPUB } = ChromeUtils.importESModule("chrome://zotero/content/EPUB.mjs"); let maxLength = Zotero.Prefs.get('fulltext.textMaxLength'); if (maxLength === 0) { diff --git a/chrome/content/zotero/xpcom/recognizeDocument.js b/chrome/content/zotero/xpcom/recognizeDocument.js index 1ac1173d39..9cc21abcca 100644 --- a/chrome/content/zotero/xpcom/recognizeDocument.js +++ b/chrome/content/zotero/xpcom/recognizeDocument.js @@ -578,7 +578,7 @@ Zotero.RecognizeDocument = new function () { } async function _recognizeEPUB(item, filePath) { - const { EPUB } = ChromeUtils.import('chrome://zotero/content/EPUB.jsm'); + const { EPUB } = ChromeUtils.importESModule("chrome://zotero/content/EPUB.mjs"); let epub = new EPUB(filePath); try {