aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 19:23:17 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 19:23:17 -0500
commitd5b1217df3fe7480fc5f58fe194f5bbf73281094 (patch)
treedc24325097acb461b24415e87666da96f7912aae
parentb9310603865292749d7303f41b7c2d6b6f286078 (diff)
Use import map
-rw-r--r--dev/jsconfig.json1
-rw-r--r--ext/action-popup.html8
-rw-r--r--ext/background.html8
-rw-r--r--ext/info.html8
-rw-r--r--ext/issues.html8
-rw-r--r--ext/js/background/backend.js2
-rw-r--r--ext/js/background/offscreen.js2
-rw-r--r--ext/js/display/search-display-controller.js2
-rw-r--r--ext/js/display/search-main.js2
-rw-r--r--ext/js/dom/simple-dom-parser.js2
-rw-r--r--ext/js/language/dictionary-importer.js4
-rw-r--r--ext/js/pages/settings/backup-controller.js2
-rw-r--r--ext/js/pages/settings/popup-preview-frame.js2
-rw-r--r--ext/js/templates/sandbox/anki-template-renderer.js2
-rw-r--r--ext/js/templates/sandbox/template-renderer-media-provider.js2
-rw-r--r--ext/js/templates/sandbox/template-renderer.js2
-rw-r--r--ext/legal.html8
-rw-r--r--ext/offscreen.html8
-rw-r--r--ext/permissions.html8
-rw-r--r--ext/popup-preview.html8
-rw-r--r--ext/popup.html8
-rw-r--r--ext/search.html8
-rw-r--r--ext/settings.html8
-rw-r--r--ext/template-renderer.html8
-rw-r--r--ext/welcome.html8
-rw-r--r--jsconfig.json3
-rw-r--r--test/japanese-util.test.js2
-rw-r--r--test/jsconfig.json1
28 files changed, 121 insertions, 14 deletions
diff --git a/dev/jsconfig.json b/dev/jsconfig.json
index a012f32f..518f97ad 100644
--- a/dev/jsconfig.json
+++ b/dev/jsconfig.json
@@ -12,6 +12,7 @@
"skipLibCheck": false,
"baseUrl": ".",
"paths": {
+ "zip.js": ["@zip.js/zip.js"],
"anki-templates": ["../types/ext/anki-templates"],
"anki-templates-internal": ["../types/ext/anki-templates-internal"],
"cache-map": ["../types/ext/cache-map"],
diff --git a/ext/action-popup.html b/ext/action-popup.html
index b60e7055..5c6bfce4 100644
--- a/ext/action-popup.html
+++ b/ext/action-popup.html
@@ -12,6 +12,14 @@
<link rel="icon" type="image/png" href="/images/icon64.png" sizes="64x64">
<link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128">
<link rel="stylesheet" type="text/css" href="/css/action-popup.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/background.html b/ext/background.html
index dc88f397..6f9ee5f6 100644
--- a/ext/background.html
+++ b/ext/background.html
@@ -12,6 +12,14 @@
<link rel="icon" type="image/png" href="/images/icon64.png" sizes="64x64">
<link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128">
<link rel="stylesheet" type="text/css" href="/css/background.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/info.html b/ext/info.html
index cb80053d..9e71ffd4 100644
--- a/ext/info.html
+++ b/ext/info.html
@@ -13,6 +13,14 @@
<link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128">
<link rel="stylesheet" type="text/css" href="/css/material.css">
<link rel="stylesheet" type="text/css" href="/css/settings.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/issues.html b/ext/issues.html
index 904fbf16..c75683dd 100644
--- a/ext/issues.html
+++ b/ext/issues.html
@@ -13,6 +13,14 @@
<link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128">
<link rel="stylesheet" type="text/css" href="/css/material.css">
<link rel="stylesheet" type="text/css" href="/css/settings.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index be68ecf4..44f5a42d 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import * as wanakana from '../../lib/wanakana.js';
+import * as wanakana from 'wanakana';
import {AccessibilityController} from '../accessibility/accessibility-controller.js';
import {AnkiConnect} from '../comm/anki-connect.js';
import {ClipboardMonitor} from '../comm/clipboard-monitor.js';
diff --git a/ext/js/background/offscreen.js b/ext/js/background/offscreen.js
index 1b68887b..45345c01 100644
--- a/ext/js/background/offscreen.js
+++ b/ext/js/background/offscreen.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import * as wanakana from '../../lib/wanakana.js';
+import * as wanakana from 'wanakana';
import {ClipboardReader} from '../comm/clipboard-reader.js';
import {invokeMessageHandler} from '../core.js';
import {ArrayBufferUtil} from '../data/sandbox/array-buffer-util.js';
diff --git a/ext/js/display/search-display-controller.js b/ext/js/display/search-display-controller.js
index a9bf2217..b93757c2 100644
--- a/ext/js/display/search-display-controller.js
+++ b/ext/js/display/search-display-controller.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import * as wanakana from '../../lib/wanakana.js';
+import * as wanakana from 'wanakana';
import {ClipboardMonitor} from '../comm/clipboard-monitor.js';
import {EventListenerCollection, invokeMessageHandler} from '../core.js';
import {yomitan} from '../yomitan.js';
diff --git a/ext/js/display/search-main.js b/ext/js/display/search-main.js
index c20cc135..c1445e37 100644
--- a/ext/js/display/search-main.js
+++ b/ext/js/display/search-main.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import * as wanakana from '../../lib/wanakana.js';
+import * as wanakana from 'wanakana';
import {log} from '../core.js';
import {DocumentFocusController} from '../dom/document-focus-controller.js';
import {HotkeyHandler} from '../input/hotkey-handler.js';
diff --git a/ext/js/dom/simple-dom-parser.js b/ext/js/dom/simple-dom-parser.js
index a1f63890..7ee28d51 100644
--- a/ext/js/dom/simple-dom-parser.js
+++ b/ext/js/dom/simple-dom-parser.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import * as parse5 from '../../lib/parse5.js';
+import * as parse5 from 'parse5';
/**
* @augments import('simple-dom-parser').ISimpleDomParser
diff --git a/ext/js/language/dictionary-importer.js b/ext/js/language/dictionary-importer.js
index 115e0726..5a4d7257 100644
--- a/ext/js/language/dictionary-importer.js
+++ b/ext/js/language/dictionary-importer.js
@@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import * as ajvSchemas0 from '../../lib/validate-schemas.js';
+import * as ajvSchemas0 from 'validate-schemas';
import {
BlobWriter as BlobWriter0,
TextWriter as TextWriter0,
Uint8ArrayReader as Uint8ArrayReader0,
ZipReader as ZipReader0,
configure
-} from '../../lib/zip.js';
+} from 'zip.js';
import {stringReverse} from '../core.js';
import {MediaUtil} from '../media/media-util.js';
import {ExtensionError} from '../core/extension-error.js';
diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js
index 52c5f418..aeff2a97 100644
--- a/ext/js/pages/settings/backup-controller.js
+++ b/ext/js/pages/settings/backup-controller.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {Dexie} from '../../../lib/dexie.js';
+import {Dexie} from 'dexie';
import {isObject, log} from '../../core.js';
import {OptionsUtil} from '../../data/options-util.js';
import {ArrayBufferUtil} from '../../data/sandbox/array-buffer-util.js';
diff --git a/ext/js/pages/settings/popup-preview-frame.js b/ext/js/pages/settings/popup-preview-frame.js
index c1a0d706..bb00829f 100644
--- a/ext/js/pages/settings/popup-preview-frame.js
+++ b/ext/js/pages/settings/popup-preview-frame.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import * as wanakana from '../../../lib/wanakana.js';
+import * as wanakana from 'wanakana';
import {Frontend} from '../../app/frontend.js';
import {TextSourceRange} from '../../dom/text-source-range.js';
import {yomitan} from '../../yomitan.js';
diff --git a/ext/js/templates/sandbox/anki-template-renderer.js b/ext/js/templates/sandbox/anki-template-renderer.js
index 9f4bf6ff..b0dc8223 100644
--- a/ext/js/templates/sandbox/anki-template-renderer.js
+++ b/ext/js/templates/sandbox/anki-template-renderer.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {Handlebars} from '../../../lib/handlebars.js';
+import {Handlebars} from 'handlebars';
import {AnkiNoteDataCreator} from '../../data/sandbox/anki-note-data-creator.js';
import {PronunciationGenerator} from '../../display/sandbox/pronunciation-generator.js';
import {StructuredContentGenerator} from '../../display/sandbox/structured-content-generator.js';
diff --git a/ext/js/templates/sandbox/template-renderer-media-provider.js b/ext/js/templates/sandbox/template-renderer-media-provider.js
index d8a0a16d..23f334e1 100644
--- a/ext/js/templates/sandbox/template-renderer-media-provider.js
+++ b/ext/js/templates/sandbox/template-renderer-media-provider.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {Handlebars} from '../../../lib/handlebars.js';
+import {Handlebars} from 'handlebars';
export class TemplateRendererMediaProvider {
constructor() {
diff --git a/ext/js/templates/sandbox/template-renderer.js b/ext/js/templates/sandbox/template-renderer.js
index fe240b5f..d4aebd64 100644
--- a/ext/js/templates/sandbox/template-renderer.js
+++ b/ext/js/templates/sandbox/template-renderer.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {Handlebars} from '../../../lib/handlebars.js';
+import {Handlebars} from 'handlebars';
import {ExtensionError} from '../../core/extension-error.js';
export class TemplateRenderer {
diff --git a/ext/legal.html b/ext/legal.html
index 94912c7e..b853f3e8 100644
--- a/ext/legal.html
+++ b/ext/legal.html
@@ -14,6 +14,14 @@
<link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128">
<link rel="stylesheet" type="text/css" href="/css/material.css">
<link rel="stylesheet" type="text/css" href="/css/settings.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/offscreen.html b/ext/offscreen.html
index afb7eb44..cfab53ee 100644
--- a/ext/offscreen.html
+++ b/ext/offscreen.html
@@ -12,6 +12,14 @@
<link rel="icon" type="image/png" href="/images/icon64.png" sizes="64x64">
<link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128">
<link rel="stylesheet" type="text/css" href="/css/background.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/permissions.html b/ext/permissions.html
index 61b0d363..7baff14e 100644
--- a/ext/permissions.html
+++ b/ext/permissions.html
@@ -14,6 +14,14 @@
<link rel="stylesheet" type="text/css" href="/css/material.css">
<link rel="stylesheet" type="text/css" href="/css/settings.css">
<link rel="stylesheet" type="text/css" href="/css/permissions.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/popup-preview.html b/ext/popup-preview.html
index 15810242..7bd54470 100644
--- a/ext/popup-preview.html
+++ b/ext/popup-preview.html
@@ -13,6 +13,14 @@
<link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128">
<link rel="stylesheet" type="text/css" href="/css/popup-preview.css">
<link rel="stylesheet" type="text/css" href="/css/popup-outer.css" id="popup-outer-css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/popup.html b/ext/popup.html
index 30e8a8c0..6bc8d690 100644
--- a/ext/popup.html
+++ b/ext/popup.html
@@ -15,6 +15,14 @@
<link rel="stylesheet" type="text/css" href="/css/display.css">
<link rel="stylesheet" type="text/css" href="/css/display-pronunciation.css">
<link rel="stylesheet" type="text/css" href="/css/structured-content.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/search.html b/ext/search.html
index 8c595cc4..377a966a 100644
--- a/ext/search.html
+++ b/ext/search.html
@@ -16,6 +16,14 @@
<link rel="stylesheet" type="text/css" href="/css/display-pronunciation.css">
<link rel="stylesheet" type="text/css" href="/css/structured-content.css">
<link rel="stylesheet" type="text/css" href="/css/search.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/settings.html b/ext/settings.html
index 346cc1d7..276a7222 100644
--- a/ext/settings.html
+++ b/ext/settings.html
@@ -14,6 +14,14 @@
<link rel="stylesheet" type="text/css" href="/css/material.css">
<link rel="stylesheet" type="text/css" href="/css/settings.css">
<link rel="stylesheet" type="text/css" href="/css/display-pronunciation.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/template-renderer.html b/ext/template-renderer.html
index 116f1a0c..d1747e99 100644
--- a/ext/template-renderer.html
+++ b/ext/template-renderer.html
@@ -11,6 +11,14 @@
<link rel="icon" type="image/png" href="/images/icon48.png" sizes="48x48">
<link rel="icon" type="image/png" href="/images/icon64.png" sizes="64x64">
<link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/ext/welcome.html b/ext/welcome.html
index 40639881..355bbc5f 100644
--- a/ext/welcome.html
+++ b/ext/welcome.html
@@ -13,6 +13,14 @@
<link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128">
<link rel="stylesheet" type="text/css" href="/css/material.css">
<link rel="stylesheet" type="text/css" href="/css/settings.css">
+ <script type="importmap">{"imports":{
+"dexie": "./lib/dexie.js",
+"handlebars": "./lib/handlebars.js",
+"parse5": "./lib/parse5.js",
+"wanakana": "./lib/wanakana.js",
+"validate-schemas": "./lib/validate-schemas.js",
+"zip.js": "./lib/zip.js"
+}}</script>
</head>
<body>
diff --git a/jsconfig.json b/jsconfig.json
index ace0c2aa..4f316174 100644
--- a/jsconfig.json
+++ b/jsconfig.json
@@ -12,6 +12,7 @@
"skipLibCheck": false,
"baseUrl": ".",
"paths": {
+ "zip.js": ["@zip.js/zip.js"],
"*": ["./types/ext/*"]
},
"types": [
@@ -29,7 +30,7 @@
"include": [
"ext/**/*.js",
"types/ext/**/*.ts",
- "types/other/web-set-timeout.d.ts"
+ "types/other/globals.d.ts"
],
"exclude": [
"node_modules",
diff --git a/test/japanese-util.test.js b/test/japanese-util.test.js
index 47da4ccb..ae5b1a16 100644
--- a/test/japanese-util.test.js
+++ b/test/japanese-util.test.js
@@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import * as wanakana from 'wanakana';
import {expect, test} from 'vitest';
import {TextSourceMap} from '../ext/js/general/text-source-map.js';
import {JapaneseUtil} from '../ext/js/language/sandbox/japanese-util.js';
-import * as wanakana from '../ext/lib/wanakana.js';
const jp = new JapaneseUtil(wanakana);
diff --git a/test/jsconfig.json b/test/jsconfig.json
index b025918c..261ec345 100644
--- a/test/jsconfig.json
+++ b/test/jsconfig.json
@@ -12,6 +12,7 @@
"skipLibCheck": false,
"baseUrl": ".",
"paths": {
+ "zip.js": ["@zip.js/zip.js"],
"*": ["../types/ext/*"],
"dev/*": ["../types/dev/*"],
"test/*": ["../types/test/*"]