@shgysk8zer0/importmap 1.8.20 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/cli.cjs +3 -4
- package/cli.js +3 -4
- package/consts.js +1 -2
- package/html.cjs +6 -7
- package/html.js +6 -7
- package/imap.js +195 -0
- package/importmap.cjs +2 -189
- package/importmap.js +2 -183
- package/importmap.json +1 -0
- package/index.cjs +54 -19
- package/index.js +51 -16
- package/package.json +3 -2
- package/unpkg.js +9 -1
package/importmap.js
CHANGED
|
@@ -1,184 +1,3 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
import { readFile } from 'node:fs/promises';
|
|
3
|
-
import '@shgysk8zer0/polyfills';
|
|
1
|
+
var importmap = JSON.parse('{\n "imports": {\n "@node/": "/node_modules/",\n "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.11/",\n "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.2/konami.js",\n "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.3/browser.min.js",\n "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.3/",\n "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.1.5/jwk-utils.min.js",\n "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.1.5/",\n "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",\n "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",\n "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",\n "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",\n "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",\n "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.4/http-status.js",\n "@shgysk8zer0/aes-gcm": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.9/aes-gcm.min.js",\n "@shgysk8zer0/aes-gcm/": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.9/",\n "@shgysk8zer0/squish": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/squish.min.js",\n "@shgysk8zer0/squish/": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/",\n "@shgysk8zer0/suid": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/suid.min.js",\n "@shgysk8zer0/suid/": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/",\n "@shgysk8zer0/geoutils": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/geoutils.min.js",\n "@shgysk8zer0/geoutils/": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/",\n "@shgysk8zer0/core-css/": "https://unpkg.com/@shgysk8zer0/core-css@3.0.0/",\n "@shgysk8zer0/signals": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/signals.min.js",\n "@shgysk8zer0/signals/": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/",\n "@shgysk8zer0/importmap/": "https://unpkg.com/@shgysk8zer0/importmap@1.9.1/",\n "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",\n "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",\n "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.1.6/bundle.min.js",\n "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.1.6/",\n "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/sanitizer.js",\n "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/",\n "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.34/core.js",\n "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.34/",\n "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.3.2/styles.js",\n "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.3.2/",\n "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.8/component.js",\n "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.8/",\n "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.7/markdown.min.js",\n "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.7/",\n "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",\n "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",\n "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.min.js",\n "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",\n "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.6/",\n "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.6/idb.min.js",\n "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.2/",\n "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.2/otp.min.js",\n "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",\n "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",\n "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/scanner.min.js",\n "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/",\n "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.23/",\n "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",\n "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",\n "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.15/router.mjs",\n "@aegisjsproject/router/": "https://unpkg.com/@aegisjsproject/router@1.1.15/",\n "@aegisjsproject/callback-registry": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.4/callbackRegistry.js",\n "@aegisjsproject/callback-registry/": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.4/",\n "@aegisjsproject/attempt": "https://unpkg.com/@aegisjsproject/attempt@1.0.7/attempt.js",\n "@aegisjsproject/attempt/": "https://unpkg.com/@aegisjsproject/attempt@1.0.7/",\n "@aegisjsproject/secret-store": "https://unpkg.com/@aegisjsproject/secret-store@1.1.1/commands.min.js",\n "@aegisjsproject/commands/": "https://unpkg.com/@aegisjsproject/commands@1.0.2/",\n "@aegisjsproject/commands": "https://unpkg.com/@aegisjsproject/commands@1.0.2/commands.min.js",\n "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.6/main.js",\n "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.6/",\n "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.1.1/",\n "@aegisjsproject/qr-encoder": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/index.min.js",\n "@aegisjsproject/qr-encoder/": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/",\n "@aegisjsproject/escape": "https://unpkg.com/@aegisjsproject/escape@1.0.4/index.min.js",\n "@aegisjsproject/escape/": "https://unpkg.com/@aegisjsproject/escape@1.0.4/",\n "@aegisjsproject/disposable": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/disposable.min.js",\n "@aegisjsproject/disposable/": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/",\n "@aegisjsproject/iota": "https://unpkg.com/@aegisjsproject/iota@1.0.12/iota.min.js",\n "@aegisjsproject/iota/": "https://unpkg.com/@aegisjsproject/iota@1.0.12/",\n "@aegisjsproject/disposable-registry": "https://unpkg.com/@aegisjsproject/disposable-registry@1.0.2/registry.js",\n "@aegisjsproject/disposable-registry/": "https://unpkg.com/@aegisjsproject/disposable-registry@1.0.2/",\n "@aegisjsproject/hermes": "https://unpkg.com/@aegisjsproject/hermes@1.0.2/hermes.js",\n "@aegisjsproject/hermes/": "https://unpkg.com/@aegisjsproject/hermes@1.0.2/",\n "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.10/",\n "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",\n "leaflet": "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",\n "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",\n "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.1.0/index.js",\n "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",\n "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",\n "highlight.js/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",\n "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",\n "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",\n "@highlightjs/cdn-assets/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",\n "marked": "https://unpkg.com/marked@18.0.0/lib/marked.esm.js",\n "marked-highlight": "https://unpkg.com/marked-highlight@2.2.4/src/index.js",\n "yaml": "https://unpkg.com/yaml@2.8.3/browser/dist/index.js",\n "yaml/": "https://unpkg.com/yaml@2.8.3/browser/dist/",\n "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",\n "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",\n "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",\n "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",\n "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",\n "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",\n "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",\n "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",\n "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",\n "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",\n "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",\n "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js",\n "qr": "https://unpkg.com/qr@0.5.5/index.js",\n "qr/": "https://unpkg.com/qr@0.5.5/",\n "lit": "https://unpkg.com/lit@3.3.2/index.js",\n "lit/": "https://unpkg.com/lit@3.3.2/",\n "lit-html": "https://unpkg.com/lit-html@3.3.2/lit-html.js",\n "lit-html/": "https://unpkg.com/lit-html@3.3.2/",\n "lit-element": "https://unpkg.com/lit-element@4.2.2/lit-element.js",\n "lit-element/": "https://unpkg.com/lit-element@4.2.2/",\n "@lit/reactive-element": "https://unpkg.com/@lit/reactive-element@2.1.2/reactive-element.js",\n "@lit/reactive-element/": "https://unpkg.com/@lit/reactive-element@2.1.2/",\n "@awesome.me/webawesome/": "https://unpkg.com/@awesome.me/webawesome@3.5.0/",\n "normalize.css": "https://unpkg.com/normalize.css@8.0.1/normalize.css"\n },\n "scopes": {}\n}');
|
|
4
2
|
|
|
5
|
-
var json = JSON.parse('{\n "imports": {\n "@node/": "/node_modules/",\n "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.11/",\n "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.2/konami.js",\n "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.3/browser.min.js",\n "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.3/",\n "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.1.5/jwk-utils.min.js",\n "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.1.5/",\n "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",\n "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",\n "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",\n "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",\n "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",\n "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.4/http-status.js",\n "@shgysk8zer0/aes-gcm": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.9/aes-gcm.min.js",\n "@shgysk8zer0/aes-gcm/": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.9/",\n "@shgysk8zer0/squish": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/squish.min.js",\n "@shgysk8zer0/squish/": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/",\n "@shgysk8zer0/suid": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/suid.min.js",\n "@shgysk8zer0/suid/": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/",\n "@shgysk8zer0/geoutils": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/geoutils.min.js",\n "@shgysk8zer0/geoutils/": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/",\n "@shgysk8zer0/core-css/": "https://unpkg.com/@shgysk8zer0/core-css@3.0.0/",\n "@shgysk8zer0/signals": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/signals.min.js",\n "@shgysk8zer0/signals/": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/",\n "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",\n "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",\n "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.1.6/bundle.min.js",\n "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.1.6/",\n "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/sanitizer.js",\n "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/",\n "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.34/core.js",\n "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.34/",\n "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.3.2/styles.js",\n "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.3.2/",\n "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.8/component.js",\n "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.8/",\n "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.7/markdown.min.js",\n "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.7/",\n "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",\n "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",\n "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.min.js",\n "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",\n "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.6/",\n "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.6/idb.min.js",\n "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.2/",\n "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.2/otp.min.js",\n "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",\n "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",\n "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/scanner.min.js",\n "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/",\n "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.23/",\n "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",\n "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",\n "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.15/router.mjs",\n "@aegisjsproject/router/": "https://unpkg.com/@aegisjsproject/router@1.1.15/",\n "@aegisjsproject/callback-registry": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.4/callbackRegistry.js",\n "@aegisjsproject/callback-registry/": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.4/",\n "@aegisjsproject/attempt": "https://unpkg.com/@aegisjsproject/attempt@1.0.7/attempt.js",\n "@aegisjsproject/attempt/": "https://unpkg.com/@aegisjsproject/attempt@1.0.7/",\n "@aegisjsproject/secret-store": "https://unpkg.com/@aegisjsproject/secret-store@1.1.1/commands.min.js",\n "@aegisjsproject/commands/": "https://unpkg.com/@aegisjsproject/commands@1.0.2/",\n "@aegisjsproject/commands": "https://unpkg.com/@aegisjsproject/commands@1.0.2/commands.min.js",\n "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.6/main.js",\n "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.6/",\n "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.1.1/",\n "@aegisjsproject/qr-encoder": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/index.min.js",\n "@aegisjsproject/qr-encoder/": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/",\n "@aegisjsproject/escape": "https://unpkg.com/@aegisjsproject/escape@1.0.4/index.min.js",\n "@aegisjsproject/escape/": "https://unpkg.com/@aegisjsproject/escape@1.0.4/",\n "@aegisjsproject/disposable": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/disposable.min.js",\n "@aegisjsproject/disposable/": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/",\n "@aegisjsproject/iota": "https://unpkg.com/@aegisjsproject/iota@1.0.12/iota.min.js",\n "@aegisjsproject/iota/": "https://unpkg.com/@aegisjsproject/iota@1.0.12/",\n "@aegisjsproject/disposable-registry": "https://unpkg.com/@aegisjsproject/disposable-registry@1.0.2/registry.js",\n "@aegisjsproject/disposable-registry/": "https://unpkg.com/@aegisjsproject/disposable-registry@1.0.2/",\n "@aegisjsproject/hermes": "https://unpkg.com/@aegisjsproject/hermes@1.0.2/hermes.js",\n "@aegisjsproject/hermes/": "https://unpkg.com/@aegisjsproject/hermes@1.0.2/",\n "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.10/",\n "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",\n "leaflet": "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",\n "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",\n "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.1.0/index.js",\n "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",\n "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",\n "highlight.js/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",\n "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",\n "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",\n "@highlightjs/cdn-assets/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",\n "marked": "https://unpkg.com/marked@18.0.0/lib/marked.esm.js",\n "marked-highlight": "https://unpkg.com/marked-highlight@2.2.4/src/index.js",\n "yaml": "https://unpkg.com/yaml@2.8.3/browser/dist/index.js",\n "yaml/": "https://unpkg.com/yaml@2.8.3/browser/dist/",\n "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",\n "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",\n "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",\n "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",\n "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",\n "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",\n "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",\n "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",\n "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",\n "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",\n "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",\n "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js",\n "qr": "https://unpkg.com/qr@0.5.5/index.js",\n "qr/": "https://unpkg.com/qr@0.5.5/",\n "lit": "https://unpkg.com/lit@3.3.2/index.js",\n "lit/": "https://unpkg.com/lit@3.3.2/",\n "lit-html": "https://unpkg.com/lit-html@3.3.2/lit-html.js",\n "lit-html/": "https://unpkg.com/lit-html@3.3.2/",\n "lit-element": "https://unpkg.com/lit-element@4.2.2/lit-element.js",\n "lit-element/": "https://unpkg.com/lit-element@4.2.2/",\n "@lit/reactive-element": "https://unpkg.com/@lit/reactive-element@2.1.2/reactive-element.js",\n "@lit/reactive-element/": "https://unpkg.com/@lit/reactive-element@2.1.2/",\n "@awesome.me/webawesome/": "https://unpkg.com/@awesome.me/webawesome@3.5.0/",\n "normalize.css": "https://unpkg.com/normalize.css@8.0.1/normalize.css"\n },\n "scopes": {}\n}');
|
|
6
|
-
|
|
7
|
-
const SHA256 = 'SHA-256';
|
|
8
|
-
const SHA384 = 'SHA-384';
|
|
9
|
-
const SHA512 = 'SHA-512';
|
|
10
|
-
const DEFAULT_ALGO = SHA384;
|
|
11
|
-
|
|
12
|
-
const BASE64 = 'base64';
|
|
13
|
-
|
|
14
|
-
const { imports, scopes } = json;
|
|
15
|
-
|
|
16
|
-
class Importmap {
|
|
17
|
-
#imports = {};
|
|
18
|
-
#scopes = {};
|
|
19
|
-
#base;
|
|
20
|
-
|
|
21
|
-
constructor({ imports: i = imports, scopes: s = scopes } = {}) {
|
|
22
|
-
this.#imports = i;
|
|
23
|
-
this.#scopes = s;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get imports() {
|
|
27
|
-
return structuredClone(this.#imports);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get scopes() {
|
|
31
|
-
return structuredClone(this.#scopes);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
delete(key) {
|
|
35
|
-
return Reflect.deleteProperty(this.#imports, key);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get(key) {
|
|
39
|
-
return Reflect.get(this.#imports, key);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
has(key) {
|
|
43
|
-
return Reflect.has(this.#imports, key);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
set(key, newValue) {
|
|
47
|
-
return Reflect.set(this.#imports, key, newValue);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
toJSON() {
|
|
51
|
-
return { imports: this.#imports, scopes: this.#scopes };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
toString() {
|
|
55
|
-
return JSON.stringify(this);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
get baseUrl() {
|
|
59
|
-
return this.#base;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
set baseUrl(val) {
|
|
63
|
-
if (typeof val === 'string' && URL.canParse(val)) {
|
|
64
|
-
this.#base = val;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
resolve(specifier, base = this.baseUrl) {
|
|
69
|
-
if (specifier instanceof URL) {
|
|
70
|
-
return specifier.href;
|
|
71
|
-
} else if (typeof specifier !== 'string') {
|
|
72
|
-
return null;
|
|
73
|
-
} else if (this.has(specifier)) {
|
|
74
|
-
return URL.parse(this.get(specifier), this.baseUrl)?.href ?? null;
|
|
75
|
-
} else if (URL.canParse(specifier)) {
|
|
76
|
-
return specifier;
|
|
77
|
-
} else if (! specifier.startsWith('.')) {
|
|
78
|
-
// Find the longest match
|
|
79
|
-
const matches = Object.keys(this.imports)
|
|
80
|
-
.filter(key => key.endsWith('/') && specifier.startsWith(key))
|
|
81
|
-
.sort((a, b) => b.length - a.length);
|
|
82
|
-
|
|
83
|
-
if (matches.length === 0) {
|
|
84
|
-
return null;
|
|
85
|
-
} else {
|
|
86
|
-
const match = matches[0];
|
|
87
|
-
const target = imports[match];
|
|
88
|
-
const subpath = specifier.slice(match.length);
|
|
89
|
-
// Resolve the mapping target against the map's base, then the subpath against that
|
|
90
|
-
const resolvedTarget = new URL(target, this.baseUrl);
|
|
91
|
-
return new URL(subpath, resolvedTarget).href;
|
|
92
|
-
}
|
|
93
|
-
} else if (typeof base === 'string') {
|
|
94
|
-
return URL.parse(specifier, base)?.href ?? null;
|
|
95
|
-
} else {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
async importLocalPackage(name = 'package.json', { signal } = {}) {
|
|
101
|
-
const path = join(process.cwd(), name);
|
|
102
|
-
const pkg = await readFile(path, { encoding: 'utf8', signal });
|
|
103
|
-
|
|
104
|
-
return this.setLocalPackage(JSON.parse(pkg));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
setLocalPackage({ name, module, exports = {} }) {
|
|
108
|
-
if (typeof name !== 'string') {
|
|
109
|
-
return false;
|
|
110
|
-
} else if (typeof exports === 'string' ) {
|
|
111
|
-
this.set(name, exports);
|
|
112
|
-
return true;
|
|
113
|
-
} else if (typeof exports === 'object') {
|
|
114
|
-
Object.entries(exports).forEach(([key, value]) => {
|
|
115
|
-
if (key.startsWith('.')) {
|
|
116
|
-
const importKey = key === '.' ? name : `${name}${key.substring(1)}`;
|
|
117
|
-
const resolved = typeof value === 'string' ? value : value.import ?? value.default;
|
|
118
|
-
|
|
119
|
-
if (typeof resolved === 'string' && resolved.startsWith('./')) {
|
|
120
|
-
if (importKey.includes('*') && resolved.includes('*')) {
|
|
121
|
-
const [prefix, suffix] = importKey.split('*');
|
|
122
|
-
|
|
123
|
-
if (resolved.endsWith('*' + suffix)) {
|
|
124
|
-
this.set(prefix, resolved.substring(1).replace('*' + suffix, ''));
|
|
125
|
-
}
|
|
126
|
-
} else {
|
|
127
|
-
this.set(importKey, resolved.substring(1));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
return true;
|
|
134
|
-
} else if (typeof module === 'string') {
|
|
135
|
-
this.set(name, module);
|
|
136
|
-
return true;
|
|
137
|
-
} else {
|
|
138
|
-
this.set(name, '/');
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
async getScript({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
|
|
144
|
-
const integrity = await this.getIntegrity({ algo, alphabet, signal });
|
|
145
|
-
|
|
146
|
-
return `<script type="importmap" integrity="${integrity}">${JSON.stringify(this)}</script>`;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
async getIntegrity({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
|
|
150
|
-
if (signal instanceof AbortSignal && signal.aborted) {
|
|
151
|
-
throw signal.reason;
|
|
152
|
-
} else {
|
|
153
|
-
const prefix = algo.toLowerCase().replace('-', '') + '-';
|
|
154
|
-
const encoded = new TextEncoder().encode(this);
|
|
155
|
-
const hash = await crypto.subtle.digest(algo, encoded);
|
|
156
|
-
|
|
157
|
-
return prefix + new Uint8Array(hash).toBase64({ alphabet });
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
static get SHA256() {
|
|
162
|
-
return SHA256;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
static get SHA384() {
|
|
166
|
-
return SHA384;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
static get SHA512() {
|
|
170
|
-
return SHA512;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
static async importFromFile(path = 'importmap.json', { signal } = {}) {
|
|
174
|
-
const fullPath = join(process.cwd(), path);
|
|
175
|
-
const importmap = await readFile(fullPath, { encoding: 'utf8', signal });
|
|
176
|
-
|
|
177
|
-
return new Importmap(JSON.parse(importmap));
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const importmap = new Importmap({ imports, scopes });
|
|
182
|
-
var importmap$1 = { imports, scopes };
|
|
183
|
-
|
|
184
|
-
export { Importmap, importmap$1 as default, importmap, imports, scopes };
|
|
3
|
+
export { importmap as default };
|
package/importmap.json
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"@shgysk8zer0/core-css/": "https://unpkg.com/@shgysk8zer0/core-css@3.0.0/",
|
|
25
25
|
"@shgysk8zer0/signals": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/signals.min.js",
|
|
26
26
|
"@shgysk8zer0/signals/": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/",
|
|
27
|
+
"@shgysk8zer0/importmap/": "https://unpkg.com/@shgysk8zer0/importmap@1.9.1/",
|
|
27
28
|
"@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",
|
|
28
29
|
"@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",
|
|
29
30
|
"@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.1.6/bundle.min.js",
|
package/index.cjs
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var promises = require('node:fs/promises');
|
|
4
|
-
var node_path = require('node:path');
|
|
5
4
|
require('@shgysk8zer0/polyfills');
|
|
6
5
|
var yaml_js = require('@shgysk8zer0/npm-utils/yaml.js');
|
|
7
6
|
var json_js = require('@shgysk8zer0/npm-utils/json.js');
|
|
8
7
|
var path_js = require('@shgysk8zer0/npm-utils/path.js');
|
|
9
8
|
|
|
10
|
-
var json = JSON.parse('{\n "imports": {\n "@node/": "/node_modules/",\n "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.11/",\n "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.2/konami.js",\n "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.3/browser.min.js",\n "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.3/",\n "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.1.5/jwk-utils.min.js",\n "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.1.5/",\n "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",\n "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",\n "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",\n "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",\n "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",\n "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.4/http-status.js",\n "@shgysk8zer0/aes-gcm": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.9/aes-gcm.min.js",\n "@shgysk8zer0/aes-gcm/": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.9/",\n "@shgysk8zer0/squish": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/squish.min.js",\n "@shgysk8zer0/squish/": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/",\n "@shgysk8zer0/suid": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/suid.min.js",\n "@shgysk8zer0/suid/": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/",\n "@shgysk8zer0/geoutils": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/geoutils.min.js",\n "@shgysk8zer0/geoutils/": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/",\n "@shgysk8zer0/core-css/": "https://unpkg.com/@shgysk8zer0/core-css@3.0.0/",\n "@shgysk8zer0/signals": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/signals.min.js",\n "@shgysk8zer0/signals/": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/",\n "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",\n "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",\n "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.1.6/bundle.min.js",\n "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.1.6/",\n "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/sanitizer.js",\n "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/",\n "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.34/core.js",\n "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.34/",\n "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.3.2/styles.js",\n "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.3.2/",\n "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.8/component.js",\n "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.8/",\n "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.7/markdown.min.js",\n "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.7/",\n "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",\n "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",\n "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.min.js",\n "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",\n "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.6/",\n "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.6/idb.min.js",\n "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.2/",\n "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.2/otp.min.js",\n "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",\n "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",\n "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/scanner.min.js",\n "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/",\n "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.23/",\n "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",\n "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",\n "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.15/router.mjs",\n "@aegisjsproject/router/": "https://unpkg.com/@aegisjsproject/router@1.1.15/",\n "@aegisjsproject/callback-registry": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.4/callbackRegistry.js",\n "@aegisjsproject/callback-registry/": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.4/",\n "@aegisjsproject/attempt": "https://unpkg.com/@aegisjsproject/attempt@1.0.7/attempt.js",\n "@aegisjsproject/attempt/": "https://unpkg.com/@aegisjsproject/attempt@1.0.7/",\n "@aegisjsproject/secret-store": "https://unpkg.com/@aegisjsproject/secret-store@1.1.1/commands.min.js",\n "@aegisjsproject/commands/": "https://unpkg.com/@aegisjsproject/commands@1.0.2/",\n "@aegisjsproject/commands": "https://unpkg.com/@aegisjsproject/commands@1.0.2/commands.min.js",\n "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.6/main.js",\n "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.6/",\n "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.1.1/",\n "@aegisjsproject/qr-encoder": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/index.min.js",\n "@aegisjsproject/qr-encoder/": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/",\n "@aegisjsproject/escape": "https://unpkg.com/@aegisjsproject/escape@1.0.4/index.min.js",\n "@aegisjsproject/escape/": "https://unpkg.com/@aegisjsproject/escape@1.0.4/",\n "@aegisjsproject/disposable": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/disposable.min.js",\n "@aegisjsproject/disposable/": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/",\n "@aegisjsproject/iota": "https://unpkg.com/@aegisjsproject/iota@1.0.12/iota.min.js",\n "@aegisjsproject/iota/": "https://unpkg.com/@aegisjsproject/iota@1.0.12/",\n "@aegisjsproject/disposable-registry": "https://unpkg.com/@aegisjsproject/disposable-registry@1.0.2/registry.js",\n "@aegisjsproject/disposable-registry/": "https://unpkg.com/@aegisjsproject/disposable-registry@1.0.2/",\n "@aegisjsproject/hermes": "https://unpkg.com/@aegisjsproject/hermes@1.0.2/hermes.js",\n "@aegisjsproject/hermes/": "https://unpkg.com/@aegisjsproject/hermes@1.0.2/",\n "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.10/",\n "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",\n "leaflet": "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",\n "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",\n "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.1.0/index.js",\n "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",\n "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",\n "highlight.js/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",\n "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",\n "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",\n "@highlightjs/cdn-assets/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",\n "marked": "https://unpkg.com/marked@18.0.0/lib/marked.esm.js",\n "marked-highlight": "https://unpkg.com/marked-highlight@2.2.4/src/index.js",\n "yaml": "https://unpkg.com/yaml@2.8.3/browser/dist/index.js",\n "yaml/": "https://unpkg.com/yaml@2.8.3/browser/dist/",\n "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",\n "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",\n "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",\n "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",\n "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",\n "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",\n "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",\n "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",\n "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",\n "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",\n "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",\n "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js",\n "qr": "https://unpkg.com/qr@0.5.5/index.js",\n "qr/": "https://unpkg.com/qr@0.5.5/",\n "lit": "https://unpkg.com/lit@3.3.2/index.js",\n "lit/": "https://unpkg.com/lit@3.3.2/",\n "lit-html": "https://unpkg.com/lit-html@3.3.2/lit-html.js",\n "lit-html/": "https://unpkg.com/lit-html@3.3.2/",\n "lit-element": "https://unpkg.com/lit-element@4.2.2/lit-element.js",\n "lit-element/": "https://unpkg.com/lit-element@4.2.2/",\n "@lit/reactive-element": "https://unpkg.com/@lit/reactive-element@2.1.2/reactive-element.js",\n "@lit/reactive-element/": "https://unpkg.com/@lit/reactive-element@2.1.2/",\n "@awesome.me/webawesome/": "https://unpkg.com/@awesome.me/webawesome@3.5.0/",\n "normalize.css": "https://unpkg.com/normalize.css@8.0.1/normalize.css"\n },\n "scopes": {}\n}');
|
|
11
|
-
|
|
12
9
|
const SHA256 = 'SHA-256';
|
|
13
10
|
const SHA384 = 'SHA-384';
|
|
14
11
|
const SHA512 = 'SHA-512';
|
|
@@ -48,14 +45,12 @@ async function hash(data, { algo = DEFAULT_ALGO, output = BUFFER } = {}) {
|
|
|
48
45
|
|
|
49
46
|
const sri = async(data, { algo = SHA384 } = {}) => hash(data, { algo, output: SRI });
|
|
50
47
|
|
|
51
|
-
const { imports, scopes } = json;
|
|
52
|
-
|
|
53
48
|
class Importmap {
|
|
54
49
|
#imports = {};
|
|
55
50
|
#scopes = {};
|
|
56
|
-
#base;
|
|
51
|
+
#base = globalThis?.document?.baseURI ?? null;
|
|
57
52
|
|
|
58
|
-
constructor({ imports: i =
|
|
53
|
+
constructor({ imports: i = {}, scopes: s = {} } = {}) {
|
|
59
54
|
this.#imports = i;
|
|
60
55
|
this.#scopes = s;
|
|
61
56
|
}
|
|
@@ -103,12 +98,13 @@ class Importmap {
|
|
|
103
98
|
}
|
|
104
99
|
|
|
105
100
|
resolve(specifier, base = this.baseUrl) {
|
|
101
|
+
console.log({ specifier, base });
|
|
106
102
|
if (specifier instanceof URL) {
|
|
107
103
|
return specifier.href;
|
|
108
104
|
} else if (typeof specifier !== 'string') {
|
|
109
105
|
return null;
|
|
110
106
|
} else if (this.has(specifier)) {
|
|
111
|
-
return URL.parse(this.get(specifier),
|
|
107
|
+
return URL.parse(this.get(specifier), base)?.href ?? null;
|
|
112
108
|
} else if (URL.canParse(specifier)) {
|
|
113
109
|
return specifier;
|
|
114
110
|
} else if (! specifier.startsWith('.')) {
|
|
@@ -120,11 +116,12 @@ class Importmap {
|
|
|
120
116
|
if (matches.length === 0) {
|
|
121
117
|
return null;
|
|
122
118
|
} else {
|
|
119
|
+
const imports = this.#imports;
|
|
123
120
|
const match = matches[0];
|
|
124
121
|
const target = imports[match];
|
|
125
122
|
const subpath = specifier.slice(match.length);
|
|
126
123
|
// Resolve the mapping target against the map's base, then the subpath against that
|
|
127
|
-
const resolvedTarget = new URL(target,
|
|
124
|
+
const resolvedTarget = new URL(target, base);
|
|
128
125
|
return new URL(subpath, resolvedTarget).href;
|
|
129
126
|
}
|
|
130
127
|
} else if (typeof base === 'string') {
|
|
@@ -135,8 +132,13 @@ class Importmap {
|
|
|
135
132
|
}
|
|
136
133
|
|
|
137
134
|
async importLocalPackage(name = 'package.json', { signal } = {}) {
|
|
138
|
-
const
|
|
139
|
-
|
|
135
|
+
const [{ join }, { readFile }] = await Promise.all([
|
|
136
|
+
import('node:path'),
|
|
137
|
+
import('node:fs/promises'),
|
|
138
|
+
]);
|
|
139
|
+
|
|
140
|
+
const path = join(process.cwd(), name);
|
|
141
|
+
const pkg = await readFile(path, { encoding: 'utf8', signal });
|
|
140
142
|
|
|
141
143
|
return this.setLocalPackage(JSON.parse(pkg));
|
|
142
144
|
}
|
|
@@ -177,10 +179,12 @@ class Importmap {
|
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
181
|
|
|
180
|
-
async getScript({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
|
|
182
|
+
async getScript({ algo = DEFAULT_ALGO, alphabet = BASE64, name, signal } = {}) {
|
|
181
183
|
const integrity = await this.getIntegrity({ algo, alphabet, signal });
|
|
182
184
|
|
|
183
|
-
return
|
|
185
|
+
return typeof name === 'string'
|
|
186
|
+
? `<script type="importmap" name="${name}" integrity="${integrity}">${JSON.stringify(this)}</script>`
|
|
187
|
+
: `<script type="importmap" integrity="${integrity}">${JSON.stringify(this)}</script>`;
|
|
184
188
|
}
|
|
185
189
|
|
|
186
190
|
async getIntegrity({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
|
|
@@ -207,18 +211,37 @@ class Importmap {
|
|
|
207
211
|
return SHA512;
|
|
208
212
|
}
|
|
209
213
|
|
|
214
|
+
static importFromScript(script) {
|
|
215
|
+
if (! ('HTMLScriptElement' in globalThis)) {
|
|
216
|
+
throw new Error('Attempting to import from the wrong environment.');
|
|
217
|
+
} else if (typeof script === 'string') {
|
|
218
|
+
return this.importFromScript(globalThis.document.scripts.namedItem(script));
|
|
219
|
+
} else if (typeof script === 'number') {
|
|
220
|
+
return this.importFromScript(globalThis.document.scripts.item(script));
|
|
221
|
+
} else if (! (script instanceof globalThis.HTMLScriptElement)) {
|
|
222
|
+
throw new TypeError('Can only import from a <script>.');
|
|
223
|
+
} else if (script.type !== 'importmap') {
|
|
224
|
+
throw new TypeError(`Cannot import importmap from a <script type="${script.type ?? 'application/jacascript'}">.`);
|
|
225
|
+
} else {
|
|
226
|
+
return new this(JSON.parse(script.textContent));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
210
230
|
static async importFromFile(path = 'importmap.json', { signal } = {}) {
|
|
211
|
-
const
|
|
212
|
-
|
|
231
|
+
const [{ join }, { readFile }] = await Promise.all([
|
|
232
|
+
import('node:path'),
|
|
233
|
+
import('node:fs/promises'),
|
|
234
|
+
]);
|
|
235
|
+
const fullPath = join(process.cwd(), path);
|
|
236
|
+
const importmap = await readFile(fullPath, { encoding: 'utf8', signal });
|
|
213
237
|
|
|
214
238
|
return new Importmap(JSON.parse(importmap));
|
|
215
239
|
}
|
|
216
240
|
}
|
|
217
241
|
|
|
218
|
-
const importmap = new Importmap({ imports, scopes });
|
|
242
|
+
var data = JSON.parse('{\n "imports": {\n "@node/": "/node_modules/",\n "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.11/",\n "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.2/konami.js",\n "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.3/browser.min.js",\n "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.3/",\n "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.1.5/jwk-utils.min.js",\n "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.1.5/",\n "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",\n "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",\n "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",\n "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",\n "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",\n "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.4/http-status.js",\n "@shgysk8zer0/aes-gcm": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.9/aes-gcm.min.js",\n "@shgysk8zer0/aes-gcm/": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.9/",\n "@shgysk8zer0/squish": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/squish.min.js",\n "@shgysk8zer0/squish/": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/",\n "@shgysk8zer0/suid": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/suid.min.js",\n "@shgysk8zer0/suid/": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/",\n "@shgysk8zer0/geoutils": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/geoutils.min.js",\n "@shgysk8zer0/geoutils/": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/",\n "@shgysk8zer0/core-css/": "https://unpkg.com/@shgysk8zer0/core-css@3.0.0/",\n "@shgysk8zer0/signals": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/signals.min.js",\n "@shgysk8zer0/signals/": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/",\n "@shgysk8zer0/importmap/": "https://unpkg.com/@shgysk8zer0/importmap@1.9.1/",\n "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",\n "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",\n "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.1.6/bundle.min.js",\n "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.1.6/",\n "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/sanitizer.js",\n "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/",\n "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.34/core.js",\n "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.34/",\n "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.3.2/styles.js",\n "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.3.2/",\n "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.8/component.js",\n "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.8/",\n "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.7/markdown.min.js",\n "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.7/",\n "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",\n "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",\n "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.min.js",\n "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",\n "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.6/",\n "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.6/idb.min.js",\n "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.2/",\n "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.2/otp.min.js",\n "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",\n "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",\n "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/scanner.min.js",\n "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/",\n "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.23/",\n "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",\n "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",\n "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.15/router.mjs",\n "@aegisjsproject/router/": "https://unpkg.com/@aegisjsproject/router@1.1.15/",\n "@aegisjsproject/callback-registry": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.4/callbackRegistry.js",\n "@aegisjsproject/callback-registry/": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.4/",\n "@aegisjsproject/attempt": "https://unpkg.com/@aegisjsproject/attempt@1.0.7/attempt.js",\n "@aegisjsproject/attempt/": "https://unpkg.com/@aegisjsproject/attempt@1.0.7/",\n "@aegisjsproject/secret-store": "https://unpkg.com/@aegisjsproject/secret-store@1.1.1/commands.min.js",\n "@aegisjsproject/commands/": "https://unpkg.com/@aegisjsproject/commands@1.0.2/",\n "@aegisjsproject/commands": "https://unpkg.com/@aegisjsproject/commands@1.0.2/commands.min.js",\n "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.6/main.js",\n "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.6/",\n "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.1.1/",\n "@aegisjsproject/qr-encoder": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/index.min.js",\n "@aegisjsproject/qr-encoder/": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/",\n "@aegisjsproject/escape": "https://unpkg.com/@aegisjsproject/escape@1.0.4/index.min.js",\n "@aegisjsproject/escape/": "https://unpkg.com/@aegisjsproject/escape@1.0.4/",\n "@aegisjsproject/disposable": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/disposable.min.js",\n "@aegisjsproject/disposable/": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/",\n "@aegisjsproject/iota": "https://unpkg.com/@aegisjsproject/iota@1.0.12/iota.min.js",\n "@aegisjsproject/iota/": "https://unpkg.com/@aegisjsproject/iota@1.0.12/",\n "@aegisjsproject/disposable-registry": "https://unpkg.com/@aegisjsproject/disposable-registry@1.0.2/registry.js",\n "@aegisjsproject/disposable-registry/": "https://unpkg.com/@aegisjsproject/disposable-registry@1.0.2/",\n "@aegisjsproject/hermes": "https://unpkg.com/@aegisjsproject/hermes@1.0.2/hermes.js",\n "@aegisjsproject/hermes/": "https://unpkg.com/@aegisjsproject/hermes@1.0.2/",\n "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.10/",\n "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",\n "leaflet": "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",\n "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",\n "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.1.0/index.js",\n "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",\n "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",\n "highlight.js/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",\n "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",\n "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",\n "@highlightjs/cdn-assets/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",\n "marked": "https://unpkg.com/marked@18.0.0/lib/marked.esm.js",\n "marked-highlight": "https://unpkg.com/marked-highlight@2.2.4/src/index.js",\n "yaml": "https://unpkg.com/yaml@2.8.3/browser/dist/index.js",\n "yaml/": "https://unpkg.com/yaml@2.8.3/browser/dist/",\n "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",\n "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",\n "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",\n "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",\n "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",\n "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",\n "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",\n "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",\n "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",\n "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",\n "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",\n "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js",\n "qr": "https://unpkg.com/qr@0.5.5/index.js",\n "qr/": "https://unpkg.com/qr@0.5.5/",\n "lit": "https://unpkg.com/lit@3.3.2/index.js",\n "lit/": "https://unpkg.com/lit@3.3.2/",\n "lit-html": "https://unpkg.com/lit-html@3.3.2/lit-html.js",\n "lit-html/": "https://unpkg.com/lit-html@3.3.2/",\n "lit-element": "https://unpkg.com/lit-element@4.2.2/lit-element.js",\n "lit-element/": "https://unpkg.com/lit-element@4.2.2/",\n "@lit/reactive-element": "https://unpkg.com/@lit/reactive-element@2.1.2/reactive-element.js",\n "@lit/reactive-element/": "https://unpkg.com/@lit/reactive-element@2.1.2/",\n "@awesome.me/webawesome/": "https://unpkg.com/@awesome.me/webawesome@3.5.0/",\n "normalize.css": "https://unpkg.com/normalize.css@8.0.1/normalize.css"\n },\n "scopes": {}\n}');
|
|
219
243
|
|
|
220
|
-
|
|
221
|
-
const IMPORTMAP_EXP = /<script\b(?=[^>]*\btype=["']importmap["'])(?:[^>]*?\bnonce=["'](?<nonce>[^"']*)["'])?[^>]*>(?<content>[\s\S]*?)<\/script>/i;
|
|
244
|
+
const IMPORTMAP_EXP = /<script\b(?=[^>]*\btype=["']importmap["'])(?=(?:[^>]*\bnonce=["'](?<nonce>[^"']*)["'])?)(?=(?:[^>]*\bname=["'](?<name>[^"']*)["'])?)[^>]*>(?<content>[\s\S]*?)<\/script>/i;
|
|
222
245
|
|
|
223
246
|
const UNPKG = 'https://unpkg.com/';
|
|
224
247
|
|
|
@@ -323,7 +346,15 @@ async function updateJSON(file) {
|
|
|
323
346
|
return await updateJSON(path_js.getFileURL(file));
|
|
324
347
|
} else if (file instanceof URL && file.protocol === 'file:') {
|
|
325
348
|
const importmap = await json_js.readJSONFile(file);
|
|
326
|
-
|
|
349
|
+
let { updated, imports } = await update(importmap.imports);
|
|
350
|
+
const pkg = await import(undefined('./package.json'));
|
|
351
|
+
const { name, version } = pkg.default;
|
|
352
|
+
const ownURL = new URL(`https://unpkg.com/${name}@${version}/`);
|
|
353
|
+
|
|
354
|
+
if (imports[name + '/'] !== ownURL) {
|
|
355
|
+
updated = true;
|
|
356
|
+
imports[name + '/'] = ownURL;
|
|
357
|
+
}
|
|
327
358
|
|
|
328
359
|
if (updated) {
|
|
329
360
|
await json_js.writeJSONFile(file, { ...importmap, imports: { ...importmap.imports, ...imports }});
|
|
@@ -344,6 +375,10 @@ var unpkg = /*#__PURE__*/Object.freeze({
|
|
|
344
375
|
updateYAML: updateYAML
|
|
345
376
|
});
|
|
346
377
|
|
|
378
|
+
const imports = data.imports;
|
|
379
|
+
const scopes = data.scopes;
|
|
380
|
+
const importmap = new Importmap(data);
|
|
381
|
+
|
|
347
382
|
/**
|
|
348
383
|
* @typedef {Object<string, string>} ImportMapSpecifiers
|
|
349
384
|
*/
|