@shgysk8zer0/importmap 1.8.0 → 1.8.2

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.js CHANGED
@@ -5,124 +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.7/attempt.js",
67
- "@aegisjsproject/attempt/": "https://unpkg.com/@aegisjsproject/attempt@1.0.7/",
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
- "normalize.css": "https://unpkg.com/normalize.css@8.0.1/normalize.css"
119
- };
120
- const scopes$1 = {
121
- };
122
- var json = {
123
- imports: imports$1,
124
- scopes: scopes$1
125
- };
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.5/",\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.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.2/callbackRegistry.js",\n "@aegisjsproject/callback-registry/": "https://unpkg.com/@aegisjsproject/callback-registry@2.0.2/",\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.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.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 "@aegisjsproject/iota": "https://unpkg.com/@aegisjsproject/iota@1.0.2/iota.min.js",\n "@aegisjsproject/iota/": "https://unpkg.com/@aegisjsproject/iota@1.0.2/",\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.4/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.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.3.1/",\n "normalize.css": "https://unpkg.com/normalize.css@8.0.1/normalize.css"\n },\n "scopes": {}\n}');
126
9
 
127
10
  const SHA256 = 'SHA-256';
128
11
  const SHA384 = 'SHA-384';
@@ -332,6 +215,9 @@ class Importmap {
332
215
 
333
216
  const importmap = new Importmap({ imports, scopes });
334
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
+
335
221
  const UNPKG = 'https://unpkg.com/';
336
222
 
337
223
  const cache = new Map();
@@ -449,43 +335,135 @@ async function updateJSON(file) {
449
335
  }
450
336
 
451
337
  var unpkg = /*#__PURE__*/Object.freeze({
452
- __proto__: null,
453
- update: update,
454
- updateJSON: updateJSON,
455
- updateUnpkg: updateUnpkg,
456
- updateYAML: updateYAML
338
+ __proto__: null,
339
+ update: update,
340
+ updateJSON: updateJSON,
341
+ updateUnpkg: updateUnpkg,
342
+ updateYAML: updateYAML
457
343
  });
458
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
+
459
360
  const ENCODING = 'utf8';
460
361
 
362
+ /**
363
+ *
364
+ * @param {ImportMap} importmap
365
+ * @returns {ImportMap}
366
+ */
461
367
  function mergeWithImportmap({ imports = {}, scopes = {}}) {
462
368
  return {
463
369
  imports: { ...importmap.imports, ...imports },
464
- scopes: { ...importmap.scope, ...scopes },
370
+ scopes: { ...importmap.scopes, ...scopes },
465
371
  };
466
372
  }
467
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
+ */
468
383
  async function createImportmapJSON(path = 'importmap.json', {
469
384
  importmap = { imports, scopes },
385
+ replacer = null,
470
386
  spaces = 2,
471
387
  signal,
472
388
  } = {}) {
473
- await writeFile(path, JSON.stringify(importmap, null, spaces), { encoding: ENCODING, signal });
389
+ await writeFile(path, JSON.stringify(importmap, replacer, spaces), { encoding: ENCODING, signal });
474
390
  }
475
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
+ */
476
402
  async function getImportmapIntegrity({
477
403
  importmap = { imports, scopes },
478
404
  algo = DEFAULT_ALGO,
405
+ replacer,
406
+ spaces,
479
407
  } = {}) {
480
- return await sri(JSON.stringify(importmap), { algo });
408
+ return await sri(JSON.stringify(importmap, replacer, spaces), { algo });
481
409
  }
482
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
+ */
483
422
  async function getImportmapScript({
484
423
  importmap = { imports, scopes },
485
424
  algo = DEFAULT_ALGO,
425
+ nonce = null,
426
+ replacer,
427
+ spaces,
486
428
  } = {}) {
487
- const integrity = await getImportmapIntegrity({ importmap, algo });
488
- 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
+ }
489
467
  }
490
468
 
491
- export { ENCODING, Importmap, createImportmapJSON, getImportmapIntegrity, getImportmapScript, importmap, imports, mergeWithImportmap, scopes, unpkg };
469
+ export { ENCODING, Importmap, createImportmapJSON, getImportmapIntegrity, getImportmapScript, importmap, imports, mergeWithImportmap, scopes, unpkg, updateImportmap };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgysk8zer0/importmap",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "engines": {
5
5
  "node": ">=20.10.0"
6
6
  },
@@ -17,6 +17,9 @@
17
17
  "./importmap": {
18
18
  "import": "./importmap.js"
19
19
  },
20
+ "./*.json": {
21
+ "import": "./*.json"
22
+ },
20
23
  "./*.js": {
21
24
  "import": "./*.js",
22
25
  "require": "./*.cjs"
@@ -33,7 +36,8 @@
33
36
  }
34
37
  },
35
38
  "bin": {
36
- "importmap-utils": "./cli.mjs"
39
+ "importmap-utils": "cli.js",
40
+ "importmap-html": "html.js"
37
41
  },
38
42
  "scripts": {
39
43
  "start": "npx @shgysk8zer0/http-server -c ./http.config.js",
@@ -64,11 +68,10 @@
64
68
  },
65
69
  "homepage": "https://github.com/shgysk8zer0/importmap#readme",
66
70
  "devDependencies": {
67
- "@rollup/plugin-json": "^6.1.0",
68
71
  "@shgysk8zer0/eslint-config": "^1.0.7",
69
- "@shgysk8zer0/js-utils": "^1.0.3",
70
- "@shgysk8zer0/rollup-import": "^2.0.2",
71
- "eslint": "^10.0.2"
72
+ "@shgysk8zer0/js-utils": "^1.0.5",
73
+ "@shgysk8zer0/rollup-import": "^2.0.3",
74
+ "eslint": "^10.0.3"
72
75
  },
73
76
  "dependencies": {
74
77
  "@shgysk8zer0/npm-utils": "^1.1.4",
package/cli.mjs DELETED
@@ -1,81 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { readJSONFile, writeJSONFile } from '@shgysk8zer0/npm-utils/json.js';
4
- import { readYAMLFile, writeYAMLFile } from '@shgysk8zer0/npm-utils/yaml.js';
5
- import { program } from 'commander';
6
- import { extname } from 'node:path';
7
- import { importmap } from './index.mjs';
8
- // import { updateImportMap } from './html.js';
9
-
10
- function guessFileType(file) {
11
- const ext = extname(file).toLowerCase();
12
-
13
- switch(ext) {
14
- case '.yml':
15
- case '.yaml':
16
- return 'yaml';
17
-
18
- case '.json':
19
- return 'json';
20
-
21
- case '.html':
22
- return 'html';
23
-
24
- default:
25
- throw new TypeError(`"${ext}" is not a supported file extension for file ${file}.`);
26
- }
27
- }
28
-
29
- async function parse(file, { encoding, signal } = {}) {
30
- switch(guessFileType(file)) {
31
- case 'yaml':
32
- return readYAMLFile(file, { encoding, signal });
33
-
34
- case 'json':
35
- return readJSONFile(file, { encoding, signal });
36
-
37
- }
38
- }
39
-
40
- async function init() {
41
- const { version: VERSION } = await readJSONFile(new URL('./package.json', import.meta.url));
42
-
43
- program
44
- .name('importmap-utils')
45
- .version(VERSION)
46
- .description('CLI utility for updating importmap files')
47
- .option('-i, --input [input]', 'local JSON or YAML importmap file')
48
- .option('-e, --encoding [encoding]', 'encoding', 'utf8')
49
- .option('-f, --format [format]', 'output format') // Migrate opt
50
- .option('-o, --output <output>', 'output file')
51
- .parse(process.argv);
52
-
53
- return {
54
- args: program.args,
55
- opts: program.opts(),
56
- };
57
- }
58
-
59
- init().then(async ({ opts: { input, encoding, format, output }}) => {
60
- const mod = typeof input === 'string'
61
- ? await parse(input, { encoding }).then(({ imports, scope = {}, ...rest }) => ({
62
- ...rest,
63
- imports: { ...imports, ...importmap.imports },
64
- scope: { ...scope, ...importmap.scope },
65
- }))
66
- : importmap;
67
-
68
- switch(format ?? guessFileType(output)) {
69
- case 'json':
70
- await writeJSONFile(output, mod, { encoding });
71
- break;
72
-
73
- case 'yaml':
74
- await writeYAMLFile(output, mod, { encoding });
75
- break;
76
-
77
- // case 'html':
78
- // await updateImportMap(output, { spaces: null });
79
- // break;
80
- }
81
- });