@shgysk8zer0/importmap 1.7.13 → 1.8.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/index.cjs CHANGED
@@ -7,123 +7,7 @@ var yaml_js = require('@shgysk8zer0/npm-utils/yaml.js');
7
7
  var json_js = require('@shgysk8zer0/npm-utils/json.js');
8
8
  var path_js = require('@shgysk8zer0/npm-utils/path.js');
9
9
 
10
- const imports$1 = {
11
- "@node/": "/node_modules/",
12
- "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.11/",
13
- "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.2/konami.js",
14
- "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.2/browser.min.js",
15
- "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.2/",
16
- "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.20/jwk-utils.min.js",
17
- "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.20/",
18
- "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",
19
- "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",
20
- "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",
21
- "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",
22
- "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",
23
- "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.4/http-status.js",
24
- "@shgysk8zer0/aes-gcm": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.8/aes-gcm.min.js",
25
- "@shgysk8zer0/aes-gcm/": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.8/",
26
- "@shgysk8zer0/squish": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/squish.min.js",
27
- "@shgysk8zer0/squish/": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/",
28
- "@shgysk8zer0/suid": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/suid.min.js",
29
- "@shgysk8zer0/suid/": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/",
30
- "@shgysk8zer0/geoutils": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/geoutils.min.js",
31
- "@shgysk8zer0/geoutils/": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/",
32
- "@shgysk8zer0/core-css/": "https://unpkg.com/@shgysk8zer0/core-css@2.5.4/",
33
- "@shgysk8zer0/signals": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/signals.min.js",
34
- "@shgysk8zer0/signals/": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/",
35
- "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",
36
- "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",
37
- "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.1.5/bundle.min.js",
38
- "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.1.5/",
39
- "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/sanitizer.js",
40
- "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/",
41
- "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.33/core.js",
42
- "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.33/",
43
- "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.2.7/styles.js",
44
- "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.2.7/",
45
- "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.7/component.js",
46
- "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.7/",
47
- "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.6/markdown.min.js",
48
- "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.6/",
49
- "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",
50
- "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
51
- "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.min.js",
52
- "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",
53
- "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.6/",
54
- "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.6/idb.min.js",
55
- "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.1/",
56
- "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/otp.min.js",
57
- "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",
58
- "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",
59
- "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/scanner.min.js",
60
- "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/",
61
- "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.22/",
62
- "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",
63
- "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",
64
- "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.15/router.mjs",
65
- "@aegisjsproject/router/": "https://unpkg.com/@aegisjsproject/router@1.1.15/",
66
- "@aegisjsproject/callback-registry": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.0/callbackRegistry.js",
67
- "@aegisjsproject/callback-registry/": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.0/",
68
- "@aegisjsproject/attempt": "https://unpkg.com/@aegisjsproject/attempt@1.0.5/attempt.js",
69
- "@aegisjsproject/attempt/": "https://unpkg.com/@aegisjsproject/attempt@1.0.5/",
70
- "@aegisjsproject/secret-store": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/commands.min.js",
71
- "@aegisjsproject/commands/": "https://unpkg.com/@aegisjsproject/commands@1.0.1/",
72
- "@aegisjsproject/commands": "https://unpkg.com/@aegisjsproject/commands@1.0.1/commands.min.js",
73
- "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",
74
- "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",
75
- "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/",
76
- "@aegisjsproject/qr-encoder": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/index.min.js",
77
- "@aegisjsproject/qr-encoder/": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/",
78
- "@aegisjsproject/escape": "https://unpkg.com/@aegisjsproject/escape@1.0.4/index.min.js",
79
- "@aegisjsproject/escape/": "https://unpkg.com/@aegisjsproject/escape@1.0.4/",
80
- "@aegisjsproject/disposable": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/disposable.min.js",
81
- "@aegisjsproject/disposable/": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/",
82
- "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",
83
- "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
84
- leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
85
- "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",
86
- "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.1.0/index.js",
87
- "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
88
- "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
89
- "highlight.js/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",
90
- "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
91
- "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
92
- "@highlightjs/cdn-assets/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",
93
- marked: "https://unpkg.com/marked@17.0.3/lib/marked.esm.js",
94
- "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",
95
- yaml: "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",
96
- "yaml/": "https://unpkg.com/yaml@2.8.2/browser/dist/",
97
- "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
98
- "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
99
- "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
100
- "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",
101
- "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",
102
- "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",
103
- "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",
104
- "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",
105
- "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",
106
- "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",
107
- "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
108
- "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js",
109
- qr: "https://unpkg.com/qr@0.5.4/index.js",
110
- "qr/": "https://unpkg.com/qr@0.5.4/",
111
- lit: "https://unpkg.com/lit@3.3.2/index.js",
112
- "lit/": "https://unpkg.com/lit@3.3.2/",
113
- "lit-html": "https://unpkg.com/lit-html@3.3.2/lit-html.js",
114
- "lit-html/": "https://unpkg.com/lit-html@3.3.2/",
115
- "lit-element": "https://unpkg.com/lit-element@4.2.2/lit-element.js",
116
- "lit-element/": "https://unpkg.com/lit-element@4.2.2/",
117
- "@lit/reactive-element": "https://unpkg.com/@lit/reactive-element@2.1.2/reactive-element.js",
118
- "@lit/reactive-element/": "https://unpkg.com/@lit/reactive-element@2.1.2/",
119
- "@awesome.me/webawesome/": "https://unpkg.com/@awesome.me/webawesome@3.2.1/"
120
- };
121
- const scopes$1 = {
122
- };
123
- var json = {
124
- imports: imports$1,
125
- scopes: scopes$1
126
- };
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.2/browser.min.js",\n "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.2/",\n "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.20/jwk-utils.min.js",\n "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.20/",\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.8/aes-gcm.min.js",\n "@shgysk8zer0/aes-gcm/": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.8/",\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@2.5.4/",\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.5/bundle.min.js",\n "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.1.5/",\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.33/core.js",\n "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.33/",\n "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.2.7/styles.js",\n "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.2.7/",\n "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.7/component.js",\n "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.7/",\n "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.6/markdown.min.js",\n "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.6/",\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.1/",\n "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/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.22/",\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.0/callbackRegistry.js",\n "@aegisjsproject/callback-registry/": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.0/",\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.0.1/commands.min.js",\n "@aegisjsproject/commands/": "https://unpkg.com/@aegisjsproject/commands@1.0.1/",\n "@aegisjsproject/commands": "https://unpkg.com/@aegisjsproject/commands@1.0.1/commands.min.js",\n "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",\n "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",\n "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.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 "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",\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@17.0.3/lib/marked.esm.js",\n "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",\n "yaml": "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",\n "yaml/": "https://unpkg.com/yaml@2.8.2/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.4/index.js",\n "qr/": "https://unpkg.com/qr@0.5.4/",\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.2.1/",\n "normalize.css": "https://unpkg.com/normalize.css@8.0.1/normalize.css"\n },\n "scopes": {}\n}');
127
11
 
128
12
  const SHA256 = 'SHA-256';
129
13
  const SHA384 = 'SHA-384';
@@ -333,6 +217,9 @@ class Importmap {
333
217
 
334
218
  const importmap = new Importmap({ imports, scopes });
335
219
 
220
+ // export const IMPORTMAP_EXP = /<script\b(?=[^>]*\btype=["']importmap["'])(?:[^>]*?\bnonce=["'](?<nonce>[^"']*)["'])?[^>]*>[\s\S]*?<\/script>/i;
221
+ const IMPORTMAP_EXP = /<script\b(?=[^>]*\btype=["']importmap["'])(?:[^>]*?\bnonce=["'](?<nonce>[^"']*)["'])?[^>]*>(?<content>[\s\S]*?)<\/script>/i;
222
+
336
223
  const UNPKG = 'https://unpkg.com/';
337
224
 
338
225
  const cache = new Map();
@@ -450,43 +337,135 @@ async function updateJSON(file) {
450
337
  }
451
338
 
452
339
  var unpkg = /*#__PURE__*/Object.freeze({
453
- __proto__: null,
454
- update: update,
455
- updateJSON: updateJSON,
456
- updateUnpkg: updateUnpkg,
457
- updateYAML: updateYAML
340
+ __proto__: null,
341
+ update: update,
342
+ updateJSON: updateJSON,
343
+ updateUnpkg: updateUnpkg,
344
+ updateYAML: updateYAML
458
345
  });
459
346
 
347
+ /**
348
+ * @typedef {Object<string, string>} ImportMapSpecifiers
349
+ */
350
+
351
+ /**
352
+ * @typedef {Object} ImportMap
353
+ * @property {ImportMapSpecifiers} [imports]
354
+ * @property {Object<string, ImportMapSpecifiers>} [scopes]
355
+ */
356
+
357
+ /**
358
+ * @typedef {((this: any, key: string, value: any) => any) | (number | string)[] | null} JSONReplacer
359
+ * @typedef {string | number | null} JSONSpace
360
+ */
361
+
460
362
  const ENCODING = 'utf8';
461
363
 
364
+ /**
365
+ *
366
+ * @param {ImportMap} importmap
367
+ * @returns {ImportMap}
368
+ */
462
369
  function mergeWithImportmap({ imports = {}, scopes = {}}) {
463
370
  return {
464
371
  imports: { ...importmap.imports, ...imports },
465
- scopes: { ...importmap.scope, ...scopes },
372
+ scopes: { ...importmap.scopes, ...scopes },
466
373
  };
467
374
  }
468
375
 
376
+ /**
377
+ * @async
378
+ * @param {string} path
379
+ * @param {object} options
380
+ * @param {ImportMap} [options.importmap]
381
+ * @param {JSONReplacer} [options.replacer=null]
382
+ * @param {JSONSpace} [options.spaces=2]
383
+ * @param {AbortSignal} [options.signal]
384
+ */
469
385
  async function createImportmapJSON(path = 'importmap.json', {
470
386
  importmap = { imports, scopes },
387
+ replacer = null,
471
388
  spaces = 2,
472
389
  signal,
473
390
  } = {}) {
474
- await promises.writeFile(path, JSON.stringify(importmap, null, spaces), { encoding: ENCODING, signal });
391
+ await promises.writeFile(path, JSON.stringify(importmap, replacer, spaces), { encoding: ENCODING, signal });
475
392
  }
476
393
 
394
+ /**
395
+ *
396
+ * @param {object} options
397
+ * @param {ImportMap} [options.importmap]
398
+ * @param {HashAlgorithmIdentifier} [options.algo="SHA-384"]
399
+ * @param {JSONReplacer} [options.replacer=null]
400
+ * @param {JSONSpace} [options.spaces]
401
+ * @param {AbortSignal} [options.signal]
402
+ * @returns {Promise<string>}
403
+ */
477
404
  async function getImportmapIntegrity({
478
405
  importmap = { imports, scopes },
479
406
  algo = DEFAULT_ALGO,
407
+ replacer,
408
+ spaces,
480
409
  } = {}) {
481
- return await sri(JSON.stringify(importmap), { algo });
410
+ return await sri(JSON.stringify(importmap, replacer, spaces), { algo });
482
411
  }
483
412
 
413
+ /**
414
+ *
415
+ * @param {object} options
416
+ * @param {ImportMap} [options.importmap]
417
+ * @param {HashAlgorithmIdentifier} [options.algo="SHA-384"]
418
+ * @param {string} [options.nonce]
419
+ * @param {JSONReplacer} [options.replacer=null]
420
+ * @param {JSONSpace} [options.spaces]
421
+ * @param {AbortSignal} [options.signal]
422
+ * @returns {Promise<string>}
423
+ */
484
424
  async function getImportmapScript({
485
425
  importmap = { imports, scopes },
486
426
  algo = DEFAULT_ALGO,
427
+ nonce = null,
428
+ replacer,
429
+ spaces,
487
430
  } = {}) {
488
- const integrity = await getImportmapIntegrity({ importmap, algo });
489
- return `<script type="importmap" integrity="${integrity}">${JSON.stringify(importmap)}</script>`;
431
+ const integrity = await getImportmapIntegrity({ importmap, algo, replacer, spaces });
432
+
433
+ return typeof nonce === 'string' && nonce.length !== 0
434
+ ? `<script type="importmap" integrity="${integrity}" nonce="${nonce}">${JSON.stringify(importmap, replacer, spaces)}</script>`
435
+ : `<script type="importmap" integrity="${integrity}">${JSON.stringify(importmap, replacer, spaces)}</script>`;
436
+ }
437
+
438
+ /**
439
+ * Updates a `<script type="importmap" from an HTML file, writing the updated file back to disk
440
+ *
441
+ * @param {string} fileName The name of the file to update
442
+ * @param {object} options
443
+ * @param {HashAlgorithmIdentifier} [options.algo="SHA-384"] The algorithm to use for the `integrity` hash
444
+ * @param {ImportMap} [options.importmap] Optional source immportmap object, defaults to library defined importmap
445
+ * @param {JSONReplacer} [options.replacer]
446
+ * @param {JSONSpace} [options.spaces]
447
+ * @param {AbortSignal} [options.signal] Optional `AbortSignal` to abort during the read/write of the file
448
+ * @returns {Promise<boolean>} Whether or not the upate was successful
449
+ */
450
+ async function updateImportmap(fileName = 'index.html', {
451
+ algo = 'SHA-384',
452
+ importmap,
453
+ replacer,
454
+ spaces,
455
+ signal,
456
+ } = {}) {
457
+ signal?.throwIfAborted();
458
+ const file = await promises.readFile(fileName, { encoding: 'utf-8', signal });
459
+ const match = IMPORTMAP_EXP.exec(file);
460
+
461
+ if (Array.isArray(match) && typeof match[0] === 'string') {
462
+ const script = await getImportmapScript({ nonce: match.groups?.nonce, algo, importmap, replacer, spaces });
463
+ await promises.writeFile(fileName, file.replace(match[0], script), { signal });
464
+
465
+ return true;
466
+ } else {
467
+ return false;
468
+ }
490
469
  }
491
470
 
492
471
  exports.ENCODING = ENCODING;
@@ -499,3 +478,4 @@ exports.imports = imports;
499
478
  exports.mergeWithImportmap = mergeWithImportmap;
500
479
  exports.scopes = scopes;
501
480
  exports.unpkg = unpkg;
481
+ exports.updateImportmap = updateImportmap;
package/index.js CHANGED
@@ -5,123 +5,7 @@ import { readYAMLFile, writeYAMLFile } from '@shgysk8zer0/npm-utils/yaml.js';
5
5
  import { readJSONFile, writeJSONFile } from '@shgysk8zer0/npm-utils/json.js';
6
6
  import { getFileURL } from '@shgysk8zer0/npm-utils/path.js';
7
7
 
8
- const imports$1 = {
9
- "@node/": "/node_modules/",
10
- "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.11/",
11
- "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.2/konami.js",
12
- "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.2/browser.min.js",
13
- "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.2/",
14
- "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.20/jwk-utils.min.js",
15
- "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.20/",
16
- "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",
17
- "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",
18
- "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",
19
- "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",
20
- "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",
21
- "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.4/http-status.js",
22
- "@shgysk8zer0/aes-gcm": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.8/aes-gcm.min.js",
23
- "@shgysk8zer0/aes-gcm/": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.8/",
24
- "@shgysk8zer0/squish": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/squish.min.js",
25
- "@shgysk8zer0/squish/": "https://unpkg.com/@shgysk8zer0/squish@1.0.2/",
26
- "@shgysk8zer0/suid": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/suid.min.js",
27
- "@shgysk8zer0/suid/": "https://unpkg.com/@shgysk8zer0/suid@1.0.0/",
28
- "@shgysk8zer0/geoutils": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/geoutils.min.js",
29
- "@shgysk8zer0/geoutils/": "https://unpkg.com/@shgysk8zer0/geoutils@1.0.6/",
30
- "@shgysk8zer0/core-css/": "https://unpkg.com/@shgysk8zer0/core-css@2.5.4/",
31
- "@shgysk8zer0/signals": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/signals.min.js",
32
- "@shgysk8zer0/signals/": "https://unpkg.com/@shgysk8zer0/signals@0.0.3/",
33
- "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",
34
- "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",
35
- "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.1.5/bundle.min.js",
36
- "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.1.5/",
37
- "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/sanitizer.js",
38
- "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.4/",
39
- "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.33/core.js",
40
- "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.33/",
41
- "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.2.7/styles.js",
42
- "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.2.7/",
43
- "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.7/component.js",
44
- "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.7/",
45
- "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.6/markdown.min.js",
46
- "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.6/",
47
- "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",
48
- "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
49
- "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.min.js",
50
- "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",
51
- "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.6/",
52
- "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.6/idb.min.js",
53
- "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.1/",
54
- "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/otp.min.js",
55
- "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",
56
- "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",
57
- "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/scanner.min.js",
58
- "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.2.3/",
59
- "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.22/",
60
- "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",
61
- "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",
62
- "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.15/router.mjs",
63
- "@aegisjsproject/router/": "https://unpkg.com/@aegisjsproject/router@1.1.15/",
64
- "@aegisjsproject/callback-registry": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.0/callbackRegistry.js",
65
- "@aegisjsproject/callback-registry/": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.0/",
66
- "@aegisjsproject/attempt": "https://unpkg.com/@aegisjsproject/attempt@1.0.5/attempt.js",
67
- "@aegisjsproject/attempt/": "https://unpkg.com/@aegisjsproject/attempt@1.0.5/",
68
- "@aegisjsproject/secret-store": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/commands.min.js",
69
- "@aegisjsproject/commands/": "https://unpkg.com/@aegisjsproject/commands@1.0.1/",
70
- "@aegisjsproject/commands": "https://unpkg.com/@aegisjsproject/commands@1.0.1/commands.min.js",
71
- "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",
72
- "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",
73
- "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/",
74
- "@aegisjsproject/qr-encoder": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/index.min.js",
75
- "@aegisjsproject/qr-encoder/": "https://unpkg.com/@aegisjsproject/qr-encoder@1.0.1/",
76
- "@aegisjsproject/escape": "https://unpkg.com/@aegisjsproject/escape@1.0.4/index.min.js",
77
- "@aegisjsproject/escape/": "https://unpkg.com/@aegisjsproject/escape@1.0.4/",
78
- "@aegisjsproject/disposable": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/disposable.min.js",
79
- "@aegisjsproject/disposable/": "https://unpkg.com/@aegisjsproject/disposable@1.0.3/",
80
- "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",
81
- "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
82
- leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
83
- "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",
84
- "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.1.0/index.js",
85
- "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
86
- "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
87
- "highlight.js/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",
88
- "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
89
- "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
90
- "@highlightjs/cdn-assets/styles/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/",
91
- marked: "https://unpkg.com/marked@17.0.3/lib/marked.esm.js",
92
- "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",
93
- yaml: "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",
94
- "yaml/": "https://unpkg.com/yaml@2.8.2/browser/dist/",
95
- "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
96
- "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
97
- "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
98
- "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",
99
- "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",
100
- "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",
101
- "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",
102
- "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",
103
- "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",
104
- "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",
105
- "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
106
- "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js",
107
- qr: "https://unpkg.com/qr@0.5.4/index.js",
108
- "qr/": "https://unpkg.com/qr@0.5.4/",
109
- lit: "https://unpkg.com/lit@3.3.2/index.js",
110
- "lit/": "https://unpkg.com/lit@3.3.2/",
111
- "lit-html": "https://unpkg.com/lit-html@3.3.2/lit-html.js",
112
- "lit-html/": "https://unpkg.com/lit-html@3.3.2/",
113
- "lit-element": "https://unpkg.com/lit-element@4.2.2/lit-element.js",
114
- "lit-element/": "https://unpkg.com/lit-element@4.2.2/",
115
- "@lit/reactive-element": "https://unpkg.com/@lit/reactive-element@2.1.2/reactive-element.js",
116
- "@lit/reactive-element/": "https://unpkg.com/@lit/reactive-element@2.1.2/",
117
- "@awesome.me/webawesome/": "https://unpkg.com/@awesome.me/webawesome@3.2.1/"
118
- };
119
- const scopes$1 = {
120
- };
121
- var json = {
122
- imports: imports$1,
123
- scopes: scopes$1
124
- };
8
+ 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.2/browser.min.js",\n "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.6.2/",\n "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.20/jwk-utils.min.js",\n "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.20/",\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.8/aes-gcm.min.js",\n "@shgysk8zer0/aes-gcm/": "https://unpkg.com/@shgysk8zer0/aes-gcm@1.0.8/",\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@2.5.4/",\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.5/bundle.min.js",\n "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.1.5/",\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.33/core.js",\n "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.33/",\n "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.2.7/styles.js",\n "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.2.7/",\n "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.7/component.js",\n "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.7/",\n "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.6/markdown.min.js",\n "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.6/",\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.1/",\n "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/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.22/",\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.0/callbackRegistry.js",\n "@aegisjsproject/callback-registry/": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.0/",\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.0.1/commands.min.js",\n "@aegisjsproject/commands/": "https://unpkg.com/@aegisjsproject/commands@1.0.1/",\n "@aegisjsproject/commands": "https://unpkg.com/@aegisjsproject/commands@1.0.1/commands.min.js",\n "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",\n "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",\n "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.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 "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",\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@17.0.3/lib/marked.esm.js",\n "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",\n "yaml": "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",\n "yaml/": "https://unpkg.com/yaml@2.8.2/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.4/index.js",\n "qr/": "https://unpkg.com/qr@0.5.4/",\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.2.1/",\n "normalize.css": "https://unpkg.com/normalize.css@8.0.1/normalize.css"\n },\n "scopes": {}\n}');
125
9
 
126
10
  const SHA256 = 'SHA-256';
127
11
  const SHA384 = 'SHA-384';
@@ -331,6 +215,9 @@ class Importmap {
331
215
 
332
216
  const importmap = new Importmap({ imports, scopes });
333
217
 
218
+ // export const IMPORTMAP_EXP = /<script\b(?=[^>]*\btype=["']importmap["'])(?:[^>]*?\bnonce=["'](?<nonce>[^"']*)["'])?[^>]*>[\s\S]*?<\/script>/i;
219
+ const IMPORTMAP_EXP = /<script\b(?=[^>]*\btype=["']importmap["'])(?:[^>]*?\bnonce=["'](?<nonce>[^"']*)["'])?[^>]*>(?<content>[\s\S]*?)<\/script>/i;
220
+
334
221
  const UNPKG = 'https://unpkg.com/';
335
222
 
336
223
  const cache = new Map();
@@ -448,43 +335,135 @@ async function updateJSON(file) {
448
335
  }
449
336
 
450
337
  var unpkg = /*#__PURE__*/Object.freeze({
451
- __proto__: null,
452
- update: update,
453
- updateJSON: updateJSON,
454
- updateUnpkg: updateUnpkg,
455
- updateYAML: updateYAML
338
+ __proto__: null,
339
+ update: update,
340
+ updateJSON: updateJSON,
341
+ updateUnpkg: updateUnpkg,
342
+ updateYAML: updateYAML
456
343
  });
457
344
 
345
+ /**
346
+ * @typedef {Object<string, string>} ImportMapSpecifiers
347
+ */
348
+
349
+ /**
350
+ * @typedef {Object} ImportMap
351
+ * @property {ImportMapSpecifiers} [imports]
352
+ * @property {Object<string, ImportMapSpecifiers>} [scopes]
353
+ */
354
+
355
+ /**
356
+ * @typedef {((this: any, key: string, value: any) => any) | (number | string)[] | null} JSONReplacer
357
+ * @typedef {string | number | null} JSONSpace
358
+ */
359
+
458
360
  const ENCODING = 'utf8';
459
361
 
362
+ /**
363
+ *
364
+ * @param {ImportMap} importmap
365
+ * @returns {ImportMap}
366
+ */
460
367
  function mergeWithImportmap({ imports = {}, scopes = {}}) {
461
368
  return {
462
369
  imports: { ...importmap.imports, ...imports },
463
- scopes: { ...importmap.scope, ...scopes },
370
+ scopes: { ...importmap.scopes, ...scopes },
464
371
  };
465
372
  }
466
373
 
374
+ /**
375
+ * @async
376
+ * @param {string} path
377
+ * @param {object} options
378
+ * @param {ImportMap} [options.importmap]
379
+ * @param {JSONReplacer} [options.replacer=null]
380
+ * @param {JSONSpace} [options.spaces=2]
381
+ * @param {AbortSignal} [options.signal]
382
+ */
467
383
  async function createImportmapJSON(path = 'importmap.json', {
468
384
  importmap = { imports, scopes },
385
+ replacer = null,
469
386
  spaces = 2,
470
387
  signal,
471
388
  } = {}) {
472
- await writeFile(path, JSON.stringify(importmap, null, spaces), { encoding: ENCODING, signal });
389
+ await writeFile(path, JSON.stringify(importmap, replacer, spaces), { encoding: ENCODING, signal });
473
390
  }
474
391
 
392
+ /**
393
+ *
394
+ * @param {object} options
395
+ * @param {ImportMap} [options.importmap]
396
+ * @param {HashAlgorithmIdentifier} [options.algo="SHA-384"]
397
+ * @param {JSONReplacer} [options.replacer=null]
398
+ * @param {JSONSpace} [options.spaces]
399
+ * @param {AbortSignal} [options.signal]
400
+ * @returns {Promise<string>}
401
+ */
475
402
  async function getImportmapIntegrity({
476
403
  importmap = { imports, scopes },
477
404
  algo = DEFAULT_ALGO,
405
+ replacer,
406
+ spaces,
478
407
  } = {}) {
479
- return await sri(JSON.stringify(importmap), { algo });
408
+ return await sri(JSON.stringify(importmap, replacer, spaces), { algo });
480
409
  }
481
410
 
411
+ /**
412
+ *
413
+ * @param {object} options
414
+ * @param {ImportMap} [options.importmap]
415
+ * @param {HashAlgorithmIdentifier} [options.algo="SHA-384"]
416
+ * @param {string} [options.nonce]
417
+ * @param {JSONReplacer} [options.replacer=null]
418
+ * @param {JSONSpace} [options.spaces]
419
+ * @param {AbortSignal} [options.signal]
420
+ * @returns {Promise<string>}
421
+ */
482
422
  async function getImportmapScript({
483
423
  importmap = { imports, scopes },
484
424
  algo = DEFAULT_ALGO,
425
+ nonce = null,
426
+ replacer,
427
+ spaces,
485
428
  } = {}) {
486
- const integrity = await getImportmapIntegrity({ importmap, algo });
487
- return `<script type="importmap" integrity="${integrity}">${JSON.stringify(importmap)}</script>`;
429
+ const integrity = await getImportmapIntegrity({ importmap, algo, replacer, spaces });
430
+
431
+ return typeof nonce === 'string' && nonce.length !== 0
432
+ ? `<script type="importmap" integrity="${integrity}" nonce="${nonce}">${JSON.stringify(importmap, replacer, spaces)}</script>`
433
+ : `<script type="importmap" integrity="${integrity}">${JSON.stringify(importmap, replacer, spaces)}</script>`;
434
+ }
435
+
436
+ /**
437
+ * Updates a `<script type="importmap" from an HTML file, writing the updated file back to disk
438
+ *
439
+ * @param {string} fileName The name of the file to update
440
+ * @param {object} options
441
+ * @param {HashAlgorithmIdentifier} [options.algo="SHA-384"] The algorithm to use for the `integrity` hash
442
+ * @param {ImportMap} [options.importmap] Optional source immportmap object, defaults to library defined importmap
443
+ * @param {JSONReplacer} [options.replacer]
444
+ * @param {JSONSpace} [options.spaces]
445
+ * @param {AbortSignal} [options.signal] Optional `AbortSignal` to abort during the read/write of the file
446
+ * @returns {Promise<boolean>} Whether or not the upate was successful
447
+ */
448
+ async function updateImportmap(fileName = 'index.html', {
449
+ algo = 'SHA-384',
450
+ importmap,
451
+ replacer,
452
+ spaces,
453
+ signal,
454
+ } = {}) {
455
+ signal?.throwIfAborted();
456
+ const file = await readFile(fileName, { encoding: 'utf-8', signal });
457
+ const match = IMPORTMAP_EXP.exec(file);
458
+
459
+ if (Array.isArray(match) && typeof match[0] === 'string') {
460
+ const script = await getImportmapScript({ nonce: match.groups?.nonce, algo, importmap, replacer, spaces });
461
+ await writeFile(fileName, file.replace(match[0], script), { signal });
462
+
463
+ return true;
464
+ } else {
465
+ return false;
466
+ }
488
467
  }
489
468
 
490
- export { ENCODING, Importmap, createImportmapJSON, getImportmapIntegrity, getImportmapScript, importmap, imports, mergeWithImportmap, scopes, unpkg };
469
+ export { ENCODING, Importmap, createImportmapJSON, getImportmapIntegrity, getImportmapScript, importmap, imports, mergeWithImportmap, scopes, unpkg, updateImportmap };